@duro-app/ui 0.52.0 → 1.1.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/dist/{Table-xlMa_Kqe.js → Table-P-UHkEqJ.js} +333 -329
- package/dist/Table-P-UHkEqJ.js.map +1 -0
- package/dist/components/ActionBar/ActionBar.d.ts +6 -4
- package/dist/components/ActionBar/ActionBar.d.ts.map +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +3 -1
- package/dist/components/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.stories.d.ts.map +1 -1
- package/dist/components/Cluster/Cluster.d.ts +2 -2
- package/dist/components/Cluster/Cluster.d.ts.map +1 -1
- package/dist/components/Cluster/Cluster.stories.d.ts.map +1 -1
- package/dist/components/ColorMode/ColorMode.d.ts +3 -2
- package/dist/components/ColorMode/ColorMode.d.ts.map +1 -1
- package/dist/components/Combobox/Combobox.stories.d.ts.map +1 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
- package/dist/components/DetailPanel/DetailPanel.d.ts +3 -2
- package/dist/components/DetailPanel/DetailPanel.d.ts.map +1 -1
- package/dist/components/DetailPanel/styles.css.d.ts +15 -3
- package/dist/components/DetailPanel/styles.css.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.d.ts +3 -2
- package/dist/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog/styles.css.d.ts +16 -4
- package/dist/components/Dialog/styles.css.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.d.ts +3 -2
- package/dist/components/Drawer/Drawer.d.ts.map +1 -1
- package/dist/components/Drawer/styles.css.d.ts +16 -4
- package/dist/components/Drawer/styles.css.d.ts.map +1 -1
- package/dist/components/Fieldset/Fieldset.d.ts +2 -1
- package/dist/components/Fieldset/Fieldset.d.ts.map +1 -1
- package/dist/components/Grid/Grid.d.ts +2 -2
- package/dist/components/Grid/Grid.d.ts.map +1 -1
- package/dist/components/Grid/Grid.stories.d.ts.map +1 -1
- package/dist/components/Icon/Icon.d.ts +5 -3
- package/dist/components/Icon/Icon.d.ts.map +1 -1
- package/dist/components/Icon/index.d.ts +1 -1
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Inline/Inline.d.ts +2 -2
- package/dist/components/Inline/Inline.d.ts.map +1 -1
- package/dist/components/Inline/Inline.stories.d.ts.map +1 -1
- package/dist/components/Stack/Stack.d.ts +2 -1
- package/dist/components/Stack/Stack.d.ts.map +1 -1
- package/dist/components/Stack/Stack.stories.d.ts.map +1 -1
- package/dist/components/StatusIcon/StatusIcon.d.ts +2 -2
- package/dist/components/StatusIcon/StatusIcon.d.ts.map +1 -1
- package/dist/components/Table/Table.d.ts +1 -7
- package/dist/components/Table/Table.d.ts.map +1 -1
- package/dist/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/components/Tabs/TabsContext.d.ts +2 -1
- package/dist/components/Tabs/TabsContext.d.ts.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroupContext.d.ts +2 -1
- package/dist/components/ToggleGroup/ToggleGroupContext.d.ts.map +1 -1
- package/dist/components/VirtualTable/VirtualTable.d.ts +2 -1
- package/dist/components/VirtualTable/VirtualTable.d.ts.map +1 -1
- package/dist/hooks/useContainerQuery.d.ts +3 -2
- package/dist/hooks/useContainerQuery.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +2270 -2177
- package/dist/index.js.map +1 -1
- package/dist/shared/types.d.ts +2 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/table.js +137 -139
- package/dist/table.js.map +1 -1
- package/package.json +3 -2
- package/src/components/ActionBar/ActionBar.tsx +10 -5
- package/src/components/Alert/Alert.tsx +2 -2
- package/src/components/ButtonGroup/ButtonGroup.stories.tsx +3 -2
- package/src/components/ButtonGroup/ButtonGroup.tsx +5 -2
- package/src/components/Callout/Callout.tsx +2 -2
- package/src/components/Cluster/Cluster.stories.tsx +2 -1
- package/src/components/Cluster/Cluster.tsx +3 -3
- package/src/components/ColorMode/ColorMode.tsx +4 -4
- package/src/components/Combobox/Combobox.stories.tsx +7 -3
- package/src/components/ConfirmDialog/ConfirmDialog.tsx +1 -3
- package/src/components/DetailPanel/DetailPanel.tsx +23 -6
- package/src/components/DetailPanel/styles.css.ts +14 -7
- package/src/components/Dialog/Dialog.tsx +26 -5
- package/src/components/Dialog/styles.css.ts +12 -4
- package/src/components/Drawer/Drawer.tsx +17 -4
- package/src/components/Drawer/styles.css.ts +12 -4
- package/src/components/EmptyState/EmptyState.meta.ts +1 -1
- package/src/components/EmptyState/EmptyState.stories.tsx +2 -2
- package/src/components/Fieldset/Fieldset.tsx +3 -2
- package/src/components/Grid/Grid.stories.tsx +2 -1
- package/src/components/Grid/Grid.tsx +3 -3
- package/src/components/Icon/Icon.meta.ts +3 -3
- package/src/components/Icon/Icon.tsx +7 -2
- package/src/components/Icon/index.ts +1 -1
- package/src/components/Inline/Inline.stories.tsx +2 -1
- package/src/components/Inline/Inline.tsx +3 -3
- package/src/components/SideNav/SideNav.meta.ts +3 -3
- package/src/components/SideNav/SideNav.stories.tsx +8 -8
- package/src/components/Stack/Stack.stories.tsx +3 -2
- package/src/components/Stack/Stack.tsx +3 -2
- package/src/components/StatusIcon/StatusIcon.stories.tsx +1 -1
- package/src/components/StatusIcon/StatusIcon.tsx +3 -3
- package/src/components/Table/Table.stories.tsx +29 -32
- package/src/components/Table/Table.tsx +0 -13
- package/src/components/Tabs/TabsContext.ts +2 -1
- package/src/components/Toast/ToastProvider.tsx +2 -2
- package/src/components/Toggle/Toggle.meta.ts +1 -1
- package/src/components/ToggleGroup/ToggleGroupContext.ts +2 -1
- package/src/components/VirtualTable/VirtualTable.tsx +6 -5
- package/src/hooks/useContainerQuery.ts +10 -3
- package/src/shared/types.ts +3 -0
- package/dist/Table-xlMa_Kqe.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,UAAU,CAAA"}
|
package/dist/table.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { c as H, m as p, d as b, M as F, s as
|
|
2
|
-
import { jsx as u, jsxs as
|
|
3
|
-
import { flexRender as E, useReactTable as
|
|
4
|
-
import { useState as G, useCallback as
|
|
5
|
-
import { useVirtualizer as
|
|
6
|
-
const
|
|
7
|
-
sm: 640
|
|
8
|
-
}, q = {
|
|
1
|
+
import { c as H, m as p, d as b, M as F, s as xt, R as rt, H as kt, a as pt, B as bt, e as ft, C as mt, b as ht, f as yt } from "./Table-P-UHkEqJ.js";
|
|
2
|
+
import { jsx as u, jsxs as B } from "react/jsx-runtime";
|
|
3
|
+
import { flexRender as E, useReactTable as it, getPaginationRowModel as St, getFilteredRowModel as Tt, getSortedRowModel as at, getCoreRowModel as st } from "@tanstack/react-table";
|
|
4
|
+
import { useState as G, useCallback as Ct, useRef as K, useEffect as Z, useLayoutEffect as wt } from "react";
|
|
5
|
+
import { useVirtualizer as vt } from "@tanstack/react-virtual";
|
|
6
|
+
const q = {
|
|
9
7
|
root: {
|
|
10
8
|
"display-k1xSpc": "display-x78zum5",
|
|
11
9
|
"alignItems-kGNEyG": "alignItems-x6s0dn4",
|
|
@@ -47,7 +45,7 @@ const wt = {
|
|
|
47
45
|
$$css: "Table/Pagination.tsx:44"
|
|
48
46
|
}
|
|
49
47
|
};
|
|
50
|
-
function
|
|
48
|
+
function dt(o) {
|
|
51
49
|
const t = H.c(33), {
|
|
52
50
|
table: e
|
|
53
51
|
} = o;
|
|
@@ -69,15 +67,15 @@ function st(o) {
|
|
|
69
67
|
let x, y;
|
|
70
68
|
t[8] !== e ? (x = () => e.previousPage(), y = e.getCanPreviousPage(), t[8] = e, t[9] = x, t[10] = y) : (x = t[9], y = t[10]);
|
|
71
69
|
const T = !y;
|
|
72
|
-
let
|
|
73
|
-
t[11] !== c || t[12] !== x || t[13] !== T ? (
|
|
74
|
-
const
|
|
70
|
+
let f;
|
|
71
|
+
t[11] !== c || t[12] !== x || t[13] !== T ? (f = /* @__PURE__ */ u("button", { "data-element-src": "Table/Pagination.tsx:63", ...p(b.button, c), onClick: x, disabled: T, type: "button", children: "Previous" }), t[11] = c, t[12] = x, t[13] = T, t[14] = f) : f = t[14];
|
|
72
|
+
const m = l + 1;
|
|
75
73
|
let S;
|
|
76
|
-
t[15] !== s || t[16] !==
|
|
77
|
-
|
|
74
|
+
t[15] !== s || t[16] !== m ? (S = /* @__PURE__ */ B("span", { "data-element-src": "Table/Pagination.tsx:70", ...p(b.span, q.pageInfo), children: [
|
|
75
|
+
m,
|
|
78
76
|
" / ",
|
|
79
77
|
s
|
|
80
|
-
] }), t[15] = s, t[16] =
|
|
78
|
+
] }), t[15] = s, t[16] = m, t[17] = S) : S = t[17];
|
|
81
79
|
let h;
|
|
82
80
|
t[18] !== e ? (h = !e.getCanNextPage() && q.buttonDisabled, t[18] = e, t[19] = h) : h = t[19];
|
|
83
81
|
let V;
|
|
@@ -88,13 +86,13 @@ function st(o) {
|
|
|
88
86
|
let a;
|
|
89
87
|
t[25] !== V || t[26] !== w || t[27] !== $ ? (a = /* @__PURE__ */ u("button", { "data-element-src": "Table/Pagination.tsx:73", ...p(b.button, V), onClick: w, disabled: $, type: "button", children: "Next" }), t[25] = V, t[26] = w, t[27] = $, t[28] = a) : a = t[28];
|
|
90
88
|
let R;
|
|
91
|
-
return t[29] !== S || t[30] !== a || t[31] !==
|
|
92
|
-
|
|
89
|
+
return t[29] !== S || t[30] !== a || t[31] !== f ? (R = /* @__PURE__ */ B("div", { "data-element-src": "Table/Pagination.tsx:62", ...p(b.div, q.root), children: [
|
|
90
|
+
f,
|
|
93
91
|
S,
|
|
94
92
|
a
|
|
95
|
-
] }), t[29] = S, t[30] = a, t[31] =
|
|
93
|
+
] }), t[29] = S, t[30] = a, t[31] = f, t[32] = R) : R = t[32], R;
|
|
96
94
|
}
|
|
97
|
-
const
|
|
95
|
+
const _ = {
|
|
98
96
|
root: {
|
|
99
97
|
"display-k1xSpc": "display-x3nfvp2",
|
|
100
98
|
"alignItems-kGNEyG": "alignItems-x6s0dn4",
|
|
@@ -116,20 +114,20 @@ const J = {
|
|
|
116
114
|
$$css: "Table/SortIndicator.tsx:22"
|
|
117
115
|
}
|
|
118
116
|
};
|
|
119
|
-
function
|
|
117
|
+
function Vt(o) {
|
|
120
118
|
const t = H.c(5), {
|
|
121
119
|
column: e
|
|
122
120
|
} = o;
|
|
123
121
|
if (!e.getCanSort())
|
|
124
122
|
return null;
|
|
125
|
-
const n = e.getIsSorted(), l = n ?
|
|
123
|
+
const n = e.getIsSorted(), l = n ? _.active : _.inactive;
|
|
126
124
|
let r;
|
|
127
|
-
t[0] !== l ? (r = [
|
|
125
|
+
t[0] !== l ? (r = [_.root, l], t[0] = l, t[1] = r) : r = t[1];
|
|
128
126
|
const i = n === "asc" ? "▲" : n === "desc" ? "▼" : "⇅";
|
|
129
127
|
let s;
|
|
130
128
|
return t[2] !== r || t[3] !== i ? (s = /* @__PURE__ */ u("span", { "data-element-src": "Table/SortIndicator.tsx:46", ...p(b.span, r), "data-sort-indicator": "", children: i }), t[2] = r, t[3] = i, t[4] = s) : s = t[4], s;
|
|
131
129
|
}
|
|
132
|
-
const
|
|
130
|
+
const $t = {
|
|
133
131
|
input: {
|
|
134
132
|
"width-kzqmXN": "width-xh8yej3",
|
|
135
133
|
"paddingTop-kLKAdn": "paddingTop-x1nn3v0j",
|
|
@@ -148,7 +146,7 @@ const Vt = {
|
|
|
148
146
|
$$css: "Table/ColumnFilter.tsx:9"
|
|
149
147
|
}
|
|
150
148
|
};
|
|
151
|
-
function
|
|
149
|
+
function zt(o) {
|
|
152
150
|
const t = H.c(8), {
|
|
153
151
|
column: e,
|
|
154
152
|
placeholder: n
|
|
@@ -162,9 +160,9 @@ function $t(o) {
|
|
|
162
160
|
t[2] !== e ? (i = (k) => e.setFilterValue(k.target.value || void 0), t[2] = e, t[3] = i) : i = t[3];
|
|
163
161
|
const s = n ?? "Filter...";
|
|
164
162
|
let C;
|
|
165
|
-
return t[4] !== r || t[5] !== i || t[6] !== s ? (C = /* @__PURE__ */ u("input", { "data-element-src": "Table/ColumnFilter.tsx:38", ...p(b.input,
|
|
163
|
+
return t[4] !== r || t[5] !== i || t[6] !== s ? (C = /* @__PURE__ */ u("input", { "data-element-src": "Table/ColumnFilter.tsx:38", ...p(b.input, $t.input), type: "text", value: r, onChange: i, placeholder: s, dir: "auto" }), t[4] = r, t[5] = i, t[6] = s, t[7] = C) : C = t[7], C;
|
|
166
164
|
}
|
|
167
|
-
function
|
|
165
|
+
function tt(o) {
|
|
168
166
|
const t = H.c(21), {
|
|
169
167
|
options: e,
|
|
170
168
|
value: n,
|
|
@@ -172,40 +170,40 @@ function Z(o) {
|
|
|
172
170
|
label: r
|
|
173
171
|
} = o, i = r === void 0 ? "Sort by" : r;
|
|
174
172
|
let s;
|
|
175
|
-
t[0] !== e || t[1] !== n ? (s = n ? e.find((
|
|
173
|
+
t[0] !== e || t[1] !== n ? (s = n ? e.find((m) => m.id === n.id) : null, t[0] = e, t[1] = n, t[2] = s) : s = t[2];
|
|
176
174
|
const C = s, k = C ? `${i}: ${C.label} ${n.desc ? "↓" : "↑"}` : i;
|
|
177
175
|
let c;
|
|
178
176
|
t[3] !== k ? (c = /* @__PURE__ */ u(F.Trigger, { children: k }), t[3] = k, t[4] = c) : c = t[4];
|
|
179
177
|
let x;
|
|
180
178
|
if (t[5] !== l || t[6] !== e || t[7] !== n) {
|
|
181
|
-
let
|
|
182
|
-
t[9] !== l || t[10] !== n ? (
|
|
179
|
+
let m;
|
|
180
|
+
t[9] !== l || t[10] !== n ? (m = (S) => {
|
|
183
181
|
const h = n?.id === S.id, V = h ? !n.desc : !1;
|
|
184
|
-
return /* @__PURE__ */
|
|
182
|
+
return /* @__PURE__ */ B(F.Item, { onClick: () => l({
|
|
185
183
|
id: S.id,
|
|
186
184
|
desc: V
|
|
187
185
|
}), children: [
|
|
188
186
|
S.label,
|
|
189
187
|
h ? ` ${n.desc ? "↓" : "↑"}` : ""
|
|
190
188
|
] }, S.id);
|
|
191
|
-
}, t[9] = l, t[10] = n, t[11] =
|
|
189
|
+
}, t[9] = l, t[10] = n, t[11] = m) : m = t[11], x = e.map(m), t[5] = l, t[6] = e, t[7] = n, t[8] = x;
|
|
192
190
|
} else
|
|
193
191
|
x = t[8];
|
|
194
192
|
let y;
|
|
195
193
|
t[12] !== l || t[13] !== n ? (y = n !== null && /* @__PURE__ */ u(F.Item, { onClick: () => l(null), children: "Clear sort" }), t[12] = l, t[13] = n, t[14] = y) : y = t[14];
|
|
196
194
|
let T;
|
|
197
|
-
t[15] !== x || t[16] !== y ? (T = /* @__PURE__ */
|
|
195
|
+
t[15] !== x || t[16] !== y ? (T = /* @__PURE__ */ B(F.Popup, { children: [
|
|
198
196
|
x,
|
|
199
197
|
y
|
|
200
198
|
] }), t[15] = x, t[16] = y, t[17] = T) : T = t[17];
|
|
201
|
-
let
|
|
202
|
-
return t[18] !== c || t[19] !== T ? (
|
|
199
|
+
let f;
|
|
200
|
+
return t[18] !== c || t[19] !== T ? (f = /* @__PURE__ */ u("div", { "data-element-src": "Table/SortChip.tsx:32", ...p(b.div, xt.sortChip), children: /* @__PURE__ */ B(F.Root, { children: [
|
|
203
201
|
c,
|
|
204
202
|
T
|
|
205
|
-
] }) }), t[18] = c, t[19] = T, t[20] =
|
|
203
|
+
] }) }), t[18] = c, t[19] = T, t[20] = f) : f = t[20], f;
|
|
206
204
|
}
|
|
207
|
-
|
|
208
|
-
function
|
|
205
|
+
tt.displayName = "SortChip";
|
|
206
|
+
function ct(o) {
|
|
209
207
|
const t = H.c(30), {
|
|
210
208
|
table: e,
|
|
211
209
|
variant: n,
|
|
@@ -217,46 +215,46 @@ function dt(o) {
|
|
|
217
215
|
rowKey: k,
|
|
218
216
|
onRowClick: c,
|
|
219
217
|
rowAriaLabel: x
|
|
220
|
-
} = o, y = n === void 0 ? "default" : n, T = l === void 0 ? "md" : l,
|
|
221
|
-
let
|
|
222
|
-
t[0] !== s || t[1] !== e ? (
|
|
223
|
-
const S =
|
|
218
|
+
} = o, y = n === void 0 ? "default" : n, T = l === void 0 ? "md" : l, f = r === void 0 ? !0 : r;
|
|
219
|
+
let m;
|
|
220
|
+
t[0] !== s || t[1] !== e ? (m = s ? jt(e) : void 0, t[0] = s, t[1] = e, t[2] = m) : m = t[2];
|
|
221
|
+
const S = m;
|
|
224
222
|
let h;
|
|
225
|
-
t[3] !== C || t[4] !== e ? (h = C ? /* @__PURE__ */ u(
|
|
223
|
+
t[3] !== C || t[4] !== e ? (h = C ? /* @__PURE__ */ u(dt, { table: e }) : void 0, t[3] = C, t[4] = e, t[5] = h) : h = t[5];
|
|
226
224
|
const V = h;
|
|
227
225
|
let w;
|
|
228
|
-
t[6] !== e ? (w = e.getHeaderGroups().map(
|
|
226
|
+
t[6] !== e ? (w = e.getHeaderGroups().map(Rt), t[6] = e, t[7] = w) : w = t[7];
|
|
229
227
|
let M;
|
|
230
|
-
t[8] !== w ? (M = /* @__PURE__ */ u(
|
|
228
|
+
t[8] !== w ? (M = /* @__PURE__ */ u(pt, { children: w }), t[8] = w, t[9] = M) : M = t[9];
|
|
231
229
|
let $;
|
|
232
230
|
if (t[10] !== c || t[11] !== x || t[12] !== k || t[13] !== e) {
|
|
233
231
|
let j;
|
|
234
|
-
t[15] !== c || t[16] !== x || t[17] !== k ? (j = (
|
|
235
|
-
const
|
|
236
|
-
return /* @__PURE__ */ u(
|
|
232
|
+
t[15] !== c || t[16] !== x || t[17] !== k ? (j = (D) => {
|
|
233
|
+
const O = k?.(D) ?? D.id;
|
|
234
|
+
return /* @__PURE__ */ u(rt, { onClick: c ? () => c(D) : void 0, "aria-label": x?.(D), children: D.getVisibleCells().map(Mt) }, O);
|
|
237
235
|
}, t[15] = c, t[16] = x, t[17] = k, t[18] = j) : j = t[18], $ = e.getRowModel().rows.map(j), t[10] = c, t[11] = x, t[12] = k, t[13] = e, t[14] = $;
|
|
238
236
|
} else
|
|
239
237
|
$ = t[14];
|
|
240
238
|
let a;
|
|
241
|
-
t[19] !== $ ? (a = /* @__PURE__ */ u(
|
|
239
|
+
t[19] !== $ ? (a = /* @__PURE__ */ u(bt, { children: $ }), t[19] = $, t[20] = a) : a = t[20];
|
|
242
240
|
let R;
|
|
243
|
-
return t[21] !== i || t[22] !== V || t[23] !==
|
|
241
|
+
return t[21] !== i || t[22] !== V || t[23] !== f || t[24] !== T || t[25] !== S || t[26] !== M || t[27] !== a || t[28] !== y ? (R = /* @__PURE__ */ B(ft, { variant: y, size: T, responsive: f, minColumnWidth: i, sortChip: S, pagination: V, children: [
|
|
244
242
|
M,
|
|
245
243
|
a
|
|
246
|
-
] }), t[21] = i, t[22] = V, t[23] =
|
|
247
|
-
}
|
|
248
|
-
function zt(o) {
|
|
249
|
-
return /* @__PURE__ */ u(mt, { isActions: o.column.columnDef.meta?.isActions === !0, children: E(o.column.columnDef.cell, o.getContext()) }, o.id);
|
|
244
|
+
] }), t[21] = i, t[22] = V, t[23] = f, t[24] = T, t[25] = S, t[26] = M, t[27] = a, t[28] = y, t[29] = R) : R = t[29], R;
|
|
250
245
|
}
|
|
251
246
|
function Mt(o) {
|
|
252
|
-
return /* @__PURE__ */ u(
|
|
247
|
+
return /* @__PURE__ */ u(mt, { isActions: o.column.columnDef.meta?.isActions === !0, children: E(o.column.columnDef.cell, o.getContext()) }, o.id);
|
|
253
248
|
}
|
|
254
249
|
function Rt(o) {
|
|
255
|
-
|
|
256
|
-
return /* @__PURE__ */ u(xt, { label: l, "aria-label": e?.isActions ? l || "Actions" : void 0, children: o.isPlaceholder ? null : E(t.header, o.getContext()) }, o.id);
|
|
250
|
+
return /* @__PURE__ */ u(rt, { children: o.headers.map(It) }, o.id);
|
|
257
251
|
}
|
|
258
|
-
dt.displayName = "FromTanstack";
|
|
259
252
|
function It(o) {
|
|
253
|
+
const t = o.column.columnDef, e = t.meta, n = typeof t.header == "string" ? t.header : void 0, l = e?.stackLabel ?? n ?? "";
|
|
254
|
+
return /* @__PURE__ */ u(kt, { label: l, "aria-label": e?.isActions ? l || "Actions" : void 0, children: o.isPlaceholder ? null : E(t.header, o.getContext()) }, o.id);
|
|
255
|
+
}
|
|
256
|
+
ct.displayName = "FromTanstack";
|
|
257
|
+
function jt(o) {
|
|
260
258
|
const t = o.getAllColumns().filter((l) => l.getCanSort()).map((l) => {
|
|
261
259
|
const r = typeof l.columnDef.header == "string" ? l.columnDef.header : l.id;
|
|
262
260
|
return {
|
|
@@ -269,12 +267,12 @@ function It(o) {
|
|
|
269
267
|
id: e.id,
|
|
270
268
|
desc: e.desc
|
|
271
269
|
} : null;
|
|
272
|
-
return /* @__PURE__ */ u(
|
|
270
|
+
return /* @__PURE__ */ u(tt, { options: t, value: n, onChange: (l) => o.setSorting(l ? [{
|
|
273
271
|
id: l.id,
|
|
274
272
|
desc: l.desc
|
|
275
273
|
}] : []) });
|
|
276
274
|
}
|
|
277
|
-
function
|
|
275
|
+
function Et(o, t, e = {}) {
|
|
278
276
|
const {
|
|
279
277
|
enableSorting: n = !1,
|
|
280
278
|
enableFiltering: l = !1,
|
|
@@ -283,25 +281,25 @@ function Ft(o, t, e = {}) {
|
|
|
283
281
|
} = e, s = e.pagination != null, [C, k] = G([]), [c, x] = G([]), [y, T] = G({
|
|
284
282
|
pageIndex: e.pagination?.pageIndex ?? 0,
|
|
285
283
|
pageSize: e.pagination?.pageSize ?? 10
|
|
286
|
-
}), [
|
|
287
|
-
|
|
284
|
+
}), [f, m] = G({}), S = Ct((h) => {
|
|
285
|
+
m((V) => {
|
|
288
286
|
const w = typeof h == "function" ? h(V) : h;
|
|
289
287
|
return i?.(w), w;
|
|
290
288
|
});
|
|
291
289
|
}, [i]);
|
|
292
|
-
return
|
|
290
|
+
return it({
|
|
293
291
|
data: o,
|
|
294
292
|
columns: t,
|
|
295
293
|
state: {
|
|
296
294
|
sorting: C,
|
|
297
295
|
columnFilters: c,
|
|
298
296
|
pagination: y,
|
|
299
|
-
rowSelection:
|
|
297
|
+
rowSelection: f
|
|
300
298
|
},
|
|
301
|
-
getCoreRowModel:
|
|
302
|
-
getSortedRowModel:
|
|
303
|
-
getFilteredRowModel:
|
|
304
|
-
getPaginationRowModel:
|
|
299
|
+
getCoreRowModel: st(),
|
|
300
|
+
getSortedRowModel: at(),
|
|
301
|
+
getFilteredRowModel: Tt(),
|
|
302
|
+
getPaginationRowModel: St(),
|
|
305
303
|
onSortingChange: k,
|
|
306
304
|
onColumnFiltersChange: x,
|
|
307
305
|
onPaginationChange: T,
|
|
@@ -314,21 +312,21 @@ function Ft(o, t, e = {}) {
|
|
|
314
312
|
}
|
|
315
313
|
});
|
|
316
314
|
}
|
|
317
|
-
const
|
|
315
|
+
const Wt = {
|
|
318
316
|
"overflowY-kORKVm": "overflowY-x1odjw0f",
|
|
319
317
|
"overscrollBehavior-kZeWKH": "overscrollBehavior-xish69e",
|
|
320
318
|
$$css: "VirtualTable/styles.css.ts:21"
|
|
321
|
-
},
|
|
319
|
+
}, Bt = {
|
|
322
320
|
"position-kVAEAm": "position-x1n2onr6",
|
|
323
321
|
"width-kzqmXN": "width-xh8yej3",
|
|
324
322
|
$$css: "VirtualTable/styles.css.ts:64"
|
|
325
|
-
},
|
|
323
|
+
}, Dt = {
|
|
326
324
|
"position-kVAEAm": "position-x10l6tqk",
|
|
327
325
|
"top-k87sOh": "top-x13vifvy",
|
|
328
326
|
"left-kbCHJM": "left-xu96u03",
|
|
329
327
|
"transform-k3aq6I": "transform-xsqj5wx",
|
|
330
328
|
$$css: "VirtualTable/styles.css.ts:83"
|
|
331
|
-
},
|
|
329
|
+
}, Pt = {
|
|
332
330
|
"flexShrink-kmuXW": "flexShrink-xs83m0k",
|
|
333
331
|
"flexBasis-kCS8Yb": "flexBasis-x1r8uery",
|
|
334
332
|
"minWidth-k7Eaqz": "minWidth-xeuugli",
|
|
@@ -349,7 +347,7 @@ const jt = {
|
|
|
349
347
|
"backgroundColor-kWkggS": "backgroundColor-xuw63hu",
|
|
350
348
|
$$css: "VirtualTable/styles.css.ts:11"
|
|
351
349
|
},
|
|
352
|
-
scrollMax: (o) => [
|
|
350
|
+
scrollMax: (o) => [Wt, {
|
|
353
351
|
"maxHeight-kskxy": o != null ? "maxHeight-x1jols5v" : o,
|
|
354
352
|
$$css: "VirtualTable/styles.css.ts:21"
|
|
355
353
|
}, {
|
|
@@ -398,7 +396,7 @@ const jt = {
|
|
|
398
396
|
"color-kMwMTN": "color-xf715ks",
|
|
399
397
|
$$css: "VirtualTable/styles.css.ts:60"
|
|
400
398
|
},
|
|
401
|
-
bodyTotal: (o) => [
|
|
399
|
+
bodyTotal: (o) => [Bt, {
|
|
402
400
|
"height-kZKoxP": o != null ? "height-x16ye13r" : o,
|
|
403
401
|
$$css: "VirtualTable/styles.css.ts:64"
|
|
404
402
|
}, {
|
|
@@ -419,7 +417,7 @@ const jt = {
|
|
|
419
417
|
"backgroundColor-kWkggS": "backgroundColor-xjbqb8w backgroundColor-x14zl4n5",
|
|
420
418
|
$$css: "VirtualTable/styles.css.ts:78"
|
|
421
419
|
},
|
|
422
|
-
rowAbsolute: (o) => [
|
|
420
|
+
rowAbsolute: (o) => [Dt, {
|
|
423
421
|
"--x-transform": `translateY(${o}px)` != null ? `translateY(${o}px)` : void 0
|
|
424
422
|
}],
|
|
425
423
|
cell: {
|
|
@@ -435,7 +433,7 @@ const jt = {
|
|
|
435
433
|
"whiteSpace-khDVqt": "whiteSpace-xuxw1ft",
|
|
436
434
|
$$css: "VirtualTable/styles.css.ts:89"
|
|
437
435
|
},
|
|
438
|
-
cellFlex: (o) => [
|
|
436
|
+
cellFlex: (o) => [Pt, {
|
|
439
437
|
"flexGrow-kzQI83": o != null ? "flexGrow-xw36f2b" : o,
|
|
440
438
|
$$css: "VirtualTable/styles.css.ts:102"
|
|
441
439
|
}, {
|
|
@@ -515,8 +513,8 @@ const jt = {
|
|
|
515
513
|
"pointerEvents-kfzvcC": "pointerEvents-x47corl",
|
|
516
514
|
$$css: "VirtualTable/styles.css.ts:160"
|
|
517
515
|
}
|
|
518
|
-
},
|
|
519
|
-
function
|
|
516
|
+
}, At = typeof window < "u" ? wt : Z;
|
|
517
|
+
function Ht({
|
|
520
518
|
data: o,
|
|
521
519
|
columns: t,
|
|
522
520
|
sorting: e,
|
|
@@ -531,11 +529,11 @@ function Et({
|
|
|
531
529
|
estimateRowHeight: x = 44,
|
|
532
530
|
maxHeight: y = "70vh",
|
|
533
531
|
virtualizeThreshold: T = 150,
|
|
534
|
-
stackBelow:
|
|
535
|
-
responsive:
|
|
532
|
+
stackBelow: f = "sm",
|
|
533
|
+
responsive: m = !0,
|
|
536
534
|
emptyLabel: S
|
|
537
535
|
}) {
|
|
538
|
-
const [h, V] = G([]), $ =
|
|
536
|
+
const [h, V] = G([]), $ = it({
|
|
539
537
|
data: o,
|
|
540
538
|
columns: t,
|
|
541
539
|
state: {
|
|
@@ -543,105 +541,105 @@ function Et({
|
|
|
543
541
|
},
|
|
544
542
|
onSortingChange: n ?? V,
|
|
545
543
|
getRowId: l,
|
|
546
|
-
getCoreRowModel:
|
|
547
|
-
getSortedRowModel:
|
|
548
|
-
}), a = $.getRowModel().rows, R =
|
|
549
|
-
|
|
550
|
-
if (!
|
|
551
|
-
|
|
544
|
+
getCoreRowModel: st(),
|
|
545
|
+
getSortedRowModel: at()
|
|
546
|
+
}), a = $.getRowModel().rows, R = K(null), [j, D] = G(!1), O = typeof f == "number" ? f : ht[f];
|
|
547
|
+
At(() => {
|
|
548
|
+
if (!m) {
|
|
549
|
+
D(!1);
|
|
552
550
|
return;
|
|
553
551
|
}
|
|
554
552
|
const d = R.current;
|
|
555
553
|
if (!d || typeof ResizeObserver > "u") return;
|
|
556
554
|
const v = (I) => {
|
|
557
|
-
I > 0 &&
|
|
555
|
+
I > 0 && D(I < O);
|
|
558
556
|
};
|
|
559
557
|
v(d.getBoundingClientRect().width);
|
|
560
|
-
const
|
|
558
|
+
const W = new ResizeObserver((I) => {
|
|
561
559
|
const z = I[0];
|
|
562
560
|
if (!z) return;
|
|
563
561
|
const L = z.contentBoxSize?.[0];
|
|
564
562
|
v(L ? L.inlineSize : z.contentRect.width);
|
|
565
563
|
});
|
|
566
|
-
return
|
|
567
|
-
}, [
|
|
568
|
-
const
|
|
564
|
+
return W.observe(d), () => W.disconnect();
|
|
565
|
+
}, [m, O]);
|
|
566
|
+
const P = a.length > T && !j, et = K(null), Y = vt({
|
|
569
567
|
count: a.length,
|
|
570
|
-
getScrollElement: () =>
|
|
568
|
+
getScrollElement: () => et.current,
|
|
571
569
|
estimateSize: () => x,
|
|
572
570
|
overscan: 12
|
|
573
|
-
}),
|
|
574
|
-
|
|
575
|
-
if (!
|
|
576
|
-
|
|
571
|
+
}), Q = K(!0);
|
|
572
|
+
Z(() => {
|
|
573
|
+
if (!P) {
|
|
574
|
+
Q.current = !1;
|
|
577
575
|
return;
|
|
578
576
|
}
|
|
579
|
-
s && s > 1 &&
|
|
577
|
+
s && s > 1 && Y.scrollToIndex((s - 1) * c, {
|
|
580
578
|
align: "start"
|
|
581
579
|
});
|
|
582
580
|
const d = setTimeout(() => {
|
|
583
|
-
|
|
581
|
+
Q.current = !1;
|
|
584
582
|
}, 300);
|
|
585
583
|
return () => clearTimeout(d);
|
|
586
|
-
}, [
|
|
587
|
-
const N =
|
|
588
|
-
from: a.length ?
|
|
589
|
-
to: a.length ?
|
|
584
|
+
}, [P]);
|
|
585
|
+
const N = Y.getVirtualItems(), U = N[0]?.index ?? 0, ot = N.length ? N[N.length - 1].index : 0, lt = Math.max(1, Math.ceil(a.length / c)), A = Math.floor(Math.max(0, U) / c) + 1, X = {
|
|
586
|
+
from: a.length ? U + 1 : 0,
|
|
587
|
+
to: a.length ? ot + 1 : 0,
|
|
590
588
|
total: a.length,
|
|
591
589
|
page: A,
|
|
592
|
-
pages:
|
|
593
|
-
},
|
|
594
|
-
|
|
595
|
-
if (!(!
|
|
596
|
-
if (
|
|
597
|
-
|
|
590
|
+
pages: lt
|
|
591
|
+
}, J = K(null);
|
|
592
|
+
Z(() => {
|
|
593
|
+
if (!(!P || !C)) {
|
|
594
|
+
if (Q.current) {
|
|
595
|
+
J.current = A;
|
|
598
596
|
return;
|
|
599
597
|
}
|
|
600
|
-
|
|
601
|
-
from: a.length ?
|
|
602
|
-
to: a.length ?
|
|
598
|
+
J.current !== A && (J.current = A, C({
|
|
599
|
+
from: a.length ? U + 1 : 0,
|
|
600
|
+
to: a.length ? ot + 1 : 0,
|
|
603
601
|
total: a.length,
|
|
604
602
|
page: A,
|
|
605
|
-
pages:
|
|
603
|
+
pages: lt
|
|
606
604
|
}));
|
|
607
605
|
}
|
|
608
|
-
}, [A,
|
|
609
|
-
const
|
|
606
|
+
}, [A, P]);
|
|
607
|
+
const ut = (d) => {
|
|
610
608
|
const v = d.meta;
|
|
611
609
|
return typeof v?.stackLabel == "string" ? v.stackLabel : typeof v?.label == "string" ? v.label : typeof d.header == "string" ? d.header : "";
|
|
612
|
-
},
|
|
613
|
-
const L =
|
|
614
|
-
return /* @__PURE__ */
|
|
615
|
-
L ? /* @__PURE__ */ u("span", { "data-element-src": "VirtualTable/VirtualTable.tsx:
|
|
616
|
-
/* @__PURE__ */ u("div", { "data-element-src": "VirtualTable/VirtualTable.tsx:
|
|
610
|
+
}, nt = (d, v, W, I) => j ? /* @__PURE__ */ u("div", { "data-element-src": "VirtualTable/VirtualTable.tsx:241", role: "row", "aria-label": i?.(d.original), onClick: r ? () => r(d.original) : void 0, ...p(b.div, g.stackRow, !!r && g.rowClickable), children: d.getVisibleCells().map((z) => {
|
|
611
|
+
const L = ut(z.column.columnDef);
|
|
612
|
+
return /* @__PURE__ */ B("div", { "data-element-src": "VirtualTable/VirtualTable.tsx:251", role: "cell", ...p(b.div, g.stackCell), children: [
|
|
613
|
+
L ? /* @__PURE__ */ u("span", { "data-element-src": "VirtualTable/VirtualTable.tsx:252", ...p(b.span, g.stackCellLabel), children: L }) : null,
|
|
614
|
+
/* @__PURE__ */ u("div", { "data-element-src": "VirtualTable/VirtualTable.tsx:253", ...p(b.div, g.stackCellValue), children: E(z.column.columnDef.cell, z.getContext()) })
|
|
617
615
|
] }, z.id);
|
|
618
|
-
}) }, d.id) : /* @__PURE__ */ u("div", { "data-element-src": "VirtualTable/VirtualTable.tsx:
|
|
619
|
-
return /* @__PURE__ */
|
|
620
|
-
/* @__PURE__ */
|
|
621
|
-
j ? null : /* @__PURE__ */ u("div", { "data-element-src": "VirtualTable/VirtualTable.tsx:
|
|
622
|
-
const
|
|
623
|
-
return /* @__PURE__ */
|
|
624
|
-
v.isPlaceholder ? null : E(
|
|
625
|
-
I ? /* @__PURE__ */ u("span", { "data-element-src": "VirtualTable/VirtualTable.tsx:
|
|
616
|
+
}) }, d.id) : /* @__PURE__ */ u("div", { "data-element-src": "VirtualTable/VirtualTable.tsx:261", ref: I, "data-index": v, role: "row", "aria-label": i?.(d.original), onClick: r ? () => r(d.original) : void 0, ...p(b.div, g.row, !!r && g.rowClickable, W), children: d.getVisibleCells().map((z) => /* @__PURE__ */ u("div", { "data-element-src": "VirtualTable/VirtualTable.tsx:271", role: "cell", ...p(b.div, g.cell, g.cellFlex(z.column.getSize())), children: E(z.column.columnDef.cell, z.getContext()) }, z.id)) }, d.id), gt = k?.(X) ?? (a.length ? `${X.from}–${X.to} / ${X.total}` : "");
|
|
617
|
+
return /* @__PURE__ */ B("div", { "data-element-src": "VirtualTable/VirtualTable.tsx:286", ref: R, ...p(b.div, g.wrap), children: [
|
|
618
|
+
/* @__PURE__ */ B("div", { "data-element-src": "VirtualTable/VirtualTable.tsx:287", ref: et, role: "table", ...p(b.div, j ? g.stackScroll : g.scroll, P && g.scrollMax(y)), children: [
|
|
619
|
+
j ? null : /* @__PURE__ */ u("div", { "data-element-src": "VirtualTable/VirtualTable.tsx:296", role: "rowgroup", ...p(b.div, g.head), children: $.getHeaderGroups().map((d) => /* @__PURE__ */ u("div", { "data-element-src": "VirtualTable/VirtualTable.tsx:298", role: "row", ...p(b.div, g.headRow), children: d.headers.map((v) => {
|
|
620
|
+
const W = v.column, I = W.getIsSorted();
|
|
621
|
+
return /* @__PURE__ */ B("div", { "data-element-src": "VirtualTable/VirtualTable.tsx:303", role: "columnheader", "aria-sort": I === "asc" ? "ascending" : I === "desc" ? "descending" : void 0, onClick: W.getCanSort() ? W.getToggleSortingHandler() : void 0, ...p(b.div, g.headCell, W.getCanSort() && g.headCellSortable, g.cellFlex(v.getSize())), children: [
|
|
622
|
+
v.isPlaceholder ? null : E(W.columnDef.header, v.getContext()),
|
|
623
|
+
I ? /* @__PURE__ */ u("span", { "data-element-src": "VirtualTable/VirtualTable.tsx:324", ...p(b.span, g.sortMark), children: I === "asc" ? "↑" : "↓" }) : null
|
|
626
624
|
] }, v.id);
|
|
627
625
|
}) }, d.id)) }),
|
|
628
|
-
a.length === 0 ? /* @__PURE__ */ u("div", { "data-element-src": "VirtualTable/VirtualTable.tsx:
|
|
626
|
+
a.length === 0 ? /* @__PURE__ */ u("div", { "data-element-src": "VirtualTable/VirtualTable.tsx:337", ...p(b.div, g.empty), children: S }) : /* @__PURE__ */ u("div", { "data-element-src": "VirtualTable/VirtualTable.tsx:339", role: "rowgroup", ...p(b.div, j ? g.stackBody : P ? g.bodyTotal(Y.getTotalSize()) : void 0), children: P ? N.map((d) => nt(a[d.index], d.index, g.rowAbsolute(d.start), Y.measureElement)) : a.map((d, v) => nt(d, v)) })
|
|
629
627
|
] }),
|
|
630
|
-
|
|
628
|
+
P && a.length > 0 ? /* @__PURE__ */ u("div", { "data-element-src": "VirtualTable/VirtualTable.tsx:364", "aria-live": "polite", ...p(b.div, g.pos), children: gt }) : null
|
|
631
629
|
] });
|
|
632
630
|
}
|
|
633
|
-
const
|
|
634
|
-
...
|
|
635
|
-
Pagination:
|
|
636
|
-
SortIndicator:
|
|
637
|
-
ColumnFilter:
|
|
638
|
-
SortChip:
|
|
631
|
+
const Ot = {
|
|
632
|
+
...yt,
|
|
633
|
+
Pagination: dt,
|
|
634
|
+
SortIndicator: Vt,
|
|
635
|
+
ColumnFilter: zt,
|
|
636
|
+
SortChip: tt,
|
|
639
637
|
/** Renders a styled Table directly from a TanStack table instance. */
|
|
640
|
-
FromTanstack:
|
|
638
|
+
FromTanstack: ct
|
|
641
639
|
};
|
|
642
640
|
export {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
641
|
+
Ot as Table,
|
|
642
|
+
Ht as VirtualTable,
|
|
643
|
+
Et as useDataTable
|
|
646
644
|
};
|
|
647
645
|
//# sourceMappingURL=table.js.map
|