@klippa/ngx-enhancy-forms 14.7.8 → 14.7.9
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.
- package/esm2020/lib/form/form.component.mjs +20 -1
- package/fesm2015/klippa-ngx-enhancy-forms.mjs +20 -1
- package/fesm2015/klippa-ngx-enhancy-forms.mjs.map +1 -1
- package/fesm2020/klippa-ngx-enhancy-forms.mjs +19 -0
- package/fesm2020/klippa-ngx-enhancy-forms.mjs.map +1 -1
- package/lib/form/form.component.d.ts +1 -0
- package/package.json +1 -1
|
@@ -282,6 +282,25 @@ class FormComponent {
|
|
|
282
282
|
const formGroupValue = this.formGroup.value;
|
|
283
283
|
const renderedAndEnabledValues = this.getRenderedFieldValuesFormGroup(this.formGroup, true);
|
|
284
284
|
const renderedButDisabledValues = this.getRenderedFieldValuesFormGroup(this.formGroup, false);
|
|
285
|
+
return new Promise((resolve, reject) => {
|
|
286
|
+
if (this.formGroup.pending) {
|
|
287
|
+
const sub = this.formGroup.statusChanges.subscribe((res) => {
|
|
288
|
+
if (res !== 'PENDING') {
|
|
289
|
+
sub.unsubscribe();
|
|
290
|
+
this.handleSubmission(originalDisabledStates, renderedAndEnabledValues, renderedButDisabledValues, formGroupValue)
|
|
291
|
+
.then(resolve)
|
|
292
|
+
.catch(reject);
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
this.handleSubmission(originalDisabledStates, renderedAndEnabledValues, renderedButDisabledValues, formGroupValue)
|
|
298
|
+
.then(resolve)
|
|
299
|
+
.catch(reject);
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
handleSubmission(originalDisabledStates, renderedAndEnabledValues, renderedButDisabledValues, formGroupValue) {
|
|
285
304
|
if (this.formGroup.invalid) {
|
|
286
305
|
this.activeControls.find((e) => !e.formControl.valid)?.formElement?.scrollTo();
|
|
287
306
|
this.setDisabledStatesForAllControls(originalDisabledStates);
|