@m4l/components 9.63.0 → 9.64.0

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.
Files changed (111) hide show
  1. package/components/DynamicForm/DynamicForm.d.ts.map +1 -1
  2. package/components/DynamicForm/DynamicForm.js +102 -96
  3. package/components/DynamicForm/DynamicForm.styles.d.ts.map +1 -1
  4. package/components/DynamicForm/DynamicForm.styles.js +77 -60
  5. package/components/DynamicForm/constants.d.ts +4 -4
  6. package/components/DynamicForm/constants.d.ts.map +1 -1
  7. package/components/DynamicForm/dictionary.d.ts +4 -0
  8. package/components/DynamicForm/dictionary.d.ts.map +1 -1
  9. package/components/DynamicForm/dictionary.js +5 -1
  10. package/components/DynamicForm/helpers/fieldContractAllowlist/fieldContractAllowlist.d.ts +4 -0
  11. package/components/DynamicForm/helpers/fieldContractAllowlist/fieldContractAllowlist.d.ts.map +1 -1
  12. package/components/DynamicForm/helpers/fieldContractAllowlist/fieldContractAllowlist.js +41 -35
  13. package/components/DynamicForm/helpers/fieldContractAllowlist/index.d.ts +1 -1
  14. package/components/DynamicForm/helpers/fieldContractAllowlist/index.d.ts.map +1 -1
  15. package/components/DynamicForm/helpers/filterUnknownFieldsFromSubmit/filterUnknownFieldsFromSubmit.d.ts.map +1 -1
  16. package/components/DynamicForm/helpers/filterUnknownFieldsFromSubmit/filterUnknownFieldsFromSubmit.js +16 -15
  17. package/components/DynamicForm/helpers/getFieldTypeApiKey/getFieldTypeApiKey.d.ts.map +1 -1
  18. package/components/DynamicForm/helpers/getFieldTypeApiKey/getFieldTypeApiKey.js +4 -1
  19. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeAutocompletePropsFromBackend/normalizeAutocompletePropsFromBackend.d.ts.map +1 -1
  20. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeAutocompletePropsFromBackend/normalizeAutocompletePropsFromBackend.js +8 -8
  21. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeCheckboxPropsFromBackend/normalizeCheckboxPropsFromBackend.d.ts.map +1 -1
  22. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeCheckboxPropsFromBackend/normalizeCheckboxPropsFromBackend.js +5 -5
  23. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeDateRangePickerPropsFromBackend/normalizeDateRangePickerPropsFromBackend.d.ts.map +1 -1
  24. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeDateRangePickerPropsFromBackend/normalizeDateRangePickerPropsFromBackend.js +8 -8
  25. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeDaysOfWeekPickerPropsFromBackend/normalizeDaysOfWeekPickerPropsFromBackend.d.ts.map +1 -1
  26. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeDaysOfWeekPickerPropsFromBackend/normalizeDaysOfWeekPickerPropsFromBackend.js +10 -10
  27. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeImageSelectorPropsFromBackend/normalizeImageSelectorPropsFromBackend.d.ts.map +1 -1
  28. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeImageSelectorPropsFromBackend/normalizeImageSelectorPropsFromBackend.js +5 -5
  29. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeNumberInputPropsFromBackend/normalizeNumberInputPropsFromBackend.d.ts.map +1 -1
  30. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeNumberInputPropsFromBackend/normalizeNumberInputPropsFromBackend.js +3 -3
  31. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeRadioGroupPropsFromBackend/normalizeRadioGroupPropsFromBackend.d.ts.map +1 -1
  32. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeRadioGroupPropsFromBackend/normalizeRadioGroupPropsFromBackend.js +8 -8
  33. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeSelectPropsFromBackend/normalizeSelectPropsFromBackend.d.ts.map +1 -1
  34. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeSelectPropsFromBackend/normalizeSelectPropsFromBackend.js +16 -16
  35. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeTextFieldPropsFromBackend/normalizeTextFieldPropsFromBackend.d.ts.map +1 -1
  36. package/components/DynamicForm/helpers/resolveFieldComponent/normalizations/normalizeTextFieldPropsFromBackend/normalizeTextFieldPropsFromBackend.js +6 -6
  37. package/components/DynamicForm/helpers/resolveFieldComponent/resolveFieldComponent.d.ts +1 -1
  38. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/alertStrategy/alertStrategy.d.ts +4 -0
  39. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/alertStrategy/alertStrategy.d.ts.map +1 -0
  40. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/alertStrategy/alertStrategy.js +35 -0
  41. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/autocompleteStrategy/autocompleteStrategy.d.ts.map +1 -1
  42. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/autocompleteStrategy/autocompleteStrategy.js +29 -30
  43. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/checkableListStrategy/checkableListStrategy.d.ts.map +1 -1
  44. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/checkableListStrategy/checkableListStrategy.js +14 -15
  45. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/checkableListStrategy/helpers/whitelist/propertyNormalizers.d.ts.map +1 -1
  46. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/checkableListStrategy/helpers/whitelist/propertyNormalizers.js +4 -5
  47. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/checkboxStrategy/checkboxStrategy.js +14 -14
  48. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/dateRangePickerStrategy/dateRangePickerStrategy.js +9 -9
  49. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/daysOfWeekPickerStrategy/daysOfWeekPickerStrategy.js +6 -6
  50. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/imageSelectorStrategy/imageSelectorStrategy.d.ts.map +1 -1
  51. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/imageSelectorStrategy/imageSelectorStrategy.js +20 -21
  52. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/index.d.ts +1 -0
  53. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/index.d.ts.map +1 -1
  54. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/numberInputStrategy/numberInputStrategy.js +10 -10
  55. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/radioGroupStrategy/radioGroupStrategy.js +10 -10
  56. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/registry.d.ts.map +1 -1
  57. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/registry.js +14 -12
  58. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/selectStrategy/selectStrategy.d.ts.map +1 -1
  59. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/selectStrategy/selectStrategy.js +18 -19
  60. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/selectStrategy/types.d.ts +1 -1
  61. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/selectStrategy/types.d.ts.map +1 -1
  62. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/textFieldStrategy/textFieldStrategy.d.ts.map +1 -1
  63. package/components/DynamicForm/helpers/resolveFieldComponent/strategies/textFieldStrategy/textFieldStrategy.js +31 -32
  64. package/components/DynamicForm/helpers/resolveFieldContractAliases/index.d.ts +1 -1
  65. package/components/DynamicForm/helpers/resolveFieldContractAliases/index.d.ts.map +1 -1
  66. package/components/DynamicForm/helpers/resolveFieldContractAliases/resolveFieldContractAliases.d.ts +2 -0
  67. package/components/DynamicForm/helpers/resolveFieldContractAliases/resolveFieldContractAliases.d.ts.map +1 -1
  68. package/components/DynamicForm/helpers/resolveFieldContractAliases/resolveFieldContractAliases.js +14 -10
  69. package/components/DynamicForm/helpers/resolveFormSections/index.d.ts +3 -0
  70. package/components/DynamicForm/helpers/resolveFormSections/index.d.ts.map +1 -0
  71. package/components/DynamicForm/helpers/resolveFormSections/resolveFormSections.d.ts +12 -0
  72. package/components/DynamicForm/helpers/resolveFormSections/resolveFormSections.d.ts.map +1 -0
  73. package/components/DynamicForm/helpers/resolveFormSections/resolveFormSections.js +89 -0
  74. package/components/DynamicForm/helpers/resolveFormSections/types.d.ts +14 -0
  75. package/components/DynamicForm/helpers/resolveFormSections/types.d.ts.map +1 -0
  76. package/components/DynamicForm/hooks/useDynamicForm/useDynamicForm.d.ts.map +1 -1
  77. package/components/DynamicForm/hooks/useDynamicForm/useDynamicForm.js +50 -42
  78. package/components/DynamicForm/hooks/useDynamicFormConditionals/useDynamicFormConditionals.d.ts.map +1 -1
  79. package/components/DynamicForm/hooks/useDynamicFormConditionals/useDynamicFormConditionals.js +28 -19
  80. package/components/DynamicForm/hooks/useDynamicFormData/useDynamicFormData.d.ts.map +1 -1
  81. package/components/DynamicForm/hooks/useDynamicFormData/useDynamicFormData.js +64 -62
  82. package/components/DynamicForm/hooks/useFieldsWithFetchedOptions/useFieldsWithFetchedOptions.d.ts.map +1 -1
  83. package/components/DynamicForm/hooks/useFieldsWithFetchedOptions/useFieldsWithFetchedOptions.js +37 -44
  84. package/components/DynamicForm/slots/DynamicFormEnum.d.ts +2 -0
  85. package/components/DynamicForm/slots/DynamicFormEnum.d.ts.map +1 -1
  86. package/components/DynamicForm/slots/DynamicFormEnum.js +1 -1
  87. package/components/DynamicForm/slots/DynamicFormSlots.d.ts +6 -0
  88. package/components/DynamicForm/slots/DynamicFormSlots.d.ts.map +1 -1
  89. package/components/DynamicForm/slots/DynamicFormSlots.js +51 -43
  90. package/components/DynamicForm/subcomponents/DynamicFormContent/DynamicFormContent.d.ts.map +1 -1
  91. package/components/DynamicForm/subcomponents/DynamicFormContent/DynamicFormContent.js +108 -200
  92. package/components/DynamicForm/subcomponents/DynamicFormFieldsFlow/DynamicFormFieldsFlow.d.ts +4 -0
  93. package/components/DynamicForm/subcomponents/DynamicFormFieldsFlow/DynamicFormFieldsFlow.d.ts.map +1 -0
  94. package/components/DynamicForm/subcomponents/DynamicFormFieldsFlow/DynamicFormFieldsFlow.js +140 -0
  95. package/components/DynamicForm/subcomponents/DynamicFormFieldsFlow/types.d.ts +22 -0
  96. package/components/DynamicForm/subcomponents/DynamicFormFieldsFlow/types.d.ts.map +1 -0
  97. package/components/DynamicForm/subcomponents/DynamicFormSection/DynamicFormSection.d.ts +4 -0
  98. package/components/DynamicForm/subcomponents/DynamicFormSection/DynamicFormSection.d.ts.map +1 -0
  99. package/components/DynamicForm/subcomponents/DynamicFormSection/DynamicFormSection.js +73 -0
  100. package/components/DynamicForm/subcomponents/DynamicFormSection/cardStyles.d.ts +13 -0
  101. package/components/DynamicForm/subcomponents/DynamicFormSection/cardStyles.d.ts.map +1 -0
  102. package/components/DynamicForm/subcomponents/DynamicFormSection/cardStyles.js +15 -0
  103. package/components/DynamicForm/subcomponents/DynamicFormSection/slots.d.ts +10 -0
  104. package/components/DynamicForm/subcomponents/DynamicFormSection/slots.d.ts.map +1 -0
  105. package/components/DynamicForm/subcomponents/DynamicFormSection/slots.js +65 -0
  106. package/components/DynamicForm/subcomponents/DynamicFormSection/types.d.ts +11 -0
  107. package/components/DynamicForm/subcomponents/DynamicFormSection/types.d.ts.map +1 -0
  108. package/components/DynamicForm/types.d.ts +19 -12
  109. package/components/DynamicForm/types.d.ts.map +1 -1
  110. package/components/DynamicForm/types.js +6 -2
  111. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"selectStrategy.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/DynamicForm/helpers/resolveFieldComponent/strategies/selectStrategy/selectStrategy.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAiC,MAAM,UAAU,CAAC;AAGtF,0BAA0B;AAC1B,eAAO,MAAM,cAAc,EAAE,sBA+B5B,CAAC"}
