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