vlite3 1.0.8 → 1.1.1
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/README.md +4 -1
- package/components/Accordion/Accordion.vue.d.ts +1 -1
- package/components/AvatarGroup/AvatarGroup.vue.d.ts +24 -0
- package/components/AvatarGroup/AvatarGroup.vue.js +91 -0
- package/components/AvatarGroup/AvatarGroup.vue2.js +4 -0
- package/components/AvatarGroup/index.d.ts +2 -0
- package/components/Barcode/Barcode.vue.js +6 -5
- package/components/Calendar/Calendar.vue.d.ts +229 -0
- package/components/Calendar/Calendar.vue.js +7 -0
- package/components/Calendar/Calendar.vue2.js +186 -0
- package/components/Calendar/CalendarEventItem.vue.d.ts +17 -0
- package/components/Calendar/CalendarEventItem.vue.js +111 -0
- package/components/Calendar/CalendarEventItem.vue2.js +4 -0
- package/components/Calendar/index.d.ts +2 -0
- package/components/CategoryManager/CategoryManager.vue.js +282 -0
- package/components/CategoryManager/CategoryManager.vue2.js +4 -0
- package/components/CategoryManager/CategoryNode.vue.js +224 -0
- package/components/CategoryManager/CategoryNode.vue2.js +4 -0
- package/components/Chat/ChatBubble.vue.js +22 -22
- package/components/Chat/ChatInterface.vue.js +35 -34
- package/components/CommandPalette/CommandPaletteContent.vue.js +1 -1
- package/components/CommandPalette/CommandPaletteContent.vue2.js +7 -7
- package/components/CommandPalette/{CommandPaletteItem.vue.js → CommandPaletteItem.vue2.js} +1 -1
- package/components/CustomFieldsDisplay/CustomFieldsDisplay.vue.d.ts +48 -0
- package/components/CustomFieldsDisplay/CustomFieldsDisplay.vue.js +97 -0
- package/components/CustomFieldsDisplay/CustomFieldsDisplay.vue2.js +4 -0
- package/components/CustomFieldsDisplay/index.d.ts +2 -0
- package/components/CustomFieldsDisplay/types.d.ts +18 -0
- package/components/DateTime/DateTime.vue.d.ts +2 -0
- package/components/DateTime/DateTime.vue.js +9 -23
- package/components/Dropdown/Dropdown.vue.d.ts +1 -1
- package/components/Dropdown/DropdownMenu.vue.d.ts +1 -1
- package/components/FilePicker/FilePicker.vue.js +133 -140
- package/components/Form/CustomFields.vue.d.ts +1 -1
- package/components/Form/Form.vue.d.ts +2 -0
- package/components/Form/Form.vue.js +1 -1
- package/components/Form/Form.vue2.js +291 -236
- package/components/Form/FormField.vue.js +281 -226
- package/components/Form/FormFields.vue.d.ts +8 -0
- package/components/Form/FormFields.vue.js +1 -1
- package/components/Form/FormFields.vue2.js +73 -68
- package/components/Form/FormSkeleton.vue.d.ts +9 -0
- package/components/Form/FormSkeleton.vue.js +50 -0
- package/components/Form/FormSkeleton.vue2.js +4 -0
- package/components/Form/composables/useForm.d.ts +2 -0
- package/components/Form/composables/useForm.js +182 -151
- package/components/Form/index.d.ts +1 -0
- package/components/Form/types.d.ts +3 -1
- package/components/Form/utils/form.utils.d.ts +6 -1
- package/components/Form/utils/form.utils.js +91 -79
- package/components/ImportData/ImportData.vue.js +48 -48
- package/components/ImportData/ImportStep2.vue.js +116 -5
- package/components/ImportData/ImportStep2.vue2.js +2 -105
- package/components/Invoice/Invoice.vue.d.ts +6 -0
- package/components/Invoice/Invoice.vue.js +31 -0
- package/components/Invoice/Invoice.vue2.js +4 -0
- package/components/Invoice/InvoiceVariant1.vue.d.ts +10 -0
- package/components/Invoice/InvoiceVariant1.vue.js +314 -0
- package/components/Invoice/InvoiceVariant1.vue2.js +4 -0
- package/components/Invoice/InvoiceVariant2.vue.d.ts +10 -0
- package/components/Invoice/InvoiceVariant2.vue.js +230 -0
- package/components/Invoice/InvoiceVariant2.vue2.js +4 -0
- package/components/Invoice/InvoiceVariant3.vue.d.ts +10 -0
- package/components/Invoice/InvoiceVariant3.vue.js +249 -0
- package/components/Invoice/InvoiceVariant3.vue2.js +4 -0
- package/components/Invoice/InvoiceVariant4.vue.d.ts +10 -0
- package/components/Invoice/InvoiceVariant4.vue.js +290 -0
- package/components/Invoice/InvoiceVariant4.vue2.js +4 -0
- package/components/Invoice/index.d.ts +2 -0
- package/components/Invoice/types.d.ts +93 -0
- package/components/List/ListFieldRow.vue.d.ts +8 -0
- package/components/List/ListFieldRow.vue.js +160 -187
- package/components/List/utils.d.ts +2 -3
- package/components/List/utils.js +8 -60
- package/components/Navbar/NavbarTabs.vue.js +2 -2
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/NumberInput.vue.js +2 -2
- package/components/NumberInput.vue2.js +85 -79
- package/components/Screen/ScreenFilter.vue.js +6 -4
- package/components/Screen/components/ScreenQuickFilters.vue.js +6 -5
- package/components/SidePanel.vue.js +2 -2
- package/components/SidePanel.vue2.js +1 -1
- package/components/SidebarMenu/SidebarMenu.vue.d.ts +1 -1
- package/components/Slider.vue.js +54 -54
- package/components/Stats/StatItem.vue.d.ts +25 -0
- package/components/Stats/StatItem.vue.js +251 -0
- package/components/Stats/StatItem.vue2.js +4 -0
- package/components/Stats/Stats.vue.d.ts +3 -3
- package/components/Stats/Stats.vue.js +32 -351
- package/components/Stats/components/StatIconBox.vue.d.ts +13 -0
- package/components/Stats/components/StatIconBox.vue.js +82 -0
- package/components/Stats/components/StatIconBox.vue2.js +4 -0
- package/components/Stats/components/StatTrend.vue.d.ts +7 -0
- package/components/Stats/components/StatTrend.vue.js +48 -0
- package/components/Stats/components/StatTrend.vue2.js +4 -0
- package/components/StatusChip/status-map.js +36 -0
- package/components/Tabes/Tabes.vue.d.ts +1 -0
- package/components/Tabes/Tabes.vue.js +2 -2
- package/components/Tabes/Tabes.vue2.js +33 -32
- package/components/ThumbnailSelector/ThumbnailSelector.vue.d.ts +35 -0
- package/components/ThumbnailSelector/ThumbnailSelector.vue.js +7 -0
- package/components/ThumbnailSelector/ThumbnailSelector.vue2.js +184 -0
- package/components/ThumbnailSelector/index.d.ts +2 -0
- package/index.d.ts +6 -0
- package/index.js +297 -265
- package/package.json +2 -1
- package/style.css +11 -9
- package/utils/functions.d.ts +59 -1
- package/utils/functions.js +157 -81
- package/utils/status.d.ts +5 -0
- package/utils/status.js +33 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { defineComponent as S, ref as A, computed as c, openBlock as g, createElementBlock as y, withModifiers as x, normalizeClass as j, createElementVNode as u, toDisplayString as h, createCommentVNode as P, createVNode as z, withCtx as I } from "vue";
|
|
2
|
+
import U from "../Dropdown/Dropdown.vue.js";
|
|
3
|
+
import { $t as D } from "../../utils/i18n.js";
|
|
4
|
+
import { formatTime as T, formatDisplayTime as b } from "v-event-calendar";
|
|
5
|
+
const q = { class: "font-medium truncate leading-tight drop-shadow-sm pr-4" }, F = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "opacity-90 font-medium text-[9px] truncate mt-0.5 tracking-tight drop-shadow-sm flex items-center gap-1"
|
|
8
|
+
}, G = { class: "truncate" }, Q = /* @__PURE__ */ S({
|
|
9
|
+
__name: "CalendarEventItem",
|
|
10
|
+
props: {
|
|
11
|
+
event: {},
|
|
12
|
+
view: {},
|
|
13
|
+
displayTime: {},
|
|
14
|
+
canEdit: { type: Boolean },
|
|
15
|
+
canDelete: { type: Boolean }
|
|
16
|
+
},
|
|
17
|
+
emits: ["view", "edit", "delete"],
|
|
18
|
+
setup(v, { emit: C }) {
|
|
19
|
+
const t = v, d = C, s = A(!1), E = () => {
|
|
20
|
+
s.value = !0;
|
|
21
|
+
}, $ = (e) => {
|
|
22
|
+
e.target.closest(".event-actions") || d("view", t.event);
|
|
23
|
+
}, m = (e, n, i) => {
|
|
24
|
+
const a = i ? D(e, i) : D(e);
|
|
25
|
+
return a !== e ? a : n;
|
|
26
|
+
}, M = c(() => m("vlite.calendar.viewDetails", "View Details")), N = c(() => m("vlite.calendar.edit", "Edit")), k = c(() => m("vlite.calendar.delete", "Delete")), V = c(() => {
|
|
27
|
+
const e = [
|
|
28
|
+
{
|
|
29
|
+
label: M.value,
|
|
30
|
+
value: "view",
|
|
31
|
+
icon: "lucide:eye",
|
|
32
|
+
class: "gap-1"
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
return t.canEdit && e.push({
|
|
36
|
+
label: N.value,
|
|
37
|
+
value: "edit",
|
|
38
|
+
icon: "lucide:edit-2",
|
|
39
|
+
class: "gap-1"
|
|
40
|
+
}), t.canDelete && e.push({
|
|
41
|
+
label: k.value,
|
|
42
|
+
value: "delete",
|
|
43
|
+
icon: "lucide:trash-2",
|
|
44
|
+
class: "gap-1"
|
|
45
|
+
}), e;
|
|
46
|
+
}), _ = (e) => {
|
|
47
|
+
const n = e.value;
|
|
48
|
+
n === "view" && d("view", t.event), n === "edit" && d("edit", t.event), n === "delete" && d("delete", t.event);
|
|
49
|
+
}, f = c(() => {
|
|
50
|
+
if (!t.event?.start) return t.displayTime || "";
|
|
51
|
+
try {
|
|
52
|
+
const e = new Date(t.event.start);
|
|
53
|
+
if (isNaN(e.getTime())) return t.displayTime || "";
|
|
54
|
+
const n = T(e), i = b(n, !1), a = (p) => {
|
|
55
|
+
let l = p.replace(/^0/, "");
|
|
56
|
+
return l = l.replace(":00 ", " "), l;
|
|
57
|
+
}, o = a(i);
|
|
58
|
+
if (t.event.end && t.event.end !== t.event.start) {
|
|
59
|
+
const p = new Date(t.event.end);
|
|
60
|
+
if (!isNaN(p.getTime())) {
|
|
61
|
+
const l = T(p), B = b(l, !1), r = a(B), w = o.slice(-2), O = r.slice(-2);
|
|
62
|
+
if (w === O && o !== r)
|
|
63
|
+
return `${o.replace(` ${w}`, "")} – ${r.replace(" ", "")}`;
|
|
64
|
+
if (o !== r)
|
|
65
|
+
return `${o.replace(" ", "")} – ${r.replace(" ", "")}`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return o.replace(" ", "");
|
|
69
|
+
} catch {
|
|
70
|
+
return t.displayTime || "";
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return (e, n) => (g(), y("div", {
|
|
74
|
+
class: j([
|
|
75
|
+
v.view == "month" ? "flex-row! justify-between p-0.5 px-0! -text-fs-3! items-center" : " -text-fs-3",
|
|
76
|
+
"h-full w-full flex flex-col overflow-hidden relative group cursor-pointer"
|
|
77
|
+
]),
|
|
78
|
+
onClick: $,
|
|
79
|
+
onContextmenu: x(E, ["prevent"])
|
|
80
|
+
}, [
|
|
81
|
+
u("div", q, h(v.event.title), 1),
|
|
82
|
+
f.value ? (g(), y("div", F, [
|
|
83
|
+
u("span", G, h(f.value), 1)
|
|
84
|
+
])) : P("", !0),
|
|
85
|
+
z(U, {
|
|
86
|
+
options: V.value,
|
|
87
|
+
"is-open": s.value,
|
|
88
|
+
"onUpdate:isOpen": n[1] || (n[1] = (i) => s.value = i),
|
|
89
|
+
onOnSelect: _,
|
|
90
|
+
class: "absolute top-1 right-1",
|
|
91
|
+
position: "bottom-end"
|
|
92
|
+
}, {
|
|
93
|
+
trigger: I(() => [
|
|
94
|
+
u("button", {
|
|
95
|
+
class: "event-actions lg:opacity-0 lg:group-hover:opacity-100 opacity-100 transition-opacity p-0.5 rounded hover:bg-black/20 text-current flex items-center justify-center",
|
|
96
|
+
onClick: n[0] || (n[0] = x((i) => s.value = !s.value, ["stop", "prevent"]))
|
|
97
|
+
}, [...n[2] || (n[2] = [
|
|
98
|
+
u("span", {
|
|
99
|
+
class: "iconify w-3 h-3",
|
|
100
|
+
"data-icon": "lucide:more-vertical"
|
|
101
|
+
}, null, -1)
|
|
102
|
+
])])
|
|
103
|
+
]),
|
|
104
|
+
_: 1
|
|
105
|
+
}, 8, ["options", "is-open"])
|
|
106
|
+
], 34));
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
export {
|
|
110
|
+
Q as default
|
|
111
|
+
};
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { defineComponent as Y, ref as c, watch as Z, computed as I, provide as ee, openBlock as g, createElementBlock as V, createElementVNode as u, renderSlot as te, createBlock as R, withCtx as U, createTextVNode as $, createCommentVNode as z, createVNode as f, toDisplayString as O, withDirectives as oe, withKeys as F, vModelText as ne, unref as re } from "vue";
|
|
2
|
+
import le from "./CategoryNode.vue.js";
|
|
3
|
+
import de from "../Modal.vue.js";
|
|
4
|
+
import ie from "../Form/Form.vue.js";
|
|
5
|
+
import ae from "../Icon.vue.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import D from "../Button.vue.js";
|
|
8
|
+
import "../../core/config.js";
|
|
9
|
+
/* empty css */
|
|
10
|
+
import "vue-draggable-plus";
|
|
11
|
+
/* empty css */
|
|
12
|
+
import "v-tooltip-lite";
|
|
13
|
+
import "v-tooltip-lite/style.css";
|
|
14
|
+
/* empty css */
|
|
15
|
+
import "v-datepicker-lite";
|
|
16
|
+
import "v-datepicker-lite/style.css";
|
|
17
|
+
import "@jaames/iro";
|
|
18
|
+
import "@vueuse/core";
|
|
19
|
+
/* empty css */
|
|
20
|
+
import se from "../IconPicker.vue.js";
|
|
21
|
+
/* empty css */
|
|
22
|
+
/* empty css */
|
|
23
|
+
import { getUniqueId as N } from "../../utils/functions.js";
|
|
24
|
+
const ue = { class: "category-manager-container w-full bg-muted/10 rounded-xl border border-border p-4 lg:p-6" }, ce = { class: "flex items-center justify-between mb-6" }, me = {
|
|
25
|
+
key: 0,
|
|
26
|
+
class: "flex flex-col items-center justify-center py-10 px-4 text-center border border-dashed border-border rounded-xl bg-background"
|
|
27
|
+
}, fe = { class: "w-12 h-12 bg-muted rounded-full flex items-center justify-center mb-4" }, pe = { class: "text-base font-medium text-foreground" }, ve = { class: "text-sm text-muted-foreground mt-1 max-w-sm" }, he = {
|
|
28
|
+
key: 1,
|
|
29
|
+
class: "w-full tree-wrapper scrollable-container",
|
|
30
|
+
style: { "will-change": "transform", contain: "layout style" }
|
|
31
|
+
}, ge = {
|
|
32
|
+
key: 0,
|
|
33
|
+
class: "flex items-center gap-1.5 py-1.5 px-2 bg-background border border-border shadow-sm rounded-lg w-full mt-2"
|
|
34
|
+
}, ye = {
|
|
35
|
+
class: "modal-body",
|
|
36
|
+
style: { "will-change": "transform", contain: "layout style" }
|
|
37
|
+
}, je = /* @__PURE__ */ Y({
|
|
38
|
+
__name: "CategoryManager",
|
|
39
|
+
props: {
|
|
40
|
+
modelValue: { default: () => [] },
|
|
41
|
+
formSchema: {},
|
|
42
|
+
readonly: { type: Boolean, default: !1 },
|
|
43
|
+
emptyTitle: { default: "No Categories Found" },
|
|
44
|
+
emptyDescription: { default: "Get started by creating your first category." },
|
|
45
|
+
size: { default: "md" }
|
|
46
|
+
},
|
|
47
|
+
emits: ["update:modelValue", "onAdd", "onEdit", "onDelete", "onReorder"],
|
|
48
|
+
setup(y, { emit: B }) {
|
|
49
|
+
const b = y, s = B, i = c([]), x = c(/* @__PURE__ */ new Set()), w = (t) => JSON.parse(JSON.stringify(t)), A = (t) => {
|
|
50
|
+
t.forEach((e) => {
|
|
51
|
+
e.children || (e.children = []), A(e.children);
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
Z(
|
|
55
|
+
() => b.modelValue,
|
|
56
|
+
(t) => {
|
|
57
|
+
const e = JSON.stringify(t), o = JSON.stringify(i.value);
|
|
58
|
+
if (e !== o) {
|
|
59
|
+
const r = w(t);
|
|
60
|
+
A(r), i.value = r;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{ immediate: !0, deep: !0 }
|
|
64
|
+
);
|
|
65
|
+
const p = (t = !1) => {
|
|
66
|
+
const e = w(i.value);
|
|
67
|
+
s("update:modelValue", e), t && s("onReorder", e);
|
|
68
|
+
}, J = (t) => {
|
|
69
|
+
const e = new Set(x.value);
|
|
70
|
+
e.has(t) ? e.delete(t) : e.add(t), x.value = e;
|
|
71
|
+
}, a = c({
|
|
72
|
+
mode: null,
|
|
73
|
+
targetId: null,
|
|
74
|
+
title: "",
|
|
75
|
+
icon: "lucide:folder"
|
|
76
|
+
}), _ = (t, e) => {
|
|
77
|
+
a.value = {
|
|
78
|
+
mode: t,
|
|
79
|
+
targetId: t === "add-child" && e || null,
|
|
80
|
+
title: "",
|
|
81
|
+
icon: "lucide:folder"
|
|
82
|
+
}, t === "add-child" && e && x.value.add(e);
|
|
83
|
+
}, S = () => {
|
|
84
|
+
a.value = { mode: null, targetId: null, title: "", icon: "lucide:folder" };
|
|
85
|
+
}, T = () => {
|
|
86
|
+
const { mode: t, targetId: e, title: o, icon: r } = a.value;
|
|
87
|
+
if (!o.trim()) return;
|
|
88
|
+
const d = [...i.value];
|
|
89
|
+
if (t === "add-root") {
|
|
90
|
+
const l = { id: N(), title: o, icon: r, children: [] };
|
|
91
|
+
d.push(l), s("onAdd", l);
|
|
92
|
+
} else if (t === "add-child") {
|
|
93
|
+
const l = { id: N(), title: o, icon: r, children: [] }, n = (v) => {
|
|
94
|
+
for (const h of v) {
|
|
95
|
+
if (h.id === e)
|
|
96
|
+
return h.children || (h.children = []), h.children.push(l), !0;
|
|
97
|
+
if (h.children && n(h.children)) return !0;
|
|
98
|
+
}
|
|
99
|
+
return !1;
|
|
100
|
+
};
|
|
101
|
+
n(d), s("onAdd", l);
|
|
102
|
+
}
|
|
103
|
+
i.value = d, p(), S();
|
|
104
|
+
}, C = c(!1), m = c("add"), k = c(null), E = c(null), M = c({}), j = [
|
|
105
|
+
{ name: "icon", label: "Category Icon", type: "iconPicker" },
|
|
106
|
+
{ name: "title", label: "Title", type: "text", required: !0 },
|
|
107
|
+
{ name: "description", label: "Description", type: "textarea", props: { rows: 3 } }
|
|
108
|
+
], q = I(() => b.formSchema || j), K = I(() => m.value === "add" ? "Add Category" : m.value === "add-child" ? "Add Sub-category" : "Edit Category"), P = (t, e, o) => {
|
|
109
|
+
m.value = t, k.value = e || null, E.value = o || null, M.value = e ? w(e) : {}, C.value = !0;
|
|
110
|
+
}, G = async (t) => {
|
|
111
|
+
const e = t?.values || t, o = [...i.value];
|
|
112
|
+
if (m.value === "add") {
|
|
113
|
+
const r = { id: N(), children: [], ...e };
|
|
114
|
+
o.push(r), s("onAdd", r);
|
|
115
|
+
} else if (m.value === "add-child") {
|
|
116
|
+
const r = { id: N(), children: [], ...e }, d = (l) => {
|
|
117
|
+
for (const n of l) {
|
|
118
|
+
if (n.id === E.value)
|
|
119
|
+
return n.children || (n.children = []), n.children.push(r), x.value.add(n.id), !0;
|
|
120
|
+
if (n.children && d(n.children)) return !0;
|
|
121
|
+
}
|
|
122
|
+
return !1;
|
|
123
|
+
};
|
|
124
|
+
d(o), s("onAdd", r);
|
|
125
|
+
} else if (m.value === "edit" && k.value) {
|
|
126
|
+
const r = k.value.id, d = (l) => {
|
|
127
|
+
const n = l.findIndex((v) => v.id === r);
|
|
128
|
+
if (n > -1)
|
|
129
|
+
return l[n] = { ...l[n], ...e }, !0;
|
|
130
|
+
for (const v of l)
|
|
131
|
+
if (v.children && d(v.children)) return !0;
|
|
132
|
+
return !1;
|
|
133
|
+
};
|
|
134
|
+
d(o), s("onEdit", { ...k.value, ...e });
|
|
135
|
+
}
|
|
136
|
+
i.value = o, p(), t && typeof t.setSubmitting == "function" && t.setSubmitting(!1), C.value = !1;
|
|
137
|
+
}, H = (t) => {
|
|
138
|
+
const e = t.id, o = (d) => {
|
|
139
|
+
const l = d.findIndex((n) => n.id === e);
|
|
140
|
+
if (l > -1)
|
|
141
|
+
return d.splice(l, 1), !0;
|
|
142
|
+
for (const n of d)
|
|
143
|
+
if (n.children && o(n.children)) return !0;
|
|
144
|
+
return !1;
|
|
145
|
+
}, r = [...i.value];
|
|
146
|
+
o(r), i.value = r, s("onDelete", t), p();
|
|
147
|
+
}, L = (t) => {
|
|
148
|
+
s("onEdit", w(t)), p();
|
|
149
|
+
}, Q = (t) => {
|
|
150
|
+
i.value = [...t], p(!0);
|
|
151
|
+
}, W = () => {
|
|
152
|
+
p(!0);
|
|
153
|
+
};
|
|
154
|
+
ee("categoryManager", {
|
|
155
|
+
expandedIds: x,
|
|
156
|
+
inlineState: a,
|
|
157
|
+
toggleExpand: J,
|
|
158
|
+
startInline: _,
|
|
159
|
+
saveInline: T,
|
|
160
|
+
cancelInline: S,
|
|
161
|
+
saveItem: L,
|
|
162
|
+
openModalForm: P,
|
|
163
|
+
deleteItem: H,
|
|
164
|
+
readonly: I(() => b.readonly),
|
|
165
|
+
size: I(() => b.size)
|
|
166
|
+
});
|
|
167
|
+
const X = {
|
|
168
|
+
mounted: (t) => {
|
|
169
|
+
setTimeout(() => t.focus(), 10);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
return (t, e) => (g(), V("div", ue, [
|
|
173
|
+
u("div", ce, [
|
|
174
|
+
te(t.$slots, "header", {}, () => [
|
|
175
|
+
e[6] || (e[6] = u("div", null, [
|
|
176
|
+
u("h3", { class: "text-lg font-bold text-foreground" }, "Categories"),
|
|
177
|
+
u("p", { class: "text-sm text-muted-foreground mt-0.5" }, "Manage your hierarchical structure.")
|
|
178
|
+
], -1)),
|
|
179
|
+
y.readonly ? z("", !0) : (g(), R(D, {
|
|
180
|
+
key: 0,
|
|
181
|
+
variant: "primary",
|
|
182
|
+
icon: "lucide:plus",
|
|
183
|
+
size: "sm",
|
|
184
|
+
onClick: e[0] || (e[0] = (o) => _("add-root"))
|
|
185
|
+
}, {
|
|
186
|
+
default: U(() => [...e[5] || (e[5] = [
|
|
187
|
+
$(" Add Category ", -1)
|
|
188
|
+
])]),
|
|
189
|
+
_: 1
|
|
190
|
+
}))
|
|
191
|
+
])
|
|
192
|
+
]),
|
|
193
|
+
i.value.length === 0 && a.value.mode !== "add-root" ? (g(), V("div", me, [
|
|
194
|
+
u("div", fe, [
|
|
195
|
+
f(ae, {
|
|
196
|
+
icon: "lucide:folder-tree",
|
|
197
|
+
class: "w-6 h-6 text-muted-foreground"
|
|
198
|
+
})
|
|
199
|
+
]),
|
|
200
|
+
u("h4", pe, O(y.emptyTitle), 1),
|
|
201
|
+
u("p", ve, O(y.emptyDescription), 1),
|
|
202
|
+
y.readonly ? z("", !0) : (g(), R(D, {
|
|
203
|
+
key: 0,
|
|
204
|
+
variant: "outline",
|
|
205
|
+
size: "sm",
|
|
206
|
+
class: "mt-5",
|
|
207
|
+
icon: "lucide:plus",
|
|
208
|
+
onClick: e[1] || (e[1] = (o) => _("add-root"))
|
|
209
|
+
}, {
|
|
210
|
+
default: U(() => [...e[7] || (e[7] = [
|
|
211
|
+
$(" Create Category ", -1)
|
|
212
|
+
])]),
|
|
213
|
+
_: 1
|
|
214
|
+
}))
|
|
215
|
+
])) : (g(), V("div", he, [
|
|
216
|
+
f(le, {
|
|
217
|
+
modelValue: i.value,
|
|
218
|
+
"onUpdate:modelValue": Q,
|
|
219
|
+
onChange: W
|
|
220
|
+
}, null, 8, ["modelValue"]),
|
|
221
|
+
a.value.mode === "add-root" ? (g(), V("div", ge, [
|
|
222
|
+
f(se, {
|
|
223
|
+
modelValue: a.value.icon,
|
|
224
|
+
"onUpdate:modelValue": e[2] || (e[2] = (o) => a.value.icon = o),
|
|
225
|
+
"btn-props": { variant: "ghost", size: "xs", class: "h-7 w-7 p-0 text-muted-foreground hover:text-foreground shrink-0 rounded-md" },
|
|
226
|
+
position: "bottom-start"
|
|
227
|
+
}, null, 8, ["modelValue"]),
|
|
228
|
+
oe(u("input", {
|
|
229
|
+
"onUpdate:modelValue": e[3] || (e[3] = (o) => a.value.title = o),
|
|
230
|
+
class: "flex-1 bg-transparent border-0 outline-none focus:ring-0 px-1 py-1 text-sm transition-colors w-full shadow-none caret-primary text-foreground placeholder:text-muted-foreground",
|
|
231
|
+
placeholder: "New root category...",
|
|
232
|
+
onKeyup: [
|
|
233
|
+
F(T, ["enter"]),
|
|
234
|
+
F(S, ["esc"])
|
|
235
|
+
]
|
|
236
|
+
}, null, 544), [
|
|
237
|
+
[X],
|
|
238
|
+
[ne, a.value.title]
|
|
239
|
+
]),
|
|
240
|
+
f(D, {
|
|
241
|
+
variant: "primary",
|
|
242
|
+
size: "xs",
|
|
243
|
+
icon: "lucide:check",
|
|
244
|
+
class: "shrink-0 h-7 w-7 px-0",
|
|
245
|
+
title: "Save",
|
|
246
|
+
onClick: T
|
|
247
|
+
}),
|
|
248
|
+
f(D, {
|
|
249
|
+
variant: "ghost",
|
|
250
|
+
size: "xs",
|
|
251
|
+
icon: "lucide:x",
|
|
252
|
+
class: "shrink-0 h-7 w-7 px-0",
|
|
253
|
+
title: "Cancel",
|
|
254
|
+
onClick: S
|
|
255
|
+
})
|
|
256
|
+
])) : z("", !0)
|
|
257
|
+
])),
|
|
258
|
+
f(de, {
|
|
259
|
+
show: C.value,
|
|
260
|
+
"onUpdate:show": e[4] || (e[4] = (o) => C.value = o),
|
|
261
|
+
title: K.value,
|
|
262
|
+
"max-width": "max-w-md"
|
|
263
|
+
}, {
|
|
264
|
+
default: U(() => [
|
|
265
|
+
u("div", ye, [
|
|
266
|
+
f(re(ie), {
|
|
267
|
+
schema: q.value,
|
|
268
|
+
values: M.value,
|
|
269
|
+
isUpdate: m.value === "edit",
|
|
270
|
+
submitText: "Save Details",
|
|
271
|
+
onOnSubmit: G
|
|
272
|
+
}, null, 8, ["schema", "values", "isUpdate"])
|
|
273
|
+
])
|
|
274
|
+
]),
|
|
275
|
+
_: 1
|
|
276
|
+
}, 8, ["show", "title"])
|
|
277
|
+
]));
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
export {
|
|
281
|
+
je as default
|
|
282
|
+
};
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { defineComponent as F, inject as K, computed as p, resolveComponent as R, openBlock as r, createBlock as x, unref as l, withCtx as T, createElementBlock as s, Fragment as A, renderList as L, isMemoSame as O, createElementVNode as f, normalizeClass as u, createVNode as i, createCommentVNode as c, withDirectives as k, withModifiers as P, withKeys as w, vModelText as U, toDisplayString as Q, vShow as q } from "vue";
|
|
2
|
+
import { VueDraggable as G } from "vue-draggable-plus";
|
|
3
|
+
import C from "../Icon.vue.js";
|
|
4
|
+
import g from "../Button.vue.js";
|
|
5
|
+
import N from "../IconPicker.vue.js";
|
|
6
|
+
const H = { class: "flex items-center gap-px overflow-hidden flex-1" }, J = ["onClick"], W = { class: "flex items-center gap-1.5 overflow-hidden flex-1 w-full" }, X = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "drag-handle cursor-grab active:cursor-grabbing text-muted hover:text-foreground transition-colors p-0.5 shrink-0"
|
|
9
|
+
}, Y = ["onUpdate:modelValue", "onChange"], Z = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0 bg-background/80 px-1 rounded ml-2"
|
|
12
|
+
}, ee = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "ml-6 pl-3 border-l border-border mt-1.5 flex flex-col relative"
|
|
15
|
+
}, te = {
|
|
16
|
+
key: 1,
|
|
17
|
+
class: "flex items-center gap-1.5 py-1.5 px-2 bg-background border border-border shadow-sm rounded-lg w-full mb-1.5"
|
|
18
|
+
}, de = /* @__PURE__ */ F({
|
|
19
|
+
__name: "CategoryNode",
|
|
20
|
+
props: {
|
|
21
|
+
modelValue: {},
|
|
22
|
+
level: { default: 0 }
|
|
23
|
+
},
|
|
24
|
+
emits: ["update:modelValue", "change"],
|
|
25
|
+
setup(V, { emit: D }) {
|
|
26
|
+
const S = V, y = D, t = K("categoryManager"), b = p({
|
|
27
|
+
get: () => S.modelValue,
|
|
28
|
+
set: (d) => y("update:modelValue", d)
|
|
29
|
+
}), M = (d, n) => {
|
|
30
|
+
n.children = d, y("change");
|
|
31
|
+
}, I = () => y("change"), v = p(() => t?.readonly.value || !1), a = p(() => t?.size.value || "md"), j = p(() => a.value === "sm" ? "p-1 md:p-1.5" : a.value === "lg" ? "p-2 md:p-2.5" : "py-1.5 px-2"), $ = p(() => {
|
|
32
|
+
const n = S.level === 0 ? "font-semibold" : "font-medium";
|
|
33
|
+
return a.value === "sm" ? `text-xs ${n} text-foreground` : a.value === "lg" ? `-text-fs-1 ${n} text-foreground` : `text-sm ${n} text-foreground`;
|
|
34
|
+
}), m = p(() => a.value === "sm" ? "w-3.5 h-3.5" : a.value === "lg" ? "w-4.5 h-4.5" : "w-4 h-4"), B = {
|
|
35
|
+
mounted: (d) => {
|
|
36
|
+
setTimeout(() => d.focus(), 10);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
return (d, n) => {
|
|
40
|
+
const E = R("CategoryNode", !0);
|
|
41
|
+
return r(), x(l(G), {
|
|
42
|
+
modelValue: b.value,
|
|
43
|
+
"onUpdate:modelValue": n[10] || (n[10] = (e) => b.value = e),
|
|
44
|
+
group: "category-manager",
|
|
45
|
+
animation: 150,
|
|
46
|
+
handle: ".drag-handle",
|
|
47
|
+
"ghost-class": "opacity-50",
|
|
48
|
+
disabled: v.value,
|
|
49
|
+
class: "min-h-[2px]",
|
|
50
|
+
onChange: I
|
|
51
|
+
}, {
|
|
52
|
+
default: T(() => [
|
|
53
|
+
(r(!0), s(A, null, L(b.value, (e, ne, le, h) => {
|
|
54
|
+
const _ = [
|
|
55
|
+
e.id,
|
|
56
|
+
e.title,
|
|
57
|
+
e.icon,
|
|
58
|
+
e.children?.length,
|
|
59
|
+
l(t)?.expandedIds.value.has(e.id),
|
|
60
|
+
l(t)?.inlineState.value.targetId === e.id,
|
|
61
|
+
l(t)?.inlineState.value.mode,
|
|
62
|
+
v.value,
|
|
63
|
+
a.value
|
|
64
|
+
];
|
|
65
|
+
if (h && h.key === e.id && O(h, _)) return h;
|
|
66
|
+
const z = (r(), s("div", {
|
|
67
|
+
key: e.id,
|
|
68
|
+
class: "mb-1.5 flex flex-col"
|
|
69
|
+
}, [
|
|
70
|
+
f("div", {
|
|
71
|
+
class: u([
|
|
72
|
+
"group flex items-center justify-between rounded-lg transition-colors bg-body! border border-border ",
|
|
73
|
+
j.value
|
|
74
|
+
])
|
|
75
|
+
}, [
|
|
76
|
+
f("div", H, [
|
|
77
|
+
e.children && e.children.length > 0 ? (r(), s("button", {
|
|
78
|
+
key: 0,
|
|
79
|
+
onClick: (o) => l(t)?.toggleExpand(e.id),
|
|
80
|
+
class: u([
|
|
81
|
+
"flex items-center justify-center shrink-0 text-muted-foreground hover:bg-muted rounded transition-colors",
|
|
82
|
+
a.value === "sm" ? "w-4 h-4" : a.value === "lg" ? "w-6 h-6" : "w-6.5 h-6.5"
|
|
83
|
+
])
|
|
84
|
+
}, [
|
|
85
|
+
i(C, {
|
|
86
|
+
icon: l(t)?.expandedIds.value.has(e.id) ? "lucide:chevron-down" : "lucide:chevron-right",
|
|
87
|
+
class: u(m.value)
|
|
88
|
+
}, null, 8, ["icon", "class"])
|
|
89
|
+
], 10, J)) : c("", !0),
|
|
90
|
+
f("div", W, [
|
|
91
|
+
v.value ? c("", !0) : (r(), s("div", X, [
|
|
92
|
+
i(C, {
|
|
93
|
+
icon: "lucide:grip-vertical",
|
|
94
|
+
class: u(m.value)
|
|
95
|
+
}, null, 8, ["class"])
|
|
96
|
+
])),
|
|
97
|
+
v.value ? e.icon ? (r(), x(C, {
|
|
98
|
+
key: 2,
|
|
99
|
+
icon: e.icon,
|
|
100
|
+
class: u([m.value, "shrink-0 text-muted-foreground"])
|
|
101
|
+
}, null, 8, ["icon", "class"])) : c("", !0) : (r(), x(N, {
|
|
102
|
+
key: 1,
|
|
103
|
+
value: e.icon,
|
|
104
|
+
"btn-props": {
|
|
105
|
+
variant: "ghost",
|
|
106
|
+
size: "xs",
|
|
107
|
+
iconClass: m.value,
|
|
108
|
+
class: (a.value === "sm" ? "h-5 w-5" : a.value === "lg" ? "h-7 w-7" : "h-6 w-6") + " -ml-0.5! p-0 text-muted-foreground hover:text-foreground shrink-0 rounded-md"
|
|
109
|
+
},
|
|
110
|
+
position: "bottom-start",
|
|
111
|
+
onOnSelect: (o) => {
|
|
112
|
+
console.log("IconPicker value :>> ", o), e.icon = o, l(t)?.saveItem(e);
|
|
113
|
+
}
|
|
114
|
+
}, null, 8, ["value", "btn-props", "onOnSelect"])),
|
|
115
|
+
v.value ? (r(), s("span", {
|
|
116
|
+
key: 4,
|
|
117
|
+
class: u(["truncate", $.value])
|
|
118
|
+
}, Q(e.title), 3)) : k((r(), s("input", {
|
|
119
|
+
key: 3,
|
|
120
|
+
"onUpdate:modelValue": (o) => e.title = o,
|
|
121
|
+
class: u([
|
|
122
|
+
"bg-transparent border-0 outline-none focus:ring-0 px-1 py-0.5 -ml-1 transition-colors w-full truncate cursor-text min-w-0 shadow-none caret-primary",
|
|
123
|
+
$.value
|
|
124
|
+
]),
|
|
125
|
+
placeholder: "Category title...",
|
|
126
|
+
onChange: (o) => l(t)?.saveItem(e),
|
|
127
|
+
onKeyup: n[0] || (n[0] = w((o) => o.target.blur(), ["enter"])),
|
|
128
|
+
onClick: n[1] || (n[1] = P(() => {
|
|
129
|
+
}, ["stop"]))
|
|
130
|
+
}, null, 42, Y)), [
|
|
131
|
+
[U, e.title]
|
|
132
|
+
])
|
|
133
|
+
])
|
|
134
|
+
]),
|
|
135
|
+
v.value ? c("", !0) : (r(), s("div", Z, [
|
|
136
|
+
i(g, {
|
|
137
|
+
variant: "ghost",
|
|
138
|
+
size: "xs",
|
|
139
|
+
icon: "lucide:plus",
|
|
140
|
+
title: "Quick Add Subcategory",
|
|
141
|
+
class: "h-7 w-7 px-0 text-muted-foreground hover:text-primary",
|
|
142
|
+
onClick: (o) => l(t)?.startInline("add-child", e.id)
|
|
143
|
+
}, null, 8, ["onClick"]),
|
|
144
|
+
i(g, {
|
|
145
|
+
variant: "ghost",
|
|
146
|
+
size: "xs",
|
|
147
|
+
icon: "lucide:settings",
|
|
148
|
+
title: "Advanced Details",
|
|
149
|
+
class: "h-7 w-7 px-0 text-muted-foreground hover:text-primary",
|
|
150
|
+
onClick: (o) => l(t)?.openModalForm("edit", e)
|
|
151
|
+
}, null, 8, ["onClick"]),
|
|
152
|
+
i(g, {
|
|
153
|
+
variant: "ghost",
|
|
154
|
+
size: "xs",
|
|
155
|
+
icon: "lucide:trash-2",
|
|
156
|
+
title: "Delete",
|
|
157
|
+
class: "h-7 w-7 px-0 text-muted-foreground hover:text-destructive hover:bg-destructive/10",
|
|
158
|
+
onClick: (o) => l(t)?.deleteItem(e)
|
|
159
|
+
}, null, 8, ["onClick"])
|
|
160
|
+
]))
|
|
161
|
+
], 2),
|
|
162
|
+
e.children && e.children.length > 0 || l(t)?.inlineState.value.mode === "add-child" && l(t).inlineState.value.targetId === e.id ? k((r(), s("div", ee, [
|
|
163
|
+
e.children && e.children.length > 0 ? (r(), x(E, {
|
|
164
|
+
key: 0,
|
|
165
|
+
modelValue: e.children,
|
|
166
|
+
"onUpdate:modelValue": (o) => M(o, e),
|
|
167
|
+
level: V.level + 1,
|
|
168
|
+
onChange: I
|
|
169
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "level"])) : c("", !0),
|
|
170
|
+
l(t)?.inlineState.value.mode === "add-child" && l(t).inlineState.value.targetId === e.id ? (r(), s("div", te, [
|
|
171
|
+
i(N, {
|
|
172
|
+
modelValue: l(t).inlineState.value.icon,
|
|
173
|
+
"onUpdate:modelValue": n[2] || (n[2] = (o) => l(t).inlineState.value.icon = o),
|
|
174
|
+
"btn-props": {
|
|
175
|
+
variant: "ghost",
|
|
176
|
+
size: "xs",
|
|
177
|
+
class: "h-6 w-6 p-0 text-muted-foreground hover:text-foreground shrink-0 rounded-md"
|
|
178
|
+
},
|
|
179
|
+
position: "bottom-start"
|
|
180
|
+
}, null, 8, ["modelValue"]),
|
|
181
|
+
k(f("input", {
|
|
182
|
+
"onUpdate:modelValue": n[3] || (n[3] = (o) => l(t).inlineState.value.title = o),
|
|
183
|
+
class: "flex-1 bg-transparent border-0 outline-none focus:ring-0 px-1 py-0.5 text-sm transition-colors w-full shadow-none caret-primary text-foreground placeholder:text-muted-foreground",
|
|
184
|
+
placeholder: "New subcategory title...",
|
|
185
|
+
onKeyup: [
|
|
186
|
+
n[4] || (n[4] = w((o) => l(t).saveInline(), ["enter"])),
|
|
187
|
+
n[5] || (n[5] = w((o) => l(t).cancelInline(), ["esc"]))
|
|
188
|
+
]
|
|
189
|
+
}, null, 544), [
|
|
190
|
+
[B],
|
|
191
|
+
[U, l(t).inlineState.value.title]
|
|
192
|
+
]),
|
|
193
|
+
i(g, {
|
|
194
|
+
variant: "primary",
|
|
195
|
+
size: "xs",
|
|
196
|
+
icon: "lucide:check",
|
|
197
|
+
class: "shrink-0 h-6 w-6 px-0",
|
|
198
|
+
title: "Save",
|
|
199
|
+
onClick: n[6] || (n[6] = (o) => l(t).saveInline())
|
|
200
|
+
}),
|
|
201
|
+
i(g, {
|
|
202
|
+
variant: "ghost",
|
|
203
|
+
size: "xs",
|
|
204
|
+
icon: "lucide:x",
|
|
205
|
+
class: "shrink-0 h-6 w-6 px-0",
|
|
206
|
+
title: "Cancel",
|
|
207
|
+
onClick: n[7] || (n[7] = (o) => l(t).cancelInline())
|
|
208
|
+
})
|
|
209
|
+
])) : c("", !0)
|
|
210
|
+
], 512)), [
|
|
211
|
+
[q, l(t)?.expandedIds.value.has(e.id)]
|
|
212
|
+
]) : c("", !0)
|
|
213
|
+
]));
|
|
214
|
+
return z.memo = _, z;
|
|
215
|
+
}, n, 8), 128))
|
|
216
|
+
]),
|
|
217
|
+
_: 1
|
|
218
|
+
}, 8, ["modelValue", "disabled"]);
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
export {
|
|
223
|
+
de as default
|
|
224
|
+
};
|