ui-core-abv 0.8.6 → 0.8.8

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.
@@ -3363,13 +3363,15 @@ class UicTimePickerComponent extends base$3 {
3363
3363
  });
3364
3364
  const portal = new TemplatePortal(this.overlayTemplate, this.vcr);
3365
3365
  this.overlayRef.attach(portal);
3366
- this.overlayRef.backdropClick().subscribe(() => this.closeOverlay());
3366
+ this.overlayRef.backdropClick().subscribe(() => this.closeOverlay(true));
3367
3367
  this.syncSelectionFromValue();
3368
3368
  setTimeout(() => this.scrollToSelection(), 0);
3369
3369
  }
3370
- closeOverlay() {
3370
+ closeOverlay(commitSelection = false) {
3371
3371
  if (this.overlayRef) {
3372
- this.onTouched();
3372
+ if (commitSelection) {
3373
+ this.commitOverlaySelection();
3374
+ }
3373
3375
  this.overlayRef.dispose();
3374
3376
  this.overlayRef = null;
3375
3377
  this.isOverlayOpen = false;
@@ -3380,25 +3382,27 @@ class UicTimePickerComponent extends base$3 {
3380
3382
  * Comitea la selección actual antes de cerrar.
3381
3383
  */
3382
3384
  confirmAndClose() {
3383
- this.commitOverlaySelection();
3384
- this.closeOverlay();
3385
+ this.closeOverlay(true);
3385
3386
  }
3386
3387
  // Selecciones desde overlay
3387
3388
  pickHour(hour) {
3388
3389
  this.selectedHour12 = hour;
3389
- this.commitOverlaySelection();
3390
3390
  }
3391
3391
  pickMinute(minute) {
3392
3392
  this.selectedMinute = minute;
3393
- this.commitOverlaySelection();
3394
3393
  }
3395
3394
  pickMeridiem(meridiem) {
3396
3395
  this.selectedMeridiem = meridiem;
3397
- this.commitOverlaySelection();
3398
3396
  }
3399
3397
  commitOverlaySelection() {
3400
- const base = this.parseDisplay(this.displayValue) ||
3401
- this.parseValue(this.value) || {
3398
+ const current = this.parseDisplay(this.displayValue) || this.parseValue(this.value);
3399
+ const hasOverlaySelection = this.selectedHour12 !== null || this.selectedMinute !== null || this.selectedMeridiem !== null;
3400
+ if (!current && !hasOverlaySelection) {
3401
+ this.displayValue = '';
3402
+ this.notifyChange(null);
3403
+ return;
3404
+ }
3405
+ const base = current || {
3402
3406
  hour12: 12,
3403
3407
  minute: 0,
3404
3408
  meridiem: 'am',
@@ -4830,6 +4834,11 @@ class UicFormWrapperComponent {
4830
4834
  externalValidationStates = {};
4831
4835
  externalValidationSubs = new Map();
4832
4836
  externalValidationLastValue = new Map();
4837
+ immediateExternalValidationValueByField = new Map();
4838
+ immediateValidationFieldTypes = new Set([
4839
+ 'date', 'time', 'select', 'radio', 'checkbox', 'switch',
4840
+ 'pool', 'file', 'multyselect', 'searcher', 'slider'
4841
+ ]);
4833
4842
  formValueSub = null;
4834
4843
  optionSourceSubs = new Map();
4835
4844
  optionSourceDependencyValueByField = new Map();
@@ -4984,12 +4993,14 @@ class UicFormWrapperComponent {
4984
4993
  this.formValueSub = newForm.valueChanges.subscribe(() => {
4985
4994
  this.normalizeNumericControls(newForm, numericFields);
4986
4995
  this.cancelStaleExternalValidations();
4996
+ this.validateChangedImmediateFields();
4987
4997
  this.handleFormChange();
4988
4998
  this.updateDependentOptionsSources();
4989
4999
  this.resolveComputedFields();
4990
5000
  });
4991
5001
  this.form = newForm;
4992
5002
  this.clearExternalValidationSubs();
5003
+ this.initializeImmediateExternalValidationValues();
4993
5004
  this.externalValidationStates = {};
4994
5005
  this.optionSourceDependencyValueByField.clear();
4995
5006
  this.updateDisabledState();
@@ -5470,6 +5481,26 @@ class UicFormWrapperComponent {
5470
5481
  });
5471
5482
  this.externalValidationSubs.set(fieldName, sub);
5472
5483
  }
5484
+ initializeImmediateExternalValidationValues() {
5485
+ this.immediateExternalValidationValueByField.clear();
5486
+ for (const field of this.collectAllFields()) {
5487
+ if (!field.externalValidation?.key || !this.immediateValidationFieldTypes.has(field.type))
5488
+ continue;
5489
+ this.immediateExternalValidationValueByField.set(field.name, this.getFieldControl(field.name)?.value);
5490
+ }
5491
+ }
5492
+ validateChangedImmediateFields() {
5493
+ for (const field of this.collectAllFields()) {
5494
+ if (!field.externalValidation?.key || !this.immediateValidationFieldTypes.has(field.type))
5495
+ continue;
5496
+ const currentValue = this.getFieldControl(field.name)?.value;
5497
+ const previousValue = this.immediateExternalValidationValueByField.get(field.name);
5498
+ if (this.areEquivalentValues(previousValue, currentValue))
5499
+ continue;
5500
+ this.immediateExternalValidationValueByField.set(field.name, currentValue);
5501
+ this.onFieldBlur(field.name);
5502
+ }
5503
+ }
5473
5504
  cancelStaleExternalValidations() {
5474
5505
  const fields = Array.from(this.externalValidationLastValue.keys());
5475
5506
  let changed = false;