@razaman2/reactive-view 0.1.0-beta.8 → 0.2.0
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/LICENSE +21 -21
- package/README.md +1 -1
- package/dist/Editor-BX8prqWt.mjs +364 -0
- package/dist/Editor-DKILsiST.js +1 -0
- package/dist/Label-B63BpiJm.mjs +49 -0
- package/dist/Label-ClklvtMk.js +1 -0
- package/dist/ReactiveView.d.mts +20 -0
- package/dist/ReactiveView.d.ts +20 -0
- package/dist/Select-CSA5Sk_b.mjs +238 -0
- package/dist/Select-CqG647qR.js +1 -0
- package/dist/Subscription.d.mts +17 -0
- package/dist/Subscription.d.ts +17 -0
- package/dist/Subscriptions.d.mts +5 -0
- package/dist/Subscriptions.d.ts +5 -0
- package/dist/Types.d.mts +28 -0
- package/dist/Types.d.ts +28 -0
- package/dist/components/Button.vue.d.mts +3 -0
- package/dist/components/Button.vue.d.ts +3 -0
- package/dist/components/ConfirmationModal.vue.d.mts +3 -0
- package/dist/components/ConfirmationModal.vue.d.ts +3 -0
- package/dist/components/CustomAlert.vue.d.mts +69 -0
- package/dist/components/CustomAlert.vue.d.ts +69 -0
- package/dist/components/CustomButton.vue.d.mts +3 -0
- package/dist/components/CustomButton.vue.d.ts +3 -0
- package/dist/components/CustomModal.vue.d.mts +3 -0
- package/dist/components/CustomModal.vue.d.ts +3 -0
- package/dist/components/CustomTable.vue.d.mts +3 -0
- package/dist/components/CustomTable.vue.d.ts +3 -0
- package/dist/components/CustomTableRow.vue.d.mts +3 -0
- package/dist/components/CustomTableRow.vue.d.ts +3 -0
- package/dist/components/Datetime.vue.d.mts +3 -0
- package/dist/components/Datetime.vue.d.ts +3 -0
- package/dist/components/DraggableList.vue.d.mts +3 -0
- package/dist/components/DraggableList.vue.d.ts +3 -0
- package/dist/components/Editor.vue.d.mts +3 -0
- package/dist/components/Editor.vue.d.ts +3 -0
- package/dist/components/Input.vue.d.mts +3 -0
- package/dist/components/Input.vue.d.ts +3 -0
- package/dist/components/ItemsList.vue.d.mts +3 -0
- package/dist/components/ItemsList.vue.d.ts +3 -0
- package/dist/components/Label.vue.d.mts +3 -0
- package/dist/components/Label.vue.d.ts +3 -0
- package/dist/components/ListPagination.vue.d.mts +3 -0
- package/dist/components/ListPagination.vue.d.ts +3 -0
- package/dist/components/Popover.vue.d.mts +3 -0
- package/dist/components/Popover.vue.d.ts +3 -0
- package/dist/components/Select.vue.d.mts +3 -0
- package/dist/components/Select.vue.d.ts +3 -0
- package/dist/components/drag.d.mts +1 -0
- package/dist/components/drag.d.ts +1 -0
- package/dist/components/index.d.mts +17 -0
- package/dist/components/index.d.ts +17 -0
- package/dist/components/masks.d.mts +22 -0
- package/dist/components/masks.d.ts +22 -0
- package/dist/components.js +1 -0
- package/dist/components.mjs +1660 -0
- package/dist/index.d.mts +42 -121
- package/dist/index.d.ts +42 -121
- package/dist/index.js +1 -963
- package/dist/index.mjs +2 -916
- package/dist/reactive-view.css +2 -0
- package/dist/rolldown-runtime-C-QNzSnW.mjs +11 -0
- package/dist/src-CB2Ym95H.js +1 -0
- package/dist/src-DgPt5VTg.mjs +523 -0
- package/package.json +126 -48
|
@@ -0,0 +1,1660 @@
|
|
|
1
|
+
import { _ as e, c as t, d as n, g as r, h as i, i as a, n as o, p as s, r as c, s as l, t as u, y as d } from "./src-DgPt5VTg.mjs";
|
|
2
|
+
import { t as f } from "./Select-CSA5Sk_b.mjs";
|
|
3
|
+
import { t as p } from "./Label-B63BpiJm.mjs";
|
|
4
|
+
import { r as m, t as h } from "./Editor-BX8prqWt.mjs";
|
|
5
|
+
import g from "@razaman2/object-manager";
|
|
6
|
+
import _ from "@razaman2/data-manager";
|
|
7
|
+
import { Fragment as v, computed as y, createElementBlock as b, createElementVNode as x, createTextVNode as S, createVNode as C, h as w, markRaw as T, mergeProps as E, onBeforeMount as D, onBeforeUnmount as O, onMounted as k, openBlock as A, provide as j, reactive as M, ref as N, unref as P, watch as F, watchEffect as I } from "vue";
|
|
8
|
+
import { formatInTimeZone as L } from "date-fns-tz";
|
|
9
|
+
import { twMerge as R } from "tailwind-merge";
|
|
10
|
+
import { Button as z, DatePicker as ee, Divider as B, Popover as V, SplitButton as H } from "primevue";
|
|
11
|
+
import { v4 as U } from "uuid";
|
|
12
|
+
import W from "inputmask";
|
|
13
|
+
import { format as te, formatISO as ne, parse as G, parseISO as K } from "date-fns";
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/components/Button.vue
|
|
16
|
+
var q = l({
|
|
17
|
+
modelName: "Button",
|
|
18
|
+
props: {
|
|
19
|
+
class: o(),
|
|
20
|
+
buttonClass: o(),
|
|
21
|
+
split: o({ type: Boolean }),
|
|
22
|
+
options: o({
|
|
23
|
+
type: Array,
|
|
24
|
+
default: []
|
|
25
|
+
}),
|
|
26
|
+
unstyled: o({ type: Boolean })
|
|
27
|
+
},
|
|
28
|
+
setup(e, t, n) {
|
|
29
|
+
return { template: () => {
|
|
30
|
+
if (n.unstyled) return C(z, {
|
|
31
|
+
unstyled: !0,
|
|
32
|
+
class: R(u("btn uppercase rounded-lg text-sm font-normal leading-none", n.buttonClass, n.class).string, u(n.buttonClass, n.class).string)
|
|
33
|
+
}, n.$slots);
|
|
34
|
+
let e = R(u("btn uppercase leading-none", n.buttonClass, n.class).string, u(n.buttonClass, n.class).string), t = "shrink-0 text-sm! font-normal!", r = `${t} border-0! px-4! py-0! [&_.p-button-label]:[font:inherit]!`, i = "[background-image:linear-gradient(180deg,rgba(255,255,255,0.20)_28%,rgba(255,255,255,0.00)_100%)]!", a = "relative before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit] before:bg-current before:opacity-0 before:transition-opacity hover:before:opacity-[0.15]", o = `${r} ${a} h-full bg-transparent! shadow-none! rounded-none! text-inherit! [font:inherit]!`, s = ["top", "bottom"].includes(n.$attrs.iconPos) ? "h-auto py-2! gap-1" : "";
|
|
35
|
+
return n.split ? C(H, {
|
|
36
|
+
class: R(t, i, e, "p-0! overflow-hidden"),
|
|
37
|
+
buttonProps: { class: R(o, "pr-2!") },
|
|
38
|
+
menuButtonProps: { class: R(o, "pl-2!") },
|
|
39
|
+
model: n.options
|
|
40
|
+
}, n.$slots) : C(z, { class: R(r, i, a, s, e) }, n.$slots);
|
|
41
|
+
} };
|
|
42
|
+
}
|
|
43
|
+
}), J = {
|
|
44
|
+
viewBox: "0 0 24 24",
|
|
45
|
+
width: "1.2em",
|
|
46
|
+
height: "1.2em"
|
|
47
|
+
};
|
|
48
|
+
function Y(e, t) {
|
|
49
|
+
return A(), b("svg", J, [...t[0] ||= [x("path", {
|
|
50
|
+
fill: "currentColor",
|
|
51
|
+
d: "M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z"
|
|
52
|
+
}, null, -1)]]);
|
|
53
|
+
}
|
|
54
|
+
var X = T({
|
|
55
|
+
name: "mdi-close",
|
|
56
|
+
render: Y
|
|
57
|
+
}), Z = l({
|
|
58
|
+
modelName: "CustomButton",
|
|
59
|
+
props: {
|
|
60
|
+
label: o({ type: [Number, String] }),
|
|
61
|
+
tag: o({
|
|
62
|
+
type: String,
|
|
63
|
+
default: "button"
|
|
64
|
+
}),
|
|
65
|
+
loading: o({
|
|
66
|
+
type: [Boolean, Function],
|
|
67
|
+
default: !1
|
|
68
|
+
}),
|
|
69
|
+
padding: o({
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: !0
|
|
72
|
+
}),
|
|
73
|
+
buttonClass: o(),
|
|
74
|
+
loadingClass: o()
|
|
75
|
+
},
|
|
76
|
+
setup(e, t, n) {
|
|
77
|
+
let r = typeof n.loading == "function" ? n.loading : () => n.loading, i = N(!1);
|
|
78
|
+
return I(() => {
|
|
79
|
+
i.value = r();
|
|
80
|
+
}), {
|
|
81
|
+
template: () => C(n.tag, { class: R(u({
|
|
82
|
+
"px-0 h-min": !n.padding,
|
|
83
|
+
"btn uppercase rounded-lg text-sm font-normal leading-none": !0
|
|
84
|
+
}).string, u(n.buttonClass).string) }, { default: () => [a(e).buttonLoading(), C("div", { class: {
|
|
85
|
+
hidden: i.value,
|
|
86
|
+
contents: !0
|
|
87
|
+
} }, [a(e).buttonIcon(), n.$slots.default ? n.$slots.default({ component: e }) : n.label])] }),
|
|
88
|
+
buttonIcon: () => {
|
|
89
|
+
if (n.$slots.icon) return n.$slots.icon({ component: e });
|
|
90
|
+
},
|
|
91
|
+
buttonLoading: () => {
|
|
92
|
+
if (i.value) return n.$slots.loading ? n.$slots.loading({ component: e }) : C("span", { class: u("loading", n.loadingClass) }, null);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}), re = l({
|
|
97
|
+
modelName: "CustomModal",
|
|
98
|
+
props: {
|
|
99
|
+
title: o({
|
|
100
|
+
type: [
|
|
101
|
+
Boolean,
|
|
102
|
+
Number,
|
|
103
|
+
String
|
|
104
|
+
],
|
|
105
|
+
default: "Modal Title"
|
|
106
|
+
}),
|
|
107
|
+
persistent: o({ type: Boolean }),
|
|
108
|
+
header: o({
|
|
109
|
+
type: Boolean,
|
|
110
|
+
default: !0
|
|
111
|
+
}),
|
|
112
|
+
actions: o({
|
|
113
|
+
type: Boolean,
|
|
114
|
+
default: !0
|
|
115
|
+
}),
|
|
116
|
+
ok: o({
|
|
117
|
+
type: Boolean,
|
|
118
|
+
default: !0
|
|
119
|
+
}),
|
|
120
|
+
cancel: o({ type: Boolean }),
|
|
121
|
+
close: o({
|
|
122
|
+
type: Boolean,
|
|
123
|
+
default: !0
|
|
124
|
+
}),
|
|
125
|
+
show: o({
|
|
126
|
+
type: Boolean,
|
|
127
|
+
default: !0
|
|
128
|
+
}),
|
|
129
|
+
whenOk: o({
|
|
130
|
+
type: Function,
|
|
131
|
+
default: () => {}
|
|
132
|
+
}),
|
|
133
|
+
whenCancel: o({
|
|
134
|
+
type: Function,
|
|
135
|
+
default: () => {}
|
|
136
|
+
}),
|
|
137
|
+
whenClose: o({
|
|
138
|
+
type: Function,
|
|
139
|
+
default: () => {}
|
|
140
|
+
}),
|
|
141
|
+
whenEscape: o({
|
|
142
|
+
type: Function,
|
|
143
|
+
default: () => {}
|
|
144
|
+
}),
|
|
145
|
+
whenDismiss: o({
|
|
146
|
+
type: Function,
|
|
147
|
+
default: () => {}
|
|
148
|
+
}),
|
|
149
|
+
whenRouteChange: o({
|
|
150
|
+
type: Function,
|
|
151
|
+
default: () => {}
|
|
152
|
+
}),
|
|
153
|
+
class: o(),
|
|
154
|
+
headerClass: o(),
|
|
155
|
+
titleClass: o(),
|
|
156
|
+
actionsClass: o(),
|
|
157
|
+
backdropClass: o(),
|
|
158
|
+
timeout: o({
|
|
159
|
+
default: !1,
|
|
160
|
+
validator: (e) => typeof e == "number" || e === !1
|
|
161
|
+
}),
|
|
162
|
+
modal: o({ type: Boolean }),
|
|
163
|
+
id: o({ type: [Number, String] })
|
|
164
|
+
},
|
|
165
|
+
setup: (e, t, n) => {
|
|
166
|
+
j("dialog", e);
|
|
167
|
+
let r = N(), i = N(), o = document.getElementById(n.$attrs.container ?? "app-dialogs"), s = y(() => a(e).trigger ?? n.$slots.trigger), c = y(() => s.value ? !1 : n.show), l = y(() => !0), d = (e) => {
|
|
168
|
+
throw Error(e);
|
|
169
|
+
}, f = () => C("div", null, [C("dialog", E({
|
|
170
|
+
class: "modal",
|
|
171
|
+
ref: r
|
|
172
|
+
}, s.value || a(e).watch ? {} : o ? { id: o.lastChild?.id } : d("Modal should be called with showComponent.ts | trigger element | trigger slot")), [a(e).modalBox(), a(e).modalBackdrop()]), s.value?.({ component: e })]), p = () => C("div", { class: R(u("modal-box flex flex-col p-0", n.class).string, u(n.class).string) }, [
|
|
173
|
+
a(e).modalHeader(),
|
|
174
|
+
a(e).modalContent(),
|
|
175
|
+
a(e).modalActions()
|
|
176
|
+
]), m = () => n.$slots.default ? n.$slots.default({ component: e }) : C("div", { class: "px-4" }, [S("No Content")]), h = () => C("div", {
|
|
177
|
+
class: R("modal-backdrop", u({ "pointer-events-none": n.persistent }).string, u(n.backdropClass).string),
|
|
178
|
+
onClick: () => a(e).hide("backdrop")
|
|
179
|
+
}, null), g = () => {
|
|
180
|
+
if (n.actions) return C("div", {
|
|
181
|
+
style: "margin: 0;",
|
|
182
|
+
class: R("modal-action px-4 pb-4", u(n.actionsClass).string)
|
|
183
|
+
}, [a(e).okButton(), a(e).cancelButton()]);
|
|
184
|
+
}, _ = () => {
|
|
185
|
+
if (n.header) return C("div", { class: R("flex items-center justify-between px-4 pt-4", u(n.headerClass).string) }, [a(e).title(), a(e).closeButton()]);
|
|
186
|
+
}, v = () => {
|
|
187
|
+
if (n.close) return C(X, {
|
|
188
|
+
class: "cursor-pointer rounded-full text-xl transition duration-500 hover:scale-80 hover:ring",
|
|
189
|
+
onClick: async () => {
|
|
190
|
+
await n.whenClose(), a(e).hide("close");
|
|
191
|
+
}
|
|
192
|
+
}, null);
|
|
193
|
+
}, b = () => {
|
|
194
|
+
if (n.ok) return C(Z, {
|
|
195
|
+
label: "ok",
|
|
196
|
+
class: "btn-sm btn-success text-white",
|
|
197
|
+
onClick: () => a(e).triggerOk(),
|
|
198
|
+
disabled: !a(e).isValid
|
|
199
|
+
}, null);
|
|
200
|
+
}, x = () => {
|
|
201
|
+
if (n.cancel) return C(Z, {
|
|
202
|
+
label: "cancel",
|
|
203
|
+
class: "btn-sm btn-error text-white",
|
|
204
|
+
onClick: async () => {
|
|
205
|
+
await n.whenCancel(), a(e).hide("cancel");
|
|
206
|
+
}
|
|
207
|
+
}, null);
|
|
208
|
+
}, w = () => {
|
|
209
|
+
if (["String", "Number"].includes(n.title.constructor.name)) return C("h3", { class: R("w-full text-center font-bold", u(n.titleClass).string) }, [n.title]);
|
|
210
|
+
}, T = () => r.value[n.modal ? "showModal" : "show"](), D = (e) => r.value.close(e), k = () => r.value.open, A = (e) => {
|
|
211
|
+
n.$attrs.unmount?.(e), clearTimeout(i.value);
|
|
212
|
+
}, M = async () => {
|
|
213
|
+
let e = await import("@razaman2/event-emitter");
|
|
214
|
+
return (e.default?.global ? e.default : e.default.default).global();
|
|
215
|
+
}, P = async () => {
|
|
216
|
+
await n.whenOk(a(e).model.getData()), a(e).hide("ok");
|
|
217
|
+
}, I = async (e) => {
|
|
218
|
+
let t = e.key === "Escape";
|
|
219
|
+
n.persistent && t ? (e.stopPropagation(), e.preventDefault()) : t && await n.whenEscape();
|
|
220
|
+
}, L = async () => {
|
|
221
|
+
r.value && a(e).showing() && await n.whenRouteChange();
|
|
222
|
+
};
|
|
223
|
+
return O(() => {
|
|
224
|
+
document.removeEventListener("keydown", I), window.removeEventListener("hashchange", L), window.removeEventListener("popstate", L);
|
|
225
|
+
}), setTimeout(() => {
|
|
226
|
+
let t = "open";
|
|
227
|
+
r.value && (new MutationObserver(async () => {
|
|
228
|
+
if (a(e).showing()) try {
|
|
229
|
+
await (await M()).emit(`dialog:${t}`, {
|
|
230
|
+
type: t,
|
|
231
|
+
component: e,
|
|
232
|
+
id: n.id
|
|
233
|
+
});
|
|
234
|
+
} finally {}
|
|
235
|
+
}).observe(r.value, {
|
|
236
|
+
attributes: !0,
|
|
237
|
+
attributeFilter: [t]
|
|
238
|
+
}), r.value.addEventListener("close", async (t) => {
|
|
239
|
+
let r = t.target.returnValue || "escape";
|
|
240
|
+
try {
|
|
241
|
+
await (await M()).emit("dialog:close", {
|
|
242
|
+
e: t,
|
|
243
|
+
type: r,
|
|
244
|
+
component: e,
|
|
245
|
+
id: n.id
|
|
246
|
+
});
|
|
247
|
+
} finally {
|
|
248
|
+
await n.whenDismiss({ type: r }), A({ type: r });
|
|
249
|
+
}
|
|
250
|
+
}), typeof n.timeout == "number" && (i.value = setTimeout(() => a(e).hide("timeout"), n.timeout)), a(e).watch ? F(a(e).watch, (t) => {
|
|
251
|
+
r.value && t ? a(e).show() : r.value && a(e).hide();
|
|
252
|
+
}, { deep: !0 }) : c.value && a(e).show()), document.addEventListener("keydown", I), window.addEventListener("hashchange", L), window.addEventListener("popstate", L);
|
|
253
|
+
}), {
|
|
254
|
+
template: f,
|
|
255
|
+
title: w,
|
|
256
|
+
modalBox: p,
|
|
257
|
+
modalHeader: _,
|
|
258
|
+
modalContent: m,
|
|
259
|
+
modalActions: g,
|
|
260
|
+
modalBackdrop: h,
|
|
261
|
+
closeButton: v,
|
|
262
|
+
okButton: b,
|
|
263
|
+
cancelButton: x,
|
|
264
|
+
show: T,
|
|
265
|
+
hide: D,
|
|
266
|
+
showing: k,
|
|
267
|
+
triggerOk: P,
|
|
268
|
+
isValid: l,
|
|
269
|
+
modalRef: r
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
}), ie = l({
|
|
273
|
+
cancel: !0,
|
|
274
|
+
titleClass: "text-left",
|
|
275
|
+
modelName: "ConfirmationModal",
|
|
276
|
+
title: (e, t) => a(t).confirmationTitle?.(),
|
|
277
|
+
slots: (e, t) => () => C(v, null, [C(B, null, null), C("div", { class: "pt-4 px-4 pb-8" }, [a(t).confirmationDescription()])]),
|
|
278
|
+
setup(e, r) {
|
|
279
|
+
let i = M({ status: !1 });
|
|
280
|
+
return {
|
|
281
|
+
confirmationTitle: () => "Confirm",
|
|
282
|
+
confirmationDescription: () => "Are you sure you sure?",
|
|
283
|
+
okButton: () => {
|
|
284
|
+
let e = a(r).okButton();
|
|
285
|
+
if (e) return C(q, E({ unstyled: !0 }, n(e.props, "class"), {
|
|
286
|
+
loading: i.status,
|
|
287
|
+
class: "h-8 normal-case! bg-white! text-(--colors-primary-500)! border-gray-200! rounded-lg! hover:bg-gray-50!",
|
|
288
|
+
label: "Continue"
|
|
289
|
+
}), e.children);
|
|
290
|
+
},
|
|
291
|
+
cancelButton: () => {
|
|
292
|
+
let e = a(r).cancelButton();
|
|
293
|
+
if (e) return C(q, E(n(e.props, "class"), {
|
|
294
|
+
unstyled: !0,
|
|
295
|
+
class: "h-8 -order-1 normal-case! bg-white! border-gray-200! text-gray-700! rounded-lg! hover:bg-gray-50! hover:text-gray-900!",
|
|
296
|
+
label: "Cancel"
|
|
297
|
+
}), e.children);
|
|
298
|
+
},
|
|
299
|
+
closeButton: () => t(r).closeButton({
|
|
300
|
+
unstyled: !0,
|
|
301
|
+
buttonClass: "border border-gray-200 bg-white text-gray-400 hover:text-red-500 transition-all duration-500 rounded-md! -{btn}"
|
|
302
|
+
}, () => C(q, null, { icon: () => C(X, { class: "size-5" }, null) })),
|
|
303
|
+
triggerOk: () => s({
|
|
304
|
+
loading: i,
|
|
305
|
+
try: () => a(r).triggerOk()
|
|
306
|
+
})
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
}, re), ae = {
|
|
310
|
+
props: {
|
|
311
|
+
setup: d,
|
|
312
|
+
title: o({ type: String }),
|
|
313
|
+
description: o({ type: String }),
|
|
314
|
+
close: o({
|
|
315
|
+
type: Boolean,
|
|
316
|
+
default: !0
|
|
317
|
+
}),
|
|
318
|
+
timeout: o({
|
|
319
|
+
default: 3e3,
|
|
320
|
+
validator: (e) => typeof e == "number" || e === !1
|
|
321
|
+
})
|
|
322
|
+
},
|
|
323
|
+
setup(e, t) {
|
|
324
|
+
return (e) => C(r, {
|
|
325
|
+
modelName: "CustomAlert",
|
|
326
|
+
setup: (n) => {
|
|
327
|
+
let r = {
|
|
328
|
+
default: C("path", {
|
|
329
|
+
"stroke-linecap": "round",
|
|
330
|
+
"stroke-linejoin": "round",
|
|
331
|
+
"stroke-width": "2",
|
|
332
|
+
d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
333
|
+
}, null),
|
|
334
|
+
"alert-info": C("path", {
|
|
335
|
+
"stroke-linecap": "round",
|
|
336
|
+
"stroke-linejoin": "round",
|
|
337
|
+
"stroke-width": "2",
|
|
338
|
+
d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
339
|
+
}, null),
|
|
340
|
+
"alert-success": C("path", {
|
|
341
|
+
"stroke-linecap": "round",
|
|
342
|
+
"stroke-linejoin": "round",
|
|
343
|
+
"stroke-width": "2",
|
|
344
|
+
d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
345
|
+
}, null),
|
|
346
|
+
"alert-warning": C("path", {
|
|
347
|
+
"stroke-linecap": "round",
|
|
348
|
+
"stroke-linejoin": "round",
|
|
349
|
+
"stroke-width": "2",
|
|
350
|
+
d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
|
351
|
+
}, null),
|
|
352
|
+
"alert-error": C("path", {
|
|
353
|
+
"stroke-linecap": "round",
|
|
354
|
+
"stroke-linejoin": "round",
|
|
355
|
+
"stroke-width": "2",
|
|
356
|
+
d: "M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
357
|
+
}, null)
|
|
358
|
+
}, i = () => /alert-(info|success|warning|error)/.exec(e.$attrs.class)?.shift();
|
|
359
|
+
return P(e.timeout) && k(() => {
|
|
360
|
+
setTimeout(() => a(n).hide("timeout"), P(e.timeout));
|
|
361
|
+
}), {
|
|
362
|
+
template: () => C("div", {
|
|
363
|
+
role: "alert",
|
|
364
|
+
class: "alert"
|
|
365
|
+
}, [
|
|
366
|
+
a(n).alertIcon(),
|
|
367
|
+
C("div", null, [a(n).alertTitle(), e.$slots.default ? e.$slots.default({ component: n }) : a(n).alertDescription()]),
|
|
368
|
+
a(n).alertClose()
|
|
369
|
+
]),
|
|
370
|
+
alertIcon: () => C("svg", {
|
|
371
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
372
|
+
class: {
|
|
373
|
+
[i() ? "stroke-current" : "stroke-black"]: !0,
|
|
374
|
+
"h-6 w-6 shrink-0": !0
|
|
375
|
+
},
|
|
376
|
+
fill: "none",
|
|
377
|
+
viewBox: "0 0 24 24"
|
|
378
|
+
}, [r[i()] || r.default]),
|
|
379
|
+
alertTitle: () => C("h3", { class: "font-bold" }, [P(e.title)]),
|
|
380
|
+
alertDescription: () => C("div", { class: "text-xs" }, [P(e.description)]),
|
|
381
|
+
alertClose: () => {
|
|
382
|
+
if (P(e.close)) return C(X, {
|
|
383
|
+
id: "alert-close",
|
|
384
|
+
class: "text-xl cursor-pointer rounded-full hover:scale-80 hover:ring transition duration-500",
|
|
385
|
+
onClick: () => a(n).hide("close")
|
|
386
|
+
}, null);
|
|
387
|
+
},
|
|
388
|
+
hide: (n) => {
|
|
389
|
+
e.$el.remove(), t.emit("close", n);
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
}, e.$slots);
|
|
394
|
+
}
|
|
395
|
+
}, oe = {
|
|
396
|
+
viewBox: "0 0 24 24",
|
|
397
|
+
width: "1.2em",
|
|
398
|
+
height: "1.2em"
|
|
399
|
+
};
|
|
400
|
+
function se(e, t) {
|
|
401
|
+
return A(), b("svg", oe, [...t[0] ||= [x("path", {
|
|
402
|
+
fill: "currentColor",
|
|
403
|
+
d: "M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6z"
|
|
404
|
+
}, null, -1)]]);
|
|
405
|
+
}
|
|
406
|
+
var ce = T({
|
|
407
|
+
name: "mdi-chevron-down",
|
|
408
|
+
render: se
|
|
409
|
+
}), le = {
|
|
410
|
+
viewBox: "0 0 24 24",
|
|
411
|
+
width: "1.2em",
|
|
412
|
+
height: "1.2em"
|
|
413
|
+
};
|
|
414
|
+
function ue(e, t) {
|
|
415
|
+
return A(), b("svg", le, [...t[0] ||= [x("path", {
|
|
416
|
+
fill: "currentColor",
|
|
417
|
+
d: "M19 4h-3.5l-1-1h-5l-1 1H5v2h14M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6z"
|
|
418
|
+
}, null, -1)]]);
|
|
419
|
+
}
|
|
420
|
+
var de = T({
|
|
421
|
+
name: "mdi-delete",
|
|
422
|
+
render: ue
|
|
423
|
+
}), fe = {
|
|
424
|
+
viewBox: "0 0 24 24",
|
|
425
|
+
width: "1.2em",
|
|
426
|
+
height: "1.2em"
|
|
427
|
+
};
|
|
428
|
+
function pe(e, t) {
|
|
429
|
+
return A(), b("svg", fe, [...t[0] ||= [x("path", {
|
|
430
|
+
fill: "currentColor",
|
|
431
|
+
d: "M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83l3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75z"
|
|
432
|
+
}, null, -1)]]);
|
|
433
|
+
}
|
|
434
|
+
var me = T({
|
|
435
|
+
name: "mdi-edit",
|
|
436
|
+
render: pe
|
|
437
|
+
}), he = {
|
|
438
|
+
viewBox: "0 0 24 24",
|
|
439
|
+
width: "1.2em",
|
|
440
|
+
height: "1.2em"
|
|
441
|
+
};
|
|
442
|
+
function ge(e, t) {
|
|
443
|
+
return A(), b("svg", he, [...t[0] ||= [x("path", {
|
|
444
|
+
fill: "currentColor",
|
|
445
|
+
d: "M16 12a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2"
|
|
446
|
+
}, null, -1)]]);
|
|
447
|
+
}
|
|
448
|
+
var _e = T({
|
|
449
|
+
name: "mdi-more-horiz",
|
|
450
|
+
render: ge
|
|
451
|
+
}), ve = {
|
|
452
|
+
viewBox: "0 0 24 24",
|
|
453
|
+
width: "1.2em",
|
|
454
|
+
height: "1.2em"
|
|
455
|
+
};
|
|
456
|
+
function ye(e, t) {
|
|
457
|
+
return A(), b("svg", ve, [...t[0] ||= [x("path", {
|
|
458
|
+
fill: "currentColor",
|
|
459
|
+
d: "M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6l-6-6zM16 6h2v12h-2z"
|
|
460
|
+
}, null, -1)]]);
|
|
461
|
+
}
|
|
462
|
+
var be = T({
|
|
463
|
+
name: "mdi-last-page",
|
|
464
|
+
render: ye
|
|
465
|
+
}), xe = {
|
|
466
|
+
viewBox: "0 0 24 24",
|
|
467
|
+
width: "1.2em",
|
|
468
|
+
height: "1.2em"
|
|
469
|
+
};
|
|
470
|
+
function Se(e, t) {
|
|
471
|
+
return A(), b("svg", xe, [...t[0] ||= [x("path", {
|
|
472
|
+
fill: "currentColor",
|
|
473
|
+
d: "M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6l6 6zM6 6h2v12H6z"
|
|
474
|
+
}, null, -1)]]);
|
|
475
|
+
}
|
|
476
|
+
var Ce = T({
|
|
477
|
+
name: "mdi-first-page",
|
|
478
|
+
render: Se
|
|
479
|
+
}), we = {
|
|
480
|
+
viewBox: "0 0 24 24",
|
|
481
|
+
width: "1.2em",
|
|
482
|
+
height: "1.2em"
|
|
483
|
+
};
|
|
484
|
+
function Te(e, t) {
|
|
485
|
+
return A(), b("svg", we, [...t[0] ||= [x("path", {
|
|
486
|
+
fill: "currentColor",
|
|
487
|
+
d: "M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6z"
|
|
488
|
+
}, null, -1)]]);
|
|
489
|
+
}
|
|
490
|
+
var Ee = T({
|
|
491
|
+
name: "mdi-navigate-next",
|
|
492
|
+
render: Te
|
|
493
|
+
}), De = {
|
|
494
|
+
viewBox: "0 0 24 24",
|
|
495
|
+
width: "1.2em",
|
|
496
|
+
height: "1.2em"
|
|
497
|
+
};
|
|
498
|
+
function Oe(e, t) {
|
|
499
|
+
return A(), b("svg", De, [...t[0] ||= [x("path", {
|
|
500
|
+
fill: "currentColor",
|
|
501
|
+
d: "M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6z"
|
|
502
|
+
}, null, -1)]]);
|
|
503
|
+
}
|
|
504
|
+
var ke = T({
|
|
505
|
+
name: "mdi-navigate-before",
|
|
506
|
+
render: Oe
|
|
507
|
+
}), Ae = {
|
|
508
|
+
viewBox: "0 0 24 24",
|
|
509
|
+
width: "1.2em",
|
|
510
|
+
height: "1.2em"
|
|
511
|
+
};
|
|
512
|
+
function je(e, t) {
|
|
513
|
+
return A(), b("svg", Ae, [...t[0] ||= [x("path", {
|
|
514
|
+
fill: "currentColor",
|
|
515
|
+
d: "M13 14h-2V9h2m0 9h-2v-2h2M1 21h22L12 2z"
|
|
516
|
+
}, null, -1)]]);
|
|
517
|
+
}
|
|
518
|
+
var Me = T({
|
|
519
|
+
name: "mdi-warning",
|
|
520
|
+
render: je
|
|
521
|
+
}), Ne = {
|
|
522
|
+
props: {
|
|
523
|
+
setup: d,
|
|
524
|
+
ReactiveView: !0
|
|
525
|
+
},
|
|
526
|
+
setup() {
|
|
527
|
+
return (e) => C(r, {
|
|
528
|
+
modelName: "ListPagination",
|
|
529
|
+
getDefaultData: (e) => ({
|
|
530
|
+
page: 1,
|
|
531
|
+
rows: 5,
|
|
532
|
+
current: 1,
|
|
533
|
+
selections: [
|
|
534
|
+
1,
|
|
535
|
+
3,
|
|
536
|
+
5,
|
|
537
|
+
10,
|
|
538
|
+
15
|
|
539
|
+
],
|
|
540
|
+
...e
|
|
541
|
+
}),
|
|
542
|
+
setup: (e) => {
|
|
543
|
+
let t = N(a(e).model.getData("page") || 1), n = y(() => Math.ceil(r.value / a(e).model.getData("rows"))), r = y(() => a(e).model.getData("count") ?? a(a(e).$attrs.list).model.getData().length), i = y(() => o.value - a(e).model.getData("rows")), o = y(() => t.value * a(e).model.getData("rows"));
|
|
544
|
+
return F(n, (e) => {
|
|
545
|
+
e >= 1 && t.value > e && (t.value = e);
|
|
546
|
+
}), F(t, (t, i = 0) => {
|
|
547
|
+
let { current: o, rows: s } = a(e).model.getData();
|
|
548
|
+
if (i === 0) {
|
|
549
|
+
let n = t * s - (s - 1);
|
|
550
|
+
a(e).model.setData({
|
|
551
|
+
page: t,
|
|
552
|
+
current: n
|
|
553
|
+
});
|
|
554
|
+
} else if (t === 1) a(e).model.setData({
|
|
555
|
+
page: t,
|
|
556
|
+
current: 1
|
|
557
|
+
});
|
|
558
|
+
else if (t > i + 1) {
|
|
559
|
+
let i = r.value % s ? (n.value - 1) * s + 1 : n.value * s - (s - 1);
|
|
560
|
+
a(e).model.setData({
|
|
561
|
+
page: t,
|
|
562
|
+
current: i
|
|
563
|
+
});
|
|
564
|
+
} else i > t ? a(e).model.setData({
|
|
565
|
+
page: t,
|
|
566
|
+
current: (t - 1) * s + 1
|
|
567
|
+
}) : a(e).model.setData({
|
|
568
|
+
page: t,
|
|
569
|
+
current: o + s
|
|
570
|
+
});
|
|
571
|
+
}, { immediate: !0 }), D(() => {
|
|
572
|
+
a(e).load(a(e).$attrs.list, e);
|
|
573
|
+
}), {
|
|
574
|
+
template: () => {
|
|
575
|
+
let { current: n, rows: i } = a(e).model.getData();
|
|
576
|
+
return r.value ? C("div", { class: { "paginator flex flex-wrap gap-x-2 items-center justify-end": !0 } }, [
|
|
577
|
+
C("span", { class: "paginator-text" }, [S("Records per page:")]),
|
|
578
|
+
C("span", { class: "paginator-count" }, [a(e).rows()]),
|
|
579
|
+
C("span", { class: { "flex gap-x-1": !0 } }, [
|
|
580
|
+
C("span", { class: "start" }, [n > r.value ? r.value === 0 ? r.value : n - i : n]),
|
|
581
|
+
C("span", null, [S("-")]),
|
|
582
|
+
C("span", { class: "end" }, [i * t.value > r.value ? r.value : i * t.value]),
|
|
583
|
+
C("span", null, [S("of")]),
|
|
584
|
+
C("span", { class: "count" }, [r.value])
|
|
585
|
+
]),
|
|
586
|
+
a(e).controls()
|
|
587
|
+
]) : C("div", { class: { "flex justify-start items-center gap-x-2": !0 } }, [C(Me, null, null), C("span", null, [S("No data available")])]);
|
|
588
|
+
},
|
|
589
|
+
prev: () => C(Z, {
|
|
590
|
+
disabled: !(t.value > 1),
|
|
591
|
+
class: { "paginator-prev btn-xs disabled:text-black": !0 },
|
|
592
|
+
onClick: () => --t.value
|
|
593
|
+
}, { default: () => [C(ke, null, null)] }),
|
|
594
|
+
next: () => {
|
|
595
|
+
let { rows: n } = a(e).model.getData();
|
|
596
|
+
return C(Z, {
|
|
597
|
+
disabled: !(t.value * n < r.value),
|
|
598
|
+
class: { "paginator-next btn-xs disabled:text-black": !0 },
|
|
599
|
+
onClick: () => t.value += 1
|
|
600
|
+
}, { default: () => [C(Ee, null, null)] });
|
|
601
|
+
},
|
|
602
|
+
start: () => C(Z, {
|
|
603
|
+
disabled: !(t.value > 1),
|
|
604
|
+
class: { "paginator-start btn-xs disabled:text-black": !0 },
|
|
605
|
+
onClick: () => t.value = 1
|
|
606
|
+
}, { default: () => [C(Ce, null, null)] }),
|
|
607
|
+
end: () => {
|
|
608
|
+
let { rows: i } = a(e).model.getData();
|
|
609
|
+
return C(Z, {
|
|
610
|
+
disabled: !(t.value * i < r.value),
|
|
611
|
+
class: { "paginator-end btn-xs disabled:text-black": !0 },
|
|
612
|
+
onClick: () => t.value = n.value
|
|
613
|
+
}, { default: () => [C(be, null, null)] });
|
|
614
|
+
},
|
|
615
|
+
rows: () => C(f, {
|
|
616
|
+
placeholder: !1,
|
|
617
|
+
appendTo: "body",
|
|
618
|
+
sorted: !1,
|
|
619
|
+
class: "rounded max-w-max bg-transparent border-none cursor-pointer",
|
|
620
|
+
options: a(e).model.getData("selections"),
|
|
621
|
+
data: a(e).model.getData("rows"),
|
|
622
|
+
"onUpdate:model": ({ after: n }) => {
|
|
623
|
+
a(e).model.setData({
|
|
624
|
+
rows: parseInt(n),
|
|
625
|
+
count: r.value,
|
|
626
|
+
page: 1,
|
|
627
|
+
current: 1
|
|
628
|
+
}), t.value = 1;
|
|
629
|
+
}
|
|
630
|
+
}, null),
|
|
631
|
+
controls: () => C("div", { class: "flex gap-x-1" }, [
|
|
632
|
+
a(e).start(),
|
|
633
|
+
a(e).prev(),
|
|
634
|
+
a(e).next(),
|
|
635
|
+
a(e).end()
|
|
636
|
+
]),
|
|
637
|
+
pagination: (t) => a(a(e).$attrs.list).tid === t.id ? {} : t.index < i.value || t.index >= o.value ? { class: c("hidden") } : {},
|
|
638
|
+
load: () => {},
|
|
639
|
+
to: o,
|
|
640
|
+
from: i
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
}, e.$slots);
|
|
644
|
+
}
|
|
645
|
+
}, Pe = l({
|
|
646
|
+
modelName: "ItemsList",
|
|
647
|
+
props: {
|
|
648
|
+
isValid: o({ type: [Boolean, Function] }),
|
|
649
|
+
beforeItemAdding: o({ type: Function }),
|
|
650
|
+
whenItemAdding: o({ type: Function }),
|
|
651
|
+
beforeItemDeleting: o({ type: Function }),
|
|
652
|
+
whenItemDeleting: o({ type: Function }),
|
|
653
|
+
whenItemActive: o({ type: Function }),
|
|
654
|
+
whenItemInactive: o({ type: Function }),
|
|
655
|
+
defaultDisplayComponent: o(),
|
|
656
|
+
displayComponent: o({ default: () => r }),
|
|
657
|
+
itemProps: o({
|
|
658
|
+
type: [Function, Object],
|
|
659
|
+
default: () => ({})
|
|
660
|
+
}),
|
|
661
|
+
itemSlots: o({
|
|
662
|
+
type: [Function, Object],
|
|
663
|
+
default: () => ({})
|
|
664
|
+
}),
|
|
665
|
+
itemKey: o({
|
|
666
|
+
type: String,
|
|
667
|
+
default: "id"
|
|
668
|
+
}),
|
|
669
|
+
paginator: o({ type: [Boolean, Object] }),
|
|
670
|
+
draggable: o({ type: Function }),
|
|
671
|
+
groupable: o({ type: Function }),
|
|
672
|
+
sortable: o({
|
|
673
|
+
type: Function,
|
|
674
|
+
default: (e) => e
|
|
675
|
+
}),
|
|
676
|
+
filterable: o({
|
|
677
|
+
type: Function,
|
|
678
|
+
default: (e) => e
|
|
679
|
+
}),
|
|
680
|
+
clickable: o({
|
|
681
|
+
type: Boolean,
|
|
682
|
+
default: !0
|
|
683
|
+
}),
|
|
684
|
+
selectable: o({
|
|
685
|
+
type: Boolean,
|
|
686
|
+
default: !0
|
|
687
|
+
}),
|
|
688
|
+
selected: o({
|
|
689
|
+
type: [
|
|
690
|
+
Boolean,
|
|
691
|
+
Function,
|
|
692
|
+
Number,
|
|
693
|
+
Object,
|
|
694
|
+
String
|
|
695
|
+
],
|
|
696
|
+
default: 0
|
|
697
|
+
}),
|
|
698
|
+
duplicate: o({
|
|
699
|
+
type: Function,
|
|
700
|
+
default: () => !1
|
|
701
|
+
}),
|
|
702
|
+
addToStart: o({
|
|
703
|
+
type: Boolean,
|
|
704
|
+
default: !0
|
|
705
|
+
}),
|
|
706
|
+
multiple: o({ type: Boolean }),
|
|
707
|
+
"data:callback_key": o({ type: [
|
|
708
|
+
Boolean,
|
|
709
|
+
Function,
|
|
710
|
+
String
|
|
711
|
+
] }),
|
|
712
|
+
listPaginationClass: o(),
|
|
713
|
+
listDefaultClass: o(),
|
|
714
|
+
listTemplateClass: o(),
|
|
715
|
+
listClass: o()
|
|
716
|
+
},
|
|
717
|
+
defaultData: [],
|
|
718
|
+
setup(e, t, i) {
|
|
719
|
+
let o = `component_${U()}`, s = M({}), c = N(U()), l = N(U()), d = N([P(c)]), f = N(), p = N(), m = N(), h = N(), v = y(() => {
|
|
720
|
+
try {
|
|
721
|
+
let t = a(e).activeComponent();
|
|
722
|
+
return typeof i.isValid == "function" ? i.isValid({
|
|
723
|
+
component: t,
|
|
724
|
+
list: e
|
|
725
|
+
}) : typeof P(i.isValid) == "boolean" ? P(i.isValid) : P(a(t).isValid);
|
|
726
|
+
} catch {
|
|
727
|
+
return !1;
|
|
728
|
+
}
|
|
729
|
+
}), b = y(() => {
|
|
730
|
+
try {
|
|
731
|
+
return a(e).model.getData().map((t) => {
|
|
732
|
+
try {
|
|
733
|
+
if (["Object"].includes(t.constructor.name)) {
|
|
734
|
+
let n = a(e).itemIdentifier(t);
|
|
735
|
+
return n || n === 0 ? t : Object.assign(t, { tid: U() });
|
|
736
|
+
} else return {
|
|
737
|
+
"": t,
|
|
738
|
+
tid: U()
|
|
739
|
+
};
|
|
740
|
+
} catch {
|
|
741
|
+
return {
|
|
742
|
+
"": t,
|
|
743
|
+
tid: U()
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
});
|
|
747
|
+
} catch {
|
|
748
|
+
return [];
|
|
749
|
+
}
|
|
750
|
+
}), x = y(() => i.sortable(i.filterable(P(b), e), e)), S = (e = {}, t = !0) => {
|
|
751
|
+
try {
|
|
752
|
+
return e.hasOwnProperty(i.itemKey) ? i.itemKey : t ? "tid" : i.itemKey;
|
|
753
|
+
} catch {
|
|
754
|
+
return t ? "tid" : i.itemKey;
|
|
755
|
+
}
|
|
756
|
+
}, w = (t = {}) => {
|
|
757
|
+
try {
|
|
758
|
+
return t[a(e).itemKey(t)];
|
|
759
|
+
} catch {
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
}, T = (e) => s[e], E = () => i.defaultDisplayComponent === !1 ? C(r, { class: "hidden" }) : i.defaultDisplayComponent === void 0 ? i.displayComponent : i.defaultDisplayComponent, D = () => C(i.displayComponent), O = (t = {}) => t.id === P(c) ? a(e).defaultDisplayComponent() : i.displayComponent, A = (t) => {
|
|
763
|
+
let n = a(e).itemIdentifier(t), r = a(e).getComponent(P(l)), o = a(e).getComponent(n);
|
|
764
|
+
if (o && i.duplicate({
|
|
765
|
+
id: n,
|
|
766
|
+
tid: P(c),
|
|
767
|
+
items: P(x),
|
|
768
|
+
prev: r,
|
|
769
|
+
next: o
|
|
770
|
+
})) throw Error(`Component with id { ${n} } already exists.`);
|
|
771
|
+
{
|
|
772
|
+
let n = o ?? r;
|
|
773
|
+
if (n) {
|
|
774
|
+
let r = a(e).getComponent(P(c));
|
|
775
|
+
a(n).model.replaceData(t ?? I(r));
|
|
776
|
+
}
|
|
777
|
+
return n;
|
|
778
|
+
}
|
|
779
|
+
}, j = (t, n) => new Promise(async (r) => {
|
|
780
|
+
let i = P(x).reduce((r, i) => {
|
|
781
|
+
let { id: o = !0, force: s = !1 } = typeof n == "boolean" ? {
|
|
782
|
+
id: !0,
|
|
783
|
+
force: n
|
|
784
|
+
} : n ?? {}, c = a(e).itemIdentifier(i), l = a(e).getComponent(c);
|
|
785
|
+
return i.hasOwnProperty("tid") || s ? r.concat(t({
|
|
786
|
+
list: e,
|
|
787
|
+
data: a(e).finalize(l, o),
|
|
788
|
+
component: l,
|
|
789
|
+
tid: c
|
|
790
|
+
})) : r;
|
|
791
|
+
}, []);
|
|
792
|
+
r(await Promise.all(i));
|
|
793
|
+
}), I = (e) => a(e).model.getData({ raw: !0 }) ?? a(e).model.getData(), L = async (t) => {
|
|
794
|
+
let n = i.beforeItemAdding ?? a(t).beforeItemAdding, r = i.whenItemAdding ?? a(t).whenItemAdding, o = {
|
|
795
|
+
tid: P(c),
|
|
796
|
+
data: V(t),
|
|
797
|
+
list: e
|
|
798
|
+
};
|
|
799
|
+
return (await n?.(Object.assign({}, o, { component: t }), e) ?? !0) && (await r?.(o, e) ? await r(Object.assign({}, o, { component: t }), e) : a(e).set(g.on(I(t)).clone())), t;
|
|
800
|
+
}, z = async (t) => {
|
|
801
|
+
if (!(a(t).$attrs.default || a(t).$attrs.template)) {
|
|
802
|
+
let n = i.beforeItemDeleting ?? a(t).beforeItemDeleting, r = i.whenItemDeleting ?? a(t).whenItemDeleting, o = { list: e };
|
|
803
|
+
return (await n?.(Object.assign({}, o, { component: t }), e) ?? !0) && (await r?.(o, e) ? await r(Object.assign({}, o, { component: t }), e) : a(e).unset(g.on(I(t)).clone())), t;
|
|
804
|
+
}
|
|
805
|
+
}, ee = (t) => {
|
|
806
|
+
let n = a(e).itemIdentifier(t);
|
|
807
|
+
P(x).findIndex((t) => a(e).itemIdentifier(t) === n) === -1 ? (a(e).model.replaceData(i.addToStart ? [t].concat(P(x)) : P(x).concat(t)), delete s[P(l)], c.value = U(), l.value = U()) : a(e).defaultComponent(t);
|
|
808
|
+
}, B = (t) => {
|
|
809
|
+
let n = a(e).itemIdentifier(t);
|
|
810
|
+
a(e).model.replaceData(P(x).filter((t) => a(e).itemIdentifier(t) !== n)), delete s[n];
|
|
811
|
+
}, V = (e, t) => {
|
|
812
|
+
try {
|
|
813
|
+
let { tid: n, ...r } = I(e);
|
|
814
|
+
return r.id || t === !1 ? r : Object.assign({}, r, { id: a(e).getTid?.() ?? n });
|
|
815
|
+
} catch {
|
|
816
|
+
return {};
|
|
817
|
+
}
|
|
818
|
+
}, H = () => {
|
|
819
|
+
let t = a(e).activeItemIdentifier();
|
|
820
|
+
return a(e).getComponent(t);
|
|
821
|
+
}, W = () => i.selectable ? (i.multiple ? P(d) : P(d)[0]) ?? P(c) : P(c), te = ({ index: t, item: n }) => {
|
|
822
|
+
let r = a(e).itemIdentifier(n), o = r === P(l), u = r === P(c), p = (t) => ({
|
|
823
|
+
event: { [t]: !0 },
|
|
824
|
+
source: P(f),
|
|
825
|
+
target: a(e).getComponent(r),
|
|
826
|
+
items: P(x)
|
|
827
|
+
}), m = {
|
|
828
|
+
id: r,
|
|
829
|
+
key: r,
|
|
830
|
+
list: e,
|
|
831
|
+
instance: (e) => s[r] = e,
|
|
832
|
+
default: u,
|
|
833
|
+
template: o,
|
|
834
|
+
selected: P(d).includes(r),
|
|
835
|
+
component: a(e).getComponent(r) ?? { model: _.setDefaultData(n) },
|
|
836
|
+
defaultData: Array.isArray(n) ? [] : {},
|
|
837
|
+
data: () => {
|
|
838
|
+
let n = P(x).find((t) => a(e).itemIdentifier(t) === r);
|
|
839
|
+
return n === void 0 ? P(x)[t] : n;
|
|
840
|
+
},
|
|
841
|
+
"data:callback": (e, { component: t }) => {
|
|
842
|
+
try {
|
|
843
|
+
let n = i["data:callback_key"], r = typeof n == "function" ? n(e) : n;
|
|
844
|
+
r === !0 ? a(t).model.replaceData(e.after) : typeof r == "string" ? a(t).model.getData(r).valueOf() !== e.after[r].valueOf() && a(t).model.replaceData(e.after) : e.changed && a(t).model.replaceData(e.after);
|
|
845
|
+
} catch {
|
|
846
|
+
a(t).model.replaceData(e.after);
|
|
847
|
+
}
|
|
848
|
+
},
|
|
849
|
+
onClick: (t) => {
|
|
850
|
+
let n = a(e).getComponent(r);
|
|
851
|
+
i.selectable && (typeof a(n).whenItemSelected == "function" ? a(n).whenItemSelected(t, m) : P(d).includes(r) || (d.value = [r])), i.clickable && typeof a(n).whenItemClicked == "function" && a(n).whenItemClicked(t, m);
|
|
852
|
+
},
|
|
853
|
+
...o ? { class: "hidden" } : {},
|
|
854
|
+
...typeof t == "number" ? { index: t } : {},
|
|
855
|
+
...i.draggable ? {
|
|
856
|
+
draggable: !0,
|
|
857
|
+
ondragover: (t) => {
|
|
858
|
+
t.preventDefault(), i.draggable(p("over"), e);
|
|
859
|
+
},
|
|
860
|
+
ondragend: () => {
|
|
861
|
+
f.value = void 0, i.draggable(p("end"), e);
|
|
862
|
+
},
|
|
863
|
+
ondragstart: () => {
|
|
864
|
+
f.value = a(e).getComponent(r), i.draggable(p("start"), e);
|
|
865
|
+
},
|
|
866
|
+
ondrop: () => {
|
|
867
|
+
i.draggable(p("drop"), e);
|
|
868
|
+
},
|
|
869
|
+
ondragenter: () => {
|
|
870
|
+
a(e).itemIdentifier(I(f)) !== r && i.draggable(p("enter"), e);
|
|
871
|
+
},
|
|
872
|
+
ondragleave: () => {
|
|
873
|
+
a(e).itemIdentifier(I(f)) !== r && i.draggable(p("leave"), e);
|
|
874
|
+
}
|
|
875
|
+
} : {}
|
|
876
|
+
};
|
|
877
|
+
return m;
|
|
878
|
+
}, ne = () => {
|
|
879
|
+
let t = a(e).itemOptions({ item: { tid: P(c) } }), r = a(e).itemOptions({ item: { tid: P(l) } });
|
|
880
|
+
return C("div", { class: i.$attrs.class }, [
|
|
881
|
+
C("div", { class: i.listClass }, P(x).reduce((t, n, r) => t.concat(K(a(e).itemOptions({
|
|
882
|
+
index: r,
|
|
883
|
+
item: n
|
|
884
|
+
}))), [])),
|
|
885
|
+
C("div", {
|
|
886
|
+
...n(t, ["class"]),
|
|
887
|
+
class: R(u(t.class, i.listDefaultClass).string, u(i.listDefaultClass).string)
|
|
888
|
+
}, [K(t)]),
|
|
889
|
+
C("div", {
|
|
890
|
+
...n(r, ["class"]),
|
|
891
|
+
class: R(u(r.class, i.listTemplateClass).string, u(i.listTemplateClass).string)
|
|
892
|
+
}, [K(r)]),
|
|
893
|
+
C("div", { class: i.listPaginationClass }, [a(e).paginationComponent()])
|
|
894
|
+
]);
|
|
895
|
+
}, G = (e) => {
|
|
896
|
+
try {
|
|
897
|
+
return e.props.ReactiveView || e.props.setup.ReactiveView;
|
|
898
|
+
} catch {
|
|
899
|
+
return !1;
|
|
900
|
+
}
|
|
901
|
+
}, K = (t) => {
|
|
902
|
+
let o = a(e).activeDisplay(t), s = typeof o == "function" ? o(t) : o, { class: c, ...l } = typeof i.itemProps == "function" ? i.itemProps(t) : i.itemProps, { class: d } = a(e).pageProps(t), { class: f, ...p } = {
|
|
903
|
+
...t,
|
|
904
|
+
...l
|
|
905
|
+
}, m = R(u(s.props.class, f, c, d).string, u(c, d).string), h = typeof i.itemSlots == "function" ? i.itemSlots(t) : i.itemSlots;
|
|
906
|
+
try {
|
|
907
|
+
return G(s) ? C(s, {
|
|
908
|
+
...p,
|
|
909
|
+
class: m
|
|
910
|
+
}, h) : G(s.type) ? C(s, {
|
|
911
|
+
...p,
|
|
912
|
+
...n(s.props, "class"),
|
|
913
|
+
class: m
|
|
914
|
+
}, s.children) : C(r, {
|
|
915
|
+
...p,
|
|
916
|
+
...n(s.props, "class"),
|
|
917
|
+
class: m
|
|
918
|
+
}, () => s.children);
|
|
919
|
+
} catch (e) {
|
|
920
|
+
return console.log("component builder failed:", e, s), C("div", t, "Component failed to mount!");
|
|
921
|
+
}
|
|
922
|
+
}, q = (e) => {
|
|
923
|
+
try {
|
|
924
|
+
return P(p) && a(p).pagination?.(e) || {};
|
|
925
|
+
} catch {
|
|
926
|
+
return {};
|
|
927
|
+
}
|
|
928
|
+
}, J = () => {
|
|
929
|
+
if (i.paginator) {
|
|
930
|
+
let { component: t = Ne, data: n, props: r } = i.paginator?.props?.ReactiveView ? {
|
|
931
|
+
component: i.paginator,
|
|
932
|
+
props: { list: e }
|
|
933
|
+
} : i.paginator?.component || i.paginator?.data || i.paginator?.props ? {
|
|
934
|
+
...i.paginator,
|
|
935
|
+
props: {
|
|
936
|
+
list: i.paginator.list ?? e,
|
|
937
|
+
...i.paginator.props
|
|
938
|
+
}
|
|
939
|
+
} : { props: { list: e } };
|
|
940
|
+
return C(t, {
|
|
941
|
+
...r,
|
|
942
|
+
instance: p,
|
|
943
|
+
...n === void 0 ? {} : { data: n }
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
}, Y = (t) => C("button", {
|
|
947
|
+
ref: m,
|
|
948
|
+
class: "btn btn-sm btn-success text-white uppercase",
|
|
949
|
+
onClick: () => {
|
|
950
|
+
let n = a(e).defaultComponent(t);
|
|
951
|
+
if (n) return a(e).add(n);
|
|
952
|
+
},
|
|
953
|
+
disabled: !P(a(e).isValid)
|
|
954
|
+
}, "add"), X = (t) => {
|
|
955
|
+
let n = a(e).getComponent(a(e).itemIdentifier(t));
|
|
956
|
+
return C("button", {
|
|
957
|
+
ref: h,
|
|
958
|
+
class: "btn btn-sm btn-error text-white uppercase",
|
|
959
|
+
onClick: () => {
|
|
960
|
+
if (n) return a(e).remove(n);
|
|
961
|
+
},
|
|
962
|
+
disabled: !n || n === s[P(c)] || n === s[P(l)]
|
|
963
|
+
}, "delete");
|
|
964
|
+
}, Z = () => {
|
|
965
|
+
F(d, (t, n = []) => {
|
|
966
|
+
t.forEach((t) => {
|
|
967
|
+
setTimeout(() => {
|
|
968
|
+
let n = a(e).getComponent(t), r = i.whenItemActive ?? a(n).whenItemActive;
|
|
969
|
+
n && r && r({
|
|
970
|
+
list: e,
|
|
971
|
+
data: a(n).model.getData(),
|
|
972
|
+
component: n
|
|
973
|
+
});
|
|
974
|
+
});
|
|
975
|
+
}), n.forEach((t) => {
|
|
976
|
+
setTimeout(() => {
|
|
977
|
+
let n = a(e).getComponent(t), r = i.whenItemInactive ?? a(n).whenItemInactive;
|
|
978
|
+
n && r && r({
|
|
979
|
+
list: e,
|
|
980
|
+
data: a(n).model.getData(),
|
|
981
|
+
component: n
|
|
982
|
+
});
|
|
983
|
+
});
|
|
984
|
+
});
|
|
985
|
+
}, { immediate: !0 });
|
|
986
|
+
}, re = () => {
|
|
987
|
+
let t = (t, n = "") => {
|
|
988
|
+
if (typeof n == "string") return t.find((t) => t[a(e).itemKey(t)] === n || t[""] === n);
|
|
989
|
+
if (typeof n == "function") return t.find((e) => n(e));
|
|
990
|
+
if (["Object"].includes(n.constructor.name)) return t.find((t) => t[a(e).itemKey(t)] === n.id || t[a(e).itemKey(t)] === n[a(e).itemKey(n)]);
|
|
991
|
+
if (["Number"].includes(n.constructor.name)) return n > -1 ? t[n > t.length ? t.length - 1 : n] ?? t[t.length - 1] : t[t.length - Math.abs(n)] ?? t[0];
|
|
992
|
+
};
|
|
993
|
+
F(x, (n, r) => {
|
|
994
|
+
if (r) {
|
|
995
|
+
if (n.length > r.length) d.value = [a(e).itemIdentifier(i.addToStart ? t(n, 0) : t(n, -1))];
|
|
996
|
+
else if (n.length < r.length) {
|
|
997
|
+
let i = r.findIndex((t) => a(e).itemIdentifier(t) === P(d)[0]);
|
|
998
|
+
i > -1 && (d.value = [a(e).itemIdentifier(t(n, i) ?? t(n, -1)) ?? P(c)]);
|
|
999
|
+
}
|
|
1000
|
+
} else d.value = [a(e).itemIdentifier(t(n, i.selected))];
|
|
1001
|
+
}, { immediate: !0 });
|
|
1002
|
+
};
|
|
1003
|
+
return k(() => {
|
|
1004
|
+
Z(), i.selectable && typeof i.selected != "boolean" && re();
|
|
1005
|
+
}), {
|
|
1006
|
+
template: ne,
|
|
1007
|
+
displayComponent: D,
|
|
1008
|
+
defaultDisplayComponent: E,
|
|
1009
|
+
activeDisplay: O,
|
|
1010
|
+
defaultComponent: A,
|
|
1011
|
+
activeComponent: H,
|
|
1012
|
+
activeItemIdentifier: W,
|
|
1013
|
+
itemKey: S,
|
|
1014
|
+
itemIdentifier: w,
|
|
1015
|
+
itemOptions: te,
|
|
1016
|
+
getComponent: T,
|
|
1017
|
+
pageProps: q,
|
|
1018
|
+
paginationComponent: J,
|
|
1019
|
+
addButton: Y,
|
|
1020
|
+
deleteButton: X,
|
|
1021
|
+
map: j,
|
|
1022
|
+
add: L,
|
|
1023
|
+
remove: z,
|
|
1024
|
+
set: ee,
|
|
1025
|
+
unset: B,
|
|
1026
|
+
finalize: V,
|
|
1027
|
+
isValid: v,
|
|
1028
|
+
defaultIdRef: c,
|
|
1029
|
+
selectionsRef: d,
|
|
1030
|
+
components: s,
|
|
1031
|
+
id: o
|
|
1032
|
+
};
|
|
1033
|
+
}
|
|
1034
|
+
}), Fe = l({
|
|
1035
|
+
modelName: "CustomTableRow",
|
|
1036
|
+
setup: (e, t, n) => {
|
|
1037
|
+
let r = a(a(e).$attrs.list);
|
|
1038
|
+
return {
|
|
1039
|
+
template: () => {
|
|
1040
|
+
let t = P(r.row).props["data-row-class"] ?? "";
|
|
1041
|
+
return C("div", {
|
|
1042
|
+
"data-table-row": !0,
|
|
1043
|
+
class: R(u("relative grid grid-cols-subgrid col-span-full bg-(--colors-white)", t).string, u(t).string, a(r).rowLineClass(), a(r).columnLineClass("[&>*:nth-child(n+3):not(:last-child)]:after:-inset-y-(--row-padding-y,0.75rem) [&>.sticky]:-my-(--row-padding-y,0.75rem) [&>.sticky]:py-(--row-padding-y,0.75rem)"), a(r).controlsInsetClass())
|
|
1044
|
+
}, [
|
|
1045
|
+
a(r).rowStart?.({ row: e }),
|
|
1046
|
+
a(r).leftRowColumnControls({ row: e }),
|
|
1047
|
+
a(e).rowElement().children,
|
|
1048
|
+
a(r).rightRowColumnControls({ row: e }),
|
|
1049
|
+
a(r).rowEnd?.({ row: e })
|
|
1050
|
+
]);
|
|
1051
|
+
},
|
|
1052
|
+
rowCollapseButton: () => a(r).rowCollapseButton(e, t, n),
|
|
1053
|
+
rowCheckbox: () => a(r).rowCheckbox(e, t, n),
|
|
1054
|
+
rowElement: () => {
|
|
1055
|
+
let i = () => C("div", { class: "grid grid-cols-[1fr_auto] text-red-500" }, [S("Extend [ rowElement ] Component")]);
|
|
1056
|
+
if (typeof a(r).rowElement != "function") return i();
|
|
1057
|
+
try {
|
|
1058
|
+
return a(r).rowElement(e, t, n);
|
|
1059
|
+
} catch (e) {
|
|
1060
|
+
return console.error("failed to render row-element", e), i();
|
|
1061
|
+
}
|
|
1062
|
+
},
|
|
1063
|
+
rowMenuButton: () => a(r).rowMenuButton(e, t, n),
|
|
1064
|
+
whenCheckboxClicked: (t) => {
|
|
1065
|
+
t.stopPropagation();
|
|
1066
|
+
let n = a(r).itemIdentifier(a(e).model.getData()), i = P(a(r).checkedRef);
|
|
1067
|
+
i.has(n) ? i.delete(n) : i.add(n);
|
|
1068
|
+
},
|
|
1069
|
+
checkedRef: y(() => P(a(r).checkedRef).has(a(r).itemIdentifier(a(e).model.getData())))
|
|
1070
|
+
};
|
|
1071
|
+
}
|
|
1072
|
+
}), Ie = l({
|
|
1073
|
+
modelName: "Popover",
|
|
1074
|
+
props: {
|
|
1075
|
+
autoClose: o({
|
|
1076
|
+
type: Boolean,
|
|
1077
|
+
default: !0
|
|
1078
|
+
}),
|
|
1079
|
+
timeout: o({
|
|
1080
|
+
default: 0,
|
|
1081
|
+
validator: (e) => /^\d+$/.test(e)
|
|
1082
|
+
}),
|
|
1083
|
+
containerClass: o(),
|
|
1084
|
+
boundary: o({ type: [
|
|
1085
|
+
Function,
|
|
1086
|
+
Object,
|
|
1087
|
+
String
|
|
1088
|
+
] })
|
|
1089
|
+
},
|
|
1090
|
+
setup(e, t, n) {
|
|
1091
|
+
let r = `component_${U()}`, i = N(), o = N(0), s, c = () => {
|
|
1092
|
+
let e = i.value;
|
|
1093
|
+
if (!e?.visible || !e.container) return;
|
|
1094
|
+
e.alignOverlay();
|
|
1095
|
+
let t = e.container;
|
|
1096
|
+
(window.scrollX || window.scrollY) && (t.style.top = `${parseFloat(t.style.top) - window.scrollY}px`, t.style.insetInlineStart = `${parseFloat(t.style.insetInlineStart) - window.scrollX}px`);
|
|
1097
|
+
let n = e.target.getBoundingClientRect(), r = t.getBoundingClientRect(), a = t.offsetWidth, o = r.left + (r.width - a) / 2, s = getComputedStyle(t), c = (parseFloat(s.getPropertyValue("--p-popover-gutter")) || 0) + (parseFloat(s.borderTopLeftRadius) || 0), u = n.left + n.width / 2;
|
|
1098
|
+
if (a > c * 2) {
|
|
1099
|
+
let e = u - o < c ? Math.max(u - c, 0) - o : Math.max(0, Math.min(u + c, document.documentElement.clientWidth) - (o + a));
|
|
1100
|
+
t.style.insetInlineStart = `${parseFloat(t.style.insetInlineStart) + e}px`, o += e;
|
|
1101
|
+
}
|
|
1102
|
+
let d = l(e.target)?.getBoundingClientRect();
|
|
1103
|
+
if (d) {
|
|
1104
|
+
let e = parseFloat(s.getPropertyValue("--p-popover-gutter")) || 0, r = t.offsetHeight, i = t.classList.contains("p-popover-flipped"), l = n.bottom + e + r <= d.bottom, f = n.top - e - r >= d.top;
|
|
1105
|
+
!i && !l && f ? (t.style.top = `${n.top - r}px`, t.classList.add("p-popover-flipped"), t.setAttribute("data-p-popover-flipped", "true")) : i && !f && l && (t.style.top = `${n.bottom}px`, t.classList.remove("p-popover-flipped"), t.removeAttribute("data-p-popover-flipped"));
|
|
1106
|
+
let p = Math.max(Math.min(0, d.right - (o + a)), d.left - o);
|
|
1107
|
+
a > c * 2 && (p = Math.min(Math.max(p, u + c - (o + a)), u - c - o)), t.style.insetInlineStart = `${parseFloat(t.style.insetInlineStart) + p}px`, o += p;
|
|
1108
|
+
}
|
|
1109
|
+
t.style.setProperty("--p-popover-arrow-left", `${Math.max(0, n.left - o)}px`);
|
|
1110
|
+
}, l = (e) => {
|
|
1111
|
+
let t = P(n.boundary);
|
|
1112
|
+
return typeof t == "function" ? t(e) : typeof t == "string" ? e.closest(t) : t;
|
|
1113
|
+
}, d = () => {
|
|
1114
|
+
s = new ResizeObserver(() => requestAnimationFrame(c)), s.observe(i.value.container);
|
|
1115
|
+
}, f = () => {
|
|
1116
|
+
s?.disconnect(), s = null;
|
|
1117
|
+
};
|
|
1118
|
+
return {
|
|
1119
|
+
template: () => {
|
|
1120
|
+
let t = a(e).trigger();
|
|
1121
|
+
return C("div", { id: r }, [C(V, E({ onClick: (e) => {
|
|
1122
|
+
n.autoClose || e.stopPropagation();
|
|
1123
|
+
} }, n.$attrs, {
|
|
1124
|
+
class: "fixed!",
|
|
1125
|
+
style: {
|
|
1126
|
+
"--p-popover-arrow-offset": `${o.value / 2}px`,
|
|
1127
|
+
"--p-popover-border-radius": "var(--radius-lg)",
|
|
1128
|
+
"--p-popover-border-color": "var(--colors-DCE1E8)",
|
|
1129
|
+
"--p-popover-shadow": "0 2px 8px 0 rgba(18,55,105,0.12)"
|
|
1130
|
+
},
|
|
1131
|
+
onShow: d,
|
|
1132
|
+
onHide: f,
|
|
1133
|
+
ref: i
|
|
1134
|
+
}), {
|
|
1135
|
+
...n.$slots,
|
|
1136
|
+
container: () => n.$slots.default ? n.$slots.default({ component: e }) : a(e).container()
|
|
1137
|
+
}), C(t.type, E(t.props, { onClick: (e) => {
|
|
1138
|
+
o.value = e.currentTarget.offsetWidth, i.value.toggle(e), n.timeout && setTimeout(() => i.value.hide(), n.timeout);
|
|
1139
|
+
} }), t.children)]);
|
|
1140
|
+
},
|
|
1141
|
+
trigger: () => a(e).menuButton({
|
|
1142
|
+
label: "Popover",
|
|
1143
|
+
class: "w-max normal-case"
|
|
1144
|
+
}),
|
|
1145
|
+
container: () => C("div", { class: R(u({ "rounded-[calc(var(--radius-lg)-1px)] overflow-hidden": !0 }, n.containerClass).string, n.containerClass) }, [a(e).body()]),
|
|
1146
|
+
body: () => C("span", { class: "px-2" }, [S("Your content here!")]),
|
|
1147
|
+
menuButton: ({ class: e = "", ...t } = {}, n = {}) => C(q, E({
|
|
1148
|
+
unstyled: !0,
|
|
1149
|
+
class: R(u("flex justify-start h-8.5 w-full rounded-none", e).string, u(e).string)
|
|
1150
|
+
}, t), n),
|
|
1151
|
+
popoverRef: i
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
}), Le = l({
|
|
1155
|
+
modelName: "CustomTable",
|
|
1156
|
+
props: {
|
|
1157
|
+
empty: o({ type: Object }),
|
|
1158
|
+
isSelectable: o({
|
|
1159
|
+
type: Boolean,
|
|
1160
|
+
default: !0
|
|
1161
|
+
}),
|
|
1162
|
+
isCollapsible: o({ type: Boolean }),
|
|
1163
|
+
hasMenu: o({
|
|
1164
|
+
type: Boolean,
|
|
1165
|
+
default: !0
|
|
1166
|
+
}),
|
|
1167
|
+
hasHeaderMenu: o({ type: Boolean }),
|
|
1168
|
+
headerClass: o(),
|
|
1169
|
+
columnLines: o({ type: Boolean }),
|
|
1170
|
+
rowLines: o({
|
|
1171
|
+
type: Boolean,
|
|
1172
|
+
default: !0
|
|
1173
|
+
})
|
|
1174
|
+
},
|
|
1175
|
+
defaultDisplayComponent: !1,
|
|
1176
|
+
displayComponent: Fe,
|
|
1177
|
+
setup(e, t, r) {
|
|
1178
|
+
let o = N({
|
|
1179
|
+
children: [],
|
|
1180
|
+
props: {}
|
|
1181
|
+
}), s = N(/* @__PURE__ */ new Set()), c = N(/* @__PURE__ */ new Set()), l = y(() => {
|
|
1182
|
+
let t = a(e).model.getData();
|
|
1183
|
+
return t.length && t.every((t) => P(a(e).checkedRef).has(a(e).itemIdentifier(t)));
|
|
1184
|
+
}), d = y(() => {
|
|
1185
|
+
let t = a(e).model.getData();
|
|
1186
|
+
return t.length && t.every((t) => P(a(e).expandedRef).has(a(e).itemIdentifier(t)));
|
|
1187
|
+
}), f = y(() => !P(l) && !!P(s).size), p = () => {
|
|
1188
|
+
a(e).model.getData().forEach((t) => {
|
|
1189
|
+
P(a(e).checkedRef).add(a(e).itemIdentifier(t));
|
|
1190
|
+
});
|
|
1191
|
+
}, h = () => {
|
|
1192
|
+
a(e).model.getData().forEach((t) => {
|
|
1193
|
+
P(a(e).checkedRef).delete(a(e).itemIdentifier(t));
|
|
1194
|
+
});
|
|
1195
|
+
}, _ = (e) => r.columnLines ? `[&>.sticky]:z-1 [&>.sticky:not(:last-child):not(:has(~.sticky:not(:last-child)))]:-mr-[calc(var(--column-gap,1rem)/2)] [&>.sticky:not(:last-child):not(:has(~.sticky:not(:last-child)))]:shadow-[1px_0_0_var(--colors-EDEFF2)] [&>*:nth-child(n+3):not(:last-child):not(.sticky)]:relative [&>*:nth-child(n+3):not(:last-child)]:after:absolute [&>*:nth-child(n+3):not(:last-child)]:after:w-px [&>*:nth-child(n+3):not(:last-child)]:after:bg-(--colors-EDEFF2) [&>*:nth-child(n+3):not(:last-child)]:after:left-[calc(var(--column-gap,1rem)/-2)] ${e}` : "", b = () => r.rowLines ? "border-(--colors-EDEFF2) border-b last:border-b-0 [&:has(+:not([data-table-row]))]:border-b-0 [[data-table-row]_&]:border-b-0 [[data-table-row]_*_&]:border-t" : "", x = () => R(r.isCollapsible || r.isSelectable ? "" : "[&>:nth-child(2)]:-ml-[calc(var(--column-gap,1rem)-0.75rem)]", r.hasMenu ? "" : "[&>:nth-last-child(2)]:-mr-[calc(var(--column-gap,1rem)-0.75rem)]"), T = (e, t, n) => t ? e.props?.[`data-col-${t}`] ?? n : e.props ?? {}, D = () => C("div", {
|
|
1196
|
+
"data-table": !0,
|
|
1197
|
+
class: R("flex flex-col", P(o).props.class)
|
|
1198
|
+
}, [a(e).tableHead(), a(e).tableBody()]), O = () => {
|
|
1199
|
+
if (a(e).model.getData().length) {
|
|
1200
|
+
let t = a(e).rowCheckbox({ row: e }), i = a(e).rowMenuButton({ row: e }), s = a(e).leftRowColumnControls({ row: e }), c = a(e).rightRowColumnControls({ row: e }), l = P(o).props["data-header-row-class"] ?? "";
|
|
1201
|
+
return C("div", { class: R(u({ "sticky top-0 z-10 bg-(--colors-F9FAFC) grid grid-cols-subgrid col-span-full": !0 }, r.headerClass, l).string, u(r.headerClass, l).string, _("[&>*:nth-child(n+3):not(:last-child)]:after:inset-y-0"), x()) }, [
|
|
1202
|
+
C(s.type, s.props, { default: () => [C("div", { class: "h-full bg-inherit flex items-center gap-x-2" }, [a(e).rowCollapseButton({}), t && C(t.type, E(n(t.props, ["onChange"]), { onChange: (e) => e.target.checked ? p() : h() }), t.children)])] }),
|
|
1203
|
+
P(o).children.map((e) => T(e, "element") ?? w(T(e, "type", "div"), { class: R(u(T(e).class).string, u(T(e, "class")).string) }, T(e, "title"))),
|
|
1204
|
+
C(c.type, c.props, { default: () => [C("div", { class: "h-full bg-inherit flex items-center" }, [i && C(i, E(n(i.props, ["class"]), { class: R(i.props.class, u({ hidden: !r.hasHeaderMenu }).string) }), i.children)])] })
|
|
1205
|
+
]);
|
|
1206
|
+
}
|
|
1207
|
+
}, k = () => {
|
|
1208
|
+
if (!a(e).model.getData().length && r.empty) return [a(e).emptyTableElement()];
|
|
1209
|
+
let [n, i, o, s] = a(t).template().children;
|
|
1210
|
+
return [
|
|
1211
|
+
n.children,
|
|
1212
|
+
i.children,
|
|
1213
|
+
o.children,
|
|
1214
|
+
a(e).tablePagination(s.children),
|
|
1215
|
+
a(e).tableActionElement()
|
|
1216
|
+
];
|
|
1217
|
+
}, A = (e) => {
|
|
1218
|
+
if (e?.some(Boolean)) return C("div", { class: "sticky bottom-0 z-10 col-span-full px-3 py-2 border-t border-(--colors-EDEFF2) bg-(--colors-white) text-sm" }, [C("div", { class: "sticky right-3 ml-auto w-max" }, [e])]);
|
|
1219
|
+
}, j = (...t) => C("div", { class: R("sticky left-0 bg-inherit self-stretch", r.isCollapsible || r.isSelectable ? "px-3" : "px-0") }, [C("div", { class: "h-full flex items-center gap-x-2 bg-inherit" }, [a(e).rowCollapseButton(...t), a(e).rowCheckbox(...t)])]), M = (...t) => C("div", { class: R("sticky right-0 bg-inherit self-stretch", r.hasMenu ? "px-3" : "px-0") }, [C("div", { class: "h-full flex items-center gap-x-2 bg-inherit" }, [a(e).rowMenuButton(...t)])]), I = () => {
|
|
1220
|
+
let e = g.on(r.empty);
|
|
1221
|
+
return C("div", { class: {
|
|
1222
|
+
hidden: !e.get(),
|
|
1223
|
+
"py-8 px-3 flex flex-col gap-y-3 col-span-full": !0
|
|
1224
|
+
} }, [
|
|
1225
|
+
C("div", { class: "text-(--colors-0F0F12) text-center text-xl not-italic font-semibold leading-6 tracking-[-0.4px]" }, [e.get("title")]),
|
|
1226
|
+
C("div", { class: "text-(--colors-494F62) text-center text-xs not-italic font-normal leading-3.5 tracking-[-0.24px]" }, [e.get("description")]),
|
|
1227
|
+
C("div", { class: "hidden" }, [a(t).template()])
|
|
1228
|
+
]);
|
|
1229
|
+
}, L = ({ row: t } = {}) => {
|
|
1230
|
+
if (r.hasMenu) return C(Ie, {
|
|
1231
|
+
boundary: "[data-table]",
|
|
1232
|
+
setup: (n, r) => ({
|
|
1233
|
+
trigger: () => C(q, {
|
|
1234
|
+
unstyled: !0,
|
|
1235
|
+
class: "p-0 size-6 text-(--colors-A0A3B4) shrink-0"
|
|
1236
|
+
}, { icon: () => C(_e, null, null) }),
|
|
1237
|
+
body: () => C(v, null, [a(n).menuButton({
|
|
1238
|
+
label: "Edit",
|
|
1239
|
+
class: "normal-case",
|
|
1240
|
+
onClick: async () => {
|
|
1241
|
+
await a(e).handleEdit({ row: t });
|
|
1242
|
+
}
|
|
1243
|
+
}, { icon: () => C(me, { class: "text-(--colors-818898) shrink-0" }, null) }), a(n).menuButton({
|
|
1244
|
+
label: "Delete",
|
|
1245
|
+
class: "normal-case",
|
|
1246
|
+
onClick: () => i(C(ie, {
|
|
1247
|
+
setup: () => ({ confirmationTitle: () => "Delete" }),
|
|
1248
|
+
whenOk: async () => {
|
|
1249
|
+
await a(e).handleDelete({ row: t }), a(e).refresh();
|
|
1250
|
+
}
|
|
1251
|
+
}, null))
|
|
1252
|
+
}, { icon: () => C(de, { class: "text-(--colors-818898) shrink-0" }, null) })])
|
|
1253
|
+
})
|
|
1254
|
+
}, null);
|
|
1255
|
+
}, z = (t, n) => {
|
|
1256
|
+
if (P(c).has(t) !== n) {
|
|
1257
|
+
P(c)[n ? "add" : "delete"](t);
|
|
1258
|
+
let r = a(e).getComponent(t);
|
|
1259
|
+
r && a(e).handleCollapsible({
|
|
1260
|
+
row: r,
|
|
1261
|
+
expanded: n
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
}, ee = ({ row: t } = {}) => {
|
|
1265
|
+
if (r.isCollapsible) {
|
|
1266
|
+
let n = t && a(e).itemIdentifier(a(t).model.getData()), r = t ? P(c).has(n) : P(d);
|
|
1267
|
+
return C(q, {
|
|
1268
|
+
unstyled: !0,
|
|
1269
|
+
class: "p-0 size-6 text-(--colors-A0A3B4) shrink-0",
|
|
1270
|
+
onClick: () => {
|
|
1271
|
+
t ? z(n, !r) : a(e).model.getData().forEach((t) => z(a(e).itemIdentifier(t), !r));
|
|
1272
|
+
}
|
|
1273
|
+
}, { icon: () => C(ce, { class: {
|
|
1274
|
+
"transition-transform duration-200": !0,
|
|
1275
|
+
"-rotate-90": !r
|
|
1276
|
+
} }, null) });
|
|
1277
|
+
}
|
|
1278
|
+
}, V = ({ row: t } = {}) => {
|
|
1279
|
+
if (r.isSelectable) return C(m, {
|
|
1280
|
+
type: "checkbox",
|
|
1281
|
+
size: "large",
|
|
1282
|
+
indeterminate: t === e && P(f),
|
|
1283
|
+
data: () => P(t === e ? a(e).isAllSelected : a(t).checkedRef),
|
|
1284
|
+
onChange: (n) => {
|
|
1285
|
+
let r = a(e).itemIdentifier(a(t).model.getData());
|
|
1286
|
+
P(a(e).checkedRef)[n.target.checked ? "add" : "delete"](r);
|
|
1287
|
+
}
|
|
1288
|
+
}, null);
|
|
1289
|
+
}, H = () => {
|
|
1290
|
+
if (P(a(e).checkedRef).size) return C("div", { class: "sticky bottom-0 z-20 col-span-full" }, [C("div", { class: "sticky left-1/2 w-0" }, [C("div", { class: {
|
|
1291
|
+
"absolute -translate-x-1/2 bg-white rounded-xl shadow-[0_4px_24px_rgba(0,0,0,0.12)] px-5 py-3 flex items-center w-max": !0,
|
|
1292
|
+
"bottom-16": !!P(r.$attrs.paginator),
|
|
1293
|
+
"bottom-8": !P(r.$attrs.paginator)
|
|
1294
|
+
} }, [
|
|
1295
|
+
C("span", { class: "font-medium" }, [P(a(e).checkedRef).size, S(" Selected")]),
|
|
1296
|
+
C(B, { layout: "vertical" }, null),
|
|
1297
|
+
a(e).bulkSelectAllButton(),
|
|
1298
|
+
C(B, { layout: "vertical" }, null),
|
|
1299
|
+
a(e).bulkClearAllButton(),
|
|
1300
|
+
a(e).bulkExportButton(),
|
|
1301
|
+
C(B, { layout: "vertical" }, null),
|
|
1302
|
+
a(e).bulkDeleteButton(),
|
|
1303
|
+
C(B, { layout: "vertical" }, null),
|
|
1304
|
+
a(e).bulkCloseButton()
|
|
1305
|
+
])])]);
|
|
1306
|
+
}, U = () => C("button", {
|
|
1307
|
+
class: {
|
|
1308
|
+
"cursor-pointer hover:text-warning duration-300": !0,
|
|
1309
|
+
"text-(--colors-primary-500)": P(l)
|
|
1310
|
+
},
|
|
1311
|
+
onClick: () => p()
|
|
1312
|
+
}, [S("Select all")]), W = () => C("button", {
|
|
1313
|
+
class: "cursor-pointer hover:text-warning duration-300",
|
|
1314
|
+
onClick: () => h()
|
|
1315
|
+
}, [S("Clear all")]), te = () => C("button", {
|
|
1316
|
+
class: "flex items-center gap-x-1 cursor-pointer hover:text-error duration-300",
|
|
1317
|
+
onClick: async () => {
|
|
1318
|
+
i(C(ie, {
|
|
1319
|
+
setup: () => ({ confirmationTitle: () => "Delete" }),
|
|
1320
|
+
whenOk: async () => {
|
|
1321
|
+
await a(e).handleBulkDelete(Array.from(P(a(e).checkedRef))), h(), a(e).refresh();
|
|
1322
|
+
}
|
|
1323
|
+
}, null));
|
|
1324
|
+
}
|
|
1325
|
+
}, [S("Delete")]), ne = () => C(v, null, [C(B, { layout: "vertical" }, null), C("button", {
|
|
1326
|
+
class: "cursor-pointer hover:text-warning duration-300",
|
|
1327
|
+
onClick: async () => {
|
|
1328
|
+
await a(e).handleBulkExport(Array.from(P(a(e).checkedRef))), h();
|
|
1329
|
+
}
|
|
1330
|
+
}, [S("Export")])]), G = () => C("button", {
|
|
1331
|
+
class: "cursor-pointer text-gray-400 hover:text-gray-600 duration-300",
|
|
1332
|
+
onClick: () => h()
|
|
1333
|
+
}, [C(X, { class: "size-4" }, null)]), K = () => {}, J = () => {}, Y = (e) => {
|
|
1334
|
+
if (e && a(e).rowElement) try {
|
|
1335
|
+
return a(e).rowElement().children.default();
|
|
1336
|
+
} catch (t) {
|
|
1337
|
+
try {
|
|
1338
|
+
return a(e).rowElement();
|
|
1339
|
+
} catch (n) {
|
|
1340
|
+
console.warn(`[${r.modelName}]: failed to set table columns`, {
|
|
1341
|
+
e1: t,
|
|
1342
|
+
e2: n
|
|
1343
|
+
}, a(e));
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
return F(() => Y(a(e, Function).defaultComponent()), (e) => {
|
|
1348
|
+
e && (o.value = e);
|
|
1349
|
+
}), {
|
|
1350
|
+
template: D,
|
|
1351
|
+
tableHead: O,
|
|
1352
|
+
tableBody: k,
|
|
1353
|
+
tablePagination: A,
|
|
1354
|
+
columnLineClass: _,
|
|
1355
|
+
rowLineClass: b,
|
|
1356
|
+
controlsInsetClass: x,
|
|
1357
|
+
leftRowColumnControls: j,
|
|
1358
|
+
rightRowColumnControls: M,
|
|
1359
|
+
emptyTableElement: I,
|
|
1360
|
+
tableActionElement: H,
|
|
1361
|
+
rowMenuButton: L,
|
|
1362
|
+
rowCollapseButton: ee,
|
|
1363
|
+
rowCheckbox: V,
|
|
1364
|
+
bulkSelectAllButton: U,
|
|
1365
|
+
bulkClearAllButton: W,
|
|
1366
|
+
bulkDeleteButton: te,
|
|
1367
|
+
bulkExportButton: ne,
|
|
1368
|
+
bulkCloseButton: G,
|
|
1369
|
+
selectAll: p,
|
|
1370
|
+
deselectAll: h,
|
|
1371
|
+
checkedRef: s,
|
|
1372
|
+
expandedRef: c,
|
|
1373
|
+
isAllSelected: l,
|
|
1374
|
+
isAllExpanded: d,
|
|
1375
|
+
isIndeterminate: f,
|
|
1376
|
+
row: o,
|
|
1377
|
+
refresh: K,
|
|
1378
|
+
handleCollapsible: J
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
}, Pe), Re = l({
|
|
1382
|
+
props: {
|
|
1383
|
+
defaultData: o(),
|
|
1384
|
+
filled: o({ type: Boolean }),
|
|
1385
|
+
timezone: o({ type: [Boolean, String] }),
|
|
1386
|
+
time: o({ type: Boolean }),
|
|
1387
|
+
date: o({
|
|
1388
|
+
type: Boolean,
|
|
1389
|
+
default: !0
|
|
1390
|
+
}),
|
|
1391
|
+
type: o({
|
|
1392
|
+
type: String,
|
|
1393
|
+
default: "date",
|
|
1394
|
+
validator: (t) => {
|
|
1395
|
+
let n = [
|
|
1396
|
+
"date",
|
|
1397
|
+
"dates",
|
|
1398
|
+
"range"
|
|
1399
|
+
];
|
|
1400
|
+
return n.includes(t) || e(`[Datetime] invalid type. Must be one of ${n.join(", ")}.`);
|
|
1401
|
+
}
|
|
1402
|
+
}),
|
|
1403
|
+
options: o({
|
|
1404
|
+
type: Object,
|
|
1405
|
+
default: {}
|
|
1406
|
+
}),
|
|
1407
|
+
minDate: o({
|
|
1408
|
+
type: [Boolean, Date],
|
|
1409
|
+
default: () => /* @__PURE__ */ new Date(),
|
|
1410
|
+
validator: (e) => ["Boolean", "Date"].includes(e?.constructor.name) && e !== !0
|
|
1411
|
+
}),
|
|
1412
|
+
inputClass: o(),
|
|
1413
|
+
panelClass: o()
|
|
1414
|
+
},
|
|
1415
|
+
defaultData: (e) => P(e.defaultData) ?? {
|
|
1416
|
+
date: void 0,
|
|
1417
|
+
dates: [],
|
|
1418
|
+
range: {}
|
|
1419
|
+
}[P(e.type)],
|
|
1420
|
+
setup(e, t, n) {
|
|
1421
|
+
let r = y(() => {
|
|
1422
|
+
let t = a(e).model.getData();
|
|
1423
|
+
if (c.value === "range") {
|
|
1424
|
+
let n = g.on(t), r = n.get(a(e).dataPath("start")), i = n.get(a(e).dataPath("end"));
|
|
1425
|
+
if (r && i) return [K(r), K(i)];
|
|
1426
|
+
} else if (c.value === "multiple") return Array.isArray(t) ? t.map((e) => K(e)) : [];
|
|
1427
|
+
else if (typeof t == "string") return o.value ? G(t, "HH:mm", /* @__PURE__ */ new Date()) : K(t);
|
|
1428
|
+
}), i = y(() => !!P(n.time)), o = y(() => P(n.date) === !1), s = (e) => o.value ? te(e, "HH:mm") : i.value && typeof P(n.timezone) == "string" ? L(e, P(n.timezone), "yyyy-MM-dd'T'HH:mm:ssXXX") : ne(e, { representation: i.value ? "complete" : "date" }), c = y(() => ({
|
|
1429
|
+
date: "single",
|
|
1430
|
+
dates: "multiple",
|
|
1431
|
+
range: "range"
|
|
1432
|
+
})[P(n.type)]), l = N(), d = !1, f = (e) => e.target.tagName === "INPUT" && !e.target.closest(".p-datepicker-panel");
|
|
1433
|
+
return { template: () => {
|
|
1434
|
+
let t = o.value ? "hh:mm am" : `mm/dd/yyyy${i.value ? " hh:mm am" : ""}`;
|
|
1435
|
+
return C(ee, E({
|
|
1436
|
+
ref: l,
|
|
1437
|
+
onMousedown: (e) => {
|
|
1438
|
+
d = f(e) && l.value.overlayVisible;
|
|
1439
|
+
},
|
|
1440
|
+
onClick: (e) => {
|
|
1441
|
+
f(e) && d && (l.value.overlayVisible = !1);
|
|
1442
|
+
},
|
|
1443
|
+
fluid: !0,
|
|
1444
|
+
size: "small",
|
|
1445
|
+
appendTo: "self",
|
|
1446
|
+
hideOnRangeSelection: !0,
|
|
1447
|
+
selectOtherMonths: !0,
|
|
1448
|
+
manualInput: !1,
|
|
1449
|
+
dateFormat: "mm/dd/yy",
|
|
1450
|
+
showTime: i.value,
|
|
1451
|
+
timeOnly: o.value,
|
|
1452
|
+
hourFormat: "12"
|
|
1453
|
+
}, P(n.options), n.$attrs, { panelClass: ["min-w-0! w-max!", P(n.panelClass)] }, P(n.minDate) && !o.value ? { minDate: P(n.minDate) } : {}, {
|
|
1454
|
+
inputClass: R(u({ "bg-(--colors-F5F6F8)!": P(n.filled) }).string, u(P(n.inputClass)).string),
|
|
1455
|
+
selectionMode: c.value,
|
|
1456
|
+
placeholder: `${t}${c.value === "range" ? ` - ${t}` : c.value === "multiple" ? `, ..., ${t}` : ""}`,
|
|
1457
|
+
modelValue: r.value,
|
|
1458
|
+
"onUpdate:modelValue": (t) => {
|
|
1459
|
+
if (t) if (c.value === "range") {
|
|
1460
|
+
let [n, r] = t;
|
|
1461
|
+
n && r && a(e).model.replaceData({
|
|
1462
|
+
[a(e).dataPath("start")]: s(n),
|
|
1463
|
+
[a(e).dataPath("end")]: s(r)
|
|
1464
|
+
});
|
|
1465
|
+
} else c.value === "multiple" ? a(e).model.replaceData(t.map(s)) : a(e).model.replaceData(s(t));
|
|
1466
|
+
else a(e).model.replaceData();
|
|
1467
|
+
}
|
|
1468
|
+
}), null);
|
|
1469
|
+
} };
|
|
1470
|
+
}
|
|
1471
|
+
}), ze = {
|
|
1472
|
+
viewBox: "0 0 24 24",
|
|
1473
|
+
width: "1.2em",
|
|
1474
|
+
height: "1.2em"
|
|
1475
|
+
};
|
|
1476
|
+
function Be(e, t) {
|
|
1477
|
+
return A(), b("svg", ze, [...t[0] ||= [x("path", {
|
|
1478
|
+
fill: "currentColor",
|
|
1479
|
+
d: "M9 3v1H4v2h1v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6h1V4h-5V3zM7 6h10v13H7zm2 2v9h2V8zm4 0v9h2V8z"
|
|
1480
|
+
}, null, -1)]]);
|
|
1481
|
+
}
|
|
1482
|
+
var Ve = T({
|
|
1483
|
+
name: "mdi-trash-can-outline",
|
|
1484
|
+
render: Be
|
|
1485
|
+
}), He = {
|
|
1486
|
+
viewBox: "0 0 24 24",
|
|
1487
|
+
width: "1.2em",
|
|
1488
|
+
height: "1.2em"
|
|
1489
|
+
};
|
|
1490
|
+
function Ue(e, t) {
|
|
1491
|
+
return A(), b("svg", He, [...t[0] ||= [x("path", {
|
|
1492
|
+
fill: "currentColor",
|
|
1493
|
+
d: "M9 3h2v2H9zm4 0h2v2h-2zM9 7h2v2H9zm4 0h2v2h-2zm-4 4h2v2H9zm4 0h2v2h-2zm-4 4h2v2H9zm4 0h2v2h-2zm-4 4h2v2H9zm4 0h2v2h-2z"
|
|
1494
|
+
}, null, -1)]]);
|
|
1495
|
+
}
|
|
1496
|
+
var We = T({
|
|
1497
|
+
name: "mdi-drag-vertical",
|
|
1498
|
+
render: Ue
|
|
1499
|
+
}), Ge = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==", Q = null, Ke = (e) => {
|
|
1500
|
+
!e?.setDragImage || typeof Image > "u" || (Q || (Q = new Image(), Q.src = Ge), e.setDragImage(Q, 0, 0));
|
|
1501
|
+
}, qe = l({
|
|
1502
|
+
modelName: "DraggableList",
|
|
1503
|
+
defaultData: [],
|
|
1504
|
+
setup(e, t, n) {
|
|
1505
|
+
let r = N(null), i = N(null), o = (e) => r.value !== null && e !== r.value && e !== r.value + 1, s = (e, t) => {
|
|
1506
|
+
r.value = t, e.dataTransfer && (e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", t.toString()), Ke(e.dataTransfer));
|
|
1507
|
+
}, c = (e, t) => {
|
|
1508
|
+
e.preventDefault(), i.value = t === r.value ? null : {
|
|
1509
|
+
type: "item",
|
|
1510
|
+
index: t
|
|
1511
|
+
};
|
|
1512
|
+
}, l = (e, t) => {
|
|
1513
|
+
e.preventDefault(), i.value = o(t) ? {
|
|
1514
|
+
type: "gap",
|
|
1515
|
+
index: t
|
|
1516
|
+
} : null;
|
|
1517
|
+
}, u = (t, n) => {
|
|
1518
|
+
if (t.preventDefault(), r.value !== null && r.value !== n) {
|
|
1519
|
+
let t = [...a(e).model.getData() || []];
|
|
1520
|
+
[t[r.value], t[n]] = [t[n], t[r.value]], a(e).model.replaceData(t);
|
|
1521
|
+
}
|
|
1522
|
+
f();
|
|
1523
|
+
}, d = (t, n) => {
|
|
1524
|
+
if (t.preventDefault(), o(n)) {
|
|
1525
|
+
let t = [...a(e).model.getData() || []], [i] = t.splice(r.value, 1);
|
|
1526
|
+
t.splice(n > r.value ? n - 1 : n, 0, i), a(e).model.replaceData(t);
|
|
1527
|
+
}
|
|
1528
|
+
f();
|
|
1529
|
+
}, f = () => {
|
|
1530
|
+
r.value = null, i.value = null;
|
|
1531
|
+
}, p = (t) => {
|
|
1532
|
+
let n = [...a(e).model.getData() || []];
|
|
1533
|
+
n.splice(t, 1), a(e).model.replaceData(n);
|
|
1534
|
+
}, m = () => {
|
|
1535
|
+
let t = a(e).model.getData() || [];
|
|
1536
|
+
return C("div", { class: "flex flex-col" }, [t.map((t, n) => [a(e).gap(n), a(e).itemRow(t, n)]), t.length ? a(e).gap(t.length) : !1]);
|
|
1537
|
+
};
|
|
1538
|
+
return {
|
|
1539
|
+
template: m,
|
|
1540
|
+
render: m,
|
|
1541
|
+
gap: (t) => {
|
|
1542
|
+
let n = i.value?.type === "gap" && i.value.index === t;
|
|
1543
|
+
return C("div", {
|
|
1544
|
+
key: `gap-${t}`,
|
|
1545
|
+
"data-drop-gap": t,
|
|
1546
|
+
onDragover: (n) => a(e).onGapDragOver(n, t),
|
|
1547
|
+
onDrop: (n) => a(e).onGapDrop(n, t),
|
|
1548
|
+
class: "mx-1 h-4 shrink-0 flex items-center"
|
|
1549
|
+
}, [C("div", { class: {
|
|
1550
|
+
"h-1 w-full rounded-full transition-colors": !0,
|
|
1551
|
+
"bg-(--colors-DE851A) shadow-[0_0_0_3px_rgb(222_133_26/0.25)]": n
|
|
1552
|
+
} }, null)]);
|
|
1553
|
+
},
|
|
1554
|
+
itemRow: (t, n) => {
|
|
1555
|
+
let o = r.value === n, s = i.value?.type === "item" && i.value.index === n;
|
|
1556
|
+
return C("div", {
|
|
1557
|
+
key: t.id || t.uuid || `new-${n}`,
|
|
1558
|
+
"data-drop-item": n,
|
|
1559
|
+
draggable: "true",
|
|
1560
|
+
onDragstart: (t) => a(e).onDragStart(t, n),
|
|
1561
|
+
onDragover: (t) => a(e).onDragOver(t, n),
|
|
1562
|
+
onDrop: (t) => a(e).onDrop(t, n),
|
|
1563
|
+
onDragend: (t) => a(e).onDragEnd(t),
|
|
1564
|
+
class: {
|
|
1565
|
+
"px-3 flex items-center gap-x-3 bg-white border rounded shadow-sm cursor-move transition-all": !0,
|
|
1566
|
+
"border-[#DCE1E8]": !s,
|
|
1567
|
+
"opacity-40 border-dashed": o,
|
|
1568
|
+
"border-(--colors-DE851A) ring-1 ring-inset ring-(--colors-DE851A) shadow-md": s
|
|
1569
|
+
}
|
|
1570
|
+
}, [
|
|
1571
|
+
a(e).dragHandle(),
|
|
1572
|
+
a(e).indexBadge(n),
|
|
1573
|
+
C("div", { class: "grow flex items-center overflow-hidden" }, [a(e).itemContent(t, n)]),
|
|
1574
|
+
a(e).removeAction(t, n)
|
|
1575
|
+
]);
|
|
1576
|
+
},
|
|
1577
|
+
dragHandle: () => C("div", { class: "text-(--colors-8B8CA0) grid place-items-center cursor-grab active:cursor-grabbing" }, [C(We, { class: "size-6" }, null)]),
|
|
1578
|
+
indexBadge: (e) => C("div", { class: "w-5 h-5 rounded-full bg-(--colors-primary-500) text-white flex items-center justify-center text-[10px] font-bold shrink-0" }, [e + 1]),
|
|
1579
|
+
itemContent: (e, t) => n.$slots.default ? n.$slots.default({
|
|
1580
|
+
item: e,
|
|
1581
|
+
index: t
|
|
1582
|
+
}) : C("div", { class: "text-sm font-medium text-(--colors-303136) truncate ml-2" }, [e.text || e.name || e.title || `Item ${t + 1}`]),
|
|
1583
|
+
removeAction: (t, n) => C("button", {
|
|
1584
|
+
type: "button",
|
|
1585
|
+
onClick: () => a(e).onRemove(n),
|
|
1586
|
+
class: "text-gray-400 hover:text-error duration-300 cursor-pointer",
|
|
1587
|
+
"aria-label": "Remove item"
|
|
1588
|
+
}, [C(Ve, { class: "size-6" }, null)]),
|
|
1589
|
+
onDragStart: s,
|
|
1590
|
+
onDragOver: c,
|
|
1591
|
+
onGapDragOver: l,
|
|
1592
|
+
onDrop: u,
|
|
1593
|
+
onGapDrop: d,
|
|
1594
|
+
onDragEnd: f,
|
|
1595
|
+
onRemove: p,
|
|
1596
|
+
dragIndex: r,
|
|
1597
|
+
dropTarget: i
|
|
1598
|
+
};
|
|
1599
|
+
}
|
|
1600
|
+
}), $ = (e, { name: t } = {}) => new Proxy(e, { get: (e, n, r) => n === "unsigned" ? $(Object.assign({}, e, { allowMinus: !1 }), { name: t }) : n === "edit" ? (t) => Object.assign({}, e, t) : n === "name" ? t : Reflect.get(e, n, r) }), Je = {
|
|
1601
|
+
currency: $({
|
|
1602
|
+
alias: "currency",
|
|
1603
|
+
prefix: "$",
|
|
1604
|
+
autoUnmask: !0,
|
|
1605
|
+
unmaskAsNumber: !0,
|
|
1606
|
+
clearMaskOnLostFocus: !1,
|
|
1607
|
+
rightAlign: !1,
|
|
1608
|
+
numericInput: !0
|
|
1609
|
+
}, { name: "Currency" }),
|
|
1610
|
+
percentage: $({
|
|
1611
|
+
alias: "numeric",
|
|
1612
|
+
suffix: " %",
|
|
1613
|
+
autoUnmask: !0,
|
|
1614
|
+
unmaskAsNumber: !0,
|
|
1615
|
+
clearMaskOnLostFocus: !1,
|
|
1616
|
+
rightAlign: !1,
|
|
1617
|
+
max: 100,
|
|
1618
|
+
min: 0
|
|
1619
|
+
}, { name: "Percentage" }),
|
|
1620
|
+
pounds: $({
|
|
1621
|
+
alias: "numeric",
|
|
1622
|
+
suffix: " lbs",
|
|
1623
|
+
autoUnmask: !0,
|
|
1624
|
+
unmaskAsNumber: !0,
|
|
1625
|
+
clearMaskOnLostFocus: !1,
|
|
1626
|
+
rightAlign: !1
|
|
1627
|
+
}, { name: "Pounds" }),
|
|
1628
|
+
integer: $({
|
|
1629
|
+
alias: "integer",
|
|
1630
|
+
autoUnmask: !0,
|
|
1631
|
+
unmaskAsNumber: !0,
|
|
1632
|
+
clearMaskOnLostFocus: !1,
|
|
1633
|
+
numericInput: !0,
|
|
1634
|
+
rightAlign: !1
|
|
1635
|
+
}, { name: "Integer" }),
|
|
1636
|
+
float: $({
|
|
1637
|
+
alias: "currency",
|
|
1638
|
+
autoUnmask: !0,
|
|
1639
|
+
unmaskAsNumber: !0,
|
|
1640
|
+
clearMaskOnLostFocus: !1,
|
|
1641
|
+
rightAlign: !1,
|
|
1642
|
+
numericInput: !0,
|
|
1643
|
+
digits: 2
|
|
1644
|
+
}, { name: "Float" }),
|
|
1645
|
+
number: $({
|
|
1646
|
+
alias: "currency",
|
|
1647
|
+
autoUnmask: !0,
|
|
1648
|
+
unmaskAsNumber: !0,
|
|
1649
|
+
clearMaskOnLostFocus: !1,
|
|
1650
|
+
rightAlign: !1,
|
|
1651
|
+
numericInput: !0,
|
|
1652
|
+
digits: 2
|
|
1653
|
+
}, { name: "Number" }),
|
|
1654
|
+
phone: $({
|
|
1655
|
+
mask: "(999) 999 - 9999",
|
|
1656
|
+
placeholder: "0"
|
|
1657
|
+
}, { name: "Phone number" })
|
|
1658
|
+
}, Ye = Object.assign(Je, { format: (e, t) => new Proxy(Je, { get: (n, r) => W.format(String(e ?? ""), Object.assign({}, Je[r], t)) }) });
|
|
1659
|
+
//#endregion
|
|
1660
|
+
export { q as Button, ie as ConfirmationModal, ae as CustomAlert, Z as CustomButton, re as CustomModal, Le as CustomTable, Fe as CustomTableRow, Re as Datetime, qe as DraggableList, h as Editor, m as Input, Pe as ItemsList, p as Label, Ne as ListPagination, Ye as Masks, Ie as Popover, f as Select };
|