impact-nova 2.5.4 → 2.5.6

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 (39) hide show
  1. package/dist/components/data/ag-grid-react/index.js +64 -64
  2. package/dist/components/data/data-table/data-table-column-state.d.ts +7 -0
  3. package/dist/components/data/data-table/data-table-column-state.js +48 -23
  4. package/dist/form-engine/field-dependency-graph.d.ts +1 -4
  5. package/dist/form-engine/field-dependency-graph.js +53 -57
  6. package/dist/form-engine/field-groups.d.ts +15 -0
  7. package/dist/form-engine/field-groups.js +60 -0
  8. package/dist/form-engine/index.d.ts +3 -2
  9. package/dist/form-engine/index.js +17 -14
  10. package/dist/form-engine/types.d.ts +17 -0
  11. package/dist/form-react/Fields/RichTextField.d.ts +3 -0
  12. package/dist/form-react/Fields/RichTextField.js +214 -0
  13. package/dist/form-react/Fields/SelectField.js +27 -28
  14. package/dist/form-react/Fields/SliderRangeField.d.ts +3 -0
  15. package/dist/form-react/Fields/SliderRangeField.js +69 -0
  16. package/dist/form-react/ReactHooksForm.js +149 -87
  17. package/dist/form-react/fields.d.ts +2 -0
  18. package/dist/form-react/fields.js +22 -18
  19. package/dist/form-react/hooks/useCascadingForm.d.ts +1 -2
  20. package/dist/form-react/hooks/useCascadingForm.js +59 -67
  21. package/dist/form-react/hooks/useFieldVisibility.d.ts +1 -2
  22. package/dist/form-react/hooks/useFieldVisibility.js +36 -43
  23. package/dist/form-react/hooks/useFormSteps.d.ts +29 -0
  24. package/dist/form-react/hooks/useFormSteps.js +96 -0
  25. package/dist/form-react/hooks/useReactHookForm.js +17 -18
  26. package/dist/form-react/hooks/useSelectOptions.d.ts +1 -1
  27. package/dist/form-react/hooks/useSelectOptions.js +80 -83
  28. package/dist/form-react/index.d.ts +5 -3
  29. package/dist/form-react/index.js +93 -88
  30. package/dist/form-react/registry/defaultFieldRegistrations.d.ts +1 -1
  31. package/dist/form-react/registry/defaultFieldRegistrations.js +11 -9
  32. package/dist/form-react/types/fields.types.d.ts +31 -12
  33. package/dist/form-react/types/fieldsOutput.types.d.ts +5 -1
  34. package/dist/form-react/types/reactHookForm.types.d.ts +31 -2
  35. package/dist/form-react/utils/fieldDefaults.utils.js +28 -13
  36. package/dist/impact-nova.css +1 -1
  37. package/dist/llms/rules/installation.js +1 -1
  38. package/dist/llms/rules/requirements.js +1 -1
  39. package/package.json +17 -2
@@ -1,30 +1,30 @@
1
1
  import { jsxs as ye, jsx as F } from "react/jsx-runtime";
2
2
  import { lazy as be, useRef as L, useState as O, useId as xe, useEffect as q, useCallback as m, useMemo as f, Suspense as Se } from "react";
3
- import { ModuleRegistry as Fe, AllCommunityModule as Ae, ValidationModule as Ee } from "ag-grid-community";
4
- import { AllEnterpriseModule as Ge } from "ag-grid-enterprise";
5
- import { AgGridReact as Me } from "ag-grid-react";
6
- import { customAgGridTheme as Re } from "./theme.js";
7
- import { syncAgGridThemeMode as Te } from "./sync-ag-grid-theme-mode.js";
8
- import { CustomHeader as we } from "./headers/custom-header.js";
3
+ import { ModuleRegistry as Fe, AllCommunityModule as Ae } from "ag-grid-community";
4
+ import { AllEnterpriseModule as Ee } from "ag-grid-enterprise";
5
+ import { AgGridReact as Ge } from "ag-grid-react";
6
+ import { customAgGridTheme as Me } from "./theme.js";
7
+ import { syncAgGridThemeMode as Re } from "./sync-ag-grid-theme-mode.js";
8
+ import { CustomHeader as Te } from "./headers/custom-header.js";
9
9
  import { CustomHeaderGroup as z } from "./headers/custom-inner-header-group.js";
