flexi-datagrid 1.2.11 → 1.2.12
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/index.es.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { createContext as e, useCallback as t, useContext as n, useEffect as r, useLayoutEffect as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
2
|
+
import { ArrowDown as c, ArrowUp as l, ArrowUpDown as u, ChevronDown as d, ChevronLeft as f, ChevronRight as p, ChevronsLeft as m, ChevronsRight as h, Filter as g, Pin as ee, PinOff as _, RotateCcw as v, Settings as y, X as b } from "lucide-react";
|
|
3
3
|
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
4
4
|
import { createPortal as C } from "react-dom";
|
|
5
5
|
//#region src/DataTable/context/DataTableContext.tsx
|
|
6
|
-
var w =
|
|
7
|
-
function
|
|
6
|
+
var w = e(null);
|
|
7
|
+
function T({ value: e, children: t }) {
|
|
8
8
|
return /* @__PURE__ */ x(w.Provider, {
|
|
9
9
|
value: e,
|
|
10
10
|
children: t
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
let e =
|
|
13
|
+
function E() {
|
|
14
|
+
let e = n(w);
|
|
15
15
|
if (!e) throw Error("DataTable components must be rendered inside <DataTable>.");
|
|
16
16
|
return e;
|
|
17
17
|
}
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/DataTable/utils/classNames.ts
|
|
20
|
-
var
|
|
20
|
+
var D = (...e) => e.filter(Boolean).join(" ");
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/DataTable/components/GroupZone.tsx
|
|
23
|
-
function
|
|
24
|
-
let { groupedColumns: e, columnsByKey: t, addGroup: n, removeGroup: r } =
|
|
23
|
+
function O() {
|
|
24
|
+
let { groupedColumns: e, columnsByKey: t, addGroup: n, removeGroup: r } = E(), [i, a] = s(!1);
|
|
25
25
|
return /* @__PURE__ */ x("div", {
|
|
26
26
|
onDragOver: (e) => {
|
|
27
27
|
e.preventDefault(), a(!0);
|
|
@@ -32,7 +32,7 @@ function D() {
|
|
|
32
32
|
let r = e.dataTransfer.getData("text/plain");
|
|
33
33
|
r && t.has(r) && n(r);
|
|
34
34
|
},
|
|
35
|
-
className:
|
|
35
|
+
className: D("flexi-groupzone", i && "flexi-groupzone--dragover"),
|
|
36
36
|
children: e.length === 0 ? /* @__PURE__ */ x("span", {
|
|
37
37
|
className: "flexi-groupzone-hint",
|
|
38
38
|
children: "Drag a column header here to group your records by that field"
|
|
@@ -47,7 +47,7 @@ function D() {
|
|
|
47
47
|
type: "button",
|
|
48
48
|
onClick: () => r(e),
|
|
49
49
|
className: "flexi-icon-btn flexi-chip-remove",
|
|
50
|
-
children: /* @__PURE__ */ x(
|
|
50
|
+
children: /* @__PURE__ */ x(b, { className: "flexi-icon-xs" })
|
|
51
51
|
})]
|
|
52
52
|
}, e))]
|
|
53
53
|
})
|
|
@@ -55,8 +55,8 @@ function D() {
|
|
|
55
55
|
}
|
|
56
56
|
//#endregion
|
|
57
57
|
//#region src/DataTable/components/Pagination.tsx
|
|
58
|
-
function
|
|
59
|
-
let { currentPage: e, pageSize: t, totalPages: n, totalCount: r, pageSizeOptions:
|
|
58
|
+
function te() {
|
|
59
|
+
let { currentPage: e, pageSize: t, totalPages: n, totalCount: r, pageSizeOptions: i, goToPage: a, changePageSize: o } = E();
|
|
60
60
|
return /* @__PURE__ */ S("div", {
|
|
61
61
|
className: "flexi-pagination",
|
|
62
62
|
children: [
|
|
@@ -64,9 +64,9 @@ function O() {
|
|
|
64
64
|
className: "flexi-pagination-size",
|
|
65
65
|
children: [/* @__PURE__ */ x("span", { children: "Rows per page" }), /* @__PURE__ */ x("select", {
|
|
66
66
|
value: t,
|
|
67
|
-
onChange: (e) =>
|
|
67
|
+
onChange: (e) => o(Number(e.target.value)),
|
|
68
68
|
className: "flexi-pagination-select",
|
|
69
|
-
children:
|
|
69
|
+
children: i.map((e) => /* @__PURE__ */ x("option", {
|
|
70
70
|
value: e,
|
|
71
71
|
children: e
|
|
72
72
|
}, e))
|
|
@@ -81,19 +81,19 @@ function O() {
|
|
|
81
81
|
children: [
|
|
82
82
|
/* @__PURE__ */ x("button", {
|
|
83
83
|
type: "button",
|
|
84
|
-
onClick: () =>
|
|
84
|
+
onClick: () => a(1),
|
|
85
85
|
disabled: e === 1,
|
|
86
86
|
className: "flexi-icon-btn",
|
|
87
87
|
title: "First page",
|
|
88
|
-
children: /* @__PURE__ */ x(
|
|
88
|
+
children: /* @__PURE__ */ x(m, { className: "flexi-icon-sm" })
|
|
89
89
|
}),
|
|
90
90
|
/* @__PURE__ */ x("button", {
|
|
91
91
|
type: "button",
|
|
92
|
-
onClick: () =>
|
|
92
|
+
onClick: () => a(e - 1),
|
|
93
93
|
disabled: e === 1,
|
|
94
94
|
className: "flexi-icon-btn",
|
|
95
95
|
title: "Previous page",
|
|
96
|
-
children: /* @__PURE__ */ x(
|
|
96
|
+
children: /* @__PURE__ */ x(f, { className: "flexi-icon-sm" })
|
|
97
97
|
}),
|
|
98
98
|
/* @__PURE__ */ S("span", {
|
|
99
99
|
className: "flexi-pagination-page",
|
|
@@ -106,19 +106,19 @@ function O() {
|
|
|
106
106
|
}),
|
|
107
107
|
/* @__PURE__ */ x("button", {
|
|
108
108
|
type: "button",
|
|
109
|
-
onClick: () =>
|
|
109
|
+
onClick: () => a(e + 1),
|
|
110
110
|
disabled: e === n,
|
|
111
111
|
className: "flexi-icon-btn",
|
|
112
112
|
title: "Next page",
|
|
113
|
-
children: /* @__PURE__ */ x(
|
|
113
|
+
children: /* @__PURE__ */ x(p, { className: "flexi-icon-sm" })
|
|
114
114
|
}),
|
|
115
115
|
/* @__PURE__ */ x("button", {
|
|
116
116
|
type: "button",
|
|
117
|
-
onClick: () =>
|
|
117
|
+
onClick: () => a(n),
|
|
118
118
|
disabled: e === n,
|
|
119
119
|
className: "flexi-icon-btn",
|
|
120
120
|
title: "Last page",
|
|
121
|
-
children: /* @__PURE__ */ x(
|
|
121
|
+
children: /* @__PURE__ */ x(h, { className: "flexi-icon-sm" })
|
|
122
122
|
})
|
|
123
123
|
]
|
|
124
124
|
})
|
|
@@ -127,26 +127,26 @@ function O() {
|
|
|
127
127
|
}
|
|
128
128
|
//#endregion
|
|
129
129
|
//#region src/DataTable/constants.ts
|
|
130
|
-
var
|
|
130
|
+
var ne = [
|
|
131
131
|
10,
|
|
132
132
|
25,
|
|
133
133
|
50,
|
|
134
134
|
100
|
|
135
|
-
], k = [],
|
|
135
|
+
], k = [], re = [], A = (e) => {
|
|
136
136
|
let t = [];
|
|
137
137
|
return e.forEach((e) => {
|
|
138
|
-
e.children && e.children.length > 0 ? t.push(...
|
|
138
|
+
e.children && e.children.length > 0 ? t.push(...A(e.children)) : t.push(e);
|
|
139
139
|
}), t;
|
|
140
|
-
},
|
|
140
|
+
}, j = (e) => {
|
|
141
141
|
if (e === !0) return "left";
|
|
142
142
|
if (e === "left" || e === "right") return e;
|
|
143
|
-
},
|
|
143
|
+
}, ie = (e) => {
|
|
144
144
|
let t = {};
|
|
145
145
|
return e.forEach((e) => {
|
|
146
|
-
let n =
|
|
146
|
+
let n = j(e.pinned);
|
|
147
147
|
n && (t[e.key] = n);
|
|
148
148
|
}), t;
|
|
149
|
-
},
|
|
149
|
+
}, M = (e, t, n) => {
|
|
150
150
|
let r = (e) => {
|
|
151
151
|
let n = t[e];
|
|
152
152
|
return n === "left" ? 0 : n === "right" ? 2 : 1;
|
|
@@ -161,22 +161,22 @@ var te = [
|
|
|
161
161
|
children: i(e.children)
|
|
162
162
|
} : e);
|
|
163
163
|
return i(e);
|
|
164
|
-
},
|
|
164
|
+
}, N = (e, t, n) => {
|
|
165
165
|
let r = e.map((e) => e.key);
|
|
166
166
|
if (r.includes(t) && r.includes(n)) return e;
|
|
167
167
|
for (let r of e) if (r.children && r.children.length > 0) {
|
|
168
|
-
let e =
|
|
168
|
+
let e = N(r.children, t, n);
|
|
169
169
|
if (e) return e;
|
|
170
170
|
}
|
|
171
171
|
return null;
|
|
172
|
-
},
|
|
172
|
+
}, P = (e, t) => {
|
|
173
173
|
let n = t[e.key];
|
|
174
174
|
if (n !== void 0) return n;
|
|
175
175
|
let r = e.style?.width || e.headerStyle?.width || "150px";
|
|
176
176
|
if (typeof r == "number") return r;
|
|
177
177
|
let i = String(r).trim();
|
|
178
178
|
return /^\d+(\.\d+)?(px)?$/i.test(i) && parseInt(i, 10) || 150;
|
|
179
|
-
},
|
|
179
|
+
}, ae = (e, t, n) => {
|
|
180
180
|
let r = (e) => {
|
|
181
181
|
let t = 0;
|
|
182
182
|
return e.forEach((e) => {
|
|
@@ -203,13 +203,13 @@ var te = [
|
|
|
203
203
|
...e,
|
|
204
204
|
rowSpan: Math.min(e.rowSpan, c.length - t)
|
|
205
205
|
})));
|
|
206
|
-
},
|
|
206
|
+
}, oe = ({ visibleLeafColumns: e, pinnedColumns: t, columnWidths: n, hasGroups: r, hasActions: i }) => {
|
|
207
207
|
let a = {}, o = r ? 48 : 0;
|
|
208
208
|
e.forEach((e) => {
|
|
209
209
|
t[e.key] === "left" && (a[e.key] = {
|
|
210
210
|
side: "left",
|
|
211
211
|
offset: o
|
|
212
|
-
}, o +=
|
|
212
|
+
}, o += P(e, n));
|
|
213
213
|
});
|
|
214
214
|
let s = i ? 100 : 0;
|
|
215
215
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
@@ -217,10 +217,10 @@ var te = [
|
|
|
217
217
|
t[i.key] === "right" && (a[i.key] = {
|
|
218
218
|
side: "right",
|
|
219
219
|
offset: s
|
|
220
|
-
}, s +=
|
|
220
|
+
}, s += P(i, n));
|
|
221
221
|
}
|
|
222
222
|
return a;
|
|
223
|
-
},
|
|
223
|
+
}, F = (e, t, n = !1, r) => {
|
|
224
224
|
let i = e[t];
|
|
225
225
|
if (!i) return r || {};
|
|
226
226
|
let a = i.side === "right";
|
|
@@ -233,7 +233,7 @@ var te = [
|
|
|
233
233
|
boxShadow: a ? "-2px 0 5px -2px rgba(0,0,0,0.1)" : "2px 0 5px -2px rgba(0,0,0,0.1)",
|
|
234
234
|
...r
|
|
235
235
|
};
|
|
236
|
-
},
|
|
236
|
+
}, I = () => /* @__PURE__ */ x("td", {
|
|
237
237
|
className: "flexi-row-indent-cell",
|
|
238
238
|
style: {
|
|
239
239
|
position: "sticky",
|
|
@@ -254,8 +254,8 @@ function L({ children: e }) {
|
|
|
254
254
|
})
|
|
255
255
|
});
|
|
256
256
|
}
|
|
257
|
-
function
|
|
258
|
-
let { rowHeight: t, expandedGroups: n, toggleGroupExpansion:
|
|
257
|
+
function se({ node: e }) {
|
|
258
|
+
let { rowHeight: t, expandedGroups: n, toggleGroupExpansion: r, totalColumnsCount: i } = E(), a = n[e.path] !== !1;
|
|
259
259
|
return /* @__PURE__ */ S("tr", {
|
|
260
260
|
className: "flexi-group-row",
|
|
261
261
|
style: { height: t },
|
|
@@ -270,10 +270,10 @@ function oe({ node: e }) {
|
|
|
270
270
|
},
|
|
271
271
|
children: /* @__PURE__ */ S("button", {
|
|
272
272
|
type: "button",
|
|
273
|
-
onClick: () =>
|
|
273
|
+
onClick: () => r(e.path),
|
|
274
274
|
className: "flexi-group-toggle",
|
|
275
275
|
children: [
|
|
276
|
-
x(
|
|
276
|
+
x(a ? d : p, { className: "flexi-icon-md flexi-icon-muted" }),
|
|
277
277
|
/* @__PURE__ */ x("span", {
|
|
278
278
|
className: "flexi-group-value",
|
|
279
279
|
children: e.groupValue
|
|
@@ -285,27 +285,27 @@ function oe({ node: e }) {
|
|
|
285
285
|
]
|
|
286
286
|
})
|
|
287
287
|
}), /* @__PURE__ */ x("td", {
|
|
288
|
-
colSpan: Math.max(1,
|
|
288
|
+
colSpan: Math.max(1, i - 1),
|
|
289
289
|
className: "flexi-group-filler"
|
|
290
290
|
})]
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
|
-
function
|
|
294
|
-
let { rowHeight: r, hasGroups: i, hasActions: a, actions: o, onRowClick: s, visibleLeafColumns: c, pinnedColumns: l, pinOffsets: u, rowSpanColumns: d, rowSpanInfo: f } =
|
|
293
|
+
function R({ record: e, rowIndex: t, className: n }) {
|
|
294
|
+
let { rowHeight: r, hasGroups: i, hasActions: a, actions: o, onRowClick: s, visibleLeafColumns: c, pinnedColumns: l, pinOffsets: u, rowSpanColumns: d, rowSpanInfo: f } = E(), p = f.get(t);
|
|
295
295
|
return /* @__PURE__ */ S("tr", {
|
|
296
|
-
className:
|
|
296
|
+
className: D("flexi-row", s && "flexi-row--clickable", n),
|
|
297
297
|
style: { height: r },
|
|
298
298
|
onClick: s ? (n) => s(e, t, n) : void 0,
|
|
299
299
|
children: [
|
|
300
|
-
i && /* @__PURE__ */ x(
|
|
300
|
+
i && /* @__PURE__ */ x(I, {}),
|
|
301
301
|
c.map((t) => {
|
|
302
302
|
let n = d?.includes(t.key) ? p?.[t.key] : void 0;
|
|
303
303
|
if (n === "skip") return null;
|
|
304
304
|
let r = e[t.key];
|
|
305
305
|
return /* @__PURE__ */ x("td", {
|
|
306
306
|
rowSpan: typeof n == "number" ? n : void 0,
|
|
307
|
-
className:
|
|
308
|
-
style:
|
|
307
|
+
className: D("flexi-cell", !!l[t.key] && "flexi-cell--pinned", t.className),
|
|
308
|
+
style: F(u, t.key, !1, t.style),
|
|
309
309
|
children: t.render ? t.render(r, e) : /* @__PURE__ */ x("span", {
|
|
310
310
|
className: "flexi-cell-text",
|
|
311
311
|
children: r
|
|
@@ -316,22 +316,22 @@ function se({ record: e, rowIndex: t, className: n }) {
|
|
|
316
316
|
]
|
|
317
317
|
});
|
|
318
318
|
}
|
|
319
|
-
function
|
|
320
|
-
let { hasGroups: r, hasActions: i, actions: a, pinnedBottomRowData: o, visibleLeafColumns: s, pinnedColumns: c, pinOffsets: l } =
|
|
319
|
+
function ce({ record: e, index: t, className: n }) {
|
|
320
|
+
let { hasGroups: r, hasActions: i, actions: a, pinnedBottomRowData: o, visibleLeafColumns: s, pinnedColumns: c, pinOffsets: l } = E(), u = {
|
|
321
321
|
position: "sticky",
|
|
322
322
|
bottom: `${(o.length - 1 - t) * 48}px`,
|
|
323
323
|
zIndex: 45
|
|
324
324
|
};
|
|
325
325
|
return /* @__PURE__ */ S("tr", {
|
|
326
|
-
className:
|
|
326
|
+
className: D("flexi-row", "flexi-row--pinned-bottom", n),
|
|
327
327
|
style: u,
|
|
328
328
|
children: [
|
|
329
|
-
r && /* @__PURE__ */ x(
|
|
329
|
+
r && /* @__PURE__ */ x(I, {}),
|
|
330
330
|
s.map((t) => {
|
|
331
331
|
let n = e[t.key], r = t.pinnedRender ?? t.render;
|
|
332
332
|
return /* @__PURE__ */ x("td", {
|
|
333
|
-
className:
|
|
334
|
-
style:
|
|
333
|
+
className: D("flexi-cell", !!c[t.key] && "flexi-cell--pinned", t.className),
|
|
334
|
+
style: F(l, t.key, !1, t.style),
|
|
335
335
|
children: r ? r(n, e) : /* @__PURE__ */ x("span", {
|
|
336
336
|
className: "flexi-cell-text",
|
|
337
337
|
children: n
|
|
@@ -344,11 +344,11 @@ function R({ record: e, index: t, className: n }) {
|
|
|
344
344
|
}
|
|
345
345
|
//#endregion
|
|
346
346
|
//#region src/DataTable/components/PinnedBottomBody.tsx
|
|
347
|
-
function
|
|
348
|
-
let { pinnedBottomRowData: e, pinnedRowClassName: t } =
|
|
347
|
+
function le() {
|
|
348
|
+
let { pinnedBottomRowData: e, pinnedRowClassName: t } = E();
|
|
349
349
|
return e.length === 0 ? null : /* @__PURE__ */ x("tbody", {
|
|
350
350
|
className: "flexi-tbody flexi-tbody--pinned-bottom",
|
|
351
|
-
children: e.map((e, n) => /* @__PURE__ */ x(
|
|
351
|
+
children: e.map((e, n) => /* @__PURE__ */ x(ce, {
|
|
352
352
|
record: e,
|
|
353
353
|
index: n,
|
|
354
354
|
className: typeof t == "function" ? t(e, n) : t
|
|
@@ -357,21 +357,21 @@ function ce() {
|
|
|
357
357
|
}
|
|
358
358
|
//#endregion
|
|
359
359
|
//#region src/DataTable/components/SettingsMenu.tsx
|
|
360
|
-
function
|
|
361
|
-
let { settingsMenu: e } =
|
|
360
|
+
function ue() {
|
|
361
|
+
let { settingsMenu: e } = E();
|
|
362
362
|
return /* @__PURE__ */ x("button", {
|
|
363
363
|
type: "button",
|
|
364
364
|
ref: e.buttonRef,
|
|
365
365
|
onClick: (t) => {
|
|
366
366
|
t.stopPropagation(), e.toggle();
|
|
367
367
|
},
|
|
368
|
-
className:
|
|
368
|
+
className: D("flexi-icon-btn", e.isOpen && "flexi-settings-btn--active"),
|
|
369
369
|
title: "Grid display settings",
|
|
370
|
-
children: /* @__PURE__ */ x(
|
|
370
|
+
children: /* @__PURE__ */ x(y, { className: "flexi-icon-sm" })
|
|
371
371
|
});
|
|
372
372
|
}
|
|
373
|
-
function
|
|
374
|
-
let { gridRootRef: e, settingsMenu: t, displayPinnedIcon: n, toggleDisplayPinnedIcon: r, showGroupBy: i, toggleShowGroupBy: a, initialLeafColumns: o, hiddenColumns: s, toggleColumnVisibility: c, resetControlPanelDefaults: l } =
|
|
373
|
+
function z() {
|
|
374
|
+
let { gridRootRef: e, settingsMenu: t, displayPinnedIcon: n, toggleDisplayPinnedIcon: r, showGroupBy: i, toggleShowGroupBy: a, initialLeafColumns: o, hiddenColumns: s, toggleColumnVisibility: c, resetControlPanelDefaults: l } = E(), u = e.current;
|
|
375
375
|
return !t.isOpen || !t.position || !u ? null : C(/* @__PURE__ */ S("div", {
|
|
376
376
|
ref: t.menuRef,
|
|
377
377
|
className: "flexi-settings-menu",
|
|
@@ -439,44 +439,44 @@ function ue() {
|
|
|
439
439
|
onClick: l,
|
|
440
440
|
className: "flexi-settings-reset",
|
|
441
441
|
title: "Reset pin icon visibility and hidden columns to their defaults",
|
|
442
|
-
children: [/* @__PURE__ */ x(
|
|
442
|
+
children: [/* @__PURE__ */ x(v, { className: "flexi-icon-sm" }), /* @__PURE__ */ x("span", { children: "Reset to defaults" })]
|
|
443
443
|
})
|
|
444
444
|
]
|
|
445
445
|
}), u);
|
|
446
446
|
}
|
|
447
447
|
//#endregion
|
|
448
448
|
//#region src/DataTable/utils/records.ts
|
|
449
|
-
var
|
|
449
|
+
var B = (e, t, n) => n?.getValue ? n.getValue(e) : e[t], V = (e, t) => {
|
|
450
450
|
let n = typeof t == "function" ? t(e) : e[t];
|
|
451
451
|
return n == null ? void 0 : String(n);
|
|
452
|
-
},
|
|
452
|
+
}, H = (e, t, n) => {
|
|
453
453
|
if (!n) return;
|
|
454
454
|
let r;
|
|
455
455
|
for (let i in n) n[i](e, t) && (r = r ? `${r} ${i}` : i);
|
|
456
456
|
return r;
|
|
457
|
-
},
|
|
458
|
-
let r = e.map((e) =>
|
|
457
|
+
}, U = (e, t, n) => {
|
|
458
|
+
let r = e.map((e) => B(e, t, n));
|
|
459
459
|
return Array.from(new Set(r)).filter((e) => e != null);
|
|
460
|
-
},
|
|
460
|
+
}, de = (e, t, n) => {
|
|
461
461
|
let r = Object.entries(t).filter(([, e]) => e && e.length > 0);
|
|
462
|
-
return r.length === 0 ? e : e.filter((e) => r.every(([t, r]) => r.includes(
|
|
463
|
-
},
|
|
462
|
+
return r.length === 0 ? e : e.filter((e) => r.every(([t, r]) => r.includes(B(e, t, n.get(t)))));
|
|
463
|
+
}, W = (e) => e == null || typeof e == "number" && Number.isNaN(e), G = (e, t) => typeof e == "number" && typeof t == "number" ? e - t : e instanceof Date && t instanceof Date ? e.getTime() - t.getTime() : String(e).localeCompare(String(t), void 0, {
|
|
464
464
|
numeric: !0,
|
|
465
465
|
sensitivity: "base"
|
|
466
|
-
}),
|
|
467
|
-
let a =
|
|
466
|
+
}), fe = (e, t, n, r) => [...e].sort((e, i) => {
|
|
467
|
+
let a = B(e, t, r), o = B(i, t, r);
|
|
468
468
|
if (a === o) return 0;
|
|
469
|
-
let s =
|
|
469
|
+
let s = W(a), c = W(o);
|
|
470
470
|
if (s && c) return 0;
|
|
471
471
|
if (s) return 1;
|
|
472
472
|
if (c) return -1;
|
|
473
|
-
let l =
|
|
473
|
+
let l = G(a, o);
|
|
474
474
|
return n === "asc" ? l : -l;
|
|
475
475
|
});
|
|
476
476
|
//#endregion
|
|
477
477
|
//#region src/DataTable/components/TableBody.tsx
|
|
478
|
-
function
|
|
479
|
-
let { isLoading: e, visibleRows: t, startIndex: n, totalRowCount: r, topSpacerHeight: i, bottomSpacerHeight: a, totalColumnsCount: o, rowKey: s, rowClassRules: c } =
|
|
478
|
+
function pe() {
|
|
479
|
+
let { isLoading: e, visibleRows: t, startIndex: n, totalRowCount: r, topSpacerHeight: i, bottomSpacerHeight: a, totalColumnsCount: o, rowKey: s, rowClassRules: c } = E(), l = Math.max(1, o);
|
|
480
480
|
return e || r === 0 ? /* @__PURE__ */ x("tbody", {
|
|
481
481
|
className: "flexi-tbody",
|
|
482
482
|
children: /* @__PURE__ */ x("tr", { children: /* @__PURE__ */ x("td", {
|
|
@@ -501,11 +501,11 @@ function U() {
|
|
|
501
501
|
}),
|
|
502
502
|
t.map((e, t) => {
|
|
503
503
|
let r = n + t;
|
|
504
|
-
return e.kind === "group" ? /* @__PURE__ */ x(
|
|
504
|
+
return e.kind === "group" ? /* @__PURE__ */ x(se, { node: e }, `group-header-${e.path}-${r}`) : /* @__PURE__ */ x(R, {
|
|
505
505
|
record: e.record,
|
|
506
506
|
rowIndex: r,
|
|
507
|
-
className:
|
|
508
|
-
},
|
|
507
|
+
className: H(e.record, r, c)
|
|
508
|
+
}, V(e.record, s) ?? `row-${r}`);
|
|
509
509
|
}),
|
|
510
510
|
a > 0 && /* @__PURE__ */ x("tr", {
|
|
511
511
|
"aria-hidden": "true",
|
|
@@ -524,21 +524,21 @@ function U() {
|
|
|
524
524
|
}
|
|
525
525
|
//#endregion
|
|
526
526
|
//#region src/DataTable/components/TableColGroup.tsx
|
|
527
|
-
function
|
|
528
|
-
let { hasGroups: e, hasActions: t, visibleLeafColumns: n, columnWidths: r } =
|
|
527
|
+
function me() {
|
|
528
|
+
let { hasGroups: e, hasActions: t, visibleLeafColumns: n, columnWidths: r } = E();
|
|
529
529
|
return /* @__PURE__ */ S("colgroup", { children: [
|
|
530
530
|
e && /* @__PURE__ */ x("col", { style: { width: "48px" } }),
|
|
531
531
|
n.map((e) => /* @__PURE__ */ x("col", { style: {
|
|
532
532
|
...e.style,
|
|
533
|
-
width:
|
|
533
|
+
width: P(e, r)
|
|
534
534
|
} }, e.key)),
|
|
535
535
|
t && /* @__PURE__ */ x("col", { style: { width: "100px" } })
|
|
536
536
|
] });
|
|
537
537
|
}
|
|
538
538
|
//#endregion
|
|
539
539
|
//#region src/DataTable/components/FilterDropdown.tsx
|
|
540
|
-
function
|
|
541
|
-
let { gridRootRef: t, filters: n } =
|
|
540
|
+
function he({ columnKey: e }) {
|
|
541
|
+
let { gridRootRef: t, filters: n } = E(), r = t.current, { filterPosition: i } = n;
|
|
542
542
|
if (!r || !i) return null;
|
|
543
543
|
let a = n.selectedFilters[e], o = (a?.length || 0) > 0, s = n.filteredUniqueValues;
|
|
544
544
|
return C(/* @__PURE__ */ S("div", {
|
|
@@ -593,57 +593,57 @@ function ge({ columnKey: e }) {
|
|
|
593
593
|
}
|
|
594
594
|
//#endregion
|
|
595
595
|
//#region src/DataTable/components/HeaderCell.tsx
|
|
596
|
-
function
|
|
597
|
-
let { groupBy:
|
|
596
|
+
function ge({ col: e, rowSpan: t, colSpan: n }) {
|
|
597
|
+
let { groupBy: r, pinnedColumns: i, pinOffsets: a, displayPinnedIcon: o, togglePin: s, sortState: d, handleSort: f, filters: p, handleDragStart: m, handleDragEnd: h, handleDrop: v, startResize: y } = E(), b = i[e.key], C = !!b, w = (p.selectedFilters[e.key]?.length || 0) > 0, T = !e.children || e.children.length === 0, O = d.key === e.key, te = r && T, ne = T && e.resizable !== !1, k = !!e.sortable && T;
|
|
598
598
|
return /* @__PURE__ */ S("th", {
|
|
599
|
-
rowSpan:
|
|
600
|
-
colSpan:
|
|
599
|
+
rowSpan: t,
|
|
600
|
+
colSpan: n,
|
|
601
601
|
draggable: !0,
|
|
602
|
-
onDragStart: (
|
|
603
|
-
onDragEnd:
|
|
602
|
+
onDragStart: (t) => m(t, e.key, T),
|
|
603
|
+
onDragEnd: h,
|
|
604
604
|
onDragOver: (e) => e.preventDefault(),
|
|
605
|
-
onDrop: (
|
|
606
|
-
className:
|
|
607
|
-
style:
|
|
605
|
+
onDrop: (t) => v(t, e.key),
|
|
606
|
+
className: D("flexi-th", "flexi-th--draggable", te && "flexi-th--group-draggable", C && "flexi-th--pinned", e.className, e.headerClassName),
|
|
607
|
+
style: F(a, e.key, !0, e.headerStyle),
|
|
608
608
|
children: [/* @__PURE__ */ S("div", {
|
|
609
609
|
className: "flexi-th-inner",
|
|
610
610
|
children: [
|
|
611
611
|
/* @__PURE__ */ S("div", {
|
|
612
|
-
className:
|
|
613
|
-
onClick: () =>
|
|
612
|
+
className: D("flexi-th-label", k && "flexi-th-label--sortable"),
|
|
613
|
+
onClick: () => k && f(e.key),
|
|
614
614
|
children: [/* @__PURE__ */ x("span", {
|
|
615
615
|
className: "flexi-th-text",
|
|
616
|
-
children:
|
|
617
|
-
}),
|
|
618
|
-
className:
|
|
619
|
-
children: O &&
|
|
616
|
+
children: e.header
|
|
617
|
+
}), k && /* @__PURE__ */ x("span", {
|
|
618
|
+
className: D("flexi-sort-icon", O && "flexi-sort-icon--active"),
|
|
619
|
+
children: O && d.direction === "asc" ? /* @__PURE__ */ x(l, { className: "flexi-icon-sm" }) : O && d.direction === "desc" ? /* @__PURE__ */ x(c, { className: "flexi-icon-sm" }) : /* @__PURE__ */ x(u, { className: "flexi-icon-sm" })
|
|
620
620
|
})]
|
|
621
621
|
}),
|
|
622
622
|
/* @__PURE__ */ S("div", {
|
|
623
623
|
className: "flexi-th-actions",
|
|
624
|
-
children: [
|
|
624
|
+
children: [T && e.filterable && /* @__PURE__ */ x("button", {
|
|
625
625
|
type: "button",
|
|
626
|
-
ref: (
|
|
627
|
-
onClick: (
|
|
628
|
-
|
|
626
|
+
ref: (t) => p.registerFilterButton(e.key, t),
|
|
627
|
+
onClick: (t) => {
|
|
628
|
+
t.stopPropagation(), p.toggleFilterDropdown(e.key);
|
|
629
629
|
},
|
|
630
|
-
className:
|
|
631
|
-
children: /* @__PURE__ */ x(
|
|
632
|
-
}),
|
|
630
|
+
className: D("flexi-icon-btn", "flexi-filter-btn", w && "flexi-filter-btn--active"),
|
|
631
|
+
children: /* @__PURE__ */ x(g, { className: "flexi-icon-sm" })
|
|
632
|
+
}), T && o && /* @__PURE__ */ x("button", {
|
|
633
633
|
type: "button",
|
|
634
|
-
onClick: (
|
|
635
|
-
|
|
634
|
+
onClick: (t) => {
|
|
635
|
+
t.stopPropagation(), s(e.key);
|
|
636
636
|
},
|
|
637
|
-
className:
|
|
638
|
-
title:
|
|
639
|
-
children: x(
|
|
637
|
+
className: D("flexi-icon-btn", "flexi-pin-btn", C && "flexi-pin-btn--pinned"),
|
|
638
|
+
title: b === "left" ? "Pinned left (click to pin right)" : b === "right" ? "Pinned right (click to unpin)" : "Pin column left",
|
|
639
|
+
children: x(C ? _ : ee, { className: "flexi-icon-sm" })
|
|
640
640
|
})]
|
|
641
641
|
}),
|
|
642
|
-
|
|
642
|
+
T && p.activeFilterKey === e.key && /* @__PURE__ */ x(he, { columnKey: e.key })
|
|
643
643
|
]
|
|
644
|
-
}),
|
|
644
|
+
}), ne && /* @__PURE__ */ x("div", {
|
|
645
645
|
className: "flexi-th-resizer",
|
|
646
|
-
onMouseDown: (
|
|
646
|
+
onMouseDown: (t) => y(t, e),
|
|
647
647
|
onClick: (e) => e.stopPropagation(),
|
|
648
648
|
onDragStart: (e) => e.preventDefault()
|
|
649
649
|
})]
|
|
@@ -651,8 +651,8 @@ function _e({ col: r, rowSpan: i, colSpan: a }) {
|
|
|
651
651
|
}
|
|
652
652
|
//#endregion
|
|
653
653
|
//#region src/DataTable/components/TableHeader.tsx
|
|
654
|
-
function
|
|
655
|
-
let { headerRows: e, hasGroups: t } =
|
|
654
|
+
function K() {
|
|
655
|
+
let { headerRows: e, hasGroups: t } = E();
|
|
656
656
|
return /* @__PURE__ */ x("thead", {
|
|
657
657
|
className: "flexi-thead",
|
|
658
658
|
children: e.map((n, r) => /* @__PURE__ */ S("tr", {
|
|
@@ -667,7 +667,7 @@ function ve() {
|
|
|
667
667
|
zIndex: 35,
|
|
668
668
|
backgroundColor: "rgb(248, 250, 252)"
|
|
669
669
|
}
|
|
670
|
-
}), n.map(({ col: e, rowSpan: t, colSpan: n }) => /* @__PURE__ */ x(
|
|
670
|
+
}), n.map(({ col: e, rowSpan: t, colSpan: n }) => /* @__PURE__ */ x(ge, {
|
|
671
671
|
col: e,
|
|
672
672
|
rowSpan: t,
|
|
673
673
|
colSpan: n
|
|
@@ -677,14 +677,14 @@ function ve() {
|
|
|
677
677
|
}
|
|
678
678
|
//#endregion
|
|
679
679
|
//#region src/DataTable/utils/grouping.ts
|
|
680
|
-
var
|
|
680
|
+
var _e = (e, t, n, r = 0, i = "") => {
|
|
681
681
|
if (r >= t.length) return e.map((e) => ({
|
|
682
682
|
kind: "record",
|
|
683
683
|
record: e
|
|
684
684
|
}));
|
|
685
685
|
let a = t[r], o = n.get(a), s = /* @__PURE__ */ new Map();
|
|
686
686
|
return e.forEach((e) => {
|
|
687
|
-
let t = String(
|
|
687
|
+
let t = String(B(e, a, o) ?? "N/A"), n = s.get(t);
|
|
688
688
|
n ? n.push(e) : s.set(t, [e]);
|
|
689
689
|
}), Array.from(s.entries()).sort(([e], [t]) => e.localeCompare(t, void 0, {
|
|
690
690
|
numeric: !0,
|
|
@@ -697,18 +697,18 @@ var ye = (e, t, n, r = 0, i = "") => {
|
|
|
697
697
|
groupValue: e,
|
|
698
698
|
path: s,
|
|
699
699
|
depth: r,
|
|
700
|
-
children:
|
|
700
|
+
children: _e(o, t, n, r + 1, s),
|
|
701
701
|
totalItemsCount: o.length
|
|
702
702
|
};
|
|
703
703
|
});
|
|
704
|
-
},
|
|
704
|
+
}, ve = (e, t) => {
|
|
705
705
|
let n = [], r = (e) => {
|
|
706
706
|
e.forEach((e) => {
|
|
707
707
|
n.push(e), e.kind === "group" && t[e.path] !== !1 && r(e.children);
|
|
708
708
|
});
|
|
709
709
|
};
|
|
710
710
|
return r(e), n;
|
|
711
|
-
},
|
|
711
|
+
}, ye = (e, t, n, r) => {
|
|
712
712
|
let i = /* @__PURE__ */ new Map();
|
|
713
713
|
if (!t || t.length === 0) return i;
|
|
714
714
|
let a = e.map(() => t.map(() => !0)), o = null;
|
|
@@ -723,7 +723,7 @@ var ye = (e, t, n, r = 0, i = "") => {
|
|
|
723
723
|
let e = !0;
|
|
724
724
|
for (let o = 0; o < t.length; o++) {
|
|
725
725
|
let c = t[o], l = n.get(c);
|
|
726
|
-
e &&
|
|
726
|
+
e && B(i.record, c, l) === B(s.record, c, l) ? a[r][o] = !1 : (e = !1, a[r][o] = !0);
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
729
|
o = r;
|
|
@@ -751,16 +751,16 @@ var ye = (e, t, n, r = 0, i = "") => {
|
|
|
751
751
|
};
|
|
752
752
|
//#endregion
|
|
753
753
|
//#region src/DataTable/hooks/useAnchoredPosition.ts
|
|
754
|
-
function
|
|
755
|
-
let [
|
|
756
|
-
return
|
|
754
|
+
function q({ active: e, resetKey: t, rootRef: n, getAnchor: i, compute: a }) {
|
|
755
|
+
let [c, l] = s(null), u = o(i), d = o(a);
|
|
756
|
+
return u.current = i, d.current = a, r(() => {
|
|
757
757
|
if (!e) {
|
|
758
|
-
|
|
758
|
+
l(null);
|
|
759
759
|
return;
|
|
760
760
|
}
|
|
761
761
|
let t = () => {
|
|
762
|
-
let e =
|
|
763
|
-
!e || !t ||
|
|
762
|
+
let e = u.current(), t = n.current;
|
|
763
|
+
!e || !t || l(d.current(e.getBoundingClientRect(), t.getBoundingClientRect()));
|
|
764
764
|
};
|
|
765
765
|
return t(), window.addEventListener("scroll", t, !0), window.addEventListener("resize", t), () => {
|
|
766
766
|
window.removeEventListener("scroll", t, !0), window.removeEventListener("resize", t);
|
|
@@ -769,237 +769,237 @@ function W({ active: e, resetKey: t, rootRef: n, getAnchor: r, compute: i }) {
|
|
|
769
769
|
e,
|
|
770
770
|
t,
|
|
771
771
|
n
|
|
772
|
-
]),
|
|
772
|
+
]), c;
|
|
773
773
|
}
|
|
774
774
|
//#endregion
|
|
775
775
|
//#region src/DataTable/hooks/useClickOutside.ts
|
|
776
|
-
function
|
|
777
|
-
let
|
|
778
|
-
|
|
776
|
+
function J(e, t, n) {
|
|
777
|
+
let i = o(t), a = o(n);
|
|
778
|
+
i.current = t, a.current = n, r(() => {
|
|
779
779
|
if (!e) return;
|
|
780
780
|
let t = (e) => {
|
|
781
|
-
let t = e.target, [n, ...
|
|
782
|
-
n && (n.contains(t) ||
|
|
781
|
+
let t = e.target, [n, ...r] = i.current();
|
|
782
|
+
n && (n.contains(t) || r.some((e) => e?.contains(t)) || a.current());
|
|
783
783
|
};
|
|
784
784
|
return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
|
|
785
785
|
}, [e]);
|
|
786
786
|
}
|
|
787
787
|
//#endregion
|
|
788
788
|
//#region src/DataTable/hooks/useColumnFilters.ts
|
|
789
|
-
function
|
|
790
|
-
let [
|
|
791
|
-
t ?
|
|
792
|
-
}, []),
|
|
793
|
-
|
|
794
|
-
}, []),
|
|
795
|
-
|
|
789
|
+
function be({ data: e, columnsByKey: n, gridRootRef: r }) {
|
|
790
|
+
let [i, c] = s(null), [l, u] = s({}), [d, f] = s(""), p = o(/* @__PURE__ */ new Map()), m = o(null), h = t((e, t) => {
|
|
791
|
+
t ? p.current.set(e, t) : p.current.delete(e);
|
|
792
|
+
}, []), g = t(() => {
|
|
793
|
+
c(null), f("");
|
|
794
|
+
}, []), ee = t((e) => {
|
|
795
|
+
f(""), c((t) => t === e ? null : e);
|
|
796
796
|
}, []);
|
|
797
|
-
|
|
798
|
-
let
|
|
799
|
-
active:
|
|
800
|
-
resetKey:
|
|
801
|
-
rootRef:
|
|
802
|
-
getAnchor: () =>
|
|
797
|
+
J(i !== null, () => [m.current, i ? p.current.get(i) : null], g);
|
|
798
|
+
let _ = q({
|
|
799
|
+
active: i !== null,
|
|
800
|
+
resetKey: i,
|
|
801
|
+
rootRef: r,
|
|
802
|
+
getAnchor: () => i ? p.current.get(i) : null,
|
|
803
803
|
compute: (e, t) => ({
|
|
804
804
|
top: e.bottom - t.top + 4,
|
|
805
805
|
left: e.left - t.left
|
|
806
806
|
})
|
|
807
|
-
}),
|
|
808
|
-
|
|
807
|
+
}), v = t((e, t) => {
|
|
808
|
+
u((n) => {
|
|
809
809
|
let r = n[e] || [], i = r.includes(t) ? r.filter((e) => e !== t) : [...r, t], a = {
|
|
810
810
|
...n,
|
|
811
811
|
[e]: i
|
|
812
812
|
};
|
|
813
813
|
return i.length === 0 && delete a[e], a;
|
|
814
814
|
});
|
|
815
|
-
}, []),
|
|
816
|
-
|
|
815
|
+
}, []), y = t((e) => {
|
|
816
|
+
u((t) => {
|
|
817
817
|
let n = { ...t };
|
|
818
818
|
return delete n[e], n;
|
|
819
819
|
});
|
|
820
|
-
}, []),
|
|
820
|
+
}, []), b = a(() => i ? U(e, i, n.get(i)) : [], [
|
|
821
821
|
e,
|
|
822
|
-
|
|
823
|
-
|
|
822
|
+
i,
|
|
823
|
+
n
|
|
824
824
|
]);
|
|
825
825
|
return {
|
|
826
|
-
activeFilterKey:
|
|
827
|
-
selectedFilters:
|
|
828
|
-
filterSearchQuery:
|
|
829
|
-
setFilterSearchQuery:
|
|
830
|
-
filterPosition:
|
|
831
|
-
dropdownRef:
|
|
832
|
-
filteredUniqueValues:
|
|
833
|
-
if (!
|
|
834
|
-
let e =
|
|
835
|
-
return
|
|
836
|
-
}, [
|
|
837
|
-
registerFilterButton:
|
|
838
|
-
toggleFilterDropdown:
|
|
839
|
-
handleFilterChange:
|
|
840
|
-
clearFilter:
|
|
826
|
+
activeFilterKey: i,
|
|
827
|
+
selectedFilters: l,
|
|
828
|
+
filterSearchQuery: d,
|
|
829
|
+
setFilterSearchQuery: f,
|
|
830
|
+
filterPosition: _,
|
|
831
|
+
dropdownRef: m,
|
|
832
|
+
filteredUniqueValues: a(() => {
|
|
833
|
+
if (!d.trim()) return b;
|
|
834
|
+
let e = d.toLowerCase();
|
|
835
|
+
return b.filter((t) => String(t).toLowerCase().includes(e));
|
|
836
|
+
}, [b, d]),
|
|
837
|
+
registerFilterButton: h,
|
|
838
|
+
toggleFilterDropdown: ee,
|
|
839
|
+
handleFilterChange: v,
|
|
840
|
+
clearFilter: y
|
|
841
841
|
};
|
|
842
842
|
}
|
|
843
843
|
//#endregion
|
|
844
844
|
//#region src/DataTable/hooks/useColumnReorder.ts
|
|
845
|
-
function
|
|
846
|
-
let [
|
|
845
|
+
function xe({ columns: e, pinnedColumns: n, isResizingRef: r, onColumnReorder: i }) {
|
|
846
|
+
let [c, l] = s({}), u = o(null), d = a(() => M(e, n, c), [
|
|
847
847
|
e,
|
|
848
|
-
|
|
849
|
-
|
|
848
|
+
n,
|
|
849
|
+
c
|
|
850
850
|
]);
|
|
851
851
|
return {
|
|
852
|
-
reorderedColumns:
|
|
853
|
-
handleDragStart:
|
|
854
|
-
if (
|
|
852
|
+
reorderedColumns: d,
|
|
853
|
+
handleDragStart: t((e, t, n) => {
|
|
854
|
+
if (r.current) {
|
|
855
855
|
e.preventDefault();
|
|
856
856
|
return;
|
|
857
857
|
}
|
|
858
|
-
|
|
859
|
-
}, [
|
|
860
|
-
handleDragEnd:
|
|
861
|
-
|
|
858
|
+
u.current = t, n && e.dataTransfer.setData("text/plain", t), e.dataTransfer.effectAllowed = "move";
|
|
859
|
+
}, [r]),
|
|
860
|
+
handleDragEnd: t(() => {
|
|
861
|
+
u.current = null;
|
|
862
862
|
}, []),
|
|
863
|
-
handleDrop:
|
|
864
|
-
|
|
865
|
-
let
|
|
866
|
-
if (
|
|
867
|
-
let
|
|
868
|
-
if (!
|
|
869
|
-
let
|
|
870
|
-
|
|
871
|
-
let m = { ...
|
|
872
|
-
|
|
863
|
+
handleDrop: t((t, r) => {
|
|
864
|
+
t.preventDefault(), t.stopPropagation();
|
|
865
|
+
let a = u.current;
|
|
866
|
+
if (u.current = null, !a || a === r) return;
|
|
867
|
+
let o = N(d, a, r);
|
|
868
|
+
if (!o) return;
|
|
869
|
+
let s = o.map((e) => e.key), f = s.indexOf(a), p = s.indexOf(r);
|
|
870
|
+
s.splice(p, 0, s.splice(f, 1)[0]);
|
|
871
|
+
let m = { ...c };
|
|
872
|
+
s.forEach((e, t) => {
|
|
873
873
|
m[e] = t;
|
|
874
|
-
}),
|
|
874
|
+
}), l(m), i && i(A(M(e, n, m)).map((e) => e.key));
|
|
875
875
|
}, [
|
|
876
|
-
|
|
877
|
-
|
|
876
|
+
d,
|
|
877
|
+
c,
|
|
878
878
|
e,
|
|
879
|
-
|
|
880
|
-
|
|
879
|
+
n,
|
|
880
|
+
i
|
|
881
881
|
])
|
|
882
882
|
};
|
|
883
883
|
}
|
|
884
884
|
//#endregion
|
|
885
885
|
//#region src/DataTable/hooks/useColumnResize.ts
|
|
886
|
-
function
|
|
887
|
-
let [
|
|
888
|
-
return
|
|
889
|
-
columnWidths:
|
|
890
|
-
isResizingRef:
|
|
891
|
-
startResize:
|
|
892
|
-
e.preventDefault(), e.stopPropagation(),
|
|
893
|
-
let
|
|
894
|
-
let
|
|
895
|
-
u && (
|
|
886
|
+
function Se(e) {
|
|
887
|
+
let [n, i] = s({}), a = o(!1), c = o(null), l = o(e);
|
|
888
|
+
return l.current = e, r(() => () => c.current?.(), []), {
|
|
889
|
+
columnWidths: n,
|
|
890
|
+
isResizingRef: a,
|
|
891
|
+
startResize: t((e, t) => {
|
|
892
|
+
e.preventDefault(), e.stopPropagation(), c.current?.(), a.current = !0;
|
|
893
|
+
let r = e.clientX, o = P(t, n), s = t.minWidth ?? 60, u = t.maxWidth, d = n[t.key], f = (e) => {
|
|
894
|
+
let n = Math.max(s, o + (e.clientX - r));
|
|
895
|
+
u && (n = Math.min(u, n)), d = n, i((e) => e[t.key] === n ? e : {
|
|
896
896
|
...e,
|
|
897
|
-
[
|
|
897
|
+
[t.key]: n
|
|
898
898
|
});
|
|
899
899
|
}, p = () => {
|
|
900
|
-
window.removeEventListener("mousemove", f), window.removeEventListener("mouseup", m),
|
|
900
|
+
window.removeEventListener("mousemove", f), window.removeEventListener("mouseup", m), c.current = null;
|
|
901
901
|
}, m = () => {
|
|
902
902
|
p(), requestAnimationFrame(() => {
|
|
903
|
-
|
|
904
|
-
}), d !== void 0 &&
|
|
903
|
+
a.current = !1;
|
|
904
|
+
}), d !== void 0 && l.current?.(t.key, d);
|
|
905
905
|
};
|
|
906
|
-
window.addEventListener("mousemove", f), window.addEventListener("mouseup", m),
|
|
907
|
-
p(),
|
|
906
|
+
window.addEventListener("mousemove", f), window.addEventListener("mouseup", m), c.current = () => {
|
|
907
|
+
p(), a.current = !1;
|
|
908
908
|
};
|
|
909
|
-
}, [
|
|
909
|
+
}, [n])
|
|
910
910
|
};
|
|
911
911
|
}
|
|
912
912
|
//#endregion
|
|
913
913
|
//#region src/DataTable/hooks/useColumnVisibility.ts
|
|
914
|
-
function
|
|
915
|
-
let [
|
|
914
|
+
function Ce({ defaultHiddenColumns: e, defaultDisplayPinnedIcon: n, onColumnVisibilityChange: r }) {
|
|
915
|
+
let [i, a] = s(e), [o, c] = s(n);
|
|
916
916
|
return {
|
|
917
|
-
hiddenColumns:
|
|
918
|
-
displayPinnedIcon:
|
|
919
|
-
toggleColumnVisibility:
|
|
920
|
-
let t =
|
|
921
|
-
|
|
922
|
-
}, [
|
|
923
|
-
toggleDisplayPinnedIcon:
|
|
924
|
-
resetControlPanelDefaults:
|
|
925
|
-
|
|
917
|
+
hiddenColumns: i,
|
|
918
|
+
displayPinnedIcon: o,
|
|
919
|
+
toggleColumnVisibility: t((e) => {
|
|
920
|
+
let t = i.includes(e) ? i.filter((t) => t !== e) : [...i, e];
|
|
921
|
+
a(t), r?.(t);
|
|
922
|
+
}, [i, r]),
|
|
923
|
+
toggleDisplayPinnedIcon: t(() => c((e) => !e), []),
|
|
924
|
+
resetControlPanelDefaults: t(() => {
|
|
925
|
+
c(n), a(e), r?.(e);
|
|
926
926
|
}, [
|
|
927
|
-
|
|
927
|
+
n,
|
|
928
928
|
e,
|
|
929
|
-
|
|
929
|
+
r
|
|
930
930
|
])
|
|
931
931
|
};
|
|
932
932
|
}
|
|
933
933
|
//#endregion
|
|
934
934
|
//#region src/DataTable/hooks/usePagination.ts
|
|
935
|
-
function
|
|
936
|
-
let [
|
|
937
|
-
return
|
|
938
|
-
|
|
935
|
+
function we({ items: e, enabled: n, defaultPageSize: i, onPageChange: o, resetOn: c }) {
|
|
936
|
+
let [l, u] = s(1), [d, f] = s(Math.max(1, Math.floor(i) || 1)), p = e.length, m = n ? Math.max(1, Math.ceil(p / d)) : 1;
|
|
937
|
+
return r(() => {
|
|
938
|
+
u(1);
|
|
939
939
|
}, [
|
|
940
|
-
...
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
]),
|
|
944
|
-
|
|
945
|
-
}, [
|
|
946
|
-
currentPage:
|
|
947
|
-
pageSize:
|
|
948
|
-
totalPages:
|
|
949
|
-
totalCount:
|
|
950
|
-
pagedItems:
|
|
951
|
-
if (!
|
|
952
|
-
let
|
|
953
|
-
return e.slice(
|
|
940
|
+
...c,
|
|
941
|
+
d,
|
|
942
|
+
n
|
|
943
|
+
]), r(() => {
|
|
944
|
+
l > m && u(m);
|
|
945
|
+
}, [l, m]), {
|
|
946
|
+
currentPage: l,
|
|
947
|
+
pageSize: d,
|
|
948
|
+
totalPages: m,
|
|
949
|
+
totalCount: p,
|
|
950
|
+
pagedItems: a(() => {
|
|
951
|
+
if (!n) return e;
|
|
952
|
+
let t = (l - 1) * d;
|
|
953
|
+
return e.slice(t, t + d);
|
|
954
954
|
}, [
|
|
955
955
|
e,
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
956
|
+
n,
|
|
957
|
+
l,
|
|
958
|
+
d
|
|
959
959
|
]),
|
|
960
|
-
goToPage:
|
|
961
|
-
let t = Math.min(Math.max(1, e),
|
|
962
|
-
|
|
960
|
+
goToPage: t((e) => {
|
|
961
|
+
let t = Math.min(Math.max(1, e), m);
|
|
962
|
+
u(t), o?.(t, d);
|
|
963
963
|
}, [
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
964
|
+
m,
|
|
965
|
+
d,
|
|
966
|
+
o
|
|
967
967
|
]),
|
|
968
|
-
changePageSize:
|
|
969
|
-
|
|
970
|
-
}, [
|
|
968
|
+
changePageSize: t((e) => {
|
|
969
|
+
f(e), u(1), o?.(1, e);
|
|
970
|
+
}, [o])
|
|
971
971
|
};
|
|
972
972
|
}
|
|
973
973
|
//#endregion
|
|
974
974
|
//#region src/DataTable/hooks/usePinnedColumns.ts
|
|
975
|
-
function
|
|
976
|
-
let [
|
|
975
|
+
function Te(e, n) {
|
|
976
|
+
let [r, i] = s(() => ie(e));
|
|
977
977
|
return {
|
|
978
|
-
pinnedColumns:
|
|
979
|
-
togglePin:
|
|
980
|
-
let
|
|
981
|
-
a ? o[e] = a : delete o[e],
|
|
982
|
-
}, [
|
|
978
|
+
pinnedColumns: r,
|
|
979
|
+
togglePin: t((e) => {
|
|
980
|
+
let t = r[e], a = t ? t === "left" ? "right" : void 0 : "left", o = { ...r };
|
|
981
|
+
a ? o[e] = a : delete o[e], i(o), n?.(e, !!a, a);
|
|
982
|
+
}, [r, n])
|
|
983
983
|
};
|
|
984
984
|
}
|
|
985
985
|
//#endregion
|
|
986
986
|
//#region src/DataTable/hooks/useRowGrouping.ts
|
|
987
|
-
function
|
|
988
|
-
let [
|
|
987
|
+
function Ee(e, n) {
|
|
988
|
+
let [r, i] = s(e), [a, o] = s({});
|
|
989
989
|
return {
|
|
990
|
-
groupedColumns:
|
|
991
|
-
expandedGroups:
|
|
992
|
-
addGroup:
|
|
993
|
-
if (!e ||
|
|
994
|
-
let
|
|
995
|
-
|
|
996
|
-
}, [
|
|
997
|
-
removeGroup:
|
|
998
|
-
let
|
|
999
|
-
|
|
1000
|
-
}, [
|
|
1001
|
-
toggleGroupExpansion:
|
|
1002
|
-
|
|
990
|
+
groupedColumns: r,
|
|
991
|
+
expandedGroups: a,
|
|
992
|
+
addGroup: t((e) => {
|
|
993
|
+
if (!e || r.includes(e)) return;
|
|
994
|
+
let t = [...r, e];
|
|
995
|
+
i(t), n?.(t);
|
|
996
|
+
}, [r, n]),
|
|
997
|
+
removeGroup: t((e) => {
|
|
998
|
+
let t = r.filter((t) => t !== e);
|
|
999
|
+
i(t), o({}), n?.(t);
|
|
1000
|
+
}, [r, n]),
|
|
1001
|
+
toggleGroupExpansion: t((e) => {
|
|
1002
|
+
o((t) => ({
|
|
1003
1003
|
...t,
|
|
1004
1004
|
[e]: t[e] === !1
|
|
1005
1005
|
}));
|
|
@@ -1008,35 +1008,35 @@ function Oe(e, t) {
|
|
|
1008
1008
|
}
|
|
1009
1009
|
//#endregion
|
|
1010
1010
|
//#region src/DataTable/hooks/useSettingsMenu.ts
|
|
1011
|
-
function
|
|
1012
|
-
let [
|
|
1013
|
-
return
|
|
1014
|
-
isOpen:
|
|
1015
|
-
position:
|
|
1016
|
-
active:
|
|
1011
|
+
function De(e) {
|
|
1012
|
+
let [n, r] = s(!1), i = o(null), a = o(null), c = t(() => r((e) => !e), []);
|
|
1013
|
+
return J(n, () => [i.current, a.current], t(() => r(!1), [])), {
|
|
1014
|
+
isOpen: n,
|
|
1015
|
+
position: q({
|
|
1016
|
+
active: n,
|
|
1017
1017
|
rootRef: e,
|
|
1018
|
-
getAnchor: () =>
|
|
1018
|
+
getAnchor: () => a.current,
|
|
1019
1019
|
compute: (e, t) => ({
|
|
1020
1020
|
top: e.bottom - t.top + 4,
|
|
1021
1021
|
right: t.right - e.right
|
|
1022
1022
|
})
|
|
1023
1023
|
}),
|
|
1024
|
-
menuRef:
|
|
1025
|
-
buttonRef:
|
|
1026
|
-
toggle:
|
|
1024
|
+
menuRef: i,
|
|
1025
|
+
buttonRef: a,
|
|
1026
|
+
toggle: c
|
|
1027
1027
|
};
|
|
1028
1028
|
}
|
|
1029
1029
|
//#endregion
|
|
1030
1030
|
//#region src/DataTable/hooks/useSorting.ts
|
|
1031
|
-
function
|
|
1032
|
-
let [e,
|
|
1031
|
+
function Oe() {
|
|
1032
|
+
let [e, n] = s({
|
|
1033
1033
|
key: null,
|
|
1034
1034
|
direction: null
|
|
1035
1035
|
});
|
|
1036
1036
|
return {
|
|
1037
1037
|
sortState: e,
|
|
1038
|
-
handleSort:
|
|
1039
|
-
|
|
1038
|
+
handleSort: t((e) => {
|
|
1039
|
+
n((t) => {
|
|
1040
1040
|
let n = "asc";
|
|
1041
1041
|
return t.key === e && (t.direction === "asc" ? n = "desc" : t.direction === "desc" && (n = null)), {
|
|
1042
1042
|
key: n ? e : null,
|
|
@@ -1048,141 +1048,141 @@ function Ae() {
|
|
|
1048
1048
|
}
|
|
1049
1049
|
//#endregion
|
|
1050
1050
|
//#region src/DataTable/hooks/useVirtualRows.ts
|
|
1051
|
-
function
|
|
1052
|
-
let [
|
|
1053
|
-
return
|
|
1051
|
+
function ke({ containerRef: e, totalRowCount: t, rowHeight: n, overscan: i }) {
|
|
1052
|
+
let [o, c] = s(0), [l, u] = s(0);
|
|
1053
|
+
return r(() => {
|
|
1054
1054
|
let t = e.current;
|
|
1055
1055
|
if (!t) return;
|
|
1056
|
-
let n = () =>
|
|
1057
|
-
|
|
1056
|
+
let n = () => c(t.scrollTop);
|
|
1057
|
+
u(t.clientHeight), c(t.scrollTop), t.addEventListener("scroll", n, { passive: !0 });
|
|
1058
1058
|
let r;
|
|
1059
|
-
return typeof ResizeObserver < "u" && (r = new ResizeObserver(() =>
|
|
1059
|
+
return typeof ResizeObserver < "u" && (r = new ResizeObserver(() => u(t.clientHeight)), r.observe(t)), () => {
|
|
1060
1060
|
t.removeEventListener("scroll", n), r?.disconnect();
|
|
1061
1061
|
};
|
|
1062
|
-
}, [e]),
|
|
1063
|
-
if (
|
|
1062
|
+
}, [e]), a(() => {
|
|
1063
|
+
if (l === 0 || n === "auto") return {
|
|
1064
1064
|
startIndex: 0,
|
|
1065
1065
|
endIndex: t,
|
|
1066
1066
|
topSpacerHeight: 0,
|
|
1067
1067
|
bottomSpacerHeight: 0
|
|
1068
1068
|
};
|
|
1069
|
-
let e = n > 0 ? n : 1,
|
|
1069
|
+
let e = n > 0 ? n : 1, r = Math.max(0, t - 1), a = Math.min(r, Math.floor(o / e)), s = Math.ceil(l / e) + 1, c = Math.max(0, a - i), u = Math.min(t, a + s + i);
|
|
1070
1070
|
return {
|
|
1071
|
-
startIndex:
|
|
1071
|
+
startIndex: c,
|
|
1072
1072
|
endIndex: u,
|
|
1073
|
-
topSpacerHeight:
|
|
1073
|
+
topSpacerHeight: c * e,
|
|
1074
1074
|
bottomSpacerHeight: (t - u) * e
|
|
1075
1075
|
};
|
|
1076
1076
|
}, [
|
|
1077
|
-
i,
|
|
1078
1077
|
o,
|
|
1078
|
+
l,
|
|
1079
1079
|
t,
|
|
1080
1080
|
n,
|
|
1081
|
-
|
|
1081
|
+
i
|
|
1082
1082
|
]);
|
|
1083
1083
|
}
|
|
1084
1084
|
//#endregion
|
|
1085
1085
|
//#region src/DataTable/hooks/useDataTableState.ts
|
|
1086
|
-
function
|
|
1087
|
-
let
|
|
1086
|
+
function Y({ columns: e, data: n, rowKey: i, actions: c, isLoading: l, groupBy: u = !1, defaultGroupBy: d = k, onPinChange: f, onGroupChange: p, pinnedBottomRowData: m = re, pinnedRowClassName: h, rowHeight: g = 40, overscan: ee = 8, onColumnResize: _, onColumnReorder: v, rowClassRules: y, onRowClick: b, rowSpanColumns: x, controlPanel: S = !1, defaultDisplayPinnedIcon: C = !0, defaultHiddenColumns: w = k, onColumnVisibilityChange: T, pagination: E = !1, defaultPageSize: D = 10, pageSizeOptions: O = ne, onPageChange: te }) {
|
|
1087
|
+
let j = o(null), ie = o(null), M = a(() => A(e), [e]), N = a(() => {
|
|
1088
1088
|
let e = /* @__PURE__ */ new Map();
|
|
1089
|
-
return
|
|
1090
|
-
}, [
|
|
1089
|
+
return M.forEach((t) => e.set(t.key, t)), e;
|
|
1090
|
+
}, [M]), { pinnedColumns: P, togglePin: F } = Te(M, f), { columnWidths: I, isResizingRef: L, startResize: se } = Se(_), { reorderedColumns: R, handleDragStart: ce, handleDragEnd: le, handleDrop: ue } = xe({
|
|
1091
1091
|
columns: e,
|
|
1092
|
-
pinnedColumns:
|
|
1093
|
-
isResizingRef:
|
|
1094
|
-
onColumnReorder:
|
|
1095
|
-
}), z =
|
|
1096
|
-
defaultHiddenColumns:
|
|
1097
|
-
defaultDisplayPinnedIcon:
|
|
1092
|
+
pinnedColumns: P,
|
|
1093
|
+
isResizingRef: L,
|
|
1094
|
+
onColumnReorder: v
|
|
1095
|
+
}), z = Ce({
|
|
1096
|
+
defaultHiddenColumns: w,
|
|
1097
|
+
defaultDisplayPinnedIcon: C,
|
|
1098
1098
|
onColumnVisibilityChange: T
|
|
1099
|
-
}), { hiddenColumns: B } = z, V =
|
|
1100
|
-
|
|
1101
|
-
let
|
|
1102
|
-
|
|
1103
|
-
}, [
|
|
1099
|
+
}), { hiddenColumns: B } = z, V = Ee(d, p), { groupedColumns: H, expandedGroups: U } = V, [W, G] = s(u);
|
|
1100
|
+
r(() => G(u), [u]);
|
|
1101
|
+
let pe = t(() => G((e) => !e), []), { resetControlPanelDefaults: me } = z, he = t(() => {
|
|
1102
|
+
me(), G(u);
|
|
1103
|
+
}, [me, u]), ge = W, K = ge ? H : k, q = K.length > 0, J = !!c, Y = a(() => A(R).filter((e) => !K.includes(e.key) && !B.includes(e.key)), [
|
|
1104
1104
|
R,
|
|
1105
|
-
|
|
1105
|
+
K,
|
|
1106
1106
|
B
|
|
1107
|
-
]),
|
|
1107
|
+
]), Ae = a(() => ae(R, K, B), [
|
|
1108
1108
|
R,
|
|
1109
|
-
|
|
1109
|
+
K,
|
|
1110
1110
|
B
|
|
1111
|
-
]),
|
|
1112
|
-
visibleLeafColumns:
|
|
1113
|
-
pinnedColumns:
|
|
1114
|
-
columnWidths:
|
|
1115
|
-
hasGroups:
|
|
1116
|
-
hasActions:
|
|
1111
|
+
]), je = a(() => oe({
|
|
1112
|
+
visibleLeafColumns: Y,
|
|
1113
|
+
pinnedColumns: P,
|
|
1114
|
+
columnWidths: I,
|
|
1115
|
+
hasGroups: q,
|
|
1116
|
+
hasActions: J
|
|
1117
1117
|
}), [
|
|
1118
|
-
|
|
1118
|
+
Y,
|
|
1119
|
+
P,
|
|
1119
1120
|
I,
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
return !Y.key || !Y.direction ? e : me(e, Y.key, Y.direction, F.get(Y.key));
|
|
1121
|
+
q,
|
|
1122
|
+
J
|
|
1123
|
+
]), X = be({
|
|
1124
|
+
data: n,
|
|
1125
|
+
columnsByKey: N,
|
|
1126
|
+
gridRootRef: j
|
|
1127
|
+
}), { sortState: Z, handleSort: Me } = Oe(), Q = we({
|
|
1128
|
+
items: a(() => {
|
|
1129
|
+
let e = de(n, X.selectedFilters, N);
|
|
1130
|
+
return !Z.key || !Z.direction ? e : fe(e, Z.key, Z.direction, N.get(Z.key));
|
|
1131
1131
|
}, [
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1132
|
+
n,
|
|
1133
|
+
X.selectedFilters,
|
|
1134
|
+
Z,
|
|
1135
|
+
N
|
|
1136
1136
|
]),
|
|
1137
1137
|
enabled: E,
|
|
1138
1138
|
defaultPageSize: D,
|
|
1139
|
-
onPageChange:
|
|
1140
|
-
resetOn: [
|
|
1141
|
-
}),
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
]),
|
|
1146
|
-
containerRef:
|
|
1147
|
-
totalRowCount:
|
|
1148
|
-
rowHeight:
|
|
1149
|
-
overscan:
|
|
1150
|
-
}),
|
|
1151
|
-
|
|
1152
|
-
Q,
|
|
1153
|
-
Le
|
|
1154
|
-
]), Be = v(() => xe($, S, F, Q), [
|
|
1139
|
+
onPageChange: te,
|
|
1140
|
+
resetOn: [X.selectedFilters, Z]
|
|
1141
|
+
}), Ne = a(() => _e(Q.pagedItems, K, N), [
|
|
1142
|
+
Q.pagedItems,
|
|
1143
|
+
K,
|
|
1144
|
+
N
|
|
1145
|
+
]), Pe = a(() => ve(Ne, U), [Ne, U]), Fe = Pe.length, { startIndex: $, endIndex: Ie, topSpacerHeight: Le, bottomSpacerHeight: Re } = ke({
|
|
1146
|
+
containerRef: ie,
|
|
1147
|
+
totalRowCount: Fe,
|
|
1148
|
+
rowHeight: g,
|
|
1149
|
+
overscan: ee
|
|
1150
|
+
}), ze = a(() => Pe.slice($, Ie), [
|
|
1151
|
+
Pe,
|
|
1155
1152
|
$,
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1153
|
+
Ie
|
|
1154
|
+
]), Be = a(() => ye(ze, x, N, $), [
|
|
1155
|
+
ze,
|
|
1156
|
+
x,
|
|
1157
|
+
N,
|
|
1158
|
+
$
|
|
1159
|
+
]), Ve = De(j), He = Y.length + +!!J + +!!q;
|
|
1160
1160
|
return {
|
|
1161
|
-
gridRootRef:
|
|
1162
|
-
tableWrapRef:
|
|
1163
|
-
rowKey:
|
|
1164
|
-
actions:
|
|
1165
|
-
isLoading: !!
|
|
1166
|
-
groupBy:
|
|
1167
|
-
showGroupBy:
|
|
1168
|
-
toggleShowGroupBy:
|
|
1169
|
-
controlPanel:
|
|
1170
|
-
rowHeight:
|
|
1171
|
-
rowSpanColumns:
|
|
1172
|
-
rowClassRules:
|
|
1173
|
-
onRowClick:
|
|
1174
|
-
pinnedBottomRowData:
|
|
1175
|
-
pinnedRowClassName:
|
|
1161
|
+
gridRootRef: j,
|
|
1162
|
+
tableWrapRef: ie,
|
|
1163
|
+
rowKey: i,
|
|
1164
|
+
actions: c,
|
|
1165
|
+
isLoading: !!l,
|
|
1166
|
+
groupBy: ge,
|
|
1167
|
+
showGroupBy: W,
|
|
1168
|
+
toggleShowGroupBy: pe,
|
|
1169
|
+
controlPanel: S,
|
|
1170
|
+
rowHeight: g,
|
|
1171
|
+
rowSpanColumns: x,
|
|
1172
|
+
rowClassRules: y,
|
|
1173
|
+
onRowClick: b,
|
|
1174
|
+
pinnedBottomRowData: m,
|
|
1175
|
+
pinnedRowClassName: h,
|
|
1176
1176
|
pageSizeOptions: O,
|
|
1177
1177
|
paginationEnabled: E,
|
|
1178
|
-
initialLeafColumns:
|
|
1179
|
-
columnsByKey:
|
|
1180
|
-
visibleLeafColumns:
|
|
1181
|
-
headerRows:
|
|
1182
|
-
pinnedColumns:
|
|
1183
|
-
pinOffsets:
|
|
1184
|
-
columnWidths:
|
|
1185
|
-
togglePin:
|
|
1178
|
+
initialLeafColumns: M,
|
|
1179
|
+
columnsByKey: N,
|
|
1180
|
+
visibleLeafColumns: Y,
|
|
1181
|
+
headerRows: Ae,
|
|
1182
|
+
pinnedColumns: P,
|
|
1183
|
+
pinOffsets: je,
|
|
1184
|
+
columnWidths: I,
|
|
1185
|
+
togglePin: F,
|
|
1186
1186
|
startResize: se,
|
|
1187
1187
|
handleDragStart: ce,
|
|
1188
1188
|
handleDragEnd: le,
|
|
@@ -1191,70 +1191,101 @@ function K({ columns: e, data: t, rowKey: n, actions: r, isLoading: i, groupBy:
|
|
|
1191
1191
|
displayPinnedIcon: z.displayPinnedIcon,
|
|
1192
1192
|
toggleColumnVisibility: z.toggleColumnVisibility,
|
|
1193
1193
|
toggleDisplayPinnedIcon: z.toggleDisplayPinnedIcon,
|
|
1194
|
-
resetControlPanelDefaults:
|
|
1194
|
+
resetControlPanelDefaults: he,
|
|
1195
1195
|
settingsMenu: Ve,
|
|
1196
|
-
groupedColumns:
|
|
1197
|
-
expandedGroups:
|
|
1196
|
+
groupedColumns: H,
|
|
1197
|
+
expandedGroups: U,
|
|
1198
1198
|
addGroup: V.addGroup,
|
|
1199
1199
|
removeGroup: V.removeGroup,
|
|
1200
1200
|
toggleGroupExpansion: V.toggleGroupExpansion,
|
|
1201
|
-
hasGroups:
|
|
1202
|
-
hasActions:
|
|
1203
|
-
sortState:
|
|
1204
|
-
handleSort:
|
|
1205
|
-
filters:
|
|
1206
|
-
currentPage:
|
|
1207
|
-
pageSize:
|
|
1208
|
-
totalPages:
|
|
1209
|
-
totalCount:
|
|
1210
|
-
goToPage:
|
|
1211
|
-
changePageSize:
|
|
1212
|
-
visibleRows:
|
|
1213
|
-
startIndex:
|
|
1214
|
-
totalRowCount:
|
|
1215
|
-
topSpacerHeight:
|
|
1216
|
-
bottomSpacerHeight:
|
|
1201
|
+
hasGroups: q,
|
|
1202
|
+
hasActions: J,
|
|
1203
|
+
sortState: Z,
|
|
1204
|
+
handleSort: Me,
|
|
1205
|
+
filters: X,
|
|
1206
|
+
currentPage: Q.currentPage,
|
|
1207
|
+
pageSize: Q.pageSize,
|
|
1208
|
+
totalPages: Q.totalPages,
|
|
1209
|
+
totalCount: Q.totalCount,
|
|
1210
|
+
goToPage: Q.goToPage,
|
|
1211
|
+
changePageSize: Q.changePageSize,
|
|
1212
|
+
visibleRows: ze,
|
|
1213
|
+
startIndex: $,
|
|
1214
|
+
totalRowCount: Fe,
|
|
1215
|
+
topSpacerHeight: Le,
|
|
1216
|
+
bottomSpacerHeight: Re,
|
|
1217
1217
|
rowSpanInfo: Be,
|
|
1218
1218
|
totalColumnsCount: He
|
|
1219
1219
|
};
|
|
1220
1220
|
}
|
|
1221
1221
|
//#endregion
|
|
1222
1222
|
//#region src/DataTable/DataTable.tsx
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1223
|
+
var Ae = [
|
|
1224
|
+
"height",
|
|
1225
|
+
"maxHeight",
|
|
1226
|
+
"minHeight"
|
|
1227
|
+
];
|
|
1228
|
+
function je(e, t) {
|
|
1229
|
+
let [n, r] = s(0);
|
|
1230
|
+
return i(() => {
|
|
1231
|
+
let n = t ? e.current?.firstElementChild : null;
|
|
1232
|
+
if (!(n instanceof HTMLElement)) {
|
|
1233
|
+
r(0);
|
|
1234
|
+
return;
|
|
1235
|
+
}
|
|
1236
|
+
let i = () => {
|
|
1237
|
+
let e = parseFloat(getComputedStyle(n.nextElementSibling ?? n).marginTop) || 0;
|
|
1238
|
+
r(n.offsetHeight + e);
|
|
1239
|
+
};
|
|
1240
|
+
i();
|
|
1241
|
+
let a = new ResizeObserver(i);
|
|
1242
|
+
return a.observe(n), () => a.disconnect();
|
|
1243
|
+
}, [e, t]), n;
|
|
1244
|
+
}
|
|
1245
|
+
function X(e, t) {
|
|
1246
|
+
if (!e || t <= 0) return e;
|
|
1247
|
+
let n = { ...e };
|
|
1248
|
+
for (let r of Ae) {
|
|
1249
|
+
let i = e[r];
|
|
1250
|
+
i == null || i === "" || i === "auto" || i === "none" || (n[r] = `calc(${typeof i == "number" ? `${i}px` : String(i)} - ${t}px)`);
|
|
1251
|
+
}
|
|
1252
|
+
return n;
|
|
1253
|
+
}
|
|
1254
|
+
function Z(e) {
|
|
1255
|
+
let t = Y(e), { containerStyle: n, tableStyle: r, bordered: i = !1 } = e, a = X(n, je(t.gridRootRef, !!t.groupBy));
|
|
1256
|
+
return /* @__PURE__ */ x(T, {
|
|
1226
1257
|
value: t,
|
|
1227
1258
|
children: /* @__PURE__ */ S("div", {
|
|
1228
1259
|
ref: t.gridRootRef,
|
|
1229
1260
|
className: "flexi-root",
|
|
1230
1261
|
children: [
|
|
1231
|
-
t.groupBy && /* @__PURE__ */ x(
|
|
1262
|
+
t.groupBy && /* @__PURE__ */ x(O, {}),
|
|
1232
1263
|
/* @__PURE__ */ S("div", {
|
|
1233
1264
|
ref: t.tableWrapRef,
|
|
1234
1265
|
className: "flexi-table-wrap",
|
|
1235
|
-
style:
|
|
1266
|
+
style: a,
|
|
1236
1267
|
children: [t.controlPanel && /* @__PURE__ */ x("div", {
|
|
1237
1268
|
className: "flexi-settings-corner",
|
|
1238
1269
|
children: /* @__PURE__ */ x("div", {
|
|
1239
1270
|
className: "flexi-settings-corner-inner",
|
|
1240
|
-
children: /* @__PURE__ */ x(
|
|
1271
|
+
children: /* @__PURE__ */ x(ue, {})
|
|
1241
1272
|
})
|
|
1242
1273
|
}), /* @__PURE__ */ S("table", {
|
|
1243
|
-
className:
|
|
1274
|
+
className: D("flexi-table", i && "flexi-table--bordered"),
|
|
1244
1275
|
style: r,
|
|
1245
1276
|
children: [
|
|
1246
|
-
/* @__PURE__ */ x(
|
|
1247
|
-
/* @__PURE__ */ x(
|
|
1248
|
-
/* @__PURE__ */ x(
|
|
1249
|
-
/* @__PURE__ */ x(
|
|
1277
|
+
/* @__PURE__ */ x(me, {}),
|
|
1278
|
+
/* @__PURE__ */ x(K, {}),
|
|
1279
|
+
/* @__PURE__ */ x(pe, {}),
|
|
1280
|
+
/* @__PURE__ */ x(le, {})
|
|
1250
1281
|
]
|
|
1251
1282
|
})]
|
|
1252
1283
|
}),
|
|
1253
|
-
/* @__PURE__ */ x(
|
|
1254
|
-
t.paginationEnabled && /* @__PURE__ */ x(
|
|
1284
|
+
/* @__PURE__ */ x(z, {}),
|
|
1285
|
+
t.paginationEnabled && /* @__PURE__ */ x(te, {})
|
|
1255
1286
|
]
|
|
1256
1287
|
})
|
|
1257
1288
|
});
|
|
1258
1289
|
}
|
|
1259
1290
|
//#endregion
|
|
1260
|
-
export {
|
|
1291
|
+
export { Z as DataTable };
|