impact-nova 1.7.38 → 1.7.40
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/ag-grid-react/cell-renderers/editors/date-cell-editor.js +58 -48
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.d.ts +0 -2
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +212 -218
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.d.ts +2 -2
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +97 -127
- package/dist/components/ui/ag-grid-react/headers/components/date-filter-picker.d.ts +39 -0
- package/dist/components/ui/ag-grid-react/headers/header-search-input.js +433 -299
- package/dist/components/ui/ag-grid-react/headers/utils/date-utils.d.ts +33 -1
- package/dist/components/ui/ag-grid-react/headers/utils/date-utils.js +60 -26
- package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.d.ts +11 -10
- package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.js +284 -260
- package/dist/components/ui/ag-grid-react/index.js +24 -25
- package/dist/components/ui/create-item-flow/create-item-flow.js +1 -1
- package/dist/components/ui/data-table/column-indicator.d.ts +17 -0
- package/dist/components/ui/data-table/column-indicator.js +30 -0
- package/dist/components/ui/data-table/data-table-column-list.js +210 -154
- package/dist/components/ui/data-table/data-table.js +60 -59
- package/dist/components/ui/data-table/index.d.ts +3 -0
- package/dist/components/ui/data-table/index.js +34 -28
- package/dist/components/ui/data-table/indicator-legend.d.ts +8 -0
- package/dist/components/ui/data-table/indicator-legend.js +20 -0
- package/dist/components/ui/data-table/pin-switch.d.ts +30 -0
- package/dist/components/ui/data-table/pin-switch.js +75 -0
- package/dist/components/ui/date-picker/date-picker.js +65 -63
- package/dist/components/ui/date-picker/date-range-picker.js +77 -75
- package/dist/components/ui/nested-list/components/NestedListContent.js +7 -7
- package/dist/components/ui/nested-list/components/SortableItem.d.ts +10 -0
- package/dist/components/ui/nested-list/components/SortableItem.js +91 -83
- package/dist/components/ui/nested-list/nested-list.js +184 -178
- package/dist/components/ui/types/ag-grid.types.d.ts +16 -2
- package/dist/components/ui/types/date-picker.types.d.ts +4 -0
- package/dist/components/ui/types/nested-list.types.d.ts +12 -0
- package/dist/i18n/defaultMessages.d.ts +10 -0
- package/dist/i18n/defaultMessages.js +16 -8
- package/dist/i18n/locales/de.js +8 -0
- package/dist/i18n/locales/es.js +8 -0
- package/dist/i18n/locales/hi.js +8 -0
- package/dist/i18n/locales/kn.js +8 -0
- package/dist/impact-nova.css +1 -1
- package/dist/index.js +180 -174
- package/package.json +1 -1
- package/tailwind.config.js +16 -0
|
@@ -1,106 +1,114 @@
|
|
|
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 {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsxs as ce, jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import { useState as W, useRef as R, useCallback as g, useEffect as J } from "react";
|
|
3
|
+
import { useDataTable as se } from "./data-table-context.js";
|
|
4
|
+
import { NestedList as ae } from "../nested-list/nested-list.js";
|
|
5
|
+
import { SelectionMode as de } from "../types/nested-list.types.js";
|
|
6
|
+
import { mergePartialOrderedColumnState as ue } from "./data-table-column-state.js";
|
|
7
|
+
import { PinSwitch as fe } from "./pin-switch.js";
|
|
8
|
+
import { ColumnIndicator as Q } from "./column-indicator.js";
|
|
9
|
+
import { IndicatorLegend as pe } from "./indicator-legend.js";
|
|
10
|
+
import { useImpactNovaI18n as he } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
11
|
+
function me(E) {
|
|
12
|
+
const P = [];
|
|
13
|
+
let C = E.getOriginalParent();
|
|
14
|
+
for (; C; ) {
|
|
15
|
+
const w = C.getColGroupDef();
|
|
16
|
+
w?.headerName && w?.children && P.push(C), C = C.getOriginalParent();
|
|
14
17
|
}
|
|
15
|
-
return
|
|
18
|
+
return P.reverse(), P;
|
|
16
19
|
}
|
|
17
|
-
const
|
|
18
|
-
enableApplyDiscard:
|
|
19
|
-
showSearch:
|
|
20
|
-
showSelectAll:
|
|
21
|
-
showCollapse:
|
|
20
|
+
const ge = 300, K = 100, Ee = ({
|
|
21
|
+
enableApplyDiscard: E = !1,
|
|
22
|
+
showSearch: P = !0,
|
|
23
|
+
showSelectAll: C = !0,
|
|
24
|
+
showCollapse: w = !0
|
|
22
25
|
}) => {
|
|
23
|
-
const { gridApi:
|
|
24
|
-
if (!
|
|
25
|
-
const r =
|
|
26
|
-
f.set(
|
|
27
|
-
let
|
|
28
|
-
const
|
|
29
|
-
let
|
|
30
|
-
return
|
|
31
|
-
},
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
34
|
-
return
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
id:
|
|
39
|
-
label:
|
|
26
|
+
const { gridApi: n } = se(), { t: L } = he(), [X, F] = W([]), [Z, ee] = W(!1), N = R(!1), $ = R(null), M = R(0), V = R({}), [B, te] = W(!1), x = g(() => {
|
|
27
|
+
if (!n || N.current) return;
|
|
28
|
+
const r = n.getColumnState(), i = n.getColumns() || [], t = new Map(i.map((o) => [o.getColId(), o])), s = [], l = [], e = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
29
|
+
f.set(s, "f"), f.set(l, "s");
|
|
30
|
+
let p = 0;
|
|
31
|
+
const T = (o) => {
|
|
32
|
+
let c = f.get(o);
|
|
33
|
+
return c === void 0 && (c = `n${p++}`, f.set(o, c)), c;
|
|
34
|
+
}, h = (o, c) => {
|
|
35
|
+
const a = o.getGroupId(), S = T(c), D = `${a}::${S}`, k = e.get(D);
|
|
36
|
+
if (k && k.list === c && c[c.length - 1] === k.node)
|
|
37
|
+
return k.node;
|
|
38
|
+
const _ = v.get(D) || 0;
|
|
39
|
+
v.set(D, _ + 1);
|
|
40
|
+
const O = o.getColGroupDef(), A = {
|
|
41
|
+
id: _ === 0 ? `${a}__${S}` : `${a}__${S}__${_}`,
|
|
42
|
+
label: O?.headerName || a,
|
|
40
43
|
checked: !0,
|
|
41
44
|
children: [],
|
|
42
45
|
category: "group"
|
|
43
46
|
};
|
|
44
|
-
return
|
|
47
|
+
return c.push(A), e.set(D, { list: c, node: A }), A;
|
|
45
48
|
};
|
|
46
|
-
let
|
|
47
|
-
r.forEach((
|
|
48
|
-
const
|
|
49
|
-
if (!
|
|
50
|
-
let
|
|
51
|
-
if (
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
|
|
49
|
+
let d = 0, j = 0, m = 0, u = 0;
|
|
50
|
+
r.forEach((o) => {
|
|
51
|
+
const c = t.get(o.colId);
|
|
52
|
+
if (!c) return;
|
|
53
|
+
let a = n.getDisplayNameForColumn(c, "header");
|
|
54
|
+
if (a === "") return;
|
|
55
|
+
if (a == null) {
|
|
56
|
+
const b = c.getColDef();
|
|
57
|
+
if (b.headerName === "") return;
|
|
58
|
+
a = b.headerName || b.field || o.colId;
|
|
56
59
|
}
|
|
57
|
-
if (!
|
|
60
|
+
if (!a || a.trim() === "")
|
|
58
61
|
return;
|
|
59
|
-
const
|
|
60
|
-
id:
|
|
61
|
-
label:
|
|
62
|
-
checked:
|
|
62
|
+
const S = !o.hide, D = !!o.sort, k = c.isFilterActive(), _ = o.pinned === "left" ? "left" : o.pinned === "right" ? "right" : null, O = {
|
|
63
|
+
id: o.colId,
|
|
64
|
+
label: a,
|
|
65
|
+
checked: S,
|
|
66
|
+
data: {
|
|
67
|
+
hasSortApplied: D,
|
|
68
|
+
hasFilterApplied: k,
|
|
69
|
+
pinned: _
|
|
70
|
+
}
|
|
63
71
|
};
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
let
|
|
68
|
-
for (const
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
o.pinned ? (d++, S && j++) : (m++, S && u++);
|
|
73
|
+
const U = o.pinned ? s : l, A = me(c);
|
|
74
|
+
if (A.length > 0) {
|
|
75
|
+
let b = U, q = null;
|
|
76
|
+
for (const ie of A)
|
|
77
|
+
q = h(ie, b), b = q.children;
|
|
78
|
+
q.children.push(O);
|
|
71
79
|
} else
|
|
72
|
-
|
|
80
|
+
U.push(O);
|
|
73
81
|
});
|
|
74
|
-
const
|
|
75
|
-
let
|
|
76
|
-
for (const
|
|
77
|
-
|
|
78
|
-
return
|
|
82
|
+
const I = (o) => {
|
|
83
|
+
let c = o.length > 0;
|
|
84
|
+
for (const a of o)
|
|
85
|
+
a.children && (a.checked = I(a.children)), a.checked || (c = !1);
|
|
86
|
+
return c;
|
|
79
87
|
};
|
|
80
|
-
|
|
81
|
-
const
|
|
88
|
+
I(s), I(l);
|
|
89
|
+
const G = [
|
|
82
90
|
{
|
|
83
91
|
id: "root-frozen",
|
|
84
|
-
label:
|
|
85
|
-
checked:
|
|
86
|
-
children:
|
|
92
|
+
label: L("dataTable.frozenColumns"),
|
|
93
|
+
checked: d > 0 && j === d,
|
|
94
|
+
children: s,
|
|
87
95
|
category: "structure",
|
|
88
96
|
isDragDisabled: !0
|
|
89
97
|
},
|
|
90
98
|
{
|
|
91
99
|
id: "root-scrollable",
|
|
92
|
-
label:
|
|
93
|
-
checked: m > 0 &&
|
|
94
|
-
children:
|
|
100
|
+
label: L("dataTable.scrollableColumns"),
|
|
101
|
+
checked: m > 0 && u === m,
|
|
102
|
+
children: l,
|
|
95
103
|
category: "structure",
|
|
96
104
|
isDragDisabled: !0
|
|
97
105
|
}
|
|
98
106
|
];
|
|
99
|
-
F(
|
|
100
|
-
}, [
|
|
101
|
-
|
|
102
|
-
if (!
|
|
103
|
-
const r = setTimeout(() =>
|
|
107
|
+
F(G), ee(!0);
|
|
108
|
+
}, [n, L]);
|
|
109
|
+
J(() => {
|
|
110
|
+
if (!n) return;
|
|
111
|
+
const r = setTimeout(() => x(), 0), i = [
|
|
104
112
|
"columnVisible",
|
|
105
113
|
"columnPinned",
|
|
106
114
|
"columnMoved",
|
|
@@ -112,115 +120,163 @@ const ce = 300, q = 100, he = ({
|
|
|
112
120
|
"columnEverythingChanged",
|
|
113
121
|
"dragStopped",
|
|
114
122
|
"columnValueChanged",
|
|
115
|
-
"displayedColumnsChanged"
|
|
123
|
+
"displayedColumnsChanged",
|
|
124
|
+
"sortChanged",
|
|
125
|
+
"filterChanged"
|
|
116
126
|
];
|
|
117
|
-
let
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
if (
|
|
121
|
-
const
|
|
122
|
-
|
|
127
|
+
let t = null;
|
|
128
|
+
const s = () => {
|
|
129
|
+
t && clearTimeout(t), t = setTimeout(() => {
|
|
130
|
+
if (t = null, N.current) return;
|
|
131
|
+
const l = $.current?.querySelector('[data-component="nested-list"] .overflow-y-auto');
|
|
132
|
+
l && (M.current = l.scrollTop), x(), te((e) => !e);
|
|
123
133
|
}, 150);
|
|
124
134
|
};
|
|
125
|
-
return
|
|
126
|
-
clearTimeout(r),
|
|
135
|
+
return n.isDestroyed() || i.forEach((l) => n.addEventListener(l, s)), () => {
|
|
136
|
+
clearTimeout(r), t && clearTimeout(t), n.isDestroyed() || i.forEach((l) => n.removeEventListener(l, s));
|
|
127
137
|
};
|
|
128
|
-
}, [
|
|
129
|
-
if (
|
|
138
|
+
}, [n, x]), J(() => {
|
|
139
|
+
if (M.current === 0) return;
|
|
130
140
|
const r = requestAnimationFrame(() => {
|
|
131
|
-
const
|
|
132
|
-
|
|
141
|
+
const i = $.current?.querySelector('[data-component="nested-list"] .overflow-y-auto');
|
|
142
|
+
i && (i.scrollTop = M.current, M.current = 0);
|
|
133
143
|
});
|
|
134
144
|
return () => cancelAnimationFrame(r);
|
|
135
|
-
}, [
|
|
136
|
-
const
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
if (
|
|
140
|
-
|
|
145
|
+
}, [B]);
|
|
146
|
+
const Y = g((r) => {
|
|
147
|
+
const i = [], t = (s, l) => {
|
|
148
|
+
s.forEach((e) => {
|
|
149
|
+
if (e.id === "root-frozen") {
|
|
150
|
+
e.children && t(e.children, "left");
|
|
141
151
|
return;
|
|
142
152
|
}
|
|
143
|
-
if (
|
|
144
|
-
|
|
153
|
+
if (e.id === "root-scrollable") {
|
|
154
|
+
e.children && t(e.children, null);
|
|
145
155
|
return;
|
|
146
156
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
157
|
+
if (e.category === "group" || e.children && e.children.length > 0)
|
|
158
|
+
e.children && t(e.children, l);
|
|
159
|
+
else if (n?.getColumn(e.id)) {
|
|
160
|
+
let p;
|
|
161
|
+
if (l === null)
|
|
162
|
+
p = null;
|
|
163
|
+
else {
|
|
164
|
+
const h = e.data?.pinned;
|
|
165
|
+
p = h === "left" || h === "right" ? h : l;
|
|
166
|
+
}
|
|
167
|
+
i.push({
|
|
168
|
+
colId: e.id,
|
|
169
|
+
pinned: p,
|
|
170
|
+
hide: !e.checked
|
|
171
|
+
});
|
|
172
|
+
}
|
|
152
173
|
});
|
|
153
174
|
};
|
|
154
|
-
return
|
|
155
|
-
}, [
|
|
156
|
-
if (!
|
|
157
|
-
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
175
|
+
return t(r, null), i;
|
|
176
|
+
}, [n]), z = g((r) => {
|
|
177
|
+
if (!n) return;
|
|
178
|
+
N.current = !0;
|
|
179
|
+
const i = Y(r);
|
|
180
|
+
if (i.length === 0) {
|
|
160
181
|
setTimeout(() => {
|
|
161
|
-
|
|
162
|
-
},
|
|
182
|
+
N.current = !1;
|
|
183
|
+
}, K);
|
|
163
184
|
return;
|
|
164
185
|
}
|
|
165
|
-
const
|
|
166
|
-
|
|
186
|
+
const t = n.getColumnState(), s = ue(t, i), l = new Set(t.filter((d) => d.pinned).map((d) => d.colId)), e = s.filter((d) => d.pinned && !l.has(d.colId)), v = new Set(e.map((d) => d.colId));
|
|
187
|
+
n.applyColumnState({ state: s, applyOrder: !0 });
|
|
167
188
|
const f = () => {
|
|
168
|
-
|
|
189
|
+
N.current = !1, x();
|
|
169
190
|
};
|
|
170
|
-
if (
|
|
171
|
-
setTimeout(f,
|
|
191
|
+
if (v.size === 0) {
|
|
192
|
+
setTimeout(f, K);
|
|
172
193
|
return;
|
|
173
194
|
}
|
|
174
|
-
let
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
177
|
-
const
|
|
178
|
-
if (
|
|
179
|
-
const
|
|
180
|
-
return
|
|
195
|
+
let p = !1, T = null;
|
|
196
|
+
const h = () => {
|
|
197
|
+
if (p || n.isDestroyed()) return;
|
|
198
|
+
const d = n.getColumnState();
|
|
199
|
+
if (e.filter((m) => {
|
|
200
|
+
const u = d.find((I) => I.colId === m.colId);
|
|
201
|
+
return u && !u.pinned;
|
|
181
202
|
}).length > 0) {
|
|
182
|
-
|
|
183
|
-
const m =
|
|
203
|
+
p = !0, T && clearTimeout(T), n.removeEventListener("columnPinned", h);
|
|
204
|
+
const m = s.filter((u) => u.pinned && !v.has(u.colId));
|
|
184
205
|
if (m.length > 0) {
|
|
185
|
-
const
|
|
186
|
-
(
|
|
206
|
+
const u = m[0], I = s.map(
|
|
207
|
+
(G) => G.colId === u.colId ? { ...G, pinned: null } : G
|
|
187
208
|
);
|
|
188
|
-
|
|
209
|
+
n.applyColumnState({ state: I, applyOrder: !0 });
|
|
189
210
|
}
|
|
190
|
-
setTimeout(f,
|
|
211
|
+
setTimeout(f, K);
|
|
191
212
|
}
|
|
192
213
|
};
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
},
|
|
196
|
-
}, [
|
|
197
|
-
|
|
198
|
-
}, [
|
|
199
|
-
|
|
200
|
-
}, [
|
|
201
|
-
|
|
202
|
-
|
|
214
|
+
n.addEventListener("columnPinned", h), T = setTimeout(() => {
|
|
215
|
+
n.removeEventListener("columnPinned", h), p || f();
|
|
216
|
+
}, ge);
|
|
217
|
+
}, [n, Y, x]), ne = g((r) => {
|
|
218
|
+
z(r);
|
|
219
|
+
}, [z]), re = g((r) => {
|
|
220
|
+
E || z(r), F(r);
|
|
221
|
+
}, [E, z]), H = g((r, i) => {
|
|
222
|
+
F((t) => {
|
|
223
|
+
const s = (l) => l.map((e) => e.id === r ? {
|
|
224
|
+
...e,
|
|
225
|
+
data: {
|
|
226
|
+
...e.data,
|
|
227
|
+
pinned: i
|
|
228
|
+
}
|
|
229
|
+
} : e.children ? {
|
|
230
|
+
...e,
|
|
231
|
+
children: s(e.children)
|
|
232
|
+
} : e);
|
|
233
|
+
return s(t);
|
|
234
|
+
}), n && n.applyColumnState({
|
|
235
|
+
state: [{ colId: r, pinned: i }]
|
|
236
|
+
});
|
|
237
|
+
}, [n]), le = g((r, i) => {
|
|
238
|
+
if (!i.isLeaf) return null;
|
|
239
|
+
const t = r.data;
|
|
240
|
+
return !t?.hasSortApplied && !t?.hasFilterApplied ? null : /* @__PURE__ */ ce("span", { className: "inline-flex items-center gap-1 ml-1.5 shrink-0", children: [
|
|
241
|
+
t?.hasSortApplied && /* @__PURE__ */ y(Q, { type: "sort" }),
|
|
242
|
+
t?.hasFilterApplied && /* @__PURE__ */ y(Q, { type: "filter" })
|
|
243
|
+
] });
|
|
244
|
+
}, []), oe = g((r, i) => {
|
|
245
|
+
const t = r.data;
|
|
246
|
+
return r.category === "structure" ? r.id !== "root-frozen" ? null : /* @__PURE__ */ y(pe, {}) : !i.isLeaf || !(t?.pinned === "left" || t?.pinned === "right") ? null : /* @__PURE__ */ y(
|
|
247
|
+
fe,
|
|
248
|
+
{
|
|
249
|
+
value: t?.pinned ?? null,
|
|
250
|
+
onChange: (l) => H(r.id, l),
|
|
251
|
+
className: "shrink-0"
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
}, [H]);
|
|
255
|
+
return Z ? /* @__PURE__ */ y("div", { ref: $, className: "flex flex-col h-full bg-canvas-elevated", children: /* @__PURE__ */ y(
|
|
256
|
+
ae,
|
|
203
257
|
{
|
|
204
|
-
items:
|
|
205
|
-
onChange:
|
|
206
|
-
onSubmit:
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
258
|
+
items: X,
|
|
259
|
+
onChange: re,
|
|
260
|
+
onSubmit: ne,
|
|
261
|
+
renderLabelExtras: le,
|
|
262
|
+
renderActions: oe,
|
|
263
|
+
enableApplyDiscard: E,
|
|
264
|
+
enableSearch: P,
|
|
265
|
+
enableSelectAll: C,
|
|
210
266
|
enableDragDrop: !0,
|
|
211
267
|
enableCollapse: !0,
|
|
212
|
-
enableGlobalCollapse:
|
|
213
|
-
selectionMode:
|
|
214
|
-
searchPlaceholder:
|
|
268
|
+
enableGlobalCollapse: w,
|
|
269
|
+
selectionMode: de.CASCADE_DOWN,
|
|
270
|
+
searchPlaceholder: L("dataTable.searchColumnsPlaceholder"),
|
|
215
271
|
className: "h-full",
|
|
216
|
-
initialCollapsedItems:
|
|
272
|
+
initialCollapsedItems: V.current,
|
|
217
273
|
onCollapseChange: (r) => {
|
|
218
|
-
|
|
274
|
+
V.current = r;
|
|
219
275
|
}
|
|
220
276
|
},
|
|
221
|
-
|
|
222
|
-
) }) : /* @__PURE__ */
|
|
277
|
+
B ? "sync-a" : "sync-b"
|
|
278
|
+
) }) : /* @__PURE__ */ y("div", { className: "p-4 text-[13px] text-content-placeholder", children: L("dataTable.loadingColumns") });
|
|
223
279
|
};
|
|
224
280
|
export {
|
|
225
|
-
|
|
281
|
+
Ee as DataTableColumnList
|
|
226
282
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { useState as l, useRef as
|
|
3
|
-
import { AgGridWrapper as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { DataTableContext as
|
|
6
|
-
import { DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX as
|
|
1
|
+
import { jsx as i, jsxs as E } from "react/jsx-runtime";
|
|
2
|
+
import { useState as l, useRef as F, useCallback as _, useMemo as S, useEffect as A, memo as N } from "react";
|
|
3
|
+
import { AgGridWrapper as M } from "../ag-grid-react/index.js";
|
|
4
|
+
import { cn as y } from "../../../lib/utils.js";
|
|
5
|
+
import { DataTableContext as z, DataTableSheetPortalContext as I, useDataTable as j, useDataTableSheetPortal as P } from "./data-table-context.js";
|
|
6
|
+
import { DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX as R } from "./data-table-constants.js";
|
|
7
7
|
import { AG_GRID_VALUE_FORMATTERS as k } from "../ag-grid-react/value-formatters.js";
|
|
8
|
-
const
|
|
8
|
+
const C = {
|
|
9
9
|
default: 46,
|
|
10
10
|
compact: 30,
|
|
11
11
|
comfort: 52
|
|
12
|
-
},
|
|
12
|
+
}, G = (o) => {
|
|
13
13
|
if (o)
|
|
14
14
|
return o.map((e) => {
|
|
15
15
|
if ("children" in e && e.children)
|
|
16
16
|
return {
|
|
17
17
|
...e,
|
|
18
|
-
children:
|
|
18
|
+
children: G(e.children)
|
|
19
19
|
};
|
|
20
20
|
const t = e;
|
|
21
21
|
return !t.valueFormatter && (t.type === "numericColumn" || t.type === "number") ? {
|
|
@@ -27,65 +27,65 @@ const w = {
|
|
|
27
27
|
children: o,
|
|
28
28
|
className: e
|
|
29
29
|
}) => {
|
|
30
|
-
const [t, r] = l(null), [n, p] = l(null), [
|
|
31
|
-
m.current = Math.max(0, m.current +
|
|
32
|
-
}, []), T =
|
|
33
|
-
r(
|
|
34
|
-
}, []),
|
|
30
|
+
const [t, r] = l(null), [n, p] = l(null), [c, d] = l("medium"), [h, u] = l("full"), [s, f] = l("default"), [g, b] = l(!1), m = F(0), x = _((H) => {
|
|
31
|
+
m.current = Math.max(0, m.current + H), b(m.current > 0);
|
|
32
|
+
}, []), T = _((H) => {
|
|
33
|
+
r(H);
|
|
34
|
+
}, []), v = {
|
|
35
35
|
small: "12px",
|
|
36
36
|
medium: "14px",
|
|
37
37
|
large: "16px"
|
|
38
|
-
}[
|
|
38
|
+
}[c], a = `${C[s]}px`, O = S(() => ({
|
|
39
39
|
gridApi: t,
|
|
40
40
|
registerApi: T,
|
|
41
41
|
registerScopedSheetDepth: x,
|
|
42
|
-
fontSize:
|
|
43
|
-
setFontSize:
|
|
44
|
-
numericFormat:
|
|
45
|
-
setNumericFormat:
|
|
46
|
-
rowHeight:
|
|
42
|
+
fontSize: c,
|
|
43
|
+
setFontSize: d,
|
|
44
|
+
numericFormat: h,
|
|
45
|
+
setNumericFormat: u,
|
|
46
|
+
rowHeight: s,
|
|
47
47
|
setRowHeight: f
|
|
48
48
|
}), [
|
|
49
49
|
t,
|
|
50
50
|
T,
|
|
51
51
|
x,
|
|
52
|
-
s,
|
|
53
|
-
h,
|
|
54
52
|
c,
|
|
55
53
|
d,
|
|
54
|
+
h,
|
|
56
55
|
u,
|
|
56
|
+
s,
|
|
57
57
|
f
|
|
58
|
-
]),
|
|
58
|
+
]), D = S(() => ({
|
|
59
59
|
sheetTarget: n,
|
|
60
60
|
setSheetTarget: p,
|
|
61
61
|
scopedSheetOpen: g
|
|
62
62
|
}), [n, p, g]);
|
|
63
|
-
return /* @__PURE__ */ i(
|
|
63
|
+
return /* @__PURE__ */ i(z.Provider, { value: O, children: /* @__PURE__ */ i(I.Provider, { value: D, children: /* @__PURE__ */ i(
|
|
64
64
|
"div",
|
|
65
65
|
{
|
|
66
66
|
"data-component": "data-table",
|
|
67
|
-
className:
|
|
67
|
+
className: y("flex flex-col w-full min-h-0 rounded-[inherit]", e),
|
|
68
68
|
style: {
|
|
69
|
-
"--ag-font-size":
|
|
70
|
-
"--ag-row-height":
|
|
69
|
+
"--ag-font-size": v,
|
|
70
|
+
"--ag-row-height": a
|
|
71
71
|
},
|
|
72
72
|
children: o
|
|
73
73
|
}
|
|
74
74
|
) }) });
|
|
75
|
-
},
|
|
75
|
+
}, w = {
|
|
76
76
|
full: "full_no",
|
|
77
77
|
k: "thou",
|
|
78
78
|
m: "mil",
|
|
79
79
|
b: "bil",
|
|
80
80
|
full_precision: "full_precision"
|
|
81
|
-
}, L =
|
|
82
|
-
const { setSheetTarget: e, scopedSheetOpen: t } =
|
|
81
|
+
}, L = N(function() {
|
|
82
|
+
const { setSheetTarget: e, scopedSheetOpen: t } = P();
|
|
83
83
|
return /* @__PURE__ */ i(
|
|
84
84
|
"div",
|
|
85
85
|
{
|
|
86
86
|
ref: e,
|
|
87
87
|
className: "absolute inset-0 pointer-events-none z-[39] flex overflow-x-hidden overflow-y-visible",
|
|
88
|
-
style: t ? { minHeight:
|
|
88
|
+
style: t ? { minHeight: R } : void 0
|
|
89
89
|
}
|
|
90
90
|
);
|
|
91
91
|
});
|
|
@@ -95,49 +95,50 @@ function J(o) {
|
|
|
95
95
|
rowHeight: t,
|
|
96
96
|
gridApi: r,
|
|
97
97
|
numericFormat: n
|
|
98
|
-
} =
|
|
99
|
-
className:
|
|
100
|
-
onGridReady:
|
|
98
|
+
} = j(), { scopedSheetOpen: p } = P(), {
|
|
99
|
+
className: c,
|
|
100
|
+
onGridReady: d,
|
|
101
101
|
rowHeight: h,
|
|
102
|
-
context:
|
|
103
|
-
columnDefs:
|
|
104
|
-
maintainColumnOrder:
|
|
105
|
-
...
|
|
106
|
-
} = o,
|
|
107
|
-
...
|
|
108
|
-
formatType:
|
|
109
|
-
}), [
|
|
110
|
-
|
|
102
|
+
context: u,
|
|
103
|
+
columnDefs: s,
|
|
104
|
+
maintainColumnOrder: f = !0,
|
|
105
|
+
...g
|
|
106
|
+
} = o, b = C[t], m = h ?? b, x = S(() => G(s), [s]), T = S(() => ({
|
|
107
|
+
...u,
|
|
108
|
+
formatType: w[n]
|
|
109
|
+
}), [u, n]);
|
|
110
|
+
A(() => {
|
|
111
111
|
r?.resetRowHeights();
|
|
112
|
-
}, [t, r]),
|
|
112
|
+
}, [t, r]), A(() => {
|
|
113
113
|
if (r) {
|
|
114
114
|
const a = r.getGridOption("context") || {};
|
|
115
115
|
r.setGridOption("context", {
|
|
116
116
|
...a,
|
|
117
|
-
formatType:
|
|
117
|
+
formatType: w[n]
|
|
118
118
|
}), r.refreshCells({ force: !0 });
|
|
119
119
|
}
|
|
120
120
|
}, [n, r]);
|
|
121
|
-
const
|
|
122
|
-
e(a.api),
|
|
123
|
-
}, [e,
|
|
124
|
-
return /* @__PURE__ */
|
|
121
|
+
const v = _((a) => {
|
|
122
|
+
e(a.api), d?.(a);
|
|
123
|
+
}, [e, d]);
|
|
124
|
+
return /* @__PURE__ */ E(
|
|
125
125
|
"div",
|
|
126
126
|
{
|
|
127
|
-
className:
|
|
127
|
+
className: y(
|
|
128
128
|
"relative flex-1 min-h-0 w-full bg-canvas-elevated rounded-b-[inherit] grid-rounded-bottom",
|
|
129
|
-
|
|
129
|
+
c
|
|
130
130
|
),
|
|
131
|
+
style: p ? { minHeight: R } : void 0,
|
|
131
132
|
children: [
|
|
132
133
|
/* @__PURE__ */ i(
|
|
133
|
-
|
|
134
|
+
M,
|
|
134
135
|
{
|
|
135
|
-
...
|
|
136
|
-
columnDefs:
|
|
137
|
-
rowHeight:
|
|
138
|
-
onGridReady:
|
|
139
|
-
context:
|
|
140
|
-
maintainColumnOrder:
|
|
136
|
+
...g,
|
|
137
|
+
columnDefs: x,
|
|
138
|
+
rowHeight: m,
|
|
139
|
+
onGridReady: v,
|
|
140
|
+
context: T,
|
|
141
|
+
maintainColumnOrder: f
|
|
141
142
|
}
|
|
142
143
|
),
|
|
143
144
|
/* @__PURE__ */ i(L, {})
|
|
@@ -148,7 +149,7 @@ function J(o) {
|
|
|
148
149
|
const K = ({
|
|
149
150
|
children: o,
|
|
150
151
|
className: e
|
|
151
|
-
}) => /* @__PURE__ */ i("div", { "data-component": "data-table-toolbar", className:
|
|
152
|
+
}) => /* @__PURE__ */ i("div", { "data-component": "data-table-toolbar", className: y("flex items-center justify-between px-4 py-3 shrink-0 bg-canvas-elevated rounded-t-[inherit]", e), children: o });
|
|
152
153
|
export {
|
|
153
154
|
q as DataTable,
|
|
154
155
|
J as DataTableContent,
|
|
@@ -6,4 +6,7 @@ export * from './data-table-format-options';
|
|
|
6
6
|
export * from './data-table-sheet';
|
|
7
7
|
export * from './data-table-view-menu';
|
|
8
8
|
export * from './data-table-saved-views';
|
|
9
|
+
export * from './pin-switch';
|
|
10
|
+
export * from './column-indicator';
|
|
11
|
+
export * from './indicator-legend';
|
|
9
12
|
export type { SavedTableViewItem, TableViewTypeOption, DataTableSavedViewsProps, DataTableSavedViewsActionContext, DataTableSavedViewsCancelContext, } from '../types/data-table-saved-views.types';
|