@dazzadev/vuetify-datatable 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/vuetify-datatable.js +240 -240
- package/dist/vuetify-datatable.umd.cjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -89,8 +89,8 @@ this shows while every column fits.
|
|
|
89
89
|
columns are never listed.
|
|
90
90
|
|
|
91
91
|
Two header options shape the chooser: `hidden: true` starts a column hidden until the user shows
|
|
92
|
-
it (and "Reset" hides it again), and `locked: true` keeps a
|
|
93
|
-
moved). The `column-chooser` slot receives `locked` on each column.
|
|
92
|
+
it (and "Reset" hides it again; the "N hidden" count leaves these out), and `locked: true` keeps a
|
|
93
|
+
column always visible (it can still be moved). The `column-chooser` slot receives `locked` on each column.
|
|
94
94
|
|
|
95
95
|
The choices are saved in `localStorage`, keyed by the set of header keys. Texts and the storage
|
|
96
96
|
key can be set in the global config:
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
function
|
|
1
|
+
import { defineComponent as Oe, computed as c, resolveComponent as f, openBlock as m, createBlock as C, withCtx as a, createVNode as r, createTextVNode as V, toDisplayString as b, renderSlot as k, createCommentVNode as K, inject as at, ref as v, watch as N, nextTick as st, onMounted as rt, onBeforeUnmount as it, createElementBlock as G, normalizeStyle as dt, normalizeClass as He, withDirectives as ut, createElementVNode as M, Fragment as ct, renderList as Me, withModifiers as ne, withKeys as Pe, mergeProps as P, vShow as vt, createSlots as mt, resolveDynamicComponent as we } from "vue";
|
|
2
|
+
function ft(l) {
|
|
3
3
|
return l && l.__esModule && Object.prototype.hasOwnProperty.call(l, "default") ? l.default : l;
|
|
4
4
|
}
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
-
if (
|
|
8
|
-
|
|
5
|
+
var ae = { exports: {} }, Ee;
|
|
6
|
+
function pt() {
|
|
7
|
+
if (Ee) return ae.exports;
|
|
8
|
+
Ee = 1;
|
|
9
9
|
function l(_, $ = 100, I = {}) {
|
|
10
10
|
if (typeof _ != "function")
|
|
11
11
|
throw new TypeError(`Expected the first parameter to be a function, got \`${typeof _}\`.`);
|
|
12
12
|
if ($ < 0)
|
|
13
13
|
throw new RangeError("`wait` must not be negative.");
|
|
14
|
-
const { immediate:
|
|
15
|
-
let d,
|
|
16
|
-
function
|
|
17
|
-
const S = d, O =
|
|
18
|
-
return d = void 0,
|
|
14
|
+
const { immediate: y } = typeof I == "boolean" ? { immediate: I } : I;
|
|
15
|
+
let d, h, i, L, x;
|
|
16
|
+
function H() {
|
|
17
|
+
const S = d, O = h;
|
|
18
|
+
return d = void 0, h = void 0, x = _.apply(S, O), x;
|
|
19
19
|
}
|
|
20
20
|
function E() {
|
|
21
21
|
const S = Date.now() - L;
|
|
22
|
-
S < $ && S >= 0 ? i = setTimeout(E, $ - S) : (i = void 0,
|
|
22
|
+
S < $ && S >= 0 ? i = setTimeout(E, $ - S) : (i = void 0, y || (x = H()));
|
|
23
23
|
}
|
|
24
24
|
const p = function(...S) {
|
|
25
25
|
if (d && this !== d && Object.getPrototypeOf(this) === Object.getPrototypeOf(d))
|
|
26
26
|
throw new Error("Debounced method called with different contexts of the same prototype.");
|
|
27
|
-
d = this,
|
|
28
|
-
const O =
|
|
29
|
-
return i || (i = setTimeout(E, $)), O && (
|
|
27
|
+
d = this, h = S, L = Date.now();
|
|
28
|
+
const O = y && !i;
|
|
29
|
+
return i || (i = setTimeout(E, $)), O && (x = H()), x;
|
|
30
30
|
};
|
|
31
31
|
return Object.defineProperty(p, "isPending", {
|
|
32
32
|
get() {
|
|
@@ -37,13 +37,13 @@ function ft() {
|
|
|
37
37
|
}, p.flush = () => {
|
|
38
38
|
i && p.trigger();
|
|
39
39
|
}, p.trigger = () => {
|
|
40
|
-
|
|
40
|
+
x = H(), p.clear();
|
|
41
41
|
}, p;
|
|
42
42
|
}
|
|
43
|
-
return
|
|
43
|
+
return ae.exports.debounce = l, ae.exports = l, ae.exports;
|
|
44
44
|
}
|
|
45
|
-
var
|
|
46
|
-
const
|
|
45
|
+
var gt = /* @__PURE__ */ pt();
|
|
46
|
+
const bt = /* @__PURE__ */ ft(gt), yt = /* @__PURE__ */ Oe({
|
|
47
47
|
__name: "ConfirmationModal",
|
|
48
48
|
props: {
|
|
49
49
|
show: Boolean,
|
|
@@ -59,45 +59,45 @@ const gt = /* @__PURE__ */ mt(pt), bt = /* @__PURE__ */ Ee({
|
|
|
59
59
|
set: () => {
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
-
return (I,
|
|
63
|
-
const d = f("v-card-title"),
|
|
62
|
+
return (I, y) => {
|
|
63
|
+
const d = f("v-card-title"), h = f("v-card-text"), i = f("v-spacer"), L = f("v-btn"), x = f("v-card-actions"), H = f("v-card"), E = f("v-dialog");
|
|
64
64
|
return m(), C(E, {
|
|
65
65
|
modelValue: $.value,
|
|
66
|
-
"onUpdate:modelValue":
|
|
66
|
+
"onUpdate:modelValue": y[2] || (y[2] = (p) => $.value = p),
|
|
67
67
|
"max-width": "500px",
|
|
68
68
|
persistent: "",
|
|
69
69
|
"no-click-animation": ""
|
|
70
70
|
}, {
|
|
71
|
-
default:
|
|
72
|
-
r(
|
|
73
|
-
default:
|
|
71
|
+
default: a(() => [
|
|
72
|
+
r(H, null, {
|
|
73
|
+
default: a(() => [
|
|
74
74
|
r(d, { class: "text-h5 text-center py-6" }, {
|
|
75
|
-
default:
|
|
76
|
-
V(
|
|
75
|
+
default: a(() => [
|
|
76
|
+
V(b(l.title), 1)
|
|
77
77
|
]),
|
|
78
78
|
_: 1
|
|
79
79
|
}),
|
|
80
|
-
l.description ? (m(), C(
|
|
80
|
+
l.description ? (m(), C(h, {
|
|
81
81
|
key: 0,
|
|
82
82
|
class: "text-center px-0 py-0"
|
|
83
83
|
}, {
|
|
84
|
-
default:
|
|
85
|
-
V(
|
|
84
|
+
default: a(() => [
|
|
85
|
+
V(b(l.description) + " ", 1),
|
|
86
86
|
k(I.$slots, "description")
|
|
87
87
|
]),
|
|
88
88
|
_: 3
|
|
89
89
|
})) : K("", !0),
|
|
90
|
-
r(
|
|
91
|
-
default:
|
|
90
|
+
r(x, null, {
|
|
91
|
+
default: a(() => [
|
|
92
92
|
r(i),
|
|
93
93
|
r(L, {
|
|
94
94
|
color: "error",
|
|
95
95
|
variant: "flat",
|
|
96
96
|
dark: "",
|
|
97
|
-
onClick:
|
|
97
|
+
onClick: y[0] || (y[0] = (p) => I.$emit("close"))
|
|
98
98
|
}, {
|
|
99
|
-
default:
|
|
100
|
-
V(
|
|
99
|
+
default: a(() => [
|
|
100
|
+
V(b(l.cancelButtonText), 1)
|
|
101
101
|
]),
|
|
102
102
|
_: 1
|
|
103
103
|
}),
|
|
@@ -105,10 +105,10 @@ const gt = /* @__PURE__ */ mt(pt), bt = /* @__PURE__ */ Ee({
|
|
|
105
105
|
color: "success",
|
|
106
106
|
variant: "flat",
|
|
107
107
|
dark: "",
|
|
108
|
-
onClick:
|
|
108
|
+
onClick: y[1] || (y[1] = (p) => I.$emit("confirm"))
|
|
109
109
|
}, {
|
|
110
|
-
default:
|
|
111
|
-
V(
|
|
110
|
+
default: a(() => [
|
|
111
|
+
V(b(l.confirmButtonText), 1)
|
|
112
112
|
]),
|
|
113
113
|
_: 1
|
|
114
114
|
}),
|
|
@@ -124,18 +124,18 @@ const gt = /* @__PURE__ */ mt(pt), bt = /* @__PURE__ */ Ee({
|
|
|
124
124
|
}, 8, ["modelValue"]);
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
-
}),
|
|
128
|
-
function
|
|
127
|
+
}), Re = Symbol("DataTableConfig");
|
|
128
|
+
function Et(l) {
|
|
129
129
|
return {
|
|
130
130
|
install(_) {
|
|
131
|
-
_.provide(
|
|
131
|
+
_.provide(Re, l);
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
const
|
|
135
|
+
const ht = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify-content:flex-start;padding-bottom:8px}.vdt-body{position:relative}.vdt--pinned .v-table__wrapper>table>thead>tr>th:last-child,.vdt--pinned .v-table__wrapper>table>tbody>tr.v-data-table__tr>td:last-child{position:sticky;right:0;z-index:2;background:rgb(var(--v-theme-surface))}.vdt--pinned.vdt--can-right .v-table__wrapper>table>thead>tr>th:last-child,.vdt--pinned.vdt--can-right .v-table__wrapper>table>tbody>tr.v-data-table__tr>td:last-child{box-shadow:inset 1px 0 rgba(var(--v-border-color),var(--v-border-opacity)),-8px 0 12px -6px #00000026}.vdt-fade{position:absolute;top:var(--vdt-scroll-top, 0px);height:var(--vdt-scroll-h, 100%);width:56px;pointer-events:none;opacity:0;transition:opacity .2s;z-index:3}.vdt-fade--left{left:0;background:linear-gradient(to left,rgba(var(--v-theme-surface),0),rgb(var(--v-theme-surface)))}.vdt-fade--right{right:var(--vdt-pinned-w, 0px);background:linear-gradient(to right,rgba(var(--v-theme-surface),0),rgb(var(--v-theme-surface)))}.vdt--can-left .vdt-fade--left,.vdt--can-right .vdt-fade--right{opacity:1}.vdt-arrow{position:absolute;top:calc(var(--vdt-scroll-top, 0px) + var(--vdt-head-h, 48px) / 2 - 16px);z-index:4;display:flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:thin solid rgba(var(--v-border-color),var(--v-border-opacity));border-radius:50%;background:rgb(var(--v-theme-surface));color:rgb(var(--v-theme-primary));box-shadow:0 4px 12px #00000026;cursor:pointer}.vdt-arrow:focus-visible{outline:2px solid rgb(var(--v-theme-primary));outline-offset:2px}.vdt-arrow--left{left:8px}.vdt-arrow--right{right:calc(var(--vdt-pinned-w, 0px) + 8px)}.vdt-hint{position:absolute;top:calc(var(--vdt-scroll-top, 0px) + var(--vdt-head-h, 48px) / 2 - 24px);right:calc(var(--vdt-pinned-w, 0px) + 8px);z-index:5;transform:translateY(-100%);padding:5px 10px;border-radius:4px;background:rgb(var(--v-theme-surface-variant));color:rgb(var(--v-theme-on-surface-variant));font-size:12px;white-space:nowrap;pointer-events:none}.vdt-hint:after{content:"";position:absolute;top:100%;right:11px;border:5px solid transparent;border-top-color:rgb(var(--v-theme-surface-variant))}.vdt-columns__actions{display:flex;justify-content:space-between;margin:4px 0}.vdt-columns__list{max-height:320px;margin:0;padding:0;overflow-y:auto;list-style:none}.vdt-columns__item{display:flex;align-items:center;gap:4px;border-radius:4px}.vdt-columns__item--over{background:rgba(var(--v-theme-primary),.08)}.vdt-columns__handle{display:flex;padding:4px;border:0;border-radius:4px;background:none;color:rgba(var(--v-theme-on-surface),var(--v-medium-emphasis-opacity));cursor:grab}.vdt-columns__handle:focus-visible{outline:2px solid rgb(var(--v-theme-primary))}', xt = { class: "vdt-toolbar" }, wt = { class: "vdt-columns__actions" }, kt = { class: "vdt-columns__list" }, Ct = ["onDragstart", "onDragover", "onDrop"], Vt = ["aria-label", "title", "onKeydown"], St = ["aria-label"], Dt = ["aria-label"], Tt = {
|
|
136
136
|
key: 2,
|
|
137
137
|
class: "vdt-hint"
|
|
138
|
-
}, se = "actions",
|
|
138
|
+
}, se = "actions", Bt = 300, ke = 2, _t = "vuetify-datatable:columns:", $t = "svg:M16,5V18H21V5M4,18H9V5H4M10,18H15V5H10V18Z", It = "svg:M9,3H11V5H9V3M13,3H15V5H13V3M9,7H11V9H9V7M13,7H15V9H13V7M9,11H11V13H9V11M13,11H15V13H13V11M9,15H11V17H9V15M13,15H15V17H13V15M9,19H11V21H9V19M13,19H15V21H13V19Z", Lt = "svg:M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z", Ht = "svg:M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z", Mt = /* @__PURE__ */ Oe({
|
|
139
139
|
inheritAttrs: !1,
|
|
140
140
|
__name: "DataTable",
|
|
141
141
|
props: {
|
|
@@ -173,10 +173,10 @@ const yt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
|
|
|
173
173
|
function $() {
|
|
174
174
|
if (typeof document > "u" || document.getElementById("vuetify-datatable-styles")) return;
|
|
175
175
|
const e = document.createElement("style");
|
|
176
|
-
e.id = "vuetify-datatable-styles", e.textContent =
|
|
176
|
+
e.id = "vuetify-datatable-styles", e.textContent = ht, document.head.appendChild(e);
|
|
177
177
|
}
|
|
178
178
|
$();
|
|
179
|
-
const I = [se, "expanded-row", "data-table-expand", "data-table-select"],
|
|
179
|
+
const I = [se, "expanded-row", "data-table-expand", "data-table-select"], y = {
|
|
180
180
|
columns: "Columns",
|
|
181
181
|
hiddenColumns: (e) => `Columns · ${e} hidden`,
|
|
182
182
|
searchColumns: "Search columns",
|
|
@@ -187,13 +187,13 @@ const yt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
|
|
|
187
187
|
scrollHint: "Scroll to see more columns",
|
|
188
188
|
scrollLeft: "Previous columns",
|
|
189
189
|
scrollRight: "More columns"
|
|
190
|
-
}, d = l,
|
|
190
|
+
}, d = l, h = _, i = at(Re, { icons: {} }), L = c(() => {
|
|
191
191
|
var e;
|
|
192
192
|
return d.viewIcon ?? ((e = i.icons) == null ? void 0 : e.view) ?? "mdi-eye-outline";
|
|
193
|
-
}),
|
|
193
|
+
}), x = c(() => {
|
|
194
194
|
var e;
|
|
195
195
|
return d.editIcon ?? ((e = i.icons) == null ? void 0 : e.edit) ?? "mdi-pencil-outline";
|
|
196
|
-
}),
|
|
196
|
+
}), H = c(() => {
|
|
197
197
|
var e;
|
|
198
198
|
return d.deleteIcon ?? ((e = i.icons) == null ? void 0 : e.delete) ?? "mdi-trash-can-outline";
|
|
199
199
|
}), E = c(() => i.iconProps ?? {}), p = c(() => d.tableClass ?? i.tableClass ?? "border rounded-md");
|
|
@@ -202,12 +202,12 @@ const yt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
|
|
|
202
202
|
}
|
|
203
203
|
const O = c({
|
|
204
204
|
get: () => d.modelValue,
|
|
205
|
-
set: (e) =>
|
|
205
|
+
set: (e) => h("update:modelValue", e)
|
|
206
206
|
});
|
|
207
|
-
function
|
|
208
|
-
|
|
207
|
+
function Ae() {
|
|
208
|
+
h("update:modelValue", []);
|
|
209
209
|
}
|
|
210
|
-
const A = v(d.itemsPerPage),
|
|
210
|
+
const A = v(d.itemsPerPage), Y = v([]), Z = v(1), re = v(null), W = v(!1), ze = c(() => {
|
|
211
211
|
var e;
|
|
212
212
|
return ((e = d.headers) == null ? void 0 : e.filter(
|
|
213
213
|
(t) => t.key !== "actions" && t.key !== "expanded-row" && t.key !== "data-table-expand"
|
|
@@ -215,45 +215,45 @@ const yt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
|
|
|
215
215
|
});
|
|
216
216
|
function D(e) {
|
|
217
217
|
var o;
|
|
218
|
-
const t = ((o = i.texts) == null ? void 0 : o[e]) ??
|
|
218
|
+
const t = ((o = i.texts) == null ? void 0 : o[e]) ?? y[e];
|
|
219
219
|
return typeof t == "function" ? t() : t;
|
|
220
220
|
}
|
|
221
|
-
const ie = v(!1), de = v(""), z = v([]),
|
|
221
|
+
const ie = v(!1), de = v(""), z = v([]), g = v([]), J = v(null), X = v(null), R = c(() => d.headers.filter((e) => !I.includes(e.key) && !!e.title)), U = c(() => {
|
|
222
222
|
const e = new Map(R.value.map((o) => [o.key, o]));
|
|
223
223
|
return [...z.value.filter((o) => e.has(o)).map((o) => e.get(o)), ...R.value.filter((o) => !z.value.includes(o.key))];
|
|
224
|
-
}),
|
|
224
|
+
}), Ne = c(() => {
|
|
225
225
|
const e = (de.value ?? "").trim().toLowerCase();
|
|
226
226
|
return e ? U.value.filter((t) => {
|
|
227
227
|
var o;
|
|
228
228
|
return (o = t.title) == null ? void 0 : o.toLowerCase().includes(e);
|
|
229
229
|
}) : U.value;
|
|
230
|
-
}), ue = c(() => new Set(R.value.filter((e) => e.locked).map((e) => e.key))),
|
|
230
|
+
}), ue = c(() => new Set(R.value.filter((e) => e.locked).map((e) => e.key))), j = c(() => R.value.filter((e) => e.hidden && !e.locked).map((e) => e.key)), Q = c(() => R.value.filter((e) => g.value.includes(e.key)).length), Ce = c(() => g.value.filter((e) => !j.value.includes(e)).length), Ke = c(
|
|
231
231
|
() => U.value.map((e) => ({
|
|
232
232
|
key: e.key,
|
|
233
233
|
title: e.title ?? "",
|
|
234
|
-
visible: !
|
|
234
|
+
visible: !g.value.includes(e.key),
|
|
235
235
|
locked: ue.value.has(e.key)
|
|
236
236
|
}))
|
|
237
|
-
),
|
|
237
|
+
), Ve = c(() => d.headers.some((e) => e.key === se)), ce = c(() => {
|
|
238
238
|
const e = new Set(R.value.map((s) => s.key)), t = [...U.value], o = d.headers.map((s) => e.has(s.key) ? t.shift() : s);
|
|
239
239
|
return [
|
|
240
|
-
...o.filter((s) => s.key !== se && !
|
|
240
|
+
...o.filter((s) => s.key !== se && !g.value.includes(s.key)),
|
|
241
241
|
...o.filter((s) => s.key === se)
|
|
242
242
|
];
|
|
243
|
-
}),
|
|
243
|
+
}), Se = c(
|
|
244
244
|
() => {
|
|
245
245
|
var e;
|
|
246
|
-
return
|
|
246
|
+
return Ce.value > 0 ? (((e = i.texts) == null ? void 0 : e.hiddenColumns) ?? y.hiddenColumns)(Ce.value) : D("columns");
|
|
247
247
|
}
|
|
248
248
|
);
|
|
249
|
-
function
|
|
250
|
-
ue.value.has(e) || (
|
|
251
|
-
}
|
|
252
|
-
function De() {
|
|
253
|
-
x.value = j.value === 0 ? R.value.filter((e) => !e.locked).map((e) => e.key) : [];
|
|
249
|
+
function De(e, t) {
|
|
250
|
+
ue.value.has(e) || (g.value = t ? g.value.filter((o) => o !== e) : [...g.value, e]);
|
|
254
251
|
}
|
|
255
252
|
function Te() {
|
|
256
|
-
|
|
253
|
+
g.value = Q.value === 0 ? R.value.filter((e) => !e.locked).map((e) => e.key) : [];
|
|
254
|
+
}
|
|
255
|
+
function Be() {
|
|
256
|
+
z.value = [], g.value = [...j.value];
|
|
257
257
|
}
|
|
258
258
|
function ve(e, t) {
|
|
259
259
|
const o = U.value.map((w) => w.key), s = o.indexOf(e), T = o.indexOf(t);
|
|
@@ -263,19 +263,19 @@ const yt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
|
|
|
263
263
|
const o = U.value.map((T) => T.key), s = o[o.indexOf(e) + t];
|
|
264
264
|
s && ve(e, s);
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function Ue(e, t) {
|
|
267
267
|
var o;
|
|
268
|
-
|
|
268
|
+
J.value = t, (o = e.dataTransfer) == null || o.setData("text/plain", t);
|
|
269
269
|
}
|
|
270
|
-
function
|
|
271
|
-
|
|
270
|
+
function je(e) {
|
|
271
|
+
J.value && ve(J.value, e), _e();
|
|
272
272
|
}
|
|
273
|
-
function
|
|
274
|
-
|
|
273
|
+
function _e() {
|
|
274
|
+
J.value = null, X.value = null;
|
|
275
275
|
}
|
|
276
276
|
const fe = c(() => {
|
|
277
277
|
var t;
|
|
278
|
-
const e =
|
|
278
|
+
const e = _t + R.value.map((o) => o.key).sort().join(",");
|
|
279
279
|
return ((t = i.storageKey) == null ? void 0 : t.call(i, e)) ?? e;
|
|
280
280
|
});
|
|
281
281
|
N(
|
|
@@ -283,22 +283,22 @@ const yt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
|
|
|
283
283
|
(e) => {
|
|
284
284
|
try {
|
|
285
285
|
const t = JSON.parse(localStorage.getItem(e) ?? "null");
|
|
286
|
-
z.value = Array.isArray(t == null ? void 0 : t.order) ? t.order : [],
|
|
286
|
+
z.value = Array.isArray(t == null ? void 0 : t.order) ? t.order : [], g.value = Array.isArray(t == null ? void 0 : t.hidden) ? t.hidden.filter((o) => !ue.value.has(o)) : [...j.value];
|
|
287
287
|
} catch {
|
|
288
|
-
z.value = [],
|
|
288
|
+
z.value = [], g.value = [...j.value];
|
|
289
289
|
}
|
|
290
290
|
},
|
|
291
291
|
{ immediate: !0 }
|
|
292
|
-
), N([z,
|
|
292
|
+
), N([z, g], ([e, t]) => {
|
|
293
293
|
try {
|
|
294
|
-
e.length === 0 && t.length ===
|
|
294
|
+
e.length === 0 && t.length === j.value.length && t.every((s) => j.value.includes(s)) ? localStorage.removeItem(fe.value) : localStorage.setItem(fe.value, JSON.stringify({ order: e, hidden: t }));
|
|
295
295
|
} catch {
|
|
296
296
|
}
|
|
297
297
|
});
|
|
298
|
-
const pe = v(null), ge = v(null), ee = v(!1), be = v(!1), te = v(!1), ye = v(!1),
|
|
299
|
-
let
|
|
300
|
-
const
|
|
301
|
-
"vdt--pinned":
|
|
298
|
+
const pe = v(null), ge = v(null), ee = v(!1), be = v(!1), te = v(!1), ye = v(!1), $e = v({});
|
|
299
|
+
let q = null;
|
|
300
|
+
const qe = c(() => ee.value || Q.value > 0 || ie.value), Ie = c(() => te.value && !ye.value), Fe = c(() => ({
|
|
301
|
+
"vdt--pinned": Ve.value,
|
|
302
302
|
"vdt--can-left": be.value,
|
|
303
303
|
"vdt--can-right": te.value
|
|
304
304
|
}));
|
|
@@ -311,191 +311,191 @@ const yt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
|
|
|
311
311
|
if (!e || !t) return;
|
|
312
312
|
const o = t.scrollWidth - t.clientWidth;
|
|
313
313
|
ee.value = o > ke, be.value = ee.value && t.scrollLeft > ke, te.value = ee.value && t.scrollLeft < o - ke;
|
|
314
|
-
const s =
|
|
315
|
-
|
|
314
|
+
const s = Ve.value ? t.querySelector("thead > tr > th:last-child") : null, T = t.querySelector("thead"), w = t.getBoundingClientRect();
|
|
315
|
+
$e.value = {
|
|
316
316
|
"--vdt-pinned-w": `${(s == null ? void 0 : s.offsetWidth) ?? 0}px`,
|
|
317
317
|
"--vdt-scroll-top": `${w.top - e.getBoundingClientRect().top}px`,
|
|
318
318
|
"--vdt-scroll-h": `${w.height}px`,
|
|
319
319
|
"--vdt-head-h": `${(T == null ? void 0 : T.offsetHeight) ?? 48}px`
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function Ge(e) {
|
|
323
323
|
const t = he();
|
|
324
324
|
!t || e.target !== t || (t.scrollLeft > 10 && (ye.value = !0), le());
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function Le(e) {
|
|
327
327
|
var t;
|
|
328
|
-
e === 1 && (ye.value = !0), (t = he()) == null || t.scrollBy({ left: e *
|
|
328
|
+
e === 1 && (ye.value = !0), (t = he()) == null || t.scrollBy({ left: e * Bt, behavior: "smooth" });
|
|
329
329
|
}
|
|
330
|
-
N([ce, () => d.items, () => d.loading], () =>
|
|
331
|
-
|
|
332
|
-
page:
|
|
330
|
+
N([ce, () => d.items, () => d.loading], () => st(le)), rt(() => {
|
|
331
|
+
F({
|
|
332
|
+
page: Z.value,
|
|
333
333
|
itemsPerPage: A.value
|
|
334
|
-
}), typeof ResizeObserver < "u" && pe.value && (
|
|
335
|
-
}),
|
|
336
|
-
const
|
|
337
|
-
re.value = e,
|
|
338
|
-
},
|
|
339
|
-
re.value = null,
|
|
340
|
-
}, Ze = (e) => {
|
|
341
|
-
y("editItem", e);
|
|
334
|
+
}), typeof ResizeObserver < "u" && pe.value && (q = new ResizeObserver(() => requestAnimationFrame(le)), q.observe(pe.value)), le();
|
|
335
|
+
}), it(() => q == null ? void 0 : q.disconnect());
|
|
336
|
+
const Ye = (e) => {
|
|
337
|
+
re.value = e, W.value = !0;
|
|
338
|
+
}, Ze = () => {
|
|
339
|
+
re.value = null, W.value = !1;
|
|
342
340
|
}, We = (e) => {
|
|
343
|
-
|
|
344
|
-
}, Je = () => {
|
|
345
|
-
|
|
346
|
-
},
|
|
347
|
-
|
|
341
|
+
h("editItem", e);
|
|
342
|
+
}, Je = (e) => {
|
|
343
|
+
h("viewItem", e);
|
|
344
|
+
}, Xe = () => {
|
|
345
|
+
h("deleteItem", re.value), W.value = !1;
|
|
346
|
+
}, F = ({ page: e, itemsPerPage: t }) => {
|
|
347
|
+
const o = Y.value.map((s) => ({
|
|
348
348
|
column: s.key,
|
|
349
349
|
direction: s.order
|
|
350
350
|
}));
|
|
351
|
-
|
|
351
|
+
h("onLoadData", {
|
|
352
352
|
page: e,
|
|
353
353
|
itemsPerPage: t,
|
|
354
354
|
search: d.search,
|
|
355
355
|
sortBy: o
|
|
356
356
|
});
|
|
357
357
|
};
|
|
358
|
-
function
|
|
359
|
-
|
|
358
|
+
function Qe() {
|
|
359
|
+
F({
|
|
360
360
|
page: 1,
|
|
361
361
|
itemsPerPage: A.value
|
|
362
362
|
});
|
|
363
363
|
}
|
|
364
|
-
const
|
|
364
|
+
const et = bt(Qe, 400);
|
|
365
365
|
return N(
|
|
366
366
|
() => d.search,
|
|
367
367
|
(e, t) => {
|
|
368
|
-
e !== t &&
|
|
368
|
+
e !== t && et();
|
|
369
369
|
}
|
|
370
370
|
), N(A, (e, t) => {
|
|
371
|
-
e !== t &&
|
|
371
|
+
e !== t && F({
|
|
372
372
|
page: 1,
|
|
373
373
|
itemsPerPage: e
|
|
374
374
|
});
|
|
375
|
-
}), N(
|
|
376
|
-
|
|
375
|
+
}), N(Y, () => {
|
|
376
|
+
F({
|
|
377
377
|
page: 1,
|
|
378
378
|
itemsPerPage: A.value
|
|
379
379
|
});
|
|
380
|
-
}), N(
|
|
381
|
-
|
|
380
|
+
}), N(Z, (e) => {
|
|
381
|
+
F({
|
|
382
382
|
page: e,
|
|
383
383
|
itemsPerPage: A.value
|
|
384
384
|
});
|
|
385
385
|
}), (e, t) => {
|
|
386
|
-
const o = f("v-btn"), s = f("v-text-field"), T = f("v-checkbox-btn"), w = f("v-icon"),
|
|
387
|
-
return m(),
|
|
386
|
+
const o = f("v-btn"), s = f("v-text-field"), T = f("v-checkbox-btn"), w = f("v-icon"), tt = f("v-card-text"), lt = f("v-card"), ot = f("v-menu"), oe = f("v-tooltip"), nt = f("v-data-table-server");
|
|
387
|
+
return m(), G("div", {
|
|
388
388
|
ref_key: "rootRef",
|
|
389
389
|
ref: pe,
|
|
390
|
-
class:
|
|
391
|
-
style:
|
|
390
|
+
class: He(["vdt", Fe.value]),
|
|
391
|
+
style: dt($e.value)
|
|
392
392
|
}, [
|
|
393
|
-
|
|
393
|
+
ut(M("div", xt, [
|
|
394
394
|
k(e.$slots, "column-chooser", {
|
|
395
|
-
columns:
|
|
396
|
-
hiddenCount:
|
|
397
|
-
label:
|
|
398
|
-
setVisible:
|
|
399
|
-
toggleAll:
|
|
400
|
-
reset:
|
|
395
|
+
columns: Ke.value,
|
|
396
|
+
hiddenCount: Q.value,
|
|
397
|
+
label: Se.value,
|
|
398
|
+
setVisible: De,
|
|
399
|
+
toggleAll: Te,
|
|
400
|
+
reset: Be,
|
|
401
401
|
move: me,
|
|
402
402
|
place: ve
|
|
403
403
|
}, () => [
|
|
404
|
-
r(
|
|
404
|
+
r(ot, {
|
|
405
405
|
modelValue: ie.value,
|
|
406
|
-
"onUpdate:modelValue": t[2] || (t[2] = (
|
|
406
|
+
"onUpdate:modelValue": t[2] || (t[2] = (n) => ie.value = n),
|
|
407
407
|
"close-on-content-click": !1,
|
|
408
408
|
location: "bottom start"
|
|
409
409
|
}, {
|
|
410
|
-
activator:
|
|
411
|
-
r(o,
|
|
410
|
+
activator: a(({ props: n }) => [
|
|
411
|
+
r(o, P(n, {
|
|
412
412
|
class: "vdt-columns__button",
|
|
413
413
|
variant: "outlined",
|
|
414
414
|
color: "primary",
|
|
415
415
|
size: "small",
|
|
416
|
-
"prepend-icon":
|
|
416
|
+
"prepend-icon": $t
|
|
417
417
|
}), {
|
|
418
|
-
default:
|
|
419
|
-
V(
|
|
418
|
+
default: a(() => [
|
|
419
|
+
V(b(Se.value), 1)
|
|
420
420
|
]),
|
|
421
421
|
_: 1
|
|
422
422
|
}, 16)
|
|
423
423
|
]),
|
|
424
|
-
default:
|
|
425
|
-
r(
|
|
424
|
+
default: a(() => [
|
|
425
|
+
r(lt, {
|
|
426
426
|
class: "vdt-columns",
|
|
427
427
|
"min-width": "280"
|
|
428
428
|
}, {
|
|
429
|
-
default:
|
|
430
|
-
r(
|
|
431
|
-
default:
|
|
429
|
+
default: a(() => [
|
|
430
|
+
r(tt, { class: "pa-3" }, {
|
|
431
|
+
default: a(() => [
|
|
432
432
|
r(s, {
|
|
433
433
|
modelValue: de.value,
|
|
434
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
434
|
+
"onUpdate:modelValue": t[0] || (t[0] = (n) => de.value = n),
|
|
435
435
|
placeholder: D("searchColumns"),
|
|
436
436
|
density: "compact",
|
|
437
437
|
variant: "outlined",
|
|
438
438
|
"hide-details": "",
|
|
439
439
|
clearable: ""
|
|
440
440
|
}, null, 8, ["modelValue", "placeholder"]),
|
|
441
|
-
|
|
441
|
+
M("div", wt, [
|
|
442
442
|
r(o, {
|
|
443
443
|
variant: "text",
|
|
444
444
|
size: "small",
|
|
445
445
|
color: "primary",
|
|
446
|
-
onClick:
|
|
446
|
+
onClick: Te
|
|
447
447
|
}, {
|
|
448
|
-
default:
|
|
449
|
-
V(
|
|
448
|
+
default: a(() => [
|
|
449
|
+
V(b(Q.value === 0 ? D("hideAllColumns") : D("showAllColumns")), 1)
|
|
450
450
|
]),
|
|
451
451
|
_: 1
|
|
452
452
|
}),
|
|
453
453
|
r(o, {
|
|
454
454
|
variant: "text",
|
|
455
455
|
size: "small",
|
|
456
|
-
onClick:
|
|
456
|
+
onClick: Be
|
|
457
457
|
}, {
|
|
458
|
-
default:
|
|
459
|
-
V(
|
|
458
|
+
default: a(() => [
|
|
459
|
+
V(b(D("resetColumns")), 1)
|
|
460
460
|
]),
|
|
461
461
|
_: 1
|
|
462
462
|
})
|
|
463
463
|
]),
|
|
464
|
-
|
|
465
|
-
(m(!0),
|
|
466
|
-
key:
|
|
467
|
-
class:
|
|
464
|
+
M("ul", kt, [
|
|
465
|
+
(m(!0), G(ct, null, Me(Ne.value, (n) => (m(), G("li", {
|
|
466
|
+
key: n.key,
|
|
467
|
+
class: He(["vdt-columns__item", { "vdt-columns__item--over": X.value === n.key }]),
|
|
468
468
|
draggable: "true",
|
|
469
|
-
onDragstart: (u) =>
|
|
470
|
-
onDragover:
|
|
471
|
-
onDragleave: t[1] || (t[1] = (u) =>
|
|
472
|
-
onDrop:
|
|
473
|
-
onDragend:
|
|
469
|
+
onDragstart: (u) => Ue(u, n.key),
|
|
470
|
+
onDragover: ne((u) => X.value = n.key, ["prevent"]),
|
|
471
|
+
onDragleave: t[1] || (t[1] = (u) => X.value = null),
|
|
472
|
+
onDrop: ne((u) => je(n.key), ["prevent"]),
|
|
473
|
+
onDragend: _e
|
|
474
474
|
}, [
|
|
475
475
|
r(T, {
|
|
476
|
-
"model-value": !
|
|
477
|
-
label:
|
|
478
|
-
disabled: !!
|
|
476
|
+
"model-value": !g.value.includes(n.key),
|
|
477
|
+
label: n.title,
|
|
478
|
+
disabled: !!n.locked,
|
|
479
479
|
density: "compact",
|
|
480
480
|
class: "flex-grow-1",
|
|
481
|
-
"onUpdate:modelValue": (u) =>
|
|
481
|
+
"onUpdate:modelValue": (u) => De(n.key, !!u)
|
|
482
482
|
}, null, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"]),
|
|
483
|
-
|
|
483
|
+
M("button", {
|
|
484
484
|
type: "button",
|
|
485
485
|
class: "vdt-columns__handle",
|
|
486
|
-
"aria-label": `${D("moveColumn")}: ${
|
|
486
|
+
"aria-label": `${D("moveColumn")}: ${n.title}`,
|
|
487
487
|
title: D("moveColumn"),
|
|
488
488
|
onKeydown: [
|
|
489
|
-
Pe(
|
|
490
|
-
Pe(
|
|
489
|
+
Pe(ne((u) => me(n.key, -1), ["prevent"]), ["up"]),
|
|
490
|
+
Pe(ne((u) => me(n.key, 1), ["prevent"]), ["down"])
|
|
491
491
|
]
|
|
492
492
|
}, [
|
|
493
493
|
r(w, {
|
|
494
|
-
icon:
|
|
494
|
+
icon: It,
|
|
495
495
|
size: "18"
|
|
496
496
|
})
|
|
497
|
-
], 40,
|
|
498
|
-
], 42,
|
|
497
|
+
], 40, Vt)
|
|
498
|
+
], 42, Ct))), 128))
|
|
499
499
|
])
|
|
500
500
|
]),
|
|
501
501
|
_: 1
|
|
@@ -508,48 +508,48 @@ const yt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
|
|
|
508
508
|
}, 8, ["modelValue"])
|
|
509
509
|
])
|
|
510
510
|
], 512), [
|
|
511
|
-
[
|
|
511
|
+
[vt, qe.value]
|
|
512
512
|
]),
|
|
513
|
-
|
|
513
|
+
M("div", {
|
|
514
514
|
ref_key: "bodyRef",
|
|
515
515
|
ref: ge,
|
|
516
516
|
class: "vdt-body",
|
|
517
|
-
onScrollCapturePassive:
|
|
517
|
+
onScrollCapturePassive: Ge
|
|
518
518
|
}, [
|
|
519
|
-
r(
|
|
519
|
+
r(nt, P(e.$attrs, {
|
|
520
520
|
headers: ce.value,
|
|
521
521
|
items: l.items,
|
|
522
522
|
loading: l.loading,
|
|
523
523
|
"items-length": l.totalItems,
|
|
524
524
|
"items-per-page": A.value,
|
|
525
|
-
"onUpdate:itemsPerPage": t[3] || (t[3] = (
|
|
525
|
+
"onUpdate:itemsPerPage": t[3] || (t[3] = (n) => A.value = n),
|
|
526
526
|
search: l.search,
|
|
527
|
-
"sort-by":
|
|
528
|
-
"onUpdate:sortBy": t[4] || (t[4] = (
|
|
529
|
-
page:
|
|
530
|
-
"onUpdate:page": t[5] || (t[5] = (
|
|
527
|
+
"sort-by": Y.value,
|
|
528
|
+
"onUpdate:sortBy": t[4] || (t[4] = (n) => Y.value = n),
|
|
529
|
+
page: Z.value,
|
|
530
|
+
"onUpdate:page": t[5] || (t[5] = (n) => Z.value = n),
|
|
531
531
|
"item-value": l.itemValue,
|
|
532
532
|
"show-expand": l.showExpand,
|
|
533
533
|
"show-select": l.showSelect,
|
|
534
534
|
"select-strategy": l.selectStrategy,
|
|
535
535
|
modelValue: O.value,
|
|
536
|
-
"onUpdate:modelValue": t[6] || (t[6] = (
|
|
536
|
+
"onUpdate:modelValue": t[6] || (t[6] = (n) => O.value = n),
|
|
537
537
|
class: p.value
|
|
538
|
-
}),
|
|
539
|
-
"item.data-table-expand":
|
|
538
|
+
}), mt({
|
|
539
|
+
"item.data-table-expand": a(({ internalItem: n, isExpanded: u, toggleExpand: B }) => [
|
|
540
540
|
k(e.$slots, "item.data-table-expand", {
|
|
541
|
-
internalItem:
|
|
541
|
+
internalItem: n,
|
|
542
542
|
isExpanded: u,
|
|
543
543
|
toggleExpand: B
|
|
544
544
|
}, () => [
|
|
545
545
|
r(o, {
|
|
546
|
-
onClick: (xe) => B(
|
|
546
|
+
onClick: (xe) => B(n),
|
|
547
547
|
rounded: ""
|
|
548
548
|
}, {
|
|
549
|
-
default:
|
|
549
|
+
default: a(() => [
|
|
550
550
|
r(w, null, {
|
|
551
|
-
default:
|
|
552
|
-
V(
|
|
551
|
+
default: a(() => [
|
|
552
|
+
V(b(u(n) ? "mdi-chevron-up" : "mdi-chevron-down"), 1)
|
|
553
553
|
]),
|
|
554
554
|
_: 2
|
|
555
555
|
}, 1024)
|
|
@@ -558,31 +558,31 @@ const yt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
|
|
|
558
558
|
}, 1032, ["onClick"])
|
|
559
559
|
])
|
|
560
560
|
]),
|
|
561
|
-
"expanded-row":
|
|
561
|
+
"expanded-row": a(({ columns: n, item: u }) => [
|
|
562
562
|
k(e.$slots, "expanded-row", {
|
|
563
|
-
columns:
|
|
563
|
+
columns: n,
|
|
564
564
|
item: u
|
|
565
565
|
})
|
|
566
566
|
]),
|
|
567
|
-
"item.actions":
|
|
568
|
-
k(e.$slots, "before-actions", { item:
|
|
567
|
+
"item.actions": a(({ item: n }) => [
|
|
568
|
+
k(e.$slots, "before-actions", { item: n }),
|
|
569
569
|
l.showViewButton ? (m(), C(oe, {
|
|
570
570
|
key: 0,
|
|
571
571
|
text: l.viewButtonText
|
|
572
572
|
}, {
|
|
573
|
-
activator:
|
|
573
|
+
activator: a(({ props: u }) => {
|
|
574
574
|
var B;
|
|
575
575
|
return [
|
|
576
|
-
r(o,
|
|
576
|
+
r(o, P({
|
|
577
577
|
icon: "",
|
|
578
578
|
flat: "",
|
|
579
|
-
onClick: (xe) =>
|
|
579
|
+
onClick: (xe) => Je(n)
|
|
580
580
|
}, u, {
|
|
581
|
-
disabled: (B = l.disableView) == null ? void 0 : B.call(l,
|
|
581
|
+
disabled: (B = l.disableView) == null ? void 0 : B.call(l, n)
|
|
582
582
|
}), {
|
|
583
|
-
default:
|
|
583
|
+
default: a(() => [
|
|
584
584
|
k(e.$slots, "view-icon", {}, () => [
|
|
585
|
-
S(L.value) ? (m(), C(we(L.value),
|
|
585
|
+
S(L.value) ? (m(), C(we(L.value), P({
|
|
586
586
|
key: 0,
|
|
587
587
|
size: 20,
|
|
588
588
|
class: "text-info"
|
|
@@ -591,8 +591,8 @@ const yt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
|
|
|
591
591
|
size: "20",
|
|
592
592
|
class: "text-info"
|
|
593
593
|
}, {
|
|
594
|
-
default:
|
|
595
|
-
V(
|
|
594
|
+
default: a(() => [
|
|
595
|
+
V(b(L.value), 1)
|
|
596
596
|
]),
|
|
597
597
|
_: 1
|
|
598
598
|
}))
|
|
@@ -608,19 +608,19 @@ const yt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
|
|
|
608
608
|
key: 1,
|
|
609
609
|
text: l.editButtonText
|
|
610
610
|
}, {
|
|
611
|
-
activator:
|
|
611
|
+
activator: a(({ props: u }) => {
|
|
612
612
|
var B;
|
|
613
613
|
return [
|
|
614
|
-
r(o,
|
|
614
|
+
r(o, P({
|
|
615
615
|
icon: "",
|
|
616
616
|
flat: "",
|
|
617
|
-
onClick: (xe) =>
|
|
617
|
+
onClick: (xe) => We(n)
|
|
618
618
|
}, u, {
|
|
619
|
-
disabled: (B = l.disableEdit) == null ? void 0 : B.call(l,
|
|
619
|
+
disabled: (B = l.disableEdit) == null ? void 0 : B.call(l, n)
|
|
620
620
|
}), {
|
|
621
|
-
default:
|
|
621
|
+
default: a(() => [
|
|
622
622
|
k(e.$slots, "edit-icon", {}, () => [
|
|
623
|
-
S(
|
|
623
|
+
S(x.value) ? (m(), C(we(x.value), P({
|
|
624
624
|
key: 0,
|
|
625
625
|
size: 20,
|
|
626
626
|
class: "text-primary"
|
|
@@ -629,8 +629,8 @@ const yt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
|
|
|
629
629
|
size: "20",
|
|
630
630
|
class: "text-primary"
|
|
631
631
|
}, {
|
|
632
|
-
default:
|
|
633
|
-
V(
|
|
632
|
+
default: a(() => [
|
|
633
|
+
V(b(x.value), 1)
|
|
634
634
|
]),
|
|
635
635
|
_: 1
|
|
636
636
|
}))
|
|
@@ -646,19 +646,19 @@ const yt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
|
|
|
646
646
|
key: 2,
|
|
647
647
|
text: l.deleteButtonText
|
|
648
648
|
}, {
|
|
649
|
-
activator:
|
|
649
|
+
activator: a(({ props: u }) => {
|
|
650
650
|
var B;
|
|
651
651
|
return [
|
|
652
|
-
r(o,
|
|
652
|
+
r(o, P({
|
|
653
653
|
icon: "",
|
|
654
654
|
flat: "",
|
|
655
|
-
onClick: (xe) =>
|
|
655
|
+
onClick: (xe) => Ye(n)
|
|
656
656
|
}, u, {
|
|
657
|
-
disabled: (B = l.disableDelete) == null ? void 0 : B.call(l,
|
|
657
|
+
disabled: (B = l.disableDelete) == null ? void 0 : B.call(l, n)
|
|
658
658
|
}), {
|
|
659
|
-
default:
|
|
659
|
+
default: a(() => [
|
|
660
660
|
k(e.$slots, "delete-icon", {}, () => [
|
|
661
|
-
S(
|
|
661
|
+
S(H.value) ? (m(), C(we(H.value), P({
|
|
662
662
|
key: 0,
|
|
663
663
|
size: 20,
|
|
664
664
|
class: "text-error"
|
|
@@ -667,8 +667,8 @@ const yt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
|
|
|
667
667
|
size: "20",
|
|
668
668
|
class: "text-error"
|
|
669
669
|
}, {
|
|
670
|
-
default:
|
|
671
|
-
V(
|
|
670
|
+
default: a(() => [
|
|
671
|
+
V(b(H.value), 1)
|
|
672
672
|
]),
|
|
673
673
|
_: 1
|
|
674
674
|
}))
|
|
@@ -680,10 +680,10 @@ const yt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
|
|
|
680
680
|
}),
|
|
681
681
|
_: 2
|
|
682
682
|
}, 1032, ["text"])) : K("", !0),
|
|
683
|
-
k(e.$slots, "after-actions", { item:
|
|
683
|
+
k(e.$slots, "after-actions", { item: n })
|
|
684
684
|
]),
|
|
685
|
-
tfoot:
|
|
686
|
-
|
|
685
|
+
tfoot: a(() => [
|
|
686
|
+
M("tfoot", null, [
|
|
687
687
|
k(e.$slots, "item.tfoot", { columns: ce.value })
|
|
688
688
|
])
|
|
689
689
|
]),
|
|
@@ -691,81 +691,81 @@ const yt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
|
|
|
691
691
|
}, [
|
|
692
692
|
l.showSelect ? {
|
|
693
693
|
name: "top",
|
|
694
|
-
fn:
|
|
694
|
+
fn: a(() => [
|
|
695
695
|
k(e.$slots, "selection-actions", {
|
|
696
696
|
selected: O.value,
|
|
697
697
|
count: O.value.length,
|
|
698
|
-
clear:
|
|
698
|
+
clear: Ae
|
|
699
699
|
})
|
|
700
700
|
]),
|
|
701
701
|
key: "0"
|
|
702
702
|
} : void 0,
|
|
703
|
-
Me(
|
|
704
|
-
name: `item.${
|
|
705
|
-
fn:
|
|
706
|
-
k(e.$slots, `item.${
|
|
707
|
-
V(
|
|
703
|
+
Me(ze.value, (n) => ({
|
|
704
|
+
name: `item.${n.key}`,
|
|
705
|
+
fn: a(({ item: u }) => [
|
|
706
|
+
k(e.$slots, `item.${n.key}`, { item: u }, () => [
|
|
707
|
+
V(b(u[n.key]), 1)
|
|
708
708
|
])
|
|
709
709
|
])
|
|
710
710
|
}))
|
|
711
711
|
]), 1040, ["headers", "items", "loading", "items-length", "items-per-page", "search", "sort-by", "page", "item-value", "show-expand", "show-select", "select-strategy", "modelValue", "class"]),
|
|
712
|
-
t[9] || (t[9] =
|
|
713
|
-
t[10] || (t[10] =
|
|
714
|
-
be.value ? (m(),
|
|
712
|
+
t[9] || (t[9] = M("div", { class: "vdt-fade vdt-fade--left" }, null, -1)),
|
|
713
|
+
t[10] || (t[10] = M("div", { class: "vdt-fade vdt-fade--right" }, null, -1)),
|
|
714
|
+
be.value ? (m(), G("button", {
|
|
715
715
|
key: 0,
|
|
716
716
|
type: "button",
|
|
717
717
|
class: "vdt-arrow vdt-arrow--left",
|
|
718
718
|
"aria-label": D("scrollLeft"),
|
|
719
|
-
onClick: t[7] || (t[7] = (
|
|
719
|
+
onClick: t[7] || (t[7] = (n) => Le(-1))
|
|
720
720
|
}, [
|
|
721
721
|
r(w, {
|
|
722
|
-
icon:
|
|
722
|
+
icon: Lt,
|
|
723
723
|
size: "20"
|
|
724
724
|
})
|
|
725
|
-
], 8,
|
|
725
|
+
], 8, St)) : K("", !0),
|
|
726
726
|
te.value ? (m(), C(oe, {
|
|
727
727
|
key: 1,
|
|
728
728
|
text: D("scrollRight"),
|
|
729
|
-
disabled:
|
|
729
|
+
disabled: Ie.value,
|
|
730
730
|
location: "top"
|
|
731
731
|
}, {
|
|
732
|
-
activator:
|
|
733
|
-
|
|
732
|
+
activator: a(({ props: n }) => [
|
|
733
|
+
M("button", P(n, {
|
|
734
734
|
type: "button",
|
|
735
735
|
class: "vdt-arrow vdt-arrow--right",
|
|
736
736
|
"aria-label": D("scrollRight"),
|
|
737
|
-
onClick: t[8] || (t[8] = (u) =>
|
|
737
|
+
onClick: t[8] || (t[8] = (u) => Le(1))
|
|
738
738
|
}), [
|
|
739
739
|
r(w, {
|
|
740
|
-
icon:
|
|
740
|
+
icon: Ht,
|
|
741
741
|
size: "20"
|
|
742
742
|
})
|
|
743
|
-
], 16,
|
|
743
|
+
], 16, Dt)
|
|
744
744
|
]),
|
|
745
745
|
_: 1
|
|
746
746
|
}, 8, ["text", "disabled"])) : K("", !0),
|
|
747
|
-
|
|
747
|
+
Ie.value ? (m(), G("span", Tt, b(D("scrollHint")), 1)) : K("", !0)
|
|
748
748
|
], 544),
|
|
749
|
-
r(
|
|
750
|
-
show:
|
|
749
|
+
r(yt, {
|
|
750
|
+
show: W.value,
|
|
751
751
|
title: l.deleteModalTitle,
|
|
752
752
|
description: l.deleteModalMessage,
|
|
753
753
|
confirmButtonText: l.deleteModalConfirmButtonText,
|
|
754
754
|
cancelButtonText: l.deleteModalCancelButtonText,
|
|
755
|
-
onClose:
|
|
756
|
-
onConfirm:
|
|
755
|
+
onClose: Ze,
|
|
756
|
+
onConfirm: Xe
|
|
757
757
|
}, null, 8, ["show", "title", "description", "confirmButtonText", "cancelButtonText"])
|
|
758
758
|
], 6);
|
|
759
759
|
};
|
|
760
760
|
}
|
|
761
|
-
}),
|
|
761
|
+
}), Ot = {
|
|
762
762
|
install(l) {
|
|
763
763
|
l.component("DataTable", Mt);
|
|
764
764
|
}
|
|
765
765
|
};
|
|
766
766
|
export {
|
|
767
|
-
|
|
767
|
+
Re as DATA_TABLE_CONFIG_KEY,
|
|
768
768
|
Mt as DataTable,
|
|
769
|
-
|
|
770
|
-
|
|
769
|
+
Et as createDataTableConfig,
|
|
770
|
+
Ot as default
|
|
771
771
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(x,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(x=typeof globalThis<"u"?globalThis:x||self,e(x.VuetifyDatatable={},x.Vue))})(this,(function(x,e){"use strict";function xe(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var I={exports:{}},ce;function Ce(){if(ce)return I.exports;ce=1;function l(C,w=100,k={}){if(typeof C!="function")throw new TypeError(`Expected the first parameter to be a function, got \`${typeof C}\`.`);if(w<0)throw new RangeError("`wait` must not be negative.");const{immediate:m}=typeof k=="boolean"?{immediate:k}:k;let i,u,s,V,p;function S(){const g=i,N=u;return i=void 0,u=void 0,p=C.apply(g,N),p}function B(){const g=Date.now()-V;g<w&&g>=0?s=setTimeout(B,w-g):(s=void 0,m||(p=S()))}const d=function(...g){if(i&&this!==i&&Object.getPrototypeOf(this)===Object.getPrototypeOf(i))throw new Error("Debounced method called with different contexts of the same prototype.");i=this,u=g,V=Date.now();const N=m&&!s;return s||(s=setTimeout(B,w)),N&&(p=S()),p};return Object.defineProperty(d,"isPending",{get(){return s!==void 0}}),d.clear=()=>{s&&(clearTimeout(s),s=void 0)},d.flush=()=>{s&&d.trigger()},d.trigger=()=>{p=S(),d.clear()},d}return I.exports.debounce=l,I.exports=l,I.exports}var we=Ce();const ke=xe(we),Ve=e.defineComponent({__name:"ConfirmationModal",props:{show:Boolean,title:String,description:String,confirmButtonText:String,cancelButtonText:String},emits:["close","confirm"],setup(l){const C=l,w=e.computed({get:()=>C.show,set:()=>{}});return(k,m)=>{const i=e.resolveComponent("v-card-title"),u=e.resolveComponent("v-card-text"),s=e.resolveComponent("v-spacer"),V=e.resolveComponent("v-btn"),p=e.resolveComponent("v-card-actions"),S=e.resolveComponent("v-card"),B=e.resolveComponent("v-dialog");return e.openBlock(),e.createBlock(B,{modelValue:w.value,"onUpdate:modelValue":m[2]||(m[2]=d=>w.value=d),"max-width":"500px",persistent:"","no-click-animation":""},{default:e.withCtx(()=>[e.createVNode(S,null,{default:e.withCtx(()=>[e.createVNode(i,{class:"text-h5 text-center py-6"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.title),1)]),_:1}),l.description?(e.openBlock(),e.createBlock(u,{key:0,class:"text-center px-0 py-0"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.description)+" ",1),e.renderSlot(k.$slots,"description")]),_:3})):e.createCommentVNode("",!0),e.createVNode(p,null,{default:e.withCtx(()=>[e.createVNode(s),e.createVNode(V,{color:"error",variant:"flat",dark:"",onClick:m[0]||(m[0]=d=>k.$emit("close"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.cancelButtonText),1)]),_:1}),e.createVNode(V,{color:"success",variant:"flat",dark:"",onClick:m[1]||(m[1]=d=>k.$emit("confirm"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.confirmButtonText),1)]),_:1}),e.createVNode(s)]),_:1})]),_:3})]),_:3},8,["modelValue"])}}}),G=Symbol("DataTableConfig");function Se(l){return{install(C){C.provide(G,l)}}}const Be='.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify-content:flex-start;padding-bottom:8px}.vdt-body{position:relative}.vdt--pinned .v-table__wrapper>table>thead>tr>th:last-child,.vdt--pinned .v-table__wrapper>table>tbody>tr.v-data-table__tr>td:last-child{position:sticky;right:0;z-index:2;background:rgb(var(--v-theme-surface))}.vdt--pinned.vdt--can-right .v-table__wrapper>table>thead>tr>th:last-child,.vdt--pinned.vdt--can-right .v-table__wrapper>table>tbody>tr.v-data-table__tr>td:last-child{box-shadow:inset 1px 0 rgba(var(--v-border-color),var(--v-border-opacity)),-8px 0 12px -6px #00000026}.vdt-fade{position:absolute;top:var(--vdt-scroll-top, 0px);height:var(--vdt-scroll-h, 100%);width:56px;pointer-events:none;opacity:0;transition:opacity .2s;z-index:3}.vdt-fade--left{left:0;background:linear-gradient(to left,rgba(var(--v-theme-surface),0),rgb(var(--v-theme-surface)))}.vdt-fade--right{right:var(--vdt-pinned-w, 0px);background:linear-gradient(to right,rgba(var(--v-theme-surface),0),rgb(var(--v-theme-surface)))}.vdt--can-left .vdt-fade--left,.vdt--can-right .vdt-fade--right{opacity:1}.vdt-arrow{position:absolute;top:calc(var(--vdt-scroll-top, 0px) + var(--vdt-head-h, 48px) / 2 - 16px);z-index:4;display:flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:thin solid rgba(var(--v-border-color),var(--v-border-opacity));border-radius:50%;background:rgb(var(--v-theme-surface));color:rgb(var(--v-theme-primary));box-shadow:0 4px 12px #00000026;cursor:pointer}.vdt-arrow:focus-visible{outline:2px solid rgb(var(--v-theme-primary));outline-offset:2px}.vdt-arrow--left{left:8px}.vdt-arrow--right{right:calc(var(--vdt-pinned-w, 0px) + 8px)}.vdt-hint{position:absolute;top:calc(var(--vdt-scroll-top, 0px) + var(--vdt-head-h, 48px) / 2 - 24px);right:calc(var(--vdt-pinned-w, 0px) + 8px);z-index:5;transform:translateY(-100%);padding:5px 10px;border-radius:4px;background:rgb(var(--v-theme-surface-variant));color:rgb(var(--v-theme-on-surface-variant));font-size:12px;white-space:nowrap;pointer-events:none}.vdt-hint:after{content:"";position:absolute;top:100%;right:11px;border:5px solid transparent;border-top-color:rgb(var(--v-theme-surface-variant))}.vdt-columns__actions{display:flex;justify-content:space-between;margin:4px 0}.vdt-columns__list{max-height:320px;margin:0;padding:0;overflow-y:auto;list-style:none}.vdt-columns__item{display:flex;align-items:center;gap:4px;border-radius:4px}.vdt-columns__item--over{background:rgba(var(--v-theme-primary),.08)}.vdt-columns__handle{display:flex;padding:4px;border:0;border-radius:4px;background:none;color:rgba(var(--v-theme-on-surface),var(--v-medium-emphasis-opacity));cursor:grab}.vdt-columns__handle:focus-visible{outline:2px solid rgb(var(--v-theme-primary))}',Ne={class:"vdt-toolbar"},De={class:"vdt-columns__actions"},Te={class:"vdt-columns__list"},_e=["onDragstart","onDragover","onDrop"],Ee=["aria-label","title","onKeydown"],Pe=["aria-label"],Me=["aria-label"],$e={key:2,class:"vdt-hint"},H="actions",Le=300,Y=2,Ie="vuetify-datatable:columns:",He="svg:M16,5V18H21V5M4,18H9V5H4M10,18H15V5H10V18Z",Oe="svg:M9,3H11V5H9V3M13,3H15V5H13V3M9,7H11V9H9V7M13,7H15V9H13V7M9,11H11V13H9V11M13,11H15V13H13V11M9,15H11V17H9V15M13,15H15V17H13V15M9,19H11V21H9V19M13,19H15V21H13V19Z",Ae="svg:M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",Re="svg:M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",de=e.defineComponent({inheritAttrs:!1,__name:"DataTable",props:{tableClass:{},headers:{default:()=>[]},items:{default:()=>[]},loading:{type:Boolean,default:!1},itemValue:{default:"id"},totalItems:{default:0},itemsPerPage:{default:10},search:{},showExpand:{type:Boolean,default:!1},showSelect:{type:Boolean,default:!1},selectStrategy:{default:"page"},modelValue:{default:()=>[]},showEditButton:{type:Boolean,default:!0},showDeleteButton:{type:Boolean,default:!0},showViewButton:{type:Boolean,default:!1},viewButtonText:{},deleteButtonText:{},deleteModalTitle:{},deleteModalMessage:{},deleteModalConfirmButtonText:{},deleteModalCancelButtonText:{},editButtonText:{},viewIcon:{},editIcon:{},deleteIcon:{},disableView:{},disableEdit:{},disableDelete:{}},emits:["onLoadData","editItem","deleteItem","viewItem","update:modelValue"],setup(l,{emit:C}){function w(){if(typeof document>"u"||document.getElementById("vuetify-datatable-styles"))return;const t=document.createElement("style");t.id="vuetify-datatable-styles",t.textContent=Be,document.head.appendChild(t)}w();const k=[H,"expanded-row","data-table-expand","data-table-select"],m={columns:"Columns",hiddenColumns:t=>`Columns · ${t} hidden`,searchColumns:"Search columns",showAllColumns:"Show all",hideAllColumns:"Hide all",resetColumns:"Reset",moveColumn:"Drag or use the arrow keys to reorder",scrollHint:"Scroll to see more columns",scrollLeft:"Previous columns",scrollRight:"More columns"},i=l,u=C,s=e.inject(G,{icons:{}}),V=e.computed(()=>{var t;return i.viewIcon??((t=s.icons)==null?void 0:t.view)??"mdi-eye-outline"}),p=e.computed(()=>{var t;return i.editIcon??((t=s.icons)==null?void 0:t.edit)??"mdi-pencil-outline"}),S=e.computed(()=>{var t;return i.deleteIcon??((t=s.icons)==null?void 0:t.delete)??"mdi-trash-can-outline"}),B=e.computed(()=>s.iconProps??{}),d=e.computed(()=>i.tableClass??s.tableClass??"border rounded-md");function g(t){return typeof t!="string"}const N=e.computed({get:()=>i.modelValue,set:t=>u("update:modelValue",t)});function Ke(){u("update:modelValue",[])}const T=e.ref(i.itemsPerPage),O=e.ref([]),A=e.ref(1),Z=e.ref(null),R=e.ref(!1),je=e.computed(()=>{var t;return((t=i.headers)==null?void 0:t.filter(o=>o.key!=="actions"&&o.key!=="expanded-row"&&o.key!=="data-table-expand"))||[]});function y(t){var n;const o=((n=s.texts)==null?void 0:n[t])??m[t];return typeof o=="function"?o():o}const W=e.ref(!1),J=e.ref(""),_=e.ref([]),f=e.ref([]),z=e.ref(null),K=e.ref(null),D=e.computed(()=>i.headers.filter(t=>!k.includes(t.key)&&!!t.title)),E=e.computed(()=>{const t=new Map(D.value.map(n=>[n.key,n]));return[..._.value.filter(n=>t.has(n)).map(n=>t.get(n)),...D.value.filter(n=>!_.value.includes(n.key))]}),Ue=e.computed(()=>{const t=(J.value??"").trim().toLowerCase();return t?E.value.filter(o=>{var n;return(n=o.title)==null?void 0:n.toLowerCase().includes(t)}):E.value}),X=e.computed(()=>new Set(D.value.filter(t=>t.locked).map(t=>t.key))),M=e.computed(()=>D.value.filter(t=>t.hidden&&!t.locked).map(t=>t.key)),P=e.computed(()=>D.value.filter(t=>f.value.includes(t.key)).length),qe=e.computed(()=>E.value.map(t=>({key:t.key,title:t.title??"",visible:!f.value.includes(t.key),locked:X.value.has(t.key)}))),me=e.computed(()=>i.headers.some(t=>t.key===H)),Q=e.computed(()=>{const t=new Set(D.value.map(r=>r.key)),o=[...E.value],n=i.headers.map(r=>t.has(r.key)?o.shift():r);return[...n.filter(r=>r.key!==H&&!f.value.includes(r.key)),...n.filter(r=>r.key===H)]}),ue=e.computed(()=>{var t;return P.value>0?(((t=s.texts)==null?void 0:t.hiddenColumns)??m.hiddenColumns)(P.value):y("columns")});function pe(t,o){X.value.has(t)||(f.value=o?f.value.filter(n=>n!==t):[...f.value,t])}function fe(){f.value=P.value===0?D.value.filter(t=>!t.locked).map(t=>t.key):[]}function he(){_.value=[],f.value=[...M.value]}function ee(t,o){const n=E.value.map(h=>h.key),r=n.indexOf(t),b=n.indexOf(o);r===-1||b===-1||r===b||(n.splice(b,0,...n.splice(r,1)),_.value=n)}function te(t,o){const n=E.value.map(b=>b.key),r=n[n.indexOf(t)+o];r&&ee(t,r)}function Fe(t,o){var n;z.value=o,(n=t.dataTransfer)==null||n.setData("text/plain",o)}function Ge(t){z.value&&ee(z.value,t),ge()}function ge(){z.value=null,K.value=null}const oe=e.computed(()=>{var o;const t=Ie+D.value.map(n=>n.key).sort().join(",");return((o=s.storageKey)==null?void 0:o.call(s,t))??t});e.watch(oe,t=>{try{const o=JSON.parse(localStorage.getItem(t)??"null");_.value=Array.isArray(o==null?void 0:o.order)?o.order:[],f.value=Array.isArray(o==null?void 0:o.hidden)?o.hidden.filter(n=>!X.value.has(n)):[...M.value]}catch{_.value=[],f.value=[...M.value]}},{immediate:!0}),e.watch([_,f],([t,o])=>{try{t.length===0&&o.length===M.value.length&&o.every(r=>M.value.includes(r))?localStorage.removeItem(oe.value):localStorage.setItem(oe.value,JSON.stringify({order:t,hidden:o}))}catch{}});const le=e.ref(null),ne=e.ref(null),j=e.ref(!1),ae=e.ref(!1),U=e.ref(!1),re=e.ref(!1),ye=e.ref({});let $=null;const Ye=e.computed(()=>j.value||P.value>0||W.value),be=e.computed(()=>U.value&&!re.value),Ze=e.computed(()=>({"vdt--pinned":me.value,"vdt--can-left":ae.value,"vdt--can-right":U.value}));function se(){var t;return((t=ne.value)==null?void 0:t.querySelector(".v-table__wrapper"))??null}function q(){const t=ne.value,o=se();if(!t||!o)return;const n=o.scrollWidth-o.clientWidth;j.value=n>Y,ae.value=j.value&&o.scrollLeft>Y,U.value=j.value&&o.scrollLeft<n-Y;const r=me.value?o.querySelector("thead > tr > th:last-child"):null,b=o.querySelector("thead"),h=o.getBoundingClientRect();ye.value={"--vdt-pinned-w":`${(r==null?void 0:r.offsetWidth)??0}px`,"--vdt-scroll-top":`${h.top-t.getBoundingClientRect().top}px`,"--vdt-scroll-h":`${h.height}px`,"--vdt-head-h":`${(b==null?void 0:b.offsetHeight)??48}px`}}function We(t){const o=se();!o||t.target!==o||(o.scrollLeft>10&&(re.value=!0),q())}function ve(t){var o;t===1&&(re.value=!0),(o=se())==null||o.scrollBy({left:t*Le,behavior:"smooth"})}e.watch([Q,()=>i.items,()=>i.loading],()=>e.nextTick(q)),e.onMounted(()=>{L({page:A.value,itemsPerPage:T.value}),typeof ResizeObserver<"u"&&le.value&&($=new ResizeObserver(()=>requestAnimationFrame(q)),$.observe(le.value)),q()}),e.onBeforeUnmount(()=>$==null?void 0:$.disconnect());const Je=t=>{Z.value=t,R.value=!0},Xe=()=>{Z.value=null,R.value=!1},Qe=t=>{u("editItem",t)},et=t=>{u("viewItem",t)},tt=()=>{u("deleteItem",Z.value),R.value=!1},L=({page:t,itemsPerPage:o})=>{const n=O.value.map(r=>({column:r.key,direction:r.order}));u("onLoadData",{page:t,itemsPerPage:o,search:i.search,sortBy:n})};function ot(){L({page:1,itemsPerPage:T.value})}const lt=ke(ot,400);return e.watch(()=>i.search,(t,o)=>{t!==o&<()}),e.watch(T,(t,o)=>{t!==o&&L({page:1,itemsPerPage:t})}),e.watch(O,()=>{L({page:1,itemsPerPage:T.value})}),e.watch(A,t=>{L({page:t,itemsPerPage:T.value})}),(t,o)=>{const n=e.resolveComponent("v-btn"),r=e.resolveComponent("v-text-field"),b=e.resolveComponent("v-checkbox-btn"),h=e.resolveComponent("v-icon"),nt=e.resolveComponent("v-card-text"),at=e.resolveComponent("v-card"),rt=e.resolveComponent("v-menu"),F=e.resolveComponent("v-tooltip"),st=e.resolveComponent("v-data-table-server");return e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:le,class:e.normalizeClass(["vdt",Ze.value]),style:e.normalizeStyle(ye.value)},[e.withDirectives(e.createElementVNode("div",Ne,[e.renderSlot(t.$slots,"column-chooser",{columns:qe.value,hiddenCount:P.value,label:ue.value,setVisible:pe,toggleAll:fe,reset:he,move:te,place:ee},()=>[e.createVNode(rt,{modelValue:W.value,"onUpdate:modelValue":o[2]||(o[2]=a=>W.value=a),"close-on-content-click":!1,location:"bottom start"},{activator:e.withCtx(({props:a})=>[e.createVNode(n,e.mergeProps(a,{class:"vdt-columns__button",variant:"outlined",color:"primary",size:"small","prepend-icon":He}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(ue.value),1)]),_:1},16)]),default:e.withCtx(()=>[e.createVNode(at,{class:"vdt-columns","min-width":"280"},{default:e.withCtx(()=>[e.createVNode(nt,{class:"pa-3"},{default:e.withCtx(()=>[e.createVNode(r,{modelValue:J.value,"onUpdate:modelValue":o[0]||(o[0]=a=>J.value=a),placeholder:y("searchColumns"),density:"compact",variant:"outlined","hide-details":"",clearable:""},null,8,["modelValue","placeholder"]),e.createElementVNode("div",De,[e.createVNode(n,{variant:"text",size:"small",color:"primary",onClick:fe},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(P.value===0?y("hideAllColumns"):y("showAllColumns")),1)]),_:1}),e.createVNode(n,{variant:"text",size:"small",onClick:he},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y("resetColumns")),1)]),_:1})]),e.createElementVNode("ul",Te,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Ue.value,a=>(e.openBlock(),e.createElementBlock("li",{key:a.key,class:e.normalizeClass(["vdt-columns__item",{"vdt-columns__item--over":K.value===a.key}]),draggable:"true",onDragstart:c=>Fe(c,a.key),onDragover:e.withModifiers(c=>K.value=a.key,["prevent"]),onDragleave:o[1]||(o[1]=c=>K.value=null),onDrop:e.withModifiers(c=>Ge(a.key),["prevent"]),onDragend:ge},[e.createVNode(b,{"model-value":!f.value.includes(a.key),label:a.title,disabled:!!a.locked,density:"compact",class:"flex-grow-1","onUpdate:modelValue":c=>pe(a.key,!!c)},null,8,["model-value","label","disabled","onUpdate:modelValue"]),e.createElementVNode("button",{type:"button",class:"vdt-columns__handle","aria-label":`${y("moveColumn")}: ${a.title}`,title:y("moveColumn"),onKeydown:[e.withKeys(e.withModifiers(c=>te(a.key,-1),["prevent"]),["up"]),e.withKeys(e.withModifiers(c=>te(a.key,1),["prevent"]),["down"])]},[e.createVNode(h,{icon:Oe,size:"18"})],40,Ee)],42,_e))),128))])]),_:1})]),_:1})]),_:1},8,["modelValue"])])],512),[[e.vShow,Ye.value]]),e.createElementVNode("div",{ref_key:"bodyRef",ref:ne,class:"vdt-body",onScrollCapturePassive:We},[e.createVNode(st,e.mergeProps(t.$attrs,{headers:Q.value,items:l.items,loading:l.loading,"items-length":l.totalItems,"items-per-page":T.value,"onUpdate:itemsPerPage":o[3]||(o[3]=a=>T.value=a),search:l.search,"sort-by":O.value,"onUpdate:sortBy":o[4]||(o[4]=a=>O.value=a),page:A.value,"onUpdate:page":o[5]||(o[5]=a=>A.value=a),"item-value":l.itemValue,"show-expand":l.showExpand,"show-select":l.showSelect,"select-strategy":l.selectStrategy,modelValue:N.value,"onUpdate:modelValue":o[6]||(o[6]=a=>N.value=a),class:d.value}),e.createSlots({"item.data-table-expand":e.withCtx(({internalItem:a,isExpanded:c,toggleExpand:v})=>[e.renderSlot(t.$slots,"item.data-table-expand",{internalItem:a,isExpanded:c,toggleExpand:v},()=>[e.createVNode(n,{onClick:ie=>v(a),rounded:""},{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c(a)?"mdi-chevron-up":"mdi-chevron-down"),1)]),_:2},1024)]),_:2},1032,["onClick"])])]),"expanded-row":e.withCtx(({columns:a,item:c})=>[e.renderSlot(t.$slots,"expanded-row",{columns:a,item:c})]),"item.actions":e.withCtx(({item:a})=>[e.renderSlot(t.$slots,"before-actions",{item:a}),l.showViewButton?(e.openBlock(),e.createBlock(F,{key:0,text:l.viewButtonText},{activator:e.withCtx(({props:c})=>{var v;return[e.createVNode(n,e.mergeProps({icon:"",flat:"",onClick:ie=>et(a)},c,{disabled:(v=l.disableView)==null?void 0:v.call(l,a)}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"view-icon",{},()=>[g(V.value)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(V.value),e.mergeProps({key:0,size:20,class:"text-info"},B.value),null,16)):(e.openBlock(),e.createBlock(h,{key:1,size:"20",class:"text-info"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(V.value),1)]),_:1}))])]),_:3},16,["onClick","disabled"])]}),_:2},1032,["text"])):e.createCommentVNode("",!0),l.showEditButton?(e.openBlock(),e.createBlock(F,{key:1,text:l.editButtonText},{activator:e.withCtx(({props:c})=>{var v;return[e.createVNode(n,e.mergeProps({icon:"",flat:"",onClick:ie=>Qe(a)},c,{disabled:(v=l.disableEdit)==null?void 0:v.call(l,a)}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"edit-icon",{},()=>[g(p.value)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p.value),e.mergeProps({key:0,size:20,class:"text-primary"},B.value),null,16)):(e.openBlock(),e.createBlock(h,{key:1,size:"20",class:"text-primary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.value),1)]),_:1}))])]),_:3},16,["onClick","disabled"])]}),_:2},1032,["text"])):e.createCommentVNode("",!0),l.showDeleteButton?(e.openBlock(),e.createBlock(F,{key:2,text:l.deleteButtonText},{activator:e.withCtx(({props:c})=>{var v;return[e.createVNode(n,e.mergeProps({icon:"",flat:"",onClick:ie=>Je(a)},c,{disabled:(v=l.disableDelete)==null?void 0:v.call(l,a)}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"delete-icon",{},()=>[g(S.value)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(S.value),e.mergeProps({key:0,size:20,class:"text-error"},B.value),null,16)):(e.openBlock(),e.createBlock(h,{key:1,size:"20",class:"text-error"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(S.value),1)]),_:1}))])]),_:3},16,["onClick","disabled"])]}),_:2},1032,["text"])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"after-actions",{item:a})]),tfoot:e.withCtx(()=>[e.createElementVNode("tfoot",null,[e.renderSlot(t.$slots,"item.tfoot",{columns:Q.value})])]),_:2},[l.showSelect?{name:"top",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"selection-actions",{selected:N.value,count:N.value.length,clear:Ke})]),key:"0"}:void 0,e.renderList(je.value,a=>({name:`item.${a.key}`,fn:e.withCtx(({item:c})=>[e.renderSlot(t.$slots,`item.${a.key}`,{item:c},()=>[e.createTextVNode(e.toDisplayString(c[a.key]),1)])])}))]),1040,["headers","items","loading","items-length","items-per-page","search","sort-by","page","item-value","show-expand","show-select","select-strategy","modelValue","class"]),o[9]||(o[9]=e.createElementVNode("div",{class:"vdt-fade vdt-fade--left"},null,-1)),o[10]||(o[10]=e.createElementVNode("div",{class:"vdt-fade vdt-fade--right"},null,-1)),ae.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"vdt-arrow vdt-arrow--left","aria-label":y("scrollLeft"),onClick:o[7]||(o[7]=a=>ve(-1))},[e.createVNode(h,{icon:Ae,size:"20"})],8,Pe)):e.createCommentVNode("",!0),U.value?(e.openBlock(),e.createBlock(F,{key:1,text:y("scrollRight"),disabled:be.value,location:"top"},{activator:e.withCtx(({props:a})=>[e.createElementVNode("button",e.mergeProps(a,{type:"button",class:"vdt-arrow vdt-arrow--right","aria-label":y("scrollRight"),onClick:o[8]||(o[8]=c=>ve(1))}),[e.createVNode(h,{icon:Re,size:"20"})],16,Me)]),_:1},8,["text","disabled"])):e.createCommentVNode("",!0),be.value?(e.openBlock(),e.createElementBlock("span",$e,e.toDisplayString(y("scrollHint")),1)):e.createCommentVNode("",!0)],544),e.createVNode(Ve,{show:R.value,title:l.deleteModalTitle,description:l.deleteModalMessage,confirmButtonText:l.deleteModalConfirmButtonText,cancelButtonText:l.deleteModalCancelButtonText,onClose:Xe,onConfirm:tt},null,8,["show","title","description","confirmButtonText","cancelButtonText"])],6)}}}),ze={install(l){l.component("DataTable",de)}};x.DATA_TABLE_CONFIG_KEY=G,x.DataTable=de,x.createDataTableConfig=Se,x.default=ze,Object.defineProperties(x,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(x,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(x=typeof globalThis<"u"?globalThis:x||self,e(x.VuetifyDatatable={},x.Vue))})(this,(function(x,e){"use strict";function Ce(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var L={exports:{}},ce;function we(){if(ce)return L.exports;ce=1;function l(C,w=100,k={}){if(typeof C!="function")throw new TypeError(`Expected the first parameter to be a function, got \`${typeof C}\`.`);if(w<0)throw new RangeError("`wait` must not be negative.");const{immediate:u}=typeof k=="boolean"?{immediate:k}:k;let i,p,s,V,f;function S(){const g=i,N=p;return i=void 0,p=void 0,f=C.apply(g,N),f}function B(){const g=Date.now()-V;g<w&&g>=0?s=setTimeout(B,w-g):(s=void 0,u||(f=S()))}const d=function(...g){if(i&&this!==i&&Object.getPrototypeOf(this)===Object.getPrototypeOf(i))throw new Error("Debounced method called with different contexts of the same prototype.");i=this,p=g,V=Date.now();const N=u&&!s;return s||(s=setTimeout(B,w)),N&&(f=S()),f};return Object.defineProperty(d,"isPending",{get(){return s!==void 0}}),d.clear=()=>{s&&(clearTimeout(s),s=void 0)},d.flush=()=>{s&&d.trigger()},d.trigger=()=>{f=S(),d.clear()},d}return L.exports.debounce=l,L.exports=l,L.exports}var ke=we();const Ve=Ce(ke),Se=e.defineComponent({__name:"ConfirmationModal",props:{show:Boolean,title:String,description:String,confirmButtonText:String,cancelButtonText:String},emits:["close","confirm"],setup(l){const C=l,w=e.computed({get:()=>C.show,set:()=>{}});return(k,u)=>{const i=e.resolveComponent("v-card-title"),p=e.resolveComponent("v-card-text"),s=e.resolveComponent("v-spacer"),V=e.resolveComponent("v-btn"),f=e.resolveComponent("v-card-actions"),S=e.resolveComponent("v-card"),B=e.resolveComponent("v-dialog");return e.openBlock(),e.createBlock(B,{modelValue:w.value,"onUpdate:modelValue":u[2]||(u[2]=d=>w.value=d),"max-width":"500px",persistent:"","no-click-animation":""},{default:e.withCtx(()=>[e.createVNode(S,null,{default:e.withCtx(()=>[e.createVNode(i,{class:"text-h5 text-center py-6"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.title),1)]),_:1}),l.description?(e.openBlock(),e.createBlock(p,{key:0,class:"text-center px-0 py-0"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.description)+" ",1),e.renderSlot(k.$slots,"description")]),_:3})):e.createCommentVNode("",!0),e.createVNode(f,null,{default:e.withCtx(()=>[e.createVNode(s),e.createVNode(V,{color:"error",variant:"flat",dark:"",onClick:u[0]||(u[0]=d=>k.$emit("close"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.cancelButtonText),1)]),_:1}),e.createVNode(V,{color:"success",variant:"flat",dark:"",onClick:u[1]||(u[1]=d=>k.$emit("confirm"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.confirmButtonText),1)]),_:1}),e.createVNode(s)]),_:1})]),_:3})]),_:3},8,["modelValue"])}}}),G=Symbol("DataTableConfig");function Be(l){return{install(C){C.provide(G,l)}}}const Ne='.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify-content:flex-start;padding-bottom:8px}.vdt-body{position:relative}.vdt--pinned .v-table__wrapper>table>thead>tr>th:last-child,.vdt--pinned .v-table__wrapper>table>tbody>tr.v-data-table__tr>td:last-child{position:sticky;right:0;z-index:2;background:rgb(var(--v-theme-surface))}.vdt--pinned.vdt--can-right .v-table__wrapper>table>thead>tr>th:last-child,.vdt--pinned.vdt--can-right .v-table__wrapper>table>tbody>tr.v-data-table__tr>td:last-child{box-shadow:inset 1px 0 rgba(var(--v-border-color),var(--v-border-opacity)),-8px 0 12px -6px #00000026}.vdt-fade{position:absolute;top:var(--vdt-scroll-top, 0px);height:var(--vdt-scroll-h, 100%);width:56px;pointer-events:none;opacity:0;transition:opacity .2s;z-index:3}.vdt-fade--left{left:0;background:linear-gradient(to left,rgba(var(--v-theme-surface),0),rgb(var(--v-theme-surface)))}.vdt-fade--right{right:var(--vdt-pinned-w, 0px);background:linear-gradient(to right,rgba(var(--v-theme-surface),0),rgb(var(--v-theme-surface)))}.vdt--can-left .vdt-fade--left,.vdt--can-right .vdt-fade--right{opacity:1}.vdt-arrow{position:absolute;top:calc(var(--vdt-scroll-top, 0px) + var(--vdt-head-h, 48px) / 2 - 16px);z-index:4;display:flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:thin solid rgba(var(--v-border-color),var(--v-border-opacity));border-radius:50%;background:rgb(var(--v-theme-surface));color:rgb(var(--v-theme-primary));box-shadow:0 4px 12px #00000026;cursor:pointer}.vdt-arrow:focus-visible{outline:2px solid rgb(var(--v-theme-primary));outline-offset:2px}.vdt-arrow--left{left:8px}.vdt-arrow--right{right:calc(var(--vdt-pinned-w, 0px) + 8px)}.vdt-hint{position:absolute;top:calc(var(--vdt-scroll-top, 0px) + var(--vdt-head-h, 48px) / 2 - 24px);right:calc(var(--vdt-pinned-w, 0px) + 8px);z-index:5;transform:translateY(-100%);padding:5px 10px;border-radius:4px;background:rgb(var(--v-theme-surface-variant));color:rgb(var(--v-theme-on-surface-variant));font-size:12px;white-space:nowrap;pointer-events:none}.vdt-hint:after{content:"";position:absolute;top:100%;right:11px;border:5px solid transparent;border-top-color:rgb(var(--v-theme-surface-variant))}.vdt-columns__actions{display:flex;justify-content:space-between;margin:4px 0}.vdt-columns__list{max-height:320px;margin:0;padding:0;overflow-y:auto;list-style:none}.vdt-columns__item{display:flex;align-items:center;gap:4px;border-radius:4px}.vdt-columns__item--over{background:rgba(var(--v-theme-primary),.08)}.vdt-columns__handle{display:flex;padding:4px;border:0;border-radius:4px;background:none;color:rgba(var(--v-theme-on-surface),var(--v-medium-emphasis-opacity));cursor:grab}.vdt-columns__handle:focus-visible{outline:2px solid rgb(var(--v-theme-primary))}',De={class:"vdt-toolbar"},Te={class:"vdt-columns__actions"},_e={class:"vdt-columns__list"},Ee=["onDragstart","onDragover","onDrop"],Pe=["aria-label","title","onKeydown"],Me=["aria-label"],$e=["aria-label"],Le={key:2,class:"vdt-hint"},I="actions",Ie=300,Y=2,He="vuetify-datatable:columns:",Oe="svg:M16,5V18H21V5M4,18H9V5H4M10,18H15V5H10V18Z",Ae="svg:M9,3H11V5H9V3M13,3H15V5H13V3M9,7H11V9H9V7M13,7H15V9H13V7M9,11H11V13H9V11M13,11H15V13H13V11M9,15H11V17H9V15M13,15H15V17H13V15M9,19H11V21H9V19M13,19H15V21H13V19Z",Re="svg:M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",ze="svg:M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",de=e.defineComponent({inheritAttrs:!1,__name:"DataTable",props:{tableClass:{},headers:{default:()=>[]},items:{default:()=>[]},loading:{type:Boolean,default:!1},itemValue:{default:"id"},totalItems:{default:0},itemsPerPage:{default:10},search:{},showExpand:{type:Boolean,default:!1},showSelect:{type:Boolean,default:!1},selectStrategy:{default:"page"},modelValue:{default:()=>[]},showEditButton:{type:Boolean,default:!0},showDeleteButton:{type:Boolean,default:!0},showViewButton:{type:Boolean,default:!1},viewButtonText:{},deleteButtonText:{},deleteModalTitle:{},deleteModalMessage:{},deleteModalConfirmButtonText:{},deleteModalCancelButtonText:{},editButtonText:{},viewIcon:{},editIcon:{},deleteIcon:{},disableView:{},disableEdit:{},disableDelete:{}},emits:["onLoadData","editItem","deleteItem","viewItem","update:modelValue"],setup(l,{emit:C}){function w(){if(typeof document>"u"||document.getElementById("vuetify-datatable-styles"))return;const t=document.createElement("style");t.id="vuetify-datatable-styles",t.textContent=Ne,document.head.appendChild(t)}w();const k=[I,"expanded-row","data-table-expand","data-table-select"],u={columns:"Columns",hiddenColumns:t=>`Columns · ${t} hidden`,searchColumns:"Search columns",showAllColumns:"Show all",hideAllColumns:"Hide all",resetColumns:"Reset",moveColumn:"Drag or use the arrow keys to reorder",scrollHint:"Scroll to see more columns",scrollLeft:"Previous columns",scrollRight:"More columns"},i=l,p=C,s=e.inject(G,{icons:{}}),V=e.computed(()=>{var t;return i.viewIcon??((t=s.icons)==null?void 0:t.view)??"mdi-eye-outline"}),f=e.computed(()=>{var t;return i.editIcon??((t=s.icons)==null?void 0:t.edit)??"mdi-pencil-outline"}),S=e.computed(()=>{var t;return i.deleteIcon??((t=s.icons)==null?void 0:t.delete)??"mdi-trash-can-outline"}),B=e.computed(()=>s.iconProps??{}),d=e.computed(()=>i.tableClass??s.tableClass??"border rounded-md");function g(t){return typeof t!="string"}const N=e.computed({get:()=>i.modelValue,set:t=>p("update:modelValue",t)});function je(){p("update:modelValue",[])}const T=e.ref(i.itemsPerPage),H=e.ref([]),O=e.ref(1),Z=e.ref(null),A=e.ref(!1),Ue=e.computed(()=>{var t;return((t=i.headers)==null?void 0:t.filter(o=>o.key!=="actions"&&o.key!=="expanded-row"&&o.key!=="data-table-expand"))||[]});function y(t){var n;const o=((n=s.texts)==null?void 0:n[t])??u[t];return typeof o=="function"?o():o}const W=e.ref(!1),J=e.ref(""),_=e.ref([]),m=e.ref([]),R=e.ref(null),z=e.ref(null),D=e.computed(()=>i.headers.filter(t=>!k.includes(t.key)&&!!t.title)),E=e.computed(()=>{const t=new Map(D.value.map(n=>[n.key,n]));return[..._.value.filter(n=>t.has(n)).map(n=>t.get(n)),...D.value.filter(n=>!_.value.includes(n.key))]}),qe=e.computed(()=>{const t=(J.value??"").trim().toLowerCase();return t?E.value.filter(o=>{var n;return(n=o.title)==null?void 0:n.toLowerCase().includes(t)}):E.value}),X=e.computed(()=>new Set(D.value.filter(t=>t.locked).map(t=>t.key))),P=e.computed(()=>D.value.filter(t=>t.hidden&&!t.locked).map(t=>t.key)),K=e.computed(()=>D.value.filter(t=>m.value.includes(t.key)).length),me=e.computed(()=>m.value.filter(t=>!P.value.includes(t)).length),Fe=e.computed(()=>E.value.map(t=>({key:t.key,title:t.title??"",visible:!m.value.includes(t.key),locked:X.value.has(t.key)}))),ue=e.computed(()=>i.headers.some(t=>t.key===I)),Q=e.computed(()=>{const t=new Set(D.value.map(r=>r.key)),o=[...E.value],n=i.headers.map(r=>t.has(r.key)?o.shift():r);return[...n.filter(r=>r.key!==I&&!m.value.includes(r.key)),...n.filter(r=>r.key===I)]}),pe=e.computed(()=>{var t;return me.value>0?(((t=s.texts)==null?void 0:t.hiddenColumns)??u.hiddenColumns)(me.value):y("columns")});function fe(t,o){X.value.has(t)||(m.value=o?m.value.filter(n=>n!==t):[...m.value,t])}function he(){m.value=K.value===0?D.value.filter(t=>!t.locked).map(t=>t.key):[]}function ge(){_.value=[],m.value=[...P.value]}function ee(t,o){const n=E.value.map(h=>h.key),r=n.indexOf(t),b=n.indexOf(o);r===-1||b===-1||r===b||(n.splice(b,0,...n.splice(r,1)),_.value=n)}function te(t,o){const n=E.value.map(b=>b.key),r=n[n.indexOf(t)+o];r&&ee(t,r)}function Ge(t,o){var n;R.value=o,(n=t.dataTransfer)==null||n.setData("text/plain",o)}function Ye(t){R.value&&ee(R.value,t),ye()}function ye(){R.value=null,z.value=null}const oe=e.computed(()=>{var o;const t=He+D.value.map(n=>n.key).sort().join(",");return((o=s.storageKey)==null?void 0:o.call(s,t))??t});e.watch(oe,t=>{try{const o=JSON.parse(localStorage.getItem(t)??"null");_.value=Array.isArray(o==null?void 0:o.order)?o.order:[],m.value=Array.isArray(o==null?void 0:o.hidden)?o.hidden.filter(n=>!X.value.has(n)):[...P.value]}catch{_.value=[],m.value=[...P.value]}},{immediate:!0}),e.watch([_,m],([t,o])=>{try{t.length===0&&o.length===P.value.length&&o.every(r=>P.value.includes(r))?localStorage.removeItem(oe.value):localStorage.setItem(oe.value,JSON.stringify({order:t,hidden:o}))}catch{}});const le=e.ref(null),ne=e.ref(null),j=e.ref(!1),ae=e.ref(!1),U=e.ref(!1),re=e.ref(!1),be=e.ref({});let M=null;const Ze=e.computed(()=>j.value||K.value>0||W.value),ve=e.computed(()=>U.value&&!re.value),We=e.computed(()=>({"vdt--pinned":ue.value,"vdt--can-left":ae.value,"vdt--can-right":U.value}));function se(){var t;return((t=ne.value)==null?void 0:t.querySelector(".v-table__wrapper"))??null}function q(){const t=ne.value,o=se();if(!t||!o)return;const n=o.scrollWidth-o.clientWidth;j.value=n>Y,ae.value=j.value&&o.scrollLeft>Y,U.value=j.value&&o.scrollLeft<n-Y;const r=ue.value?o.querySelector("thead > tr > th:last-child"):null,b=o.querySelector("thead"),h=o.getBoundingClientRect();be.value={"--vdt-pinned-w":`${(r==null?void 0:r.offsetWidth)??0}px`,"--vdt-scroll-top":`${h.top-t.getBoundingClientRect().top}px`,"--vdt-scroll-h":`${h.height}px`,"--vdt-head-h":`${(b==null?void 0:b.offsetHeight)??48}px`}}function Je(t){const o=se();!o||t.target!==o||(o.scrollLeft>10&&(re.value=!0),q())}function xe(t){var o;t===1&&(re.value=!0),(o=se())==null||o.scrollBy({left:t*Ie,behavior:"smooth"})}e.watch([Q,()=>i.items,()=>i.loading],()=>e.nextTick(q)),e.onMounted(()=>{$({page:O.value,itemsPerPage:T.value}),typeof ResizeObserver<"u"&&le.value&&(M=new ResizeObserver(()=>requestAnimationFrame(q)),M.observe(le.value)),q()}),e.onBeforeUnmount(()=>M==null?void 0:M.disconnect());const Xe=t=>{Z.value=t,A.value=!0},Qe=()=>{Z.value=null,A.value=!1},et=t=>{p("editItem",t)},tt=t=>{p("viewItem",t)},ot=()=>{p("deleteItem",Z.value),A.value=!1},$=({page:t,itemsPerPage:o})=>{const n=H.value.map(r=>({column:r.key,direction:r.order}));p("onLoadData",{page:t,itemsPerPage:o,search:i.search,sortBy:n})};function lt(){$({page:1,itemsPerPage:T.value})}const nt=Ve(lt,400);return e.watch(()=>i.search,(t,o)=>{t!==o&&nt()}),e.watch(T,(t,o)=>{t!==o&&$({page:1,itemsPerPage:t})}),e.watch(H,()=>{$({page:1,itemsPerPage:T.value})}),e.watch(O,t=>{$({page:t,itemsPerPage:T.value})}),(t,o)=>{const n=e.resolveComponent("v-btn"),r=e.resolveComponent("v-text-field"),b=e.resolveComponent("v-checkbox-btn"),h=e.resolveComponent("v-icon"),at=e.resolveComponent("v-card-text"),rt=e.resolveComponent("v-card"),st=e.resolveComponent("v-menu"),F=e.resolveComponent("v-tooltip"),it=e.resolveComponent("v-data-table-server");return e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:le,class:e.normalizeClass(["vdt",We.value]),style:e.normalizeStyle(be.value)},[e.withDirectives(e.createElementVNode("div",De,[e.renderSlot(t.$slots,"column-chooser",{columns:Fe.value,hiddenCount:K.value,label:pe.value,setVisible:fe,toggleAll:he,reset:ge,move:te,place:ee},()=>[e.createVNode(st,{modelValue:W.value,"onUpdate:modelValue":o[2]||(o[2]=a=>W.value=a),"close-on-content-click":!1,location:"bottom start"},{activator:e.withCtx(({props:a})=>[e.createVNode(n,e.mergeProps(a,{class:"vdt-columns__button",variant:"outlined",color:"primary",size:"small","prepend-icon":Oe}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(pe.value),1)]),_:1},16)]),default:e.withCtx(()=>[e.createVNode(rt,{class:"vdt-columns","min-width":"280"},{default:e.withCtx(()=>[e.createVNode(at,{class:"pa-3"},{default:e.withCtx(()=>[e.createVNode(r,{modelValue:J.value,"onUpdate:modelValue":o[0]||(o[0]=a=>J.value=a),placeholder:y("searchColumns"),density:"compact",variant:"outlined","hide-details":"",clearable:""},null,8,["modelValue","placeholder"]),e.createElementVNode("div",Te,[e.createVNode(n,{variant:"text",size:"small",color:"primary",onClick:he},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(K.value===0?y("hideAllColumns"):y("showAllColumns")),1)]),_:1}),e.createVNode(n,{variant:"text",size:"small",onClick:ge},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y("resetColumns")),1)]),_:1})]),e.createElementVNode("ul",_e,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(qe.value,a=>(e.openBlock(),e.createElementBlock("li",{key:a.key,class:e.normalizeClass(["vdt-columns__item",{"vdt-columns__item--over":z.value===a.key}]),draggable:"true",onDragstart:c=>Ge(c,a.key),onDragover:e.withModifiers(c=>z.value=a.key,["prevent"]),onDragleave:o[1]||(o[1]=c=>z.value=null),onDrop:e.withModifiers(c=>Ye(a.key),["prevent"]),onDragend:ye},[e.createVNode(b,{"model-value":!m.value.includes(a.key),label:a.title,disabled:!!a.locked,density:"compact",class:"flex-grow-1","onUpdate:modelValue":c=>fe(a.key,!!c)},null,8,["model-value","label","disabled","onUpdate:modelValue"]),e.createElementVNode("button",{type:"button",class:"vdt-columns__handle","aria-label":`${y("moveColumn")}: ${a.title}`,title:y("moveColumn"),onKeydown:[e.withKeys(e.withModifiers(c=>te(a.key,-1),["prevent"]),["up"]),e.withKeys(e.withModifiers(c=>te(a.key,1),["prevent"]),["down"])]},[e.createVNode(h,{icon:Ae,size:"18"})],40,Pe)],42,Ee))),128))])]),_:1})]),_:1})]),_:1},8,["modelValue"])])],512),[[e.vShow,Ze.value]]),e.createElementVNode("div",{ref_key:"bodyRef",ref:ne,class:"vdt-body",onScrollCapturePassive:Je},[e.createVNode(it,e.mergeProps(t.$attrs,{headers:Q.value,items:l.items,loading:l.loading,"items-length":l.totalItems,"items-per-page":T.value,"onUpdate:itemsPerPage":o[3]||(o[3]=a=>T.value=a),search:l.search,"sort-by":H.value,"onUpdate:sortBy":o[4]||(o[4]=a=>H.value=a),page:O.value,"onUpdate:page":o[5]||(o[5]=a=>O.value=a),"item-value":l.itemValue,"show-expand":l.showExpand,"show-select":l.showSelect,"select-strategy":l.selectStrategy,modelValue:N.value,"onUpdate:modelValue":o[6]||(o[6]=a=>N.value=a),class:d.value}),e.createSlots({"item.data-table-expand":e.withCtx(({internalItem:a,isExpanded:c,toggleExpand:v})=>[e.renderSlot(t.$slots,"item.data-table-expand",{internalItem:a,isExpanded:c,toggleExpand:v},()=>[e.createVNode(n,{onClick:ie=>v(a),rounded:""},{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c(a)?"mdi-chevron-up":"mdi-chevron-down"),1)]),_:2},1024)]),_:2},1032,["onClick"])])]),"expanded-row":e.withCtx(({columns:a,item:c})=>[e.renderSlot(t.$slots,"expanded-row",{columns:a,item:c})]),"item.actions":e.withCtx(({item:a})=>[e.renderSlot(t.$slots,"before-actions",{item:a}),l.showViewButton?(e.openBlock(),e.createBlock(F,{key:0,text:l.viewButtonText},{activator:e.withCtx(({props:c})=>{var v;return[e.createVNode(n,e.mergeProps({icon:"",flat:"",onClick:ie=>tt(a)},c,{disabled:(v=l.disableView)==null?void 0:v.call(l,a)}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"view-icon",{},()=>[g(V.value)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(V.value),e.mergeProps({key:0,size:20,class:"text-info"},B.value),null,16)):(e.openBlock(),e.createBlock(h,{key:1,size:"20",class:"text-info"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(V.value),1)]),_:1}))])]),_:3},16,["onClick","disabled"])]}),_:2},1032,["text"])):e.createCommentVNode("",!0),l.showEditButton?(e.openBlock(),e.createBlock(F,{key:1,text:l.editButtonText},{activator:e.withCtx(({props:c})=>{var v;return[e.createVNode(n,e.mergeProps({icon:"",flat:"",onClick:ie=>et(a)},c,{disabled:(v=l.disableEdit)==null?void 0:v.call(l,a)}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"edit-icon",{},()=>[g(f.value)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(f.value),e.mergeProps({key:0,size:20,class:"text-primary"},B.value),null,16)):(e.openBlock(),e.createBlock(h,{key:1,size:"20",class:"text-primary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value),1)]),_:1}))])]),_:3},16,["onClick","disabled"])]}),_:2},1032,["text"])):e.createCommentVNode("",!0),l.showDeleteButton?(e.openBlock(),e.createBlock(F,{key:2,text:l.deleteButtonText},{activator:e.withCtx(({props:c})=>{var v;return[e.createVNode(n,e.mergeProps({icon:"",flat:"",onClick:ie=>Xe(a)},c,{disabled:(v=l.disableDelete)==null?void 0:v.call(l,a)}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"delete-icon",{},()=>[g(S.value)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(S.value),e.mergeProps({key:0,size:20,class:"text-error"},B.value),null,16)):(e.openBlock(),e.createBlock(h,{key:1,size:"20",class:"text-error"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(S.value),1)]),_:1}))])]),_:3},16,["onClick","disabled"])]}),_:2},1032,["text"])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"after-actions",{item:a})]),tfoot:e.withCtx(()=>[e.createElementVNode("tfoot",null,[e.renderSlot(t.$slots,"item.tfoot",{columns:Q.value})])]),_:2},[l.showSelect?{name:"top",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"selection-actions",{selected:N.value,count:N.value.length,clear:je})]),key:"0"}:void 0,e.renderList(Ue.value,a=>({name:`item.${a.key}`,fn:e.withCtx(({item:c})=>[e.renderSlot(t.$slots,`item.${a.key}`,{item:c},()=>[e.createTextVNode(e.toDisplayString(c[a.key]),1)])])}))]),1040,["headers","items","loading","items-length","items-per-page","search","sort-by","page","item-value","show-expand","show-select","select-strategy","modelValue","class"]),o[9]||(o[9]=e.createElementVNode("div",{class:"vdt-fade vdt-fade--left"},null,-1)),o[10]||(o[10]=e.createElementVNode("div",{class:"vdt-fade vdt-fade--right"},null,-1)),ae.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"vdt-arrow vdt-arrow--left","aria-label":y("scrollLeft"),onClick:o[7]||(o[7]=a=>xe(-1))},[e.createVNode(h,{icon:Re,size:"20"})],8,Me)):e.createCommentVNode("",!0),U.value?(e.openBlock(),e.createBlock(F,{key:1,text:y("scrollRight"),disabled:ve.value,location:"top"},{activator:e.withCtx(({props:a})=>[e.createElementVNode("button",e.mergeProps(a,{type:"button",class:"vdt-arrow vdt-arrow--right","aria-label":y("scrollRight"),onClick:o[8]||(o[8]=c=>xe(1))}),[e.createVNode(h,{icon:ze,size:"20"})],16,$e)]),_:1},8,["text","disabled"])):e.createCommentVNode("",!0),ve.value?(e.openBlock(),e.createElementBlock("span",Le,e.toDisplayString(y("scrollHint")),1)):e.createCommentVNode("",!0)],544),e.createVNode(Se,{show:A.value,title:l.deleteModalTitle,description:l.deleteModalMessage,confirmButtonText:l.deleteModalConfirmButtonText,cancelButtonText:l.deleteModalCancelButtonText,onClose:Qe,onConfirm:ot},null,8,["show","title","description","confirmButtonText","cancelButtonText"])],6)}}}),Ke={install(l){l.component("DataTable",de)}};x.DATA_TABLE_CONFIG_KEY=G,x.DataTable=de,x.createDataTableConfig=Be,x.default=Ke,Object.defineProperties(x,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|