osl-base-extended 2.0.30 → 2.0.31
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.
|
@@ -2703,7 +2703,7 @@ class DynamicForm {
|
|
|
2703
2703
|
this.loadApiDatasources();
|
|
2704
2704
|
}
|
|
2705
2705
|
ngOnChanges(changes) {
|
|
2706
|
-
if (changes['elements']) {
|
|
2706
|
+
if (changes['elements'] || changes['model']) {
|
|
2707
2707
|
this.loadApiDatasources();
|
|
2708
2708
|
}
|
|
2709
2709
|
}
|
|
@@ -2720,6 +2720,8 @@ class DynamicForm {
|
|
|
2720
2720
|
const allReady = elem.dependsOn.every(k => this.model?.[k] != null);
|
|
2721
2721
|
if (!allReady)
|
|
2722
2722
|
continue;
|
|
2723
|
+
if (elem.datasource?.length)
|
|
2724
|
+
continue;
|
|
2723
2725
|
}
|
|
2724
2726
|
elem.loadingIf = () => true;
|
|
2725
2727
|
const data = await this.datasourceCache.load(elem.apiService, elem.apiMethod, elem.apiBody ? elem.apiBody(this.model) : null);
|
|
@@ -2760,8 +2762,21 @@ class DynamicForm {
|
|
|
2760
2762
|
async _refreshDependents(changedKey) {
|
|
2761
2763
|
const dependents = this._flatElements().filter(e => e.dependsOn?.includes(changedKey));
|
|
2762
2764
|
for (const dep of dependents) {
|
|
2763
|
-
const body = dep.apiBody ? dep.apiBody(this.model) : undefined;
|
|
2764
2765
|
let valueCleared = false;
|
|
2766
|
+
// If any parent dependency is now null, clear field + datasource without API call
|
|
2767
|
+
const anyDepNull = dep.dependsOn.some(k => this.model[k] == null);
|
|
2768
|
+
if (anyDepNull) {
|
|
2769
|
+
if (this.model[dep.key] != null) {
|
|
2770
|
+
this.model[dep.key] = null;
|
|
2771
|
+
valueCleared = true;
|
|
2772
|
+
}
|
|
2773
|
+
dep.datasource = [];
|
|
2774
|
+
this.cdr.markForCheck();
|
|
2775
|
+
if (valueCleared)
|
|
2776
|
+
await this._refreshDependents(dep.key);
|
|
2777
|
+
continue;
|
|
2778
|
+
}
|
|
2779
|
+
const body = dep.apiBody ? dep.apiBody(this.model) : undefined;
|
|
2765
2780
|
if (dep.searchType !== 'Api' && dep.apiService && dep.apiMethod) {
|
|
2766
2781
|
dep.loadingIf = () => true;
|
|
2767
2782
|
this.cdr.markForCheck();
|