impact-nova 1.7.32 → 1.7.33
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.
|
@@ -1,87 +1,85 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useDataTable as
|
|
4
|
-
import { NestedList as
|
|
5
|
-
import { SelectionMode as
|
|
6
|
-
import { mergePartialOrderedColumnState as
|
|
7
|
-
import { useImpactNovaI18n as
|
|
8
|
-
const de = ({
|
|
9
|
-
enableApplyDiscard:
|
|
10
|
-
showSearch:
|
|
11
|
-
showSelectAll:
|
|
12
|
-
showCollapse:
|
|
1
|
+
import { jsx as w } from "react/jsx-runtime";
|
|
2
|
+
import { useState as A, useRef as _, useCallback as k, useEffect as F } from "react";
|
|
3
|
+
import { useDataTable as J } from "./data-table-context.js";
|
|
4
|
+
import { NestedList as Q } from "../nested-list/nested-list.js";
|
|
5
|
+
import { SelectionMode as X } from "../types/nested-list.types.js";
|
|
6
|
+
import { mergePartialOrderedColumnState as Z } from "./data-table-column-state.js";
|
|
7
|
+
import { useImpactNovaI18n as ee } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
8
|
+
const te = 300, M = 100, de = ({
|
|
9
|
+
enableApplyDiscard: R = !1,
|
|
10
|
+
showSearch: U = !0,
|
|
11
|
+
showSelectAll: q = !0,
|
|
12
|
+
showCollapse: W = !0
|
|
13
13
|
}) => {
|
|
14
|
-
const { gridApi:
|
|
15
|
-
if (!
|
|
16
|
-
const r =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
id: m === 0 ? `${o}__${h}` : `${o}__${h}__${m}`,
|
|
26
|
-
label: I?.headerName || o,
|
|
14
|
+
const { gridApi: e } = J(), { t: T } = ee(), [K, O] = A([]), [V, B] = A(!1), v = _(!1), x = _(null), E = _(0), z = _({}), [L, $] = A(!1), D = k(() => {
|
|
15
|
+
if (!e || v.current) return;
|
|
16
|
+
const r = e.getColumnState(), u = e.getColumns() || [], c = new Map(u.map((t) => [t.getColId(), t])), a = [], i = [], l = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), g = (t, o) => {
|
|
17
|
+
const n = t.getGroupId(), d = `${n}::${o === a ? "f" : "s"}`, p = l.get(d);
|
|
18
|
+
if (p && p.list === o && o[o.length - 1] === p.node)
|
|
19
|
+
return p.node;
|
|
20
|
+
const S = h.get(d) || 0;
|
|
21
|
+
h.set(d, S + 1);
|
|
22
|
+
const G = t.getColGroupDef(), y = o === a ? "f" : "s", N = {
|
|
23
|
+
id: S === 0 ? `${n}__${y}` : `${n}__${y}__${S}`,
|
|
24
|
+
label: G?.headerName || n,
|
|
27
25
|
checked: !0,
|
|
28
26
|
children: [],
|
|
29
27
|
category: "group"
|
|
30
28
|
};
|
|
31
|
-
return
|
|
29
|
+
return o.push(N), l.set(d, { list: o, node: N }), N;
|
|
32
30
|
};
|
|
33
|
-
let
|
|
31
|
+
let f = 0, C = 0, m = 0, s = 0;
|
|
34
32
|
r.forEach((t) => {
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
37
|
-
let
|
|
38
|
-
if (
|
|
39
|
-
if (
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
|
|
33
|
+
const o = c.get(t.colId);
|
|
34
|
+
if (!o) return;
|
|
35
|
+
let n = e.getDisplayNameForColumn(o, "header");
|
|
36
|
+
if (n === "") return;
|
|
37
|
+
if (n == null) {
|
|
38
|
+
const y = o.getColDef();
|
|
39
|
+
if (y.headerName === "") return;
|
|
40
|
+
n = y.headerName || y.field || t.colId;
|
|
43
41
|
}
|
|
44
|
-
if (!
|
|
42
|
+
if (!n || n.trim() === "")
|
|
45
43
|
return;
|
|
46
|
-
const
|
|
44
|
+
const d = !t.hide, p = {
|
|
47
45
|
id: t.colId,
|
|
48
|
-
label:
|
|
49
|
-
checked:
|
|
46
|
+
label: n,
|
|
47
|
+
checked: d
|
|
50
48
|
};
|
|
51
|
-
t.pinned ? (
|
|
52
|
-
const
|
|
53
|
-
|
|
49
|
+
t.pinned ? (f++, d && C++) : (m++, d && s++);
|
|
50
|
+
const S = t.pinned ? a : i, G = o.getOriginalParent();
|
|
51
|
+
G?.getColGroupDef()?.children ? g(G, S).children.push(p) : S.push(p);
|
|
54
52
|
});
|
|
55
|
-
const
|
|
56
|
-
let
|
|
57
|
-
for (const
|
|
58
|
-
|
|
59
|
-
return
|
|
53
|
+
const I = (t) => {
|
|
54
|
+
let o = t.length > 0;
|
|
55
|
+
for (const n of t)
|
|
56
|
+
n.children && (n.checked = I(n.children)), n.checked || (o = !1);
|
|
57
|
+
return o;
|
|
60
58
|
};
|
|
61
|
-
|
|
62
|
-
const
|
|
59
|
+
I(a), I(i);
|
|
60
|
+
const b = [
|
|
63
61
|
{
|
|
64
62
|
id: "root-frozen",
|
|
65
|
-
label:
|
|
66
|
-
checked:
|
|
67
|
-
children:
|
|
63
|
+
label: T("dataTable.frozenColumns"),
|
|
64
|
+
checked: f > 0 && C === f,
|
|
65
|
+
children: a,
|
|
68
66
|
category: "structure",
|
|
69
67
|
isDragDisabled: !0
|
|
70
68
|
},
|
|
71
69
|
{
|
|
72
70
|
id: "root-scrollable",
|
|
73
|
-
label:
|
|
74
|
-
checked:
|
|
75
|
-
children:
|
|
71
|
+
label: T("dataTable.scrollableColumns"),
|
|
72
|
+
checked: m > 0 && s === m,
|
|
73
|
+
children: i,
|
|
76
74
|
category: "structure",
|
|
77
75
|
isDragDisabled: !0
|
|
78
76
|
}
|
|
79
77
|
];
|
|
80
|
-
|
|
81
|
-
}, [
|
|
78
|
+
O(b), B(!0);
|
|
79
|
+
}, [e, T]);
|
|
82
80
|
F(() => {
|
|
83
|
-
if (!
|
|
84
|
-
const r = setTimeout(() =>
|
|
81
|
+
if (!e) return;
|
|
82
|
+
const r = setTimeout(() => D(), 0), u = [
|
|
85
83
|
"columnVisible",
|
|
86
84
|
"columnPinned",
|
|
87
85
|
"columnMoved",
|
|
@@ -96,89 +94,111 @@ const de = ({
|
|
|
96
94
|
"displayedColumnsChanged"
|
|
97
95
|
];
|
|
98
96
|
let c = null;
|
|
99
|
-
const
|
|
97
|
+
const a = () => {
|
|
100
98
|
c && clearTimeout(c), c = setTimeout(() => {
|
|
101
|
-
c = null;
|
|
102
|
-
const n = !f.current;
|
|
103
|
-
f.current = !1, g(), n && P((e) => !e);
|
|
99
|
+
c = null, !v.current && (D(), $((i) => !i));
|
|
104
100
|
}, 150);
|
|
105
101
|
};
|
|
106
|
-
return
|
|
107
|
-
clearTimeout(r), c && clearTimeout(c),
|
|
102
|
+
return e.isDestroyed() || u.forEach((i) => e.addEventListener(i, a)), () => {
|
|
103
|
+
clearTimeout(r), c && clearTimeout(c), e.isDestroyed() || u.forEach((i) => e.removeEventListener(i, a));
|
|
108
104
|
};
|
|
109
|
-
}, [
|
|
110
|
-
if (
|
|
105
|
+
}, [e, D]), F(() => {
|
|
106
|
+
if (E.current === 0) return;
|
|
111
107
|
const r = requestAnimationFrame(() => {
|
|
112
|
-
const
|
|
113
|
-
|
|
108
|
+
const u = x.current?.querySelector('[data-component="nested-list"] .overflow-y-auto');
|
|
109
|
+
u && (u.scrollTop = E.current, E.current = 0);
|
|
114
110
|
});
|
|
115
111
|
return () => cancelAnimationFrame(r);
|
|
116
|
-
}, [
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
if (
|
|
121
|
-
|
|
112
|
+
}, [L]);
|
|
113
|
+
const j = k((r) => {
|
|
114
|
+
const u = [], c = (a, i) => {
|
|
115
|
+
a.forEach((l) => {
|
|
116
|
+
if (l.id === "root-frozen") {
|
|
117
|
+
l.children && c(l.children, "left");
|
|
122
118
|
return;
|
|
123
119
|
}
|
|
124
|
-
if (
|
|
125
|
-
|
|
120
|
+
if (l.id === "root-scrollable") {
|
|
121
|
+
l.children && c(l.children, null);
|
|
126
122
|
return;
|
|
127
123
|
}
|
|
128
|
-
|
|
129
|
-
colId:
|
|
130
|
-
pinned:
|
|
131
|
-
hide: !
|
|
124
|
+
l.category === "group" || l.children && l.children.length > 0 ? l.children && c(l.children, i) : e?.getColumn(l.id) && u.push({
|
|
125
|
+
colId: l.id,
|
|
126
|
+
pinned: i,
|
|
127
|
+
hide: !l.checked
|
|
132
128
|
});
|
|
133
129
|
});
|
|
134
130
|
};
|
|
135
|
-
return c(r, null),
|
|
136
|
-
}, [
|
|
137
|
-
if (!
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
if (
|
|
131
|
+
return c(r, null), u;
|
|
132
|
+
}, [e]), P = k((r) => {
|
|
133
|
+
if (!e) return;
|
|
134
|
+
v.current = !0;
|
|
135
|
+
const u = j(r);
|
|
136
|
+
if (u.length === 0) {
|
|
141
137
|
setTimeout(() => {
|
|
142
|
-
|
|
143
|
-
},
|
|
138
|
+
v.current = !1;
|
|
139
|
+
}, M);
|
|
144
140
|
return;
|
|
145
141
|
}
|
|
146
|
-
const c =
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
142
|
+
const c = e.getColumnState(), a = Z(c, u), i = new Set(c.filter((s) => s.pinned).map((s) => s.colId)), l = a.filter((s) => s.pinned && !i.has(s.colId)), h = new Set(l.map((s) => s.colId));
|
|
143
|
+
e.applyColumnState({ state: a, applyOrder: !0 });
|
|
144
|
+
const g = () => {
|
|
145
|
+
v.current = !1;
|
|
146
|
+
const s = x.current?.querySelector('[data-component="nested-list"] .overflow-y-auto');
|
|
147
|
+
s && (E.current = s.scrollTop), D(), $((I) => !I);
|
|
148
|
+
};
|
|
149
|
+
if (h.size === 0) {
|
|
150
|
+
setTimeout(g, M);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
let f = !1, C = null;
|
|
154
|
+
const m = () => {
|
|
155
|
+
if (f || e.isDestroyed()) return;
|
|
156
|
+
const s = e.getColumnState();
|
|
157
|
+
if (l.filter((b) => {
|
|
158
|
+
const t = s.find((o) => o.colId === b.colId);
|
|
159
|
+
return t && !t.pinned;
|
|
160
|
+
}).length > 0) {
|
|
161
|
+
f = !0, C && clearTimeout(C), e.removeEventListener("columnPinned", m);
|
|
162
|
+
const b = a.filter((t) => t.pinned && !h.has(t.colId));
|
|
163
|
+
if (b.length > 0) {
|
|
164
|
+
const t = b[0], o = a.map(
|
|
165
|
+
(n) => n.colId === t.colId ? { ...n, pinned: null } : n
|
|
166
|
+
);
|
|
167
|
+
e.applyColumnState({ state: o, applyOrder: !0 });
|
|
168
|
+
}
|
|
169
|
+
setTimeout(g, M);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
e.addEventListener("columnPinned", m), C = setTimeout(() => {
|
|
173
|
+
e.removeEventListener("columnPinned", m), f || g();
|
|
174
|
+
}, te);
|
|
175
|
+
}, [e, j, D]), Y = k((r) => {
|
|
176
|
+
P(r);
|
|
177
|
+
}, [P]), H = k((r) => {
|
|
178
|
+
R || P(r), O(r);
|
|
179
|
+
}, [R, P]);
|
|
180
|
+
return V ? /* @__PURE__ */ w("div", { ref: x, className: "flex flex-col h-full bg-canvas-elevated", children: /* @__PURE__ */ w(
|
|
181
|
+
Q,
|
|
162
182
|
{
|
|
163
|
-
items:
|
|
183
|
+
items: K,
|
|
164
184
|
onChange: H,
|
|
165
|
-
onSubmit:
|
|
166
|
-
enableApplyDiscard:
|
|
167
|
-
enableSearch:
|
|
168
|
-
enableSelectAll:
|
|
185
|
+
onSubmit: Y,
|
|
186
|
+
enableApplyDiscard: R,
|
|
187
|
+
enableSearch: U,
|
|
188
|
+
enableSelectAll: q,
|
|
169
189
|
enableDragDrop: !0,
|
|
170
190
|
enableCollapse: !0,
|
|
171
|
-
enableGlobalCollapse:
|
|
172
|
-
selectionMode:
|
|
173
|
-
searchPlaceholder:
|
|
191
|
+
enableGlobalCollapse: W,
|
|
192
|
+
selectionMode: X.CASCADE_DOWN,
|
|
193
|
+
searchPlaceholder: T("dataTable.searchColumnsPlaceholder"),
|
|
174
194
|
className: "h-full",
|
|
175
195
|
initialCollapsedItems: z.current,
|
|
176
196
|
onCollapseChange: (r) => {
|
|
177
197
|
z.current = r;
|
|
178
198
|
}
|
|
179
199
|
},
|
|
180
|
-
|
|
181
|
-
) }) : /* @__PURE__ */
|
|
200
|
+
L ? "sync-a" : "sync-b"
|
|
201
|
+
) }) : /* @__PURE__ */ w("div", { className: "p-4 text-[13px] text-content-placeholder", children: T("dataTable.loadingColumns") });
|
|
182
202
|
};
|
|
183
203
|
export {
|
|
184
204
|
de as DataTableColumnList
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback as S } from "react";
|
|
2
2
|
import { useSensors as Z, useSensor as V, MouseSensor as $, TouchSensor as E, closestCenter as p } from "@dnd-kit/core";
|
|
3
|
-
import { arrayMove as
|
|
3
|
+
import { arrayMove as A } from "@dnd-kit/sortable";
|
|
4
4
|
const W = "droppable-", y = /* @__PURE__ */ new Set(["root-frozen", "root-scrollable"]);
|
|
5
5
|
function X(h) {
|
|
6
6
|
if (h.startsWith(W)) {
|
|
@@ -65,7 +65,7 @@ const rn = ({
|
|
|
65
65
|
return null;
|
|
66
66
|
},
|
|
67
67
|
[]
|
|
68
|
-
),
|
|
68
|
+
), G = S(
|
|
69
69
|
(t, e, o) => t.map((r) => {
|
|
70
70
|
if (r.children && r.children.length > 0) {
|
|
71
71
|
const n = r.children.findIndex(
|
|
@@ -74,7 +74,7 @@ const rn = ({
|
|
|
74
74
|
(i) => i.id === o
|
|
75
75
|
);
|
|
76
76
|
if (n !== -1 && l !== -1) {
|
|
77
|
-
const i =
|
|
77
|
+
const i = A(r.children, n, l);
|
|
78
78
|
return {
|
|
79
79
|
...r,
|
|
80
80
|
children: i
|
|
@@ -82,7 +82,7 @@ const rn = ({
|
|
|
82
82
|
}
|
|
83
83
|
return {
|
|
84
84
|
...r,
|
|
85
|
-
children:
|
|
85
|
+
children: G(r.children, e, o)
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
return r;
|
|
@@ -98,7 +98,7 @@ const rn = ({
|
|
|
98
98
|
(i) => i.id === e
|
|
99
99
|
);
|
|
100
100
|
if (n !== -1 && l !== -1) {
|
|
101
|
-
const i =
|
|
101
|
+
const i = A(
|
|
102
102
|
t,
|
|
103
103
|
l,
|
|
104
104
|
n
|
|
@@ -112,7 +112,7 @@ const rn = ({
|
|
|
112
112
|
(t, e, o) => {
|
|
113
113
|
const r = t.findIndex((l) => l.id === e), n = t.findIndex((l) => l.id === o);
|
|
114
114
|
if (r !== -1 && n !== -1) {
|
|
115
|
-
const l =
|
|
115
|
+
const l = A(t, r, n);
|
|
116
116
|
return u?.(e, o), l;
|
|
117
117
|
}
|
|
118
118
|
return null;
|
|
@@ -120,20 +120,20 @@ const rn = ({
|
|
|
120
120
|
[u]
|
|
121
121
|
), z = S(
|
|
122
122
|
(t, e, o) => {
|
|
123
|
-
const r =
|
|
123
|
+
const r = G(t, e, o);
|
|
124
124
|
return u?.(e, o), r;
|
|
125
125
|
},
|
|
126
|
-
[
|
|
127
|
-
),
|
|
126
|
+
[G, u]
|
|
127
|
+
), N = S(
|
|
128
128
|
(t, e, o, r = !1) => {
|
|
129
129
|
const n = F(t, e);
|
|
130
130
|
if (!n) return null;
|
|
131
131
|
const l = (s) => s.filter((c) => c.id !== e).map(
|
|
132
132
|
(c) => c.children ? { ...c, children: l(c.children) } : c
|
|
133
|
-
).filter((c) => !(c.children && c.children.length === 0 && c.category === "group")), i = F(t, o), f = !n.children || n.children.length === 0, R = i?.children && i.children.length > 0, M = d[o] === !0,
|
|
133
|
+
).filter((c) => !(c.children && c.children.length === 0 && c.category === "group")), i = F(t, o), f = !n.children || n.children.length === 0, R = i?.children && i.children.length > 0, M = d[o] === !0, w = f && R && !M && r, g = (s) => {
|
|
134
134
|
for (let c = 0; c < s.length; c++) {
|
|
135
135
|
if (s[c].id === o)
|
|
136
|
-
if (
|
|
136
|
+
if (w) {
|
|
137
137
|
const L = {
|
|
138
138
|
...s[c],
|
|
139
139
|
children: [n, ...s[c].children || []]
|
|
@@ -156,7 +156,7 @@ const rn = ({
|
|
|
156
156
|
return Y ? (u?.(e, o), O) : null;
|
|
157
157
|
},
|
|
158
158
|
[u, d]
|
|
159
|
-
),
|
|
159
|
+
), _ = S(
|
|
160
160
|
(t, e, o) => {
|
|
161
161
|
const r = F(t, e);
|
|
162
162
|
if (!r) return t;
|
|
@@ -181,10 +181,10 @@ const rn = ({
|
|
|
181
181
|
}
|
|
182
182
|
const f = X(i);
|
|
183
183
|
if (f)
|
|
184
|
-
return
|
|
185
|
-
const R = C(n, l), M = C(n, i),
|
|
184
|
+
return _(n, l, f);
|
|
185
|
+
const R = C(n, l), M = C(n, i), w = T(n, l), g = T(n, i);
|
|
186
186
|
if (y.has(i) && R !== null && R > 0)
|
|
187
|
-
return
|
|
187
|
+
return _(n, l, i);
|
|
188
188
|
if (R === 0 && M !== null && M > 0)
|
|
189
189
|
return B(
|
|
190
190
|
n,
|
|
@@ -193,7 +193,7 @@ const rn = ({
|
|
|
193
193
|
) || n;
|
|
194
194
|
if (R === null || M === null)
|
|
195
195
|
return n;
|
|
196
|
-
if (R > 0 && M > 0 &&
|
|
196
|
+
if (R > 0 && M > 0 && w !== g) {
|
|
197
197
|
const P = j(n, l), O = j(n, i);
|
|
198
198
|
if (P && O && P !== O) {
|
|
199
199
|
const a = o.rect.current.translated, b = r.rect;
|
|
@@ -202,7 +202,7 @@ const rn = ({
|
|
|
202
202
|
const Q = a.top + a.height / 2, U = b.top + b.height / 2;
|
|
203
203
|
H = Q > U;
|
|
204
204
|
}
|
|
205
|
-
return
|
|
205
|
+
return N(n, l, i, H) || n;
|
|
206
206
|
}
|
|
207
207
|
const Y = o.rect.current.translated, s = r.rect;
|
|
208
208
|
let c = !1;
|
|
@@ -210,7 +210,7 @@ const rn = ({
|
|
|
210
210
|
const a = Y.top + Y.height / 2, b = s.top + s.height / 2;
|
|
211
211
|
c = a > b;
|
|
212
212
|
}
|
|
213
|
-
return
|
|
213
|
+
return N(n, l, i, c) || n;
|
|
214
214
|
}
|
|
215
215
|
return R === 0 ? k(n, l, i) || n : z(n, l, i);
|
|
216
216
|
});
|
|
@@ -221,8 +221,8 @@ const rn = ({
|
|
|
221
221
|
B,
|
|
222
222
|
k,
|
|
223
223
|
z,
|
|
224
|
-
G,
|
|
225
224
|
N,
|
|
225
|
+
_,
|
|
226
226
|
x
|
|
227
227
|
]
|
|
228
228
|
), K = S(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "impact-nova",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.33",
|
|
4
4
|
"description": "Enterprise-grade React design system built with React 19, Vite, Tailwind CSS, and Radix UI. Built-in internationalization (i18n) and comprehensive UI component library for scalable, accessible, and performant applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|