10
- import { mergeColumnGroupDefsWithDefault as ke } from "./merge-column-group-defs.js";
11
- import { DefaultTextCellRenderer as Ie } from "./cell-renderers/default-text-cell-renderer.js";
12
- import { GridHeaderContext as je } from "./headers/context/grid-header-context.js";
13
- import { convertToAgGridFilterModel as Pe, getMultiFilterIndices as De, convertFromAgGridFilterModel as Le } from "./headers/utils/filter-utils.js";
14
- import { AG_GRID_VALUE_FORMATTERS as Oe } from "./value-formatters.js";
15
- import { useGridAutoSizeStrategyOnResize as He } from "./useGridAutoSizeStrategyOnResize.js";
16
- import { subscribeGridApiEvent as ct, subscribeGridApiEvents as ut } from "./grid-api-event-subscription.js";
10
+ import { mergeColumnGroupDefsWithDefault as we } from "./merge-column-group-defs.js";
11
+ import { DefaultTextCellRenderer as ke } from "./cell-renderers/default-text-cell-renderer.js";
12
+ import { GridHeaderContext as Ie } from "./headers/context/grid-header-context.js";
13
+ import { convertToAgGridFilterModel as je, getMultiFilterIndices as Pe, convertFromAgGridFilterModel as De } from "./headers/utils/filter-utils.js";
14
+ import { AG_GRID_VALUE_FORMATTERS as Le } from "./value-formatters.js";
15
+ import { useGridAutoSizeStrategyOnResize as Oe } from "./useGridAutoSizeStrategyOnResize.js";
16
+ import { subscribeGridApiEvent as ct, subscribeGridApiEvents as at } from "./grid-api-event-subscription.js";
17
17
  import { notifyColumnIndicatorSync as R } from "./notify-column-indicator-sync.js";
18
- import { setActiveSearchColumnId as H, clearHeaderSearchActiveState as Ne } from "./headers/header-search-active-state.js";
18
+ import { setActiveSearchColumnId as H, clearHeaderSearchActiveState as He } from "./headers/header-search-active-state.js";
19
19
  /* empty css */
