@johnhalazonetis/data-table 1.23.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 +391 -0
- package/dist/data-table.css +3 -0
- package/dist/data-table.js +4489 -0
- package/package.json +44 -0
- package/src/components/DataTable/index.d.ts +128 -0
|
@@ -0,0 +1,4489 @@
|
|
|
1
|
+
import { Fragment as e, Teleport as t, Transition as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createStaticVNode as c, createTextVNode as l, createVNode as u, inject as d, isRef as f, mergeProps as p, nextTick as m, normalizeClass as h, normalizeStyle as g, onMounted as _, onUnmounted as v, openBlock as y, provide as b, ref as x, renderList as S, toDisplayString as C, toValue as w, unref as T, useTemplateRef as E, vModelSelect as D, vModelText as O, watch as k, watchEffect as A, withCtx as j, withDirectives as ee, withModifiers as M } from "vue";
|
|
2
|
+
import { FlexRender as N, getCoreRowModel as P, getFilteredRowModel as te, getPaginationRowModel as F, getSortedRowModel as I, useVueTable as L } from "@tanstack/vue-table";
|
|
3
|
+
import { onClickOutside as R } from "@vueuse/core";
|
|
4
|
+
import { useVirtualizer as z } from "@tanstack/vue-virtual";
|
|
5
|
+
//#region \0plugin-vue:export-helper
|
|
6
|
+
var B = (e, t) => {
|
|
7
|
+
let n = e.__vccOpts || e;
|
|
8
|
+
for (let [e, r] of t) n[e] = r;
|
|
9
|
+
return n;
|
|
10
|
+
}, V = { class: "p-3" }, H = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "text-center py-4",
|
|
13
|
+
style: { color: "var(--st-text-tertiary)" }
|
|
14
|
+
}, ne = {
|
|
15
|
+
key: 1,
|
|
16
|
+
class: "text-xs font-medium uppercase tracking-wide mb-2",
|
|
17
|
+
style: { color: "var(--st-text-placeholder)" }
|
|
18
|
+
}, U = ["onDragstart", "onDragover"], W = {
|
|
19
|
+
class: "text-xs w-12 shrink-0",
|
|
20
|
+
style: { color: "var(--st-text-tertiary)" }
|
|
21
|
+
}, G = ["onUpdate:modelValue"], K = ["value"], re = ["onClick", "title"], q = {
|
|
22
|
+
class: "w-3 h-3",
|
|
23
|
+
viewBox: "0 0 16 16",
|
|
24
|
+
fill: "currentColor"
|
|
25
|
+
}, ie = {
|
|
26
|
+
key: 0,
|
|
27
|
+
"fill-rule": "evenodd",
|
|
28
|
+
d: "M8 12a.5.5 0 0 0 .5-.5V5.707l2.146 2.147a.5.5 0 0 0 .708-.708l-3-3a.5.5 0 0 0-.708 0l-3 3a.5.5 0 1 0 .708.708L7.5 5.707V11.5a.5.5 0 0 0 .5.5z"
|
|
29
|
+
}, J = {
|
|
30
|
+
key: 1,
|
|
31
|
+
"fill-rule": "evenodd",
|
|
32
|
+
d: "M8 4a.5.5 0 0 1 .5.5v5.793l2.146-2.147a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 1 1 .708-.708L7.5 10.293V4.5A.5.5 0 0 1 8 4z"
|
|
33
|
+
}, ae = ["onClick"], oe = ["onDragstart", "onDragover"], se = {
|
|
34
|
+
class: "text-xs w-12 shrink-0",
|
|
35
|
+
style: { color: "var(--st-text-tertiary)" }
|
|
36
|
+
}, ce = ["onUpdate:modelValue"], le = ["value"], ue = ["onClick", "title"], de = {
|
|
37
|
+
class: "w-3 h-3",
|
|
38
|
+
viewBox: "0 0 16 16",
|
|
39
|
+
fill: "currentColor"
|
|
40
|
+
}, fe = {
|
|
41
|
+
key: 0,
|
|
42
|
+
"fill-rule": "evenodd",
|
|
43
|
+
d: "M8 12a.5.5 0 0 0 .5-.5V5.707l2.146 2.147a.5.5 0 0 0 .708-.708l-3-3a.5.5 0 0 0-.708 0l-3 3a.5.5 0 1 0 .708.708L7.5 5.707V11.5a.5.5 0 0 0 .5.5z"
|
|
44
|
+
}, Y = {
|
|
45
|
+
key: 1,
|
|
46
|
+
"fill-rule": "evenodd",
|
|
47
|
+
d: "M8 4a.5.5 0 0 1 .5.5v5.793l2.146-2.147a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 1 1 .708-.708L7.5 10.293V4.5A.5.5 0 0 1 8 4z"
|
|
48
|
+
}, pe = ["onClick"], me = {
|
|
49
|
+
class: "px-3 py-2 flex items-center justify-end gap-2",
|
|
50
|
+
style: { borderTop: "1px solid var(--st-border-secondary)" }
|
|
51
|
+
}, he = /* @__PURE__ */ B({
|
|
52
|
+
__name: "SortPanel",
|
|
53
|
+
props: {
|
|
54
|
+
table: {
|
|
55
|
+
type: Object,
|
|
56
|
+
required: !0
|
|
57
|
+
},
|
|
58
|
+
sorting: {
|
|
59
|
+
type: Array,
|
|
60
|
+
default: () => []
|
|
61
|
+
},
|
|
62
|
+
allColumns: {
|
|
63
|
+
type: Array,
|
|
64
|
+
default: () => []
|
|
65
|
+
},
|
|
66
|
+
subTableColumns: {
|
|
67
|
+
type: Array,
|
|
68
|
+
default: null
|
|
69
|
+
},
|
|
70
|
+
subTableSorting: {
|
|
71
|
+
type: Array,
|
|
72
|
+
default: () => []
|
|
73
|
+
},
|
|
74
|
+
tableName: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: "table"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
emits: [
|
|
80
|
+
"update:sorting",
|
|
81
|
+
"update:sub-table-sorting",
|
|
82
|
+
"close"
|
|
83
|
+
],
|
|
84
|
+
setup(t, { emit: n }) {
|
|
85
|
+
let i = t, u = n, f = d("showDataTypes", !0), p = r(() => !!i.subTableColumns && i.subTableColumns.length > 0);
|
|
86
|
+
function m() {
|
|
87
|
+
let e = i.sorting.map((e) => ({
|
|
88
|
+
...e,
|
|
89
|
+
table: "parent"
|
|
90
|
+
})), t = i.subTableSorting.map((e) => ({
|
|
91
|
+
...e,
|
|
92
|
+
table: "sub"
|
|
93
|
+
}));
|
|
94
|
+
return [...e, ...t];
|
|
95
|
+
}
|
|
96
|
+
let h = x(m());
|
|
97
|
+
k([() => i.sorting, () => i.subTableSorting], () => {
|
|
98
|
+
h.value = m();
|
|
99
|
+
}, { deep: !0 });
|
|
100
|
+
function _(e) {
|
|
101
|
+
let t = e === "parent" ? i.allColumns : i.subTableColumns, n = new Set(h.value.filter((t) => t.table === e).map((e) => e.id)), r = t.find((e) => !n.has(e.id));
|
|
102
|
+
r && h.value.push({
|
|
103
|
+
id: r.id,
|
|
104
|
+
desc: !1,
|
|
105
|
+
table: e
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function v(e) {
|
|
109
|
+
h.value.splice(e, 1);
|
|
110
|
+
}
|
|
111
|
+
function b(e) {
|
|
112
|
+
h.value[e].desc = !h.value[e].desc;
|
|
113
|
+
}
|
|
114
|
+
function w() {
|
|
115
|
+
let e = h.value.filter((e) => e.table === "parent").map(({ table: e, ...t }) => t), t = h.value.filter((e) => e.table === "sub").map(({ table: e, ...t }) => t);
|
|
116
|
+
u("update:sorting", e), p.value && u("update:sub-table-sorting", t), u("close");
|
|
117
|
+
}
|
|
118
|
+
function E() {
|
|
119
|
+
h.value = [], u("update:sorting", []), p.value && u("update:sub-table-sorting", []), u("close");
|
|
120
|
+
}
|
|
121
|
+
let O = r(() => h.value.filter((e) => e.table === "parent")), A = r(() => h.value.filter((e) => e.table === "sub"));
|
|
122
|
+
function j(e, t) {
|
|
123
|
+
let n = 0;
|
|
124
|
+
for (let r = 0; r < h.value.length; r++) if (h.value[r].table === e) {
|
|
125
|
+
if (n === t) return r;
|
|
126
|
+
n++;
|
|
127
|
+
}
|
|
128
|
+
return -1;
|
|
129
|
+
}
|
|
130
|
+
let N = x(null), P = x(null);
|
|
131
|
+
function te(e) {
|
|
132
|
+
N.value = e;
|
|
133
|
+
}
|
|
134
|
+
function F(e, t) {
|
|
135
|
+
e.preventDefault(), P.value = t;
|
|
136
|
+
}
|
|
137
|
+
function I() {
|
|
138
|
+
if (N.value !== null && P.value !== null && N.value !== P.value) {
|
|
139
|
+
let e = [...h.value], [t] = e.splice(N.value, 1);
|
|
140
|
+
e.splice(P.value, 0, t), h.value = e;
|
|
141
|
+
}
|
|
142
|
+
N.value = null, P.value = null;
|
|
143
|
+
}
|
|
144
|
+
return (n, r) => (y(), o("div", {
|
|
145
|
+
class: "absolute top-full right-0 mt-1 w-96 rounded shadow-xl z-50 text-[13px]",
|
|
146
|
+
style: {
|
|
147
|
+
backgroundColor: "var(--st-bg-surface)",
|
|
148
|
+
border: "1px solid var(--st-border-secondary)"
|
|
149
|
+
},
|
|
150
|
+
onClick: r[2] ||= M(() => {}, ["stop"])
|
|
151
|
+
}, [s("div", V, [
|
|
152
|
+
h.value.length === 0 ? (y(), o("div", H, [...r[3] ||= [s("p", { class: "mb-1" }, "No sorts applied to this view", -1), s("p", { class: "text-xs" }, "Add a column below to sort the view", -1)]])) : a("", !0),
|
|
153
|
+
p.value ? (y(), o("div", ne, C(t.tableName), 1)) : a("", !0),
|
|
154
|
+
(y(!0), o(e, null, S(O.value, (n, i) => (y(), o("div", {
|
|
155
|
+
key: "p-" + i,
|
|
156
|
+
class: "flex items-center gap-2 mb-2 rounded px-1 -mx-1 transition-colors",
|
|
157
|
+
style: g(P.value === j("parent", i) && N.value !== j("parent", i) ? { backgroundColor: "var(--st-bg-menu-hover)" } : {}),
|
|
158
|
+
draggable: "true",
|
|
159
|
+
onDragstart: (e) => te(j("parent", i)),
|
|
160
|
+
onDragover: (e) => F(e, j("parent", i)),
|
|
161
|
+
onDragend: I
|
|
162
|
+
}, [
|
|
163
|
+
r[5] ||= c("<span class=\"cursor-grab active:cursor-grabbing shrink-0 flex items-center\" style=\"color:var(--st-text-placeholder);\" data-v-f1143526><svg class=\"w-3.5 h-3.5\" viewBox=\"0 0 16 16\" fill=\"currentColor\" data-v-f1143526><circle cx=\"5.5\" cy=\"4\" r=\"1\" data-v-f1143526></circle><circle cx=\"10.5\" cy=\"4\" r=\"1\" data-v-f1143526></circle><circle cx=\"5.5\" cy=\"8\" r=\"1\" data-v-f1143526></circle><circle cx=\"10.5\" cy=\"8\" r=\"1\" data-v-f1143526></circle><circle cx=\"5.5\" cy=\"12\" r=\"1\" data-v-f1143526></circle><circle cx=\"10.5\" cy=\"12\" r=\"1\" data-v-f1143526></circle></svg></span>", 1),
|
|
164
|
+
s("span", W, C(i === 0 ? "sort by" : "then by"), 1),
|
|
165
|
+
ee(s("select", {
|
|
166
|
+
"onUpdate:modelValue": (e) => n.id = e,
|
|
167
|
+
class: "sort-select flex-1 rounded py-1 text-[13px] outline-none min-w-0",
|
|
168
|
+
style: {
|
|
169
|
+
backgroundColor: "var(--st-bg)",
|
|
170
|
+
border: "1px solid var(--st-border-secondary)",
|
|
171
|
+
color: "var(--st-text)"
|
|
172
|
+
}
|
|
173
|
+
}, [(y(!0), o(e, null, S(t.allColumns, (t) => (y(), o("option", {
|
|
174
|
+
key: t.id,
|
|
175
|
+
value: t.id
|
|
176
|
+
}, [l(C(t.id), 1), T(f) ? (y(), o(e, { key: 0 }, [l(" (" + C(t.type) + ")", 1)], 64)) : a("", !0)], 8, K))), 128))], 8, G), [[D, n.id]]),
|
|
177
|
+
s("button", {
|
|
178
|
+
class: "shrink-0 w-[68px] flex items-center justify-center gap-1 px-2 py-1 rounded text-xs font-medium transition-colors",
|
|
179
|
+
style: g(n.desc ? {
|
|
180
|
+
color: "#3b82f6",
|
|
181
|
+
backgroundColor: "rgba(59, 130, 246, 0.1)",
|
|
182
|
+
border: "1px solid rgba(59, 130, 246, 0.3)"
|
|
183
|
+
} : {
|
|
184
|
+
color: "var(--st-accent)",
|
|
185
|
+
backgroundColor: "var(--st-accent-bg)",
|
|
186
|
+
border: "1px solid var(--st-accent-border-light)"
|
|
187
|
+
}),
|
|
188
|
+
onClick: (e) => b(j("parent", i)),
|
|
189
|
+
title: n.desc ? "Descending — click to toggle" : "Ascending — click to toggle"
|
|
190
|
+
}, [(y(), o("svg", q, [n.desc ? (y(), o("path", J)) : (y(), o("path", ie))])), l(" " + C(n.desc ? "DESC" : "ASC"), 1)], 12, re),
|
|
191
|
+
s("button", {
|
|
192
|
+
class: "shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors",
|
|
193
|
+
style: { color: "var(--st-text-tertiary)" },
|
|
194
|
+
title: "Remove sort rule",
|
|
195
|
+
onClick: (e) => v(j("parent", i))
|
|
196
|
+
}, [...r[4] ||= [s("svg", {
|
|
197
|
+
class: "w-3.5 h-3.5",
|
|
198
|
+
viewBox: "0 0 16 16",
|
|
199
|
+
fill: "currentColor"
|
|
200
|
+
}, [s("path", { d: "M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z" })], -1)]], 8, ae)
|
|
201
|
+
], 44, U))), 128)),
|
|
202
|
+
s("button", {
|
|
203
|
+
class: "text-[13px] mt-1",
|
|
204
|
+
style: { color: "var(--st-text-secondary)" },
|
|
205
|
+
onClick: r[0] ||= (e) => _("parent")
|
|
206
|
+
}, " + Pick a column to sort by "),
|
|
207
|
+
p.value ? (y(), o(e, { key: 2 }, [
|
|
208
|
+
r[8] ||= s("div", {
|
|
209
|
+
class: "my-3",
|
|
210
|
+
style: { borderTop: "1px solid var(--st-border-secondary)" }
|
|
211
|
+
}, null, -1),
|
|
212
|
+
r[9] ||= s("div", {
|
|
213
|
+
class: "text-xs font-medium uppercase tracking-wide mb-2",
|
|
214
|
+
style: { color: "var(--st-text-placeholder)" }
|
|
215
|
+
}, " Sub-table ", -1),
|
|
216
|
+
(y(!0), o(e, null, S(A.value, (n, i) => (y(), o("div", {
|
|
217
|
+
key: "s-" + i,
|
|
218
|
+
class: "flex items-center gap-2 mb-2 rounded px-1 -mx-1 transition-colors",
|
|
219
|
+
style: g(P.value === j("sub", i) && N.value !== j("sub", i) ? { backgroundColor: "var(--st-bg-menu-hover)" } : {}),
|
|
220
|
+
draggable: "true",
|
|
221
|
+
onDragstart: (e) => te(j("sub", i)),
|
|
222
|
+
onDragover: (e) => F(e, j("sub", i)),
|
|
223
|
+
onDragend: I
|
|
224
|
+
}, [
|
|
225
|
+
r[7] ||= c("<span class=\"cursor-grab active:cursor-grabbing shrink-0 flex items-center\" style=\"color:var(--st-text-placeholder);\" data-v-f1143526><svg class=\"w-3.5 h-3.5\" viewBox=\"0 0 16 16\" fill=\"currentColor\" data-v-f1143526><circle cx=\"5.5\" cy=\"4\" r=\"1\" data-v-f1143526></circle><circle cx=\"10.5\" cy=\"4\" r=\"1\" data-v-f1143526></circle><circle cx=\"5.5\" cy=\"8\" r=\"1\" data-v-f1143526></circle><circle cx=\"10.5\" cy=\"8\" r=\"1\" data-v-f1143526></circle><circle cx=\"5.5\" cy=\"12\" r=\"1\" data-v-f1143526></circle><circle cx=\"10.5\" cy=\"12\" r=\"1\" data-v-f1143526></circle></svg></span>", 1),
|
|
226
|
+
s("span", se, C(i === 0 ? "sort by" : "then by"), 1),
|
|
227
|
+
ee(s("select", {
|
|
228
|
+
"onUpdate:modelValue": (e) => n.id = e,
|
|
229
|
+
class: "sort-select flex-1 rounded py-1 text-[13px] outline-none min-w-0",
|
|
230
|
+
style: {
|
|
231
|
+
backgroundColor: "var(--st-bg)",
|
|
232
|
+
border: "1px solid var(--st-border-secondary)",
|
|
233
|
+
color: "var(--st-text)"
|
|
234
|
+
}
|
|
235
|
+
}, [(y(!0), o(e, null, S(t.subTableColumns, (t) => (y(), o("option", {
|
|
236
|
+
key: t.id,
|
|
237
|
+
value: t.id
|
|
238
|
+
}, [l(C(t.id), 1), T(f) ? (y(), o(e, { key: 0 }, [l(" (" + C(t.type) + ")", 1)], 64)) : a("", !0)], 8, le))), 128))], 8, ce), [[D, n.id]]),
|
|
239
|
+
s("button", {
|
|
240
|
+
class: "shrink-0 w-[68px] flex items-center justify-center gap-1 px-2 py-1 rounded text-xs font-medium transition-colors",
|
|
241
|
+
style: g(n.desc ? {
|
|
242
|
+
color: "#3b82f6",
|
|
243
|
+
backgroundColor: "rgba(59, 130, 246, 0.1)",
|
|
244
|
+
border: "1px solid rgba(59, 130, 246, 0.3)"
|
|
245
|
+
} : {
|
|
246
|
+
color: "var(--st-accent)",
|
|
247
|
+
backgroundColor: "var(--st-accent-bg)",
|
|
248
|
+
border: "1px solid var(--st-accent-border-light)"
|
|
249
|
+
}),
|
|
250
|
+
onClick: (e) => b(j("sub", i)),
|
|
251
|
+
title: n.desc ? "Descending — click to toggle" : "Ascending — click to toggle"
|
|
252
|
+
}, [(y(), o("svg", de, [n.desc ? (y(), o("path", Y)) : (y(), o("path", fe))])), l(" " + C(n.desc ? "DESC" : "ASC"), 1)], 12, ue),
|
|
253
|
+
s("button", {
|
|
254
|
+
class: "shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors",
|
|
255
|
+
style: { color: "var(--st-text-tertiary)" },
|
|
256
|
+
title: "Remove sort rule",
|
|
257
|
+
onClick: (e) => v(j("sub", i))
|
|
258
|
+
}, [...r[6] ||= [s("svg", {
|
|
259
|
+
class: "w-3.5 h-3.5",
|
|
260
|
+
viewBox: "0 0 16 16",
|
|
261
|
+
fill: "currentColor"
|
|
262
|
+
}, [s("path", { d: "M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z" })], -1)]], 8, pe)
|
|
263
|
+
], 44, oe))), 128)),
|
|
264
|
+
s("button", {
|
|
265
|
+
class: "text-[13px] mt-1",
|
|
266
|
+
style: { color: "var(--st-text-secondary)" },
|
|
267
|
+
onClick: r[1] ||= (e) => _("sub")
|
|
268
|
+
}, " + Pick a column to sort by ")
|
|
269
|
+
], 64)) : a("", !0)
|
|
270
|
+
]), s("div", me, [h.value.length > 0 ? (y(), o("button", {
|
|
271
|
+
key: 0,
|
|
272
|
+
class: "px-3 py-1 rounded text-[13px] transition-colors",
|
|
273
|
+
style: {
|
|
274
|
+
border: "1px solid var(--st-border-secondary)",
|
|
275
|
+
color: "var(--st-text-secondary)"
|
|
276
|
+
},
|
|
277
|
+
onClick: E
|
|
278
|
+
}, " Clear sorting ")) : a("", !0), s("button", {
|
|
279
|
+
class: "px-3 py-1 rounded text-[13px] font-medium transition-colors",
|
|
280
|
+
style: {
|
|
281
|
+
backgroundColor: "var(--st-accent)",
|
|
282
|
+
color: "var(--st-text-on-accent)"
|
|
283
|
+
},
|
|
284
|
+
onClick: w
|
|
285
|
+
}, " Apply sorting ")])]));
|
|
286
|
+
}
|
|
287
|
+
}, [["__scopeId", "data-v-f1143526"]]), ge = [
|
|
288
|
+
"date",
|
|
289
|
+
"time",
|
|
290
|
+
"timetz",
|
|
291
|
+
"timestamp",
|
|
292
|
+
"timestamptz",
|
|
293
|
+
"datetime"
|
|
294
|
+
], _e = [
|
|
295
|
+
{
|
|
296
|
+
group: "Comparison",
|
|
297
|
+
operators: [
|
|
298
|
+
{
|
|
299
|
+
label: "Equals",
|
|
300
|
+
value: "="
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
label: "Not equal",
|
|
304
|
+
value: "<>"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
label: "Greater than",
|
|
308
|
+
value: ">"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
label: "Less than",
|
|
312
|
+
value: "<"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
label: "Greater or equal",
|
|
316
|
+
value: ">="
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
label: "Less or equal",
|
|
320
|
+
value: "<="
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
group: "Pattern Matching",
|
|
326
|
+
operators: [{
|
|
327
|
+
label: "Contains",
|
|
328
|
+
value: "~~"
|
|
329
|
+
}, {
|
|
330
|
+
label: "Excludes",
|
|
331
|
+
value: "~~*"
|
|
332
|
+
}]
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
group: "Set & Null Checks",
|
|
336
|
+
operators: [{
|
|
337
|
+
label: "In list",
|
|
338
|
+
value: "in"
|
|
339
|
+
}, {
|
|
340
|
+
label: "Is",
|
|
341
|
+
value: "is"
|
|
342
|
+
}]
|
|
343
|
+
}
|
|
344
|
+
], X = {
|
|
345
|
+
INSERT: "insert",
|
|
346
|
+
UPDATE: "update",
|
|
347
|
+
DELETE: "delete"
|
|
348
|
+
}, ve = "__pending_", Z = { class: "relative flex items-center" }, ye = {
|
|
349
|
+
key: 0,
|
|
350
|
+
class: "w-3.5 h-3.5",
|
|
351
|
+
viewBox: "0 0 16 16",
|
|
352
|
+
fill: "currentColor"
|
|
353
|
+
}, be = {
|
|
354
|
+
key: 1,
|
|
355
|
+
class: "w-3.5 h-3.5",
|
|
356
|
+
viewBox: "0 0 16 16",
|
|
357
|
+
fill: "currentColor"
|
|
358
|
+
}, xe = {
|
|
359
|
+
class: "rounded-lg shadow-xl p-3",
|
|
360
|
+
style: {
|
|
361
|
+
backgroundColor: "var(--st-bg-surface)",
|
|
362
|
+
border: "1px solid var(--st-border-secondary)"
|
|
363
|
+
}
|
|
364
|
+
}, Se = ["type", "value"], Ce = {
|
|
365
|
+
__name: "FilterDatePicker",
|
|
366
|
+
props: {
|
|
367
|
+
value: {
|
|
368
|
+
type: String,
|
|
369
|
+
default: ""
|
|
370
|
+
},
|
|
371
|
+
columnType: {
|
|
372
|
+
type: String,
|
|
373
|
+
default: "date"
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
emits: ["update"],
|
|
377
|
+
setup(e, { emit: n }) {
|
|
378
|
+
let c = e, l = n, u = d("themeVars", {}), f = r(() => (u?.value ?? u)?.["--st-bg"]?.startsWith("#1") ? "dark" : "light"), p = x(!1), m = x(null), h = x(null), _ = r(() => {
|
|
379
|
+
let e = c.columnType;
|
|
380
|
+
return e === "time" || e === "timetz" ? "time" : e === "date" ? "date" : "datetime-local";
|
|
381
|
+
}), v = r(() => c.value ? _.value === "datetime-local" ? c.value.replace(" ", "T").slice(0, 16) : c.value.slice(0, _.value === "time" ? 5 : 10) : "");
|
|
382
|
+
function b(e) {
|
|
383
|
+
return e ? _.value === "datetime-local" ? e.replace("T", " ") + ":00" : e : "";
|
|
384
|
+
}
|
|
385
|
+
function S(e) {
|
|
386
|
+
l("update", b(e.target.value)), p.value = !1;
|
|
387
|
+
}
|
|
388
|
+
function C() {
|
|
389
|
+
p.value = !p.value;
|
|
390
|
+
}
|
|
391
|
+
function w() {
|
|
392
|
+
p.value = !1;
|
|
393
|
+
}
|
|
394
|
+
function E() {
|
|
395
|
+
w();
|
|
396
|
+
}
|
|
397
|
+
return (e, n) => (y(), o("div", Z, [s("button", {
|
|
398
|
+
ref_key: "triggerRef",
|
|
399
|
+
ref: h,
|
|
400
|
+
class: "flex items-center justify-center w-4 h-4 rounded transition-colors shrink-0",
|
|
401
|
+
style: g({ color: p.value ? "var(--st-accent)" : "var(--st-text-placeholder)" }),
|
|
402
|
+
title: "Pick date/time",
|
|
403
|
+
onClick: M(C, ["stop"])
|
|
404
|
+
}, [_.value === "time" ? (y(), o("svg", ye, [...n[1] ||= [s("path", { d: "M8 0a8 8 0 100 16A8 8 0 008 0zM1.5 8a6.5 6.5 0 1113 0 6.5 6.5 0 01-13 0zm7-3.25a.75.75 0 00-1.5 0v3.5c0 .27.144.518.378.651l2.5 1.5a.75.75 0 10.744-1.302L8.5 7.742V4.75z" }, null, -1)]])) : (y(), o("svg", be, [...n[2] ||= [s("path", { d: "M4.75 0a.75.75 0 01.75.75V2h5V.75a.75.75 0 011.5 0V2h1.25c.966 0 1.75.784 1.75 1.75v10.5A1.75 1.75 0 0113.25 16H2.75A1.75 1.75 0 011 14.25V3.75C1 2.784 1.784 2 2.75 2H4V.75A.75.75 0 014.75 0zm0 3.5h-2a.25.25 0 00-.25.25V6h10.5V3.75a.25.25 0 00-.25-.25h-2V5a.75.75 0 01-1.5 0V3.5h-5V5a.75.75 0 01-1.5 0V3.5zM2.5 7.5v6.75c0 .138.112.25.25.25h10.5a.25.25 0 00.25-.25V7.5H2.5z" }, null, -1)]]))], 4), (y(), i(t, { to: "body" }, [p.value ? (y(), o("div", {
|
|
405
|
+
key: 0,
|
|
406
|
+
class: "fixed inset-0 z-40",
|
|
407
|
+
onClick: E
|
|
408
|
+
})) : a("", !0), p.value ? (y(), o("div", {
|
|
409
|
+
key: 1,
|
|
410
|
+
ref_key: "pickerRef",
|
|
411
|
+
ref: m,
|
|
412
|
+
class: "fixed z-50",
|
|
413
|
+
style: g({
|
|
414
|
+
...T(u),
|
|
415
|
+
top: h.value ? h.value.getBoundingClientRect().bottom + 6 + "px" : "0",
|
|
416
|
+
left: h.value ? h.value.getBoundingClientRect().left + "px" : "0"
|
|
417
|
+
}),
|
|
418
|
+
onClick: n[0] ||= M(() => {}, ["stop"])
|
|
419
|
+
}, [s("div", xe, [s("input", {
|
|
420
|
+
type: _.value,
|
|
421
|
+
value: v.value,
|
|
422
|
+
class: "outline-none rounded px-2 py-1.5 text-[13px]",
|
|
423
|
+
style: g({
|
|
424
|
+
backgroundColor: "var(--st-bg-input)",
|
|
425
|
+
border: "1px solid var(--st-border-secondary)",
|
|
426
|
+
color: "var(--st-text)",
|
|
427
|
+
colorScheme: f.value
|
|
428
|
+
}),
|
|
429
|
+
onChange: S
|
|
430
|
+
}, null, 44, Se)])], 4)) : a("", !0)]))]));
|
|
431
|
+
}
|
|
432
|
+
}, we = { class: "flex items-center gap-1.5 flex-wrap flex-1 min-w-0" }, Te = {
|
|
433
|
+
key: 0,
|
|
434
|
+
class: "text-[10px] font-medium uppercase px-1 rounded",
|
|
435
|
+
style: {
|
|
436
|
+
color: "var(--st-text-placeholder)",
|
|
437
|
+
backgroundColor: "var(--st-bg-input)"
|
|
438
|
+
}
|
|
439
|
+
}, Ee = { style: { color: "var(--st-text-secondary)" } }, De = {
|
|
440
|
+
class: "font-mono text-xs",
|
|
441
|
+
style: { color: "var(--st-text-placeholder)" }
|
|
442
|
+
}, Oe = ["value", "onInput"], ke = ["onClick"], Ae = {
|
|
443
|
+
key: 0,
|
|
444
|
+
class: "text-[10px] font-medium uppercase px-1 rounded",
|
|
445
|
+
style: {
|
|
446
|
+
color: "var(--st-text-placeholder)",
|
|
447
|
+
backgroundColor: "var(--st-bg-input)"
|
|
448
|
+
}
|
|
449
|
+
}, je = { style: { color: "var(--st-text-secondary)" } }, Me = ["placeholder"], Ne = [
|
|
450
|
+
"data-highlighted",
|
|
451
|
+
"onClick",
|
|
452
|
+
"onMouseenter"
|
|
453
|
+
], Pe = { style: { color: "var(--st-text)" } }, Fe = {
|
|
454
|
+
key: 0,
|
|
455
|
+
class: "text-xs",
|
|
456
|
+
style: { color: "var(--st-text-placeholder)" }
|
|
457
|
+
}, Ie = {
|
|
458
|
+
key: 0,
|
|
459
|
+
class: "px-3 py-2 text-[13px]",
|
|
460
|
+
style: { color: "var(--st-text-placeholder)" }
|
|
461
|
+
}, Q = {
|
|
462
|
+
key: 0,
|
|
463
|
+
class: "px-3 py-1 text-xs font-medium uppercase tracking-wide",
|
|
464
|
+
style: { color: "var(--st-text-placeholder)" }
|
|
465
|
+
}, Le = [
|
|
466
|
+
"data-highlighted",
|
|
467
|
+
"onClick",
|
|
468
|
+
"onMouseenter"
|
|
469
|
+
], Re = { style: { color: "var(--st-text)" } }, ze = {
|
|
470
|
+
class: "font-mono text-xs",
|
|
471
|
+
style: { color: "var(--st-text-placeholder)" }
|
|
472
|
+
}, Be = /* @__PURE__ */ B({
|
|
473
|
+
__name: "FilterBar",
|
|
474
|
+
props: {
|
|
475
|
+
table: {
|
|
476
|
+
type: Object,
|
|
477
|
+
required: !0
|
|
478
|
+
},
|
|
479
|
+
columnFilters: {
|
|
480
|
+
type: Array,
|
|
481
|
+
default: () => []
|
|
482
|
+
},
|
|
483
|
+
allColumns: {
|
|
484
|
+
type: Array,
|
|
485
|
+
default: () => []
|
|
486
|
+
},
|
|
487
|
+
subTableColumns: {
|
|
488
|
+
type: Array,
|
|
489
|
+
default: null
|
|
490
|
+
},
|
|
491
|
+
subTableColumnFilters: {
|
|
492
|
+
type: Array,
|
|
493
|
+
default: () => []
|
|
494
|
+
},
|
|
495
|
+
tableName: {
|
|
496
|
+
type: String,
|
|
497
|
+
default: "table"
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
emits: ["update:column-filters", "update:sub-table-column-filters"],
|
|
501
|
+
setup(n, { emit: c }) {
|
|
502
|
+
let l = n, u = c, f = d("showDataTypes", !0), p = d("themeVars", {}), h = r(() => {
|
|
503
|
+
let e = l.columnFilters.map((e, t) => ({
|
|
504
|
+
...e,
|
|
505
|
+
table: "parent",
|
|
506
|
+
sourceIndex: t
|
|
507
|
+
})), t = l.subTableColumnFilters.map((e, t) => ({
|
|
508
|
+
...e,
|
|
509
|
+
table: "sub",
|
|
510
|
+
sourceIndex: t
|
|
511
|
+
}));
|
|
512
|
+
return [...e, ...t];
|
|
513
|
+
}), _ = r(() => h.value.some((e) => e.table === "sub")), v = x("closed"), b = x(null), w = x(""), E = x(0), D = x(null), j = x(null), M = x(null), N = x({
|
|
514
|
+
top: 0,
|
|
515
|
+
left: 0
|
|
516
|
+
}), P = x({});
|
|
517
|
+
function te() {
|
|
518
|
+
if (v.value === "operators" && M.value) {
|
|
519
|
+
let e = M.value.getBoundingClientRect();
|
|
520
|
+
N.value = {
|
|
521
|
+
top: e.bottom + 4,
|
|
522
|
+
left: e.right
|
|
523
|
+
};
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
let e = j.value;
|
|
527
|
+
if (!e) return;
|
|
528
|
+
let t = e.getBoundingClientRect();
|
|
529
|
+
N.value = {
|
|
530
|
+
top: t.bottom + 4,
|
|
531
|
+
left: t.left
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
let F = r(() => {
|
|
535
|
+
let e = [];
|
|
536
|
+
for (let t of _e) {
|
|
537
|
+
e.push({
|
|
538
|
+
type: "header",
|
|
539
|
+
label: t.group
|
|
540
|
+
});
|
|
541
|
+
for (let n of t.operators) e.push({
|
|
542
|
+
type: "operator",
|
|
543
|
+
...n
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
return e;
|
|
547
|
+
}), I = r(() => F.value.filter((e) => e.type === "operator")), L = r(() => {
|
|
548
|
+
let e = w.value.toLowerCase();
|
|
549
|
+
return e ? l.allColumns.filter((t) => t.id.toLowerCase().includes(e)) : l.allColumns;
|
|
550
|
+
}), R = r(() => L.value.map((e) => ({
|
|
551
|
+
...e,
|
|
552
|
+
table: "parent"
|
|
553
|
+
}))), z = r(() => `Filter by ${l.allColumns.map((e) => e.id).slice(0, 3).join(", ")}...`), B = r(() => {
|
|
554
|
+
let e = l.subTableColumns || [];
|
|
555
|
+
return [...l.allColumns, ...e];
|
|
556
|
+
});
|
|
557
|
+
function V(e) {
|
|
558
|
+
return B.value.find((t) => t.id === e)?.type || "varchar";
|
|
559
|
+
}
|
|
560
|
+
function H(e) {
|
|
561
|
+
return ge.includes(V(e));
|
|
562
|
+
}
|
|
563
|
+
function ne(e) {
|
|
564
|
+
return e.value?.operator || "=";
|
|
565
|
+
}
|
|
566
|
+
function U(e) {
|
|
567
|
+
return e.value?.value ?? "";
|
|
568
|
+
}
|
|
569
|
+
function W() {
|
|
570
|
+
v.value = "columns", E.value = 0;
|
|
571
|
+
}
|
|
572
|
+
function G(e, t) {
|
|
573
|
+
b.value = {
|
|
574
|
+
id: e,
|
|
575
|
+
table: t
|
|
576
|
+
}, w.value = "", v.value = "operators", E.value = 0;
|
|
577
|
+
}
|
|
578
|
+
function K(e) {
|
|
579
|
+
if (!b.value) return;
|
|
580
|
+
let { id: t, table: n } = b.value, r = {
|
|
581
|
+
id: t,
|
|
582
|
+
value: {
|
|
583
|
+
operator: e,
|
|
584
|
+
value: ""
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
n === "sub" ? u("update:sub-table-column-filters", [...l.subTableColumnFilters, r]) : u("update:column-filters", [...l.columnFilters, r]), v.value = "closed", b.value = null, w.value = "", D.value?.blur();
|
|
588
|
+
let i = () => {
|
|
589
|
+
let e = h.value.length - 1, t = P.value[e];
|
|
590
|
+
t ? t.focus() : m(i);
|
|
591
|
+
};
|
|
592
|
+
m(() => m(i));
|
|
593
|
+
}
|
|
594
|
+
function re(e) {
|
|
595
|
+
let t = h.value[e];
|
|
596
|
+
t.table === "sub" ? u("update:sub-table-column-filters", l.subTableColumnFilters.filter((e, n) => n !== t.sourceIndex)) : u("update:column-filters", l.columnFilters.filter((e, n) => n !== t.sourceIndex));
|
|
597
|
+
}
|
|
598
|
+
function q(e, t) {
|
|
599
|
+
let n = h.value[e];
|
|
600
|
+
if (n.table === "sub") {
|
|
601
|
+
let e = [...l.subTableColumnFilters], r = e[n.sourceIndex], i = r.value?.operator || "=";
|
|
602
|
+
e[n.sourceIndex] = {
|
|
603
|
+
...r,
|
|
604
|
+
value: {
|
|
605
|
+
operator: i,
|
|
606
|
+
value: t
|
|
607
|
+
}
|
|
608
|
+
}, u("update:sub-table-column-filters", e);
|
|
609
|
+
} else {
|
|
610
|
+
let e = [...l.columnFilters], r = e[n.sourceIndex], i = r.value?.operator || "=";
|
|
611
|
+
e[n.sourceIndex] = {
|
|
612
|
+
...r,
|
|
613
|
+
value: {
|
|
614
|
+
operator: i,
|
|
615
|
+
value: t
|
|
616
|
+
}
|
|
617
|
+
}, u("update:column-filters", e);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
function ie(e) {
|
|
621
|
+
v.value === "columns" ? J(e) : v.value === "operators" ? ae(e) : e.key !== "Escape" && W(), e.key === "Escape" && (se(), D.value?.blur());
|
|
622
|
+
}
|
|
623
|
+
function J(e) {
|
|
624
|
+
let t = R.value;
|
|
625
|
+
if (t.length !== 0) {
|
|
626
|
+
if (e.key === "ArrowDown") e.preventDefault(), E.value = Math.min(E.value + 1, t.length - 1), oe("column-picker");
|
|
627
|
+
else if (e.key === "ArrowUp") e.preventDefault(), E.value = Math.max(E.value - 1, 0), oe("column-picker");
|
|
628
|
+
else if (e.key === "Enter" || e.key === "Tab") {
|
|
629
|
+
e.preventDefault();
|
|
630
|
+
let n = t[E.value];
|
|
631
|
+
n && G(n.id, n.table);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
function ae(e) {
|
|
636
|
+
let t = I.value;
|
|
637
|
+
t.length !== 0 && (e.key === "ArrowDown" ? (e.preventDefault(), E.value = Math.min(E.value + 1, t.length - 1), oe("operator-picker")) : e.key === "ArrowUp" ? (e.preventDefault(), E.value = Math.max(E.value - 1, 0), oe("operator-picker")) : (e.key === "Enter" || e.key === "Tab") && (e.preventDefault(), t[E.value] && K(t[E.value].value)));
|
|
638
|
+
}
|
|
639
|
+
function oe(e) {
|
|
640
|
+
m(() => {
|
|
641
|
+
let t = document.getElementById(e)?.querySelector("[data-highlighted=\"true\"]");
|
|
642
|
+
t && t.scrollIntoView({ block: "nearest" });
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
function se() {
|
|
646
|
+
v.value = "closed", b.value = null, w.value = "", E.value = 0;
|
|
647
|
+
}
|
|
648
|
+
function ce() {
|
|
649
|
+
v.value === "closed" && W();
|
|
650
|
+
}
|
|
651
|
+
return k(w, () => {
|
|
652
|
+
E.value = 0;
|
|
653
|
+
}), A((e) => {
|
|
654
|
+
if (v.value === "closed") return;
|
|
655
|
+
function t() {
|
|
656
|
+
m(te);
|
|
657
|
+
}
|
|
658
|
+
te(), window.addEventListener("resize", t), window.addEventListener("scroll", t, !0), e(() => {
|
|
659
|
+
window.removeEventListener("resize", t), window.removeEventListener("scroll", t, !0);
|
|
660
|
+
});
|
|
661
|
+
}), (r, c) => (y(), o("div", we, [
|
|
662
|
+
(y(!0), o(e, null, S(h.value, (e, t) => (y(), o("div", {
|
|
663
|
+
key: e.table + "-" + e.sourceIndex,
|
|
664
|
+
class: "flex items-center gap-1 rounded px-2 py-0.5 text-[13px]",
|
|
665
|
+
style: {
|
|
666
|
+
backgroundColor: "var(--st-bg-surface)",
|
|
667
|
+
border: "1px solid var(--st-border-secondary)"
|
|
668
|
+
}
|
|
669
|
+
}, [
|
|
670
|
+
_.value ? (y(), o("span", Te, C(e.table === "sub" ? "sub" : n.tableName), 1)) : a("", !0),
|
|
671
|
+
s("span", Ee, C(e.id), 1),
|
|
672
|
+
s("span", De, C(ne(e)), 1),
|
|
673
|
+
s("input", {
|
|
674
|
+
ref_for: !0,
|
|
675
|
+
ref: (e) => {
|
|
676
|
+
e && (P.value[t] = e);
|
|
677
|
+
},
|
|
678
|
+
value: U(e),
|
|
679
|
+
class: "bg-transparent outline-none text-[13px]",
|
|
680
|
+
style: g({
|
|
681
|
+
color: "var(--st-text)",
|
|
682
|
+
width: Math.max(6, (U(e) || "").length + 1) + "ch"
|
|
683
|
+
}),
|
|
684
|
+
placeholder: "value",
|
|
685
|
+
onInput: (e) => q(t, e.target.value)
|
|
686
|
+
}, null, 44, Oe),
|
|
687
|
+
H(e.id) ? (y(), i(Ce, {
|
|
688
|
+
key: 1,
|
|
689
|
+
value: U(e),
|
|
690
|
+
"column-type": V(e.id),
|
|
691
|
+
onUpdate: (e) => q(t, e)
|
|
692
|
+
}, null, 8, [
|
|
693
|
+
"value",
|
|
694
|
+
"column-type",
|
|
695
|
+
"onUpdate"
|
|
696
|
+
])) : a("", !0),
|
|
697
|
+
s("button", {
|
|
698
|
+
class: "ml-0.5 w-5 h-5 flex items-center justify-center rounded transition-colors filter-chip-close shrink-0",
|
|
699
|
+
style: { color: "var(--st-text-placeholder)" },
|
|
700
|
+
onClick: (e) => re(t)
|
|
701
|
+
}, [...c[1] ||= [s("svg", {
|
|
702
|
+
class: "w-3 h-3",
|
|
703
|
+
viewBox: "0 0 16 16",
|
|
704
|
+
fill: "currentColor"
|
|
705
|
+
}, [s("path", { d: "M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z" })], -1)]], 8, ke)
|
|
706
|
+
]))), 128)),
|
|
707
|
+
b.value ? (y(), o("div", {
|
|
708
|
+
key: 0,
|
|
709
|
+
ref_key: "pendingChipRef",
|
|
710
|
+
ref: M,
|
|
711
|
+
class: "flex items-center gap-1 rounded px-2 py-0.5 text-[13px]",
|
|
712
|
+
style: {
|
|
713
|
+
backgroundColor: "var(--st-bg-surface)",
|
|
714
|
+
border: "1px solid var(--st-accent-border)"
|
|
715
|
+
}
|
|
716
|
+
}, [_.value || b.value && b.value.table === "sub" ? (y(), o("span", Ae, C(b.value.table === "sub" ? "sub" : n.tableName), 1)) : a("", !0), s("span", je, C(b.value.id), 1)], 512)) : a("", !0),
|
|
717
|
+
s("div", {
|
|
718
|
+
ref_key: "anchorRef",
|
|
719
|
+
ref: j,
|
|
720
|
+
class: "relative flex-1 min-w-[200px]"
|
|
721
|
+
}, [
|
|
722
|
+
ee(s("input", {
|
|
723
|
+
ref_key: "searchInputRef",
|
|
724
|
+
ref: D,
|
|
725
|
+
"onUpdate:modelValue": c[0] ||= (e) => w.value = e,
|
|
726
|
+
class: "w-full bg-transparent outline-none text-[13px] py-1",
|
|
727
|
+
style: g({
|
|
728
|
+
color: "var(--st-text)",
|
|
729
|
+
caretColor: v.value === "operators" ? "transparent" : void 0
|
|
730
|
+
}),
|
|
731
|
+
placeholder: v.value === "operators" ? "Pick a filter method..." : h.value.length > 0 ? "+ Add more filters..." : z.value,
|
|
732
|
+
onFocus: ce,
|
|
733
|
+
onKeydown: ie
|
|
734
|
+
}, null, 44, Me), [[O, w.value]]),
|
|
735
|
+
(y(), i(t, { to: "body" }, [v.value === "columns" ? (y(), o("div", {
|
|
736
|
+
key: 0,
|
|
737
|
+
id: "column-picker",
|
|
738
|
+
class: "fixed w-60 rounded shadow-xl z-50 py-1 max-h-60 overflow-auto",
|
|
739
|
+
style: g({
|
|
740
|
+
...T(p),
|
|
741
|
+
top: N.value.top + "px",
|
|
742
|
+
left: N.value.left + "px",
|
|
743
|
+
fontFamily: "var(--dt-font-family)",
|
|
744
|
+
backgroundColor: "var(--st-bg-surface)",
|
|
745
|
+
border: "1px solid var(--st-border-secondary)",
|
|
746
|
+
color: "var(--st-text)"
|
|
747
|
+
})
|
|
748
|
+
}, [(y(!0), o(e, null, S(L.value, (e, t) => (y(), o("div", {
|
|
749
|
+
key: "p-" + e.id,
|
|
750
|
+
class: "flex items-center justify-between px-3 py-1.5 cursor-pointer text-[13px]",
|
|
751
|
+
"data-highlighted": t === E.value,
|
|
752
|
+
style: g(t === E.value ? { backgroundColor: "var(--st-bg-menu-hover)" } : {}),
|
|
753
|
+
onClick: (t) => G(e.id, "parent"),
|
|
754
|
+
onMouseenter: (e) => E.value = t
|
|
755
|
+
}, [s("span", Pe, C(e.id), 1), T(f) ? (y(), o("span", Fe, C(e.type), 1)) : a("", !0)], 44, Ne))), 128)), L.value.length === 0 ? (y(), o("div", Ie, " No columns found ")) : a("", !0)], 4)) : a("", !0)])),
|
|
756
|
+
(y(), i(t, { to: "body" }, [v.value === "operators" ? (y(), o("div", {
|
|
757
|
+
key: 0,
|
|
758
|
+
id: "operator-picker",
|
|
759
|
+
class: "fixed w-52 rounded shadow-xl z-50 py-1 max-h-60 overflow-auto",
|
|
760
|
+
style: g({
|
|
761
|
+
...T(p),
|
|
762
|
+
top: N.value.top + "px",
|
|
763
|
+
left: N.value.left + "px",
|
|
764
|
+
fontFamily: "var(--dt-font-family)",
|
|
765
|
+
backgroundColor: "var(--st-bg-surface)",
|
|
766
|
+
border: "1px solid var(--st-border-secondary)",
|
|
767
|
+
color: "var(--st-text)"
|
|
768
|
+
})
|
|
769
|
+
}, [(y(!0), o(e, null, S(F.value, (t, n) => (y(), o(e, { key: n }, [t.type === "header" ? (y(), o("div", Q, C(t.label), 1)) : (y(), o("div", {
|
|
770
|
+
key: 1,
|
|
771
|
+
class: "flex items-center justify-between px-3 py-1.5 cursor-pointer text-[13px]",
|
|
772
|
+
"data-highlighted": I.value.indexOf(t) === E.value,
|
|
773
|
+
style: g(I.value.indexOf(t) === E.value ? { backgroundColor: "var(--st-bg-menu-hover)" } : {}),
|
|
774
|
+
onClick: (e) => K(t.value),
|
|
775
|
+
onMouseenter: (e) => E.value = I.value.indexOf(t)
|
|
776
|
+
}, [s("span", Re, C(t.label), 1), s("span", ze, C(t.value), 1)], 44, Le))], 64))), 128))], 4)) : a("", !0)])),
|
|
777
|
+
(y(), i(t, { to: "body" }, [v.value === "closed" ? a("", !0) : (y(), o("div", {
|
|
778
|
+
key: 0,
|
|
779
|
+
class: "fixed inset-0 z-40",
|
|
780
|
+
onClick: se
|
|
781
|
+
}))]))
|
|
782
|
+
], 512)
|
|
783
|
+
]));
|
|
784
|
+
}
|
|
785
|
+
}, [["__scopeId", "data-v-d6671bc9"]]), Ve = {
|
|
786
|
+
class: "px-3 py-2 flex items-center justify-between",
|
|
787
|
+
style: { borderBottom: "1px solid var(--st-border-secondary)" }
|
|
788
|
+
}, He = {
|
|
789
|
+
class: "font-medium",
|
|
790
|
+
style: { color: "var(--st-text-secondary)" }
|
|
791
|
+
}, Ue = { class: "max-h-72 overflow-auto py-1" }, We = {
|
|
792
|
+
key: 0,
|
|
793
|
+
class: "px-3 py-1 text-xs font-medium uppercase tracking-wide",
|
|
794
|
+
style: { color: "var(--st-text-placeholder)" }
|
|
795
|
+
}, Ge = ["onClick"], Ke = {
|
|
796
|
+
key: 0,
|
|
797
|
+
class: "w-3 h-3",
|
|
798
|
+
style: { color: "var(--st-text-on-accent)" },
|
|
799
|
+
viewBox: "0 0 16 16",
|
|
800
|
+
fill: "currentColor"
|
|
801
|
+
}, qe = {
|
|
802
|
+
key: 0,
|
|
803
|
+
class: "text-xs ml-auto shrink-0",
|
|
804
|
+
style: { color: "var(--st-text-placeholder)" }
|
|
805
|
+
}, Je = ["onClick"], Ye = {
|
|
806
|
+
key: 0,
|
|
807
|
+
class: "w-3 h-3",
|
|
808
|
+
style: { color: "var(--st-text-on-accent)" },
|
|
809
|
+
viewBox: "0 0 16 16",
|
|
810
|
+
fill: "currentColor"
|
|
811
|
+
}, Xe = {
|
|
812
|
+
key: 0,
|
|
813
|
+
class: "text-xs ml-auto shrink-0",
|
|
814
|
+
style: { color: "var(--st-text-placeholder)" }
|
|
815
|
+
}, Ze = /* @__PURE__ */ B({
|
|
816
|
+
__name: "ColumnVisibilityPanel",
|
|
817
|
+
props: {
|
|
818
|
+
table: {
|
|
819
|
+
type: Object,
|
|
820
|
+
required: !0
|
|
821
|
+
},
|
|
822
|
+
columnVisibility: {
|
|
823
|
+
type: Object,
|
|
824
|
+
default: () => ({})
|
|
825
|
+
},
|
|
826
|
+
defaultColumnVisibility: {
|
|
827
|
+
type: Object,
|
|
828
|
+
default: () => ({})
|
|
829
|
+
},
|
|
830
|
+
subTableColumns: {
|
|
831
|
+
type: Array,
|
|
832
|
+
default: null
|
|
833
|
+
},
|
|
834
|
+
subTableColumnVisibility: {
|
|
835
|
+
type: Object,
|
|
836
|
+
default: () => ({})
|
|
837
|
+
},
|
|
838
|
+
tableName: {
|
|
839
|
+
type: String,
|
|
840
|
+
default: "table"
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
emits: [
|
|
844
|
+
"update:column-visibility",
|
|
845
|
+
"update:sub-table-column-visibility",
|
|
846
|
+
"close"
|
|
847
|
+
],
|
|
848
|
+
setup(t, { emit: n }) {
|
|
849
|
+
let i = t, c = n, l = d("showDataTypes", !0), u = r(() => !!i.subTableColumns && i.subTableColumns.length > 0), f = r(() => i.table.getAllLeafColumns().map((e) => ({
|
|
850
|
+
id: e.id,
|
|
851
|
+
type: e.columnDef.meta?.type || "text",
|
|
852
|
+
isVisible: i.columnVisibility[e.id] !== !1
|
|
853
|
+
}))), p = r(() => u.value ? i.subTableColumns.map((e) => ({
|
|
854
|
+
id: e.id,
|
|
855
|
+
type: e.type || "text",
|
|
856
|
+
isVisible: i.subTableColumnVisibility[e.id] !== !1
|
|
857
|
+
})) : []), m = r(() => f.value.filter((e) => e.isVisible).length), h = r(() => p.value.filter((e) => e.isVisible).length), _ = r(() => m.value + h.value), v = r(() => f.value.length + p.value.length);
|
|
858
|
+
function b(e) {
|
|
859
|
+
let t = { ...i.columnVisibility };
|
|
860
|
+
t[e] = t[e] === !1, c("update:column-visibility", t);
|
|
861
|
+
}
|
|
862
|
+
function x(e) {
|
|
863
|
+
let t = { ...i.subTableColumnVisibility };
|
|
864
|
+
t[e] = t[e] === !1, c("update:sub-table-column-visibility", t);
|
|
865
|
+
}
|
|
866
|
+
function w() {
|
|
867
|
+
let e = {};
|
|
868
|
+
if (f.value.forEach((t) => {
|
|
869
|
+
e[t.id] = !0;
|
|
870
|
+
}), c("update:column-visibility", e), u.value) {
|
|
871
|
+
let e = {};
|
|
872
|
+
p.value.forEach((t) => {
|
|
873
|
+
e[t.id] = !0;
|
|
874
|
+
}), c("update:sub-table-column-visibility", e);
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
function E() {
|
|
878
|
+
c("update:column-visibility", { ...i.defaultColumnVisibility }), u.value && c("update:sub-table-column-visibility", {});
|
|
879
|
+
}
|
|
880
|
+
return (n, r) => (y(), o("div", {
|
|
881
|
+
class: "absolute top-full right-0 mt-1 w-64 rounded shadow-xl z-50 text-[13px]",
|
|
882
|
+
style: {
|
|
883
|
+
backgroundColor: "var(--st-bg-surface)",
|
|
884
|
+
border: "1px solid var(--st-border-secondary)"
|
|
885
|
+
},
|
|
886
|
+
onClick: r[0] ||= M(() => {}, ["stop"])
|
|
887
|
+
}, [s("div", Ve, [s("span", He, C(_.value) + " of " + C(v.value) + " columns", 1), s("div", { class: "flex items-center gap-2" }, [
|
|
888
|
+
s("button", {
|
|
889
|
+
class: "text-xs",
|
|
890
|
+
style: { color: "var(--st-text-secondary)" },
|
|
891
|
+
onClick: w
|
|
892
|
+
}, "Show all"),
|
|
893
|
+
r[1] ||= s("span", { style: { color: "var(--st-text-placeholder)" } }, "|", -1),
|
|
894
|
+
s("button", {
|
|
895
|
+
class: "text-xs",
|
|
896
|
+
style: { color: "var(--st-text-secondary)" },
|
|
897
|
+
onClick: E
|
|
898
|
+
}, "Default")
|
|
899
|
+
])]), s("div", Ue, [
|
|
900
|
+
u.value ? (y(), o("div", We, C(t.tableName), 1)) : a("", !0),
|
|
901
|
+
(y(!0), o(e, null, S(f.value, (e) => (y(), o("button", {
|
|
902
|
+
key: "p-" + e.id,
|
|
903
|
+
class: "w-full text-left px-3 py-1.5 flex items-center gap-2.5 transition-colors hover-menu-item",
|
|
904
|
+
onClick: (t) => b(e.id)
|
|
905
|
+
}, [
|
|
906
|
+
s("span", {
|
|
907
|
+
class: "w-4 h-4 rounded border flex items-center justify-center shrink-0 transition-colors",
|
|
908
|
+
style: g(e.isVisible ? {
|
|
909
|
+
backgroundColor: "var(--st-accent)",
|
|
910
|
+
borderColor: "var(--st-accent)"
|
|
911
|
+
} : {
|
|
912
|
+
borderColor: "var(--st-border-tertiary)",
|
|
913
|
+
backgroundColor: "transparent"
|
|
914
|
+
})
|
|
915
|
+
}, [e.isVisible ? (y(), o("svg", Ke, [...r[2] ||= [s("path", { d: "M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z" }, null, -1)]])) : a("", !0)], 4),
|
|
916
|
+
s("span", {
|
|
917
|
+
class: "truncate",
|
|
918
|
+
style: g({ color: e.isVisible ? "var(--st-text)" : "var(--st-text-tertiary)" })
|
|
919
|
+
}, C(e.id), 5),
|
|
920
|
+
T(l) ? (y(), o("span", qe, C(e.type), 1)) : a("", !0)
|
|
921
|
+
], 8, Ge))), 128)),
|
|
922
|
+
u.value ? (y(), o(e, { key: 1 }, [
|
|
923
|
+
r[4] ||= s("div", {
|
|
924
|
+
class: "my-1",
|
|
925
|
+
style: { borderTop: "1px solid var(--st-border-secondary)" }
|
|
926
|
+
}, null, -1),
|
|
927
|
+
r[5] ||= s("div", {
|
|
928
|
+
class: "px-3 py-1 text-xs font-medium uppercase tracking-wide",
|
|
929
|
+
style: { color: "var(--st-text-placeholder)" }
|
|
930
|
+
}, " Sub-table ", -1),
|
|
931
|
+
(y(!0), o(e, null, S(p.value, (e) => (y(), o("button", {
|
|
932
|
+
key: "s-" + e.id,
|
|
933
|
+
class: "w-full text-left px-3 py-1.5 flex items-center gap-2.5 transition-colors hover-menu-item",
|
|
934
|
+
onClick: (t) => x(e.id)
|
|
935
|
+
}, [
|
|
936
|
+
s("span", {
|
|
937
|
+
class: "w-4 h-4 rounded border flex items-center justify-center shrink-0 transition-colors",
|
|
938
|
+
style: g(e.isVisible ? {
|
|
939
|
+
backgroundColor: "var(--st-accent)",
|
|
940
|
+
borderColor: "var(--st-accent)"
|
|
941
|
+
} : {
|
|
942
|
+
borderColor: "var(--st-border-tertiary)",
|
|
943
|
+
backgroundColor: "transparent"
|
|
944
|
+
})
|
|
945
|
+
}, [e.isVisible ? (y(), o("svg", Ye, [...r[3] ||= [s("path", { d: "M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z" }, null, -1)]])) : a("", !0)], 4),
|
|
946
|
+
s("span", {
|
|
947
|
+
class: "truncate",
|
|
948
|
+
style: g({ color: e.isVisible ? "var(--st-text)" : "var(--st-text-tertiary)" })
|
|
949
|
+
}, C(e.id), 5),
|
|
950
|
+
T(l) ? (y(), o("span", Xe, C(e.type), 1)) : a("", !0)
|
|
951
|
+
], 8, Je))), 128))
|
|
952
|
+
], 64)) : a("", !0)
|
|
953
|
+
])]));
|
|
954
|
+
}
|
|
955
|
+
}, [["__scopeId", "data-v-c662bbfe"]]), $ = { style: {
|
|
956
|
+
borderBottom: "1px solid var(--st-border)",
|
|
957
|
+
backgroundColor: "var(--st-bg)"
|
|
958
|
+
} }, Qe = { class: "flex items-center gap-2 px-3 py-1.5" }, $e = ["disabled"], et = ["disabled"], tt = ["disabled"], nt = {
|
|
959
|
+
key: 0,
|
|
960
|
+
class: "absolute top-full left-0 mt-1 min-w-[12rem] rounded shadow-xl z-50 py-1 text-[13px]",
|
|
961
|
+
style: {
|
|
962
|
+
backgroundColor: "var(--st-bg-surface)",
|
|
963
|
+
border: "1px solid var(--st-border-secondary)"
|
|
964
|
+
}
|
|
965
|
+
}, rt = {
|
|
966
|
+
key: 0,
|
|
967
|
+
class: "my-1",
|
|
968
|
+
style: { borderTop: "1px solid var(--st-border-secondary)" }
|
|
969
|
+
}, it = ["disabled", "onClick"], at = ["innerHTML"], ot = { class: "flex-1" }, st = ["disabled"], ct = {
|
|
970
|
+
key: 3,
|
|
971
|
+
class: "absolute top-full right-0 mt-1 flex min-w-[11rem] w-max flex-col items-stretch rounded shadow-xl z-50 py-1 text-[13px]",
|
|
972
|
+
style: {
|
|
973
|
+
backgroundColor: "var(--st-bg-surface)",
|
|
974
|
+
border: "1px solid var(--st-border-secondary)"
|
|
975
|
+
}
|
|
976
|
+
}, lt = ["onClick"], ut = ["innerHTML"], dt = { class: "shrink-0 whitespace-nowrap" }, ft = /* @__PURE__ */ B({
|
|
977
|
+
__name: "TableToolbar",
|
|
978
|
+
props: {
|
|
979
|
+
table: {
|
|
980
|
+
type: Object,
|
|
981
|
+
required: !0
|
|
982
|
+
},
|
|
983
|
+
sorting: {
|
|
984
|
+
type: Array,
|
|
985
|
+
default: () => []
|
|
986
|
+
},
|
|
987
|
+
columnFilters: {
|
|
988
|
+
type: Array,
|
|
989
|
+
default: () => []
|
|
990
|
+
},
|
|
991
|
+
columnVisibility: {
|
|
992
|
+
type: Object,
|
|
993
|
+
default: () => ({})
|
|
994
|
+
},
|
|
995
|
+
defaultColumnVisibility: {
|
|
996
|
+
type: Object,
|
|
997
|
+
default: () => ({})
|
|
998
|
+
},
|
|
999
|
+
editable: {
|
|
1000
|
+
type: Object,
|
|
1001
|
+
default: () => ({
|
|
1002
|
+
insert: !0,
|
|
1003
|
+
update: !0,
|
|
1004
|
+
delete: !0
|
|
1005
|
+
})
|
|
1006
|
+
},
|
|
1007
|
+
loading: {
|
|
1008
|
+
type: Boolean,
|
|
1009
|
+
default: !1
|
|
1010
|
+
},
|
|
1011
|
+
defaultInsertLabel: {
|
|
1012
|
+
type: String,
|
|
1013
|
+
default: null
|
|
1014
|
+
},
|
|
1015
|
+
insertActions: {
|
|
1016
|
+
type: Array,
|
|
1017
|
+
default: () => []
|
|
1018
|
+
},
|
|
1019
|
+
toolbarActions: {
|
|
1020
|
+
type: Array,
|
|
1021
|
+
default: () => []
|
|
1022
|
+
},
|
|
1023
|
+
toolbarActionsLabel: {
|
|
1024
|
+
type: String,
|
|
1025
|
+
default: "Actions"
|
|
1026
|
+
},
|
|
1027
|
+
subTableColumns: {
|
|
1028
|
+
type: Array,
|
|
1029
|
+
default: null
|
|
1030
|
+
},
|
|
1031
|
+
subTableSorting: {
|
|
1032
|
+
type: Array,
|
|
1033
|
+
default: () => []
|
|
1034
|
+
},
|
|
1035
|
+
subTableColumnFilters: {
|
|
1036
|
+
type: Array,
|
|
1037
|
+
default: () => []
|
|
1038
|
+
},
|
|
1039
|
+
subTableColumnVisibility: {
|
|
1040
|
+
type: Object,
|
|
1041
|
+
default: () => ({})
|
|
1042
|
+
},
|
|
1043
|
+
tableName: {
|
|
1044
|
+
type: String,
|
|
1045
|
+
default: "table"
|
|
1046
|
+
},
|
|
1047
|
+
isEmpty: {
|
|
1048
|
+
type: Boolean,
|
|
1049
|
+
default: !1
|
|
1050
|
+
}
|
|
1051
|
+
},
|
|
1052
|
+
emits: [
|
|
1053
|
+
"update:sorting",
|
|
1054
|
+
"update:column-filters",
|
|
1055
|
+
"update:column-visibility",
|
|
1056
|
+
"update:sub-table-sorting",
|
|
1057
|
+
"update:sub-table-column-filters",
|
|
1058
|
+
"update:sub-table-column-visibility",
|
|
1059
|
+
"insert-row",
|
|
1060
|
+
"insert-action",
|
|
1061
|
+
"refresh",
|
|
1062
|
+
"toolbar-action"
|
|
1063
|
+
],
|
|
1064
|
+
setup(t, { emit: n }) {
|
|
1065
|
+
let c = t, d = n, f = x(!1), p = x(!1), m = x(!1), _ = x(!1), v = x(null), b = x(null), w = x(null), T = x(null);
|
|
1066
|
+
R(v, () => {
|
|
1067
|
+
f.value = !1;
|
|
1068
|
+
}), R(b, () => {
|
|
1069
|
+
_.value = !1;
|
|
1070
|
+
}), R(w, () => {
|
|
1071
|
+
m.value = !1;
|
|
1072
|
+
}), R(T, () => {
|
|
1073
|
+
p.value = !1;
|
|
1074
|
+
});
|
|
1075
|
+
function E(e) {
|
|
1076
|
+
e.disabled || (d("toolbar-action", e.key), _.value = !1);
|
|
1077
|
+
}
|
|
1078
|
+
let D = r(() => c.sorting.length + c.subTableSorting.length);
|
|
1079
|
+
r(() => c.columnFilters.length + c.subTableColumnFilters.length);
|
|
1080
|
+
let O = r(() => Object.values(c.columnVisibility).filter((e) => e === !1).length + Object.values(c.subTableColumnVisibility).filter((e) => e === !1).length), k = r(() => {
|
|
1081
|
+
let e = c.columnVisibility, t = c.defaultColumnVisibility, n = c.table.getAllColumns().map((e) => e.id);
|
|
1082
|
+
for (let r of n) if (e[r] !== !1 != (t[r] !== !1)) return !1;
|
|
1083
|
+
for (let e of Object.values(c.subTableColumnVisibility)) if (e === !1) return !1;
|
|
1084
|
+
return !0;
|
|
1085
|
+
}), A = r(() => c.table.getAllColumns().map((e) => ({
|
|
1086
|
+
id: e.id,
|
|
1087
|
+
type: e.columnDef.meta?.type || "text"
|
|
1088
|
+
}))), j = r(() => c.subTableColumns ? c.subTableColumns.map((e) => ({
|
|
1089
|
+
id: e.accessorKey || e.id || e.header,
|
|
1090
|
+
type: e.meta?.type || e.columnDef?.meta?.type || "text"
|
|
1091
|
+
})) : null);
|
|
1092
|
+
return (n, r) => (y(), o("div", $, [s("div", Qe, [
|
|
1093
|
+
u(Be, {
|
|
1094
|
+
table: t.table,
|
|
1095
|
+
"column-filters": t.columnFilters,
|
|
1096
|
+
"all-columns": A.value,
|
|
1097
|
+
"sub-table-columns": j.value,
|
|
1098
|
+
"sub-table-column-filters": t.subTableColumnFilters,
|
|
1099
|
+
"table-name": t.tableName,
|
|
1100
|
+
"onUpdate:columnFilters": r[0] ||= (e) => d("update:column-filters", e),
|
|
1101
|
+
"onUpdate:subTableColumnFilters": r[1] ||= (e) => d("update:sub-table-column-filters", e),
|
|
1102
|
+
class: "flex-1",
|
|
1103
|
+
style: g(t.isEmpty ? {
|
|
1104
|
+
opacity: .4,
|
|
1105
|
+
pointerEvents: "none"
|
|
1106
|
+
} : {})
|
|
1107
|
+
}, null, 8, [
|
|
1108
|
+
"table",
|
|
1109
|
+
"column-filters",
|
|
1110
|
+
"all-columns",
|
|
1111
|
+
"sub-table-columns",
|
|
1112
|
+
"sub-table-column-filters",
|
|
1113
|
+
"table-name",
|
|
1114
|
+
"style"
|
|
1115
|
+
]),
|
|
1116
|
+
s("button", {
|
|
1117
|
+
class: "p-1.5 rounded transition-colors",
|
|
1118
|
+
style: { color: "var(--st-text-secondary)" },
|
|
1119
|
+
disabled: t.loading,
|
|
1120
|
+
title: "Refresh",
|
|
1121
|
+
onClick: r[2] ||= (e) => d("refresh")
|
|
1122
|
+
}, [(y(), o("svg", {
|
|
1123
|
+
class: h(["w-4 h-4", t.loading ? "animate-spin" : ""]),
|
|
1124
|
+
viewBox: "0 0 16 16",
|
|
1125
|
+
fill: "currentColor"
|
|
1126
|
+
}, [...r[18] ||= [s("path", { d: "M8 3a5 5 0 104.546 2.914.5.5 0 01.908-.418A6 6 0 118 2v1z" }, null, -1), s("path", { d: "M8 4.466V.534a.25.25 0 01.41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 018 4.466z" }, null, -1)]], 2))], 8, $e),
|
|
1127
|
+
s("div", {
|
|
1128
|
+
ref_key: "sortContainerRef",
|
|
1129
|
+
ref: v,
|
|
1130
|
+
class: "relative"
|
|
1131
|
+
}, [s("button", {
|
|
1132
|
+
class: "flex items-center gap-1.5 px-2.5 py-1 rounded text-[13px] transition-colors",
|
|
1133
|
+
style: g(t.isEmpty ? {
|
|
1134
|
+
border: "1px solid var(--st-border-secondary)",
|
|
1135
|
+
color: "var(--st-text-secondary)",
|
|
1136
|
+
opacity: .4,
|
|
1137
|
+
cursor: "default"
|
|
1138
|
+
} : D.value > 0 ? {
|
|
1139
|
+
border: "1px solid var(--st-accent-border)",
|
|
1140
|
+
color: "var(--st-accent)",
|
|
1141
|
+
backgroundColor: "var(--st-accent-bg)"
|
|
1142
|
+
} : {
|
|
1143
|
+
border: "1px solid var(--st-border-secondary)",
|
|
1144
|
+
color: "var(--st-text-secondary)"
|
|
1145
|
+
}),
|
|
1146
|
+
disabled: t.isEmpty,
|
|
1147
|
+
onClick: r[3] ||= (e) => !t.isEmpty && (f.value = !f.value)
|
|
1148
|
+
}, [r[19] ||= s("svg", {
|
|
1149
|
+
class: "w-3.5 h-3.5",
|
|
1150
|
+
viewBox: "0 0 16 16",
|
|
1151
|
+
fill: "currentColor"
|
|
1152
|
+
}, [s("path", { d: "M3.5 2.5a.5.5 0 00-1 0v9.793l-1.146-1.147a.5.5 0 00-.708.708l2 2a.5.5 0 00.708 0l2-2a.5.5 0 00-.708-.708L3.5 12.293V2.5zm4 .5a.5.5 0 010-1h1a.5.5 0 010 1h-1zm0 3a.5.5 0 010-1h3a.5.5 0 010 1h-3zm0 3a.5.5 0 010-1h5a.5.5 0 010 1h-5zm0 3a.5.5 0 010-1h7a.5.5 0 010 1h-7z" })], -1), D.value > 0 ? (y(), o(e, { key: 0 }, [l(" Sorted by " + C(D.value) + " rule" + C(D.value > 1 ? "s" : ""), 1)], 64)) : (y(), o(e, { key: 1 }, [l("Sort")], 64))], 12, et), f.value ? (y(), i(he, {
|
|
1153
|
+
key: 0,
|
|
1154
|
+
table: t.table,
|
|
1155
|
+
sorting: t.sorting,
|
|
1156
|
+
"all-columns": A.value,
|
|
1157
|
+
"sub-table-columns": j.value,
|
|
1158
|
+
"sub-table-sorting": t.subTableSorting,
|
|
1159
|
+
"table-name": t.tableName,
|
|
1160
|
+
"onUpdate:sorting": r[4] ||= (e) => d("update:sorting", e),
|
|
1161
|
+
"onUpdate:subTableSorting": r[5] ||= (e) => d("update:sub-table-sorting", e),
|
|
1162
|
+
onClose: r[6] ||= (e) => f.value = !1
|
|
1163
|
+
}, null, 8, [
|
|
1164
|
+
"table",
|
|
1165
|
+
"sorting",
|
|
1166
|
+
"all-columns",
|
|
1167
|
+
"sub-table-columns",
|
|
1168
|
+
"sub-table-sorting",
|
|
1169
|
+
"table-name"
|
|
1170
|
+
])) : a("", !0)], 512),
|
|
1171
|
+
t.toolbarActions.length > 0 ? (y(), o("div", {
|
|
1172
|
+
key: 0,
|
|
1173
|
+
ref_key: "actionsContainerRef",
|
|
1174
|
+
ref: b,
|
|
1175
|
+
class: "relative"
|
|
1176
|
+
}, [s("button", {
|
|
1177
|
+
class: "flex items-center gap-1.5 px-2.5 py-1 rounded text-[13px] transition-colors",
|
|
1178
|
+
style: g(t.isEmpty ? {
|
|
1179
|
+
border: "1px solid var(--st-border-secondary)",
|
|
1180
|
+
color: "var(--st-text-secondary)",
|
|
1181
|
+
opacity: .4,
|
|
1182
|
+
cursor: "default"
|
|
1183
|
+
} : {
|
|
1184
|
+
border: "1px solid var(--st-border-secondary)",
|
|
1185
|
+
color: "var(--st-text-secondary)"
|
|
1186
|
+
}),
|
|
1187
|
+
disabled: t.isEmpty,
|
|
1188
|
+
onClick: r[7] ||= (e) => !t.isEmpty && (_.value = !_.value)
|
|
1189
|
+
}, [
|
|
1190
|
+
r[20] ||= s("svg", {
|
|
1191
|
+
class: "w-3.5 h-3.5",
|
|
1192
|
+
viewBox: "0 0 16 16",
|
|
1193
|
+
fill: "currentColor"
|
|
1194
|
+
}, [s("path", { d: "M8 4a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm0 5a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm0 5a1.5 1.5 0 110-3 1.5 1.5 0 010 3z" })], -1),
|
|
1195
|
+
l(" " + C(t.toolbarActionsLabel) + " ", 1),
|
|
1196
|
+
r[21] ||= s("svg", {
|
|
1197
|
+
class: "w-3 h-3 opacity-60",
|
|
1198
|
+
viewBox: "0 0 16 16",
|
|
1199
|
+
fill: "currentColor"
|
|
1200
|
+
}, [s("path", { d: "M4.427 6.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 6H4.604a.25.25 0 00-.177.427z" })], -1)
|
|
1201
|
+
], 12, tt), _.value ? (y(), o("div", nt, [(y(!0), o(e, null, S(t.toolbarActions, (t, n) => (y(), o(e, { key: t.key ?? `divider-${n}` }, [t.divider ? (y(), o("div", rt)) : (y(), o("button", {
|
|
1202
|
+
key: 1,
|
|
1203
|
+
class: "w-full text-left px-3 py-1.5 hover-menu-item flex items-center gap-2",
|
|
1204
|
+
style: g({
|
|
1205
|
+
color: "var(--st-text)",
|
|
1206
|
+
opacity: t.disabled ? .4 : 1,
|
|
1207
|
+
cursor: t.disabled ? "not-allowed" : "pointer"
|
|
1208
|
+
}),
|
|
1209
|
+
disabled: t.disabled,
|
|
1210
|
+
onClick: (e) => E(t)
|
|
1211
|
+
}, [t.icon ? (y(), o("span", {
|
|
1212
|
+
key: 0,
|
|
1213
|
+
class: "shrink-0 flex items-center",
|
|
1214
|
+
innerHTML: t.icon
|
|
1215
|
+
}, null, 8, at)) : a("", !0), s("span", ot, C(t.label), 1)], 12, it))], 64))), 128))])) : a("", !0)], 512)) : a("", !0),
|
|
1216
|
+
s("div", {
|
|
1217
|
+
ref_key: "columnsContainerRef",
|
|
1218
|
+
ref: w,
|
|
1219
|
+
class: "relative"
|
|
1220
|
+
}, [s("button", {
|
|
1221
|
+
class: "flex items-center gap-1.5 px-2.5 py-1 rounded text-[13px] transition-colors",
|
|
1222
|
+
style: g(t.isEmpty ? {
|
|
1223
|
+
border: "1px solid var(--st-border-secondary)",
|
|
1224
|
+
color: "var(--st-text-secondary)",
|
|
1225
|
+
opacity: .4,
|
|
1226
|
+
cursor: "default"
|
|
1227
|
+
} : k.value ? {
|
|
1228
|
+
border: "1px solid var(--st-border-secondary)",
|
|
1229
|
+
color: "var(--st-text-secondary)"
|
|
1230
|
+
} : {
|
|
1231
|
+
border: "1px solid var(--st-accent-border)",
|
|
1232
|
+
color: "var(--st-accent)",
|
|
1233
|
+
backgroundColor: "var(--st-accent-bg)"
|
|
1234
|
+
}),
|
|
1235
|
+
disabled: t.isEmpty,
|
|
1236
|
+
onClick: r[8] ||= (e) => !t.isEmpty && (m.value = !m.value)
|
|
1237
|
+
}, [r[22] ||= s("svg", {
|
|
1238
|
+
class: "w-3.5 h-3.5",
|
|
1239
|
+
viewBox: "0 0 16 16",
|
|
1240
|
+
fill: "currentColor"
|
|
1241
|
+
}, [s("path", { d: "M1.5 2A1.5 1.5 0 000 3.5v9A1.5 1.5 0 001.5 14h13a1.5 1.5 0 001.5-1.5v-9A1.5 1.5 0 0014.5 2h-13zM1 3.5a.5.5 0 01.5-.5H5v10H1.5a.5.5 0 01-.5-.5v-9zM6 13V3h4v10H6zm5 0V3h3.5a.5.5 0 01.5.5v9a.5.5 0 01-.5.5H11z" })], -1), k.value ? (y(), o(e, { key: 0 }, [l("Columns")], 64)) : (y(), o(e, { key: 1 }, [l(C(O.value) + " hidden", 1)], 64))], 12, st), m.value ? (y(), i(Ze, {
|
|
1242
|
+
key: 0,
|
|
1243
|
+
table: t.table,
|
|
1244
|
+
"column-visibility": t.columnVisibility,
|
|
1245
|
+
"default-column-visibility": t.defaultColumnVisibility,
|
|
1246
|
+
"sub-table-columns": j.value,
|
|
1247
|
+
"sub-table-column-visibility": t.subTableColumnVisibility,
|
|
1248
|
+
"table-name": t.tableName,
|
|
1249
|
+
"onUpdate:columnVisibility": r[9] ||= (e) => d("update:column-visibility", e),
|
|
1250
|
+
"onUpdate:subTableColumnVisibility": r[10] ||= (e) => d("update:sub-table-column-visibility", e),
|
|
1251
|
+
onClose: r[11] ||= (e) => m.value = !1
|
|
1252
|
+
}, null, 8, [
|
|
1253
|
+
"table",
|
|
1254
|
+
"column-visibility",
|
|
1255
|
+
"default-column-visibility",
|
|
1256
|
+
"sub-table-columns",
|
|
1257
|
+
"sub-table-column-visibility",
|
|
1258
|
+
"table-name"
|
|
1259
|
+
])) : a("", !0)], 512),
|
|
1260
|
+
t.editable.insert ? (y(), o("div", {
|
|
1261
|
+
key: 1,
|
|
1262
|
+
ref_key: "insertContainerRef",
|
|
1263
|
+
ref: T,
|
|
1264
|
+
class: "relative"
|
|
1265
|
+
}, [t.defaultInsertLabel && t.insertActions.length > 0 ? (y(), o("button", {
|
|
1266
|
+
key: 0,
|
|
1267
|
+
class: "flex items-center gap-1.5 px-3 py-1 rounded text-[13px] font-medium transition-colors",
|
|
1268
|
+
style: {
|
|
1269
|
+
backgroundColor: "var(--st-accent)",
|
|
1270
|
+
color: "var(--st-text-on-accent)"
|
|
1271
|
+
},
|
|
1272
|
+
onClick: r[12] ||= (e) => p.value = !p.value
|
|
1273
|
+
}, [l(C(t.defaultInsertLabel) + " ", 1), r[23] ||= s("svg", {
|
|
1274
|
+
class: "w-3 h-3",
|
|
1275
|
+
viewBox: "0 0 16 16",
|
|
1276
|
+
fill: "currentColor"
|
|
1277
|
+
}, [s("path", { d: "M4.427 6.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 6H4.604a.25.25 0 00-.177.427z" })], -1)])) : t.defaultInsertLabel ? (y(), o("button", {
|
|
1278
|
+
key: 1,
|
|
1279
|
+
class: "flex items-center gap-1.5 px-3 py-1 rounded text-[13px] font-medium transition-colors",
|
|
1280
|
+
style: {
|
|
1281
|
+
backgroundColor: "var(--st-accent)",
|
|
1282
|
+
color: "var(--st-text-on-accent)"
|
|
1283
|
+
},
|
|
1284
|
+
onClick: r[13] ||= (e) => d("insert-row")
|
|
1285
|
+
}, C(t.defaultInsertLabel), 1)) : (y(), o("button", {
|
|
1286
|
+
key: 2,
|
|
1287
|
+
class: "flex items-center gap-1.5 px-3 py-1 rounded text-[13px] font-medium transition-colors",
|
|
1288
|
+
style: {
|
|
1289
|
+
backgroundColor: "var(--st-accent)",
|
|
1290
|
+
color: "var(--st-text-on-accent)"
|
|
1291
|
+
},
|
|
1292
|
+
onClick: r[14] ||= (e) => p.value = !p.value
|
|
1293
|
+
}, [...r[24] ||= [l(" Insert ", -1), s("svg", {
|
|
1294
|
+
class: "w-3 h-3",
|
|
1295
|
+
viewBox: "0 0 16 16",
|
|
1296
|
+
fill: "currentColor"
|
|
1297
|
+
}, [s("path", { d: "M4.427 6.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 6H4.604a.25.25 0 00-.177.427z" })], -1)]])), p.value ? (y(), o("div", ct, [t.insertActions.length > 0 ? (y(!0), o(e, { key: 0 }, S(t.insertActions, (e) => (y(), o("button", {
|
|
1298
|
+
key: e.key,
|
|
1299
|
+
class: "flex items-center gap-2 whitespace-nowrap text-left px-3 py-1.5 hover-menu-item",
|
|
1300
|
+
style: { color: "var(--st-text)" },
|
|
1301
|
+
onClick: (t) => {
|
|
1302
|
+
d("insert-action", e.key), p.value = !1;
|
|
1303
|
+
}
|
|
1304
|
+
}, [e.icon ? (y(), o("span", {
|
|
1305
|
+
key: 0,
|
|
1306
|
+
class: "w-3.5 h-3.5 shrink-0 flex items-center justify-center",
|
|
1307
|
+
innerHTML: e.icon
|
|
1308
|
+
}, null, 8, ut)) : a("", !0), s("span", dt, C(e.label), 1)], 8, lt))), 128)) : (y(), o(e, { key: 1 }, [
|
|
1309
|
+
s("button", {
|
|
1310
|
+
class: "whitespace-nowrap text-left px-3 py-1.5 hover-menu-item",
|
|
1311
|
+
style: { color: "var(--st-text)" },
|
|
1312
|
+
onClick: r[15] ||= (e) => {
|
|
1313
|
+
d("insert-row"), p.value = !1;
|
|
1314
|
+
}
|
|
1315
|
+
}, " Insert row "),
|
|
1316
|
+
s("button", {
|
|
1317
|
+
class: "whitespace-nowrap text-left px-3 py-1.5 hover-menu-item",
|
|
1318
|
+
style: { color: "var(--st-text)" },
|
|
1319
|
+
onClick: r[16] ||= (e) => p.value = !1
|
|
1320
|
+
}, " Insert column "),
|
|
1321
|
+
r[25] ||= s("div", {
|
|
1322
|
+
class: "my-1",
|
|
1323
|
+
style: { borderTop: "1px solid var(--st-border-secondary)" }
|
|
1324
|
+
}, null, -1),
|
|
1325
|
+
s("button", {
|
|
1326
|
+
class: "whitespace-nowrap text-left px-3 py-1.5 hover-menu-item",
|
|
1327
|
+
style: { color: "var(--st-text)" },
|
|
1328
|
+
onClick: r[17] ||= (e) => p.value = !1
|
|
1329
|
+
}, " Import data from CSV ")
|
|
1330
|
+
], 64))])) : a("", !0)], 512)) : a("", !0)
|
|
1331
|
+
])]));
|
|
1332
|
+
}
|
|
1333
|
+
}, [["__scopeId", "data-v-7857cf96"]]);
|
|
1334
|
+
//#endregion
|
|
1335
|
+
//#region src/components/DataTable/rowActionDestructive.js
|
|
1336
|
+
function pt(e) {
|
|
1337
|
+
return typeof e != "object" || !e || e.divider === !0 ? !1 : e.danger === !0 || e.variant === "destructive" ? !0 : /^delete/i.test(String(e.key ?? ""));
|
|
1338
|
+
}
|
|
1339
|
+
//#endregion
|
|
1340
|
+
//#region src/components/DataTable/SelectionToolbar.vue
|
|
1341
|
+
var mt = {
|
|
1342
|
+
class: "px-3 py-1.5 flex items-center gap-2",
|
|
1343
|
+
style: {
|
|
1344
|
+
borderBottom: "1px solid var(--st-border)",
|
|
1345
|
+
backgroundColor: "var(--st-bg)"
|
|
1346
|
+
}
|
|
1347
|
+
}, ht = {
|
|
1348
|
+
class: "text-[13px]",
|
|
1349
|
+
style: { color: "var(--st-text)" }
|
|
1350
|
+
}, gt = {
|
|
1351
|
+
key: 0,
|
|
1352
|
+
class: "absolute top-full left-0 mt-1 w-48 rounded shadow-xl z-50 py-1 text-[13px]",
|
|
1353
|
+
style: {
|
|
1354
|
+
backgroundColor: "var(--st-bg-surface)",
|
|
1355
|
+
border: "1px solid var(--st-border-secondary)"
|
|
1356
|
+
}
|
|
1357
|
+
}, _t = {
|
|
1358
|
+
key: 0,
|
|
1359
|
+
class: "my-1",
|
|
1360
|
+
style: { borderTop: "1px solid var(--st-border-secondary)" }
|
|
1361
|
+
}, vt = ["disabled", "onClick"], yt = ["innerHTML"], bt = ["onClick"], xt = /* @__PURE__ */ B({
|
|
1362
|
+
__name: "SelectionToolbar",
|
|
1363
|
+
props: {
|
|
1364
|
+
selectedCount: {
|
|
1365
|
+
type: Number,
|
|
1366
|
+
required: !0
|
|
1367
|
+
},
|
|
1368
|
+
table: {
|
|
1369
|
+
type: Object,
|
|
1370
|
+
required: !0
|
|
1371
|
+
},
|
|
1372
|
+
editable: {
|
|
1373
|
+
type: Object,
|
|
1374
|
+
default: () => ({
|
|
1375
|
+
insert: !0,
|
|
1376
|
+
update: !0,
|
|
1377
|
+
delete: !0
|
|
1378
|
+
})
|
|
1379
|
+
},
|
|
1380
|
+
selectionActions: {
|
|
1381
|
+
type: Array,
|
|
1382
|
+
default: () => []
|
|
1383
|
+
},
|
|
1384
|
+
contextMenuActions: {
|
|
1385
|
+
type: Array,
|
|
1386
|
+
default: () => []
|
|
1387
|
+
},
|
|
1388
|
+
enableSelectAll: {
|
|
1389
|
+
type: Boolean,
|
|
1390
|
+
default: !0
|
|
1391
|
+
},
|
|
1392
|
+
totalFilteredCount: {
|
|
1393
|
+
type: Number,
|
|
1394
|
+
default: null
|
|
1395
|
+
},
|
|
1396
|
+
countLabelSingular: {
|
|
1397
|
+
type: String,
|
|
1398
|
+
default: "record"
|
|
1399
|
+
},
|
|
1400
|
+
countLabelPlural: {
|
|
1401
|
+
type: String,
|
|
1402
|
+
default: "records"
|
|
1403
|
+
},
|
|
1404
|
+
enableSelectAllMatching: {
|
|
1405
|
+
type: Boolean,
|
|
1406
|
+
default: !1
|
|
1407
|
+
}
|
|
1408
|
+
},
|
|
1409
|
+
emits: [
|
|
1410
|
+
"delete-confirm-request",
|
|
1411
|
+
"selection-action",
|
|
1412
|
+
"select-all-matching",
|
|
1413
|
+
"clear-full-selection"
|
|
1414
|
+
],
|
|
1415
|
+
setup(t, { emit: n }) {
|
|
1416
|
+
let i = d("tableSourceRows", null), c = t, u = r(() => c.totalFilteredCount == null ? (i != null && w(i), c.table.getFilteredRowModel().rows.length) : c.totalFilteredCount), f = r(() => c.selectedCount >= u.value && u.value > 0), p = n, m = x(!1), _ = x(null);
|
|
1417
|
+
R(_, () => {
|
|
1418
|
+
m.value = !1;
|
|
1419
|
+
});
|
|
1420
|
+
function v() {
|
|
1421
|
+
return c.table.getSelectedRowModel().rows.map((e) => e.original);
|
|
1422
|
+
}
|
|
1423
|
+
function b(e) {
|
|
1424
|
+
let t = v(), n = "";
|
|
1425
|
+
if (e === "json") n = JSON.stringify(t, null, 2);
|
|
1426
|
+
else if (e === "csv") {
|
|
1427
|
+
let e = Object.keys(t[0] || {});
|
|
1428
|
+
n = [e.join(","), ...t.map((t) => e.map((e) => JSON.stringify(t[e] ?? "")).join(","))].join("\n");
|
|
1429
|
+
} else if (e === "sql") {
|
|
1430
|
+
let e = Object.keys(t[0] || {});
|
|
1431
|
+
n = t.map((t) => {
|
|
1432
|
+
let n = e.map((e) => {
|
|
1433
|
+
let n = t[e];
|
|
1434
|
+
return n === null ? "NULL" : typeof n == "string" ? `'${n.replace(/'/g, "''")}'` : String(n);
|
|
1435
|
+
});
|
|
1436
|
+
return `INSERT INTO table_name (${e.join(", ")}) VALUES (${n.join(", ")});`;
|
|
1437
|
+
}).join("\n");
|
|
1438
|
+
}
|
|
1439
|
+
navigator.clipboard.writeText(n), m.value = !1;
|
|
1440
|
+
}
|
|
1441
|
+
function E(e) {
|
|
1442
|
+
let t = v(), n = "", r = "", i = "";
|
|
1443
|
+
if (e === "json") n = JSON.stringify(t, null, 2), r = "application/json", i = "export.json";
|
|
1444
|
+
else if (e === "csv") {
|
|
1445
|
+
let e = Object.keys(t[0] || {});
|
|
1446
|
+
n = [e.join(","), ...t.map((t) => e.map((e) => JSON.stringify(t[e] ?? "")).join(","))].join("\n"), r = "text/csv", i = "export.csv";
|
|
1447
|
+
} else if (e === "tsv") {
|
|
1448
|
+
let e = Object.keys(t[0] || {});
|
|
1449
|
+
n = [e.join(" "), ...t.map((t) => e.map((e) => {
|
|
1450
|
+
let n = t[e] ?? "";
|
|
1451
|
+
return String(n).replace(/\t/g, " ");
|
|
1452
|
+
}).join(" "))].join("\n"), r = "text/tab-separated-values", i = "export.tsv";
|
|
1453
|
+
}
|
|
1454
|
+
let a = new Blob([n], { type: r }), o = URL.createObjectURL(a), s = document.createElement("a");
|
|
1455
|
+
s.href = o, s.download = i, s.click(), URL.revokeObjectURL(o), m.value = !1;
|
|
1456
|
+
}
|
|
1457
|
+
function D(e) {
|
|
1458
|
+
if (e == null || e.divider) return !1;
|
|
1459
|
+
let t = e.disabled;
|
|
1460
|
+
return t == null || typeof t == "function" ? !1 : !!t;
|
|
1461
|
+
}
|
|
1462
|
+
function O(e) {
|
|
1463
|
+
e.divider || D(e) || (p("selection-action", e.key, v()), m.value = !1);
|
|
1464
|
+
}
|
|
1465
|
+
function k(e) {
|
|
1466
|
+
p("selection-action", e.key, v()), m.value = !1;
|
|
1467
|
+
}
|
|
1468
|
+
return (n, r) => (y(), o("div", mt, [
|
|
1469
|
+
s("span", ht, C(t.selectedCount) + " row" + C(t.selectedCount > 1 ? "s" : "") + " selected", 1),
|
|
1470
|
+
t.editable.delete ? (y(), o("button", {
|
|
1471
|
+
key: 0,
|
|
1472
|
+
class: "flex items-center gap-1.5 px-2.5 py-1 rounded text-[13px] transition-colors",
|
|
1473
|
+
style: {
|
|
1474
|
+
border: "1px solid rgba(239,68,68,0.4)",
|
|
1475
|
+
color: "#ef4444",
|
|
1476
|
+
"background-color": "rgba(239,68,68,0.1)"
|
|
1477
|
+
},
|
|
1478
|
+
onClick: r[0] ||= (e) => p("delete-confirm-request")
|
|
1479
|
+
}, [...r[11] ||= [s("svg", {
|
|
1480
|
+
class: "w-3.5 h-3.5",
|
|
1481
|
+
viewBox: "0 0 16 16",
|
|
1482
|
+
fill: "currentColor"
|
|
1483
|
+
}, [s("path", { d: "M6.5 1.75a.25.25 0 01.25-.25h2.5a.25.25 0 01.25.25V3h-3V1.75zM11 3V1.75C11 .784 10.216 0 9.25 0h-2.5C5.784 0 5 .784 5 1.75V3H2.75a.75.75 0 000 1.5h.31l.72 9.678A1.75 1.75 0 005.525 16h4.95a1.75 1.75 0 001.745-1.822L12.94 4.5h.31a.75.75 0 000-1.5H11z" })], -1), l(" Delete... ", -1)]])) : a("", !0),
|
|
1484
|
+
s("div", {
|
|
1485
|
+
ref_key: "actionsDropdownRef",
|
|
1486
|
+
ref: _,
|
|
1487
|
+
class: "relative"
|
|
1488
|
+
}, [s("button", {
|
|
1489
|
+
class: "flex items-center gap-1 px-2.5 py-1 rounded text-[13px] transition-colors",
|
|
1490
|
+
style: {
|
|
1491
|
+
border: "1px solid var(--st-border-secondary)",
|
|
1492
|
+
color: "var(--st-text-secondary)"
|
|
1493
|
+
},
|
|
1494
|
+
onClick: r[1] ||= (e) => m.value = !m.value
|
|
1495
|
+
}, [...r[12] ||= [l(" Actions ", -1), s("svg", {
|
|
1496
|
+
class: "w-3 h-3",
|
|
1497
|
+
viewBox: "0 0 16 16",
|
|
1498
|
+
fill: "currentColor"
|
|
1499
|
+
}, [s("path", { d: "M4.427 6.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 6H4.604a.25.25 0 00-.177.427z" })], -1)]]), m.value ? (y(), o("div", gt, [
|
|
1500
|
+
s("button", {
|
|
1501
|
+
class: "w-full text-left px-3 py-1.5 hover-menu-item",
|
|
1502
|
+
style: { color: "var(--st-text)" },
|
|
1503
|
+
onClick: r[2] ||= (e) => b("csv")
|
|
1504
|
+
}, "Copy as CSV"),
|
|
1505
|
+
s("button", {
|
|
1506
|
+
class: "w-full text-left px-3 py-1.5 hover-menu-item",
|
|
1507
|
+
style: { color: "var(--st-text)" },
|
|
1508
|
+
onClick: r[3] ||= (e) => b("sql")
|
|
1509
|
+
}, "Copy as SQL"),
|
|
1510
|
+
s("button", {
|
|
1511
|
+
class: "w-full text-left px-3 py-1.5 hover-menu-item",
|
|
1512
|
+
style: { color: "var(--st-text)" },
|
|
1513
|
+
onClick: r[4] ||= (e) => b("json")
|
|
1514
|
+
}, "Copy as JSON"),
|
|
1515
|
+
r[15] ||= s("div", {
|
|
1516
|
+
class: "my-1",
|
|
1517
|
+
style: { borderTop: "1px solid var(--st-border-secondary)" }
|
|
1518
|
+
}, null, -1),
|
|
1519
|
+
s("button", {
|
|
1520
|
+
class: "w-full text-left px-3 py-1.5 hover-menu-item",
|
|
1521
|
+
style: { color: "var(--st-text)" },
|
|
1522
|
+
onClick: r[5] ||= (e) => E("csv")
|
|
1523
|
+
}, "Download as CSV"),
|
|
1524
|
+
s("button", {
|
|
1525
|
+
class: "w-full text-left px-3 py-1.5 hover-menu-item",
|
|
1526
|
+
style: { color: "var(--st-text)" },
|
|
1527
|
+
onClick: r[6] ||= (e) => E("tsv")
|
|
1528
|
+
}, "Download as TSV"),
|
|
1529
|
+
s("button", {
|
|
1530
|
+
class: "w-full text-left px-3 py-1.5 hover-menu-item",
|
|
1531
|
+
style: { color: "var(--st-text)" },
|
|
1532
|
+
onClick: r[7] ||= (e) => E("json")
|
|
1533
|
+
}, "Download as JSON"),
|
|
1534
|
+
t.contextMenuActions.length > 0 ? (y(), o(e, { key: 0 }, [r[13] ||= s("div", {
|
|
1535
|
+
class: "my-1",
|
|
1536
|
+
style: { borderTop: "1px solid var(--st-border-secondary)" }
|
|
1537
|
+
}, null, -1), (y(!0), o(e, null, S(t.contextMenuActions, (t, n) => (y(), o(e, { key: t.divider ? `divider-${n}` : t.key }, [t.divider ? (y(), o("div", _t)) : (y(), o("button", {
|
|
1538
|
+
key: 1,
|
|
1539
|
+
type: "button",
|
|
1540
|
+
class: h(["w-full text-left px-3 py-1.5 hover-menu-item flex items-center gap-2 disabled:pointer-events-none", { "opacity-40 cursor-not-allowed": D(t) }]),
|
|
1541
|
+
disabled: D(t),
|
|
1542
|
+
style: g({ color: T(pt)(t) ? "var(--st-danger)" : "var(--st-text)" }),
|
|
1543
|
+
onClick: (e) => O(t)
|
|
1544
|
+
}, [t.icon ? (y(), o("span", {
|
|
1545
|
+
key: 0,
|
|
1546
|
+
class: "shrink-0 w-3.5 h-3.5 inline-flex items-center justify-center [&_svg]:max-w-full [&_svg]:max-h-full",
|
|
1547
|
+
innerHTML: t.icon
|
|
1548
|
+
}, null, 8, yt)) : a("", !0), s("span", null, C(t.label), 1)], 14, vt))], 64))), 128))], 64)) : a("", !0),
|
|
1549
|
+
t.selectionActions.length > 0 ? (y(), o(e, { key: 1 }, [r[14] ||= s("div", {
|
|
1550
|
+
class: "my-1",
|
|
1551
|
+
style: { borderTop: "1px solid var(--st-border-secondary)" }
|
|
1552
|
+
}, null, -1), (y(!0), o(e, null, S(t.selectionActions, (e) => (y(), o("button", {
|
|
1553
|
+
key: e.key,
|
|
1554
|
+
class: "w-full text-left px-3 py-1.5 hover-menu-item",
|
|
1555
|
+
style: { color: "var(--st-text)" },
|
|
1556
|
+
onClick: (t) => k(e)
|
|
1557
|
+
}, C(e.label), 9, bt))), 128))], 64)) : a("", !0)
|
|
1558
|
+
])) : a("", !0)], 512),
|
|
1559
|
+
s("button", {
|
|
1560
|
+
class: "text-[13px] transition-colors",
|
|
1561
|
+
style: { color: "var(--st-text-secondary)" },
|
|
1562
|
+
onClick: r[8] ||= (e) => p("clear-full-selection")
|
|
1563
|
+
}, " Clear selection "),
|
|
1564
|
+
t.enableSelectAllMatching && t.totalFilteredCount != null && !f.value ? (y(), o("button", {
|
|
1565
|
+
key: 1,
|
|
1566
|
+
class: "text-[13px] transition-colors",
|
|
1567
|
+
style: { color: "var(--st-accent)" },
|
|
1568
|
+
type: "button",
|
|
1569
|
+
onClick: r[9] ||= (e) => p("select-all-matching")
|
|
1570
|
+
}, " Select all " + C(u.value) + " " + C(u.value === 1 ? t.countLabelSingular : t.countLabelPlural), 1)) : t.enableSelectAll && !t.enableSelectAllMatching && !f.value ? (y(), o("button", {
|
|
1571
|
+
key: 2,
|
|
1572
|
+
class: "text-[13px] transition-colors",
|
|
1573
|
+
style: { color: "var(--st-accent)" },
|
|
1574
|
+
type: "button",
|
|
1575
|
+
onClick: r[10] ||= (e) => t.table.toggleAllRowsSelected(!0)
|
|
1576
|
+
}, " Select all " + C(u.value) + " " + C(u.value === 1 ? t.countLabelSingular : t.countLabelPlural), 1)) : a("", !0),
|
|
1577
|
+
r[16] ||= s("div", { class: "flex-1" }, null, -1)
|
|
1578
|
+
]));
|
|
1579
|
+
}
|
|
1580
|
+
}, [["__scopeId", "data-v-10f6e0bb"]]), St = 22, Ct = 40;
|
|
1581
|
+
function wt(e) {
|
|
1582
|
+
return !Array.isArray(e) || e.length === 0 ? 0 : e.reduce((e, t) => t && typeof t == "object" && t.icon ? e + St : e + Ct, 0);
|
|
1583
|
+
}
|
|
1584
|
+
//#endregion
|
|
1585
|
+
//#region src/components/DataTable/TableColumnHeader.vue
|
|
1586
|
+
var Tt = { class: "flex items-center gap-1.5 px-2 py-1.5 cursor-default overflow-hidden" }, Et = {
|
|
1587
|
+
class: "shrink-0 text-[13px]",
|
|
1588
|
+
style: { color: "var(--st-text)" }
|
|
1589
|
+
}, Dt = {
|
|
1590
|
+
key: 0,
|
|
1591
|
+
class: "text-xs font-normal truncate min-w-0",
|
|
1592
|
+
style: { color: "var(--st-text-tertiary)" }
|
|
1593
|
+
}, Ot = {
|
|
1594
|
+
key: 1,
|
|
1595
|
+
class: "text-xs shrink-0",
|
|
1596
|
+
style: { color: "var(--st-accent)" }
|
|
1597
|
+
}, kt = {
|
|
1598
|
+
key: 2,
|
|
1599
|
+
class: "shrink-0 text-xs",
|
|
1600
|
+
style: { color: "var(--st-text-tertiary)" },
|
|
1601
|
+
title: "Column is frozen"
|
|
1602
|
+
}, At = /* @__PURE__ */ B({
|
|
1603
|
+
__name: "TableColumnHeader",
|
|
1604
|
+
props: {
|
|
1605
|
+
header: {
|
|
1606
|
+
type: Object,
|
|
1607
|
+
required: !0
|
|
1608
|
+
},
|
|
1609
|
+
table: {
|
|
1610
|
+
type: Object,
|
|
1611
|
+
required: !0
|
|
1612
|
+
}
|
|
1613
|
+
},
|
|
1614
|
+
setup(e) {
|
|
1615
|
+
let n = e, r = d("showDataTypes", !0), c = d("themeVars", {}), u = d("showRowBorders", !0), f = d("showColumnBorders", !0), p = x(!1), m = x({
|
|
1616
|
+
top: 0,
|
|
1617
|
+
left: 0
|
|
1618
|
+
}), _ = x(null), v = x(null), b = n.header.column.columnDef.meta || {};
|
|
1619
|
+
function S() {
|
|
1620
|
+
if (!p.value) {
|
|
1621
|
+
let e = v.value?.closest("th");
|
|
1622
|
+
if (e) {
|
|
1623
|
+
let t = e.getBoundingClientRect();
|
|
1624
|
+
m.value = {
|
|
1625
|
+
top: t.bottom + 2,
|
|
1626
|
+
left: t.left
|
|
1627
|
+
};
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
p.value = !p.value;
|
|
1631
|
+
}
|
|
1632
|
+
function w() {
|
|
1633
|
+
p.value = !1;
|
|
1634
|
+
}
|
|
1635
|
+
function E() {
|
|
1636
|
+
n.header.column.toggleSorting(!1), w();
|
|
1637
|
+
}
|
|
1638
|
+
function D() {
|
|
1639
|
+
n.header.column.toggleSorting(!0), w();
|
|
1640
|
+
}
|
|
1641
|
+
function O() {
|
|
1642
|
+
navigator.clipboard.writeText(n.header.column.id), w();
|
|
1643
|
+
}
|
|
1644
|
+
function k() {
|
|
1645
|
+
b && (b.isFrozen = !b.isFrozen), w();
|
|
1646
|
+
}
|
|
1647
|
+
function A(e) {
|
|
1648
|
+
let t = n.header.getResizeHandler();
|
|
1649
|
+
t && t(e);
|
|
1650
|
+
}
|
|
1651
|
+
function j() {
|
|
1652
|
+
let e = n.header.column.id, t = _.value;
|
|
1653
|
+
if (typeof document > "u" || !t) return;
|
|
1654
|
+
let i = document.createElement("canvas").getContext("2d");
|
|
1655
|
+
if (!i) return;
|
|
1656
|
+
let a = getComputedStyle(t).fontFamily;
|
|
1657
|
+
i.font = `13px ${a && a.trim() !== "" ? a : "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif"}`;
|
|
1658
|
+
let o = n.header.column, s = o.columnDef.meta || {}, c = typeof o.columnDef.header == "string" ? o.columnDef.header : String(o.id), l = i.measureText(c).width;
|
|
1659
|
+
if (r && s.type && (l += 6 + i.measureText(String(s.type)).width), !(s.type === "boolean" && !s.badge || s.progressBar)) {
|
|
1660
|
+
let e = o.columnDef.accessorKey ?? o.id, t = n.table.getFilteredRowModel().rows;
|
|
1661
|
+
for (let n = 0; n < t.length; n++) {
|
|
1662
|
+
let r = t[n].original?.[e];
|
|
1663
|
+
if (r == null) continue;
|
|
1664
|
+
let a = i.measureText(String(r)).width;
|
|
1665
|
+
a > l && (l = a);
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
Array.isArray(s.cellButtons) && s.cellButtons.length > 0 && (l += wt(s.cellButtons));
|
|
1669
|
+
let u = Math.ceil(l) + 16 + 28, d = Math.min(Math.max(u, 60), 500);
|
|
1670
|
+
n.table.options.onColumnSizingChange((t) => ({
|
|
1671
|
+
...t,
|
|
1672
|
+
[e]: d
|
|
1673
|
+
}));
|
|
1674
|
+
}
|
|
1675
|
+
return (n, d) => (y(), o("th", {
|
|
1676
|
+
ref_key: "thRef",
|
|
1677
|
+
ref: _,
|
|
1678
|
+
class: "relative z-[21] text-left font-normal select-none group/header",
|
|
1679
|
+
style: g({
|
|
1680
|
+
width: `${e.header.getSize()}px`,
|
|
1681
|
+
minWidth: `${e.header.getSize()}px`,
|
|
1682
|
+
backgroundColor: "var(--st-bg-header)",
|
|
1683
|
+
borderBottom: T(u) ? "1px solid var(--st-border)" : "none",
|
|
1684
|
+
borderRight: T(f) ? "1px solid var(--st-border)" : "none"
|
|
1685
|
+
})
|
|
1686
|
+
}, [
|
|
1687
|
+
s("div", Tt, [
|
|
1688
|
+
s("span", Et, [e.header.isPlaceholder ? a("", !0) : (y(), i(T(N), {
|
|
1689
|
+
key: 0,
|
|
1690
|
+
render: e.header.column.columnDef.header,
|
|
1691
|
+
props: e.header.getContext()
|
|
1692
|
+
}, null, 8, ["render", "props"]))]),
|
|
1693
|
+
T(r) ? (y(), o("span", Dt, C(T(b).type), 1)) : a("", !0),
|
|
1694
|
+
e.header.column.getIsSorted() ? (y(), o("span", Ot, C(e.header.column.getIsSorted() === "asc" ? "↑" : "↓"), 1)) : a("", !0),
|
|
1695
|
+
T(b).isFrozen ? (y(), o("span", kt, "❄")) : a("", !0),
|
|
1696
|
+
s("button", {
|
|
1697
|
+
ref_key: "triggerRef",
|
|
1698
|
+
ref: v,
|
|
1699
|
+
class: h(["ml-auto shrink-0 w-4 h-4 flex items-center justify-center opacity-0 group-hover/header:opacity-100 transition-opacity", { "!opacity-100": p.value }]),
|
|
1700
|
+
style: { color: "var(--st-text-tertiary)" },
|
|
1701
|
+
onClick: M(S, ["stop"])
|
|
1702
|
+
}, [...d[1] ||= [s("svg", {
|
|
1703
|
+
class: "w-3 h-3",
|
|
1704
|
+
viewBox: "0 0 16 16",
|
|
1705
|
+
fill: "currentColor"
|
|
1706
|
+
}, [s("path", { d: "M4.427 6.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 6H4.604a.25.25 0 00-.177.427z" })], -1)]], 2)
|
|
1707
|
+
]),
|
|
1708
|
+
(y(), i(t, { to: "body" }, [p.value ? (y(), o("div", {
|
|
1709
|
+
key: 0,
|
|
1710
|
+
class: "fixed inset-0 z-40",
|
|
1711
|
+
onClick: w
|
|
1712
|
+
})) : a("", !0), p.value ? (y(), o("div", {
|
|
1713
|
+
key: 1,
|
|
1714
|
+
class: "fixed w-52 rounded shadow-xl z-50 py-1 text-[13px]",
|
|
1715
|
+
style: g({
|
|
1716
|
+
...T(c),
|
|
1717
|
+
fontFamily: "var(--dt-font-family)",
|
|
1718
|
+
top: m.value.top + "px",
|
|
1719
|
+
left: m.value.left + "px",
|
|
1720
|
+
backgroundColor: "var(--st-bg-surface)",
|
|
1721
|
+
border: "1px solid var(--st-border-secondary)",
|
|
1722
|
+
color: "var(--st-text)"
|
|
1723
|
+
}),
|
|
1724
|
+
onClick: d[0] ||= M(() => {}, ["stop"])
|
|
1725
|
+
}, [
|
|
1726
|
+
s("button", {
|
|
1727
|
+
class: "w-full text-left px-3 py-1.5 flex items-center gap-2 hover-menu-item",
|
|
1728
|
+
style: { color: "var(--st-text)" },
|
|
1729
|
+
onClick: E
|
|
1730
|
+
}, [...d[2] ||= [s("span", {
|
|
1731
|
+
class: "w-4 text-center",
|
|
1732
|
+
style: { color: "var(--st-text-secondary)" }
|
|
1733
|
+
}, "↑", -1), l("Sort Ascending ", -1)]]),
|
|
1734
|
+
s("button", {
|
|
1735
|
+
class: "w-full text-left px-3 py-1.5 flex items-center gap-2 hover-menu-item",
|
|
1736
|
+
style: { color: "var(--st-text)" },
|
|
1737
|
+
onClick: D
|
|
1738
|
+
}, [...d[3] ||= [s("span", {
|
|
1739
|
+
class: "w-4 text-center",
|
|
1740
|
+
style: { color: "var(--st-text-secondary)" }
|
|
1741
|
+
}, "↓", -1), l("Sort Descending ", -1)]]),
|
|
1742
|
+
d[6] ||= s("div", {
|
|
1743
|
+
class: "my-1",
|
|
1744
|
+
style: { borderTop: "1px solid var(--st-border-secondary)" }
|
|
1745
|
+
}, null, -1),
|
|
1746
|
+
s("button", {
|
|
1747
|
+
class: "w-full text-left px-3 py-1.5 flex items-center gap-2 hover-menu-item",
|
|
1748
|
+
style: { color: "var(--st-text)" },
|
|
1749
|
+
onClick: O
|
|
1750
|
+
}, [...d[4] ||= [s("span", {
|
|
1751
|
+
class: "w-4 text-center",
|
|
1752
|
+
style: { color: "var(--st-text-secondary)" }
|
|
1753
|
+
}, [s("svg", {
|
|
1754
|
+
class: "w-3.5 h-3.5 inline",
|
|
1755
|
+
viewBox: "0 0 16 16",
|
|
1756
|
+
fill: "currentColor"
|
|
1757
|
+
}, [s("path", { d: "M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25zM5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25z" })])], -1), l(" Copy name ", -1)]]),
|
|
1758
|
+
s("button", {
|
|
1759
|
+
class: "w-full text-left px-3 py-1.5 flex items-center gap-2 hover-menu-item",
|
|
1760
|
+
style: { color: "var(--st-text)" },
|
|
1761
|
+
onClick: k
|
|
1762
|
+
}, [d[5] ||= s("span", {
|
|
1763
|
+
class: "w-4 text-center",
|
|
1764
|
+
style: { color: "var(--st-text-secondary)" }
|
|
1765
|
+
}, "❄", -1), l(" " + C(T(b).isFrozen ? "Unfreeze column" : "Freeze column"), 1)])
|
|
1766
|
+
], 4)) : a("", !0)])),
|
|
1767
|
+
s("div", {
|
|
1768
|
+
class: h(["absolute top-0 right-0 w-1 h-full cursor-col-resize hover:bg-blue-500/50 active:bg-blue-500", { "bg-blue-500": e.header.column.getIsResizing() }]),
|
|
1769
|
+
onMousedown: A,
|
|
1770
|
+
onTouchstart: A,
|
|
1771
|
+
onDblclick: M(j, ["stop"])
|
|
1772
|
+
}, null, 34)
|
|
1773
|
+
], 4));
|
|
1774
|
+
}
|
|
1775
|
+
}, [["__scopeId", "data-v-d19d2667"]]), jt = ["title"], Mt = {
|
|
1776
|
+
class: "text-xs",
|
|
1777
|
+
style: { color: "var(--st-text-secondary)" }
|
|
1778
|
+
}, Nt = {
|
|
1779
|
+
key: 1,
|
|
1780
|
+
class: "text-[13px]",
|
|
1781
|
+
style: { color: "var(--st-text)" }
|
|
1782
|
+
}, Pt = {
|
|
1783
|
+
key: 0,
|
|
1784
|
+
class: "italic",
|
|
1785
|
+
style: { color: "var(--st-text-placeholder)" }
|
|
1786
|
+
}, Ft = {
|
|
1787
|
+
class: "absolute -bottom-7 left-0 flex items-center gap-1 rounded shadow-lg px-2 py-1 z-20 text-xs whitespace-nowrap",
|
|
1788
|
+
style: {
|
|
1789
|
+
backgroundColor: "var(--st-bg-surface)",
|
|
1790
|
+
border: "1px solid var(--st-border-secondary)"
|
|
1791
|
+
}
|
|
1792
|
+
}, It = {
|
|
1793
|
+
key: 0,
|
|
1794
|
+
class: "flex items-center min-w-0"
|
|
1795
|
+
}, Lt = {
|
|
1796
|
+
key: 1,
|
|
1797
|
+
class: "flex items-center gap-2 min-w-0"
|
|
1798
|
+
}, Rt = {
|
|
1799
|
+
class: "rounded-full overflow-hidden flex shrink-0 flex-nowrap",
|
|
1800
|
+
style: {
|
|
1801
|
+
height: "6px",
|
|
1802
|
+
width: "80px",
|
|
1803
|
+
backgroundColor: "var(--st-border-secondary)"
|
|
1804
|
+
}
|
|
1805
|
+
}, zt = {
|
|
1806
|
+
class: "flex flex-col shrink-0",
|
|
1807
|
+
style: { gap: "1px" }
|
|
1808
|
+
}, Bt = {
|
|
1809
|
+
key: 3,
|
|
1810
|
+
class: "flex items-center gap-2"
|
|
1811
|
+
}, Vt = {
|
|
1812
|
+
class: "flex-1 rounded-full overflow-hidden",
|
|
1813
|
+
style: {
|
|
1814
|
+
height: "6px",
|
|
1815
|
+
backgroundColor: "var(--st-border-secondary)"
|
|
1816
|
+
}
|
|
1817
|
+
}, Ht = {
|
|
1818
|
+
class: "text-xs shrink-0 tabular-nums",
|
|
1819
|
+
style: { color: "var(--st-text-secondary)" }
|
|
1820
|
+
}, Ut = {
|
|
1821
|
+
class: "flex flex-col gap-0.5 flex-1 min-w-0 text-[13px]",
|
|
1822
|
+
style: { color: "var(--st-text)" }
|
|
1823
|
+
}, Wt = {
|
|
1824
|
+
key: 0,
|
|
1825
|
+
class: "italic",
|
|
1826
|
+
style: { color: "var(--st-text-placeholder)" }
|
|
1827
|
+
}, Gt = {
|
|
1828
|
+
key: 2,
|
|
1829
|
+
class: "block whitespace-pre-wrap break-words"
|
|
1830
|
+
}, Kt = ["title"], qt = ["title"], Jt = ["innerHTML"], Yt = ["title", "onClick"], Xt = ["innerHTML"], Zt = { key: 1 }, Qt = {
|
|
1831
|
+
__name: "TableCell",
|
|
1832
|
+
props: {
|
|
1833
|
+
cell: {
|
|
1834
|
+
type: Object,
|
|
1835
|
+
required: !0
|
|
1836
|
+
},
|
|
1837
|
+
isSelected: {
|
|
1838
|
+
type: Boolean,
|
|
1839
|
+
default: !1
|
|
1840
|
+
}
|
|
1841
|
+
},
|
|
1842
|
+
emits: [
|
|
1843
|
+
"select",
|
|
1844
|
+
"update",
|
|
1845
|
+
"editing-change"
|
|
1846
|
+
],
|
|
1847
|
+
setup(t, { emit: n }) {
|
|
1848
|
+
let i = [
|
|
1849
|
+
"badge",
|
|
1850
|
+
"cellButtons",
|
|
1851
|
+
"progressBar",
|
|
1852
|
+
"segmentedBar",
|
|
1853
|
+
"suffixIcon",
|
|
1854
|
+
"secondaryText",
|
|
1855
|
+
"overflow",
|
|
1856
|
+
"multiline"
|
|
1857
|
+
], c = t, u = d("editable", !0), p = d("showRowBorders", !0), _ = d("showColumnBorders", !0), v = d("cellButtonVisibility", "hover"), b = d("cellOverflow", "truncate"), w = d("getCellPendingState", () => null), E = d("getCellPreviousValue", () => void 0), D = d("getRowPendingState", () => null), k = r(() => w(c.cell.row.id, c.cell.column.id)), A = r(() => D(c.cell.row.id)), j = r(() => E(c.cell.row.id, c.cell.column.id)), N = r(() => k.value === "modified"), P = r(() => A.value === "delete"), te = r(() => {
|
|
1858
|
+
let e = f(v) ? v.value : v;
|
|
1859
|
+
return e === "always" ? "opacity-100" : e === "select" ? c.isSelected ? "opacity-100" : "opacity-0" : "opacity-0 group-hover/row:opacity-100";
|
|
1860
|
+
}), F = n, I = x(!1), L = x(""), R = x(null), z = {}, B = d("originalColumnMetaById", null), V = r(() => {
|
|
1861
|
+
let e = String(c.cell.column.id), t = B?.value?.[e], n = c.cell.column.columnDef.meta || {};
|
|
1862
|
+
if (!t) return Object.keys(n).length ? n : z;
|
|
1863
|
+
let r = {
|
|
1864
|
+
...t,
|
|
1865
|
+
...n
|
|
1866
|
+
};
|
|
1867
|
+
for (let e of i) (r[e] === void 0 || r[e] === null) && t[e] != null && (r[e] = t[e]);
|
|
1868
|
+
return typeof r.badge != "function" && r.badge !== !0 && typeof t.badge == "function" && (r.badge = t.badge), r.suffixIcon == null && t.suffixIcon != null && (r.suffixIcon = t.suffixIcon), r.secondaryText == null && t.secondaryText != null && (r.secondaryText = t.secondaryText), typeof r.secondaryText != "function" && typeof r.secondaryText != "string" && typeof t.secondaryText == "function" && (r.secondaryText = t.secondaryText), typeof r.segmentedBar != "function" && typeof t.segmentedBar == "function" && (r.segmentedBar = t.segmentedBar), r;
|
|
1869
|
+
}), H = r(() => V.value.type === "boolean"), ne = r(() => {
|
|
1870
|
+
let e = V.value;
|
|
1871
|
+
if (!e.progressBar) return null;
|
|
1872
|
+
let t = c.cell.getValue();
|
|
1873
|
+
if (t == null) return null;
|
|
1874
|
+
if (typeof e.progressBar == "function") return Math.min(100, Math.max(0, e.progressBar(t, c.cell.row.original)));
|
|
1875
|
+
if (typeof e.progressBar == "object" && e.progressBar !== null) {
|
|
1876
|
+
let { min: n = 0, max: r = 100 } = e.progressBar;
|
|
1877
|
+
return Math.min(100, Math.max(0, (t - n) / (r - n) * 100));
|
|
1878
|
+
}
|
|
1879
|
+
return Math.min(100, Math.max(0, Number(t)));
|
|
1880
|
+
}), U = r(() => {
|
|
1881
|
+
let e = V.value;
|
|
1882
|
+
if (!e.segmentedBar || typeof e.segmentedBar != "function") return null;
|
|
1883
|
+
let t = c.cell.getValue(), n = c.cell.row.original;
|
|
1884
|
+
return e.segmentedBar(t, n) ?? null;
|
|
1885
|
+
});
|
|
1886
|
+
function W(e, t) {
|
|
1887
|
+
if (!t || t <= 0) return "0%";
|
|
1888
|
+
let n = e / t * 100;
|
|
1889
|
+
return `${Math.min(100, Math.max(0, n))}%`;
|
|
1890
|
+
}
|
|
1891
|
+
let G = r(() => {
|
|
1892
|
+
let e = V.value;
|
|
1893
|
+
return e.overflow ? e.overflow : e.multiline ? "wrap" : (f(b) ? b.value : b) || "truncate";
|
|
1894
|
+
}), K = r(() => V.value.cellButtons ?? []);
|
|
1895
|
+
function re(e) {
|
|
1896
|
+
let t = e && e.color !== void 0 ? e.color : null;
|
|
1897
|
+
return t ? {
|
|
1898
|
+
backgroundColor: `color-mix(in srgb, ${t} 15%, transparent)`,
|
|
1899
|
+
color: t,
|
|
1900
|
+
border: `1px solid color-mix(in srgb, ${t} 35%, transparent)`
|
|
1901
|
+
} : {
|
|
1902
|
+
backgroundColor: "var(--st-border-secondary)",
|
|
1903
|
+
color: "var(--st-text)",
|
|
1904
|
+
border: "1px solid var(--st-border)"
|
|
1905
|
+
};
|
|
1906
|
+
}
|
|
1907
|
+
let q = r(() => {
|
|
1908
|
+
let e = V.value;
|
|
1909
|
+
if (!e.badge) return null;
|
|
1910
|
+
let t = c.cell.getValue(), n = c.cell.row.original, r = e.badge;
|
|
1911
|
+
if (typeof r == "function") {
|
|
1912
|
+
if (r = r(t, n), r == null || r === !1) return null;
|
|
1913
|
+
} else if (r === !0) r = {};
|
|
1914
|
+
else if (typeof r != "object" || !r) return null;
|
|
1915
|
+
let i = re(r), a;
|
|
1916
|
+
return a = r.label != null && r.label !== "" ? String(r.label) : t == null ? "NULL" : typeof t == "boolean" ? t ? "True" : "False" : String(t), {
|
|
1917
|
+
style: i,
|
|
1918
|
+
text: a
|
|
1919
|
+
};
|
|
1920
|
+
}), ie = r(() => H.value && !V.value.badge), J = r(() => {
|
|
1921
|
+
let e = V.value;
|
|
1922
|
+
if (!e.suffixIcon) return null;
|
|
1923
|
+
let t = c.cell.getValue();
|
|
1924
|
+
return typeof e.suffixIcon == "function" ? e.suffixIcon(t, c.cell.row.original) || null : e.suffixIcon;
|
|
1925
|
+
}), ae = r(() => {
|
|
1926
|
+
let e = V.value;
|
|
1927
|
+
if (e.secondaryText == null || e.secondaryText === "") return null;
|
|
1928
|
+
let t = c.cell.getValue(), n = c.cell.row.original, r;
|
|
1929
|
+
if (r = typeof e.secondaryText == "function" ? e.secondaryText(t, n) : e.secondaryText, r == null) return null;
|
|
1930
|
+
let i = String(r).trim();
|
|
1931
|
+
return i === "" ? null : i;
|
|
1932
|
+
}), oe = r(() => c.cell.getValue() == null), se = r(() => ae.value ? oe.value ? !0 : !q.value : !1), ce = r(() => se.value ? "flex items-start gap-1 min-w-0" : "flex items-center gap-1 min-w-0");
|
|
1933
|
+
function le() {
|
|
1934
|
+
I.value || F("select");
|
|
1935
|
+
}
|
|
1936
|
+
function ue() {
|
|
1937
|
+
!u.value?.update || ie.value || V.value.progressBar || V.value.segmentedBar || K.value.length > 0 || (I.value = !0, F("editing-change", !0), L.value = c.cell.getValue() ?? "", m(() => {
|
|
1938
|
+
R.value && (R.value.focus(), R.value.select(), de());
|
|
1939
|
+
}));
|
|
1940
|
+
}
|
|
1941
|
+
function de() {
|
|
1942
|
+
R.value && (R.value.style.height = "auto", R.value.style.height = R.value.scrollHeight + "px");
|
|
1943
|
+
}
|
|
1944
|
+
function fe() {
|
|
1945
|
+
let e = V.value.type;
|
|
1946
|
+
F("update", e === "int8" || e === "int4" || e === "float8" ? Number(L.value) : L.value), I.value = !1, F("editing-change", !1);
|
|
1947
|
+
}
|
|
1948
|
+
function Y() {
|
|
1949
|
+
I.value = !1, F("editing-change", !1);
|
|
1950
|
+
}
|
|
1951
|
+
function pe(e) {
|
|
1952
|
+
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), fe()) : e.key === "Escape" && Y();
|
|
1953
|
+
}
|
|
1954
|
+
function me() {
|
|
1955
|
+
u.value?.update && F("update", !c.cell.getValue());
|
|
1956
|
+
}
|
|
1957
|
+
return (n, r) => (y(), o("div", {
|
|
1958
|
+
class: "px-2 py-1.5 relative cursor-default align-middle",
|
|
1959
|
+
style: g({
|
|
1960
|
+
display: "table-cell",
|
|
1961
|
+
width: `${t.cell.column.getSize()}px`,
|
|
1962
|
+
minWidth: `${t.cell.column.getSize()}px`,
|
|
1963
|
+
maxWidth: `${t.cell.column.getSize()}px`,
|
|
1964
|
+
overflow: "hidden",
|
|
1965
|
+
borderBottom: T(p) ? "1px solid var(--st-border)" : "none",
|
|
1966
|
+
borderRight: T(_) ? "1px solid var(--st-border)" : "none",
|
|
1967
|
+
boxShadow: t.isSelected && !I.value ? "inset 0 0 0 2px var(--st-accent)" : N.value ? "inset 3px 0 0 var(--st-accent)" : "none",
|
|
1968
|
+
zIndex: I.value ? 20 : t.isSelected ? 10 : "auto"
|
|
1969
|
+
}),
|
|
1970
|
+
title: N.value && j.value !== void 0 ? `Was: ${j.value === null || j.value === "" ? "(empty)" : j.value}` : void 0,
|
|
1971
|
+
onClick: le,
|
|
1972
|
+
onDblclick: ue
|
|
1973
|
+
}, [ie.value ? (y(), o(e, { key: 0 }, [T(u).update ? (y(), o("button", {
|
|
1974
|
+
key: 0,
|
|
1975
|
+
class: "flex items-center gap-1.5",
|
|
1976
|
+
onClick: M(me, ["stop"])
|
|
1977
|
+
}, [s("span", {
|
|
1978
|
+
class: "inline-block w-7 h-4 rounded-full relative transition-colors",
|
|
1979
|
+
style: g({ backgroundColor: t.cell.getValue() ? "var(--st-accent)" : "var(--st-toggle-off)" })
|
|
1980
|
+
}, [s("span", { class: h(["absolute top-0.5 w-3 h-3 rounded-full bg-white transition-transform", t.cell.getValue() ? "left-3.5" : "left-0.5"]) }, null, 2)], 4), s("span", Mt, C(t.cell.getValue() ? "true" : "false"), 1)])) : (y(), o("span", Nt, [t.cell.getValue() === null || t.cell.getValue() === void 0 ? (y(), o("span", Pt, "NULL")) : (y(), o(e, { key: 1 }, [l(C(t.cell.getValue() ? "true" : "false"), 1)], 64))]))], 64)) : I.value ? (y(), o(e, { key: 1 }, [ee(s("textarea", {
|
|
1981
|
+
ref_key: "textareaRef",
|
|
1982
|
+
ref: R,
|
|
1983
|
+
"onUpdate:modelValue": r[0] ||= (e) => L.value = e,
|
|
1984
|
+
class: "w-full rounded px-1.5 py-1 text-[13px] resize-none outline-none",
|
|
1985
|
+
style: {
|
|
1986
|
+
backgroundColor: "var(--st-bg-input)",
|
|
1987
|
+
color: "var(--st-text)",
|
|
1988
|
+
border: "1px solid var(--st-accent)"
|
|
1989
|
+
},
|
|
1990
|
+
rows: "1",
|
|
1991
|
+
onKeydown: pe,
|
|
1992
|
+
onInput: de
|
|
1993
|
+
}, null, 544), [[O, L.value]]), s("div", Ft, [
|
|
1994
|
+
s("button", {
|
|
1995
|
+
class: "flex items-center gap-0.5",
|
|
1996
|
+
style: { color: "var(--st-accent)" },
|
|
1997
|
+
onClick: M(fe, ["stop"])
|
|
1998
|
+
}, " ↵ Save "),
|
|
1999
|
+
r[1] ||= s("span", { style: { color: "var(--st-text-placeholder)" } }, "|", -1),
|
|
2000
|
+
s("button", {
|
|
2001
|
+
class: "flex items-center gap-0.5",
|
|
2002
|
+
style: { color: "var(--st-text-secondary)" },
|
|
2003
|
+
onClick: M(Y, ["stop"])
|
|
2004
|
+
}, " Esc Cancel ")
|
|
2005
|
+
])], 64)) : U.value ? (y(), o(e, { key: 2 }, [U.value.total === 0 ? (y(), o("div", It, [...r[2] ||= [s("span", {
|
|
2006
|
+
class: "italic text-[13px]",
|
|
2007
|
+
style: { color: "var(--st-text-placeholder)" }
|
|
2008
|
+
}, "—", -1)]])) : (y(), o("div", Lt, [s("div", Rt, [(y(!0), o(e, null, S(U.value.segments, (e) => (y(), o("div", {
|
|
2009
|
+
key: e.label,
|
|
2010
|
+
class: "h-full shrink-0",
|
|
2011
|
+
style: g({
|
|
2012
|
+
width: W(e.count, U.value.total),
|
|
2013
|
+
backgroundColor: e.color
|
|
2014
|
+
})
|
|
2015
|
+
}, null, 4))), 128))]), s("div", zt, [(y(!0), o(e, null, S(U.value.segments, (e) => (y(), o("span", {
|
|
2016
|
+
key: e.label,
|
|
2017
|
+
class: "text-[11px] leading-snug tabular-nums whitespace-nowrap",
|
|
2018
|
+
style: { color: "var(--st-text-secondary)" }
|
|
2019
|
+
}, C(e.count) + " " + C(e.label), 1))), 128))])]))], 64)) : ne.value === null ? (y(), o("div", {
|
|
2020
|
+
key: 4,
|
|
2021
|
+
class: h(ce.value),
|
|
2022
|
+
style: g(P.value ? {
|
|
2023
|
+
textDecoration: "line-through",
|
|
2024
|
+
opacity: .5
|
|
2025
|
+
} : {})
|
|
2026
|
+
}, [
|
|
2027
|
+
s("div", Ut, [t.cell.getValue() === null || t.cell.getValue() === void 0 ? (y(), o("span", Wt, "NULL")) : q.value ? (y(), o("span", {
|
|
2028
|
+
key: 1,
|
|
2029
|
+
class: "inline-flex shrink-0 self-start items-center px-1.5 py-0.5 rounded text-[11px] font-medium leading-tight",
|
|
2030
|
+
style: g(q.value.style)
|
|
2031
|
+
}, C(q.value.text), 5)) : G.value === "wrap" ? (y(), o("span", Gt, C(t.cell.getValue()), 1)) : (y(), o("span", {
|
|
2032
|
+
key: 3,
|
|
2033
|
+
class: "truncate block",
|
|
2034
|
+
title: String(t.cell.getValue())
|
|
2035
|
+
}, C(t.cell.getValue()), 9, Kt)), se.value ? (y(), o("span", {
|
|
2036
|
+
key: 4,
|
|
2037
|
+
class: h(["block text-[11px] leading-snug", G.value === "wrap" ? "whitespace-pre-wrap break-words" : "truncate"]),
|
|
2038
|
+
style: { color: "var(--st-text-secondary)" },
|
|
2039
|
+
title: G.value === "wrap" ? void 0 : ae.value
|
|
2040
|
+
}, C(ae.value), 11, qt)) : a("", !0)]),
|
|
2041
|
+
J.value ? (y(), o("span", {
|
|
2042
|
+
key: 0,
|
|
2043
|
+
class: "w-3.5 h-3.5 shrink-0 flex items-center justify-center",
|
|
2044
|
+
style: g({ color: J.value.color || "var(--st-text-secondary)" }),
|
|
2045
|
+
innerHTML: J.value.svg
|
|
2046
|
+
}, null, 12, Jt)) : a("", !0),
|
|
2047
|
+
K.value.length > 0 ? (y(), o("div", {
|
|
2048
|
+
key: 1,
|
|
2049
|
+
class: h(["flex items-center gap-0.5 shrink-0", te.value])
|
|
2050
|
+
}, [(y(!0), o(e, null, S(K.value, (e, n) => (y(), o("button", {
|
|
2051
|
+
key: n,
|
|
2052
|
+
type: "button",
|
|
2053
|
+
class: h(["flex items-center justify-center rounded transition-colors", e.icon ? "w-5 h-5 shrink-0" : "h-5 px-1.5 shrink-0 text-[11px] font-medium whitespace-nowrap"]),
|
|
2054
|
+
style: { color: "var(--st-text-secondary)" },
|
|
2055
|
+
title: e.label,
|
|
2056
|
+
onClick: M((n) => e.onClick(t.cell.row.original), ["stop"])
|
|
2057
|
+
}, [e.icon ? (y(), o("span", {
|
|
2058
|
+
key: 0,
|
|
2059
|
+
class: "w-3.5 h-3.5 flex items-center justify-center",
|
|
2060
|
+
innerHTML: e.icon
|
|
2061
|
+
}, null, 8, Xt)) : (y(), o("span", Zt, C(e.label), 1))], 10, Yt))), 128))], 2)) : a("", !0)
|
|
2062
|
+
], 6)) : (y(), o("div", Bt, [s("div", Vt, [s("div", {
|
|
2063
|
+
class: "h-full rounded-full transition-all duration-300",
|
|
2064
|
+
style: g({
|
|
2065
|
+
width: `${ne.value}%`,
|
|
2066
|
+
backgroundColor: "var(--st-accent)"
|
|
2067
|
+
})
|
|
2068
|
+
}, null, 4)]), s("span", Ht, C(Math.round(ne.value)) + "% ", 1)]))], 44, jt));
|
|
2069
|
+
}
|
|
2070
|
+
}, $t = ["data-index"], en = {
|
|
2071
|
+
class: "group/row",
|
|
2072
|
+
style: {
|
|
2073
|
+
display: "table",
|
|
2074
|
+
tableLayout: "fixed",
|
|
2075
|
+
width: "100%"
|
|
2076
|
+
}
|
|
2077
|
+
}, tn = { class: "flex h-full gap-1 pr-1.5 pl-1 items-center justify-end pl-0.5" }, nn = { class: "flex min-w-0 flex-1 items-center justify-end gap-0.5" }, rn = {
|
|
2078
|
+
class: "text-xs text-right whitespace-nowrap",
|
|
2079
|
+
style: { color: "var(--st-text-tertiary)" }
|
|
2080
|
+
}, an = ["checked"], on = /* @__PURE__ */ B({
|
|
2081
|
+
__name: "TableGridDataRow",
|
|
2082
|
+
props: {
|
|
2083
|
+
row: {
|
|
2084
|
+
type: Object,
|
|
2085
|
+
required: !0
|
|
2086
|
+
},
|
|
2087
|
+
rowIndex: {
|
|
2088
|
+
type: Number,
|
|
2089
|
+
required: !0
|
|
2090
|
+
},
|
|
2091
|
+
orderNumber: {
|
|
2092
|
+
type: Number,
|
|
2093
|
+
required: !0
|
|
2094
|
+
},
|
|
2095
|
+
virtualOffsetY: {
|
|
2096
|
+
type: Number,
|
|
2097
|
+
default: null
|
|
2098
|
+
},
|
|
2099
|
+
totalTableWidth: {
|
|
2100
|
+
type: Number,
|
|
2101
|
+
required: !0
|
|
2102
|
+
},
|
|
2103
|
+
selectedCell: {
|
|
2104
|
+
type: String,
|
|
2105
|
+
default: null
|
|
2106
|
+
},
|
|
2107
|
+
editingRowId: {
|
|
2108
|
+
type: [
|
|
2109
|
+
String,
|
|
2110
|
+
Number,
|
|
2111
|
+
null
|
|
2112
|
+
],
|
|
2113
|
+
default: null
|
|
2114
|
+
}
|
|
2115
|
+
},
|
|
2116
|
+
emits: [
|
|
2117
|
+
"toggle-row-select",
|
|
2118
|
+
"edit-row",
|
|
2119
|
+
"context-menu",
|
|
2120
|
+
"select-cell",
|
|
2121
|
+
"update-cell",
|
|
2122
|
+
"editing-change"
|
|
2123
|
+
],
|
|
2124
|
+
setup(t) {
|
|
2125
|
+
let n = t, c = d("editable", !0), l = r(() => {
|
|
2126
|
+
let e = T(c);
|
|
2127
|
+
return e === !0 ? {
|
|
2128
|
+
insert: !0,
|
|
2129
|
+
update: !0,
|
|
2130
|
+
delete: !0
|
|
2131
|
+
} : e === !1 ? {
|
|
2132
|
+
insert: !1,
|
|
2133
|
+
update: !1,
|
|
2134
|
+
delete: !1
|
|
2135
|
+
} : {
|
|
2136
|
+
insert: !0,
|
|
2137
|
+
update: !0,
|
|
2138
|
+
delete: !0,
|
|
2139
|
+
...e
|
|
2140
|
+
};
|
|
2141
|
+
}), f = d("showRowBorders", !0), m = d("showColumnBorders", !0), _ = d("getSubTable", null), v = d("expanded", {}), b = d("toggleRowExpanded", () => {}), x = d("nestingDepth", 0), E = d("parentTheme", "dark"), D = d("parentAccentColor", "#3ecf8e"), O = d("subTableSorting", {}), k = d("subTableColumnFilters", {}), A = d("subTableColumnVisibility", {}), j = d("getRowPendingState", () => null), ee = d("isRowDisplayedSelected", null), N = d("highlightedRowId", null), P = r(() => {
|
|
2142
|
+
let e = T(N);
|
|
2143
|
+
return e == null || e === "" ? !1 : n.row.id === e;
|
|
2144
|
+
});
|
|
2145
|
+
function te(e) {
|
|
2146
|
+
let t = T(ee);
|
|
2147
|
+
return typeof t == "function" ? t(e) : e.getIsSelected();
|
|
2148
|
+
}
|
|
2149
|
+
let F = r(() => {
|
|
2150
|
+
let e = m ? "inset -1px 0 0 var(--st-border)" : "", t = "2px 0 4px var(--st-shadow-sticky)";
|
|
2151
|
+
return e ? `${e}, ${t}` : t;
|
|
2152
|
+
}), I = r(() => _ ? _(n.row.original) : null), L = r(() => {
|
|
2153
|
+
let e = I.value;
|
|
2154
|
+
if (!e) return {
|
|
2155
|
+
tableProps: null,
|
|
2156
|
+
onRowAction: null
|
|
2157
|
+
};
|
|
2158
|
+
let { onRowAction: t, ...n } = e;
|
|
2159
|
+
return {
|
|
2160
|
+
tableProps: n,
|
|
2161
|
+
onRowAction: typeof t == "function" ? t : null
|
|
2162
|
+
};
|
|
2163
|
+
}), R = r(() => T(v) ?? {});
|
|
2164
|
+
function z() {
|
|
2165
|
+
return !!I.value;
|
|
2166
|
+
}
|
|
2167
|
+
function B() {
|
|
2168
|
+
return !!R.value?.[n.row.id];
|
|
2169
|
+
}
|
|
2170
|
+
let V = r(() => n.virtualOffsetY == null ? { width: "100%" } : {
|
|
2171
|
+
position: "absolute",
|
|
2172
|
+
top: "0px",
|
|
2173
|
+
left: "0px",
|
|
2174
|
+
width: "100%",
|
|
2175
|
+
transform: `translateY(${n.virtualOffsetY}px)`,
|
|
2176
|
+
zIndex: n.editingRowId === n.row.id ? 5 : "auto"
|
|
2177
|
+
});
|
|
2178
|
+
return (n, r) => (y(), o("div", {
|
|
2179
|
+
class: h(["st-row", {
|
|
2180
|
+
"st-row--selected": te(t.row),
|
|
2181
|
+
"st-row--active": P.value,
|
|
2182
|
+
"st-row--pending-insert": T(j)(t.row.id) === "insert",
|
|
2183
|
+
"st-row--pending-delete": T(j)(t.row.id) === "delete"
|
|
2184
|
+
}]),
|
|
2185
|
+
style: g(V.value),
|
|
2186
|
+
"data-index": t.virtualOffsetY == null ? void 0 : t.rowIndex
|
|
2187
|
+
}, [s("div", en, [
|
|
2188
|
+
s("div", {
|
|
2189
|
+
class: "py-1.5 align-middle sticky left-0 z-10 st-sticky-cell",
|
|
2190
|
+
style: g({
|
|
2191
|
+
display: "table-cell",
|
|
2192
|
+
width: "44px",
|
|
2193
|
+
minWidth: "44px",
|
|
2194
|
+
borderBottom: T(f) ? "1px solid var(--st-border)" : "none"
|
|
2195
|
+
})
|
|
2196
|
+
}, [s("div", tn, [s("div", nn, [z() ? (y(), o("button", {
|
|
2197
|
+
key: 0,
|
|
2198
|
+
class: "flex items-center justify-center w-4 h-4 shrink-0 transition-transform duration-150",
|
|
2199
|
+
style: g({
|
|
2200
|
+
color: B() ? "var(--st-accent)" : "var(--st-text-secondary)",
|
|
2201
|
+
transform: B() ? "rotate(90deg)" : "rotate(0deg)"
|
|
2202
|
+
}),
|
|
2203
|
+
title: "Toggle sub-table",
|
|
2204
|
+
onClick: r[0] ||= M((e) => T(b)(t.row.id), ["stop"])
|
|
2205
|
+
}, [...r[5] ||= [s("svg", {
|
|
2206
|
+
class: "w-3 h-3",
|
|
2207
|
+
viewBox: "0 0 16 16",
|
|
2208
|
+
fill: "currentColor"
|
|
2209
|
+
}, [s("path", { d: "M6 3l5 5-5 5V3z" })], -1)]], 4)) : l.value.update ? (y(), o("button", {
|
|
2210
|
+
key: 1,
|
|
2211
|
+
class: "invisible group-hover/row:visible flex items-center justify-center w-4 h-4 shrink-0",
|
|
2212
|
+
style: { color: "var(--st-text-secondary)" },
|
|
2213
|
+
title: "Expand row",
|
|
2214
|
+
onClick: r[1] ||= M((e) => n.$emit("edit-row", t.row.original), ["stop"])
|
|
2215
|
+
}, [...r[6] ||= [s("svg", {
|
|
2216
|
+
class: "w-3 h-3",
|
|
2217
|
+
viewBox: "0 0 16 16",
|
|
2218
|
+
fill: "none",
|
|
2219
|
+
stroke: "currentColor",
|
|
2220
|
+
"stroke-width": "2"
|
|
2221
|
+
}, [s("path", { d: "M6 2h8v8M14 2L6 10" })], -1)]])) : a("", !0), s("span", rn, C(t.orderNumber), 1)])])], 4),
|
|
2222
|
+
s("div", {
|
|
2223
|
+
class: "px-1 py-1.5 text-center align-middle sticky z-10 st-sticky-cell",
|
|
2224
|
+
style: g({
|
|
2225
|
+
display: "table-cell",
|
|
2226
|
+
width: "40px",
|
|
2227
|
+
minWidth: "40px",
|
|
2228
|
+
left: "44px",
|
|
2229
|
+
borderBottom: T(f) ? "1px solid var(--st-border)" : "none",
|
|
2230
|
+
boxShadow: F.value
|
|
2231
|
+
})
|
|
2232
|
+
}, [s("input", {
|
|
2233
|
+
type: "checkbox",
|
|
2234
|
+
class: "cursor-pointer align-middle",
|
|
2235
|
+
style: { accentColor: "var(--st-accent)" },
|
|
2236
|
+
checked: te(t.row),
|
|
2237
|
+
onClick: r[2] ||= (e) => n.$emit("toggle-row-select", t.row, e, t.rowIndex)
|
|
2238
|
+
}, null, 8, an)], 4),
|
|
2239
|
+
(y(!0), o(e, null, S(t.row.getVisibleCells(), (e) => (y(), i(Qt, {
|
|
2240
|
+
key: e.id,
|
|
2241
|
+
cell: e,
|
|
2242
|
+
"is-selected": t.selectedCell === `${t.row.id}:${e.column.id}`,
|
|
2243
|
+
onSelect: (r) => n.$emit("select-cell", t.row.id, e.column.id),
|
|
2244
|
+
onUpdate: (r) => n.$emit("update-cell", t.row.id, e.column.id, r),
|
|
2245
|
+
onEditingChange: r[3] ||= (e) => n.$emit("editing-change", e, t.row.id),
|
|
2246
|
+
onContextmenu: M((r) => n.$emit("context-menu", r, t.row, e), ["prevent", "stop"])
|
|
2247
|
+
}, null, 8, [
|
|
2248
|
+
"cell",
|
|
2249
|
+
"is-selected",
|
|
2250
|
+
"onSelect",
|
|
2251
|
+
"onUpdate",
|
|
2252
|
+
"onContextmenu"
|
|
2253
|
+
]))), 128))
|
|
2254
|
+
]), B() && I.value ? (y(), o("div", {
|
|
2255
|
+
key: 0,
|
|
2256
|
+
style: g({
|
|
2257
|
+
display: "block",
|
|
2258
|
+
width: t.totalTableWidth + "px",
|
|
2259
|
+
borderBottom: T(f) ? "1px solid var(--st-border)" : "none"
|
|
2260
|
+
})
|
|
2261
|
+
}, [s("div", { style: g({
|
|
2262
|
+
borderLeft: "3px solid var(--st-accent)",
|
|
2263
|
+
marginLeft: 10 + Number(w(T(x)) || 0) * 16 + "px",
|
|
2264
|
+
backgroundColor: "var(--st-bg)"
|
|
2265
|
+
}) }, [u(Vr, p(L.value.tableProps, {
|
|
2266
|
+
editable: I.value.editable ?? {
|
|
2267
|
+
insert: !1,
|
|
2268
|
+
update: !1,
|
|
2269
|
+
delete: !1
|
|
2270
|
+
},
|
|
2271
|
+
theme: I.value.theme ?? T(T(E)),
|
|
2272
|
+
"accent-color": I.value.accentColor ?? T(T(D)),
|
|
2273
|
+
"nesting-depth": T(x) + 1,
|
|
2274
|
+
"controlled-sorting": T(O),
|
|
2275
|
+
"controlled-column-filters": T(k),
|
|
2276
|
+
"controlled-column-visibility": T(A),
|
|
2277
|
+
onRowAction: r[4] ||= (e, t) => L.value.onRowAction?.(e, t)
|
|
2278
|
+
}), null, 16, [
|
|
2279
|
+
"editable",
|
|
2280
|
+
"theme",
|
|
2281
|
+
"accent-color",
|
|
2282
|
+
"nesting-depth",
|
|
2283
|
+
"controlled-sorting",
|
|
2284
|
+
"controlled-column-filters",
|
|
2285
|
+
"controlled-column-visibility"
|
|
2286
|
+
])], 4)], 4)) : a("", !0)], 14, $t));
|
|
2287
|
+
}
|
|
2288
|
+
}, [["__scopeId", "data-v-1d48216e"]]), sn = 36, cn = 56, ln = 40, un = 300, dn = {
|
|
2289
|
+
__name: "TableGridVirtualRows",
|
|
2290
|
+
props: {
|
|
2291
|
+
rows: {
|
|
2292
|
+
type: Array,
|
|
2293
|
+
required: !0
|
|
2294
|
+
},
|
|
2295
|
+
scrollElementRef: {
|
|
2296
|
+
type: Object,
|
|
2297
|
+
required: !0
|
|
2298
|
+
},
|
|
2299
|
+
totalTableWidth: {
|
|
2300
|
+
type: Number,
|
|
2301
|
+
required: !0
|
|
2302
|
+
},
|
|
2303
|
+
selectedCell: {
|
|
2304
|
+
type: String,
|
|
2305
|
+
default: null
|
|
2306
|
+
},
|
|
2307
|
+
editingRowId: {
|
|
2308
|
+
type: [
|
|
2309
|
+
String,
|
|
2310
|
+
Number,
|
|
2311
|
+
null
|
|
2312
|
+
],
|
|
2313
|
+
default: null
|
|
2314
|
+
},
|
|
2315
|
+
paginationState: {
|
|
2316
|
+
type: Object,
|
|
2317
|
+
required: !0
|
|
2318
|
+
}
|
|
2319
|
+
},
|
|
2320
|
+
emits: [
|
|
2321
|
+
"toggle-row-select",
|
|
2322
|
+
"edit-row",
|
|
2323
|
+
"context-menu",
|
|
2324
|
+
"select-cell",
|
|
2325
|
+
"update-cell",
|
|
2326
|
+
"editing-change"
|
|
2327
|
+
],
|
|
2328
|
+
setup(t, { emit: n }) {
|
|
2329
|
+
let a = t, s = n, c = d("cellOverflow", "truncate"), l = d("getSubTable", null), u = d("expanded"), f = typeof window < "u" && "onscrollend" in window, p = r(() => T(u) ?? {}), m = z(r(() => {
|
|
2330
|
+
let e = a.rows, t = p.value, n = T(c) === "wrap", r = {}, i = l;
|
|
2331
|
+
if (i) for (let t of e) {
|
|
2332
|
+
let e = i(t.original);
|
|
2333
|
+
e && (r[t.id] = e);
|
|
2334
|
+
}
|
|
2335
|
+
return {
|
|
2336
|
+
count: e.length,
|
|
2337
|
+
getScrollElement: () => T(a.scrollElementRef),
|
|
2338
|
+
estimateSize: (i) => {
|
|
2339
|
+
let a = e[i];
|
|
2340
|
+
if (!a) return sn;
|
|
2341
|
+
let o = n ? cn : sn;
|
|
2342
|
+
return r[a.id] ? t[a.id] ? Math.max(o, un) : Math.max(o, ln) : o;
|
|
2343
|
+
},
|
|
2344
|
+
overscan: 8,
|
|
2345
|
+
getItemKey: (t) => e[t]?.id ?? t,
|
|
2346
|
+
useScrollendEvent: f,
|
|
2347
|
+
isScrollingResetDelay: f ? 100 : 150
|
|
2348
|
+
};
|
|
2349
|
+
})), h = r(() => m.value.getVirtualItems()), _ = r(() => m.value.getTotalSize());
|
|
2350
|
+
function v(e, t) {
|
|
2351
|
+
if (!e || t == null) return;
|
|
2352
|
+
let n = e.$el ?? e;
|
|
2353
|
+
!n || typeof n.setAttribute != "function" || (n.setAttribute("data-index", String(t.index)), m.value.measureElement(n));
|
|
2354
|
+
}
|
|
2355
|
+
function b(e) {
|
|
2356
|
+
return a.paginationState.pageIndex * a.paginationState.pageSize + e + 1;
|
|
2357
|
+
}
|
|
2358
|
+
return (n, r) => (y(), o("div", { style: g({
|
|
2359
|
+
position: "relative",
|
|
2360
|
+
height: _.value + "px",
|
|
2361
|
+
width: t.totalTableWidth + "px"
|
|
2362
|
+
}) }, [(y(!0), o(e, null, S(h.value, (e) => (y(), i(on, {
|
|
2363
|
+
key: e.key,
|
|
2364
|
+
ref_for: !0,
|
|
2365
|
+
ref: (t) => v(t, e),
|
|
2366
|
+
row: t.rows[e.index],
|
|
2367
|
+
"row-index": e.index,
|
|
2368
|
+
"order-number": b(e.index),
|
|
2369
|
+
"virtual-offset-y": e.start,
|
|
2370
|
+
"total-table-width": t.totalTableWidth,
|
|
2371
|
+
"selected-cell": t.selectedCell,
|
|
2372
|
+
"editing-row-id": t.editingRowId,
|
|
2373
|
+
onToggleRowSelect: r[0] ||= (e, t, n) => s("toggle-row-select", e, t, n),
|
|
2374
|
+
onEditRow: r[1] ||= (e) => s("edit-row", e),
|
|
2375
|
+
onContextMenu: r[2] ||= (e, t, n) => s("context-menu", e, t, n),
|
|
2376
|
+
onSelectCell: r[3] ||= (e, t) => s("select-cell", e, t),
|
|
2377
|
+
onUpdateCell: r[4] ||= (e, t, n) => s("update-cell", e, t, n),
|
|
2378
|
+
onEditingChange: r[5] ||= (e, t) => s("editing-change", e, t)
|
|
2379
|
+
}, null, 8, [
|
|
2380
|
+
"row",
|
|
2381
|
+
"row-index",
|
|
2382
|
+
"order-number",
|
|
2383
|
+
"virtual-offset-y",
|
|
2384
|
+
"total-table-width",
|
|
2385
|
+
"selected-cell",
|
|
2386
|
+
"editing-row-id"
|
|
2387
|
+
]))), 128))], 4));
|
|
2388
|
+
}
|
|
2389
|
+
}, fn = {
|
|
2390
|
+
__name: "TableGridFlowRows",
|
|
2391
|
+
props: {
|
|
2392
|
+
rows: {
|
|
2393
|
+
type: Array,
|
|
2394
|
+
required: !0
|
|
2395
|
+
},
|
|
2396
|
+
totalTableWidth: {
|
|
2397
|
+
type: Number,
|
|
2398
|
+
required: !0
|
|
2399
|
+
},
|
|
2400
|
+
selectedCell: {
|
|
2401
|
+
type: String,
|
|
2402
|
+
default: null
|
|
2403
|
+
},
|
|
2404
|
+
editingRowId: {
|
|
2405
|
+
type: [
|
|
2406
|
+
String,
|
|
2407
|
+
Number,
|
|
2408
|
+
null
|
|
2409
|
+
],
|
|
2410
|
+
default: null
|
|
2411
|
+
},
|
|
2412
|
+
paginationState: {
|
|
2413
|
+
type: Object,
|
|
2414
|
+
required: !0
|
|
2415
|
+
}
|
|
2416
|
+
},
|
|
2417
|
+
emits: [
|
|
2418
|
+
"toggle-row-select",
|
|
2419
|
+
"edit-row",
|
|
2420
|
+
"context-menu",
|
|
2421
|
+
"select-cell",
|
|
2422
|
+
"update-cell",
|
|
2423
|
+
"editing-change"
|
|
2424
|
+
],
|
|
2425
|
+
setup(t, { emit: n }) {
|
|
2426
|
+
let r = n;
|
|
2427
|
+
function a(e, t) {
|
|
2428
|
+
return t.pageIndex * t.pageSize + e + 1;
|
|
2429
|
+
}
|
|
2430
|
+
return (n, s) => (y(), o("div", {
|
|
2431
|
+
class: "flex flex-col",
|
|
2432
|
+
style: g({ width: t.totalTableWidth + "px" })
|
|
2433
|
+
}, [(y(!0), o(e, null, S(t.rows, (e, n) => (y(), i(on, {
|
|
2434
|
+
key: e.id,
|
|
2435
|
+
row: e,
|
|
2436
|
+
"row-index": n,
|
|
2437
|
+
"order-number": a(n, t.paginationState),
|
|
2438
|
+
"total-table-width": t.totalTableWidth,
|
|
2439
|
+
"selected-cell": t.selectedCell,
|
|
2440
|
+
"editing-row-id": t.editingRowId,
|
|
2441
|
+
onToggleRowSelect: s[0] ||= (e, t, n) => r("toggle-row-select", e, t, n),
|
|
2442
|
+
onEditRow: s[1] ||= (e) => r("edit-row", e),
|
|
2443
|
+
onContextMenu: s[2] ||= (e, t, n) => r("context-menu", e, t, n),
|
|
2444
|
+
onSelectCell: s[3] ||= (e, t) => r("select-cell", e, t),
|
|
2445
|
+
onUpdateCell: s[4] ||= (e, t, n) => r("update-cell", e, t, n),
|
|
2446
|
+
onEditingChange: s[5] ||= (e, t) => r("editing-change", e, t)
|
|
2447
|
+
}, null, 8, [
|
|
2448
|
+
"row",
|
|
2449
|
+
"row-index",
|
|
2450
|
+
"order-number",
|
|
2451
|
+
"total-table-width",
|
|
2452
|
+
"selected-cell",
|
|
2453
|
+
"editing-row-id"
|
|
2454
|
+
]))), 128))], 4));
|
|
2455
|
+
}
|
|
2456
|
+
}, pn = ["checked", "indeterminate"], mn = {
|
|
2457
|
+
key: 0,
|
|
2458
|
+
class: "absolute inset-0 flex items-center justify-center pointer-events-none",
|
|
2459
|
+
style: { top: "33px" }
|
|
2460
|
+
}, hn = { class: "flex flex-col items-center gap-4 text-center px-6 pointer-events-auto" }, gn = {
|
|
2461
|
+
class: "flex items-center justify-center w-14 h-14 rounded-2xl",
|
|
2462
|
+
style: {
|
|
2463
|
+
backgroundColor: "var(--st-accent-bg)",
|
|
2464
|
+
border: "1px solid var(--st-accent-border-light)"
|
|
2465
|
+
}
|
|
2466
|
+
}, _n = {
|
|
2467
|
+
class: "w-7 h-7",
|
|
2468
|
+
viewBox: "0 0 24 24",
|
|
2469
|
+
fill: "none",
|
|
2470
|
+
stroke: "currentColor",
|
|
2471
|
+
"stroke-width": "1.5",
|
|
2472
|
+
"stroke-linecap": "round",
|
|
2473
|
+
"stroke-linejoin": "round",
|
|
2474
|
+
style: { color: "var(--st-accent)" }
|
|
2475
|
+
}, vn = { class: "flex flex-col gap-1" }, yn = {
|
|
2476
|
+
class: "font-semibold text-[15px]",
|
|
2477
|
+
style: { color: "var(--st-text)" }
|
|
2478
|
+
}, bn = {
|
|
2479
|
+
class: "text-[13px] max-w-xs leading-relaxed",
|
|
2480
|
+
style: { color: "var(--st-text-tertiary)" }
|
|
2481
|
+
}, xn = {
|
|
2482
|
+
key: 0,
|
|
2483
|
+
class: "relative mt-1"
|
|
2484
|
+
}, Sn = {
|
|
2485
|
+
key: 1,
|
|
2486
|
+
class: "flex items-center"
|
|
2487
|
+
}, Cn = {
|
|
2488
|
+
key: 3,
|
|
2489
|
+
class: "absolute top-full left-1/2 -translate-x-1/2 mt-1 w-48 rounded shadow-xl z-50 py-1 text-[13px]",
|
|
2490
|
+
style: {
|
|
2491
|
+
backgroundColor: "var(--st-bg-surface)",
|
|
2492
|
+
border: "1px solid var(--st-border-secondary)"
|
|
2493
|
+
}
|
|
2494
|
+
}, wn = 500, Tn = 8, En = /* @__PURE__ */ B({
|
|
2495
|
+
__name: "TableGrid",
|
|
2496
|
+
props: { table: {
|
|
2497
|
+
type: Object,
|
|
2498
|
+
required: !0
|
|
2499
|
+
} },
|
|
2500
|
+
emits: [
|
|
2501
|
+
"update-cell",
|
|
2502
|
+
"context-menu",
|
|
2503
|
+
"edit-row"
|
|
2504
|
+
],
|
|
2505
|
+
setup(n, { expose: c, emit: u }) {
|
|
2506
|
+
let f = [
|
|
2507
|
+
60,
|
|
2508
|
+
75,
|
|
2509
|
+
85,
|
|
2510
|
+
55,
|
|
2511
|
+
70,
|
|
2512
|
+
80,
|
|
2513
|
+
65,
|
|
2514
|
+
90
|
|
2515
|
+
];
|
|
2516
|
+
function p(e, t) {
|
|
2517
|
+
return f[(e + t) % f.length];
|
|
2518
|
+
}
|
|
2519
|
+
let m = n, _ = d("editable", !0), v = r(() => {
|
|
2520
|
+
let e = T(_);
|
|
2521
|
+
return e === !0 ? {
|
|
2522
|
+
insert: !0,
|
|
2523
|
+
update: !0,
|
|
2524
|
+
delete: !0
|
|
2525
|
+
} : e === !1 ? {
|
|
2526
|
+
insert: !1,
|
|
2527
|
+
update: !1,
|
|
2528
|
+
delete: !1
|
|
2529
|
+
} : {
|
|
2530
|
+
insert: !0,
|
|
2531
|
+
update: !0,
|
|
2532
|
+
delete: !0,
|
|
2533
|
+
...e
|
|
2534
|
+
};
|
|
2535
|
+
}), b = d("showRowBorders", !0), D = d("showColumnBorders", !0), O = d("loading", !1), k = r(() => !!T(O)), A = d("emptyTitle", "No rows found"), j = d("emptyMessage", "Get started by inserting a new row."), ee = d("openInsertPanel", null), N = d("defaultInsertLabel", null), P = d("insertActions", null), te = r(() => {
|
|
2536
|
+
let e = P == null ? [] : T(P);
|
|
2537
|
+
return Array.isArray(e) ? e : [];
|
|
2538
|
+
}), F = r(() => !v.value.insert || !(N != null && String(T(N)).trim()) ? !1 : te.value.length === 0), I = d("insertRow", () => {}), L = x(!1), R = d("nestingDepth", 0), z = u, B = x(null), V = x(null), H = d("tableSourceRows", null), ne = r(() => (H != null && w(H), m.table.getHeaderGroups())), U = r(() => 84 + m.table.getVisibleLeafColumns().reduce((e, t) => e + t.getSize(), 0)), W = r(() => (H != null && w(H), m.table.getRowModel().rows)), G = r(() => (H != null && w(H), m.table.getVisibleLeafColumns())), K = r(() => m.table.getState().pagination), re = d("isRowDisplayedSelected", null);
|
|
2539
|
+
function q(e) {
|
|
2540
|
+
let t = T(re);
|
|
2541
|
+
return typeof t == "function" ? t(e) : e.getIsSelected();
|
|
2542
|
+
}
|
|
2543
|
+
let ie = r(() => W.value.length ? W.value.every((e) => q(e)) : !1), J = r(() => {
|
|
2544
|
+
if (!W.value.length) return !1;
|
|
2545
|
+
let e = W.value.some((e) => q(e)), t = W.value.every((e) => q(e));
|
|
2546
|
+
return e && !t;
|
|
2547
|
+
});
|
|
2548
|
+
function ae(e, t) {
|
|
2549
|
+
B.value = `${e}:${t}`;
|
|
2550
|
+
}
|
|
2551
|
+
function oe() {
|
|
2552
|
+
B.value = null;
|
|
2553
|
+
}
|
|
2554
|
+
function se(e, t, n) {
|
|
2555
|
+
z("context-menu", e, t, n);
|
|
2556
|
+
}
|
|
2557
|
+
function ce() {
|
|
2558
|
+
m.table.toggleAllPageRowsSelected(!ie.value);
|
|
2559
|
+
}
|
|
2560
|
+
let le = x(null);
|
|
2561
|
+
function ue(e, t, n) {
|
|
2562
|
+
if (t?.shiftKey && le.value !== null) {
|
|
2563
|
+
let e = Math.min(le.value, n), t = Math.max(le.value, n), r = W.value;
|
|
2564
|
+
for (let n = e; n <= t; n++) r[n].toggleSelected(!0);
|
|
2565
|
+
} else e.toggleSelected(!q(e));
|
|
2566
|
+
le.value = n;
|
|
2567
|
+
}
|
|
2568
|
+
let de = r(() => {
|
|
2569
|
+
let e = D ? "inset -1px 0 0 var(--st-border)" : "", t = "2px 0 4px var(--st-shadow-sticky)";
|
|
2570
|
+
return e ? `${e}, ${t}` : t;
|
|
2571
|
+
}), fe = r(() => W.value.length > wn), Y = E("scroller");
|
|
2572
|
+
function pe(e, t) {
|
|
2573
|
+
V.value = e ? t : null;
|
|
2574
|
+
}
|
|
2575
|
+
function me() {
|
|
2576
|
+
let e = Y.value;
|
|
2577
|
+
if (!e) return null;
|
|
2578
|
+
let t = w(R);
|
|
2579
|
+
return t && t > 0 ? e.parentElement : e;
|
|
2580
|
+
}
|
|
2581
|
+
function he() {
|
|
2582
|
+
return me()?.clientWidth ?? 0;
|
|
2583
|
+
}
|
|
2584
|
+
return c({
|
|
2585
|
+
getScrollViewportInnerWidth: he,
|
|
2586
|
+
getViewportResizeObserveTarget: me
|
|
2587
|
+
}), (r, c) => (y(), o("div", { class: h(T(R) === 0 ? "flex-1 min-h-0 relative" : "overflow-auto") }, [s("div", {
|
|
2588
|
+
ref: "scroller",
|
|
2589
|
+
class: h(T(R) === 0 ? "absolute inset-0 overflow-auto flex flex-col items-start min-h-0" : "flex flex-col items-start"),
|
|
2590
|
+
style: { "scrollbar-gutter": "stable" },
|
|
2591
|
+
onClick: M(oe, ["self"])
|
|
2592
|
+
}, [s("div", {
|
|
2593
|
+
class: "sticky top-0 z-[26] shrink-0 isolate",
|
|
2594
|
+
style: g({
|
|
2595
|
+
width: U.value + "px",
|
|
2596
|
+
backgroundColor: "var(--st-bg-header)"
|
|
2597
|
+
})
|
|
2598
|
+
}, [s("table", {
|
|
2599
|
+
class: "border-separate border-spacing-0 table-fixed w-full border-0 bg-transparent",
|
|
2600
|
+
style: g({ width: U.value + "px" })
|
|
2601
|
+
}, [s("thead", null, [(y(!0), o(e, null, S(ne.value, (t) => (y(), o("tr", { key: t.id }, [
|
|
2602
|
+
s("th", {
|
|
2603
|
+
class: "px-1.5 py-1.5 text-right font-normal sticky left-0 z-[40]",
|
|
2604
|
+
style: g({
|
|
2605
|
+
width: "44px",
|
|
2606
|
+
minWidth: "44px",
|
|
2607
|
+
backgroundColor: "var(--st-bg-header)",
|
|
2608
|
+
borderBottom: T(b) ? "1px solid var(--st-border)" : "none",
|
|
2609
|
+
color: "var(--st-text-tertiary)"
|
|
2610
|
+
})
|
|
2611
|
+
}, [...c[12] ||= [s("span", { class: "text-xs" }, "#", -1)]], 4),
|
|
2612
|
+
s("th", {
|
|
2613
|
+
class: "px-1 py-1.5 text-center align-middle sticky z-[39]",
|
|
2614
|
+
style: g({
|
|
2615
|
+
width: "40px",
|
|
2616
|
+
minWidth: "40px",
|
|
2617
|
+
left: "44px",
|
|
2618
|
+
backgroundColor: "var(--st-bg-header)",
|
|
2619
|
+
borderBottom: T(b) ? "1px solid var(--st-border)" : "none",
|
|
2620
|
+
boxShadow: de.value
|
|
2621
|
+
})
|
|
2622
|
+
}, [s("input", {
|
|
2623
|
+
type: "checkbox",
|
|
2624
|
+
class: "cursor-pointer align-middle",
|
|
2625
|
+
style: { accentColor: "var(--st-accent)" },
|
|
2626
|
+
checked: ie.value,
|
|
2627
|
+
indeterminate: J.value,
|
|
2628
|
+
title: "Select all rows on this page",
|
|
2629
|
+
onChange: ce
|
|
2630
|
+
}, null, 40, pn)], 4),
|
|
2631
|
+
(y(!0), o(e, null, S(t.headers, (e) => (y(), i(At, {
|
|
2632
|
+
key: e.id,
|
|
2633
|
+
header: e,
|
|
2634
|
+
table: n.table
|
|
2635
|
+
}, null, 8, ["header", "table"]))), 128))
|
|
2636
|
+
]))), 128))])], 4)], 4), W.value.length > 0 && fe.value ? (y(), i(dn, {
|
|
2637
|
+
key: 0,
|
|
2638
|
+
rows: W.value,
|
|
2639
|
+
"scroll-element-ref": Y.value,
|
|
2640
|
+
"total-table-width": U.value,
|
|
2641
|
+
"selected-cell": B.value,
|
|
2642
|
+
"editing-row-id": V.value,
|
|
2643
|
+
"pagination-state": K.value,
|
|
2644
|
+
onToggleRowSelect: ue,
|
|
2645
|
+
onEditRow: c[0] ||= (e) => z("edit-row", e),
|
|
2646
|
+
onContextMenu: se,
|
|
2647
|
+
onSelectCell: ae,
|
|
2648
|
+
onUpdateCell: c[1] ||= (e, t, n) => z("update-cell", e, t, n),
|
|
2649
|
+
onEditingChange: pe
|
|
2650
|
+
}, null, 8, [
|
|
2651
|
+
"rows",
|
|
2652
|
+
"scroll-element-ref",
|
|
2653
|
+
"total-table-width",
|
|
2654
|
+
"selected-cell",
|
|
2655
|
+
"editing-row-id",
|
|
2656
|
+
"pagination-state"
|
|
2657
|
+
])) : W.value.length > 0 ? (y(), i(fn, {
|
|
2658
|
+
key: 1,
|
|
2659
|
+
rows: W.value,
|
|
2660
|
+
"total-table-width": U.value,
|
|
2661
|
+
"selected-cell": B.value,
|
|
2662
|
+
"editing-row-id": V.value,
|
|
2663
|
+
"pagination-state": K.value,
|
|
2664
|
+
onToggleRowSelect: ue,
|
|
2665
|
+
onEditRow: c[2] ||= (e) => z("edit-row", e),
|
|
2666
|
+
onContextMenu: se,
|
|
2667
|
+
onSelectCell: ae,
|
|
2668
|
+
onUpdateCell: c[3] ||= (e, t, n) => z("update-cell", e, t, n),
|
|
2669
|
+
onEditingChange: pe
|
|
2670
|
+
}, null, 8, [
|
|
2671
|
+
"rows",
|
|
2672
|
+
"total-table-width",
|
|
2673
|
+
"selected-cell",
|
|
2674
|
+
"editing-row-id",
|
|
2675
|
+
"pagination-state"
|
|
2676
|
+
])) : k.value ? (y(), o("div", {
|
|
2677
|
+
key: 2,
|
|
2678
|
+
class: "shrink-0",
|
|
2679
|
+
style: g({ width: U.value + "px" })
|
|
2680
|
+
}, [s("table", {
|
|
2681
|
+
class: "border-separate border-spacing-0 table-fixed w-full border-0 bg-transparent",
|
|
2682
|
+
style: g({ width: U.value + "px" })
|
|
2683
|
+
}, [s("tbody", null, [(y(), o(e, null, S(Tn, (t) => s("tr", { key: t }, [
|
|
2684
|
+
s("td", {
|
|
2685
|
+
class: "sticky left-0 z-10 py-1.5 align-middle",
|
|
2686
|
+
style: g({
|
|
2687
|
+
width: "44px",
|
|
2688
|
+
minWidth: "44px",
|
|
2689
|
+
backgroundColor: "var(--st-bg)",
|
|
2690
|
+
borderBottom: T(b) ? "1px solid var(--st-border)" : "none"
|
|
2691
|
+
})
|
|
2692
|
+
}, null, 4),
|
|
2693
|
+
s("td", {
|
|
2694
|
+
class: "sticky z-10 px-1 py-1.5 text-center align-middle",
|
|
2695
|
+
style: g({
|
|
2696
|
+
width: "40px",
|
|
2697
|
+
minWidth: "40px",
|
|
2698
|
+
left: "44px",
|
|
2699
|
+
backgroundColor: "var(--st-bg)",
|
|
2700
|
+
borderBottom: T(b) ? "1px solid var(--st-border)" : "none",
|
|
2701
|
+
boxShadow: de.value
|
|
2702
|
+
})
|
|
2703
|
+
}, null, 4),
|
|
2704
|
+
(y(!0), o(e, null, S(G.value, (e, n) => (y(), o("td", {
|
|
2705
|
+
key: e.id,
|
|
2706
|
+
class: "px-2 py-1.5 align-middle",
|
|
2707
|
+
style: g({
|
|
2708
|
+
width: e.getSize() + "px",
|
|
2709
|
+
borderBottom: T(b) ? "1px solid var(--st-border)" : "none",
|
|
2710
|
+
backgroundColor: "var(--st-bg)"
|
|
2711
|
+
})
|
|
2712
|
+
}, [s("div", {
|
|
2713
|
+
class: "animate-pulse rounded max-w-full",
|
|
2714
|
+
style: g({
|
|
2715
|
+
width: p(t - 1, n) + "%",
|
|
2716
|
+
height: "12px",
|
|
2717
|
+
backgroundColor: "var(--st-border-secondary)"
|
|
2718
|
+
})
|
|
2719
|
+
}, null, 4)], 4))), 128))
|
|
2720
|
+
])), 64))])], 4)], 4)) : a("", !0)], 2), W.value.length === 0 && !k.value ? (y(), o("div", mn, [s("div", hn, [
|
|
2721
|
+
s("div", gn, [(y(), o("svg", _n, [...c[13] ||= [s("rect", {
|
|
2722
|
+
x: "3",
|
|
2723
|
+
y: "3",
|
|
2724
|
+
width: "18",
|
|
2725
|
+
height: "18",
|
|
2726
|
+
rx: "2"
|
|
2727
|
+
}, null, -1), s("path", { d: "M3 9h18M3 15h18M9 9v9M15 9v9" }, null, -1)]]))]),
|
|
2728
|
+
s("div", vn, [s("p", yn, C(T(A)), 1), s("p", bn, C(T(j)), 1)]),
|
|
2729
|
+
v.value.insert ? (y(), o("div", xn, [
|
|
2730
|
+
F.value ? (y(), o("button", {
|
|
2731
|
+
key: 0,
|
|
2732
|
+
class: "flex items-center gap-1.5 px-3 py-1 rounded text-[13px] font-medium transition-colors",
|
|
2733
|
+
style: {
|
|
2734
|
+
backgroundColor: "var(--st-accent)",
|
|
2735
|
+
color: "var(--st-text-on-accent)"
|
|
2736
|
+
},
|
|
2737
|
+
onClick: c[4] ||= (e) => T(I)()
|
|
2738
|
+
}, C(T(N)), 1)) : T(N) ? (y(), o("div", Sn, [s("button", {
|
|
2739
|
+
class: "flex items-center gap-1.5 px-3 py-1 rounded-l text-[13px] font-medium transition-colors",
|
|
2740
|
+
style: {
|
|
2741
|
+
backgroundColor: "var(--st-accent)",
|
|
2742
|
+
color: "var(--st-text-on-accent)"
|
|
2743
|
+
},
|
|
2744
|
+
onClick: c[5] ||= (e) => T(I)()
|
|
2745
|
+
}, C(T(N)), 1), s("button", {
|
|
2746
|
+
class: "flex items-center self-stretch px-1.5 rounded-r transition-colors",
|
|
2747
|
+
style: {
|
|
2748
|
+
backgroundColor: "var(--st-accent)",
|
|
2749
|
+
color: "var(--st-text-on-accent)",
|
|
2750
|
+
borderLeft: "1px solid var(--st-accent-hover)"
|
|
2751
|
+
},
|
|
2752
|
+
onClick: c[6] ||= (e) => L.value = !L.value
|
|
2753
|
+
}, [...c[14] ||= [s("svg", {
|
|
2754
|
+
class: "w-3 h-3",
|
|
2755
|
+
viewBox: "0 0 16 16",
|
|
2756
|
+
fill: "currentColor"
|
|
2757
|
+
}, [s("path", { d: "M4.427 6.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 6H4.604a.25.25 0 00-.177.427z" })], -1)]])])) : (y(), o("button", {
|
|
2758
|
+
key: 2,
|
|
2759
|
+
class: "flex items-center gap-1.5 px-3 py-1 rounded text-[13px] font-medium transition-colors",
|
|
2760
|
+
style: {
|
|
2761
|
+
backgroundColor: "var(--st-accent)",
|
|
2762
|
+
color: "var(--st-text-on-accent)"
|
|
2763
|
+
},
|
|
2764
|
+
onClick: c[7] ||= (e) => L.value = !L.value
|
|
2765
|
+
}, [...c[15] ||= [l(" Insert ", -1), s("svg", {
|
|
2766
|
+
class: "w-3 h-3",
|
|
2767
|
+
viewBox: "0 0 16 16",
|
|
2768
|
+
fill: "currentColor"
|
|
2769
|
+
}, [s("path", { d: "M4.427 6.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 6H4.604a.25.25 0 00-.177.427z" })], -1)]])),
|
|
2770
|
+
L.value ? (y(), o("div", Cn, [
|
|
2771
|
+
s("button", {
|
|
2772
|
+
class: "w-full text-left px-3 py-1.5 hover-menu-item",
|
|
2773
|
+
style: { color: "var(--st-text)" },
|
|
2774
|
+
onClick: c[8] ||= (e) => {
|
|
2775
|
+
T(ee)(), L.value = !1;
|
|
2776
|
+
}
|
|
2777
|
+
}, " Insert row "),
|
|
2778
|
+
s("button", {
|
|
2779
|
+
class: "w-full text-left px-3 py-1.5 hover-menu-item",
|
|
2780
|
+
style: { color: "var(--st-text)" },
|
|
2781
|
+
onClick: c[9] ||= (e) => L.value = !1
|
|
2782
|
+
}, " Insert column "),
|
|
2783
|
+
c[16] ||= s("div", {
|
|
2784
|
+
class: "my-1",
|
|
2785
|
+
style: { borderTop: "1px solid var(--st-border-secondary)" }
|
|
2786
|
+
}, null, -1),
|
|
2787
|
+
s("button", {
|
|
2788
|
+
class: "w-full text-left px-3 py-1.5 hover-menu-item",
|
|
2789
|
+
style: { color: "var(--st-text)" },
|
|
2790
|
+
onClick: c[10] ||= (e) => L.value = !1
|
|
2791
|
+
}, " Import data from CSV ")
|
|
2792
|
+
])) : a("", !0),
|
|
2793
|
+
(y(), i(t, { to: "body" }, [L.value ? (y(), o("div", {
|
|
2794
|
+
key: 0,
|
|
2795
|
+
class: "fixed inset-0 z-40",
|
|
2796
|
+
onClick: c[11] ||= (e) => L.value = !1
|
|
2797
|
+
})) : a("", !0)]))
|
|
2798
|
+
])) : a("", !0)
|
|
2799
|
+
])])) : a("", !0)], 2));
|
|
2800
|
+
}
|
|
2801
|
+
}, [["__scopeId", "data-v-c262480e"]]), Dn = {
|
|
2802
|
+
class: "px-3 py-1.5 flex items-center gap-3 text-[13px] shrink-0",
|
|
2803
|
+
style: {
|
|
2804
|
+
borderTop: "1px solid var(--st-border)",
|
|
2805
|
+
backgroundColor: "var(--st-bg)",
|
|
2806
|
+
color: "var(--st-text-secondary)"
|
|
2807
|
+
}
|
|
2808
|
+
}, On = ["disabled"], kn = { class: "flex items-center gap-1.5" }, An = ["value", "max"], jn = {
|
|
2809
|
+
key: 1,
|
|
2810
|
+
class: "tabular-nums",
|
|
2811
|
+
style: { color: "var(--st-text)" }
|
|
2812
|
+
}, Mn = ["disabled"], Nn = { class: "flex items-center gap-1.5" }, Pn = ["value"], Fn = {
|
|
2813
|
+
class: "tabular-nums px-2 py-0.5 rounded",
|
|
2814
|
+
style: {
|
|
2815
|
+
color: "var(--st-accent)",
|
|
2816
|
+
backgroundColor: "var(--st-accent-bg)",
|
|
2817
|
+
border: "1px solid var(--st-accent-border-light)"
|
|
2818
|
+
}
|
|
2819
|
+
}, In = ["disabled"], Ln = ["disabled"], Rn = {
|
|
2820
|
+
key: 0,
|
|
2821
|
+
class: "w-3 h-3 animate-spin",
|
|
2822
|
+
viewBox: "0 0 16 16",
|
|
2823
|
+
fill: "none",
|
|
2824
|
+
stroke: "currentColor",
|
|
2825
|
+
"stroke-width": "2"
|
|
2826
|
+
}, zn = { style: { color: "var(--st-text-tertiary)" } }, Bn = {
|
|
2827
|
+
class: "text-[13px] mb-4",
|
|
2828
|
+
style: { color: "var(--st-text-secondary)" }
|
|
2829
|
+
}, Vn = { class: "flex items-center justify-end gap-2" }, Hn = {
|
|
2830
|
+
__name: "TablePagination",
|
|
2831
|
+
props: {
|
|
2832
|
+
table: {
|
|
2833
|
+
type: Object,
|
|
2834
|
+
required: !0
|
|
2835
|
+
},
|
|
2836
|
+
totalCount: {
|
|
2837
|
+
type: Number,
|
|
2838
|
+
default: null
|
|
2839
|
+
},
|
|
2840
|
+
hasRandomAccess: {
|
|
2841
|
+
type: Boolean,
|
|
2842
|
+
default: !0
|
|
2843
|
+
},
|
|
2844
|
+
stagedEdits: {
|
|
2845
|
+
type: Boolean,
|
|
2846
|
+
default: !1
|
|
2847
|
+
},
|
|
2848
|
+
pendingEditCount: {
|
|
2849
|
+
type: Number,
|
|
2850
|
+
default: 0
|
|
2851
|
+
},
|
|
2852
|
+
committing: {
|
|
2853
|
+
type: Boolean,
|
|
2854
|
+
default: !1
|
|
2855
|
+
},
|
|
2856
|
+
countLabelSingular: {
|
|
2857
|
+
type: String,
|
|
2858
|
+
default: "record"
|
|
2859
|
+
},
|
|
2860
|
+
countLabelPlural: {
|
|
2861
|
+
type: String,
|
|
2862
|
+
default: "records"
|
|
2863
|
+
}
|
|
2864
|
+
},
|
|
2865
|
+
emits: ["commit", "discard"],
|
|
2866
|
+
setup(n, { emit: c }) {
|
|
2867
|
+
let u = d("themeVars", {}), f = d("tableSourceRows", null), p = n, m = c, h = r(() => p.table.getState().pagination.pageIndex), _ = r(() => p.table.getState().pagination.pageSize), v = r(() => p.totalCount !== null && p.totalCount !== void 0 && Number.isFinite(Number(p.totalCount))), b = r(() => {
|
|
2868
|
+
if (v.value) {
|
|
2869
|
+
let e = Math.max(1, _.value), t = Number(p.totalCount), n = Math.ceil(t / e);
|
|
2870
|
+
return Math.max(1, n);
|
|
2871
|
+
}
|
|
2872
|
+
return p.table.getPageCount();
|
|
2873
|
+
}), S = r(() => v.value ? h.value > 0 : p.table.getCanPreviousPage()), E = r(() => v.value ? h.value + 1 < b.value : p.table.getCanNextPage()), D = r(() => p.totalCount !== null && p.totalCount !== void 0 ? p.totalCount : (f != null && w(f), p.table.getFilteredRowModel().rows.length));
|
|
2874
|
+
function O(e) {
|
|
2875
|
+
let t = Math.max(0, Math.min(e, b.value - 1));
|
|
2876
|
+
p.table.setPageIndex(t);
|
|
2877
|
+
}
|
|
2878
|
+
function k(e) {
|
|
2879
|
+
let t = parseInt(e.target.value, 10);
|
|
2880
|
+
isNaN(t) || O(t - 1);
|
|
2881
|
+
}
|
|
2882
|
+
let A = x(!1);
|
|
2883
|
+
function j() {
|
|
2884
|
+
p.pendingEditCount !== 0 && (A.value = !0);
|
|
2885
|
+
}
|
|
2886
|
+
function ee() {
|
|
2887
|
+
m("discard"), A.value = !1;
|
|
2888
|
+
}
|
|
2889
|
+
return (r, c) => (y(), o("div", Dn, [
|
|
2890
|
+
s("button", {
|
|
2891
|
+
class: "p-1 rounded disabled:opacity-30 disabled:cursor-not-allowed transition-colors",
|
|
2892
|
+
disabled: !S.value,
|
|
2893
|
+
onClick: c[0] ||= (e) => n.table.previousPage()
|
|
2894
|
+
}, [...c[6] ||= [s("svg", {
|
|
2895
|
+
class: "w-4 h-4",
|
|
2896
|
+
viewBox: "0 0 16 16",
|
|
2897
|
+
fill: "currentColor"
|
|
2898
|
+
}, [s("path", { d: "M9.78 12.78a.75.75 0 01-1.06 0L4.47 8.53a.75.75 0 010-1.06l4.25-4.25a.75.75 0 011.06 1.06L6.06 8l3.72 3.72a.75.75 0 010 1.06z" })], -1)]], 8, On),
|
|
2899
|
+
s("div", kn, [
|
|
2900
|
+
c[7] ||= s("span", null, "Page", -1),
|
|
2901
|
+
n.hasRandomAccess ? (y(), o("input", {
|
|
2902
|
+
key: 0,
|
|
2903
|
+
type: "number",
|
|
2904
|
+
value: h.value + 1,
|
|
2905
|
+
min: "1",
|
|
2906
|
+
max: b.value,
|
|
2907
|
+
class: "w-12 rounded px-1.5 py-0.5 text-center text-[13px] outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",
|
|
2908
|
+
style: {
|
|
2909
|
+
backgroundColor: "var(--st-bg-input)",
|
|
2910
|
+
border: "1px solid var(--st-border-secondary)",
|
|
2911
|
+
color: "var(--st-text)"
|
|
2912
|
+
},
|
|
2913
|
+
onChange: k
|
|
2914
|
+
}, null, 40, An)) : (y(), o("span", jn, C(h.value + 1), 1)),
|
|
2915
|
+
s("span", null, "of " + C(b.value), 1)
|
|
2916
|
+
]),
|
|
2917
|
+
s("button", {
|
|
2918
|
+
class: "p-1 rounded disabled:opacity-30 disabled:cursor-not-allowed transition-colors",
|
|
2919
|
+
disabled: !E.value,
|
|
2920
|
+
onClick: c[1] ||= (e) => n.table.nextPage()
|
|
2921
|
+
}, [...c[8] ||= [s("svg", {
|
|
2922
|
+
class: "w-4 h-4",
|
|
2923
|
+
viewBox: "0 0 16 16",
|
|
2924
|
+
fill: "currentColor"
|
|
2925
|
+
}, [s("path", { d: "M6.22 3.22a.75.75 0 011.06 0l4.25 4.25a.75.75 0 010 1.06l-4.25 4.25a.75.75 0 01-1.06-1.06L9.94 8 6.22 4.28a.75.75 0 010-1.06z" })], -1)]], 8, Mn),
|
|
2926
|
+
c[14] ||= s("div", {
|
|
2927
|
+
class: "w-px h-4 mx-1",
|
|
2928
|
+
style: { backgroundColor: "var(--st-border)" }
|
|
2929
|
+
}, null, -1),
|
|
2930
|
+
s("div", Nn, [c[10] ||= s("span", null, "Rows per page:", -1), s("select", {
|
|
2931
|
+
value: _.value,
|
|
2932
|
+
class: "rounded px-1.5 py-0.5 text-[13px] outline-none cursor-pointer",
|
|
2933
|
+
style: {
|
|
2934
|
+
backgroundColor: "var(--st-bg-input)",
|
|
2935
|
+
border: "1px solid var(--st-border-secondary)",
|
|
2936
|
+
color: "var(--st-text)"
|
|
2937
|
+
},
|
|
2938
|
+
onChange: c[2] ||= (e) => n.table.setPageSize(Number(e.target.value))
|
|
2939
|
+
}, [...c[9] ||= [
|
|
2940
|
+
s("option", { value: 100 }, "100", -1),
|
|
2941
|
+
s("option", { value: 500 }, "500", -1),
|
|
2942
|
+
s("option", { value: 1e3 }, "1000", -1)
|
|
2943
|
+
]], 40, Pn)]),
|
|
2944
|
+
c[15] ||= s("div", { class: "flex-1" }, null, -1),
|
|
2945
|
+
n.stagedEdits && n.pendingEditCount > 0 ? (y(), o(e, { key: 0 }, [
|
|
2946
|
+
s("span", Fn, C(n.pendingEditCount) + " pending change" + C(n.pendingEditCount === 1 ? "" : "s"), 1),
|
|
2947
|
+
s("button", {
|
|
2948
|
+
class: "px-2 py-0.5 rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",
|
|
2949
|
+
style: {
|
|
2950
|
+
border: "1px solid var(--st-border-secondary)",
|
|
2951
|
+
color: "var(--st-text-secondary)",
|
|
2952
|
+
backgroundColor: "transparent"
|
|
2953
|
+
},
|
|
2954
|
+
disabled: n.committing,
|
|
2955
|
+
onClick: j
|
|
2956
|
+
}, " Clear edits ", 8, In),
|
|
2957
|
+
s("button", {
|
|
2958
|
+
class: "flex items-center gap-1.5 px-2.5 py-0.5 rounded font-medium transition-colors disabled:opacity-60 disabled:cursor-not-allowed",
|
|
2959
|
+
style: {
|
|
2960
|
+
backgroundColor: "var(--st-accent)",
|
|
2961
|
+
color: "var(--st-text-on-accent)"
|
|
2962
|
+
},
|
|
2963
|
+
disabled: n.committing,
|
|
2964
|
+
onClick: c[3] ||= (e) => m("commit")
|
|
2965
|
+
}, [n.committing ? (y(), o("svg", Rn, [...c[11] ||= [s("path", {
|
|
2966
|
+
d: "M8 1.5a6.5 6.5 0 1 1-6.5 6.5",
|
|
2967
|
+
"stroke-linecap": "round"
|
|
2968
|
+
}, null, -1)]])) : a("", !0), l(" " + C(n.committing ? "Committing…" : "Commit"), 1)], 8, Ln),
|
|
2969
|
+
c[12] ||= s("div", {
|
|
2970
|
+
class: "w-px h-4 mx-1",
|
|
2971
|
+
style: { backgroundColor: "var(--st-border)" }
|
|
2972
|
+
}, null, -1)
|
|
2973
|
+
], 64)) : a("", !0),
|
|
2974
|
+
s("span", zn, C(D.value.toLocaleString()) + " " + C(D.value === 1 ? n.countLabelSingular : n.countLabelPlural), 1),
|
|
2975
|
+
(y(), i(t, { to: "body" }, [A.value ? (y(), o("div", {
|
|
2976
|
+
key: 0,
|
|
2977
|
+
class: "fixed inset-0 z-[100] flex items-center justify-center",
|
|
2978
|
+
style: g({
|
|
2979
|
+
...T(u),
|
|
2980
|
+
backgroundColor: "var(--st-bg-overlay)"
|
|
2981
|
+
}),
|
|
2982
|
+
onClick: c[5] ||= M((e) => A.value = !1, ["self"])
|
|
2983
|
+
}, [s("div", {
|
|
2984
|
+
class: "rounded-lg shadow-xl p-5 w-80",
|
|
2985
|
+
style: g({
|
|
2986
|
+
...T(u),
|
|
2987
|
+
backgroundColor: "var(--st-bg-surface)",
|
|
2988
|
+
border: "1px solid var(--st-border-secondary)",
|
|
2989
|
+
color: "var(--st-text)"
|
|
2990
|
+
})
|
|
2991
|
+
}, [
|
|
2992
|
+
c[13] ||= s("h3", { class: "font-semibold text-[14px] mb-2" }, "Clear all pending edits?", -1),
|
|
2993
|
+
s("p", Bn, " This will discard " + C(n.pendingEditCount) + " pending change" + C(n.pendingEditCount === 1 ? "" : "s") + ". This action cannot be undone. ", 1),
|
|
2994
|
+
s("div", Vn, [s("button", {
|
|
2995
|
+
class: "px-3 py-1 rounded text-[13px]",
|
|
2996
|
+
style: {
|
|
2997
|
+
border: "1px solid var(--st-border-secondary)",
|
|
2998
|
+
color: "var(--st-text-secondary)"
|
|
2999
|
+
},
|
|
3000
|
+
onClick: c[4] ||= (e) => A.value = !1
|
|
3001
|
+
}, " Cancel "), s("button", {
|
|
3002
|
+
class: "px-3 py-1 rounded text-[13px] font-medium",
|
|
3003
|
+
style: {
|
|
3004
|
+
"background-color": "#ef4444",
|
|
3005
|
+
color: "white"
|
|
3006
|
+
},
|
|
3007
|
+
onClick: ee
|
|
3008
|
+
}, " Clear edits ")])
|
|
3009
|
+
], 4)], 4)) : a("", !0)]))
|
|
3010
|
+
]));
|
|
3011
|
+
}
|
|
3012
|
+
}, Un = {
|
|
3013
|
+
class: "px-5 py-4 flex items-center justify-between",
|
|
3014
|
+
style: { borderBottom: "1px solid var(--st-border)" }
|
|
3015
|
+
}, Wn = { class: "flex items-center gap-2" }, Gn = {
|
|
3016
|
+
class: "text-sm",
|
|
3017
|
+
style: { color: "var(--st-text)" }
|
|
3018
|
+
}, Kn = {
|
|
3019
|
+
class: "rounded px-2 py-0.5 text-[13px]",
|
|
3020
|
+
style: {
|
|
3021
|
+
backgroundColor: "var(--st-bg-input)",
|
|
3022
|
+
border: "1px solid var(--st-border-secondary)",
|
|
3023
|
+
color: "var(--st-text-secondary)"
|
|
3024
|
+
}
|
|
3025
|
+
}, qn = { class: "flex-1 overflow-auto px-5 py-4" }, Jn = {
|
|
3026
|
+
key: 0,
|
|
3027
|
+
class: "mb-6"
|
|
3028
|
+
}, Yn = { class: "flex items-start gap-4" }, Xn = { class: "w-40 shrink-0 pt-2" }, Zn = {
|
|
3029
|
+
class: "text-[13px] font-medium",
|
|
3030
|
+
style: { color: "var(--st-text)" }
|
|
3031
|
+
}, Qn = {
|
|
3032
|
+
class: "text-xs",
|
|
3033
|
+
style: { color: "var(--st-text-tertiary)" }
|
|
3034
|
+
}, $n = { class: "flex-1" }, er = ["disabled", "onClick"], tr = {
|
|
3035
|
+
class: "text-xs",
|
|
3036
|
+
style: { color: "var(--st-text-secondary)" }
|
|
3037
|
+
}, nr = ["value"], rr = ["onUpdate:modelValue", "placeholder"], ir = { key: 1 }, ar = { class: "flex items-start gap-4" }, or = { class: "w-40 shrink-0 pt-2" }, sr = {
|
|
3038
|
+
class: "text-[13px] font-medium",
|
|
3039
|
+
style: { color: "var(--st-text)" }
|
|
3040
|
+
}, cr = {
|
|
3041
|
+
class: "text-xs",
|
|
3042
|
+
style: { color: "var(--st-text-tertiary)" }
|
|
3043
|
+
}, lr = { class: "flex-1" }, ur = ["disabled", "onClick"], dr = {
|
|
3044
|
+
class: "text-xs",
|
|
3045
|
+
style: { color: "var(--st-text-secondary)" }
|
|
3046
|
+
}, fr = ["value"], pr = ["onUpdate:modelValue", "placeholder"], mr = {
|
|
3047
|
+
class: "px-5 py-3 flex items-center justify-end gap-2",
|
|
3048
|
+
style: { borderTop: "1px solid var(--st-border)" }
|
|
3049
|
+
}, hr = {
|
|
3050
|
+
__name: "RowEditPanel",
|
|
3051
|
+
props: {
|
|
3052
|
+
mode: {
|
|
3053
|
+
type: String,
|
|
3054
|
+
required: !0
|
|
3055
|
+
},
|
|
3056
|
+
rowData: {
|
|
3057
|
+
type: Object,
|
|
3058
|
+
default: null
|
|
3059
|
+
},
|
|
3060
|
+
table: {
|
|
3061
|
+
type: Object,
|
|
3062
|
+
required: !0
|
|
3063
|
+
},
|
|
3064
|
+
tableName: {
|
|
3065
|
+
type: String,
|
|
3066
|
+
default: "table"
|
|
3067
|
+
}
|
|
3068
|
+
},
|
|
3069
|
+
emits: ["save", "close"],
|
|
3070
|
+
setup(t, { emit: n }) {
|
|
3071
|
+
let i = d("themeVars", {}), l = t, u = n, f = r(() => l.table.getAllColumns().map((e) => ({
|
|
3072
|
+
id: e.id,
|
|
3073
|
+
meta: e.columnDef.meta || {}
|
|
3074
|
+
}))), p = r(() => l.mode === "insert" ? f.value.filter((e) => e.meta.insertable !== !1) : f.value), m = r(() => p.value.filter((e) => e.meta.isNullable === !1)), b = r(() => p.value.filter((e) => e.meta.isNullable !== !1)), w = x({});
|
|
3075
|
+
function E() {
|
|
3076
|
+
let e = {};
|
|
3077
|
+
f.value.forEach((t) => {
|
|
3078
|
+
l.mode === "update" && l.rowData ? e[t.id] = l.rowData[t.id] ?? "" : t.meta.defaultValue === void 0 ? e[t.id] = t.meta.type === "boolean" ? !1 : "" : e[t.id] = t.meta.defaultValue;
|
|
3079
|
+
}), w.value = e;
|
|
3080
|
+
}
|
|
3081
|
+
E();
|
|
3082
|
+
function D() {
|
|
3083
|
+
let e = { ...w.value };
|
|
3084
|
+
f.value.forEach((t) => {
|
|
3085
|
+
[
|
|
3086
|
+
"int8",
|
|
3087
|
+
"int4",
|
|
3088
|
+
"float8"
|
|
3089
|
+
].includes(t.meta.type) && e[t.id] !== "" && (e[t.id] = Number(e[t.id]));
|
|
3090
|
+
}), u("save", e);
|
|
3091
|
+
}
|
|
3092
|
+
function k(e) {
|
|
3093
|
+
e.key === "Escape" ? u("close") : (e.metaKey || e.ctrlKey) && e.key === "Enter" && D();
|
|
3094
|
+
}
|
|
3095
|
+
return _(() => {
|
|
3096
|
+
document.addEventListener("keydown", k);
|
|
3097
|
+
}), v(() => {
|
|
3098
|
+
document.removeEventListener("keydown", k);
|
|
3099
|
+
}), (n, r) => (y(), o("div", {
|
|
3100
|
+
class: "w-[420px] shrink-0 flex flex-col shadow-2xl overflow-hidden",
|
|
3101
|
+
style: g({
|
|
3102
|
+
...T(i),
|
|
3103
|
+
backgroundColor: "var(--st-bg)",
|
|
3104
|
+
borderLeft: "1px solid var(--st-border)"
|
|
3105
|
+
})
|
|
3106
|
+
}, [
|
|
3107
|
+
s("div", Un, [s("div", Wn, [s("span", Gn, C(t.mode === "insert" ? "Insert row into" : "Update row from"), 1), s("code", Kn, C(t.tableName), 1)]), s("button", {
|
|
3108
|
+
class: "w-6 h-6 flex items-center justify-center",
|
|
3109
|
+
style: { color: "var(--st-text-tertiary)" },
|
|
3110
|
+
onClick: r[0] ||= (e) => u("close")
|
|
3111
|
+
}, [...r[2] ||= [s("svg", {
|
|
3112
|
+
class: "w-4 h-4",
|
|
3113
|
+
viewBox: "0 0 16 16",
|
|
3114
|
+
fill: "currentColor"
|
|
3115
|
+
}, [s("path", { d: "M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z" })], -1)]])]),
|
|
3116
|
+
s("div", qn, [m.value.length > 0 ? (y(), o("div", Jn, [(y(!0), o(e, null, S(m.value, (n) => (y(), o("div", {
|
|
3117
|
+
key: n.id,
|
|
3118
|
+
class: "mb-4"
|
|
3119
|
+
}, [s("div", Yn, [s("div", Xn, [s("div", Zn, C(n.id), 1), s("div", Qn, C(n.meta.type), 1)]), s("div", $n, [n.meta.type === "boolean" ? (y(), o("button", {
|
|
3120
|
+
key: 0,
|
|
3121
|
+
class: h(["flex items-center gap-2", { "opacity-50 cursor-not-allowed": n.meta.readOnly && t.mode === "insert" }]),
|
|
3122
|
+
disabled: n.meta.readOnly && t.mode === "insert",
|
|
3123
|
+
onClick: (e) => !(n.meta.readOnly && t.mode === "insert") && (w.value[n.id] = !w.value[n.id])
|
|
3124
|
+
}, [s("span", {
|
|
3125
|
+
class: "inline-block w-8 h-[18px] rounded-full relative transition-colors",
|
|
3126
|
+
style: g({ backgroundColor: w.value[n.id] ? "var(--st-accent)" : "var(--st-toggle-off)" })
|
|
3127
|
+
}, [s("span", { class: h(["absolute top-[2px] w-[14px] h-[14px] rounded-full bg-white transition-transform", w.value[n.id] ? "left-[17px]" : "left-[2px]"]) }, null, 2)], 4), s("span", tr, C(w.value[n.id] ? "true" : "false"), 1)], 10, er)) : (y(), o(e, { key: 1 }, [n.meta.isPrimaryKey && t.mode === "update" || n.meta.readOnly && t.mode === "insert" ? (y(), o("input", {
|
|
3128
|
+
key: 0,
|
|
3129
|
+
value: w.value[n.id],
|
|
3130
|
+
class: "w-full rounded px-3 py-2 text-[13px] outline-none cursor-not-allowed",
|
|
3131
|
+
style: {
|
|
3132
|
+
backgroundColor: "var(--st-bg-input)",
|
|
3133
|
+
border: "1px solid var(--st-border-secondary)",
|
|
3134
|
+
color: "var(--st-text-secondary)"
|
|
3135
|
+
},
|
|
3136
|
+
disabled: ""
|
|
3137
|
+
}, null, 8, nr)) : ee((y(), o("textarea", {
|
|
3138
|
+
key: 1,
|
|
3139
|
+
"onUpdate:modelValue": (e) => w.value[n.id] = e,
|
|
3140
|
+
class: "w-full rounded px-3 py-2 text-[13px] outline-none resize-y min-h-[36px]",
|
|
3141
|
+
style: {
|
|
3142
|
+
backgroundColor: "var(--st-bg-input)",
|
|
3143
|
+
border: "1px solid var(--st-border-secondary)",
|
|
3144
|
+
color: "var(--st-text)"
|
|
3145
|
+
},
|
|
3146
|
+
rows: "1",
|
|
3147
|
+
placeholder: n.meta.placeholder ?? ""
|
|
3148
|
+
}, null, 8, rr)), [[O, w.value[n.id]]])], 64))])])]))), 128))])) : a("", !0), b.value.length > 0 ? (y(), o("div", ir, [r[3] ||= s("div", { class: "mb-3" }, [s("h3", {
|
|
3149
|
+
class: "text-sm font-medium",
|
|
3150
|
+
style: { color: "var(--st-text)" }
|
|
3151
|
+
}, "Optional Fields"), s("p", {
|
|
3152
|
+
class: "text-xs mt-0.5",
|
|
3153
|
+
style: { color: "var(--st-text-tertiary)" }
|
|
3154
|
+
}, "These are columns that do not need any value")], -1), (y(!0), o(e, null, S(b.value, (n) => (y(), o("div", {
|
|
3155
|
+
key: n.id,
|
|
3156
|
+
class: "mb-4"
|
|
3157
|
+
}, [s("div", ar, [s("div", or, [s("div", sr, C(n.id), 1), s("div", cr, C(n.meta.type), 1)]), s("div", lr, [n.meta.type === "boolean" ? (y(), o("button", {
|
|
3158
|
+
key: 0,
|
|
3159
|
+
class: h(["flex items-center gap-2", { "opacity-50 cursor-not-allowed": n.meta.readOnly && t.mode === "insert" }]),
|
|
3160
|
+
disabled: n.meta.readOnly && t.mode === "insert",
|
|
3161
|
+
onClick: (e) => !(n.meta.readOnly && t.mode === "insert") && (w.value[n.id] = !w.value[n.id])
|
|
3162
|
+
}, [s("span", {
|
|
3163
|
+
class: "inline-block w-8 h-[18px] rounded-full relative transition-colors",
|
|
3164
|
+
style: g({ backgroundColor: w.value[n.id] ? "var(--st-accent)" : "var(--st-toggle-off)" })
|
|
3165
|
+
}, [s("span", { class: h(["absolute top-[2px] w-[14px] h-[14px] rounded-full bg-white transition-transform", w.value[n.id] ? "left-[17px]" : "left-[2px]"]) }, null, 2)], 4), s("span", dr, C(w.value[n.id] ? "true" : "false"), 1)], 10, ur)) : (y(), o(e, { key: 1 }, [n.meta.readOnly && t.mode === "insert" ? (y(), o("input", {
|
|
3166
|
+
key: 0,
|
|
3167
|
+
value: w.value[n.id],
|
|
3168
|
+
class: "w-full rounded px-3 py-2 text-[13px] outline-none cursor-not-allowed",
|
|
3169
|
+
style: {
|
|
3170
|
+
backgroundColor: "var(--st-bg-input)",
|
|
3171
|
+
border: "1px solid var(--st-border-secondary)",
|
|
3172
|
+
color: "var(--st-text-secondary)"
|
|
3173
|
+
},
|
|
3174
|
+
disabled: ""
|
|
3175
|
+
}, null, 8, fr)) : ee((y(), o("textarea", {
|
|
3176
|
+
key: 1,
|
|
3177
|
+
"onUpdate:modelValue": (e) => w.value[n.id] = e,
|
|
3178
|
+
class: "w-full rounded px-3 py-2 text-[13px] outline-none resize-y min-h-[36px]",
|
|
3179
|
+
style: {
|
|
3180
|
+
backgroundColor: "var(--st-bg-input)",
|
|
3181
|
+
border: "1px solid var(--st-border-secondary)",
|
|
3182
|
+
color: "var(--st-text)"
|
|
3183
|
+
},
|
|
3184
|
+
rows: "1",
|
|
3185
|
+
placeholder: n.meta.placeholder ?? "NULL"
|
|
3186
|
+
}, null, 8, pr)), [[O, w.value[n.id]]])], 64))])])]))), 128))])) : a("", !0)]),
|
|
3187
|
+
s("div", mr, [s("button", {
|
|
3188
|
+
class: "px-3 py-1.5 rounded text-[13px] transition-colors",
|
|
3189
|
+
style: {
|
|
3190
|
+
border: "1px solid var(--st-border-secondary)",
|
|
3191
|
+
color: "var(--st-text-secondary)"
|
|
3192
|
+
},
|
|
3193
|
+
onClick: r[1] ||= (e) => u("close")
|
|
3194
|
+
}, " Cancel "), s("button", {
|
|
3195
|
+
class: "px-3 py-1.5 rounded text-[13px] font-medium transition-colors flex items-center gap-1.5",
|
|
3196
|
+
style: {
|
|
3197
|
+
backgroundColor: "var(--st-accent)",
|
|
3198
|
+
color: "var(--st-text-on-accent)"
|
|
3199
|
+
},
|
|
3200
|
+
onClick: D
|
|
3201
|
+
}, [...r[4] ||= [c(" Save <span class=\"opacity-60 flex items-center gap-0.5\"><svg viewBox=\"0 0 24 24\" class=\"w-3 h-3\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3\"></path></svg><svg viewBox=\"0 0 24 24\" class=\"w-3 h-3\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"9 10 4 15 9 20\"></polyline><path d=\"M20 4v7a4 4 0 0 1-4 4H4\"></path></svg></span>", 2)]])])
|
|
3202
|
+
], 4));
|
|
3203
|
+
}
|
|
3204
|
+
}, gr = {
|
|
3205
|
+
class: "w-52 rounded shadow-xl py-1 text-[13px]",
|
|
3206
|
+
style: {
|
|
3207
|
+
backgroundColor: "var(--st-bg-surface)",
|
|
3208
|
+
border: "1px solid var(--st-border-secondary)"
|
|
3209
|
+
}
|
|
3210
|
+
}, _r = {
|
|
3211
|
+
class: "w-3.5 h-3.5",
|
|
3212
|
+
style: { color: "var(--st-text-secondary)" },
|
|
3213
|
+
viewBox: "0 0 16 16",
|
|
3214
|
+
fill: "currentColor"
|
|
3215
|
+
}, vr = {
|
|
3216
|
+
class: "w-3.5 h-3.5",
|
|
3217
|
+
style: { color: "var(--st-text-secondary)" },
|
|
3218
|
+
viewBox: "0 0 16 16",
|
|
3219
|
+
fill: "currentColor"
|
|
3220
|
+
}, yr = {
|
|
3221
|
+
class: "w-3.5 h-3.5",
|
|
3222
|
+
style: { color: "var(--st-text-secondary)" },
|
|
3223
|
+
viewBox: "0 0 16 16",
|
|
3224
|
+
fill: "currentColor"
|
|
3225
|
+
}, br = {
|
|
3226
|
+
key: 0,
|
|
3227
|
+
class: "my-1",
|
|
3228
|
+
style: { borderTop: "1px solid var(--st-border-secondary)" }
|
|
3229
|
+
}, xr = ["disabled", "onClick"], Sr = ["innerHTML"], Cr = {
|
|
3230
|
+
class: "w-3.5 h-3.5",
|
|
3231
|
+
style: { color: "var(--st-text-secondary)" },
|
|
3232
|
+
viewBox: "0 0 16 16",
|
|
3233
|
+
fill: "currentColor"
|
|
3234
|
+
}, wr = /* @__PURE__ */ B({
|
|
3235
|
+
__name: "ContextMenu",
|
|
3236
|
+
props: {
|
|
3237
|
+
x: {
|
|
3238
|
+
type: Number,
|
|
3239
|
+
required: !0
|
|
3240
|
+
},
|
|
3241
|
+
y: {
|
|
3242
|
+
type: Number,
|
|
3243
|
+
required: !0
|
|
3244
|
+
},
|
|
3245
|
+
row: {
|
|
3246
|
+
type: Object,
|
|
3247
|
+
default: null
|
|
3248
|
+
},
|
|
3249
|
+
cell: {
|
|
3250
|
+
type: Object,
|
|
3251
|
+
default: null
|
|
3252
|
+
},
|
|
3253
|
+
customActions: {
|
|
3254
|
+
type: Array,
|
|
3255
|
+
default: () => []
|
|
3256
|
+
},
|
|
3257
|
+
allowRowEdit: {
|
|
3258
|
+
type: Boolean,
|
|
3259
|
+
default: !1
|
|
3260
|
+
},
|
|
3261
|
+
allowRowDelete: {
|
|
3262
|
+
type: Boolean,
|
|
3263
|
+
default: !1
|
|
3264
|
+
}
|
|
3265
|
+
},
|
|
3266
|
+
emits: [
|
|
3267
|
+
"close",
|
|
3268
|
+
"edit-row",
|
|
3269
|
+
"delete-row",
|
|
3270
|
+
"filter-by-value",
|
|
3271
|
+
"undo-row",
|
|
3272
|
+
"undo-cell",
|
|
3273
|
+
"row-action"
|
|
3274
|
+
],
|
|
3275
|
+
setup(n, { emit: c }) {
|
|
3276
|
+
let u = d("themeVars", {}), f = d("getRowPendingState", () => null), p = d("getCellPendingState", () => null), m = n, b = c, w = r(() => m.row ? f(m.row.id) : null), E = r(() => m.row && m.cell ? p(m.row.id, m.cell.column.id) : null), D = r(() => w.value === "insert" ? "Discard new row" : w.value === "delete" ? "Restore row" : w.value === "update" ? "Undo row changes" : null), O = x(null), k = r(() => m.cell ? m.cell.getValue() : null), A = r(() => m.cell ? m.cell.column.id : null);
|
|
3277
|
+
function j(e) {
|
|
3278
|
+
if (navigator.clipboard && document.hasFocus()) navigator.clipboard.writeText(e);
|
|
3279
|
+
else {
|
|
3280
|
+
let t = document.createElement("textarea");
|
|
3281
|
+
t.value = e, t.style.cssText = "position:fixed;opacity:0;pointer-events:none", document.body.appendChild(t), t.focus(), t.select(), document.execCommand("copy"), document.body.removeChild(t);
|
|
3282
|
+
}
|
|
3283
|
+
}
|
|
3284
|
+
function ee() {
|
|
3285
|
+
k.value !== null && k.value !== void 0 && j(String(k.value)), b("close");
|
|
3286
|
+
}
|
|
3287
|
+
function M() {
|
|
3288
|
+
m.row && j(JSON.stringify(m.row.original, null, 2)), b("close");
|
|
3289
|
+
}
|
|
3290
|
+
function N() {
|
|
3291
|
+
A.value && k.value !== null && k.value !== void 0 && b("filter-by-value", A.value, String(k.value)), b("close");
|
|
3292
|
+
}
|
|
3293
|
+
function P() {
|
|
3294
|
+
b("edit-row"), b("close");
|
|
3295
|
+
}
|
|
3296
|
+
function te() {
|
|
3297
|
+
b("delete-row"), b("close");
|
|
3298
|
+
}
|
|
3299
|
+
function F() {
|
|
3300
|
+
b("undo-row"), b("close");
|
|
3301
|
+
}
|
|
3302
|
+
function I() {
|
|
3303
|
+
A.value && b("undo-cell", A.value), b("close");
|
|
3304
|
+
}
|
|
3305
|
+
function L() {
|
|
3306
|
+
return m.row?.original ?? null;
|
|
3307
|
+
}
|
|
3308
|
+
function z(e, t) {
|
|
3309
|
+
if (e == null || e.divider) return !1;
|
|
3310
|
+
let n = e.disabled;
|
|
3311
|
+
if (n == null) return !1;
|
|
3312
|
+
let r = t?.original ?? t ?? null;
|
|
3313
|
+
return typeof n == "function" ? !!n(r) : !!n;
|
|
3314
|
+
}
|
|
3315
|
+
function B(e) {
|
|
3316
|
+
z(e, m.row) || (b("row-action", e.key, L()), b("close"));
|
|
3317
|
+
}
|
|
3318
|
+
R(O, () => {
|
|
3319
|
+
b("close");
|
|
3320
|
+
});
|
|
3321
|
+
function V(e) {
|
|
3322
|
+
e.key === "Escape" && b("close");
|
|
3323
|
+
}
|
|
3324
|
+
_(() => {
|
|
3325
|
+
document.addEventListener("keydown", V);
|
|
3326
|
+
}), v(() => {
|
|
3327
|
+
document.removeEventListener("keydown", V);
|
|
3328
|
+
});
|
|
3329
|
+
let H = r(() => {
|
|
3330
|
+
let e = window.innerWidth, t = window.innerHeight, n = {
|
|
3331
|
+
position: "fixed",
|
|
3332
|
+
zIndex: 9999
|
|
3333
|
+
};
|
|
3334
|
+
return m.y > t / 2 ? n.bottom = `${t - m.y}px` : n.top = `${m.y}px`, m.x > e / 2 ? n.right = `${e - m.x}px` : n.left = `${m.x}px`, n;
|
|
3335
|
+
});
|
|
3336
|
+
return (r, c) => (y(), i(t, { to: "body" }, [s("div", {
|
|
3337
|
+
ref_key: "menuRef",
|
|
3338
|
+
ref: O,
|
|
3339
|
+
style: g({
|
|
3340
|
+
...T(u),
|
|
3341
|
+
...H.value
|
|
3342
|
+
})
|
|
3343
|
+
}, [s("div", gr, [
|
|
3344
|
+
s("button", {
|
|
3345
|
+
class: "w-full text-left px-3 py-1.5 flex items-center gap-2 hover-menu-item",
|
|
3346
|
+
style: { color: "var(--st-text)" },
|
|
3347
|
+
onClick: ee
|
|
3348
|
+
}, [(y(), o("svg", _r, [...c[0] ||= [s("path", { d: "M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25zM5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25z" }, null, -1)]])), c[1] ||= l(" Copy cell ", -1)]),
|
|
3349
|
+
s("button", {
|
|
3350
|
+
class: "w-full text-left px-3 py-1.5 flex items-center gap-2 hover-menu-item",
|
|
3351
|
+
style: { color: "var(--st-text)" },
|
|
3352
|
+
onClick: M
|
|
3353
|
+
}, [(y(), o("svg", vr, [...c[2] ||= [s("path", { d: "M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25zM5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25z" }, null, -1)]])), c[3] ||= l(" Copy row ", -1)]),
|
|
3354
|
+
c[14] ||= s("div", {
|
|
3355
|
+
class: "my-1",
|
|
3356
|
+
style: { borderTop: "1px solid var(--st-border-secondary)" }
|
|
3357
|
+
}, null, -1),
|
|
3358
|
+
s("button", {
|
|
3359
|
+
class: "w-full text-left px-3 py-1.5 flex items-center gap-2 hover-menu-item",
|
|
3360
|
+
style: { color: "var(--st-text)" },
|
|
3361
|
+
onClick: N
|
|
3362
|
+
}, [(y(), o("svg", yr, [...c[4] ||= [s("path", { d: "M.75 3a.75.75 0 000 1.5h14.5a.75.75 0 000-1.5H.75zM3 7.75A.75.75 0 013.75 7h8.5a.75.75 0 010 1.5h-8.5A.75.75 0 013 7.75zm3 4a.75.75 0 01.75-.75h2.5a.75.75 0 010 1.5h-2.5a.75.75 0 01-.75-.75z" }, null, -1)]])), c[5] ||= l(" Filter by value ", -1)]),
|
|
3363
|
+
E.value === "modified" || D.value ? (y(), o(e, { key: 0 }, [
|
|
3364
|
+
c[8] ||= s("div", {
|
|
3365
|
+
class: "my-1",
|
|
3366
|
+
style: { borderTop: "1px solid var(--st-border-secondary)" }
|
|
3367
|
+
}, null, -1),
|
|
3368
|
+
E.value === "modified" ? (y(), o("button", {
|
|
3369
|
+
key: 0,
|
|
3370
|
+
class: "w-full text-left px-3 py-1.5 flex items-center gap-2 hover-menu-item",
|
|
3371
|
+
style: { color: "var(--st-accent)" },
|
|
3372
|
+
onClick: I
|
|
3373
|
+
}, [...c[6] ||= [s("svg", {
|
|
3374
|
+
class: "w-3.5 h-3.5",
|
|
3375
|
+
viewBox: "0 0 16 16",
|
|
3376
|
+
fill: "none",
|
|
3377
|
+
stroke: "currentColor",
|
|
3378
|
+
"stroke-width": "2",
|
|
3379
|
+
"stroke-linecap": "round",
|
|
3380
|
+
"stroke-linejoin": "round"
|
|
3381
|
+
}, [s("path", { d: "M3 7h7a4 4 0 0 1 0 8H6" }), s("path", { d: "M6 4L3 7l3 3" })], -1), l(" Undo cell change ", -1)]])) : a("", !0),
|
|
3382
|
+
D.value ? (y(), o("button", {
|
|
3383
|
+
key: 1,
|
|
3384
|
+
class: "w-full text-left px-3 py-1.5 flex items-center gap-2 hover-menu-item",
|
|
3385
|
+
style: { color: "var(--st-accent)" },
|
|
3386
|
+
onClick: F
|
|
3387
|
+
}, [c[7] ||= s("svg", {
|
|
3388
|
+
class: "w-3.5 h-3.5",
|
|
3389
|
+
viewBox: "0 0 16 16",
|
|
3390
|
+
fill: "none",
|
|
3391
|
+
stroke: "currentColor",
|
|
3392
|
+
"stroke-width": "2",
|
|
3393
|
+
"stroke-linecap": "round",
|
|
3394
|
+
"stroke-linejoin": "round"
|
|
3395
|
+
}, [s("path", { d: "M3 7h7a4 4 0 0 1 0 8H6" }), s("path", { d: "M6 4L3 7l3 3" })], -1), l(" " + C(D.value), 1)])) : a("", !0)
|
|
3396
|
+
], 64)) : a("", !0),
|
|
3397
|
+
n.customActions.length > 0 ? (y(), o(e, { key: 1 }, [c[9] ||= s("div", {
|
|
3398
|
+
class: "my-1",
|
|
3399
|
+
style: { borderTop: "1px solid var(--st-border-secondary)" }
|
|
3400
|
+
}, null, -1), (y(!0), o(e, null, S(n.customActions, (t, n) => (y(), o(e, { key: t.divider ? `divider-${n}` : t.key }, [t.divider ? (y(), o("div", br)) : (y(), o("button", {
|
|
3401
|
+
key: 1,
|
|
3402
|
+
type: "button",
|
|
3403
|
+
class: h(["w-full text-left px-3 py-1.5 flex items-center gap-2 hover-menu-item disabled:pointer-events-none", { "opacity-40 cursor-not-allowed": z(t, m.row) }]),
|
|
3404
|
+
disabled: z(t, m.row),
|
|
3405
|
+
style: g({ color: T(pt)(t) ? "var(--st-danger)" : "var(--st-text)" }),
|
|
3406
|
+
onClick: (e) => B(t)
|
|
3407
|
+
}, [t.icon ? (y(), o("span", {
|
|
3408
|
+
key: 0,
|
|
3409
|
+
class: "shrink-0 w-3.5 h-3.5 inline-flex items-center justify-center [&_svg]:max-w-full [&_svg]:max-h-full",
|
|
3410
|
+
innerHTML: t.icon
|
|
3411
|
+
}, null, 8, Sr)) : a("", !0), s("span", null, C(t.label), 1)], 14, xr))], 64))), 128))], 64)) : a("", !0),
|
|
3412
|
+
n.allowRowEdit || n.allowRowDelete ? (y(), o(e, { key: 2 }, [
|
|
3413
|
+
c[13] ||= s("div", {
|
|
3414
|
+
class: "my-1",
|
|
3415
|
+
style: { borderTop: "1px solid var(--st-border-secondary)" }
|
|
3416
|
+
}, null, -1),
|
|
3417
|
+
n.allowRowEdit ? (y(), o("button", {
|
|
3418
|
+
key: 0,
|
|
3419
|
+
class: "w-full text-left px-3 py-1.5 flex items-center gap-2 hover-menu-item",
|
|
3420
|
+
style: { color: "var(--st-text)" },
|
|
3421
|
+
onClick: P
|
|
3422
|
+
}, [(y(), o("svg", Cr, [...c[10] ||= [s("path", { d: "M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61z" }, null, -1)]])), c[11] ||= l(" Edit row ", -1)])) : a("", !0),
|
|
3423
|
+
n.allowRowDelete && w.value !== "delete" ? (y(), o("button", {
|
|
3424
|
+
key: 1,
|
|
3425
|
+
class: "w-full text-left px-3 py-1.5 flex items-center gap-2 hover-menu-item",
|
|
3426
|
+
style: { color: "#ef4444" },
|
|
3427
|
+
onClick: te
|
|
3428
|
+
}, [...c[12] ||= [s("svg", {
|
|
3429
|
+
class: "w-3.5 h-3.5",
|
|
3430
|
+
viewBox: "0 0 16 16",
|
|
3431
|
+
fill: "currentColor"
|
|
3432
|
+
}, [s("path", { d: "M6.5 1.75a.25.25 0 01.25-.25h2.5a.25.25 0 01.25.25V3h-3V1.75zM11 3V1.75C11 .784 10.216 0 9.25 0h-2.5C5.784 0 5 .784 5 1.75V3H2.75a.75.75 0 000 1.5h.31l.72 9.678A1.75 1.75 0 005.525 16h4.95a1.75 1.75 0 001.745-1.822L12.94 4.5h.31a.75.75 0 000-1.5H11z" })], -1), l(" Delete row ", -1)]])) : a("", !0)
|
|
3433
|
+
], 64)) : a("", !0)
|
|
3434
|
+
])], 4)]));
|
|
3435
|
+
}
|
|
3436
|
+
}, [["__scopeId", "data-v-3f2648fa"]]), Tr = { class: "px-5 pt-5 pb-4" }, Er = { style: { color: "var(--st-text-secondary)" } }, Dr = {
|
|
3437
|
+
class: "px-5 py-3 flex items-center justify-end gap-2",
|
|
3438
|
+
style: { borderTop: "1px solid var(--st-border-secondary)" }
|
|
3439
|
+
}, Or = {
|
|
3440
|
+
__name: "DeleteRowsConfirmDialog",
|
|
3441
|
+
props: {
|
|
3442
|
+
modelValue: {
|
|
3443
|
+
type: Boolean,
|
|
3444
|
+
default: !1
|
|
3445
|
+
},
|
|
3446
|
+
rowCount: {
|
|
3447
|
+
type: Number,
|
|
3448
|
+
required: !0
|
|
3449
|
+
}
|
|
3450
|
+
},
|
|
3451
|
+
emits: ["update:modelValue", "confirm"],
|
|
3452
|
+
setup(e, { emit: n }) {
|
|
3453
|
+
let r = d("themeVars", {}), c = n;
|
|
3454
|
+
function l() {
|
|
3455
|
+
c("update:modelValue", !1);
|
|
3456
|
+
}
|
|
3457
|
+
function u() {
|
|
3458
|
+
c("confirm");
|
|
3459
|
+
}
|
|
3460
|
+
return (n, c) => (y(), i(t, { to: "body" }, [e.modelValue ? (y(), o("div", {
|
|
3461
|
+
key: 0,
|
|
3462
|
+
class: "fixed inset-0 z-50 flex items-center justify-center",
|
|
3463
|
+
style: g({ ...T(r) })
|
|
3464
|
+
}, [s("div", {
|
|
3465
|
+
class: "fixed inset-0",
|
|
3466
|
+
style: { backgroundColor: "var(--st-bg-overlay)" },
|
|
3467
|
+
onClick: l
|
|
3468
|
+
}), s("div", {
|
|
3469
|
+
class: "relative rounded-lg shadow-2xl w-96 text-[13px]",
|
|
3470
|
+
style: g({
|
|
3471
|
+
...T(r),
|
|
3472
|
+
backgroundColor: "var(--st-bg-surface)",
|
|
3473
|
+
border: "1px solid var(--st-border-secondary)"
|
|
3474
|
+
})
|
|
3475
|
+
}, [s("div", Tr, [c[0] ||= s("h3", {
|
|
3476
|
+
class: "font-medium text-sm mb-2",
|
|
3477
|
+
style: { color: "var(--st-text)" }
|
|
3478
|
+
}, "Confirm deletion", -1), s("p", Er, " Are you sure you want to delete " + C(e.rowCount) + " row" + C(e.rowCount > 1 ? "s" : "") + "? This action cannot be undone. ", 1)]), s("div", Dr, [s("button", {
|
|
3479
|
+
type: "button",
|
|
3480
|
+
class: "px-3 py-1.5 rounded text-[13px] transition-colors",
|
|
3481
|
+
style: {
|
|
3482
|
+
border: "1px solid var(--st-border-secondary)",
|
|
3483
|
+
color: "var(--st-text-secondary)"
|
|
3484
|
+
},
|
|
3485
|
+
onClick: l
|
|
3486
|
+
}, " Cancel "), s("button", {
|
|
3487
|
+
type: "button",
|
|
3488
|
+
class: "px-3 py-1.5 rounded bg-red-600 text-white hover:bg-red-700 transition-colors font-medium",
|
|
3489
|
+
onClick: u
|
|
3490
|
+
}, " Delete " + C(e.rowCount) + " row" + C(e.rowCount > 1 ? "s" : ""), 1)])], 4)], 4)) : a("", !0)]));
|
|
3491
|
+
}
|
|
3492
|
+
}, kr = 60;
|
|
3493
|
+
function Ar(e, t) {
|
|
3494
|
+
let n = e.length, r = {};
|
|
3495
|
+
if (n === 0) return r;
|
|
3496
|
+
let i = Math.max(kr * n, Math.floor(t)), a = Math.floor(i / n), o = i - a * n;
|
|
3497
|
+
return e.forEach((e, t) => {
|
|
3498
|
+
r[e] = a + +(t < o);
|
|
3499
|
+
}), r;
|
|
3500
|
+
}
|
|
3501
|
+
function jr(e, t, n) {
|
|
3502
|
+
let r = e.length;
|
|
3503
|
+
if (r === 0) return {};
|
|
3504
|
+
let i = Math.max(0, Math.floor(n)), a = t.reduce((e, t) => e + t, 0);
|
|
3505
|
+
if (a <= 0) return Ar(e, i);
|
|
3506
|
+
let o = t.map((e) => i * e / a), s = o.map((e) => Math.floor(e)), c = i - s.reduce((e, t) => e + t, 0), l = [...o.keys()].sort((e, t) => {
|
|
3507
|
+
let n = o[e] - s[e];
|
|
3508
|
+
return o[t] - s[t] - n;
|
|
3509
|
+
}), u = 0;
|
|
3510
|
+
for (; c > 0;) {
|
|
3511
|
+
let e = l[u % r];
|
|
3512
|
+
s[e] += 1, --c, u += 1;
|
|
3513
|
+
}
|
|
3514
|
+
let d = {};
|
|
3515
|
+
return e.forEach((e, t) => {
|
|
3516
|
+
d[e] = s[t];
|
|
3517
|
+
}), d;
|
|
3518
|
+
}
|
|
3519
|
+
//#endregion
|
|
3520
|
+
//#region src/components/DataTable/contextMenuCoordinator.js
|
|
3521
|
+
var Mr = null;
|
|
3522
|
+
function Nr(e) {
|
|
3523
|
+
Mr && Mr !== e && Mr(), Mr = e;
|
|
3524
|
+
}
|
|
3525
|
+
function Pr(e) {
|
|
3526
|
+
Mr === e && (Mr = null);
|
|
3527
|
+
}
|
|
3528
|
+
//#endregion
|
|
3529
|
+
//#region src/components/DataTable/DataTable.vue
|
|
3530
|
+
var Fr = ["data-st-theme"], Ir = {
|
|
3531
|
+
key: 1,
|
|
3532
|
+
class: "flex items-center gap-2 px-3 py-2 text-[13px] shrink-0",
|
|
3533
|
+
style: {
|
|
3534
|
+
backgroundColor: "rgba(239,68,68,0.1)",
|
|
3535
|
+
borderBottom: "1px solid rgba(239,68,68,0.3)",
|
|
3536
|
+
color: "#ef4444"
|
|
3537
|
+
}
|
|
3538
|
+
}, Lr = { class: "flex-1" }, Rr = { class: "flex flex-1 min-h-0 min-w-0" }, zr = { class: "flex flex-col flex-1 min-w-0 min-h-0" }, Br = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif", Vr = /* @__PURE__ */ B({
|
|
3539
|
+
__name: "DataTable",
|
|
3540
|
+
props: {
|
|
3541
|
+
columns: {
|
|
3542
|
+
type: Array,
|
|
3543
|
+
required: !0
|
|
3544
|
+
},
|
|
3545
|
+
rows: {
|
|
3546
|
+
type: Array,
|
|
3547
|
+
required: !0
|
|
3548
|
+
},
|
|
3549
|
+
tableName: {
|
|
3550
|
+
type: String,
|
|
3551
|
+
default: "table"
|
|
3552
|
+
},
|
|
3553
|
+
loading: {
|
|
3554
|
+
type: Boolean,
|
|
3555
|
+
default: !1
|
|
3556
|
+
},
|
|
3557
|
+
error: {
|
|
3558
|
+
type: String,
|
|
3559
|
+
default: null
|
|
3560
|
+
},
|
|
3561
|
+
defaultColumnVisibility: {
|
|
3562
|
+
type: Object,
|
|
3563
|
+
default: () => ({})
|
|
3564
|
+
},
|
|
3565
|
+
showDataTypes: {
|
|
3566
|
+
type: Boolean,
|
|
3567
|
+
default: !0
|
|
3568
|
+
},
|
|
3569
|
+
editable: {
|
|
3570
|
+
type: [Boolean, Object],
|
|
3571
|
+
default: !0
|
|
3572
|
+
},
|
|
3573
|
+
selectionActions: {
|
|
3574
|
+
type: Array,
|
|
3575
|
+
default: () => []
|
|
3576
|
+
},
|
|
3577
|
+
contextMenuActions: {
|
|
3578
|
+
type: Array,
|
|
3579
|
+
default: () => []
|
|
3580
|
+
},
|
|
3581
|
+
enableSelectAll: {
|
|
3582
|
+
type: Boolean,
|
|
3583
|
+
default: !0
|
|
3584
|
+
},
|
|
3585
|
+
toolbarActions: {
|
|
3586
|
+
type: Array,
|
|
3587
|
+
default: () => []
|
|
3588
|
+
},
|
|
3589
|
+
toolbarActionsLabel: {
|
|
3590
|
+
type: String,
|
|
3591
|
+
default: "Actions"
|
|
3592
|
+
},
|
|
3593
|
+
defaultInsertLabel: {
|
|
3594
|
+
type: String,
|
|
3595
|
+
default: null
|
|
3596
|
+
},
|
|
3597
|
+
showRowBorders: {
|
|
3598
|
+
type: Boolean,
|
|
3599
|
+
default: !0
|
|
3600
|
+
},
|
|
3601
|
+
showColumnBorders: {
|
|
3602
|
+
type: Boolean,
|
|
3603
|
+
default: !0
|
|
3604
|
+
},
|
|
3605
|
+
cellButtonVisibility: {
|
|
3606
|
+
type: String,
|
|
3607
|
+
default: "hover",
|
|
3608
|
+
validator: (e) => [
|
|
3609
|
+
"hover",
|
|
3610
|
+
"always",
|
|
3611
|
+
"select"
|
|
3612
|
+
].includes(e)
|
|
3613
|
+
},
|
|
3614
|
+
cellOverflow: {
|
|
3615
|
+
type: String,
|
|
3616
|
+
default: "truncate",
|
|
3617
|
+
validator: (e) => ["truncate", "wrap"].includes(e)
|
|
3618
|
+
},
|
|
3619
|
+
insertActions: {
|
|
3620
|
+
type: Array,
|
|
3621
|
+
default: () => []
|
|
3622
|
+
},
|
|
3623
|
+
countLabelSingular: {
|
|
3624
|
+
type: String,
|
|
3625
|
+
default: "record"
|
|
3626
|
+
},
|
|
3627
|
+
countLabelPlural: {
|
|
3628
|
+
type: String,
|
|
3629
|
+
default: "records"
|
|
3630
|
+
},
|
|
3631
|
+
theme: {
|
|
3632
|
+
type: String,
|
|
3633
|
+
default: "dark"
|
|
3634
|
+
},
|
|
3635
|
+
accentColor: {
|
|
3636
|
+
type: String,
|
|
3637
|
+
default: "#3ecf8e"
|
|
3638
|
+
},
|
|
3639
|
+
fontFamily: {
|
|
3640
|
+
type: String,
|
|
3641
|
+
default: null
|
|
3642
|
+
},
|
|
3643
|
+
getSubTable: {
|
|
3644
|
+
type: Function,
|
|
3645
|
+
default: null
|
|
3646
|
+
},
|
|
3647
|
+
subTableColumns: {
|
|
3648
|
+
type: Array,
|
|
3649
|
+
default: null
|
|
3650
|
+
},
|
|
3651
|
+
expandedRows: {
|
|
3652
|
+
type: Object,
|
|
3653
|
+
default: null
|
|
3654
|
+
},
|
|
3655
|
+
nestingDepth: {
|
|
3656
|
+
type: Number,
|
|
3657
|
+
default: 0
|
|
3658
|
+
},
|
|
3659
|
+
showToolbar: {
|
|
3660
|
+
type: Boolean,
|
|
3661
|
+
default: !0
|
|
3662
|
+
},
|
|
3663
|
+
showPagination: {
|
|
3664
|
+
type: Boolean,
|
|
3665
|
+
default: !0
|
|
3666
|
+
},
|
|
3667
|
+
emptyTitle: {
|
|
3668
|
+
type: String,
|
|
3669
|
+
default: "No rows found"
|
|
3670
|
+
},
|
|
3671
|
+
emptyMessage: {
|
|
3672
|
+
type: String,
|
|
3673
|
+
default: "Get started by inserting a new row."
|
|
3674
|
+
},
|
|
3675
|
+
totalCount: {
|
|
3676
|
+
type: Number,
|
|
3677
|
+
default: null
|
|
3678
|
+
},
|
|
3679
|
+
totalFilteredCount: {
|
|
3680
|
+
type: Number,
|
|
3681
|
+
default: null
|
|
3682
|
+
},
|
|
3683
|
+
additionalSelectedRowIds: {
|
|
3684
|
+
type: Array,
|
|
3685
|
+
default: () => []
|
|
3686
|
+
},
|
|
3687
|
+
highlightedRowId: {
|
|
3688
|
+
type: [String, Number],
|
|
3689
|
+
default: null
|
|
3690
|
+
},
|
|
3691
|
+
enableSelectAllMatching: {
|
|
3692
|
+
type: Boolean,
|
|
3693
|
+
default: !1
|
|
3694
|
+
},
|
|
3695
|
+
hasRandomAccess: {
|
|
3696
|
+
type: Boolean,
|
|
3697
|
+
default: !0
|
|
3698
|
+
},
|
|
3699
|
+
columnFilters: {
|
|
3700
|
+
type: Array,
|
|
3701
|
+
default: null
|
|
3702
|
+
},
|
|
3703
|
+
controlledSorting: {
|
|
3704
|
+
type: Array,
|
|
3705
|
+
default: null
|
|
3706
|
+
},
|
|
3707
|
+
controlledColumnFilters: {
|
|
3708
|
+
type: Array,
|
|
3709
|
+
default: null
|
|
3710
|
+
},
|
|
3711
|
+
controlledColumnVisibility: {
|
|
3712
|
+
type: Object,
|
|
3713
|
+
default: null
|
|
3714
|
+
},
|
|
3715
|
+
stagedEdits: {
|
|
3716
|
+
type: Boolean,
|
|
3717
|
+
default: !1
|
|
3718
|
+
}
|
|
3719
|
+
},
|
|
3720
|
+
emits: [
|
|
3721
|
+
"insert-row",
|
|
3722
|
+
"update-row",
|
|
3723
|
+
"delete-rows",
|
|
3724
|
+
"insert-column",
|
|
3725
|
+
"update-column",
|
|
3726
|
+
"delete-column",
|
|
3727
|
+
"refresh",
|
|
3728
|
+
"selection-action",
|
|
3729
|
+
"row-action",
|
|
3730
|
+
"toolbar-action",
|
|
3731
|
+
"insert-action",
|
|
3732
|
+
"view-change",
|
|
3733
|
+
"update:expanded-rows",
|
|
3734
|
+
"sub-table-event",
|
|
3735
|
+
"column-resize",
|
|
3736
|
+
"page-change",
|
|
3737
|
+
"sort-change",
|
|
3738
|
+
"select-all-matching",
|
|
3739
|
+
"update:additionalSelectedRowIds",
|
|
3740
|
+
"update:column-filters",
|
|
3741
|
+
"commit-edits",
|
|
3742
|
+
"discard-edits"
|
|
3743
|
+
],
|
|
3744
|
+
setup(t, { expose: c, emit: l }) {
|
|
3745
|
+
let f = Symbol("dataTable.fontFamily"), p = t;
|
|
3746
|
+
function S(e, t) {
|
|
3747
|
+
let n = parseInt(e.replace("#", ""), 16), r = Math.max(0, (n >> 16) - t), i = Math.max(0, (n >> 8 & 255) - t), a = Math.max(0, (n & 255) - t);
|
|
3748
|
+
return `#${(r << 16 | i << 8 | a).toString(16).padStart(6, "0")}`;
|
|
3749
|
+
}
|
|
3750
|
+
function w(e) {
|
|
3751
|
+
let t = parseInt(e.replace("#", ""), 16), n = (t >> 16) / 255, r = (t >> 8 & 255) / 255, i = (t & 255) / 255;
|
|
3752
|
+
return .2126 * n + .7152 * r + .0722 * i;
|
|
3753
|
+
}
|
|
3754
|
+
let E = r(() => {
|
|
3755
|
+
let e = p.theme === "dark", t = p.accentColor, n = S(t, 20), r = w(t) > .4 ? "#000" : "#fff", i = `color-mix(in srgb, ${t} 10%, transparent)`, a = `color-mix(in srgb, ${t} 40%, transparent)`, o = `color-mix(in srgb, ${t} 30%, transparent)`;
|
|
3756
|
+
return {
|
|
3757
|
+
"--st-bg": e ? "#1c1c1c" : "#ffffff",
|
|
3758
|
+
"--st-bg-header": e ? "#2a2a2a" : "#f4f4f5",
|
|
3759
|
+
"--st-bg-surface": e ? "#2a2a2a" : "#ffffff",
|
|
3760
|
+
"--st-bg-input": e ? "#2a2a2a" : "#f4f4f5",
|
|
3761
|
+
"--st-bg-row-hover": e ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.03)",
|
|
3762
|
+
"--st-bg-menu-hover": e ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.06)",
|
|
3763
|
+
"--st-bg-selected": e ? "rgba(59,130,246,0.15)" : "rgba(59,130,246,0.08)",
|
|
3764
|
+
"--st-bg-selected-cell": e ? "rgba(59,130,246,0.25)" : "rgba(59,130,246,0.12)",
|
|
3765
|
+
"--st-bg-overlay": e ? "rgba(0,0,0,0.6)" : "rgba(0,0,0,0.3)",
|
|
3766
|
+
"--st-bg-panel-overlay": e ? "rgba(0,0,0,0.3)" : "rgba(0,0,0,0.15)",
|
|
3767
|
+
"--st-border": e ? "#333333" : "#e4e4e7",
|
|
3768
|
+
"--st-border-secondary": e ? "#444444" : "#d4d4d8",
|
|
3769
|
+
"--st-border-tertiary": e ? "#555555" : "#a1a1aa",
|
|
3770
|
+
"--st-text": e ? "#e5e5e5" : "#18181b",
|
|
3771
|
+
"--st-text-secondary": e ? "#a1a1aa" : "#52525b",
|
|
3772
|
+
"--st-text-tertiary": e ? "#71717a" : "#a1a1aa",
|
|
3773
|
+
"--st-text-placeholder": e ? "#52525b" : "#a1a1aa",
|
|
3774
|
+
"--st-text-on-accent": r,
|
|
3775
|
+
"--st-accent": t,
|
|
3776
|
+
"--st-accent-hover": n,
|
|
3777
|
+
"--st-accent-bg": i,
|
|
3778
|
+
"--st-accent-border": a,
|
|
3779
|
+
"--st-accent-border-light": o,
|
|
3780
|
+
"--st-toggle-off": e ? "#52525b" : "#d4d4d8",
|
|
3781
|
+
"--st-shadow-sticky": e ? "rgba(0,0,0,0.2)" : "rgba(0,0,0,0.08)",
|
|
3782
|
+
"--st-danger": e ? "#f87171" : "#dc2626"
|
|
3783
|
+
};
|
|
3784
|
+
}), D = d(f, null), O = r(() => {
|
|
3785
|
+
if (p.fontFamily != null && String(p.fontFamily).trim() !== "") return String(p.fontFamily).trim();
|
|
3786
|
+
let e = D == null ? null : T(D);
|
|
3787
|
+
return e != null && String(e).trim() !== "" ? String(e).trim() : null;
|
|
3788
|
+
});
|
|
3789
|
+
b(f, O);
|
|
3790
|
+
let A = r(() => ({ "--dt-font-family": O.value || Br })), ee = r(() => ({
|
|
3791
|
+
...E.value,
|
|
3792
|
+
...A.value,
|
|
3793
|
+
backgroundColor: "var(--st-bg)",
|
|
3794
|
+
color: "var(--st-text)"
|
|
3795
|
+
})), M = x(null), N = x(null), R = x(!1), z = x([]), B = l, V = r(() => p.editable === !0 ? {
|
|
3796
|
+
insert: !0,
|
|
3797
|
+
update: !0,
|
|
3798
|
+
delete: !0
|
|
3799
|
+
} : p.editable === !1 ? {
|
|
3800
|
+
insert: !1,
|
|
3801
|
+
update: !1,
|
|
3802
|
+
delete: !1
|
|
3803
|
+
} : {
|
|
3804
|
+
insert: !0,
|
|
3805
|
+
update: !0,
|
|
3806
|
+
delete: !0,
|
|
3807
|
+
...p.editable
|
|
3808
|
+
}), H = r(() => V.value.update), ne = r(() => V.value.delete), U = x(!1);
|
|
3809
|
+
k(() => p.error, () => {
|
|
3810
|
+
U.value = !1;
|
|
3811
|
+
});
|
|
3812
|
+
let W = x(p.controlledSorting ?? []), G = x(p.controlledColumnFilters ?? p.columnFilters ?? []), K = x({}), re = x({
|
|
3813
|
+
pageIndex: 0,
|
|
3814
|
+
pageSize: 100
|
|
3815
|
+
}), q = x({}), ie = x({
|
|
3816
|
+
startOffset: null,
|
|
3817
|
+
startSize: null,
|
|
3818
|
+
deltaOffset: null,
|
|
3819
|
+
deltaPercentage: null,
|
|
3820
|
+
isResizingColumn: !1,
|
|
3821
|
+
columnSizingStart: []
|
|
3822
|
+
}), J = x(p.controlledColumnVisibility ?? { ...p.defaultColumnVisibility });
|
|
3823
|
+
k(() => p.controlledSorting, (e) => {
|
|
3824
|
+
e !== null && (W.value = e);
|
|
3825
|
+
}, { deep: !0 }), k(() => p.controlledColumnFilters, (e) => {
|
|
3826
|
+
e !== null && (G.value = e);
|
|
3827
|
+
}, { deep: !0 }), k(() => p.columnFilters, (e) => {
|
|
3828
|
+
e !== null && (G.value = e);
|
|
3829
|
+
}, { deep: !0 }), k(() => p.controlledColumnVisibility, (e) => {
|
|
3830
|
+
e !== null && (J.value = e);
|
|
3831
|
+
}, { deep: !0 });
|
|
3832
|
+
let ae = x([]), oe = x([]), se = x({}), ce = x({}), le = r(() => p.expandedRows ?? ce.value);
|
|
3833
|
+
function ue(e) {
|
|
3834
|
+
p.expandedRows === null ? ce.value = {
|
|
3835
|
+
...ce.value,
|
|
3836
|
+
[e]: !ce.value[e]
|
|
3837
|
+
} : B("update:expanded-rows", {
|
|
3838
|
+
...p.expandedRows,
|
|
3839
|
+
[e]: !p.expandedRows[e]
|
|
3840
|
+
});
|
|
3841
|
+
}
|
|
3842
|
+
function de(e, t, n) {
|
|
3843
|
+
if (!n || typeof n != "object") return !0;
|
|
3844
|
+
let { operator: r, value: i } = n;
|
|
3845
|
+
if (!r || i === "" || i === void 0) return !0;
|
|
3846
|
+
let a = e.getValue(t), o = a == null ? "" : String(a), s = Number(a), c = Number(i), l = !isNaN(s) && !isNaN(c) && i !== "";
|
|
3847
|
+
switch (r) {
|
|
3848
|
+
case "=": return o === i;
|
|
3849
|
+
case "<>": return o !== i;
|
|
3850
|
+
case ">": return l ? s > c : o > i;
|
|
3851
|
+
case "<": return l ? s < c : o < i;
|
|
3852
|
+
case ">=": return l ? s >= c : o >= i;
|
|
3853
|
+
case "<=": return l ? s <= c : o <= i;
|
|
3854
|
+
case "~~": return o.includes(i);
|
|
3855
|
+
case "~~*": return o.toLowerCase().includes(i.toLowerCase());
|
|
3856
|
+
case "in": return i.split(",").map((e) => e.trim()).includes(o);
|
|
3857
|
+
case "is": {
|
|
3858
|
+
let e = i.toLowerCase();
|
|
3859
|
+
return e === "null" ? a == null : e === "not null" ? a != null : e === "true" ? a === !0 : e === "false" ? a === !1 : !0;
|
|
3860
|
+
}
|
|
3861
|
+
default: return o.toLowerCase().includes(i.toLowerCase());
|
|
3862
|
+
}
|
|
3863
|
+
}
|
|
3864
|
+
let fe = r(() => {
|
|
3865
|
+
for (let e of p.columns) if (e.meta?.isPrimaryKey) return e.accessorKey ?? e.id ?? "id";
|
|
3866
|
+
return "id";
|
|
3867
|
+
}), Y = r(() => p.totalCount !== null), pe = r(() => p.totalFilteredCount == null ? p.totalCount : p.totalFilteredCount), me = r(() => new Set((p.additionalSelectedRowIds || []).map((e) => String(e)))), he = r(() => {
|
|
3868
|
+
let e = new Set((p.additionalSelectedRowIds || []).map(String));
|
|
3869
|
+
for (let t of Object.keys(K.value)) e.add(String(t));
|
|
3870
|
+
return e.size;
|
|
3871
|
+
});
|
|
3872
|
+
function ge() {
|
|
3873
|
+
let e = /* @__PURE__ */ new Set();
|
|
3874
|
+
for (let t of p.additionalSelectedRowIds || []) e.add(String(t));
|
|
3875
|
+
for (let t of Object.keys(K.value)) e.add(String(t));
|
|
3876
|
+
return [...e];
|
|
3877
|
+
}
|
|
3878
|
+
function _e(e) {
|
|
3879
|
+
let t = fe.value, n = String(e.original[t] ?? e.original.id);
|
|
3880
|
+
return e.getIsSelected() || me.value.has(n);
|
|
3881
|
+
}
|
|
3882
|
+
b("isRowDisplayedSelected", _e), b("highlightedRowId", r(() => p.highlightedRowId != null && p.highlightedRowId !== "" ? String(p.highlightedRowId) : null));
|
|
3883
|
+
let Z = x(/* @__PURE__ */ new Map()), ye = x(!1), be = 0;
|
|
3884
|
+
function xe() {
|
|
3885
|
+
return be += 1, `${ve}${Date.now()}_${be}`;
|
|
3886
|
+
}
|
|
3887
|
+
function Se(e) {
|
|
3888
|
+
let t = fe.value;
|
|
3889
|
+
return p.rows.find((n) => String(n[t] ?? n.id) === String(e));
|
|
3890
|
+
}
|
|
3891
|
+
let Ce = r(() => Z.value.size > 0), we = r(() => Z.value.size), Te = r(() => {
|
|
3892
|
+
if (!p.stagedEdits || Z.value.size === 0) return p.rows;
|
|
3893
|
+
let e = fe.value, t = [], n = p.rows.map((t) => {
|
|
3894
|
+
let n = String(t[e] ?? t.id), r = Z.value.get(n);
|
|
3895
|
+
return r && r.kind === X.UPDATE ? {
|
|
3896
|
+
...t,
|
|
3897
|
+
...r.changes
|
|
3898
|
+
} : t;
|
|
3899
|
+
});
|
|
3900
|
+
for (let [e, n] of Z.value) n.kind === X.INSERT && t.push({
|
|
3901
|
+
...n.changes,
|
|
3902
|
+
__stagedId: e
|
|
3903
|
+
});
|
|
3904
|
+
return [...n, ...t];
|
|
3905
|
+
});
|
|
3906
|
+
function Ee(e) {
|
|
3907
|
+
let t = xe(), n = new Map(Z.value);
|
|
3908
|
+
n.set(t, {
|
|
3909
|
+
kind: X.INSERT,
|
|
3910
|
+
changes: { ...e }
|
|
3911
|
+
}), Z.value = n;
|
|
3912
|
+
}
|
|
3913
|
+
function De(e, t) {
|
|
3914
|
+
let n = String(e), r = new Map(Z.value), i = r.get(n);
|
|
3915
|
+
if (i?.kind === X.INSERT) r.set(n, {
|
|
3916
|
+
kind: X.INSERT,
|
|
3917
|
+
changes: {
|
|
3918
|
+
...i.changes,
|
|
3919
|
+
...t
|
|
3920
|
+
}
|
|
3921
|
+
});
|
|
3922
|
+
else if (i?.kind === X.DELETE) {
|
|
3923
|
+
let e = i.snapshot ?? Se(n);
|
|
3924
|
+
r.set(n, {
|
|
3925
|
+
kind: X.UPDATE,
|
|
3926
|
+
changes: { ...t },
|
|
3927
|
+
snapshot: e
|
|
3928
|
+
});
|
|
3929
|
+
} else if (i?.kind === X.UPDATE) {
|
|
3930
|
+
let e = {
|
|
3931
|
+
...i.changes,
|
|
3932
|
+
...t
|
|
3933
|
+
}, a = i.snapshot;
|
|
3934
|
+
Object.keys(e).some((t) => e[t] !== a?.[t]) ? r.set(n, {
|
|
3935
|
+
kind: X.UPDATE,
|
|
3936
|
+
changes: e,
|
|
3937
|
+
snapshot: a
|
|
3938
|
+
}) : r.delete(n);
|
|
3939
|
+
} else {
|
|
3940
|
+
let e = Se(n);
|
|
3941
|
+
Object.keys(t).some((n) => t[n] !== e?.[n]) && r.set(n, {
|
|
3942
|
+
kind: X.UPDATE,
|
|
3943
|
+
changes: { ...t },
|
|
3944
|
+
snapshot: e
|
|
3945
|
+
});
|
|
3946
|
+
}
|
|
3947
|
+
Z.value = r;
|
|
3948
|
+
}
|
|
3949
|
+
function Oe(e) {
|
|
3950
|
+
let t = new Map(Z.value);
|
|
3951
|
+
for (let n of e) {
|
|
3952
|
+
let e = String(n), r = t.get(e);
|
|
3953
|
+
if (r?.kind === X.INSERT) t.delete(e);
|
|
3954
|
+
else {
|
|
3955
|
+
let n = r?.snapshot ?? Se(e);
|
|
3956
|
+
t.set(e, {
|
|
3957
|
+
kind: X.DELETE,
|
|
3958
|
+
snapshot: n
|
|
3959
|
+
});
|
|
3960
|
+
}
|
|
3961
|
+
}
|
|
3962
|
+
Z.value = t;
|
|
3963
|
+
}
|
|
3964
|
+
function ke(e) {
|
|
3965
|
+
let t = new Map(Z.value);
|
|
3966
|
+
t.delete(String(e)), Z.value = t;
|
|
3967
|
+
}
|
|
3968
|
+
function Ae(e, t) {
|
|
3969
|
+
let n = String(e), r = Z.value.get(n);
|
|
3970
|
+
if (!r || r.kind !== X.UPDATE) return;
|
|
3971
|
+
let { [t]: i, ...a } = r.changes, o = new Map(Z.value);
|
|
3972
|
+
Object.keys(a).length === 0 ? o.delete(n) : o.set(n, {
|
|
3973
|
+
...r,
|
|
3974
|
+
changes: a
|
|
3975
|
+
}), Z.value = o;
|
|
3976
|
+
}
|
|
3977
|
+
function je(e) {
|
|
3978
|
+
return Z.value.get(String(e))?.kind ?? null;
|
|
3979
|
+
}
|
|
3980
|
+
function Me(e, t) {
|
|
3981
|
+
let n = Z.value.get(String(e));
|
|
3982
|
+
return n && n.kind === X.UPDATE && t in n.changes ? "modified" : null;
|
|
3983
|
+
}
|
|
3984
|
+
function Ne(e, t) {
|
|
3985
|
+
let n = Z.value.get(String(e));
|
|
3986
|
+
if (!(!n || n.kind !== X.UPDATE)) return n.snapshot?.[t];
|
|
3987
|
+
}
|
|
3988
|
+
function Pe() {
|
|
3989
|
+
let e = [], t = [], n = [];
|
|
3990
|
+
for (let [r, i] of Z.value) i.kind === X.INSERT ? e.push({ ...i.changes }) : i.kind === X.UPDATE ? t.push({
|
|
3991
|
+
id: r,
|
|
3992
|
+
changes: { ...i.changes }
|
|
3993
|
+
}) : i.kind === X.DELETE && n.push(r);
|
|
3994
|
+
return {
|
|
3995
|
+
inserts: e,
|
|
3996
|
+
updates: t,
|
|
3997
|
+
deletes: n
|
|
3998
|
+
};
|
|
3999
|
+
}
|
|
4000
|
+
function Fe() {
|
|
4001
|
+
if (ye.value || !Ce.value) return;
|
|
4002
|
+
let e = Pe();
|
|
4003
|
+
ye.value = !0, B("commit-edits", e, (e) => {
|
|
4004
|
+
ye.value = !1, e && (Z.value = /* @__PURE__ */ new Map());
|
|
4005
|
+
});
|
|
4006
|
+
}
|
|
4007
|
+
function Ie() {
|
|
4008
|
+
Z.value = /* @__PURE__ */ new Map(), B("discard-edits");
|
|
4009
|
+
}
|
|
4010
|
+
let Q = L({
|
|
4011
|
+
data: Te,
|
|
4012
|
+
get columns() {
|
|
4013
|
+
return p.columns;
|
|
4014
|
+
},
|
|
4015
|
+
filterFns: { operator: de },
|
|
4016
|
+
defaultColumn: { filterFn: "operator" },
|
|
4017
|
+
state: {
|
|
4018
|
+
get sorting() {
|
|
4019
|
+
return W.value;
|
|
4020
|
+
},
|
|
4021
|
+
get columnFilters() {
|
|
4022
|
+
return G.value;
|
|
4023
|
+
},
|
|
4024
|
+
get rowSelection() {
|
|
4025
|
+
return K.value;
|
|
4026
|
+
},
|
|
4027
|
+
get pagination() {
|
|
4028
|
+
return re.value;
|
|
4029
|
+
},
|
|
4030
|
+
get columnSizing() {
|
|
4031
|
+
return q.value;
|
|
4032
|
+
},
|
|
4033
|
+
get columnSizingInfo() {
|
|
4034
|
+
return ie.value;
|
|
4035
|
+
},
|
|
4036
|
+
get columnVisibility() {
|
|
4037
|
+
return J.value;
|
|
4038
|
+
}
|
|
4039
|
+
},
|
|
4040
|
+
get manualSorting() {
|
|
4041
|
+
return Y.value;
|
|
4042
|
+
},
|
|
4043
|
+
get manualFiltering() {
|
|
4044
|
+
return Y.value;
|
|
4045
|
+
},
|
|
4046
|
+
onSortingChange: (e) => {
|
|
4047
|
+
W.value = typeof e == "function" ? e(W.value) : e, Y.value && B("sort-change", W.value);
|
|
4048
|
+
},
|
|
4049
|
+
onColumnFiltersChange: (e) => {
|
|
4050
|
+
G.value = typeof e == "function" ? e(G.value) : e, B("update:column-filters", G.value);
|
|
4051
|
+
},
|
|
4052
|
+
onRowSelectionChange: (e) => {
|
|
4053
|
+
let t = K.value, n = typeof e == "function" ? e(t) : e;
|
|
4054
|
+
if (Y.value && (p.additionalSelectedRowIds?.length ?? 0) > 0) {
|
|
4055
|
+
let e = new Set(Object.keys(t)), r = new Set(Object.keys(n)), i = [...e].filter((e) => !r.has(e));
|
|
4056
|
+
if (i.length > 0) {
|
|
4057
|
+
let e = p.additionalSelectedRowIds || [], t = new Set(e.map(String)), n = i.filter((e) => t.has(String(e)));
|
|
4058
|
+
if (n.length > 0) {
|
|
4059
|
+
let t = new Set(n.map(String));
|
|
4060
|
+
B("update:additionalSelectedRowIds", e.filter((e) => !t.has(String(e))));
|
|
4061
|
+
}
|
|
4062
|
+
}
|
|
4063
|
+
}
|
|
4064
|
+
K.value = n;
|
|
4065
|
+
},
|
|
4066
|
+
onPaginationChange: (e) => {
|
|
4067
|
+
let t = typeof e == "function" ? e(re.value) : e;
|
|
4068
|
+
re.value = t, Y.value && B("page-change", {
|
|
4069
|
+
pageIndex: t.pageIndex,
|
|
4070
|
+
pageSize: t.pageSize
|
|
4071
|
+
});
|
|
4072
|
+
},
|
|
4073
|
+
onColumnSizingChange: (e) => {
|
|
4074
|
+
q.value = typeof e == "function" ? e(q.value) : e;
|
|
4075
|
+
},
|
|
4076
|
+
onColumnSizingInfoChange: (e) => {
|
|
4077
|
+
let t = ie.value, n = typeof e == "function" ? e(t) : e;
|
|
4078
|
+
ie.value = n, t.isResizingColumn && !n.isResizingColumn && B("column-resize", q.value);
|
|
4079
|
+
},
|
|
4080
|
+
onColumnVisibilityChange: (e) => {
|
|
4081
|
+
J.value = typeof e == "function" ? e(J.value) : e;
|
|
4082
|
+
},
|
|
4083
|
+
getCoreRowModel: P(),
|
|
4084
|
+
getSortedRowModel: I(),
|
|
4085
|
+
getFilteredRowModel: te(),
|
|
4086
|
+
getPaginationRowModel: F(),
|
|
4087
|
+
get manualPagination() {
|
|
4088
|
+
return Y.value;
|
|
4089
|
+
},
|
|
4090
|
+
get pageCount() {
|
|
4091
|
+
if (Y.value) return Math.ceil(p.totalCount / re.value.pageSize);
|
|
4092
|
+
},
|
|
4093
|
+
enableRowSelection: !0,
|
|
4094
|
+
enableMultiRowSelection: !0,
|
|
4095
|
+
enableColumnResizing: !0,
|
|
4096
|
+
columnResizeMode: "onChange",
|
|
4097
|
+
getRowId: (e) => e.__stagedId ? String(e.__stagedId) : String(e[fe.value] ?? e.id)
|
|
4098
|
+
}), Le = r(() => {
|
|
4099
|
+
let e = Object.create(null);
|
|
4100
|
+
function t(n) {
|
|
4101
|
+
if (Array.isArray(n)) for (let r of n) {
|
|
4102
|
+
let n = r.id ?? r.accessorKey;
|
|
4103
|
+
n != null && r.meta && (e[String(n)] = r.meta), r.columns?.length && t(r.columns);
|
|
4104
|
+
}
|
|
4105
|
+
}
|
|
4106
|
+
return t(p.columns), e;
|
|
4107
|
+
});
|
|
4108
|
+
k(() => [
|
|
4109
|
+
p.rows,
|
|
4110
|
+
p.additionalSelectedRowIds,
|
|
4111
|
+
p.totalCount
|
|
4112
|
+
], () => {
|
|
4113
|
+
if (p.totalCount == null) return;
|
|
4114
|
+
let e = new Set((p.additionalSelectedRowIds || []).map(String));
|
|
4115
|
+
if (e.size === 0) return;
|
|
4116
|
+
let t = fe.value, n = { ...K.value }, r = !1;
|
|
4117
|
+
for (let i of p.rows) {
|
|
4118
|
+
let a = String(i[t] ?? i.id);
|
|
4119
|
+
e.has(a) && !n[a] && (n[a] = !0, r = !0);
|
|
4120
|
+
}
|
|
4121
|
+
r && (K.value = n);
|
|
4122
|
+
}, { deep: !0 });
|
|
4123
|
+
function Re() {
|
|
4124
|
+
Q.resetRowSelection(), B("update:additionalSelectedRowIds", []);
|
|
4125
|
+
}
|
|
4126
|
+
let ze = he, Be = r(() => he.value > 0), Ve = x({
|
|
4127
|
+
open: !1,
|
|
4128
|
+
mode: "insert",
|
|
4129
|
+
rowData: null
|
|
4130
|
+
});
|
|
4131
|
+
function He() {
|
|
4132
|
+
Ve.value = {
|
|
4133
|
+
open: !0,
|
|
4134
|
+
mode: "insert",
|
|
4135
|
+
rowData: null
|
|
4136
|
+
};
|
|
4137
|
+
}
|
|
4138
|
+
function Ue() {
|
|
4139
|
+
let e = p.defaultInsertLabel;
|
|
4140
|
+
if (typeof e == "string" && e.trim() !== "") {
|
|
4141
|
+
B("insert-row");
|
|
4142
|
+
return;
|
|
4143
|
+
}
|
|
4144
|
+
He();
|
|
4145
|
+
}
|
|
4146
|
+
function We(e) {
|
|
4147
|
+
Ve.value = {
|
|
4148
|
+
open: !0,
|
|
4149
|
+
mode: "update",
|
|
4150
|
+
rowData: { ...e }
|
|
4151
|
+
};
|
|
4152
|
+
}
|
|
4153
|
+
function Ge() {
|
|
4154
|
+
Ve.value = {
|
|
4155
|
+
open: !1,
|
|
4156
|
+
mode: "insert",
|
|
4157
|
+
rowData: null
|
|
4158
|
+
};
|
|
4159
|
+
}
|
|
4160
|
+
function Ke(e) {
|
|
4161
|
+
if (Ve.value.mode === "insert") p.stagedEdits ? Ee(e) : B("insert-row", e);
|
|
4162
|
+
else if (p.stagedEdits) {
|
|
4163
|
+
let t = fe.value, n = String(e[t] ?? e.id), r = Se(n) ?? {}, i = {};
|
|
4164
|
+
for (let n of Object.keys(e)) n !== t && e[n] !== r[n] && (i[n] = e[n]);
|
|
4165
|
+
Object.keys(i).length > 0 && De(n, i);
|
|
4166
|
+
} else B("update-row", {
|
|
4167
|
+
id: e.id,
|
|
4168
|
+
changes: e
|
|
4169
|
+
});
|
|
4170
|
+
Ge();
|
|
4171
|
+
}
|
|
4172
|
+
function qe(e) {
|
|
4173
|
+
p.stagedEdits ? Oe(e) : B("delete-rows", e), Q.resetRowSelection(), B("update:additionalSelectedRowIds", []);
|
|
4174
|
+
}
|
|
4175
|
+
function Je(e) {
|
|
4176
|
+
let t = (e ?? []).map(String).filter(Boolean);
|
|
4177
|
+
t.length !== 0 && (z.value = t, R.value = !0);
|
|
4178
|
+
}
|
|
4179
|
+
function Ye() {
|
|
4180
|
+
Je(ge());
|
|
4181
|
+
}
|
|
4182
|
+
function Xe() {
|
|
4183
|
+
let e = [...z.value];
|
|
4184
|
+
R.value = !1, qe(e);
|
|
4185
|
+
}
|
|
4186
|
+
k(R, (e) => {
|
|
4187
|
+
e || (z.value = []);
|
|
4188
|
+
});
|
|
4189
|
+
function Ze(e, t, n) {
|
|
4190
|
+
p.stagedEdits ? De(e, { [t]: n }) : B("update-row", {
|
|
4191
|
+
id: e,
|
|
4192
|
+
changes: { [t]: n }
|
|
4193
|
+
});
|
|
4194
|
+
}
|
|
4195
|
+
let $ = x({
|
|
4196
|
+
show: !1,
|
|
4197
|
+
x: 0,
|
|
4198
|
+
y: 0,
|
|
4199
|
+
row: null,
|
|
4200
|
+
cell: null
|
|
4201
|
+
});
|
|
4202
|
+
function Qe(e, t, n) {
|
|
4203
|
+
Nr($e), $.value = {
|
|
4204
|
+
show: !0,
|
|
4205
|
+
x: e.clientX,
|
|
4206
|
+
y: e.clientY,
|
|
4207
|
+
row: t,
|
|
4208
|
+
cell: n
|
|
4209
|
+
};
|
|
4210
|
+
}
|
|
4211
|
+
function $e() {
|
|
4212
|
+
$.value = {
|
|
4213
|
+
show: !1,
|
|
4214
|
+
x: 0,
|
|
4215
|
+
y: 0,
|
|
4216
|
+
row: null,
|
|
4217
|
+
cell: null
|
|
4218
|
+
}, Pr($e);
|
|
4219
|
+
}
|
|
4220
|
+
function et(e, t) {
|
|
4221
|
+
G.value.find((t) => t.id === e) ? G.value = G.value.map((n) => n.id === e ? {
|
|
4222
|
+
...n,
|
|
4223
|
+
value: {
|
|
4224
|
+
operator: "=",
|
|
4225
|
+
value: t
|
|
4226
|
+
}
|
|
4227
|
+
} : n) : G.value = [...G.value, {
|
|
4228
|
+
id: e,
|
|
4229
|
+
value: {
|
|
4230
|
+
operator: "=",
|
|
4231
|
+
value: t
|
|
4232
|
+
}
|
|
4233
|
+
}];
|
|
4234
|
+
}
|
|
4235
|
+
b("themeVars", r(() => ({
|
|
4236
|
+
...E.value,
|
|
4237
|
+
...A.value
|
|
4238
|
+
}))), b("originalColumnMetaById", Le), b("table", Q), b("tableSourceRows", Te), b("tableName", p.tableName), b("showDataTypes", p.showDataTypes), b("editable", V), b("showRowBorders", p.showRowBorders), b("showColumnBorders", p.showColumnBorders), b("cellButtonVisibility", r(() => p.cellButtonVisibility)), b("cellOverflow", r(() => p.cellOverflow)), b("insertRow", () => B("insert-row")), b("openInsertPanel", He), b("emptyTitle", r(() => p.emptyTitle)), b("emptyMessage", r(() => p.emptyMessage)), b("defaultInsertLabel", r(() => p.defaultInsertLabel)), b("insertActions", r(() => p.insertActions)), b("loading", r(() => p.loading)), b("expanded", le), b("toggleRowExpanded", ue), b("getSubTable", p.getSubTable), b("nestingDepth", p.nestingDepth), b("parentTheme", r(() => p.theme)), b("parentAccentColor", r(() => p.accentColor)), b("subTableSorting", ae), b("subTableColumnFilters", oe), b("subTableColumnVisibility", se), b("stagedEditsEnabled", r(() => p.stagedEdits)), b("getRowPendingState", je), b("getCellPendingState", Me), b("getCellPreviousValue", Ne), b("undoRowEdit", ke), b("undoCellEdit", Ae), k(() => p.rows, () => {
|
|
4239
|
+
Q.resetRowSelection();
|
|
4240
|
+
});
|
|
4241
|
+
function tt() {
|
|
4242
|
+
let e = {};
|
|
4243
|
+
if (typeof document > "u") return e;
|
|
4244
|
+
let t = document.createElement("canvas").getContext("2d");
|
|
4245
|
+
if (!t) return e;
|
|
4246
|
+
let n = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif";
|
|
4247
|
+
if (M.value) {
|
|
4248
|
+
let e = getComputedStyle(M.value).fontFamily;
|
|
4249
|
+
e && e.trim() !== "" && (n = e);
|
|
4250
|
+
}
|
|
4251
|
+
t.font = `13px ${n}`;
|
|
4252
|
+
let r = Q.getAllLeafColumns(), i = Te.value.slice(0, 200);
|
|
4253
|
+
for (let n of r) {
|
|
4254
|
+
let r = n.columnDef.meta || {}, a = typeof n.columnDef.header == "string" ? n.columnDef.header : String(n.id), o = t.measureText(a).width;
|
|
4255
|
+
p.showDataTypes && r.type && (o += 6 + t.measureText(r.type).width);
|
|
4256
|
+
let s = !!r.segmentedBar;
|
|
4257
|
+
if (!(r.type === "boolean" && !r.badge || r.progressBar || s)) {
|
|
4258
|
+
let e = n.columnDef.accessorKey ?? n.id;
|
|
4259
|
+
for (let n of i) {
|
|
4260
|
+
let r = n?.[e];
|
|
4261
|
+
if (r == null) continue;
|
|
4262
|
+
let i = t.measureText(String(r)).width;
|
|
4263
|
+
i > o && (o = i);
|
|
4264
|
+
}
|
|
4265
|
+
}
|
|
4266
|
+
Array.isArray(r.cellButtons) && r.cellButtons.length > 0 && (o += wt(r.cellButtons));
|
|
4267
|
+
let c = Math.ceil(o) + 16 + 28;
|
|
4268
|
+
s && (c = Math.max(c, 200)), e[n.id] = Math.min(Math.max(c, 60), 500);
|
|
4269
|
+
}
|
|
4270
|
+
return e;
|
|
4271
|
+
}
|
|
4272
|
+
function nt(e) {
|
|
4273
|
+
let t = { ...tt() }, n = e;
|
|
4274
|
+
if (!(typeof n == "number" && Number.isFinite(n)) || n <= 0) {
|
|
4275
|
+
q.value = t;
|
|
4276
|
+
return;
|
|
4277
|
+
}
|
|
4278
|
+
let r = Q.getVisibleLeafColumns().map((e) => e.id);
|
|
4279
|
+
if (r.length === 0) {
|
|
4280
|
+
q.value = t;
|
|
4281
|
+
return;
|
|
4282
|
+
}
|
|
4283
|
+
let i = r.map((e) => t[e] ?? 60), a = i.reduce((e, t) => e + t, 0), o = Math.max(0, Math.floor(n - 84));
|
|
4284
|
+
if (a > 0 && a <= o && r.length > 0) {
|
|
4285
|
+
let e = jr(r, i, o);
|
|
4286
|
+
r.forEach((n) => {
|
|
4287
|
+
t[n] = e[n];
|
|
4288
|
+
});
|
|
4289
|
+
}
|
|
4290
|
+
q.value = t;
|
|
4291
|
+
}
|
|
4292
|
+
let rt = null;
|
|
4293
|
+
function it() {
|
|
4294
|
+
rt?.disconnect(), rt = null;
|
|
4295
|
+
}
|
|
4296
|
+
return _(() => {
|
|
4297
|
+
(async () => {
|
|
4298
|
+
await m(), await new Promise((e) => {
|
|
4299
|
+
requestAnimationFrame(() => e());
|
|
4300
|
+
});
|
|
4301
|
+
let e = N.value?.getScrollViewportInnerWidth?.() ?? 0;
|
|
4302
|
+
if (nt(e), e > 0) return;
|
|
4303
|
+
let t = typeof N.value?.getViewportResizeObserveTarget == "function" ? N.value.getViewportResizeObserveTarget() : null;
|
|
4304
|
+
t && typeof ResizeObserver < "u" && (it(), rt = new ResizeObserver(() => {
|
|
4305
|
+
let e = N.value?.getScrollViewportInnerWidth?.() ?? 0;
|
|
4306
|
+
e <= 0 || (nt(e), it());
|
|
4307
|
+
}), rt.observe(t));
|
|
4308
|
+
})();
|
|
4309
|
+
}), v(() => {
|
|
4310
|
+
it(), Pr($e);
|
|
4311
|
+
}), c({ openDeleteConfirmation: Je }), (r, c) => (y(), o("div", {
|
|
4312
|
+
ref_key: "rootElRef",
|
|
4313
|
+
ref: M,
|
|
4314
|
+
class: h(["data-table-root flex flex-col text-[13px]", t.nestingDepth === 0 ? "flex-1 min-h-0 min-w-0" : ""]),
|
|
4315
|
+
"data-st-theme": t.theme,
|
|
4316
|
+
style: g(ee.value)
|
|
4317
|
+
}, [
|
|
4318
|
+
t.showToolbar ? (y(), o(e, { key: 0 }, [Be.value ? (y(), i(xt, {
|
|
4319
|
+
key: 0,
|
|
4320
|
+
"selected-count": T(ze),
|
|
4321
|
+
table: T(Q),
|
|
4322
|
+
editable: V.value,
|
|
4323
|
+
"selection-actions": t.selectionActions,
|
|
4324
|
+
"context-menu-actions": t.contextMenuActions,
|
|
4325
|
+
"enable-select-all": t.enableSelectAll,
|
|
4326
|
+
"total-filtered-count": Y.value ? pe.value : null,
|
|
4327
|
+
"enable-select-all-matching": t.enableSelectAllMatching,
|
|
4328
|
+
"count-label-singular": t.countLabelSingular,
|
|
4329
|
+
"count-label-plural": t.countLabelPlural,
|
|
4330
|
+
onDeleteConfirmRequest: Ye,
|
|
4331
|
+
onSelectionAction: c[0] ||= (e, t) => B("selection-action", e, t, ge()),
|
|
4332
|
+
onSelectAllMatching: c[1] ||= (e) => B("select-all-matching"),
|
|
4333
|
+
onClearFullSelection: Re
|
|
4334
|
+
}, null, 8, [
|
|
4335
|
+
"selected-count",
|
|
4336
|
+
"table",
|
|
4337
|
+
"editable",
|
|
4338
|
+
"selection-actions",
|
|
4339
|
+
"context-menu-actions",
|
|
4340
|
+
"enable-select-all",
|
|
4341
|
+
"total-filtered-count",
|
|
4342
|
+
"enable-select-all-matching",
|
|
4343
|
+
"count-label-singular",
|
|
4344
|
+
"count-label-plural"
|
|
4345
|
+
])) : (y(), i(ft, {
|
|
4346
|
+
key: 1,
|
|
4347
|
+
table: T(Q),
|
|
4348
|
+
sorting: W.value,
|
|
4349
|
+
"column-filters": G.value,
|
|
4350
|
+
"column-visibility": J.value,
|
|
4351
|
+
"default-column-visibility": t.defaultColumnVisibility,
|
|
4352
|
+
editable: V.value,
|
|
4353
|
+
loading: t.loading,
|
|
4354
|
+
"is-empty": Te.value.length === 0,
|
|
4355
|
+
"default-insert-label": t.defaultInsertLabel,
|
|
4356
|
+
"insert-actions": t.insertActions,
|
|
4357
|
+
"toolbar-actions": t.toolbarActions,
|
|
4358
|
+
"toolbar-actions-label": t.toolbarActionsLabel,
|
|
4359
|
+
"sub-table-columns": t.subTableColumns,
|
|
4360
|
+
"sub-table-sorting": ae.value,
|
|
4361
|
+
"sub-table-column-filters": oe.value,
|
|
4362
|
+
"sub-table-column-visibility": se.value,
|
|
4363
|
+
"table-name": t.tableName,
|
|
4364
|
+
"onUpdate:sorting": c[2] ||= (e) => W.value = e,
|
|
4365
|
+
"onUpdate:columnFilters": c[3] ||= (e) => G.value = e,
|
|
4366
|
+
"onUpdate:columnVisibility": c[4] ||= (e) => J.value = e,
|
|
4367
|
+
"onUpdate:subTableSorting": c[5] ||= (e) => ae.value = e,
|
|
4368
|
+
"onUpdate:subTableColumnFilters": c[6] ||= (e) => oe.value = e,
|
|
4369
|
+
"onUpdate:subTableColumnVisibility": c[7] ||= (e) => se.value = e,
|
|
4370
|
+
onInsertRow: Ue,
|
|
4371
|
+
onInsertAction: c[8] ||= (e) => B("insert-action", e),
|
|
4372
|
+
onRefresh: c[9] ||= (e) => B("refresh"),
|
|
4373
|
+
onToolbarAction: c[10] ||= (e) => B("toolbar-action", e)
|
|
4374
|
+
}, null, 8, [
|
|
4375
|
+
"table",
|
|
4376
|
+
"sorting",
|
|
4377
|
+
"column-filters",
|
|
4378
|
+
"column-visibility",
|
|
4379
|
+
"default-column-visibility",
|
|
4380
|
+
"editable",
|
|
4381
|
+
"loading",
|
|
4382
|
+
"is-empty",
|
|
4383
|
+
"default-insert-label",
|
|
4384
|
+
"insert-actions",
|
|
4385
|
+
"toolbar-actions",
|
|
4386
|
+
"toolbar-actions-label",
|
|
4387
|
+
"sub-table-columns",
|
|
4388
|
+
"sub-table-sorting",
|
|
4389
|
+
"sub-table-column-filters",
|
|
4390
|
+
"sub-table-column-visibility",
|
|
4391
|
+
"table-name"
|
|
4392
|
+
]))], 64)) : a("", !0),
|
|
4393
|
+
t.error && !U.value ? (y(), o("div", Ir, [
|
|
4394
|
+
c[19] ||= s("svg", {
|
|
4395
|
+
class: "w-3.5 h-3.5 shrink-0",
|
|
4396
|
+
viewBox: "0 0 16 16",
|
|
4397
|
+
fill: "currentColor"
|
|
4398
|
+
}, [s("path", { d: "M8 1a7 7 0 100 14A7 7 0 008 1zm0 3a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 018 4zm0 8a1 1 0 110-2 1 1 0 010 2z" })], -1),
|
|
4399
|
+
s("span", Lr, C(t.error), 1),
|
|
4400
|
+
s("button", {
|
|
4401
|
+
class: "opacity-60 hover:opacity-100",
|
|
4402
|
+
onClick: c[11] ||= (e) => U.value = !0
|
|
4403
|
+
}, [...c[18] ||= [s("svg", {
|
|
4404
|
+
class: "w-3.5 h-3.5",
|
|
4405
|
+
viewBox: "0 0 16 16",
|
|
4406
|
+
fill: "currentColor"
|
|
4407
|
+
}, [s("path", { d: "M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z" })], -1)]])
|
|
4408
|
+
])) : a("", !0),
|
|
4409
|
+
s("div", Rr, [s("div", zr, [u(En, {
|
|
4410
|
+
ref_key: "tableGridRef",
|
|
4411
|
+
ref: N,
|
|
4412
|
+
table: T(Q),
|
|
4413
|
+
onUpdateCell: Ze,
|
|
4414
|
+
onContextMenu: Qe,
|
|
4415
|
+
onEditRow: We
|
|
4416
|
+
}, null, 8, ["table"]), t.showPagination ? (y(), i(Hn, {
|
|
4417
|
+
key: 0,
|
|
4418
|
+
table: T(Q),
|
|
4419
|
+
"total-count": t.totalCount,
|
|
4420
|
+
"has-random-access": t.hasRandomAccess,
|
|
4421
|
+
"staged-edits": t.stagedEdits,
|
|
4422
|
+
"pending-edit-count": we.value,
|
|
4423
|
+
committing: ye.value || t.loading,
|
|
4424
|
+
"count-label-singular": t.countLabelSingular,
|
|
4425
|
+
"count-label-plural": t.countLabelPlural,
|
|
4426
|
+
onCommit: Fe,
|
|
4427
|
+
onDiscard: Ie
|
|
4428
|
+
}, null, 8, [
|
|
4429
|
+
"table",
|
|
4430
|
+
"total-count",
|
|
4431
|
+
"has-random-access",
|
|
4432
|
+
"staged-edits",
|
|
4433
|
+
"pending-edit-count",
|
|
4434
|
+
"committing",
|
|
4435
|
+
"count-label-singular",
|
|
4436
|
+
"count-label-plural"
|
|
4437
|
+
])) : a("", !0)]), u(n, { name: "slide-panel" }, {
|
|
4438
|
+
default: j(() => [(V.value.insert || V.value.update) && Ve.value.open ? (y(), i(hr, {
|
|
4439
|
+
key: 0,
|
|
4440
|
+
mode: Ve.value.mode,
|
|
4441
|
+
"row-data": Ve.value.rowData,
|
|
4442
|
+
table: T(Q),
|
|
4443
|
+
"table-name": t.tableName,
|
|
4444
|
+
onSave: Ke,
|
|
4445
|
+
onClose: Ge
|
|
4446
|
+
}, null, 8, [
|
|
4447
|
+
"mode",
|
|
4448
|
+
"row-data",
|
|
4449
|
+
"table",
|
|
4450
|
+
"table-name"
|
|
4451
|
+
])) : a("", !0)]),
|
|
4452
|
+
_: 1
|
|
4453
|
+
})]),
|
|
4454
|
+
u(Or, {
|
|
4455
|
+
modelValue: R.value,
|
|
4456
|
+
"onUpdate:modelValue": c[12] ||= (e) => R.value = e,
|
|
4457
|
+
"row-count": z.value.length,
|
|
4458
|
+
onConfirm: Xe
|
|
4459
|
+
}, null, 8, ["modelValue", "row-count"]),
|
|
4460
|
+
$.value.show ? (y(), i(wr, {
|
|
4461
|
+
key: 2,
|
|
4462
|
+
x: $.value.x,
|
|
4463
|
+
y: $.value.y,
|
|
4464
|
+
row: $.value.row,
|
|
4465
|
+
cell: $.value.cell,
|
|
4466
|
+
"custom-actions": t.contextMenuActions,
|
|
4467
|
+
"allow-row-edit": H.value,
|
|
4468
|
+
"allow-row-delete": ne.value,
|
|
4469
|
+
onClose: $e,
|
|
4470
|
+
onEditRow: c[13] ||= (e) => We($.value.row.original),
|
|
4471
|
+
onDeleteRow: c[14] ||= (e) => Je([$.value.row.id]),
|
|
4472
|
+
onFilterByValue: et,
|
|
4473
|
+
onUndoRow: c[15] ||= (e) => ke($.value.row.id),
|
|
4474
|
+
onUndoCell: c[16] ||= (e) => Ae($.value.row.id, e),
|
|
4475
|
+
onRowAction: c[17] ||= (e, t) => B("row-action", e, t)
|
|
4476
|
+
}, null, 8, [
|
|
4477
|
+
"x",
|
|
4478
|
+
"y",
|
|
4479
|
+
"row",
|
|
4480
|
+
"cell",
|
|
4481
|
+
"custom-actions",
|
|
4482
|
+
"allow-row-edit",
|
|
4483
|
+
"allow-row-delete"
|
|
4484
|
+
])) : a("", !0)
|
|
4485
|
+
], 14, Fr));
|
|
4486
|
+
}
|
|
4487
|
+
}, [["__scopeId", "data-v-3ec50e77"]]);
|
|
4488
|
+
//#endregion
|
|
4489
|
+
export { Vr as DataTable };
|