vlite3 1.5.6 → 1.5.7
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/ButtonGroup.vue.js +2 -2
- package/components/CategoryManager/CategoryManager.vue2.js +3 -3
- package/components/Chip/Chip.vue.d.ts +1 -0
- package/components/Chip/Chip.vue.js +67 -36
- package/components/Chip/types.d.ts +5 -1
- package/components/CommandPalette/CommandPaletteContent.vue2.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem.vue2.js → CommandPaletteItem.vue.js} +1 -1
- package/components/DataTable/DataTable.vue.d.ts +12 -3
- package/components/DataTable/DataTable.vue.js +5 -586
- package/components/DataTable/DataTable.vue2.js +711 -2
- package/components/DataTable/DataTableHeader.vue.d.ts +22 -0
- package/components/DataTable/DataTableHeader.vue.js +5 -58
- package/components/DataTable/DataTableHeader.vue2.js +106 -2
- package/components/DataTable/DataTableRow.vue.d.ts +13 -0
- package/components/DataTable/DataTableRow.vue.js +2 -2
- package/components/DataTable/DataTableRow.vue2.js +133 -123
- package/components/DataTable/dataTableColumnWidths.d.ts +91 -0
- package/components/DataTable/dataTableColumnWidths.js +82 -0
- package/components/DataTable/types.d.ts +48 -0
- package/components/DataTable/useDataTableColumnResize.d.ts +52 -0
- package/components/DataTable/useDataTableColumnResize.js +328 -0
- package/components/Form/{AccordionView.vue.js → AccordionView.vue2.js} +1 -1
- package/components/Form/index.vue2.js +1 -1
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/PanZoomViewport/PanZoomViewport.vue.d.ts +1 -1
- package/components/RichTextEditor/RichTextEditor.vue.js +4 -4
- package/components/RichTextEditor/RichTextLinkPopover.vue3.js +2 -2
- package/components/RichTextEditor/RichTextToolbar.vue3.js +2 -2
- package/components/Screen/ScreenFilter.vue.js +3 -3
- package/components/StatusChip/StatusChip.vue.d.ts +6 -0
- package/components/StatusChip/StatusChip.vue.js +12 -10
- package/components/Tabes/Tabes.vue.js +3 -3
- package/components/Tabes/Tabes.vue2.js +241 -220
- package/components/Tabes/types.d.ts +3 -1
- package/package.json +1 -1
- package/style.css +17 -3
- package/utils/usePersistentState.d.ts +4 -1
- package/utils/usePersistentState.js +4 -3
- /package/components/RichTextEditor/{RichTextLinkPopover.vue.js → RichTextLinkPopover.vue2.js} +0 -0
- /package/components/RichTextEditor/{RichTextToolbar.vue.js → RichTextToolbar.vue2.js} +0 -0
|
@@ -1,4 +1,713 @@
|
|
|
1
|
-
import f from "
|
|
1
|
+
import { defineComponent as pt, computed as r, inject as yt, toRef as re, ref as L, watch as F, shallowRef as kt, onUnmounted as xt, openBlock as o, createElementBlock as d, createElementVNode as f, normalizeClass as I, Fragment as z, renderList as k, createCommentVNode as D, unref as a, isMemoSame as de, createBlock as ce, createSlots as q, withCtx as G, renderSlot as M, mergeProps as ue, createVNode as V, normalizeStyle as E, withModifiers as Le } from "vue";
|
|
2
|
+
import { useBreakpoints as zt, breakpointsTailwind as St } from "@vueuse/core";
|
|
3
|
+
import Rt from "../CheckBox.vue.js";
|
|
4
|
+
import Ct from "../ConfirmationModal.vue.js";
|
|
5
|
+
import It from "../Pagination/Pagination.vue.js";
|
|
6
|
+
import Me from "../Empty/Empty.vue.js";
|
|
7
|
+
import Tt from "./DataTableHeader.vue.js";
|
|
8
|
+
import He from "./DataTableRow.vue.js";
|
|
9
|
+
import { useDataTableTree as Bt } from "./useDataTableTree.js";
|
|
10
|
+
import { useDataTableColumnResize as Pt } from "./useDataTableColumnResize.js";
|
|
11
|
+
import { getStackedVisibleHeaders as Dt } from "./dataTableHeaders.js";
|
|
12
|
+
import { useRtl as Et } from "../../composables/useRtl.js";
|
|
13
|
+
import { $t as T } from "../../utils/i18n.js";
|
|
14
|
+
import { SCREEN_CONTEXT_KEY as $t } from "./types.js";
|
|
15
|
+
import { MAX_COLUMN_WIDTH as Ke, SELECTION_COLUMN_WIDTH as Wt } from "./dataTableColumnWidths.js";
|
|
16
|
+
const Lt = { class: "space-y-6.5" }, Mt = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "w-full min-w-0 space-y-3"
|
|
19
|
+
}, Ht = { class: "flex items-center gap-2 px-3 py-3 border-b" }, Kt = {
|
|
20
|
+
key: 0,
|
|
21
|
+
class: "h-4 w-4 rounded-[4px] bg-muted animate-pulse"
|
|
22
|
+
}, At = { class: "flex flex-col gap-2.5 px-3 py-3" }, Ft = {
|
|
23
|
+
key: 2,
|
|
24
|
+
class: "border rounded-lg bg-background"
|
|
25
|
+
}, Vt = ["data-resizing"], Nt = ["data-vlite-resize-boundary", "data-active", "aria-label", "aria-valuenow", "aria-valuemin", "aria-valuemax", "aria-valuetext", "onPointerdown", "onDblclick", "onKeydown"], Ot = { key: 0 }, Ut = ["data-vlite-col"], jt = { class: "hover:bg-transparent" }, Yt = {
|
|
26
|
+
key: 0,
|
|
27
|
+
scope: "col",
|
|
28
|
+
class: "w-[40px] px-0 text-center font-medium text-muted-foreground",
|
|
29
|
+
style: { width: "40px" }
|
|
30
|
+
}, Xt = { class: "flex items-center justify-center" }, Zt = { class: "[&_tr:last-child]:border-0" }, qt = {
|
|
31
|
+
key: 0,
|
|
32
|
+
class: "w-[48px] px-0 py-4 align-middle text-center",
|
|
33
|
+
style: { width: "48px" }
|
|
34
|
+
}, Gt = { key: 2 }, Jt = ["colspan"], Qt = { key: 0 }, _t = 10, gl = /* @__PURE__ */ pt({
|
|
35
|
+
__name: "DataTable",
|
|
36
|
+
props: {
|
|
37
|
+
rows: { default: () => [] },
|
|
38
|
+
selectedRows: { default: () => [] },
|
|
39
|
+
headers: { default: () => [] },
|
|
40
|
+
keyField: { default: "auto" },
|
|
41
|
+
loading: { type: Boolean, default: !1 },
|
|
42
|
+
hideSelectable: { type: Boolean, default: !1 },
|
|
43
|
+
isRowSelectable: {},
|
|
44
|
+
emptyTitle: {},
|
|
45
|
+
emptyTitleI18n: {},
|
|
46
|
+
emptyDescription: {},
|
|
47
|
+
emptyDescriptionI18n: {},
|
|
48
|
+
emptyIcon: { default: "lucide:inbox" },
|
|
49
|
+
showPagination: { type: Boolean, default: !0 },
|
|
50
|
+
paginationProps: { default: () => ({
|
|
51
|
+
alignment: "between",
|
|
52
|
+
navType: "icon",
|
|
53
|
+
showItemsPerPage: !0,
|
|
54
|
+
itemsPerPageOptions: [10, 25, 50, 100],
|
|
55
|
+
showPageInfo: !1
|
|
56
|
+
}) },
|
|
57
|
+
pageInfo: {},
|
|
58
|
+
striped: { type: Boolean, default: !1 },
|
|
59
|
+
hoverable: { type: Boolean, default: !0 },
|
|
60
|
+
bordered: { type: Boolean, default: !0 },
|
|
61
|
+
cellBordered: { type: Boolean, default: !1 },
|
|
62
|
+
compact: { type: Boolean, default: !1 },
|
|
63
|
+
rounded: { type: Boolean, default: !0 },
|
|
64
|
+
tableClass: {},
|
|
65
|
+
class: {},
|
|
66
|
+
sortable: { type: Boolean, default: !1 },
|
|
67
|
+
variant: { default: "default" },
|
|
68
|
+
headerVariant: { default: "default" },
|
|
69
|
+
size: { default: "md" },
|
|
70
|
+
loadChildren: {},
|
|
71
|
+
treeIndent: { default: 20 },
|
|
72
|
+
responsive: { type: Boolean, default: !0 },
|
|
73
|
+
resizable: { type: Boolean, default: !1 },
|
|
74
|
+
persistenceKey: {}
|
|
75
|
+
},
|
|
76
|
+
emits: ["change", "select", "rowClick", "update:itemsPerPage", "update:selectedRows", "delete", "expand", "columnResize"],
|
|
77
|
+
setup(n, { emit: Ae }) {
|
|
78
|
+
const Fe = (e, l) => {
|
|
79
|
+
if (!(!e || !l))
|
|
80
|
+
return l.includes(".") ? l.split(".").reduce((t, i) => t?.[i], e) : e[l];
|
|
81
|
+
}, w = (e, l) => Fe(e, l), Ve = (e, l) => {
|
|
82
|
+
const t = ["id", "_id"];
|
|
83
|
+
if (l && l !== "auto") return l;
|
|
84
|
+
if (e && e.length > 0) {
|
|
85
|
+
for (const i of t)
|
|
86
|
+
if (i in e[0]) return i;
|
|
87
|
+
}
|
|
88
|
+
return "_id";
|
|
89
|
+
}, Ne = (e) => e.sortKey || e.field, s = n, me = zt(St).smaller("md"), N = r(() => s.responsive && me.value), Oe = r(() => Dt(s.headers)), J = r(
|
|
90
|
+
() => me.value ? s.headers.filter((e) => !e.hideOnMobile) : s.headers
|
|
91
|
+
), S = Ae, Q = yt($t, null), p = r(() => s.hideSelectable ? !1 : Q ? Q.forceSelectable : !0), b = r(() => Ve(s.rows, s.keyField)), y = (e) => s.isRowSelectable?.(e) !== !1, O = (e) => p.value && y(e), {
|
|
92
|
+
isTreeMode: g,
|
|
93
|
+
flattenVisibleRows: H,
|
|
94
|
+
allLoadedRows: R,
|
|
95
|
+
findParentId: ve,
|
|
96
|
+
isExpandable: U,
|
|
97
|
+
isExpanded: j,
|
|
98
|
+
isLoading: Y,
|
|
99
|
+
collectDescendantIds: fe,
|
|
100
|
+
toggleExpand: be,
|
|
101
|
+
pruneStaleTreeState: Ue,
|
|
102
|
+
getChildren: ge
|
|
103
|
+
} = Bt({
|
|
104
|
+
rows: re(s, "rows"),
|
|
105
|
+
keyField: b,
|
|
106
|
+
loadChildren: re(s, "loadChildren"),
|
|
107
|
+
getRowId: w,
|
|
108
|
+
onExpand: (e) => S("expand", e)
|
|
109
|
+
}), B = L({ field: "", order: "" }), $ = L(
|
|
110
|
+
s.pageInfo?.itemsPerPage || s.paginationProps?.itemsPerPage || 10
|
|
111
|
+
), W = L(s.pageInfo?.currentPage || 1), X = L(!1), _ = r(() => s.loading);
|
|
112
|
+
F(
|
|
113
|
+
() => s.pageInfo?.itemsPerPage,
|
|
114
|
+
(e) => {
|
|
115
|
+
e !== void 0 && ($.value = e);
|
|
116
|
+
}
|
|
117
|
+
), F(
|
|
118
|
+
() => s.paginationProps?.itemsPerPage,
|
|
119
|
+
(e) => {
|
|
120
|
+
e !== void 0 && ($.value = e);
|
|
121
|
+
}
|
|
122
|
+
), F(
|
|
123
|
+
() => s.pageInfo?.currentPage,
|
|
124
|
+
(e) => {
|
|
125
|
+
e && (W.value = e);
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
const u = kt(/* @__PURE__ */ new Set());
|
|
129
|
+
F(
|
|
130
|
+
() => s.selectedRows,
|
|
131
|
+
(e) => {
|
|
132
|
+
const l = new Set(
|
|
133
|
+
(e || []).filter(y).map((t) => w(t, b.value))
|
|
134
|
+
);
|
|
135
|
+
(l.size !== u.value.size || [...l].some((t) => !u.value.has(t))) && (u.value = l);
|
|
136
|
+
},
|
|
137
|
+
{ immediate: !0 }
|
|
138
|
+
);
|
|
139
|
+
const K = r(() => {
|
|
140
|
+
if (!g.value) return s.rows.filter(y);
|
|
141
|
+
const e = [], l = (t) => {
|
|
142
|
+
for (const i of t) {
|
|
143
|
+
y(i) && e.push(i);
|
|
144
|
+
for (const c of ge(i)) l([c]);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
return l(s.rows), e;
|
|
148
|
+
}), ee = r(() => {
|
|
149
|
+
const e = K.value;
|
|
150
|
+
return e.length > 0 && e.every((l) => u.value.has(w(l, b.value)));
|
|
151
|
+
}), je = r(() => K.value.length > 0), Ye = r(
|
|
152
|
+
() => K.value.filter(
|
|
153
|
+
(e) => u.value.has(w(e, b.value))
|
|
154
|
+
).length
|
|
155
|
+
), he = r(
|
|
156
|
+
() => Ye.value > 0 && !ee.value
|
|
157
|
+
), Xe = r(() => {
|
|
158
|
+
const e = new Map(R.value);
|
|
159
|
+
return (s.selectedRows || []).forEach((l) => e.set(w(l, b.value), l)), s.rows.forEach((l) => e.set(w(l, b.value), l)), Array.from(u.value).map((l) => e.get(l)).filter(Boolean);
|
|
160
|
+
}), Ze = (e) => {
|
|
161
|
+
if (!g.value) return !1;
|
|
162
|
+
const l = fe(e).filter((i) => {
|
|
163
|
+
const c = R.value.get(i);
|
|
164
|
+
return c && y(c);
|
|
165
|
+
});
|
|
166
|
+
if (!l.length) return !1;
|
|
167
|
+
let t = 0;
|
|
168
|
+
for (const i of l)
|
|
169
|
+
u.value.has(i) && t++;
|
|
170
|
+
return t > 0 && t < l.length;
|
|
171
|
+
}, Z = r(() => {
|
|
172
|
+
const e = /* @__PURE__ */ new Set();
|
|
173
|
+
if (!g.value) return e;
|
|
174
|
+
for (const l of H.value)
|
|
175
|
+
Ze(l.row) && e.add(l.id);
|
|
176
|
+
return e;
|
|
177
|
+
}), qe = (e, l) => {
|
|
178
|
+
let t = ve(e);
|
|
179
|
+
for (; t != null; ) {
|
|
180
|
+
const i = R.value.get(t);
|
|
181
|
+
if (!i) break;
|
|
182
|
+
const c = ge(i).filter(y).map((v) => w(v, b.value)), m = c.length > 0 && c.every((v) => l.has(v));
|
|
183
|
+
y(i) && m ? l.add(t) : l.delete(t), t = ve(t);
|
|
184
|
+
}
|
|
185
|
+
}, Ge = (e) => {
|
|
186
|
+
const l = new Set(u.value);
|
|
187
|
+
K.value.forEach((t) => {
|
|
188
|
+
const i = w(t, b.value);
|
|
189
|
+
e ? l.add(i) : l.delete(i);
|
|
190
|
+
}), u.value = l, te();
|
|
191
|
+
}, we = (e) => {
|
|
192
|
+
const l = R.value.get(e) || s.rows.find((c) => w(c, b.value) === e);
|
|
193
|
+
if (!l || !y(l)) return;
|
|
194
|
+
const t = new Set(u.value), i = !t.has(e);
|
|
195
|
+
if (g.value) {
|
|
196
|
+
const c = R.value.get(e);
|
|
197
|
+
if (c) {
|
|
198
|
+
const m = (v, x) => {
|
|
199
|
+
const h = R.value.get(v);
|
|
200
|
+
!h || !y(h) || (x ? t.add(v) : t.delete(v));
|
|
201
|
+
};
|
|
202
|
+
m(e, i), fe(c).forEach((v) => m(v, i)), qe(e, t), u.value = t, te();
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
t.has(e) ? t.delete(e) : t.add(e), u.value = t, te();
|
|
207
|
+
}, te = () => {
|
|
208
|
+
const e = /* @__PURE__ */ new Set(), l = [], t = (i) => {
|
|
209
|
+
const c = w(i, b.value);
|
|
210
|
+
u.value.has(c) && !e.has(c) && (l.push(i), e.add(c));
|
|
211
|
+
};
|
|
212
|
+
K.value.forEach(t), (s.selectedRows || []).forEach(t), S("select", {
|
|
213
|
+
selected: l,
|
|
214
|
+
all: ee.value,
|
|
215
|
+
indeterminate: he.value
|
|
216
|
+
}), S("update:selectedRows", l);
|
|
217
|
+
}, Je = (e) => {
|
|
218
|
+
const l = s.headers.find((i) => i.field === e), t = l ? Ne(l) : e;
|
|
219
|
+
B.value.field === t ? B.value.order = B.value.order === "asc" ? "desc" : "asc" : (B.value.field = t, B.value.order = "asc"), W.value = 1, le();
|
|
220
|
+
}, Qe = (e) => {
|
|
221
|
+
W.value = e, le();
|
|
222
|
+
}, _e = (e) => {
|
|
223
|
+
$.value = e, W.value = 1, S("update:itemsPerPage", e), le();
|
|
224
|
+
}, pe = (e) => S("rowClick", e), et = () => {
|
|
225
|
+
S("delete", Xe.value), X.value = !1;
|
|
226
|
+
};
|
|
227
|
+
let P = null;
|
|
228
|
+
const le = () => {
|
|
229
|
+
P && clearTimeout(P), P = setTimeout(() => {
|
|
230
|
+
P = null;
|
|
231
|
+
const e = {
|
|
232
|
+
pagination: { page: W.value, limit: $.value },
|
|
233
|
+
sort: { ...B.value },
|
|
234
|
+
filter: {}
|
|
235
|
+
};
|
|
236
|
+
S("change", e), Q?.onTableChange?.(e);
|
|
237
|
+
}, 10);
|
|
238
|
+
};
|
|
239
|
+
xt(() => {
|
|
240
|
+
P && (clearTimeout(P), P = null);
|
|
241
|
+
}), F(
|
|
242
|
+
() => s.rows,
|
|
243
|
+
() => {
|
|
244
|
+
Ue();
|
|
245
|
+
const e = new Set(R.value.keys());
|
|
246
|
+
(s.selectedRows || []).forEach((l) => {
|
|
247
|
+
y(l) && e.add(w(l, b.value));
|
|
248
|
+
}), u.value = new Set(
|
|
249
|
+
[...u.value].filter((l) => {
|
|
250
|
+
const t = R.value.get(l);
|
|
251
|
+
return e.has(l) && (!t || y(t));
|
|
252
|
+
})
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
);
|
|
256
|
+
const ye = L(null), ke = L(null), tt = Et(), A = r(() => s.resizable && !N.value), xe = r(
|
|
257
|
+
() => A.value && s.cellBordered
|
|
258
|
+
), {
|
|
259
|
+
isResizing: ze,
|
|
260
|
+
activeField: Se,
|
|
261
|
+
isApplyingWidths: C,
|
|
262
|
+
columnWidths: ne,
|
|
263
|
+
tableWidth: Re,
|
|
264
|
+
columnBoundaries: Ce,
|
|
265
|
+
boundaryLayerWidth: lt,
|
|
266
|
+
boundaryLayerHeight: nt,
|
|
267
|
+
minWidthFor: Ie,
|
|
268
|
+
resolveWidth: Te,
|
|
269
|
+
startResize: at,
|
|
270
|
+
adjustWidth: Be,
|
|
271
|
+
resetColumn: ae
|
|
272
|
+
} = Pt({
|
|
273
|
+
headers: J,
|
|
274
|
+
enabled: A,
|
|
275
|
+
fullHeightBoundaries: xe,
|
|
276
|
+
persistenceKey: re(s, "persistenceKey"),
|
|
277
|
+
isRtl: tt,
|
|
278
|
+
tableRef: ye,
|
|
279
|
+
viewportRef: ke,
|
|
280
|
+
hasSelectionColumn: p,
|
|
281
|
+
// Skeleton cells would poison the natural-width measurement.
|
|
282
|
+
measurementReady: r(() => !_.value),
|
|
283
|
+
onCommit: (e) => S("columnResize", e)
|
|
284
|
+
}), it = r(() => g.value || C.value), ie = r(() => {
|
|
285
|
+
const e = /* @__PURE__ */ new Map();
|
|
286
|
+
for (const l of J.value) e.set(l.field, l);
|
|
287
|
+
return e;
|
|
288
|
+
}), Pe = (e) => {
|
|
289
|
+
const l = T("vlite.dataTable.resizeColumn"), t = l !== "vlite.dataTable.resizeColumn" ? l : "Resize column", i = e.titleI18n ? T(e.titleI18n) : e.title;
|
|
290
|
+
return i ? `${t}: ${i}` : t;
|
|
291
|
+
}, De = (e, l) => {
|
|
292
|
+
at(e, l);
|
|
293
|
+
}, st = (e, l, t) => Be(e, l, t), ot = (e, l) => {
|
|
294
|
+
if (l.key === "ArrowLeft" || l.key === "ArrowRight") {
|
|
295
|
+
l.preventDefault(), l.stopPropagation(), Be(e, l.key === "ArrowRight" ? 1 : -1, l.shiftKey);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
(l.key === "Enter" || l.key === " ") && (l.preventDefault(), l.stopPropagation(), ae(e));
|
|
299
|
+
}, se = (e) => {
|
|
300
|
+
const l = ie.value.get(e);
|
|
301
|
+
return l ? ne.value[e] ?? Te(l) : void 0;
|
|
302
|
+
}, rt = (e) => {
|
|
303
|
+
const l = ie.value.get(e);
|
|
304
|
+
return l ? Ie(l) : void 0;
|
|
305
|
+
}, dt = (e) => {
|
|
306
|
+
const l = ie.value.get(e);
|
|
307
|
+
return l ? Pe(l) : void 0;
|
|
308
|
+
}, ct = r(() => {
|
|
309
|
+
const e = s.variant === "raised", l = s.rounded ? e ? "rounded-lg" : "rounded" : "rounded-none";
|
|
310
|
+
return [
|
|
311
|
+
"w-full flex flex-col",
|
|
312
|
+
e ? `bg-background shadow-sm p-2 ${l}` : `bg-background ${l}`,
|
|
313
|
+
N.value ? "overflow-visible" : "overflow-hidden",
|
|
314
|
+
// Outer border stays on desktop table; stacked cards carry their own borders.
|
|
315
|
+
s.bordered && !N.value ? "border border-border" : "",
|
|
316
|
+
// Belt-and-braces with the body-level lock: no text selection mid-drag.
|
|
317
|
+
ze.value ? "select-none" : "",
|
|
318
|
+
s.class
|
|
319
|
+
].join(" ");
|
|
320
|
+
}), ut = r(() => {
|
|
321
|
+
const e = s.cellBordered ? "[&_thead_th]:border-border [&_tbody_td]:border-border [&_tbody_th]:border-border [&_thead_th:not(:last-child)]:border-e [&_tbody_td:not(:last-child)]:border-e [&_tbody_th:not(:last-child)]:border-e [&_tbody_tr:not(:last-child)>td]:border-b [&_tbody_tr:not(:last-child)>th]:border-b" : "";
|
|
322
|
+
return [
|
|
323
|
+
"w-full caption-bottom -text-fs-1",
|
|
324
|
+
g.value || C.value ? "table-fixed" : "",
|
|
325
|
+
e,
|
|
326
|
+
s.tableClass
|
|
327
|
+
].join(" ");
|
|
328
|
+
}), mt = r(
|
|
329
|
+
() => Re.value != null ? { width: `${Re.value}px` } : void 0
|
|
330
|
+
), vt = (e) => {
|
|
331
|
+
if (C.value) return;
|
|
332
|
+
const l = {};
|
|
333
|
+
return e.width && !/(?:^|\s|:)w-/.test(e.width) && (l.width = e.width), e.minWidth && !/(?:^|\s|:)min-w-/.test(e.minWidth) && (g.value && !l.width ? l.width = e.minWidth : l.minWidth = e.minWidth), l;
|
|
334
|
+
}, ft = (e) => {
|
|
335
|
+
const l = ne.value[e.field];
|
|
336
|
+
if (l != null) return { width: `${l}px` };
|
|
337
|
+
const t = {};
|
|
338
|
+
return e.width && !/(?:^|\s|:)w-/.test(e.width) ? t.width = e.width : e.minWidth && !/(?:^|\s|:)min-w-/.test(e.minWidth) && (t.width = e.minWidth), t;
|
|
339
|
+
}, Ee = (e) => {
|
|
340
|
+
if (C.value) return "";
|
|
341
|
+
const l = [];
|
|
342
|
+
return e.width && /(?:^|\s|:)w-/.test(e.width) && l.push(e.width), e.minWidth && /(?:^|\s|:)min-w-/.test(e.minWidth) && l.push(e.minWidth), l.join(" ");
|
|
343
|
+
}, $e = r(
|
|
344
|
+
() => s.emptyTitleI18n ? T(s.emptyTitleI18n) : s.emptyTitle
|
|
345
|
+
), We = r(
|
|
346
|
+
() => s.emptyDescriptionI18n ? T(s.emptyDescriptionI18n) : s.emptyDescription
|
|
347
|
+
), bt = r(() => {
|
|
348
|
+
const e = T("vlite.dataTable.confirmDeleteTitle");
|
|
349
|
+
return e !== "vlite.dataTable.confirmDeleteTitle" ? e : "Confirm Deletion";
|
|
350
|
+
}), gt = r(() => {
|
|
351
|
+
const e = T("vlite.dataTable.confirmDeleteDesc");
|
|
352
|
+
return e !== "vlite.dataTable.confirmDeleteDesc" ? e : "Are you sure you want to delete the selected items?";
|
|
353
|
+
}), ht = r(() => {
|
|
354
|
+
const e = T("vlite.dataTable.deleteBtn");
|
|
355
|
+
return e !== "vlite.dataTable.deleteBtn" ? e : "Delete";
|
|
356
|
+
}), wt = r(() => {
|
|
357
|
+
const e = T("vlite.dataTable.cancelBtn");
|
|
358
|
+
return e !== "vlite.dataTable.cancelBtn" ? e : "Cancel";
|
|
359
|
+
});
|
|
360
|
+
return (e, l) => (o(), d("div", Lt, [
|
|
361
|
+
f("div", {
|
|
362
|
+
class: I(ct.value)
|
|
363
|
+
}, [
|
|
364
|
+
N.value ? (o(), d("div", Mt, [
|
|
365
|
+
_.value ? (o(!0), d(z, { key: 0 }, k(Math.min($.value, 15), (t) => (o(), d("div", {
|
|
366
|
+
key: "skeleton-card-" + t,
|
|
367
|
+
class: "border rounded-lg overflow-hidden bg-background"
|
|
368
|
+
}, [
|
|
369
|
+
f("div", Ht, [
|
|
370
|
+
p.value ? (o(), d("div", Kt)) : D("", !0),
|
|
371
|
+
l[9] || (l[9] = f("div", { class: "h-4 flex-1 rounded-md bg-muted animate-pulse" }, null, -1))
|
|
372
|
+
]),
|
|
373
|
+
f("div", At, [
|
|
374
|
+
(o(!0), d(z, null, k(Oe.value.slice(1, 4), (i) => (o(), d("div", {
|
|
375
|
+
key: i.field,
|
|
376
|
+
class: "flex items-center justify-between gap-3"
|
|
377
|
+
}, [...l[10] || (l[10] = [
|
|
378
|
+
f("div", { class: "h-2.5 w-14 rounded bg-muted animate-pulse" }, null, -1),
|
|
379
|
+
f("div", { class: "h-4 w-20 rounded-md bg-muted animate-pulse" }, null, -1)
|
|
380
|
+
])]))), 128))
|
|
381
|
+
])
|
|
382
|
+
]))), 128)) : a(H).length > 0 ? (o(!0), d(z, { key: 1 }, k(a(H), (t, i, c, m) => {
|
|
383
|
+
const v = [
|
|
384
|
+
t.row,
|
|
385
|
+
u.value.has(t.id),
|
|
386
|
+
Z.value.has(t.id),
|
|
387
|
+
p.value,
|
|
388
|
+
O(t.row),
|
|
389
|
+
n.compact,
|
|
390
|
+
n.size,
|
|
391
|
+
n.striped,
|
|
392
|
+
n.hoverable,
|
|
393
|
+
n.cellBordered,
|
|
394
|
+
a(g),
|
|
395
|
+
t.depth,
|
|
396
|
+
t.isLastSibling,
|
|
397
|
+
t.ancestorLastFlags,
|
|
398
|
+
a(j)(t.id),
|
|
399
|
+
a(Y)(t.id),
|
|
400
|
+
a(U)(t.row),
|
|
401
|
+
n.treeIndent,
|
|
402
|
+
!0
|
|
403
|
+
];
|
|
404
|
+
if (m && m.key === t.id && de(m, v)) return m;
|
|
405
|
+
const x = (o(), ce(He, {
|
|
406
|
+
key: t.id,
|
|
407
|
+
stacked: "",
|
|
408
|
+
row: t.row,
|
|
409
|
+
headers: n.headers,
|
|
410
|
+
index: t.index,
|
|
411
|
+
"key-field": b.value,
|
|
412
|
+
selectable: p.value,
|
|
413
|
+
"selection-disabled": !O(t.row),
|
|
414
|
+
"is-selected": u.value.has(t.id),
|
|
415
|
+
"is-indeterminate": Z.value.has(t.id),
|
|
416
|
+
hoverable: n.hoverable,
|
|
417
|
+
striped: n.striped,
|
|
418
|
+
compact: n.compact,
|
|
419
|
+
size: n.size,
|
|
420
|
+
"cell-bordered": n.cellBordered,
|
|
421
|
+
"tree-mode": a(g),
|
|
422
|
+
depth: t.depth,
|
|
423
|
+
"tree-indent": n.treeIndent,
|
|
424
|
+
expandable: a(U)(t.row),
|
|
425
|
+
expanded: a(j)(t.id),
|
|
426
|
+
"tree-loading": a(Y)(t.id),
|
|
427
|
+
"is-last-sibling": t.isLastSibling,
|
|
428
|
+
"ancestor-last-flags": t.ancestorLastFlags,
|
|
429
|
+
onSelect: we,
|
|
430
|
+
onRowClick: pe,
|
|
431
|
+
onToggleExpand: (h) => a(be)(t.row, t.depth)
|
|
432
|
+
}, q({ _: 2 }, [
|
|
433
|
+
k(n.headers, (h) => ({
|
|
434
|
+
name: h.field,
|
|
435
|
+
fn: G((oe) => [
|
|
436
|
+
M(e.$slots, h.field, ue({ ref_for: !0 }, oe), void 0, !0)
|
|
437
|
+
])
|
|
438
|
+
}))
|
|
439
|
+
]), 1032, ["row", "headers", "index", "key-field", "selectable", "selection-disabled", "is-selected", "is-indeterminate", "hoverable", "striped", "compact", "size", "cell-bordered", "tree-mode", "depth", "tree-indent", "expandable", "expanded", "tree-loading", "is-last-sibling", "ancestor-last-flags", "onToggleExpand"]));
|
|
440
|
+
return x.memo = v, x;
|
|
441
|
+
}, l, 0), 128)) : (o(), d("div", Ft, [
|
|
442
|
+
M(e.$slots, "empty", {}, () => [
|
|
443
|
+
V(a(Me), {
|
|
444
|
+
title: $e.value,
|
|
445
|
+
description: We.value,
|
|
446
|
+
icon: n.emptyIcon,
|
|
447
|
+
variant: "variant12",
|
|
448
|
+
class: "bg-transparent! py-8!"
|
|
449
|
+
}, q({ _: 2 }, [
|
|
450
|
+
e.$slots["empty-action"] ? {
|
|
451
|
+
name: "action",
|
|
452
|
+
fn: G(() => [
|
|
453
|
+
M(e.$slots, "empty-action", {}, void 0, !0)
|
|
454
|
+
]),
|
|
455
|
+
key: "0"
|
|
456
|
+
} : void 0
|
|
457
|
+
]), 1032, ["title", "description", "icon"])
|
|
458
|
+
], !0)
|
|
459
|
+
]))
|
|
460
|
+
])) : (o(), d("div", {
|
|
461
|
+
key: 1,
|
|
462
|
+
ref_key: "tableViewportRef",
|
|
463
|
+
ref: ke,
|
|
464
|
+
class: I(["relative w-full overflow-x-auto", a(g) ? "overflow-y-visible" : "overflow-y-hidden"])
|
|
465
|
+
}, [
|
|
466
|
+
xe.value && a(Ce).length ? (o(), d("div", {
|
|
467
|
+
key: 0,
|
|
468
|
+
class: "data-table__resize-boundaries",
|
|
469
|
+
"data-resizing": a(ze) ? "true" : void 0,
|
|
470
|
+
style: E({
|
|
471
|
+
inlineSize: `${a(lt)}px`,
|
|
472
|
+
blockSize: `${a(nt)}px`
|
|
473
|
+
})
|
|
474
|
+
}, [
|
|
475
|
+
(o(!0), d(z, null, k(a(Ce), (t) => (o(), d("span", {
|
|
476
|
+
key: t.field,
|
|
477
|
+
class: "data-table__resize-boundary",
|
|
478
|
+
"data-vlite-resize-boundary": t.field,
|
|
479
|
+
"data-active": a(Se) === t.field ? "true" : void 0,
|
|
480
|
+
style: E({
|
|
481
|
+
insetInlineStart: `${t.offset - _t / 2}px`
|
|
482
|
+
}),
|
|
483
|
+
role: "separator",
|
|
484
|
+
"aria-orientation": "vertical",
|
|
485
|
+
"aria-label": dt(t.field),
|
|
486
|
+
"aria-valuenow": se(t.field),
|
|
487
|
+
"aria-valuemin": rt(t.field),
|
|
488
|
+
"aria-valuemax": a(Ke),
|
|
489
|
+
"aria-valuetext": se(t.field) != null ? `${se(t.field)}px` : void 0,
|
|
490
|
+
tabindex: "0",
|
|
491
|
+
onPointerdown: (i) => De(t.field, i),
|
|
492
|
+
onClick: l[2] || (l[2] = Le(() => {
|
|
493
|
+
}, ["stop"])),
|
|
494
|
+
onDblclick: Le((i) => a(ae)(t.field), ["stop", "prevent"]),
|
|
495
|
+
onKeydown: (i) => ot(t.field, i)
|
|
496
|
+
}, [...l[11] || (l[11] = [
|
|
497
|
+
f("span", {
|
|
498
|
+
class: "data-table__resize-boundary-line",
|
|
499
|
+
"aria-hidden": "true"
|
|
500
|
+
}, null, -1)
|
|
501
|
+
])], 44, Nt))), 128))
|
|
502
|
+
], 12, Vt)) : D("", !0),
|
|
503
|
+
f("table", {
|
|
504
|
+
ref_key: "tableRef",
|
|
505
|
+
ref: ye,
|
|
506
|
+
class: I([ut.value, "data-table"]),
|
|
507
|
+
style: E(mt.value)
|
|
508
|
+
}, [
|
|
509
|
+
it.value ? (o(), d("colgroup", Ot, [
|
|
510
|
+
p.value ? (o(), d("col", {
|
|
511
|
+
key: 0,
|
|
512
|
+
style: E({ width: `${a(Wt)}px` })
|
|
513
|
+
}, null, 4)) : D("", !0),
|
|
514
|
+
(o(!0), d(z, null, k(J.value, (t) => (o(), d("col", {
|
|
515
|
+
key: "col-" + t.field,
|
|
516
|
+
"data-vlite-col": t.field,
|
|
517
|
+
class: I(Ee(t)),
|
|
518
|
+
style: E(ft(t))
|
|
519
|
+
}, null, 14, Ut))), 128))
|
|
520
|
+
])) : D("", !0),
|
|
521
|
+
f("thead", {
|
|
522
|
+
class: I([
|
|
523
|
+
"[&_tr]:border-b [&_tr]:border-border",
|
|
524
|
+
n.headerVariant === "minimal" ? "bg-transparent" : "bg-accent",
|
|
525
|
+
n.variant === "raised" && n.rounded ? "[&_th:first-child]:rounded-tl-lg [&_th:last-child]:rounded-tr-lg" : ""
|
|
526
|
+
])
|
|
527
|
+
}, [
|
|
528
|
+
f("tr", jt, [
|
|
529
|
+
p.value ? (o(), d("th", Yt, [
|
|
530
|
+
f("div", Xt, [
|
|
531
|
+
V(Rt, {
|
|
532
|
+
"model-value": ee.value,
|
|
533
|
+
indeterminate: he.value,
|
|
534
|
+
disabled: !je.value,
|
|
535
|
+
size: "xs",
|
|
536
|
+
"onUpdate:modelValue": Ge
|
|
537
|
+
}, null, 8, ["model-value", "indeterminate", "disabled"])
|
|
538
|
+
])
|
|
539
|
+
])) : D("", !0),
|
|
540
|
+
(o(!0), d(z, null, k(n.headers, (t) => (o(), ce(Tt, {
|
|
541
|
+
key: t.field,
|
|
542
|
+
header: t,
|
|
543
|
+
"sort-config": B.value,
|
|
544
|
+
compact: n.compact,
|
|
545
|
+
size: n.size,
|
|
546
|
+
"table-sortable": n.sortable,
|
|
547
|
+
"cell-bordered": n.cellBordered,
|
|
548
|
+
resizable: A.value,
|
|
549
|
+
"resize-handle-visible": !n.cellBordered,
|
|
550
|
+
"columns-frozen": a(C),
|
|
551
|
+
"resize-active": a(Se) === t.field,
|
|
552
|
+
"resize-width": a(ne)[t.field] ?? a(Te)(t),
|
|
553
|
+
"resize-min": a(Ie)(t),
|
|
554
|
+
"resize-max": a(Ke),
|
|
555
|
+
"resize-label": Pe(t),
|
|
556
|
+
onSort: Je,
|
|
557
|
+
onResizeStart: (i) => De(t.field, i),
|
|
558
|
+
onResizeKeyboard: (i, c) => st(t.field, i, c),
|
|
559
|
+
onResizeReset: (i) => a(ae)(t.field),
|
|
560
|
+
class: I([
|
|
561
|
+
n.cellBordered ? "" : "last:pr-5!",
|
|
562
|
+
Ee(t),
|
|
563
|
+
a(g) || a(C) ? "min-w-0! max-w-none!" : ""
|
|
564
|
+
]),
|
|
565
|
+
style: E(vt(t))
|
|
566
|
+
}, null, 8, ["header", "sort-config", "compact", "size", "table-sortable", "cell-bordered", "resizable", "resize-handle-visible", "columns-frozen", "resize-active", "resize-width", "resize-min", "resize-max", "resize-label", "onResizeStart", "onResizeKeyboard", "onResizeReset", "class", "style"]))), 128))
|
|
567
|
+
])
|
|
568
|
+
], 2),
|
|
569
|
+
f("tbody", Zt, [
|
|
570
|
+
_.value ? (o(!0), d(z, { key: 0 }, k(Math.min($.value, 15), (t, i, c, m) => {
|
|
571
|
+
const v = [];
|
|
572
|
+
if (m && m.key === "skeleton-" + t && de(m, v)) return m;
|
|
573
|
+
const x = (o(), d("tr", {
|
|
574
|
+
key: "skeleton-" + t,
|
|
575
|
+
class: "border-b border-border/70 bg-background transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"
|
|
576
|
+
}, [
|
|
577
|
+
p.value ? (o(), d("td", qt, [...l[12] || (l[12] = [
|
|
578
|
+
f("div", { class: "flex items-center justify-center" }, [
|
|
579
|
+
f("div", { class: "h-4 w-4 rounded-[4px] bg-muted/50 animate-pulse" })
|
|
580
|
+
], -1)
|
|
581
|
+
])])) : D("", !0),
|
|
582
|
+
(o(!0), d(z, null, k(n.headers, (h) => (o(), d("td", {
|
|
583
|
+
key: h.field,
|
|
584
|
+
class: I(["align-middle", [
|
|
585
|
+
h.hideOnMobile ? "hidden md:table-cell" : "",
|
|
586
|
+
n.cellBordered ? "px-5! py-3!" : "p-5! last:pr-6!"
|
|
587
|
+
]])
|
|
588
|
+
}, [
|
|
589
|
+
f("div", {
|
|
590
|
+
class: "rounded-md bg-muted/50 animate-pulse h-4",
|
|
591
|
+
style: E({ width: `${50 + Math.random() * 40}%` })
|
|
592
|
+
}, null, 4)
|
|
593
|
+
], 2))), 128))
|
|
594
|
+
]));
|
|
595
|
+
return x.memo = v, x;
|
|
596
|
+
}, l, 3), 128)) : a(H).length > 0 ? (o(!0), d(z, { key: 1 }, k(a(H), (t, i, c, m) => {
|
|
597
|
+
const v = [
|
|
598
|
+
t.row,
|
|
599
|
+
u.value.has(t.id),
|
|
600
|
+
Z.value.has(t.id),
|
|
601
|
+
p.value,
|
|
602
|
+
O(t.row),
|
|
603
|
+
n.compact,
|
|
604
|
+
n.size,
|
|
605
|
+
n.striped,
|
|
606
|
+
n.hoverable,
|
|
607
|
+
n.cellBordered,
|
|
608
|
+
a(g),
|
|
609
|
+
t.depth,
|
|
610
|
+
t.isLastSibling,
|
|
611
|
+
t.ancestorLastFlags,
|
|
612
|
+
a(j)(t.id),
|
|
613
|
+
a(Y)(t.id),
|
|
614
|
+
a(U)(t.row),
|
|
615
|
+
n.treeIndent,
|
|
616
|
+
!1,
|
|
617
|
+
a(C),
|
|
618
|
+
A.value
|
|
619
|
+
];
|
|
620
|
+
if (m && m.key === t.id && de(m, v)) return m;
|
|
621
|
+
const x = (o(), ce(He, {
|
|
622
|
+
key: t.id,
|
|
623
|
+
row: t.row,
|
|
624
|
+
headers: n.headers,
|
|
625
|
+
index: t.index,
|
|
626
|
+
"key-field": b.value,
|
|
627
|
+
selectable: p.value,
|
|
628
|
+
"selection-disabled": !O(t.row),
|
|
629
|
+
"is-selected": u.value.has(t.id),
|
|
630
|
+
"is-indeterminate": Z.value.has(t.id),
|
|
631
|
+
hoverable: n.hoverable,
|
|
632
|
+
striped: n.striped,
|
|
633
|
+
compact: n.compact,
|
|
634
|
+
size: n.size,
|
|
635
|
+
"cell-bordered": n.cellBordered,
|
|
636
|
+
"tree-mode": a(g),
|
|
637
|
+
depth: t.depth,
|
|
638
|
+
"tree-indent": n.treeIndent,
|
|
639
|
+
expandable: a(U)(t.row),
|
|
640
|
+
expanded: a(j)(t.id),
|
|
641
|
+
"tree-loading": a(Y)(t.id),
|
|
642
|
+
"is-last-sibling": t.isLastSibling,
|
|
643
|
+
"ancestor-last-flags": t.ancestorLastFlags,
|
|
644
|
+
"columns-frozen": a(C),
|
|
645
|
+
"column-resizing": A.value,
|
|
646
|
+
onSelect: we,
|
|
647
|
+
onRowClick: pe,
|
|
648
|
+
onToggleExpand: (h) => a(be)(t.row, t.depth),
|
|
649
|
+
class: I(n.cellBordered ? "" : "[&_td:last-child]:pr-5!")
|
|
650
|
+
}, q({ _: 2 }, [
|
|
651
|
+
k(n.headers, (h) => ({
|
|
652
|
+
name: h.field,
|
|
653
|
+
fn: G((oe) => [
|
|
654
|
+
M(e.$slots, h.field, ue({ ref_for: !0 }, oe), void 0, !0)
|
|
655
|
+
])
|
|
656
|
+
}))
|
|
657
|
+
]), 1032, ["row", "headers", "index", "key-field", "selectable", "selection-disabled", "is-selected", "is-indeterminate", "hoverable", "striped", "compact", "size", "cell-bordered", "tree-mode", "depth", "tree-indent", "expandable", "expanded", "tree-loading", "is-last-sibling", "ancestor-last-flags", "columns-frozen", "column-resizing", "onToggleExpand", "class"]));
|
|
658
|
+
return x.memo = v, x;
|
|
659
|
+
}, l, 5), 128)) : (o(), d("tr", Gt, [
|
|
660
|
+
f("td", {
|
|
661
|
+
colspan: p.value ? n.headers.length + 1 : n.headers.length,
|
|
662
|
+
class: "align-middle hover:bg-transparent"
|
|
663
|
+
}, [
|
|
664
|
+
M(e.$slots, "empty", {}, () => [
|
|
665
|
+
V(a(Me), {
|
|
666
|
+
title: $e.value,
|
|
667
|
+
description: We.value,
|
|
668
|
+
icon: n.emptyIcon,
|
|
669
|
+
variant: "variant12",
|
|
670
|
+
class: "bg-transparent! py-8!"
|
|
671
|
+
}, q({ _: 2 }, [
|
|
672
|
+
e.$slots["empty-action"] ? {
|
|
673
|
+
name: "action",
|
|
674
|
+
fn: G(() => [
|
|
675
|
+
M(e.$slots, "empty-action", {}, void 0, !0)
|
|
676
|
+
]),
|
|
677
|
+
key: "0"
|
|
678
|
+
} : void 0
|
|
679
|
+
]), 1032, ["title", "description", "icon"])
|
|
680
|
+
], !0)
|
|
681
|
+
], 8, Jt)
|
|
682
|
+
]))
|
|
683
|
+
])
|
|
684
|
+
], 6)
|
|
685
|
+
], 2))
|
|
686
|
+
], 2),
|
|
687
|
+
n.showPagination && n.pageInfo && n.pageInfo.totalPages > 1 ? (o(), d("div", Qt, [
|
|
688
|
+
V(a(It), ue({
|
|
689
|
+
"current-page": W.value,
|
|
690
|
+
"total-pages": n.pageInfo.totalPages,
|
|
691
|
+
"total-items": n.pageInfo.totalItems
|
|
692
|
+
}, n.paginationProps, {
|
|
693
|
+
onChange: Qe,
|
|
694
|
+
"onUpdate:itemsPerPage": _e
|
|
695
|
+
}), null, 16, ["current-page", "total-pages", "total-items"])
|
|
696
|
+
])) : D("", !0),
|
|
697
|
+
V(Ct, {
|
|
698
|
+
show: X.value,
|
|
699
|
+
"onUpdate:show": l[7] || (l[7] = (t) => X.value = t),
|
|
700
|
+
title: bt.value,
|
|
701
|
+
description: gt.value,
|
|
702
|
+
"confirm-text": ht.value,
|
|
703
|
+
"cancel-text": wt.value,
|
|
704
|
+
variant: "danger",
|
|
705
|
+
onConfirm: et,
|
|
706
|
+
onCancel: l[8] || (l[8] = (t) => X.value = !1)
|
|
707
|
+
}, null, 8, ["show", "title", "description", "confirm-text", "cancel-text"])
|
|
708
|
+
]));
|
|
709
|
+
}
|
|
710
|
+
});
|
|
2
711
|
export {
|
|
3
|
-
|
|
712
|
+
gl as default
|
|
4
713
|
};
|