impact-nova 1.7.29 → 1.7.30
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/ui/data-table/data-table-column-list.js +86 -82
- package/dist/components/ui/nested-list/hooks/useNestedListDragDrop.d.ts +2 -1
- package/dist/components/ui/nested-list/hooks/useNestedListDragDrop.js +134 -133
- package/dist/components/ui/nested-list/hooks/useNestedListState.d.ts +2 -1
- package/dist/components/ui/nested-list/hooks/useNestedListState.js +67 -66
- package/dist/components/ui/nested-list/nested-list.js +183 -175
- package/dist/components/ui/types/nested-list.types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ interface UseNestedListStateProps {
|
|
|
9
9
|
initialItems: NestedListItem[];
|
|
10
10
|
enableApplyDiscard: boolean;
|
|
11
11
|
enableNormalizedState?: boolean;
|
|
12
|
+
initialCollapsedItems?: Record<string, boolean>;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
15
|
* Build normalized state from nested tree structure
|
|
@@ -35,7 +36,7 @@ declare function getAncestorIds(normalized: NormalizedItems, itemId: string): st
|
|
|
35
36
|
* Get all descendant IDs for an item (for cascade operations)
|
|
36
37
|
*/
|
|
37
38
|
declare function getDescendantIds(normalized: NormalizedItems, itemId: string): string[];
|
|
38
|
-
export declare const useNestedListState: ({ initialItems, enableApplyDiscard, enableNormalizedState, }: UseNestedListStateProps) => {
|
|
39
|
+
export declare const useNestedListState: ({ initialItems, enableApplyDiscard, enableNormalizedState, initialCollapsedItems, }: UseNestedListStateProps) => {
|
|
39
40
|
findItemByIdFast: (id: string) => NestedListItem | null;
|
|
40
41
|
updateItemFast: (itemId: string, updates: Partial<NestedListItem>) => void;
|
|
41
42
|
getAncestors: (itemId: string) => string[];
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { useState as
|
|
1
|
+
import { useState as u, useMemo as O, useCallback as g } from "react";
|
|
2
2
|
function p(s) {
|
|
3
|
-
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(),
|
|
4
|
-
|
|
5
|
-
e.set(
|
|
3
|
+
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), d = [], i = (r, h) => {
|
|
4
|
+
r.forEach((o) => {
|
|
5
|
+
e.set(o.id, o), n.set(o.id, h), o.children && o.children.length > 0 ? (t.set(o.id, o.children.map((C) => C.id)), i(o.children, o.id)) : t.set(o.id, []), h === null && d.push(o.id);
|
|
6
6
|
});
|
|
7
7
|
};
|
|
8
|
-
return
|
|
8
|
+
return i(s, null), { byId: e, childrenById: t, parentById: n, rootIds: d };
|
|
9
9
|
}
|
|
10
10
|
function a(s) {
|
|
11
11
|
const e = (t) => {
|
|
12
12
|
const n = [];
|
|
13
|
-
for (const
|
|
14
|
-
const
|
|
15
|
-
if (!
|
|
16
|
-
const
|
|
13
|
+
for (const d of t) {
|
|
14
|
+
const i = s.byId.get(d);
|
|
15
|
+
if (!i) continue;
|
|
16
|
+
const r = s.childrenById.get(d) || [], h = r.length > 0 ? e(r) : void 0;
|
|
17
17
|
n.push({
|
|
18
|
-
...
|
|
19
|
-
children:
|
|
18
|
+
...i,
|
|
19
|
+
children: h
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
return n;
|
|
@@ -26,85 +26,86 @@ function a(s) {
|
|
|
26
26
|
function R(s, e, t) {
|
|
27
27
|
const n = s.byId.get(e);
|
|
28
28
|
if (!n) return s;
|
|
29
|
-
const
|
|
30
|
-
return
|
|
29
|
+
const d = new Map(s.byId);
|
|
30
|
+
return d.set(e, { ...n, ...t }), {
|
|
31
31
|
...s,
|
|
32
|
-
byId:
|
|
32
|
+
byId: d
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function N(s, e) {
|
|
36
36
|
return s.byId.get(e) || null;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function z(s, e) {
|
|
39
39
|
const t = [];
|
|
40
40
|
let n = s.parentById.get(e) || null;
|
|
41
41
|
for (; n !== null; )
|
|
42
42
|
t.push(n), n = s.parentById.get(n) || null;
|
|
43
43
|
return t;
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
const t = [], n = (
|
|
47
|
-
(s.childrenById.get(
|
|
48
|
-
t.push(
|
|
45
|
+
function tt(s, e) {
|
|
46
|
+
const t = [], n = (d) => {
|
|
47
|
+
(s.childrenById.get(d) || []).forEach((r) => {
|
|
48
|
+
t.push(r), n(r);
|
|
49
49
|
});
|
|
50
50
|
};
|
|
51
51
|
return n(e), t;
|
|
52
52
|
}
|
|
53
|
-
const
|
|
53
|
+
const nt = ({
|
|
54
54
|
initialItems: s,
|
|
55
55
|
enableApplyDiscard: e,
|
|
56
|
-
enableNormalizedState: t = !1
|
|
56
|
+
enableNormalizedState: t = !1,
|
|
57
|
+
initialCollapsedItems: n
|
|
57
58
|
}) => {
|
|
58
|
-
const [
|
|
59
|
+
const [d, i] = u(s), [r, h] = u(!1), o = O(() => ({
|
|
59
60
|
get current() {
|
|
60
|
-
return
|
|
61
|
+
return r;
|
|
61
62
|
},
|
|
62
63
|
set current(c) {
|
|
63
|
-
c !==
|
|
64
|
+
c !== r && queueMicrotask(() => h(c));
|
|
64
65
|
}
|
|
65
|
-
}), [
|
|
66
|
+
}), [r]), C = d !== s, [j, x] = u(s), [v, l] = u(s), [f, w] = u(
|
|
66
67
|
() => t ? p(s) : {
|
|
67
68
|
byId: /* @__PURE__ */ new Map(),
|
|
68
69
|
childrenById: /* @__PURE__ */ new Map(),
|
|
69
70
|
parentById: /* @__PURE__ */ new Map(),
|
|
70
71
|
rootIds: []
|
|
71
72
|
}
|
|
72
|
-
), [k, E] =
|
|
73
|
+
), [k, E] = u(
|
|
73
74
|
() => t ? p(s) : {
|
|
74
75
|
byId: /* @__PURE__ */ new Map(),
|
|
75
76
|
childrenById: /* @__PURE__ */ new Map(),
|
|
76
77
|
parentById: /* @__PURE__ */ new Map(),
|
|
77
78
|
rootIds: []
|
|
78
79
|
}
|
|
79
|
-
), [
|
|
80
|
+
), [G, J] = u(""), [K, P] = u(n ?? {}), [Q, V] = u(!1), [W, X] = u(null), [Y, Z] = u(null), [_, $] = u(
|
|
80
81
|
/* @__PURE__ */ new Set()
|
|
81
|
-
), [
|
|
82
|
-
if (
|
|
82
|
+
), [m, b] = u(/* @__PURE__ */ new Set());
|
|
83
|
+
if (C && !r && (i(s), l(s), e && x(s), t)) {
|
|
83
84
|
const c = p(s);
|
|
84
85
|
w(c), e && E(c);
|
|
85
86
|
}
|
|
86
|
-
|
|
87
|
-
const U =
|
|
88
|
-
t && (w((I) => R(I, c,
|
|
89
|
-
}, [t]), A =
|
|
90
|
-
t && (w((
|
|
91
|
-
const I = new Map(
|
|
87
|
+
r && !C && h(!1);
|
|
88
|
+
const U = g((c) => t ? N(f, c) : null, [t, f]), L = g((c, y) => {
|
|
89
|
+
t && (w((I) => R(I, c, y)), l((I) => a(R(p(I), c, y))));
|
|
90
|
+
}, [t]), A = g((c) => t ? z(f, c) : [], [t, f]), F = g((c) => t ? tt(f, c) : [], [t, f]), q = g((c) => {
|
|
91
|
+
t && (w((y) => {
|
|
92
|
+
const I = new Map(y.byId);
|
|
92
93
|
return c.forEach((T, B) => {
|
|
93
94
|
const M = I.get(B);
|
|
94
95
|
M && I.set(B, { ...M, ...T });
|
|
95
|
-
}), { ...
|
|
96
|
-
}), l((
|
|
97
|
-
const I = p(
|
|
96
|
+
}), { ...y, byId: I };
|
|
97
|
+
}), l((y) => {
|
|
98
|
+
const I = p(y);
|
|
98
99
|
return c.forEach((T, B) => {
|
|
99
100
|
const M = I.byId.get(B);
|
|
100
101
|
M && I.byId.set(B, { ...M, ...T });
|
|
101
102
|
}), a(I);
|
|
102
103
|
}));
|
|
103
|
-
}, [t]), D =
|
|
104
|
-
t && l(a(
|
|
105
|
-
}, [t,
|
|
104
|
+
}, [t]), D = g(() => {
|
|
105
|
+
t && l(a(f));
|
|
106
|
+
}, [t, f]), H = g(() => {
|
|
106
107
|
t && w(p(v));
|
|
107
|
-
}, [t, v]),
|
|
108
|
+
}, [t, v]), S = O(() => ({
|
|
108
109
|
findItemByIdFast: U,
|
|
109
110
|
updateItemFast: L,
|
|
110
111
|
getAncestors: A,
|
|
@@ -113,7 +114,7 @@ const st = ({
|
|
|
113
114
|
syncToTreeState: D,
|
|
114
115
|
syncToNormalizedState: H,
|
|
115
116
|
isNormalized: t,
|
|
116
|
-
normalizedState:
|
|
117
|
+
normalizedState: f,
|
|
117
118
|
setNormalizedState: w,
|
|
118
119
|
savedNormalizedState: k,
|
|
119
120
|
setSavedNormalizedState: E
|
|
@@ -126,40 +127,40 @@ const st = ({
|
|
|
126
127
|
D,
|
|
127
128
|
H,
|
|
128
129
|
t,
|
|
129
|
-
|
|
130
|
+
f,
|
|
130
131
|
k
|
|
131
132
|
]);
|
|
132
133
|
return {
|
|
133
134
|
// Standard state (backward compatible)
|
|
134
135
|
items: v,
|
|
135
136
|
setItems: l,
|
|
136
|
-
savedItems:
|
|
137
|
+
savedItems: j,
|
|
137
138
|
setSavedItems: x,
|
|
138
|
-
isUserChangeRef:
|
|
139
|
-
searchText:
|
|
140
|
-
setSearchText:
|
|
141
|
-
collapsedItems:
|
|
142
|
-
setCollapsedItems:
|
|
143
|
-
isListCollapsed:
|
|
144
|
-
setIsListCollapsed:
|
|
145
|
-
activeId:
|
|
146
|
-
setActiveId:
|
|
147
|
-
overId:
|
|
148
|
-
setOverId:
|
|
149
|
-
selectedCategories:
|
|
150
|
-
setSelectedCategories:
|
|
151
|
-
itemsToBlink:
|
|
152
|
-
setItemsToBlink:
|
|
139
|
+
isUserChangeRef: o,
|
|
140
|
+
searchText: G,
|
|
141
|
+
setSearchText: J,
|
|
142
|
+
collapsedItems: K,
|
|
143
|
+
setCollapsedItems: P,
|
|
144
|
+
isListCollapsed: Q,
|
|
145
|
+
setIsListCollapsed: V,
|
|
146
|
+
activeId: W,
|
|
147
|
+
setActiveId: X,
|
|
148
|
+
overId: Y,
|
|
149
|
+
setOverId: Z,
|
|
150
|
+
selectedCategories: _,
|
|
151
|
+
setSelectedCategories: $,
|
|
152
|
+
itemsToBlink: m,
|
|
153
|
+
setItemsToBlink: b,
|
|
153
154
|
// Normalized state helpers (for optimized operations)
|
|
154
|
-
...
|
|
155
|
+
...S
|
|
155
156
|
};
|
|
156
157
|
};
|
|
157
158
|
export {
|
|
158
159
|
a as denormalizeItems,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
z as getAncestorIds,
|
|
161
|
+
tt as getDescendantIds,
|
|
162
|
+
N as getItemById,
|
|
162
163
|
p as normalizeItems,
|
|
163
164
|
R as updateNormalizedItem,
|
|
164
|
-
|
|
165
|
+
nt as useNestedListState
|
|
165
166
|
};
|