vlite3 1.1.6 → 1.1.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/README.md +1 -0
- package/components/Chart/GaugeChart.vue.d.ts +120 -0
- package/components/Chart/PieChart.vue.d.ts +1 -1
- package/components/Chart/index.d.ts +2 -1
- package/components/Chart/types.d.ts +60 -1
- package/components/DataTable/DataTable.vue.d.ts +1 -0
- package/components/DataTable/DataTable.vue.js +142 -132
- package/components/DataTable/DataTableHeader.vue.d.ts +1 -0
- package/components/DataTable/DataTableHeader.vue.js +17 -16
- package/components/DataTable/DataTableRow.vue.d.ts +1 -0
- package/components/DataTable/DataTableRow.vue.js +29 -25
- package/components/DataTable/types.d.ts +1 -0
- package/components/Dropdown/Dropdown.vue.d.ts +2 -1
- package/components/Dropdown/Dropdown.vue.js +74 -71
- package/components/Dropdown/DropdownMenu.vue.d.ts +3 -0
- package/components/Dropdown/DropdownMenu.vue.js +1 -1
- package/components/Dropdown/DropdownMenu.vue2.js +85 -74
- package/components/Dropdown/DropdownTrigger.vue.js +8 -4
- package/components/MultiSelect/MultiSelect.vue.d.ts +3 -0
- package/components/MultiSelect/MultiSelect.vue.js +82 -78
- package/components/Skeleton/Skeleton.vue.d.ts +30 -0
- package/components/Skeleton/Skeleton.vue.js +215 -0
- package/components/Skeleton/Skeleton.vue2.js +4 -0
- package/components/Skeleton/extract.d.ts +5 -0
- package/components/Skeleton/extract.js +83 -0
- package/components/Skeleton/index.d.ts +4 -0
- package/components/Skeleton/shared.d.ts +14 -0
- package/components/Skeleton/shared.js +29 -0
- package/components/Skeleton/types.d.ts +59 -0
- package/components/Skeleton/types.js +6 -0
- package/index.d.ts +1 -0
- package/index.js +217 -207
- package/package.json +1 -1
- package/style.css +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineComponent as he, inject as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as he, inject as be, computed as r, ref as S, watch as x, openBlock as d, createElementBlock as u, createElementVNode as m, normalizeClass as b, createVNode as T, createCommentVNode as V, Fragment as D, renderList as B, createBlock as M, normalizeStyle as j, isMemoSame as F, createSlots as K, withCtx as U, renderSlot as W, mergeProps as O, unref as L } from "vue";
|
|
2
|
+
import ye from "../CheckBox.vue.js";
|
|
3
3
|
import we from "../ConfirmationModal.vue.js";
|
|
4
|
-
import
|
|
4
|
+
import pe from "../Pagination/Pagination.vue.js";
|
|
5
5
|
import Pe from "../Empty/Empty.vue.js";
|
|
6
6
|
import Ce from "./DataTableHeader.vue.js";
|
|
7
7
|
import ke from "./DataTableRow.vue.js";
|
|
8
|
-
import { $t as
|
|
8
|
+
import { $t as y } from "../../utils/i18n.js";
|
|
9
9
|
import { SCREEN_CONTEXT_KEY as Se } from "./types.js";
|
|
10
|
-
const xe = { class: "space-y-6.5" },
|
|
10
|
+
const xe = { class: "space-y-6.5" }, Be = { class: "overflow-x-auto w-full" }, Ie = { class: "hover:bg-transparent" }, Te = {
|
|
11
11
|
key: 0,
|
|
12
12
|
scope: "col",
|
|
13
13
|
class: "w-[40px] px-0 text-center font-medium text-muted-foreground",
|
|
14
14
|
style: { width: "40px" }
|
|
15
|
-
},
|
|
15
|
+
}, De = { class: "flex items-center justify-center" }, Ee = { class: "[&_tr:last-child]:border-0" }, ze = {
|
|
16
16
|
key: 0,
|
|
17
17
|
class: "w-[48px] px-0 py-4 align-middle text-center",
|
|
18
18
|
style: { width: "48px" }
|
|
@@ -42,6 +42,7 @@ const xe = { class: "space-y-6.5" }, Ie = { class: "overflow-x-auto w-full" }, T
|
|
|
42
42
|
striped: { type: Boolean, default: !1 },
|
|
43
43
|
hoverable: { type: Boolean, default: !0 },
|
|
44
44
|
bordered: { type: Boolean, default: !0 },
|
|
45
|
+
cellBordered: { type: Boolean, default: !1 },
|
|
45
46
|
compact: { type: Boolean, default: !1 },
|
|
46
47
|
tableClass: {},
|
|
47
48
|
class: {},
|
|
@@ -51,146 +52,146 @@ const xe = { class: "space-y-6.5" }, Ie = { class: "overflow-x-auto w-full" }, T
|
|
|
51
52
|
size: { default: "md" }
|
|
52
53
|
},
|
|
53
54
|
emits: ["change", "select", "rowClick", "update:itemsPerPage", "update:selectedRows", "delete"],
|
|
54
|
-
setup(
|
|
55
|
+
setup(a, { emit: Y }) {
|
|
55
56
|
const X = (e, t) => {
|
|
56
57
|
if (!(!e || !t))
|
|
57
|
-
return t.includes(".") ? t.split(".").reduce((l,
|
|
58
|
+
return t.includes(".") ? t.split(".").reduce((l, s) => l?.[s], e) : e[t];
|
|
58
59
|
}, c = (e, t) => X(e, t), q = (e, t) => {
|
|
59
60
|
const l = ["id", "_id"];
|
|
60
61
|
if (t && t !== "auto") return t;
|
|
61
62
|
if (e && e.length > 0) {
|
|
62
|
-
for (const
|
|
63
|
-
if (
|
|
63
|
+
for (const s of l)
|
|
64
|
+
if (s in e[0]) return s;
|
|
64
65
|
}
|
|
65
66
|
return "_id";
|
|
66
|
-
}, G = (e) => e.sortKey || e.field,
|
|
67
|
-
|
|
68
|
-
), h =
|
|
69
|
-
|
|
70
|
-
() =>
|
|
67
|
+
}, G = (e) => e.sortKey || e.field, n = a, g = Y, E = be(Se, null), w = r(() => n.hideSelectable ? !1 : E ? E.forceSelectable : !0), i = r(() => q(n.rows, n.keyField)), v = S({ field: "", order: "" }), p = S(
|
|
68
|
+
n.pageInfo?.itemsPerPage || n.paginationProps?.itemsPerPage || 10
|
|
69
|
+
), h = S(n.pageInfo?.currentPage || 1), I = S(!1), H = r(() => n.loading);
|
|
70
|
+
x(
|
|
71
|
+
() => n.pageInfo?.itemsPerPage,
|
|
71
72
|
(e) => {
|
|
72
|
-
e !== void 0 && (
|
|
73
|
+
e !== void 0 && (p.value = e);
|
|
73
74
|
}
|
|
74
|
-
),
|
|
75
|
-
() =>
|
|
75
|
+
), x(
|
|
76
|
+
() => n.paginationProps?.itemsPerPage,
|
|
76
77
|
(e) => {
|
|
77
|
-
e !== void 0 && (
|
|
78
|
+
e !== void 0 && (p.value = e);
|
|
78
79
|
}
|
|
79
|
-
),
|
|
80
|
-
() =>
|
|
80
|
+
), x(
|
|
81
|
+
() => n.pageInfo?.currentPage,
|
|
81
82
|
(e) => {
|
|
82
83
|
e && (h.value = e);
|
|
83
84
|
}
|
|
84
85
|
);
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
() =>
|
|
86
|
+
const o = S(/* @__PURE__ */ new Set());
|
|
87
|
+
x(
|
|
88
|
+
() => n.selectedRows,
|
|
88
89
|
(e) => {
|
|
89
|
-
const t = new Set((e || []).map((l) => c(l,
|
|
90
|
-
(t.size !==
|
|
90
|
+
const t = new Set((e || []).map((l) => c(l, i.value)));
|
|
91
|
+
(t.size !== o.value.size || [...t].some((l) => !o.value.has(l))) && (o.value = t);
|
|
91
92
|
},
|
|
92
93
|
{ immediate: !0, deep: !0 }
|
|
93
94
|
);
|
|
94
|
-
const z =
|
|
95
|
-
() =>
|
|
96
|
-
), A =
|
|
97
|
-
const e = [...
|
|
98
|
-
return e.forEach((l) => t.set(c(l,
|
|
95
|
+
const z = r(
|
|
96
|
+
() => n.rows.length > 0 && n.rows.every((e) => o.value.has(c(e, i.value)))
|
|
97
|
+
), A = r(() => o.value.size > 0 && !z.value), J = r(() => {
|
|
98
|
+
const e = [...n.selectedRows || [], ...n.rows], t = /* @__PURE__ */ new Map();
|
|
99
|
+
return e.forEach((l) => t.set(c(l, i.value), l)), Array.from(o.value).map((l) => t.get(l)).filter(Boolean);
|
|
99
100
|
}), Q = (e) => {
|
|
100
|
-
const t = new Set(
|
|
101
|
-
e ?
|
|
101
|
+
const t = new Set(o.value);
|
|
102
|
+
e ? n.rows.forEach((l) => t.add(c(l, i.value))) : n.rows.forEach((l) => t.delete(c(l, i.value))), o.value = t, N();
|
|
102
103
|
}, Z = (e) => {
|
|
103
|
-
const t = new Set(
|
|
104
|
-
t.has(e) ? t.delete(e) : t.add(e),
|
|
104
|
+
const t = new Set(o.value);
|
|
105
|
+
t.has(e) ? t.delete(e) : t.add(e), o.value = t, N();
|
|
105
106
|
}, N = () => {
|
|
106
107
|
const e = /* @__PURE__ */ new Set(), t = [];
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
}), (
|
|
111
|
-
const
|
|
112
|
-
!e.has(
|
|
108
|
+
n.rows.forEach((l) => {
|
|
109
|
+
const s = c(l, i.value);
|
|
110
|
+
o.value.has(s) && (t.push(l), e.add(s));
|
|
111
|
+
}), (n.selectedRows || []).forEach((l) => {
|
|
112
|
+
const s = c(l, i.value);
|
|
113
|
+
!e.has(s) && o.value.has(s) && (t.push(l), e.add(s));
|
|
113
114
|
}), g("select", {
|
|
114
115
|
selected: t,
|
|
115
116
|
all: z.value,
|
|
116
117
|
indeterminate: A.value
|
|
117
118
|
}), g("update:selectedRows", t);
|
|
118
119
|
}, _ = (e) => {
|
|
119
|
-
const t =
|
|
120
|
+
const t = n.headers.find((s) => s.field === e), l = t ? G(t) : e;
|
|
120
121
|
v.value.field === l ? v.value.order = v.value.order === "asc" ? "desc" : "asc" : (v.value.field = l, v.value.order = "asc"), h.value = 1, $();
|
|
121
122
|
}, ee = (e) => {
|
|
122
123
|
h.value = e, $();
|
|
123
124
|
}, te = (e) => {
|
|
124
|
-
|
|
125
|
+
p.value = e, h.value = 1, g("update:itemsPerPage", e), $();
|
|
125
126
|
}, le = (e) => g("rowClick", e), ae = () => {
|
|
126
|
-
g("delete", J.value),
|
|
127
|
+
g("delete", J.value), I.value = !1;
|
|
127
128
|
};
|
|
128
129
|
let R = null;
|
|
129
130
|
const $ = () => {
|
|
130
131
|
R && clearTimeout(R), R = setTimeout(() => {
|
|
131
132
|
const e = {
|
|
132
|
-
pagination: { page: h.value, limit:
|
|
133
|
+
pagination: { page: h.value, limit: p.value },
|
|
133
134
|
sort: { ...v.value },
|
|
134
135
|
filter: {}
|
|
135
136
|
};
|
|
136
137
|
g("change", e), E?.onTableChange?.(e);
|
|
137
138
|
}, 10);
|
|
138
139
|
};
|
|
139
|
-
|
|
140
|
-
() =>
|
|
140
|
+
x(
|
|
141
|
+
() => n.rows,
|
|
141
142
|
() => {
|
|
142
|
-
const e = new Set(
|
|
143
|
-
|
|
143
|
+
const e = new Set(n.rows.map((t) => c(t, i.value)));
|
|
144
|
+
o.value = new Set([...o.value].filter((t) => e.has(t)));
|
|
144
145
|
}
|
|
145
146
|
);
|
|
146
|
-
const ne =
|
|
147
|
+
const ne = r(() => [
|
|
147
148
|
"w-full flex flex-col",
|
|
148
|
-
|
|
149
|
+
n.variant === "raised" ? "bg-background shadow-sm p-2 rounded-lg" : "bg-background rounded",
|
|
149
150
|
"overflow-hidden",
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
].join(" ")),
|
|
151
|
+
n.bordered ? "border border-border" : "",
|
|
152
|
+
n.class
|
|
153
|
+
].join(" ")), oe = r(() => ["w-full caption-bottom -text-fs-1", n.cellBordered ? "[&>thead>tr>th:not(:last-child)]:border-r [&>thead>tr>th]:border-border [&>tbody>tr>td:not(:last-child)]:border-r [&>tbody>tr>td]:border-border [&>tbody>tr>th:not(:last-child)]:border-r [&>tbody>tr>th]:border-border" : "", n.tableClass].join(" ")), se = (e) => {
|
|
153
154
|
const t = {};
|
|
154
155
|
return e.width && !/(?:^|\s|:)w-/.test(e.width) && (t.width = e.width), e.minWidth && !/(?:^|\s|:)min-w-/.test(e.minWidth) && (t.minWidth = e.minWidth), t;
|
|
155
|
-
},
|
|
156
|
+
}, re = (e) => {
|
|
156
157
|
const t = [];
|
|
157
158
|
return e.width && /(?:^|\s|:)w-/.test(e.width) && t.push(e.width), e.minWidth && /(?:^|\s|:)min-w-/.test(e.minWidth) && t.push(e.minWidth), t.join(" ");
|
|
158
|
-
},
|
|
159
|
-
() =>
|
|
160
|
-
), de =
|
|
161
|
-
() =>
|
|
162
|
-
), ce =
|
|
163
|
-
const e =
|
|
159
|
+
}, ie = r(
|
|
160
|
+
() => n.emptyTitleI18n ? y(n.emptyTitleI18n) : n.emptyTitle
|
|
161
|
+
), de = r(
|
|
162
|
+
() => n.emptyDescriptionI18n ? y(n.emptyDescriptionI18n) : n.emptyDescription
|
|
163
|
+
), ce = r(() => {
|
|
164
|
+
const e = y("vlite.dataTable.confirmDeleteTitle");
|
|
164
165
|
return e !== "vlite.dataTable.confirmDeleteTitle" ? e : "Confirm Deletion";
|
|
165
|
-
}), ue =
|
|
166
|
-
const e =
|
|
166
|
+
}), ue = r(() => {
|
|
167
|
+
const e = y("vlite.dataTable.confirmDeleteDesc");
|
|
167
168
|
return e !== "vlite.dataTable.confirmDeleteDesc" ? e : "Are you sure you want to delete the selected items?";
|
|
168
|
-
}), me =
|
|
169
|
-
const e =
|
|
169
|
+
}), me = r(() => {
|
|
170
|
+
const e = y("vlite.dataTable.deleteBtn");
|
|
170
171
|
return e !== "vlite.dataTable.deleteBtn" ? e : "Delete";
|
|
171
|
-
}), fe =
|
|
172
|
-
const e =
|
|
172
|
+
}), fe = r(() => {
|
|
173
|
+
const e = y("vlite.dataTable.cancelBtn");
|
|
173
174
|
return e !== "vlite.dataTable.cancelBtn" ? e : "Cancel";
|
|
174
175
|
});
|
|
175
176
|
return (e, t) => (d(), u("div", xe, [
|
|
176
177
|
m("div", {
|
|
177
|
-
class:
|
|
178
|
+
class: b(ne.value)
|
|
178
179
|
}, [
|
|
179
|
-
m("div",
|
|
180
|
+
m("div", Be, [
|
|
180
181
|
m("table", {
|
|
181
|
-
class:
|
|
182
|
+
class: b([oe.value, "data-table"])
|
|
182
183
|
}, [
|
|
183
184
|
m("thead", {
|
|
184
|
-
class:
|
|
185
|
+
class: b([
|
|
185
186
|
"[&_tr]:border-b [&_tr]:border-border",
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
a.headerVariant === "minimal" ? "bg-transparent" : "bg-muted",
|
|
188
|
+
a.variant === "raised" ? "[&_th:first-child]:rounded-tl-lg [&_th:last-child]:rounded-tr-lg" : ""
|
|
188
189
|
])
|
|
189
190
|
}, [
|
|
190
|
-
m("tr",
|
|
191
|
-
|
|
192
|
-
m("div",
|
|
193
|
-
|
|
191
|
+
m("tr", Ie, [
|
|
192
|
+
w.value ? (d(), u("th", Te, [
|
|
193
|
+
m("div", De, [
|
|
194
|
+
T(ye, {
|
|
194
195
|
"model-value": z.value,
|
|
195
196
|
indeterminate: A.value,
|
|
196
197
|
size: "xs",
|
|
@@ -198,35 +199,42 @@ const xe = { class: "space-y-6.5" }, Ie = { class: "overflow-x-auto w-full" }, T
|
|
|
198
199
|
}, null, 8, ["model-value", "indeterminate"])
|
|
199
200
|
])
|
|
200
201
|
])) : V("", !0),
|
|
201
|
-
(d(!0), u(
|
|
202
|
+
(d(!0), u(D, null, B(a.headers, (l) => (d(), M(Ce, {
|
|
202
203
|
key: l.field,
|
|
203
204
|
header: l,
|
|
204
205
|
"sort-config": v.value,
|
|
205
|
-
compact:
|
|
206
|
-
size:
|
|
207
|
-
"table-sortable":
|
|
206
|
+
compact: a.compact,
|
|
207
|
+
size: a.size,
|
|
208
|
+
"table-sortable": a.sortable,
|
|
209
|
+
"cell-bordered": a.cellBordered,
|
|
208
210
|
onSort: _,
|
|
209
|
-
class:
|
|
210
|
-
|
|
211
|
-
|
|
211
|
+
class: b([
|
|
212
|
+
a.cellBordered ? "" : "last:pr-5!",
|
|
213
|
+
re(l)
|
|
214
|
+
]),
|
|
215
|
+
style: j(se(l))
|
|
216
|
+
}, null, 8, ["header", "sort-config", "compact", "size", "table-sortable", "cell-bordered", "class", "style"]))), 128))
|
|
212
217
|
])
|
|
213
218
|
], 2),
|
|
214
219
|
m("tbody", Ee, [
|
|
215
|
-
H.value ? (d(!0), u(
|
|
216
|
-
const
|
|
217
|
-
if (f && f.key === "skeleton-" + l && F(f,
|
|
218
|
-
const
|
|
220
|
+
H.value ? (d(!0), u(D, { key: 0 }, B(Math.min(p.value, 15), (l, s, ve, f) => {
|
|
221
|
+
const P = [];
|
|
222
|
+
if (f && f.key === "skeleton-" + l && F(f, P)) return f;
|
|
223
|
+
const C = (d(), u("tr", {
|
|
219
224
|
key: "skeleton-" + l,
|
|
220
225
|
class: "border-b border-border/70 bg-background transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"
|
|
221
226
|
}, [
|
|
222
|
-
|
|
227
|
+
w.value ? (d(), u("td", ze, [...t[6] || (t[6] = [
|
|
223
228
|
m("div", { class: "flex items-center justify-center" }, [
|
|
224
229
|
m("div", { class: "h-4 w-4 rounded-[4px] bg-muted/50 animate-pulse" })
|
|
225
230
|
], -1)
|
|
226
231
|
])])) : V("", !0),
|
|
227
|
-
(d(!0), u(
|
|
228
|
-
key:
|
|
229
|
-
class:
|
|
232
|
+
(d(!0), u(D, null, B(a.headers, (k) => (d(), u("td", {
|
|
233
|
+
key: k.field,
|
|
234
|
+
class: b(["align-middle", [
|
|
235
|
+
k.hideOnMobile ? "hidden md:table-cell" : "",
|
|
236
|
+
a.cellBordered ? "px-5! py-3!" : "p-5! last:pr-6!"
|
|
237
|
+
]])
|
|
230
238
|
}, [
|
|
231
239
|
m("div", {
|
|
232
240
|
class: "rounded-md bg-muted/50 animate-pulse h-4",
|
|
@@ -234,52 +242,54 @@ const xe = { class: "space-y-6.5" }, Ie = { class: "overflow-x-auto w-full" }, T
|
|
|
234
242
|
}, null, 4)
|
|
235
243
|
], 2))), 128))
|
|
236
244
|
]));
|
|
237
|
-
return
|
|
238
|
-
}, t, 0), 128)) :
|
|
239
|
-
const
|
|
245
|
+
return C.memo = P, C;
|
|
246
|
+
}, t, 0), 128)) : a.rows.length > 0 ? (d(!0), u(D, { key: 1 }, B(a.rows, (l, s, ve, f) => {
|
|
247
|
+
const P = [
|
|
240
248
|
l,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
249
|
+
o.value.has(c(l, i.value)),
|
|
250
|
+
w.value,
|
|
251
|
+
a.compact,
|
|
252
|
+
a.size,
|
|
253
|
+
a.striped,
|
|
254
|
+
a.hoverable,
|
|
255
|
+
a.cellBordered
|
|
247
256
|
];
|
|
248
|
-
if (f && f.key === c(l,
|
|
249
|
-
const
|
|
250
|
-
key: c(l,
|
|
257
|
+
if (f && f.key === c(l, i.value) && F(f, P)) return f;
|
|
258
|
+
const C = (d(), M(ke, {
|
|
259
|
+
key: c(l, i.value),
|
|
251
260
|
row: l,
|
|
252
|
-
headers:
|
|
253
|
-
index:
|
|
254
|
-
"key-field":
|
|
255
|
-
selectable:
|
|
256
|
-
"is-selected":
|
|
257
|
-
hoverable:
|
|
258
|
-
striped:
|
|
259
|
-
compact:
|
|
260
|
-
size:
|
|
261
|
+
headers: a.headers,
|
|
262
|
+
index: s,
|
|
263
|
+
"key-field": i.value,
|
|
264
|
+
selectable: w.value,
|
|
265
|
+
"is-selected": o.value.has(c(l, i.value)),
|
|
266
|
+
hoverable: a.hoverable,
|
|
267
|
+
striped: a.striped,
|
|
268
|
+
compact: a.compact,
|
|
269
|
+
size: a.size,
|
|
270
|
+
"cell-bordered": a.cellBordered,
|
|
261
271
|
onSelect: Z,
|
|
262
272
|
onRowClick: le,
|
|
263
|
-
class: "[&_td:last-child]:pr-3.5!"
|
|
273
|
+
class: b(a.cellBordered ? "" : "[&_td:last-child]:pr-3.5!")
|
|
264
274
|
}, K({ _: 2 }, [
|
|
265
|
-
|
|
266
|
-
name:
|
|
275
|
+
B(a.headers, (k) => ({
|
|
276
|
+
name: k.field,
|
|
267
277
|
fn: U((ge) => [
|
|
268
|
-
W(e.$slots,
|
|
278
|
+
W(e.$slots, k.field, O({ ref_for: !0 }, ge))
|
|
269
279
|
])
|
|
270
280
|
}))
|
|
271
|
-
]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact", "size"]));
|
|
272
|
-
return
|
|
281
|
+
]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact", "size", "cell-bordered", "class"]));
|
|
282
|
+
return C.memo = P, C;
|
|
273
283
|
}, t, 2), 128)) : (d(), u("tr", Re, [
|
|
274
284
|
m("td", {
|
|
275
|
-
colspan:
|
|
285
|
+
colspan: w.value ? a.headers.length + 1 : a.headers.length,
|
|
276
286
|
class: "align-middle hover:bg-transparent"
|
|
277
287
|
}, [
|
|
278
288
|
W(e.$slots, "empty", {}, () => [
|
|
279
|
-
|
|
280
|
-
title:
|
|
289
|
+
T(L(Pe), {
|
|
290
|
+
title: ie.value,
|
|
281
291
|
description: de.value,
|
|
282
|
-
icon:
|
|
292
|
+
icon: a.emptyIcon,
|
|
283
293
|
variant: "variant12",
|
|
284
294
|
class: "bg-transparent! py-8!"
|
|
285
295
|
}, K({ _: 2 }, [
|
|
@@ -298,26 +308,26 @@ const xe = { class: "space-y-6.5" }, Ie = { class: "overflow-x-auto w-full" }, T
|
|
|
298
308
|
], 2)
|
|
299
309
|
])
|
|
300
310
|
], 2),
|
|
301
|
-
|
|
302
|
-
|
|
311
|
+
a.showPagination && a.pageInfo && a.pageInfo.totalPages > 1 ? (d(), u("div", Ve, [
|
|
312
|
+
T(L(pe), O({
|
|
303
313
|
"current-page": h.value,
|
|
304
|
-
"total-pages":
|
|
305
|
-
"total-items":
|
|
306
|
-
},
|
|
314
|
+
"total-pages": a.pageInfo.totalPages,
|
|
315
|
+
"total-items": a.pageInfo.totalItems
|
|
316
|
+
}, a.paginationProps, {
|
|
307
317
|
onChange: ee,
|
|
308
318
|
"onUpdate:itemsPerPage": te
|
|
309
319
|
}), null, 16, ["current-page", "total-pages", "total-items"])
|
|
310
320
|
])) : V("", !0),
|
|
311
|
-
|
|
312
|
-
show:
|
|
313
|
-
"onUpdate:show": t[4] || (t[4] = (l) =>
|
|
321
|
+
T(we, {
|
|
322
|
+
show: I.value,
|
|
323
|
+
"onUpdate:show": t[4] || (t[4] = (l) => I.value = l),
|
|
314
324
|
title: ce.value,
|
|
315
325
|
description: ue.value,
|
|
316
326
|
"confirm-text": me.value,
|
|
317
327
|
"cancel-text": fe.value,
|
|
318
328
|
variant: "danger",
|
|
319
329
|
onConfirm: ae,
|
|
320
|
-
onCancel: t[5] || (t[5] = (l) =>
|
|
330
|
+
onCancel: t[5] || (t[5] = (l) => I.value = !1)
|
|
321
331
|
}, null, 8, ["show", "title", "description", "confirm-text", "cancel-text"])
|
|
322
332
|
]));
|
|
323
333
|
}
|
|
@@ -5,6 +5,7 @@ interface Props {
|
|
|
5
5
|
compact?: boolean;
|
|
6
6
|
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
7
7
|
tableSortable?: boolean;
|
|
8
|
+
cellBordered?: boolean;
|
|
8
9
|
}
|
|
9
10
|
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
10
11
|
sort: (field: string) => any;
|
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
import { defineComponent as x, computed as r, openBlock as
|
|
1
|
+
import { defineComponent as x, computed as r, openBlock as l, createElementBlock as n, normalizeClass as o, createElementVNode as s, toDisplayString as y, createVNode as b, createCommentVNode as v } from "vue";
|
|
2
2
|
import C from "../Icon.vue.js";
|
|
3
3
|
import { $t as w } from "../../utils/i18n.js";
|
|
4
|
-
const
|
|
4
|
+
const B = { class: "text-xs font-bold! uppercase tracking-wider text-gray-900 truncate" }, S = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "w-4 h-4 shrink-0"
|
|
7
|
-
},
|
|
7
|
+
}, I = /* @__PURE__ */ x({
|
|
8
8
|
__name: "DataTableHeader",
|
|
9
9
|
props: {
|
|
10
10
|
header: {},
|
|
11
11
|
sortConfig: {},
|
|
12
12
|
compact: { type: Boolean, default: !1 },
|
|
13
13
|
size: { default: "md" },
|
|
14
|
-
tableSortable: { type: Boolean, default: !0 }
|
|
14
|
+
tableSortable: { type: Boolean, default: !0 },
|
|
15
|
+
cellBordered: { type: Boolean }
|
|
15
16
|
},
|
|
16
17
|
emits: ["sort"],
|
|
17
18
|
setup(t, { emit: i }) {
|
|
18
|
-
const e = t,
|
|
19
|
+
const e = t, d = i, a = r(() => e.header.sortKey || e.header.field), c = r(
|
|
19
20
|
() => e.sortConfig?.field === a.value && e.sortConfig?.order
|
|
20
21
|
), u = r(() => !e.sortConfig || e.sortConfig.field !== a.value ? "lucide:chevrons-up-down" : e.sortConfig.order === "asc" ? "lucide:arrow-up" : e.sortConfig.order === "desc" ? "lucide:arrow-down" : "lucide:chevrons-up-down"), f = () => {
|
|
21
|
-
e.tableSortable && e.header.sortable !== !1 &&
|
|
22
|
-
},
|
|
22
|
+
e.tableSortable && e.header.sortable !== !1 && d("sort", e.header.field);
|
|
23
|
+
}, p = r(() => ({
|
|
23
24
|
left: "justify-start text-left",
|
|
24
25
|
center: "justify-center text-center",
|
|
25
26
|
right: "justify-end text-right"
|
|
26
|
-
})[e.header.align || "left"]),
|
|
27
|
+
})[e.header.align || "left"]), h = r(
|
|
27
28
|
() => e.header.titleI18n ? w(e.header.titleI18n) : e.header.title
|
|
28
|
-
),
|
|
29
|
-
return (g,
|
|
29
|
+
), m = r(() => e.size === "xs" || e.compact ? `py-1.5! ${e.cellBordered ? "px-3!" : ""}` : e.size === "sm" ? `py-2! ${e.cellBordered ? "px-3!" : ""}` : e.size === "lg" ? `py-4! ${e.cellBordered ? "px-4!" : ""}` : `py-3! ${e.cellBordered ? "px-3.5!" : ""}`);
|
|
30
|
+
return (g, k) => (l(), n("th", {
|
|
30
31
|
scope: "col",
|
|
31
32
|
class: o(["group/th px-3 text-left align-middle font-medium text-muted-foreground transition-colors [&:has([role=checkbox])]:pr-0 overflow-hidden max-w-[400px]", [
|
|
32
|
-
|
|
33
|
+
m.value,
|
|
33
34
|
t.header.sortable !== !1 && t.tableSortable ? "cursor-pointer hover:bg-muted/50" : "",
|
|
34
35
|
t.header.hideOnMobile ? "hidden md:table-cell" : ""
|
|
35
36
|
]]),
|
|
36
37
|
onClick: f
|
|
37
38
|
}, [
|
|
38
39
|
s("div", {
|
|
39
|
-
class: o(["flex items-center gap-2 space-x-2",
|
|
40
|
+
class: o(["flex items-center gap-2 space-x-2", p.value])
|
|
40
41
|
}, [
|
|
41
|
-
s("span",
|
|
42
|
-
t.tableSortable && t.header.sortable !== !1 ? (
|
|
42
|
+
s("span", B, y(h.value), 1),
|
|
43
|
+
t.tableSortable && t.header.sortable !== !1 ? (l(), n("span", S, [
|
|
43
44
|
b(C, {
|
|
44
45
|
icon: u.value,
|
|
45
46
|
class: o(["w-3.5 h-3.5 transition-all text-muted-foreground mt-0.5", [
|
|
46
|
-
|
|
47
|
+
c.value ? "opacity-100 text-foreground" : "opacity-0 group-hover/th:opacity-100"
|
|
47
48
|
]])
|
|
48
49
|
}, null, 8, ["icon", "class"])
|
|
49
50
|
])) : v("", !0)
|
|
@@ -52,5 +53,5 @@ const S = { class: "text-xs font-bold! uppercase tracking-wider text-gray-900 tr
|
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
55
|
export {
|
|
55
|
-
|
|
56
|
+
I as default
|
|
56
57
|
};
|