impact-nova 2.1.0-alpha.5 → 2.1.0-alpha.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 (34) hide show
  1. package/dist/components/data/ag-grid-react/index.js +120 -119
  2. package/dist/components/data/ag-grid-react/notify-column-indicator-sync.d.ts +7 -0
  3. package/dist/components/data/ag-grid-react/notify-column-indicator-sync.js +6 -0
  4. package/dist/components/data/ag-grid-react/theme.js +5 -4
  5. package/dist/components/data/data-table/build-column-tree-from-grid.d.ts +14 -0
  6. package/dist/components/data/data-table/build-column-tree-from-grid.js +95 -0
  7. package/dist/components/data/data-table/data-table-column-apply.d.ts +14 -1
  8. package/dist/components/data/data-table/data-table-column-apply.js +97 -13
  9. package/dist/components/data/data-table/data-table-column-def-pin.d.ts +25 -0
  10. package/dist/components/data/data-table/data-table-column-def-pin.js +66 -0
  11. package/dist/components/data/data-table/data-table-column-list-sync.d.ts +8 -0
  12. package/dist/components/data/data-table/data-table-column-list-sync.js +15 -0
  13. package/dist/components/data/data-table/data-table-column-list.d.ts +1 -1
  14. package/dist/components/data/data-table/data-table-column-list.js +73 -283
  15. package/dist/components/data/data-table/data-table-sheet.js +3 -1
  16. package/dist/components/data/data-table/data-table.js +80 -71
  17. package/dist/components/data/data-table/use-data-table-column-list-sync.d.ts +16 -0
  18. package/dist/components/data/data-table/use-data-table-column-list-sync.js +222 -0
  19. package/dist/components/forms/select/hooks/useSelectValueState.d.ts +19 -0
  20. package/dist/components/forms/select/hooks/useSelectValueState.js +41 -0
  21. package/dist/components/forms/select/index.js +4 -3
  22. package/dist/components/forms/select/select.js +163 -158
  23. package/dist/components/forms/select/select.types.d.ts +3 -2
  24. package/dist/components/forms/select/utils/select.d.ts +2 -1
  25. package/dist/components/forms/select/utils/select.js +47 -37
  26. package/dist/impact-nova-components.css +26 -17
  27. package/dist/impact-nova.css +1 -1
  28. package/dist/index.js +297 -296
  29. package/dist/llms/rules/ag-grid.js +1 -1
  30. package/dist/llms/rules/installation.js +1 -1
  31. package/dist/llms/rules/migration.js +1 -1
  32. package/dist/llms/rules/real-world-patterns.js +1 -1
  33. package/dist/llms/rules/requirements.js +1 -1
  34. package/package.json +5 -5
@@ -1,49 +1,50 @@
1
- import { jsx as n, jsxs as P } from "react/jsx-runtime";
2
- import { useState as f, useRef as _, useCallback as x, useMemo as y, useEffect as v, memo as S } from "react";
3
- import { AgGridWrapper as G } from "../ag-grid-react/index.js";
1
+ import { jsx as n, jsxs as G } from "react/jsx-runtime";
2
+ import { useState as h, useRef as E, useCallback as D, useMemo as g, useEffect as y, memo as v } from "react";
3
+ import { AgGridWrapper as O } from "../ag-grid-react/index.js";
4
4
  import { cn as H } from "../../../lib/utils.js";
