@solcre-org/core-ui 2.11.40 → 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 => {
|
|
@@ -1231,13 +1281,20 @@ class FileFieldComponent extends BaseFieldComponent {
|
|
|
1231
1281
|
const fileToRemove = all[index];
|
|
1232
1282
|
const config = this.fieldConfig();
|
|
1233
1283
|
let fileType;
|
|
1284
|
+
let previewFile;
|
|
1234
1285
|
if (this.isServerFile(fileToRemove)) {
|
|
1286
|
+
const serverFile = fileToRemove;
|
|
1235
1287
|
const existing = [...this.existingFiles()];
|
|
1236
|
-
const idx = existing.findIndex(f => f.id ===
|
|
1288
|
+
const idx = existing.findIndex(f => f.id === serverFile.id);
|
|
1237
1289
|
if (idx !== -1) {
|
|
1238
1290
|
existing.splice(idx, 1);
|
|
1239
1291
|
this.existingFiles.set(existing);
|
|
1240
1292
|
fileType = 'existing';
|
|
1293
|
+
const currentPreviewUrls = this.getPreviewUrls();
|
|
1294
|
+
const matchingPreview = currentPreviewUrls.find(p => p.id === serverFile.id);
|
|
1295
|
+
if (matchingPreview) {
|
|
1296
|
+
previewFile = matchingPreview;
|
|
1297
|
+
}
|
|
1241
1298
|
}
|
|
1242
1299
|
}
|
|
1243
1300
|
else if (this.isPreviewFile(fileToRemove)) {
|
|
@@ -1248,7 +1305,12 @@ class FileFieldComponent extends BaseFieldComponent {
|
|
|
1248
1305
|
this.previewBlobs.set(blobs);
|
|
1249
1306
|
const fileIdMap = this.previewFileIds();
|
|
1250
1307
|
const previewId = fileToRemove.__previewId || fileIdMap.get(fileToRemove);
|
|
1308
|
+
const originalUrl = fileToRemove.__originalUrl;
|
|
1251
1309
|
if (previewId) {
|
|
1310
|
+
previewFile = {
|
|
1311
|
+
id: previewId,
|
|
1312
|
+
url: originalUrl || ''
|
|
1313
|
+
};
|
|
1252
1314
|
const existing = [...this.existingFiles()];
|
|
1253
1315
|
const existingIdx = existing.findIndex(f => f.id === previewId);
|
|
1254
1316
|
if (existingIdx !== -1) {
|
|
@@ -1273,7 +1335,12 @@ class FileFieldComponent extends BaseFieldComponent {
|
|
|
1273
1335
|
}
|
|
1274
1336
|
}
|
|
1275
1337
|
if (config.onFileRemoved && fileType) {
|
|
1276
|
-
config.onFileRemoved(
|
|
1338
|
+
config.onFileRemoved({
|
|
1339
|
+
file: fileToRemove,
|
|
1340
|
+
index: index,
|
|
1341
|
+
fileType: fileType,
|
|
1342
|
+
previewFile: previewFile
|
|
1343
|
+
});
|
|
1277
1344
|
}
|
|
1278
1345
|
this.validateCurrentState();
|
|
1279
1346
|
this.formControl().markAsTouched();
|
|
@@ -10716,11 +10783,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
|
|
|
10716
10783
|
// Este archivo es generado automáticamente por scripts/update-version.js
|
|
10717
10784
|
// No edites manualmente este archivo
|
|
10718
10785
|
const VERSION = {
|
|
10719
|
-
full: '2.11.
|
|
10786
|
+
full: '2.11.42',
|
|
10720
10787
|
major: 2,
|
|
10721
10788
|
minor: 11,
|
|
10722
|
-
patch:
|
|
10723
|
-
timestamp: '2025-09-
|
|
10789
|
+
patch: 42,
|
|
10790
|
+
timestamp: '2025-09-02T17:49:00.511Z',
|
|
10724
10791
|
buildDate: '2/9/2025'
|
|
10725
10792
|
};
|
|
10726
10793
|
|