impact-nova 2.5.0 → 2.5.2

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 (25) hide show
  1. package/dist/components/data/data-table/build-column-state-from-tree.d.ts +7 -0
  2. package/dist/components/data/data-table/build-column-state-from-tree.js +34 -0
  3. package/dist/components/data/data-table/column-runtime-state-guard.d.ts +17 -0
  4. package/dist/components/data/data-table/column-runtime-state-guard.js +69 -0
  5. package/dist/components/data/data-table/data-table-column-apply.d.ts +4 -0
  6. package/dist/components/data/data-table/data-table-column-apply.js +82 -65
  7. package/dist/components/data/data-table/data-table-column-list-sync.d.ts +4 -3
  8. package/dist/components/data/data-table/data-table-column-list-sync.js +6 -5
  9. package/dist/components/data/data-table/data-table-column-list.js +34 -36
  10. package/dist/components/data/data-table/data-table-column-tree-cache.d.ts +6 -4
  11. package/dist/components/data/data-table/data-table-column-tree-cache.js +102 -69
  12. package/dist/components/data/data-table/data-table.js +66 -61
  13. package/dist/components/data/data-table/index.d.ts +1 -0
  14. package/dist/components/data/data-table/index.js +50 -44
  15. package/dist/components/data/data-table/patch-column-tree-visibility-from-grid.d.ts +3 -0
  16. package/dist/components/data/data-table/patch-column-tree-visibility-from-grid.js +35 -0
  17. package/dist/components/data/data-table/use-data-table-column-list-sync.d.ts +0 -1
  18. package/dist/components/data/data-table/use-data-table-column-list-sync.js +194 -263
  19. package/dist/components/data/nested-list/components/SortableItem.js +43 -42
  20. package/dist/components/data/nested-list/nested-list-tree-utils.d.ts +8 -0
  21. package/dist/components/data/nested-list/nested-list-tree-utils.js +38 -12
  22. package/dist/index.js +292 -286
  23. package/dist/llms/rules/installation.js +1 -1
  24. package/dist/llms/rules/requirements.js +1 -1
  25. package/package.json +1 -1
