vlite3 0.6.6 → 0.6.8
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/components/DataTable/DataTable.vue.js +232 -209
- package/components/DataTable/types.d.ts +15 -0
- package/components/DataTable/types.js +4 -0
- package/components/Dropdown/Dropdown.vue.js +13 -21
- package/components/Modal.vue.js +2 -2
- package/components/Modal.vue2.js +58 -56
- package/components/PermissionMatrix/PermissionEditor.vue.d.ts +0 -12
- package/components/PermissionMatrix/PermissionEditor.vue.js +120 -524
- package/components/PermissionMatrix/PermissionEditorList.vue.d.ts +18 -0
- package/components/PermissionMatrix/PermissionEditorList.vue.js +7 -0
- package/components/PermissionMatrix/PermissionEditorList.vue2.js +162 -0
- package/components/PermissionMatrix/PermissionEditorMatrix.vue.d.ts +18 -0
- package/components/PermissionMatrix/PermissionEditorMatrix.vue.js +7 -0
- package/components/PermissionMatrix/PermissionEditorMatrix.vue2.js +206 -0
- package/components/PermissionMatrix/PermissionMatrix.vue.js +1 -1
- package/components/PermissionMatrix/PermissionMatrix.vue2.js +115 -126
- package/components/PermissionMatrix/PermissionTopBar.vue.d.ts +28 -0
- package/components/PermissionMatrix/PermissionTopBar.vue.js +132 -0
- package/components/PermissionMatrix/PermissionTopBar.vue2.js +4 -0
- package/components/PermissionMatrix/utils.d.ts +11 -0
- package/components/PermissionMatrix/utils.js +20 -0
- package/components/Screen/Screen.vue.js +113 -107
- package/components/SidePanel.vue.js +57 -53
- package/index.js +179 -177
- package/package.json +1 -1
- package/style.css +1 -1
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { $t as
|
|
11
|
-
|
|
1
|
+
import { defineComponent as me, inject as ve, computed as n, ref as b, watch as g, openBlock as r, createElementBlock as u, createBlock as R, normalizeClass as S, createSlots as M, withCtx as T, renderSlot as D, createCommentVNode as x, createElementVNode as f, createVNode as z, Fragment as A, renderList as $, normalizeStyle as L, mergeProps as Y, unref as W } from "vue";
|
|
2
|
+
import he from "../CheckBox.vue.js";
|
|
3
|
+
import ge from "../Button.vue.js";
|
|
4
|
+
import pe from "../ConfirmationModal.vue.js";
|
|
5
|
+
import be from "../Pagination/Pagination.vue.js";
|
|
6
|
+
import ye from "../Empty/Empty.vue.js";
|
|
7
|
+
import we from "./DataTableHeader.vue.js";
|
|
8
|
+
import Pe from "./DataTableRow.vue.js";
|
|
9
|
+
import Ce from "./DataTableToolbar.vue.js";
|
|
10
|
+
import { $t as P } from "../../utils/i18n.js";
|
|
11
|
+
import { SCREEN_CONTEXT_KEY as ke } from "./types.js";
|
|
12
|
+
const Ie = { class: "space-y-6.5" }, Se = { class: "overflow-x-auto w-full" }, Te = { class: "hover:bg-transparent" }, De = {
|
|
12
13
|
key: 0,
|
|
13
14
|
scope: "col",
|
|
14
15
|
class: "w-[48px] px-0 text-center font-medium text-muted-foreground",
|
|
15
16
|
style: { width: "48px" }
|
|
16
|
-
},
|
|
17
|
+
}, xe = { class: "flex items-center justify-center" }, $e = { class: "[&_tr:last-child]:border-0" }, Be = {
|
|
17
18
|
key: 0,
|
|
18
19
|
class: "w-[48px] px-0 py-4 align-middle text-center",
|
|
19
20
|
style: { width: "48px" }
|
|
20
|
-
},
|
|
21
|
+
}, Ee = { key: 2 }, Re = ["colspan"], ze = { key: 1 }, We = /* @__PURE__ */ me({
|
|
21
22
|
__name: "DataTable",
|
|
22
23
|
props: {
|
|
23
24
|
rows: { default: () => [] },
|
|
@@ -29,7 +30,7 @@ const pe = { class: "space-y-6.5" }, ye = { class: "overflow-x-auto w-full" }, w
|
|
|
29
30
|
toolbarClass: {},
|
|
30
31
|
toolbarSearchClass: {},
|
|
31
32
|
headers: { default: () => [] },
|
|
32
|
-
keyField: { default: "
|
|
33
|
+
keyField: { default: "auto" },
|
|
33
34
|
loading: { type: Boolean, default: !1 },
|
|
34
35
|
selectable: { type: Boolean, default: !1 },
|
|
35
36
|
emptyTitle: {},
|
|
@@ -56,298 +57,320 @@ const pe = { class: "space-y-6.5" }, ye = { class: "overflow-x-auto w-full" }, w
|
|
|
56
57
|
variant: { default: "default" }
|
|
57
58
|
},
|
|
58
59
|
emits: ["change", "select", "rowClick", "update:itemsPerPage", "update:selectedRows", "delete"],
|
|
59
|
-
setup(
|
|
60
|
-
const q = (e,
|
|
61
|
-
if (!(!e || !
|
|
62
|
-
return
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
!e && l && (C.value = "idle");
|
|
60
|
+
setup(o, { emit: X }) {
|
|
61
|
+
const q = (e, t) => {
|
|
62
|
+
if (!(!e || !t))
|
|
63
|
+
return t.includes(".") ? t.split(".").reduce((a, c) => a?.[c], e) : e[t];
|
|
64
|
+
}, m = (e, t) => q(e, t), G = (e, t) => {
|
|
65
|
+
const a = ["id", "_id"];
|
|
66
|
+
if (t && t !== "auto") return t;
|
|
67
|
+
if (e && e.length > 0) {
|
|
68
|
+
for (const c of a)
|
|
69
|
+
if (c in e[0]) return c;
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
return "_id";
|
|
72
|
+
}, l = o, y = X, j = ve(ke, null), O = n(() => j?.disableSearch ? !1 : l.showSearch), B = n(() => !!(l.selectable || j?.forceSelectable)), i = n(() => G(l.rows, l.keyField)), d = b({ field: "", order: "" }), C = b(
|
|
73
|
+
l.pageInfo?.itemsPerPage || l.paginationProps?.itemsPerPage || 10
|
|
74
|
+
), p = b(l.pageInfo?.currentPage || 1), w = b(l.search || ""), k = b(!1), I = b("initial"), H = n(() => l.loading);
|
|
75
|
+
g(
|
|
76
|
+
() => l.loading,
|
|
77
|
+
(e, t) => {
|
|
78
|
+
!e && t && (I.value = "idle");
|
|
79
|
+
}
|
|
80
|
+
), g(
|
|
81
|
+
() => l.search,
|
|
73
82
|
(e) => {
|
|
74
|
-
e !== void 0 && e !==
|
|
83
|
+
e !== void 0 && e !== w.value && (w.value = e);
|
|
75
84
|
}
|
|
76
85
|
);
|
|
77
|
-
let
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
86
|
+
let N = null;
|
|
87
|
+
g(w, () => {
|
|
88
|
+
N && clearTimeout(N), N = setTimeout(() => {
|
|
89
|
+
p.value = 1, I.value = "search", E();
|
|
81
90
|
}, 300);
|
|
82
|
-
}),
|
|
83
|
-
() =>
|
|
91
|
+
}), g(
|
|
92
|
+
() => l.pageInfo?.itemsPerPage,
|
|
84
93
|
(e) => {
|
|
85
|
-
e !== void 0 && (
|
|
94
|
+
e !== void 0 && (C.value = e);
|
|
86
95
|
}
|
|
87
|
-
),
|
|
88
|
-
() =>
|
|
96
|
+
), g(
|
|
97
|
+
() => l.paginationProps?.itemsPerPage,
|
|
89
98
|
(e) => {
|
|
90
|
-
e !== void 0 && (
|
|
99
|
+
e !== void 0 && (C.value = e);
|
|
91
100
|
}
|
|
92
|
-
),
|
|
93
|
-
() =>
|
|
101
|
+
), g(
|
|
102
|
+
() => l.pageInfo?.currentPage,
|
|
94
103
|
(e) => {
|
|
95
|
-
e && (
|
|
104
|
+
e && (p.value = e);
|
|
96
105
|
}
|
|
97
106
|
);
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
() =>
|
|
107
|
+
const s = b(/* @__PURE__ */ new Set());
|
|
108
|
+
g(
|
|
109
|
+
() => l.selectedRows,
|
|
101
110
|
(e) => {
|
|
102
|
-
const
|
|
103
|
-
|
|
111
|
+
const t = new Set(
|
|
112
|
+
(e || []).map((a) => m(a, i.value))
|
|
113
|
+
);
|
|
114
|
+
(t.size !== s.value.size || [...t].some((a) => !s.value.has(a))) && (s.value = t);
|
|
104
115
|
},
|
|
105
116
|
{ immediate: !0, deep: !0 }
|
|
106
117
|
);
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
s.value.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
const U = n(() => l.rows.length === 0 ? !1 : l.rows.every(
|
|
119
|
+
(e) => s.value.has(m(e, i.value))
|
|
120
|
+
)), V = n(
|
|
121
|
+
() => s.value.size > 0 && !U.value
|
|
122
|
+
), J = n(() => {
|
|
123
|
+
const e = [...l.selectedRows || [], ...l.rows], t = /* @__PURE__ */ new Map();
|
|
124
|
+
return e.forEach((a) => t.set(m(a, i.value), a)), Array.from(s.value).map((a) => t.get(a)).filter(Boolean);
|
|
125
|
+
}), Q = (e) => {
|
|
126
|
+
e ? l.rows.forEach(
|
|
127
|
+
(t) => s.value.add(m(t, i.value))
|
|
128
|
+
) : s.value.size > 0 && l.rows.forEach(
|
|
129
|
+
(t) => s.value.delete(m(t, i.value))
|
|
130
|
+
), K();
|
|
131
|
+
}, Z = (e) => {
|
|
132
|
+
s.value.has(e) ? s.value.delete(e) : s.value.add(e), K();
|
|
133
|
+
}, K = () => {
|
|
134
|
+
const e = l.selectedRows || [], t = /* @__PURE__ */ new Set(), a = [];
|
|
135
|
+
l.rows.forEach((v) => {
|
|
136
|
+
const h = m(v, i.value);
|
|
137
|
+
s.value.has(h) && (a.push(v), t.add(h));
|
|
138
|
+
}), e.forEach((v) => {
|
|
139
|
+
const h = m(v, i.value);
|
|
140
|
+
!t.has(h) && s.value.has(h) && (a.push(v), t.add(h));
|
|
122
141
|
});
|
|
123
|
-
const
|
|
124
|
-
selected:
|
|
125
|
-
all:
|
|
126
|
-
indeterminate:
|
|
142
|
+
const c = {
|
|
143
|
+
selected: a,
|
|
144
|
+
all: U.value,
|
|
145
|
+
indeterminate: V.value
|
|
127
146
|
};
|
|
128
|
-
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
},
|
|
138
|
-
const e =
|
|
139
|
-
|
|
147
|
+
y("select", c), y("update:selectedRows", a);
|
|
148
|
+
}, _ = (e) => {
|
|
149
|
+
d.value.field === e ? d.value.order === "asc" ? d.value.order = "desc" : d.value.order === "desc" ? (d.value.order = "", d.value.field = "") : d.value.order = "asc" : (d.value.field = e, d.value.order = "asc"), p.value = 1, I.value = "sort", E();
|
|
150
|
+
}, ee = (e) => {
|
|
151
|
+
p.value = e, I.value = "page", E();
|
|
152
|
+
}, te = (e) => {
|
|
153
|
+
C.value = e, p.value = 1, I.value = "limit", y("update:itemsPerPage", e), E();
|
|
154
|
+
}, le = (e) => {
|
|
155
|
+
y("rowClick", e);
|
|
156
|
+
}, ae = () => {
|
|
157
|
+
const e = J.value;
|
|
158
|
+
y("delete", e), k.value = !1;
|
|
140
159
|
};
|
|
141
|
-
let
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
160
|
+
let F = null;
|
|
161
|
+
const E = () => {
|
|
162
|
+
F && clearTimeout(F), F = setTimeout(() => {
|
|
163
|
+
y("change", {
|
|
145
164
|
pagination: {
|
|
146
|
-
page:
|
|
147
|
-
limit:
|
|
165
|
+
page: p.value,
|
|
166
|
+
limit: C.value
|
|
148
167
|
},
|
|
149
|
-
sorting: { ...
|
|
150
|
-
search:
|
|
168
|
+
sorting: { ...d.value },
|
|
169
|
+
search: w.value
|
|
151
170
|
});
|
|
152
171
|
}, 10);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
"overflow-hidden",
|
|
157
|
-
t.bordered ? "border border-border" : "",
|
|
158
|
-
t.class
|
|
159
|
-
].join(" ")), te = r(() => ["w-full caption-bottom -text-fs-1", t.tableClass].join(" ")), le = (e) => e.width ? e.width : "auto";
|
|
160
|
-
h(
|
|
161
|
-
() => t.rows,
|
|
172
|
+
};
|
|
173
|
+
g(
|
|
174
|
+
() => l.rows,
|
|
162
175
|
() => {
|
|
163
|
-
const e = new Set(
|
|
164
|
-
|
|
176
|
+
const e = new Set(
|
|
177
|
+
l.rows.map((t) => m(t, i.value))
|
|
178
|
+
);
|
|
179
|
+
s.value = new Set([...s.value].filter((t) => e.has(t)));
|
|
165
180
|
}
|
|
166
181
|
);
|
|
167
|
-
const
|
|
168
|
-
|
|
182
|
+
const oe = n(() => [
|
|
183
|
+
"w-full flex flex-col",
|
|
184
|
+
l.variant === "raised" ? "bg-background shadow-sm p-2 rounded-lg" : "bg-background rounded",
|
|
185
|
+
"overflow-hidden",
|
|
186
|
+
l.bordered ? "border border-border" : "",
|
|
187
|
+
l.class
|
|
188
|
+
].join(" ")), se = n(
|
|
189
|
+
() => ["w-full caption-bottom -text-fs-1", l.tableClass].join(" ")
|
|
190
|
+
), ne = (e) => e.width || "auto", re = n(
|
|
191
|
+
() => l.emptyTitleI18n ? P(l.emptyTitleI18n) : l.emptyTitle
|
|
192
|
+
), ie = n(
|
|
193
|
+
() => l.emptyDescriptionI18n ? P(l.emptyDescriptionI18n) : l.emptyDescription
|
|
194
|
+
), de = n(() => {
|
|
195
|
+
const e = P("vlite.dataTable.confirmDeleteTitle");
|
|
169
196
|
return e !== "vlite.dataTable.confirmDeleteTitle" ? e : "Confirm Deletion";
|
|
170
|
-
}),
|
|
171
|
-
const e =
|
|
197
|
+
}), ce = n(() => {
|
|
198
|
+
const e = P("vlite.dataTable.confirmDeleteDesc");
|
|
172
199
|
return e !== "vlite.dataTable.confirmDeleteDesc" ? e : "Are you sure you want to delete the selected items?";
|
|
173
|
-
}),
|
|
174
|
-
const e =
|
|
200
|
+
}), ue = n(() => {
|
|
201
|
+
const e = P("vlite.dataTable.deleteBtn");
|
|
175
202
|
return e !== "vlite.dataTable.deleteBtn" ? e : "Delete";
|
|
176
|
-
}),
|
|
177
|
-
const e =
|
|
203
|
+
}), fe = n(() => {
|
|
204
|
+
const e = P("vlite.dataTable.cancelBtn");
|
|
178
205
|
return e !== "vlite.dataTable.cancelBtn" ? e : "Cancel";
|
|
179
206
|
});
|
|
180
|
-
return (e,
|
|
181
|
-
|
|
207
|
+
return (e, t) => (r(), u("div", Ie, [
|
|
208
|
+
O.value || e.$slots?.["toolbar-left"] || e.$slots?.["toolbar-right"] ? (r(), R(Ce, {
|
|
182
209
|
key: 0,
|
|
183
|
-
modelValue:
|
|
184
|
-
"onUpdate:modelValue":
|
|
185
|
-
"show-search":
|
|
186
|
-
placeholder:
|
|
187
|
-
placeholderI18n:
|
|
188
|
-
class:
|
|
189
|
-
"search-class":
|
|
210
|
+
modelValue: w.value,
|
|
211
|
+
"onUpdate:modelValue": t[1] || (t[1] = (a) => w.value = a),
|
|
212
|
+
"show-search": O.value,
|
|
213
|
+
placeholder: o.searchPlaceholder,
|
|
214
|
+
placeholderI18n: o.searchPlaceholderI18n,
|
|
215
|
+
class: S(o.toolbarClass),
|
|
216
|
+
"search-class": o.toolbarSearchClass
|
|
190
217
|
}, M({ _: 2 }, [
|
|
191
218
|
e.$slots?.["toolbar-left"] ? {
|
|
192
219
|
name: "left",
|
|
193
|
-
fn:
|
|
194
|
-
|
|
220
|
+
fn: T(() => [
|
|
221
|
+
D(e.$slots, "toolbar-left")
|
|
195
222
|
]),
|
|
196
223
|
key: "0"
|
|
197
224
|
} : void 0,
|
|
198
225
|
s.value.size > 0 ? {
|
|
199
226
|
name: "delete",
|
|
200
|
-
fn:
|
|
201
|
-
s.value.size > 0 ? (
|
|
227
|
+
fn: T(() => [
|
|
228
|
+
s.value.size > 0 ? (r(), R(ge, {
|
|
202
229
|
key: 0,
|
|
203
230
|
rounded: "full",
|
|
204
231
|
variant: "outline",
|
|
205
232
|
size: "lg",
|
|
206
233
|
icon: "lucide:trash-2",
|
|
207
|
-
onClick:
|
|
208
|
-
})) :
|
|
234
|
+
onClick: t[0] || (t[0] = (a) => k.value = !0)
|
|
235
|
+
})) : x("", !0)
|
|
209
236
|
]),
|
|
210
237
|
key: "1"
|
|
211
238
|
} : void 0,
|
|
212
239
|
e.$slots?.["toolbar-right"] ? {
|
|
213
240
|
name: "right",
|
|
214
|
-
fn:
|
|
215
|
-
|
|
241
|
+
fn: T(() => [
|
|
242
|
+
D(e.$slots, "toolbar-right")
|
|
216
243
|
]),
|
|
217
244
|
key: "2"
|
|
218
245
|
} : void 0
|
|
219
|
-
]), 1032, ["modelValue", "show-search", "placeholder", "placeholderI18n", "class", "search-class"])) :
|
|
220
|
-
|
|
221
|
-
class:
|
|
246
|
+
]), 1032, ["modelValue", "show-search", "placeholder", "placeholderI18n", "class", "search-class"])) : x("", !0),
|
|
247
|
+
f("div", {
|
|
248
|
+
class: S(oe.value)
|
|
222
249
|
}, [
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
class:
|
|
250
|
+
f("div", Se, [
|
|
251
|
+
f("table", {
|
|
252
|
+
class: S([se.value, "data-table"])
|
|
226
253
|
}, [
|
|
227
|
-
|
|
228
|
-
class:
|
|
254
|
+
f("thead", {
|
|
255
|
+
class: S([
|
|
229
256
|
"[&_tr]:border-b [&_tr]:border-border bg-muted",
|
|
230
|
-
|
|
257
|
+
o.variant === "raised" ? "[&_th:first-child]:rounded-tl-lg [&_th:last-child]:rounded-tr-lg" : ""
|
|
231
258
|
])
|
|
232
259
|
}, [
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
"model-value":
|
|
238
|
-
indeterminate:
|
|
260
|
+
f("tr", Te, [
|
|
261
|
+
B.value ? (r(), u("th", De, [
|
|
262
|
+
f("div", xe, [
|
|
263
|
+
z(he, {
|
|
264
|
+
"model-value": U.value,
|
|
265
|
+
indeterminate: V.value,
|
|
239
266
|
size: "xs",
|
|
240
|
-
"onUpdate:modelValue":
|
|
267
|
+
"onUpdate:modelValue": Q
|
|
241
268
|
}, null, 8, ["model-value", "indeterminate"])
|
|
242
269
|
])
|
|
243
|
-
])) :
|
|
244
|
-
(
|
|
245
|
-
key:
|
|
246
|
-
header:
|
|
247
|
-
"sort-config":
|
|
248
|
-
compact:
|
|
249
|
-
"table-sortable":
|
|
250
|
-
onSort:
|
|
270
|
+
])) : x("", !0),
|
|
271
|
+
(r(!0), u(A, null, $(o.headers, (a) => (r(), R(we, {
|
|
272
|
+
key: a.field,
|
|
273
|
+
header: a,
|
|
274
|
+
"sort-config": d.value,
|
|
275
|
+
compact: o.compact,
|
|
276
|
+
"table-sortable": o.sortable,
|
|
277
|
+
onSort: _,
|
|
251
278
|
class: "last:pr-5!",
|
|
252
|
-
style:
|
|
253
|
-
width: le(o)
|
|
254
|
-
})
|
|
279
|
+
style: L({ width: ne(a) })
|
|
255
280
|
}, null, 8, ["header", "sort-config", "compact", "table-sortable", "style"]))), 128))
|
|
256
281
|
])
|
|
257
282
|
], 2),
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
key: "skeleton-" +
|
|
283
|
+
f("tbody", $e, [
|
|
284
|
+
H.value ? (r(!0), u(A, { key: 0 }, $(Math.min(C.value, 15), (a) => (r(), u("tr", {
|
|
285
|
+
key: "skeleton-" + a,
|
|
261
286
|
class: "border-b border-border/70 bg-background transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"
|
|
262
287
|
}, [
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
288
|
+
B.value ? (r(), u("td", Be, [...t[4] || (t[4] = [
|
|
289
|
+
f("div", { class: "flex items-center justify-center" }, [
|
|
290
|
+
f("div", { class: "h-4 w-4 rounded-[4px] bg-muted/50 animate-pulse" })
|
|
266
291
|
], -1)
|
|
267
|
-
])])) :
|
|
268
|
-
(
|
|
269
|
-
key:
|
|
270
|
-
class:
|
|
292
|
+
])])) : x("", !0),
|
|
293
|
+
(r(!0), u(A, null, $(o.headers, (c) => (r(), u("td", {
|
|
294
|
+
key: c.field,
|
|
295
|
+
class: S(["p-5! align-middle last:pr-6!", [c.hideOnMobile ? "hidden md:table-cell" : ""]])
|
|
271
296
|
}, [
|
|
272
|
-
|
|
297
|
+
f("div", {
|
|
273
298
|
class: "rounded-md bg-muted/50 animate-pulse h-4 w-full",
|
|
274
|
-
style:
|
|
275
|
-
width: `${50 + Math.random() * 40}%`
|
|
276
|
-
})
|
|
299
|
+
style: L({ width: `${50 + Math.random() * 40}%` })
|
|
277
300
|
}, null, 4)
|
|
278
301
|
], 2))), 128))
|
|
279
|
-
]))), 128)) :
|
|
280
|
-
key:
|
|
281
|
-
row:
|
|
282
|
-
headers:
|
|
283
|
-
index:
|
|
284
|
-
"key-field":
|
|
285
|
-
selectable:
|
|
286
|
-
"is-selected": s.value.has(
|
|
287
|
-
hoverable:
|
|
288
|
-
striped:
|
|
289
|
-
compact:
|
|
290
|
-
onSelect:
|
|
291
|
-
onRowClick:
|
|
302
|
+
]))), 128)) : o.rows.length > 0 ? (r(!0), u(A, { key: 1 }, $(o.rows, (a, c) => (r(), R(Pe, {
|
|
303
|
+
key: m(a, i.value),
|
|
304
|
+
row: a,
|
|
305
|
+
headers: o.headers,
|
|
306
|
+
index: c,
|
|
307
|
+
"key-field": i.value,
|
|
308
|
+
selectable: B.value,
|
|
309
|
+
"is-selected": s.value.has(m(a, i.value)),
|
|
310
|
+
hoverable: o.hoverable,
|
|
311
|
+
striped: o.striped,
|
|
312
|
+
compact: o.compact,
|
|
313
|
+
onSelect: Z,
|
|
314
|
+
onRowClick: le,
|
|
292
315
|
class: "[&_td:last-child]:pr-3.5!"
|
|
293
316
|
}, M({ _: 2 }, [
|
|
294
|
-
|
|
295
|
-
name:
|
|
296
|
-
fn:
|
|
297
|
-
|
|
317
|
+
$(o.headers, (v) => ({
|
|
318
|
+
name: v.field,
|
|
319
|
+
fn: T((h) => [
|
|
320
|
+
D(e.$slots, v.field, Y({ ref_for: !0 }, h))
|
|
298
321
|
])
|
|
299
322
|
}))
|
|
300
|
-
]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact"]))), 128)) : (
|
|
301
|
-
|
|
302
|
-
colspan:
|
|
323
|
+
]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact"]))), 128)) : (r(), u("tr", Ee, [
|
|
324
|
+
f("td", {
|
|
325
|
+
colspan: B.value ? o.headers.length + 1 : o.headers.length,
|
|
303
326
|
class: "align-middle hover:bg-transparent"
|
|
304
327
|
}, [
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
title:
|
|
308
|
-
description:
|
|
309
|
-
icon:
|
|
328
|
+
D(e.$slots, "empty", {}, () => [
|
|
329
|
+
z(W(ye), {
|
|
330
|
+
title: re.value,
|
|
331
|
+
description: ie.value,
|
|
332
|
+
icon: o.emptyIcon,
|
|
310
333
|
class: "border-none! bg-transparent! py-16!"
|
|
311
334
|
}, M({ _: 2 }, [
|
|
312
335
|
e.$slots["empty-action"] ? {
|
|
313
336
|
name: "action",
|
|
314
|
-
fn:
|
|
315
|
-
|
|
337
|
+
fn: T(() => [
|
|
338
|
+
D(e.$slots, "empty-action")
|
|
316
339
|
]),
|
|
317
340
|
key: "0"
|
|
318
341
|
} : void 0
|
|
319
342
|
]), 1032, ["title", "description", "icon"])
|
|
320
343
|
])
|
|
321
|
-
], 8,
|
|
344
|
+
], 8, Re)
|
|
322
345
|
]))
|
|
323
346
|
])
|
|
324
347
|
], 2)
|
|
325
348
|
])
|
|
326
349
|
], 2),
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
"current-page":
|
|
330
|
-
"total-pages":
|
|
331
|
-
"total-items":
|
|
332
|
-
},
|
|
333
|
-
onChange:
|
|
334
|
-
"onUpdate:itemsPerPage":
|
|
350
|
+
o.showPagination && o.pageInfo && o.pageInfo.totalPages > 1 ? (r(), u("div", ze, [
|
|
351
|
+
z(W(be), Y({
|
|
352
|
+
"current-page": p.value,
|
|
353
|
+
"total-pages": o.pageInfo.totalPages,
|
|
354
|
+
"total-items": o.pageInfo.totalItems
|
|
355
|
+
}, o.paginationProps, {
|
|
356
|
+
onChange: ee,
|
|
357
|
+
"onUpdate:itemsPerPage": te
|
|
335
358
|
}), null, 16, ["current-page", "total-pages", "total-items"])
|
|
336
|
-
])) :
|
|
337
|
-
|
|
338
|
-
show:
|
|
339
|
-
"onUpdate:show":
|
|
340
|
-
title:
|
|
341
|
-
description:
|
|
342
|
-
"confirm-text":
|
|
343
|
-
"cancel-text":
|
|
359
|
+
])) : x("", !0),
|
|
360
|
+
z(pe, {
|
|
361
|
+
show: k.value,
|
|
362
|
+
"onUpdate:show": t[2] || (t[2] = (a) => k.value = a),
|
|
363
|
+
title: de.value,
|
|
364
|
+
description: ce.value,
|
|
365
|
+
"confirm-text": ue.value,
|
|
366
|
+
"cancel-text": fe.value,
|
|
344
367
|
variant: "danger",
|
|
345
|
-
onConfirm:
|
|
346
|
-
onCancel:
|
|
368
|
+
onConfirm: ae,
|
|
369
|
+
onCancel: t[3] || (t[3] = (a) => k.value = !1)
|
|
347
370
|
}, null, 8, ["show", "title", "description", "confirm-text", "cancel-text"])
|
|
348
371
|
]));
|
|
349
372
|
}
|
|
350
373
|
});
|
|
351
374
|
export {
|
|
352
|
-
|
|
375
|
+
We as default
|
|
353
376
|
};
|
|
@@ -47,6 +47,13 @@ export interface DataTableProps {
|
|
|
47
47
|
toolbarClass?: string;
|
|
48
48
|
toolbarSearchClass?: string;
|
|
49
49
|
headers: TableHeader[];
|
|
50
|
+
/**
|
|
51
|
+
* Unique row identifier field.
|
|
52
|
+
* When set to the sentinel value 'auto' (the internal default), DataTable will
|
|
53
|
+
* automatically pick the first matching key from ['id', '_id'] found on the
|
|
54
|
+
* first row. Explicitly passing 'id' or '_id' (or any other string) pins the
|
|
55
|
+
* field to that exact value.
|
|
56
|
+
*/
|
|
50
57
|
keyField?: string;
|
|
51
58
|
loading?: boolean;
|
|
52
59
|
selectable?: boolean;
|
|
@@ -76,3 +83,11 @@ export interface RowClickPayload {
|
|
|
76
83
|
row: any;
|
|
77
84
|
index: number;
|
|
78
85
|
}
|
|
86
|
+
/** Shape provided by Screen to deeply nested components */
|
|
87
|
+
export interface ScreenContext {
|
|
88
|
+
/** When true, DataTable should hide its own search toolbar */
|
|
89
|
+
disableSearch: boolean;
|
|
90
|
+
/** When true, DataTable should enable row selection */
|
|
91
|
+
forceSelectable: boolean;
|
|
92
|
+
}
|
|
93
|
+
export declare const SCREEN_CONTEXT_KEY: unique symbol;
|