1
+ {"version":3,"file":"selectStrategy.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/DynamicForm/helpers/resolveFieldComponent/strategies/selectStrategy/selectStrategy.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAiC,MAAM,UAAU,CAAC;AAGtF,0BAA0B;AAC1B,eAAO,MAAM,cAAc,EAAE,sBA8B5B,CAAC"}
@@ -1,34 +1,33 @@
1
- import { jsx as b } from "@emotion/react/jsx-runtime";
2
- import { resolveFieldMandatory as z } from "../../../resolveFieldContractAliases/resolveFieldContractAliases.js";
3
- import { normalizeSelectPropsFromBackend as F } from "../../normalizations/normalizeSelectPropsFromBackend/normalizeSelectPropsFromBackend.js";
4
- import { RHFSelect as S } from "../../../../../hook-form/RHFSelect/RHFSelect.js";
5
- const B = {
1
+ import { jsx as R } from "@emotion/react/jsx-runtime";
2
+ import { resolveFieldMandatory as b, resolveFieldReadOnly as S } from "../../../resolveFieldContractAliases/resolveFieldContractAliases.js";
3
+ import { normalizeSelectPropsFromBackend as h } from "../../normalizations/normalizeSelectPropsFromBackend/normalizeSelectPropsFromBackend.js";
4
+ import { RHFSelect as z } from "../../../../../hook-form/RHFSelect/RHFSelect.js";
5
+ const H = {
6
6
  componentIds: ["RHFSelect"],
7
7
  /** Renders the RHFSelect component for the given field and context. */
8
8
  render(o) {
9
- const { field: e, props: l } = o, { size: r, disabled: t, readOnly: n, getLabel: s, hostApiRemote: a, suppressLabel: d } = l, { name: i, placeholder: p } = e, c = z(e), m = F(e, s, a), {
9
+ const { field: e, props: l } = o, { size: r, disabled: t, readOnly: s, getLabel: n, hostApiRemote: d, suppressLabel: a } = l, { name: i, placeholder: p } = e, c = b(e), m = h(e, n, d), {
10
10
  resolvedLabel: y,
11
- multiple: O,
12
- readOnly: R,
13
- resolvedSelectOptions: f,
14
- ...v
15
- } = m;
16
- return /* @__PURE__ */ b(
17
- S,
11
+ multiple: f,
12
+ resolvedSelectOptions: v,
13
+ ...F
14
+ } = m, O = S(e, s);
15
+ return /* @__PURE__ */ R(
16
+ z,
18
17
  {
19
18
  name: i,
20
19
  size: r,
21
- ...!d && { label: y, mandatory: c },
22
- options: f,
20
+ ...!a && { label: y, mandatory: c },
21
+ options: v,
23
22
  disabled: t,
24
- readOnly: !!(n || R),
25
- multiple: O,
23
+ readOnly: O,
24
+ multiple: f,
26
25
  placeholder: p || void 0,
27
- ...v
26
+ ...F
28
27
  }
29
28
  );
30
29
  }
31
30
  };
32
31
  export {
33
- B as selectStrategy
32
+ H as selectStrategy
34
33
  };
@@ -5,7 +5,7 @@ import { NormalizedLabeledFieldComponentPropsResult } from '../types';
5
5
  * Props from `RHFSelectRHFComponentPropsFromBackend` that are valid `RHFSelect` component props.
6
6
  * The `option*Path` keys are configuration for the normalization step and must not be forwarded to the component.
7
7
  */
8
- type SelectComponentProps = Pick<RHFSelectRHFComponentPropsFromBackend, 'id' | 'placeholder' | 'multiple' | 'readOnly'>;
8
+ type SelectComponentProps = Pick<RHFSelectRHFComponentPropsFromBackend, 'id' | 'placeholder' | 'multiple'>;
9
9
  /** Result of {@link normalizeSelectPropsFromBackend}: normalized RHF props plus the resolved visible label. */
10
10
  export type NormalizedSelectPropsFromBackendResult = NormalizedLabeledFieldComponentPropsResult<SelectComponentProps> & {
11
11
  /** Options safe for {@link RHFSelect} (defensively normalized from `field.options`). */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/DynamicForm/helpers/resolveFieldComponent/strategies/selectStrategy/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,KAAK,EAAE,0CAA0C,EAAE,MAAM,UAAU,CAAC;AAE3E;;;GAGG;AACH,KAAK,oBAAoB,GAAG,IAAI,CAC9B,qCAAqC,EACrC,IAAI,GAAG,aAAa,GAAG,UAAU,GAAG,UAAU,CAC/C,CAAC;AAEF,+GAA+G;AAC/G,MAAM,MAAM,sCAAsC,GAChD,0CAA0C,CAAC,oBAAoB,CAAC,GAAG;IACnE,wFAAwF;IACxF,qBAAqB,EAAE,YAAY,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CACxD,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/DynamicForm/helpers/resolveFieldComponent/strategies/selectStrategy/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,KAAK,EAAE,0CAA0C,EAAE,MAAM,UAAU,CAAC;AAE3E;;;GAGG;AACH,KAAK,oBAAoB,GAAG,IAAI,CAC9B,qCAAqC,EACrC,IAAI,GAAG,aAAa,GAAG,UAAU,CAClC,CAAC;AAEF,+GAA+G;AAC/G,MAAM,MAAM,sCAAsC,GAChD,0CAA0C,CAAC,oBAAoB,CAAC,GAAG;IACnE,wFAAwF;IACxF,qBAAqB,EAAE,YAAY,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CACxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"textFieldStrategy.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/DynamicForm/helpers/resolveFieldComponent/strategies/textFieldStrategy/textFieldStrategy.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,sBAAsB,EAAiC,MAAM,UAAU,CAAC;AAMtF,6BAA6B;AAC7B,eAAO,MAAM,iBAAiB,EAAE,sBAmF/B,CAAC"}
1
+ {"version":3,"file":"textFieldStrategy.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/DynamicForm/helpers/resolveFieldComponent/strategies/textFieldStrategy/textFieldStrategy.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,sBAAsB,EAAiC,MAAM,UAAU,CAAC;AAMtF,6BAA6B;AAC7B,eAAO,MAAM,iBAAiB,EAAE,sBAkF/B,CAAC"}
@@ -1,74 +1,73 @@
1
- import { jsx as e } from "@emotion/react/jsx-runtime";
2
- import { NotificationWarningFill as v } from "@m4l/icons";
3
- import { DYNAMIC_FORM_DICTIONARY as E } from "../../../../dictionary.js";
4
- import { Icon as H } from "@m4l/base";
5
- import { resolveFieldMandatory as k } from "../../../resolveFieldContractAliases/resolveFieldContractAliases.js";
6
- import { normalizeTextFieldPropsFromBackend as z } from "../../normalizations/normalizeTextFieldPropsFromBackend/normalizeTextFieldPropsFromBackend.js";
7
- import { DynamicFormFallbackEndIconChipStyled as D } from "../../../../slots/DynamicFormSlots.js";
8
- import { RHFTextFieldPassword as M } from "../../../../../hook-form/RHFTextFieldPassword/RHFTextFieldPassword.js";
9
- import { RHFResourceDictionary as g } from "../../../../../hook-form/RHFResourceDictionary/RHFResourceDictionary.js";
10
- import { RHFTextField as w } from "../../../../../hook-form/RHFTextField/RHFTextField.js";
1
+ import { jsx as r } from "@emotion/react/jsx-runtime";
2
+ import { NotificationWarningFill as N } from "@m4l/icons";
3
+ import { DYNAMIC_FORM_DICTIONARY as h } from "../../../../dictionary.js";
4
+ import { Icon as E } from "@m4l/base";
5
+ import { resolveFieldMandatory as H, resolveFieldReadOnly as k } from "../../../resolveFieldContractAliases/resolveFieldContractAliases.js";
6
+ import { normalizeTextFieldPropsFromBackend as D } from "../../normalizations/normalizeTextFieldPropsFromBackend/normalizeTextFieldPropsFromBackend.js";
7
+ import { DynamicFormFallbackEndIconChipStyled as M } from "../../../../slots/DynamicFormSlots.js";
8
+ import { RHFTextFieldPassword as g } from "../../../../../hook-form/RHFTextFieldPassword/RHFTextFieldPassword.js";
9
+ import { RHFResourceDictionary as w } from "../../../../../hook-form/RHFResourceDictionary/RHFResourceDictionary.js";
10
+ import { RHFTextField as z } from "../../../../../hook-form/RHFTextField/RHFTextField.js";
11
11
  const K = {
12
12
  componentIds: ["RHFTextField", "RHFTextFieldPassword", "RHFResourceDictionary"],
13
13
  /** Renders the RHFTextField component for the given field and context. */
14
14
  render(f) {
15
- const { field: r, props: u, isFallback: o } = f, { size: n = "medium", disabled: t, readOnly: R, getLabel: I, hostApiRemote: O, slots: b, suppressLabel: a } = u, { name: d, placeholder: i } = r, c = k(r), P = z(r, I, O), {
15
+ const { field: o, props: u, isFallback: e } = f, { size: n = "medium", disabled: t, readOnly: R, getLabel: I, hostApiRemote: b, slots: O, suppressLabel: a } = u, { name: d, placeholder: i } = o, c = H(o), P = D(o, I, b), {
16
16
  resolvedLabel: s,
17
17
  startIcon: p,
18
18
  endIcon: m,
19
- readOnly: T,
20
- ...y
21
- } = P, l = !!(R || T), F = l ? { readOnly: !0 } : void 0, x = o ? { readOnly: !0 } : F, N = /* @__PURE__ */ e(
22
- D,
19
+ ...F
20
+ } = P, l = k(o, R), y = l ? { readOnly: !0 } : void 0, T = e ? { readOnly: !0 } : y, v = /* @__PURE__ */ r(
21
+ M,
23
22
  {
24
23
  size: n,
25
- label: I(E.UNKNOWN_COMPONENT_MESSAGE),
26
- startIcon: /* @__PURE__ */ e(H, { src: /* @__PURE__ */ e(v, {}), color: "chips.warning.contained.color" }),
24
+ label: I(h.UNKNOWN_COMPONENT_MESSAGE),
25
+ startIcon: /* @__PURE__ */ r(E, { src: /* @__PURE__ */ r(N, {}), color: "chips.warning.contained.color" }),
27
26
  color: "warning",
28
27
  opacity: !0
29
28
  }
30
- ), h = o ? b?.fallbackEndIcon ?? N : void 0;
31
- return !o && r.fieldType.componentId === "RHFTextFieldPassword" ? /* @__PURE__ */ e(
32
- M,
29
+ ), x = e ? O?.fallbackEndIcon ?? v : void 0;
30
+ return !e && o.fieldType.componentId === "RHFTextFieldPassword" ? /* @__PURE__ */ r(
31
+ g,
33
32
  {
34
33
  name: d,
35
34
  size: n,
36
35
  ...!a && { label: s, mandatory: c },
37
36
  disabled: t,
38
37
  placeholder: i || void 0,
39
- ...y,
40
- InputProps: F,
38
+ ...F,
39
+ InputProps: y,
41
40
  readOnly: l,
42
41
  startIcon: p,
43
42
  endIcon: m
44
43
  }
45
- ) : !o && r.fieldType.componentId === "RHFResourceDictionary" ? /* @__PURE__ */ e(
46
- g,
44
+ ) : !e && o.fieldType.componentId === "RHFResourceDictionary" ? /* @__PURE__ */ r(
45
+ w,
47
46
  {
48
47
  name: d,
49
48
  size: n,
50
49
  ...!a && { label: s, mandatory: c },
51
50
  disabled: t,
52
51
  placeholder: i || void 0,
53
- ...y,
54
- InputProps: F,
52
+ ...F,
53
+ InputProps: y,
55
54
  readOnly: l,
56
55
  startIcon: p,
57
56
  endIcon: m
58
57
  }
59
- ) : /* @__PURE__ */ e(
60
- w,
58
+ ) : /* @__PURE__ */ r(
59
+ z,
61
60
  {
62
61
  name: d,
63
62
  size: n,
64
63
  ...!a && { label: s, mandatory: c },
65
64
  disabled: t,
66
65
  placeholder: i || void 0,
67
- ...y,
66
+ ...F,
68
67
  startIcon: p,
69
- endIcon: o ? h : m,
70
- InputProps: x,
71
- readOnly: o || l
68
+ endIcon: e ? x : m,
69
+ InputProps: T,
70
+ readOnly: e || l
72
71
  }
73
72
  );
74
73
  }
@@ -1,2 +1,2 @@
1
- export { resolveFieldHelperMessage, resolveFieldLabelValue, resolveFieldMandatory, resolveFieldSymbol, resolveFieldTypeComponentProps, } from './resolveFieldContractAliases';
1
+ export { resolveFieldHelperMessage, resolveFieldLabelValue, resolveFieldMandatory, resolveFieldReadOnly, resolveFieldSymbol, resolveFieldTypeComponentProps, } from './resolveFieldContractAliases';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/helpers/resolveFieldContractAliases/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,8BAA8B,GAC/B,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/helpers/resolveFieldContractAliases/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,8BAA8B,GAC/B,MAAM,+BAA+B,CAAC"}
@@ -6,6 +6,8 @@ import { CombinedFieldComponentPropsFromBackend, Field, FieldType } from '../../
6
6
  export declare function resolveFieldTypeComponentProps(fieldType: Pick<FieldType, 'componentProps'> | null | undefined): CombinedFieldComponentPropsFromBackend | undefined;
7
7
  /** Resolve whether the field is mandatory, defaulting to false when absent. */
8
8
  export declare function resolveFieldMandatory(field: Pick<Field, 'mandatory'>): boolean;
9
+ /** Combine the form setting with the field's root read-only flag. */
10
+ export declare function resolveFieldReadOnly(field: Pick<Field, 'readOnly'>, formReadOnly?: boolean): boolean;
9
11
  /**
10
12
  * Resolve the field helper text from `helperMessage`.
11
13
  */
@@ -1 +1 @@
1
- {"version":3,"file":"resolveFieldContractAliases.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/helpers/resolveFieldContractAliases/resolveFieldContractAliases.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sCAAsC,EACtC,KAAK,EACL,SAAS,EACV,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,gBAAgB,CAAC,GAAG,IAAI,GAAG,SAAS,GAC9D,sCAAsC,GAAG,SAAS,CAKpD;AAED,+EAA+E;AAC/E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG,OAAO,CAE9E;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,eAAe,CAAC,GAClC,MAAM,GAAG,IAAI,CAEf;AAED,kDAAkD;AAClD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAEjF;AAED,iGAAiG;AACjG,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,eAAe,CAAC,GAAG,MAAM,GAAG,SAAS,CAE1F"}
1
+ {"version":3,"file":"resolveFieldContractAliases.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/helpers/resolveFieldContractAliases/resolveFieldContractAliases.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sCAAsC,EACtC,KAAK,EACL,SAAS,EACV,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,gBAAgB,CAAC,GAAG,IAAI,GAAG,SAAS,GAC9D,sCAAsC,GAAG,SAAS,CAKpD;AAED,+EAA+E;AAC/E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG,OAAO,CAE9E;AAED,qEAAqE;AACrE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAEpG;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,eAAe,CAAC,GAClC,MAAM,GAAG,IAAI,CAEf;AAED,kDAAkD;AAClD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAEjF;AAED,iGAAiG;AACjG,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,eAAe,CAAC,GAAG,MAAM,GAAG,SAAS,CAE1F"}
@@ -1,23 +1,27 @@
1
- function n(e) {
1
+ function r(e) {
2
2
  if (e)
3
3
  return e.componentProps;
4
4
  }
5
- function r(e) {
5
+ function l(e) {
6
6
  return e.mandatory ?? !1;
7
7
  }
8
- function o(e) {
8
+ function o(e, n) {
9
+ return n === !0 || e.readOnly === !0;
10
+ }
11
+ function t(e) {
9
12
  return e.helperMessage ?? null;
10
13
  }
11
- function l(e) {
14
+ function u(e) {
12
15
  return e.label ?? null;
13
16
  }
14
- function t(e) {
17
+ function i(e) {
15
18
  return e.magnitudeUnit?.symbol || void 0;
16
19
  }
17
20
  export {
18
- o as resolveFieldHelperMessage,
19
- l as resolveFieldLabelValue,
20
- r as resolveFieldMandatory,
21
- t as resolveFieldSymbol,
22
- n as resolveFieldTypeComponentProps
21
+ t as resolveFieldHelperMessage,
22
+ u as resolveFieldLabelValue,
23
+ l as resolveFieldMandatory,
24
+ o as resolveFieldReadOnly,
25
+ i as resolveFieldSymbol,
26
+ r as resolveFieldTypeComponentProps
23
27
  };
@@ -0,0 +1,3 @@
1
+ export * from './resolveFormSections';
2
+ export type * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/helpers/resolveFormSections/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,mBAAmB,SAAS,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Field } from '../../types';
2
+ import { FormSectionIssue, ResolvedFormSections } from './types';
3
+ /** Identify structural section records even when their declared binding is malformed. */
4
+ export declare function isSectionField(field: Pick<Field, 'fieldType'>): boolean;
5
+ /** Keep only records safe to pass to DynamicForm's existing field pipeline. */
6
+ export declare function normalizeDynamicFormFields(value: unknown): {
7
+ fields: Field[];
8
+ issues: FormSectionIssue[];
9
+ };
10
+ /** Resolve section ownership from one stable top-level field registry. */
11
+ export declare function resolveFormSections(fields: Field[]): ResolvedFormSections;
12
+ //# sourceMappingURL=resolveFormSections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveFormSections.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/helpers/resolveFormSections/resolveFormSections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEtE,yFAAyF;AACzF,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG,OAAO,CAEvE;AAED,+EAA+E;AAC/E,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG;IAC1D,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B,CAoDA;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,oBAAoB,CAuEzE"}
@@ -0,0 +1,89 @@
1
+ import { isRecord as l } from "../isRecord/isRecord.js";
2
+ import { isSupportedInformationalField as p } from "../fieldContractAllowlist/fieldContractAllowlist.js";
3
+ function u(t) {
4
+ return t.fieldType?.id === "fft_section" || t.fieldType?.componentId === "Section";
5
+ }
6
+ function g(t) {
7
+ if (!Array.isArray(t))
8
+ return { fields: [], issues: t == null ? [] : ["invalid-field"] };
9
+ const i = /* @__PURE__ */ new Set(), c = [];
10
+ for (const e of t) {
11
+ if (!l(e) || typeof e.id != "number" || !Number.isSafeInteger(e.id)) {
12
+ i.add("invalid-field");
13
+ continue;
14
+ }
15
+ c.push({
16
+ ...e,
17
+ options: Array.isArray(e.options) ? e.options : [],
18
+ validations: Array.isArray(e.validations) ? e.validations : [],
19
+ currentValue: e.currentValue ?? null,
20
+ defaultValue: e.defaultValue ?? null
21
+ });
22
+ }
23
+ const o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
24
+ for (const e of c)
25
+ if (o.set(e.id, (o.get(e.id) ?? 0) + 1), typeof e.name == "string" && e.name.trim()) {
26
+ const d = u(e) ? f : a;
27
+ d.set(e.name, (d.get(e.name) ?? 0) + 1);
28
+ }
29
+ return { fields: c.filter((e) => {
30
+ const d = (o.get(e.id) ?? 0) > 1, s = typeof e.name == "string" && e.name.trim() !== "" && (u(e) ? (f.get(e.name) ?? 0) > 1 || a.has(e.name) : (a.get(e.name) ?? 0) > 1);
31
+ return d && i.add("duplicate-field-id"), s && i.add("duplicate-field-name"), !d && !s;
32
+ }), issues: [...i] };
33
+ }
34
+ function h(t) {
35
+ const i = /* @__PURE__ */ new Set(), c = new Map(t.map((n) => [n.id, n])), o = /* @__PURE__ */ new Map(), a = [], f = t.filter(u).sort((n, e) => (n.displayOrder ?? 1 / 0) - (e.displayOrder ?? 1 / 0));
36
+ for (const n of f) {
37
+ if (n.fieldType?.id !== "fft_section" || n.fieldType?.componentId !== "Section") {
38
+ i.add("invalid-section");
39
+ continue;
40
+ }
41
+ if (!Array.isArray(n.value) || n.value.length === 0) {
42
+ i.add("empty-section");
43
+ continue;
44
+ }
45
+ const e = [], d = /* @__PURE__ */ new Set();
46
+ for (const s of n.value) {
47
+ if (typeof s != "number" || !Number.isSafeInteger(s)) {
48
+ i.add("invalid-reference");
49
+ continue;
50
+ }
51
+ if (d.has(s)) {
52
+ i.add("duplicate-reference");
53
+ continue;
54
+ }
55
+ d.add(s);
56
+ const r = c.get(s);
57
+ if (!r) {
58
+ i.add("missing-reference");
59
+ continue;
60
+ }
61
+ if (u(r)) {
62
+ i.add("nested-section");
63
+ continue;
64
+ }
65
+ if (!p(r) && (typeof r.name != "string" || r.name.trim() === "")) {
66
+ i.add("unnamed-field");
67
+ continue;
68
+ }
69
+ if (o.has(s)) {
70
+ i.add("duplicate-ownership");
71
+ continue;
72
+ }
73
+ o.set(s, n), e.push(r);
74
+ }
75
+ e.length > 0 ? a.push({ field: n, fields: e }) : i.add("empty-section");
76
+ }
77
+ return {
78
+ fields: t,
79
+ sections: a,
80
+ ungroupedFields: t.filter((n) => !u(n) && !o.has(n.id)),
81
+ ownerByFieldId: o,
82
+ issues: [...i]
83
+ };
84
+ }
85
+ export {
86
+ u as isSectionField,
87
+ g as normalizeDynamicFormFields,
88
+ h as resolveFormSections
89
+ };
@@ -0,0 +1,14 @@
1
+ import { Field } from '../../types';
2
+ export type FormSectionIssue = 'invalid-field' | 'duplicate-field-id' | 'duplicate-field-name' | 'invalid-section' | 'empty-section' | 'invalid-reference' | 'missing-reference' | 'duplicate-reference' | 'duplicate-ownership' | 'nested-section' | 'unnamed-field';
3
+ export interface ResolvedFormSection {
4
+ field: Field;
5
+ fields: Field[];
6
+ }
7
+ export interface ResolvedFormSections {
8
+ fields: Field[];
9
+ sections: ResolvedFormSection[];
10
+ ungroupedFields: Field[];
11
+ ownerByFieldId: Map<number, Field>;
12
+ issues: FormSectionIssue[];
13
+ }
14
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/helpers/resolveFormSections/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,MAAM,gBAAgB,GACxB,eAAe,GACf,oBAAoB,GACpB,sBAAsB,GACtB,iBAAiB,GACjB,eAAe,GACf,mBAAmB,GACnB,mBAAmB,GACnB,qBAAqB,GACrB,qBAAqB,GACrB,gBAAgB,GAChB,eAAe,CAAC;AAEpB,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAChC,eAAe,EAAE,KAAK,EAAE,CAAC;IACzB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACnC,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDynamicForm.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/hooks/useDynamicForm/useDynamicForm.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAqB,MAAM,aAAa,CAAC;AAWxE;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,sBAAsB;;;EAsG1D"}
1
+ {"version":3,"file":"useDynamicForm.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/hooks/useDynamicForm/useDynamicForm.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAqB,MAAM,aAAa,CAAC;AA0BxE;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,sBAAsB;;;EA+H1D"}
@@ -1,61 +1,69 @@
1
- import { useMemo as f } from "react";
2
- import { EMPTY_DATA as h } from "../../constants.js";
3
- import { createValidationPartialObject as g, createValidationSchema as A, createValidationFullObject as N } from "../../../hook-form/RHFormProvider/schema.js";
4
- import { useUserPreferences as T, useModuleDictionary as w } from "@m4l/core";
5
- import { resolveInitialValue as C } from "../../helpers/resolveInitialValue/resolveInitialValue.js";
6
- import { isSupportedDynamicFormField as D } from "../../helpers/fieldContractAllowlist/fieldContractAllowlist.js";
7
- import { createFieldValidationSchema as E } from "../../helpers/createFieldValidationSchema/createFieldValidationSchema.js";
8
- import { evaluateConditionalRule as d } from "../../helpers/evaluateConditionalRule/evaluateConditionalRule.js";
9
- function I(m) {
10
- const c = T().timeZone ?? null, a = m.fields ?? h.fields, l = m.conditionalRules ?? h.conditionalRules, { getLabel: u } = w(), y = f(() => {
11
- const n = {};
12
- return a.forEach((e) => {
13
- e.isVisible !== !1 && typeof e.name == "string" && e.name.trim() !== "" && (n[e.name] = C(e, { timeZone: c }));
14
- }), n;
15
- }, [a, c]), F = f(() => {
16
- const n = g({});
17
- return a.forEach((e) => {
18
- if (typeof e.name != "string" || e.name.trim() === "" || !D(e))
1
+ import { useMemo as c } from "react";
2
+ import { EMPTY_DATA as F } from "../../constants.js";
3
+ import { createValidationPartialObject as R, createValidationSchema as E, createValidationFullObject as I } from "../../../hook-form/RHFormProvider/schema.js";
4
+ import { useUserPreferences as M, useModuleDictionary as P } from "@m4l/core";
5
+ import { normalizeDynamicFormFields as j, resolveFormSections as O, isSectionField as y } from "../../helpers/resolveFormSections/resolveFormSections.js";
6
+ import { isSupportedInformationalField as g, isSupportedDynamicFormField as Z } from "../../helpers/fieldContractAllowlist/fieldContractAllowlist.js";
7
+ import { resolveInitialValue as x } from "../../helpers/resolveInitialValue/resolveInitialValue.js";
8
+ import { createFieldValidationSchema as z } from "../../helpers/createFieldValidationSchema/createFieldValidationSchema.js";
9
+ import { evaluateConditionalRule as S } from "../../helpers/evaluateConditionalRule/evaluateConditionalRule.js";
10
+ function b(s, a) {
11
+ return s.some(
12
+ (e) => e.actionType === "show" && S(e, a[e.sourceFieldName]) || e.actionType === "hide" && !S(e, a[e.sourceFieldName])
13
+ );
14
+ }
15
+ function J(s) {
16
+ const a = M().timeZone ?? null, e = c(
17
+ () => j(s.fields ?? F.fields).fields,
18
+ [s.fields]
19
+ ), m = s.conditionalRules ?? F.conditionalRules, { ownerByFieldId: d } = c(() => O(e), [e]), { getLabel: h } = P(), V = c(() => {
20
+ const t = {};
21
+ return e.forEach((i) => {
22
+ i.isVisible !== !1 && !y(i) && !g(i) && typeof i.name == "string" && i.name.trim() !== "" && (t[i.name] = x(i, { timeZone: a }));
23
+ }), t;
24
+ }, [e, a]), v = c(() => {
25
+ const t = R({});
26
+ return e.forEach((i) => {
27
+ if (typeof i.name != "string" || i.name.trim() === "" || y(i) || !Z(i) || g(i))
19
28
  return;
20
- const i = E(e, u);
21
- if (!i)
29
+ const r = z(i, h);
30
+ if (!r)
22
31
  return;
23
- const S = !e.isConditional && e.isVisible !== !1;
24
- if (e.isConditional === !1) {
25
- n[e.name] = S ? i : i.optional();
32
+ const n = d.get(i.id), l = n?.isConditional && typeof n.name == "string" ? m.filter((o) => o.isActive && o.targetFieldName === n.name) : [];
33
+ if (!i.isConditional && !n?.isConditional) {
34
+ const o = i.isVisible !== !1 && n?.isVisible !== !1;
35
+ t[i.name] = o ? r : r.optional();
26
36
  return;
27
37
  }
28
- const p = l.filter(
29
- (o) => o.isActive && o.targetFieldName === e.name
30
- ), r = [...new Set(p.map((o) => o.sourceFieldName))];
31
- if (r.length === 0) {
32
- n[e.name] = i.optional();
38
+ const u = i.isConditional ? m.filter((o) => o.isActive && o.targetFieldName === i.name) : [], p = [...new Set([...u, ...l].map((o) => o.sourceFieldName))];
39
+ if (i.isConditional && u.length === 0 || n?.isConditional && l.length === 0 || p.length === 0) {
40
+ t[i.name] = r.optional();
33
41
  return;
34
42
  }
35
- const V = i.when(
36
- r,
43
+ const C = r.when(
44
+ p,
37
45
  {
38
46
  /** Returns true when the field is visible (any show rule met or any hide rule not met). */
39
47
  is: (o) => {
40
- const v = Array.isArray(o) ? o : [o], s = {};
41
- return r.forEach((t, b) => {
42
- s[t] = v[b];
43
- }), p.some(
44
- (t) => t.actionType === "show" && d(t, s[t.sourceFieldName]) || t.actionType === "hide" && !d(t, s[t.sourceFieldName])
45
- );
48
+ const A = Array.isArray(o) ? o : [o], f = {};
49
+ p.forEach((w, D) => {
50
+ f[w] = A[D];
51
+ });
52
+ const N = i.isConditional ? b(u, f) : i.isVisible !== !1, T = n?.isConditional ? b(l, f) : n?.isVisible !== !1;
53
+ return N && T;
46
54
  },
47
55
  then: (o) => o,
48
56
  otherwise: (o) => o.optional()
49
57
  }
50
58
  );
51
- n[e.name] = V;
52
- }), A(N(n));
53
- }, [a, l, u]);
59
+ t[i.name] = C;
60
+ }), E(I(t));
61
+ }, [e, m, h, d]);
54
62
  return {
55
- initialValues: y,
56
- validationSchema: F
63
+ initialValues: V,
64
+ validationSchema: v
57
65
  };
58
66
  }
59
67
  export {
60
- I as useDynamicForm
68
+ J as useDynamicForm
61
69
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useDynamicFormConditionals.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/hooks/useDynamicFormConditionals/useDynamicFormConditionals.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAsC,MAAM,aAAa,CAAC;AAGzF;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,sBAAsB;;EAqEtE"}
1
+ {"version":3,"file":"useDynamicFormConditionals.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/hooks/useDynamicFormConditionals/useDynamicFormConditionals.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAsC,MAAM,aAAa,CAAC;AAIzF;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,sBAAsB;;EAiFtE"}
@@ -1,28 +1,37 @@
1
- import { useMemo as r } from "react";
2
- import { useFormContext as u, useWatch as y } from "react-hook-form";
3
- import { EMPTY_DATA as m } from "../../constants.js";
4
- import { evaluateConditionalRule as h } from "../../helpers/evaluateConditionalRule/evaluateConditionalRule.js";
5
- function A(c) {
6
- const a = c.fields ?? m.fields, l = c.conditionalRules ?? m.conditionalRules, { control: f } = u(), t = r(() => l.filter(
1
+ import { useMemo as s } from "react";
2
+ import { useFormContext as p, useWatch as h } from "react-hook-form";
3
+ import { EMPTY_DATA as f } from "../../constants.js";
4
+ import { evaluateConditionalRule as N } from "../../helpers/evaluateConditionalRule/evaluateConditionalRule.js";
5
+ import { normalizeDynamicFormFields as g, resolveFormSections as w, isSectionField as b } from "../../helpers/resolveFormSections/resolveFormSections.js";
6
+ function R(d) {
7
+ const o = s(
8
+ () => g(d.fields ?? f.fields).fields,
9
+ [d.fields]
10
+ ), c = d.conditionalRules ?? f.conditionalRules, { ownerByFieldId: m } = s(() => w(o), [o]), { control: F } = p(), n = s(() => c.filter(
7
11
  (i) => i.isActive && typeof i.sourceFieldName == "string" && i.sourceFieldName.trim() !== "" && typeof i.targetFieldName == "string" && i.targetFieldName.trim() !== ""
8
- ), [l]), o = r(() => [...new Set(t.map((i) => i.sourceFieldName))], [t]), d = y({
9
- control: f,
10
- name: o,
11
- disabled: o.length === 0,
12
+ ), [c]), a = s(() => [...new Set(n.map((i) => i.sourceFieldName))], [n]), l = h({
13
+ control: F,
14
+ name: a,
15
+ disabled: a.length === 0,
12
16
  exact: !0
13
17
  });
14
18
  return {
15
- visibleFields: r(() => {
16
- const i = /* @__PURE__ */ new Set(), F = Array.isArray(d) ? d : [];
17
- return a.forEach((e) => {
19
+ visibleFields: s(() => {
20
+ const i = /* @__PURE__ */ new Set(), u = Array.isArray(l) ? l : [];
21
+ return o.forEach((e) => {
18
22
  !e.isConditional && e.isVisible !== !1 && i.add(e.name);
19
- }), t.forEach((e) => {
20
- const s = o.indexOf(e.sourceFieldName), p = s >= 0 ? F[s] : void 0, n = h(e, p);
21
- n && e.actionType === "show" ? i.add(e.targetFieldName) : !n && e.actionType === "show" || n && e.actionType === "hide" || !n && e.actionType === "hide" && i.add(e.targetFieldName);
22
- }), a.filter((e) => i.has(e.name)).sort((e, s) => (e.displayOrder ?? 1 / 0) - (s.displayOrder ?? 1 / 0));
23
- }, [t, a, o, d])
23
+ }), n.forEach((e) => {
24
+ const t = a.indexOf(e.sourceFieldName), y = t >= 0 ? u[t] : void 0, r = N(e, y);
25
+ r && e.actionType === "show" ? i.add(e.targetFieldName) : !r && e.actionType === "show" || r && e.actionType === "hide" || !r && e.actionType === "hide" && i.add(e.targetFieldName);
26
+ }), o.filter((e) => {
27
+ if (b(e) || !i.has(e.name))
28
+ return !1;
29
+ const t = m.get(e.id);
30
+ return !t || (t.isConditional ? i.has(t.name) : t.isVisible !== !1);
31
+ }).sort((e, t) => (e.displayOrder ?? 1 / 0) - (t.displayOrder ?? 1 / 0));
32
+ }, [n, o, m, a, l])
24
33
  };
25
34
  }
26
35
  export {
27
- A as useDynamicFormConditionals
36
+ R as useDynamicFormConditionals
28
37
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useDynamicFormData.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/hooks/useDynamicFormData/useDynamicFormData.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAgB5E;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,uBAAuB,GAC7B,wBAAwB,CA8L1B"}
1
+ {"version":3,"file":"useDynamicFormData.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/hooks/useDynamicFormData/useDynamicFormData.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAgB5E;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,uBAAuB,GAC7B,wBAAwB,CAiM1B"}