20
- import { useAgGridTruncationTooltip as pt } from "./use-ag-grid-truncation-tooltip.js";
21
- import { isAgGridHeaderLabelTooltipOverflowing as ft, isAgGridTextOverflowing as gt } from "./ag-grid-tooltip-overflow.js";
22
- const We = be(
20
+ import { useAgGridTruncationTooltip as dt } from "./use-ag-grid-truncation-tooltip.js";
21
+ import { isAgGridHeaderLabelTooltipOverflowing as mt, isAgGridTextOverflowing as ft } from "./ag-grid-tooltip-overflow.js";
22
+ const Ne = be(
23
23
  () => import("./headers/advanced-filter/advanced-filter-dialog.js").then((s) => ({
24
24
  default: s.AdvancedFilterDialog
25
25
  }))
26
26
  );
27
- Fe.registerModules([Ae, Ge, Ee]);
27
+ Fe.registerModules([Ae, Ee]);
28
28
  const S = "", N = "", J = (s) => {
29
29
  if (!s) return;
30
30
  const o = s.cellRendererParams?.splits;
@@ -39,18 +39,18 @@ const S = "", N = "", J = (s) => {
39
39
  l.push("");
40
40
  continue;
41
41
  }
42
- const c = s[g];
43
- if (c == null) {
42
+ const a = s[g];
43
+ if (a == null) {
44
44
  l.push("");
45
45
  continue;
46
46
  }
47
- if (typeof c == "object" && "value" in c) {
48
- const u = c.value;
47
+ if (typeof a == "object" && "value" in a) {
48
+ const u = a.value;
49
49
  l.push(u == null ? "" : String(u));
50
50
  continue;
51
51
  }
52
- if (typeof c != "object") {
53
- l.push(String(c));
52
+ if (typeof a != "object") {
53
+ l.push(String(a));
54
54
  continue;
55
55
  }
56
56
  l.push("");
@@ -72,13 +72,13 @@ const S = "", N = "", J = (s) => {
72
72
  document.body.removeChild(o);
73
73
  }
74
74
  };
75
- function it({
75
+ function lt({
76
76
  children: s,
77
77
  defaultColDef: o,
78
78
  defaultColGroupDef: l,
79
79
  columnDefs: y,
80
80
  valueFormatters: g,
81
- onGridReady: c,
81
+ onGridReady: a,
82
82
  onGridPreDestroyed: u,
83
83
  onFilterChanged: b,
84
84
  onSelectionChanged: h,
@@ -92,10 +92,10 @@ function it({
92
92
  themeOverride: ee,
93
93
  ...C
94
94
  }) {
95
- const a = L(null), j = L(null), [W, _] = O(null), K = xe(), v = L(K);
96
- v.current = K, He(W, j, w), q(() => {
95
+ const c = L(null), j = L(null), [W, _] = O(null), K = xe(), v = L(K);
96
+ v.current = K, Oe(W, j, w), q(() => {
97
97
  const e = document.documentElement, t = () => {
98
- Te(e.classList.contains("dark") ? "dark" : "light", e);
98
+ Re(e.classList.contains("dark") ? "dark" : "light", e);
99
99
  };
100
100
  t();
101
101
  const n = new MutationObserver(t);
@@ -125,14 +125,14 @@ function it({
125
125
  }), []), P = f(() => ({
126
126
  gridScopeId: v.current,
127
127
  openSearch: (e) => {
128
- if (!a.current) return;
129
- const t = a.current.getGridOption("context") || {};
130
- a.current.setGridOption("context", { ...t, activeSearchColumnId: e }), H(v.current, e), R(a.current);
128
+ if (!c.current) return;
129
+ const t = c.current.getGridOption("context") || {};
130
+ c.current.setGridOption("context", { ...t, activeSearchColumnId: e }), H(v.current, e), R(c.current);
131
131
  },
132
132
  closeSearch: () => {
133
- if (!a.current) return;
134
- const e = a.current.getGridOption("context") || {};
135
- a.current.setGridOption("context", { ...e, activeSearchColumnId: null }), H(v.current, null), R(a.current);
133
+ if (!c.current) return;
134
+ const e = c.current.getGridOption("context") || {};
135
+ c.current.setGridOption("context", { ...e, activeSearchColumnId: null }), H(v.current, null), R(c.current);
136
136
  },
137
137
  openAdvancedFilter: (e) => {
138
138
  V(e || null), U(!0);
@@ -141,21 +141,21 @@ function it({
141
141
  U(!1), V(null);
142
142
  },
143
143
  applyAdvancedFilter: (e) => {
144
- if (!a.current) return;
145
- const t = Pe(e);
146
- a.current.setFilterModel(t), a.current.onFilterChanged(), R(a.current);
144
+ if (!c.current) return;
145
+ const t = je(e);
146
+ c.current.setFilterModel(t), c.current.onFilterChanged(), R(c.current);
147
147
  }
148
148
  }), []), le = m((e) => {
149
- a.current = e.api, _(e.api);
149
+ c.current = e.api, _(e.api);
150
150
  const t = e.api.getGridOption("context") || {};
151
151
  e.api.setGridOption("context", {
152
152
  ...t,
153
153
  activeSearchColumnId: null,
154
154
  headerSearchScopeId: v.current
155
- }), H(v.current, null), c && c(e);
156
- }, [c]), ie = m(
155
+ }), H(v.current, null), a && a(e);
156
+ }, [a]), ie = m(
157
157
  (e) => {
158
- Ne(v.current), a.current = null, _(null), u?.(e);
158
+ He(v.current), c.current = null, _(null), u?.(e);
159
159
  },
160
160
  [u]
161
161
  ), se = m(
@@ -163,12 +163,12 @@ function it({
163
163
  R(e.api), b?.(e);
164
164
  },
165
165
  [b]
166
- ), ae = m(
166
+ ), ce = m(
167
167
  (e) => {
168
168
  h?.(e);
169
169
  },
170
170
  [h]
171
- ), ce = m(
171
+ ), ae = m(
172
172
  (e) => {
173
173
  A?.(e);
174
174
  },
@@ -189,11 +189,11 @@ function it({
189
189
  return e.addEventListener("keydown", t, !0), () => e.removeEventListener("keydown", t, !0);
190
190
  }, []);
191
191
  const ue = f(() => ({
192
- headerComponent: we,
192
+ headerComponent: Te,
193
193
  // Default cell renderer wraps text in a span so display:flex centering
194
194
  // and text-overflow:ellipsis both work (ellipsis doesn't work on
195
195
  // anonymous flex text nodes, but works on flex child elements).
196
- cellRenderer: Ie,
196
+ cellRenderer: ke,
197
197
  ...o,
198
198
  suppressHeaderKeyboardEvent: (e) => {
199
199
  const { event: t } = e, n = t.target;
@@ -219,10 +219,10 @@ function it({
219
219
  innerHeaderGroupComponent: l?.headerGroupComponentParams?.innerHeaderGroupComponent ?? "CustomInnerHeaderGroup"
220
220
  }
221
221
  }), [l]), de = f(
222
- () => ke(y ?? void 0, D),
222
+ () => we(y ?? void 0, D),
223
223
  [y, D]
224
224
  ), pe = f(() => ({
225
- ...Oe,
225
+ ...Le,
226
226
  // Always available - value formatters
227
227
  CustomInnerHeaderGroup: z,
228
228
  CustomHeaderGroup: z,
@@ -310,11 +310,11 @@ function it({
310
310
  processCellCallback: E,
311
311
  ...C.defaultExcelExportParams ?? {}
312
312
  }), [E, C.defaultExcelExportParams]);
313
- return /* @__PURE__ */ ye(je.Provider, { value: P, children: [
313
+ return /* @__PURE__ */ ye(Ie.Provider, { value: P, children: [
314
314
  /* @__PURE__ */ F("div", { ref: j, "data-component": "ag-grid-react", style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ F(
315
- Me,
315
+ Ge,
316
316
  {
317
- theme: ee ?? Re,
317
+ theme: ee ?? Me,
318
318
  defaultColDef: ue,
319
319
  columnDefs: de,
320
320
  cellSelection: !0,
@@ -322,8 +322,8 @@ function it({
322
322
  onGridReady: le,
323
323
  onGridPreDestroyed: ie,
324
324
  onFilterChanged: se,
325
- onSelectionChanged: ae,
326
- onModelUpdated: ce,
325
+ onSelectionChanged: ce,
326
+ onModelUpdated: ae,
327
327
  tooltipShowMode: k,
328
328
  tooltipShowDelay: I,
329
329
  tooltipHideDelay: Y,
@@ -348,7 +348,7 @@ function it({
348
348
  ) }),
349
349
  s,
350
350
  /* @__PURE__ */ F(
351
- _e,
351
+ We,
352
352
  {
353
353
  isOpen: te,
354
354
  columnId: re,
@@ -359,7 +359,7 @@ function it({
359
359
  )
360
360
  ] });
361
361
  }
362
- function _e({
362
+ function We({
363
363
  isOpen: s,
364
364
  columnId: o,
365
365
  gridApi: l,
@@ -367,11 +367,11 @@ function _e({
367
367
  onApply: g
368
368
  }) {
369
369
  if (!s || !o || !l) return null;
370
- const c = l.getColumn(o);
371
- if (!c) return null;
372
- const u = c.getColDef(), b = u.headerComponentParams, h = De(u), A = h.text !== -1 || h.number !== -1 || h.date !== -1, T = h.set !== -1, k = u.filter === "agMultiColumnFilter" && (A || T) ? "multi" : u.filter === "agNumberColumnFilter" ? "number" : u.filter === "agDateColumnFilter" ? "date" : u.filter === "agSetColumnFilter" || b?.selectOptions ? "select" : "text", I = Le(l.getFilterModel());
370
+ const a = l.getColumn(o);
371
+ if (!a) return null;
372
+ const u = a.getColDef(), b = u.headerComponentParams, h = Pe(u), A = h.text !== -1 || h.number !== -1 || h.date !== -1, T = h.set !== -1, k = u.filter === "agMultiColumnFilter" && (A || T) ? "multi" : u.filter === "agNumberColumnFilter" ? "number" : u.filter === "agDateColumnFilter" ? "date" : u.filter === "agSetColumnFilter" || b?.selectOptions ? "select" : "text", I = De(l.getFilterModel());
373
373
  return /* @__PURE__ */ F(Se, { fallback: null, children: /* @__PURE__ */ F(
374
- We,
374
+ Ne,
375
375
  {
376
376
  isOpen: s,
377
377
  onClose: y,
@@ -387,10 +387,10 @@ function _e({
387
387
  ) });
388
388
  }
389
389
  export {
390
- it as AgGridWrapper,
391
- ft as isAgGridHeaderLabelTooltipOverflowing,
392
- gt as isAgGridTextOverflowing,
390
+ lt as AgGridWrapper,
391
+ mt as isAgGridHeaderLabelTooltipOverflowing,
392
+ ft as isAgGridTextOverflowing,
393
393
  ct as subscribeGridApiEvent,
394
- ut as subscribeGridApiEvents,
395
- pt as useAgGridTruncationTooltip
394
+ at as subscribeGridApiEvents,
395
+ dt as useAgGridTruncationTooltip
396
396
  };
@@ -10,6 +10,13 @@ import { ColumnState } from 'ag-grid-community';
10
10
  * receives a complete ordered array — as intended for `applyColumnState`, without relying
11
11
  * on incidental merge behaviour inside the grid.
12
12
  *
13
+ * **Managed columns** (ids present in `partial`): order and overridden fields come from
14
+ * `partial`; other fields are preserved from `prevState`.
15
+ *
16
+ * **Non-managed columns** (e.g. AG Grid service columns excluded from the picker tree):
17
+ * keep their relative anchor position in `prevState` — columns before the first managed
18
+ * column stay before the managed block; columns after stay after.
19
+ *
13
20
  * Complexity: O(N) time, O(N) extra map/set memory for one pass over `prevState` and
14
21
  * `partial` (unavoidable when applying global order for N columns).
15
22
  */
@@ -1,29 +1,54 @@
1
- function f(e, t) {
2
- if (t.length === 0)
3
- return e;
4
- const c = /* @__PURE__ */ new Map();
5
- for (let n = 0; n < e.length; n++) {
6
- const o = e[n];
7
- c.set(o.colId, o);
1
+ function u(n, l) {
2
+ if (l.length === 0)
3
+ return n;
4
+ const i = /* @__PURE__ */ new Map();
5
+ for (let e = 0; e < n.length; e++) {
6
+ const t = n[e];
7
+ i.set(t.colId, t);
8
8
  }
9
- const l = /* @__PURE__ */ new Set();
10
- for (let n = 0; n < t.length; n++)
11
- l.add(t[n].colId);
12
- let d = 0;
13
- for (let n = 0; n < e.length; n++)
14
- l.has(e[n].colId) || d++;
15
- const s = new Array(t.length + d);
16
- let g = 0;
17
- for (let n = 0; n < t.length; n++) {
18
- const o = t[n], i = c.get(o.colId);
19
- s[g++] = i !== void 0 ? Object.assign({}, i, o) : Object.assign({}, o);
9
+ const s = /* @__PURE__ */ new Set();
10
+ for (let e = 0; e < l.length; e++)
11
+ s.add(l[e].colId);
12
+ const c = new Array(l.length);
13
+ for (let e = 0; e < l.length; e++) {
14
+ const t = l[e], h = i.get(t.colId);
15
+ c[e] = h !== void 0 ? Object.assign({}, h, t) : Object.assign({}, t);
20
16
  }
21
- for (let n = 0; n < e.length; n++) {
22
- const o = e[n];
23
- l.has(o.colId) || (s[g++] = o);
17
+ let o = !1, d = 0, g = 0;
18
+ for (let e = 0; e < n.length; e++) {
19
+ const t = n[e];
20
+ if (s.has(t.colId)) {
21
+ o = !0;
22
+ continue;
23
+ }
24
+ o ? g++ : d++;
24
25
  }
25
- return s;
26
+ const r = new Array(
27
+ d + c.length + g
28
+ );
29
+ let f = 0;
30
+ o = !1;
31
+ for (let e = 0; e < n.length; e++) {
32
+ const t = n[e];
33
+ if (s.has(t.colId)) {
34
+ o = !0;
35
+ continue;
36
+ }
37
+ o || (r[f++] = t);
38
+ }
39
+ for (let e = 0; e < c.length; e++)
40
+ r[f++] = c[e];
41
+ o = !1;
42
+ for (let e = 0; e < n.length; e++) {
43
+ const t = n[e];
44
+ if (s.has(t.colId)) {
45
+ o = !0;
46
+ continue;
47
+ }
48
+ o && (r[f++] = t);
49
+ }
50
+ return r;
26
51
  }
27
52
  export {
28
- f as mergePartialOrderedColumnState
53
+ u as mergePartialOrderedColumnState
29
54
  };
@@ -1,10 +1,7 @@
1
1
  import { FieldDependency, FieldVisibilityBase, FormValuesSnapshot } from './types';
2
2
  export declare function collectFieldDependencyIds(field: FieldVisibilityBase): string[];
3
3
  export declare function computeIsFieldVisible(field: FieldVisibilityBase, formValues: FormValuesSnapshot): boolean;
4
- export declare function computeIsFieldDisabled(field: FieldVisibilityBase, formValues: FormValuesSnapshot, options?: {
5
- isCascadingDisabled?: (field: FieldVisibilityBase) => boolean;
6
- }): boolean;
7
- export declare function computeIsCascadingDisabled(field: FieldVisibilityBase, formValues: FormValuesSnapshot, isCascadingEnabled: boolean): boolean;
4
+ export declare function computeIsFieldDisabled(field: FieldVisibilityBase, formValues: FormValuesSnapshot): boolean;
8
5
  export declare function getDependentFieldIds(allFields: FieldVisibilityBase[], changedFieldName: string): string[];
9
6
  export declare function buildCascadeParentFormState(cascadingDependency: FieldDependency[] | undefined, formValues: FormValuesSnapshot): Record<string, unknown> | null;
10
7
  export declare function collectFormWatchFieldIds(fields: FieldVisibilityBase[]): string[];
@@ -1,90 +1,86 @@
1
1
  import { isEmptyValue as l } from "./is-empty-value.js";
2
- function a(e) {
2
+ function u(n) {
3
3
  const t = /* @__PURE__ */ new Set();
4
- return e.visibilityDependency?.forEach((n) => {
5
- t.add(n.fieldId);
6
- }), e.disableDependency?.forEach((n) => {
7
- t.add(n.fieldId);
8
- }), e.cascadingDependency?.forEach((n) => {
9
- t.add(n.fieldId);
4
+ return n.visibilityDependency?.forEach((e) => {
5
+ t.add(e.fieldId);
6
+ }), n.disableDependency?.forEach((e) => {
7
+ t.add(e.fieldId);
8
+ }), n.cascadingDependency?.forEach((e) => {
9
+ t.add(e.fieldId);
10
10
  }), Array.from(t);
11
11
  }
12
- function d(e, t) {
13
- return !e.visibilityDependency || e.visibilityDependency.length === 0 ? !0 : e.visibilityDependency.every((n) => t[n.fieldId] === n.value);
14
- }
15
- function u(e, t) {
16
- const n = t[e.fieldId];
17
- return e.value === null ? !l(n) : e.value === "__empty__" ? l(n) : typeof n == "boolean" ? n === (e.value === "true") : Array.isArray(n) ? n.some((r) => typeof r == "object" && r?.value === e.value ? !0 : typeof r == "string" && r === e.value) : typeof n == "object" && n !== null && "value" in n ? n.value === e.value : n === e.value;
12
+ function d(n, t) {
13
+ return !n.visibilityDependency || n.visibilityDependency.length === 0 ? !0 : n.visibilityDependency.every((e) => {
14
+ const r = t[e.fieldId];
15
+ return e.value === "__empty__" ? l(r) : r === e.value;
16
+ });
18
17
  }
19
- function s(e, t, n) {
20
- return !!(!d(e, t) || e.isDisabled || e.disableDependency && e.disableDependency.length > 0 && (e.disableDependencyMode === "every" ? e.disableDependency.every(
21
- (i) => u(i, t)
22
- ) : e.disableDependency.some(
23
- (i) => u(i, t)
24
- )) || n?.isCascadingDisabled?.(e));
18
+ function o(n, t) {
19
+ const e = t[n.fieldId];
20
+ return n.value === null ? !l(e) : n.value === "__empty__" ? l(e) : typeof e == "boolean" ? e === (n.value === "true") : Array.isArray(e) ? e.some((r) => typeof r == "object" && r?.value === n.value ? !0 : typeof r == "string" && r === n.value) : typeof e == "object" && e !== null && "value" in e ? e.value === n.value : e === n.value;
25
21
  }
26
- function f(e, t, n) {
27
- return !n || !e.cascadingDependency || e.cascadingDependency.length === 0 ? !1 : e.cascadingDependency.some((r) => {
28
- const i = t[r.fieldId];
29
- return r.value === null || r.value === void 0 ? l(i) : i === r.value;
30
- });
22
+ function s(n, t) {
23
+ return !!(!d(n, t) || n.isDisabled || n.disableDependency && n.disableDependency.length > 0 && (n.disableDependencyMode === "every" ? n.disableDependency.every(
24
+ (r) => o(r, t)
25
+ ) : n.disableDependency.some(
26
+ (r) => o(r, t)
27
+ )));
31
28
  }
32
- function y(e, t) {
33
- return e.filter(
34
- (n) => n.cascadingDependency?.some(
29
+ function f(n, t) {
30
+ return n.filter(
31
+ (e) => e.cascadingDependency?.some(
35
32
  (r) => r.fieldId === t
36
33
  )
37
- ).map((n) => n.id);
34
+ ).map((e) => e.id);
38
35
  }
39
- function p(e, t) {
40
- if (!e || e.length === 0)
36
+ function y(n, t) {
37
+ if (!n || n.length === 0)
41
38
  return null;
42
- const n = {};
43
- for (const r of e) {
39
+ const e = {};
40
+ for (const r of n) {
44
41
  const i = t[r.fieldId];
45
- i == null || i === "" || Array.isArray(i) && i.length === 0 || (n[r.fieldId] = i);
42
+ i == null || i === "" || Array.isArray(i) && i.length === 0 || (e[r.fieldId] = i);
46
43
  }
47
- return Object.keys(n).length > 0 ? n : null;
44
+ return Object.keys(e).length > 0 ? e : null;
48
45
  }
49
- function o(e) {
46
+ function c(n) {
50
47
  const t = /* @__PURE__ */ new Set();
51
- for (const n of e) {
52
- n.doNotIncludeInSubmit || t.add(n.id);
53
- for (const r of a(n))
48
+ for (const e of n) {
49
+ e.doNotIncludeInSubmit || t.add(e.id);
50
+ for (const r of u(e))
54
51
  t.add(r);
55
52
  }
56
53
  return Array.from(t);
57
54
  }
58
- function b(e) {
59
- return o(e);
55
+ function b(n) {
56
+ return c(n);
60
57
  }
61
- function v(e) {
58
+ function p(n) {
62
59
  const t = /* @__PURE__ */ new Set();
63
- for (const n of e) {
64
- t.add(n.id);
65
- for (const r of a(n))
60
+ for (const e of n) {
61
+ t.add(e.id);
62
+ for (const r of u(e))
66
63
  t.add(r);
67
64
  }
68
65
  return Array.from(t);
69
66
  }
70
- function D(e, t, n) {
71
- return e.some(
72
- (r) => !!t[r.id] && d(r, n)
67
+ function I(n, t, e) {
68
+ return n.some(
69
+ (r) => !!t[r.id] && d(r, e)
73
70
  );
74
71
  }
75
- function I(e, t) {
76
- return e.filter((n) => d(n, t)).map((n) => n.id);
72
+ function v(n, t) {
73
+ return n.filter((e) => d(e, t)).map((e) => e.id);
77
74
  }
78
75
  export {
79
- p as buildCascadeParentFormState,
80
- a as collectFieldDependencyIds,
76
+ y as buildCascadeParentFormState,
77
+ u as collectFieldDependencyIds,
81
78
  b as collectFilterSidebarWatchFieldIds,
82
- o as collectFormWatchFieldIds,
83
- v as collectSectionWatchFieldIds,
84
- I as collectVisibleFieldIds,
85
- f as computeIsCascadingDisabled,
79
+ c as collectFormWatchFieldIds,
80
+ p as collectSectionWatchFieldIds,
81
+ v as collectVisibleFieldIds,
86
82
  s as computeIsFieldDisabled,
87
83
  d as computeIsFieldVisible,
88
- y as getDependentFieldIds,
89
- D as hasVisibleFieldErrors
84
+ f as getDependentFieldIds,
85
+ I as hasVisibleFieldErrors
90
86
  };
@@ -0,0 +1,15 @@
1
+ import { FieldGroup, FieldVisibilityBase, FormStepConfig, FormValuesSnapshot } from './types';
2
+ /**
3
+ * Group fields by `fieldGroup`, preserving declaration order.
4
+ * Fields without `fieldGroup` are collected into a `'_default'` group.
5
+ * When `stepConfigs` is provided, groups are ordered to match and enriched with title/description.
6
+ */
7
+ export declare function buildFieldGroups(fields: FieldVisibilityBase[], stepConfigs?: FormStepConfig[]): FieldGroup[];
8
+ /**
9
+ * Check if all visible required fields in a step have non-empty values and no errors.
10
+ */
11
+ export declare function isStepComplete(stepFieldIds: string[], fields: FieldVisibilityBase[], formValues: FormValuesSnapshot, fieldErrors: Record<string, unknown>): boolean;
12
+ /**
13
+ * Return the index of the first incomplete step, or -1 if all steps are complete.
14
+ */
15
+ export declare function getFirstIncompleteStep(groups: FieldGroup[], fields: FieldVisibilityBase[], formValues: FormValuesSnapshot, fieldErrors: Record<string, unknown>): number;
@@ -0,0 +1,60 @@
1
+ import { isEmptyValue as s } from "./is-empty-value.js";
2
+ import { computeIsFieldVisible as u } from "./field-dependency-graph.js";
3
+ const l = "_default";
4
+ function g(d, r) {
5
+ const i = /* @__PURE__ */ new Map(), n = [];
6
+ for (const t of d) {
7
+ const o = t.fieldGroup || l;
8
+ i.has(o) || (i.set(o, []), n.push(o)), i.get(o).push(t.id);
9
+ }
10
+ if (r && r.length > 0) {
11
+ const t = new Map(r.map((e) => [e.groupId, e])), o = [];
12
+ for (const e of r) {
13
+ const f = i.get(e.groupId);
14
+ f && (o.push({
15
+ groupId: e.groupId,
16
+ title: e.title,
17
+ description: e.description,
18
+ fieldIds: f,
19
+ validateBeforeNext: e.validateBeforeNext ?? !0
20
+ }), i.delete(e.groupId));
21
+ }
22
+ for (const e of n) {
23
+ if (!i.has(e)) continue;
24
+ const f = t.get(e);
25
+ o.push({
26
+ groupId: e,
27
+ title: f?.title,
28
+ description: f?.description,
29
+ fieldIds: i.get(e),
30
+ validateBeforeNext: f?.validateBeforeNext ?? !0
31
+ });
32
+ }
33
+ return o;
34
+ }
35
+ return n.map((t) => ({
36
+ groupId: t,
37
+ title: void 0,
38
+ description: void 0,
39
+ fieldIds: i.get(t),
40
+ validateBeforeNext: !0
41
+ }));
42
+ }
43
+ function p(d, r, i, n) {
44
+ const t = new Set(d), o = r.filter((e) => t.has(e.id));
45
+ for (const e of o)
46
+ if (u(e, i) && (n[e.id] || e.isRequired && s(i[e.id])))
47
+ return !1;
48
+ return !0;
49
+ }
50
+ function I(d, r, i, n) {
51
+ for (let t = 0; t < d.length; t++)
52
+ if (!p(d[t].fieldIds, r, i, n))
53
+ return t;
54
+ return -1;
55
+ }
56
+ export {
57
+ g as buildFieldGroups,
58
+ I as getFirstIncompleteStep,
59
+ p as isStepComplete
60
+ };
@@ -5,5 +5,6 @@
5
5
  * @packageDocumentation
6
6
  */
7
7
  export { isEmptyValue } from './is-empty-value';
8
- export type { FieldDependency, FieldVisibilityBase, FormValuesSnapshot, } from './types';
9
- export { buildCascadeParentFormState, collectFieldDependencyIds, collectFormWatchFieldIds, collectFilterSidebarWatchFieldIds, collectSectionWatchFieldIds, collectVisibleFieldIds, computeIsCascadingDisabled, computeIsFieldDisabled, computeIsFieldVisible, getDependentFieldIds, hasVisibleFieldErrors, } from './field-dependency-graph';
8
+ export type { FieldDependency, FieldGroup, FieldVisibilityBase, FormStepConfig, FormValuesSnapshot, } from './types';
9
+ export { buildCascadeParentFormState, collectFieldDependencyIds, collectFormWatchFieldIds, collectFilterSidebarWatchFieldIds, collectSectionWatchFieldIds, collectVisibleFieldIds, computeIsFieldDisabled, computeIsFieldVisible, getDependentFieldIds, hasVisibleFieldErrors, } from './field-dependency-graph';
10
+ export { buildFieldGroups, isStepComplete, getFirstIncompleteStep, } from './field-groups';
@@ -1,16 +1,19 @@
1
- import { isEmptyValue as d } from "./is-empty-value.js";
2
- import { buildCascadeParentFormState as t, collectFieldDependencyIds as c, collectFilterSidebarWatchFieldIds as s, collectFormWatchFieldIds as o, collectSectionWatchFieldIds as a, collectVisibleFieldIds as r, computeIsCascadingDisabled as F, computeIsFieldDisabled as I, computeIsFieldVisible as m, getDependentFieldIds as p, hasVisibleFieldErrors as b } from "./field-dependency-graph.js";
1
+ import { isEmptyValue as t } from "./is-empty-value.js";
2
+ import { buildCascadeParentFormState as d, collectFieldDependencyIds as o, collectFilterSidebarWatchFieldIds as c, collectFormWatchFieldIds as s, collectSectionWatchFieldIds as r, collectVisibleFieldIds as F, computeIsFieldDisabled as p, computeIsFieldVisible as a, getDependentFieldIds as m, hasVisibleFieldErrors as I } from "./field-dependency-graph.js";
3
+ import { buildFieldGroups as n, getFirstIncompleteStep as u, isStepComplete as S } from "./field-groups.js";
3
4
  export {
4
- t as buildCascadeParentFormState,
5
- c as collectFieldDependencyIds,
6
- s as collectFilterSidebarWatchFieldIds,
7
- o as collectFormWatchFieldIds,
8
- a as collectSectionWatchFieldIds,
9
- r as collectVisibleFieldIds,
10
- F as computeIsCascadingDisabled,
11
- I as computeIsFieldDisabled,
12
- m as computeIsFieldVisible,
13
- p as getDependentFieldIds,
14
- b as hasVisibleFieldErrors,
15
- d as isEmptyValue
5
+ d as buildCascadeParentFormState,
6
+ n as buildFieldGroups,
7
+ o as collectFieldDependencyIds,
8
+ c as collectFilterSidebarWatchFieldIds,
9
+ s as collectFormWatchFieldIds,
10
+ r as collectSectionWatchFieldIds,
11
+ F as collectVisibleFieldIds,
12
+ p as computeIsFieldDisabled,
13
+ a as computeIsFieldVisible,
14
+ m as getDependentFieldIds,
15
+ u as getFirstIncompleteStep,
16
+ I as hasVisibleFieldErrors,
17
+ t as isEmptyValue,
18
+ S as isStepComplete
16
19
  };