ui-core-abv 0.8.6 → 0.8.7
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/fesm2022/ui-core-abv.mjs
CHANGED
|
@@ -4830,6 +4830,11 @@ class UicFormWrapperComponent {
|
|
|
4830
4830
|
externalValidationStates = {};
|
|
4831
4831
|
externalValidationSubs = new Map();
|
|
4832
4832
|
externalValidationLastValue = new Map();
|
|
4833
|
+
immediateExternalValidationValueByField = new Map();
|
|
4834
|
+
immediateValidationFieldTypes = new Set([
|
|
4835
|
+
'date', 'time', 'select', 'radio', 'checkbox', 'switch',
|
|
4836
|
+
'pool', 'file', 'multyselect', 'searcher', 'slider'
|
|
4837
|
+
]);
|
|
4833
4838
|
formValueSub = null;
|
|
4834
4839
|
optionSourceSubs = new Map();
|
|
4835
4840
|
optionSourceDependencyValueByField = new Map();
|
|
@@ -4984,12 +4989,14 @@ class UicFormWrapperComponent {
|
|
|
4984
4989
|
this.formValueSub = newForm.valueChanges.subscribe(() => {
|
|
4985
4990
|
this.normalizeNumericControls(newForm, numericFields);
|
|
4986
4991
|
this.cancelStaleExternalValidations();
|
|
4992
|
+
this.validateChangedImmediateFields();
|
|
4987
4993
|
this.handleFormChange();
|
|
4988
4994
|
this.updateDependentOptionsSources();
|
|
4989
4995
|
this.resolveComputedFields();
|
|
4990
4996
|
});
|
|
4991
4997
|
this.form = newForm;
|
|
4992
4998
|
this.clearExternalValidationSubs();
|
|
4999
|
+
this.initializeImmediateExternalValidationValues();
|
|
4993
5000
|
this.externalValidationStates = {};
|
|
4994
5001
|
this.optionSourceDependencyValueByField.clear();
|
|
4995
5002
|
this.updateDisabledState();
|
|
@@ -5470,6 +5477,26 @@ class UicFormWrapperComponent {
|
|
|
5470
5477
|
});
|
|
5471
5478
|
this.externalValidationSubs.set(fieldName, sub);
|
|
5472
5479
|
}
|
|
5480
|
+
initializeImmediateExternalValidationValues() {
|
|
5481
|
+
this.immediateExternalValidationValueByField.clear();
|
|
5482
|
+
for (const field of this.collectAllFields()) {
|
|
5483
|
+
if (!field.externalValidation?.key || !this.immediateValidationFieldTypes.has(field.type))
|
|
5484
|
+
continue;
|
|
5485
|
+
this.immediateExternalValidationValueByField.set(field.name, this.getFieldControl(field.name)?.value);
|
|
5486
|
+
}
|
|
5487
|
+
}
|
|
5488
|
+
validateChangedImmediateFields() {
|
|
5489
|
+
for (const field of this.collectAllFields()) {
|
|
5490
|
+
if (!field.externalValidation?.key || !this.immediateValidationFieldTypes.has(field.type))
|
|
5491
|
+
continue;
|
|
5492
|
+
const currentValue = this.getFieldControl(field.name)?.value;
|
|
5493
|
+
const previousValue = this.immediateExternalValidationValueByField.get(field.name);
|
|
5494
|
+
if (this.areEquivalentValues(previousValue, currentValue))
|
|
5495
|
+
continue;
|
|
5496
|
+
this.immediateExternalValidationValueByField.set(field.name, currentValue);
|
|
5497
|
+
this.onFieldBlur(field.name);
|
|
5498
|
+
}
|
|
5499
|
+
}
|
|
5473
5500
|
cancelStaleExternalValidations() {
|
|
5474
5501
|
const fields = Array.from(this.externalValidationLastValue.keys());
|
|
5475
5502
|
let changed = false;
|