@solcre-org/core-ui 2.12.37 → 2.12.38

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.
@@ -2229,7 +2229,9 @@ class SelectFieldComponent extends BaseFieldComponent {
2229
2229
  String(opt.value) === String(currentInitialValue));
2230
2230
  if (matchingOption) {
2231
2231
  setTimeout(() => {
2232
- this.formControl().setValue(currentInitialValue, { emitEvent: false });
2232
+ this.formControl().setValue(currentInitialValue, { emitEvent: true });
2233
+ this.valueChange.emit(currentInitialValue);
2234
+ this.hasValue.set(true);
2233
2235
  this.isInitialized.set(true);
2234
2236
  }, 0);
2235
2237
  }
@@ -2243,9 +2245,15 @@ class SelectFieldComponent extends BaseFieldComponent {
2243
2245
  if (newValue !== null && newValue !== undefined && newValue !== currentValue) {
2244
2246
  this.formControl().setValue(newValue, { emitEvent: true });
2245
2247
  this.valueChange.emit(newValue);
2248
+ this.hasValue.set(true);
2246
2249
  }
2247
2250
  }
2248
- }, 10);
2251
+ const finalValue = this.formControl().value;
2252
+ if (finalValue !== null && finalValue !== undefined && finalValue !== '') {
2253
+ const hasValidValue = !Array.isArray(finalValue) || finalValue.length > 0;
2254
+ this.hasValue.set(hasValidValue);
2255
+ }
2256
+ }, 100);
2249
2257
  }
2250
2258
  compareWith = (item, selected) => {
2251
2259
  if (!item || selected === null || selected === undefined) {
@@ -2285,6 +2293,11 @@ class SelectFieldComponent extends BaseFieldComponent {
2285
2293
  else {
2286
2294
  finalValue = newValue;
2287
2295
  }
2296
+ const hasValidValue = finalValue !== null &&
2297
+ finalValue !== undefined &&
2298
+ finalValue !== '' &&
2299
+ (!Array.isArray(finalValue) || finalValue.length > 0);
2300
+ this.hasValue.set(hasValidValue);
2288
2301
  const fieldConfig = this.field();
2289
2302
  if (fieldConfig.onSelectionChange && this.formValue()) {
2290
2303
  try {
@@ -5460,14 +5473,17 @@ class GenericModalComponent {
5460
5473
  const payloadKey = (field.keyToPayload ?? field.key);
5461
5474
  const modeConfig = field.modes?.[this.mode()];
5462
5475
  const defaultValue = modeConfig?.defaultValue ?? field.defaultValue;
5476
+ let initialValue = newInstance[fieldKey];
5463
5477
  if (this.mode() === ModalMode.CREATE) {
5464
- if (defaultValue !== undefined && newInstance[fieldKey] === undefined) {
5478
+ if (defaultValue !== undefined) {
5465
5479
  if (typeof defaultValue === 'function') {
5466
5480
  const computedValue = defaultValue(newInstance);
5467
5481
  newInstance[payloadKey] = computedValue;
5482
+ initialValue = computedValue;
5468
5483
  }
5469
5484
  else {
5470
5485
  newInstance[payloadKey] = defaultValue;
5486
+ initialValue = defaultValue;
5471
5487
  }
5472
5488
  }
5473
5489
  }
@@ -5475,42 +5491,49 @@ class GenericModalComponent {
5475
5491
  if (typeof defaultValue === 'function') {
5476
5492
  const computedValue = defaultValue(newInstance);
5477
5493
  newInstance[payloadKey] = computedValue;
5494
+ initialValue = computedValue;
5478
5495
  }
5479
5496
  }
5480
5497
  const validators = modeConfig?.validators ?? field.validators ?? [];
5481
- formGroup[fieldKey] = [newInstance[fieldKey], validators];
5498
+ formGroup[fieldKey] = [initialValue, validators];
5482
5499
  });
5483
5500
  this.form.set(this.formBuilder.group(formGroup));
5484
- this.allFields().forEach(field => {
5485
- const fieldKey = field.key;
5486
- const payloadKey = (field.keyToPayload ?? field.key);
5487
- if ('dynamicValue' in field && typeof field.dynamicValue === 'function') {
5488
- const dynamicVal = field.dynamicValue(newInstance);
5489
- if (dynamicVal !== undefined) {
5490
- newInstance[payloadKey] = dynamicVal;
5491
- const control = this.form().get(fieldKey);
5492
- if (control) {
5493
- control.setValue(dynamicVal, { emitEvent: false });
5501
+ setTimeout(() => {
5502
+ this.allFields().forEach(field => {
5503
+ const fieldKey = field.key;
5504
+ const payloadKey = (field.keyToPayload ?? field.key);
5505
+ if ('dynamicValue' in field && typeof field.dynamicValue === 'function') {
5506
+ const dynamicVal = field.dynamicValue(newInstance);
5507
+ if (dynamicVal !== undefined && dynamicVal !== null) {
5508
+ newInstance[payloadKey] = dynamicVal;
5509
+ const control = this.form().get(fieldKey);
5510
+ if (control) {
5511
+ control.setValue(dynamicVal, { emitEvent: true });
5512
+ }
5494
5513
  }
5495
5514
  }
5496
- }
5497
- });
5498
- setTimeout(() => {
5515
+ });
5516
+ this.allFields().forEach(field => {
5517
+ const fieldKey = field.key;
5518
+ const control = this.form().get(fieldKey);
5519
+ if (control && control.value !== undefined && control.value !== null) {
5520
+ const payloadKey = (field.keyToPayload ?? field.key);
5521
+ newInstance[payloadKey] = control.value;
5522
+ }
5523
+ });
5499
5524
  Object.values(this.form().controls).forEach(control => {
5500
5525
  control.markAsUntouched();
5501
5526
  });
5502
5527
  this.fieldErrors.set({});
5503
5528
  this.internalErrors.set([]);
5504
- }, 0);
5505
- this.editedData.set(newInstance);
5506
- if (this.mode() !== ModalMode.VIEW) {
5507
- const originalCopy = Object.create(Object.getPrototypeOf(newInstance));
5508
- Object.assign(originalCopy, newInstance);
5509
- this.originalData.set(originalCopy);
5510
- }
5511
- setTimeout(() => {
5529
+ this.editedData.set(newInstance);
5530
+ if (this.mode() !== ModalMode.VIEW) {
5531
+ const originalCopy = Object.create(Object.getPrototypeOf(newInstance));
5532
+ Object.assign(originalCopy, newInstance);
5533
+ this.originalData.set(originalCopy);
5534
+ }
5512
5535
  this.modalData.emit(newInstance);
5513
- }, 1);
5536
+ }, 50);
5514
5537
  }
5515
5538
  initializeActiveTabAndStep() {
5516
5539
  if (this.hasTabs()) {
@@ -13267,11 +13290,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
13267
13290
  // Este archivo es generado automáticamente por scripts/update-version.js
13268
13291
  // No edites manualmente este archivo
13269
13292
  const VERSION = {
13270
- full: '2.12.37',
13293
+ full: '2.12.38',
13271
13294
  major: 2,
13272
13295
  minor: 12,
13273
- patch: 37,
13274
- timestamp: '2025-09-17T13:18:31.604Z',
13296
+ patch: 38,
13297
+ timestamp: '2025-09-17T14:27:53.302Z',
13275
13298
  buildDate: '17/9/2025'
13276
13299
  };
13277
13300