@valtimo/components 13.51.0 → 13.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10894,15 +10894,19 @@ class FormioComponent {
10894
10894
  this.options$.next(optionsValue);
10895
10895
  }
10896
10896
  set submission(submissionValue) {
10897
+ this.releaseSubmit();
10897
10898
  this.submission$.next(submissionValue);
10898
10899
  }
10899
10900
  set form(formValue) {
10901
+ this.releaseSubmit();
10900
10902
  this._form$.next(formValue);
10901
10903
  }
10902
10904
  set readOnly(readOnlyValue) {
10903
10905
  this.readOnly$.next(readOnlyValue);
10904
10906
  }
10905
10907
  set errors(errorsValue) {
10908
+ if (errorsValue?.length)
10909
+ this.failSubmit();
10906
10910
  this.errors$.next(errorsValue ?? []);
10907
10911
  }
10908
10912
  handleBeforeUnload() {
@@ -10920,6 +10924,7 @@ class FormioComponent {
10920
10924
  this.tagsService = tagsService;
10921
10925
  this.injector = injector;
10922
10926
  this.formioTranslationService = formioTranslationService;
10927
+ this.preventDoubleSubmit = false;
10923
10928
  // eslint-disable-next-line @angular-eslint/no-output-native
10924
10929
  this.submit = new EventEmitter();
10925
10930
  // eslint-disable-next-line @angular-eslint/no-output-native
@@ -10961,6 +10966,8 @@ class FormioComponent {
10961
10966
  this.tokenReady$ = this._storeTokenInLocalStorage
10962
10967
  ? this.localStorageService.tokenSetInLocalStorage$
10963
10968
  : this._inMemoryTokenSet$.asObservable();
10969
+ this._formioSource = null;
10970
+ this._submitting = false;
10964
10971
  this._subscriptions = new Subscription();
10965
10972
  this._tokenTimerSubscription = new Subscription();
10966
10973
  this.setOverrideOptions(this.configService.config);
@@ -10990,13 +10997,22 @@ class FormioComponent {
10990
10997
  this.localStorageService.clearTokenFromLocalStorage();
10991
10998
  }
10992
10999
  showErrors(errors) {
11000
+ this.failSubmit();
10993
11001
  this.errors$.next(errors);
10994
11002
  }
10995
11003
  onSubmit(submission) {
11004
+ if (this._submitting)
11005
+ return;
11006
+ if (this.preventDoubleSubmit && this.submit.observed)
11007
+ this._submitting = true;
10996
11008
  this.errors$.next([]);
10997
11009
  this.submit.emit(submission);
10998
11010
  }
11011
+ releaseSubmit() {
11012
+ this._submitting = false;
11013
+ }
10999
11014
  formReady(form) {
11015
+ this._formioSource = form;
11000
11016
  this.stateService.currentForm = form;
11001
11017
  }
11002
11018
  onChange(object) {
@@ -11011,6 +11027,12 @@ class FormioComponent {
11011
11027
  prevPage() {
11012
11028
  this.scrollToTop();
11013
11029
  }
11030
+ failSubmit() {
11031
+ if (!this._submitting)
11032
+ return;
11033
+ this.releaseSubmit();
11034
+ this._formioSource?.formio?.emit('submitError', '');
11035
+ }
11014
11036
  openReloadFormSubscription() {
11015
11037
  this._subscriptions.add(this.form$.subscribe(form => {
11016
11038
  this.refreshForm.emit({
@@ -11091,7 +11113,7 @@ class FormioComponent {
11091
11113
  this._overrideOptions$.next(config.formioOptions);
11092
11114
  }
11093
11115
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormioComponent, deps: [{ token: i6$1.UserProviderService }, { token: i4.NGXLogger }, { token: FormIoStateService }, { token: i1$3.ActivatedRoute }, { token: i1.TranslateService }, { token: FormIoLocalStorageService }, { token: ValtimoModalService }, { token: i1$2.ConfigService }, { token: FormIoTagsService }, { token: i0.Injector }, { token: FormioTranslationService }], target: i0.ɵɵFactoryTarget.Component }); }
11094
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormioComponent, isStandalone: false, selector: "valtimo-form-io", inputs: { options: "options", submission: "submission", form: "form", readOnly: "readOnly", errors: "errors", formRefresh$: "formRefresh$" }, outputs: { submit: "submit", change: "change", event: "event" }, host: { listeners: { "window:beforeunload": "handleBeforeUnload($event)" } }, providers: [FormIoLocalStorageService], usesOnChanges: true, ngImport: i0, template: "<!--\n ~ Copyright 2015-2025 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div\n class=\"formio-carbon\"\n cdsLayer=\"1\"\n *ngIf=\"{\n currentLanguage: currentLanguage$ | async,\n formioOptions: formioOptions$ | async,\n renderOptions: renderOptions$ | async,\n submission: submission$ | async,\n readOnly: readOnly$ | async,\n form: form$ | async,\n errors: errors$ | async,\n tokenReady: tokenReady$ | async,\n } as obs\"\n>\n <div *ngIf=\"obs.errors.length > 0\" class=\"alert alert-danger pt-5 pb-5 mb-2\">\n <ol>\n <li *ngFor=\"let error of obs.errors\">\n {{ error }}\n </li>\n </ol>\n </div>\n\n <formio\n *ngIf=\"obs.formioOptions && obs.form && obs.tokenReady\"\n [form]=\"obs.form\"\n [language]=\"languageEventEmitter\"\n [options]=\"obs.formioOptions\"\n [readOnly]=\"obs.readOnly\"\n [refresh]=\"refreshForm\"\n [renderOptions]=\"obs.renderOptions\"\n [submission]=\"obs.submission\"\n (change)=\"onChange($event)\"\n (nextPage)=\"nextPage()\"\n (prevPage)=\"prevPage()\"\n (ready)=\"formReady($event)\"\n (submit)=\"onSubmit($event)\"\n (customEvent)=\"onCustomEvent($event)\"\n ></formio>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1$4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i9.FormioComponent, selector: "formio" }, { kind: "directive", type: i2$3.LayerDirective, selector: "[cdsLayer], [ibmLayer]", inputs: ["ibmLayer", "cdsLayer"], exportAs: ["layer"] }, { kind: "pipe", type: i1$4.AsyncPipe, name: "async" }] }); }
11116
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormioComponent, isStandalone: false, selector: "valtimo-form-io", inputs: { options: "options", submission: "submission", form: "form", readOnly: "readOnly", errors: "errors", formRefresh$: "formRefresh$", preventDoubleSubmit: "preventDoubleSubmit" }, outputs: { submit: "submit", change: "change", event: "event" }, host: { listeners: { "window:beforeunload": "handleBeforeUnload($event)" } }, providers: [FormIoLocalStorageService], usesOnChanges: true, ngImport: i0, template: "<!--\n ~ Copyright 2015-2025 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div\n class=\"formio-carbon\"\n cdsLayer=\"1\"\n *ngIf=\"{\n currentLanguage: currentLanguage$ | async,\n formioOptions: formioOptions$ | async,\n renderOptions: renderOptions$ | async,\n submission: submission$ | async,\n readOnly: readOnly$ | async,\n form: form$ | async,\n errors: errors$ | async,\n tokenReady: tokenReady$ | async,\n } as obs\"\n>\n <div *ngIf=\"obs.errors.length > 0\" class=\"alert alert-danger pt-5 pb-5 mb-2\">\n <ol>\n <li *ngFor=\"let error of obs.errors\">\n {{ error }}\n </li>\n </ol>\n </div>\n\n <formio\n *ngIf=\"obs.formioOptions && obs.form && obs.tokenReady\"\n [form]=\"obs.form\"\n [language]=\"languageEventEmitter\"\n [options]=\"obs.formioOptions\"\n [readOnly]=\"obs.readOnly\"\n [refresh]=\"refreshForm\"\n [renderOptions]=\"obs.renderOptions\"\n [submission]=\"obs.submission\"\n (change)=\"onChange($event)\"\n (nextPage)=\"nextPage()\"\n (prevPage)=\"prevPage()\"\n (ready)=\"formReady($event)\"\n (submit)=\"onSubmit($event)\"\n (customEvent)=\"onCustomEvent($event)\"\n ></formio>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1$4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i9.FormioComponent, selector: "formio" }, { kind: "directive", type: i2$3.LayerDirective, selector: "[cdsLayer], [ibmLayer]", inputs: ["ibmLayer", "cdsLayer"], exportAs: ["layer"] }, { kind: "pipe", type: i1$4.AsyncPipe, name: "async" }] }); }
11095
11117
  }
11096
11118
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormioComponent, decorators: [{
11097
11119
  type: Component,
@@ -11108,6 +11130,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
11108
11130
  type: Input
11109
11131
  }], formRefresh$: [{
11110
11132
  type: Input
11133
+ }], preventDoubleSubmit: [{
11134
+ type: Input
11111
11135
  }], submit: [{
11112
11136
  type: Output
11113
11137
  }], change: [{