@cryptlex/web-components 5.0.0 → 5.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/components/data-table/data-table-filter.es.js +46 -44
- package/dist/components/data-table/data-table-filter.es.js.map +1 -1
- package/dist/components/data-table/data-table.es.js +160 -159
- package/dist/components/data-table/data-table.es.js.map +1 -1
- package/dist/components/data-table/table-commons.es.js +51 -217
- package/dist/components/data-table/table-commons.es.js.map +1 -1
- package/dist/components/inputs/date-picker.es.js +61 -41
- package/dist/components/inputs/date-picker.es.js.map +1 -1
- package/dist/components/inputs/datefield.es.js +9 -9
- package/dist/components/inputs/datefield.es.js.map +1 -1
- package/dist/components/inputs/field.es.js +36 -35
- package/dist/components/inputs/field.es.js.map +1 -1
- package/dist/components/inputs/id-search.es.js +36 -33
- package/dist/components/inputs/id-search.es.js.map +1 -1
- package/dist/components/inputs/multi-select.es.js +32 -39
- package/dist/components/inputs/multi-select.es.js.map +1 -1
- package/dist/components/inputs/{country-select.es.js → select-options.es.js} +26 -24
- package/dist/components/inputs/select-options.es.js.map +1 -0
- package/dist/components/inputs/select.es.js +46 -45
- package/dist/components/inputs/select.es.js.map +1 -1
- package/dist/components/ui/button.es.js +22 -24
- package/dist/components/ui/button.es.js.map +1 -1
- package/dist/components/ui/menu.es.js +44 -43
- package/dist/components/ui/menu.es.js.map +1 -1
- package/dist/components/ui/popover.es.js +1 -1
- package/dist/components/ui/popover.es.js.map +1 -1
- package/dist/index.es.d.ts +44 -54
- package/dist/index.es.js +206 -207
- package/dist/node_modules/.pnpm/@internationalized_date@3.8.2/node_modules/@internationalized/date/dist/CalendarDate.es.js +13 -13
- package/dist/node_modules/.pnpm/@internationalized_date@3.8.2/node_modules/@internationalized/date/dist/conversion.es.js +5 -5
- package/dist/node_modules/.pnpm/@internationalized_date@3.8.2/node_modules/@internationalized/date/dist/string.es.js +48 -39
- package/dist/node_modules/.pnpm/@internationalized_date@3.8.2/node_modules/@internationalized/date/dist/string.es.js.map +1 -1
- package/dist/utils/form-hook.es.js +10 -14
- package/dist/utils/form-hook.es.js.map +1 -1
- package/dist/utils/primitives.es.js.map +1 -1
- package/dist/utils/resource-names.es.js +182 -0
- package/dist/utils/resource-names.es.js.map +1 -0
- package/package.json +1 -1
- package/dist/components/inputs/country-select.es.js.map +0 -1
- package/dist/components/inputs/license-type-select.es.js +0 -31
- package/dist/components/inputs/license-type-select.es.js.map +0 -1
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as e, Fragment as
|
|
3
|
-
import { useQuery as
|
|
4
|
-
import { createColumnHelper as
|
|
5
|
-
import { Info as
|
|
6
|
-
import { createContext as
|
|
7
|
-
import { sortableKeyboardCoordinates as
|
|
8
|
-
import { DataTableFilter as
|
|
9
|
-
import { EasyMenu as X, MenuItem as
|
|
10
|
-
import { Table as
|
|
11
|
-
import {
|
|
2
|
+
import { jsx as e, Fragment as N, jsxs as s } from "react/jsx-runtime";
|
|
3
|
+
import { useQuery as re, keepPreviousData as oe } from "@tanstack/react-query";
|
|
4
|
+
import { createColumnHelper as ie, useReactTable as le, getCoreRowModel as se, flexRender as F } from "@tanstack/react-table";
|
|
5
|
+
import { Info as ce, RotateCw as de, Columns3 as ue, GripVertical as me, ChevronFirst as ge, ChevronLeft as fe, ChevronRight as pe, ChevronLast as he, ArrowDownNarrowWide as be, ArrowDownWideNarrow as Se, ArrowUpDown as Ce } from "lucide-react";
|
|
6
|
+
import { createContext as ye, useId as ve, useState as x, useMemo as O, useEffect as Q, useContext as xe } from "react";
|
|
7
|
+
import { sortableKeyboardCoordinates as we, SortableContext as Ne, verticalListSortingStrategy as Te, arrayMove as De, useSortable as Pe } from "@dnd-kit/sortable";
|
|
8
|
+
import { DataTableFilter as Ae } from "./data-table-filter.es.js";
|
|
9
|
+
import { EasyMenu as X, MenuItem as L } from "../ui/menu.es.js";
|
|
10
|
+
import { Table as Ie, TableHeader as ze, TableRow as $, TableHead as Me, TableBody as Fe, TableCell as Oe } from "../ui/table.es.js";
|
|
11
|
+
import { useResourceFormatter as Le } from "../../utils/resource-names.es.js";
|
|
12
|
+
import { useSensors as Re, useSensor as W, PointerSensor as ke, KeyboardSensor as Ee, DndContext as _e, closestCenter as Ve, DragOverlay as He } from "@dnd-kit/core";
|
|
12
13
|
import { CSS as Ue } from "@dnd-kit/utilities";
|
|
13
14
|
import { merge as je } from "lodash-es";
|
|
14
|
-
import { TABLE_CHECK_BOX_COLUMN as qe, TABLE_ID_COLUMN as Be, TABLE_DEFAULT_DATE_COLUMNS as Ke
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { Button as
|
|
19
|
-
const
|
|
20
|
-
function
|
|
21
|
-
var
|
|
22
|
-
const
|
|
15
|
+
import { TABLE_CHECK_BOX_COLUMN as qe, TABLE_ID_COLUMN as Be, TABLE_DEFAULT_DATE_COLUMNS as Ke } from "./table-commons.es.js";
|
|
16
|
+
import { SearchField as Qe } from "../inputs/searchfield.es.js";
|
|
17
|
+
import { cn as w } from "../../utils/primitives.es.js";
|
|
18
|
+
import { Loader as $e } from "../ui/loader.es.js";
|
|
19
|
+
import { Button as S } from "../ui/button.es.js";
|
|
20
|
+
const R = "tableActions";
|
|
21
|
+
function St({ columns: t, fetchFn: o, columnsToHideByDefault: i = {}, allowSelection: r = !1, filterConfig: a }) {
|
|
22
|
+
var H, U, j;
|
|
23
|
+
const d = ve(), [C, l] = x({
|
|
23
24
|
/** TODO Reflect in URL */
|
|
24
25
|
pagination: { pageIndex: 0, pageSize: 20 },
|
|
25
26
|
// Pagination state
|
|
@@ -28,72 +29,72 @@ function bt({ columns: t, fetchFn: i, columnsToHideByDefault: o = {}, allowSelec
|
|
|
28
29
|
/** Ephemeral */
|
|
29
30
|
rowSelection: {}
|
|
30
31
|
// Row selection state
|
|
31
|
-
}), [
|
|
32
|
+
}), [c, m] = x(""), [f, y] = x([]), [b, z] = x({
|
|
32
33
|
id: !1,
|
|
33
34
|
updatedAt: !1,
|
|
34
|
-
...
|
|
35
|
-
}), [
|
|
36
|
-
|
|
35
|
+
...i
|
|
36
|
+
}), [M, J] = x([]), k = O(() => M.reduce((n, p) => je(n, p), {}), [M]), P = (n) => {
|
|
37
|
+
l((p) => ({ ...p, ...n }));
|
|
37
38
|
}, {
|
|
38
39
|
sorting: A,
|
|
39
|
-
rowSelection:
|
|
40
|
+
rowSelection: E,
|
|
40
41
|
pagination: I
|
|
41
|
-
} =
|
|
42
|
-
queryKey: [
|
|
43
|
-
queryFn: () =>
|
|
42
|
+
} = C, v = re({
|
|
43
|
+
queryKey: [d, I, A, c],
|
|
44
|
+
queryFn: () => o(I, A, c, k),
|
|
44
45
|
placeholderData: oe,
|
|
45
46
|
// Keep previous data while loading new data
|
|
46
47
|
retry: 0,
|
|
47
48
|
refetchOnWindowFocus: !1
|
|
48
49
|
});
|
|
49
|
-
|
|
50
|
-
}, [
|
|
51
|
-
const
|
|
52
|
-
var
|
|
53
|
-
const n = (
|
|
50
|
+
Q(() => {
|
|
51
|
+
}, [b]);
|
|
52
|
+
const ee = O(() => ie(), []), _ = O(() => {
|
|
53
|
+
var B;
|
|
54
|
+
const n = (B = v.data) == null ? void 0 : B.data;
|
|
54
55
|
if (!(n != null && n.length)) return [];
|
|
55
|
-
const
|
|
56
|
-
|
|
56
|
+
const p = (u) => u != null && typeof u == "object" && "metadata" in u && Array.isArray(u.metadata), q = n.filter(
|
|
57
|
+
p
|
|
57
58
|
);
|
|
58
|
-
return
|
|
59
|
+
return q.length === 0 ? [] : Array.from(new Set(q.flatMap((u) => {
|
|
59
60
|
var g;
|
|
60
|
-
return ((g =
|
|
61
|
-
}))).map((
|
|
61
|
+
return ((g = u.metadata) == null ? void 0 : g.map((h) => h.key)) ?? [];
|
|
62
|
+
}))).map((u) => ee.accessor(
|
|
62
63
|
(g) => {
|
|
63
|
-
var
|
|
64
|
-
return
|
|
64
|
+
var h, K;
|
|
65
|
+
return p(g) ? ((K = (h = g == null ? void 0 : g.metadata) == null ? void 0 : h.find((ae) => ae.key === u)) == null ? void 0 : K.value) ?? "" : "";
|
|
65
66
|
},
|
|
66
67
|
{
|
|
67
|
-
id:
|
|
68
|
-
header:
|
|
68
|
+
id: u,
|
|
69
|
+
header: u,
|
|
69
70
|
// tooltip header
|
|
70
71
|
enableSorting: !1,
|
|
71
72
|
cell: (g) => {
|
|
72
|
-
const
|
|
73
|
-
return
|
|
73
|
+
const h = g.getValue();
|
|
74
|
+
return h == null ? "" : String(h);
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
));
|
|
77
|
-
}, [(
|
|
78
|
+
}, [(H = v.data) == null ? void 0 : H.data]), te = [
|
|
78
79
|
...r ? qe : [],
|
|
79
80
|
...Be,
|
|
80
|
-
...t.filter((n) => n.id !==
|
|
81
|
-
...
|
|
81
|
+
...t.filter((n) => n.id !== R),
|
|
82
|
+
..._.length ? _ : [],
|
|
82
83
|
...Ke,
|
|
83
84
|
// Actions column
|
|
84
|
-
...t.filter((n) => n.id ===
|
|
85
|
+
...t.filter((n) => n.id === R)
|
|
85
86
|
];
|
|
86
|
-
function
|
|
87
|
+
function ne(n) {
|
|
87
88
|
return typeof n == "function";
|
|
88
89
|
}
|
|
89
|
-
function D(n,
|
|
90
|
-
return
|
|
90
|
+
function D(n, p) {
|
|
91
|
+
return ne(n) ? n(p) : n;
|
|
91
92
|
}
|
|
92
|
-
const
|
|
93
|
-
data: ((
|
|
94
|
-
columns:
|
|
95
|
-
getCoreRowModel:
|
|
96
|
-
rowCount: (
|
|
93
|
+
const V = le({
|
|
94
|
+
data: ((U = v.data) == null ? void 0 : U.data) ?? [],
|
|
95
|
+
columns: te,
|
|
96
|
+
getCoreRowModel: se(),
|
|
97
|
+
rowCount: (j = v.data) == null ? void 0 : j.total,
|
|
97
98
|
manualPagination: !0,
|
|
98
99
|
// Handle pagination manually since pagination is done server side for data tables
|
|
99
100
|
onPaginationChange: (n) => {
|
|
@@ -107,55 +108,55 @@ function bt({ columns: t, fetchFn: i, columnsToHideByDefault: o = {}, allowSelec
|
|
|
107
108
|
manualFiltering: !0,
|
|
108
109
|
// Handle filtering manually since filtering is done server side for data tables
|
|
109
110
|
onColumnVisibilityChange: (n) => {
|
|
110
|
-
|
|
111
|
+
z(D(n, b));
|
|
111
112
|
},
|
|
112
113
|
onRowSelectionChange: (n) => {
|
|
113
|
-
P({ rowSelection: D(n,
|
|
114
|
+
P({ rowSelection: D(n, E) });
|
|
114
115
|
},
|
|
115
116
|
onColumnOrderChange: (n) => {
|
|
116
|
-
|
|
117
|
+
y(D(n, f));
|
|
117
118
|
},
|
|
118
119
|
state: {
|
|
119
120
|
sorting: A,
|
|
120
|
-
columnVisibility:
|
|
121
|
+
columnVisibility: b,
|
|
121
122
|
pagination: I,
|
|
122
|
-
rowSelection:
|
|
123
|
-
columnOrder:
|
|
123
|
+
rowSelection: E,
|
|
124
|
+
columnOrder: f
|
|
124
125
|
},
|
|
125
126
|
meta: {
|
|
126
|
-
refetch:
|
|
127
|
+
refetch: v.refetch
|
|
127
128
|
}
|
|
128
129
|
});
|
|
129
|
-
return
|
|
130
|
-
|
|
131
|
-
}, []), { tableState:
|
|
130
|
+
return Q(() => {
|
|
131
|
+
y([...V.getAllLeafColumns().map((n) => n.id)]);
|
|
132
|
+
}, []), { tableState: C, updateTableState: P, query: v, setSearchQuery: m, searchQuery: c, tanTable: V, mergedFilters: k, filters: M, setFilters: J, filterConfig: a };
|
|
132
133
|
}
|
|
133
|
-
const Y =
|
|
134
|
-
const t =
|
|
134
|
+
const Y = ye(null), T = () => {
|
|
135
|
+
const t = xe(Y);
|
|
135
136
|
if (!t)
|
|
136
137
|
throw Error("DataTable should be used within DataTableProvider.");
|
|
137
138
|
return t;
|
|
138
139
|
};
|
|
139
|
-
function
|
|
140
|
-
return /* @__PURE__ */ e(Y.Provider, { value:
|
|
140
|
+
function Ct({ children: t, ...o }) {
|
|
141
|
+
return /* @__PURE__ */ e(Y.Provider, { value: o, children: t });
|
|
141
142
|
}
|
|
142
|
-
function
|
|
143
|
+
function yt({
|
|
143
144
|
tableActions: t,
|
|
144
|
-
className:
|
|
145
|
-
...
|
|
145
|
+
className: o,
|
|
146
|
+
...i
|
|
146
147
|
// filterableFields,
|
|
147
148
|
}) {
|
|
148
|
-
var
|
|
149
|
-
const { query: r, tanTable: a } =
|
|
150
|
-
return /* @__PURE__ */ e(
|
|
149
|
+
var d;
|
|
150
|
+
const { query: r, tanTable: a } = T();
|
|
151
|
+
return /* @__PURE__ */ e(N, { children: /* @__PURE__ */ s("section", { ...i, className: w("flex flex-col bg-card", o), children: [
|
|
151
152
|
/* @__PURE__ */ e(Ye, { tableActions: t }),
|
|
152
153
|
/* @__PURE__ */ s("div", { className: "w-full overflow-auto border-x grow min-h-table relative", tabIndex: 0, children: [
|
|
153
|
-
r.isLoading && /* @__PURE__ */ e(G, { className: "cursor-wait", children: /* @__PURE__ */ e(
|
|
154
|
+
r.isLoading && /* @__PURE__ */ e(G, { className: "cursor-wait", children: /* @__PURE__ */ e($e, {}) }),
|
|
154
155
|
!r.isLoading && a.getRowModel().rows.length === 0 && // Empty table
|
|
155
156
|
/* @__PURE__ */ e(G, { className: "cursor-not-allowed", children: !r.isFetching && (r.isError ? /* @__PURE__ */ s("span", { className: "flex gap-3 justify-center items-center", children: [
|
|
156
|
-
/* @__PURE__ */ e(
|
|
157
|
+
/* @__PURE__ */ e(ce, {}),
|
|
157
158
|
/* @__PURE__ */ e("span", { children: "You don't have the required permissions. Please contact your admin." })
|
|
158
|
-
] }) : (
|
|
159
|
+
] }) : (d = r.data) != null && d.data ? /* @__PURE__ */ e(N, { children: "Unknown error. Please contact customer support." }) : /* @__PURE__ */ e(N, { children: "No results found." })) }),
|
|
159
160
|
!r.isLoading && a.getRowModel().rows.length !== 0 && /* @__PURE__ */ e(Ze, { className: "size-full" })
|
|
160
161
|
] }),
|
|
161
162
|
/* @__PURE__ */ s("div", { className: "flex w-full justify-between border gap-icon p-icon overflow-x-auto", children: [
|
|
@@ -169,14 +170,14 @@ function Ct({
|
|
|
169
170
|
}
|
|
170
171
|
function G({
|
|
171
172
|
children: t,
|
|
172
|
-
className:
|
|
173
|
+
className: o
|
|
173
174
|
}) {
|
|
174
|
-
return /* @__PURE__ */ s(
|
|
175
|
+
return /* @__PURE__ */ s(N, { children: [
|
|
175
176
|
/* @__PURE__ */ e(
|
|
176
177
|
"span",
|
|
177
178
|
{
|
|
178
|
-
className:
|
|
179
|
-
|
|
179
|
+
className: w(
|
|
180
|
+
o,
|
|
180
181
|
"absolute top-0 bg-card z-20 size-full text-sm flex items-center justify-center"
|
|
181
182
|
),
|
|
182
183
|
children: t
|
|
@@ -186,76 +187,76 @@ function G({
|
|
|
186
187
|
] });
|
|
187
188
|
}
|
|
188
189
|
function We() {
|
|
189
|
-
const { tanTable: t, tableState:
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
coordinateGetter:
|
|
190
|
+
const { tanTable: t, tableState: o } = T(), [i, r] = x(null), a = Le(), d = Re(
|
|
191
|
+
W(ke),
|
|
192
|
+
W(Ee, {
|
|
193
|
+
coordinateGetter: we
|
|
193
194
|
})
|
|
194
195
|
);
|
|
195
196
|
return /* @__PURE__ */ e(
|
|
196
197
|
_e,
|
|
197
198
|
{
|
|
198
|
-
sensors:
|
|
199
|
+
sensors: d,
|
|
199
200
|
collisionDetection: Ve,
|
|
200
201
|
onDragStart: (l) => {
|
|
201
202
|
const { active: c } = l;
|
|
202
203
|
r(c.id.toString());
|
|
203
204
|
},
|
|
204
205
|
onDragEnd: (l) => {
|
|
205
|
-
const { active: c, over:
|
|
206
|
-
if (
|
|
207
|
-
const
|
|
208
|
-
t.setColumnOrder([...
|
|
206
|
+
const { active: c, over: m } = l;
|
|
207
|
+
if (m && c.id !== m.id) {
|
|
208
|
+
const f = t.getState().columnOrder, y = f.indexOf(c.id.toString()), b = f.indexOf(m.id.toString());
|
|
209
|
+
t.setColumnOrder([...De(f, y, b)]);
|
|
209
210
|
}
|
|
210
211
|
r(null);
|
|
211
212
|
},
|
|
212
213
|
children: /* @__PURE__ */ s(
|
|
213
|
-
|
|
214
|
+
Ne,
|
|
214
215
|
{
|
|
215
216
|
items: t.getState().columnOrder,
|
|
216
|
-
strategy:
|
|
217
|
+
strategy: Te,
|
|
217
218
|
children: [
|
|
218
|
-
/* @__PURE__ */ s(X, { label: /* @__PURE__ */ s(
|
|
219
|
-
/* @__PURE__ */ e(
|
|
219
|
+
/* @__PURE__ */ s(X, { label: /* @__PURE__ */ s(N, { children: [
|
|
220
|
+
/* @__PURE__ */ e(ue, {}),
|
|
220
221
|
"Columns"
|
|
221
222
|
] }), selectionMode: "multiple", items: t.getAllFlatColumns(), selectedKeys: t.getIsAllColumnsVisible() ? "all" : t.getVisibleFlatColumns().map((l) => l.id), children: [
|
|
222
|
-
/* @__PURE__ */ e(
|
|
223
|
+
/* @__PURE__ */ e(L, { onAction: () => t.toggleAllColumnsVisible(), className: "italic", children: "(select all)" }),
|
|
223
224
|
t.getState().columnOrder.map((l) => {
|
|
224
|
-
const c = t.getAllFlatColumns().find((
|
|
225
|
-
return c ? /* @__PURE__ */ e(
|
|
225
|
+
const c = t.getAllFlatColumns().find((m) => m.id === l);
|
|
226
|
+
return c ? /* @__PURE__ */ e(C, { column: c }, c.id) : null;
|
|
226
227
|
})
|
|
227
228
|
] }),
|
|
228
|
-
/* @__PURE__ */ e(He, { children:
|
|
229
|
+
/* @__PURE__ */ e(He, { children: i ? /* @__PURE__ */ e("div", { className: "dropdown-item opacity-70 border-2 border-primary", children: a(i) }) : null })
|
|
229
230
|
]
|
|
230
231
|
}
|
|
231
232
|
)
|
|
232
233
|
}
|
|
233
234
|
);
|
|
234
|
-
function
|
|
235
|
+
function C({ column: l }) {
|
|
235
236
|
const {
|
|
236
237
|
attributes: c,
|
|
237
|
-
listeners:
|
|
238
|
-
setNodeRef:
|
|
239
|
-
transform:
|
|
240
|
-
transition:
|
|
241
|
-
} =
|
|
242
|
-
transform: Ue.Transform.toString(
|
|
243
|
-
transition:
|
|
238
|
+
listeners: m,
|
|
239
|
+
setNodeRef: f,
|
|
240
|
+
transform: y,
|
|
241
|
+
transition: b
|
|
242
|
+
} = Pe({ id: l.id }), z = {
|
|
243
|
+
transform: Ue.Transform.toString(y),
|
|
244
|
+
transition: b,
|
|
244
245
|
zIndex: "999"
|
|
245
246
|
};
|
|
246
247
|
return /* @__PURE__ */ s(
|
|
247
|
-
|
|
248
|
+
L,
|
|
248
249
|
{
|
|
249
|
-
ref:
|
|
250
|
-
style:
|
|
250
|
+
ref: f,
|
|
251
|
+
style: z,
|
|
251
252
|
...c,
|
|
252
253
|
id: l.id,
|
|
253
254
|
onAction: () => l.toggleVisibility(),
|
|
254
255
|
isDisabled: !l.getCanHide(),
|
|
255
256
|
className: "flex items-center",
|
|
256
257
|
children: [
|
|
257
|
-
/* @__PURE__ */ e(
|
|
258
|
-
|
|
258
|
+
/* @__PURE__ */ e(me, { ...m, className: "size-icon cursor-grab" }),
|
|
259
|
+
a(l.id),
|
|
259
260
|
l.getIsSorted() && /* @__PURE__ */ e(Z, { className: "size-icon", direction: l.getIsSorted() })
|
|
260
261
|
]
|
|
261
262
|
}
|
|
@@ -264,110 +265,110 @@ function We() {
|
|
|
264
265
|
}
|
|
265
266
|
function Ge() {
|
|
266
267
|
var r;
|
|
267
|
-
const { tanTable: t, query:
|
|
268
|
+
const { tanTable: t, query: o } = T(), i = ((r = o.data) == null ? void 0 : r.total) ?? 0;
|
|
268
269
|
return /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
269
270
|
/* @__PURE__ */ e("span", { className: "whitespace-nowrap caption text-muted", children: `${t.getState().pagination.pageIndex * t.getState().pagination.pageSize + 1} - ${Math.min(
|
|
270
271
|
(t.getState().pagination.pageIndex + 1) * t.getState().pagination.pageSize,
|
|
271
|
-
|
|
272
|
-
)} of ${
|
|
272
|
+
i
|
|
273
|
+
)} of ${i == null ? void 0 : i.toLocaleString()}` }),
|
|
273
274
|
/* @__PURE__ */ e(
|
|
274
|
-
|
|
275
|
+
S,
|
|
275
276
|
{
|
|
276
277
|
onPress: () => t.firstPage(),
|
|
277
278
|
isDisabled: !t.getCanPreviousPage(),
|
|
278
279
|
variant: "neutral",
|
|
279
280
|
size: "icon",
|
|
280
|
-
children: /* @__PURE__ */ e(
|
|
281
|
+
children: /* @__PURE__ */ e(ge, {})
|
|
281
282
|
}
|
|
282
283
|
),
|
|
283
284
|
/* @__PURE__ */ e(
|
|
284
|
-
|
|
285
|
+
S,
|
|
285
286
|
{
|
|
286
287
|
onPress: () => t.previousPage(),
|
|
287
288
|
isDisabled: !t.getCanPreviousPage(),
|
|
288
289
|
variant: "neutral",
|
|
289
290
|
size: "icon",
|
|
290
|
-
children: /* @__PURE__ */ e(
|
|
291
|
+
children: /* @__PURE__ */ e(fe, {})
|
|
291
292
|
}
|
|
292
293
|
),
|
|
293
294
|
/* @__PURE__ */ e(
|
|
294
|
-
|
|
295
|
+
S,
|
|
295
296
|
{
|
|
296
297
|
onPress: () => t.nextPage(),
|
|
297
298
|
isDisabled: !t.getCanNextPage(),
|
|
298
299
|
variant: "neutral",
|
|
299
300
|
size: "icon",
|
|
300
|
-
children: /* @__PURE__ */ e(
|
|
301
|
+
children: /* @__PURE__ */ e(pe, {})
|
|
301
302
|
}
|
|
302
303
|
),
|
|
303
304
|
/* @__PURE__ */ e(
|
|
304
|
-
|
|
305
|
+
S,
|
|
305
306
|
{
|
|
306
307
|
onClick: () => t.lastPage(),
|
|
307
308
|
isDisabled: !t.getCanNextPage(),
|
|
308
309
|
variant: "neutral",
|
|
309
310
|
size: "icon",
|
|
310
|
-
children: /* @__PURE__ */ e(
|
|
311
|
+
children: /* @__PURE__ */ e(he, {})
|
|
311
312
|
}
|
|
312
313
|
)
|
|
313
314
|
] });
|
|
314
315
|
}
|
|
315
316
|
function Xe() {
|
|
316
|
-
const { tanTable: t } =
|
|
317
|
-
return /* @__PURE__ */ e(X, { label: t.getState().pagination.pageSize.toString(), selectionMode: "single", selectedKeys: [t.getState().pagination.pageSize.toString()], items:
|
|
317
|
+
const { tanTable: t } = T(), o = [10, 20, 30, 40, 50];
|
|
318
|
+
return /* @__PURE__ */ e(X, { label: t.getState().pagination.pageSize.toString(), selectionMode: "single", selectedKeys: [t.getState().pagination.pageSize.toString()], items: o.map((i) => ({ id: i.toString(), value: i })), children: (i) => /* @__PURE__ */ e(L, { onAction: () => t.setPageSize(i.value), children: i.value }) });
|
|
318
319
|
}
|
|
319
320
|
function Ye({ tableActions: t }) {
|
|
320
|
-
const { query:
|
|
321
|
+
const { query: o, tanTable: i, searchQuery: r, setSearchQuery: a } = T();
|
|
321
322
|
return /* @__PURE__ */ s("section", { className: "flex bg-card justify-between my-0 p-icon border gap-icon overflow-auto", children: [
|
|
322
323
|
/* @__PURE__ */ s("div", { className: "flex gap-icon", children: [
|
|
323
324
|
/* @__PURE__ */ e(
|
|
324
|
-
|
|
325
|
+
S,
|
|
325
326
|
{
|
|
326
|
-
isPending:
|
|
327
|
-
onClick: () =>
|
|
327
|
+
isPending: o.isFetching,
|
|
328
|
+
onClick: () => o.refetch(),
|
|
328
329
|
variant: "neutral",
|
|
329
330
|
size: "icon",
|
|
330
|
-
children: /* @__PURE__ */ e(
|
|
331
|
+
children: /* @__PURE__ */ e(de, {})
|
|
331
332
|
}
|
|
332
333
|
),
|
|
333
|
-
t.filter((
|
|
334
|
-
(
|
|
335
|
-
const
|
|
336
|
-
return /* @__PURE__ */ e(
|
|
337
|
-
|
|
338
|
-
}, size: "icon", children: /* @__PURE__ */ e(
|
|
334
|
+
t.filter((d) => d.bulk === i.getSelectedRowModel().rows.length > 0).map(
|
|
335
|
+
(d, C) => {
|
|
336
|
+
const l = d.icon;
|
|
337
|
+
return /* @__PURE__ */ e(S, { type: "button", isDisabled: o.isFetching, className: "animate-in fade-in slide-in-from-left-15 duration-300 transition-transform", onPress: (c) => {
|
|
338
|
+
d.onClick(c, i);
|
|
339
|
+
}, size: "icon", children: /* @__PURE__ */ e(l, {}) }, `${C}-${d.bulk}`);
|
|
339
340
|
}
|
|
340
341
|
)
|
|
341
342
|
] }),
|
|
342
343
|
/* @__PURE__ */ s("div", { className: "flex gap-icon", children: [
|
|
343
|
-
/* @__PURE__ */ e(
|
|
344
|
-
/* @__PURE__ */ e(
|
|
344
|
+
/* @__PURE__ */ e(Ae, {}),
|
|
345
|
+
/* @__PURE__ */ e(Qe, { value: r, onChange: a })
|
|
345
346
|
] })
|
|
346
347
|
] });
|
|
347
348
|
}
|
|
348
|
-
function Z({ direction: t, ...
|
|
349
|
-
return t === "asc" ? /* @__PURE__ */ e(
|
|
349
|
+
function Z({ direction: t, ...o }) {
|
|
350
|
+
return t === "asc" ? /* @__PURE__ */ e(be, { ...o }) : t === "desc" ? /* @__PURE__ */ e(Se, { ...o }) : /* @__PURE__ */ e(Ce, { ...o });
|
|
350
351
|
}
|
|
351
352
|
function Ze({ className: t }) {
|
|
352
|
-
const { tanTable:
|
|
353
|
-
return /* @__PURE__ */ s(
|
|
354
|
-
/* @__PURE__ */ e(
|
|
355
|
-
|
|
353
|
+
const { tanTable: o } = T(), i = (r, a) => w("animate-in fade-in slide-in-from-top-10", "px-icon py-2 text-left text-sm font-medium whitespace-nowrap", r && "bg-card sticky right-0 z-50 text-center", a);
|
|
354
|
+
return /* @__PURE__ */ s(Ie, { className: w(t), children: [
|
|
355
|
+
/* @__PURE__ */ e(ze, { className: "sticky top-0 z-10", children: o.getHeaderGroups().map((r) => /* @__PURE__ */ e($, { className: w("h-input"), children: r.headers.map((a) => /* @__PURE__ */ s(
|
|
356
|
+
Me,
|
|
356
357
|
{
|
|
357
|
-
className:
|
|
358
|
+
className: i(!1, "bg-card"),
|
|
358
359
|
children: [
|
|
359
|
-
!a.column.getCanSort() && !a.isPlaceholder && /* @__PURE__ */ e(
|
|
360
|
+
!a.column.getCanSort() && !a.isPlaceholder && /* @__PURE__ */ e(N, { children: F(
|
|
360
361
|
a.column.columnDef.header,
|
|
361
362
|
a.getContext()
|
|
362
363
|
) }),
|
|
363
364
|
a.column.getCanSort() && /* @__PURE__ */ s(
|
|
364
|
-
|
|
365
|
+
S,
|
|
365
366
|
{
|
|
366
367
|
variant: "ghost",
|
|
367
368
|
className: "w-full !justify-start !px-1.5",
|
|
368
369
|
onPress: a.column.getToggleSortingHandler(),
|
|
369
370
|
children: [
|
|
370
|
-
|
|
371
|
+
F(
|
|
371
372
|
a.column.columnDef.header,
|
|
372
373
|
a.getContext()
|
|
373
374
|
),
|
|
@@ -379,16 +380,16 @@ function Ze({ className: t }) {
|
|
|
379
380
|
},
|
|
380
381
|
a.id
|
|
381
382
|
)) }, r.id)) }),
|
|
382
|
-
/* @__PURE__ */ e(Fe, { className: "flex-1 overflow-y-auto relative", children:
|
|
383
|
-
|
|
383
|
+
/* @__PURE__ */ e(Fe, { className: "flex-1 overflow-y-auto relative", children: o.getRowModel().rows.map((r) => /* @__PURE__ */ e(
|
|
384
|
+
$,
|
|
384
385
|
{
|
|
385
|
-
className:
|
|
386
|
+
className: w("h-input transition-colors data-[selected=true]:bg-primary/10 hover:bg-muted-foreground/20"),
|
|
386
387
|
"data-selected": r.getIsSelected(),
|
|
387
388
|
children: r.getVisibleCells().map((a) => /* @__PURE__ */ e(
|
|
388
|
-
|
|
389
|
+
Oe,
|
|
389
390
|
{
|
|
390
|
-
className:
|
|
391
|
-
children:
|
|
391
|
+
className: i(a.column.id === R),
|
|
392
|
+
children: F(
|
|
392
393
|
a.column.columnDef.cell,
|
|
393
394
|
a.getContext()
|
|
394
395
|
)
|
|
@@ -401,11 +402,11 @@ function Ze({ className: t }) {
|
|
|
401
402
|
] });
|
|
402
403
|
}
|
|
403
404
|
export {
|
|
404
|
-
|
|
405
|
-
|
|
405
|
+
R as ACTIONS_COLUMN_ID,
|
|
406
|
+
yt as DataTable,
|
|
406
407
|
Y as DataTableContext,
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
408
|
+
Ct as DataTableProvider,
|
|
409
|
+
T as useDataTable,
|
|
410
|
+
St as useDataTableState
|
|
410
411
|
};
|
|
411
412
|
//# sourceMappingURL=data-table.es.js.map
|