vlite3 0.1.3 → 0.1.6
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/Button.vue.js +8 -8
- package/components/DataTable/DataTable.vue.d.ts +4 -1
- package/components/DataTable/DataTable.vue.js +3 -3
- package/components/DataTable/DataTable.vue2.js +165 -161
- package/components/DataTable/DataTableHeader.vue.d.ts +2 -0
- package/components/DataTable/DataTableHeader.vue.js +15 -14
- package/components/DataTable/DataTableRow.vue.js +1 -1
- package/components/DataTable/types.d.ts +4 -1
- package/components/FilePicker/FilePicker.vue.js +3 -3
- package/components/Form/Form.vue.js +2 -2
- package/components/Form/Form.vue2.js +68 -64
- package/components/Form/FormField.vue.js +21 -30
- package/components/Input.vue.js +1 -1
- package/components/Modal.vue.js +6 -6
- package/components/Navbar/Navbar.vue.d.ts +1 -0
- package/components/Navbar/Navbar.vue.js +152 -103
- package/components/Navbar/NavbarItem.vue.js +65 -57
- package/components/SidebarMenu/SidebarMenu.vue.js +12 -12
- package/components/SidebarMenu/SidebarMenuItem.vue.js +20 -20
- package/components/Workbook/Sheet.vue.d.ts +2 -0
- package/components/Workbook/Sheet.vue.js +57 -48
- package/components/Workbook/Workbook.vue.d.ts +1 -0
- package/components/Workbook/Workbook.vue.js +2 -2
- package/components/Workbook/Workbook.vue2.js +49 -47
- package/components/Workbook/types.d.ts +1 -0
- package/composables/useKeyStroke.js +32 -31
- package/package.json +1 -1
- package/router/index.d.ts +2 -0
- package/style.css +12 -9
- package/types/navbar.type.d.ts +1 -0
package/components/Button.vue.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as v, useSlots as x, computed as s, withDirectives as y, openBlock as r, createElementBlock as w, normalizeClass as i, createBlock as a, createCommentVNode as u, renderSlot as p, createTextVNode as k, toDisplayString as z, unref as B } from "vue";
|
|
2
|
-
import
|
|
2
|
+
import c from "./Icon.vue.js";
|
|
3
3
|
import { vRipple as C } from "../directives/vRipple.js";
|
|
4
4
|
const R = ["type", "disabled"], D = /* @__PURE__ */ v({
|
|
5
5
|
__name: "Button",
|
|
@@ -16,8 +16,8 @@ const R = ["type", "disabled"], D = /* @__PURE__ */ v({
|
|
|
16
16
|
rounded: { default: "md" }
|
|
17
17
|
},
|
|
18
18
|
setup(e) {
|
|
19
|
-
const t = e, g = x(),
|
|
20
|
-
const n = "inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background
|
|
19
|
+
const t = e, g = x(), l = s(() => t.icon && !t.text && !g.default), h = s(() => {
|
|
20
|
+
const n = "inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 active:scale-95 cursor-pointer gap-2", d = {
|
|
21
21
|
primary: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
22
22
|
"primary-light": "bg-primary-light text-primary-fg-light hover:bg-primary/20",
|
|
23
23
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
@@ -62,7 +62,7 @@ const R = ["type", "disabled"], D = /* @__PURE__ */ v({
|
|
|
62
62
|
n,
|
|
63
63
|
d[t.variant],
|
|
64
64
|
m[t.rounded],
|
|
65
|
-
|
|
65
|
+
l.value ? b[t.size] : f[t.size],
|
|
66
66
|
t.class
|
|
67
67
|
].join(" ");
|
|
68
68
|
}), o = s(() => ({
|
|
@@ -77,22 +77,22 @@ const R = ["type", "disabled"], D = /* @__PURE__ */ v({
|
|
|
77
77
|
class: i(h.value),
|
|
78
78
|
disabled: e.disabled || e.loading
|
|
79
79
|
}, [
|
|
80
|
-
e.loading ? (r(), a(
|
|
80
|
+
e.loading ? (r(), a(c, {
|
|
81
81
|
key: 0,
|
|
82
82
|
icon: "lucide:loader-2",
|
|
83
83
|
class: i(["animate-spin", { [o.value]: !0 }])
|
|
84
|
-
}, null, 8, ["class"])) : e.icon ? (r(), a(
|
|
84
|
+
}, null, 8, ["class"])) : e.icon ? (r(), a(c, {
|
|
85
85
|
key: 1,
|
|
86
86
|
icon: e.icon,
|
|
87
87
|
class: i({
|
|
88
|
-
"mx-auto":
|
|
88
|
+
"mx-auto": l.value,
|
|
89
89
|
[o.value]: !0
|
|
90
90
|
})
|
|
91
91
|
}, null, 8, ["icon", "class"])) : u("", !0),
|
|
92
92
|
p(n.$slots, "default", {}, () => [
|
|
93
93
|
k(z(e.text), 1)
|
|
94
94
|
]),
|
|
95
|
-
e.iconRight && !e.loading ? (r(), a(
|
|
95
|
+
e.iconRight && !e.loading ? (r(), a(c, {
|
|
96
96
|
key: 2,
|
|
97
97
|
icon: e.iconRight,
|
|
98
98
|
class: i([o.value, "h-4 w-4"])
|
|
@@ -32,10 +32,10 @@ declare const __VLS_component: import('vue').DefineComponent<DataTableProps, {},
|
|
|
32
32
|
"onUpdate:selectedRows"?: (value: any[]) => any;
|
|
33
33
|
}>, {
|
|
34
34
|
search: string;
|
|
35
|
+
variant: "default" | "raised";
|
|
35
36
|
loading: boolean;
|
|
36
37
|
rows: any[];
|
|
37
38
|
selectable: boolean;
|
|
38
|
-
emptyMessage: string;
|
|
39
39
|
showSearch: boolean;
|
|
40
40
|
showItemsPerPage: boolean;
|
|
41
41
|
itemsPerPage: number;
|
|
@@ -47,9 +47,12 @@ declare const __VLS_component: import('vue').DefineComponent<DataTableProps, {},
|
|
|
47
47
|
striped: boolean;
|
|
48
48
|
selectedRows: any[];
|
|
49
49
|
searchPlaceholder: string;
|
|
50
|
+
emptyTitle: string;
|
|
51
|
+
emptyDescription: string;
|
|
50
52
|
emptyIcon: string;
|
|
51
53
|
showPagination: boolean;
|
|
52
54
|
bordered: boolean;
|
|
55
|
+
sortable: boolean;
|
|
53
56
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
54
57
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
55
58
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from "./DataTable.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const m = /* @__PURE__ */ o
|
|
3
|
+
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-896cd72f"]]);
|
|
5
5
|
export {
|
|
6
6
|
m as default
|
|
7
7
|
};
|
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as ee, ref as g, computed as b, watch as p, onMounted as te, openBlock as r, createElementBlock as d, createVNode as C, createSlots as V, withCtx as T, renderSlot as S, createBlock as D, createCommentVNode as I, createElementVNode as n, normalizeClass as B, Fragment as R, renderList as $, normalizeStyle as A, mergeProps as le, toDisplayString as M, createTextVNode as ae, unref as se } from "vue";
|
|
2
2
|
import oe from "../Icon.vue.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import re from "../CheckBox.vue.js";
|
|
4
|
+
import ne from "../Button.vue.js";
|
|
5
|
+
import de from "../ConfirmationModal.vue.js";
|
|
6
|
+
import ie from "../Pagination/Pagination.vue.js";
|
|
7
7
|
import ue from "./DataTableHeader.vue.js";
|
|
8
8
|
import ce from "./DataTableRow.vue.js";
|
|
9
9
|
import me from "./DataTableToolbar.vue.js";
|
|
10
|
-
const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve = {
|
|
11
|
-
key: 0,
|
|
12
|
-
style: { width: "48px" }
|
|
13
|
-
}, ge = { class: "[&_tr]:border-b [&_tr]:border-border/70! bg-muted" }, pe = { class: "hover:bg-transparent" }, we = {
|
|
10
|
+
const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve = { class: "hover:bg-transparent" }, ge = {
|
|
14
11
|
key: 0,
|
|
15
12
|
scope: "col",
|
|
16
13
|
class: "w-[48px] px-0 text-center font-medium text-muted-foreground",
|
|
17
14
|
style: { width: "48px" }
|
|
18
|
-
},
|
|
15
|
+
}, pe = { class: "flex items-center justify-center" }, we = { class: "[&_tr:last-child]:border-0" }, ye = {
|
|
19
16
|
key: 0,
|
|
20
17
|
class: "w-[48px] px-0 py-4 align-middle text-center",
|
|
21
18
|
style: { width: "48px" }
|
|
22
|
-
},
|
|
19
|
+
}, be = { key: 2 }, ke = ["colspan"], Pe = { class: "flex flex-col items-center justify-center gap-2 text-muted-foreground p-8" }, xe = { class: "flex h-12 w-12 items-center justify-center rounded-full bg-muted" }, Ce = { class: "mt-1 text-base font-semibold text-foreground" }, Se = { class: "text-sm max-w-sm mx-auto" }, Ie = {
|
|
23
20
|
key: 0,
|
|
24
21
|
class: "mt-4"
|
|
25
|
-
},
|
|
22
|
+
}, $e = { key: 0 }, Ve = /* @__PURE__ */ ee({
|
|
26
23
|
__name: "DataTable",
|
|
27
24
|
props: {
|
|
28
25
|
rows: { default: () => [] },
|
|
@@ -34,7 +31,8 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
|
|
|
34
31
|
keyField: { default: "_id" },
|
|
35
32
|
loading: { type: Boolean, default: !1 },
|
|
36
33
|
selectable: { type: Boolean, default: !1 },
|
|
37
|
-
|
|
34
|
+
emptyTitle: { default: "No data available" },
|
|
35
|
+
emptyDescription: { default: "No results found. Try adjusting your filters or search terms." },
|
|
38
36
|
emptyIcon: { default: "lucide:inbox" },
|
|
39
37
|
showPagination: { type: Boolean, default: !0 },
|
|
40
38
|
pageInfo: {},
|
|
@@ -46,18 +44,20 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
|
|
|
46
44
|
bordered: { type: Boolean, default: !0 },
|
|
47
45
|
compact: { type: Boolean, default: !1 },
|
|
48
46
|
tableClass: {},
|
|
49
|
-
class: {}
|
|
47
|
+
class: {},
|
|
48
|
+
sortable: { type: Boolean, default: !1 },
|
|
49
|
+
variant: { default: "default" }
|
|
50
50
|
},
|
|
51
51
|
emits: ["change", "select", "rowClick", "update:itemsPerPage", "update:selectedRows", "delete"],
|
|
52
|
-
setup(
|
|
53
|
-
const
|
|
52
|
+
setup(a, { emit: U }) {
|
|
53
|
+
const O = (e, t) => t.split(".").reduce((s, c) => s?.[c], e), u = (e, t) => O(e, t), l = a, w = U, i = g({ field: "", order: "" }), k = g(l.itemsPerPage), h = g(l.pageInfo?.currentPage || 1), y = g(l.search || ""), P = g(!1), v = g("initial"), L = b(() => l.loading && (v.value === "initial" || v.value === "page"));
|
|
54
54
|
p(
|
|
55
|
-
() =>
|
|
55
|
+
() => l.loading,
|
|
56
56
|
(e, t) => {
|
|
57
57
|
!e && t && (v.value = "idle");
|
|
58
58
|
}
|
|
59
59
|
), p(
|
|
60
|
-
() =>
|
|
60
|
+
() => l.search,
|
|
61
61
|
(e) => {
|
|
62
62
|
e !== void 0 && e !== y.value && (y.value = e);
|
|
63
63
|
}
|
|
@@ -65,246 +65,250 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
|
|
|
65
65
|
let F = null;
|
|
66
66
|
p(y, (e) => {
|
|
67
67
|
F && clearTimeout(F), F = setTimeout(() => {
|
|
68
|
-
h.value = 1, v.value = "search",
|
|
68
|
+
h.value = 1, v.value = "search", x();
|
|
69
69
|
}, 300);
|
|
70
70
|
}), p(
|
|
71
|
-
() =>
|
|
71
|
+
() => l.itemsPerPage,
|
|
72
72
|
(e) => {
|
|
73
|
-
|
|
73
|
+
k.value = e;
|
|
74
74
|
}
|
|
75
75
|
), p(
|
|
76
|
-
() =>
|
|
76
|
+
() => l.pageInfo?.currentPage,
|
|
77
77
|
(e) => {
|
|
78
78
|
e && (h.value = e);
|
|
79
79
|
}
|
|
80
80
|
);
|
|
81
|
-
const
|
|
81
|
+
const j = (e) => u(e, l.keyField), o = g(/* @__PURE__ */ new Set());
|
|
82
82
|
p(
|
|
83
|
-
() =>
|
|
83
|
+
() => l.selectedRows,
|
|
84
84
|
(e) => {
|
|
85
|
-
const t = new Set((e || []).map((
|
|
86
|
-
(t.size !== o.value.size || [...t].some((
|
|
85
|
+
const t = new Set((e || []).map((s) => u(s, l.keyField)));
|
|
86
|
+
(t.size !== o.value.size || [...t].some((s) => !o.value.has(s))) && (o.value = t);
|
|
87
87
|
},
|
|
88
88
|
{ immediate: !0, deep: !0 }
|
|
89
89
|
);
|
|
90
|
-
const
|
|
91
|
-
const e = [...
|
|
92
|
-
return e.forEach((
|
|
93
|
-
}),
|
|
94
|
-
e ?
|
|
95
|
-
},
|
|
96
|
-
o.value.has(e) ? o.value.delete(e) : o.value.add(e),
|
|
97
|
-
},
|
|
98
|
-
const e =
|
|
99
|
-
|
|
100
|
-
const f = u(m,
|
|
101
|
-
o.value.has(f) && (
|
|
90
|
+
const z = b(() => l.rows.length === 0 ? !1 : l.rows.every((e) => o.value.has(u(e, l.keyField)))), E = b(() => o.value.size > 0 && !z.value), W = b(() => {
|
|
91
|
+
const e = [...l.selectedRows || [], ...l.rows], t = /* @__PURE__ */ new Map();
|
|
92
|
+
return e.forEach((s) => t.set(u(s, l.keyField), s)), Array.from(o.value).map((s) => t.get(s)).filter(Boolean);
|
|
93
|
+
}), q = (e) => {
|
|
94
|
+
e ? l.rows.forEach((t) => o.value.add(u(t, l.keyField))) : o.value.size > 0 && l.rows.forEach((t) => o.value.delete(u(t, l.keyField))), N();
|
|
95
|
+
}, G = (e) => {
|
|
96
|
+
o.value.has(e) ? o.value.delete(e) : o.value.add(e), N();
|
|
97
|
+
}, N = () => {
|
|
98
|
+
const e = l.selectedRows || [], t = /* @__PURE__ */ new Set(), s = [];
|
|
99
|
+
l.rows.forEach((m) => {
|
|
100
|
+
const f = u(m, l.keyField);
|
|
101
|
+
o.value.has(f) && (s.push(m), t.add(f));
|
|
102
102
|
}), e.forEach((m) => {
|
|
103
|
-
const f = u(m,
|
|
104
|
-
!t.has(f) && o.value.has(f) && (
|
|
103
|
+
const f = u(m, l.keyField);
|
|
104
|
+
!t.has(f) && o.value.has(f) && (s.push(m), t.add(f));
|
|
105
105
|
});
|
|
106
106
|
const c = {
|
|
107
|
-
selected:
|
|
108
|
-
all:
|
|
109
|
-
indeterminate:
|
|
107
|
+
selected: s,
|
|
108
|
+
all: z.value,
|
|
109
|
+
indeterminate: E.value
|
|
110
110
|
};
|
|
111
|
-
w("select", c), w("update:selectedRows",
|
|
112
|
-
}, G = (e) => {
|
|
113
|
-
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"), h.value = 1, v.value = "sort", S();
|
|
111
|
+
w("select", c), w("update:selectedRows", s);
|
|
114
112
|
}, H = (e) => {
|
|
115
|
-
|
|
113
|
+
i.value.field === e ? i.value.order === "asc" ? i.value.order = "desc" : i.value.order === "desc" ? (i.value.order = "", i.value.field = "") : i.value.order = "asc" : (i.value.field = e, i.value.order = "asc"), h.value = 1, v.value = "sort", x();
|
|
116
114
|
}, J = (e) => {
|
|
117
|
-
|
|
115
|
+
h.value = e, v.value = "page", x();
|
|
118
116
|
}, K = (e) => {
|
|
117
|
+
k.value = e, h.value = 1, v.value = "limit", w("update:itemsPerPage", e), x();
|
|
118
|
+
}, Q = (e) => {
|
|
119
119
|
w("rowClick", e);
|
|
120
|
-
},
|
|
121
|
-
const e =
|
|
122
|
-
w("delete", e),
|
|
123
|
-
},
|
|
120
|
+
}, X = () => {
|
|
121
|
+
const e = W.value;
|
|
122
|
+
w("delete", e), P.value = !1;
|
|
123
|
+
}, x = () => {
|
|
124
124
|
w("change", {
|
|
125
125
|
pagination: {
|
|
126
126
|
page: h.value,
|
|
127
|
-
limit:
|
|
127
|
+
limit: k.value
|
|
128
128
|
},
|
|
129
|
-
sorting: { ...
|
|
129
|
+
sorting: { ...i.value },
|
|
130
130
|
search: y.value
|
|
131
131
|
});
|
|
132
|
-
},
|
|
133
|
-
"w-full
|
|
132
|
+
}, Y = b(() => [
|
|
133
|
+
"w-full flex flex-col",
|
|
134
|
+
l.variant === "raised" ? "bg-background shadow-sm p-2 rounded-lg" : "bg-background rounded",
|
|
134
135
|
"overflow-hidden",
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
l.bordered ? "border border-border/60" : "",
|
|
137
|
+
l.class
|
|
138
|
+
].join(" ")), Z = b(() => ["w-full caption-bottom text-sm", l.tableClass].join(" ")), _ = (e) => e.width ? e.width : "auto";
|
|
137
139
|
return p(
|
|
138
|
-
() =>
|
|
140
|
+
() => l.rows,
|
|
139
141
|
() => {
|
|
140
|
-
const e = new Set(
|
|
142
|
+
const e = new Set(l.rows.map((t) => u(t, l.keyField)));
|
|
141
143
|
o.value = new Set([...o.value].filter((t) => e.has(t)));
|
|
142
144
|
}
|
|
143
|
-
),
|
|
144
|
-
|
|
145
|
-
}), (e, t) => (
|
|
146
|
-
|
|
145
|
+
), te(() => {
|
|
146
|
+
x();
|
|
147
|
+
}), (e, t) => (r(), d("div", fe, [
|
|
148
|
+
C(me, {
|
|
147
149
|
modelValue: y.value,
|
|
148
|
-
"onUpdate:modelValue": t[1] || (t[1] = (
|
|
149
|
-
"show-search":
|
|
150
|
-
placeholder:
|
|
150
|
+
"onUpdate:modelValue": t[1] || (t[1] = (s) => y.value = s),
|
|
151
|
+
"show-search": a.showSearch,
|
|
152
|
+
placeholder: a.searchPlaceholder
|
|
151
153
|
}, V({ _: 2 }, [
|
|
152
154
|
e.$slots?.["toolbar-left"] ? {
|
|
153
155
|
name: "left",
|
|
154
|
-
fn:
|
|
155
|
-
|
|
156
|
+
fn: T(() => [
|
|
157
|
+
S(e.$slots, "toolbar-left", {}, void 0, !0)
|
|
156
158
|
]),
|
|
157
159
|
key: "0"
|
|
158
160
|
} : void 0,
|
|
159
161
|
e.$slots?.["toolbar-right"] || o.value.size > 0 ? {
|
|
160
162
|
name: "right",
|
|
161
|
-
fn:
|
|
162
|
-
o.value.size > 0 ? (
|
|
163
|
+
fn: T(() => [
|
|
164
|
+
o.value.size > 0 ? (r(), D(ne, {
|
|
163
165
|
key: 0,
|
|
164
166
|
rounded: "full",
|
|
165
167
|
variant: "ghost",
|
|
166
168
|
icon: "lucide:trash-2",
|
|
167
169
|
class: "text-destructive! bg-destructive/10 hover:bg-destructive/15",
|
|
168
|
-
onClick: t[0] || (t[0] = (
|
|
169
|
-
})) :
|
|
170
|
-
|
|
170
|
+
onClick: t[0] || (t[0] = (s) => P.value = !0)
|
|
171
|
+
})) : I("", !0),
|
|
172
|
+
S(e.$slots, "toolbar-right", {}, void 0, !0)
|
|
171
173
|
]),
|
|
172
174
|
key: "1"
|
|
173
175
|
} : void 0
|
|
174
176
|
]), 1032, ["modelValue", "show-search", "placeholder"]),
|
|
175
|
-
|
|
176
|
-
class:
|
|
177
|
+
n("div", {
|
|
178
|
+
class: B(Y.value)
|
|
177
179
|
}, [
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
class:
|
|
180
|
+
n("div", he, [
|
|
181
|
+
n("table", {
|
|
182
|
+
class: B([Z.value, ""])
|
|
181
183
|
}, [
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
r("div", ye, [
|
|
195
|
-
$(ne, {
|
|
196
|
-
"model-value": R.value,
|
|
197
|
-
indeterminate: N.value,
|
|
184
|
+
n("thead", {
|
|
185
|
+
class: B([
|
|
186
|
+
"[&_tr]:border-b [&_tr]:border-border/70! bg-muted",
|
|
187
|
+
a.variant === "raised" ? "[&_th:first-child]:rounded-tl-lg [&_th:last-child]:rounded-tr-lg" : ""
|
|
188
|
+
])
|
|
189
|
+
}, [
|
|
190
|
+
n("tr", ve, [
|
|
191
|
+
a.selectable ? (r(), d("th", ge, [
|
|
192
|
+
n("div", pe, [
|
|
193
|
+
C(re, {
|
|
194
|
+
"model-value": z.value,
|
|
195
|
+
indeterminate: E.value,
|
|
198
196
|
size: "xs",
|
|
199
|
-
"onUpdate:modelValue":
|
|
197
|
+
"onUpdate:modelValue": q
|
|
200
198
|
}, null, 8, ["model-value", "indeterminate"])
|
|
201
199
|
])
|
|
202
|
-
])) :
|
|
203
|
-
(
|
|
204
|
-
key:
|
|
205
|
-
header:
|
|
206
|
-
"sort-config":
|
|
207
|
-
compact:
|
|
208
|
-
|
|
209
|
-
|
|
200
|
+
])) : I("", !0),
|
|
201
|
+
(r(!0), d(R, null, $(a.headers, (s) => (r(), D(ue, {
|
|
202
|
+
key: s.field,
|
|
203
|
+
header: s,
|
|
204
|
+
"sort-config": i.value,
|
|
205
|
+
compact: a.compact,
|
|
206
|
+
"table-sortable": a.sortable,
|
|
207
|
+
onSort: H,
|
|
208
|
+
class: "last:pr-5!",
|
|
209
|
+
style: A({
|
|
210
|
+
width: _(s)
|
|
211
|
+
})
|
|
212
|
+
}, null, 8, ["header", "sort-config", "compact", "table-sortable", "style"]))), 128))
|
|
210
213
|
])
|
|
211
|
-
]),
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
key: "skeleton-" +
|
|
214
|
+
], 2),
|
|
215
|
+
n("tbody", we, [
|
|
216
|
+
L.value ? (r(!0), d(R, { key: 0 }, $(Math.min(k.value, 15), (s) => (r(), d("tr", {
|
|
217
|
+
key: "skeleton-" + s,
|
|
215
218
|
class: "border-b border-border/50 bg-background transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"
|
|
216
219
|
}, [
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
+
a.selectable ? (r(), d("td", ye, [...t[4] || (t[4] = [
|
|
221
|
+
n("div", { class: "flex items-center justify-center" }, [
|
|
222
|
+
n("div", { class: "h-4 w-4 rounded-[4px] bg-muted/50 animate-pulse" })
|
|
220
223
|
], -1)
|
|
221
|
-
])])) :
|
|
222
|
-
(
|
|
224
|
+
])])) : I("", !0),
|
|
225
|
+
(r(!0), d(R, null, $(a.headers, (c) => (r(), d("td", {
|
|
223
226
|
key: c.field,
|
|
224
|
-
class:
|
|
227
|
+
class: B(["p-5! align-middle last:pr-6!", [c.hideOnMobile ? "hidden md:table-cell" : ""]])
|
|
225
228
|
}, [
|
|
226
|
-
|
|
229
|
+
n("div", {
|
|
227
230
|
class: "rounded-md bg-muted/50 animate-pulse h-4 w-full",
|
|
228
|
-
style:
|
|
231
|
+
style: A({
|
|
229
232
|
width: `${50 + Math.random() * 40}%`
|
|
230
233
|
})
|
|
231
234
|
}, null, 4)
|
|
232
235
|
], 2))), 128))
|
|
233
|
-
]))), 128)) :
|
|
234
|
-
key:
|
|
235
|
-
row:
|
|
236
|
-
headers:
|
|
236
|
+
]))), 128)) : a.rows.length > 0 ? (r(!0), d(R, { key: 1 }, $(a.rows, (s, c) => (r(), D(ce, {
|
|
237
|
+
key: j(s),
|
|
238
|
+
row: s,
|
|
239
|
+
headers: a.headers,
|
|
237
240
|
index: c,
|
|
238
|
-
"key-field":
|
|
239
|
-
selectable:
|
|
240
|
-
"is-selected": o.value.has(
|
|
241
|
-
hoverable:
|
|
242
|
-
striped:
|
|
243
|
-
compact:
|
|
244
|
-
onSelect:
|
|
245
|
-
onRowClick:
|
|
241
|
+
"key-field": a.keyField,
|
|
242
|
+
selectable: a.selectable,
|
|
243
|
+
"is-selected": o.value.has(j(s)),
|
|
244
|
+
hoverable: a.hoverable,
|
|
245
|
+
striped: a.striped,
|
|
246
|
+
compact: a.compact,
|
|
247
|
+
onSelect: G,
|
|
248
|
+
onRowClick: Q,
|
|
249
|
+
class: "[&_td:last-child]:pr-3.5!"
|
|
246
250
|
}, V({ _: 2 }, [
|
|
247
|
-
|
|
251
|
+
$(a.headers, (m) => ({
|
|
248
252
|
name: m.field,
|
|
249
|
-
fn:
|
|
250
|
-
|
|
253
|
+
fn: T((f) => [
|
|
254
|
+
S(e.$slots, m.field, le({ ref_for: !0 }, f), void 0, !0)
|
|
251
255
|
])
|
|
252
256
|
}))
|
|
253
|
-
]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact"]))), 128)) : (
|
|
254
|
-
|
|
255
|
-
colspan:
|
|
257
|
+
]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact"]))), 128)) : (r(), d("tr", be, [
|
|
258
|
+
n("td", {
|
|
259
|
+
colspan: a.selectable ? a.headers.length + 1 : a.headers.length,
|
|
256
260
|
class: "h-96 text-center align-middle hover:bg-transparent"
|
|
257
261
|
}, [
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
icon:
|
|
262
|
+
n("div", Pe, [
|
|
263
|
+
n("div", xe, [
|
|
264
|
+
C(oe, {
|
|
265
|
+
icon: a.emptyIcon,
|
|
262
266
|
class: "h-6 w-6 text-muted-foreground/80"
|
|
263
267
|
}, null, 8, ["icon"])
|
|
264
268
|
]),
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
+
n("h3", Ce, M(a.emptyTitle), 1),
|
|
270
|
+
n("p", Se, [
|
|
271
|
+
S(e.$slots, "empty-description", {}, () => [
|
|
272
|
+
ae(M(a.emptyDescription), 1)
|
|
269
273
|
], !0)
|
|
270
274
|
]),
|
|
271
|
-
e.$slots["empty-action"] ? (
|
|
272
|
-
|
|
273
|
-
])) :
|
|
275
|
+
e.$slots["empty-action"] ? (r(), d("div", Ie, [
|
|
276
|
+
S(e.$slots, "empty-action", {}, void 0, !0)
|
|
277
|
+
])) : I("", !0)
|
|
274
278
|
])
|
|
275
|
-
], 8,
|
|
279
|
+
], 8, ke)
|
|
276
280
|
]))
|
|
277
281
|
])
|
|
278
282
|
], 2)
|
|
279
283
|
])
|
|
280
284
|
], 2),
|
|
281
|
-
|
|
282
|
-
|
|
285
|
+
a.showPagination && a.pageInfo && a.pageInfo.totalItems > 0 ? (r(), d("div", $e, [
|
|
286
|
+
C(se(ie), {
|
|
283
287
|
"current-page": h.value,
|
|
284
|
-
"total-pages":
|
|
288
|
+
"total-pages": a.pageInfo.totalPages,
|
|
285
289
|
"show-page-info": !1,
|
|
286
|
-
"show-items-per-page":
|
|
287
|
-
"items-per-page":
|
|
288
|
-
"items-per-page-options":
|
|
290
|
+
"show-items-per-page": a.showItemsPerPage,
|
|
291
|
+
"items-per-page": k.value,
|
|
292
|
+
"items-per-page-options": a.itemsPerPageOptions,
|
|
289
293
|
"nav-type": "icon",
|
|
290
|
-
onChange:
|
|
291
|
-
"onUpdate:itemsPerPage":
|
|
294
|
+
onChange: J,
|
|
295
|
+
"onUpdate:itemsPerPage": K
|
|
292
296
|
}, null, 8, ["current-page", "total-pages", "show-items-per-page", "items-per-page", "items-per-page-options"])
|
|
293
|
-
])) :
|
|
294
|
-
|
|
295
|
-
show:
|
|
296
|
-
"onUpdate:show": t[2] || (t[2] = (
|
|
297
|
+
])) : I("", !0),
|
|
298
|
+
C(de, {
|
|
299
|
+
show: P.value,
|
|
300
|
+
"onUpdate:show": t[2] || (t[2] = (s) => P.value = s),
|
|
297
301
|
title: "Confirm Deletion",
|
|
298
302
|
description: "Are you sure you want to delete the selected items?",
|
|
299
303
|
"confirm-text": "Delete",
|
|
300
304
|
"cancel-text": "Cancel",
|
|
301
305
|
variant: "danger",
|
|
302
|
-
onConfirm:
|
|
303
|
-
onCancel: t[3] || (t[3] = (
|
|
306
|
+
onConfirm: X,
|
|
307
|
+
onCancel: t[3] || (t[3] = (s) => P.value = !1)
|
|
304
308
|
}, null, 8, ["show"])
|
|
305
309
|
]));
|
|
306
310
|
}
|
|
307
311
|
});
|
|
308
312
|
export {
|
|
309
|
-
|
|
313
|
+
Ve as default
|
|
310
314
|
};
|
|
@@ -3,6 +3,7 @@ interface Props {
|
|
|
3
3
|
header: TableHeader;
|
|
4
4
|
sortConfig?: SortConfig;
|
|
5
5
|
compact?: boolean;
|
|
6
|
+
tableSortable?: boolean;
|
|
6
7
|
}
|
|
7
8
|
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
8
9
|
sort: (field: string) => any;
|
|
@@ -10,5 +11,6 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
|
|
|
10
11
|
onSort?: (field: string) => any;
|
|
11
12
|
}>, {
|
|
12
13
|
compact: boolean;
|
|
14
|
+
tableSortable: boolean;
|
|
13
15
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLTableCellElement>;
|
|
14
16
|
export default _default;
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { defineComponent as m, computed as o, openBlock as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as m, computed as o, openBlock as a, createElementBlock as n, normalizeClass as r, createElementVNode as l, toDisplayString as p, createVNode as g, createCommentVNode as x } from "vue";
|
|
2
|
+
import b from "../Icon.vue.js";
|
|
3
|
+
const y = { class: "text-xs font-bold! uppercase tracking-wider text-gray-900 truncate" }, C = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "w-4 h-4 shrink-0"
|
|
6
|
-
},
|
|
6
|
+
}, S = /* @__PURE__ */ m({
|
|
7
7
|
__name: "DataTableHeader",
|
|
8
8
|
props: {
|
|
9
9
|
header: {},
|
|
10
10
|
sortConfig: {},
|
|
11
|
-
compact: { type: Boolean, default: !1 }
|
|
11
|
+
compact: { type: Boolean, default: !1 },
|
|
12
|
+
tableSortable: { type: Boolean, default: !0 }
|
|
12
13
|
},
|
|
13
14
|
emits: ["sort"],
|
|
14
|
-
setup(t, { emit:
|
|
15
|
-
const e = t,
|
|
16
|
-
e.header.sortable !== !1 &&
|
|
15
|
+
setup(t, { emit: s }) {
|
|
16
|
+
const e = t, i = s, c = o(() => e.sortConfig?.field === e.header.field && e.sortConfig?.order), d = o(() => !e.sortConfig || e.sortConfig.field !== e.header.field ? "lucide:chevrons-up-down" : e.sortConfig.order === "asc" ? "lucide:arrow-up" : e.sortConfig.order === "desc" ? "lucide:arrow-down" : "lucide:chevrons-up-down"), f = () => {
|
|
17
|
+
e.tableSortable && e.header.sortable !== !1 && i("sort", e.header.field);
|
|
17
18
|
}, u = o(() => ({
|
|
18
19
|
left: "justify-start text-left",
|
|
19
20
|
center: "justify-center text-center",
|
|
20
21
|
right: "justify-end text-right"
|
|
21
22
|
})[e.header.align || "left"]);
|
|
22
|
-
return (h, v) => (
|
|
23
|
+
return (h, v) => (a(), n("th", {
|
|
23
24
|
scope: "col",
|
|
24
25
|
class: r(["h-10 px-3 text-left align-middle font-medium text-muted-foreground transition-colors [&:has([role=checkbox])]:pr-0 overflow-hidden", [
|
|
25
26
|
t.compact ? "py-2" : "py-3!",
|
|
@@ -28,12 +29,12 @@ const C = { class: "text-xs font-bold! uppercase tracking-wider text-gray-900 tr
|
|
|
28
29
|
]]),
|
|
29
30
|
onClick: f
|
|
30
31
|
}, [
|
|
31
|
-
|
|
32
|
+
l("div", {
|
|
32
33
|
class: r(["flex items-center gap-2 space-x-2", u.value])
|
|
33
34
|
}, [
|
|
34
|
-
|
|
35
|
-
t.header.sortable !== !1 ? (
|
|
36
|
-
g(
|
|
35
|
+
l("span", y, p(t.header.title), 1),
|
|
36
|
+
t.tableSortable && t.header.sortable !== !1 ? (a(), n("span", C, [
|
|
37
|
+
g(b, {
|
|
37
38
|
icon: d.value,
|
|
38
39
|
class: r(["w-3.5 h-3.5 transition-all text-muted-foreground mt-0.5", [
|
|
39
40
|
c.value ? "opacity-100 text-foreground" : "opacity-0 group-hover:opacity-100"
|
|
@@ -45,5 +46,5 @@ const C = { class: "text-xs font-bold! uppercase tracking-wider text-gray-900 tr
|
|
|
45
46
|
}
|
|
46
47
|
});
|
|
47
48
|
export {
|
|
48
|
-
|
|
49
|
+
S as default
|
|
49
50
|
};
|