vlite3 0.3.2 → 0.3.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/AvatarUploader/AvatarUploader.vue.d.ts +2 -2
- package/components/AvatarUploader/AvatarUploader.vue.js +53 -36
- package/components/DataList/DataList.vue.d.ts +49 -0
- package/components/DataList/DataList.vue.js +120 -0
- package/components/DataList/DataList.vue2.js +4 -0
- package/components/DataList/index.d.ts +2 -0
- package/components/DataList/types.d.ts +17 -0
- package/components/DataTable/DataTable.vue.d.ts +1 -3
- package/components/DataTable/DataTable.vue.js +142 -133
- package/components/DataTable/types.d.ts +3 -10
- package/components/FilePicker/FilePicker.vue.d.ts +1 -0
- package/components/FilePicker/FilePicker.vue.js +159 -139
- package/components/Form/FormField.vue.js +53 -50
- package/components/Form/composables/useForm.js +80 -63
- package/components/Form/types.d.ts +4 -3
- package/components/Pagination/Pagination.vue.d.ts +4 -16
- package/components/Pagination/Pagination.vue.js +36 -36
- package/components/Pagination/index.d.ts +19 -0
- package/components/Screen/Screen.vue.d.ts +68 -0
- package/components/Screen/Screen.vue.js +370 -0
- package/components/Screen/Screen.vue2.js +4 -0
- package/components/Screen/ScreenFilter.vue.d.ts +15 -0
- package/components/Screen/ScreenFilter.vue.js +147 -0
- package/components/Screen/ScreenFilter.vue2.js +4 -0
- package/components/Screen/index.d.ts +3 -0
- package/components/Screen/types.d.ts +52 -0
- package/index.d.ts +2 -0
- package/index.js +36 -30
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as N, computed as z, openBlock as s, createElementBlock as
|
|
1
|
+
import { defineComponent as N, computed as z, openBlock as s, createElementBlock as r, normalizeClass as S, createElementVNode as d, Fragment as P, renderList as $, toDisplayString as x, createVNode as b, createCommentVNode as m, createTextVNode as h, createBlock as v, withCtx as w } from "vue";
|
|
2
2
|
import O from "../Icon.vue.js";
|
|
3
3
|
import o from "../Button.vue.js";
|
|
4
4
|
const R = {
|
|
@@ -24,7 +24,7 @@ const R = {
|
|
|
24
24
|
props: {
|
|
25
25
|
currentPage: { default: 1 },
|
|
26
26
|
totalPages: {},
|
|
27
|
-
|
|
27
|
+
totalItems: { default: 1 },
|
|
28
28
|
disabled: { type: Boolean, default: !1 },
|
|
29
29
|
showEdges: { type: Boolean, default: !1 },
|
|
30
30
|
showPageInfo: { type: Boolean, default: !1 },
|
|
@@ -36,31 +36,31 @@ const R = {
|
|
|
36
36
|
},
|
|
37
37
|
emits: ["update:currentPage", "change", "update:itemsPerPage", "change:itemsPerPage"],
|
|
38
38
|
setup(e, { emit: j }) {
|
|
39
|
-
const a = e, u = j,
|
|
40
|
-
a.disabled ||
|
|
41
|
-
}, T = (
|
|
42
|
-
const t =
|
|
39
|
+
const a = e, u = j, i = (l) => {
|
|
40
|
+
a.disabled || l < 1 || l > a.totalPages || l !== a.currentPage && (u("update:currentPage", l), u("change", l));
|
|
41
|
+
}, T = (l) => {
|
|
42
|
+
const t = l.target, n = parseInt(t.value);
|
|
43
43
|
u("update:itemsPerPage", n), u("change:itemsPerPage", n), u("update:currentPage", 1), u("change", 1);
|
|
44
44
|
}, D = z(() => {
|
|
45
|
-
if (a.
|
|
45
|
+
if (a.totalItems * 2 + 5 >= a.totalPages)
|
|
46
46
|
return y(1, a.totalPages);
|
|
47
|
-
const t = Math.max(a.currentPage - a.
|
|
47
|
+
const t = Math.max(a.currentPage - a.totalItems, 1), n = Math.min(a.currentPage + a.totalItems, a.totalPages), g = t > 2, c = n < a.totalPages - 2, k = 1, I = a.totalPages;
|
|
48
48
|
if (!g && c) {
|
|
49
|
-
let f = 3 + 2 * a.
|
|
50
|
-
return [...y(1, f), "DOTS",
|
|
49
|
+
let f = 3 + 2 * a.totalItems;
|
|
50
|
+
return [...y(1, f), "DOTS", I];
|
|
51
51
|
}
|
|
52
52
|
if (g && !c) {
|
|
53
|
-
let f = 3 + 2 * a.
|
|
54
|
-
return [k, "DOTS", ...
|
|
53
|
+
let f = 3 + 2 * a.totalItems, C = y(a.totalPages - f + 1, a.totalPages);
|
|
54
|
+
return [k, "DOTS", ...C];
|
|
55
55
|
}
|
|
56
56
|
if (g && c) {
|
|
57
57
|
let f = y(t, n);
|
|
58
|
-
return [k, "DOTS", ...f, "DOTS",
|
|
58
|
+
return [k, "DOTS", ...f, "DOTS", I];
|
|
59
59
|
}
|
|
60
60
|
return [];
|
|
61
|
-
}), y = (
|
|
62
|
-
let n = t -
|
|
63
|
-
return Array.from({ length: n }, (g, c) => c +
|
|
61
|
+
}), y = (l, t) => {
|
|
62
|
+
let n = t - l + 1;
|
|
63
|
+
return Array.from({ length: n }, (g, c) => c + l);
|
|
64
64
|
}, B = z(() => {
|
|
65
65
|
if (a.alignment)
|
|
66
66
|
switch (a.alignment) {
|
|
@@ -69,17 +69,17 @@ const R = {
|
|
|
69
69
|
case "end":
|
|
70
70
|
return "justify-end";
|
|
71
71
|
case "between":
|
|
72
|
-
return "justify-between";
|
|
72
|
+
return "justify-between!";
|
|
73
73
|
default:
|
|
74
74
|
return "justify-center";
|
|
75
75
|
}
|
|
76
76
|
return a.showPageInfo || a.showItemsPerPage ? "justify-between" : "justify-center";
|
|
77
77
|
});
|
|
78
|
-
return (
|
|
78
|
+
return (l, t) => (s(), r("div", {
|
|
79
79
|
class: S(["flex flex-col md:flex-row items-center gap-4 w-full", [B.value]])
|
|
80
80
|
}, [
|
|
81
|
-
e.showPageInfo || e.showItemsPerPage ? (s(),
|
|
82
|
-
e.showItemsPerPage ? (s(),
|
|
81
|
+
e.showPageInfo || e.showItemsPerPage ? (s(), r("div", R, [
|
|
82
|
+
e.showItemsPerPage ? (s(), r("div", E, [
|
|
83
83
|
t[8] || (t[8] = d("span", { class: "whitespace-nowrap" }, "Show", -1)),
|
|
84
84
|
d("div", V, [
|
|
85
85
|
d("select", {
|
|
@@ -88,7 +88,7 @@ const R = {
|
|
|
88
88
|
disabled: e.disabled,
|
|
89
89
|
onChange: T
|
|
90
90
|
}, [
|
|
91
|
-
(s(!0),
|
|
91
|
+
(s(!0), r(P, null, $(e.itemsPerPageOptions, (n) => (s(), r("option", {
|
|
92
92
|
key: n,
|
|
93
93
|
value: n
|
|
94
94
|
}, x(n), 9, M))), 128))
|
|
@@ -100,8 +100,8 @@ const R = {
|
|
|
100
100
|
]),
|
|
101
101
|
t[9] || (t[9] = d("span", { class: "whitespace-nowrap" }, "per page", -1))
|
|
102
102
|
])) : m("", !0),
|
|
103
|
-
e.showItemsPerPage && e.showPageInfo ? (s(),
|
|
104
|
-
e.showPageInfo ? (s(),
|
|
103
|
+
e.showItemsPerPage && e.showPageInfo ? (s(), r("div", A)) : m("", !0),
|
|
104
|
+
e.showPageInfo ? (s(), r("span", F, [
|
|
105
105
|
t[10] || (t[10] = h(" Page ", -1)),
|
|
106
106
|
d("span", q, x(e.currentPage), 1),
|
|
107
107
|
t[11] || (t[11] = h(" of ", -1)),
|
|
@@ -115,7 +115,7 @@ const R = {
|
|
|
115
115
|
size: "sm",
|
|
116
116
|
icon: "lucide:chevrons-left",
|
|
117
117
|
disabled: e.disabled || e.currentPage === 1,
|
|
118
|
-
onClick: t[0] || (t[0] = (n) =>
|
|
118
|
+
onClick: t[0] || (t[0] = (n) => i(1))
|
|
119
119
|
}, null, 8, ["disabled"])) : m("", !0),
|
|
120
120
|
e.navType === "icon" ? (s(), v(o, {
|
|
121
121
|
key: 1,
|
|
@@ -123,14 +123,14 @@ const R = {
|
|
|
123
123
|
size: "sm",
|
|
124
124
|
icon: "lucide:chevron-left",
|
|
125
125
|
disabled: e.disabled || e.currentPage === 1,
|
|
126
|
-
onClick: t[1] || (t[1] = (n) =>
|
|
127
|
-
}, null, 8, ["disabled"])) : (s(),
|
|
126
|
+
onClick: t[1] || (t[1] = (n) => i(e.currentPage - 1))
|
|
127
|
+
}, null, 8, ["disabled"])) : (s(), r(P, { key: 2 }, [
|
|
128
128
|
b(o, {
|
|
129
129
|
variant: "ghost",
|
|
130
130
|
size: "sm",
|
|
131
131
|
class: "hidden sm:flex",
|
|
132
132
|
disabled: e.disabled || e.currentPage === 1,
|
|
133
|
-
onClick: t[2] || (t[2] = (n) =>
|
|
133
|
+
onClick: t[2] || (t[2] = (n) => i(e.currentPage - 1))
|
|
134
134
|
}, {
|
|
135
135
|
default: w(() => [...t[12] || (t[12] = [
|
|
136
136
|
h(" Previous ", -1)
|
|
@@ -143,11 +143,11 @@ const R = {
|
|
|
143
143
|
icon: "lucide:chevron-left",
|
|
144
144
|
class: "flex sm:hidden",
|
|
145
145
|
disabled: e.disabled || e.currentPage === 1,
|
|
146
|
-
onClick: t[3] || (t[3] = (n) =>
|
|
146
|
+
onClick: t[3] || (t[3] = (n) => i(e.currentPage - 1))
|
|
147
147
|
}, null, 8, ["disabled"])
|
|
148
148
|
], 64)),
|
|
149
|
-
(s(!0),
|
|
150
|
-
n === "DOTS" ? (s(),
|
|
149
|
+
(s(!0), r(P, null, $(D.value, (n, g) => (s(), r(P, { key: g }, [
|
|
150
|
+
n === "DOTS" ? (s(), r("div", J, "...")) : (s(), v(o, {
|
|
151
151
|
key: 1,
|
|
152
152
|
size: "sm",
|
|
153
153
|
variant: n === e.currentPage ? "outline" : "ghost",
|
|
@@ -156,7 +156,7 @@ const R = {
|
|
|
156
156
|
"text-gray-600 hover:bg-gray-100": n !== e.currentPage
|
|
157
157
|
}),
|
|
158
158
|
disabled: e.disabled,
|
|
159
|
-
onClick: (c) =>
|
|
159
|
+
onClick: (c) => i(n)
|
|
160
160
|
}, {
|
|
161
161
|
default: w(() => [
|
|
162
162
|
h(x(n), 1)
|
|
@@ -170,14 +170,14 @@ const R = {
|
|
|
170
170
|
size: "sm",
|
|
171
171
|
icon: "lucide:chevron-right",
|
|
172
172
|
disabled: e.disabled || e.currentPage === e.totalPages,
|
|
173
|
-
onClick: t[4] || (t[4] = (n) =>
|
|
174
|
-
}, null, 8, ["disabled"])) : (s(),
|
|
173
|
+
onClick: t[4] || (t[4] = (n) => i(e.currentPage + 1))
|
|
174
|
+
}, null, 8, ["disabled"])) : (s(), r(P, { key: 4 }, [
|
|
175
175
|
b(o, {
|
|
176
176
|
variant: "ghost",
|
|
177
177
|
size: "sm",
|
|
178
178
|
class: "hidden sm:flex",
|
|
179
179
|
disabled: e.disabled || e.currentPage === e.totalPages,
|
|
180
|
-
onClick: t[5] || (t[5] = (n) =>
|
|
180
|
+
onClick: t[5] || (t[5] = (n) => i(e.currentPage + 1))
|
|
181
181
|
}, {
|
|
182
182
|
default: w(() => [...t[13] || (t[13] = [
|
|
183
183
|
h(" Next ", -1)
|
|
@@ -190,7 +190,7 @@ const R = {
|
|
|
190
190
|
icon: "lucide:chevron-right",
|
|
191
191
|
class: "flex sm:hidden",
|
|
192
192
|
disabled: e.disabled || e.currentPage === e.totalPages,
|
|
193
|
-
onClick: t[6] || (t[6] = (n) =>
|
|
193
|
+
onClick: t[6] || (t[6] = (n) => i(e.currentPage + 1))
|
|
194
194
|
}, null, 8, ["disabled"])
|
|
195
195
|
], 64)),
|
|
196
196
|
e.showEdges ? (s(), v(o, {
|
|
@@ -199,7 +199,7 @@ const R = {
|
|
|
199
199
|
size: "sm",
|
|
200
200
|
icon: "lucide:chevrons-right",
|
|
201
201
|
disabled: e.disabled || e.currentPage === e.totalPages,
|
|
202
|
-
onClick: t[7] || (t[7] = (n) =>
|
|
202
|
+
onClick: t[7] || (t[7] = (n) => i(e.totalPages))
|
|
203
203
|
}, null, 8, ["disabled"])) : m("", !0)
|
|
204
204
|
])
|
|
205
205
|
], 2));
|
|
@@ -1 +1,20 @@
|
|
|
1
1
|
export { default as Pagination } from './Pagination.vue';
|
|
2
|
+
export interface PageInfo {
|
|
3
|
+
currentPage: number;
|
|
4
|
+
totalPages: number;
|
|
5
|
+
totalItems?: number;
|
|
6
|
+
itemsPerPage?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface PaginationProps {
|
|
9
|
+
currentPage?: number;
|
|
10
|
+
totalPages: number;
|
|
11
|
+
totalItems?: number;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
showEdges?: boolean;
|
|
14
|
+
showPageInfo?: boolean;
|
|
15
|
+
showItemsPerPage?: boolean;
|
|
16
|
+
itemsPerPage?: number;
|
|
17
|
+
itemsPerPageOptions?: number[];
|
|
18
|
+
navType?: 'text' | 'icon';
|
|
19
|
+
alignment?: 'start' | 'center' | 'end' | 'between';
|
|
20
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ScreenProps } from './types';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: {
|
|
5
|
+
title?(_: {}): any;
|
|
6
|
+
description?(_: {}): any;
|
|
7
|
+
'before-search'?(_: {}): any;
|
|
8
|
+
actions?(_: {}): any;
|
|
9
|
+
'after-add'?(_: {}): any;
|
|
10
|
+
'custom-header'?(_: {}): any;
|
|
11
|
+
empty?(_: {}): any;
|
|
12
|
+
};
|
|
13
|
+
refs: {};
|
|
14
|
+
rootEl: HTMLDivElement;
|
|
15
|
+
};
|
|
16
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
17
|
+
declare const __VLS_component: import('vue').DefineComponent<ScreenProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
18
|
+
change: (payload: {
|
|
19
|
+
pageinfo: {
|
|
20
|
+
page: number;
|
|
21
|
+
limit: number;
|
|
22
|
+
};
|
|
23
|
+
pagination: {
|
|
24
|
+
page: number;
|
|
25
|
+
limit: number;
|
|
26
|
+
};
|
|
27
|
+
search: string;
|
|
28
|
+
filter: Record<string, any>;
|
|
29
|
+
}) => any;
|
|
30
|
+
add: () => any;
|
|
31
|
+
}, string, import('vue').PublicProps, Readonly<ScreenProps> & Readonly<{
|
|
32
|
+
onChange?: (payload: {
|
|
33
|
+
pageinfo: {
|
|
34
|
+
page: number;
|
|
35
|
+
limit: number;
|
|
36
|
+
};
|
|
37
|
+
pagination: {
|
|
38
|
+
page: number;
|
|
39
|
+
limit: number;
|
|
40
|
+
};
|
|
41
|
+
search: string;
|
|
42
|
+
filter: Record<string, any>;
|
|
43
|
+
}) => any;
|
|
44
|
+
onAdd?: () => any;
|
|
45
|
+
}>, {
|
|
46
|
+
title: string;
|
|
47
|
+
description: string;
|
|
48
|
+
data: any[];
|
|
49
|
+
loading: boolean;
|
|
50
|
+
pagination: boolean;
|
|
51
|
+
emptyTitle: string;
|
|
52
|
+
emptyDescription: string;
|
|
53
|
+
emptyIcon: string;
|
|
54
|
+
paginationProps: import('./types').ScreenPaginationProps;
|
|
55
|
+
customHeader: boolean;
|
|
56
|
+
canSearch: boolean;
|
|
57
|
+
canAdd: boolean;
|
|
58
|
+
filterSchema: import('../Form').IForm[];
|
|
59
|
+
filterType: "modal" | "dropdown";
|
|
60
|
+
showRefresh: boolean;
|
|
61
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
62
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
63
|
+
export default _default;
|
|
64
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
65
|
+
new (): {
|
|
66
|
+
$slots: S;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { defineComponent as H, ref as k, watch as I, computed as T, resolveComponent as L, openBlock as t, createElementBlock as d, createElementVNode as s, renderSlot as h, toDisplayString as r, createCommentVNode as v, normalizeClass as j, createVNode as u, createBlock as o, resolveDynamicComponent as A, Fragment as w, mergeProps as c, withCtx as l, createTextVNode as m, unref as O } from "vue";
|
|
2
|
+
import Q from "../Input.vue.js";
|
|
3
|
+
import f from "../Button.vue.js";
|
|
4
|
+
import V from "../Icon.vue.js";
|
|
5
|
+
import D from "../Modal.vue.js";
|
|
6
|
+
import W from "../Pagination/Pagination.vue.js";
|
|
7
|
+
import q from "./ScreenFilter.vue.js";
|
|
8
|
+
const G = { class: "flex flex-col w-full space-y-8" }, J = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "flex flex-col md:flex-row sm:items-start md:items-center justify-between gap-4"
|
|
11
|
+
}, K = { class: "flex flex-col shrink-0" }, M = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "text-fs-7.5 font-bold text-foreground"
|
|
14
|
+
}, X = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "text-sm text-gray-700 mt-1.5 md:max-w-[450px]"
|
|
17
|
+
}, Y = { class: "flex flex-col sm:flex-row items-start sm:items-center gap-3 w-full justify-end" }, Z = { class: "flex items-center gap-3 w-full sm:w-auto flex-1 md:flex-none justify-start sm:justify-end" }, p = {
|
|
18
|
+
key: 0,
|
|
19
|
+
class: "flex items-center p-1 rounded-md border border-border shrink-0"
|
|
20
|
+
}, _ = {
|
|
21
|
+
key: 3,
|
|
22
|
+
class: "w-full md:w-64! max-sm:order-last"
|
|
23
|
+
}, ee = { class: "flex items-center gap-3 max-sm:w-full sm:w-auto max-sm:order-last" }, te = ["href", "target"], ae = { class: "flex-1 w-full relative min-h-[300px]" }, ne = { class: "flex flex-col items-center justify-center py-16 px-4 text-center bg-card border border-border rounded-lg shadow-sm" }, de = { class: "flex h-16 w-16 items-center justify-center rounded-full bg-muted mb-4" }, le = { class: "text-lg font-semibold text-foreground" }, ie = { class: "mt-2 text-sm text-muted-foreground max-w-sm" }, oe = { class: "mt-6" }, se = ["href", "target"], re = {
|
|
24
|
+
key: 1,
|
|
25
|
+
class: "p-8 text-center text-muted-foreground border border-dashed border-border rounded-lg"
|
|
26
|
+
}, ue = { key: 2 }, Be = /* @__PURE__ */ H({
|
|
27
|
+
__name: "Screen",
|
|
28
|
+
props: {
|
|
29
|
+
title: { default: "" },
|
|
30
|
+
description: { default: "" },
|
|
31
|
+
pageInfo: {},
|
|
32
|
+
data: { default: () => [] },
|
|
33
|
+
loading: { type: Boolean, default: !1 },
|
|
34
|
+
refetch: {},
|
|
35
|
+
paginationProps: { default: () => ({
|
|
36
|
+
alignment: "end",
|
|
37
|
+
navType: "icon",
|
|
38
|
+
showItemsPerPage: !1,
|
|
39
|
+
itemsPerPageOptions: [10, 25, 50, 100]
|
|
40
|
+
}) },
|
|
41
|
+
emptyTitle: { default: "No records found" },
|
|
42
|
+
emptyDescription: { default: "We could not find any records matching your criteria." },
|
|
43
|
+
emptyIcon: { default: "lucide:inbox" },
|
|
44
|
+
addComponent: {},
|
|
45
|
+
addBtn: {},
|
|
46
|
+
list: {},
|
|
47
|
+
table: {},
|
|
48
|
+
customHeader: { type: Boolean, default: !1 },
|
|
49
|
+
canSearch: { type: Boolean, default: !0 },
|
|
50
|
+
canAdd: { type: Boolean, default: !0 },
|
|
51
|
+
pagination: { type: Boolean, default: !0 },
|
|
52
|
+
filterSchema: { default: () => [] },
|
|
53
|
+
filterType: { default: "modal" },
|
|
54
|
+
showRefresh: { type: Boolean, default: !1 }
|
|
55
|
+
},
|
|
56
|
+
emits: ["add", "change"],
|
|
57
|
+
setup(e, { emit: R }) {
|
|
58
|
+
const i = e, U = R, B = k(i.table ? "table" : "list"), x = k(""), C = k({}), y = k(i.pageInfo?.currentPage || 1), P = k(i.pageInfo?.itemsPerPage || i.paginationProps?.itemsPerPage || 10);
|
|
59
|
+
I(
|
|
60
|
+
() => i.pageInfo?.currentPage,
|
|
61
|
+
(a) => {
|
|
62
|
+
a && (y.value = a);
|
|
63
|
+
}
|
|
64
|
+
), I(
|
|
65
|
+
() => i.pageInfo?.itemsPerPage,
|
|
66
|
+
(a) => {
|
|
67
|
+
a && (P.value = a);
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
let $ = null;
|
|
71
|
+
I(x, (a) => {
|
|
72
|
+
$ && clearTimeout($), $ = setTimeout(() => {
|
|
73
|
+
y.value = 1, b();
|
|
74
|
+
}, 300);
|
|
75
|
+
});
|
|
76
|
+
const z = (a) => {
|
|
77
|
+
y.value = a, b();
|
|
78
|
+
}, E = (a) => {
|
|
79
|
+
P.value = a, y.value = 1, b();
|
|
80
|
+
}, b = () => {
|
|
81
|
+
const a = {
|
|
82
|
+
pageinfo: {
|
|
83
|
+
page: y.value,
|
|
84
|
+
limit: P.value
|
|
85
|
+
},
|
|
86
|
+
pagination: {
|
|
87
|
+
page: y.value,
|
|
88
|
+
limit: P.value
|
|
89
|
+
},
|
|
90
|
+
search: x.value,
|
|
91
|
+
filter: C.value
|
|
92
|
+
};
|
|
93
|
+
U("change", a), i.refetch && i.refetch(a);
|
|
94
|
+
}, N = T(() => B.value === "table" && i.table ? i.table : i.list), F = T(() => i.data && i.data.length > 0);
|
|
95
|
+
return (a, n) => {
|
|
96
|
+
const S = L("router-link");
|
|
97
|
+
return t(), d("div", G, [
|
|
98
|
+
e.customHeader ? h(a.$slots, "custom-header", { key: 1 }) : (t(), d("div", J, [
|
|
99
|
+
s("div", K, [
|
|
100
|
+
h(a.$slots, "title", {}, () => [
|
|
101
|
+
e.title ? (t(), d("h1", M, r(e.title), 1)) : v("", !0)
|
|
102
|
+
]),
|
|
103
|
+
h(a.$slots, "description", {}, () => [
|
|
104
|
+
e.description ? (t(), d("p", X, r(e.description), 1)) : v("", !0)
|
|
105
|
+
])
|
|
106
|
+
]),
|
|
107
|
+
s("div", Y, [
|
|
108
|
+
s("div", Z, [
|
|
109
|
+
e.table && e.list ? (t(), d("div", p, [
|
|
110
|
+
s("button", {
|
|
111
|
+
onClick: n[0] || (n[0] = (g) => B.value = "list"),
|
|
112
|
+
class: j(["p-1.5 rounded transition-colors", [
|
|
113
|
+
B.value === "list" ? "bg-secondary/70 shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
114
|
+
]]),
|
|
115
|
+
title: "List View"
|
|
116
|
+
}, [
|
|
117
|
+
u(V, {
|
|
118
|
+
icon: "lucide:layout-grid",
|
|
119
|
+
class: "w-4 h-4"
|
|
120
|
+
})
|
|
121
|
+
], 2),
|
|
122
|
+
s("button", {
|
|
123
|
+
onClick: n[1] || (n[1] = (g) => B.value = "table"),
|
|
124
|
+
class: j(["p-1.5 rounded transition-colors", [
|
|
125
|
+
B.value === "table" ? "bg-secondary/70 shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
126
|
+
]]),
|
|
127
|
+
title: "Table View"
|
|
128
|
+
}, [
|
|
129
|
+
u(V, {
|
|
130
|
+
icon: "lucide:list",
|
|
131
|
+
class: "w-4 h-4"
|
|
132
|
+
})
|
|
133
|
+
], 2)
|
|
134
|
+
])) : v("", !0),
|
|
135
|
+
h(a.$slots, "before-search"),
|
|
136
|
+
e.showRefresh ? (t(), o(f, {
|
|
137
|
+
key: 1,
|
|
138
|
+
variant: "outline",
|
|
139
|
+
icon: "lucide:refresh-cw",
|
|
140
|
+
size: "lg",
|
|
141
|
+
class: "shrink-0 h-9! w-9!",
|
|
142
|
+
title: "Refresh",
|
|
143
|
+
disabled: e.loading,
|
|
144
|
+
onClick: b
|
|
145
|
+
}, null, 8, ["disabled"])) : v("", !0),
|
|
146
|
+
e.filterSchema && e.filterSchema.length > 0 ? (t(), o(q, {
|
|
147
|
+
key: 2,
|
|
148
|
+
schema: e.filterSchema,
|
|
149
|
+
type: e.filterType,
|
|
150
|
+
modelValue: C.value,
|
|
151
|
+
"onUpdate:modelValue": n[2] || (n[2] = (g) => C.value = g),
|
|
152
|
+
onChange: b
|
|
153
|
+
}, null, 8, ["schema", "type", "modelValue"])) : v("", !0),
|
|
154
|
+
e.canSearch ? (t(), d("div", _, [
|
|
155
|
+
u(Q, {
|
|
156
|
+
modelValue: x.value,
|
|
157
|
+
"onUpdate:modelValue": n[3] || (n[3] = (g) => x.value = g),
|
|
158
|
+
icon: "lucide:search",
|
|
159
|
+
placeholder: "Search...",
|
|
160
|
+
variant: "outline",
|
|
161
|
+
class: "bg-background w-full",
|
|
162
|
+
"show-clear-button": !0
|
|
163
|
+
}, null, 8, ["modelValue"])
|
|
164
|
+
])) : v("", !0)
|
|
165
|
+
]),
|
|
166
|
+
s("div", ee, [
|
|
167
|
+
h(a.$slots, "actions", {}, () => [
|
|
168
|
+
e.addComponent ? (t(), o(A(e.addComponent), { key: 0 })) : e.canAdd ? (t(), d(w, { key: 1 }, [
|
|
169
|
+
e.addBtn ? (t(), d(w, { key: 0 }, [
|
|
170
|
+
e.addBtn.modal ? (t(), o(D, c({
|
|
171
|
+
key: 0,
|
|
172
|
+
body: e.addBtn.modal
|
|
173
|
+
}, e.addBtn.modalProps, {
|
|
174
|
+
refetch: e.refetch,
|
|
175
|
+
data: e.data,
|
|
176
|
+
triggerClass: "w-full",
|
|
177
|
+
loading: e.loading
|
|
178
|
+
}), {
|
|
179
|
+
trigger: l(() => [
|
|
180
|
+
u(f, c({
|
|
181
|
+
class: "w-full",
|
|
182
|
+
icon: e.addBtn.icon || "lucide:plus",
|
|
183
|
+
variant: e.addBtn.variant || "primary"
|
|
184
|
+
}, e.addBtn.buttonProps), {
|
|
185
|
+
default: l(() => [
|
|
186
|
+
m(r(e.addBtn.label || "Add"), 1)
|
|
187
|
+
]),
|
|
188
|
+
_: 1
|
|
189
|
+
}, 16, ["icon", "variant"])
|
|
190
|
+
]),
|
|
191
|
+
_: 1
|
|
192
|
+
}, 16, ["body", "refetch", "data", "loading"])) : e.addBtn.to ? (t(), o(S, {
|
|
193
|
+
key: 1,
|
|
194
|
+
to: e.addBtn.to,
|
|
195
|
+
class: "inline-flex w-full sm:w-auto"
|
|
196
|
+
}, {
|
|
197
|
+
default: l(() => [
|
|
198
|
+
u(f, c({
|
|
199
|
+
class: "w-full",
|
|
200
|
+
icon: e.addBtn.icon || "lucide:plus",
|
|
201
|
+
variant: e.addBtn.variant || "primary"
|
|
202
|
+
}, e.addBtn.buttonProps), {
|
|
203
|
+
default: l(() => [
|
|
204
|
+
m(r(e.addBtn.label || "Add"), 1)
|
|
205
|
+
]),
|
|
206
|
+
_: 1
|
|
207
|
+
}, 16, ["icon", "variant"])
|
|
208
|
+
]),
|
|
209
|
+
_: 1
|
|
210
|
+
}, 8, ["to"])) : e.addBtn.href ? (t(), d("a", {
|
|
211
|
+
key: 2,
|
|
212
|
+
href: e.addBtn.href,
|
|
213
|
+
target: e.addBtn.target,
|
|
214
|
+
class: "inline-flex w-full sm:w-auto"
|
|
215
|
+
}, [
|
|
216
|
+
u(f, c({
|
|
217
|
+
class: "w-full",
|
|
218
|
+
icon: e.addBtn.icon || "lucide:plus",
|
|
219
|
+
variant: e.addBtn.variant || "primary"
|
|
220
|
+
}, e.addBtn.buttonProps), {
|
|
221
|
+
default: l(() => [
|
|
222
|
+
m(r(e.addBtn.label || "Add"), 1)
|
|
223
|
+
]),
|
|
224
|
+
_: 1
|
|
225
|
+
}, 16, ["icon", "variant"])
|
|
226
|
+
], 8, te)) : (t(), o(f, c({
|
|
227
|
+
key: 3,
|
|
228
|
+
class: "w-full sm:w-auto",
|
|
229
|
+
icon: e.addBtn.icon || "lucide:plus",
|
|
230
|
+
variant: e.addBtn.variant || "primary"
|
|
231
|
+
}, e.addBtn.buttonProps, {
|
|
232
|
+
onClick: n[4] || (n[4] = (g) => e.addBtn.onClick ? e.addBtn.onClick() : a.$emit("add"))
|
|
233
|
+
}), {
|
|
234
|
+
default: l(() => [
|
|
235
|
+
m(r(e.addBtn.label || "Add"), 1)
|
|
236
|
+
]),
|
|
237
|
+
_: 1
|
|
238
|
+
}, 16, ["icon", "variant"]))
|
|
239
|
+
], 64)) : (t(), o(f, {
|
|
240
|
+
key: 1,
|
|
241
|
+
class: "w-full sm:w-auto",
|
|
242
|
+
icon: "lucide:plus",
|
|
243
|
+
variant: "primary",
|
|
244
|
+
onClick: n[5] || (n[5] = (g) => a.$emit("add"))
|
|
245
|
+
}, {
|
|
246
|
+
default: l(() => [...n[8] || (n[8] = [
|
|
247
|
+
m(" Add ", -1)
|
|
248
|
+
])]),
|
|
249
|
+
_: 1
|
|
250
|
+
}))
|
|
251
|
+
], 64)) : v("", !0)
|
|
252
|
+
]),
|
|
253
|
+
h(a.$slots, "after-add")
|
|
254
|
+
])
|
|
255
|
+
])
|
|
256
|
+
])),
|
|
257
|
+
s("div", ae, [
|
|
258
|
+
!F.value && !e.loading ? h(a.$slots, "empty", { key: 0 }, () => [
|
|
259
|
+
s("div", ne, [
|
|
260
|
+
s("div", de, [
|
|
261
|
+
u(V, {
|
|
262
|
+
icon: e.emptyIcon,
|
|
263
|
+
class: "h-8 w-8 text-muted-foreground"
|
|
264
|
+
}, null, 8, ["icon"])
|
|
265
|
+
]),
|
|
266
|
+
s("h3", le, r(e.emptyTitle), 1),
|
|
267
|
+
s("p", ie, r(e.emptyDescription), 1),
|
|
268
|
+
s("div", oe, [
|
|
269
|
+
e.addComponent ? (t(), o(A(e.addComponent), { key: 0 })) : e.canAdd ? (t(), d(w, { key: 1 }, [
|
|
270
|
+
e.addBtn ? (t(), d(w, { key: 0 }, [
|
|
271
|
+
e.addBtn.modal ? (t(), o(D, c({
|
|
272
|
+
key: 0,
|
|
273
|
+
body: e.addBtn.modal
|
|
274
|
+
}, e.addBtn.modalProps), {
|
|
275
|
+
trigger: l(() => [
|
|
276
|
+
u(f, c({
|
|
277
|
+
icon: e.addBtn.icon || "lucide:plus",
|
|
278
|
+
variant: e.addBtn.variant || "outline"
|
|
279
|
+
}, e.addBtn.buttonProps), {
|
|
280
|
+
default: l(() => [
|
|
281
|
+
m(r(e.addBtn.label || "Add New"), 1)
|
|
282
|
+
]),
|
|
283
|
+
_: 1
|
|
284
|
+
}, 16, ["icon", "variant"])
|
|
285
|
+
]),
|
|
286
|
+
_: 1
|
|
287
|
+
}, 16, ["body"])) : e.addBtn.to ? (t(), o(S, {
|
|
288
|
+
key: 1,
|
|
289
|
+
to: e.addBtn.to,
|
|
290
|
+
class: "inline-flex"
|
|
291
|
+
}, {
|
|
292
|
+
default: l(() => [
|
|
293
|
+
u(f, c({
|
|
294
|
+
icon: e.addBtn.icon || "lucide:plus",
|
|
295
|
+
variant: e.addBtn.variant || "outline"
|
|
296
|
+
}, e.addBtn.buttonProps), {
|
|
297
|
+
default: l(() => [
|
|
298
|
+
m(r(e.addBtn.label || "Add New"), 1)
|
|
299
|
+
]),
|
|
300
|
+
_: 1
|
|
301
|
+
}, 16, ["icon", "variant"])
|
|
302
|
+
]),
|
|
303
|
+
_: 1
|
|
304
|
+
}, 8, ["to"])) : e.addBtn.href ? (t(), d("a", {
|
|
305
|
+
key: 2,
|
|
306
|
+
href: e.addBtn.href,
|
|
307
|
+
target: e.addBtn.target,
|
|
308
|
+
class: "inline-flex"
|
|
309
|
+
}, [
|
|
310
|
+
u(f, c({
|
|
311
|
+
icon: e.addBtn.icon || "lucide:plus",
|
|
312
|
+
variant: e.addBtn.variant || "outline"
|
|
313
|
+
}, e.addBtn.buttonProps), {
|
|
314
|
+
default: l(() => [
|
|
315
|
+
m(r(e.addBtn.label || "Add New"), 1)
|
|
316
|
+
]),
|
|
317
|
+
_: 1
|
|
318
|
+
}, 16, ["icon", "variant"])
|
|
319
|
+
], 8, se)) : (t(), o(f, c({
|
|
320
|
+
key: 3,
|
|
321
|
+
icon: e.addBtn.icon || "lucide:plus",
|
|
322
|
+
variant: e.addBtn.variant || "outline"
|
|
323
|
+
}, e.addBtn.buttonProps, {
|
|
324
|
+
onClick: n[6] || (n[6] = (g) => e.addBtn.onClick ? e.addBtn.onClick() : a.$emit("add"))
|
|
325
|
+
}), {
|
|
326
|
+
default: l(() => [
|
|
327
|
+
m(r(e.addBtn.label || "Add New"), 1)
|
|
328
|
+
]),
|
|
329
|
+
_: 1
|
|
330
|
+
}, 16, ["icon", "variant"]))
|
|
331
|
+
], 64)) : (t(), o(f, {
|
|
332
|
+
key: 1,
|
|
333
|
+
icon: "lucide:plus",
|
|
334
|
+
variant: "outline",
|
|
335
|
+
onClick: n[7] || (n[7] = (g) => a.$emit("add"))
|
|
336
|
+
}, {
|
|
337
|
+
default: l(() => [...n[9] || (n[9] = [
|
|
338
|
+
m(" Add New ", -1)
|
|
339
|
+
])]),
|
|
340
|
+
_: 1
|
|
341
|
+
}))
|
|
342
|
+
], 64)) : v("", !0)
|
|
343
|
+
])
|
|
344
|
+
])
|
|
345
|
+
]) : (t(), d(w, { key: 1 }, [
|
|
346
|
+
N.value ? (t(), o(A(N.value), {
|
|
347
|
+
key: 0,
|
|
348
|
+
data: e.data,
|
|
349
|
+
loading: e.loading,
|
|
350
|
+
refetch: e.refetch
|
|
351
|
+
}, null, 8, ["data", "loading", "refetch"])) : (t(), d("div", re, " Please provide a `:list` or `:table` component. "))
|
|
352
|
+
], 64))
|
|
353
|
+
]),
|
|
354
|
+
e.pagination && e.pageInfo && e.pageInfo.totalPages > 1 ? (t(), d("div", ue, [
|
|
355
|
+
u(O(W), c({
|
|
356
|
+
"current-page": e.pageInfo.currentPage,
|
|
357
|
+
"total-pages": e.pageInfo.totalPages,
|
|
358
|
+
"total-items": e.pageInfo.totalItems
|
|
359
|
+
}, e.paginationProps, {
|
|
360
|
+
onChange: z,
|
|
361
|
+
"onUpdate:itemsPerPage": E
|
|
362
|
+
}), null, 16, ["current-page", "total-pages", "total-items"])
|
|
363
|
+
])) : v("", !0)
|
|
364
|
+
]);
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
export {
|
|
369
|
+
Be as default
|
|
370
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
schema: any[];
|
|
3
|
+
modelValue: Record<string, any>;
|
|
4
|
+
type?: 'modal' | 'dropdown';
|
|
5
|
+
};
|
|
6
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
7
|
+
"update:modelValue": (val: Record<string, any>) => any;
|
|
8
|
+
change: (val: Record<string, any>) => any;
|
|
9
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
"onUpdate:modelValue"?: (val: Record<string, any>) => any;
|
|
11
|
+
onChange?: (val: Record<string, any>) => any;
|
|
12
|
+
}>, {
|
|
13
|
+
type: "modal" | "dropdown";
|
|
14
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
export default _default;
|