RED-9887: fixed save button being disabled.

This commit is contained in:
Nicoleta Panaghiu 2024-08-28 13:22:37 +03:00
parent 43830f463d
commit db1257751a
2 changed files with 10 additions and 9 deletions

View File

@ -54,7 +54,7 @@
<div class="editing-actions">
<iqser-icon-button
(action)="save()"
[disabled]="disabled()"
[disabled]="disabled"
[label]="'component-management.actions.save' | translate"
[type]="iconButtonTypes.primary"
></iqser-icon-button>

View File

@ -48,14 +48,6 @@ export class EditableStructuredComponentValueComponent implements OnInit {
protected entryLabel: string;
protected editing = false;
protected initialEntry: IComponentLogEntry;
disabled = computed(() => {
for (let i = 0; i < this.currentEntry().componentValues.length; i++) {
if (this.currentEntry().componentValues[i].value !== this.initialEntry.componentValues[i]?.value) {
return false;
}
}
return this.currentEntry().componentValues.length === this.initialEntry.componentValues.length;
});
protected readonly iconButtonTypes = IconButtonTypes;
constructor(
@ -64,6 +56,15 @@ export class EditableStructuredComponentValueComponent implements OnInit {
private readonly _state: FilePreviewStateService,
) {}
get disabled() {
for (let i = 0; i < this.currentEntry().componentValues.length; i++) {
if (this.currentEntry().componentValues[i].value !== this.initialEntry.componentValues[i]?.value) {
return false;
}
}
return this.currentEntry().componentValues.length === this.initialEntry.componentValues.length;
}
get #initialEntry() {
return JSON.parse(JSON.stringify(this.entry()));
}