|
|
|
@ -109,6 +109,7 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni |
|
|
|
private datasources: Array<Datasource>; |
|
|
|
private destroy$ = new Subject(); |
|
|
|
public sources: Array<MultipleInputWidgetSource> = []; |
|
|
|
private isSavingInProgress = false; |
|
|
|
|
|
|
|
isVerticalAlignment: boolean; |
|
|
|
inputWidthSettings: string; |
|
|
|
@ -468,7 +469,8 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni |
|
|
|
} |
|
|
|
|
|
|
|
public inputChanged(source: MultipleInputWidgetSource, key: MultipleInputWidgetDataKey) { |
|
|
|
if (!this.settings.showActionButtons) { |
|
|
|
if (!this.settings.showActionButtons && !this.isSavingInProgress) { |
|
|
|
this.isSavingInProgress = true; |
|
|
|
const currentValue = this.multipleInputFormGroup.get(key.formId).value; |
|
|
|
if (!key.settings.required || (key.settings.required && isDefined(currentValue))) { |
|
|
|
const dataToSave: MultipleInputWidgetSource = { |
|
|
|
@ -481,7 +483,8 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni |
|
|
|
} |
|
|
|
|
|
|
|
public save(dataToSave?: MultipleInputWidgetSource) { |
|
|
|
if (document && document.activeElement) { |
|
|
|
if (document?.activeElement && !this.isSavingInProgress) { |
|
|
|
this.isSavingInProgress = true; |
|
|
|
(document.activeElement as HTMLElement).blur(); |
|
|
|
} |
|
|
|
const config: RequestConfig = { |
|
|
|
@ -571,12 +574,14 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni |
|
|
|
() => { |
|
|
|
this.multipleInputFormGroup.markAsPristine(); |
|
|
|
this.ctx.detectChanges(); |
|
|
|
this.isSavingInProgress = false; |
|
|
|
if (this.settings.showResultMessage) { |
|
|
|
this.ctx.showSuccessToast(this.translate.instant('widgets.input-widgets.update-successful'), |
|
|
|
1000, 'bottom', 'left', this.toastTargetId); |
|
|
|
} |
|
|
|
}, |
|
|
|
() => { |
|
|
|
this.isSavingInProgress = false; |
|
|
|
if (this.settings.showResultMessage) { |
|
|
|
this.ctx.showErrorToast(this.translate.instant('widgets.input-widgets.update-failed'), |
|
|
|
'bottom', 'left', this.toastTargetId); |
|
|
|
@ -585,6 +590,7 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni |
|
|
|
} else { |
|
|
|
this.multipleInputFormGroup.markAsPristine(); |
|
|
|
this.ctx.detectChanges(); |
|
|
|
this.isSavingInProgress = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|