5
- import { DataTableContext as C, DataTableSheetPortalStoreContext as R, useDataTable as E, useDataTableSheetPortal as w } from "./data-table-context.js";
6
- import { createDataTableSheetPortalStore as O } from "./data-table-sheet-portal-store.js";
7
- import { DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX as F } from "./data-table-constants.js";
8
- const A = {
5
+ import { DataTableContext as F, DataTableSheetPortalStoreContext as N, useDataTable as I, useDataTableSheetPortal as A } from "./data-table-context.js";
6
+ import { createDataTableSheetPortalStore as z } from "./data-table-sheet-portal-store.js";
7
+ import { DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX as B } from "./data-table-constants.js";
8
+ import { extractRuntimeColumnDefs as M, mergeInitialGridRuntimeState as j } from "./data-table-column-def-pin.js";
9
+ const P = {
9
10
  default: 46,
10
11
  compact: 30,
11
12
  comfort: 52
12
- }, V = ({
13
+ }, U = ({
13
14
  children: a,
14
15
  className: t
15
16
  }) => {
16
- const [r, e] = f(null), [o, c] = f("medium"), [s, p] = f("full"), [l, h] = f("default"), d = _(O()), m = x((i) => {
17
- d.current.registerScopedSheetDepth(i);
18
- }, []), u = x((i) => {
19
- e(i);
20
- }, []), g = {
17
+ const [r, e] = h(null), [o, c] = h("medium"), [i, S] = h("full"), [s, m] = h("default"), d = E(z()), u = D((l) => {
18
+ d.current.registerScopedSheetDepth(l);
19
+ }, []), f = D((l) => {
20
+ e(l);
21
+ }, []), x = {
21
22
  small: "12px",
22
23
  medium: "14px",
23
24
  large: "16px"
24
- }[o], b = `${A[l]}px`, T = y(
25
+ }[o], b = `${P[s]}px`, T = g(
25
26
  () => ({
26
27
  gridApi: r,
27
- registerApi: u,
28
- registerScopedSheetDepth: m,
28
+ registerApi: f,
29
+ registerScopedSheetDepth: u,
29
30
  fontSize: o,
30
31
  setFontSize: c,
31
- numericFormat: s,
32
- setNumericFormat: p,
33
- rowHeight: l,
34
- setRowHeight: h
32
+ numericFormat: i,
33
+ setNumericFormat: S,
34
+ rowHeight: s,
35
+ setRowHeight: m
35
36
  }),
36
37
  [
37
38
  r,
39
+ f,
38
40
  u,
39
- m,
40
41
  o,
41
- s,
42
- l
42
+ i,
43
+ s
43
44
  ]
44
45
  );
45
- return /* @__PURE__ */ n(C.Provider, { value: T, children: /* @__PURE__ */ n(
46
- R.Provider,
46
+ return /* @__PURE__ */ n(F.Provider, { value: T, children: /* @__PURE__ */ n(
47
+ N.Provider,
47
48
  {
48
49
  value: d.current,
49
50
  children: /* @__PURE__ */ n(
@@ -55,7 +56,7 @@ const A = {
55
56
  t
56
57
  ),
57
58
  style: {
58
- "--ag-font-size": g,
59
+ "--ag-font-size": x,
59
60
  "--ag-row-height": b
60
61
  },
61
62
  children: a
@@ -63,14 +64,14 @@ const A = {
63
64
  )
64
65
  }
65
66
  ) });
66
- }, D = {
67
+ }, w = {
67
68
  full: "full_no",
68
69
  k: "thou",
69
70
  m: "mil",
70
71
  b: "bil",
71
72
  full_precision: "full_precision"
72
- }, N = S(function() {
73
- const { setSheetTarget: t } = w();
73
+ }, k = v(function() {
74
+ const { setSheetTarget: t } = A();
74
75
  return /* @__PURE__ */ n(
75
76
  "div",
76
77
  {
@@ -78,37 +79,37 @@ const A = {
78
79
  className: "absolute inset-0 pointer-events-none z-[39] flex overflow-x-hidden overflow-y-visible"
79
80
  }
80
81
  );
81
- }), z = S(function({
82
+ }), L = v(function({
82
83
  className: t,
83
84
  children: r
84
85
  }) {
85
- const { scopedSheetOpen: e } = w();
86
- return /* @__PURE__ */ P(
86
+ const { scopedSheetOpen: e } = A();
87
+ return /* @__PURE__ */ G(
87
88
  "div",
88
89
  {
89
90
  className: H(
90
91
  "relative flex-1 min-h-0 w-full bg-canvas-elevated rounded-b-[inherit] grid-rounded-bottom",
91
92
  t
92
93
  ),
93
- style: e ? { minHeight: F } : void 0,
94
+ style: e ? { minHeight: B } : void 0,
94
95
  children: [
95
96
  r,
96
- /* @__PURE__ */ n(N, {})
97
+ /* @__PURE__ */ n(k, {})
97
98
  ]
98
99
  }
99
100
  );
100
- }), B = S(function({
101
+ }), W = v(function({
101
102
  resolvedRowHeight: t,
102
103
  mergedContext: r,
103
104
  onGridReady: e,
104
105
  columnDefs: o,
105
106
  maintainColumnOrder: c = !0,
106
- ...s
107
+ ...i
107
108
  }) {
108
109
  return /* @__PURE__ */ n(
109
- G,
110
+ O,
110
111
  {
111
- ...s,
112
+ ...i,
112
113
  columnDefs: o,
113
114
  rowHeight: t,
114
115
  onGridReady: e,
@@ -117,57 +118,65 @@ const A = {
117
118
  }
118
119
  );
119
120
  });
120
- function Y(a) {
121
+ function Z(a) {
121
122
  const {
122
123
  registerApi: t,
123
124
  rowHeight: r,
124
125
  gridApi: e,
125
126
  numericFormat: o
126
- } = E(), {
127
+ } = I(), {
127
128
  className: c,
128
- onGridReady: s,
129
- rowHeight: p,
130
- context: l,
131
- columnDefs: h,
132
- maintainColumnOrder: d = !0,
133
- ...m
134
- } = a, u = A[r], g = p ?? u, b = y(
129
+ onGridReady: i,
130
+ rowHeight: S,
131
+ context: s,
132
+ columnDefs: m,
133
+ initialState: d,
134
+ maintainColumnOrder: u = !0,
135
+ ...f
136
+ } = a, x = P[r], b = S ?? x, { runtimeColumnDefs: T, extractedRuntimeDefaults: l } = g(
137
+ () => M(m ?? void 0),
138
+ [m]
139
+ ), _ = g(
140
+ () => j(d, l),
141
+ [d, l]
142
+ ), C = g(
135
143
  () => ({
136
- ...l,
137
- formatType: D[o]
144
+ ...s,
145
+ formatType: w[o]
138
146
  }),
139
- [l, o]
147
+ [s, o]
140
148
  );
141
- v(() => {
149
+ y(() => {
142
150
  e?.resetRowHeights();
143
- }, [r, e]), v(() => {
151
+ }, [r, e]), y(() => {
144
152
  if (e) {
145
- const i = e.getGridOption("context") || {};
153
+ const p = e.getGridOption("context") || {};
146
154
  e.setGridOption("context", {
147
- ...i,
148
- formatType: D[o]
155
+ ...p,
156
+ formatType: w[o]
149
157
  }), e.refreshCells({ force: !0 });
150
158
  }
151
159
  }, [o, e]);
152
- const T = x(
153
- (i) => {
154
- t(i.api), s?.(i);
160
+ const R = D(
161
+ (p) => {
162
+ t(p.api), i?.(p);
155
163
  },
156
- [t, s]
164
+ [t, i]
157
165
  );
158
- return /* @__PURE__ */ n(z, { className: c, children: /* @__PURE__ */ n(
159
- B,
166
+ return /* @__PURE__ */ n(L, { className: c, children: /* @__PURE__ */ n(
167
+ W,
160
168
  {
161
- ...m,
162
- columnDefs: h,
163
- maintainColumnOrder: d,
164
- resolvedRowHeight: g,
165
- mergedContext: b,
166
- onGridReady: T
169
+ ...f,
170
+ columnDefs: T,
171
+ initialState: _,
172
+ maintainColumnOrder: u,
173
+ resolvedRowHeight: b,
174
+ mergedContext: C,
175
+ onGridReady: R
167
176
  }
168
177
  ) });
169
178
  }
170
- const $ = ({
179
+ const ee = ({
171
180
  children: a,
172
181
  className: t
173
182
  }) => /* @__PURE__ */ n(
@@ -182,7 +191,7 @@ const $ = ({
182
191
  }
183
192
  );
184
193
  export {
185
- V as DataTable,
186
- Y as DataTableContent,
187
- $ as DataTableToolbar
194
+ U as DataTable,
195
+ Z as DataTableContent,
196
+ ee as DataTableToolbar
188
197
  };
@@ -0,0 +1,16 @@
1
+ import { GridApi } from 'ag-grid-community';
2
+ import { NestedListItem } from '../nested-list/nested-list.types';
3
+ export interface UseDataTableColumnListSyncOptions {
4
+ gridApi: GridApi | null;
5
+ frozenColumnsLabel: string;
6
+ scrollableColumnsLabel: string;
7
+ }
8
+ export declare function useDataTableColumnListSync({ gridApi, frozenColumnsLabel, scrollableColumnsLabel, }: UseDataTableColumnListSyncOptions): {
9
+ items: NestedListItem[];
10
+ isReady: boolean;
11
+ externalSyncKey: boolean;
12
+ listWrapperRef: import('react').RefObject<HTMLDivElement | null>;
13
+ handleChange: (currentItems: NestedListItem[], enableApplyDiscard: boolean) => void;
14
+ handleSubmit: (finalItems: NestedListItem[]) => void;
15
+ handlePinChange: (itemId: string, newPinned: "left" | "right" | null) => void;
16
+ };
@@ -0,0 +1,222 @@
1
+ import { useState as M, useRef as h, useCallback as a, useEffect as x } from "react";
2
+ import { mergePartialOrderedColumnState as L } from "./data-table-column-state.js";
3
+ import { afterSynchronousColumnApply as b, normalizeColumnPinned as q, GRID_AUTO_UNPIN_WAIT_MS as H, alignColumnTreePinMetadata as N, EXTERNAL_SYNC_DEBOUNCE_MS as J, readGridColumnPinned as Q } from "./data-table-column-apply.js";
4
+ import { buildColumnTreeFromGrid as Z } from "./build-column-tree-from-grid.js";
5
+ import { computeColumnListSyncFingerprints as z, resolveColumnListSyncMode as A } from "./data-table-column-list-sync.js";
6
+ import { subscribeGridApiEvent as j } from "../ag-grid-react/grid-api-event-subscription.js";
7
+ function se({
8
+ gridApi: n,
9
+ frozenColumnsLabel: O,
10
+ scrollableColumnsLabel: _
11
+ }) {
12
+ const [K, v] = M([]), [V, W] = M(!1), [w, B] = M(!1), i = h(!1), E = h(null), S = h(0), y = h(""), P = h(""), C = a(() => !n || i.current ? null : Z(n, {
13
+ frozenColumns: O,
14
+ scrollableColumns: _
15
+ }), [n, O, _]), g = a(
16
+ (t, e, o) => {
17
+ const l = y.current, c = z(t);
18
+ y.current = c.structural, P.current = c.indicators, v(t), W(!0), e === "structural" && l !== "" && B((d) => !d);
19
+ },
20
+ [n]
21
+ ), p = a(
22
+ (t = "unknown") => {
23
+ const e = C();
24
+ e && g(e, "structural", t);
25
+ },
26
+ [g, C, n]
27
+ ), D = a(
28
+ (t) => {
29
+ const e = C();
30
+ if (!e) return;
31
+ const o = A(
32
+ e,
33
+ y.current,
34
+ P.current
35
+ );
36
+ if (o !== "skip") {
37
+ if (o === "structural") {
38
+ const l = E.current?.querySelector(
39
+ '[data-component="nested-list"] .overflow-y-auto'
40
+ );
41
+ l && (S.current = l.scrollTop);
42
+ }
43
+ g(e, o, t);
44
+ }
45
+ },
46
+ [g, C]
47
+ );
48
+ x(() => {
49
+ if (!n) return;
50
+ queueMicrotask(() => p("initial"));
51
+ const t = [
52
+ "columnVisible",
53
+ "columnPinned",
54
+ "columnMoved",
55
+ "gridReady",
56
+ "columnGroupOpened",
57
+ "columnRowGroupChanged",
58
+ "columnPivotModeChanged",
59
+ "columnEverythingChanged",
60
+ "dragStopped",
61
+ "columnValueChanged",
62
+ "displayedColumnsChanged",
63
+ "sortChanged",
64
+ "filterChanged",
65
+ "newColumnsLoaded"
66
+ ];
67
+ let e = null;
68
+ const o = (c) => {
69
+ i.current || (e && clearTimeout(e), e = setTimeout(() => {
70
+ e = null, !(i.current || n.isDestroyed()) && D(`grid:${c}`);
71
+ }, J));
72
+ }, l = t.map(
73
+ (c) => j(n, c, () => {
74
+ o(c);
75
+ })
76
+ );
77
+ return () => {
78
+ e && clearTimeout(e), l.forEach((c) => c());
79
+ };
80
+ }, [n, p, D]), x(() => {
81
+ if (S.current === 0) return;
82
+ const t = requestAnimationFrame(() => {
83
+ const e = E.current?.querySelector(
84
+ '[data-component="nested-list"] .overflow-y-auto'
85
+ );
86
+ e && (e.scrollTop = S.current, S.current = 0);
87
+ });
88
+ return () => cancelAnimationFrame(t);
89
+ }, [w]);
90
+ const U = a(
91
+ (t) => {
92
+ const e = [], o = (l, c) => {
93
+ l.forEach((r) => {
94
+ if (r.id === "root-frozen") {
95
+ r.children && o(r.children, "left");
96
+ return;
97
+ }
98
+ if (r.id === "root-scrollable") {
99
+ r.children && o(r.children, null);
100
+ return;
101
+ }
102
+ if (r.category === "group" || r.children && r.children.length > 0)
103
+ r.children && o(r.children, c);
104
+ else {
105
+ let u;
106
+ if (c === null)
107
+ u = null;
108
+ else {
109
+ const f = r.data?.pinned;
110
+ u = f === "left" || f === "right" ? f : c;
111
+ }
112
+ e.push({
113
+ colId: r.id,
114
+ pinned: u,
115
+ hide: !r.checked
116
+ });
117
+ }
118
+ });
119
+ };
120
+ return o(t, null), e;
121
+ },
122
+ []
123
+ ), I = a(
124
+ (t) => {
125
+ if (!n) return;
126
+ i.current = !0;
127
+ const e = U(t);
128
+ if (e.length === 0) {
129
+ b(() => {
130
+ i.current = !1;
131
+ });
132
+ return;
133
+ }
134
+ const o = n.getColumnState(), l = L(o, e), c = new Set(
135
+ o.filter((s) => q(s.pinned)).map((s) => s.colId)
136
+ ), r = l.filter(
137
+ (s) => q(s.pinned) && !c.has(s.colId)
138
+ ), d = new Set(r.map((s) => s.colId));
139
+ n.applyColumnState({ state: l, applyOrder: !0 });
140
+ const u = () => {
141
+ i.current = !1, p("handleChanges:releaseLockAndSync");
142
+ };
143
+ if (d.size === 0) {
144
+ b(u);
145
+ return;
146
+ }
147
+ let T = !1, f = null, G = null;
148
+ G = j(n, "columnPinned", () => {
149
+ if (T || n.isDestroyed()) return;
150
+ const s = n.getColumnState();
151
+ if (r.filter((R) => {
152
+ const m = s.find((F) => F.colId === R.colId);
153
+ return m && !m.pinned;
154
+ }).length > 0) {
155
+ T = !0, f && clearTimeout(f), G?.();
156
+ const R = l.filter(
157
+ (m) => m.pinned && !d.has(m.colId)
158
+ );
159
+ if (R.length > 0) {
160
+ const m = R[0], F = l.map(
161
+ (k) => k.colId === m.colId ? { ...k, pinned: null } : k
162
+ );
163
+ n.applyColumnState({ state: F, applyOrder: !0 });
164
+ }
165
+ b(u);
166
+ }
167
+ }), f = setTimeout(() => {
168
+ G?.(), T || u();
169
+ }, H);
170
+ },
171
+ [n, U, p]
172
+ ), X = a(
173
+ (t) => {
174
+ I(N(t));
175
+ },
176
+ [I]
177
+ ), Y = a(
178
+ (t, e) => {
179
+ const o = N(t);
180
+ e || I(o), v(o);
181
+ const l = z(o);
182
+ y.current = l.structural, P.current = l.indicators;
183
+ },
184
+ [I]
185
+ ), $ = a(
186
+ (t, e) => {
187
+ if (v((c) => {
188
+ const r = (d) => d.map((u) => u.id === t ? {
189
+ ...u,
190
+ data: {
191
+ ...u.data,
192
+ pinned: e
193
+ }
194
+ } : u.children ? {
195
+ ...u,
196
+ children: r(u.children)
197
+ } : u);
198
+ return r(c);
199
+ }), !n) return;
200
+ i.current = !0;
201
+ const o = n.getColumnState(), l = L(o, [
202
+ { colId: t, pinned: e }
203
+ ]);
204
+ n.applyColumnState({ state: l, applyOrder: !0 }), b(() => {
205
+ i.current = !1, Q(n, t) !== e && p("handlePinChange");
206
+ });
207
+ },
208
+ [n, p]
209
+ );
210
+ return {
211
+ items: K,
212
+ isReady: V,
213
+ externalSyncKey: w,
214
+ listWrapperRef: E,
215
+ handleChange: Y,
216
+ handleSubmit: X,
217
+ handlePinChange: $
218
+ };
219
+ }
220
+ export {
221
+ se as useDataTableColumnListSync
222
+ };
@@ -0,0 +1,19 @@
1
+ import { Option, PropsValue } from '../select.types';
2
+ export interface UseSelectValueStateParams<OptionType> {
3
+ value: PropsValue<OptionType> | undefined;
4
+ defaultValue: PropsValue<OptionType> | undefined;
5
+ isMulti: boolean;
6
+ onChange?: unknown;
7
+ }
8
+ export interface UseSelectValueStateResult<OptionType> {
9
+ usesMenuSession: boolean;
10
+ currentValue: PropsValue<OptionType>;
11
+ setCurrentValue: (next: PropsValue<OptionType>) => void;
12
+ beginMenuSession: () => void;
13
+ endMenuSession: () => PropsValue<OptionType> | undefined;
14
+ }
15
+ /**
16
+ * Controlled selects without `onChange` keep edits in a menu session so
17
+ * `onMenuClose` can batch-commit without stale `value` props.
18
+ */
19
+ export declare function useSelectValueState<OptionType extends Option = Option>({ value, defaultValue, isMulti, onChange, }: UseSelectValueStateParams<OptionType>): UseSelectValueStateResult<OptionType>;
@@ -0,0 +1,41 @@
1
+ import { useState as i, useRef as v, useCallback as r } from "react";
2
+ import { cloneSelectValue as M } from "../utils/select.js";
3
+ function h({
4
+ value: c,
5
+ defaultValue: V,
6
+ isMulti: s,
7
+ onChange: f
8
+ }) {
9
+ const u = c !== void 0, e = u && f === void 0, [S, d] = i(
10
+ V ?? (s ? [] : null)
11
+ ), [a, l] = i(null), o = v(null), t = u ? c : S, m = e && a !== null ? a : t, p = r(
12
+ (n) => {
13
+ if (!u) {
14
+ d(n);
15
+ return;
16
+ }
17
+ e && (o.current = n, l(n));
18
+ },
19
+ [u, e]
20
+ ), C = r(() => {
21
+ if (!e)
22
+ return;
23
+ const n = M(t, s);
24
+ o.current = n, l(n);
25
+ }, [e, t, s]), b = r(() => {
26
+ if (!e)
27
+ return;
28
+ const n = o.current ?? t;
29
+ return o.current = null, l(null), n;
30
+ }, [e, t]);
31
+ return {
32
+ usesMenuSession: e,
33
+ currentValue: m,
34
+ setCurrentValue: p,
35
+ beginMenuSession: C,
36
+ endMenuSession: b
37
+ };
38
+ }
39
+ export {
40
+ h as useSelectValueState
41
+ };
@@ -1,13 +1,14 @@
1
1
  import { Select as n } from "./select.js";
2
- import { cx as r, getIndeterminateState as i, getLeafOptions as c, getSelectedCount as S, getSequence as a, isInvertedSelection as d, isOptionArray as g, isSelected as l } from "./utils/select.js";
2
+ import { cloneSelectValue as c, cx as r, getIndeterminateState as i, getLeafOptions as l, getSelectedCount as S, getSequence as a, isInvertedSelection as d, isOptionArray as g, isSelected as p } from "./utils/select.js";
3
3
  export {
4
4
  n as Select,
5
+ c as cloneSelectValue,
5
6
  r as cx,
6
7
  i as getIndeterminateState,
7
- c as getLeafOptions,
8
+ l as getLeafOptions,
8
9
  S as getSelectedCount,
9
10
  a as getSequence,
10
11
  d as isInvertedSelection,
11
12
  g as isOptionArray,
12
- l as isSelected
13
+ p as isSelected
13
14
  };