@solcre-org/core-ui 2.12.39 → 2.12.40
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.
|
@@ -3704,6 +3704,9 @@ class MultiEntryFieldComponent {
|
|
|
3704
3704
|
ModalMode = ModalMode;
|
|
3705
3705
|
entries = signal([]);
|
|
3706
3706
|
fieldValues = signal([]);
|
|
3707
|
+
isSyncingFromInput = signal(false);
|
|
3708
|
+
lastInputSignature = null;
|
|
3709
|
+
lastEmittedSignature = null;
|
|
3707
3710
|
config = computed(() => this.field().multiEntryConfig || {});
|
|
3708
3711
|
allowMultiple = computed(() => this.config().allowMultipleEntries || false);
|
|
3709
3712
|
maxEntries = computed(() => this.config().maxEntries || 10);
|
|
@@ -3750,38 +3753,54 @@ class MultiEntryFieldComponent {
|
|
|
3750
3753
|
this.initializeEntries(this.value());
|
|
3751
3754
|
}
|
|
3752
3755
|
initializeEntries(inputValue) {
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
}));
|
|
3758
|
-
this.entries.set(initialEntries);
|
|
3759
|
-
this.fieldValues.set(Array(this.minEntries()).fill(null));
|
|
3756
|
+
const signature = this.serializeValue(inputValue);
|
|
3757
|
+
const currentEntriesCount = this.entries().length;
|
|
3758
|
+
const requiresMinEntriesUpdate = currentEntriesCount < this.minEntries();
|
|
3759
|
+
if (this.lastInputSignature === signature && currentEntriesCount > 0 && !requiresMinEntriesUpdate) {
|
|
3760
3760
|
return;
|
|
3761
3761
|
}
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3762
|
+
this.isSyncingFromInput.set(true);
|
|
3763
|
+
try {
|
|
3764
|
+
let newEntries = [];
|
|
3765
|
+
if (!inputValue) {
|
|
3766
|
+
newEntries = Array.from({ length: this.minEntries() }, () => ({
|
|
3767
|
+
id: this.generateEntryId(),
|
|
3768
|
+
value: null
|
|
3769
|
+
}));
|
|
3770
|
+
}
|
|
3771
|
+
else {
|
|
3772
|
+
let parsedValues = [];
|
|
3773
|
+
if (Array.isArray(inputValue)) {
|
|
3774
|
+
parsedValues = inputValue;
|
|
3775
|
+
}
|
|
3776
|
+
else if (typeof inputValue === 'string') {
|
|
3777
|
+
const separator = this.config().customSeparator || ',';
|
|
3778
|
+
parsedValues = inputValue
|
|
3779
|
+
.split(separator)
|
|
3780
|
+
.map(v => v.trim())
|
|
3781
|
+
.filter(v => v !== '');
|
|
3782
|
+
}
|
|
3783
|
+
else {
|
|
3784
|
+
parsedValues = [inputValue];
|
|
3785
|
+
}
|
|
3786
|
+
newEntries = parsedValues.map(value => ({
|
|
3787
|
+
id: this.generateEntryId(),
|
|
3788
|
+
value
|
|
3789
|
+
}));
|
|
3790
|
+
while (newEntries.length < this.minEntries()) {
|
|
3791
|
+
newEntries.push({
|
|
3792
|
+
id: this.generateEntryId(),
|
|
3793
|
+
value: null
|
|
3794
|
+
});
|
|
3795
|
+
}
|
|
3796
|
+
}
|
|
3797
|
+
this.entries.set(newEntries);
|
|
3798
|
+
this.fieldValues.set(newEntries.map(entry => entry.value));
|
|
3799
|
+
this.lastInputSignature = signature;
|
|
3772
3800
|
}
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
value: value
|
|
3776
|
-
}));
|
|
3777
|
-
while (newEntries.length < this.minEntries()) {
|
|
3778
|
-
newEntries.push({
|
|
3779
|
-
id: this.generateEntryId(),
|
|
3780
|
-
value: null
|
|
3781
|
-
});
|
|
3801
|
+
finally {
|
|
3802
|
+
this.isSyncingFromInput.set(false);
|
|
3782
3803
|
}
|
|
3783
|
-
this.entries.set(newEntries);
|
|
3784
|
-
this.fieldValues.set(newEntries.map(entry => entry.value));
|
|
3785
3804
|
}
|
|
3786
3805
|
generateEntryId() {
|
|
3787
3806
|
return `entry_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
@@ -3862,6 +3881,15 @@ class MultiEntryFieldComponent {
|
|
|
3862
3881
|
default:
|
|
3863
3882
|
formattedValue = nonEmptyValues;
|
|
3864
3883
|
}
|
|
3884
|
+
const signature = this.serializeValue(formattedValue);
|
|
3885
|
+
if (this.isSyncingFromInput()) {
|
|
3886
|
+
this.lastEmittedSignature = signature;
|
|
3887
|
+
return;
|
|
3888
|
+
}
|
|
3889
|
+
if (this.lastEmittedSignature === signature) {
|
|
3890
|
+
return;
|
|
3891
|
+
}
|
|
3892
|
+
this.lastEmittedSignature = signature;
|
|
3865
3893
|
this.valueChange.emit(formattedValue);
|
|
3866
3894
|
}
|
|
3867
3895
|
createFieldConfigForEntry(index) {
|
|
@@ -3890,6 +3918,14 @@ class MultiEntryFieldComponent {
|
|
|
3890
3918
|
shouldShowRemoveButton(index) {
|
|
3891
3919
|
return this.shouldShowActions(index) && this.canRemove();
|
|
3892
3920
|
}
|
|
3921
|
+
serializeValue(value) {
|
|
3922
|
+
try {
|
|
3923
|
+
return JSON.stringify(value ?? null);
|
|
3924
|
+
}
|
|
3925
|
+
catch {
|
|
3926
|
+
return String(value);
|
|
3927
|
+
}
|
|
3928
|
+
}
|
|
3893
3929
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MultiEntryFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3894
3930
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: MultiEntryFieldComponent, isStandalone: true, selector: "core-multi-entry-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: true, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, rowData: { classPropertyName: "rowData", publicName: "rowData", isSignal: true, isRequired: false, transformFunction: null }, formValue: { classPropertyName: "formValue", publicName: "formValue", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", onBlurEvent: "onBlurEvent", onEnterEvent: "onEnterEvent" }, hostDirectives: [{ directive: CoreHostDirective }], ngImport: i0, template: "<div class=\"c-entry-group\">\n @for (entry of entries(); track entry.id; let index = $index) {\n <div class=\"c-entry-item\">\n <!-- Campo din\u00E1mico para cada entrada -->\n <div\n coreDynamicField\n [field]=\"createFieldConfigForEntry(index)\"\n [value]=\"entry.value\"\n [mode]=\"mode()\"\n [errors]=\"errors()\"\n [rowData]=\"rowData()\"\n [formValue]=\"formValue()\"\n (valueChange)=\"onFieldValueChange($event, index)\"\n (onBlurEvent)=\"onFieldBlur($event)\"\n (onEnterEvent)=\"onFieldEnter($event)\">\n </div>\n\n <!-- Botones de acci\u00F3n (agregar/eliminar) -->\n @if (shouldShowActions(index)) {\n <div class=\"c-entry-actions\">\n @if (shouldShowAddButton(index)) {\n <button \n type=\"button\"\n class=\"c-entry-action c-entry-action--add\"\n (click)=\"addEntry()\"\n [disabled]=\"isDisabled()\"\n [title]=\"addLabel() | translate\"\n [attr.aria-label]=\"addLabel() | translate\">\n <span class=\"icon-counter-up\"></span>\n {{ addLabel() | translate }}\n </button>\n }\n \n @if (shouldShowRemoveButton(index)) {\n <button \n type=\"button\"\n class=\"c-entry-action c-entry-action--remove\"\n (click)=\"removeEntry(index)\"\n [disabled]=\"isDisabled()\"\n [title]=\"removeLabel() | translate\"\n [attr.aria-label]=\"removeLabel() | translate\">\n <span class=\"icon-counter-down\"></span>\n {{ removeLabel() | translate }}\n </button>\n }\n </div>\n }\n </div>\n }\n\n <!-- Errores del campo principal -->\n @if (errors().length > 0) {\n <core-field-errors [errors]=\"errors()\"></core-field-errors>\n }\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }, { kind: "directive", type: DynamicFieldDirective, selector: "[coreDynamicField]", inputs: ["field", "value", "mode", "errors", "rowData", "formValue"], outputs: ["valueChange", "onBlurEvent", "onEnterEvent", "selectionChange"] }, { kind: "component", type: FieldErrorsComponent, selector: "core-field-errors", inputs: ["errors"] }] });
|
|
3895
3931
|
}
|
|
@@ -13357,11 +13393,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
|
|
|
13357
13393
|
// Este archivo es generado automáticamente por scripts/update-version.js
|
|
13358
13394
|
// No edites manualmente este archivo
|
|
13359
13395
|
const VERSION = {
|
|
13360
|
-
full: '2.12.
|
|
13396
|
+
full: '2.12.40',
|
|
13361
13397
|
major: 2,
|
|
13362
13398
|
minor: 12,
|
|
13363
|
-
patch:
|
|
13364
|
-
timestamp: '2025-09-17T15:
|
|
13399
|
+
patch: 40,
|
|
13400
|
+
timestamp: '2025-09-17T15:45:09.933Z',
|
|
13365
13401
|
buildDate: '17/9/2025'
|
|
13366
13402
|
};
|
|
13367
13403
|
|