@solcre-org/core-ui 2.11.41 → 2.11.42

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.
@@ -1016,6 +1016,21 @@ class FileFieldComponent extends BaseFieldComponent {
1016
1016
  this.createBlobsFromUrls(previewUrls);
1017
1017
  }
1018
1018
  });
1019
+ valueChangeEffect = effect(() => {
1020
+ const currentValue = this.value();
1021
+ const field = this.field();
1022
+ const syncEnabled = field.syncWithValue !== false;
1023
+ if (syncEnabled) {
1024
+ this.reinitializeFilesFromValue(currentValue, field);
1025
+ }
1026
+ });
1027
+ refreshTriggerEffect = effect(() => {
1028
+ const field = this.field();
1029
+ if (field.refreshTrigger !== undefined) {
1030
+ const currentValue = this.value();
1031
+ this.reinitializeFilesFromValue(currentValue, field);
1032
+ }
1033
+ });
1019
1034
  getPreviewUrls() {
1020
1035
  const field = this.field();
1021
1036
  const rowData = this.rowData();
@@ -1136,9 +1151,44 @@ class FileFieldComponent extends BaseFieldComponent {
1136
1151
  this.existingFiles.set([]);
1137
1152
  }
1138
1153
  }
1154
+ reinitializeFilesFromValue(currentValue, field) {
1155
+ this.selectedFiles.set([]);
1156
+ this.existingFiles.set([]);
1157
+ this.previewUrls.set([]);
1158
+ this.previewBlobs.set([]);
1159
+ this.previewFileIds.set(new Map());
1160
+ this.clearLocalError();
1161
+ const hasPreviewUrls = field.previewUrls && ((Array.isArray(field.previewUrls) && field.previewUrls.length > 0) ||
1162
+ (typeof field.previewUrls === 'function'));
1163
+ if (currentValue && !hasPreviewUrls) {
1164
+ if (currentValue instanceof File) {
1165
+ this.selectedFiles.set([currentValue]);
1166
+ this.generatePreviews([currentValue]);
1167
+ }
1168
+ else if (Array.isArray(currentValue)) {
1169
+ const files = currentValue.filter(v => v instanceof File);
1170
+ const serverFiles = currentValue.filter(v => this.isServerFile(v));
1171
+ this.selectedFiles.set(files);
1172
+ this.existingFiles.set(serverFiles);
1173
+ this.generatePreviews(files);
1174
+ }
1175
+ else if (this.isServerFile(currentValue)) {
1176
+ this.existingFiles.set([currentValue]);
1177
+ }
1178
+ }
1179
+ else if (hasPreviewUrls) {
1180
+ this.selectedFiles.set([]);
1181
+ this.existingFiles.set([]);
1182
+ }
1183
+ }
1139
1184
  isServerFile(value) {
1140
1185
  return value && typeof value === 'object' && 'id' in value && 'filename' in value;
1141
1186
  }
1187
+ forceRefresh() {
1188
+ const currentValue = this.value();
1189
+ const field = this.field();
1190
+ this.reinitializeFilesFromValue(currentValue, field);
1191
+ }
1142
1192
  generatePreviews(files) {
1143
1193
  const urls = [];
1144
1194
  files.forEach(file => {
@@ -10733,11 +10783,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
10733
10783
  // Este archivo es generado automáticamente por scripts/update-version.js
10734
10784
  // No edites manualmente este archivo
10735
10785
  const VERSION = {
10736
- full: '2.11.41',
10786
+ full: '2.11.42',
10737
10787
  major: 2,
10738
10788
  minor: 11,
10739
- patch: 41,
10740
- timestamp: '2025-09-02T16:19:28.934Z',
10789
+ patch: 42,
10790
+ timestamp: '2025-09-02T17:49:00.511Z',
10741
10791
  buildDate: '2/9/2025'
10742
10792
  };
10743
10793