@tetrascience-npm/tetrascience-react-ui 0.5.0-beta.40.1 → 0.5.0-beta.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ai/attachments.cjs +2 -0
- package/dist/components/ai/attachments.cjs.map +1 -0
- package/dist/components/ai/attachments.js +224 -0
- package/dist/components/ai/attachments.js.map +1 -0
- package/dist/components/ai/chain-of-thought.cjs +2 -0
- package/dist/components/ai/chain-of-thought.cjs.map +1 -0
- package/dist/components/ai/chain-of-thought.js +145 -0
- package/dist/components/ai/chain-of-thought.js.map +1 -0
- package/dist/components/ai/confirmation.cjs +2 -0
- package/dist/components/ai/confirmation.cjs.map +1 -0
- package/dist/components/ai/confirmation.js +109 -0
- package/dist/components/ai/confirmation.js.map +1 -0
- package/dist/components/ai/context.cjs +2 -0
- package/dist/components/ai/context.cjs.map +1 -0
- package/dist/components/ai/context.js +266 -0
- package/dist/components/ai/context.js.map +1 -0
- package/dist/components/ai/conversation.cjs +4 -0
- package/dist/components/ai/conversation.cjs.map +1 -0
- package/dist/components/ai/conversation.js +108 -0
- package/dist/components/ai/conversation.js.map +1 -0
- package/dist/components/ai/inline-citation.cjs +2 -0
- package/dist/components/ai/inline-citation.cjs.map +1 -0
- package/dist/components/ai/inline-citation.js +182 -0
- package/dist/components/ai/inline-citation.js.map +1 -0
- package/dist/components/ai/message.cjs +2 -0
- package/dist/components/ai/message.cjs.map +1 -0
- package/dist/components/ai/message.js +237 -0
- package/dist/components/ai/message.js.map +1 -0
- package/dist/components/ai/model-selector.cjs +2 -0
- package/dist/components/ai/model-selector.cjs.map +1 -0
- package/dist/components/ai/model-selector.js +77 -0
- package/dist/components/ai/model-selector.js.map +1 -0
- package/dist/components/ai/prompt-input.cjs +2 -0
- package/dist/components/ai/prompt-input.cjs.map +1 -0
- package/dist/components/ai/prompt-input.js +774 -0
- package/dist/components/ai/prompt-input.js.map +1 -0
- package/dist/components/ai/queue.cjs +2 -0
- package/dist/components/ai/queue.cjs.map +1 -0
- package/dist/components/ai/queue.js +209 -0
- package/dist/components/ai/queue.js.map +1 -0
- package/dist/components/ai/reasoning.cjs +2 -0
- package/dist/components/ai/reasoning.cjs.map +1 -0
- package/dist/components/ai/reasoning.js +129 -0
- package/dist/components/ai/reasoning.js.map +1 -0
- package/dist/components/ai/shimmer.cjs +2 -0
- package/dist/components/ai/shimmer.cjs.map +1 -0
- package/dist/components/ai/shimmer.js +49 -0
- package/dist/components/ai/shimmer.js.map +1 -0
- package/dist/components/ai/sources.cjs +2 -0
- package/dist/components/ai/sources.cjs.map +1 -0
- package/dist/components/ai/sources.js +54 -0
- package/dist/components/ai/sources.js.map +1 -0
- package/dist/components/ai/speech-input.cjs +2 -0
- package/dist/components/ai/speech-input.cjs.map +1 -0
- package/dist/components/ai/speech-input.js +123 -0
- package/dist/components/ai/speech-input.js.map +1 -0
- package/dist/components/ai/stream-status.cjs +2 -0
- package/dist/components/ai/stream-status.cjs.map +1 -0
- package/dist/components/ai/stream-status.js +106 -0
- package/dist/components/ai/stream-status.js.map +1 -0
- package/dist/components/ai/suggestion.cjs +2 -0
- package/dist/components/ai/suggestion.cjs.map +1 -0
- package/dist/components/ai/suggestion.js +38 -0
- package/dist/components/ai/suggestion.js.map +1 -0
- package/dist/components/ai/task.cjs +2 -0
- package/dist/components/ai/task.cjs.map +1 -0
- package/dist/components/ai/task.js +94 -0
- package/dist/components/ai/task.js.map +1 -0
- package/dist/components/ai/tool.cjs +2 -0
- package/dist/components/ai/tool.cjs.map +1 -0
- package/dist/components/ai/tool.js +143 -0
- package/dist/components/ai/tool.js.map +1 -0
- package/dist/components/composed/Chat/Chat.cjs +2 -0
- package/dist/components/composed/Chat/Chat.cjs.map +1 -0
- package/dist/components/composed/Chat/Chat.js +167 -0
- package/dist/components/composed/Chat/Chat.js.map +1 -0
- package/dist/components/ui/code-block.cjs +4 -0
- package/dist/components/ui/code-block.cjs.map +1 -0
- package/dist/components/ui/code-block.js +306 -0
- package/dist/components/ui/code-block.js.map +1 -0
- package/dist/components/ui/data-table/data-table-filter.cjs +2 -0
- package/dist/components/ui/data-table/data-table-filter.cjs.map +1 -0
- package/dist/components/ui/data-table/data-table-filter.js +178 -0
- package/dist/components/ui/data-table/data-table-filter.js.map +1 -0
- package/dist/components/ui/data-table/data-table.cjs +1 -1
- package/dist/components/ui/data-table/data-table.cjs.map +1 -1
- package/dist/components/ui/data-table/data-table.js +244 -195
- package/dist/components/ui/data-table/data-table.js.map +1 -1
- package/dist/components/ui/progress.cjs +2 -0
- package/dist/components/ui/progress.cjs.map +1 -0
- package/dist/components/ui/progress.js +32 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1182 -1
- package/dist/index.js +572 -368
- package/dist/index.js.map +1 -1
- package/dist/index.tailwind.css +1 -1
- package/package.json +12 -1
|
@@ -1,293 +1,342 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useSensors as
|
|
3
|
-
import { restrictToHorizontalAxis as
|
|
4
|
-
import { sortableKeyboardCoordinates as
|
|
5
|
-
import { CSS as
|
|
6
|
-
import { useReactTable as
|
|
7
|
-
import { GripVerticalIcon as
|
|
8
|
-
import * as
|
|
9
|
-
import { DataTablePagination as
|
|
10
|
-
import { Table as
|
|
11
|
-
import { cn as
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsx as r, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import { useSensors as Oe, useSensor as P, PointerSensor as ke, KeyboardSensor as Ve, DndContext as ze, closestCenter as Ee, DragOverlay as Le } from "@dnd-kit/core";
|
|
3
|
+
import { restrictToHorizontalAxis as Ke } from "@dnd-kit/modifiers";
|
|
4
|
+
import { sortableKeyboardCoordinates as Ae, arrayMove as Fe, SortableContext as je, horizontalListSortingStrategy as Pe, useSortable as qe } from "@dnd-kit/sortable";
|
|
5
|
+
import { CSS as Ue } from "@dnd-kit/utilities";
|
|
6
|
+
import { useReactTable as We, getPaginationRowModel as Be, getSortedRowModel as Ge, getCoreRowModel as Xe, flexRender as Y } from "@tanstack/react-table";
|
|
7
|
+
import { GripVerticalIcon as Ye, ArrowUpIcon as Je, ArrowDownIcon as Qe, ArrowUpDownIcon as Ze } from "lucide-react";
|
|
8
|
+
import * as i from "react";
|
|
9
|
+
import { DataTablePagination as $e } from "./data-table-pagination.js";
|
|
10
|
+
import { Table as q, TableHeader as U, TableRow as _, TableBody as W, TableHead as J, TableCell as B } from "../table.js";
|
|
11
|
+
import { cn as y } from "../../../lib/utils.js";
|
|
12
|
+
function et(t, a, c) {
|
|
13
|
+
const n = t.toLowerCase().trim(), s = c.toLowerCase().trim();
|
|
14
|
+
switch (a) {
|
|
15
|
+
case "contains":
|
|
16
|
+
return n.includes(s);
|
|
17
|
+
case "equals":
|
|
18
|
+
return n === s;
|
|
19
|
+
case "not_equals":
|
|
20
|
+
return n !== s;
|
|
21
|
+
case "starts_with":
|
|
22
|
+
return n.startsWith(s);
|
|
23
|
+
case "ends_with":
|
|
24
|
+
return n.endsWith(s);
|
|
25
|
+
case "is_empty":
|
|
26
|
+
return n === "";
|
|
27
|
+
case "is_not_empty":
|
|
28
|
+
return n !== "";
|
|
29
|
+
default:
|
|
30
|
+
return !0;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const Q = i.createContext(null);
|
|
34
|
+
function gt() {
|
|
35
|
+
const t = i.useContext(Q);
|
|
36
|
+
if (!t)
|
|
16
37
|
throw new Error("useDataTable must be used within a <DataTable>");
|
|
17
|
-
return
|
|
38
|
+
return t;
|
|
18
39
|
}
|
|
19
|
-
function
|
|
20
|
-
header:
|
|
40
|
+
function tt({
|
|
41
|
+
header: t,
|
|
21
42
|
children: a,
|
|
22
|
-
position:
|
|
23
|
-
numeric:
|
|
43
|
+
position: c,
|
|
44
|
+
numeric: n
|
|
24
45
|
}) {
|
|
25
46
|
const {
|
|
26
|
-
attributes:
|
|
27
|
-
listeners:
|
|
28
|
-
setNodeRef:
|
|
29
|
-
transform:
|
|
30
|
-
transition:
|
|
31
|
-
isDragging:
|
|
32
|
-
} =
|
|
33
|
-
transform:
|
|
34
|
-
|
|
47
|
+
attributes: s,
|
|
48
|
+
listeners: l,
|
|
49
|
+
setNodeRef: S,
|
|
50
|
+
transform: f,
|
|
51
|
+
transition: D,
|
|
52
|
+
isDragging: g
|
|
53
|
+
} = qe({ id: t.column.id }), T = {
|
|
54
|
+
transform: Ue.Transform.toString(
|
|
55
|
+
f ? { ...f, scaleX: 1, scaleY: 1 } : null
|
|
35
56
|
),
|
|
36
|
-
transition:
|
|
57
|
+
transition: D,
|
|
37
58
|
position: "relative"
|
|
38
59
|
};
|
|
39
|
-
return /* @__PURE__ */
|
|
40
|
-
|
|
60
|
+
return /* @__PURE__ */ r(
|
|
61
|
+
J,
|
|
41
62
|
{
|
|
42
|
-
ref:
|
|
43
|
-
style:
|
|
44
|
-
variant:
|
|
45
|
-
className:
|
|
63
|
+
ref: S,
|
|
64
|
+
style: T,
|
|
65
|
+
variant: n ? "numeric" : void 0,
|
|
66
|
+
className: y(
|
|
46
67
|
"group/header transition-shadow duration-150",
|
|
47
|
-
!
|
|
48
|
-
!
|
|
49
|
-
!
|
|
50
|
-
|
|
68
|
+
!g && c === "first" && "hover:shadow-[inset_-1px_0_0_0_var(--color-border)]",
|
|
69
|
+
!g && c === "last" && "hover:shadow-[inset_1px_0_0_0_var(--color-border)]",
|
|
70
|
+
!g && c === "middle" && "hover:shadow-[inset_1px_0_0_0_var(--color-border),inset_-1px_0_0_0_var(--color-border)]",
|
|
71
|
+
g && "opacity-40"
|
|
51
72
|
),
|
|
52
|
-
children: /* @__PURE__ */ b("div", { className:
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */
|
|
73
|
+
children: /* @__PURE__ */ b("div", { className: y("flex items-center gap-1", n && "flex-row-reverse"), children: [
|
|
74
|
+
/* @__PURE__ */ r("div", { className: "flex-1", children: a }),
|
|
75
|
+
/* @__PURE__ */ r(
|
|
55
76
|
"button",
|
|
56
77
|
{
|
|
57
78
|
type: "button",
|
|
58
79
|
"data-drag-handle": "",
|
|
59
80
|
className: "cursor-grab touch-none text-muted-foreground hover:text-foreground active:cursor-grabbing opacity-0 group-hover/header:opacity-100 transition-opacity",
|
|
60
|
-
...
|
|
61
|
-
...
|
|
62
|
-
children: /* @__PURE__ */
|
|
81
|
+
...s,
|
|
82
|
+
...l,
|
|
83
|
+
children: /* @__PURE__ */ r(Ye, { className: "size-3.5" })
|
|
63
84
|
}
|
|
64
85
|
)
|
|
65
86
|
] })
|
|
66
87
|
}
|
|
67
88
|
);
|
|
68
89
|
}
|
|
69
|
-
function
|
|
70
|
-
header:
|
|
90
|
+
function G({
|
|
91
|
+
header: t,
|
|
71
92
|
enableSorting: a,
|
|
72
|
-
numericColumns:
|
|
73
|
-
columnLabels:
|
|
93
|
+
numericColumns: c,
|
|
94
|
+
columnLabels: n
|
|
74
95
|
}) {
|
|
75
|
-
if (
|
|
76
|
-
const
|
|
96
|
+
if (t.isPlaceholder) return null;
|
|
97
|
+
const s = a && t.column.getCanSort(), l = t.column.getIsSorted(), S = c.has(t.column.id);
|
|
77
98
|
return /* @__PURE__ */ b(
|
|
78
99
|
"div",
|
|
79
100
|
{
|
|
80
|
-
className:
|
|
101
|
+
className: y(
|
|
81
102
|
"flex items-center gap-1",
|
|
82
|
-
|
|
83
|
-
|
|
103
|
+
s && "group/sort cursor-pointer select-none",
|
|
104
|
+
S && "flex-row-reverse"
|
|
84
105
|
),
|
|
85
|
-
onClick:
|
|
86
|
-
onKeyDown: (
|
|
87
|
-
(
|
|
106
|
+
onClick: s ? t.column.getToggleSortingHandler() : void 0,
|
|
107
|
+
onKeyDown: (f) => {
|
|
108
|
+
(f.key === "Enter" || f.key === " ") && s && t.column.getToggleSortingHandler();
|
|
88
109
|
},
|
|
89
110
|
children: [
|
|
90
|
-
|
|
91
|
-
|
|
111
|
+
n[t.column.id] ?? Y(t.column.columnDef.header, t.getContext()),
|
|
112
|
+
s && /* @__PURE__ */ r(
|
|
92
113
|
"span",
|
|
93
114
|
{
|
|
94
|
-
className:
|
|
95
|
-
!
|
|
115
|
+
className: y(
|
|
116
|
+
!l && "opacity-0 group-hover/sort:opacity-100 transition-opacity"
|
|
96
117
|
),
|
|
97
|
-
children:
|
|
118
|
+
children: l === "asc" ? /* @__PURE__ */ r(Je, { className: "size-3.5 text-foreground" }) : l === "desc" ? /* @__PURE__ */ r(Qe, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ r(Ze, { className: "size-3.5 text-muted-foreground" })
|
|
98
119
|
}
|
|
99
120
|
)
|
|
100
121
|
]
|
|
101
122
|
}
|
|
102
123
|
);
|
|
103
124
|
}
|
|
104
|
-
function
|
|
105
|
-
table:
|
|
125
|
+
function X({
|
|
126
|
+
table: t,
|
|
106
127
|
columns: a,
|
|
107
|
-
numericColumns:
|
|
128
|
+
numericColumns: c
|
|
108
129
|
}) {
|
|
109
|
-
return
|
|
130
|
+
return t.getRowModel().rows.length === 0 ? /* @__PURE__ */ r(_, { children: /* @__PURE__ */ r(B, { colSpan: a.length, className: "h-24 text-center text-muted-foreground", children: "No results." }) }) : t.getRowModel().rows.map((n) => /* @__PURE__ */ r(_, { "data-state": n.getIsSelected() ? "selected" : void 0, children: n.getVisibleCells().map((s) => /* @__PURE__ */ r(B, { variant: c.has(s.column.id) ? "numeric" : void 0, children: Y(s.column.columnDef.cell, s.getContext()) }, s.id)) }, n.id));
|
|
110
131
|
}
|
|
111
|
-
function
|
|
112
|
-
const a = [],
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
}), { toolbarSlots: a, paginationSlots:
|
|
132
|
+
function ot(t) {
|
|
133
|
+
const a = [], c = [], n = [], s = [];
|
|
134
|
+
return i.Children.forEach(t, (l) => {
|
|
135
|
+
i.isValidElement(l) && l.type === rt ? a.push(l) : i.isValidElement(l) && l.type.displayName === "DataTableFilter" ? c.push(l) : i.isValidElement(l) && l.type === $e ? n.push(l) : s.push(l);
|
|
136
|
+
}), { toolbarSlots: a, filterSlots: c, paginationSlots: n, restSlots: s };
|
|
116
137
|
}
|
|
117
|
-
function
|
|
118
|
-
columns:
|
|
138
|
+
function pt({
|
|
139
|
+
columns: t,
|
|
119
140
|
data: a,
|
|
120
|
-
toolbar:
|
|
121
|
-
enableSorting:
|
|
122
|
-
enableColumnVisibility:
|
|
123
|
-
children:
|
|
124
|
-
columnOrder:
|
|
125
|
-
onColumnOrderChange:
|
|
126
|
-
columnVisibility:
|
|
127
|
-
onColumnVisibilityChange:
|
|
128
|
-
columnLabels:
|
|
129
|
-
onColumnLabelChange:
|
|
130
|
-
enablePagination:
|
|
131
|
-
defaultPageSize:
|
|
132
|
-
pagination:
|
|
133
|
-
onPaginationChange:
|
|
134
|
-
enableColumnReorder:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
141
|
+
toolbar: c,
|
|
142
|
+
enableSorting: n = !1,
|
|
143
|
+
enableColumnVisibility: s = !1,
|
|
144
|
+
children: l,
|
|
145
|
+
columnOrder: S,
|
|
146
|
+
onColumnOrderChange: f,
|
|
147
|
+
columnVisibility: D,
|
|
148
|
+
onColumnVisibilityChange: g,
|
|
149
|
+
columnLabels: T,
|
|
150
|
+
onColumnLabelChange: k,
|
|
151
|
+
enablePagination: x = !1,
|
|
152
|
+
defaultPageSize: Z = 10,
|
|
153
|
+
pagination: I,
|
|
154
|
+
onPaginationChange: N,
|
|
155
|
+
enableColumnReorder: $ = !1,
|
|
156
|
+
enableFiltering: M = !1,
|
|
157
|
+
filters: ee,
|
|
158
|
+
onFiltersChange: V,
|
|
159
|
+
filterConfig: R,
|
|
160
|
+
manualFiltering: z = !1,
|
|
161
|
+
density: E = "default",
|
|
162
|
+
className: te,
|
|
163
|
+
variant: L = "card",
|
|
164
|
+
containerClassName: K
|
|
139
165
|
}) {
|
|
140
|
-
const [
|
|
166
|
+
const [oe, re] = i.useState([]), [ne, se] = i.useState({}), [ie, ae] = i.useState([]), [le, ce] = i.useState({}), [de, ue] = i.useState({
|
|
141
167
|
pageIndex: 0,
|
|
142
|
-
pageSize:
|
|
143
|
-
}),
|
|
144
|
-
if (
|
|
145
|
-
return
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
} :
|
|
149
|
-
}, [
|
|
150
|
-
if (
|
|
168
|
+
pageSize: Z
|
|
169
|
+
}), [me, fe] = i.useState([]), ge = I ?? de, H = ee ?? me, O = D ?? ne, p = S ?? ie, C = T ?? le, pe = i.useMemo(() => {
|
|
170
|
+
if (x)
|
|
171
|
+
return N ? (e) => {
|
|
172
|
+
const o = typeof e == "function" ? e(I) : e;
|
|
173
|
+
N(o);
|
|
174
|
+
} : ue;
|
|
175
|
+
}, [x, N, I]), he = i.useMemo(() => {
|
|
176
|
+
if (s)
|
|
151
177
|
return (e) => {
|
|
152
|
-
const
|
|
153
|
-
(
|
|
178
|
+
const o = typeof e == "function" ? e(O) : e;
|
|
179
|
+
(g ?? se)(o);
|
|
154
180
|
};
|
|
155
|
-
}, [
|
|
181
|
+
}, [s, O, g]), be = i.useCallback(
|
|
156
182
|
(e) => {
|
|
157
|
-
|
|
158
|
-
(m ?? te)(r);
|
|
183
|
+
(V ?? fe)(e);
|
|
159
184
|
},
|
|
160
|
-
[
|
|
161
|
-
),
|
|
162
|
-
|
|
163
|
-
|
|
185
|
+
[V]
|
|
186
|
+
), ye = i.useMemo(() => R || t.filter((e) => "accessorKey" in e).map((e) => ({ columnId: String(e.accessorKey) })), [R, t]), Se = i.useMemo(() => {
|
|
187
|
+
if (!M || z) return a;
|
|
188
|
+
const e = H.filter(
|
|
189
|
+
(o) => o.columnId && o.operator && (o.value.trim() !== "" || o.operator === "is_empty" || o.operator === "is_not_empty")
|
|
190
|
+
);
|
|
191
|
+
return e.length === 0 ? a : a.filter(
|
|
192
|
+
(o) => e.every((d) => {
|
|
193
|
+
const u = String(
|
|
194
|
+
o[d.columnId] ?? ""
|
|
195
|
+
);
|
|
196
|
+
return et(u, d.operator, d.value);
|
|
197
|
+
})
|
|
198
|
+
);
|
|
199
|
+
}, [a, H, M, z]), ve = i.useCallback(
|
|
200
|
+
(e) => {
|
|
201
|
+
const o = typeof e == "function" ? e(p) : e;
|
|
202
|
+
(f ?? ae)(o);
|
|
203
|
+
},
|
|
204
|
+
[p, f]
|
|
205
|
+
), m = We({
|
|
206
|
+
data: Se,
|
|
207
|
+
columns: t,
|
|
164
208
|
state: {
|
|
165
|
-
sorting:
|
|
166
|
-
columnVisibility:
|
|
209
|
+
sorting: n ? oe : void 0,
|
|
210
|
+
columnVisibility: s ? O : void 0,
|
|
167
211
|
columnOrder: p.length > 0 ? p : void 0,
|
|
168
|
-
...
|
|
212
|
+
...x ? { pagination: ge } : {}
|
|
169
213
|
},
|
|
170
|
-
onSortingChange:
|
|
171
|
-
onPaginationChange:
|
|
172
|
-
onColumnVisibilityChange:
|
|
173
|
-
onColumnOrderChange:
|
|
174
|
-
getCoreRowModel:
|
|
175
|
-
getSortedRowModel:
|
|
176
|
-
getPaginationRowModel:
|
|
177
|
-
}),
|
|
178
|
-
(e,
|
|
179
|
-
(
|
|
214
|
+
onSortingChange: n ? re : void 0,
|
|
215
|
+
onPaginationChange: pe,
|
|
216
|
+
onColumnVisibilityChange: he,
|
|
217
|
+
onColumnOrderChange: ve,
|
|
218
|
+
getCoreRowModel: Xe(),
|
|
219
|
+
getSortedRowModel: n ? Ge() : void 0,
|
|
220
|
+
getPaginationRowModel: x ? Be() : void 0
|
|
221
|
+
}), xe = i.useCallback(
|
|
222
|
+
(e, o) => {
|
|
223
|
+
(k ?? ((d, u) => ce((w) => ({ ...w, [d]: u }))))(e, o);
|
|
180
224
|
},
|
|
181
|
-
[
|
|
182
|
-
),
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
), [
|
|
225
|
+
[k]
|
|
226
|
+
), Ce = Oe(
|
|
227
|
+
P(ke, { activationConstraint: { distance: 5 } }),
|
|
228
|
+
P(Ve, { coordinateGetter: Ae })
|
|
229
|
+
), [A, F] = i.useState(null), we = i.useCallback(
|
|
186
230
|
(e) => {
|
|
187
|
-
|
|
231
|
+
F(String(e.active.id));
|
|
188
232
|
},
|
|
189
233
|
[]
|
|
190
|
-
),
|
|
234
|
+
), _e = i.useCallback(
|
|
191
235
|
(e) => {
|
|
192
|
-
|
|
193
|
-
const { active:
|
|
194
|
-
if (!
|
|
195
|
-
const u = p.length > 0 ? p :
|
|
196
|
-
if (w === -1 ||
|
|
197
|
-
const
|
|
198
|
-
|
|
236
|
+
F(null);
|
|
237
|
+
const { active: o, over: d } = e;
|
|
238
|
+
if (!d || o.id === d.id) return;
|
|
239
|
+
const u = p.length > 0 ? p : m.getAllLeafColumns().map((He) => He.id), w = u.indexOf(String(o.id)), j = u.indexOf(String(d.id));
|
|
240
|
+
if (w === -1 || j === -1) return;
|
|
241
|
+
const Re = Fe(u, w, j);
|
|
242
|
+
m.setColumnOrder(Re);
|
|
199
243
|
},
|
|
200
|
-
[p,
|
|
201
|
-
),
|
|
244
|
+
[p, m]
|
|
245
|
+
), v = A ? m.getFlatHeaders().find((e) => e.column.id === A) : null, h = i.useMemo(() => {
|
|
202
246
|
if (a.length === 0) return /* @__PURE__ */ new Set();
|
|
203
|
-
const e = a[0],
|
|
204
|
-
for (const
|
|
205
|
-
const u = "accessorKey" in
|
|
206
|
-
u && typeof e[u] == "number" &&
|
|
247
|
+
const e = a[0], o = /* @__PURE__ */ new Set();
|
|
248
|
+
for (const d of t) {
|
|
249
|
+
const u = "accessorKey" in d ? String(d.accessorKey) : "";
|
|
250
|
+
u && typeof e[u] == "number" && o.add(u);
|
|
207
251
|
}
|
|
208
|
-
return
|
|
209
|
-
}, [a,
|
|
210
|
-
table:
|
|
252
|
+
return o;
|
|
253
|
+
}, [a, t]), De = {
|
|
254
|
+
table: m,
|
|
211
255
|
columnLabels: C,
|
|
212
|
-
setColumnLabel:
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
256
|
+
setColumnLabel: xe,
|
|
257
|
+
filters: H,
|
|
258
|
+
setFilters: be,
|
|
259
|
+
filterConfig: ye,
|
|
260
|
+
enableFiltering: M
|
|
261
|
+
}, { toolbarSlots: Te, filterSlots: Ie, paginationSlots: Ne, restSlots: Me } = ot(l);
|
|
262
|
+
return /* @__PURE__ */ r(Q.Provider, { value: De, children: /* @__PURE__ */ b("div", { "data-slot": "data-table", className: y("w-full space-y-2", te), children: [
|
|
263
|
+
c,
|
|
264
|
+
Te,
|
|
265
|
+
Ie,
|
|
266
|
+
$ ? /* @__PURE__ */ b(
|
|
267
|
+
ze,
|
|
219
268
|
{
|
|
220
|
-
sensors:
|
|
221
|
-
collisionDetection:
|
|
222
|
-
modifiers: [
|
|
223
|
-
onDragStart:
|
|
224
|
-
onDragEnd:
|
|
269
|
+
sensors: Ce,
|
|
270
|
+
collisionDetection: Ee,
|
|
271
|
+
modifiers: [Ke],
|
|
272
|
+
onDragStart: we,
|
|
273
|
+
onDragEnd: _e,
|
|
225
274
|
children: [
|
|
226
|
-
/* @__PURE__ */
|
|
227
|
-
|
|
275
|
+
/* @__PURE__ */ r(
|
|
276
|
+
je,
|
|
228
277
|
{
|
|
229
|
-
items:
|
|
230
|
-
strategy:
|
|
231
|
-
children: /* @__PURE__ */ b(
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
|
|
278
|
+
items: m.getFlatHeaders().map((e) => e.column.id),
|
|
279
|
+
strategy: Pe,
|
|
280
|
+
children: /* @__PURE__ */ b(q, { "data-density": E, variant: L, containerClassName: K, children: [
|
|
281
|
+
/* @__PURE__ */ r(U, { children: m.getHeaderGroups().map((e) => /* @__PURE__ */ r(_, { children: e.headers.map((o, d) => /* @__PURE__ */ r(
|
|
282
|
+
tt,
|
|
234
283
|
{
|
|
235
|
-
header:
|
|
236
|
-
position:
|
|
237
|
-
numeric: h.has(
|
|
238
|
-
children: /* @__PURE__ */
|
|
239
|
-
|
|
284
|
+
header: o,
|
|
285
|
+
position: d === 0 ? "first" : d === e.headers.length - 1 ? "last" : "middle",
|
|
286
|
+
numeric: h.has(o.column.id),
|
|
287
|
+
children: /* @__PURE__ */ r(
|
|
288
|
+
G,
|
|
240
289
|
{
|
|
241
|
-
header:
|
|
242
|
-
enableSorting:
|
|
290
|
+
header: o,
|
|
291
|
+
enableSorting: n,
|
|
243
292
|
numericColumns: h,
|
|
244
293
|
columnLabels: C
|
|
245
294
|
}
|
|
246
295
|
)
|
|
247
296
|
},
|
|
248
|
-
|
|
297
|
+
o.id
|
|
249
298
|
)) }, e.id)) }),
|
|
250
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ r(W, { children: /* @__PURE__ */ r(X, { table: m, columns: t, numericColumns: h }) })
|
|
251
300
|
] })
|
|
252
301
|
}
|
|
253
302
|
),
|
|
254
|
-
/* @__PURE__ */
|
|
303
|
+
/* @__PURE__ */ r(Le, { dropAnimation: null, children: v && /* @__PURE__ */ r("div", { className: "rounded-md border bg-background px-4 py-3 text-sm font-medium shadow-lg", children: C[v.column.id] ?? (typeof v.column.columnDef.header == "string" ? v.column.columnDef.header : v.column.id) }) })
|
|
255
304
|
]
|
|
256
305
|
}
|
|
257
|
-
) : /* @__PURE__ */ b(
|
|
258
|
-
/* @__PURE__ */
|
|
259
|
-
|
|
306
|
+
) : /* @__PURE__ */ b(q, { "data-density": E, variant: L, containerClassName: K, children: [
|
|
307
|
+
/* @__PURE__ */ r(U, { children: m.getHeaderGroups().map((e) => /* @__PURE__ */ r(_, { children: e.headers.map((o) => /* @__PURE__ */ r(J, { variant: h.has(o.column.id) ? "numeric" : void 0, children: /* @__PURE__ */ r(
|
|
308
|
+
G,
|
|
260
309
|
{
|
|
261
|
-
header:
|
|
262
|
-
enableSorting:
|
|
310
|
+
header: o,
|
|
311
|
+
enableSorting: n,
|
|
263
312
|
numericColumns: h,
|
|
264
313
|
columnLabels: C
|
|
265
314
|
}
|
|
266
|
-
) },
|
|
267
|
-
/* @__PURE__ */
|
|
315
|
+
) }, o.id)) }, e.id)) }),
|
|
316
|
+
/* @__PURE__ */ r(W, { children: /* @__PURE__ */ r(X, { table: m, columns: t, numericColumns: h }) })
|
|
268
317
|
] }),
|
|
269
|
-
|
|
270
|
-
|
|
318
|
+
Ne,
|
|
319
|
+
Me
|
|
271
320
|
] }) });
|
|
272
321
|
}
|
|
273
|
-
function
|
|
274
|
-
className:
|
|
322
|
+
function rt({
|
|
323
|
+
className: t,
|
|
275
324
|
children: a,
|
|
276
|
-
...
|
|
325
|
+
...c
|
|
277
326
|
}) {
|
|
278
|
-
return /* @__PURE__ */
|
|
327
|
+
return /* @__PURE__ */ r(
|
|
279
328
|
"div",
|
|
280
329
|
{
|
|
281
330
|
"data-slot": "table-toolbar",
|
|
282
|
-
className:
|
|
283
|
-
...
|
|
331
|
+
className: y("flex items-center justify-end gap-2", t),
|
|
332
|
+
...c,
|
|
284
333
|
children: a
|
|
285
334
|
}
|
|
286
335
|
);
|
|
287
336
|
}
|
|
288
337
|
export {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
338
|
+
pt as DataTable,
|
|
339
|
+
rt as TableToolbar,
|
|
340
|
+
gt as useDataTable
|
|
292
341
|
};
|
|
293
342
|
//# sourceMappingURL=data-table.js.map
|