@solcre-org/core-ui 2.11.39 → 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 +38 -14
- package/fesm2022/solcre-org-core-ui.mjs.map +1 -1
- package/index.d.ts +12 -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
|
}
|
|
@@ -1235,6 +1246,19 @@ class FileFieldComponent extends BaseFieldComponent {
|
|
|
1235
1246
|
if (idx !== -1) {
|
|
1236
1247
|
blobs.splice(idx, 1);
|
|
1237
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
|
+
}
|
|
1238
1262
|
fileType = 'preview';
|
|
1239
1263
|
}
|
|
1240
1264
|
}
|
|
@@ -10692,11 +10716,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
|
|
|
10692
10716
|
// Este archivo es generado automáticamente por scripts/update-version.js
|
|
10693
10717
|
// No edites manualmente este archivo
|
|
10694
10718
|
const VERSION = {
|
|
10695
|
-
full: '2.11.
|
|
10719
|
+
full: '2.11.40',
|
|
10696
10720
|
major: 2,
|
|
10697
10721
|
minor: 11,
|
|
10698
|
-
patch:
|
|
10699
|
-
timestamp: '2025-09-02T15:
|
|
10722
|
+
patch: 40,
|
|
10723
|
+
timestamp: '2025-09-02T15:56:06.044Z',
|
|
10700
10724
|
buildDate: '2/9/2025'
|
|
10701
10725
|
};
|
|
10702
10726
|
|