@ngx-smz/core 21.5.3 → 21.5.4

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.
@@ -5904,9 +5904,17 @@ class FormGroupComponent {
5904
5904
  // console.log(presetControlType, group.children[index]);
5905
5905
  const child = group.children[index];
5906
5906
  const inputRef = group.children[index]._inputFormControl;
5907
+ // mergeClone uses JSON serialization and drops functions/signals.
5908
+ // Restore non-serializable input fields after applying the control-type preset.
5907
5909
  group.children[index] = {
5908
5910
  ...mergeClone(presetControlType, { ...group.children[index], _inputFormControl: null }),
5909
- _inputFormControl: inputRef
5911
+ _inputFormControl: inputRef,
5912
+ visibilityFunction: child.visibilityFunction,
5913
+ warningFunction: child.warningFunction,
5914
+ dataDependency: child.dataDependency,
5915
+ warning: child.warning,
5916
+ tooltip: child.tooltip,
5917
+ popover: child.popover,
5910
5918
  };
5911
5919
  if (group.children[index]?.advancedSettings?.validators?.length > 0) {
5912
5920
  group.children[index].advancedSettings.validators = child.advancedSettings.validators;
@@ -6047,17 +6055,25 @@ class FormGroupComponent {
6047
6055
  }
6048
6056
  callVisibilityFunctions() {
6049
6057
  const formValues = this.viewdata.getData()?.data;
6058
+ let visibilityChanged = false;
6050
6059
  for (const group of this.config.groups) {
6051
6060
  for (const input of group.children.filter(x => x.visibilityFunction != null)) {
6052
6061
  if (this.config.isDebug) {
6053
6062
  console.log(`UpdateVisibilityDependsOnFormData called for ${input.propertyName} | Before: ${input.isVisible}`);
6054
6063
  }
6055
- input.isVisible = input.visibilityFunction(formValues);
6064
+ const nextVisible = input.visibilityFunction(formValues);
6065
+ if (input.isVisible !== nextVisible) {
6066
+ visibilityChanged = true;
6067
+ }
6068
+ input.isVisible = nextVisible;
6056
6069
  if (this.config.isDebug) {
6057
6070
  console.log(`UpdateVisibilityDependsOnFormData called for ${input.propertyName} | After: ${input.isVisible}`);
6058
6071
  }
6059
6072
  }
6060
6073
  }
6074
+ if (visibilityChanged) {
6075
+ this.cdf.markForCheck();
6076
+ }
6061
6077
  }
6062
6078
  callWarningFunctions() {
6063
6079
  const formValues = this.viewdata.getData()?.data;