@@ -1,154 +1,126 @@
1
- import { useState as U, useRef as S, useCallback as m, useLayoutEffect as et, useEffect as _ } from "react";
2
- import { mergePartialOrderedColumnState as V } from "./data-table-column-state.js";
3
- import { afterSynchronousColumnApply as M, normalizeColumnPinned as B, GRID_AUTO_UNPIN_WAIT_MS as nt, alignColumnTreePinMetadata as X, EXTERNAL_SYNC_DEBOUNCE_MS as rt, readGridColumnPinned as ot } from "./data-table-column-apply.js";
4
- import { computeColumnListSyncFingerprints as Y } from "./data-table-column-list-sync.js";
5
- import { resolveColumnTreeFromCacheOrGrid as z, peekColumnListSyncWouldSkip as ct, readColumnTreeCache as H, writeColumnTreeCache as ut } from "./data-table-column-tree-cache.js";
6
- import { patchColumnTreeIndicatorsFromGrid as J } from "./patch-column-tree-indicators-from-grid.js";
7
- import { subscribeGridApiEvent as P } from "../ag-grid-react/grid-api-event-subscription.js";
8
- import { subscribeColumnIndicatorSync as Q } from "../ag-grid-react/column-indicator-sync-bus.js";
9
- function Ct({
10
- gridApi: t,
11
- frozenColumnsLabel: d,
12
- scrollableColumnsLabel: f,
13
- isSyncActive: a = !0
1
+ import { useState as W, useRef as p, useEffect as j, useCallback as d, useLayoutEffect as $ } from "react";
2
+ import { mergePartialOrderedColumnState as q } from "./data-table-column-state.js";
3
+ import { afterSynchronousColumnApply as k, normalizeColumnPinned as z, GRID_AUTO_UNPIN_WAIT_MS as A, alignColumnTreePinMetadata as V, EXTERNAL_SYNC_DEBOUNCE_MS as ee, readGridColumnPinned as ne } from "./data-table-column-apply.js";
4
+ import { buildColumnStateFromTree as te } from "./build-column-state-from-tree.js";
5
+ import { isColumnRuntimeStateGuardUpdating as w } from "./column-runtime-state-guard.js";
6
+ import { computeColumnListSyncFingerprints as re } from "./data-table-column-list-sync.js";
7
+ import { writeColumnTreeCache as B, resolveColumnTreeFromCacheOrGrid as oe, peekColumnListSyncWouldSkip as ue, readColumnTreeCache as se } from "./data-table-column-tree-cache.js";
8
+ import { patchColumnTreeIndicatorsFromGrid as ce } from "./patch-column-tree-indicators-from-grid.js";
9
+ import { subscribeGridApiEvent as X } from "../ag-grid-react/grid-api-event-subscription.js";
10
+ import { subscribeColumnIndicatorSync as le } from "../ag-grid-react/column-indicator-sync-bus.js";
11
+ function Y(e, C, h) {
12
+ return {
13
+ layout: e.current,
14
+ visibility: C.current,
15
+ indicators: h.current
16
+ };
17
+ }
18
+ function x(e, C, h, c) {
19
+ C.current = e.layout, h.current = e.visibility, c.current = e.indicators;
20
+ }
21
+ function Te({
22
+ gridApi: e,
23
+ frozenColumnsLabel: C,
24
+ scrollableColumnsLabel: h,
25
+ isSyncActive: c = !0
14
26
  }) {
15
- const [Z, k] = U([]), [$, x] = U(!1), [q, N] = U(!1), i = S(!1), g = S(null), E = S(0), I = S(""), R = S(""), W = S(a), b = S(!1), T = m(
16
- (e, n) => {
17
- const o = I.current, c = Y(e);
18
- I.current = c.structural, R.current = c.indicators, k(e), x(!0), n === "structural" && o !== "" && N((r) => !r), n === "indicators-only" && b.current && (b.current = !1, N((r) => !r));
27
+ const [R, E] = W([]), [H, M] = W(!1), l = p(!1), J = p(null), D = p(R), S = p(""), b = p(""), I = p(""), N = p(c);
28
+ j(() => {
29
+ D.current = R;
30
+ }, [R]);
31
+ const F = d(
32
+ () => ({
33
+ frozenColumns: C,
34
+ scrollableColumns: h
35
+ }),
36
+ [C, h]
37
+ ), y = d(
38
+ (n) => {
39
+ x(
40
+ re(n),
41
+ S,
42
+ b,
43
+ I
44
+ );
19
45
  },
20
46
  []
21
- ), p = m(
22
- () => {
23
- if (!t || i.current) return;
24
- const e = z({
25
- gridApi: t,
26
- labels: {
27
- frozenColumns: d,
28
- scrollableColumns: f
29
- },
30
- previousFingerprints: {
31
- structural: I.current,
32
- indicators: R.current
33
- }
34
- });
35
- if (e.syncMode === "skip" || !e.rootItems) {
36
- e.syncMode !== "skip" && x(!0);
47
+ ), T = d(
48
+ (n) => {
49
+ if (!e) {
50
+ l.current = !1;
37
51
  return;
38
52
  }
39
- T(
40
- e.rootItems,
41
- e.syncMode === "indicators-only" ? "indicators-only" : "structural"
42
- );
53
+ l.current = !1, B(e, n), y(n);
43
54
  },
44
- [
45
- T,
46
- d,
47
- t,
48
- f
49
- ]
50
- ), j = m(
51
- () => {
52
- if (!t || i.current) return;
53
- const e = z({
54
- gridApi: t,
55
- labels: {
56
- frozenColumns: d,
57
- scrollableColumns: f
58
- },
59
- previousFingerprints: {
60
- structural: I.current,
61
- indicators: R.current
62
- }
63
- });
64
- if (e.syncMode !== "skip" && e.rootItems) {
65
- if (e.syncMode === "structural") {
66
- const n = g.current?.querySelector(
67
- '[data-component="nested-list"] .overflow-y-auto'
68
- );
69
- n && (E.current = n.scrollTop);
70
- }
71
- T(
72
- e.rootItems,
73
- e.syncMode === "indicators-only" ? "indicators-only" : "structural"
74
- );
75
- }
76
- },
77
- [
78
- T,
79
- d,
80
- t,
81
- f
82
- ]
83
- );
84
- et(() => {
85
- const e = a && !W.current;
86
- if (W.current = a, !t || !a) return;
87
- const n = {
88
- frozenColumns: d,
89
- scrollableColumns: f
90
- }, o = {
91
- structural: I.current,
92
- indicators: R.current
93
- };
94
- if (!(!e && o.structural !== "" && ct({
95
- gridApi: t,
96
- labels: n,
97
- previousFingerprints: o
55
+ [e, y]
56
+ ), a = d(() => {
57
+ if (!e || l.current || w(e))
58
+ return;
59
+ const n = oe({
60
+ gridApi: e,
61
+ labels: F(),
62
+ previousFingerprints: Y(
63
+ S,
64
+ b,
65
+ I
66
+ )
67
+ });
68
+ if (n.syncMode === "skip" || !n.rootItems) {
69
+ n.syncMode !== "skip" && M(!0);
70
+ return;
71
+ }
72
+ x(
73
+ n.fingerprints,
74
+ S,
75
+ b,
76
+ I
77
+ ), E(n.rootItems), M(!0);
78
+ }, [e, F]);
79
+ $(() => {
80
+ const n = c && !N.current;
81
+ if (N.current = c, !e || !c) return;
82
+ const t = F(), r = Y(
83
+ S,
84
+ b,
85
+ I
86
+ );
87
+ if (!(!n && r.layout !== "" && ue({
88
+ gridApi: e,
89
+ labels: t,
90
+ previousFingerprints: r
98
91
  }))) {
99
- if (e) {
100
- b.current = !0, queueMicrotask(() => {
101
- const c = H(t, n);
102
- if (c) {
103
- const s = J(
104
- c.items,
105
- t
92
+ if (n) {
93
+ queueMicrotask(() => {
94
+ const o = se(e, t);
95
+ if (o) {
96
+ const i = ce(
97
+ o.items,
98
+ e
106
99
  );
107
- T(s, "indicators-only");
100
+ x(
101
+ B(e, i),
102
+ S,
103
+ b,
104
+ I
105
+ ), E(i), M(!0);
108
106
  return;
109
107
  }
110
- p();
108
+ a();
111
109
  });
112
110
  return;
113
111
  }
114
112
  queueMicrotask(() => {
115
- p();
113
+ a();
116
114
  });
117
115
  }
118
116
  }, [
119
- t,
120
- a,
121
- d,
122
- f,
123
- p,
124
- T
125
- ]), _(() => {
126
- if (!t || a) return;
127
- const e = {
128
- frozenColumns: d,
129
- scrollableColumns: f
130
- }, n = () => {
131
- const r = H(t, e);
132
- if (!r)
133
- return;
134
- const h = J(
135
- r.items,
136
- t
137
- );
138
- ut(t, h);
139
- }, o = P(t, "sortChanged", () => {
140
- n();
141
- }), c = P(t, "filterChanged", () => {
142
- n();
143
- }), s = Q(() => {
144
- n();
145
- });
146
- return () => {
147
- o(), c(), s();
148
- };
149
- }, [t, a, d, f]), _(() => {
150
- if (!t || !a) return;
151
- const e = [
117
+ e,
118
+ c,
119
+ F,
120
+ a
121
+ ]), j(() => {
122
+ if (!e || !c) return;
123
+ const n = [
152
124
  "columnVisible",
153
125
  "columnPinned",
154
126
  "columnMoved",
@@ -164,161 +136,120 @@ function Ct({
164
136
  "filterChanged",
165
137
  "newColumnsLoaded"
166
138
  ];
167
- let n = null;
168
- const o = () => {
169
- i.current || (n && clearTimeout(n), n = setTimeout(() => {
170
- n = null, !(i.current || t.isDestroyed()) && j();
171
- }, rt));
172
- }, c = e.map(
173
- (r) => P(t, r, () => {
174
- o();
139
+ let t = null;
140
+ const r = () => {
141
+ l.current || w(e) || (t && clearTimeout(t), t = setTimeout(() => {
142
+ t = null, !(l.current || w(e) || e.isDestroyed()) && a();
143
+ }, ee));
144
+ }, o = n.map(
145
+ (m) => X(e, m, () => {
146
+ r();
175
147
  })
176
- ), s = Q(() => {
177
- o();
148
+ ), i = le(() => {
149
+ r();
178
150
  });
179
151
  return () => {
180
- n && clearTimeout(n), c.forEach((r) => r()), s();
152
+ t && clearTimeout(t), o.forEach((m) => m()), i();
181
153
  };
182
- }, [t, a, j]), _(() => {
183
- if (E.current === 0) return;
184
- const e = requestAnimationFrame(() => {
185
- const n = g.current?.querySelector(
186
- '[data-component="nested-list"] .overflow-y-auto'
187
- );
188
- n && (n.scrollTop = E.current, E.current = 0);
189
- });
190
- return () => cancelAnimationFrame(e);
191
- }, [q]);
192
- const K = m(
193
- (e) => {
194
- const n = [], o = (c, s) => {
195
- c.forEach((r) => {
196
- if (r.id === "root-frozen") {
197
- r.children && o(r.children, "left");
198
- return;
199
- }
200
- if (r.id === "root-scrollable") {
201
- r.children && o(r.children, null);
202
- return;
203
- }
204
- if (r.category === "group" || r.children && r.children.length > 0)
205
- r.children && o(r.children, s);
206
- else {
207
- let u;
208
- if (s === null)
209
- u = null;
210
- else {
211
- const y = r.data?.pinned;
212
- u = y === "left" || y === "right" ? y : s;
213
- }
214
- n.push({
215
- colId: r.id,
216
- pinned: u,
217
- hide: !r.checked
218
- });
219
- }
220
- });
221
- };
222
- return o(e, null), n;
223
- },
224
- []
225
- ), F = m(
226
- (e) => {
227
- if (!t) return;
228
- i.current = !0;
229
- const n = K(e);
230
- if (n.length === 0) {
231
- M(() => {
232
- i.current = !1;
154
+ }, [e, c, a]);
155
+ const P = d(
156
+ (n) => {
157
+ if (!e) return;
158
+ l.current = !0;
159
+ const t = te(n);
160
+ if (t.length === 0) {
161
+ k(() => {
162
+ T(n);
233
163
  });
234
164
  return;
235
165
  }
236
- const o = t.getColumnState(), c = V(o, n), s = new Set(
237
- o.filter((l) => B(l.pinned)).map((l) => l.colId)
238
- ), r = c.filter(
239
- (l) => B(l.pinned) && !s.has(l.colId)
240
- ), h = new Set(r.map((l) => l.colId));
241
- t.applyColumnState({ state: c, applyOrder: !0 });
166
+ const r = e.getColumnState(), o = q(r, t), i = new Set(
167
+ r.filter((s) => z(s.pinned)).map((s) => s.colId)
168
+ ), m = o.filter(
169
+ (s) => z(s.pinned) && !i.has(s.colId)
170
+ ), v = new Set(m.map((s) => s.colId));
171
+ e.applyColumnState({ state: o, applyOrder: !0 });
242
172
  const u = () => {
243
- i.current = !1, p();
173
+ T(n);
244
174
  };
245
- if (h.size === 0) {
246
- M(u);
175
+ if (v.size === 0) {
176
+ k(u);
247
177
  return;
248
178
  }
249
- let v = !1, y = null, O = null;
250
- O = P(t, "columnPinned", () => {
251
- if (v || t.isDestroyed()) return;
252
- const l = t.getColumnState();
253
- if (r.filter((G) => {
254
- const C = l.find((w) => w.colId === G.colId);
255
- return C && !C.pinned;
179
+ let O = !1, U = null, _ = null;
180
+ _ = X(e, "columnPinned", () => {
181
+ if (O || e.isDestroyed()) return;
182
+ const s = e.getColumnState();
183
+ if (m.filter((G) => {
184
+ const f = s.find((g) => g.colId === G.colId);
185
+ return f && !f.pinned;
256
186
  }).length > 0) {
257
- v = !0, y && clearTimeout(y), O?.();
258
- const G = c.filter(
259
- (C) => C.pinned && !h.has(C.colId)
187
+ O = !0, U && clearTimeout(U), _?.();
188
+ const G = o.filter(
189
+ (f) => f.pinned && !v.has(f.colId)
260
190
  );
261
191
  if (G.length > 0) {
262
- const C = G[0], w = c.map(
263
- (D) => D.colId === C.colId ? { ...D, pinned: null } : D
192
+ const f = G[0], g = o.map(
193
+ (L) => L.colId === f.colId ? { ...L, pinned: null } : L
264
194
  );
265
- t.applyColumnState({ state: w, applyOrder: !0 });
195
+ e.applyColumnState({ state: g, applyOrder: !0 });
266
196
  }
267
- M(u);
197
+ k(() => {
198
+ l.current = !1, a();
199
+ });
268
200
  }
269
- }), y = setTimeout(() => {
270
- O?.(), v || u();
271
- }, nt);
201
+ }), U = setTimeout(() => {
202
+ _?.(), O || u();
203
+ }, A);
272
204
  },
273
- [t, K, p]
274
- ), L = m(
275
- (e) => {
276
- F(X(e));
205
+ [e, T, a]
206
+ ), K = d(
207
+ (n) => {
208
+ P(V(n));
277
209
  },
278
- [F]
279
- ), A = m(
280
- (e, n) => {
281
- const o = X(e);
282
- n || F(o), k(o);
283
- const c = Y(o);
284
- I.current = c.structural, R.current = c.indicators;
210
+ [P]
211
+ ), Q = d(
212
+ (n, t) => {
213
+ const r = V(n);
214
+ t || P(r), E(r), y(r);
285
215
  },
286
- [F]
287
- ), tt = m(
288
- (e, n) => {
289
- if (k((s) => {
290
- const r = (h) => h.map((u) => u.id === e ? {
291
- ...u,
292
- data: {
293
- ...u.data,
294
- pinned: n
295
- }
296
- } : u.children ? {
297
- ...u,
298
- children: r(u.children)
299
- } : u);
300
- return r(s);
301
- }), !t) return;
302
- i.current = !0;
303
- const o = t.getColumnState(), c = V(o, [
304
- { colId: e, pinned: n }
216
+ [P, y]
217
+ ), Z = d(
218
+ (n, t) => {
219
+ const r = (v) => v.map((u) => u.id === n ? {
220
+ ...u,
221
+ data: {
222
+ ...u.data,
223
+ pinned: t
224
+ }
225
+ } : u.children ? {
226
+ ...u,
227
+ children: r(u.children)
228
+ } : u), o = r(D.current);
229
+ if (E(o), y(o), !e) return;
230
+ l.current = !0;
231
+ const i = e.getColumnState(), m = q(i, [
232
+ { colId: n, pinned: t }
305
233
  ]);
306
- t.applyColumnState({ state: c, applyOrder: !0 }), M(() => {
307
- i.current = !1, ot(t, e) !== n && p();
234
+ e.applyColumnState({ state: m, applyOrder: !0 }), k(() => {
235
+ if (ne(e, n) !== t) {
236
+ l.current = !1, a();
237
+ return;
238
+ }
239
+ T(o);
308
240
  });
309
241
  },
310
- [t, p]
242
+ [e, y, T, a]
311
243
  );
312
244
  return {
313
- items: Z,
314
- isReady: $,
315
- externalSyncKey: q,
316
- listWrapperRef: g,
317
- handleChange: A,
318
- handleSubmit: L,
319
- handlePinChange: tt
245
+ items: R,
246
+ isReady: H,
247
+ listWrapperRef: J,
248
+ handleChange: Q,
249
+ handleSubmit: K,
250
+ handlePinChange: Z
320
251
  };
321
252
  }
322
253
  export {
323
- Ct as useDataTableColumnListSync
254
+ Te as useDataTableColumnListSync
324
255
  };