sf-crud 13.2.60 → 13.2.61

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.
@@ -2779,25 +2779,30 @@ class ControlComponent {
2779
2779
  }
2780
2780
  }
2781
2781
  sendDependencyValue(data) {
2782
- if (this.control.dependency && this.setDependencyValue) {
2783
- if (this.control.subtype === 'dropdown' && this.dataFromService.length > 0 && typeof (data) !== "object") {
2784
- const selectedOption = this.dataFromService.find((item) => item[this.control.config?.optionValue] === data);
2785
- if (selectedOption) {
2786
- this.setDependencyValue.emit({ data: selectedOption[this.control.dependency.value], scope: this.control.dependency.scope });
2787
- }
2788
- }
2789
- else if (typeof (data) !== "object") {
2790
- this.setDependencyValue.emit({ data: data, scope: this.control.dependency.scope });
2791
- }
2792
- else if (typeof (this.control.dependency) === "object") {
2793
- this.setDependencyValue.emit({ data: data[this.control.dependency.value], scope: this.control.dependency.scope });
2794
- }
2795
- else if (Array.isArray(this.control.dependency)) {
2782
+ if (this.control.dependency) {
2783
+ if (Array.isArray(this.control.dependency)) {
2796
2784
  const array = this.control.dependency;
2797
2785
  array.forEach((d) => {
2798
- this.setDependencyValue.emit({ data: data[d.value], scope: d.scope });
2786
+ this.evaluateDependencyValue(data, d.value, d.scope);
2799
2787
  });
2800
2788
  }
2789
+ else {
2790
+ this.evaluateDependencyValue(data, this.control.dependency.value, this.control.dependency.scope);
2791
+ }
2792
+ }
2793
+ }
2794
+ evaluateDependencyValue(data, value, scope) {
2795
+ if ((this.control.subtype === 'dropdown' || this.control.subtype === 'multiselect' || this.control.subtype === 'group') && this.dataFromService.length > 0 && typeof (data) !== "object") {
2796
+ const selectedOption = this.dataFromService.find((item) => item[this.control.config?.optionValue] === data);
2797
+ if (selectedOption) {
2798
+ this.setDependencyValue.emit({ data: selectedOption[value], scope: scope });
2799
+ }
2800
+ }
2801
+ else if (typeof (data) !== "object") {
2802
+ this.setDependencyValue.emit({ data: data, scope: scope });
2803
+ }
2804
+ else {
2805
+ this.setDependencyValue.emit({ data: data[value], scope: scope });
2801
2806
  }
2802
2807
  }
2803
2808
  /**