@solcre-org/core-ui 2.11.38 → 2.11.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.
- package/fesm2022/solcre-org-core-ui.mjs +54 -14
- package/fesm2022/solcre-org-core-ui.mjs.map +1 -1
- package/index.d.ts +13 -3
- package/package.json +1 -1
|
@@ -990,6 +990,7 @@ class FileFieldComponent extends BaseFieldComponent {
|
|
|
990
990
|
existingFiles = signal([]);
|
|
991
991
|
previewUrls = signal([]);
|
|
992
992
|
previewBlobs = signal([]);
|
|
993
|
+
previewFileIds = signal(new Map());
|
|
993
994
|
errorMessage = signal('');
|
|
994
995
|
errorParams = signal(null);
|
|
995
996
|
displayErrorMessage = computed(() => {
|
|
@@ -1023,36 +1024,38 @@ class FileFieldComponent extends BaseFieldComponent {
|
|
|
1023
1024
|
return [];
|
|
1024
1025
|
}
|
|
1025
1026
|
if (typeof previewUrls === 'function') {
|
|
1026
|
-
|
|
1027
|
-
return result;
|
|
1027
|
+
return rowData ? previewUrls(rowData) : [];
|
|
1028
1028
|
}
|
|
1029
|
-
|
|
1030
|
-
return result;
|
|
1029
|
+
return Array.isArray(previewUrls) ? previewUrls : [];
|
|
1031
1030
|
}
|
|
1032
|
-
async createBlobsFromUrls(
|
|
1031
|
+
async createBlobsFromUrls(previewUrls) {
|
|
1033
1032
|
const blobs = [];
|
|
1034
|
-
|
|
1033
|
+
const fileIdMap = new Map();
|
|
1034
|
+
for (let i = 0; i < previewUrls.length; i++) {
|
|
1035
1035
|
try {
|
|
1036
|
-
const
|
|
1037
|
-
const response = await fetch(url);
|
|
1036
|
+
const previewFile = previewUrls[i];
|
|
1037
|
+
const response = await fetch(previewFile.url);
|
|
1038
1038
|
if (!response.ok) {
|
|
1039
1039
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
1040
1040
|
}
|
|
1041
1041
|
const blob = await response.blob();
|
|
1042
|
-
const filename = this.extractFilenameFromUrl(url) || `preview-image-${i + 1}.jpg`;
|
|
1042
|
+
const filename = this.extractFilenameFromUrl(previewFile.url) || `preview-image-${i + 1}.jpg`;
|
|
1043
1043
|
const file = new File([blob], filename, {
|
|
1044
1044
|
type: blob.type || 'image/jpeg',
|
|
1045
1045
|
lastModified: Date.now()
|
|
1046
1046
|
});
|
|
1047
1047
|
file.__isPreviewFile = true;
|
|
1048
|
-
file.__originalUrl = url;
|
|
1048
|
+
file.__originalUrl = previewFile.url;
|
|
1049
|
+
file.__previewId = previewFile.id;
|
|
1049
1050
|
blobs.push(file);
|
|
1051
|
+
fileIdMap.set(file, previewFile.id);
|
|
1050
1052
|
}
|
|
1051
1053
|
catch (error) {
|
|
1052
|
-
console.error(`❌ Error loading preview image from URL: ${
|
|
1054
|
+
console.error(`❌ Error loading preview image from URL: ${previewUrls[i].url}`, error);
|
|
1053
1055
|
}
|
|
1054
1056
|
}
|
|
1055
1057
|
this.previewBlobs.set(blobs);
|
|
1058
|
+
this.previewFileIds.set(fileIdMap);
|
|
1056
1059
|
}
|
|
1057
1060
|
extractFilenameFromUrl(url) {
|
|
1058
1061
|
try {
|
|
@@ -1196,6 +1199,14 @@ class FileFieldComponent extends BaseFieldComponent {
|
|
|
1196
1199
|
}
|
|
1197
1200
|
this.selectedFiles.set(cfg.multiple ? combined : [combined[0]]);
|
|
1198
1201
|
this.generatePreviews(this.selectedFiles());
|
|
1202
|
+
if (cfg.onFilesAdded) {
|
|
1203
|
+
const currentPreviewUrls = this.getPreviewUrls();
|
|
1204
|
+
const newFiles = cfg.multiple ? incoming : [incoming[0]];
|
|
1205
|
+
cfg.onFilesAdded({
|
|
1206
|
+
previewUrls: currentPreviewUrls,
|
|
1207
|
+
newFiles: newFiles
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1199
1210
|
this.formControl().markAsTouched();
|
|
1200
1211
|
this.emitCurrentValue();
|
|
1201
1212
|
}
|
|
@@ -1218,12 +1229,37 @@ class FileFieldComponent extends BaseFieldComponent {
|
|
|
1218
1229
|
removeFile(index) {
|
|
1219
1230
|
const all = this.allFiles();
|
|
1220
1231
|
const fileToRemove = all[index];
|
|
1232
|
+
const config = this.fieldConfig();
|
|
1233
|
+
let fileType;
|
|
1221
1234
|
if (this.isServerFile(fileToRemove)) {
|
|
1222
1235
|
const existing = [...this.existingFiles()];
|
|
1223
1236
|
const idx = existing.findIndex(f => f.id === fileToRemove.id);
|
|
1224
1237
|
if (idx !== -1) {
|
|
1225
1238
|
existing.splice(idx, 1);
|
|
1226
1239
|
this.existingFiles.set(existing);
|
|
1240
|
+
fileType = 'existing';
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
else if (this.isPreviewFile(fileToRemove)) {
|
|
1244
|
+
const blobs = [...this.previewBlobs()];
|
|
1245
|
+
const idx = blobs.indexOf(fileToRemove);
|
|
1246
|
+
if (idx !== -1) {
|
|
1247
|
+
blobs.splice(idx, 1);
|
|
1248
|
+
this.previewBlobs.set(blobs);
|
|
1249
|
+
const fileIdMap = this.previewFileIds();
|
|
1250
|
+
const previewId = fileToRemove.__previewId || fileIdMap.get(fileToRemove);
|
|
1251
|
+
if (previewId) {
|
|
1252
|
+
const existing = [...this.existingFiles()];
|
|
1253
|
+
const existingIdx = existing.findIndex(f => f.id === previewId);
|
|
1254
|
+
if (existingIdx !== -1) {
|
|
1255
|
+
existing.splice(existingIdx, 1);
|
|
1256
|
+
this.existingFiles.set(existing);
|
|
1257
|
+
}
|
|
1258
|
+
const newMap = new Map(fileIdMap);
|
|
1259
|
+
newMap.delete(fileToRemove);
|
|
1260
|
+
this.previewFileIds.set(newMap);
|
|
1261
|
+
}
|
|
1262
|
+
fileType = 'preview';
|
|
1227
1263
|
}
|
|
1228
1264
|
}
|
|
1229
1265
|
else {
|
|
@@ -1233,8 +1269,12 @@ class FileFieldComponent extends BaseFieldComponent {
|
|
|
1233
1269
|
selected.splice(idx, 1);
|
|
1234
1270
|
this.selectedFiles.set(selected);
|
|
1235
1271
|
this.generatePreviews(selected);
|
|
1272
|
+
fileType = 'selected';
|
|
1236
1273
|
}
|
|
1237
1274
|
}
|
|
1275
|
+
if (config.onFileRemoved && fileType) {
|
|
1276
|
+
config.onFileRemoved(fileToRemove, index, fileType);
|
|
1277
|
+
}
|
|
1238
1278
|
this.validateCurrentState();
|
|
1239
1279
|
this.formControl().markAsTouched();
|
|
1240
1280
|
this.emitCurrentValue();
|
|
@@ -10676,11 +10716,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
|
|
|
10676
10716
|
// Este archivo es generado automáticamente por scripts/update-version.js
|
|
10677
10717
|
// No edites manualmente este archivo
|
|
10678
10718
|
const VERSION = {
|
|
10679
|
-
full: '2.11.
|
|
10719
|
+
full: '2.11.40',
|
|
10680
10720
|
major: 2,
|
|
10681
10721
|
minor: 11,
|
|
10682
|
-
patch:
|
|
10683
|
-
timestamp: '2025-09-02T15:
|
|
10722
|
+
patch: 40,
|
|
10723
|
+
timestamp: '2025-09-02T15:56:06.044Z',
|
|
10684
10724
|
buildDate: '2/9/2025'
|
|
10685
10725
|
};
|
|
10686
10726
|
|