vlite3 1.4.3 → 1.4.5
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/AppShell/AppShellLayoutStorefront.vue.js +2 -2
- package/components/AvatarUploader/AvatarUploader.vue.d.ts +2 -2
- package/components/Cart/Cart.vue.d.ts +27 -0
- package/components/Cart/Cart.vue.js +242 -0
- package/components/Cart/Cart.vue2.js +4 -0
- package/components/Cart/CartCouponInput.vue.d.ts +32 -0
- package/components/Cart/CartCouponInput.vue.js +176 -0
- package/components/Cart/CartCouponInput.vue2.js +4 -0
- package/components/Cart/CartEmptyState.vue.d.ts +17 -0
- package/components/Cart/CartEmptyState.vue.js +48 -0
- package/components/Cart/CartEmptyState.vue2.js +4 -0
- package/components/Cart/CartLineItem.vue.d.ts +29 -0
- package/components/Cart/CartLineItem.vue.js +341 -0
- package/components/Cart/CartLineItem.vue2.js +4 -0
- package/components/Cart/CartSummary.vue.d.ts +29 -0
- package/components/Cart/CartSummary.vue.js +157 -0
- package/components/Cart/CartSummary.vue2.js +4 -0
- package/components/Cart/CartVariant1.vue.d.ts +42 -0
- package/components/Cart/CartVariant1.vue.js +156 -0
- package/components/Cart/CartVariant1.vue2.js +4 -0
- package/components/Cart/CartVariant2.vue.d.ts +42 -0
- package/components/Cart/CartVariant2.vue.js +154 -0
- package/components/Cart/CartVariant2.vue2.js +4 -0
- package/components/Cart/CartVariant3.vue.d.ts +41 -0
- package/components/Cart/CartVariant3.vue.js +192 -0
- package/components/Cart/CartVariant3.vue2.js +4 -0
- package/components/Cart/CartVariant4.vue.d.ts +41 -0
- package/components/Cart/CartVariant4.vue.js +145 -0
- package/components/Cart/CartVariant4.vue2.js +4 -0
- package/components/Cart/composables/useCart.d.ts +46 -0
- package/components/Cart/composables/useCart.js +110 -0
- package/components/Cart/composables/useCartCalculation.d.ts +91 -0
- package/components/Cart/composables/useCartCalculation.js +145 -0
- package/components/Cart/index.d.ts +9 -0
- package/components/Cart/types.d.ts +391 -0
- package/components/CategoryManager/CategoryManager.vue.d.ts +2 -2
- package/components/CategoryManager/CategoryManager.vue.js +3 -3
- package/components/CategoryManager/CategoryManager.vue2.js +224 -248
- package/components/CategoryManager/utils.d.ts +3 -0
- package/components/CategoryManager/utils.js +31 -0
- package/components/CategoryMenu/CategoryMenu.vue.d.ts +2 -0
- package/components/CategoryMenu/CategoryMenu.vue.js +46 -40
- package/components/CategoryMenu/CategoryMenuVariant1.vue.d.ts +5 -1
- package/components/CategoryMenu/CategoryMenuVariant1.vue.js +5 -144
- package/components/CategoryMenu/CategoryMenuVariant1.vue2.js +220 -2
- package/components/CategoryMenu/CategoryMenuVariant2.vue.d.ts +5 -1
- package/components/CategoryMenu/CategoryMenuVariant2.vue.js +5 -160
- package/components/CategoryMenu/CategoryMenuVariant2.vue2.js +235 -2
- package/components/CategoryMenu/types.d.ts +5 -2
- package/components/Clipboard.vue.d.ts +2 -2
- package/components/Dropdown/Dropdown.vue.d.ts +1 -0
- package/components/Dropdown/Dropdown.vue.js +31 -29
- package/components/FilePicker/FilePicker.vue.d.ts +2 -2
- package/components/FilePicker/FilePicker.vue.js +278 -202
- package/components/Form/CustomFields.vue.d.ts +4 -0
- package/components/Form/CustomFields.vue.js +2 -2
- package/components/Form/CustomFields.vue2.js +349 -145
- package/components/Form/FormField.vue.d.ts +1 -1
- package/components/Form/FormField.vue.js +1 -1
- package/components/Form/types.d.ts +3 -0
- package/components/Modal.vue.d.ts +2 -0
- package/components/Modal.vue.js +1 -1
- package/components/Modal.vue2.js +30 -28
- package/components/OTPInput/OTPInput.vue.d.ts +1 -1
- package/components/Rating/Rating.vue.d.ts +1 -1
- package/components/Screen/ScreenFilter.vue.js +3 -2
- package/components/SidePanel.vue.d.ts +2 -0
- package/components/SidePanel.vue.js +1 -1
- package/components/SidePanel.vue2.js +25 -23
- package/components/SidebarMenu/SidebarMenu.vue.js +145 -128
- package/components/index.d.ts +1 -0
- package/core/config.d.ts +128 -0
- package/index.d.ts +1 -0
- package/index.js +327 -306
- package/package.json +1 -1
- package/style.css +1 -1
- package/types/config.type.d.ts +2 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const d = (t, c = null) => {
|
|
2
|
+
t.forEach((r, e) => {
|
|
3
|
+
r.parentId = c, r.position = e, r.children || (r.children = []), d(r.children, r.id);
|
|
4
|
+
});
|
|
5
|
+
}, i = (t) => {
|
|
6
|
+
const c = /* @__PURE__ */ new Map(), r = [];
|
|
7
|
+
t.forEach((n) => {
|
|
8
|
+
c.set(n.id, {
|
|
9
|
+
...n,
|
|
10
|
+
id: n.id,
|
|
11
|
+
title: n.name || n.title || "Untitled",
|
|
12
|
+
icon: n.icon,
|
|
13
|
+
parentId: n.parentId || null,
|
|
14
|
+
position: n.position ?? 0,
|
|
15
|
+
children: []
|
|
16
|
+
});
|
|
17
|
+
}), t.forEach((n) => {
|
|
18
|
+
const o = c.get(n.id);
|
|
19
|
+
o && (n.parentId && c.has(n.parentId) ? c.get(n.parentId).children.push(o) : r.push(o));
|
|
20
|
+
});
|
|
21
|
+
const e = (n) => {
|
|
22
|
+
n.sort((o, s) => (o.position ?? 0) - (s.position ?? 0)), n.forEach((o) => {
|
|
23
|
+
o.children && e(o.children);
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
return e(r), r;
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
i as buildTreeFromRaw,
|
|
30
|
+
d as ensureMeta
|
|
31
|
+
};
|
|
@@ -6,7 +6,9 @@ declare const _default: import('vue').DefineComponent<CategoryMenuProps, {}, {},
|
|
|
6
6
|
}>, {
|
|
7
7
|
class: string;
|
|
8
8
|
variant: import('./types').CategoryMenuVariant;
|
|
9
|
+
menuStyles: any;
|
|
9
10
|
items: CategoryMenuItem[];
|
|
11
|
+
rawData: import('../CategoryManager').RawCategoryItem[];
|
|
10
12
|
mobileBreakpoint: "sm" | "md" | "lg" | "xl";
|
|
11
13
|
maxDepth: number;
|
|
12
14
|
showIcons: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { CATEGORY_MENU_ROUTE_PREFIX_KEY as
|
|
1
|
+
import { defineComponent as C, computed as i, markRaw as u, inject as B, openBlock as m, createElementBlock as D, createBlock as f, unref as E, normalizeClass as h, resolveDynamicComponent as S } from "vue";
|
|
2
|
+
import v from "./CategoryMenuVariant1.vue.js";
|
|
3
|
+
import k from "./CategoryMenuVariant2.vue.js";
|
|
4
|
+
import { CATEGORY_MENU_ROUTE_PREFIX_KEY as R, buildCategoryRoute as A } from "./utils.js";
|
|
5
5
|
import P from "../SidebarMenu/SidebarMenu.vue.js";
|
|
6
6
|
/* empty css */
|
|
7
7
|
import "vue-router";
|
|
@@ -14,15 +14,17 @@ import "../../core/config.js";
|
|
|
14
14
|
/* empty css */
|
|
15
15
|
/* empty css */
|
|
16
16
|
/* empty css */
|
|
17
|
-
|
|
17
|
+
import { buildTreeFromRaw as j } from "../CategoryManager/utils.js";
|
|
18
|
+
const L = {
|
|
18
19
|
key: 0,
|
|
19
20
|
class: "w-full text-center text-xs text-muted-foreground py-3"
|
|
20
|
-
},
|
|
21
|
+
}, M = {
|
|
21
22
|
name: "CategoryMenu"
|
|
22
|
-
},
|
|
23
|
-
...
|
|
23
|
+
}, Z = /* @__PURE__ */ C({
|
|
24
|
+
...M,
|
|
24
25
|
props: {
|
|
25
26
|
items: { default: () => [] },
|
|
27
|
+
rawData: { default: void 0 },
|
|
26
28
|
variant: { default: "tabs" },
|
|
27
29
|
maxDepth: { default: 2 },
|
|
28
30
|
showIcons: { type: Boolean, default: !0 },
|
|
@@ -35,72 +37,76 @@ const S = {
|
|
|
35
37
|
megaColumns: { default: 4 },
|
|
36
38
|
showImages: { type: Boolean, default: !0 },
|
|
37
39
|
showDescriptions: { type: Boolean, default: !0 },
|
|
38
|
-
class: { default: "" }
|
|
40
|
+
class: { default: "" },
|
|
41
|
+
menuStyles: { default: {} }
|
|
39
42
|
},
|
|
40
43
|
emits: ["select"],
|
|
41
|
-
setup(
|
|
42
|
-
const e =
|
|
44
|
+
setup(w, { emit: g }) {
|
|
45
|
+
const e = w, n = g, l = i(() => e.rawData && e.rawData.length > 0 ? j(e.rawData) : e.items || []);
|
|
46
|
+
console.log(l.value);
|
|
47
|
+
const x = i(() => {
|
|
43
48
|
switch (e.variant) {
|
|
44
49
|
case "tabs":
|
|
45
|
-
return
|
|
50
|
+
return u(v);
|
|
46
51
|
case "mega":
|
|
47
|
-
return
|
|
52
|
+
return u(k);
|
|
48
53
|
default:
|
|
49
|
-
return
|
|
54
|
+
return u(v);
|
|
50
55
|
}
|
|
51
|
-
}),
|
|
52
|
-
|
|
56
|
+
}), o = B(
|
|
57
|
+
R,
|
|
53
58
|
void 0
|
|
54
|
-
),
|
|
55
|
-
const
|
|
56
|
-
return String(e.routePrefix ||
|
|
57
|
-
}),
|
|
59
|
+
), s = i(() => {
|
|
60
|
+
const a = typeof o == "object" && o && "value" in o ? o.value : o;
|
|
61
|
+
return String(e.routePrefix || a || "");
|
|
62
|
+
}), y = i(() => {
|
|
58
63
|
if (e.variant !== "sidebar") return [];
|
|
59
|
-
const
|
|
60
|
-
const
|
|
64
|
+
const a = (t, d = []) => {
|
|
65
|
+
const c = t.children && t.children.length > 0 ? t.children.map((_) => a(_, [...d, t])) : void 0, p = !!c?.length;
|
|
61
66
|
return {
|
|
62
67
|
id: t.id !== void 0 ? String(t.id) : void 0,
|
|
63
68
|
label: t.title || t.name || "Untitled",
|
|
64
|
-
to:
|
|
69
|
+
to: p ? void 0 : A(s.value, t, d),
|
|
65
70
|
icon: e.showIcons ? t.icon : void 0,
|
|
66
71
|
badge: t.badge,
|
|
67
|
-
children:
|
|
72
|
+
children: c,
|
|
68
73
|
// Parent nodes are expanders in tree/sidebar mode; leaves select/navigate.
|
|
69
|
-
action:
|
|
74
|
+
action: p ? void 0 : () => n("select", t)
|
|
70
75
|
};
|
|
71
|
-
},
|
|
72
|
-
return e.showAllItem &&
|
|
76
|
+
}, r = l.value.map((t) => a(t));
|
|
77
|
+
return e.showAllItem && r.unshift({
|
|
73
78
|
id: "all",
|
|
74
79
|
label: e.allItemLabel,
|
|
75
|
-
to:
|
|
80
|
+
to: s.value ? s.value : void 0,
|
|
76
81
|
icon: e.showIcons ? "lucide:layout-grid" : void 0,
|
|
77
|
-
action: () =>
|
|
78
|
-
}),
|
|
79
|
-
}), I = (
|
|
80
|
-
return (
|
|
82
|
+
action: () => n("select", { id: "all", title: e.allItemLabel })
|
|
83
|
+
}), r;
|
|
84
|
+
}), I = (a) => n("select", a), b = i(() => !l.value || l.value.length === 0);
|
|
85
|
+
return (a, r) => b.value ? (m(), D("div", L, " No categories to display. ")) : e.variant === "sidebar" ? (m(), f(E(P), {
|
|
81
86
|
key: 1,
|
|
82
|
-
items:
|
|
87
|
+
items: y.value,
|
|
83
88
|
"allow-multiple": e.multiExpand,
|
|
84
89
|
"default-expanded": e.activeId ? [String(e.activeId)] : [],
|
|
85
|
-
class:
|
|
86
|
-
}, null, 8, ["items", "allow-multiple", "default-expanded", "class"])) : (m(),
|
|
90
|
+
class: h(e.class)
|
|
91
|
+
}, null, 8, ["items", "allow-multiple", "default-expanded", "class"])) : (m(), f(S(x.value), {
|
|
87
92
|
key: 2,
|
|
88
|
-
items:
|
|
93
|
+
items: l.value,
|
|
89
94
|
"max-depth": e.maxDepth,
|
|
90
95
|
"show-icons": e.showIcons,
|
|
91
96
|
"show-all-item": e.showAllItem,
|
|
92
97
|
"all-item-label": e.allItemLabel,
|
|
93
98
|
"multi-expand": e.multiExpand,
|
|
94
99
|
"active-id": e.activeId,
|
|
95
|
-
"route-prefix":
|
|
100
|
+
"route-prefix": s.value,
|
|
96
101
|
"mega-columns": e.megaColumns,
|
|
102
|
+
menuStyles: e.menuStyles,
|
|
97
103
|
"show-images": e.showImages,
|
|
98
104
|
"show-descriptions": e.showDescriptions,
|
|
99
|
-
class:
|
|
105
|
+
class: h(e.class),
|
|
100
106
|
onSelect: I
|
|
101
|
-
}, null, 40, ["items", "max-depth", "show-icons", "show-all-item", "all-item-label", "multi-expand", "active-id", "route-prefix", "mega-columns", "show-images", "show-descriptions", "class"]));
|
|
107
|
+
}, null, 40, ["items", "max-depth", "show-icons", "show-all-item", "all-item-label", "multi-expand", "active-id", "route-prefix", "mega-columns", "menuStyles", "show-images", "show-descriptions", "class"]));
|
|
102
108
|
}
|
|
103
109
|
});
|
|
104
110
|
export {
|
|
105
|
-
|
|
111
|
+
Z as default
|
|
106
112
|
};
|
|
@@ -8,10 +8,14 @@ interface Props {
|
|
|
8
8
|
activeId: string | number | null | undefined;
|
|
9
9
|
routePrefix?: string;
|
|
10
10
|
class?: string;
|
|
11
|
+
menuStyles?: object;
|
|
11
12
|
}
|
|
12
13
|
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
13
14
|
select: (item: import('../CategoryManager').CategoryItem) => any;
|
|
14
15
|
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
15
16
|
onSelect?: (item: import('../CategoryManager').CategoryItem) => any;
|
|
16
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
17
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
18
|
+
scrollRef: HTMLDivElement;
|
|
19
|
+
scrollContentRef: HTMLDivElement;
|
|
20
|
+
}, HTMLElement>;
|
|
17
21
|
export default _default;
|
|
@@ -1,146 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
/* empty css */
|
|
6
|
-
/* empty css */
|
|
7
|
-
/* empty css */
|
|
8
|
-
import { normalizeRoutePrefix as S, categoriesToDropdownOptions as z, buildCategoryRoute as O } from "./utils.js";
|
|
9
|
-
const T = {
|
|
10
|
-
class: "flex items-center gap-1 overflow-x-auto py-2 -mx-1 px-1 scrollbar-thin",
|
|
11
|
-
style: { "will-change": "transform", contain: "layout style" }
|
|
12
|
-
}, F = { class: "truncate max-w-[180px]" }, H = { class: "truncate max-w-[180px]" }, M = { class: "sm:hidden border-t border-border" }, j = {
|
|
13
|
-
key: 0,
|
|
14
|
-
class: "px-2 py-2 bg-muted/30"
|
|
15
|
-
}, q = { class: "flex-1 truncate" }, ee = /* @__PURE__ */ R({
|
|
16
|
-
__name: "CategoryMenuVariant1",
|
|
17
|
-
props: {
|
|
18
|
-
items: {},
|
|
19
|
-
maxDepth: {},
|
|
20
|
-
showIcons: { type: Boolean },
|
|
21
|
-
showAllItem: { type: Boolean },
|
|
22
|
-
allItemLabel: {},
|
|
23
|
-
activeId: {},
|
|
24
|
-
routePrefix: {},
|
|
25
|
-
class: {}
|
|
26
|
-
},
|
|
27
|
-
emits: ["select"],
|
|
28
|
-
setup(B, { emit: A }) {
|
|
29
|
-
const o = B, f = A, w = L(() => o.items || []), b = V(null), C = L(() => S(o.routePrefix)), I = (n) => {
|
|
30
|
-
const c = n.option?.data;
|
|
31
|
-
f("select", c || n);
|
|
32
|
-
}, D = () => {
|
|
33
|
-
f("select", { id: "all", title: o.allItemLabel });
|
|
34
|
-
}, u = (n, c = []) => O(o.routePrefix, n, c), x = (n) => n ? "router-link" : "button", g = (n) => n ? { to: n } : { type: "button" }, y = (n) => o.activeId ? n.id === o.activeId || (n.children || []).some((c) => y(c)) : !1;
|
|
35
|
-
return (n, c) => (t(), s("nav", {
|
|
36
|
-
class: P(["relative w-full", o.class]),
|
|
37
|
-
role: "navigation",
|
|
38
|
-
"aria-label": "Categories"
|
|
39
|
-
}, [
|
|
40
|
-
a("div", T, [
|
|
41
|
-
o.showAllItem ? (t(), l(v(x(C.value)), k({ key: 0 }, g(C.value), {
|
|
42
|
-
class: "shrink-0 px-3 py-1.5 text-sm font-medium rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",
|
|
43
|
-
onClick: D
|
|
44
|
-
}), {
|
|
45
|
-
default: p(() => [
|
|
46
|
-
E(m(o.allItemLabel), 1)
|
|
47
|
-
]),
|
|
48
|
-
_: 1
|
|
49
|
-
}, 16)) : i("", !0),
|
|
50
|
-
(t(!0), s(d, null, _(w.value, (e) => (t(), s(d, {
|
|
51
|
-
key: e.id
|
|
52
|
-
}, [
|
|
53
|
-
e.children && e.children.length > 0 ? (t(), l($(N), {
|
|
54
|
-
key: 0,
|
|
55
|
-
options: $(z)(e.children, o.routePrefix, [e]),
|
|
56
|
-
maxHeight: "500px",
|
|
57
|
-
"close-on-select": !0,
|
|
58
|
-
searchable: !1,
|
|
59
|
-
"show-selected-label": !1,
|
|
60
|
-
"show-selected-icon": !1,
|
|
61
|
-
selectable: !0,
|
|
62
|
-
placement: "bottom-start",
|
|
63
|
-
offset: [0, 6],
|
|
64
|
-
"menu-id": `cat-menu-tabs-${e.id}`,
|
|
65
|
-
"nested-position": "right-start",
|
|
66
|
-
"nested-offset": [0, -5],
|
|
67
|
-
trigger: "hover",
|
|
68
|
-
class: "shrink-0",
|
|
69
|
-
onOnSelect: I
|
|
70
|
-
}, {
|
|
71
|
-
trigger: p(({ isOpen: r }) => [
|
|
72
|
-
a("button", {
|
|
73
|
-
type: "button",
|
|
74
|
-
class: P([
|
|
75
|
-
"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md transition-colors",
|
|
76
|
-
y(e) || r ? "bg-primary/10 text-primary" : "text-muted-foreground hover:text-foreground hover:bg-accent"
|
|
77
|
-
])
|
|
78
|
-
}, [
|
|
79
|
-
o.showIcons && e.icon ? (t(), l(h, {
|
|
80
|
-
key: 0,
|
|
81
|
-
icon: e.icon,
|
|
82
|
-
class: "w-3.5 h-3.5 shrink-0"
|
|
83
|
-
}, null, 8, ["icon"])) : i("", !0),
|
|
84
|
-
a("span", F, m(e.title || e.name), 1),
|
|
85
|
-
e.children && e.children.length > 0 ? (t(), l(h, {
|
|
86
|
-
key: 1,
|
|
87
|
-
icon: "lucide:chevron-down",
|
|
88
|
-
class: "w-3 h-3 opacity-70 shrink-0"
|
|
89
|
-
})) : i("", !0)
|
|
90
|
-
], 2)
|
|
91
|
-
]),
|
|
92
|
-
_: 2
|
|
93
|
-
}, 1032, ["options", "menu-id"])) : (t(), l(v(x(u(e))), k({
|
|
94
|
-
key: 1,
|
|
95
|
-
ref_for: !0
|
|
96
|
-
}, g(u(e)), {
|
|
97
|
-
class: [
|
|
98
|
-
"shrink-0 inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md transition-colors",
|
|
99
|
-
y(e) ? "bg-primary/10 text-primary" : "text-muted-foreground hover:text-foreground hover:bg-accent"
|
|
100
|
-
],
|
|
101
|
-
onClick: (r) => f("select", e)
|
|
102
|
-
}), {
|
|
103
|
-
default: p(() => [
|
|
104
|
-
o.showIcons && e.icon ? (t(), l(h, {
|
|
105
|
-
key: 0,
|
|
106
|
-
icon: e.icon,
|
|
107
|
-
class: "w-3.5 h-3.5 shrink-0"
|
|
108
|
-
}, null, 8, ["icon"])) : i("", !0),
|
|
109
|
-
a("span", H, m(e.title || e.name), 1)
|
|
110
|
-
]),
|
|
111
|
-
_: 2
|
|
112
|
-
}, 1040, ["class", "onClick"]))
|
|
113
|
-
], 64))), 128))
|
|
114
|
-
]),
|
|
115
|
-
a("div", M, [
|
|
116
|
-
(t(!0), s(d, null, _(w.value, (e) => (t(), s(d, {
|
|
117
|
-
key: `m-${e.id}`
|
|
118
|
-
}, [
|
|
119
|
-
b.value === e.id && e.children ? (t(), s("div", j, [
|
|
120
|
-
(t(!0), s(d, null, _(e.children, (r) => (t(), l(v(x(u(r, [e]))), k({
|
|
121
|
-
key: r.id
|
|
122
|
-
}, { ref_for: !0 }, g(u(r, [e])), {
|
|
123
|
-
class: "w-full flex items-center gap-2 px-3 py-2 text-sm rounded-md text-foreground/90 hover:bg-accent text-left",
|
|
124
|
-
onClick: (G) => {
|
|
125
|
-
I({ value: r.id, option: { data: r } }), b.value = null;
|
|
126
|
-
}
|
|
127
|
-
}), {
|
|
128
|
-
default: p(() => [
|
|
129
|
-
o.showIcons && r.icon ? (t(), l(h, {
|
|
130
|
-
key: 0,
|
|
131
|
-
icon: r.icon,
|
|
132
|
-
class: "w-4 h-4 shrink-0 opacity-80"
|
|
133
|
-
}, null, 8, ["icon"])) : i("", !0),
|
|
134
|
-
a("span", q, m(r.title || r.name), 1)
|
|
135
|
-
]),
|
|
136
|
-
_: 2
|
|
137
|
-
}, 1040, ["onClick"]))), 128))
|
|
138
|
-
])) : i("", !0)
|
|
139
|
-
], 64))), 128))
|
|
140
|
-
])
|
|
141
|
-
], 2));
|
|
142
|
-
}
|
|
143
|
-
});
|
|
1
|
+
import o from "./CategoryMenuVariant1.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-4d803b88"]]);
|
|
144
5
|
export {
|
|
145
|
-
|
|
6
|
+
m as default
|
|
146
7
|
};
|
|
@@ -1,4 +1,222 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent as F, computed as D, ref as m, onMounted as H, nextTick as N, watch as q, openBlock as n, createElementBlock as a, normalizeClass as T, createElementVNode as s, createVNode as g, Transition as E, withCtx as u, createCommentVNode as i, createBlock as c, resolveDynamicComponent as C, mergeProps as S, createTextVNode as G, toDisplayString as v, Fragment as p, renderList as I, unref as O } from "vue";
|
|
2
|
+
import { useResizeObserver as W } from "@vueuse/core";
|
|
3
|
+
import J from "../Dropdown/Dropdown.vue.js";
|
|
4
|
+
import d from "../Icon.vue.js";
|
|
5
|
+
import "../../core/config.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
/* empty css */
|
|
8
|
+
/* empty css */
|
|
9
|
+
import { normalizeRoutePrefix as K, categoriesToDropdownOptions as Q, buildCategoryRoute as U } from "./utils.js";
|
|
10
|
+
const X = { class: "relative w-full max-w-full min-w-0 overflow-hidden flex items-center group" }, Y = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "absolute left-0 inset-y-0 z-10 flex items-center pointer-events-none"
|
|
13
|
+
}, Z = { class: "truncate max-w-[180px]" }, ee = { class: "truncate max-w-[180px]" }, te = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "absolute right-0 inset-y-0 z-10 flex items-center justify-end pointer-events-none"
|
|
16
|
+
}, oe = { class: "sm:hidden border-t border-border" }, ne = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "px-2 py-2 bg-muted/30"
|
|
19
|
+
}, le = { class: "flex-1 truncate" }, he = /* @__PURE__ */ F({
|
|
20
|
+
__name: "CategoryMenuVariant1",
|
|
21
|
+
props: {
|
|
22
|
+
items: {},
|
|
23
|
+
maxDepth: {},
|
|
24
|
+
showIcons: { type: Boolean },
|
|
25
|
+
showAllItem: { type: Boolean },
|
|
26
|
+
allItemLabel: {},
|
|
27
|
+
activeId: {},
|
|
28
|
+
routePrefix: {},
|
|
29
|
+
class: {},
|
|
30
|
+
menuStyles: {}
|
|
31
|
+
},
|
|
32
|
+
emits: ["select"],
|
|
33
|
+
setup(L, { emit: M }) {
|
|
34
|
+
const l = L, y = M, b = D(() => l.items || []), R = m(null), $ = D(() => K(l.routePrefix)), h = m(null), B = m(null), P = m(!1), z = m(!1), f = () => {
|
|
35
|
+
const t = h.value;
|
|
36
|
+
t && (P.value = t.scrollLeft > 2, z.value = t.scrollLeft + t.clientWidth < t.scrollWidth - 2);
|
|
37
|
+
}, V = (t) => {
|
|
38
|
+
const o = h.value;
|
|
39
|
+
if (!o) return;
|
|
40
|
+
const e = o.clientWidth * 0.6;
|
|
41
|
+
o.scrollBy({ left: t === "right" ? e : -e, behavior: "smooth" });
|
|
42
|
+
};
|
|
43
|
+
W(h, f), W(B, f), H(async () => {
|
|
44
|
+
await N(), f();
|
|
45
|
+
}), q(
|
|
46
|
+
() => b.value,
|
|
47
|
+
() => N(f),
|
|
48
|
+
{ deep: !0 }
|
|
49
|
+
);
|
|
50
|
+
const A = (t) => {
|
|
51
|
+
const o = t.option?.data;
|
|
52
|
+
y("select", o || t);
|
|
53
|
+
}, j = () => {
|
|
54
|
+
y("select", { id: "all", title: l.allItemLabel });
|
|
55
|
+
}, x = (t, o = []) => U(l.routePrefix, t, o), k = (t) => t ? "router-link" : "button", w = (t) => t ? { to: t } : { type: "button" }, _ = (t) => l.activeId ? t.id === l.activeId || (t.children || []).some((o) => _(o)) : !1;
|
|
56
|
+
return (t, o) => (n(), a("nav", {
|
|
57
|
+
class: T(["relative w-full max-w-full min-w-0 overflow-hidden", l.class]),
|
|
58
|
+
role: "navigation",
|
|
59
|
+
"aria-label": "Categories"
|
|
60
|
+
}, [
|
|
61
|
+
s("div", X, [
|
|
62
|
+
g(E, { name: "fade-x" }, {
|
|
63
|
+
default: u(() => [
|
|
64
|
+
P.value ? (n(), a("div", Y, [
|
|
65
|
+
o[2] || (o[2] = s("div", { class: "w-8 h-full bg-gradient-to-r from-background to-transparent" }, null, -1)),
|
|
66
|
+
s("button", {
|
|
67
|
+
type: "button",
|
|
68
|
+
class: "pointer-events-auto absolute left-0 bg-background h-full px-1 flex items-center text-muted-foreground hover:text-foreground transition-colors",
|
|
69
|
+
"aria-label": "Scroll left",
|
|
70
|
+
tabindex: "-1",
|
|
71
|
+
onClick: o[0] || (o[0] = (e) => V("left"))
|
|
72
|
+
}, [
|
|
73
|
+
g(d, {
|
|
74
|
+
icon: "lucide:chevron-left",
|
|
75
|
+
class: "w-4 h-4"
|
|
76
|
+
})
|
|
77
|
+
])
|
|
78
|
+
])) : i("", !0)
|
|
79
|
+
]),
|
|
80
|
+
_: 1
|
|
81
|
+
}),
|
|
82
|
+
s("div", {
|
|
83
|
+
ref_key: "scrollRef",
|
|
84
|
+
ref: h,
|
|
85
|
+
class: "flex-1 min-w-0 max-w-full overflow-x-auto category-tabs-no-scrollbar scroll-smooth",
|
|
86
|
+
style: { "will-change": "transform", contain: "layout style" },
|
|
87
|
+
onScroll: f
|
|
88
|
+
}, [
|
|
89
|
+
s("div", {
|
|
90
|
+
ref_key: "scrollContentRef",
|
|
91
|
+
ref: B,
|
|
92
|
+
class: "flex w-max min-w-full items-center gap-1 py-2 px-1"
|
|
93
|
+
}, [
|
|
94
|
+
l.showAllItem ? (n(), c(C(k($.value)), S({ key: 0 }, w($.value), {
|
|
95
|
+
class: "shrink-0 px-3 py-1.5 text-sm font-medium rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",
|
|
96
|
+
onClick: j
|
|
97
|
+
}), {
|
|
98
|
+
default: u(() => [
|
|
99
|
+
G(v(l.allItemLabel), 1)
|
|
100
|
+
]),
|
|
101
|
+
_: 1
|
|
102
|
+
}, 16)) : i("", !0),
|
|
103
|
+
(n(!0), a(p, null, I(b.value, (e) => (n(), a(p, {
|
|
104
|
+
key: e.id
|
|
105
|
+
}, [
|
|
106
|
+
e.children && e.children.length > 0 ? (n(), c(O(J), {
|
|
107
|
+
key: 0,
|
|
108
|
+
options: O(Q)(e.children, l.routePrefix, [e]),
|
|
109
|
+
maxHeight: "500px",
|
|
110
|
+
"close-on-select": !0,
|
|
111
|
+
searchable: !1,
|
|
112
|
+
"show-selected-label": !1,
|
|
113
|
+
"show-selected-icon": !1,
|
|
114
|
+
menuStyles: L.menuStyles,
|
|
115
|
+
selectable: !0,
|
|
116
|
+
placement: "bottom-start",
|
|
117
|
+
offset: [0, 6],
|
|
118
|
+
"menu-id": `cat-menu-tabs-${e.id}`,
|
|
119
|
+
"nested-position": "right-start",
|
|
120
|
+
"nested-offset": [0, -5],
|
|
121
|
+
trigger: "hover",
|
|
122
|
+
class: "shrink-0",
|
|
123
|
+
onOnSelect: A
|
|
124
|
+
}, {
|
|
125
|
+
trigger: u(({ isOpen: r }) => [
|
|
126
|
+
s("button", {
|
|
127
|
+
type: "button",
|
|
128
|
+
class: T([
|
|
129
|
+
"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md transition-colors",
|
|
130
|
+
_(e) || r ? "bg-primary/10 text-primary" : "text-muted-foreground hover:text-foreground hover:bg-accent"
|
|
131
|
+
])
|
|
132
|
+
}, [
|
|
133
|
+
l.showIcons && e.icon ? (n(), c(d, {
|
|
134
|
+
key: 0,
|
|
135
|
+
icon: e.icon,
|
|
136
|
+
class: "w-3.5 h-3.5 shrink-0"
|
|
137
|
+
}, null, 8, ["icon"])) : i("", !0),
|
|
138
|
+
s("span", Z, v(e.title || e.name), 1),
|
|
139
|
+
e.children && e.children.length > 0 ? (n(), c(d, {
|
|
140
|
+
key: 1,
|
|
141
|
+
icon: "lucide:chevron-down",
|
|
142
|
+
class: "w-3 h-3 opacity-70 shrink-0"
|
|
143
|
+
})) : i("", !0)
|
|
144
|
+
], 2)
|
|
145
|
+
]),
|
|
146
|
+
_: 2
|
|
147
|
+
}, 1032, ["options", "menuStyles", "menu-id"])) : (n(), c(C(k(x(e))), S({
|
|
148
|
+
key: 1,
|
|
149
|
+
ref_for: !0
|
|
150
|
+
}, w(x(e)), {
|
|
151
|
+
class: [
|
|
152
|
+
"shrink-0 inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md transition-colors",
|
|
153
|
+
_(e) ? "bg-primary/10 text-primary" : "text-muted-foreground hover:text-foreground hover:bg-accent"
|
|
154
|
+
],
|
|
155
|
+
onClick: (r) => y("select", e)
|
|
156
|
+
}), {
|
|
157
|
+
default: u(() => [
|
|
158
|
+
l.showIcons && e.icon ? (n(), c(d, {
|
|
159
|
+
key: 0,
|
|
160
|
+
icon: e.icon,
|
|
161
|
+
class: "w-3.5 h-3.5 shrink-0"
|
|
162
|
+
}, null, 8, ["icon"])) : i("", !0),
|
|
163
|
+
s("span", ee, v(e.title || e.name), 1)
|
|
164
|
+
]),
|
|
165
|
+
_: 2
|
|
166
|
+
}, 1040, ["class", "onClick"]))
|
|
167
|
+
], 64))), 128))
|
|
168
|
+
], 512)
|
|
169
|
+
], 544),
|
|
170
|
+
g(E, { name: "fade-x" }, {
|
|
171
|
+
default: u(() => [
|
|
172
|
+
z.value ? (n(), a("div", te, [
|
|
173
|
+
o[3] || (o[3] = s("div", { class: "w-8 h-full bg-gradient-to-l from-background to-transparent" }, null, -1)),
|
|
174
|
+
s("button", {
|
|
175
|
+
type: "button",
|
|
176
|
+
class: "pointer-events-auto absolute right-0 h-full px-1 flex items-center text-muted-foreground hover:text-foreground transition-colors bg-background",
|
|
177
|
+
"aria-label": "Scroll right",
|
|
178
|
+
tabindex: "-1",
|
|
179
|
+
onClick: o[1] || (o[1] = (e) => V("right"))
|
|
180
|
+
}, [
|
|
181
|
+
g(d, {
|
|
182
|
+
icon: "lucide:chevron-right",
|
|
183
|
+
class: "w-4 h-4"
|
|
184
|
+
})
|
|
185
|
+
])
|
|
186
|
+
])) : i("", !0)
|
|
187
|
+
]),
|
|
188
|
+
_: 1
|
|
189
|
+
})
|
|
190
|
+
]),
|
|
191
|
+
s("div", oe, [
|
|
192
|
+
(n(!0), a(p, null, I(b.value, (e) => (n(), a(p, {
|
|
193
|
+
key: `m-${e.id}`
|
|
194
|
+
}, [
|
|
195
|
+
R.value === e.id && e.children ? (n(), a("div", ne, [
|
|
196
|
+
(n(!0), a(p, null, I(e.children, (r) => (n(), c(C(k(x(r, [e]))), S({
|
|
197
|
+
key: r.id
|
|
198
|
+
}, { ref_for: !0 }, w(x(r, [e])), {
|
|
199
|
+
class: "w-full flex items-center gap-2 px-3 py-2 text-sm rounded-md text-foreground/90 hover:bg-accent text-left",
|
|
200
|
+
onClick: (re) => {
|
|
201
|
+
A({ value: r.id, option: { data: r } }), R.value = null;
|
|
202
|
+
}
|
|
203
|
+
}), {
|
|
204
|
+
default: u(() => [
|
|
205
|
+
l.showIcons && r.icon ? (n(), c(d, {
|
|
206
|
+
key: 0,
|
|
207
|
+
icon: r.icon,
|
|
208
|
+
class: "w-4 h-4 shrink-0 opacity-80"
|
|
209
|
+
}, null, 8, ["icon"])) : i("", !0),
|
|
210
|
+
s("span", le, v(r.title || r.name), 1)
|
|
211
|
+
]),
|
|
212
|
+
_: 2
|
|
213
|
+
}, 1040, ["onClick"]))), 128))
|
|
214
|
+
])) : i("", !0)
|
|
215
|
+
], 64))), 128))
|
|
216
|
+
])
|
|
217
|
+
], 2));
|
|
218
|
+
}
|
|
219
|
+
});
|
|
2
220
|
export {
|
|
3
|
-
|
|
221
|
+
he as default
|
|
4
222
|
};
|
|
@@ -9,10 +9,14 @@ interface Props {
|
|
|
9
9
|
activeId: string | number | null | undefined;
|
|
10
10
|
routePrefix?: string;
|
|
11
11
|
class?: string;
|
|
12
|
+
menuStyles?: object;
|
|
12
13
|
}
|
|
13
14
|
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
14
15
|
select: (item: import('../CategoryManager').CategoryItem) => any;
|
|
15
16
|
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
16
17
|
onSelect?: (item: import('../CategoryManager').CategoryItem) => any;
|
|
17
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
18
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
19
|
+
scrollRef: HTMLDivElement;
|
|
20
|
+
scrollContentRef: HTMLDivElement;
|
|
21
|
+
}, HTMLElement>;
|
|
18
22
|
export default _default;
|