sf-crud 13.2.51 → 13.2.53
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/sf-crud.mjs +22 -9
- package/fesm2022/sf-crud.mjs.map +1 -1
- package/package.json +2 -2
package/fesm2022/sf-crud.mjs
CHANGED
|
@@ -2218,6 +2218,12 @@ class ControlComponent {
|
|
|
2218
2218
|
ngOnChanges(changes) {
|
|
2219
2219
|
if (!changes)
|
|
2220
2220
|
return;
|
|
2221
|
+
if (this.control?.subtype === 'file' &&
|
|
2222
|
+
changes['value'] &&
|
|
2223
|
+
!changes['value'].firstChange) {
|
|
2224
|
+
this.loadFiles();
|
|
2225
|
+
return;
|
|
2226
|
+
}
|
|
2221
2227
|
// Sincroniza el autocomplete cuando el value llega actualizado desde el padre
|
|
2222
2228
|
if ((this.control?.subtype === 'autocomplete' ||
|
|
2223
2229
|
this.control?.subtype === 'autocompleteCustom') &&
|
|
@@ -2556,16 +2562,23 @@ class ControlComponent {
|
|
|
2556
2562
|
const op = this.control.config;
|
|
2557
2563
|
const url = this.crudService.getURL(op, undefined, undefined, this.context);
|
|
2558
2564
|
this.generalService.genericRequest(this.control.config.method, url, formData)
|
|
2559
|
-
.then(() => {
|
|
2565
|
+
.then((res) => {
|
|
2560
2566
|
let separator = this.control.config?.separator || ",";
|
|
2561
|
-
|
|
2562
|
-
if (
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
this.
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2567
|
+
const blobPaths = res?.data?.blobPaths || [];
|
|
2568
|
+
if (blobPaths.length > 0) {
|
|
2569
|
+
const base = (this.generalService.jsonConfig.BlobUrl || '').replace(/\/temp\/?$/, '').replace(/\/+$/, '');
|
|
2570
|
+
const fullUrls = blobPaths.map((p) => `${base}${p}`);
|
|
2571
|
+
if (this.control.type == "string")
|
|
2572
|
+
this.value = fullUrls.join(separator);
|
|
2573
|
+
else if (this.control.type == "array")
|
|
2574
|
+
this.value = fullUrls;
|
|
2575
|
+
}
|
|
2576
|
+
else {
|
|
2577
|
+
if (this.control.type == "string")
|
|
2578
|
+
this.value = event.map(f => `${this.generalService.jsonConfig.Server}${path}/${f.name}`).join(separator);
|
|
2579
|
+
else if (this.control.type == "array")
|
|
2580
|
+
this.value = event.map(f => `${this.generalService.jsonConfig.Server}${path}/${f.name}`);
|
|
2581
|
+
}
|
|
2569
2582
|
this.sendValue();
|
|
2570
2583
|
let msg = !this.control.config.limit || this.control.config.limit == 1 ? "Archivo cargado correctamente!" : "Archivos cargados correctamente!";
|
|
2571
2584
|
this.notificationService.addNotification({ severity: 'info', detail: msg }, this.primeChecking());
|