vlite3 1.0.10 → 1.1.2
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/AttachmentsList/AttachmentsList.vue.d.ts +1 -16
- package/components/AttachmentsList/AttachmentsList.vue.js +191 -167
- 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/AvatarUploader/AvatarUploader.vue.d.ts +1 -1
- package/components/Barcode/Barcode.vue.js +6 -5
- package/components/Button.vue.d.ts +1 -1
- 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/Carousel/Carousel.vue.d.ts +2 -2
- package/components/CategoryManager/CategoryManager.vue.d.ts +2 -1
- package/components/CategoryManager/CategoryManager.vue.js +322 -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/CategoryManager/types.d.ts +14 -0
- package/components/Chip/Chip.vue.d.ts +2 -2
- package/components/ColorPicker/ColorIro.vue3.js +2 -2
- package/components/ColorPicker/ColorPicker.vue.js +2 -2
- package/components/CommandPalette/CommandPaletteContent.vue.js +1 -1
- package/components/CommandPalette/CommandPaletteContent.vue2.js +7 -7
- package/components/CommandPalette/{CommandPaletteItem.vue2.js → CommandPaletteItem.vue.js} +1 -1
- package/components/ConfirmationModal.vue.d.ts +2 -2
- 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/DataTable/DataTable.vue.d.ts +3 -3
- package/components/DateTime/DateTime.vue.d.ts +2 -0
- package/components/DateTime/DateTime.vue.js +9 -23
- package/components/Dropdown/Dropdown.vue.d.ts +3 -3
- package/components/Dropdown/DropdownGroupedLayout.vue.d.ts +1 -1
- package/components/Dropdown/DropdownMenu.vue.d.ts +2 -2
- package/components/Dropdown/DropdownTrigger.vue.d.ts +1 -1
- package/components/FilePicker/FilePicker.vue.d.ts +1 -1
- package/components/Form/CustomFields.vue.d.ts +1 -1
- package/components/Form/Form.vue.js +2 -2
- package/components/Form/Form.vue2.js +230 -241
- package/components/Form/FormField.vue.d.ts +1 -1
- package/components/Form/composables/useForm.d.ts +2 -0
- package/components/Form/composables/useForm.js +76 -69
- package/components/Form/utils/form.utils.js +66 -66
- 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/Input.vue.d.ts +3 -3
- package/components/Invoice/Invoice.vue.d.ts +3 -0
- package/components/Invoice/Invoice.vue.js +38 -0
- package/components/Invoice/Invoice.vue2.js +4 -0
- package/components/Invoice/InvoiceVariant1.vue.d.ts +13 -0
- package/components/Invoice/InvoiceVariant1.vue.js +360 -0
- package/components/Invoice/InvoiceVariant1.vue2.js +4 -0
- package/components/Invoice/InvoiceVariant2.vue.d.ts +13 -0
- package/components/Invoice/InvoiceVariant2.vue.js +226 -0
- package/components/Invoice/InvoiceVariant2.vue2.js +4 -0
- package/components/Invoice/InvoiceVariant3.vue.d.ts +13 -0
- package/components/Invoice/InvoiceVariant3.vue.js +292 -0
- package/components/Invoice/InvoiceVariant3.vue2.js +4 -0
- package/components/Invoice/InvoiceVariant4.vue.d.ts +13 -0
- package/components/Invoice/InvoiceVariant4.vue.js +343 -0
- package/components/Invoice/InvoiceVariant4.vue2.js +4 -0
- package/components/Invoice/index.d.ts +2 -0
- package/components/Invoice/types.d.ts +97 -0
- package/components/List/List.vue.d.ts +1 -9
- package/components/List/List.vue.js +166 -165
- package/components/List/ListFieldRow.vue.d.ts +10 -2
- package/components/List/ListFieldRow.vue.js +80 -78
- package/components/List/utils.d.ts +2 -1
- package/components/List/utils.js +8 -39
- package/components/MultiSelect/MultiSelect.vue.d.ts +1 -1
- package/components/Navbar/NavbarItem.vue.d.ts +1 -1
- package/components/Navbar/NavbarTabs.vue.js +2 -2
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/NumberInput.vue.d.ts +2 -2
- package/components/NumberInput.vue.js +2 -2
- package/components/NumberInput.vue2.js +38 -38
- package/components/OTPInput/OTPInput.vue.d.ts +1 -1
- package/components/PricingPlan/PricingPlan.vue.d.ts +1 -1
- package/components/Screen/ScreenFilter.vue.js +22 -21
- package/components/Screen/components/ScreenQuickFilters.vue.js +6 -5
- package/components/SidebarMenu/SidebarMenu.vue.d.ts +1 -1
- package/components/Stats/Stats.vue.d.ts +1 -1
- package/components/StatusChip/status-map.js +27 -7
- 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 +2 -2
- package/components/ThumbnailSelector/ThumbnailSelector.vue.js +2 -2
- package/components/ThumbnailSelector/ThumbnailSelector.vue2.js +141 -115
- package/components/Workbook/Workbook.vue.d.ts +3 -3
- package/core/config.d.ts +76 -0
- package/core/index.js +17 -5
- package/index.d.ts +6 -1
- package/index.js +271 -256
- package/package.json +2 -1
- package/style.css +5 -3
- package/types/config.type.d.ts +6 -0
- package/types/list.type.d.ts +6 -0
- package/utils/configUtils.d.ts +9 -0
- package/utils/configUtils.js +7 -0
- package/utils/index.d.ts +1 -0
- package/utils/status.d.ts +5 -0
- package/utils/status.js +33 -0
- /package/components/ColorPicker/{ColorIro.vue.js → ColorIro.vue2.js} +0 -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
|
+
};
|
|
@@ -352,7 +352,7 @@ declare function __VLS_template(): {
|
|
|
352
352
|
};
|
|
353
353
|
}>> & Readonly<{
|
|
354
354
|
"onSlide-change"?: ((index: number) => any) | undefined;
|
|
355
|
-
}>, "
|
|
355
|
+
}>, "state" | "focus" | "direction" | "draggable" | "easing" | "goNext" | "gap" | "pagination" | "paginationSize" | "paginationVisibility" | "paginationHoverInitialTimeout" | "paginationHoverEdgeThreshold" | "autoPlay" | "autoPlayInterval" | "itemsToShow" | "speed" | "mousewheel" | "loop" | "currentItem" | "bufferSize" | "maxDomElements" | "goToSlide" | "goPrev" | "autoFocus" | "wheelOptions" | "canGoNext" | "canGoPrev"> & import('vue').ShallowUnwrapRef<{
|
|
356
356
|
goToSlide: (index: number, smooth?: boolean) => void;
|
|
357
357
|
goNext: (smooth?: boolean) => void;
|
|
358
358
|
goPrev: (smooth?: boolean) => void;
|
|
@@ -778,7 +778,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
778
778
|
};
|
|
779
779
|
}>> & Readonly<{
|
|
780
780
|
"onSlide-change"?: ((index: number) => any) | undefined;
|
|
781
|
-
}>, "
|
|
781
|
+
}>, "state" | "focus" | "direction" | "draggable" | "easing" | "goNext" | "gap" | "pagination" | "paginationSize" | "paginationVisibility" | "paginationHoverInitialTimeout" | "paginationHoverEdgeThreshold" | "autoPlay" | "autoPlayInterval" | "itemsToShow" | "speed" | "mousewheel" | "loop" | "currentItem" | "bufferSize" | "maxDomElements" | "goToSlide" | "goPrev" | "autoFocus" | "wheelOptions" | "canGoNext" | "canGoPrev"> & import('vue').ShallowUnwrapRef<{
|
|
782
782
|
goToSlide: (index: number, smooth?: boolean) => void;
|
|
783
783
|
goNext: (smooth?: boolean) => void;
|
|
784
784
|
goPrev: (smooth?: boolean) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CategoryItem, CategoryManagerProps } from './types';
|
|
1
|
+
import { CategoryItem, RawCategoryItem, CategoryManagerProps } from './types';
|
|
2
2
|
declare function __VLS_template(): {
|
|
3
3
|
attrs: Partial<{}>;
|
|
4
4
|
slots: {
|
|
@@ -24,6 +24,7 @@ declare const __VLS_component: import('vue').DefineComponent<CategoryManagerProp
|
|
|
24
24
|
size: "sm" | "md" | "lg";
|
|
25
25
|
readonly: boolean;
|
|
26
26
|
modelValue: CategoryItem[];
|
|
27
|
+
rawData: RawCategoryItem[];
|
|
27
28
|
emptyTitle: string;
|
|
28
29
|
emptyDescription: string;
|
|
29
30
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { defineComponent as te, ref as p, watch as R, computed as D, provide as oe, openBlock as x, createElementBlock as V, createElementVNode as m, renderSlot as ne, createBlock as $, withCtx as _, createTextVNode as F, createCommentVNode as A, createVNode as g, toDisplayString as J, withDirectives as re, withKeys as B, vModelText as le, unref as ie } from "vue";
|
|
2
|
+
import de from "./CategoryNode.vue.js";
|
|
3
|
+
import ae from "../Modal.vue.js";
|
|
4
|
+
import se from "../Form/Form.vue.js";
|
|
5
|
+
import ue from "../Icon.vue.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import E 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 ce from "../IconPicker.vue.js";
|
|
21
|
+
/* empty css */
|
|
22
|
+
/* empty css */
|
|
23
|
+
import { getUniqueId as N } from "../../utils/functions.js";
|
|
24
|
+
const me = { class: "category-manager-container w-full bg-muted/10 rounded-xl border border-border p-4 lg:p-6" }, fe = { class: "flex items-center justify-between mb-6" }, pe = {
|
|
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
|
+
}, ve = { class: "w-12 h-12 bg-muted rounded-full flex items-center justify-center mb-4" }, he = { class: "text-base font-medium text-foreground" }, ge = { class: "text-sm text-muted-foreground mt-1 max-w-sm" }, ye = {
|
|
28
|
+
key: 1,
|
|
29
|
+
class: "w-full tree-wrapper scrollable-container",
|
|
30
|
+
style: { "will-change": "transform", contain: "layout style" }
|
|
31
|
+
}, xe = {
|
|
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
|
+
}, be = {
|
|
35
|
+
class: "modal-body",
|
|
36
|
+
style: { "will-change": "transform", contain: "layout style" }
|
|
37
|
+
}, Ke = /* @__PURE__ */ te({
|
|
38
|
+
__name: "CategoryManager",
|
|
39
|
+
props: {
|
|
40
|
+
modelValue: { default: () => [] },
|
|
41
|
+
rawData: { default: void 0 },
|
|
42
|
+
formSchema: {},
|
|
43
|
+
readonly: { type: Boolean, default: !1 },
|
|
44
|
+
emptyTitle: { default: "No Categories Found" },
|
|
45
|
+
emptyDescription: { default: "Get started by creating your first category." },
|
|
46
|
+
size: { default: "md" }
|
|
47
|
+
},
|
|
48
|
+
emits: ["update:modelValue", "onAdd", "onEdit", "onDelete", "onReorder"],
|
|
49
|
+
setup(b, { emit: j }) {
|
|
50
|
+
const w = b, f = j, d = p([]), S = p(/* @__PURE__ */ new Set()), u = (t) => JSON.parse(JSON.stringify(t)), v = (t, e = null) => {
|
|
51
|
+
t.forEach((o, l) => {
|
|
52
|
+
o.parentId = e, o.position = l, o.children || (o.children = []), v(o.children, o.id);
|
|
53
|
+
});
|
|
54
|
+
}, q = (t) => {
|
|
55
|
+
const e = /* @__PURE__ */ new Map(), o = [];
|
|
56
|
+
t.forEach((n) => {
|
|
57
|
+
e.set(n.id, {
|
|
58
|
+
...n,
|
|
59
|
+
id: n.id,
|
|
60
|
+
title: n.name || n.title || "Untitled",
|
|
61
|
+
icon: n.icon,
|
|
62
|
+
parentId: n.parentId || null,
|
|
63
|
+
position: n.position ?? 0,
|
|
64
|
+
children: []
|
|
65
|
+
});
|
|
66
|
+
}), t.forEach((n) => {
|
|
67
|
+
const r = e.get(n.id);
|
|
68
|
+
r && (n.parentId && e.has(n.parentId) ? e.get(n.parentId).children.push(r) : o.push(r));
|
|
69
|
+
});
|
|
70
|
+
const l = (n) => {
|
|
71
|
+
n.sort((r, a) => (r.position ?? 0) - (a.position ?? 0)), n.forEach((r) => {
|
|
72
|
+
r.children && l(r.children);
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
return l(o), o;
|
|
76
|
+
};
|
|
77
|
+
R(
|
|
78
|
+
() => w.rawData,
|
|
79
|
+
(t) => {
|
|
80
|
+
if (t && t.length > 0) {
|
|
81
|
+
const e = q(t);
|
|
82
|
+
v(e);
|
|
83
|
+
const o = JSON.stringify(e), l = JSON.stringify(d.value);
|
|
84
|
+
if (o !== l) {
|
|
85
|
+
const n = u(e);
|
|
86
|
+
d.value = n, f("update:modelValue", n);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{ immediate: !0, deep: !0 }
|
|
91
|
+
), R(
|
|
92
|
+
() => w.modelValue,
|
|
93
|
+
(t) => {
|
|
94
|
+
const e = JSON.stringify(t), o = JSON.stringify(d.value);
|
|
95
|
+
if (e !== o && t.length > 0) {
|
|
96
|
+
const l = u(t);
|
|
97
|
+
v(l), d.value = l;
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{ immediate: !0, deep: !0 }
|
|
101
|
+
);
|
|
102
|
+
const y = (t = !1) => {
|
|
103
|
+
v(d.value);
|
|
104
|
+
const e = u(d.value);
|
|
105
|
+
f("update:modelValue", e), t && f("onReorder", e);
|
|
106
|
+
}, K = (t) => {
|
|
107
|
+
const e = new Set(S.value);
|
|
108
|
+
e.has(t) ? e.delete(t) : e.add(t), S.value = e;
|
|
109
|
+
}, s = p({
|
|
110
|
+
mode: null,
|
|
111
|
+
targetId: null,
|
|
112
|
+
title: "",
|
|
113
|
+
icon: "lucide:folder"
|
|
114
|
+
}), M = (t, e) => {
|
|
115
|
+
s.value = {
|
|
116
|
+
mode: t,
|
|
117
|
+
targetId: t === "add-child" && e || null,
|
|
118
|
+
title: "",
|
|
119
|
+
icon: "lucide:folder"
|
|
120
|
+
}, t === "add-child" && e && S.value.add(e);
|
|
121
|
+
}, I = () => {
|
|
122
|
+
s.value = { mode: null, targetId: null, title: "", icon: "lucide:folder" };
|
|
123
|
+
}, T = () => {
|
|
124
|
+
const { mode: t, targetId: e, title: o, icon: l } = s.value;
|
|
125
|
+
if (!o.trim()) return;
|
|
126
|
+
const n = [...d.value];
|
|
127
|
+
let r = null;
|
|
128
|
+
if (t === "add-root")
|
|
129
|
+
r = { id: N(), title: o, icon: l, children: [] }, n.push(r);
|
|
130
|
+
else if (t === "add-child") {
|
|
131
|
+
r = { id: N(), title: o, icon: l, children: [] };
|
|
132
|
+
const a = (c) => {
|
|
133
|
+
for (const i of c) {
|
|
134
|
+
if (i.id === e)
|
|
135
|
+
return i.children || (i.children = []), i.children.push(r), !0;
|
|
136
|
+
if (i.children && a(i.children)) return !0;
|
|
137
|
+
}
|
|
138
|
+
return !1;
|
|
139
|
+
};
|
|
140
|
+
a(n);
|
|
141
|
+
}
|
|
142
|
+
r && (v(n), f("onAdd", u(r))), d.value = n, y(), I();
|
|
143
|
+
}, k = p(!1), h = p("add"), U = p(null), z = p(null), O = p({}), P = [
|
|
144
|
+
{ name: "icon", label: "Category Icon", type: "iconPicker" },
|
|
145
|
+
{ name: "title", label: "Title", type: "text", required: !0 },
|
|
146
|
+
{ name: "description", label: "Description", type: "textarea", props: { rows: 3 } }
|
|
147
|
+
], G = D(() => w.formSchema || P), H = D(() => h.value === "add" ? "Add Category" : h.value === "add-child" ? "Add Sub-category" : "Edit Category"), L = (t, e, o) => {
|
|
148
|
+
h.value = t, U.value = e || null, z.value = o || null, O.value = e ? u(e) : {}, k.value = !0;
|
|
149
|
+
}, Q = async (t) => {
|
|
150
|
+
const e = t?.values || t, o = [...d.value];
|
|
151
|
+
let l = null, n = null;
|
|
152
|
+
if (h.value === "add") {
|
|
153
|
+
const r = { id: N(), children: [], ...e };
|
|
154
|
+
o.push(r), l = r, n = "onAdd";
|
|
155
|
+
} else if (h.value === "add-child") {
|
|
156
|
+
const r = { id: N(), children: [], ...e }, a = (c) => {
|
|
157
|
+
for (const i of c) {
|
|
158
|
+
if (i.id === z.value)
|
|
159
|
+
return i.children || (i.children = []), i.children.push(r), S.value.add(i.id), !0;
|
|
160
|
+
if (i.children && a(i.children)) return !0;
|
|
161
|
+
}
|
|
162
|
+
return !1;
|
|
163
|
+
};
|
|
164
|
+
a(o), l = r, n = "onAdd";
|
|
165
|
+
} else if (h.value === "edit" && U.value) {
|
|
166
|
+
const r = U.value.id, a = (c) => {
|
|
167
|
+
const i = c.findIndex((C) => C.id === r);
|
|
168
|
+
if (i > -1)
|
|
169
|
+
return c[i] = { ...c[i], ...e }, l = c[i], !0;
|
|
170
|
+
for (const C of c)
|
|
171
|
+
if (C.children && a(C.children)) return !0;
|
|
172
|
+
return !1;
|
|
173
|
+
};
|
|
174
|
+
a(o), n = "onEdit";
|
|
175
|
+
}
|
|
176
|
+
v(o), l && (n === "onAdd" ? f("onAdd", u(l)) : n === "onEdit" && f("onEdit", u(l))), d.value = o, y(), t && typeof t.setSubmitting == "function" && t.setSubmitting(!1), k.value = !1;
|
|
177
|
+
}, W = (t) => {
|
|
178
|
+
const e = t.id, o = (n) => {
|
|
179
|
+
const r = n.findIndex((a) => a.id === e);
|
|
180
|
+
if (r > -1)
|
|
181
|
+
return n.splice(r, 1), !0;
|
|
182
|
+
for (const a of n)
|
|
183
|
+
if (a.children && o(a.children)) return !0;
|
|
184
|
+
return !1;
|
|
185
|
+
}, l = [...d.value];
|
|
186
|
+
o(l), v(l), d.value = l, f("onDelete", u(t)), y();
|
|
187
|
+
}, X = (t) => {
|
|
188
|
+
f("onEdit", u(t)), y();
|
|
189
|
+
}, Y = (t) => {
|
|
190
|
+
d.value = [...t], y(!0);
|
|
191
|
+
}, Z = () => {
|
|
192
|
+
y(!0);
|
|
193
|
+
};
|
|
194
|
+
oe("categoryManager", {
|
|
195
|
+
expandedIds: S,
|
|
196
|
+
inlineState: s,
|
|
197
|
+
toggleExpand: K,
|
|
198
|
+
startInline: M,
|
|
199
|
+
saveInline: T,
|
|
200
|
+
cancelInline: I,
|
|
201
|
+
saveItem: X,
|
|
202
|
+
openModalForm: L,
|
|
203
|
+
deleteItem: W,
|
|
204
|
+
readonly: D(() => w.readonly),
|
|
205
|
+
size: D(() => w.size)
|
|
206
|
+
});
|
|
207
|
+
const ee = {
|
|
208
|
+
mounted: (t) => {
|
|
209
|
+
setTimeout(() => t.focus(), 10);
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
return (t, e) => (x(), V("div", me, [
|
|
213
|
+
m("div", fe, [
|
|
214
|
+
ne(t.$slots, "header", {}, () => [
|
|
215
|
+
e[6] || (e[6] = m("div", null, [
|
|
216
|
+
m("h3", { class: "text-lg font-bold text-foreground" }, "Categories"),
|
|
217
|
+
m("p", { class: "text-sm text-muted-foreground mt-0.5" }, "Manage your hierarchical structure.")
|
|
218
|
+
], -1)),
|
|
219
|
+
b.readonly ? A("", !0) : (x(), $(E, {
|
|
220
|
+
key: 0,
|
|
221
|
+
variant: "primary",
|
|
222
|
+
icon: "lucide:plus",
|
|
223
|
+
size: "sm",
|
|
224
|
+
onClick: e[0] || (e[0] = (o) => M("add-root"))
|
|
225
|
+
}, {
|
|
226
|
+
default: _(() => [...e[5] || (e[5] = [
|
|
227
|
+
F(" Add Category ", -1)
|
|
228
|
+
])]),
|
|
229
|
+
_: 1
|
|
230
|
+
}))
|
|
231
|
+
])
|
|
232
|
+
]),
|
|
233
|
+
d.value.length === 0 && s.value.mode !== "add-root" ? (x(), V("div", pe, [
|
|
234
|
+
m("div", ve, [
|
|
235
|
+
g(ue, {
|
|
236
|
+
icon: "lucide:folder-tree",
|
|
237
|
+
class: "w-6 h-6 text-muted-foreground"
|
|
238
|
+
})
|
|
239
|
+
]),
|
|
240
|
+
m("h4", he, J(b.emptyTitle), 1),
|
|
241
|
+
m("p", ge, J(b.emptyDescription), 1),
|
|
242
|
+
b.readonly ? A("", !0) : (x(), $(E, {
|
|
243
|
+
key: 0,
|
|
244
|
+
variant: "outline",
|
|
245
|
+
size: "sm",
|
|
246
|
+
class: "mt-5",
|
|
247
|
+
icon: "lucide:plus",
|
|
248
|
+
onClick: e[1] || (e[1] = (o) => M("add-root"))
|
|
249
|
+
}, {
|
|
250
|
+
default: _(() => [...e[7] || (e[7] = [
|
|
251
|
+
F(" Create Category ", -1)
|
|
252
|
+
])]),
|
|
253
|
+
_: 1
|
|
254
|
+
}))
|
|
255
|
+
])) : (x(), V("div", ye, [
|
|
256
|
+
g(de, {
|
|
257
|
+
modelValue: d.value,
|
|
258
|
+
"onUpdate:modelValue": Y,
|
|
259
|
+
onChange: Z
|
|
260
|
+
}, null, 8, ["modelValue"]),
|
|
261
|
+
s.value.mode === "add-root" ? (x(), V("div", xe, [
|
|
262
|
+
g(ce, {
|
|
263
|
+
modelValue: s.value.icon,
|
|
264
|
+
"onUpdate:modelValue": e[2] || (e[2] = (o) => s.value.icon = o),
|
|
265
|
+
"btn-props": { variant: "ghost", size: "xs", class: "h-7 w-7 p-0 text-muted-foreground hover:text-foreground shrink-0 rounded-md" },
|
|
266
|
+
position: "bottom-start"
|
|
267
|
+
}, null, 8, ["modelValue"]),
|
|
268
|
+
re(m("input", {
|
|
269
|
+
"onUpdate:modelValue": e[3] || (e[3] = (o) => s.value.title = o),
|
|
270
|
+
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",
|
|
271
|
+
placeholder: "New root category...",
|
|
272
|
+
onKeyup: [
|
|
273
|
+
B(T, ["enter"]),
|
|
274
|
+
B(I, ["esc"])
|
|
275
|
+
]
|
|
276
|
+
}, null, 544), [
|
|
277
|
+
[ee],
|
|
278
|
+
[le, s.value.title]
|
|
279
|
+
]),
|
|
280
|
+
g(E, {
|
|
281
|
+
variant: "primary",
|
|
282
|
+
size: "xs",
|
|
283
|
+
icon: "lucide:check",
|
|
284
|
+
class: "shrink-0 h-7 w-7 px-0",
|
|
285
|
+
title: "Save",
|
|
286
|
+
onClick: T
|
|
287
|
+
}),
|
|
288
|
+
g(E, {
|
|
289
|
+
variant: "ghost",
|
|
290
|
+
size: "xs",
|
|
291
|
+
icon: "lucide:x",
|
|
292
|
+
class: "shrink-0 h-7 w-7 px-0",
|
|
293
|
+
title: "Cancel",
|
|
294
|
+
onClick: I
|
|
295
|
+
})
|
|
296
|
+
])) : A("", !0)
|
|
297
|
+
])),
|
|
298
|
+
g(ae, {
|
|
299
|
+
show: k.value,
|
|
300
|
+
"onUpdate:show": e[4] || (e[4] = (o) => k.value = o),
|
|
301
|
+
title: H.value,
|
|
302
|
+
"max-width": "max-w-md"
|
|
303
|
+
}, {
|
|
304
|
+
default: _(() => [
|
|
305
|
+
m("div", be, [
|
|
306
|
+
g(ie(se), {
|
|
307
|
+
schema: G.value,
|
|
308
|
+
values: O.value,
|
|
309
|
+
isUpdate: h.value === "edit",
|
|
310
|
+
submitText: "Save Details",
|
|
311
|
+
onOnSubmit: Q
|
|
312
|
+
}, null, 8, ["schema", "values", "isUpdate"])
|
|
313
|
+
])
|
|
314
|
+
]),
|
|
315
|
+
_: 1
|
|
316
|
+
}, 8, ["show", "title"])
|
|
317
|
+
]));
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
export {
|
|
321
|
+
Ke as default
|
|
322
|
+
};
|