vlite3 0.3.4 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Badge.vue.js +4 -4
- package/components/Button.vue.d.ts +1 -0
- package/components/Button.vue.js +46 -35
- package/components/DataList/DataList.vue.d.ts +9 -7
- package/components/DataList/DataList.vue.js +78 -55
- package/components/DataList/types.d.ts +5 -10
- package/components/DataTable/DataTable.vue.d.ts +1 -3
- package/components/DataTable/DataTable.vue.js +136 -127
- package/components/DataTable/DataTableRow.vue.js +1 -1
- package/components/DataTable/types.d.ts +3 -10
- package/components/Form/types.d.ts +0 -3
- package/components/Input.vue.js +24 -25
- 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 +47 -0
- package/components/Screen/Screen.vue.js +411 -0
- package/components/Screen/Screen.vue2.js +4 -0
- package/components/Screen/ScreenFilter.vue.d.ts +15 -0
- package/components/Screen/ScreenFilter.vue.js +169 -0
- package/components/Screen/ScreenFilter.vue2.js +4 -0
- package/components/Screen/index.d.ts +3 -0
- package/components/Screen/types.d.ts +53 -0
- package/index.d.ts +1 -0
- package/index.js +39 -35
- package/package.json +1 -1
- package/style.css +4 -1
- package/types/button.d.ts +4 -0
- package/utils/usePersistentState.d.ts +8 -0
- package/utils/usePersistentState.js +7 -0
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { defineComponent as M, computed as V, ref as h, provide as E, watch as S, resolveComponent as X, openBlock as a, createElementBlock as i, createElementVNode as r, renderSlot as B, toDisplayString as u, createCommentVNode as g, createBlock as o, normalizeClass as F, unref as T, createVNode as c, resolveDynamicComponent as N, Fragment as P, mergeProps as m, withCtx as s, createTextVNode as v } from "vue";
|
|
2
|
+
import Y from "../Input.vue.js";
|
|
3
|
+
import f from "../Button.vue.js";
|
|
4
|
+
import R from "../Icon.vue.js";
|
|
5
|
+
import H from "../Modal.vue.js";
|
|
6
|
+
import Z from "../ConfirmationModal.vue.js";
|
|
7
|
+
import p from "../Pagination/Pagination.vue.js";
|
|
8
|
+
import _ from "./ScreenFilter.vue.js";
|
|
9
|
+
import { usePersistentState as ee } from "../../utils/usePersistentState.js";
|
|
10
|
+
const te = { class: "flex flex-col w-full space-y-8" }, ae = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "flex flex-col md:flex-row sm:items-start md:items-center justify-between gap-4"
|
|
13
|
+
}, ne = { class: "flex flex-col shrink-0" }, le = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "text-fs-7.5 font-bold text-foreground"
|
|
16
|
+
}, de = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "text-sm text-gray-700 mt-1 md:max-w-[450px]"
|
|
19
|
+
}, ie = { class: "flex flex-col sm:flex-row items-start sm:items-center gap-2.5 w-full justify-end" }, oe = { class: "flex items-center gap-2 w-full sm:w-auto flex-1 md:flex-none justify-start sm:justify-end" }, se = {
|
|
20
|
+
key: 1,
|
|
21
|
+
class: "flex items-center p-1 rounded-md border border-border shrink-0"
|
|
22
|
+
}, re = {
|
|
23
|
+
key: 4,
|
|
24
|
+
class: "w-full md:w-60! max-sm:order-last"
|
|
25
|
+
}, ue = { class: "flex items-center gap-3 max-sm:w-full sm:w-auto max-sm:order-last" }, ce = ["href", "target"], fe = { class: "flex-1 w-full relative min-h-[300px]" }, me = { class: "flex flex-col items-center justify-center py-16 px-4 text-center bg-card border border-border rounded-lg shadow-sm" }, ge = { class: "flex h-16 w-16 items-center justify-center rounded-full bg-muted mb-4" }, ve = { class: "text-lg font-semibold text-foreground" }, ye = { class: "mt-2 text-sm text-muted-foreground max-w-sm" }, he = { class: "mt-6" }, Be = ["href", "target"], be = {
|
|
26
|
+
key: 1,
|
|
27
|
+
class: "p-8 text-center text-muted-foreground border border-dashed border-border rounded-lg"
|
|
28
|
+
}, we = {
|
|
29
|
+
key: 2,
|
|
30
|
+
class: "-mt-2"
|
|
31
|
+
}, Se = /* @__PURE__ */ M({
|
|
32
|
+
__name: "Screen",
|
|
33
|
+
props: {
|
|
34
|
+
name: { default: "" },
|
|
35
|
+
title: { default: "" },
|
|
36
|
+
description: { default: "" },
|
|
37
|
+
pageInfo: {},
|
|
38
|
+
data: { default: () => [] },
|
|
39
|
+
loading: { type: Boolean, default: !1 },
|
|
40
|
+
refetch: {},
|
|
41
|
+
paginationProps: { default: () => ({
|
|
42
|
+
alignment: "end",
|
|
43
|
+
navType: "icon",
|
|
44
|
+
showItemsPerPage: !1,
|
|
45
|
+
itemsPerPageOptions: [10, 25, 50, 100]
|
|
46
|
+
}) },
|
|
47
|
+
emptyTitle: { default: "No records found" },
|
|
48
|
+
emptyDescription: { default: "We could not find any records matching your criteria." },
|
|
49
|
+
emptyIcon: { default: "lucide:inbox" },
|
|
50
|
+
addComponent: {},
|
|
51
|
+
addBtn: {},
|
|
52
|
+
list: {},
|
|
53
|
+
table: {},
|
|
54
|
+
customHeader: { type: Boolean, default: !1 },
|
|
55
|
+
canSearch: { type: Boolean, default: !0 },
|
|
56
|
+
canAdd: { type: Boolean, default: !0 },
|
|
57
|
+
pagination: { type: Boolean, default: !0 },
|
|
58
|
+
filterSchema: { default: () => [] },
|
|
59
|
+
filterType: { default: "modal" },
|
|
60
|
+
showRefresh: { type: Boolean, default: !1 }
|
|
61
|
+
},
|
|
62
|
+
emits: ["add", "delete"],
|
|
63
|
+
setup(e, { emit: L }) {
|
|
64
|
+
const l = e, j = L, K = V(() => l.name || l.title || "default-screen"), w = ee(
|
|
65
|
+
`view-mode-${K.value}`,
|
|
66
|
+
l.table ? "table" : "list"
|
|
67
|
+
), C = h(""), D = h({}), b = h(l.pageInfo?.currentPage || 1), $ = h(l.pageInfo?.itemsPerPage || l.paginationProps?.itemsPerPage || 10), y = h([]), U = h([]), k = h(!1);
|
|
68
|
+
E("screen-selected-rows", y), E("screen-request-delete", (t) => I(t));
|
|
69
|
+
const I = (t) => {
|
|
70
|
+
U.value = t, k.value = !0;
|
|
71
|
+
}, O = () => {
|
|
72
|
+
j("delete", U.value), k.value = !1, y.value = [];
|
|
73
|
+
}, Q = (t) => {
|
|
74
|
+
j("delete", t), y.value = [];
|
|
75
|
+
};
|
|
76
|
+
S(
|
|
77
|
+
() => l.pageInfo?.currentPage,
|
|
78
|
+
(t) => {
|
|
79
|
+
t && (b.value = t);
|
|
80
|
+
}
|
|
81
|
+
), S(
|
|
82
|
+
() => l.pageInfo?.itemsPerPage,
|
|
83
|
+
(t) => {
|
|
84
|
+
t && ($.value = t);
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
let A = null;
|
|
88
|
+
S(C, (t) => {
|
|
89
|
+
A && clearTimeout(A), A = setTimeout(() => {
|
|
90
|
+
b.value = 1, x();
|
|
91
|
+
}, 300);
|
|
92
|
+
});
|
|
93
|
+
const W = (t) => {
|
|
94
|
+
b.value = t, x();
|
|
95
|
+
}, G = (t) => {
|
|
96
|
+
$.value = t, b.value = 1, x();
|
|
97
|
+
}, x = () => {
|
|
98
|
+
const t = {
|
|
99
|
+
pageinfo: {
|
|
100
|
+
page: b.value,
|
|
101
|
+
limit: $.value
|
|
102
|
+
},
|
|
103
|
+
pagination: {
|
|
104
|
+
page: b.value,
|
|
105
|
+
limit: $.value
|
|
106
|
+
},
|
|
107
|
+
search: C.value,
|
|
108
|
+
filter: D.value
|
|
109
|
+
};
|
|
110
|
+
l.refetch && l.refetch(t);
|
|
111
|
+
}, z = V(() => w.value === "table" && l.table ? l.table : l.list), J = V(() => l.data && l.data.length > 0);
|
|
112
|
+
return (t, n) => {
|
|
113
|
+
const q = X("router-link");
|
|
114
|
+
return a(), i("div", te, [
|
|
115
|
+
e.customHeader ? B(t.$slots, "custom-header", { key: 1 }) : (a(), i("div", ae, [
|
|
116
|
+
r("div", ne, [
|
|
117
|
+
B(t.$slots, "title", {}, () => [
|
|
118
|
+
e.title ? (a(), i("h1", le, u(e.title), 1)) : g("", !0)
|
|
119
|
+
]),
|
|
120
|
+
B(t.$slots, "description", {}, () => [
|
|
121
|
+
e.description ? (a(), i("p", de, u(e.description), 1)) : g("", !0)
|
|
122
|
+
])
|
|
123
|
+
]),
|
|
124
|
+
r("div", ie, [
|
|
125
|
+
r("div", oe, [
|
|
126
|
+
y.value.length > 0 ? (a(), o(f, {
|
|
127
|
+
key: 0,
|
|
128
|
+
variant: "outline",
|
|
129
|
+
class: "hover:bg-destructive/10 shrink-0 h-9! w-9!",
|
|
130
|
+
icon: "lucide:trash-2",
|
|
131
|
+
title: "Delete Selected",
|
|
132
|
+
onClick: n[0] || (n[0] = (d) => I(y.value))
|
|
133
|
+
})) : g("", !0),
|
|
134
|
+
e.table && e.list ? (a(), i("div", se, [
|
|
135
|
+
r("button", {
|
|
136
|
+
onClick: n[1] || (n[1] = (d) => w.value = "list"),
|
|
137
|
+
class: F(["p-1.5 rounded", [
|
|
138
|
+
T(w) === "list" ? "bg-secondary/85 dark:bg-gray-250 shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
139
|
+
]]),
|
|
140
|
+
title: "List View"
|
|
141
|
+
}, [
|
|
142
|
+
c(R, {
|
|
143
|
+
icon: "lucide:layout-grid",
|
|
144
|
+
class: "w-4 h-4"
|
|
145
|
+
})
|
|
146
|
+
], 2),
|
|
147
|
+
r("button", {
|
|
148
|
+
onClick: n[2] || (n[2] = (d) => w.value = "table"),
|
|
149
|
+
class: F(["p-1.5 rounded", [
|
|
150
|
+
T(w) === "table" ? "bg-secondary/85 dark:bg-gray-250 shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
151
|
+
]]),
|
|
152
|
+
title: "Table View"
|
|
153
|
+
}, [
|
|
154
|
+
c(R, {
|
|
155
|
+
icon: "lucide:list",
|
|
156
|
+
class: "w-4 h-4"
|
|
157
|
+
})
|
|
158
|
+
], 2)
|
|
159
|
+
])) : g("", !0),
|
|
160
|
+
B(t.$slots, "before-search"),
|
|
161
|
+
e.showRefresh ? (a(), o(f, {
|
|
162
|
+
key: 2,
|
|
163
|
+
variant: "outline",
|
|
164
|
+
icon: "lucide:refresh-cw",
|
|
165
|
+
size: "lg",
|
|
166
|
+
class: "shrink-0 h-9! w-9!",
|
|
167
|
+
title: "Refresh",
|
|
168
|
+
disabled: e.loading,
|
|
169
|
+
onClick: x
|
|
170
|
+
}, null, 8, ["disabled"])) : g("", !0),
|
|
171
|
+
e.filterSchema && e.filterSchema.length > 0 ? (a(), o(_, {
|
|
172
|
+
key: 3,
|
|
173
|
+
schema: e.filterSchema,
|
|
174
|
+
type: e.filterType,
|
|
175
|
+
modelValue: D.value,
|
|
176
|
+
"onUpdate:modelValue": n[3] || (n[3] = (d) => D.value = d),
|
|
177
|
+
onChange: x
|
|
178
|
+
}, null, 8, ["schema", "type", "modelValue"])) : g("", !0),
|
|
179
|
+
e.canSearch ? (a(), i("div", re, [
|
|
180
|
+
c(Y, {
|
|
181
|
+
lazy: "",
|
|
182
|
+
modelValue: C.value,
|
|
183
|
+
"onUpdate:modelValue": n[4] || (n[4] = (d) => C.value = d),
|
|
184
|
+
icon: "lucide:search",
|
|
185
|
+
placeholder: "Search...",
|
|
186
|
+
variant: "outline",
|
|
187
|
+
class: "bg-background w-full",
|
|
188
|
+
"show-clear-button": !0
|
|
189
|
+
}, null, 8, ["modelValue"])
|
|
190
|
+
])) : g("", !0)
|
|
191
|
+
]),
|
|
192
|
+
r("div", ue, [
|
|
193
|
+
B(t.$slots, "actions", {}, () => [
|
|
194
|
+
e.addComponent ? (a(), o(N(e.addComponent), { key: 0 })) : e.canAdd ? (a(), i(P, { key: 1 }, [
|
|
195
|
+
e.addBtn ? (a(), i(P, { key: 0 }, [
|
|
196
|
+
e.addBtn.modal ? (a(), o(H, m({
|
|
197
|
+
key: 0,
|
|
198
|
+
body: e.addBtn.modal
|
|
199
|
+
}, e.addBtn.modalProps, {
|
|
200
|
+
refetch: e.refetch,
|
|
201
|
+
data: e.data,
|
|
202
|
+
triggerClass: "w-full",
|
|
203
|
+
loading: e.loading
|
|
204
|
+
}), {
|
|
205
|
+
trigger: s(() => [
|
|
206
|
+
c(f, m({
|
|
207
|
+
class: "w-full",
|
|
208
|
+
icon: e.addBtn.icon || "fluent:add-16-filled",
|
|
209
|
+
variant: e.addBtn.variant || "primary"
|
|
210
|
+
}, e.addBtn.buttonProps), {
|
|
211
|
+
default: s(() => [
|
|
212
|
+
v(u(e.addBtn.label || "Add"), 1)
|
|
213
|
+
]),
|
|
214
|
+
_: 1
|
|
215
|
+
}, 16, ["icon", "variant"])
|
|
216
|
+
]),
|
|
217
|
+
_: 1
|
|
218
|
+
}, 16, ["body", "refetch", "data", "loading"])) : e.addBtn.to ? (a(), o(q, {
|
|
219
|
+
key: 1,
|
|
220
|
+
to: e.addBtn.to,
|
|
221
|
+
class: "inline-flex w-full sm:w-auto"
|
|
222
|
+
}, {
|
|
223
|
+
default: s(() => [
|
|
224
|
+
c(f, m({
|
|
225
|
+
class: "w-full",
|
|
226
|
+
icon: e.addBtn.icon || "fluent:add-16-filled",
|
|
227
|
+
variant: e.addBtn.variant || "primary"
|
|
228
|
+
}, e.addBtn.buttonProps), {
|
|
229
|
+
default: s(() => [
|
|
230
|
+
v(u(e.addBtn.label || "Add"), 1)
|
|
231
|
+
]),
|
|
232
|
+
_: 1
|
|
233
|
+
}, 16, ["icon", "variant"])
|
|
234
|
+
]),
|
|
235
|
+
_: 1
|
|
236
|
+
}, 8, ["to"])) : e.addBtn.href ? (a(), i("a", {
|
|
237
|
+
key: 2,
|
|
238
|
+
href: e.addBtn.href,
|
|
239
|
+
target: e.addBtn.target,
|
|
240
|
+
class: "inline-flex w-full sm:w-auto"
|
|
241
|
+
}, [
|
|
242
|
+
c(f, m({
|
|
243
|
+
class: "w-full",
|
|
244
|
+
icon: e.addBtn.icon || "fluent:add-16-filled",
|
|
245
|
+
variant: e.addBtn.variant || "primary"
|
|
246
|
+
}, e.addBtn.buttonProps), {
|
|
247
|
+
default: s(() => [
|
|
248
|
+
v(u(e.addBtn.label || "Add"), 1)
|
|
249
|
+
]),
|
|
250
|
+
_: 1
|
|
251
|
+
}, 16, ["icon", "variant"])
|
|
252
|
+
], 8, ce)) : (a(), o(f, m({
|
|
253
|
+
key: 3,
|
|
254
|
+
class: "w-full sm:w-auto",
|
|
255
|
+
icon: e.addBtn.icon || "fluent:add-16-filled",
|
|
256
|
+
variant: e.addBtn.variant || "primary"
|
|
257
|
+
}, e.addBtn.buttonProps, {
|
|
258
|
+
onClick: n[5] || (n[5] = (d) => e.addBtn.onClick ? e.addBtn.onClick() : t.$emit("add"))
|
|
259
|
+
}), {
|
|
260
|
+
default: s(() => [
|
|
261
|
+
v(u(e.addBtn.label || "Add"), 1)
|
|
262
|
+
]),
|
|
263
|
+
_: 1
|
|
264
|
+
}, 16, ["icon", "variant"]))
|
|
265
|
+
], 64)) : (a(), o(f, {
|
|
266
|
+
key: 1,
|
|
267
|
+
class: "w-full sm:w-auto",
|
|
268
|
+
icon: "fluent:add-16-filled",
|
|
269
|
+
variant: "primary",
|
|
270
|
+
onClick: n[6] || (n[6] = (d) => t.$emit("add"))
|
|
271
|
+
}, {
|
|
272
|
+
default: s(() => [...n[12] || (n[12] = [
|
|
273
|
+
v(" Add ", -1)
|
|
274
|
+
])]),
|
|
275
|
+
_: 1
|
|
276
|
+
}))
|
|
277
|
+
], 64)) : g("", !0)
|
|
278
|
+
]),
|
|
279
|
+
B(t.$slots, "after-add")
|
|
280
|
+
])
|
|
281
|
+
])
|
|
282
|
+
])),
|
|
283
|
+
r("div", fe, [
|
|
284
|
+
!J.value && !e.loading ? B(t.$slots, "empty", { key: 0 }, () => [
|
|
285
|
+
r("div", me, [
|
|
286
|
+
r("div", ge, [
|
|
287
|
+
c(R, {
|
|
288
|
+
icon: e.emptyIcon,
|
|
289
|
+
class: "h-8 w-8 text-muted-foreground"
|
|
290
|
+
}, null, 8, ["icon"])
|
|
291
|
+
]),
|
|
292
|
+
r("h3", ve, u(e.emptyTitle), 1),
|
|
293
|
+
r("p", ye, u(e.emptyDescription), 1),
|
|
294
|
+
r("div", he, [
|
|
295
|
+
e.addComponent ? (a(), o(N(e.addComponent), { key: 0 })) : e.canAdd ? (a(), i(P, { key: 1 }, [
|
|
296
|
+
e.addBtn ? (a(), i(P, { key: 0 }, [
|
|
297
|
+
e.addBtn.modal ? (a(), o(H, m({
|
|
298
|
+
key: 0,
|
|
299
|
+
body: e.addBtn.modal
|
|
300
|
+
}, e.addBtn.modalProps), {
|
|
301
|
+
trigger: s(() => [
|
|
302
|
+
c(f, m({
|
|
303
|
+
icon: e.addBtn.icon || "fluent:add-16-filled",
|
|
304
|
+
variant: e.addBtn.variant || "outline"
|
|
305
|
+
}, e.addBtn.buttonProps), {
|
|
306
|
+
default: s(() => [
|
|
307
|
+
v(u(e.addBtn.label || "Add New"), 1)
|
|
308
|
+
]),
|
|
309
|
+
_: 1
|
|
310
|
+
}, 16, ["icon", "variant"])
|
|
311
|
+
]),
|
|
312
|
+
_: 1
|
|
313
|
+
}, 16, ["body"])) : e.addBtn.to ? (a(), o(q, {
|
|
314
|
+
key: 1,
|
|
315
|
+
to: e.addBtn.to,
|
|
316
|
+
class: "inline-flex"
|
|
317
|
+
}, {
|
|
318
|
+
default: s(() => [
|
|
319
|
+
c(f, m({
|
|
320
|
+
icon: e.addBtn.icon || "fluent:add-16-filled",
|
|
321
|
+
variant: e.addBtn.variant || "outline"
|
|
322
|
+
}, e.addBtn.buttonProps), {
|
|
323
|
+
default: s(() => [
|
|
324
|
+
v(u(e.addBtn.label || "Add New"), 1)
|
|
325
|
+
]),
|
|
326
|
+
_: 1
|
|
327
|
+
}, 16, ["icon", "variant"])
|
|
328
|
+
]),
|
|
329
|
+
_: 1
|
|
330
|
+
}, 8, ["to"])) : e.addBtn.href ? (a(), i("a", {
|
|
331
|
+
key: 2,
|
|
332
|
+
href: e.addBtn.href,
|
|
333
|
+
target: e.addBtn.target,
|
|
334
|
+
class: "inline-flex"
|
|
335
|
+
}, [
|
|
336
|
+
c(f, m({
|
|
337
|
+
icon: e.addBtn.icon || "lucide:plus",
|
|
338
|
+
variant: e.addBtn.variant || "outline"
|
|
339
|
+
}, e.addBtn.buttonProps), {
|
|
340
|
+
default: s(() => [
|
|
341
|
+
v(u(e.addBtn.label || "Add New"), 1)
|
|
342
|
+
]),
|
|
343
|
+
_: 1
|
|
344
|
+
}, 16, ["icon", "variant"])
|
|
345
|
+
], 8, Be)) : (a(), o(f, m({
|
|
346
|
+
key: 3,
|
|
347
|
+
icon: e.addBtn.icon || "lucide:plus",
|
|
348
|
+
variant: e.addBtn.variant || "outline"
|
|
349
|
+
}, e.addBtn.buttonProps, {
|
|
350
|
+
onClick: n[7] || (n[7] = (d) => e.addBtn.onClick ? e.addBtn.onClick() : t.$emit("add"))
|
|
351
|
+
}), {
|
|
352
|
+
default: s(() => [
|
|
353
|
+
v(u(e.addBtn.label || "Add New"), 1)
|
|
354
|
+
]),
|
|
355
|
+
_: 1
|
|
356
|
+
}, 16, ["icon", "variant"]))
|
|
357
|
+
], 64)) : (a(), o(f, {
|
|
358
|
+
key: 1,
|
|
359
|
+
icon: "lucide:plus",
|
|
360
|
+
variant: "outline",
|
|
361
|
+
onClick: n[8] || (n[8] = (d) => t.$emit("add"))
|
|
362
|
+
}, {
|
|
363
|
+
default: s(() => [...n[13] || (n[13] = [
|
|
364
|
+
v(" Add New ", -1)
|
|
365
|
+
])]),
|
|
366
|
+
_: 1
|
|
367
|
+
}))
|
|
368
|
+
], 64)) : g("", !0)
|
|
369
|
+
])
|
|
370
|
+
])
|
|
371
|
+
]) : (a(), i(P, { key: 1 }, [
|
|
372
|
+
z.value ? (a(), o(N(z.value), {
|
|
373
|
+
key: 0,
|
|
374
|
+
data: e.data,
|
|
375
|
+
loading: e.loading,
|
|
376
|
+
refetch: e.refetch,
|
|
377
|
+
selectedRows: y.value,
|
|
378
|
+
"onUpdate:selectedRows": n[9] || (n[9] = (d) => y.value = d),
|
|
379
|
+
delete: I,
|
|
380
|
+
onDelete: Q
|
|
381
|
+
}, null, 40, ["data", "loading", "refetch", "selectedRows"])) : (a(), i("div", be, " Please provide a `:list` or `:table` component. "))
|
|
382
|
+
], 64))
|
|
383
|
+
]),
|
|
384
|
+
e.pagination && e.pageInfo && e.pageInfo.totalPages > 1 ? (a(), i("div", we, [
|
|
385
|
+
c(T(p), m({
|
|
386
|
+
"current-page": e.pageInfo.currentPage,
|
|
387
|
+
"total-pages": e.pageInfo.totalPages,
|
|
388
|
+
"total-items": e.pageInfo.totalItems
|
|
389
|
+
}, e.paginationProps, {
|
|
390
|
+
onChange: W,
|
|
391
|
+
"onUpdate:itemsPerPage": G
|
|
392
|
+
}), null, 16, ["current-page", "total-pages", "total-items"])
|
|
393
|
+
])) : g("", !0),
|
|
394
|
+
c(Z, {
|
|
395
|
+
show: k.value,
|
|
396
|
+
"onUpdate:show": n[10] || (n[10] = (d) => k.value = d),
|
|
397
|
+
title: "Confirm Deletion",
|
|
398
|
+
description: "Are you sure you want to delete the selected items? This action cannot be undone.",
|
|
399
|
+
"confirm-text": "Delete",
|
|
400
|
+
"cancel-text": "Cancel",
|
|
401
|
+
variant: "danger",
|
|
402
|
+
onConfirm: O,
|
|
403
|
+
onCancel: n[11] || (n[11] = (d) => k.value = !1)
|
|
404
|
+
}, null, 8, ["show"])
|
|
405
|
+
]);
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
export {
|
|
410
|
+
Se as default
|
|
411
|
+
};
|
|
@@ -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;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { defineComponent as b, ref as V, computed as F, openBlock as r, createBlock as a, withCtx as s, createElementVNode as t, createVNode as n, unref as v, toDisplayString as w, withModifiers as k } from "vue";
|
|
2
|
+
import p from "../Button.vue.js";
|
|
3
|
+
import C from "../Modal.vue.js";
|
|
4
|
+
import O from "../Dropdown/Dropdown.vue.js";
|
|
5
|
+
import f from "../Icon.vue.js";
|
|
6
|
+
import x from "../Form/Form.vue.js";
|
|
7
|
+
/* empty css */
|
|
8
|
+
import "v-datepicker-lite";
|
|
9
|
+
import "v-datepicker-lite/style.css";
|
|
10
|
+
import "@jaames/iro";
|
|
11
|
+
import "@vueuse/core";
|
|
12
|
+
/* empty css */
|
|
13
|
+
import "iconify-icon-picker";
|
|
14
|
+
import "iconify-icon-picker/style.css";
|
|
15
|
+
/* empty css */
|
|
16
|
+
/* empty css */
|
|
17
|
+
import "../../core/config.js";
|
|
18
|
+
const $ = { class: "" }, S = { class: "py-3 px-3.5 w-[300px] sm:w-[320px] max-h-[85vh] overflow-y-auto bg-card rounded-md border border-border shadow-lg text-left" }, P = /* @__PURE__ */ b({
|
|
19
|
+
__name: "ScreenFilter",
|
|
20
|
+
props: {
|
|
21
|
+
schema: {},
|
|
22
|
+
modelValue: {},
|
|
23
|
+
type: { default: "modal" }
|
|
24
|
+
},
|
|
25
|
+
emits: ["update:modelValue", "change"],
|
|
26
|
+
setup(i, { emit: y }) {
|
|
27
|
+
const m = i, c = y, l = V(!1), d = F(() => m.modelValue ? Object.keys(m.modelValue).filter(
|
|
28
|
+
(o) => m.modelValue[o] !== "" && m.modelValue[o] !== null && m.modelValue[o] !== void 0
|
|
29
|
+
).length : 0), h = (o) => {
|
|
30
|
+
c("update:modelValue", o.values), c("change", o.values), l.value = !1;
|
|
31
|
+
}, g = () => {
|
|
32
|
+
c("update:modelValue", {}), c("change", {});
|
|
33
|
+
};
|
|
34
|
+
return (o, e) => i.type === "modal" ? (r(), a(C, {
|
|
35
|
+
key: 0,
|
|
36
|
+
title: "Filters",
|
|
37
|
+
show: l.value,
|
|
38
|
+
"onUpdate:show": e[2] || (e[2] = (u) => l.value = u),
|
|
39
|
+
"max-width": "sm:max-w-md"
|
|
40
|
+
}, {
|
|
41
|
+
trigger: s(() => [
|
|
42
|
+
d.value > 0 ? (r(), a(p, {
|
|
43
|
+
key: 0,
|
|
44
|
+
variant: "secondary",
|
|
45
|
+
class: "flex items-center gap-1.5 pl-3 pr-1.5 shrink-0",
|
|
46
|
+
onClick: e[0] || (e[0] = (u) => l.value = !0)
|
|
47
|
+
}, {
|
|
48
|
+
default: s(() => [
|
|
49
|
+
n(f, {
|
|
50
|
+
icon: "ci:filter",
|
|
51
|
+
class: "w-4 h-4"
|
|
52
|
+
}),
|
|
53
|
+
t("span", null, "Filters (" + w(d.value) + ")", 1),
|
|
54
|
+
t("div", {
|
|
55
|
+
onClick: k(g, ["stop"]),
|
|
56
|
+
class: "ml-1 p-1 hover:bg-black/10 dark:hover:bg-white/10 rounded-full transition-colors cursor-pointer"
|
|
57
|
+
}, [
|
|
58
|
+
n(f, {
|
|
59
|
+
icon: "lucide:x",
|
|
60
|
+
class: "w-4 h-4"
|
|
61
|
+
})
|
|
62
|
+
])
|
|
63
|
+
]),
|
|
64
|
+
_: 1
|
|
65
|
+
})) : (r(), a(p, {
|
|
66
|
+
key: 1,
|
|
67
|
+
variant: "outline",
|
|
68
|
+
onClick: e[1] || (e[1] = (u) => l.value = !0),
|
|
69
|
+
title: "Filter",
|
|
70
|
+
size: "lg",
|
|
71
|
+
asIcon: "",
|
|
72
|
+
class: "shrink-0 h-9! w-9!"
|
|
73
|
+
}, {
|
|
74
|
+
default: s(() => [...e[4] || (e[4] = [
|
|
75
|
+
t("div", { class: "text-gray-800! h-4! w-4! flex items-center justify-center" }, [
|
|
76
|
+
t("svg", {
|
|
77
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
78
|
+
width: "1.132em",
|
|
79
|
+
height: "1.132em",
|
|
80
|
+
viewBox: "0 0 24 24"
|
|
81
|
+
}, [
|
|
82
|
+
t("path", {
|
|
83
|
+
fill: "none",
|
|
84
|
+
stroke: "currentColor",
|
|
85
|
+
"stroke-linecap": "round",
|
|
86
|
+
"stroke-linejoin": "round",
|
|
87
|
+
"stroke-width": "2",
|
|
88
|
+
d: "M20.67 7c.083-.182.127-.374.16-.627c.202-1.572.303-2.358-.158-2.866C20.212 3 19.396 3 17.766 3H6.234c-1.63 0-2.445 0-2.906.507c-.461.508-.36 1.294-.158 2.866c.06.459.158.72.457 1.076c.969 1.15 2.742 3.197 5.23 5.057c.228.17.377.448.402.755c.28 3.425.537 5.765.674 6.917c.071.604.741 1.069 1.293.678c.927-.655 2.66-1.39 2.888-2.612c.108-.577.267-1.585.445-3.244M17.5 8v7m3.5-3.5h-7"
|
|
89
|
+
})
|
|
90
|
+
])
|
|
91
|
+
], -1)
|
|
92
|
+
])]),
|
|
93
|
+
_: 1
|
|
94
|
+
}))
|
|
95
|
+
]),
|
|
96
|
+
default: s(() => [
|
|
97
|
+
t("div", $, [
|
|
98
|
+
n(v(x), {
|
|
99
|
+
schema: i.schema,
|
|
100
|
+
values: i.modelValue,
|
|
101
|
+
"submit-text": "Apply Filters",
|
|
102
|
+
onOnSubmit: h
|
|
103
|
+
}, null, 8, ["schema", "values"])
|
|
104
|
+
])
|
|
105
|
+
]),
|
|
106
|
+
_: 1
|
|
107
|
+
}, 8, ["show"])) : (r(), a(v(O), {
|
|
108
|
+
key: 1,
|
|
109
|
+
isOpen: l.value,
|
|
110
|
+
"onUpdate:isOpen": e[3] || (e[3] = (u) => l.value = u),
|
|
111
|
+
"close-on-select": !1,
|
|
112
|
+
position: "bottom-end",
|
|
113
|
+
class: "w-auto"
|
|
114
|
+
}, {
|
|
115
|
+
trigger: s(() => [
|
|
116
|
+
d.value > 0 ? (r(), a(p, {
|
|
117
|
+
key: 0,
|
|
118
|
+
variant: "secondary",
|
|
119
|
+
class: "flex items-center gap-1.5 pl-3 pr-1.5 shrink-0 bg-gray-150! hover:bg-gray-100!",
|
|
120
|
+
style: { "pointer-events": "auto" }
|
|
121
|
+
}, {
|
|
122
|
+
default: s(() => [
|
|
123
|
+
n(f, {
|
|
124
|
+
icon: "ci:filter",
|
|
125
|
+
class: "w-4 h-4"
|
|
126
|
+
}),
|
|
127
|
+
t("span", null, "Filters (" + w(d.value) + ")", 1),
|
|
128
|
+
t("div", {
|
|
129
|
+
onClick: k(g, ["stop"]),
|
|
130
|
+
class: "ml-1 p-1 hover:bg-black/10 dark:hover:bg-white/10 rounded-full transition-colors cursor-pointer"
|
|
131
|
+
}, [
|
|
132
|
+
n(f, {
|
|
133
|
+
icon: "lucide:x",
|
|
134
|
+
class: "w-4 h-4"
|
|
135
|
+
})
|
|
136
|
+
])
|
|
137
|
+
]),
|
|
138
|
+
_: 1
|
|
139
|
+
})) : (r(), a(p, {
|
|
140
|
+
key: 1,
|
|
141
|
+
variant: "outline",
|
|
142
|
+
icon: "hugeicons:filter-add",
|
|
143
|
+
title: "Filter",
|
|
144
|
+
size: "lg",
|
|
145
|
+
class: "shrink-0 h-9! w-9!"
|
|
146
|
+
}))
|
|
147
|
+
]),
|
|
148
|
+
default: s(() => [
|
|
149
|
+
t("div", S, [
|
|
150
|
+
n(v(x), {
|
|
151
|
+
schema: i.schema,
|
|
152
|
+
values: i.modelValue,
|
|
153
|
+
"submit-text": "Apply Filters",
|
|
154
|
+
"submit-props": {
|
|
155
|
+
size: "sm",
|
|
156
|
+
class: "w-full",
|
|
157
|
+
textClass: "-text-fs-1!"
|
|
158
|
+
},
|
|
159
|
+
onOnSubmit: h
|
|
160
|
+
}, null, 8, ["schema", "values"])
|
|
161
|
+
])
|
|
162
|
+
]),
|
|
163
|
+
_: 1
|
|
164
|
+
}, 8, ["isOpen"]));
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
export {
|
|
168
|
+
P as default
|
|
169
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { PageInfo, PaginationProps } from '../Pagination';
|
|
3
|
+
import { ButtonVariant } from '../../types';
|
|
4
|
+
import { IForm } from '../Form';
|
|
5
|
+
export interface ScreenPaginationProps extends Omit<PaginationProps, 'currentPage' | 'totalPages'> {
|
|
6
|
+
}
|
|
7
|
+
export interface AddBtnConfig {
|
|
8
|
+
label?: string;
|
|
9
|
+
icon?: string;
|
|
10
|
+
variant?: ButtonVariant;
|
|
11
|
+
to?: string | Record<string, any>;
|
|
12
|
+
href?: string;
|
|
13
|
+
target?: string;
|
|
14
|
+
onClick?: () => void;
|
|
15
|
+
modal?: Component | any;
|
|
16
|
+
modalProps?: Record<string, any>;
|
|
17
|
+
buttonProps?: Record<string, any>;
|
|
18
|
+
}
|
|
19
|
+
export interface ScreenProps {
|
|
20
|
+
name?: string;
|
|
21
|
+
title?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
pageInfo?: PageInfo;
|
|
24
|
+
data?: any[];
|
|
25
|
+
loading?: boolean;
|
|
26
|
+
refetch?: (payload: {
|
|
27
|
+
pageinfo: {
|
|
28
|
+
page: number;
|
|
29
|
+
limit: number;
|
|
30
|
+
};
|
|
31
|
+
pagination: {
|
|
32
|
+
page: number;
|
|
33
|
+
limit: number;
|
|
34
|
+
};
|
|
35
|
+
search: string;
|
|
36
|
+
filter: Record<string, any>;
|
|
37
|
+
}) => void;
|
|
38
|
+
paginationProps?: ScreenPaginationProps;
|
|
39
|
+
emptyTitle?: string;
|
|
40
|
+
emptyDescription?: string;
|
|
41
|
+
emptyIcon?: string;
|
|
42
|
+
addComponent?: Component | any;
|
|
43
|
+
addBtn?: AddBtnConfig;
|
|
44
|
+
list?: Component | any;
|
|
45
|
+
table?: Component | any;
|
|
46
|
+
customHeader?: boolean;
|
|
47
|
+
canSearch?: boolean;
|
|
48
|
+
canAdd?: boolean;
|
|
49
|
+
pagination?: boolean;
|
|
50
|
+
filterSchema?: IForm[];
|
|
51
|
+
filterType?: 'modal' | 'dropdown';
|
|
52
|
+
showRefresh?: boolean;
|
|
53
|
+
}
|
package/index.d.ts
CHANGED