@dazzadev/vuetify-datatable 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types.d.ts +1 -0
- package/dist/vuetify-datatable.js +161 -161
- package/dist/vuetify-datatable.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
function
|
|
1
|
+
import { defineComponent as R, computed as $, resolveComponent as y, openBlock as g, createBlock as x, withCtx as n, createVNode as r, createTextVNode as T, toDisplayString as P, renderSlot as h, createCommentVNode as L, inject as ee, ref as V, onMounted as te, watch as z, createElementBlock as oe, Fragment as ne, normalizeClass as ae, createSlots as le, createElementVNode as ie, mergeProps as M, resolveDynamicComponent as F, renderList as se } from "vue";
|
|
2
|
+
function de(e) {
|
|
3
3
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
4
|
}
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
-
if (
|
|
8
|
-
|
|
9
|
-
function e(p,
|
|
5
|
+
var j = { exports: {} }, U;
|
|
6
|
+
function re() {
|
|
7
|
+
if (U) return j.exports;
|
|
8
|
+
U = 1;
|
|
9
|
+
function e(p, l = 100, u = {}) {
|
|
10
10
|
if (typeof p != "function")
|
|
11
11
|
throw new TypeError(`Expected the first parameter to be a function, got \`${typeof p}\`.`);
|
|
12
|
-
if (
|
|
12
|
+
if (l < 0)
|
|
13
13
|
throw new RangeError("`wait` must not be negative.");
|
|
14
|
-
const { immediate: d } = typeof
|
|
15
|
-
let
|
|
16
|
-
function
|
|
17
|
-
const
|
|
18
|
-
return
|
|
14
|
+
const { immediate: d } = typeof u == "boolean" ? { immediate: u } : u;
|
|
15
|
+
let m, B, a, C, w;
|
|
16
|
+
function k() {
|
|
17
|
+
const v = m, D = B;
|
|
18
|
+
return m = void 0, B = void 0, w = p.apply(v, D), w;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
const
|
|
22
|
-
|
|
20
|
+
function f() {
|
|
21
|
+
const v = Date.now() - C;
|
|
22
|
+
v < l && v >= 0 ? a = setTimeout(f, l - v) : (a = void 0, d || (w = k()));
|
|
23
23
|
}
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
24
|
+
const i = function(...v) {
|
|
25
|
+
if (m && this !== m && Object.getPrototypeOf(this) === Object.getPrototypeOf(m))
|
|
26
26
|
throw new Error("Debounced method called with different contexts of the same prototype.");
|
|
27
|
-
|
|
27
|
+
m = this, B = v, C = Date.now();
|
|
28
28
|
const D = d && !a;
|
|
29
|
-
return a || (a = setTimeout(
|
|
29
|
+
return a || (a = setTimeout(f, l)), D && (w = k()), w;
|
|
30
30
|
};
|
|
31
|
-
return Object.defineProperty(
|
|
31
|
+
return Object.defineProperty(i, "isPending", {
|
|
32
32
|
get() {
|
|
33
33
|
return a !== void 0;
|
|
34
34
|
}
|
|
35
|
-
}),
|
|
35
|
+
}), i.clear = () => {
|
|
36
36
|
a && (clearTimeout(a), a = void 0);
|
|
37
|
-
},
|
|
38
|
-
a &&
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
},
|
|
37
|
+
}, i.flush = () => {
|
|
38
|
+
a && i.trigger();
|
|
39
|
+
}, i.trigger = () => {
|
|
40
|
+
w = k(), i.clear();
|
|
41
|
+
}, i;
|
|
42
42
|
}
|
|
43
|
-
return
|
|
43
|
+
return j.exports.debounce = e, j.exports = e, j.exports;
|
|
44
44
|
}
|
|
45
|
-
var
|
|
46
|
-
const
|
|
45
|
+
var ce = /* @__PURE__ */ re();
|
|
46
|
+
const ue = /* @__PURE__ */ de(ce), me = /* @__PURE__ */ R({
|
|
47
47
|
__name: "ConfirmationModal",
|
|
48
48
|
props: {
|
|
49
49
|
show: Boolean,
|
|
@@ -54,58 +54,58 @@ const ce = /* @__PURE__ */ se(re), ue = /* @__PURE__ */ U({
|
|
|
54
54
|
},
|
|
55
55
|
emits: ["close", "confirm"],
|
|
56
56
|
setup(e) {
|
|
57
|
-
const p = e,
|
|
57
|
+
const p = e, l = $({
|
|
58
58
|
get: () => p.show,
|
|
59
59
|
set: () => {
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
-
return (
|
|
63
|
-
const
|
|
64
|
-
return g(),
|
|
65
|
-
modelValue:
|
|
66
|
-
"onUpdate:modelValue": d[2] || (d[2] = (
|
|
62
|
+
return (u, d) => {
|
|
63
|
+
const m = y("v-card-title"), B = y("v-card-text"), a = y("v-spacer"), C = y("v-btn"), w = y("v-card-actions"), k = y("v-card"), f = y("v-dialog");
|
|
64
|
+
return g(), x(f, {
|
|
65
|
+
modelValue: l.value,
|
|
66
|
+
"onUpdate:modelValue": d[2] || (d[2] = (i) => l.value = i),
|
|
67
67
|
"max-width": "500px",
|
|
68
68
|
persistent: "",
|
|
69
69
|
"no-click-animation": ""
|
|
70
70
|
}, {
|
|
71
71
|
default: n(() => [
|
|
72
|
-
r(
|
|
72
|
+
r(k, null, {
|
|
73
73
|
default: n(() => [
|
|
74
|
-
r(
|
|
74
|
+
r(m, { class: "text-h5 text-center py-6" }, {
|
|
75
75
|
default: n(() => [
|
|
76
76
|
T(P(e.title), 1)
|
|
77
77
|
]),
|
|
78
78
|
_: 1
|
|
79
79
|
}),
|
|
80
|
-
e.description ? (g(),
|
|
80
|
+
e.description ? (g(), x(B, {
|
|
81
81
|
key: 0,
|
|
82
82
|
class: "text-center px-0 py-0"
|
|
83
83
|
}, {
|
|
84
84
|
default: n(() => [
|
|
85
85
|
T(P(e.description) + " ", 1),
|
|
86
|
-
h(
|
|
86
|
+
h(u.$slots, "description")
|
|
87
87
|
]),
|
|
88
88
|
_: 3
|
|
89
|
-
})) :
|
|
90
|
-
r(
|
|
89
|
+
})) : L("", !0),
|
|
90
|
+
r(w, null, {
|
|
91
91
|
default: n(() => [
|
|
92
92
|
r(a),
|
|
93
|
-
r(
|
|
93
|
+
r(C, {
|
|
94
94
|
color: "error",
|
|
95
95
|
variant: "flat",
|
|
96
96
|
dark: "",
|
|
97
|
-
onClick: d[0] || (d[0] = (
|
|
97
|
+
onClick: d[0] || (d[0] = (i) => u.$emit("close"))
|
|
98
98
|
}, {
|
|
99
99
|
default: n(() => [
|
|
100
100
|
T(P(e.cancelButtonText), 1)
|
|
101
101
|
]),
|
|
102
102
|
_: 1
|
|
103
103
|
}),
|
|
104
|
-
r(
|
|
104
|
+
r(C, {
|
|
105
105
|
color: "success",
|
|
106
106
|
variant: "flat",
|
|
107
107
|
dark: "",
|
|
108
|
-
onClick: d[1] || (d[1] = (
|
|
108
|
+
onClick: d[1] || (d[1] = (i) => u.$emit("confirm"))
|
|
109
109
|
}, {
|
|
110
110
|
default: n(() => [
|
|
111
111
|
T(P(e.confirmButtonText), 1)
|
|
@@ -124,18 +124,18 @@ const ce = /* @__PURE__ */ se(re), ue = /* @__PURE__ */ U({
|
|
|
124
124
|
}, 8, ["modelValue"]);
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
-
}),
|
|
128
|
-
function
|
|
127
|
+
}), G = Symbol("DataTableConfig");
|
|
128
|
+
function ge(e) {
|
|
129
129
|
return {
|
|
130
130
|
install(p) {
|
|
131
|
-
p.provide(
|
|
131
|
+
p.provide(G, e);
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
const
|
|
135
|
+
const fe = /* @__PURE__ */ R({
|
|
136
136
|
__name: "DataTable",
|
|
137
137
|
props: {
|
|
138
|
-
tableClass: {
|
|
138
|
+
tableClass: {},
|
|
139
139
|
headers: { default: () => [] },
|
|
140
140
|
items: { default: () => [] },
|
|
141
141
|
loading: { type: Boolean, default: !1 },
|
|
@@ -163,116 +163,116 @@ const me = /* @__PURE__ */ U({
|
|
|
163
163
|
},
|
|
164
164
|
emits: ["onLoadData", "editItem", "deleteItem", "viewItem"],
|
|
165
165
|
setup(e, { emit: p }) {
|
|
166
|
-
const
|
|
166
|
+
const l = e, u = p, d = ee(G, { icons: {} }), m = $(() => {
|
|
167
167
|
var t;
|
|
168
|
-
return
|
|
169
|
-
}), B =
|
|
168
|
+
return l.viewIcon ?? ((t = d.icons) == null ? void 0 : t.view) ?? "mdi-eye-outline";
|
|
169
|
+
}), B = $(() => {
|
|
170
170
|
var t;
|
|
171
|
-
return
|
|
172
|
-
}), a =
|
|
171
|
+
return l.editIcon ?? ((t = d.icons) == null ? void 0 : t.edit) ?? "mdi-pencil-outline";
|
|
172
|
+
}), a = $(() => {
|
|
173
173
|
var t;
|
|
174
|
-
return
|
|
175
|
-
}),
|
|
176
|
-
function
|
|
174
|
+
return l.deleteIcon ?? ((t = d.icons) == null ? void 0 : t.delete) ?? "mdi-trash-can-outline";
|
|
175
|
+
}), C = $(() => d.iconProps ?? {}), w = $(() => l.tableClass ?? d.tableClass ?? "border rounded-md");
|
|
176
|
+
function k(t) {
|
|
177
177
|
return typeof t != "string";
|
|
178
178
|
}
|
|
179
|
-
const
|
|
179
|
+
const f = V(l.itemsPerPage), i = V([]), v = V(1), D = V(null), O = V(!1), K = $(() => {
|
|
180
180
|
var t;
|
|
181
|
-
return ((t =
|
|
182
|
-
(
|
|
181
|
+
return ((t = l.headers) == null ? void 0 : t.filter(
|
|
182
|
+
(s) => s.key !== "actions" && s.key !== "expanded-row" && s.key !== "data-table-expand"
|
|
183
183
|
)) || [];
|
|
184
184
|
});
|
|
185
|
-
|
|
185
|
+
te(() => {
|
|
186
186
|
S({
|
|
187
|
-
page:
|
|
188
|
-
itemsPerPage:
|
|
187
|
+
page: v.value,
|
|
188
|
+
itemsPerPage: f.value
|
|
189
189
|
});
|
|
190
190
|
});
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
},
|
|
194
|
-
|
|
195
|
-
}, H = (t) => {
|
|
196
|
-
m("editItem", t);
|
|
191
|
+
const Y = (t) => {
|
|
192
|
+
D.value = t, O.value = !0;
|
|
193
|
+
}, H = () => {
|
|
194
|
+
D.value = null, O.value = !1;
|
|
197
195
|
}, J = (t) => {
|
|
198
|
-
|
|
199
|
-
}, Q = () => {
|
|
200
|
-
|
|
201
|
-
},
|
|
202
|
-
|
|
196
|
+
u("editItem", t);
|
|
197
|
+
}, Q = (t) => {
|
|
198
|
+
u("viewItem", t);
|
|
199
|
+
}, W = () => {
|
|
200
|
+
u("deleteItem", D.value), O.value = !1;
|
|
201
|
+
}, S = ({ page: t, itemsPerPage: s }) => {
|
|
202
|
+
const E = i.value.map((I) => ({
|
|
203
203
|
column: I.key,
|
|
204
204
|
direction: I.order
|
|
205
205
|
}));
|
|
206
|
-
|
|
206
|
+
u("onLoadData", {
|
|
207
207
|
page: t,
|
|
208
|
-
itemsPerPage:
|
|
209
|
-
search:
|
|
210
|
-
sortBy:
|
|
208
|
+
itemsPerPage: s,
|
|
209
|
+
search: l.search,
|
|
210
|
+
sortBy: E
|
|
211
211
|
});
|
|
212
212
|
};
|
|
213
|
-
function
|
|
213
|
+
function X() {
|
|
214
214
|
S({
|
|
215
215
|
page: 1,
|
|
216
|
-
itemsPerPage:
|
|
216
|
+
itemsPerPage: f.value
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
|
-
const
|
|
220
|
-
|
|
219
|
+
const q = ue(X, 400), Z = () => {
|
|
220
|
+
q();
|
|
221
221
|
};
|
|
222
|
-
return
|
|
223
|
-
() =>
|
|
224
|
-
(t,
|
|
225
|
-
t !==
|
|
222
|
+
return z(
|
|
223
|
+
() => l.search,
|
|
224
|
+
(t, s) => {
|
|
225
|
+
t !== s && q();
|
|
226
226
|
}
|
|
227
|
-
),
|
|
228
|
-
t !==
|
|
227
|
+
), z(f, (t, s) => {
|
|
228
|
+
t !== s && S({
|
|
229
229
|
page: 1,
|
|
230
230
|
itemsPerPage: t
|
|
231
231
|
});
|
|
232
|
-
}),
|
|
232
|
+
}), z(i, () => {
|
|
233
233
|
S({
|
|
234
234
|
page: 1,
|
|
235
|
-
itemsPerPage:
|
|
235
|
+
itemsPerPage: f.value
|
|
236
236
|
});
|
|
237
|
-
}),
|
|
237
|
+
}), z(v, (t) => {
|
|
238
238
|
S({
|
|
239
239
|
page: t,
|
|
240
|
-
itemsPerPage:
|
|
240
|
+
itemsPerPage: f.value
|
|
241
241
|
});
|
|
242
|
-
}), (t,
|
|
243
|
-
const
|
|
244
|
-
return g(),
|
|
245
|
-
r(
|
|
242
|
+
}), (t, s) => {
|
|
243
|
+
const E = y("v-icon"), I = y("v-btn"), N = y("v-tooltip"), _ = y("v-data-table-server");
|
|
244
|
+
return g(), oe(ne, null, [
|
|
245
|
+
r(_, {
|
|
246
246
|
headers: e.headers,
|
|
247
247
|
items: e.items,
|
|
248
248
|
loading: e.loading,
|
|
249
249
|
"items-length": e.totalItems,
|
|
250
|
-
"items-per-page":
|
|
251
|
-
"onUpdate:itemsPerPage":
|
|
250
|
+
"items-per-page": f.value,
|
|
251
|
+
"onUpdate:itemsPerPage": s[0] || (s[0] = (o) => f.value = o),
|
|
252
252
|
search: e.search,
|
|
253
|
-
onSearch:
|
|
254
|
-
"sort-by":
|
|
255
|
-
"onUpdate:sortBy":
|
|
256
|
-
page:
|
|
257
|
-
"onUpdate:page":
|
|
253
|
+
onSearch: Z,
|
|
254
|
+
"sort-by": i.value,
|
|
255
|
+
"onUpdate:sortBy": s[1] || (s[1] = (o) => i.value = o),
|
|
256
|
+
page: v.value,
|
|
257
|
+
"onUpdate:page": s[2] || (s[2] = (o) => v.value = o),
|
|
258
258
|
"item-value": e.itemValue,
|
|
259
259
|
"show-expand": e.showExpand,
|
|
260
|
-
class:
|
|
261
|
-
},
|
|
262
|
-
"item.data-table-expand": n(({ internalItem: o, isExpanded:
|
|
260
|
+
class: ae(w.value)
|
|
261
|
+
}, le({
|
|
262
|
+
"item.data-table-expand": n(({ internalItem: o, isExpanded: c, toggleExpand: b }) => [
|
|
263
263
|
h(t.$slots, "item.data-table-expand", {
|
|
264
264
|
internalItem: o,
|
|
265
|
-
isExpanded:
|
|
266
|
-
toggleExpand:
|
|
265
|
+
isExpanded: c,
|
|
266
|
+
toggleExpand: b
|
|
267
267
|
}, () => [
|
|
268
268
|
r(I, {
|
|
269
|
-
onClick: (
|
|
269
|
+
onClick: (A) => b(o),
|
|
270
270
|
rounded: ""
|
|
271
271
|
}, {
|
|
272
272
|
default: n(() => [
|
|
273
|
-
r(
|
|
273
|
+
r(E, null, {
|
|
274
274
|
default: n(() => [
|
|
275
|
-
T(P(
|
|
275
|
+
T(P(c(o) ? "mdi-chevron-up" : "mdi-chevron-down"), 1)
|
|
276
276
|
]),
|
|
277
277
|
_: 2
|
|
278
278
|
}, 1024)
|
|
@@ -281,41 +281,41 @@ const me = /* @__PURE__ */ U({
|
|
|
281
281
|
}, 1032, ["onClick"])
|
|
282
282
|
])
|
|
283
283
|
]),
|
|
284
|
-
"expanded-row": n(({ columns: o, item:
|
|
284
|
+
"expanded-row": n(({ columns: o, item: c }) => [
|
|
285
285
|
h(t.$slots, "expanded-row", {
|
|
286
286
|
columns: o,
|
|
287
|
-
item:
|
|
287
|
+
item: c
|
|
288
288
|
})
|
|
289
289
|
]),
|
|
290
290
|
"item.actions": n(({ item: o }) => [
|
|
291
291
|
h(t.$slots, "before-actions", { item: o }),
|
|
292
|
-
e.showViewButton ? (g(),
|
|
292
|
+
e.showViewButton ? (g(), x(N, {
|
|
293
293
|
key: 0,
|
|
294
294
|
text: e.viewButtonText
|
|
295
295
|
}, {
|
|
296
|
-
activator: n(({ props:
|
|
297
|
-
var
|
|
296
|
+
activator: n(({ props: c }) => {
|
|
297
|
+
var b;
|
|
298
298
|
return [
|
|
299
|
-
r(I,
|
|
299
|
+
r(I, M({
|
|
300
300
|
icon: "",
|
|
301
301
|
flat: "",
|
|
302
|
-
onClick: (
|
|
303
|
-
},
|
|
304
|
-
disabled: (
|
|
302
|
+
onClick: (A) => Q(o)
|
|
303
|
+
}, c, {
|
|
304
|
+
disabled: (b = e.disableView) == null ? void 0 : b.call(e, o)
|
|
305
305
|
}), {
|
|
306
306
|
default: n(() => [
|
|
307
307
|
h(t.$slots, "view-icon", {}, () => [
|
|
308
|
-
|
|
308
|
+
k(m.value) ? (g(), x(F(m.value), M({
|
|
309
309
|
key: 0,
|
|
310
310
|
size: 20,
|
|
311
311
|
class: "text-info"
|
|
312
|
-
},
|
|
312
|
+
}, C.value), null, 16)) : (g(), x(E, {
|
|
313
313
|
key: 1,
|
|
314
314
|
size: "20",
|
|
315
315
|
class: "text-info"
|
|
316
316
|
}, {
|
|
317
317
|
default: n(() => [
|
|
318
|
-
T(P(
|
|
318
|
+
T(P(m.value), 1)
|
|
319
319
|
]),
|
|
320
320
|
_: 1
|
|
321
321
|
}))
|
|
@@ -326,28 +326,28 @@ const me = /* @__PURE__ */ U({
|
|
|
326
326
|
];
|
|
327
327
|
}),
|
|
328
328
|
_: 2
|
|
329
|
-
}, 1032, ["text"])) :
|
|
330
|
-
e.showEditButton ? (g(),
|
|
329
|
+
}, 1032, ["text"])) : L("", !0),
|
|
330
|
+
e.showEditButton ? (g(), x(N, {
|
|
331
331
|
key: 1,
|
|
332
332
|
text: e.editButtonText
|
|
333
333
|
}, {
|
|
334
|
-
activator: n(({ props:
|
|
335
|
-
var
|
|
334
|
+
activator: n(({ props: c }) => {
|
|
335
|
+
var b;
|
|
336
336
|
return [
|
|
337
|
-
r(I,
|
|
337
|
+
r(I, M({
|
|
338
338
|
icon: "",
|
|
339
339
|
flat: "",
|
|
340
|
-
onClick: (
|
|
341
|
-
},
|
|
342
|
-
disabled: (
|
|
340
|
+
onClick: (A) => J(o)
|
|
341
|
+
}, c, {
|
|
342
|
+
disabled: (b = e.disableEdit) == null ? void 0 : b.call(e, o)
|
|
343
343
|
}), {
|
|
344
344
|
default: n(() => [
|
|
345
345
|
h(t.$slots, "edit-icon", {}, () => [
|
|
346
|
-
|
|
346
|
+
k(B.value) ? (g(), x(F(B.value), M({
|
|
347
347
|
key: 0,
|
|
348
348
|
size: 20,
|
|
349
349
|
class: "text-primary"
|
|
350
|
-
},
|
|
350
|
+
}, C.value), null, 16)) : (g(), x(E, {
|
|
351
351
|
key: 1,
|
|
352
352
|
size: "20",
|
|
353
353
|
class: "text-primary"
|
|
@@ -364,28 +364,28 @@ const me = /* @__PURE__ */ U({
|
|
|
364
364
|
];
|
|
365
365
|
}),
|
|
366
366
|
_: 2
|
|
367
|
-
}, 1032, ["text"])) :
|
|
368
|
-
e.showDeleteButton ? (g(),
|
|
367
|
+
}, 1032, ["text"])) : L("", !0),
|
|
368
|
+
e.showDeleteButton ? (g(), x(N, {
|
|
369
369
|
key: 2,
|
|
370
370
|
text: e.deleteButtonText
|
|
371
371
|
}, {
|
|
372
|
-
activator: n(({ props:
|
|
373
|
-
var
|
|
372
|
+
activator: n(({ props: c }) => {
|
|
373
|
+
var b;
|
|
374
374
|
return [
|
|
375
|
-
r(I,
|
|
375
|
+
r(I, M({
|
|
376
376
|
icon: "",
|
|
377
377
|
flat: "",
|
|
378
|
-
onClick: (
|
|
379
|
-
},
|
|
380
|
-
disabled: (
|
|
378
|
+
onClick: (A) => Y(o)
|
|
379
|
+
}, c, {
|
|
380
|
+
disabled: (b = e.disableDelete) == null ? void 0 : b.call(e, o)
|
|
381
381
|
}), {
|
|
382
382
|
default: n(() => [
|
|
383
383
|
h(t.$slots, "delete-icon", {}, () => [
|
|
384
|
-
|
|
384
|
+
k(a.value) ? (g(), x(F(a.value), M({
|
|
385
385
|
key: 0,
|
|
386
386
|
size: 20,
|
|
387
387
|
class: "text-error"
|
|
388
|
-
},
|
|
388
|
+
}, C.value), null, 16)) : (g(), x(E, {
|
|
389
389
|
key: 1,
|
|
390
390
|
size: "20",
|
|
391
391
|
class: "text-error"
|
|
@@ -402,45 +402,45 @@ const me = /* @__PURE__ */ U({
|
|
|
402
402
|
];
|
|
403
403
|
}),
|
|
404
404
|
_: 2
|
|
405
|
-
}, 1032, ["text"])) :
|
|
405
|
+
}, 1032, ["text"])) : L("", !0),
|
|
406
406
|
h(t.$slots, "after-actions", { item: o })
|
|
407
407
|
]),
|
|
408
408
|
tfoot: n(() => [
|
|
409
|
-
|
|
409
|
+
ie("tfoot", null, [
|
|
410
410
|
h(t.$slots, "item.tfoot")
|
|
411
411
|
])
|
|
412
412
|
]),
|
|
413
413
|
_: 2
|
|
414
414
|
}, [
|
|
415
|
-
|
|
415
|
+
se(K.value, (o) => ({
|
|
416
416
|
name: `item.${o.key}`,
|
|
417
|
-
fn: n(({ item:
|
|
418
|
-
h(t.$slots, `item.${o.key}`, { item:
|
|
419
|
-
T(P(
|
|
417
|
+
fn: n(({ item: c }) => [
|
|
418
|
+
h(t.$slots, `item.${o.key}`, { item: c }, () => [
|
|
419
|
+
T(P(c[o.key]), 1)
|
|
420
420
|
])
|
|
421
421
|
])
|
|
422
422
|
}))
|
|
423
423
|
]), 1032, ["headers", "items", "loading", "items-length", "items-per-page", "search", "sort-by", "page", "item-value", "show-expand", "class"]),
|
|
424
|
-
r(
|
|
425
|
-
show:
|
|
424
|
+
r(me, {
|
|
425
|
+
show: O.value,
|
|
426
426
|
title: e.deleteModalTitle,
|
|
427
427
|
description: e.deleteModalMessage,
|
|
428
428
|
confirmButtonText: e.deleteModalConfirmButtonText,
|
|
429
429
|
cancelButtonText: e.deleteModalCancelButtonText,
|
|
430
|
-
onClose:
|
|
431
|
-
onConfirm:
|
|
430
|
+
onClose: H,
|
|
431
|
+
onConfirm: W
|
|
432
432
|
}, null, 8, ["show", "title", "description", "confirmButtonText", "cancelButtonText"])
|
|
433
433
|
], 64);
|
|
434
434
|
};
|
|
435
435
|
}
|
|
436
|
-
}),
|
|
436
|
+
}), be = {
|
|
437
437
|
install(e) {
|
|
438
|
-
e.component("DataTable",
|
|
438
|
+
e.component("DataTable", fe);
|
|
439
439
|
}
|
|
440
440
|
};
|
|
441
441
|
export {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
442
|
+
G as DATA_TABLE_CONFIG_KEY,
|
|
443
|
+
fe as DataTable,
|
|
444
|
+
ge as createDataTableConfig,
|
|
445
|
+
be as default
|
|
446
446
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(C,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(C=typeof globalThis<"u"?globalThis:C||self,e(C.VuetifyDatatable={},C.Vue))})(this,(function(C,e){"use strict";function
|
|
1
|
+
(function(C,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(C=typeof globalThis<"u"?globalThis:C||self,e(C.VuetifyDatatable={},C.Vue))})(this,(function(C,e){"use strict";function M(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var D={exports:{}},I;function O(){if(I)return D.exports;I=1;function t(h,l=100,s={}){if(typeof h!="function")throw new TypeError(`Expected the first parameter to be a function, got \`${typeof h}\`.`);if(l<0)throw new RangeError("`wait` must not be negative.");const{immediate:c}=typeof s=="boolean"?{immediate:s}:s;let m,u,a,w,g;function y(){const p=m,B=u;return m=void 0,u=void 0,g=h.apply(p,B),g}function f(){const p=Date.now()-w;p<l&&p>=0?a=setTimeout(f,l-p):(a=void 0,c||(g=y()))}const i=function(...p){if(m&&this!==m&&Object.getPrototypeOf(this)===Object.getPrototypeOf(m))throw new Error("Debounced method called with different contexts of the same prototype.");m=this,u=p,w=Date.now();const B=c&&!a;return a||(a=setTimeout(f,l)),B&&(g=y()),g};return Object.defineProperty(i,"isPending",{get(){return a!==void 0}}),i.clear=()=>{a&&(clearTimeout(a),a=void 0)},i.flush=()=>{a&&i.trigger()},i.trigger=()=>{g=y(),i.clear()},i}return D.exports.debounce=t,D.exports=t,D.exports}var j=O();const A=M(j),z=e.defineComponent({__name:"ConfirmationModal",props:{show:Boolean,title:String,description:String,confirmButtonText:String,cancelButtonText:String},emits:["close","confirm"],setup(t){const h=t,l=e.computed({get:()=>h.show,set:()=>{}});return(s,c)=>{const m=e.resolveComponent("v-card-title"),u=e.resolveComponent("v-card-text"),a=e.resolveComponent("v-spacer"),w=e.resolveComponent("v-btn"),g=e.resolveComponent("v-card-actions"),y=e.resolveComponent("v-card"),f=e.resolveComponent("v-dialog");return e.openBlock(),e.createBlock(f,{modelValue:l.value,"onUpdate:modelValue":c[2]||(c[2]=i=>l.value=i),"max-width":"500px",persistent:"","no-click-animation":""},{default:e.withCtx(()=>[e.createVNode(y,null,{default:e.withCtx(()=>[e.createVNode(m,{class:"text-h5 text-center py-6"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),_:1}),t.description?(e.openBlock(),e.createBlock(u,{key:0,class:"text-center px-0 py-0"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.description)+" ",1),e.renderSlot(s.$slots,"description")]),_:3})):e.createCommentVNode("",!0),e.createVNode(g,null,{default:e.withCtx(()=>[e.createVNode(a),e.createVNode(w,{color:"error",variant:"flat",dark:"",onClick:c[0]||(c[0]=i=>s.$emit("close"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.cancelButtonText),1)]),_:1}),e.createVNode(w,{color:"success",variant:"flat",dark:"",onClick:c[1]||(c[1]=i=>s.$emit("confirm"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.confirmButtonText),1)]),_:1}),e.createVNode(a)]),_:1})]),_:3})]),_:3},8,["modelValue"])}}}),P=Symbol("DataTableConfig");function L(t){return{install(h){h.provide(P,t)}}}const $=e.defineComponent({__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},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"],setup(t,{emit:h}){const l=t,s=h,c=e.inject(P,{icons:{}}),m=e.computed(()=>{var o;return l.viewIcon??((o=c.icons)==null?void 0:o.view)??"mdi-eye-outline"}),u=e.computed(()=>{var o;return l.editIcon??((o=c.icons)==null?void 0:o.edit)??"mdi-pencil-outline"}),a=e.computed(()=>{var o;return l.deleteIcon??((o=c.icons)==null?void 0:o.delete)??"mdi-trash-can-outline"}),w=e.computed(()=>c.iconProps??{}),g=e.computed(()=>l.tableClass??c.tableClass??"border rounded-md");function y(o){return typeof o!="string"}const f=e.ref(l.itemsPerPage),i=e.ref([]),p=e.ref(1),B=e.ref(null),V=e.ref(!1),q=e.computed(()=>{var o;return((o=l.headers)==null?void 0:o.filter(r=>r.key!=="actions"&&r.key!=="expanded-row"&&r.key!=="data-table-expand"))||[]});e.onMounted(()=>{T({page:p.value,itemsPerPage:f.value})});const U=o=>{B.value=o,V.value=!0},R=()=>{B.value=null,V.value=!1},G=o=>{s("editItem",o)},K=o=>{s("viewItem",o)},Y=()=>{s("deleteItem",B.value),V.value=!1},T=({page:o,itemsPerPage:r})=>{const k=i.value.map(b=>({column:b.key,direction:b.order}));s("onLoadData",{page:o,itemsPerPage:r,search:l.search,sortBy:k})};function H(){T({page:1,itemsPerPage:f.value})}const E=A(H,400),J=()=>{E()};return e.watch(()=>l.search,(o,r)=>{o!==r&&E()}),e.watch(f,(o,r)=>{o!==r&&T({page:1,itemsPerPage:o})}),e.watch(i,()=>{T({page:1,itemsPerPage:f.value})}),e.watch(p,o=>{T({page:o,itemsPerPage:f.value})}),(o,r)=>{const k=e.resolveComponent("v-icon"),b=e.resolveComponent("v-btn"),S=e.resolveComponent("v-tooltip"),Q=e.resolveComponent("v-data-table-server");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Q,{headers:t.headers,items:t.items,loading:t.loading,"items-length":t.totalItems,"items-per-page":f.value,"onUpdate:itemsPerPage":r[0]||(r[0]=n=>f.value=n),search:t.search,onSearch:J,"sort-by":i.value,"onUpdate:sortBy":r[1]||(r[1]=n=>i.value=n),page:p.value,"onUpdate:page":r[2]||(r[2]=n=>p.value=n),"item-value":t.itemValue,"show-expand":t.showExpand,class:e.normalizeClass(g.value)},e.createSlots({"item.data-table-expand":e.withCtx(({internalItem:n,isExpanded:d,toggleExpand:x})=>[e.renderSlot(o.$slots,"item.data-table-expand",{internalItem:n,isExpanded:d,toggleExpand:x},()=>[e.createVNode(b,{onClick:N=>x(n),rounded:""},{default:e.withCtx(()=>[e.createVNode(k,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d(n)?"mdi-chevron-up":"mdi-chevron-down"),1)]),_:2},1024)]),_:2},1032,["onClick"])])]),"expanded-row":e.withCtx(({columns:n,item:d})=>[e.renderSlot(o.$slots,"expanded-row",{columns:n,item:d})]),"item.actions":e.withCtx(({item:n})=>[e.renderSlot(o.$slots,"before-actions",{item:n}),t.showViewButton?(e.openBlock(),e.createBlock(S,{key:0,text:t.viewButtonText},{activator:e.withCtx(({props:d})=>{var x;return[e.createVNode(b,e.mergeProps({icon:"",flat:"",onClick:N=>K(n)},d,{disabled:(x=t.disableView)==null?void 0:x.call(t,n)}),{default:e.withCtx(()=>[e.renderSlot(o.$slots,"view-icon",{},()=>[y(m.value)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.value),e.mergeProps({key:0,size:20,class:"text-info"},w.value),null,16)):(e.openBlock(),e.createBlock(k,{key:1,size:"20",class:"text-info"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.value),1)]),_:1}))])]),_:3},16,["onClick","disabled"])]}),_:2},1032,["text"])):e.createCommentVNode("",!0),t.showEditButton?(e.openBlock(),e.createBlock(S,{key:1,text:t.editButtonText},{activator:e.withCtx(({props:d})=>{var x;return[e.createVNode(b,e.mergeProps({icon:"",flat:"",onClick:N=>G(n)},d,{disabled:(x=t.disableEdit)==null?void 0:x.call(t,n)}),{default:e.withCtx(()=>[e.renderSlot(o.$slots,"edit-icon",{},()=>[y(u.value)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.value),e.mergeProps({key:0,size:20,class:"text-primary"},w.value),null,16)):(e.openBlock(),e.createBlock(k,{key:1,size:"20",class:"text-primary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.value),1)]),_:1}))])]),_:3},16,["onClick","disabled"])]}),_:2},1032,["text"])):e.createCommentVNode("",!0),t.showDeleteButton?(e.openBlock(),e.createBlock(S,{key:2,text:t.deleteButtonText},{activator:e.withCtx(({props:d})=>{var x;return[e.createVNode(b,e.mergeProps({icon:"",flat:"",onClick:N=>U(n)},d,{disabled:(x=t.disableDelete)==null?void 0:x.call(t,n)}),{default:e.withCtx(()=>[e.renderSlot(o.$slots,"delete-icon",{},()=>[y(a.value)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),e.mergeProps({key:0,size:20,class:"text-error"},w.value),null,16)):(e.openBlock(),e.createBlock(k,{key:1,size:"20",class:"text-error"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value),1)]),_:1}))])]),_:3},16,["onClick","disabled"])]}),_:2},1032,["text"])):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"after-actions",{item:n})]),tfoot:e.withCtx(()=>[e.createElementVNode("tfoot",null,[e.renderSlot(o.$slots,"item.tfoot")])]),_:2},[e.renderList(q.value,n=>({name:`item.${n.key}`,fn:e.withCtx(({item:d})=>[e.renderSlot(o.$slots,`item.${n.key}`,{item:d},()=>[e.createTextVNode(e.toDisplayString(d[n.key]),1)])])}))]),1032,["headers","items","loading","items-length","items-per-page","search","sort-by","page","item-value","show-expand","class"]),e.createVNode(z,{show:V.value,title:t.deleteModalTitle,description:t.deleteModalMessage,confirmButtonText:t.deleteModalConfirmButtonText,cancelButtonText:t.deleteModalCancelButtonText,onClose:R,onConfirm:Y},null,8,["show","title","description","confirmButtonText","cancelButtonText"])],64)}}}),F={install(t){t.component("DataTable",$)}};C.DATA_TABLE_CONFIG_KEY=P,C.DataTable=$,C.createDataTableConfig=L,C.default=F,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|