@dazzadev/vuetify-datatable 1.0.2 → 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/README.md +3 -0
- package/dist/components/DataTable.vue.d.ts +3 -0
- package/dist/types.d.ts +1 -0
- package/dist/vuetify-datatable.js +267 -249
- package/dist/vuetify-datatable.umd.cjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -129,6 +129,9 @@ If no configuration is provided, the component uses Material Design Icons (inclu
|
|
|
129
129
|
| `viewIcon` | `string` | — | View icon name override |
|
|
130
130
|
| `editIcon` | `string` | — | Edit icon name override |
|
|
131
131
|
| `deleteIcon` | `string` | — | Delete icon name override |
|
|
132
|
+
| `disableView` | `(item: T) => boolean` | — | Per-row predicate: disable the view button when it returns `true` |
|
|
133
|
+
| `disableEdit` | `(item: T) => boolean` | — | Per-row predicate: disable the edit button when it returns `true` |
|
|
134
|
+
| `disableDelete` | `(item: T) => boolean` | — | Per-row predicate: disable the delete button when it returns `true` |
|
|
132
135
|
|
|
133
136
|
## Events
|
|
134
137
|
|
|
@@ -28,6 +28,9 @@ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>
|
|
|
28
28
|
viewIcon?: string;
|
|
29
29
|
editIcon?: string;
|
|
30
30
|
deleteIcon?: string;
|
|
31
|
+
disableView?: (item: T) => boolean;
|
|
32
|
+
disableEdit?: (item: T) => boolean;
|
|
33
|
+
disableDelete?: (item: T) => boolean;
|
|
31
34
|
} & Partial<{}>> & import("vue").PublicProps;
|
|
32
35
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
33
36
|
attrs: any;
|
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(
|
|
10
|
-
if (typeof
|
|
11
|
-
throw new TypeError(`Expected the first parameter to be a function, got \`${typeof
|
|
12
|
-
if (
|
|
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
|
+
if (typeof p != "function")
|
|
11
|
+
throw new TypeError(`Expected the first parameter to be a function, got \`${typeof p}\`.`);
|
|
12
|
+
if (l < 0)
|
|
13
13
|
throw new RangeError("`wait` must not be negative.");
|
|
14
|
-
const { immediate:
|
|
15
|
-
let
|
|
16
|
-
function d() {
|
|
17
|
-
const g = f, P = b;
|
|
18
|
-
return f = void 0, b = void 0, v = w.apply(g, P), v;
|
|
19
|
-
}
|
|
14
|
+
const { immediate: d } = typeof u == "boolean" ? { immediate: u } : u;
|
|
15
|
+
let m, B, a, C, w;
|
|
20
16
|
function k() {
|
|
21
|
-
const
|
|
22
|
-
|
|
17
|
+
const v = m, D = B;
|
|
18
|
+
return m = void 0, B = void 0, w = p.apply(v, D), w;
|
|
19
|
+
}
|
|
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
|
-
|
|
28
|
-
const
|
|
29
|
-
return a || (a = setTimeout(
|
|
27
|
+
m = this, B = v, C = Date.now();
|
|
28
|
+
const D = d && !a;
|
|
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,65 +54,65 @@ const ce = /* @__PURE__ */ se(re), de = /* @__PURE__ */ q({
|
|
|
54
54
|
},
|
|
55
55
|
emits: ["close", "confirm"],
|
|
56
56
|
setup(e) {
|
|
57
|
-
const
|
|
58
|
-
get: () =>
|
|
57
|
+
const p = e, l = $({
|
|
58
|
+
get: () => p.show,
|
|
59
59
|
set: () => {
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
-
return (
|
|
63
|
-
const
|
|
64
|
-
return
|
|
65
|
-
modelValue:
|
|
66
|
-
"onUpdate:modelValue":
|
|
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
|
-
default:
|
|
72
|
-
|
|
73
|
-
default:
|
|
74
|
-
|
|
75
|
-
default:
|
|
76
|
-
|
|
71
|
+
default: n(() => [
|
|
72
|
+
r(k, null, {
|
|
73
|
+
default: n(() => [
|
|
74
|
+
r(m, { class: "text-h5 text-center py-6" }, {
|
|
75
|
+
default: n(() => [
|
|
76
|
+
T(P(e.title), 1)
|
|
77
77
|
]),
|
|
78
78
|
_: 1
|
|
79
79
|
}),
|
|
80
|
-
e.description ? (
|
|
80
|
+
e.description ? (g(), x(B, {
|
|
81
81
|
key: 0,
|
|
82
82
|
class: "text-center px-0 py-0"
|
|
83
83
|
}, {
|
|
84
|
-
default:
|
|
85
|
-
|
|
86
|
-
h(
|
|
84
|
+
default: n(() => [
|
|
85
|
+
T(P(e.description) + " ", 1),
|
|
86
|
+
h(u.$slots, "description")
|
|
87
87
|
]),
|
|
88
88
|
_: 3
|
|
89
|
-
})) :
|
|
90
|
-
|
|
91
|
-
default:
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
})) : L("", !0),
|
|
90
|
+
r(w, null, {
|
|
91
|
+
default: n(() => [
|
|
92
|
+
r(a),
|
|
93
|
+
r(C, {
|
|
94
94
|
color: "error",
|
|
95
95
|
variant: "flat",
|
|
96
96
|
dark: "",
|
|
97
|
-
onClick:
|
|
97
|
+
onClick: d[0] || (d[0] = (i) => u.$emit("close"))
|
|
98
98
|
}, {
|
|
99
|
-
default:
|
|
100
|
-
|
|
99
|
+
default: n(() => [
|
|
100
|
+
T(P(e.cancelButtonText), 1)
|
|
101
101
|
]),
|
|
102
102
|
_: 1
|
|
103
103
|
}),
|
|
104
|
-
|
|
104
|
+
r(C, {
|
|
105
105
|
color: "success",
|
|
106
106
|
variant: "flat",
|
|
107
107
|
dark: "",
|
|
108
|
-
onClick:
|
|
108
|
+
onClick: d[1] || (d[1] = (i) => u.$emit("confirm"))
|
|
109
109
|
}, {
|
|
110
|
-
default:
|
|
111
|
-
|
|
110
|
+
default: n(() => [
|
|
111
|
+
T(P(e.confirmButtonText), 1)
|
|
112
112
|
]),
|
|
113
113
|
_: 1
|
|
114
114
|
}),
|
|
115
|
-
|
|
115
|
+
r(a)
|
|
116
116
|
]),
|
|
117
117
|
_: 1
|
|
118
118
|
})
|
|
@@ -124,18 +124,18 @@ const ce = /* @__PURE__ */ se(re), de = /* @__PURE__ */ q({
|
|
|
124
124
|
}, 8, ["modelValue"]);
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
-
}),
|
|
128
|
-
function
|
|
127
|
+
}), G = Symbol("DataTableConfig");
|
|
128
|
+
function ge(e) {
|
|
129
129
|
return {
|
|
130
|
-
install(
|
|
131
|
-
|
|
130
|
+
install(p) {
|
|
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 },
|
|
@@ -156,120 +156,123 @@ const ue = /* @__PURE__ */ q({
|
|
|
156
156
|
editButtonText: {},
|
|
157
157
|
viewIcon: {},
|
|
158
158
|
editIcon: {},
|
|
159
|
-
deleteIcon: {}
|
|
159
|
+
deleteIcon: {},
|
|
160
|
+
disableView: {},
|
|
161
|
+
disableEdit: {},
|
|
162
|
+
disableDelete: {}
|
|
160
163
|
},
|
|
161
164
|
emits: ["onLoadData", "editItem", "deleteItem", "viewItem"],
|
|
162
|
-
setup(e, { emit:
|
|
163
|
-
const
|
|
165
|
+
setup(e, { emit: p }) {
|
|
166
|
+
const l = e, u = p, d = ee(G, { icons: {} }), m = $(() => {
|
|
164
167
|
var t;
|
|
165
|
-
return
|
|
166
|
-
}),
|
|
168
|
+
return l.viewIcon ?? ((t = d.icons) == null ? void 0 : t.view) ?? "mdi-eye-outline";
|
|
169
|
+
}), B = $(() => {
|
|
167
170
|
var t;
|
|
168
|
-
return
|
|
169
|
-
}), a =
|
|
171
|
+
return l.editIcon ?? ((t = d.icons) == null ? void 0 : t.edit) ?? "mdi-pencil-outline";
|
|
172
|
+
}), a = $(() => {
|
|
170
173
|
var t;
|
|
171
|
-
return
|
|
172
|
-
}),
|
|
173
|
-
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) {
|
|
174
177
|
return typeof t != "string";
|
|
175
178
|
}
|
|
176
|
-
const
|
|
179
|
+
const f = V(l.itemsPerPage), i = V([]), v = V(1), D = V(null), O = V(!1), K = $(() => {
|
|
177
180
|
var t;
|
|
178
|
-
return ((t =
|
|
181
|
+
return ((t = l.headers) == null ? void 0 : t.filter(
|
|
179
182
|
(s) => s.key !== "actions" && s.key !== "expanded-row" && s.key !== "data-table-expand"
|
|
180
183
|
)) || [];
|
|
181
184
|
});
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
page:
|
|
185
|
-
itemsPerPage:
|
|
185
|
+
te(() => {
|
|
186
|
+
S({
|
|
187
|
+
page: v.value,
|
|
188
|
+
itemsPerPage: f.value
|
|
186
189
|
});
|
|
187
190
|
});
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
}, G = () => {
|
|
191
|
-
g.value = null, P.value = !1;
|
|
192
|
-
}, K = (t) => {
|
|
193
|
-
m("editItem", t);
|
|
194
|
-
}, Y = (t) => {
|
|
195
|
-
m("viewItem", t);
|
|
191
|
+
const Y = (t) => {
|
|
192
|
+
D.value = t, O.value = !0;
|
|
196
193
|
}, H = () => {
|
|
197
|
-
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
194
|
+
D.value = null, O.value = !1;
|
|
195
|
+
}, J = (t) => {
|
|
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
|
+
column: I.key,
|
|
204
|
+
direction: I.order
|
|
202
205
|
}));
|
|
203
|
-
|
|
206
|
+
u("onLoadData", {
|
|
204
207
|
page: t,
|
|
205
208
|
itemsPerPage: s,
|
|
206
|
-
search:
|
|
207
|
-
sortBy:
|
|
209
|
+
search: l.search,
|
|
210
|
+
sortBy: E
|
|
208
211
|
});
|
|
209
212
|
};
|
|
210
|
-
function
|
|
211
|
-
|
|
213
|
+
function X() {
|
|
214
|
+
S({
|
|
212
215
|
page: 1,
|
|
213
|
-
itemsPerPage:
|
|
216
|
+
itemsPerPage: f.value
|
|
214
217
|
});
|
|
215
218
|
}
|
|
216
|
-
const
|
|
217
|
-
|
|
219
|
+
const q = ue(X, 400), Z = () => {
|
|
220
|
+
q();
|
|
218
221
|
};
|
|
219
|
-
return
|
|
220
|
-
() =>
|
|
222
|
+
return z(
|
|
223
|
+
() => l.search,
|
|
221
224
|
(t, s) => {
|
|
222
|
-
t !== s &&
|
|
225
|
+
t !== s && q();
|
|
223
226
|
}
|
|
224
|
-
),
|
|
225
|
-
t !== s &&
|
|
227
|
+
), z(f, (t, s) => {
|
|
228
|
+
t !== s && S({
|
|
226
229
|
page: 1,
|
|
227
230
|
itemsPerPage: t
|
|
228
231
|
});
|
|
229
|
-
}),
|
|
230
|
-
|
|
232
|
+
}), z(i, () => {
|
|
233
|
+
S({
|
|
231
234
|
page: 1,
|
|
232
|
-
itemsPerPage:
|
|
235
|
+
itemsPerPage: f.value
|
|
233
236
|
});
|
|
234
|
-
}),
|
|
235
|
-
|
|
237
|
+
}), z(v, (t) => {
|
|
238
|
+
S({
|
|
236
239
|
page: t,
|
|
237
|
-
itemsPerPage:
|
|
240
|
+
itemsPerPage: f.value
|
|
238
241
|
});
|
|
239
242
|
}), (t, s) => {
|
|
240
|
-
const
|
|
241
|
-
return
|
|
242
|
-
|
|
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(_, {
|
|
243
246
|
headers: e.headers,
|
|
244
247
|
items: e.items,
|
|
245
248
|
loading: e.loading,
|
|
246
249
|
"items-length": e.totalItems,
|
|
247
|
-
"items-per-page":
|
|
248
|
-
"onUpdate:itemsPerPage": s[0] || (s[0] = (
|
|
250
|
+
"items-per-page": f.value,
|
|
251
|
+
"onUpdate:itemsPerPage": s[0] || (s[0] = (o) => f.value = o),
|
|
249
252
|
search: e.search,
|
|
250
|
-
onSearch:
|
|
251
|
-
"sort-by":
|
|
252
|
-
"onUpdate:sortBy": s[1] || (s[1] = (
|
|
253
|
-
page:
|
|
254
|
-
"onUpdate:page": s[2] || (s[2] = (
|
|
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),
|
|
255
258
|
"item-value": e.itemValue,
|
|
256
259
|
"show-expand": e.showExpand,
|
|
257
|
-
class:
|
|
258
|
-
},
|
|
259
|
-
"item.data-table-expand":
|
|
260
|
+
class: ae(w.value)
|
|
261
|
+
}, le({
|
|
262
|
+
"item.data-table-expand": n(({ internalItem: o, isExpanded: c, toggleExpand: b }) => [
|
|
260
263
|
h(t.$slots, "item.data-table-expand", {
|
|
261
|
-
internalItem:
|
|
262
|
-
isExpanded:
|
|
263
|
-
toggleExpand:
|
|
264
|
+
internalItem: o,
|
|
265
|
+
isExpanded: c,
|
|
266
|
+
toggleExpand: b
|
|
264
267
|
}, () => [
|
|
265
|
-
|
|
266
|
-
onClick: (
|
|
268
|
+
r(I, {
|
|
269
|
+
onClick: (A) => b(o),
|
|
267
270
|
rounded: ""
|
|
268
271
|
}, {
|
|
269
|
-
default:
|
|
270
|
-
|
|
271
|
-
default:
|
|
272
|
-
|
|
272
|
+
default: n(() => [
|
|
273
|
+
r(E, null, {
|
|
274
|
+
default: n(() => [
|
|
275
|
+
T(P(c(o) ? "mdi-chevron-up" : "mdi-chevron-down"), 1)
|
|
273
276
|
]),
|
|
274
277
|
_: 2
|
|
275
278
|
}, 1024)
|
|
@@ -278,151 +281,166 @@ const ue = /* @__PURE__ */ q({
|
|
|
278
281
|
}, 1032, ["onClick"])
|
|
279
282
|
])
|
|
280
283
|
]),
|
|
281
|
-
"expanded-row":
|
|
284
|
+
"expanded-row": n(({ columns: o, item: c }) => [
|
|
282
285
|
h(t.$slots, "expanded-row", {
|
|
283
|
-
columns:
|
|
284
|
-
item:
|
|
286
|
+
columns: o,
|
|
287
|
+
item: c
|
|
285
288
|
})
|
|
286
289
|
]),
|
|
287
|
-
"item.actions":
|
|
288
|
-
h(t.$slots, "before-actions", { item:
|
|
289
|
-
e.showViewButton ? (
|
|
290
|
+
"item.actions": n(({ item: o }) => [
|
|
291
|
+
h(t.$slots, "before-actions", { item: o }),
|
|
292
|
+
e.showViewButton ? (g(), x(N, {
|
|
290
293
|
key: 0,
|
|
291
294
|
text: e.viewButtonText
|
|
292
295
|
}, {
|
|
293
|
-
activator:
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
296
|
+
activator: n(({ props: c }) => {
|
|
297
|
+
var b;
|
|
298
|
+
return [
|
|
299
|
+
r(I, M({
|
|
300
|
+
icon: "",
|
|
301
|
+
flat: "",
|
|
302
|
+
onClick: (A) => Q(o)
|
|
303
|
+
}, c, {
|
|
304
|
+
disabled: (b = e.disableView) == null ? void 0 : b.call(e, o)
|
|
305
|
+
}), {
|
|
306
|
+
default: n(() => [
|
|
307
|
+
h(t.$slots, "view-icon", {}, () => [
|
|
308
|
+
k(m.value) ? (g(), x(F(m.value), M({
|
|
309
|
+
key: 0,
|
|
310
|
+
size: 20,
|
|
311
|
+
class: "text-info"
|
|
312
|
+
}, C.value), null, 16)) : (g(), x(E, {
|
|
313
|
+
key: 1,
|
|
314
|
+
size: "20",
|
|
315
|
+
class: "text-info"
|
|
316
|
+
}, {
|
|
317
|
+
default: n(() => [
|
|
318
|
+
T(P(m.value), 1)
|
|
319
|
+
]),
|
|
320
|
+
_: 1
|
|
321
|
+
}))
|
|
322
|
+
])
|
|
323
|
+
]),
|
|
324
|
+
_: 3
|
|
325
|
+
}, 16, ["onClick", "disabled"])
|
|
326
|
+
];
|
|
327
|
+
}),
|
|
320
328
|
_: 2
|
|
321
|
-
}, 1032, ["text"])) :
|
|
322
|
-
e.showEditButton ? (
|
|
329
|
+
}, 1032, ["text"])) : L("", !0),
|
|
330
|
+
e.showEditButton ? (g(), x(N, {
|
|
323
331
|
key: 1,
|
|
324
332
|
text: e.editButtonText
|
|
325
333
|
}, {
|
|
326
|
-
activator:
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
334
|
+
activator: n(({ props: c }) => {
|
|
335
|
+
var b;
|
|
336
|
+
return [
|
|
337
|
+
r(I, M({
|
|
338
|
+
icon: "",
|
|
339
|
+
flat: "",
|
|
340
|
+
onClick: (A) => J(o)
|
|
341
|
+
}, c, {
|
|
342
|
+
disabled: (b = e.disableEdit) == null ? void 0 : b.call(e, o)
|
|
343
|
+
}), {
|
|
344
|
+
default: n(() => [
|
|
345
|
+
h(t.$slots, "edit-icon", {}, () => [
|
|
346
|
+
k(B.value) ? (g(), x(F(B.value), M({
|
|
347
|
+
key: 0,
|
|
348
|
+
size: 20,
|
|
349
|
+
class: "text-primary"
|
|
350
|
+
}, C.value), null, 16)) : (g(), x(E, {
|
|
351
|
+
key: 1,
|
|
352
|
+
size: "20",
|
|
353
|
+
class: "text-primary"
|
|
354
|
+
}, {
|
|
355
|
+
default: n(() => [
|
|
356
|
+
T(P(B.value), 1)
|
|
357
|
+
]),
|
|
358
|
+
_: 1
|
|
359
|
+
}))
|
|
360
|
+
])
|
|
361
|
+
]),
|
|
362
|
+
_: 3
|
|
363
|
+
}, 16, ["onClick", "disabled"])
|
|
364
|
+
];
|
|
365
|
+
}),
|
|
353
366
|
_: 2
|
|
354
|
-
}, 1032, ["text"])) :
|
|
355
|
-
e.showDeleteButton ? (
|
|
367
|
+
}, 1032, ["text"])) : L("", !0),
|
|
368
|
+
e.showDeleteButton ? (g(), x(N, {
|
|
356
369
|
key: 2,
|
|
357
370
|
text: e.deleteButtonText
|
|
358
371
|
}, {
|
|
359
|
-
activator:
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
372
|
+
activator: n(({ props: c }) => {
|
|
373
|
+
var b;
|
|
374
|
+
return [
|
|
375
|
+
r(I, M({
|
|
376
|
+
icon: "",
|
|
377
|
+
flat: "",
|
|
378
|
+
onClick: (A) => Y(o)
|
|
379
|
+
}, c, {
|
|
380
|
+
disabled: (b = e.disableDelete) == null ? void 0 : b.call(e, o)
|
|
381
|
+
}), {
|
|
382
|
+
default: n(() => [
|
|
383
|
+
h(t.$slots, "delete-icon", {}, () => [
|
|
384
|
+
k(a.value) ? (g(), x(F(a.value), M({
|
|
385
|
+
key: 0,
|
|
386
|
+
size: 20,
|
|
387
|
+
class: "text-error"
|
|
388
|
+
}, C.value), null, 16)) : (g(), x(E, {
|
|
389
|
+
key: 1,
|
|
390
|
+
size: "20",
|
|
391
|
+
class: "text-error"
|
|
392
|
+
}, {
|
|
393
|
+
default: n(() => [
|
|
394
|
+
T(P(a.value), 1)
|
|
395
|
+
]),
|
|
396
|
+
_: 1
|
|
397
|
+
}))
|
|
398
|
+
])
|
|
399
|
+
]),
|
|
400
|
+
_: 3
|
|
401
|
+
}, 16, ["onClick", "disabled"])
|
|
402
|
+
];
|
|
403
|
+
}),
|
|
386
404
|
_: 2
|
|
387
|
-
}, 1032, ["text"])) :
|
|
388
|
-
h(t.$slots, "after-actions", { item:
|
|
405
|
+
}, 1032, ["text"])) : L("", !0),
|
|
406
|
+
h(t.$slots, "after-actions", { item: o })
|
|
389
407
|
]),
|
|
390
|
-
tfoot:
|
|
391
|
-
|
|
408
|
+
tfoot: n(() => [
|
|
409
|
+
ie("tfoot", null, [
|
|
392
410
|
h(t.$slots, "item.tfoot")
|
|
393
411
|
])
|
|
394
412
|
]),
|
|
395
413
|
_: 2
|
|
396
414
|
}, [
|
|
397
|
-
|
|
398
|
-
name: `item.${
|
|
399
|
-
fn:
|
|
400
|
-
h(t.$slots, `item.${
|
|
401
|
-
|
|
415
|
+
se(K.value, (o) => ({
|
|
416
|
+
name: `item.${o.key}`,
|
|
417
|
+
fn: n(({ item: c }) => [
|
|
418
|
+
h(t.$slots, `item.${o.key}`, { item: c }, () => [
|
|
419
|
+
T(P(c[o.key]), 1)
|
|
402
420
|
])
|
|
403
421
|
])
|
|
404
422
|
}))
|
|
405
423
|
]), 1032, ["headers", "items", "loading", "items-length", "items-per-page", "search", "sort-by", "page", "item-value", "show-expand", "class"]),
|
|
406
|
-
|
|
407
|
-
show:
|
|
424
|
+
r(me, {
|
|
425
|
+
show: O.value,
|
|
408
426
|
title: e.deleteModalTitle,
|
|
409
427
|
description: e.deleteModalMessage,
|
|
410
428
|
confirmButtonText: e.deleteModalConfirmButtonText,
|
|
411
429
|
cancelButtonText: e.deleteModalCancelButtonText,
|
|
412
|
-
onClose:
|
|
413
|
-
onConfirm:
|
|
430
|
+
onClose: H,
|
|
431
|
+
onConfirm: W
|
|
414
432
|
}, null, 8, ["show", "title", "description", "confirmButtonText", "cancelButtonText"])
|
|
415
433
|
], 64);
|
|
416
434
|
};
|
|
417
435
|
}
|
|
418
|
-
}),
|
|
436
|
+
}), be = {
|
|
419
437
|
install(e) {
|
|
420
|
-
e.component("DataTable",
|
|
438
|
+
e.component("DataTable", fe);
|
|
421
439
|
}
|
|
422
440
|
};
|
|
423
441
|
export {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
442
|
+
G as DATA_TABLE_CONFIG_KEY,
|
|
443
|
+
fe as DataTable,
|
|
444
|
+
ge as createDataTableConfig,
|
|
445
|
+
be as default
|
|
428
446
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(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"}})}));
|