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.
- package/dist/components/data/ag-grid-react/index.js +64 -64
- package/dist/components/data/data-table/data-table-column-state.d.ts +7 -0
- package/dist/components/data/data-table/data-table-column-state.js +48 -23
- package/dist/form-engine/field-dependency-graph.d.ts +1 -4
- package/dist/form-engine/field-dependency-graph.js +53 -57
- package/dist/form-engine/field-groups.d.ts +15 -0
- package/dist/form-engine/field-groups.js +60 -0
- package/dist/form-engine/index.d.ts +3 -2
- package/dist/form-engine/index.js +17 -14
- package/dist/form-engine/types.d.ts +17 -0
- package/dist/form-react/Fields/RichTextField.d.ts +3 -0
- package/dist/form-react/Fields/RichTextField.js +214 -0
- package/dist/form-react/Fields/SelectField.js +27 -28
- package/dist/form-react/Fields/SliderRangeField.d.ts +3 -0
- package/dist/form-react/Fields/SliderRangeField.js +69 -0
- package/dist/form-react/ReactHooksForm.js +149 -87
- package/dist/form-react/fields.d.ts +2 -0
- package/dist/form-react/fields.js +22 -18
- package/dist/form-react/hooks/useCascadingForm.d.ts +1 -2
- package/dist/form-react/hooks/useCascadingForm.js +59 -67
- package/dist/form-react/hooks/useFieldVisibility.d.ts +1 -2
- package/dist/form-react/hooks/useFieldVisibility.js +36 -43
- package/dist/form-react/hooks/useFormSteps.d.ts +29 -0
- package/dist/form-react/hooks/useFormSteps.js +96 -0
- package/dist/form-react/hooks/useReactHookForm.js +17 -18
- package/dist/form-react/hooks/useSelectOptions.d.ts +1 -1
- package/dist/form-react/hooks/useSelectOptions.js +80 -83
- package/dist/form-react/index.d.ts +5 -3
- package/dist/form-react/index.js +93 -88
- package/dist/form-react/registry/defaultFieldRegistrations.d.ts +1 -1
- package/dist/form-react/registry/defaultFieldRegistrations.js +11 -9
- package/dist/form-react/types/fields.types.d.ts +31 -12
- package/dist/form-react/types/fieldsOutput.types.d.ts +5 -1
- package/dist/form-react/types/reactHookForm.types.d.ts +31 -2
- package/dist/form-react/utils/fieldDefaults.utils.js +28 -13
- package/dist/impact-nova.css +1 -1
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- 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
|
|
4
|
-
import { AllEnterpriseModule as
|
|
5
|
-
import { AgGridReact as
|
|
6
|
-
import { customAgGridTheme as
|
|
7
|
-
import { syncAgGridThemeMode as
|
|
8
|
-
import { CustomHeader as
|
|
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
|
|
11
|
-
import { DefaultTextCellRenderer as
|
|
12
|
-
import { GridHeaderContext as
|
|
13
|
-
import { convertToAgGridFilterModel as
|
|
14
|
-
import { AG_GRID_VALUE_FORMATTERS as
|
|
15
|
-
import { useGridAutoSizeStrategyOnResize as
|
|
16
|
-
import { subscribeGridApiEvent as ct, subscribeGridApiEvents as
|
|
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
|
|
18
|
+
import { setActiveSearchColumnId as H, clearHeaderSearchActiveState as He } from "./headers/header-search-active-state.js";
|
|
19
19
|
/* empty css */
|
|
20
|
-
import { useAgGridTruncationTooltip as
|
|
21
|
-
import { isAgGridHeaderLabelTooltipOverflowing as
|
|
22
|
-
const
|
|
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,
|
|
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
|
|
43
|
-
if (
|
|
42
|
+
const a = s[g];
|
|
43
|
+
if (a == null) {
|
|
44
44
|
l.push("");
|
|
45
45
|
continue;
|
|
46
46
|
}
|
|
47
|
-
if (typeof
|
|
48
|
-
const u =
|
|
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
|
|
53
|
-
l.push(String(
|
|
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
|
|
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:
|
|
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
|
|
96
|
-
v.current = K,
|
|
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
|
-
|
|
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 (!
|
|
129
|
-
const t =
|
|
130
|
-
|
|
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 (!
|
|
134
|
-
const e =
|
|
135
|
-
|
|
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 (!
|
|
145
|
-
const t =
|
|
146
|
-
|
|
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
|
-
|
|
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),
|
|
156
|
-
}, [
|
|
155
|
+
}), H(v.current, null), a && a(e);
|
|
156
|
+
}, [a]), ie = m(
|
|
157
157
|
(e) => {
|
|
158
|
-
|
|
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
|
-
),
|
|
166
|
+
), ce = m(
|
|
167
167
|
(e) => {
|
|
168
168
|
h?.(e);
|
|
169
169
|
},
|
|
170
170
|
[h]
|
|
171
|
-
),
|
|
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:
|
|
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:
|
|
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
|
-
() =>
|
|
222
|
+
() => we(y ?? void 0, D),
|
|
223
223
|
[y, D]
|
|
224
224
|
), pe = f(() => ({
|
|
225
|
-
...
|
|
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(
|
|
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
|
-
|
|
315
|
+
Ge,
|
|
316
316
|
{
|
|
317
|
-
theme: ee ??
|
|
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:
|
|
326
|
-
onModelUpdated:
|
|
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
|
-
|
|
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
|
|
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
|
|
371
|
-
if (!
|
|
372
|
-
const u =
|
|
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
|
-
|
|
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
|
-
|
|
391
|
-
|
|
392
|
-
|
|
390
|
+
lt as AgGridWrapper,
|
|
391
|
+
mt as isAgGridHeaderLabelTooltipOverflowing,
|
|
392
|
+
ft as isAgGridTextOverflowing,
|
|
393
393
|
ct as subscribeGridApiEvent,
|
|
394
|
-
|
|
395
|
-
|
|
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
|
|
2
|
-
if (
|
|
3
|
-
return
|
|
4
|
-
const
|
|
5
|
-
for (let
|
|
6
|
-
const
|
|
7
|
-
|
|
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
|
|
10
|
-
for (let
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
for (let
|
|
14
|
-
l
|
|
15
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
2
|
+
function u(n) {
|
|
3
3
|
const t = /* @__PURE__ */ new Set();
|
|
4
|
-
return
|
|
5
|
-
t.add(
|
|
6
|
-
}),
|
|
7
|
-
t.add(
|
|
8
|
-
}),
|
|
9
|
-
t.add(
|
|
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(
|
|
13
|
-
return !
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
27
|
-
return !n ||
|
|
28
|
-
|
|
29
|
-
|
|
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
|
|
33
|
-
return
|
|
34
|
-
(
|
|
29
|
+
function f(n, t) {
|
|
30
|
+
return n.filter(
|
|
31
|
+
(e) => e.cascadingDependency?.some(
|
|
35
32
|
(r) => r.fieldId === t
|
|
36
33
|
)
|
|
37
|
-
).map((
|
|
34
|
+
).map((e) => e.id);
|
|
38
35
|
}
|
|
39
|
-
function
|
|
40
|
-
if (!
|
|
36
|
+
function y(n, t) {
|
|
37
|
+
if (!n || n.length === 0)
|
|
41
38
|
return null;
|
|
42
|
-
const
|
|
43
|
-
for (const r of
|
|
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 || (
|
|
42
|
+
i == null || i === "" || Array.isArray(i) && i.length === 0 || (e[r.fieldId] = i);
|
|
46
43
|
}
|
|
47
|
-
return Object.keys(
|
|
44
|
+
return Object.keys(e).length > 0 ? e : null;
|
|
48
45
|
}
|
|
49
|
-
function
|
|
46
|
+
function c(n) {
|
|
50
47
|
const t = /* @__PURE__ */ new Set();
|
|
51
|
-
for (const
|
|
52
|
-
|
|
53
|
-
for (const r of
|
|
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(
|
|
59
|
-
return
|
|
55
|
+
function b(n) {
|
|
56
|
+
return c(n);
|
|
60
57
|
}
|
|
61
|
-
function
|
|
58
|
+
function p(n) {
|
|
62
59
|
const t = /* @__PURE__ */ new Set();
|
|
63
|
-
for (const
|
|
64
|
-
t.add(
|
|
65
|
-
for (const r of
|
|
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
|
|
71
|
-
return
|
|
72
|
-
(r) => !!t[r.id] && d(r,
|
|
67
|
+
function I(n, t, e) {
|
|
68
|
+
return n.some(
|
|
69
|
+
(r) => !!t[r.id] && d(r, e)
|
|
73
70
|
);
|
|
74
71
|
}
|
|
75
|
-
function
|
|
76
|
-
return
|
|
72
|
+
function v(n, t) {
|
|
73
|
+
return n.filter((e) => d(e, t)).map((e) => e.id);
|
|
77
74
|
}
|
|
78
75
|
export {
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
y as buildCascadeParentFormState,
|
|
77
|
+
u as collectFieldDependencyIds,
|
|
81
78
|
b as collectFilterSidebarWatchFieldIds,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
|
|
89
|
-
|
|
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,
|
|
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
|
|
2
|
-
import { buildCascadeParentFormState as
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
r as
|
|
10
|
-
F as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
};
|