@middag-io/react 0.33.0 → 0.35.0
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 +28 -8
- package/dist-lib/base/shell/AuthShell.js +39 -0
- package/dist-lib/base/shell/BasicShell.js +207 -0
- package/dist-lib/base/shell/ImmersiveShell.js +55 -0
- package/dist-lib/base/shell/partials/InspectorContext.js +60 -0
- package/dist-lib/base/shell/partials/InspectorPanel.js +22 -0
- package/dist-lib/base/shell/partials/NavErrorBoundary.js +66 -0
- package/dist-lib/base/shell/partials/OverlayScreen.js +36 -0
- package/dist-lib/base/shell/partials/PageActionButton.js +4 -0
- package/dist-lib/base/theme/appearance.js +39 -0
- package/dist-lib/base/theme/host-layout-detector.js +39 -0
- package/dist-lib/base/theme/host-theme-detector.js +131 -0
- package/dist-lib/base/theme/sidebar-safelist.txt +20 -0
- package/dist-lib/base/theme/tailwind-theme.css +136 -0
- package/dist-lib/base/theme/theme-bridge.css +164 -0
- package/dist-lib/base/theme/theme-context.js +103 -0
- package/dist-lib/base/theme/themes/classic.css +174 -0
- package/dist-lib/base/theme/tokens.css +290 -0
- package/dist-lib/base/theme/useHostTheme.js +34 -0
- package/dist-lib/base/utils/clipboard.js +16 -0
- package/dist-lib/base/utils/conditions.js +13 -0
- package/dist-lib/base/utils/icon-registry.js +16 -0
- package/dist-lib/base/utils/icons.js +11 -0
- package/dist-lib/base/utils/interpolate.js +6 -0
- package/dist-lib/base/utils/register-default-icons.js +9 -0
- package/dist-lib/base/utils/storage.js +30 -0
- package/dist-lib/base/utils/time.js +59 -0
- package/dist-lib/chunks/subpath-BD_PKGUX.js +146 -0
- package/dist-lib/chunks/subpath-DLFO_UGQ.js +604 -0
- package/dist-lib/components/reui/accordion.js +43 -0
- package/dist-lib/components/reui/alert-dialog.js +101 -0
- package/dist-lib/components/reui/alert.js +55 -0
- package/dist-lib/components/reui/aspect-ratio.js +11 -0
- package/dist-lib/components/reui/autocomplete.js +170 -0
- package/dist-lib/components/reui/avatar.js +51 -0
- package/dist-lib/components/reui/badge.js +64 -0
- package/dist-lib/components/reui/breadcrumb.js +69 -0
- package/dist-lib/components/reui/button-group.js +38 -0
- package/dist-lib/components/reui/button.js +47 -0
- package/dist-lib/components/reui/calendar.js +89 -0
- package/dist-lib/components/reui/card.js +55 -0
- package/dist-lib/components/reui/carousel.js +110 -0
- package/dist-lib/components/reui/chart.js +130 -0
- package/dist-lib/components/reui/checkbox.js +20 -0
- package/dist-lib/components/reui/collapsible.js +23 -0
- package/dist-lib/components/reui/combobox.js +166 -0
- package/dist-lib/components/reui/command.js +85 -0
- package/dist-lib/components/reui/context-menu.js +121 -0
- package/dist-lib/components/reui/data-grid/data-grid-column-filter.js +108 -0
- package/dist-lib/components/reui/data-grid/data-grid-column-header.js +217 -0
- package/dist-lib/components/reui/data-grid/data-grid-column-visibility.js +25 -0
- package/dist-lib/components/reui/data-grid/data-grid-pagination.js +132 -0
- package/dist-lib/components/reui/data-grid/data-grid-scroll-area.js +183 -0
- package/dist-lib/components/reui/data-grid/data-grid-table-dnd-rows.js +125 -0
- package/dist-lib/components/reui/data-grid/data-grid-table-dnd.js +130 -0
- package/dist-lib/components/reui/data-grid/data-grid-table-virtual.js +156 -0
- package/dist-lib/components/reui/data-grid/data-grid-table.js +546 -0
- package/dist-lib/components/reui/data-grid/data-grid.js +113 -0
- package/dist-lib/components/reui/data-grid-pagination.js +131 -0
- package/dist-lib/components/reui/date-selector.js +642 -0
- package/dist-lib/components/reui/dialog.js +94 -0
- package/dist-lib/components/reui/drawer.js +77 -0
- package/dist-lib/components/reui/dropdown-menu.js +123 -0
- package/dist-lib/components/reui/empty.js +59 -0
- package/dist-lib/components/reui/field.js +115 -0
- package/dist-lib/components/reui/filters.js +873 -0
- package/dist-lib/components/reui/frame.js +97 -0
- package/dist-lib/components/reui/hover-card.js +31 -0
- package/dist-lib/components/reui/icon-placeholder.js +14 -0
- package/dist-lib/components/reui/index.js +18 -0
- package/dist-lib/components/reui/input-group.js +78 -0
- package/dist-lib/components/reui/input-otp.js +44 -0
- package/dist-lib/components/reui/input.js +14 -0
- package/dist-lib/components/reui/item.js +116 -0
- package/dist-lib/components/reui/kanban.js +316 -0
- package/dist-lib/components/reui/kbd.js +19 -0
- package/dist-lib/components/reui/label.js +14 -0
- package/dist-lib/components/reui/menubar.js +132 -0
- package/dist-lib/components/reui/native-select.js +37 -0
- package/dist-lib/components/reui/navigation-menu.js +80 -0
- package/dist-lib/components/reui/number-field.js +126 -0
- package/dist-lib/components/reui/pagination.js +78 -0
- package/dist-lib/components/reui/phone-input.js +124 -0
- package/dist-lib/components/reui/popover.js +55 -0
- package/dist-lib/components/reui/progress.js +20 -0
- package/dist-lib/components/reui/radio-group.js +27 -0
- package/dist-lib/components/reui/rating.js +81 -0
- package/dist-lib/components/reui/resizable.js +31 -0
- package/dist-lib/components/reui/scroll-area.js +36 -0
- package/dist-lib/components/reui/scrollspy.js +104 -0
- package/dist-lib/components/reui/select.js +97 -0
- package/dist-lib/components/reui/separator.js +17 -0
- package/dist-lib/components/reui/sheet.js +81 -0
- package/dist-lib/components/reui/sidebar.js +350 -0
- package/dist-lib/components/reui/skeleton.js +12 -0
- package/dist-lib/components/reui/slider.js +35 -0
- package/dist-lib/components/reui/sonner.js +28 -0
- package/dist-lib/components/reui/sortable.js +172 -0
- package/dist-lib/components/reui/spinner.js +14 -0
- package/dist-lib/components/reui/stepper.js +193 -0
- package/dist-lib/components/reui/svgs/claudeAiIcon.js +13 -0
- package/dist-lib/components/reui/svgs/gemini.js +257 -0
- package/dist-lib/components/reui/svgs/openai.js +10 -0
- package/dist-lib/components/reui/svgs/openaiDark.js +13 -0
- package/dist-lib/components/reui/switch.js +19 -0
- package/dist-lib/components/reui/table.js +66 -0
- package/dist-lib/components/reui/tabs.js +47 -0
- package/dist-lib/components/reui/textarea.js +13 -0
- package/dist-lib/components/reui/timeline.js +84 -0
- package/dist-lib/components/reui/toggle-group.js +48 -0
- package/dist-lib/components/reui/toggle.js +36 -0
- package/dist-lib/components/reui/tooltip.js +35 -0
- package/dist-lib/components/reui/tree.js +102 -0
- package/dist-lib/i18n/I18nProvider.js +23 -0
- package/dist-lib/i18n/host-resolver.js +10 -0
- package/dist-lib/i18n/instance.js +2 -0
- package/dist-lib/i18n/locales/en/ui.json +266 -0
- package/dist-lib/i18n/locales/en/validators.json +13 -0
- package/dist-lib/i18n/locales/pt-BR/ui.json +266 -0
- package/dist-lib/i18n/locales/pt-BR/validators.json +13 -0
- package/dist-lib/i18n/register-strings.js +7 -0
- package/dist-lib/i18n/render-label.js +13 -0
- package/dist-lib/i18n/resolve-field-error.js +10 -0
- package/dist-lib/i18n/useHostString.js +31 -0
- package/dist-lib/i18n/useTranslation.js +48 -0
- package/dist-lib/lib/actions/resolve-action-target.js +48 -0
- package/dist-lib/lib/hooks/use-copy-to-clipboard.js +18 -0
- package/dist-lib/lib/hooks/use-file-upload.js +171 -0
- package/dist-lib/lib/hooks/use-mobile.js +18 -0
- package/dist-lib/lib/portal-container.js +7 -0
- package/dist-lib/lib/utils.js +8 -0
- package/dist-lib/middag-react.css +1 -1
- package/package.json +41 -8
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
import { cn as e } from "../../../lib/utils.js";
|
|
2
|
+
import { Checkbox as t } from "../checkbox.js";
|
|
3
|
+
import { useDataGrid as n } from "./data-grid.js";
|
|
4
|
+
import { Spinner as r } from "../spinner.js";
|
|
5
|
+
import { Fragment as i, memo as a, useCallback as o, useEffect as s, useMemo as c, useState as l } from "react";
|
|
6
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
7
|
+
import { cva as p } from "class-variance-authority";
|
|
8
|
+
import { flexRender as m } from "@tanstack/react-table";
|
|
9
|
+
//#region src/components/reui/data-grid/data-grid-table.tsx
|
|
10
|
+
var h = p("", {
|
|
11
|
+
variants: { size: {
|
|
12
|
+
dense: "px-2.5 h-9",
|
|
13
|
+
default: "px-4"
|
|
14
|
+
} },
|
|
15
|
+
defaultVariants: { size: "default" }
|
|
16
|
+
}), g = p("", {
|
|
17
|
+
variants: { size: {
|
|
18
|
+
dense: "px-2.5 py-2",
|
|
19
|
+
default: "px-4 py-2.5"
|
|
20
|
+
} },
|
|
21
|
+
defaultVariants: { size: "default" }
|
|
22
|
+
}), _ = p("", {
|
|
23
|
+
variants: { size: {
|
|
24
|
+
dense: "px-2.5 py-2",
|
|
25
|
+
default: "px-4 py-2.5"
|
|
26
|
+
} },
|
|
27
|
+
defaultVariants: { size: "default" }
|
|
28
|
+
});
|
|
29
|
+
function v(e) {
|
|
30
|
+
let t = e.getIsPinned();
|
|
31
|
+
return {
|
|
32
|
+
left: t === "left" ? `${e.getStart("left")}px` : void 0,
|
|
33
|
+
right: t === "right" ? `${e.getAfter("right")}px` : void 0,
|
|
34
|
+
position: t ? "sticky" : "relative",
|
|
35
|
+
width: e.getSize(),
|
|
36
|
+
zIndex: t ? 1 : 0
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function y(e, t) {
|
|
40
|
+
if (e) {
|
|
41
|
+
if (typeof e == "function") {
|
|
42
|
+
e(t);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
e.current = t;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function b(e) {
|
|
49
|
+
return "touches" in e;
|
|
50
|
+
}
|
|
51
|
+
function x(e) {
|
|
52
|
+
return b(e) ? e.touches[0]?.clientX ?? e.changedTouches[0]?.clientX : e.clientX;
|
|
53
|
+
}
|
|
54
|
+
function S(e, t, n) {
|
|
55
|
+
let r = n.getColumn(t.column.id);
|
|
56
|
+
if (!r || !r.getCanResize() || b(e) && e.touches.length > 1) return;
|
|
57
|
+
e.persist?.();
|
|
58
|
+
let i = e.currentTarget.ownerDocument, a = i.body.style.cursor, o = i.documentElement.style.cursor, s = t.getSize(), c = x(e), l = e.currentTarget.closest("th")?.getBoundingClientRect(), u = l && Number.isFinite(n.options.columnResizeDirection === "rtl" ? l.left : l.right) ? n.options.columnResizeDirection === "rtl" ? l.left : l.right : c;
|
|
59
|
+
if (typeof c != "number" || typeof u != "number") return;
|
|
60
|
+
i.body.style.cursor = "col-resize", i.documentElement.style.cursor = "col-resize";
|
|
61
|
+
let d = t.getLeafHeaders().map((e) => [e.column.id, e.column.getSize()]), f = n.options.columnResizeDirection === "rtl" ? -1 : 1, p = (e, t = !1) => {
|
|
62
|
+
if (typeof e != "number") return;
|
|
63
|
+
let i = {}, a = (e - c) * f, o = Math.max(a / s, -.999999);
|
|
64
|
+
d.forEach(([e, t]) => {
|
|
65
|
+
i[e] = Math.round(Math.max(t + t * o, 0) * 100) / 100;
|
|
66
|
+
}), n.setColumnSizingInfo((e) => ({
|
|
67
|
+
...e,
|
|
68
|
+
startOffset: u,
|
|
69
|
+
startSize: s,
|
|
70
|
+
deltaOffset: a,
|
|
71
|
+
deltaPercentage: o,
|
|
72
|
+
columnSizingStart: d,
|
|
73
|
+
isResizingColumn: r.id
|
|
74
|
+
})), t && n.setColumnSizing((e) => ({
|
|
75
|
+
...e,
|
|
76
|
+
...i
|
|
77
|
+
}));
|
|
78
|
+
}, m = (e) => {
|
|
79
|
+
p(e, !0), n.setColumnSizingInfo((e) => ({
|
|
80
|
+
...e,
|
|
81
|
+
isResizingColumn: !1,
|
|
82
|
+
startOffset: null,
|
|
83
|
+
startSize: null,
|
|
84
|
+
deltaOffset: null,
|
|
85
|
+
deltaPercentage: null,
|
|
86
|
+
columnSizingStart: []
|
|
87
|
+
})), i.body.style.cursor = a, i.documentElement.style.cursor = o;
|
|
88
|
+
}, h = (e) => {
|
|
89
|
+
p(e.clientX);
|
|
90
|
+
}, g = (e) => {
|
|
91
|
+
i.removeEventListener("mousemove", h), i.removeEventListener("mouseup", g), m(e.clientX);
|
|
92
|
+
}, _ = (e) => {
|
|
93
|
+
e.cancelable && (e.preventDefault(), e.stopPropagation()), p(x(e));
|
|
94
|
+
}, v = (e) => {
|
|
95
|
+
i.removeEventListener("touchmove", _), i.removeEventListener("touchend", v), e.cancelable && (e.preventDefault(), e.stopPropagation()), m(x(e));
|
|
96
|
+
}, y = { passive: !1 };
|
|
97
|
+
b(e) ? (i.addEventListener("touchmove", _, y), i.addEventListener("touchend", v, y)) : (i.addEventListener("mousemove", h, y), i.addEventListener("mouseup", g, y)), n.setColumnSizingInfo((e) => ({
|
|
98
|
+
...e,
|
|
99
|
+
startOffset: u,
|
|
100
|
+
startSize: s,
|
|
101
|
+
deltaOffset: 0,
|
|
102
|
+
deltaPercentage: 0,
|
|
103
|
+
columnSizingStart: d,
|
|
104
|
+
isResizingColumn: r.id
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
function C(e, t) {
|
|
108
|
+
return t ? {
|
|
109
|
+
topRows: e.getTopRows(),
|
|
110
|
+
centerRows: e.getCenterRows(),
|
|
111
|
+
bottomRows: e.getBottomRows()
|
|
112
|
+
} : {
|
|
113
|
+
topRows: [],
|
|
114
|
+
centerRows: e.getRowModel().rows,
|
|
115
|
+
bottomRows: []
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function w(e, t) {
|
|
119
|
+
let { topRows: n, centerRows: r, bottomRows: i } = C(e, t), a = [];
|
|
120
|
+
return n.forEach((e, t) => {
|
|
121
|
+
a.push({
|
|
122
|
+
row: e,
|
|
123
|
+
pinnedBoundary: t === n.length - 1 && (r.length > 0 || i.length > 0) ? "top" : void 0
|
|
124
|
+
});
|
|
125
|
+
}), r.forEach((e) => {
|
|
126
|
+
a.push({ row: e });
|
|
127
|
+
}), i.forEach((e, t) => {
|
|
128
|
+
a.push({
|
|
129
|
+
row: e,
|
|
130
|
+
pinnedBoundary: t === 0 && (r.length > 0 || n.length > 0) ? "bottom" : void 0
|
|
131
|
+
});
|
|
132
|
+
}), a;
|
|
133
|
+
}
|
|
134
|
+
function T() {
|
|
135
|
+
let { props: e } = n();
|
|
136
|
+
return e.tableLayout?.columnsResizable ? /* @__PURE__ */ d("col", {
|
|
137
|
+
"data-slot": "data-grid-table-fill-col",
|
|
138
|
+
style: { width: "var(--data-grid-fill-size, 0px)" }
|
|
139
|
+
}) : null;
|
|
140
|
+
}
|
|
141
|
+
function E() {
|
|
142
|
+
let { props: e } = n();
|
|
143
|
+
return e.tableLayout?.columnsResizable ? /* @__PURE__ */ d("th", {
|
|
144
|
+
"aria-hidden": "true",
|
|
145
|
+
"data-slot": "data-grid-table-fill-head-cell",
|
|
146
|
+
style: { width: "var(--data-grid-fill-size, 0px)" },
|
|
147
|
+
className: "p-0"
|
|
148
|
+
}) : null;
|
|
149
|
+
}
|
|
150
|
+
function D() {
|
|
151
|
+
let { props: e } = n();
|
|
152
|
+
return e.tableLayout?.columnsResizable ? /* @__PURE__ */ d("td", {
|
|
153
|
+
"aria-hidden": "true",
|
|
154
|
+
"data-slot": "data-grid-table-fill-body-cell",
|
|
155
|
+
style: { width: "var(--data-grid-fill-size, 0px)" },
|
|
156
|
+
className: "p-0"
|
|
157
|
+
}) : null;
|
|
158
|
+
}
|
|
159
|
+
function O() {
|
|
160
|
+
let { props: e } = n();
|
|
161
|
+
return e.tableLayout?.columnsResizable ? /* @__PURE__ */ d("td", {
|
|
162
|
+
"aria-hidden": "true",
|
|
163
|
+
"data-slot": "data-grid-table-fill-foot-cell",
|
|
164
|
+
style: { width: "var(--data-grid-fill-size, 0px)" },
|
|
165
|
+
className: "border-t p-0"
|
|
166
|
+
}) : null;
|
|
167
|
+
}
|
|
168
|
+
function k({ children: t }) {
|
|
169
|
+
let { props: r, table: i } = n(), a = i.getVisibleLeafColumns(), o = c(() => {
|
|
170
|
+
if (!r.tableLayout?.columnsResizable) return;
|
|
171
|
+
let e = i.getFlatHeaders(), t = {};
|
|
172
|
+
for (let n = 0; n < e.length; n++) {
|
|
173
|
+
let r = e[n];
|
|
174
|
+
t[`--header-${r.id}-size`] = r.getSize(), t[`--col-${r.column.id}-size`] = r.column.getSize();
|
|
175
|
+
}
|
|
176
|
+
return t;
|
|
177
|
+
}, [
|
|
178
|
+
r.tableLayout?.columnsResizable,
|
|
179
|
+
i.getState().columnSizingInfo,
|
|
180
|
+
i.getState().columnSizing
|
|
181
|
+
]);
|
|
182
|
+
return /* @__PURE__ */ f("table", {
|
|
183
|
+
"data-slot": "data-grid-table",
|
|
184
|
+
className: e("text-foreground text-sm caption-bottom text-left align-middle font-normal rtl:text-right", r.tableLayout?.columnsResizable ? "min-w-0" : "w-full min-w-full", r.tableLayout?.width === "auto" ? "table-auto" : "table-fixed", !r.tableLayout?.columnsResizable && "", !r.tableLayout?.columnsDraggable && "border-separate border-spacing-0", r.tableClassNames?.base),
|
|
185
|
+
style: r.tableLayout?.columnsResizable ? {
|
|
186
|
+
...o,
|
|
187
|
+
width: `calc(${i.getTotalSize()}px + var(--data-grid-fill-size, 0px))`
|
|
188
|
+
} : void 0,
|
|
189
|
+
children: [/* @__PURE__ */ f("colgroup", { children: [a.map((e) => /* @__PURE__ */ d("col", { style: r.tableLayout?.columnsResizable ? { width: `calc(var(--col-${e.id}-size) * 1px)` } : r.tableLayout?.width === "fixed" ? { width: e.getSize() } : void 0 }, e.id)), /* @__PURE__ */ d(T, {})] }), t]
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function A({ children: t, className: r, viewportRef: i, style: a }) {
|
|
193
|
+
let { props: c, table: u } = n(), [p, m] = l(null), [h, g] = l(0), _ = o((e) => {
|
|
194
|
+
m(e), y(i, e);
|
|
195
|
+
}, [i]), v = c.tableLayout?.columnsResizable && h > 0 ? Math.max(0, h - u.getTotalSize()) : 0;
|
|
196
|
+
return s(() => {
|
|
197
|
+
if (!p || !c.tableLayout?.columnsResizable) {
|
|
198
|
+
g(0);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
let e = p.closest("[data-slot=\"scroll-area-viewport\"]") ?? p.parentElement ?? p, t = () => {
|
|
202
|
+
g(e.clientWidth);
|
|
203
|
+
};
|
|
204
|
+
if (t(), typeof ResizeObserver > "u") return;
|
|
205
|
+
let n = new ResizeObserver(t);
|
|
206
|
+
return n.observe(e), () => {
|
|
207
|
+
n.disconnect();
|
|
208
|
+
};
|
|
209
|
+
}, [c.tableLayout?.columnsResizable, p]), /* @__PURE__ */ f("div", {
|
|
210
|
+
"data-slot": "data-grid-table-viewport",
|
|
211
|
+
ref: _,
|
|
212
|
+
className: e("relative min-w-full align-top", r),
|
|
213
|
+
style: {
|
|
214
|
+
...c.tableLayout?.columnsResizable ? {
|
|
215
|
+
width: `calc(${u.getTotalSize()}px + var(--data-grid-fill-size, 0px))`,
|
|
216
|
+
"--data-grid-fill-size": `${v}px`
|
|
217
|
+
} : void 0,
|
|
218
|
+
...a
|
|
219
|
+
},
|
|
220
|
+
children: [t, /* @__PURE__ */ d(F, { viewportElement: p })]
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
function j({ children: t }) {
|
|
224
|
+
let { props: r } = n();
|
|
225
|
+
return /* @__PURE__ */ d("thead", {
|
|
226
|
+
className: e(r.tableClassNames?.header, r.tableLayout?.headerSticky && r.tableClassNames?.headerSticky),
|
|
227
|
+
children: t
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
function M({ children: t, headerGroup: r }) {
|
|
231
|
+
let { props: i } = n();
|
|
232
|
+
return /* @__PURE__ */ f("tr", {
|
|
233
|
+
className: e("bg-muted/40", i.tableLayout?.headerBorder && "[&>th]:border-b", i.tableLayout?.cellBorder && "*:last:border-e-0", i.tableLayout?.stripped && "bg-transparent", i.tableLayout?.headerBackground === !1 && "bg-transparent", i.tableClassNames?.headerRow),
|
|
234
|
+
children: [t, /* @__PURE__ */ d(E, {})]
|
|
235
|
+
}, r.id);
|
|
236
|
+
}
|
|
237
|
+
function N({ children: t, header: r, dndRef: i, dndStyle: a }) {
|
|
238
|
+
let { props: o } = n(), { column: s } = r, c = s.getIsPinned(), l = c === "left" && s.getIsLastColumn("left"), u = c === "right" && s.getIsFirstColumn("right"), f = s.getIndex() === r.getContext().table.getVisibleLeafColumns().length - 1, p = h({ size: o.tableLayout?.dense ? "dense" : "default" });
|
|
239
|
+
return /* @__PURE__ */ d("th", {
|
|
240
|
+
ref: i,
|
|
241
|
+
style: {
|
|
242
|
+
...o.tableLayout?.width === "fixed" && !o.tableLayout?.columnsResizable && { width: r.getSize() },
|
|
243
|
+
...o.tableLayout?.columnsPinnable && s.getCanPin() && v(s),
|
|
244
|
+
...o.tableLayout?.columnsResizable && { width: `calc(var(--header-${r.id}-size) * 1px)` },
|
|
245
|
+
...a || null
|
|
246
|
+
},
|
|
247
|
+
"data-pinned": c || void 0,
|
|
248
|
+
"data-last-col": l ? "left" : u ? "right" : void 0,
|
|
249
|
+
className: e("text-secondary-foreground/80 h-10 relative text-left align-middle font-normal rtl:text-right [&:has([role=checkbox])]:pe-0", p, o.tableLayout?.cellBorder && "border-e", o.tableLayout?.columnsResizable && s.getCanResize() && "overflow-visible", o.tableLayout?.columnsResizable && s.getCanResize() && f && "pe-8", o.tableLayout?.columnsPinnable && s.getCanPin() && "[&[data-pinned][data-last-col]]:border-border data-pinned:bg-muted/90 data-pinned:backdrop-blur-xs [&:not([data-pinned]):has(+[data-pinned])_div.cursor-col-resize:last-child]:opacity-0 [&[data-last-col=left]_div.cursor-col-resize:last-child]:opacity-0 [&[data-pinned=left][data-last-col=left]]:border-e! [&[data-pinned=right]:last-child_div.cursor-col-resize:last-child]:opacity-0 [&[data-pinned=right][data-last-col=right]]:border-s!", r.column.columnDef.meta?.headerClassName, s.getIndex() === 0 || s.getIndex() === r.headerGroup.headers.length - 1 ? o.tableClassNames?.edgeCell : ""),
|
|
250
|
+
children: t
|
|
251
|
+
}, r.id);
|
|
252
|
+
}
|
|
253
|
+
function P({ header: t }) {
|
|
254
|
+
let { props: r, table: i } = n(), { column: a } = t, o = a.getIndex() === t.getContext().table.getVisibleLeafColumns().length - 1, s = (r.tableLayout?.columnsResizeMode ?? i.options.columnResizeMode) === "onEnd";
|
|
255
|
+
return /* @__PURE__ */ d("div", {
|
|
256
|
+
onDoubleClick: () => a.resetSize(),
|
|
257
|
+
onMouseDown: (e) => {
|
|
258
|
+
if (e.preventDefault(), e.stopPropagation(), s) {
|
|
259
|
+
S(e, t, i);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
t.getResizeHandler()(e);
|
|
263
|
+
},
|
|
264
|
+
onTouchStart: (e) => {
|
|
265
|
+
if (e.preventDefault(), e.stopPropagation(), s) {
|
|
266
|
+
S(e, t, i);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
t.getResizeHandler()(e);
|
|
270
|
+
},
|
|
271
|
+
className: e("absolute top-0 h-full cursor-col-resize user-select-none touch-none z-10 flex", o ? "end-0 w-5 justify-end before:hidden" : "-end-2 w-5 justify-center before:absolute before:inset-y-0 before:w-px before:-translate-x-px before:bg-border", a.getIsResizing() && (s ? "opacity-100" : o ? "before:absolute before:end-0 before:block before:inset-y-0 before:w-0.5 before:bg-primary opacity-100" : "before:block before:bg-primary before:w-0.5 opacity-100"))
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
function F({ viewportElement: e }) {
|
|
275
|
+
let { props: t, table: r } = n(), i = r.getState().columnSizingInfo, a = i.isResizingColumn, o = t.tableLayout?.columnsResizeMode ?? r.options.columnResizeMode;
|
|
276
|
+
if (!t.tableLayout?.columnsResizable || o !== "onEnd" || !a) return null;
|
|
277
|
+
let s = r.getFlatHeaders().find((e) => e.column.id === a || e.id === a);
|
|
278
|
+
if (!s) return null;
|
|
279
|
+
let c = i.deltaOffset ?? 0, l = e?.querySelector("[data-slot=\"data-grid-table\"] thead")?.getBoundingClientRect().height ?? 0, u = typeof i.startOffset == "number" && e ? i.startOffset - e.getBoundingClientRect().left : s.getStart() + s.getSize();
|
|
280
|
+
return /* @__PURE__ */ f("div", {
|
|
281
|
+
"aria-hidden": "true",
|
|
282
|
+
className: "pointer-events-none absolute inset-y-0 z-20",
|
|
283
|
+
style: {
|
|
284
|
+
left: u,
|
|
285
|
+
transform: `translateX(${c}px)`
|
|
286
|
+
},
|
|
287
|
+
children: [/* @__PURE__ */ d("div", { className: "bg-primary/85 absolute inset-y-0 left-0 w-px -translate-x-1/2" }), /* @__PURE__ */ d("div", {
|
|
288
|
+
className: "bg-primary absolute top-0 left-0 -translate-x-1/2 rounded-b-sm shadow-xs",
|
|
289
|
+
style: {
|
|
290
|
+
width: 5,
|
|
291
|
+
height: Math.max(l, 6)
|
|
292
|
+
}
|
|
293
|
+
})]
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function I() {
|
|
297
|
+
return /* @__PURE__ */ d("tbody", {
|
|
298
|
+
"aria-hidden": "true",
|
|
299
|
+
className: "h-2"
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
function L({ children: t }) {
|
|
303
|
+
let { props: r } = n();
|
|
304
|
+
return /* @__PURE__ */ d("tbody", {
|
|
305
|
+
className: e("[&_tr:last-child]:border-0", r.tableLayout?.rowRounded && "[&_td:first-child]:rounded-l-none", r.tableLayout?.rowRounded && "[&_td:last-child]:rounded-r-none", r.tableClassNames?.body),
|
|
306
|
+
children: t
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
function R({ children: t }) {
|
|
310
|
+
let { props: r } = n();
|
|
311
|
+
return /* @__PURE__ */ d("tfoot", {
|
|
312
|
+
className: e("border-t", r.tableClassNames?.footer),
|
|
313
|
+
children: t
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
function z({ children: t }) {
|
|
317
|
+
let { props: r } = n();
|
|
318
|
+
return /* @__PURE__ */ f("tr", {
|
|
319
|
+
className: e("bg-muted/40 dark:bg-background", r.tableLayout?.cellBorder && "*:last:border-e-0"),
|
|
320
|
+
children: [t, /* @__PURE__ */ d(O, {})]
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
function B({ children: t, colSpan: r, className: i }) {
|
|
324
|
+
let { props: a } = n();
|
|
325
|
+
return /* @__PURE__ */ d("td", {
|
|
326
|
+
colSpan: r,
|
|
327
|
+
className: e("text-secondary-foreground/80 border-t align-middle font-medium", _({ size: a.tableLayout?.dense ? "dense" : "default" }), a.tableLayout?.cellBorder && "border-e", i),
|
|
328
|
+
children: t
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
function V({ children: t }) {
|
|
332
|
+
let { table: r, props: i } = n();
|
|
333
|
+
return /* @__PURE__ */ f("tr", {
|
|
334
|
+
className: e("hover:bg-muted/40 data-[state=selected]:bg-muted/50", i.onRowClick && "cursor-pointer", !i.tableLayout?.stripped && i.tableLayout?.rowBorder && "border-border border-b [&:not(:last-child)>td]:border-b", i.tableLayout?.cellBorder && "*:last:border-e-0", i.tableLayout?.stripped && "odd:bg-muted/90 odd:hover:bg-muted hover:bg-transparent", r.options.enableRowSelection && "*:first:relative", i.tableClassNames?.bodyRow),
|
|
335
|
+
children: [t, /* @__PURE__ */ d(D, {})]
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
function H({ children: t, column: r }) {
|
|
339
|
+
let { props: i, table: a } = n(), o = g({ size: i.tableLayout?.dense ? "dense" : "default" });
|
|
340
|
+
return /* @__PURE__ */ d("td", {
|
|
341
|
+
style: i.tableLayout?.columnsResizable ? { width: `calc(var(--col-${r.id}-size) * 1px)` } : void 0,
|
|
342
|
+
className: e("align-middle", o, i.tableLayout?.cellBorder && "border-e", i.tableLayout?.columnsResizable && r.getCanResize() && "truncate", r.columnDef.meta?.cellClassName, i.tableLayout?.columnsPinnable && r.getCanPin() && "[&[data-pinned][data-last-col]]:border-border data-pinned:bg-background/90 data-pinned:backdrop-blur-xs\" [&[data-pinned=left][data-last-col=left]]:border-e! [&[data-pinned=right][data-last-col=right]]:border-s!", r.getIndex() === 0 || r.getIndex() === a.getVisibleFlatColumns().length - 1 ? i.tableClassNames?.edgeCell : ""),
|
|
343
|
+
children: t
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
function U({ children: t, row: r, pinnedBoundary: i, rowRef: a, dndRef: o, dndStyle: s }) {
|
|
347
|
+
let { props: c, table: l } = n(), u = r.getIsPinned();
|
|
348
|
+
return /* @__PURE__ */ f("tr", {
|
|
349
|
+
ref: (e) => {
|
|
350
|
+
y(a, e), y(o, e);
|
|
351
|
+
},
|
|
352
|
+
style: { ...s || null },
|
|
353
|
+
"data-state": l.options.enableRowSelection && r.getIsSelected() ? "selected" : void 0,
|
|
354
|
+
"data-row-pinned": u || void 0,
|
|
355
|
+
"data-row-pinned-boundary": i,
|
|
356
|
+
onClick: () => c.onRowClick && c.onRowClick(r.original),
|
|
357
|
+
className: e("hover:bg-muted/40 data-[state=selected]:bg-muted/50", c.onRowClick && "cursor-pointer", !c.tableLayout?.stripped && c.tableLayout?.rowBorder && "border-border border-b [&:not(:last-child)>td]:border-b", c.tableLayout?.cellBorder && "*:last:border-e-0", c.tableLayout?.stripped && "odd:bg-muted/90 odd:hover:bg-muted hover:bg-transparent", l.options.enableRowSelection && "*:first:relative", c.tableLayout?.rowsPinnable && u && "bg-muted/30 hover:bg-muted/50", i === "top" && "[&>td]:shadow-[0_2px_0_rgba(0,0,0,0.03)]", i === "bottom" && "[&>td]:shadow-[0_2px_0_rgba(0,0,0,0.03)]", c.tableClassNames?.bodyRow),
|
|
358
|
+
children: [t, /* @__PURE__ */ d(D, {})]
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
function W({ row: t }) {
|
|
362
|
+
let { props: r, table: i } = n();
|
|
363
|
+
return /* @__PURE__ */ d("tr", {
|
|
364
|
+
className: e(r.tableLayout?.rowBorder && "[&:not(:last-child)>td]:border-b"),
|
|
365
|
+
children: /* @__PURE__ */ d("td", {
|
|
366
|
+
colSpan: t.getVisibleCells().length + (r.tableLayout?.columnsResizable ? 1 : 0),
|
|
367
|
+
children: i.getAllColumns().find((e) => e.columnDef.meta?.expandedContent)?.columnDef.meta?.expandedContent?.(t.original)
|
|
368
|
+
})
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
function G({ children: t, cell: r, dndRef: i, dndStyle: a }) {
|
|
372
|
+
let { props: o } = n(), { column: s, row: c } = r, l = s.getIsPinned(), u = l === "left" && s.getIsLastColumn("left"), f = l === "right" && s.getIsFirstColumn("right"), p = g({ size: o.tableLayout?.dense ? "dense" : "default" });
|
|
373
|
+
return /* @__PURE__ */ d("td", {
|
|
374
|
+
ref: i,
|
|
375
|
+
...o.tableLayout?.columnsDraggable && !l ? { cell: r } : {},
|
|
376
|
+
style: {
|
|
377
|
+
...o.tableLayout?.columnsPinnable && s.getCanPin() && v(s),
|
|
378
|
+
...o.tableLayout?.columnsResizable && { width: `calc(var(--col-${s.id}-size) * 1px)` },
|
|
379
|
+
...a || null
|
|
380
|
+
},
|
|
381
|
+
"data-pinned": l || void 0,
|
|
382
|
+
"data-last-col": u ? "left" : f ? "right" : void 0,
|
|
383
|
+
className: e("align-middle", p, o.tableLayout?.cellBorder && "border-e", o.tableLayout?.columnsResizable && s.getCanResize() && "truncate", r.column.columnDef.meta?.cellClassName, o.tableLayout?.columnsPinnable && s.getCanPin() && "[&[data-pinned][data-last-col]]:border-border data-pinned:bg-background/90 data-pinned:backdrop-blur-xs\" [&[data-pinned=left][data-last-col=left]]:border-e! [&[data-pinned=right][data-last-col=right]]:border-s!", s.getIndex() === 0 || s.getIndex() === c.getVisibleCells().length - 1 ? o.tableClassNames?.edgeCell : ""),
|
|
384
|
+
children: t
|
|
385
|
+
}, r.id);
|
|
386
|
+
}
|
|
387
|
+
function K({ row: e, pinnedBoundary: t, rowRef: n }) {
|
|
388
|
+
return /* @__PURE__ */ f(i, { children: [/* @__PURE__ */ d(U, {
|
|
389
|
+
row: e,
|
|
390
|
+
pinnedBoundary: t,
|
|
391
|
+
rowRef: n,
|
|
392
|
+
children: e.getVisibleCells().map((e) => /* @__PURE__ */ d(G, {
|
|
393
|
+
cell: e,
|
|
394
|
+
children: m(e.column.columnDef.cell, e.getContext())
|
|
395
|
+
}, e.id))
|
|
396
|
+
}), e.getIsExpanded() && /* @__PURE__ */ d(W, { row: e })] });
|
|
397
|
+
}
|
|
398
|
+
function q() {
|
|
399
|
+
let { table: e, props: t } = n(), r = e.getVisibleLeafColumns().length + (t.tableLayout?.columnsResizable ? 1 : 0);
|
|
400
|
+
return /* @__PURE__ */ d("tr", { children: /* @__PURE__ */ d("td", {
|
|
401
|
+
colSpan: Math.max(r, 1),
|
|
402
|
+
className: "text-muted-foreground text-sm py-6 text-center",
|
|
403
|
+
children: t.emptyMessage || "No data available"
|
|
404
|
+
}) });
|
|
405
|
+
}
|
|
406
|
+
function J() {
|
|
407
|
+
let { props: e } = n();
|
|
408
|
+
return /* @__PURE__ */ d("div", {
|
|
409
|
+
className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
410
|
+
children: /* @__PURE__ */ f("div", {
|
|
411
|
+
className: "text-muted-foreground bg-card rounded-2xl text-sm flex items-center gap-2 border px-4 py-2 leading-none font-medium",
|
|
412
|
+
children: [/* @__PURE__ */ d(r, { className: "size-5 opacity-60" }), e.loadingMessage || "Loading..."]
|
|
413
|
+
})
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
function Y({ row: t }) {
|
|
417
|
+
let n = t.getIsPinned();
|
|
418
|
+
return /* @__PURE__ */ d("button", {
|
|
419
|
+
type: "button",
|
|
420
|
+
"aria-label": n ? "Unpin row" : "Pin row",
|
|
421
|
+
onClick: () => {
|
|
422
|
+
n ? t.pin(!1) : t.pin("top");
|
|
423
|
+
},
|
|
424
|
+
className: e("text-muted-foreground hover:text-foreground inline-flex size-7 items-center justify-center rounded-md transition-colors", n && "text-primary hover:text-primary/80"),
|
|
425
|
+
children: n ? /* @__PURE__ */ d("svg", {
|
|
426
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
427
|
+
width: "16",
|
|
428
|
+
height: "16",
|
|
429
|
+
viewBox: "0 0 24 24",
|
|
430
|
+
fill: "currentColor",
|
|
431
|
+
stroke: "none",
|
|
432
|
+
children: /* @__PURE__ */ d("path", { d: "M16 2l4.585 4.586-2.122 2.121L17.05 7.293l-3.535 3.536 1.413 5.658-2.12 2.121-4.244-4.243L4.322 18.6l-1.414-1.41 4.242-4.244-4.243-4.243 2.122-2.121 5.656 1.414 3.536-3.536-1.414-1.414z" })
|
|
433
|
+
}) : /* @__PURE__ */ f("svg", {
|
|
434
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
435
|
+
width: "16",
|
|
436
|
+
height: "16",
|
|
437
|
+
viewBox: "0 0 24 24",
|
|
438
|
+
fill: "none",
|
|
439
|
+
stroke: "currentColor",
|
|
440
|
+
strokeWidth: "2",
|
|
441
|
+
strokeLinecap: "round",
|
|
442
|
+
strokeLinejoin: "round",
|
|
443
|
+
children: [/* @__PURE__ */ d("line", {
|
|
444
|
+
x1: "12",
|
|
445
|
+
y1: "17",
|
|
446
|
+
x2: "12",
|
|
447
|
+
y2: "22"
|
|
448
|
+
}), /* @__PURE__ */ d("path", { d: "M5 17h14v-1.76a2 2 0 00-1.11-1.79l-1.78-.9A2 2 0 0115 10.76V6h1a2 2 0 000-4H8a2 2 0 000 4h1v4.76a2 2 0 01-1.11 1.79l-1.78.9A2 2 0 005 15.24z" })]
|
|
449
|
+
})
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
function X({ row: n }) {
|
|
453
|
+
return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("div", { className: e("bg-primary absolute inset-s-0 top-0 bottom-0 hidden w-[2px]", n.getIsSelected() && "block") }), /* @__PURE__ */ d(t, {
|
|
454
|
+
checked: n.getIsSelected(),
|
|
455
|
+
onCheckedChange: (e) => n.toggleSelected(!!e),
|
|
456
|
+
"aria-label": "Select row",
|
|
457
|
+
className: "align-[inherit]"
|
|
458
|
+
})] });
|
|
459
|
+
}
|
|
460
|
+
function Z() {
|
|
461
|
+
let { table: e, recordCount: r, isLoading: i } = n(), a = e.getIsAllPageRowsSelected();
|
|
462
|
+
return /* @__PURE__ */ d(t, {
|
|
463
|
+
checked: e.getIsSomePageRowsSelected() && !a ? "indeterminate" : a,
|
|
464
|
+
disabled: i || r === 0,
|
|
465
|
+
onCheckedChange: (t) => e.toggleAllPageRowsSelected(!!t),
|
|
466
|
+
"aria-label": "Select all",
|
|
467
|
+
className: "align-[inherit]"
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
function Q({ table: e }) {
|
|
471
|
+
let { isLoading: t, props: r } = n(), i = e.getState().pagination;
|
|
472
|
+
if (t && r.loadingMode === "skeleton" && i?.pageSize) return /* @__PURE__ */ d(u, { children: Array.from({ length: i.pageSize }).map((t, n) => /* @__PURE__ */ d(V, { children: e.getVisibleFlatColumns().map((e, t) => /* @__PURE__ */ d(H, {
|
|
473
|
+
column: e,
|
|
474
|
+
children: e.columnDef.meta?.skeleton
|
|
475
|
+
}, t)) }, n)) });
|
|
476
|
+
if (t && r.loadingMode === "spinner") return /* @__PURE__ */ d("tr", { children: /* @__PURE__ */ d("td", {
|
|
477
|
+
colSpan: e.getVisibleFlatColumns().length,
|
|
478
|
+
className: "p-8",
|
|
479
|
+
children: /* @__PURE__ */ f("div", {
|
|
480
|
+
className: "flex items-center justify-center",
|
|
481
|
+
children: [/* @__PURE__ */ f("svg", {
|
|
482
|
+
className: "text-muted-foreground mr-3 -ml-1 h-5 w-5 animate-spin",
|
|
483
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
484
|
+
fill: "none",
|
|
485
|
+
viewBox: "0 0 24 24",
|
|
486
|
+
children: [/* @__PURE__ */ d("circle", {
|
|
487
|
+
className: "opacity-25",
|
|
488
|
+
cx: "12",
|
|
489
|
+
cy: "12",
|
|
490
|
+
r: "10",
|
|
491
|
+
stroke: "currentColor",
|
|
492
|
+
strokeWidth: "4"
|
|
493
|
+
}), /* @__PURE__ */ d("path", {
|
|
494
|
+
className: "opacity-75",
|
|
495
|
+
fill: "currentColor",
|
|
496
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
497
|
+
})]
|
|
498
|
+
}), r.loadingMessage || "Loading..."]
|
|
499
|
+
})
|
|
500
|
+
}) });
|
|
501
|
+
let a = w(e, r.tableLayout?.rowsPinnable);
|
|
502
|
+
return a.length ? /* @__PURE__ */ d(u, { children: a.map(({ row: e, pinnedBoundary: t }) => /* @__PURE__ */ d(K, {
|
|
503
|
+
row: e,
|
|
504
|
+
pinnedBoundary: t
|
|
505
|
+
}, e.id)) }) : /* @__PURE__ */ d(q, {});
|
|
506
|
+
}
|
|
507
|
+
var $ = a(Q, (e, t) => !!t.table.getState().columnSizingInfo.isResizingColumn);
|
|
508
|
+
function ee() {
|
|
509
|
+
let { table: e, props: t } = n();
|
|
510
|
+
return /* @__PURE__ */ d(A, { children: /* @__PURE__ */ d(k, { children: /* @__PURE__ */ d(j, { children: e.getHeaderGroups().map((e, n) => /* @__PURE__ */ d(M, {
|
|
511
|
+
headerGroup: e,
|
|
512
|
+
children: e.headers.map((e, n) => {
|
|
513
|
+
let { column: r } = e;
|
|
514
|
+
return /* @__PURE__ */ f(N, {
|
|
515
|
+
header: e,
|
|
516
|
+
children: [e.isPlaceholder ? null : t.tableLayout?.columnsResizable && r.getCanResize() ? /* @__PURE__ */ d("div", {
|
|
517
|
+
className: "truncate",
|
|
518
|
+
children: m(e.column.columnDef.header, e.getContext())
|
|
519
|
+
}) : m(e.column.columnDef.header, e.getContext()), t.tableLayout?.columnsResizable && r.getCanResize() && /* @__PURE__ */ d(P, { header: e })]
|
|
520
|
+
}, n);
|
|
521
|
+
})
|
|
522
|
+
}, n)) }) }) });
|
|
523
|
+
}
|
|
524
|
+
function te({ footerContent: e, renderHeader: t = !0 }) {
|
|
525
|
+
let { table: r, props: i } = n();
|
|
526
|
+
return /* @__PURE__ */ d(A, { children: /* @__PURE__ */ f(k, { children: [
|
|
527
|
+
t && /* @__PURE__ */ d(j, { children: r.getHeaderGroups().map((e, t) => /* @__PURE__ */ d(M, {
|
|
528
|
+
headerGroup: e,
|
|
529
|
+
children: e.headers.map((e, t) => {
|
|
530
|
+
let { column: n } = e;
|
|
531
|
+
return /* @__PURE__ */ f(N, {
|
|
532
|
+
header: e,
|
|
533
|
+
children: [e.isPlaceholder ? null : i.tableLayout?.columnsResizable && n.getCanResize() ? /* @__PURE__ */ d("div", {
|
|
534
|
+
className: "truncate",
|
|
535
|
+
children: m(e.column.columnDef.header, e.getContext())
|
|
536
|
+
}) : m(e.column.columnDef.header, e.getContext()), i.tableLayout?.columnsResizable && n.getCanResize() && /* @__PURE__ */ d(P, { header: e })]
|
|
537
|
+
}, t);
|
|
538
|
+
})
|
|
539
|
+
}, t)) }),
|
|
540
|
+
t && (i.tableLayout?.stripped || !i.tableLayout?.rowBorder) && /* @__PURE__ */ d(I, {}),
|
|
541
|
+
/* @__PURE__ */ d(L, { children: /* @__PURE__ */ d($, { table: r }) }),
|
|
542
|
+
e && /* @__PURE__ */ d(R, { children: e })
|
|
543
|
+
] }) });
|
|
544
|
+
}
|
|
545
|
+
//#endregion
|
|
546
|
+
export { te as DataGridTable, k as DataGridTableBase, L as DataGridTableBody, U as DataGridTableBodyRow, G as DataGridTableBodyRowCell, W as DataGridTableBodyRowExpandded, V as DataGridTableBodyRowSkeleton, H as DataGridTableBodyRowSkeletonCell, q as DataGridTableEmpty, R as DataGridTableFoot, z as DataGridTableFootRow, B as DataGridTableFootRowCell, j as DataGridTableHead, M as DataGridTableHeadRow, N as DataGridTableHeadRowCell, P as DataGridTableHeadRowCellResize, ee as DataGridTableHeader, J as DataGridTableLoader, K as DataGridTableRenderedRow, Y as DataGridTableRowPin, X as DataGridTableRowSelect, Z as DataGridTableRowSelectAll, I as DataGridTableRowSpacer, A as DataGridTableViewport, w as getDataGridTableResolvedRows, C as getDataGridTableRowSections };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../../lib/utils.js";
|
|
3
|
+
import { createContext as t, useContext as n, useMemo as r } from "react";
|
|
4
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/reui/data-grid/data-grid.tsx
|
|
6
|
+
function a(e) {
|
|
7
|
+
let t = e.columnDef.meta;
|
|
8
|
+
if (typeof t?.headerTitle == "string") return t.headerTitle;
|
|
9
|
+
let n = e.columnDef.header;
|
|
10
|
+
return typeof n == "string" ? n : String(e.id);
|
|
11
|
+
}
|
|
12
|
+
var o = t(void 0);
|
|
13
|
+
function s() {
|
|
14
|
+
let e = n(o);
|
|
15
|
+
if (!e) throw Error("useDataGrid must be used within a DataGridProvider");
|
|
16
|
+
return e;
|
|
17
|
+
}
|
|
18
|
+
function c({ children: e, table: t, ...n }) {
|
|
19
|
+
let a = t.getState(), s = n.tableLayout?.columnsResizeMode ?? "onEnd";
|
|
20
|
+
n.tableLayout?.columnsResizable && (t.options.columnResizeMode = s);
|
|
21
|
+
let c = r(() => ({
|
|
22
|
+
props: n,
|
|
23
|
+
table: t,
|
|
24
|
+
recordCount: n.recordCount,
|
|
25
|
+
isLoading: n.isLoading || !1
|
|
26
|
+
}), [
|
|
27
|
+
t,
|
|
28
|
+
n.recordCount,
|
|
29
|
+
n.isLoading,
|
|
30
|
+
n.loadingMode,
|
|
31
|
+
n.loadingMessage,
|
|
32
|
+
n.fetchingMoreMessage,
|
|
33
|
+
n.allRowsLoadedMessage,
|
|
34
|
+
n.emptyMessage,
|
|
35
|
+
n.onRowClick,
|
|
36
|
+
n.className,
|
|
37
|
+
JSON.stringify(n.tableLayout),
|
|
38
|
+
JSON.stringify(n.tableClassNames),
|
|
39
|
+
a.sorting,
|
|
40
|
+
a.pagination,
|
|
41
|
+
a.columnFilters,
|
|
42
|
+
a.rowSelection,
|
|
43
|
+
a.expanded,
|
|
44
|
+
a.columnVisibility,
|
|
45
|
+
a.columnOrder,
|
|
46
|
+
a.columnPinning,
|
|
47
|
+
a.globalFilter
|
|
48
|
+
]);
|
|
49
|
+
return /* @__PURE__ */ i(o.Provider, {
|
|
50
|
+
value: c,
|
|
51
|
+
children: e
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function l({ children: e, table: t, ...n }) {
|
|
55
|
+
let r = {
|
|
56
|
+
loadingMode: "skeleton",
|
|
57
|
+
tableLayout: {
|
|
58
|
+
dense: !1,
|
|
59
|
+
cellBorder: !1,
|
|
60
|
+
rowBorder: !0,
|
|
61
|
+
rowRounded: !1,
|
|
62
|
+
stripped: !1,
|
|
63
|
+
headerSticky: !1,
|
|
64
|
+
headerBackground: !0,
|
|
65
|
+
headerBorder: !0,
|
|
66
|
+
width: "fixed",
|
|
67
|
+
columnsVisibility: !1,
|
|
68
|
+
columnsResizable: !1,
|
|
69
|
+
columnsResizeMode: "onEnd",
|
|
70
|
+
columnsPinnable: !1,
|
|
71
|
+
columnsMovable: !1,
|
|
72
|
+
columnsDraggable: !1,
|
|
73
|
+
rowsDraggable: !1,
|
|
74
|
+
rowsPinnable: !1
|
|
75
|
+
},
|
|
76
|
+
tableClassNames: {
|
|
77
|
+
base: "",
|
|
78
|
+
header: "",
|
|
79
|
+
headerRow: "",
|
|
80
|
+
headerSticky: "sticky top-0 z-15 bg-background/90 backdrop-blur-xs",
|
|
81
|
+
body: "",
|
|
82
|
+
bodyRow: "",
|
|
83
|
+
footer: "",
|
|
84
|
+
edgeCell: ""
|
|
85
|
+
}
|
|
86
|
+
}, a = {
|
|
87
|
+
...r,
|
|
88
|
+
...n,
|
|
89
|
+
tableLayout: {
|
|
90
|
+
...r.tableLayout,
|
|
91
|
+
...n.tableLayout || {}
|
|
92
|
+
},
|
|
93
|
+
tableClassNames: {
|
|
94
|
+
...r.tableClassNames,
|
|
95
|
+
...n.tableClassNames || {}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
if (!t) throw Error("DataGrid requires a \"table\" prop");
|
|
99
|
+
return /* @__PURE__ */ i(c, {
|
|
100
|
+
table: t,
|
|
101
|
+
...a,
|
|
102
|
+
children: e
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function u({ children: t, className: n, border: r = !0 }) {
|
|
106
|
+
return /* @__PURE__ */ i("div", {
|
|
107
|
+
"data-slot": "data-grid",
|
|
108
|
+
className: e("w-full overflow-hidden", r && "border-border rounded-2xl border", n),
|
|
109
|
+
children: t
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
export { l as DataGrid, u as DataGridContainer, c as DataGridProvider, a as getColumnHeaderLabel, s as useDataGrid };
|