sf-crud 13.2.53 → 13.2.55
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
CHANGED
|
@@ -2315,11 +2315,15 @@ class ControlComponent {
|
|
|
2315
2315
|
}
|
|
2316
2316
|
return null;
|
|
2317
2317
|
}
|
|
2318
|
-
loadDefaultValues() {
|
|
2318
|
+
async loadDefaultValues() {
|
|
2319
2319
|
if (this.control?.config && (this.control.subtype == 'dropdown' || this.control.subtype == 'multiselect' || this.control.subtype == 'group'))
|
|
2320
2320
|
this.loadDataFromService();
|
|
2321
|
-
if (this.control?.subtype == 'autocomplete' || this.control?.subtype === 'autocompleteCustom')
|
|
2322
|
-
this.extracValueFromControlBusqueda();
|
|
2321
|
+
if (this.control?.subtype == 'autocomplete' || this.control?.subtype === 'autocompleteCustom') {
|
|
2322
|
+
await this.extracValueFromControlBusqueda();
|
|
2323
|
+
if (this.control.dependency && this.tempValue) {
|
|
2324
|
+
this.sendDependencyValue(this.tempValue);
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2323
2327
|
if (this.value && this.control.type == 'date') {
|
|
2324
2328
|
this.instanceDate();
|
|
2325
2329
|
}
|
|
@@ -2525,23 +2529,26 @@ class ControlComponent {
|
|
|
2525
2529
|
this.cdr.detectChanges();
|
|
2526
2530
|
});
|
|
2527
2531
|
}
|
|
2528
|
-
extracValueFromControlBusqueda() {
|
|
2532
|
+
async extracValueFromControlBusqueda() {
|
|
2529
2533
|
const op = this.control.config;
|
|
2530
2534
|
let url = this.crudService.getURL(op, undefined, undefined, this.context);
|
|
2531
2535
|
url = url.replace('@query', this.value);
|
|
2532
|
-
|
|
2533
|
-
.
|
|
2536
|
+
try {
|
|
2537
|
+
const res = await this.generalService.genericRequest(this.control.config.method, url);
|
|
2534
2538
|
if (res.data?.length == 1 && res.data[0][this.control.field]) {
|
|
2535
2539
|
this.tempValue = res.data[0];
|
|
2536
2540
|
this.value = res.data[0][this.control.field];
|
|
2537
2541
|
}
|
|
2538
|
-
else
|
|
2542
|
+
else {
|
|
2539
2543
|
this.setDefaultValue();
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
catch {
|
|
2543
2547
|
this.setDefaultValue();
|
|
2544
|
-
}
|
|
2548
|
+
}
|
|
2549
|
+
finally {
|
|
2550
|
+
this.cdr.detectChanges();
|
|
2551
|
+
}
|
|
2545
2552
|
}
|
|
2546
2553
|
onUpload(event) {
|
|
2547
2554
|
this.uploadingFiles = true;
|