flexi-datagrid 1.2.9 → 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/README.md +4 -3
- package/dist/DataTable/constants.d.ts +1 -1
- package/dist/DataTable/hooks/useDataTableState.d.ts +3 -1
- package/dist/DataTable/hooks/useVirtualRows.d.ts +1 -1
- package/dist/DataTable/types.d.ts +2 -1
- package/dist/flexi-datagrid.css +1 -1
- package/dist/index.es.js +503 -459
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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 =
|
|
6
|
+
var w = e(null);
|
|
7
7
|
function T({ value: e, children: t }) {
|
|
8
8
|
return /* @__PURE__ */ x(w.Provider, {
|
|
9
9
|
value: e,
|
|
@@ -11,7 +11,7 @@ function T({ value: e, children: t }) {
|
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
function E() {
|
|
14
|
-
let 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
|
}
|
|
@@ -21,7 +21,7 @@ var D = (...e) => e.filter(Boolean).join(" ");
|
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/DataTable/components/GroupZone.tsx
|
|
23
23
|
function O() {
|
|
24
|
-
let { groupedColumns: e, columnsByKey: t, addGroup: n, removeGroup: r } = E(), [i, a] =
|
|
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);
|
|
@@ -47,7 +47,7 @@ function O() {
|
|
|
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 O() {
|
|
|
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 k() {
|
|
|
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 k() {
|
|
|
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 k() {
|
|
|
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 k() {
|
|
|
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
|
-
],
|
|
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 ee = [
|
|
|
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 ee = [
|
|
|
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 ee = [
|
|
|
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 ee = [
|
|
|
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",
|
|
@@ -241,7 +241,7 @@ var ee = [
|
|
|
241
241
|
zIndex: 10
|
|
242
242
|
}
|
|
243
243
|
});
|
|
244
|
-
function
|
|
244
|
+
function L({ children: e }) {
|
|
245
245
|
return /* @__PURE__ */ x("td", {
|
|
246
246
|
className: "flexi-actions-cell",
|
|
247
247
|
style: {
|
|
@@ -254,8 +254,8 @@ function R({ 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 ae({ 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,19 +285,19 @@ function ae({ 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
|
|
293
|
+
function R({ record: e, rowIndex: t, className: n }) {
|
|
294
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
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;
|
|
@@ -305,18 +305,18 @@ function oe({ record: e, rowIndex: t, className: n }) {
|
|
|
305
305
|
return /* @__PURE__ */ x("td", {
|
|
306
306
|
rowSpan: typeof n == "number" ? n : void 0,
|
|
307
307
|
className: D("flexi-cell", !!l[t.key] && "flexi-cell--pinned", t.className),
|
|
308
|
-
style:
|
|
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
|
|
312
312
|
})
|
|
313
313
|
}, t.key);
|
|
314
314
|
}),
|
|
315
|
-
a && o && /* @__PURE__ */ x(
|
|
315
|
+
a && o && /* @__PURE__ */ x(L, { children: o(e) })
|
|
316
316
|
]
|
|
317
317
|
});
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function ce({ record: e, index: t, className: n }) {
|
|
320
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`,
|
|
@@ -326,29 +326,29 @@ function se({ record: e, index: t, className: n }) {
|
|
|
326
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
333
|
className: D("flexi-cell", !!c[t.key] && "flexi-cell--pinned", t.className),
|
|
334
|
-
style:
|
|
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
|
|
338
338
|
})
|
|
339
339
|
}, t.key);
|
|
340
340
|
}),
|
|
341
|
-
i && a && /* @__PURE__ */ x(
|
|
341
|
+
i && a && /* @__PURE__ */ x(L, { children: a(e) })
|
|
342
342
|
]
|
|
343
343
|
});
|
|
344
344
|
}
|
|
345
345
|
//#endregion
|
|
346
346
|
//#region src/DataTable/components/PinnedBottomBody.tsx
|
|
347
|
-
function
|
|
347
|
+
function le() {
|
|
348
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,7 +357,7 @@ function z() {
|
|
|
357
357
|
}
|
|
358
358
|
//#endregion
|
|
359
359
|
//#region src/DataTable/components/SettingsMenu.tsx
|
|
360
|
-
function
|
|
360
|
+
function ue() {
|
|
361
361
|
let { settingsMenu: e } = E();
|
|
362
362
|
return /* @__PURE__ */ x("button", {
|
|
363
363
|
type: "button",
|
|
@@ -367,12 +367,12 @@ function B() {
|
|
|
367
367
|
},
|
|
368
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,
|
|
375
|
-
return !t.isOpen || !t.position || !
|
|
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
|
+
return !t.isOpen || !t.position || !u ? null : C(/* @__PURE__ */ S("div", {
|
|
376
376
|
ref: t.menuRef,
|
|
377
377
|
className: "flexi-settings-menu",
|
|
378
378
|
style: {
|
|
@@ -383,21 +383,36 @@ function V() {
|
|
|
383
383
|
children: [
|
|
384
384
|
/* @__PURE__ */ S("div", {
|
|
385
385
|
className: "flexi-settings-section",
|
|
386
|
-
children: [
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
386
|
+
children: [
|
|
387
|
+
/* @__PURE__ */ x("span", {
|
|
388
|
+
className: "flexi-settings-heading",
|
|
389
|
+
children: "Action Icons"
|
|
390
|
+
}),
|
|
391
|
+
/* @__PURE__ */ S("label", {
|
|
392
|
+
className: "flexi-filter-option",
|
|
393
|
+
children: [/* @__PURE__ */ x("input", {
|
|
394
|
+
type: "checkbox",
|
|
395
|
+
className: "flexi-checkbox",
|
|
396
|
+
checked: n,
|
|
397
|
+
onChange: r
|
|
398
|
+
}), /* @__PURE__ */ x("span", {
|
|
399
|
+
className: "flexi-filter-option-text",
|
|
400
|
+
children: "Show pin icon on hover"
|
|
401
|
+
})]
|
|
402
|
+
}),
|
|
403
|
+
/* @__PURE__ */ S("label", {
|
|
404
|
+
className: "flexi-filter-option",
|
|
405
|
+
children: [/* @__PURE__ */ x("input", {
|
|
406
|
+
type: "checkbox",
|
|
407
|
+
className: "flexi-checkbox",
|
|
408
|
+
checked: i,
|
|
409
|
+
onChange: a
|
|
410
|
+
}), /* @__PURE__ */ x("span", {
|
|
411
|
+
className: "flexi-filter-option-text",
|
|
412
|
+
children: "Group By"
|
|
413
|
+
})]
|
|
414
|
+
})
|
|
415
|
+
]
|
|
401
416
|
}),
|
|
402
417
|
/* @__PURE__ */ x("div", { className: "flexi-settings-divider" }),
|
|
403
418
|
/* @__PURE__ */ S("div", {
|
|
@@ -405,13 +420,13 @@ function V() {
|
|
|
405
420
|
children: [/* @__PURE__ */ x("span", {
|
|
406
421
|
className: "flexi-settings-heading",
|
|
407
422
|
children: "Columns"
|
|
408
|
-
}),
|
|
423
|
+
}), o.map((e) => /* @__PURE__ */ S("label", {
|
|
409
424
|
className: "flexi-filter-option",
|
|
410
425
|
children: [/* @__PURE__ */ x("input", {
|
|
411
426
|
type: "checkbox",
|
|
412
427
|
className: "flexi-checkbox",
|
|
413
|
-
checked: !
|
|
414
|
-
onChange: () =>
|
|
428
|
+
checked: !s.includes(e.key),
|
|
429
|
+
onChange: () => c(e.key)
|
|
415
430
|
}), /* @__PURE__ */ x("span", {
|
|
416
431
|
className: "flexi-filter-option-text",
|
|
417
432
|
children: e.header
|
|
@@ -421,46 +436,46 @@ function V() {
|
|
|
421
436
|
/* @__PURE__ */ x("div", { className: "flexi-settings-divider" }),
|
|
422
437
|
/* @__PURE__ */ S("button", {
|
|
423
438
|
type: "button",
|
|
424
|
-
onClick:
|
|
439
|
+
onClick: l,
|
|
425
440
|
className: "flexi-settings-reset",
|
|
426
441
|
title: "Reset pin icon visibility and hidden columns to their defaults",
|
|
427
|
-
children: [/* @__PURE__ */ x(
|
|
442
|
+
children: [/* @__PURE__ */ x(v, { className: "flexi-icon-sm" }), /* @__PURE__ */ x("span", { children: "Reset to defaults" })]
|
|
428
443
|
})
|
|
429
444
|
]
|
|
430
|
-
}),
|
|
445
|
+
}), u);
|
|
431
446
|
}
|
|
432
447
|
//#endregion
|
|
433
448
|
//#region src/DataTable/utils/records.ts
|
|
434
|
-
var
|
|
449
|
+
var B = (e, t, n) => n?.getValue ? n.getValue(e) : e[t], V = (e, t) => {
|
|
435
450
|
let n = typeof t == "function" ? t(e) : e[t];
|
|
436
451
|
return n == null ? void 0 : String(n);
|
|
437
|
-
},
|
|
452
|
+
}, H = (e, t, n) => {
|
|
438
453
|
if (!n) return;
|
|
439
454
|
let r;
|
|
440
455
|
for (let i in n) n[i](e, t) && (r = r ? `${r} ${i}` : i);
|
|
441
456
|
return r;
|
|
442
|
-
},
|
|
443
|
-
let r = e.map((e) =>
|
|
457
|
+
}, U = (e, t, n) => {
|
|
458
|
+
let r = e.map((e) => B(e, t, n));
|
|
444
459
|
return Array.from(new Set(r)).filter((e) => e != null);
|
|
445
|
-
},
|
|
460
|
+
}, de = (e, t, n) => {
|
|
446
461
|
let r = Object.entries(t).filter(([, e]) => e && e.length > 0);
|
|
447
|
-
return r.length === 0 ? e : e.filter((e) => r.every(([t, r]) => r.includes(
|
|
448
|
-
},
|
|
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, {
|
|
449
464
|
numeric: !0,
|
|
450
465
|
sensitivity: "base"
|
|
451
|
-
}),
|
|
452
|
-
let a =
|
|
466
|
+
}), fe = (e, t, n, r) => [...e].sort((e, i) => {
|
|
467
|
+
let a = B(e, t, r), o = B(i, t, r);
|
|
453
468
|
if (a === o) return 0;
|
|
454
|
-
let s =
|
|
469
|
+
let s = W(a), c = W(o);
|
|
455
470
|
if (s && c) return 0;
|
|
456
471
|
if (s) return 1;
|
|
457
472
|
if (c) return -1;
|
|
458
|
-
let l =
|
|
473
|
+
let l = G(a, o);
|
|
459
474
|
return n === "asc" ? l : -l;
|
|
460
475
|
});
|
|
461
476
|
//#endregion
|
|
462
477
|
//#region src/DataTable/components/TableBody.tsx
|
|
463
|
-
function
|
|
478
|
+
function pe() {
|
|
464
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);
|
|
465
480
|
return e || r === 0 ? /* @__PURE__ */ x("tbody", {
|
|
466
481
|
className: "flexi-tbody",
|
|
@@ -486,11 +501,11 @@ function ue() {
|
|
|
486
501
|
}),
|
|
487
502
|
t.map((e, t) => {
|
|
488
503
|
let r = n + t;
|
|
489
|
-
return e.kind === "group" ? /* @__PURE__ */ x(
|
|
504
|
+
return e.kind === "group" ? /* @__PURE__ */ x(se, { node: e }, `group-header-${e.path}-${r}`) : /* @__PURE__ */ x(R, {
|
|
490
505
|
record: e.record,
|
|
491
506
|
rowIndex: r,
|
|
492
|
-
className:
|
|
493
|
-
},
|
|
507
|
+
className: H(e.record, r, c)
|
|
508
|
+
}, V(e.record, s) ?? `row-${r}`);
|
|
494
509
|
}),
|
|
495
510
|
a > 0 && /* @__PURE__ */ x("tr", {
|
|
496
511
|
"aria-hidden": "true",
|
|
@@ -509,20 +524,20 @@ function ue() {
|
|
|
509
524
|
}
|
|
510
525
|
//#endregion
|
|
511
526
|
//#region src/DataTable/components/TableColGroup.tsx
|
|
512
|
-
function
|
|
527
|
+
function me() {
|
|
513
528
|
let { hasGroups: e, hasActions: t, visibleLeafColumns: n, columnWidths: r } = E();
|
|
514
529
|
return /* @__PURE__ */ S("colgroup", { children: [
|
|
515
530
|
e && /* @__PURE__ */ x("col", { style: { width: "48px" } }),
|
|
516
531
|
n.map((e) => /* @__PURE__ */ x("col", { style: {
|
|
517
532
|
...e.style,
|
|
518
|
-
width:
|
|
533
|
+
width: P(e, r)
|
|
519
534
|
} }, e.key)),
|
|
520
535
|
t && /* @__PURE__ */ x("col", { style: { width: "100px" } })
|
|
521
536
|
] });
|
|
522
537
|
}
|
|
523
538
|
//#endregion
|
|
524
539
|
//#region src/DataTable/components/FilterDropdown.tsx
|
|
525
|
-
function
|
|
540
|
+
function he({ columnKey: e }) {
|
|
526
541
|
let { gridRootRef: t, filters: n } = E(), r = t.current, { filterPosition: i } = n;
|
|
527
542
|
if (!r || !i) return null;
|
|
528
543
|
let a = n.selectedFilters[e], o = (a?.length || 0) > 0, s = n.filteredUniqueValues;
|
|
@@ -578,57 +593,57 @@ function J({ columnKey: e }) {
|
|
|
578
593
|
}
|
|
579
594
|
//#endregion
|
|
580
595
|
//#region src/DataTable/components/HeaderCell.tsx
|
|
581
|
-
function
|
|
582
|
-
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;
|
|
583
598
|
return /* @__PURE__ */ S("th", {
|
|
584
|
-
rowSpan:
|
|
585
|
-
colSpan:
|
|
599
|
+
rowSpan: t,
|
|
600
|
+
colSpan: n,
|
|
586
601
|
draggable: !0,
|
|
587
|
-
onDragStart: (
|
|
588
|
-
onDragEnd:
|
|
602
|
+
onDragStart: (t) => m(t, e.key, T),
|
|
603
|
+
onDragEnd: h,
|
|
589
604
|
onDragOver: (e) => e.preventDefault(),
|
|
590
|
-
onDrop: (
|
|
591
|
-
className: D("flexi-th", "flexi-th--draggable",
|
|
592
|
-
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),
|
|
593
608
|
children: [/* @__PURE__ */ S("div", {
|
|
594
609
|
className: "flexi-th-inner",
|
|
595
610
|
children: [
|
|
596
611
|
/* @__PURE__ */ S("div", {
|
|
597
|
-
className: D("flexi-th-label",
|
|
598
|
-
onClick: () =>
|
|
612
|
+
className: D("flexi-th-label", k && "flexi-th-label--sortable"),
|
|
613
|
+
onClick: () => k && f(e.key),
|
|
599
614
|
children: [/* @__PURE__ */ x("span", {
|
|
600
615
|
className: "flexi-th-text",
|
|
601
|
-
children:
|
|
602
|
-
}),
|
|
603
|
-
className: D("flexi-sort-icon",
|
|
604
|
-
children:
|
|
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" })
|
|
605
620
|
})]
|
|
606
621
|
}),
|
|
607
622
|
/* @__PURE__ */ S("div", {
|
|
608
623
|
className: "flexi-th-actions",
|
|
609
|
-
children: [
|
|
624
|
+
children: [T && e.filterable && /* @__PURE__ */ x("button", {
|
|
610
625
|
type: "button",
|
|
611
|
-
ref: (
|
|
612
|
-
onClick: (
|
|
613
|
-
|
|
626
|
+
ref: (t) => p.registerFilterButton(e.key, t),
|
|
627
|
+
onClick: (t) => {
|
|
628
|
+
t.stopPropagation(), p.toggleFilterDropdown(e.key);
|
|
614
629
|
},
|
|
615
|
-
className: D("flexi-icon-btn", "flexi-filter-btn",
|
|
616
|
-
children: /* @__PURE__ */ x(
|
|
617
|
-
}),
|
|
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", {
|
|
618
633
|
type: "button",
|
|
619
|
-
onClick: (
|
|
620
|
-
|
|
634
|
+
onClick: (t) => {
|
|
635
|
+
t.stopPropagation(), s(e.key);
|
|
621
636
|
},
|
|
622
|
-
className: D("flexi-icon-btn", "flexi-pin-btn",
|
|
623
|
-
title:
|
|
624
|
-
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" })
|
|
625
640
|
})]
|
|
626
641
|
}),
|
|
627
|
-
|
|
642
|
+
T && p.activeFilterKey === e.key && /* @__PURE__ */ x(he, { columnKey: e.key })
|
|
628
643
|
]
|
|
629
|
-
}),
|
|
644
|
+
}), ne && /* @__PURE__ */ x("div", {
|
|
630
645
|
className: "flexi-th-resizer",
|
|
631
|
-
onMouseDown: (
|
|
646
|
+
onMouseDown: (t) => y(t, e),
|
|
632
647
|
onClick: (e) => e.stopPropagation(),
|
|
633
648
|
onDragStart: (e) => e.preventDefault()
|
|
634
649
|
})]
|
|
@@ -636,54 +651,40 @@ function Y({ col: r, rowSpan: i, colSpan: a }) {
|
|
|
636
651
|
}
|
|
637
652
|
//#endregion
|
|
638
653
|
//#region src/DataTable/components/TableHeader.tsx
|
|
639
|
-
function
|
|
640
|
-
let { headerRows: e, hasGroups: t
|
|
654
|
+
function K() {
|
|
655
|
+
let { headerRows: e, hasGroups: t } = E();
|
|
641
656
|
return /* @__PURE__ */ x("thead", {
|
|
642
657
|
className: "flexi-thead",
|
|
643
|
-
children:
|
|
658
|
+
children: e.map((n, r) => /* @__PURE__ */ S("tr", {
|
|
644
659
|
className: "flexi-header-row",
|
|
645
|
-
children: [
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
}, e.key)),
|
|
662
|
-
n && i === 0 && /* @__PURE__ */ x("th", {
|
|
663
|
-
className: "flexi-actions-th flexi-th ",
|
|
664
|
-
style: {
|
|
665
|
-
right: 0,
|
|
666
|
-
zIndex: 55,
|
|
667
|
-
display: "flex",
|
|
668
|
-
justifyContent: "center",
|
|
669
|
-
alignItems: "center"
|
|
670
|
-
},
|
|
671
|
-
children: /* @__PURE__ */ x(B, {})
|
|
672
|
-
})
|
|
673
|
-
]
|
|
674
|
-
}, `header-row-${i}`))
|
|
660
|
+
children: [r === 0 && t && /* @__PURE__ */ x("th", {
|
|
661
|
+
rowSpan: e.length,
|
|
662
|
+
className: "flexi-group-spacer-th",
|
|
663
|
+
style: {
|
|
664
|
+
position: "sticky",
|
|
665
|
+
top: 0,
|
|
666
|
+
left: 0,
|
|
667
|
+
zIndex: 35,
|
|
668
|
+
backgroundColor: "rgb(248, 250, 252)"
|
|
669
|
+
}
|
|
670
|
+
}), n.map(({ col: e, rowSpan: t, colSpan: n }) => /* @__PURE__ */ x(ge, {
|
|
671
|
+
col: e,
|
|
672
|
+
rowSpan: t,
|
|
673
|
+
colSpan: n
|
|
674
|
+
}, e.key))]
|
|
675
|
+
}, `header-row-${r}`))
|
|
675
676
|
});
|
|
676
677
|
}
|
|
677
678
|
//#endregion
|
|
678
679
|
//#region src/DataTable/utils/grouping.ts
|
|
679
|
-
var
|
|
680
|
+
var _e = (e, t, n, r = 0, i = "") => {
|
|
680
681
|
if (r >= t.length) return e.map((e) => ({
|
|
681
682
|
kind: "record",
|
|
682
683
|
record: e
|
|
683
684
|
}));
|
|
684
685
|
let a = t[r], o = n.get(a), s = /* @__PURE__ */ new Map();
|
|
685
686
|
return e.forEach((e) => {
|
|
686
|
-
let t = String(
|
|
687
|
+
let t = String(B(e, a, o) ?? "N/A"), n = s.get(t);
|
|
687
688
|
n ? n.push(e) : s.set(t, [e]);
|
|
688
689
|
}), Array.from(s.entries()).sort(([e], [t]) => e.localeCompare(t, void 0, {
|
|
689
690
|
numeric: !0,
|
|
@@ -696,18 +697,18 @@ var pe = (e, t, n, r = 0, i = "") => {
|
|
|
696
697
|
groupValue: e,
|
|
697
698
|
path: s,
|
|
698
699
|
depth: r,
|
|
699
|
-
children:
|
|
700
|
+
children: _e(o, t, n, r + 1, s),
|
|
700
701
|
totalItemsCount: o.length
|
|
701
702
|
};
|
|
702
703
|
});
|
|
703
|
-
},
|
|
704
|
+
}, ve = (e, t) => {
|
|
704
705
|
let n = [], r = (e) => {
|
|
705
706
|
e.forEach((e) => {
|
|
706
707
|
n.push(e), e.kind === "group" && t[e.path] !== !1 && r(e.children);
|
|
707
708
|
});
|
|
708
709
|
};
|
|
709
710
|
return r(e), n;
|
|
710
|
-
},
|
|
711
|
+
}, ye = (e, t, n, r) => {
|
|
711
712
|
let i = /* @__PURE__ */ new Map();
|
|
712
713
|
if (!t || t.length === 0) return i;
|
|
713
714
|
let a = e.map(() => t.map(() => !0)), o = null;
|
|
@@ -722,7 +723,7 @@ var pe = (e, t, n, r = 0, i = "") => {
|
|
|
722
723
|
let e = !0;
|
|
723
724
|
for (let o = 0; o < t.length; o++) {
|
|
724
725
|
let c = t[o], l = n.get(c);
|
|
725
|
-
e &&
|
|
726
|
+
e && B(i.record, c, l) === B(s.record, c, l) ? a[r][o] = !1 : (e = !1, a[r][o] = !0);
|
|
726
727
|
}
|
|
727
728
|
}
|
|
728
729
|
o = r;
|
|
@@ -750,16 +751,16 @@ var pe = (e, t, n, r = 0, i = "") => {
|
|
|
750
751
|
};
|
|
751
752
|
//#endregion
|
|
752
753
|
//#region src/DataTable/hooks/useAnchoredPosition.ts
|
|
753
|
-
function
|
|
754
|
-
let [
|
|
755
|
-
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(() => {
|
|
756
757
|
if (!e) {
|
|
757
|
-
|
|
758
|
+
l(null);
|
|
758
759
|
return;
|
|
759
760
|
}
|
|
760
761
|
let t = () => {
|
|
761
|
-
let e =
|
|
762
|
-
!e || !t ||
|
|
762
|
+
let e = u.current(), t = n.current;
|
|
763
|
+
!e || !t || l(d.current(e.getBoundingClientRect(), t.getBoundingClientRect()));
|
|
763
764
|
};
|
|
764
765
|
return t(), window.addEventListener("scroll", t, !0), window.addEventListener("resize", t), () => {
|
|
765
766
|
window.removeEventListener("scroll", t, !0), window.removeEventListener("resize", t);
|
|
@@ -768,237 +769,237 @@ function X({ active: e, resetKey: t, rootRef: n, getAnchor: r, compute: i }) {
|
|
|
768
769
|
e,
|
|
769
770
|
t,
|
|
770
771
|
n
|
|
771
|
-
]),
|
|
772
|
+
]), c;
|
|
772
773
|
}
|
|
773
774
|
//#endregion
|
|
774
775
|
//#region src/DataTable/hooks/useClickOutside.ts
|
|
775
|
-
function
|
|
776
|
-
let
|
|
777
|
-
|
|
776
|
+
function J(e, t, n) {
|
|
777
|
+
let i = o(t), a = o(n);
|
|
778
|
+
i.current = t, a.current = n, r(() => {
|
|
778
779
|
if (!e) return;
|
|
779
780
|
let t = (e) => {
|
|
780
|
-
let t = e.target, [n, ...
|
|
781
|
-
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());
|
|
782
783
|
};
|
|
783
784
|
return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
|
|
784
785
|
}, [e]);
|
|
785
786
|
}
|
|
786
787
|
//#endregion
|
|
787
788
|
//#region src/DataTable/hooks/useColumnFilters.ts
|
|
788
|
-
function
|
|
789
|
-
let [
|
|
790
|
-
t ?
|
|
791
|
-
}, []),
|
|
792
|
-
|
|
793
|
-
}, []),
|
|
794
|
-
|
|
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);
|
|
795
796
|
}, []);
|
|
796
|
-
|
|
797
|
-
let
|
|
798
|
-
active:
|
|
799
|
-
resetKey:
|
|
800
|
-
rootRef:
|
|
801
|
-
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,
|
|
802
803
|
compute: (e, t) => ({
|
|
803
804
|
top: e.bottom - t.top + 4,
|
|
804
805
|
left: e.left - t.left
|
|
805
806
|
})
|
|
806
|
-
}),
|
|
807
|
-
|
|
807
|
+
}), v = t((e, t) => {
|
|
808
|
+
u((n) => {
|
|
808
809
|
let r = n[e] || [], i = r.includes(t) ? r.filter((e) => e !== t) : [...r, t], a = {
|
|
809
810
|
...n,
|
|
810
811
|
[e]: i
|
|
811
812
|
};
|
|
812
813
|
return i.length === 0 && delete a[e], a;
|
|
813
814
|
});
|
|
814
|
-
}, []),
|
|
815
|
-
|
|
815
|
+
}, []), y = t((e) => {
|
|
816
|
+
u((t) => {
|
|
816
817
|
let n = { ...t };
|
|
817
818
|
return delete n[e], n;
|
|
818
819
|
});
|
|
819
|
-
}, []),
|
|
820
|
+
}, []), b = a(() => i ? U(e, i, n.get(i)) : [], [
|
|
820
821
|
e,
|
|
821
|
-
|
|
822
|
-
|
|
822
|
+
i,
|
|
823
|
+
n
|
|
823
824
|
]);
|
|
824
825
|
return {
|
|
825
|
-
activeFilterKey:
|
|
826
|
-
selectedFilters:
|
|
827
|
-
filterSearchQuery:
|
|
828
|
-
setFilterSearchQuery:
|
|
829
|
-
filterPosition:
|
|
830
|
-
dropdownRef:
|
|
831
|
-
filteredUniqueValues:
|
|
832
|
-
if (!
|
|
833
|
-
let e =
|
|
834
|
-
return
|
|
835
|
-
}, [
|
|
836
|
-
registerFilterButton:
|
|
837
|
-
toggleFilterDropdown:
|
|
838
|
-
handleFilterChange:
|
|
839
|
-
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
|
|
840
841
|
};
|
|
841
842
|
}
|
|
842
843
|
//#endregion
|
|
843
844
|
//#region src/DataTable/hooks/useColumnReorder.ts
|
|
844
|
-
function
|
|
845
|
-
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), [
|
|
846
847
|
e,
|
|
847
|
-
|
|
848
|
-
|
|
848
|
+
n,
|
|
849
|
+
c
|
|
849
850
|
]);
|
|
850
851
|
return {
|
|
851
|
-
reorderedColumns:
|
|
852
|
-
handleDragStart:
|
|
853
|
-
if (
|
|
852
|
+
reorderedColumns: d,
|
|
853
|
+
handleDragStart: t((e, t, n) => {
|
|
854
|
+
if (r.current) {
|
|
854
855
|
e.preventDefault();
|
|
855
856
|
return;
|
|
856
857
|
}
|
|
857
|
-
|
|
858
|
-
}, [
|
|
859
|
-
handleDragEnd:
|
|
860
|
-
|
|
858
|
+
u.current = t, n && e.dataTransfer.setData("text/plain", t), e.dataTransfer.effectAllowed = "move";
|
|
859
|
+
}, [r]),
|
|
860
|
+
handleDragEnd: t(() => {
|
|
861
|
+
u.current = null;
|
|
861
862
|
}, []),
|
|
862
|
-
handleDrop:
|
|
863
|
-
|
|
864
|
-
let
|
|
865
|
-
if (
|
|
866
|
-
let
|
|
867
|
-
if (!
|
|
868
|
-
let
|
|
869
|
-
|
|
870
|
-
let m = { ...
|
|
871
|
-
|
|
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) => {
|
|
872
873
|
m[e] = t;
|
|
873
|
-
}),
|
|
874
|
+
}), l(m), i && i(A(M(e, n, m)).map((e) => e.key));
|
|
874
875
|
}, [
|
|
875
|
-
|
|
876
|
-
|
|
876
|
+
d,
|
|
877
|
+
c,
|
|
877
878
|
e,
|
|
878
|
-
|
|
879
|
-
|
|
879
|
+
n,
|
|
880
|
+
i
|
|
880
881
|
])
|
|
881
882
|
};
|
|
882
883
|
}
|
|
883
884
|
//#endregion
|
|
884
885
|
//#region src/DataTable/hooks/useColumnResize.ts
|
|
885
|
-
function
|
|
886
|
-
let [
|
|
887
|
-
return
|
|
888
|
-
columnWidths:
|
|
889
|
-
isResizingRef:
|
|
890
|
-
startResize:
|
|
891
|
-
e.preventDefault(), e.stopPropagation(),
|
|
892
|
-
let
|
|
893
|
-
let
|
|
894
|
-
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 : {
|
|
895
896
|
...e,
|
|
896
|
-
[
|
|
897
|
+
[t.key]: n
|
|
897
898
|
});
|
|
898
899
|
}, p = () => {
|
|
899
|
-
window.removeEventListener("mousemove", f), window.removeEventListener("mouseup", m),
|
|
900
|
+
window.removeEventListener("mousemove", f), window.removeEventListener("mouseup", m), c.current = null;
|
|
900
901
|
}, m = () => {
|
|
901
902
|
p(), requestAnimationFrame(() => {
|
|
902
|
-
|
|
903
|
-
}), d !== void 0 &&
|
|
903
|
+
a.current = !1;
|
|
904
|
+
}), d !== void 0 && l.current?.(t.key, d);
|
|
904
905
|
};
|
|
905
|
-
window.addEventListener("mousemove", f), window.addEventListener("mouseup", m),
|
|
906
|
-
p(),
|
|
906
|
+
window.addEventListener("mousemove", f), window.addEventListener("mouseup", m), c.current = () => {
|
|
907
|
+
p(), a.current = !1;
|
|
907
908
|
};
|
|
908
|
-
}, [
|
|
909
|
+
}, [n])
|
|
909
910
|
};
|
|
910
911
|
}
|
|
911
912
|
//#endregion
|
|
912
913
|
//#region src/DataTable/hooks/useColumnVisibility.ts
|
|
913
|
-
function
|
|
914
|
-
let [
|
|
914
|
+
function Ce({ defaultHiddenColumns: e, defaultDisplayPinnedIcon: n, onColumnVisibilityChange: r }) {
|
|
915
|
+
let [i, a] = s(e), [o, c] = s(n);
|
|
915
916
|
return {
|
|
916
|
-
hiddenColumns:
|
|
917
|
-
displayPinnedIcon:
|
|
918
|
-
toggleColumnVisibility:
|
|
919
|
-
let t =
|
|
920
|
-
|
|
921
|
-
}, [
|
|
922
|
-
toggleDisplayPinnedIcon:
|
|
923
|
-
resetControlPanelDefaults:
|
|
924
|
-
|
|
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);
|
|
925
926
|
}, [
|
|
926
|
-
|
|
927
|
+
n,
|
|
927
928
|
e,
|
|
928
|
-
|
|
929
|
+
r
|
|
929
930
|
])
|
|
930
931
|
};
|
|
931
932
|
}
|
|
932
933
|
//#endregion
|
|
933
934
|
//#region src/DataTable/hooks/usePagination.ts
|
|
934
|
-
function
|
|
935
|
-
let [
|
|
936
|
-
return
|
|
937
|
-
|
|
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);
|
|
938
939
|
}, [
|
|
939
|
-
...
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
]),
|
|
943
|
-
|
|
944
|
-
}, [
|
|
945
|
-
currentPage:
|
|
946
|
-
pageSize:
|
|
947
|
-
totalPages:
|
|
948
|
-
totalCount:
|
|
949
|
-
pagedItems:
|
|
950
|
-
if (!
|
|
951
|
-
let
|
|
952
|
-
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);
|
|
953
954
|
}, [
|
|
954
955
|
e,
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
956
|
+
n,
|
|
957
|
+
l,
|
|
958
|
+
d
|
|
958
959
|
]),
|
|
959
|
-
goToPage:
|
|
960
|
-
let t = Math.min(Math.max(1, e),
|
|
961
|
-
|
|
960
|
+
goToPage: t((e) => {
|
|
961
|
+
let t = Math.min(Math.max(1, e), m);
|
|
962
|
+
u(t), o?.(t, d);
|
|
962
963
|
}, [
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
964
|
+
m,
|
|
965
|
+
d,
|
|
966
|
+
o
|
|
966
967
|
]),
|
|
967
|
-
changePageSize:
|
|
968
|
-
|
|
969
|
-
}, [
|
|
968
|
+
changePageSize: t((e) => {
|
|
969
|
+
f(e), u(1), o?.(1, e);
|
|
970
|
+
}, [o])
|
|
970
971
|
};
|
|
971
972
|
}
|
|
972
973
|
//#endregion
|
|
973
974
|
//#region src/DataTable/hooks/usePinnedColumns.ts
|
|
974
|
-
function
|
|
975
|
-
let [
|
|
975
|
+
function Te(e, n) {
|
|
976
|
+
let [r, i] = s(() => ie(e));
|
|
976
977
|
return {
|
|
977
|
-
pinnedColumns:
|
|
978
|
-
togglePin:
|
|
979
|
-
let
|
|
980
|
-
a ? o[e] = a : delete o[e],
|
|
981
|
-
}, [
|
|
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])
|
|
982
983
|
};
|
|
983
984
|
}
|
|
984
985
|
//#endregion
|
|
985
986
|
//#region src/DataTable/hooks/useRowGrouping.ts
|
|
986
|
-
function
|
|
987
|
-
let [
|
|
987
|
+
function Ee(e, n) {
|
|
988
|
+
let [r, i] = s(e), [a, o] = s({});
|
|
988
989
|
return {
|
|
989
|
-
groupedColumns:
|
|
990
|
-
expandedGroups:
|
|
991
|
-
addGroup:
|
|
992
|
-
if (!e ||
|
|
993
|
-
let
|
|
994
|
-
|
|
995
|
-
}, [
|
|
996
|
-
removeGroup:
|
|
997
|
-
let
|
|
998
|
-
|
|
999
|
-
}, [
|
|
1000
|
-
toggleGroupExpansion:
|
|
1001
|
-
|
|
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) => ({
|
|
1002
1003
|
...t,
|
|
1003
1004
|
[e]: t[e] === !1
|
|
1004
1005
|
}));
|
|
@@ -1007,35 +1008,35 @@ function Se(e, t) {
|
|
|
1007
1008
|
}
|
|
1008
1009
|
//#endregion
|
|
1009
1010
|
//#region src/DataTable/hooks/useSettingsMenu.ts
|
|
1010
|
-
function
|
|
1011
|
-
let [
|
|
1012
|
-
return
|
|
1013
|
-
isOpen:
|
|
1014
|
-
position:
|
|
1015
|
-
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,
|
|
1016
1017
|
rootRef: e,
|
|
1017
|
-
getAnchor: () =>
|
|
1018
|
+
getAnchor: () => a.current,
|
|
1018
1019
|
compute: (e, t) => ({
|
|
1019
1020
|
top: e.bottom - t.top + 4,
|
|
1020
1021
|
right: t.right - e.right
|
|
1021
1022
|
})
|
|
1022
1023
|
}),
|
|
1023
|
-
menuRef:
|
|
1024
|
-
buttonRef:
|
|
1025
|
-
toggle:
|
|
1024
|
+
menuRef: i,
|
|
1025
|
+
buttonRef: a,
|
|
1026
|
+
toggle: c
|
|
1026
1027
|
};
|
|
1027
1028
|
}
|
|
1028
1029
|
//#endregion
|
|
1029
1030
|
//#region src/DataTable/hooks/useSorting.ts
|
|
1030
|
-
function
|
|
1031
|
-
let [e,
|
|
1031
|
+
function Oe() {
|
|
1032
|
+
let [e, n] = s({
|
|
1032
1033
|
key: null,
|
|
1033
1034
|
direction: null
|
|
1034
1035
|
});
|
|
1035
1036
|
return {
|
|
1036
1037
|
sortState: e,
|
|
1037
|
-
handleSort:
|
|
1038
|
-
|
|
1038
|
+
handleSort: t((e) => {
|
|
1039
|
+
n((t) => {
|
|
1039
1040
|
let n = "asc";
|
|
1040
1041
|
return t.key === e && (t.direction === "asc" ? n = "desc" : t.direction === "desc" && (n = null)), {
|
|
1041
1042
|
key: n ? e : null,
|
|
@@ -1047,174 +1048,211 @@ function we() {
|
|
|
1047
1048
|
}
|
|
1048
1049
|
//#endregion
|
|
1049
1050
|
//#region src/DataTable/hooks/useVirtualRows.ts
|
|
1050
|
-
function
|
|
1051
|
-
let [
|
|
1052
|
-
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(() => {
|
|
1053
1054
|
let t = e.current;
|
|
1054
1055
|
if (!t) return;
|
|
1055
|
-
let n = () =>
|
|
1056
|
-
|
|
1056
|
+
let n = () => c(t.scrollTop);
|
|
1057
|
+
u(t.clientHeight), c(t.scrollTop), t.addEventListener("scroll", n, { passive: !0 });
|
|
1057
1058
|
let r;
|
|
1058
|
-
return typeof ResizeObserver < "u" && (r = new ResizeObserver(() =>
|
|
1059
|
+
return typeof ResizeObserver < "u" && (r = new ResizeObserver(() => u(t.clientHeight)), r.observe(t)), () => {
|
|
1059
1060
|
t.removeEventListener("scroll", n), r?.disconnect();
|
|
1060
1061
|
};
|
|
1061
|
-
}, [e]),
|
|
1062
|
-
if (
|
|
1062
|
+
}, [e]), a(() => {
|
|
1063
|
+
if (l === 0 || n === "auto") return {
|
|
1063
1064
|
startIndex: 0,
|
|
1064
1065
|
endIndex: t,
|
|
1065
1066
|
topSpacerHeight: 0,
|
|
1066
1067
|
bottomSpacerHeight: 0
|
|
1067
1068
|
};
|
|
1068
|
-
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);
|
|
1069
1070
|
return {
|
|
1070
|
-
startIndex:
|
|
1071
|
+
startIndex: c,
|
|
1071
1072
|
endIndex: u,
|
|
1072
|
-
topSpacerHeight:
|
|
1073
|
+
topSpacerHeight: c * e,
|
|
1073
1074
|
bottomSpacerHeight: (t - u) * e
|
|
1074
1075
|
};
|
|
1075
1076
|
}, [
|
|
1076
|
-
i,
|
|
1077
1077
|
o,
|
|
1078
|
+
l,
|
|
1078
1079
|
t,
|
|
1079
1080
|
n,
|
|
1080
|
-
|
|
1081
|
+
i
|
|
1081
1082
|
]);
|
|
1082
1083
|
}
|
|
1083
1084
|
//#endregion
|
|
1084
1085
|
//#region src/DataTable/hooks/useDataTableState.ts
|
|
1085
|
-
function
|
|
1086
|
-
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(() => {
|
|
1087
1088
|
let e = /* @__PURE__ */ new Map();
|
|
1088
|
-
return
|
|
1089
|
-
}, [
|
|
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({
|
|
1090
1091
|
columns: e,
|
|
1091
|
-
pinnedColumns:
|
|
1092
|
+
pinnedColumns: P,
|
|
1092
1093
|
isResizingRef: L,
|
|
1093
|
-
onColumnReorder:
|
|
1094
|
-
}), z =
|
|
1095
|
-
defaultHiddenColumns:
|
|
1096
|
-
defaultDisplayPinnedIcon:
|
|
1097
|
-
onColumnVisibilityChange:
|
|
1098
|
-
}), { hiddenColumns: B } = z, V =
|
|
1094
|
+
onColumnReorder: v
|
|
1095
|
+
}), z = Ce({
|
|
1096
|
+
defaultHiddenColumns: w,
|
|
1097
|
+
defaultDisplayPinnedIcon: C,
|
|
1098
|
+
onColumnVisibilityChange: T
|
|
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)), [
|
|
1099
1104
|
R,
|
|
1100
|
-
|
|
1105
|
+
K,
|
|
1101
1106
|
B
|
|
1102
|
-
]),
|
|
1107
|
+
]), Ae = a(() => ae(R, K, B), [
|
|
1103
1108
|
R,
|
|
1104
|
-
|
|
1109
|
+
K,
|
|
1105
1110
|
B
|
|
1106
|
-
]),
|
|
1107
|
-
visibleLeafColumns:
|
|
1108
|
-
pinnedColumns:
|
|
1111
|
+
]), je = a(() => oe({
|
|
1112
|
+
visibleLeafColumns: Y,
|
|
1113
|
+
pinnedColumns: P,
|
|
1109
1114
|
columnWidths: I,
|
|
1110
|
-
hasGroups:
|
|
1111
|
-
hasActions:
|
|
1115
|
+
hasGroups: q,
|
|
1116
|
+
hasActions: J
|
|
1112
1117
|
}), [
|
|
1113
|
-
|
|
1114
|
-
|
|
1118
|
+
Y,
|
|
1119
|
+
P,
|
|
1115
1120
|
I,
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
]),
|
|
1119
|
-
data:
|
|
1120
|
-
columnsByKey:
|
|
1121
|
-
gridRootRef:
|
|
1122
|
-
}), { sortState:
|
|
1123
|
-
items:
|
|
1124
|
-
let e =
|
|
1125
|
-
return !
|
|
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));
|
|
1126
1131
|
}, [
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1132
|
+
n,
|
|
1133
|
+
X.selectedFilters,
|
|
1134
|
+
Z,
|
|
1135
|
+
N
|
|
1131
1136
|
]),
|
|
1132
|
-
enabled:
|
|
1133
|
-
defaultPageSize:
|
|
1134
|
-
onPageChange:
|
|
1135
|
-
resetOn: [
|
|
1136
|
-
}),
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
]),
|
|
1141
|
-
containerRef:
|
|
1142
|
-
totalRowCount:
|
|
1143
|
-
rowHeight:
|
|
1144
|
-
overscan:
|
|
1145
|
-
}),
|
|
1146
|
-
|
|
1137
|
+
enabled: E,
|
|
1138
|
+
defaultPageSize: D,
|
|
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,
|
|
1147
1152
|
$,
|
|
1148
|
-
|
|
1149
|
-
]),
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
+
Ie
|
|
1154
|
+
]), Be = a(() => ye(ze, x, N, $), [
|
|
1155
|
+
ze,
|
|
1156
|
+
x,
|
|
1157
|
+
N,
|
|
1153
1158
|
$
|
|
1154
|
-
]),
|
|
1159
|
+
]), Ve = De(j), He = Y.length + +!!J + +!!q;
|
|
1155
1160
|
return {
|
|
1156
|
-
gridRootRef:
|
|
1157
|
-
tableWrapRef:
|
|
1158
|
-
rowKey:
|
|
1159
|
-
actions:
|
|
1160
|
-
isLoading: !!
|
|
1161
|
-
groupBy:
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
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
|
+
pageSizeOptions: O,
|
|
1177
|
+
paginationEnabled: E,
|
|
1178
|
+
initialLeafColumns: M,
|
|
1179
|
+
columnsByKey: N,
|
|
1180
|
+
visibleLeafColumns: Y,
|
|
1181
|
+
headerRows: Ae,
|
|
1182
|
+
pinnedColumns: P,
|
|
1183
|
+
pinOffsets: je,
|
|
1177
1184
|
columnWidths: I,
|
|
1178
|
-
togglePin:
|
|
1179
|
-
startResize:
|
|
1180
|
-
handleDragStart:
|
|
1181
|
-
handleDragEnd:
|
|
1182
|
-
handleDrop:
|
|
1185
|
+
togglePin: F,
|
|
1186
|
+
startResize: se,
|
|
1187
|
+
handleDragStart: ce,
|
|
1188
|
+
handleDragEnd: le,
|
|
1189
|
+
handleDrop: ue,
|
|
1183
1190
|
hiddenColumns: B,
|
|
1184
1191
|
displayPinnedIcon: z.displayPinnedIcon,
|
|
1185
1192
|
toggleColumnVisibility: z.toggleColumnVisibility,
|
|
1186
1193
|
toggleDisplayPinnedIcon: z.toggleDisplayPinnedIcon,
|
|
1187
|
-
resetControlPanelDefaults:
|
|
1188
|
-
settingsMenu:
|
|
1194
|
+
resetControlPanelDefaults: he,
|
|
1195
|
+
settingsMenu: Ve,
|
|
1189
1196
|
groupedColumns: H,
|
|
1190
1197
|
expandedGroups: U,
|
|
1191
1198
|
addGroup: V.addGroup,
|
|
1192
1199
|
removeGroup: V.removeGroup,
|
|
1193
1200
|
toggleGroupExpansion: V.toggleGroupExpansion,
|
|
1194
|
-
hasGroups:
|
|
1195
|
-
hasActions:
|
|
1196
|
-
sortState:
|
|
1197
|
-
handleSort:
|
|
1198
|
-
filters:
|
|
1199
|
-
currentPage:
|
|
1200
|
-
pageSize:
|
|
1201
|
-
totalPages:
|
|
1202
|
-
totalCount:
|
|
1203
|
-
goToPage:
|
|
1204
|
-
changePageSize:
|
|
1205
|
-
visibleRows:
|
|
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,
|
|
1206
1213
|
startIndex: $,
|
|
1207
|
-
totalRowCount:
|
|
1208
|
-
topSpacerHeight:
|
|
1209
|
-
bottomSpacerHeight:
|
|
1210
|
-
rowSpanInfo:
|
|
1211
|
-
totalColumnsCount:
|
|
1214
|
+
totalRowCount: Fe,
|
|
1215
|
+
topSpacerHeight: Le,
|
|
1216
|
+
bottomSpacerHeight: Re,
|
|
1217
|
+
rowSpanInfo: Be,
|
|
1218
|
+
totalColumnsCount: He
|
|
1212
1219
|
};
|
|
1213
1220
|
}
|
|
1214
1221
|
//#endregion
|
|
1215
1222
|
//#region src/DataTable/DataTable.tsx
|
|
1216
|
-
|
|
1217
|
-
|
|
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));
|
|
1218
1256
|
return /* @__PURE__ */ x(T, {
|
|
1219
1257
|
value: t,
|
|
1220
1258
|
children: /* @__PURE__ */ S("div", {
|
|
@@ -1222,26 +1260,32 @@ function Ee(e) {
|
|
|
1222
1260
|
className: "flexi-root",
|
|
1223
1261
|
children: [
|
|
1224
1262
|
t.groupBy && /* @__PURE__ */ x(O, {}),
|
|
1225
|
-
/* @__PURE__ */
|
|
1263
|
+
/* @__PURE__ */ S("div", {
|
|
1226
1264
|
ref: t.tableWrapRef,
|
|
1227
1265
|
className: "flexi-table-wrap",
|
|
1228
|
-
style:
|
|
1229
|
-
children: /* @__PURE__ */
|
|
1266
|
+
style: a,
|
|
1267
|
+
children: [t.controlPanel && /* @__PURE__ */ x("div", {
|
|
1268
|
+
className: "flexi-settings-corner",
|
|
1269
|
+
children: /* @__PURE__ */ x("div", {
|
|
1270
|
+
className: "flexi-settings-corner-inner",
|
|
1271
|
+
children: /* @__PURE__ */ x(ue, {})
|
|
1272
|
+
})
|
|
1273
|
+
}), /* @__PURE__ */ S("table", {
|
|
1230
1274
|
className: D("flexi-table", i && "flexi-table--bordered"),
|
|
1231
1275
|
style: r,
|
|
1232
1276
|
children: [
|
|
1233
|
-
/* @__PURE__ */ x(
|
|
1234
|
-
/* @__PURE__ */ x(
|
|
1235
|
-
/* @__PURE__ */ x(
|
|
1236
|
-
/* @__PURE__ */ x(
|
|
1277
|
+
/* @__PURE__ */ x(me, {}),
|
|
1278
|
+
/* @__PURE__ */ x(K, {}),
|
|
1279
|
+
/* @__PURE__ */ x(pe, {}),
|
|
1280
|
+
/* @__PURE__ */ x(le, {})
|
|
1237
1281
|
]
|
|
1238
|
-
})
|
|
1282
|
+
})]
|
|
1239
1283
|
}),
|
|
1240
|
-
/* @__PURE__ */ x(
|
|
1241
|
-
t.paginationEnabled && /* @__PURE__ */ x(
|
|
1284
|
+
/* @__PURE__ */ x(z, {}),
|
|
1285
|
+
t.paginationEnabled && /* @__PURE__ */ x(te, {})
|
|
1242
1286
|
]
|
|
1243
1287
|
})
|
|
1244
1288
|
});
|
|
1245
1289
|
}
|
|
1246
1290
|
//#endregion
|
|
1247
|
-
export {
|
|
1291
|
+
export { Z as DataTable };
|