refactor: Verwende GUID anstelle des Konstruktor-Namens für Button-Sichtbarkeit; Webanwendung im wwwroot aktualisiert
- Ersetzt die Nutzung des Konstruktor-Namens durch eine GUID (`id`) in der `BaseButtonService`-Klasse, um Button-Sichtbarkeitsprobleme zu beheben. - Aktualisiert die `ButtonVisibilityService`-Klasse zur Verwendung der GUIDs zur Identifikation von Buttons. - Webanwendung im `wwwroot`-Verzeichnis auf den neuesten Stand gebracht.
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
import { Injectable, inject } from "@angular/core";
|
||||
import { ButtonVisibilityService } from "./button-visibility.service";
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
export class BaseButtonService {
|
||||
|
||||
readonly id = uuidv4().toString();
|
||||
|
||||
constructor() {
|
||||
const bvService = inject(ButtonVisibilityService);
|
||||
bvService.buttons[this.constructorName] = this;
|
||||
bvService.buttons[this.id] = this;
|
||||
}
|
||||
|
||||
public isVisible: boolean = true;
|
||||
|
||||
public get constructorName() {
|
||||
return this.constructor.name;
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export class ButtonVisibilityService {
|
||||
}
|
||||
|
||||
setVisibleOnly(...buttons: BaseButtonService[]) {
|
||||
const keys = buttons.map(b => b.constructorName)
|
||||
const keys = buttons.map(b => b.id)
|
||||
for (const key in this._buttons) {
|
||||
if (keys.includes(key)) {
|
||||
this.setVisibility(key, true)
|
||||
|
||||
Reference in New Issue
Block a user