vlite3 1.2.17 → 1.3.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/components/Button.vue.d.ts +2 -0
- package/components/Button.vue.js +66 -55
- package/components/Carousel/Carousel.vue.js +2 -2
- package/components/Carousel/Carousel.vue2.js +12 -10
- package/components/CategoryManager/CategoryManager.vue.d.ts +9 -1
- package/components/CategoryManager/CategoryManager.vue.js +5 -461
- package/components/CategoryManager/CategoryManager.vue2.js +515 -2
- package/components/CategoryManager/CategoryNode.vue.js +65 -64
- package/components/CategoryManager/types.d.ts +16 -0
- package/components/ColorPicker/ColorIro.vue3.js +2 -2
- package/components/ColorPicker/ColorPicker.vue.js +2 -2
- package/components/CommandPalette/CommandPaletteContent.vue2.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem.vue.js → CommandPaletteItem.vue2.js} +1 -1
- package/components/FadeOverlay/FadeOverlay.vue.d.ts +13 -0
- package/components/FadeOverlay/FadeOverlay.vue.js +59 -0
- package/components/FadeOverlay/index.d.ts +2 -0
- package/components/FadeOverlay/types.d.ts +72 -0
- package/components/FadeOverlay/utils.d.ts +6 -0
- package/components/FadeOverlay/utils.js +31 -0
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/NumberInput.vue.d.ts +4 -4
- package/components/NumberInput.vue.js +2 -2
- package/components/NumberInput.vue2.js +56 -56
- package/components/Screen/Screen.vue.js +51 -51
- package/components/Screen/ScreenFilter.vue.js +2 -2
- package/components/Screen/components/ScreenQuickFilters.vue.js +3 -3
- package/components/Switch.vue.js +9 -3
- package/components/Tabes/Tabes.vue.d.ts +2 -1
- package/components/Tabes/Tabes.vue.js +2 -2
- package/components/Tabes/Tabes.vue2.js +200 -78
- package/components/index.d.ts +1 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/style.css +17 -17
- package/components/FadeOverlay.vue.d.ts +0 -31
- package/components/FadeOverlay.vue.js +0 -55
- /package/components/ColorPicker/{ColorIro.vue.js → ColorIro.vue2.js} +0 -0
- /package/components/{FadeOverlay.vue2.js → FadeOverlay/FadeOverlay.vue2.js} +0 -0
|
@@ -1,4 +1,517 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent as Ce, ref as I, watch as j, computed as s, provide as De, onMounted as Ae, openBlock as b, createElementBlock as C, normalizeClass as ke, createElementVNode as m, renderSlot as Pe, toDisplayString as w, createBlock as G, withCtx as P, createTextVNode as H, createCommentVNode as E, createVNode as h, withDirectives as Ee, withKeys as K, vModelText as Re, unref as U, Transition as _e } from "vue";
|
|
2
|
+
import Ne from "./CategoryNode.vue.js";
|
|
3
|
+
import Ve from "../Modal.vue.js";
|
|
4
|
+
import qe from "../Form/Form.vue.js";
|
|
5
|
+
import Q from "../Icon.vue.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import R from "../Button.vue.js";
|
|
8
|
+
import { $t as l } from "../../utils/i18n.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 Ue from "../IconPicker.vue.js";
|
|
21
|
+
/* empty css */
|
|
22
|
+
/* empty css */
|
|
23
|
+
import "../../core/config.js";
|
|
24
|
+
import { getUniqueId as _ } from "../../utils/functions.js";
|
|
25
|
+
const ze = { class: "flex items-center justify-between mb-6" }, Oe = { class: "text-lg font-bold text-foreground" }, $e = { class: "text-sm text-muted-foreground mt-0.5" }, Fe = {
|
|
26
|
+
key: 0,
|
|
27
|
+
class: "flex flex-col items-center justify-center py-10 px-4 text-center border border-dashed border-border rounded-xl bg-background"
|
|
28
|
+
}, Je = { class: "w-12 h-12 bg-muted rounded-full flex items-center justify-center mb-4" }, Be = { class: "text-base font-medium text-foreground" }, je = { class: "text-sm text-muted-foreground mt-1 max-w-sm" }, Ge = {
|
|
29
|
+
key: 1,
|
|
30
|
+
class: "w-full tree-wrapper scrollable-container",
|
|
31
|
+
style: { "will-change": "transform", contain: "layout style" }
|
|
32
|
+
}, He = {
|
|
33
|
+
key: 0,
|
|
34
|
+
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"
|
|
35
|
+
}, Ke = ["placeholder"], Qe = {
|
|
36
|
+
class: "modal-body",
|
|
37
|
+
style: { "will-change": "transform", contain: "layout style" }
|
|
38
|
+
}, Le = {
|
|
39
|
+
key: 0,
|
|
40
|
+
class: "absolute inset-0 z-10 flex items-center justify-center rounded-xl bg-background/60 backdrop-blur-[1px] transition-opacity"
|
|
41
|
+
}, We = { class: "flex items-center gap-2 text-sm text-muted-foreground" }, xt = /* @__PURE__ */ Ce({
|
|
42
|
+
__name: "CategoryManager",
|
|
43
|
+
props: {
|
|
44
|
+
modelValue: { default: () => [] },
|
|
45
|
+
rawData: { default: void 0 },
|
|
46
|
+
formSchema: {},
|
|
47
|
+
readonly: { type: Boolean, default: !1 },
|
|
48
|
+
loading: { type: Boolean, default: !1 },
|
|
49
|
+
defaultExpanded: { default: void 0 },
|
|
50
|
+
emptyTitle: { default: "No Categories Found" },
|
|
51
|
+
emptyDescription: { default: "Get started by creating your first category." },
|
|
52
|
+
size: { default: "md" },
|
|
53
|
+
emptyTitleI18n: {},
|
|
54
|
+
emptyDescriptionI18n: {},
|
|
55
|
+
headerTitle: {},
|
|
56
|
+
headerTitleI18n: {},
|
|
57
|
+
headerDescription: {},
|
|
58
|
+
headerDescriptionI18n: {},
|
|
59
|
+
addCategoryText: {},
|
|
60
|
+
addCategoryTextI18n: {},
|
|
61
|
+
createCategoryText: {},
|
|
62
|
+
createCategoryTextI18n: {},
|
|
63
|
+
newRootPlaceholder: {},
|
|
64
|
+
newRootPlaceholderI18n: {},
|
|
65
|
+
newSubcategoryPlaceholder: {},
|
|
66
|
+
newSubcategoryPlaceholderI18n: {},
|
|
67
|
+
categoryTitlePlaceholder: {},
|
|
68
|
+
categoryTitlePlaceholderI18n: {},
|
|
69
|
+
modalTitleAdd: {},
|
|
70
|
+
modalTitleAddI18n: {},
|
|
71
|
+
modalTitleAddChild: {},
|
|
72
|
+
modalTitleAddChildI18n: {},
|
|
73
|
+
modalTitleEdit: {},
|
|
74
|
+
modalTitleEditI18n: {},
|
|
75
|
+
modalSaveText: {},
|
|
76
|
+
modalSaveTextI18n: {},
|
|
77
|
+
quickAddTooltip: {},
|
|
78
|
+
quickAddTooltipI18n: {},
|
|
79
|
+
advancedDetailsTooltip: {},
|
|
80
|
+
advancedDetailsTooltipI18n: {},
|
|
81
|
+
deleteTooltip: {},
|
|
82
|
+
deleteTooltipI18n: {},
|
|
83
|
+
saveTooltip: {},
|
|
84
|
+
saveTooltipI18n: {},
|
|
85
|
+
cancelTooltip: {},
|
|
86
|
+
cancelTooltipI18n: {}
|
|
87
|
+
},
|
|
88
|
+
emits: ["update:modelValue", "onAdd", "onEdit", "onDelete", "onReorder"],
|
|
89
|
+
setup(S, { expose: L, emit: W }) {
|
|
90
|
+
const e = S, f = W, d = I([]), g = I(/* @__PURE__ */ new Set()), v = (o) => JSON.parse(JSON.stringify(o)), T = (o, t = null) => {
|
|
91
|
+
o.forEach((a, i) => {
|
|
92
|
+
a.parentId = t, a.position = i, a.children || (a.children = []), T(a.children, a.id);
|
|
93
|
+
});
|
|
94
|
+
}, X = (o) => {
|
|
95
|
+
const t = /* @__PURE__ */ new Map(), a = [];
|
|
96
|
+
o.forEach((r) => {
|
|
97
|
+
t.set(r.id, {
|
|
98
|
+
...r,
|
|
99
|
+
id: r.id,
|
|
100
|
+
title: r.name || r.title || "Untitled",
|
|
101
|
+
icon: r.icon,
|
|
102
|
+
parentId: r.parentId || null,
|
|
103
|
+
position: r.position ?? 0,
|
|
104
|
+
children: []
|
|
105
|
+
});
|
|
106
|
+
}), o.forEach((r) => {
|
|
107
|
+
const n = t.get(r.id);
|
|
108
|
+
n && (r.parentId && t.has(r.parentId) ? t.get(r.parentId).children.push(n) : a.push(n));
|
|
109
|
+
});
|
|
110
|
+
const i = (r) => {
|
|
111
|
+
r.sort((n, u) => (n.position ?? 0) - (u.position ?? 0)), r.forEach((n) => {
|
|
112
|
+
n.children && i(n.children);
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
return i(a), a;
|
|
116
|
+
}, z = (o) => {
|
|
117
|
+
const t = /* @__PURE__ */ new Set(), a = (i) => {
|
|
118
|
+
for (const r of i)
|
|
119
|
+
t.add(r.id), r.children && a(r.children);
|
|
120
|
+
};
|
|
121
|
+
return a(o), t;
|
|
122
|
+
};
|
|
123
|
+
j(
|
|
124
|
+
() => e.rawData,
|
|
125
|
+
(o) => {
|
|
126
|
+
if (o) {
|
|
127
|
+
if (o.length === 0) {
|
|
128
|
+
d.value = [], g.value = /* @__PURE__ */ new Set(), f("update:modelValue", []);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const t = X(o);
|
|
132
|
+
T(t);
|
|
133
|
+
const a = JSON.stringify(t), i = JSON.stringify(d.value);
|
|
134
|
+
if (a !== i) {
|
|
135
|
+
const r = z(t), n = new Set(
|
|
136
|
+
[...g.value].filter((p) => r.has(p))
|
|
137
|
+
);
|
|
138
|
+
g.value = n;
|
|
139
|
+
const u = v(t);
|
|
140
|
+
d.value = u, f("update:modelValue", u);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{ immediate: !0, deep: !0 }
|
|
145
|
+
), j(
|
|
146
|
+
() => e.modelValue,
|
|
147
|
+
(o) => {
|
|
148
|
+
const t = JSON.stringify(o), a = JSON.stringify(d.value);
|
|
149
|
+
if (t !== a && o.length > 0) {
|
|
150
|
+
const i = v(o);
|
|
151
|
+
T(i), d.value = i;
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
{ immediate: !0, deep: !0 }
|
|
155
|
+
);
|
|
156
|
+
const M = () => {
|
|
157
|
+
T(d.value);
|
|
158
|
+
const o = v(d.value);
|
|
159
|
+
f("update:modelValue", o);
|
|
160
|
+
}, Y = (o) => {
|
|
161
|
+
const t = new Set(g.value);
|
|
162
|
+
t.has(o) ? t.delete(o) : t.add(o), g.value = t;
|
|
163
|
+
}, y = I({
|
|
164
|
+
mode: null,
|
|
165
|
+
targetId: null,
|
|
166
|
+
title: "",
|
|
167
|
+
icon: "lucide:folder"
|
|
168
|
+
}), N = (o, t) => {
|
|
169
|
+
y.value = {
|
|
170
|
+
mode: o,
|
|
171
|
+
targetId: o === "add-child" && t || null,
|
|
172
|
+
title: "",
|
|
173
|
+
icon: "lucide:folder"
|
|
174
|
+
}, o === "add-child" && t && g.value.add(t);
|
|
175
|
+
}, D = () => {
|
|
176
|
+
y.value = { mode: null, targetId: null, title: "", icon: "lucide:folder" };
|
|
177
|
+
}, V = () => {
|
|
178
|
+
const { mode: o, targetId: t, title: a, icon: i } = y.value;
|
|
179
|
+
if (!a.trim()) return;
|
|
180
|
+
const r = [...d.value];
|
|
181
|
+
let n = null;
|
|
182
|
+
if (o === "add-root")
|
|
183
|
+
n = { id: _(), title: a, icon: i, children: [] }, r.push(n);
|
|
184
|
+
else if (o === "add-child") {
|
|
185
|
+
n = { id: _(), title: a, icon: i, children: [] };
|
|
186
|
+
const u = (p) => {
|
|
187
|
+
for (const c of p) {
|
|
188
|
+
if (c.id === t)
|
|
189
|
+
return c.children || (c.children = []), c.children.push(n), !0;
|
|
190
|
+
if (c.children && u(c.children)) return !0;
|
|
191
|
+
}
|
|
192
|
+
return !1;
|
|
193
|
+
};
|
|
194
|
+
u(r);
|
|
195
|
+
}
|
|
196
|
+
n && (T(r), f("onAdd", v(n))), d.value = r, M(), D();
|
|
197
|
+
}, A = I(!1), x = I("add"), q = I(null), O = I(null), $ = I({}), Z = [
|
|
198
|
+
{ name: "icon", label: "Category Icon", type: "iconPicker" },
|
|
199
|
+
{ name: "title", label: "Title", type: "text", required: !0 },
|
|
200
|
+
{ name: "description", label: "Description", type: "textarea", props: { rows: 3 } }
|
|
201
|
+
], ee = s(() => e.formSchema || Z), te = s(() => x.value === "add" ? e.modalTitleAddI18n ? l(e.modalTitleAddI18n) : e.modalTitleAdd ? e.modalTitleAdd : l("vlite.categoryManager.modalTitleAdd") !== "vlite.categoryManager.modalTitleAdd" ? l("vlite.categoryManager.modalTitleAdd") : "Add Category" : x.value === "add-child" ? e.modalTitleAddChildI18n ? l(e.modalTitleAddChildI18n) : e.modalTitleAddChild ? e.modalTitleAddChild : l("vlite.categoryManager.modalTitleAddChild") !== "vlite.categoryManager.modalTitleAddChild" ? l("vlite.categoryManager.modalTitleAddChild") : "Add Sub-category" : e.modalTitleEditI18n ? l(e.modalTitleEditI18n) : e.modalTitleEdit ? e.modalTitleEdit : l("vlite.categoryManager.modalTitleEdit") !== "vlite.categoryManager.modalTitleEdit" ? l("vlite.categoryManager.modalTitleEdit") : "Edit Category"), oe = (o, t, a) => {
|
|
202
|
+
x.value = o, q.value = t || null, O.value = a || null, $.value = t ? v(t) : {}, A.value = !0;
|
|
203
|
+
}, ae = async (o) => {
|
|
204
|
+
const t = o?.values || o, a = [...d.value];
|
|
205
|
+
let i = null, r = null;
|
|
206
|
+
if (x.value === "add") {
|
|
207
|
+
const n = { id: _(), children: [], ...t };
|
|
208
|
+
a.push(n), i = n, r = "onAdd";
|
|
209
|
+
} else if (x.value === "add-child") {
|
|
210
|
+
const n = { id: _(), children: [], ...t }, u = (p) => {
|
|
211
|
+
for (const c of p) {
|
|
212
|
+
if (c.id === O.value)
|
|
213
|
+
return c.children || (c.children = []), c.children.push(n), g.value.add(c.id), !0;
|
|
214
|
+
if (c.children && u(c.children)) return !0;
|
|
215
|
+
}
|
|
216
|
+
return !1;
|
|
217
|
+
};
|
|
218
|
+
u(a), i = n, r = "onAdd";
|
|
219
|
+
} else if (x.value === "edit" && q.value) {
|
|
220
|
+
const n = q.value.id, u = (p) => {
|
|
221
|
+
const c = p.findIndex((k) => k.id === n);
|
|
222
|
+
if (c > -1)
|
|
223
|
+
return p[c] = { ...p[c], ...t }, i = p[c], !0;
|
|
224
|
+
for (const k of p)
|
|
225
|
+
if (k.children && u(k.children)) return !0;
|
|
226
|
+
return !1;
|
|
227
|
+
};
|
|
228
|
+
u(a), r = "onEdit";
|
|
229
|
+
}
|
|
230
|
+
T(a), i && (r === "onAdd" ? f("onAdd", v(i)) : r === "onEdit" && f("onEdit", v(i))), d.value = a, M(), o && typeof o.setSubmitting == "function" && o.setSubmitting(!1), A.value = !1;
|
|
231
|
+
}, le = (o) => {
|
|
232
|
+
const t = o.id, a = (r) => {
|
|
233
|
+
const n = r.findIndex((u) => u.id === t);
|
|
234
|
+
if (n > -1)
|
|
235
|
+
return r.splice(n, 1), !0;
|
|
236
|
+
for (const u of r)
|
|
237
|
+
if (u.children && a(u.children)) return !0;
|
|
238
|
+
return !1;
|
|
239
|
+
}, i = [...d.value];
|
|
240
|
+
a(i), T(i), d.value = i, f("onDelete", v(o)), M();
|
|
241
|
+
}, re = (o) => {
|
|
242
|
+
f("onEdit", v(o)), M();
|
|
243
|
+
}, ne = (o) => {
|
|
244
|
+
d.value = [...o], M();
|
|
245
|
+
}, ie = () => {
|
|
246
|
+
M();
|
|
247
|
+
}, de = (o) => {
|
|
248
|
+
T(d.value);
|
|
249
|
+
const t = v(d.value);
|
|
250
|
+
f("update:modelValue", t);
|
|
251
|
+
let a = null;
|
|
252
|
+
const i = (r) => {
|
|
253
|
+
for (const n of r) {
|
|
254
|
+
if (String(n.id) === String(o))
|
|
255
|
+
return a = n, !0;
|
|
256
|
+
if (n.children && i(n.children)) return !0;
|
|
257
|
+
}
|
|
258
|
+
return !1;
|
|
259
|
+
};
|
|
260
|
+
i(t), a && f("onReorder", {
|
|
261
|
+
id: a.id,
|
|
262
|
+
parentId: a.parentId ?? null,
|
|
263
|
+
position: a.position ?? 0
|
|
264
|
+
});
|
|
265
|
+
}, ce = s(() => {
|
|
266
|
+
if (e.emptyTitleI18n) {
|
|
267
|
+
const t = l(e.emptyTitleI18n);
|
|
268
|
+
if (t !== e.emptyTitleI18n) return t;
|
|
269
|
+
}
|
|
270
|
+
if (e.emptyTitle !== "No Categories Found") return e.emptyTitle;
|
|
271
|
+
const o = l("vlite.categoryManager.emptyTitle");
|
|
272
|
+
return o !== "vlite.categoryManager.emptyTitle" ? o : e.emptyTitle;
|
|
273
|
+
}), se = s(() => {
|
|
274
|
+
if (e.emptyDescriptionI18n) {
|
|
275
|
+
const t = l(e.emptyDescriptionI18n);
|
|
276
|
+
if (t !== e.emptyDescriptionI18n) return t;
|
|
277
|
+
}
|
|
278
|
+
if (e.emptyDescription !== "Get started by creating your first category.") return e.emptyDescription;
|
|
279
|
+
const o = l("vlite.categoryManager.emptyDescription");
|
|
280
|
+
return o !== "vlite.categoryManager.emptyDescription" ? o : e.emptyDescription;
|
|
281
|
+
}), ue = s(() => {
|
|
282
|
+
if (e.headerTitleI18n) {
|
|
283
|
+
const t = l(e.headerTitleI18n);
|
|
284
|
+
if (t !== e.headerTitleI18n) return t;
|
|
285
|
+
}
|
|
286
|
+
if (e.headerTitle) return e.headerTitle;
|
|
287
|
+
const o = l("vlite.categoryManager.headerTitle");
|
|
288
|
+
return o !== "vlite.categoryManager.headerTitle" ? o : "Categories";
|
|
289
|
+
}), ge = s(() => {
|
|
290
|
+
if (e.headerDescriptionI18n) {
|
|
291
|
+
const t = l(e.headerDescriptionI18n);
|
|
292
|
+
if (t !== e.headerDescriptionI18n) return t;
|
|
293
|
+
}
|
|
294
|
+
if (e.headerDescription) return e.headerDescription;
|
|
295
|
+
const o = l("vlite.categoryManager.headerDescription");
|
|
296
|
+
return o !== "vlite.categoryManager.headerDescription" ? o : "Manage your hierarchical structure.";
|
|
297
|
+
}), pe = s(() => {
|
|
298
|
+
if (e.addCategoryTextI18n) {
|
|
299
|
+
const t = l(e.addCategoryTextI18n);
|
|
300
|
+
if (t !== e.addCategoryTextI18n) return t;
|
|
301
|
+
}
|
|
302
|
+
if (e.addCategoryText) return e.addCategoryText;
|
|
303
|
+
const o = l("vlite.categoryManager.addCategory");
|
|
304
|
+
return o !== "vlite.categoryManager.addCategory" ? o : "Add Category";
|
|
305
|
+
}), me = s(() => {
|
|
306
|
+
if (e.createCategoryTextI18n) {
|
|
307
|
+
const t = l(e.createCategoryTextI18n);
|
|
308
|
+
if (t !== e.createCategoryTextI18n) return t;
|
|
309
|
+
}
|
|
310
|
+
if (e.createCategoryText) return e.createCategoryText;
|
|
311
|
+
const o = l("vlite.categoryManager.createCategory");
|
|
312
|
+
return o !== "vlite.categoryManager.createCategory" ? o : "Create Category";
|
|
313
|
+
}), fe = s(() => {
|
|
314
|
+
if (e.newRootPlaceholderI18n) {
|
|
315
|
+
const t = l(e.newRootPlaceholderI18n);
|
|
316
|
+
if (t !== e.newRootPlaceholderI18n) return t;
|
|
317
|
+
}
|
|
318
|
+
if (e.newRootPlaceholder) return e.newRootPlaceholder;
|
|
319
|
+
const o = l("vlite.categoryManager.newRootPlaceholder");
|
|
320
|
+
return o !== "vlite.categoryManager.newRootPlaceholder" ? o : "New root category...";
|
|
321
|
+
}), ve = s(() => {
|
|
322
|
+
if (e.modalSaveTextI18n) {
|
|
323
|
+
const t = l(e.modalSaveTextI18n);
|
|
324
|
+
if (t !== e.modalSaveTextI18n) return t;
|
|
325
|
+
}
|
|
326
|
+
if (e.modalSaveText) return e.modalSaveText;
|
|
327
|
+
const o = l("vlite.categoryManager.modalSaveText");
|
|
328
|
+
return o !== "vlite.categoryManager.modalSaveText" ? o : "Save Details";
|
|
329
|
+
}), ye = s(() => {
|
|
330
|
+
if (e.newSubcategoryPlaceholderI18n) {
|
|
331
|
+
const t = l(e.newSubcategoryPlaceholderI18n);
|
|
332
|
+
if (t !== e.newSubcategoryPlaceholderI18n) return t;
|
|
333
|
+
}
|
|
334
|
+
if (e.newSubcategoryPlaceholder) return e.newSubcategoryPlaceholder;
|
|
335
|
+
const o = l("vlite.categoryManager.newSubcategoryPlaceholder");
|
|
336
|
+
return o !== "vlite.categoryManager.newSubcategoryPlaceholder" ? o : "New subcategory title...";
|
|
337
|
+
}), he = s(() => {
|
|
338
|
+
if (e.categoryTitlePlaceholderI18n) {
|
|
339
|
+
const t = l(e.categoryTitlePlaceholderI18n);
|
|
340
|
+
if (t !== e.categoryTitlePlaceholderI18n) return t;
|
|
341
|
+
}
|
|
342
|
+
if (e.categoryTitlePlaceholder) return e.categoryTitlePlaceholder;
|
|
343
|
+
const o = l("vlite.categoryManager.categoryTitlePlaceholder");
|
|
344
|
+
return o !== "vlite.categoryManager.categoryTitlePlaceholder" ? o : "Category title...";
|
|
345
|
+
}), Te = s(() => e.quickAddTooltipI18n ? l(e.quickAddTooltipI18n) : e.quickAddTooltip ? e.quickAddTooltip : l("vlite.categoryManager.quickAddTooltip") !== "vlite.categoryManager.quickAddTooltip" ? l("vlite.categoryManager.quickAddTooltip") : "Quick Add Subcategory"), Ie = s(() => e.advancedDetailsTooltipI18n ? l(e.advancedDetailsTooltipI18n) : e.advancedDetailsTooltip ? e.advancedDetailsTooltip : l("vlite.categoryManager.advancedDetailsTooltip") !== "vlite.categoryManager.advancedDetailsTooltip" ? l("vlite.categoryManager.advancedDetailsTooltip") : "Advanced Details"), xe = s(() => e.deleteTooltipI18n ? l(e.deleteTooltipI18n) : e.deleteTooltip ? e.deleteTooltip : l("vlite.categoryManager.deleteTooltip") !== "vlite.categoryManager.deleteTooltip" ? l("vlite.categoryManager.deleteTooltip") : "Delete"), F = s(() => e.saveTooltipI18n ? l(e.saveTooltipI18n) : e.saveTooltip ? e.saveTooltip : l("vlite.categoryManager.saveTooltip") !== "vlite.categoryManager.saveTooltip" ? l("vlite.categoryManager.saveTooltip") : "Save"), J = s(() => e.cancelTooltipI18n ? l(e.cancelTooltipI18n) : e.cancelTooltip ? e.cancelTooltip : l("vlite.categoryManager.cancelTooltip") !== "vlite.categoryManager.cancelTooltip" ? l("vlite.categoryManager.cancelTooltip") : "Cancel");
|
|
346
|
+
De("categoryManager", {
|
|
347
|
+
expandedIds: g,
|
|
348
|
+
inlineState: y,
|
|
349
|
+
toggleExpand: Y,
|
|
350
|
+
startInline: N,
|
|
351
|
+
saveInline: V,
|
|
352
|
+
cancelInline: D,
|
|
353
|
+
saveItem: re,
|
|
354
|
+
openModalForm: oe,
|
|
355
|
+
deleteItem: le,
|
|
356
|
+
readonly: s(() => e.readonly),
|
|
357
|
+
size: s(() => e.size),
|
|
358
|
+
newSubcategoryPlaceholderText: ye,
|
|
359
|
+
categoryTitlePlaceholderText: he,
|
|
360
|
+
quickAddTooltipText: Te,
|
|
361
|
+
advancedDetailsTooltipText: Ie,
|
|
362
|
+
deleteTooltipText: xe,
|
|
363
|
+
saveTooltipText: F,
|
|
364
|
+
cancelTooltipText: J
|
|
365
|
+
});
|
|
366
|
+
const be = {
|
|
367
|
+
mounted: (o) => {
|
|
368
|
+
setTimeout(() => o.focus(), 10);
|
|
369
|
+
}
|
|
370
|
+
}, we = () => {
|
|
371
|
+
const o = z(d.value);
|
|
372
|
+
g.value = o;
|
|
373
|
+
}, Me = () => {
|
|
374
|
+
g.value = /* @__PURE__ */ new Set();
|
|
375
|
+
}, B = (...o) => {
|
|
376
|
+
const t = new Set(g.value);
|
|
377
|
+
o.forEach((a) => t.add(a)), g.value = t;
|
|
378
|
+
}, Se = (...o) => {
|
|
379
|
+
const t = new Set(g.value);
|
|
380
|
+
o.forEach((a) => t.delete(a)), g.value = t;
|
|
381
|
+
};
|
|
382
|
+
return Ae(() => {
|
|
383
|
+
e.defaultExpanded && e.defaultExpanded.length > 0 && B(...e.defaultExpanded);
|
|
384
|
+
}), L({
|
|
385
|
+
expandedIds: g,
|
|
386
|
+
expandAll: we,
|
|
387
|
+
collapseAll: Me,
|
|
388
|
+
expand: B,
|
|
389
|
+
collapse: Se
|
|
390
|
+
}), (o, t) => (b(), C("div", {
|
|
391
|
+
class: ke(["category-manager-container w-full bg-muted/10 rounded-xl border border-border p-4 lg:p-6 relative", { "category-manager--loading": S.loading }])
|
|
392
|
+
}, [
|
|
393
|
+
m("div", ze, [
|
|
394
|
+
Pe(o.$slots, "header", {}, () => [
|
|
395
|
+
m("div", null, [
|
|
396
|
+
m("h3", Oe, w(ue.value), 1),
|
|
397
|
+
m("p", $e, w(ge.value), 1)
|
|
398
|
+
]),
|
|
399
|
+
S.readonly ? E("", !0) : (b(), G(R, {
|
|
400
|
+
key: 0,
|
|
401
|
+
variant: "primary",
|
|
402
|
+
icon: "lucide:plus",
|
|
403
|
+
size: "sm",
|
|
404
|
+
onClick: t[0] || (t[0] = (a) => N("add-root"))
|
|
405
|
+
}, {
|
|
406
|
+
default: P(() => [
|
|
407
|
+
H(w(pe.value), 1)
|
|
408
|
+
]),
|
|
409
|
+
_: 1
|
|
410
|
+
}))
|
|
411
|
+
], !0)
|
|
412
|
+
]),
|
|
413
|
+
d.value.length === 0 && y.value.mode !== "add-root" ? (b(), C("div", Fe, [
|
|
414
|
+
m("div", Je, [
|
|
415
|
+
h(Q, {
|
|
416
|
+
icon: "lucide:folder-tree",
|
|
417
|
+
class: "w-6 h-6 text-muted-foreground"
|
|
418
|
+
})
|
|
419
|
+
]),
|
|
420
|
+
m("h4", Be, w(ce.value), 1),
|
|
421
|
+
m("p", je, w(se.value), 1),
|
|
422
|
+
S.readonly ? E("", !0) : (b(), G(R, {
|
|
423
|
+
key: 0,
|
|
424
|
+
variant: "outline",
|
|
425
|
+
size: "sm",
|
|
426
|
+
class: "mt-5",
|
|
427
|
+
icon: "lucide:plus",
|
|
428
|
+
onClick: t[1] || (t[1] = (a) => N("add-root"))
|
|
429
|
+
}, {
|
|
430
|
+
default: P(() => [
|
|
431
|
+
H(w(me.value), 1)
|
|
432
|
+
]),
|
|
433
|
+
_: 1
|
|
434
|
+
}))
|
|
435
|
+
])) : (b(), C("div", Ge, [
|
|
436
|
+
h(Ne, {
|
|
437
|
+
modelValue: d.value,
|
|
438
|
+
"onUpdate:modelValue": ne,
|
|
439
|
+
onChange: ie,
|
|
440
|
+
onDragEnd: de
|
|
441
|
+
}, null, 8, ["modelValue"]),
|
|
442
|
+
y.value.mode === "add-root" ? (b(), C("div", He, [
|
|
443
|
+
h(Ue, {
|
|
444
|
+
modelValue: y.value.icon,
|
|
445
|
+
"onUpdate:modelValue": t[2] || (t[2] = (a) => y.value.icon = a),
|
|
446
|
+
"btn-props": { variant: "ghost", size: "xs", class: "h-7 w-7 p-0 text-muted-foreground hover:text-foreground shrink-0 rounded-md" },
|
|
447
|
+
position: "bottom-start"
|
|
448
|
+
}, null, 8, ["modelValue"]),
|
|
449
|
+
Ee(m("input", {
|
|
450
|
+
"onUpdate:modelValue": t[3] || (t[3] = (a) => y.value.title = a),
|
|
451
|
+
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",
|
|
452
|
+
placeholder: fe.value,
|
|
453
|
+
onKeyup: [
|
|
454
|
+
K(V, ["enter"]),
|
|
455
|
+
K(D, ["esc"])
|
|
456
|
+
]
|
|
457
|
+
}, null, 40, Ke), [
|
|
458
|
+
[be],
|
|
459
|
+
[Re, y.value.title]
|
|
460
|
+
]),
|
|
461
|
+
h(R, {
|
|
462
|
+
variant: "primary",
|
|
463
|
+
size: "xs",
|
|
464
|
+
icon: "lucide:check",
|
|
465
|
+
class: "shrink-0 h-7 w-7 px-0",
|
|
466
|
+
title: F.value,
|
|
467
|
+
onClick: V
|
|
468
|
+
}, null, 8, ["title"]),
|
|
469
|
+
h(R, {
|
|
470
|
+
variant: "ghost",
|
|
471
|
+
size: "xs",
|
|
472
|
+
icon: "lucide:x",
|
|
473
|
+
class: "shrink-0 h-7 w-7 px-0",
|
|
474
|
+
title: J.value,
|
|
475
|
+
onClick: D
|
|
476
|
+
}, null, 8, ["title"])
|
|
477
|
+
])) : E("", !0)
|
|
478
|
+
])),
|
|
479
|
+
h(Ve, {
|
|
480
|
+
show: A.value,
|
|
481
|
+
"onUpdate:show": t[4] || (t[4] = (a) => A.value = a),
|
|
482
|
+
title: te.value,
|
|
483
|
+
"max-width": "max-w-md"
|
|
484
|
+
}, {
|
|
485
|
+
default: P(() => [
|
|
486
|
+
m("div", Qe, [
|
|
487
|
+
h(U(qe), {
|
|
488
|
+
schema: ee.value,
|
|
489
|
+
values: $.value,
|
|
490
|
+
isUpdate: x.value === "edit",
|
|
491
|
+
submitText: ve.value,
|
|
492
|
+
onOnSubmit: ae
|
|
493
|
+
}, null, 8, ["schema", "values", "isUpdate", "submitText"])
|
|
494
|
+
])
|
|
495
|
+
]),
|
|
496
|
+
_: 1
|
|
497
|
+
}, 8, ["show", "title"]),
|
|
498
|
+
h(_e, { name: "cm-fade" }, {
|
|
499
|
+
default: P(() => [
|
|
500
|
+
S.loading ? (b(), C("div", Le, [
|
|
501
|
+
m("div", We, [
|
|
502
|
+
h(Q, {
|
|
503
|
+
icon: "lucide:loader-2",
|
|
504
|
+
class: "w-4 h-4 animate-spin"
|
|
505
|
+
}),
|
|
506
|
+
m("span", null, w(U(l)("vlite.categoryManager.loading") !== "vlite.categoryManager.loading" ? U(l)("vlite.categoryManager.loading") : "Updating..."), 1)
|
|
507
|
+
])
|
|
508
|
+
])) : E("", !0)
|
|
509
|
+
]),
|
|
510
|
+
_: 1
|
|
511
|
+
})
|
|
512
|
+
], 2));
|
|
513
|
+
}
|
|
514
|
+
});
|
|
2
515
|
export {
|
|
3
|
-
|
|
516
|
+
xt as default
|
|
4
517
|
};
|