@overdoser/react-toolkit 0.21.0 → 0.22.1
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/AGENTS.md +1 -0
- package/CHANGELOG.md +35 -0
- package/components/Accordion/Accordion.js +48 -48
- package/components/ActionButton/ActionButton.js +23 -23
- package/components/ActionButton/CopyButton.js +5 -5
- package/components/Alert/Alert.js +13 -13
- package/components/Avatar/Avatar.js +12 -12
- package/components/Badge/Badge.js +6 -6
- package/components/Breadcrumbs/Breadcrumbs.js +15 -15
- package/components/Button/Button.js +14 -14
- package/components/Card/Card.js +26 -26
- package/components/Chart/AreaChart.js +103 -103
- package/components/Chart/Axis.js +7 -7
- package/components/Chart/BarChart.js +62 -62
- package/components/Chart/ChartContainer.js +11 -11
- package/components/Chart/ChartLegend.js +7 -7
- package/components/Chart/ChartTooltip.js +13 -13
- package/components/Chart/LineChart.js +88 -88
- package/components/Chart/PieChart.js +25 -25
- package/components/Chart/RadarChart.js +42 -42
- package/components/Chart/Sparkline.js +11 -11
- package/components/Chart/TradingChart.js +126 -126
- package/components/Chart/trading/period.js +3 -3
- package/components/Chip/Chip.js +24 -24
- package/components/CodeBlock/CodeBlock.js +31 -31
- package/components/CommandPalette/CommandPalette.js +166 -166
- package/components/ConfirmDialog/ConfirmDialog.js +60 -60
- package/components/Divider/Divider.js +10 -10
- package/components/Draggable/Draggable.js +29 -29
- package/components/Drawer/Drawer.js +53 -53
- package/components/Dropdown/Dropdown.js +66 -66
- package/components/Dropdown/DropdownItem.js +13 -13
- package/components/Dropdown/DropdownLabel.js +5 -5
- package/components/Dropdown/DropdownSeparator.js +5 -5
- package/components/Dropzone/Dropzone.js +15 -15
- package/components/EmptyState/EmptyState.js +11 -11
- package/components/Form/Form.js +17 -17
- package/components/Form/FormField.js +21 -21
- package/components/Form/FormRow.js +3 -3
- package/components/ImageViewer/ImageViewer.js +118 -118
- package/components/Kbd/Kbd.js +11 -11
- package/components/KeyValueList/KeyValueList.js +32 -32
- package/components/Link/Link.js +7 -7
- package/components/List/List.js +7 -7
- package/components/Loader/Loader.js +39 -39
- package/components/Modal/Modal.js +48 -48
- package/components/PageHeader/PageHeader.js +18 -18
- package/components/Pagination/Pagination.js +23 -23
- package/components/Popover/Popover.js +25 -25
- package/components/ProgressBar/ProgressBar.js +17 -17
- package/components/RelativeTime/RelativeTime.js +10 -10
- package/components/SegmentedControl/SegmentedControl.js +38 -38
- package/components/Skeleton/Skeleton.js +10 -10
- package/components/Spinner/Spinner.js +7 -7
- package/components/SplitButton/SplitButton.js +63 -63
- package/components/SplitPane/SplitPane.js +50 -50
- package/components/StatCard/StatCard.js +32 -32
- package/components/StatusDot/StatusDot.js +7 -7
- package/components/Table/Table.js +174 -174
- package/components/Tabs/Tabs.js +47 -47
- package/components/ThemeToggle/ThemeToggle.js +31 -31
- package/components/Timeline/GanttTimeline.js +213 -213
- package/components/Timeline/HistoryTimeline.js +306 -306
- package/components/Timeline/TimelineShared.js +103 -103
- package/components/Timeline/TraceEventDetails.js +103 -103
- package/components/Timeline/TraceTimeline.js +546 -546
- package/components/Timeline/historyLayout.js +2 -2
- package/components/Timer/Timer.js +39 -39
- package/components/Toast/Toast.js +59 -59
- package/components/ToggleIconButton/ToggleIconButton.js +9 -9
- package/components/Tooltip/Tooltip.js +16 -16
- package/components/Typography/Typography.js +5 -5
- package/components/inputs/Checkbox/Checkbox.js +11 -11
- package/components/inputs/Checkbox/CheckboxGroup.js +21 -21
- package/components/inputs/DatePicker/CalendarPanel.js +113 -113
- package/components/inputs/DatePicker/DatePicker.js +39 -39
- package/components/inputs/DateTimePicker/DateTimePicker.js +119 -119
- package/components/inputs/DateTimePicker/DateTimeSegments.js +40 -40
- package/components/inputs/DateTimePicker/TimeField.js +34 -34
- package/components/inputs/Input/Input.js +13 -13
- package/components/inputs/NumberInput/NumberInput.js +16 -16
- package/components/inputs/Radio/Radio.js +17 -17
- package/components/inputs/SearchInput/SearchInput.js +25 -25
- package/components/inputs/Select/Select.d.ts +55 -3
- package/components/inputs/Select/Select.js +485 -344
- package/components/inputs/Select/{Select.module.js → Select.module.scss.js} +15 -3
- package/components/inputs/Slider/Slider.js +21 -21
- package/components/inputs/Switch/Switch.js +4 -4
- package/components/inputs/Textarea/Textarea.js +8 -8
- package/hooks/usePortalPosition.d.ts +2 -1
- package/hooks/usePortalPosition.js +6 -3
- package/hooks/useResizable.js +1 -1
- package/hooks/useTheme.js +7 -7
- package/index.css +1 -1
- package/index.js +1 -1
- package/index.layered.css +1 -1
- package/llms.txt +25 -4
- package/manifest.json +33 -4
- package/package.json +1 -1
- /package/components/Accordion/{Accordion.module.js → Accordion.module.scss.js} +0 -0
- /package/components/ActionButton/{ActionButton.module.js → ActionButton.module.scss.js} +0 -0
- /package/components/Alert/{Alert.module.js → Alert.module.scss.js} +0 -0
- /package/components/Avatar/{Avatar.module.js → Avatar.module.scss.js} +0 -0
- /package/components/Badge/{Badge.module.js → Badge.module.scss.js} +0 -0
- /package/components/Breadcrumbs/{Breadcrumbs.module.js → Breadcrumbs.module.scss.js} +0 -0
- /package/components/Button/{Button.module.js → Button.module.scss.js} +0 -0
- /package/components/Card/{Card.module.js → Card.module.scss.js} +0 -0
- /package/components/Chart/{Chart.module.js → Chart.module.scss.js} +0 -0
- /package/components/Chip/{Chip.module.js → Chip.module.scss.js} +0 -0
- /package/components/CodeBlock/{CodeBlock.module.js → CodeBlock.module.scss.js} +0 -0
- /package/components/CommandPalette/{CommandPalette.module.js → CommandPalette.module.scss.js} +0 -0
- /package/components/ConfirmDialog/{ConfirmDialog.module.js → ConfirmDialog.module.scss.js} +0 -0
- /package/components/Divider/{Divider.module.js → Divider.module.scss.js} +0 -0
- /package/components/Draggable/{Draggable.module.js → Draggable.module.scss.js} +0 -0
- /package/components/Drawer/{Drawer.module.js → Drawer.module.scss.js} +0 -0
- /package/components/Dropdown/{Dropdown.module.js → Dropdown.module.scss.js} +0 -0
- /package/components/Dropzone/{Dropzone.module.js → Dropzone.module.scss.js} +0 -0
- /package/components/EmptyState/{EmptyState.module.js → EmptyState.module.scss.js} +0 -0
- /package/components/Form/{Form.module.js → Form.module.scss.js} +0 -0
- /package/components/ImageViewer/{ImageViewer.module.js → ImageViewer.module.scss.js} +0 -0
- /package/components/Kbd/{Kbd.module.js → Kbd.module.scss.js} +0 -0
- /package/components/KeyValueList/{KeyValueList.module.js → KeyValueList.module.scss.js} +0 -0
- /package/components/Link/{Link.module.js → Link.module.scss.js} +0 -0
- /package/components/List/{List.module.js → List.module.scss.js} +0 -0
- /package/components/Loader/{Loader.module.js → Loader.module.scss.js} +0 -0
- /package/components/Modal/{Modal.module.js → Modal.module.scss.js} +0 -0
- /package/components/PageHeader/{PageHeader.module.js → PageHeader.module.scss.js} +0 -0
- /package/components/Pagination/{Pagination.module.js → Pagination.module.scss.js} +0 -0
- /package/components/Popover/{Popover.module.js → Popover.module.scss.js} +0 -0
- /package/components/ProgressBar/{ProgressBar.module.js → ProgressBar.module.scss.js} +0 -0
- /package/components/RelativeTime/{RelativeTime.module.js → RelativeTime.module.scss.js} +0 -0
- /package/components/SegmentedControl/{SegmentedControl.module.js → SegmentedControl.module.scss.js} +0 -0
- /package/components/Skeleton/{Skeleton.module.js → Skeleton.module.scss.js} +0 -0
- /package/components/Spinner/{Spinner.module.js → Spinner.module.scss.js} +0 -0
- /package/components/SplitButton/{SplitButton.module.js → SplitButton.module.scss.js} +0 -0
- /package/components/SplitPane/{SplitPane.module.js → SplitPane.module.scss.js} +0 -0
- /package/components/StatCard/{StatCard.module.js → StatCard.module.scss.js} +0 -0
- /package/components/StatusDot/{StatusDot.module.js → StatusDot.module.scss.js} +0 -0
- /package/components/Table/{Table.module.js → Table.module.scss.js} +0 -0
- /package/components/Tabs/{Tabs.module.js → Tabs.module.scss.js} +0 -0
- /package/components/ThemeToggle/{ThemeToggle.module.js → ThemeToggle.module.scss.js} +0 -0
- /package/components/Timeline/{GanttTimeline.module.js → GanttTimeline.module.scss.js} +0 -0
- /package/components/Timeline/{HistoryTimeline.module.js → HistoryTimeline.module.scss.js} +0 -0
- /package/components/Timeline/{Timeline.module.js → Timeline.module.scss.js} +0 -0
- /package/components/Timeline/{TraceTimeline.module.js → TraceTimeline.module.scss.js} +0 -0
- /package/components/Timer/{Timer.module.js → Timer.module.scss.js} +0 -0
- /package/components/Toast/{Toast.module.js → Toast.module.scss.js} +0 -0
- /package/components/ToggleIconButton/{ToggleIconButton.module.js → ToggleIconButton.module.scss.js} +0 -0
- /package/components/Tooltip/{Tooltip.module.js → Tooltip.module.scss.js} +0 -0
- /package/components/Typography/{Typography.module.js → Typography.module.scss.js} +0 -0
- /package/components/inputs/Checkbox/{Checkbox.module.js → Checkbox.module.scss.js} +0 -0
- /package/components/inputs/Checkbox/{CheckboxGroup.module.js → CheckboxGroup.module.scss.js} +0 -0
- /package/components/inputs/DatePicker/{CalendarPanel.module.js → CalendarPanel.module.scss.js} +0 -0
- /package/components/inputs/DatePicker/{DatePicker.module.js → DatePicker.module.scss.js} +0 -0
- /package/components/inputs/DateTimePicker/{DateTimePicker.module.js → DateTimePicker.module.scss.js} +0 -0
- /package/components/inputs/Input/{Input.module.js → Input.module.scss.js} +0 -0
- /package/components/inputs/NumberInput/{NumberInput.module.js → NumberInput.module.scss.js} +0 -0
- /package/components/inputs/Radio/{Radio.module.js → Radio.module.scss.js} +0 -0
- /package/components/inputs/SearchInput/{SearchInput.module.js → SearchInput.module.scss.js} +0 -0
- /package/components/inputs/Slider/{Slider.module.js → Slider.module.scss.js} +0 -0
- /package/components/inputs/Textarea/{Textarea.module.js → Textarea.module.scss.js} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import u from "
|
|
1
|
+
import { useCallback as e, useEffect as t, useMemo as n, useRef as r, useState as i } from "react";
|
|
2
|
+
import a from "clsx";
|
|
3
|
+
import o from "./Table.module.scss.js";
|
|
4
|
+
import { useTableSort as s } from "./useTableSort.js";
|
|
5
|
+
import { Loader as c } from "../Loader/Loader.js";
|
|
6
|
+
import { Skeleton as l } from "../Skeleton/Skeleton.js";
|
|
7
|
+
import { Checkbox as u } from "../inputs/Checkbox/Checkbox.js";
|
|
8
8
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
9
|
// src/components/Table/Table.tsx
|
|
10
10
|
function p(e) {
|
|
@@ -14,54 +14,54 @@ function m(e) {
|
|
|
14
14
|
return p(e) ? e.key : e.id;
|
|
15
15
|
}
|
|
16
16
|
var ee = "button, a, input, select, textarea, label, [role=\"button\"], [role=\"checkbox\"], [role=\"menuitem\"], [contenteditable]";
|
|
17
|
-
function te({ direction:
|
|
17
|
+
function te({ direction: e, sortIndex: t }) {
|
|
18
18
|
return /* @__PURE__ */ f("span", {
|
|
19
|
-
className:
|
|
19
|
+
className: o.sortIndicator,
|
|
20
20
|
"aria-hidden": "true",
|
|
21
21
|
children: [
|
|
22
22
|
/* @__PURE__ */ d("span", {
|
|
23
|
-
className:
|
|
23
|
+
className: a(o.sortArrow, e === "asc" && o.sortArrowActive),
|
|
24
24
|
children: "▲"
|
|
25
25
|
}),
|
|
26
26
|
/* @__PURE__ */ d("span", {
|
|
27
|
-
className:
|
|
27
|
+
className: a(o.sortArrow, e === "desc" && o.sortArrowActive),
|
|
28
28
|
children: "▼"
|
|
29
29
|
}),
|
|
30
|
-
|
|
31
|
-
className:
|
|
32
|
-
children:
|
|
30
|
+
t !== void 0 && t >= 0 && /* @__PURE__ */ d("span", {
|
|
31
|
+
className: o.sortIndex,
|
|
32
|
+
children: t + 1
|
|
33
33
|
})
|
|
34
34
|
]
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
function ne({ page:
|
|
37
|
+
function ne({ page: e, pageSize: t, totalRows: r, pageSizeOptions: i = [
|
|
38
38
|
10,
|
|
39
39
|
25,
|
|
40
40
|
50,
|
|
41
41
|
100
|
|
42
|
-
], onPageChange:
|
|
43
|
-
let
|
|
44
|
-
let
|
|
45
|
-
if (
|
|
42
|
+
], onPageChange: s, paginatorClasses: c }) {
|
|
43
|
+
let l = Math.max(1, Math.ceil(r / t)), u = (e - 1) * t + 1, p = Math.min(e * t, r), m = n(() => {
|
|
44
|
+
let t = [];
|
|
45
|
+
if (l <= 7) for (let e = 1; e <= l; e++) t.push(e);
|
|
46
46
|
else {
|
|
47
|
-
|
|
48
|
-
for (let n = Math.max(2,
|
|
49
|
-
|
|
47
|
+
t.push(1), e > 3 && t.push("ellipsis");
|
|
48
|
+
for (let n = Math.max(2, e - 1); n <= Math.min(l - 1, e + 1); n++) t.push(n);
|
|
49
|
+
e < l - 2 && t.push("ellipsis"), t.push(l);
|
|
50
50
|
}
|
|
51
|
-
return
|
|
52
|
-
}, [
|
|
51
|
+
return t;
|
|
52
|
+
}, [e, l]);
|
|
53
53
|
return /* @__PURE__ */ f("nav", {
|
|
54
|
-
className:
|
|
54
|
+
className: a(o.paginator, c?.paginator),
|
|
55
55
|
"aria-label": "Table pagination",
|
|
56
56
|
children: [/* @__PURE__ */ f("div", {
|
|
57
|
-
className:
|
|
57
|
+
className: o.paginatorInfo,
|
|
58
58
|
children: [/* @__PURE__ */ d("span", {
|
|
59
|
-
className:
|
|
60
|
-
children: r > 0 ? `${
|
|
59
|
+
className: o.paginatorText,
|
|
60
|
+
children: r > 0 ? `${u}–${p} of ${r}` : "No results"
|
|
61
61
|
}), i.length > 1 && /* @__PURE__ */ d("select", {
|
|
62
|
-
className:
|
|
63
|
-
value:
|
|
64
|
-
onChange: (e) =>
|
|
62
|
+
className: o.pageSizeSelect,
|
|
63
|
+
value: t,
|
|
64
|
+
onChange: (e) => s(1, Number(e.target.value)),
|
|
65
65
|
"aria-label": "Rows per page",
|
|
66
66
|
children: i.map((e) => /* @__PURE__ */ f("option", {
|
|
67
67
|
value: e,
|
|
@@ -69,32 +69,32 @@ function ne({ page: t, pageSize: n, totalRows: r, pageSizeOptions: i = [
|
|
|
69
69
|
}, e))
|
|
70
70
|
})]
|
|
71
71
|
}), /* @__PURE__ */ f("div", {
|
|
72
|
-
className:
|
|
72
|
+
className: o.paginatorNav,
|
|
73
73
|
children: [
|
|
74
74
|
/* @__PURE__ */ d("button", {
|
|
75
75
|
type: "button",
|
|
76
|
-
className:
|
|
77
|
-
disabled:
|
|
78
|
-
onClick: () =>
|
|
76
|
+
className: a(o.pageButton, c?.pageButton),
|
|
77
|
+
disabled: e <= 1,
|
|
78
|
+
onClick: () => s(e - 1, t),
|
|
79
79
|
"aria-label": "Previous page",
|
|
80
80
|
children: "‹"
|
|
81
81
|
}),
|
|
82
|
-
m.map((
|
|
83
|
-
className:
|
|
82
|
+
m.map((n, r) => n === "ellipsis" ? /* @__PURE__ */ d("span", {
|
|
83
|
+
className: o.pageEllipsis,
|
|
84
84
|
children: "…"
|
|
85
|
-
}, `ellipsis-${
|
|
85
|
+
}, `ellipsis-${r}`) : /* @__PURE__ */ d("button", {
|
|
86
86
|
type: "button",
|
|
87
|
-
className:
|
|
88
|
-
onClick: () =>
|
|
89
|
-
"aria-label": `Page ${
|
|
90
|
-
"aria-current":
|
|
91
|
-
children:
|
|
92
|
-
},
|
|
87
|
+
className: a(o.pageButton, n === e && o.pageButtonActive, c?.pageButton),
|
|
88
|
+
onClick: () => s(n, t),
|
|
89
|
+
"aria-label": `Page ${n}`,
|
|
90
|
+
"aria-current": n === e ? "page" : void 0,
|
|
91
|
+
children: n
|
|
92
|
+
}, n)),
|
|
93
93
|
/* @__PURE__ */ d("button", {
|
|
94
94
|
type: "button",
|
|
95
|
-
className:
|
|
96
|
-
disabled:
|
|
97
|
-
onClick: () =>
|
|
95
|
+
className: a(o.pageButton, c?.pageButton),
|
|
96
|
+
disabled: e >= l,
|
|
97
|
+
onClick: () => s(e + 1, t),
|
|
98
98
|
"aria-label": "Next page",
|
|
99
99
|
children: "›"
|
|
100
100
|
})
|
|
@@ -103,106 +103,106 @@ function ne({ page: t, pageSize: n, totalRows: r, pageSizeOptions: i = [
|
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
function h({ data: h, columns: g, sortConfig: _, onSort: v, multiSort: y = !0, scrollable: re = !1, dragScroll: b = !1, striped: ie = !1, hoverable: ae = !1, compact: oe = !1, className: se, style: ce, rowKey: x, rowClassName: S, rowStyle: C, emptyMessage: le = "No data", pagination: w, loading: T = !1, loadingRows: ue = 3, onRowClick: E, selectable: D = !1, selectedKeys: O, defaultSelectedKeys: de, onSelectionChange: k, isRowSelectable: A, bulkActions: j, selectionLabel: fe, columnVisibility: M, layout: pe = "auto", classes: N }) {
|
|
106
|
-
let P = v !== void 0, me = re || b, F =
|
|
107
|
-
if (!w || P) return
|
|
106
|
+
let P = v !== void 0, me = re || b, F = n(() => M ? g.filter((e) => M[m(e)] !== !1) : g, [g, M]), { sortedData: he, sortConfig: ge, requestSort: I, requestMultiSort: L } = s(h, _), R = P ? _ ?? [] : ge, z = P ? h : he, B = n(() => {
|
|
107
|
+
if (!w || P) return z;
|
|
108
108
|
let e = (w.page - 1) * w.pageSize;
|
|
109
|
-
return
|
|
109
|
+
return z.slice(e, e + w.pageSize);
|
|
110
110
|
}, [
|
|
111
|
-
|
|
111
|
+
z,
|
|
112
112
|
w,
|
|
113
113
|
P
|
|
114
|
-
]),
|
|
114
|
+
]), _e = w?.totalRows ?? z.length, V = e((e, t) => {
|
|
115
115
|
if (!x) return t;
|
|
116
116
|
let n = e[x];
|
|
117
117
|
return typeof n == "number" ? n : String(n);
|
|
118
118
|
}, [x]);
|
|
119
|
-
|
|
119
|
+
t(() => {
|
|
120
120
|
D && !x && console.error("Table: `selectable` needs `rowKey` so selections survive sorting and paging; falling back to the row index.");
|
|
121
121
|
}, [D, x]);
|
|
122
|
-
let [
|
|
123
|
-
if (
|
|
122
|
+
let [ve, ye] = i(() => de ?? []), H = O !== void 0, U = H ? O : ve, W = n(() => new Set(U), [U]), G = r(null), K = e((e) => {
|
|
123
|
+
if (H || ye(e), k) {
|
|
124
124
|
let t = new Set(e);
|
|
125
|
-
k(e,
|
|
125
|
+
k(e, z.filter((e, n) => t.has(V(e, n))));
|
|
126
126
|
}
|
|
127
127
|
}, [
|
|
128
|
-
|
|
128
|
+
H,
|
|
129
129
|
k,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
]),
|
|
130
|
+
z,
|
|
131
|
+
V
|
|
132
|
+
]), q = e((e) => !A || A(e) !== !1, [A]), J = n(() => {
|
|
133
133
|
if (!D) return [];
|
|
134
134
|
let e = [];
|
|
135
|
-
return
|
|
136
|
-
|
|
135
|
+
return B.forEach((t, n) => {
|
|
136
|
+
q(t) && e.push(V(t, n));
|
|
137
137
|
}), e;
|
|
138
138
|
}, [
|
|
139
139
|
D,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
]),
|
|
144
|
-
if (
|
|
145
|
-
let e = new Set(
|
|
146
|
-
|
|
140
|
+
B,
|
|
141
|
+
q,
|
|
142
|
+
V
|
|
143
|
+
]), be = J.filter((e) => W.has(e)).length, Y = J.length > 0 && be === J.length, xe = be > 0 && !Y, Se = e(() => {
|
|
144
|
+
if (Y) {
|
|
145
|
+
let e = new Set(J);
|
|
146
|
+
K(U.filter((t) => !e.has(t)));
|
|
147
147
|
} else {
|
|
148
|
-
let e = [...
|
|
149
|
-
for (let n of
|
|
150
|
-
|
|
148
|
+
let e = [...U], t = new Set(U);
|
|
149
|
+
for (let n of J) t.has(n) || e.push(n);
|
|
150
|
+
K(e);
|
|
151
151
|
}
|
|
152
152
|
}, [
|
|
153
|
+
Y,
|
|
153
154
|
J,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
let e = R.map((e, t) => z(e, t)), t = e.indexOf(U.current), n = e.indexOf(r);
|
|
155
|
+
U,
|
|
156
|
+
K
|
|
157
|
+
]), Ce = e((e, t, n) => {
|
|
158
|
+
let r = V(e, t), i = n.target.checked, a = n.nativeEvent.shiftKey === !0, o = [r];
|
|
159
|
+
if (a && G.current !== null) {
|
|
160
|
+
let e = B.map((e, t) => V(e, t)), t = e.indexOf(G.current), n = e.indexOf(r);
|
|
161
161
|
if (t >= 0 && n >= 0) {
|
|
162
162
|
let [r, i] = t < n ? [t, n] : [n, t];
|
|
163
163
|
o = [];
|
|
164
|
-
for (let t = r; t <= i; t++)
|
|
164
|
+
for (let t = r; t <= i; t++) q(B[t]) && o.push(e[t]);
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
G.current = r;
|
|
168
168
|
let s = new Set(o);
|
|
169
169
|
if (i) {
|
|
170
|
-
let e = new Set(
|
|
170
|
+
let e = new Set(U), t = [...U];
|
|
171
171
|
for (let n of o) e.has(n) || t.push(n);
|
|
172
|
-
|
|
173
|
-
} else
|
|
172
|
+
K(t);
|
|
173
|
+
} else K(U.filter((e) => !s.has(e)));
|
|
174
174
|
}, [
|
|
175
|
-
z,
|
|
176
|
-
R,
|
|
177
|
-
G,
|
|
178
175
|
V,
|
|
179
|
-
|
|
180
|
-
|
|
176
|
+
B,
|
|
177
|
+
q,
|
|
178
|
+
U,
|
|
179
|
+
K
|
|
180
|
+
]), we = e(() => K([]), [K]), Te = n(() => D && U.length ? z.filter((e, t) => W.has(V(e, t))) : [], [
|
|
181
181
|
D,
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
]), Ee =
|
|
182
|
+
U.length,
|
|
183
|
+
z,
|
|
184
|
+
W,
|
|
185
|
+
V
|
|
186
|
+
]), Ee = e((e, t, n) => {
|
|
187
187
|
if (!E) return;
|
|
188
188
|
let r = n.target?.closest?.(ee);
|
|
189
189
|
r && r !== n.currentTarget && n.currentTarget.contains(r) || E(e, t, n);
|
|
190
|
-
}, [E]), De =
|
|
190
|
+
}, [E]), De = e((e, t, n) => {
|
|
191
191
|
E && n.target === n.currentTarget && (n.key === "Enter" || n.key === " ") && (n.preventDefault(), E(e, t, n));
|
|
192
|
-
}, [E]), Oe =
|
|
192
|
+
}, [E]), Oe = e((e, t, n) => {
|
|
193
193
|
let r = y && (t.ctrlKey || t.metaKey || t.shiftKey), i = n === "asc" ? "desc" : "asc";
|
|
194
194
|
if (P) {
|
|
195
195
|
if (r) {
|
|
196
|
-
let t =
|
|
197
|
-
r = t === -1 ? [...
|
|
196
|
+
let t = R.findIndex((t) => t.key === e), r;
|
|
197
|
+
r = t === -1 ? [...R, {
|
|
198
198
|
key: e,
|
|
199
199
|
direction: n
|
|
200
|
-
}] :
|
|
200
|
+
}] : R[t].direction === n ? R.map((n, r) => r === t ? {
|
|
201
201
|
key: e,
|
|
202
202
|
direction: i
|
|
203
|
-
} : n) :
|
|
203
|
+
} : n) : R.filter((e, n) => n !== t), v(r);
|
|
204
204
|
} else {
|
|
205
|
-
let t =
|
|
205
|
+
let t = R.find((t) => t.key === e);
|
|
206
206
|
t ? t.direction === n ? v([{
|
|
207
207
|
key: e,
|
|
208
208
|
direction: i
|
|
@@ -211,15 +211,15 @@ function h({ data: h, columns: g, sortConfig: _, onSort: v, multiSort: y = !0, s
|
|
|
211
211
|
direction: n
|
|
212
212
|
}]);
|
|
213
213
|
}
|
|
214
|
-
} else r ?
|
|
214
|
+
} else r ? L(e, n) : I(e, n);
|
|
215
215
|
}, [
|
|
216
216
|
P,
|
|
217
217
|
y,
|
|
218
|
-
|
|
218
|
+
R,
|
|
219
219
|
v,
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
]), X =
|
|
220
|
+
I,
|
|
221
|
+
L
|
|
222
|
+
]), X = r(null), Z = r(null), Q = r(!1), [ke, Ae] = i(!1), je = e((e) => {
|
|
223
223
|
let t = X.current;
|
|
224
224
|
t && (Q.current = !1, e.button !== 1 && e.button !== 2 || t.scrollWidth <= t.clientWidth || (e.button === 1 && e.preventDefault(), Z.current = {
|
|
225
225
|
pointerId: e.pointerId,
|
|
@@ -229,7 +229,7 @@ function h({ data: h, columns: g, sortConfig: _, onSort: v, multiSort: y = !0, s
|
|
|
229
229
|
downAt: performance.now(),
|
|
230
230
|
dragging: !1
|
|
231
231
|
}));
|
|
232
|
-
}, []), Me =
|
|
232
|
+
}, []), Me = e((e) => {
|
|
233
233
|
let t = Z.current, n = X.current;
|
|
234
234
|
if (!t || !n || e.pointerId !== t.pointerId) return;
|
|
235
235
|
let r = e.clientX - t.startX;
|
|
@@ -245,98 +245,98 @@ function h({ data: h, columns: g, sortConfig: _, onSort: v, multiSort: y = !0, s
|
|
|
245
245
|
} catch {}
|
|
246
246
|
}
|
|
247
247
|
n.scrollLeft = t.startScrollLeft - r;
|
|
248
|
-
}, []), Ne =
|
|
248
|
+
}, []), Ne = e((e) => {
|
|
249
249
|
let t = Z.current;
|
|
250
250
|
t && e.pointerId === t.pointerId && (Z.current = null, t.dragging && (t.button === 2 && (Q.current = !0), Ae(!1)));
|
|
251
|
-
}, []), Pe =
|
|
251
|
+
}, []), Pe = e((e) => {
|
|
252
252
|
(Z.current?.dragging || Q.current) && (Q.current = !1, e.preventDefault());
|
|
253
|
-
}, []), $ = (e) =>
|
|
254
|
-
if (
|
|
255
|
-
let t =
|
|
253
|
+
}, []), $ = (e) => R.find((t) => t.key === e)?.direction, Fe = (e) => {
|
|
254
|
+
if (R.length <= 1) return;
|
|
255
|
+
let t = R.findIndex((t) => t.key === e);
|
|
256
256
|
return t >= 0 ? t : void 0;
|
|
257
|
-
}, Ie =
|
|
257
|
+
}, Ie = r(!1);
|
|
258
258
|
T && (Ie.current = !0);
|
|
259
|
-
let Le = F.length + +!!D, Re = T &&
|
|
260
|
-
className:
|
|
259
|
+
let Le = F.length + +!!D, Re = T && B.length === 0, ze = D && U.length > 0, Be = /* @__PURE__ */ f("table", {
|
|
260
|
+
className: a(o.root, ie && o.striped, ae && o.hoverable, oe && o.compact, pe === "fixed" && o.layoutFixed, N?.root, se),
|
|
261
261
|
style: ce,
|
|
262
262
|
"aria-busy": T || void 0,
|
|
263
263
|
children: [/* @__PURE__ */ d("thead", { children: /* @__PURE__ */ f("tr", { children: [D && /* @__PURE__ */ d("th", {
|
|
264
|
-
className:
|
|
265
|
-
children: /* @__PURE__ */ d(
|
|
264
|
+
className: a(o.headerCell, o.selectHeaderCell, N?.headerCell, N?.selectHeaderCell),
|
|
265
|
+
children: /* @__PURE__ */ d(u, {
|
|
266
266
|
"aria-label": "Select all",
|
|
267
|
-
checked:
|
|
268
|
-
indeterminate:
|
|
269
|
-
disabled:
|
|
270
|
-
onChange:
|
|
267
|
+
checked: Y,
|
|
268
|
+
indeterminate: xe,
|
|
269
|
+
disabled: J.length === 0,
|
|
270
|
+
onChange: Se
|
|
271
271
|
})
|
|
272
|
-
}), F.map((
|
|
273
|
-
className:
|
|
272
|
+
}), F.map((e) => /* @__PURE__ */ f("th", {
|
|
273
|
+
className: a(o.headerCell, p(e) && e.sortable && o.headerCellSortable, e.sticky && o.headerCellSticky, N?.headerCell),
|
|
274
274
|
style: {
|
|
275
|
-
width:
|
|
276
|
-
textAlign:
|
|
275
|
+
width: e.width,
|
|
276
|
+
textAlign: e.align
|
|
277
277
|
},
|
|
278
|
-
onClick: p(
|
|
279
|
-
"aria-sort": p(
|
|
280
|
-
children: [
|
|
281
|
-
direction: $(m(
|
|
282
|
-
sortIndex: Fe(m(
|
|
278
|
+
onClick: p(e) && e.sortable ? (t) => Oe(e.key, t, e.defaultSortDirection ?? "asc") : void 0,
|
|
279
|
+
"aria-sort": p(e) && e.sortable ? $(m(e)) === "asc" ? "ascending" : $(m(e)) === "desc" ? "descending" : "none" : void 0,
|
|
280
|
+
children: [e.header, p(e) && e.sortable && /* @__PURE__ */ d(te, {
|
|
281
|
+
direction: $(m(e)),
|
|
282
|
+
sortIndex: Fe(m(e))
|
|
283
283
|
})]
|
|
284
|
-
}, m(
|
|
285
|
-
className:
|
|
284
|
+
}, m(e)))] }) }), /* @__PURE__ */ d("tbody", { children: Re ? Array.from({ length: Math.max(1, ue) }, (e, t) => /* @__PURE__ */ f("tr", {
|
|
285
|
+
className: a(o.row, o.loadingRow, N?.row, N?.loadingRow),
|
|
286
286
|
"aria-hidden": "true",
|
|
287
|
-
children: [D && /* @__PURE__ */ d("td", { className:
|
|
288
|
-
className:
|
|
289
|
-
children: /* @__PURE__ */ d(
|
|
290
|
-
}, m(
|
|
291
|
-
}, `loading-${
|
|
292
|
-
className:
|
|
287
|
+
children: [D && /* @__PURE__ */ d("td", { className: a(o.cell, o.selectCell, N?.cell) }), F.map((e) => /* @__PURE__ */ d("td", {
|
|
288
|
+
className: a(o.cell, N?.cell),
|
|
289
|
+
children: /* @__PURE__ */ d(l, { variant: "text" })
|
|
290
|
+
}, m(e)))]
|
|
291
|
+
}, `loading-${t}`)) : B.length === 0 ? /* @__PURE__ */ d("tr", {
|
|
292
|
+
className: o.emptyRow,
|
|
293
293
|
children: /* @__PURE__ */ d("td", {
|
|
294
|
-
className:
|
|
294
|
+
className: a(o.emptyCell, N?.emptyCell),
|
|
295
295
|
colSpan: Le,
|
|
296
296
|
children: le
|
|
297
297
|
})
|
|
298
|
-
}) :
|
|
299
|
-
let
|
|
298
|
+
}) : B.map((e, t) => {
|
|
299
|
+
let n = x ? String(e[x]) : t, r = D ? V(e, t) : null, i = r !== null && W.has(r), s = typeof S == "function" ? S(e, t) : S, c = typeof C == "function" ? C(e, t) : C;
|
|
300
300
|
return /* @__PURE__ */ f("tr", {
|
|
301
|
-
className:
|
|
301
|
+
className: a(o.row, E && o.rowClickable, i && o.rowSelected, N?.row, E && N?.rowClickable, i && N?.rowSelected, s),
|
|
302
302
|
style: c,
|
|
303
303
|
tabIndex: E ? 0 : void 0,
|
|
304
|
-
onClick: E ? (
|
|
305
|
-
onKeyDown: E ? (
|
|
306
|
-
"aria-selected": D ?
|
|
304
|
+
onClick: E ? (n) => Ee(e, t, n) : void 0,
|
|
305
|
+
onKeyDown: E ? (n) => De(e, t, n) : void 0,
|
|
306
|
+
"aria-selected": D ? i : void 0,
|
|
307
307
|
children: [D && /* @__PURE__ */ d("td", {
|
|
308
|
-
className:
|
|
309
|
-
children: /* @__PURE__ */ d(
|
|
308
|
+
className: a(o.cell, o.selectCell, N?.cell, N?.selectCell),
|
|
309
|
+
children: /* @__PURE__ */ d(u, {
|
|
310
310
|
"aria-label": "Select row",
|
|
311
|
-
checked:
|
|
312
|
-
disabled: !
|
|
313
|
-
onChange: (
|
|
311
|
+
checked: i,
|
|
312
|
+
disabled: !q(e),
|
|
313
|
+
onChange: (n) => Ce(e, t, n)
|
|
314
314
|
})
|
|
315
|
-
}), F.map((
|
|
316
|
-
let
|
|
317
|
-
if (p(
|
|
318
|
-
let
|
|
319
|
-
|
|
320
|
-
} else
|
|
315
|
+
}), F.map((n) => {
|
|
316
|
+
let r, i, s;
|
|
317
|
+
if (p(n)) {
|
|
318
|
+
let a = e[n.key];
|
|
319
|
+
i = typeof n.cellClassName == "function" ? n.cellClassName(a, e, t) : n.cellClassName, s = typeof n.cellStyle == "function" ? n.cellStyle(a, e, t) : n.cellStyle, r = n.render ? n.render(a, e, t) : a;
|
|
320
|
+
} else i = typeof n.cellClassName == "function" ? n.cellClassName(e, t) : n.cellClassName, s = typeof n.cellStyle == "function" ? n.cellStyle(e, t) : n.cellStyle, r = n.render(e, t);
|
|
321
321
|
return /* @__PURE__ */ d("td", {
|
|
322
|
-
className:
|
|
322
|
+
className: a(o.cell, n.sticky && o.cellSticky, N?.cell, i),
|
|
323
323
|
style: {
|
|
324
|
-
textAlign:
|
|
325
|
-
...
|
|
324
|
+
textAlign: n.align,
|
|
325
|
+
...s
|
|
326
326
|
},
|
|
327
|
-
children:
|
|
328
|
-
}, m(
|
|
327
|
+
children: r
|
|
328
|
+
}, m(n));
|
|
329
329
|
})]
|
|
330
|
-
},
|
|
330
|
+
}, n);
|
|
331
331
|
}) })]
|
|
332
332
|
}), Ve = {
|
|
333
|
-
selectedKeys:
|
|
333
|
+
selectedKeys: U,
|
|
334
334
|
selectedRows: Te,
|
|
335
|
-
clear:
|
|
335
|
+
clear: we
|
|
336
336
|
};
|
|
337
337
|
return /* @__PURE__ */ f("div", {
|
|
338
338
|
ref: X,
|
|
339
|
-
className:
|
|
339
|
+
className: a(o.wrapper, me && o.scrollable, ke && o.dragging, N?.wrapper),
|
|
340
340
|
onPointerDown: b ? je : void 0,
|
|
341
341
|
onPointerMove: b ? Me : void 0,
|
|
342
342
|
onPointerUp: b ? Ne : void 0,
|
|
@@ -344,36 +344,36 @@ function h({ data: h, columns: g, sortConfig: _, onSort: v, multiSort: y = !0, s
|
|
|
344
344
|
onContextMenu: b ? Pe : void 0,
|
|
345
345
|
children: [
|
|
346
346
|
ze && /* @__PURE__ */ f("div", {
|
|
347
|
-
className:
|
|
347
|
+
className: a(o.bulkBar, N?.bulkBar),
|
|
348
348
|
role: "region",
|
|
349
349
|
"aria-label": "Selected rows",
|
|
350
350
|
children: [
|
|
351
351
|
/* @__PURE__ */ d("span", {
|
|
352
|
-
className:
|
|
353
|
-
children: fe ? fe(
|
|
352
|
+
className: a(o.bulkLabel, N?.bulkLabel),
|
|
353
|
+
children: fe ? fe(U.length) : `${U.length} selected`
|
|
354
354
|
}),
|
|
355
355
|
/* @__PURE__ */ d("button", {
|
|
356
356
|
type: "button",
|
|
357
|
-
className:
|
|
358
|
-
onClick:
|
|
357
|
+
className: a(o.bulkClear, N?.bulkClear),
|
|
358
|
+
onClick: we,
|
|
359
359
|
children: "Clear"
|
|
360
360
|
}),
|
|
361
361
|
j !== void 0 && /* @__PURE__ */ d("div", {
|
|
362
|
-
className:
|
|
362
|
+
className: a(o.bulkActions, N?.bulkActions),
|
|
363
363
|
children: typeof j == "function" ? j(Ve) : j
|
|
364
364
|
})
|
|
365
365
|
]
|
|
366
366
|
}),
|
|
367
|
-
T !== void 0 && (T || Ie.current) ? /* @__PURE__ */ d(
|
|
367
|
+
T !== void 0 && (T || Ie.current) ? /* @__PURE__ */ d(c, {
|
|
368
368
|
loading: T && !Re,
|
|
369
369
|
delay: 150,
|
|
370
370
|
backdrop: "dim",
|
|
371
|
-
classes: { root:
|
|
371
|
+
classes: { root: o.loaderWrap },
|
|
372
372
|
children: Be
|
|
373
373
|
}) : Be,
|
|
374
374
|
w && /* @__PURE__ */ d(ne, {
|
|
375
375
|
...w,
|
|
376
|
-
totalRows:
|
|
376
|
+
totalRows: _e,
|
|
377
377
|
paginatorClasses: {
|
|
378
378
|
paginator: N?.paginator,
|
|
379
379
|
pageButton: N?.pageButton
|