vlite3 1.4.1 → 1.4.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/components/AppShell/AppShell.vue.d.ts +1 -0
- package/components/AppShell/AppShell.vue.js +33 -26
- package/components/AppShell/AppShellLayoutStorefront.vue.d.ts +54 -0
- package/components/AppShell/AppShellLayoutStorefront.vue.js +222 -0
- package/components/AppShell/AppShellLayoutStorefront.vue2.js +4 -0
- package/components/AsyncSelect/createAsyncSelect.js +3 -2
- package/components/CategoryManager/CategoryManager.vue2.js +4 -3
- package/components/CategoryMenu/CategoryMenu.vue.d.ts +22 -0
- package/components/CategoryMenu/CategoryMenu.vue.js +106 -0
- package/components/CategoryMenu/CategoryMenu.vue2.js +4 -0
- package/components/CategoryMenu/CategoryMenuVariant1.vue.d.ts +17 -0
- package/components/CategoryMenu/CategoryMenuVariant1.vue.js +146 -0
- package/components/CategoryMenu/CategoryMenuVariant1.vue2.js +4 -0
- package/components/CategoryMenu/CategoryMenuVariant2.vue.d.ts +18 -0
- package/components/CategoryMenu/CategoryMenuVariant2.vue.js +162 -0
- package/components/CategoryMenu/CategoryMenuVariant2.vue2.js +4 -0
- package/components/CategoryMenu/index.d.ts +2 -0
- package/components/CategoryMenu/types.d.ts +32 -0
- package/components/CategoryMenu/utils.d.ts +16 -0
- package/components/CategoryMenu/utils.js +45 -0
- package/components/ColorPicker/ColorIro.vue3.js +2 -2
- package/components/ColorPicker/ColorPicker.vue.d.ts +7 -3
- package/components/ColorPicker/ColorPicker.vue.js +60 -46
- package/components/CommandPalette/CommandPaletteContent.vue2.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem.vue2.js → CommandPaletteItem.vue.js} +1 -1
- package/components/DatePicker.vue.js +5 -4
- package/components/DateRangePicker.vue.js +3 -2
- package/components/Dropdown/Dropdown.vue.d.ts +4 -1
- package/components/Dropdown/Dropdown.vue.js +8 -7
- package/components/Dropdown/DropdownGroupedLayout.vue2.js +5 -2
- package/components/Dropdown/DropdownGroupedLayout.vue3.js +111 -0
- package/components/Dropdown/DropdownItem.vue.d.ts +2 -2
- package/components/Dropdown/DropdownItem.vue.js +66 -49
- package/components/Dropdown/DropdownMenu.vue.js +1 -1
- package/components/Dropdown/{DropdownMenu.vue2.js → DropdownMenu.vue3.js} +40 -40
- package/components/Dropdown/composables/useDropdownHydration.d.ts +4 -0
- package/components/Dropdown/composables/useDropdownNavigation.js +30 -18
- package/components/Form/FormField.vue.js +14 -11
- package/components/IconPicker.vue.js +3 -2
- package/components/ImportData/ImportStep2.vue.js +3 -2
- package/components/MultiSelect/composables/useMultiSelectHydration.d.ts +4 -0
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/PermissionMatrix/PermissionTopBar.vue.js +3 -2
- package/components/Screen/ScreenFilter.vue.js +20 -19
- package/components/SidebarMenu/SidebarMenuItem.vue.js +3 -2
- package/components/Switch.vue.js +8 -8
- package/components/Tooltip.vue.js +1 -0
- package/components/Workbook/Sheet.vue.js +14 -13
- package/components/index.d.ts +1 -0
- package/index.d.ts +1 -0
- package/index.js +153 -151
- package/package.json +2 -2
- package/style.css +1 -1
- package/types/appshell.type.d.ts +2 -1
- package/types/styles.d.ts +2 -0
- package/components/Dropdown/DropdownGroupedLayout.vue.js +0 -75
- /package/components/ColorPicker/{ColorIro.vue2.js → ColorIro.vue.js} +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as p, computed as m, openBlock as w, createBlock as $, unref as D, withCtx as h, createElementVNode as z, createVNode as g, renderSlot as L, mergeProps as x } from "vue";
|
|
2
2
|
import P from "./Button.vue.js";
|
|
3
3
|
import B from "./Dropdown/Dropdown.vue.js";
|
|
4
4
|
import "@iconify/vue";
|
|
5
5
|
import { $t as V } from "../utils/i18n.js";
|
|
6
6
|
/* empty css */
|
|
7
|
+
/* empty css */
|
|
7
8
|
/* empty css */
|
|
8
9
|
import U, { TimePicker as j } from "v-datepicker-lite";
|
|
9
10
|
import "v-datepicker-lite/style.css";
|
|
10
|
-
const C = { class: "overflow-hidden min-w-[300px]" },
|
|
11
|
+
const C = { class: "overflow-hidden min-w-[300px]" }, J = /* @__PURE__ */ p({
|
|
11
12
|
__name: "DatePicker",
|
|
12
13
|
props: {
|
|
13
14
|
placeholder: {},
|
|
@@ -160,7 +161,7 @@ const C = { class: "overflow-hidden min-w-[300px]" }, G = /* @__PURE__ */ z({
|
|
|
160
161
|
])
|
|
161
162
|
]),
|
|
162
163
|
default: h(() => [
|
|
163
|
-
|
|
164
|
+
z("div", C, [
|
|
164
165
|
g(D(U), {
|
|
165
166
|
value: T.value,
|
|
166
167
|
mode: t.mode,
|
|
@@ -211,5 +212,5 @@ const C = { class: "overflow-hidden min-w-[300px]" }, G = /* @__PURE__ */ z({
|
|
|
211
212
|
}
|
|
212
213
|
});
|
|
213
214
|
export {
|
|
214
|
-
|
|
215
|
+
J as default
|
|
215
216
|
};
|
|
@@ -3,6 +3,7 @@ import E from "./Dropdown/Dropdown.vue.js";
|
|
|
3
3
|
import R from "./Icon.vue.js";
|
|
4
4
|
import { $t as l } from "../utils/i18n.js";
|
|
5
5
|
/* empty css */
|
|
6
|
+
/* empty css */
|
|
6
7
|
/* empty css */
|
|
7
8
|
import P from "./Button.vue.js";
|
|
8
9
|
import p from "v-datepicker-lite";
|
|
@@ -10,7 +11,7 @@ import "v-datepicker-lite/style.css";
|
|
|
10
11
|
const j = { class: "flex items-center justify-start gap-2 w-full" }, H = { class: "flex flex-col sm:flex-row bg-background rounded-md" }, Q = {
|
|
11
12
|
key: 0,
|
|
12
13
|
class: "flex flex-col gap-1 sm:pr-3 py-2 sm:border-r border-border max-h-[280px]"
|
|
13
|
-
}, O = { class: "flex flex-col sm:flex-row items-center gap-4 py-2 p-3" }, I = { class: "border border-border rounded-md overflow-hidden bg-background" }, U = { class: "flex items-center justify-center shrink-0" }, q = { class: "border border-border rounded-md overflow-hidden bg-background" },
|
|
14
|
+
}, O = { class: "flex flex-col sm:flex-row items-center gap-4 py-2 p-3" }, I = { class: "border border-border rounded-md overflow-hidden bg-background" }, U = { class: "flex items-center justify-center shrink-0" }, q = { class: "border border-border rounded-md overflow-hidden bg-background" }, le = /* @__PURE__ */ $({
|
|
14
15
|
__name: "DateRangePicker",
|
|
15
16
|
props: {
|
|
16
17
|
modelValue: {},
|
|
@@ -236,5 +237,5 @@ const j = { class: "flex items-center justify-start gap-2 w-full" }, H = { class
|
|
|
236
237
|
}
|
|
237
238
|
});
|
|
238
239
|
export {
|
|
239
|
-
|
|
240
|
+
le as default
|
|
240
241
|
};
|
|
@@ -41,6 +41,7 @@ type __VLS_Props = {
|
|
|
41
41
|
disabled?: boolean;
|
|
42
42
|
readonly?: boolean;
|
|
43
43
|
variant?: 'default' | 'transparent' | 'secondary';
|
|
44
|
+
trigger?: import('v-tooltip-lite/types').TooltTipTrigger;
|
|
44
45
|
};
|
|
45
46
|
declare function __VLS_template(): {
|
|
46
47
|
attrs: Partial<{}>;
|
|
@@ -48,7 +49,7 @@ declare function __VLS_template(): {
|
|
|
48
49
|
trigger?(_: {
|
|
49
50
|
selectedLabel: string;
|
|
50
51
|
selectedIcon: string;
|
|
51
|
-
isOpen:
|
|
52
|
+
isOpen: any;
|
|
52
53
|
}): any;
|
|
53
54
|
menu?(_: {}): any;
|
|
54
55
|
default?(_: {}): any;
|
|
@@ -92,12 +93,14 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
|
|
|
92
93
|
onOnOpen?: () => any;
|
|
93
94
|
"onUpdate:isOpen"?: (value: boolean) => any;
|
|
94
95
|
}>, {
|
|
96
|
+
width: string;
|
|
95
97
|
variant: "default" | "transparent" | "secondary";
|
|
96
98
|
columns: number | string;
|
|
97
99
|
loading: boolean;
|
|
98
100
|
readonly: boolean;
|
|
99
101
|
disabled: boolean;
|
|
100
102
|
layout: "default" | "grouped";
|
|
103
|
+
trigger: import('v-tooltip-lite/types').TooltTipTrigger;
|
|
101
104
|
direction: "ltr" | "rtl";
|
|
102
105
|
selectable: boolean;
|
|
103
106
|
options: (IDropdownOption | string | number)[];
|
|
@@ -26,8 +26,8 @@ const He = /* @__PURE__ */ ae({
|
|
|
26
26
|
teleport: { type: Boolean, default: !0 },
|
|
27
27
|
selectedIndex: { default: null },
|
|
28
28
|
maxHeight: { default: "300px" },
|
|
29
|
-
width: {},
|
|
30
|
-
minWidth: { default: "
|
|
29
|
+
width: { default: "min-content" },
|
|
30
|
+
minWidth: { default: "140px" },
|
|
31
31
|
ignoreClickOutside: {},
|
|
32
32
|
menuId: {},
|
|
33
33
|
nestedPosition: {},
|
|
@@ -49,7 +49,8 @@ const He = /* @__PURE__ */ ae({
|
|
|
49
49
|
isNested: { type: Boolean, default: !1 },
|
|
50
50
|
disabled: { type: Boolean, default: !1 },
|
|
51
51
|
readonly: { type: Boolean, default: !1 },
|
|
52
|
-
variant: { default: "default" }
|
|
52
|
+
variant: { default: "default" },
|
|
53
|
+
trigger: { default: "click" }
|
|
53
54
|
},
|
|
54
55
|
emits: ["onSelect", "update:modelValue", "onOpen", "onClose", "update:isOpen", "load-more", "search"],
|
|
55
56
|
setup(t, { emit: U }) {
|
|
@@ -189,7 +190,7 @@ const He = /* @__PURE__ */ ae({
|
|
|
189
190
|
}, [
|
|
190
191
|
N(u(be), {
|
|
191
192
|
content: "",
|
|
192
|
-
trigger:
|
|
193
|
+
trigger: t.trigger,
|
|
193
194
|
arrow: !1,
|
|
194
195
|
disabled: t.disabled || t.readonly,
|
|
195
196
|
teleport: t.teleport,
|
|
@@ -199,12 +200,12 @@ const He = /* @__PURE__ */ ae({
|
|
|
199
200
|
keepAlive: C.value > 0,
|
|
200
201
|
menuId: I.value,
|
|
201
202
|
ignoreClickOutside: te.value,
|
|
202
|
-
class: "w-full",
|
|
203
|
+
class: "w-full flex!",
|
|
203
204
|
className: "dropdown " + (t.className || "") + (t.variant === "transparent" ? " unstyled-dropdown" : "") + (t.variant === "secondary" ? " dropdown-secondary" : ""),
|
|
204
205
|
onOnShow: o[2] || (o[2] = (n) => e.$emit("onOpen")),
|
|
205
206
|
onOnHide: o[3] || (o[3] = (n) => e.$emit("onClose")),
|
|
206
207
|
"onUpdate:isOpen": A,
|
|
207
|
-
triggerClass: "w-full",
|
|
208
|
+
triggerClass: "w-full flex items-center",
|
|
208
209
|
styles: {
|
|
209
210
|
padding: "0",
|
|
210
211
|
...t.width ? { width: t.width, maxWidth: t.width } : {},
|
|
@@ -290,7 +291,7 @@ const He = /* @__PURE__ */ ae({
|
|
|
290
291
|
]), 1032, ["options", "cachedOptions", "class", "emptyMessage", "searchEmptyMessage", "selected", "selectedIndex", "maxHeight", "nestedPosition", "nestedOffset", "selectable", "direction", "isCustomSlotMenu", "layout", "columns", "loading", "hasMore", "searchable", "remote", "debounceTime"])) : ye("", !0)
|
|
291
292
|
]),
|
|
292
293
|
_: 3
|
|
293
|
-
}, 8, ["disabled", "teleport", "offset", "placement", "isOpen", "keepAlive", "menuId", "ignoreClickOutside", "className", "styles"]),
|
|
294
|
+
}, 8, ["trigger", "disabled", "teleport", "offset", "placement", "isOpen", "keepAlive", "menuId", "ignoreClickOutside", "className", "styles"]),
|
|
294
295
|
N(we, {
|
|
295
296
|
show: b.value,
|
|
296
297
|
title: r.value.title,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from "./DropdownGroupedLayout.vue3.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import r from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-512aa158"]]);
|
|
2
5
|
export {
|
|
3
|
-
|
|
6
|
+
m as default
|
|
4
7
|
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { defineComponent as B, computed as S, openBlock as l, createElementBlock as n, normalizeStyle as D, Fragment as i, renderList as u, createBlock as m, resolveDynamicComponent as E, mergeProps as L, withCtx as N, createElementVNode as y, normalizeClass as x, createCommentVNode as d, toDisplayString as k, createVNode as V } from "vue";
|
|
2
|
+
import h from "../Icon.vue.js";
|
|
3
|
+
import v from "./DropdownItem.vue.js";
|
|
4
|
+
import { $t as z } from "../../utils/i18n.js";
|
|
5
|
+
const A = { class: "flex items-center gap-2" }, G = { class: "font-semibold text-sm text-foreground" }, I = {
|
|
6
|
+
key: 2,
|
|
7
|
+
class: "flex flex-col space-y-0.5"
|
|
8
|
+
}, P = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "flex flex-col space-y-0.5 ml-3 pl-3 border-l border-border mt-0.5 mb-1.5"
|
|
11
|
+
}, J = /* @__PURE__ */ B({
|
|
12
|
+
__name: "DropdownGroupedLayout",
|
|
13
|
+
props: {
|
|
14
|
+
options: { default: () => [] },
|
|
15
|
+
selected: {},
|
|
16
|
+
selectable: { type: Boolean, default: !0 },
|
|
17
|
+
columns: { default: 3 },
|
|
18
|
+
itemsClass: {},
|
|
19
|
+
headerClass: {}
|
|
20
|
+
},
|
|
21
|
+
emits: ["select", "mouseenter"],
|
|
22
|
+
setup(o, { emit: T }) {
|
|
23
|
+
const s = o, C = S(() => {
|
|
24
|
+
const e = s.columns;
|
|
25
|
+
return typeof e == "number" ? { "--mega-cols": e } : { gridTemplateColumns: e };
|
|
26
|
+
}), a = (e) => s.selected ? Array.isArray(s.selected) ? s.selected.includes(e.value) : typeof s.selected == "object" && s.selected !== null && e.key && e.key in s.selected ? s.selected[e.key] === e.value : s.selected === e.value : !1, b = (e) => e.labelI18n ? z(e.labelI18n) : e.label, p = (e) => e.to ? "router-link" : e.href ? "a" : "button", j = (e) => {
|
|
27
|
+
if (e.to) return { to: e.to };
|
|
28
|
+
if (e.href) {
|
|
29
|
+
const f = e.href.startsWith("http") || e.href.startsWith("//");
|
|
30
|
+
return {
|
|
31
|
+
href: e.href,
|
|
32
|
+
target: f ? "_blank" : void 0,
|
|
33
|
+
rel: f ? "noopener noreferrer" : void 0
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return { type: "button" };
|
|
37
|
+
};
|
|
38
|
+
return (e, f) => (l(), n("div", {
|
|
39
|
+
class: "mega-menu-grid p-2 gap-6",
|
|
40
|
+
style: D(C.value)
|
|
41
|
+
}, [
|
|
42
|
+
(l(!0), n(i, null, u(o.options, (t, $) => (l(), n("div", {
|
|
43
|
+
key: t.key || t.value || $,
|
|
44
|
+
class: "flex flex-col space-y-1"
|
|
45
|
+
}, [
|
|
46
|
+
o.selectable !== !1 && t.disabled !== !0 ? (l(), m(E(p(t)), L({
|
|
47
|
+
key: 0,
|
|
48
|
+
ref_for: !0
|
|
49
|
+
}, j(t), {
|
|
50
|
+
class: ["flex items-center px-2 py-1.5 mb-1 w-full text-left transition-colors group/header", [
|
|
51
|
+
o.headerClass,
|
|
52
|
+
a(t) ? "text-primary" : ""
|
|
53
|
+
]],
|
|
54
|
+
onClick: (r) => e.$emit("select", t)
|
|
55
|
+
}), {
|
|
56
|
+
default: N(() => [
|
|
57
|
+
y("div", A, [
|
|
58
|
+
t.icon || t.emoji ? (l(), m(h, {
|
|
59
|
+
key: 0,
|
|
60
|
+
icon: t.icon,
|
|
61
|
+
emoji: t.emoji,
|
|
62
|
+
class: x(["w-4 h-4 opacity-80", a(t) ? "text-primary" : "text-muted-foreground group-hover/header:text-primary"])
|
|
63
|
+
}, null, 8, ["icon", "emoji", "class"])) : d("", !0),
|
|
64
|
+
y("span", {
|
|
65
|
+
class: x(["font-semibold text-sm transition-colors", a(t) ? "text-primary" : "text-foreground group-hover/header:text-primary"])
|
|
66
|
+
}, k(b(t)), 3)
|
|
67
|
+
])
|
|
68
|
+
]),
|
|
69
|
+
_: 2
|
|
70
|
+
}, 1040, ["class", "onClick"])) : (l(), n("div", {
|
|
71
|
+
key: 1,
|
|
72
|
+
class: x(["flex items-center gap-2 px-2 py-1.5 mb-1", o.headerClass])
|
|
73
|
+
}, [
|
|
74
|
+
t.icon || t.emoji ? (l(), m(h, {
|
|
75
|
+
key: 0,
|
|
76
|
+
icon: t.icon,
|
|
77
|
+
emoji: t.emoji,
|
|
78
|
+
class: "w-4 h-4 text-muted-foreground"
|
|
79
|
+
}, null, 8, ["icon", "emoji"])) : d("", !0),
|
|
80
|
+
y("span", G, k(b(t)), 1)
|
|
81
|
+
], 2)),
|
|
82
|
+
t.children && t.children.length ? (l(), n("div", I, [
|
|
83
|
+
(l(!0), n(i, null, u(t.children, (r, _) => (l(), n(i, {
|
|
84
|
+
key: r.key || r.value || _
|
|
85
|
+
}, [
|
|
86
|
+
V(v, {
|
|
87
|
+
option: r,
|
|
88
|
+
selected: a(r),
|
|
89
|
+
selectable: o.selectable,
|
|
90
|
+
class: "w-full text-sm text-muted-foreground hover:text-foreground font-medium",
|
|
91
|
+
onClick: (c) => e.$emit("select", r)
|
|
92
|
+
}, null, 8, ["option", "selected", "selectable", "onClick"]),
|
|
93
|
+
r.children && r.children.length ? (l(), n("div", P, [
|
|
94
|
+
(l(!0), n(i, null, u(r.children, (c, w) => (l(), m(v, {
|
|
95
|
+
key: c.key || c.value || w,
|
|
96
|
+
option: c,
|
|
97
|
+
selected: a(c),
|
|
98
|
+
selectable: o.selectable,
|
|
99
|
+
class: "w-full text-xs text-muted-foreground hover:text-foreground",
|
|
100
|
+
onClick: (W) => e.$emit("select", c)
|
|
101
|
+
}, null, 8, ["option", "selected", "selectable", "onClick"]))), 128))
|
|
102
|
+
])) : d("", !0)
|
|
103
|
+
], 64))), 128))
|
|
104
|
+
])) : d("", !0)
|
|
105
|
+
]))), 128))
|
|
106
|
+
], 4));
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
export {
|
|
110
|
+
J as default
|
|
111
|
+
};
|
|
@@ -16,7 +16,7 @@ declare function __VLS_template(): {
|
|
|
16
16
|
}): any;
|
|
17
17
|
};
|
|
18
18
|
refs: {};
|
|
19
|
-
rootEl:
|
|
19
|
+
rootEl: any;
|
|
20
20
|
};
|
|
21
21
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
22
22
|
declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
@@ -25,7 +25,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
|
|
|
25
25
|
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
26
26
|
onClick?: (option: IDropdownOption) => any;
|
|
27
27
|
onMouseenter?: (index: number) => any;
|
|
28
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {},
|
|
28
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
29
29
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
30
30
|
export default _default;
|
|
31
31
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { $t as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as $, computed as n, openBlock as i, createBlock as l, resolveDynamicComponent as C, mergeProps as I, withKeys as B, withCtx as D, renderSlot as j, normalizeProps as E, guardReactiveProps as P, createCommentVNode as a, createElementVNode as r, toDisplayString as s, createElementBlock as b } from "vue";
|
|
2
|
+
import h from "../Icon.vue.js";
|
|
3
|
+
import { $t as c } from "../../utils/i18n.js";
|
|
4
|
+
const S = { class: "flex flex-col flex-1 min-w-0" }, z = { class: "flex items-center justify-between gap-2" }, K = { class: "truncate font-medium" }, L = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "text-xs text-muted-foreground whitespace-nowrap opacity-90"
|
|
7
|
-
},
|
|
7
|
+
}, N = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "text-[10px] text-muted-foreground truncate opacity-70"
|
|
10
|
-
},
|
|
10
|
+
}, T = /* @__PURE__ */ $({
|
|
11
11
|
__name: "DropdownItem",
|
|
12
12
|
props: {
|
|
13
13
|
option: {},
|
|
@@ -17,52 +17,69 @@ const j = ["tabindex", "data-disabled", "data-testid"], C = { class: "flex flex-
|
|
|
17
17
|
index: {}
|
|
18
18
|
},
|
|
19
19
|
emits: ["click", "mouseenter"],
|
|
20
|
-
setup(
|
|
21
|
-
const
|
|
22
|
-
() =>
|
|
23
|
-
),
|
|
24
|
-
() =>
|
|
25
|
-
),
|
|
26
|
-
() =>
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
setup(t, { emit: v }) {
|
|
21
|
+
const e = t, d = v, x = n(
|
|
22
|
+
() => e.option.labelI18n ? c(e.option.labelI18n) : e.option.label
|
|
23
|
+
), u = n(
|
|
24
|
+
() => e.option.subtitleI18n ? c(e.option.subtitleI18n) : e.option.subtitle
|
|
25
|
+
), p = n(
|
|
26
|
+
() => e.option.descriptionI18n ? c(e.option.descriptionI18n) : e.option.description
|
|
27
|
+
), m = n(
|
|
28
|
+
() => e.option.href && (e.option.href.startsWith("http") || e.option.href.startsWith("//"))
|
|
29
|
+
), y = n(() => e.option.to ? "router-link" : e.option.href ? "a" : "div"), k = n(() => e.option.to ? { to: e.option.to } : e.option.href ? {
|
|
30
|
+
href: e.option.href,
|
|
31
|
+
target: m.value ? "_blank" : void 0,
|
|
32
|
+
rel: m.value ? "noopener noreferrer" : void 0
|
|
33
|
+
} : {}), g = (o) => {
|
|
34
|
+
if (e.option.disabled) {
|
|
35
|
+
o.preventDefault();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
d("click", e.option);
|
|
39
|
+
}, w = (o) => {
|
|
40
|
+
e.option.to || e.option.href || (o.preventDefault(), d("click", e.option));
|
|
41
|
+
};
|
|
42
|
+
return (o, f) => (i(), l(C(y.value), I(k.value, {
|
|
43
|
+
tabindex: t.option.disabled ? -1 : 0,
|
|
30
44
|
"data-dropdown-item": "",
|
|
31
|
-
class:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
]]
|
|
37
|
-
"data-disabled":
|
|
38
|
-
"data-testid":
|
|
39
|
-
onClick:
|
|
40
|
-
onKeydown:
|
|
41
|
-
onMouseenter:
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
class: ["relative w-full flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus-visible:bg-accent focus-visible:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50", [
|
|
46
|
+
t.selectable && t.selected && !t.option.children ? "bg-accent" : "",
|
|
47
|
+
t.focused ? "bg-accent text-accent-foreground" : "hover:bg-accent hover:text-accent-foreground",
|
|
48
|
+
t.option.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
|
|
49
|
+
t.option.class || ""
|
|
50
|
+
]],
|
|
51
|
+
"data-disabled": t.option.disabled ? !0 : void 0,
|
|
52
|
+
"data-testid": o.$attrs["data-testid"] || (t.option.value ? `dropdown-item-${t.option.value}` : `dropdown-item-${t.option.label}`).toString().toLowerCase().replace(/[^a-z0-9]+/g, "-"),
|
|
53
|
+
onClick: g,
|
|
54
|
+
onKeydown: B(w, ["enter"]),
|
|
55
|
+
onMouseenter: f[0] || (f[0] = (V) => o.$emit("mouseenter", t.index ?? -1))
|
|
56
|
+
}), {
|
|
57
|
+
default: D(() => [
|
|
58
|
+
j(o.$slots, "default", E(P({ option: t.option, index: t.index, selected: t.selected })), () => [
|
|
59
|
+
t.option.icon || t.option.emoji ? (i(), l(h, {
|
|
60
|
+
key: 0,
|
|
61
|
+
icon: t.option.icon,
|
|
62
|
+
emoji: t.option.emoji,
|
|
63
|
+
class: "mr-2.5 h-4 w-4 shrink-0 mt-0.5"
|
|
64
|
+
}, null, 8, ["icon", "emoji"])) : a("", !0),
|
|
65
|
+
r("div", S, [
|
|
66
|
+
r("div", z, [
|
|
67
|
+
r("span", K, s(x.value), 1),
|
|
68
|
+
u.value ? (i(), b("span", L, s(u.value), 1)) : a("", !0)
|
|
69
|
+
]),
|
|
70
|
+
p.value ? (i(), b("span", N, s(p.value), 1)) : a("", !0)
|
|
54
71
|
]),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
72
|
+
t.selectable && t.selected ? (i(), l(h, {
|
|
73
|
+
key: 1,
|
|
74
|
+
icon: "lucide:check",
|
|
75
|
+
class: "ml-2 h-4 w-4 shrink-0 text-primary"
|
|
76
|
+
})) : a("", !0)
|
|
77
|
+
])
|
|
78
|
+
]),
|
|
79
|
+
_: 3
|
|
80
|
+
}, 16, ["tabindex", "class", "data-disabled", "data-testid"]));
|
|
64
81
|
}
|
|
65
82
|
});
|
|
66
83
|
export {
|
|
67
|
-
|
|
84
|
+
T as default
|
|
68
85
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as ee, ref as j, computed as g, watch as T, onMounted as te, onBeforeUnmount as le, openBlock as o, createElementBlock as
|
|
1
|
+
import { defineComponent as ee, ref as j, computed as g, watch as T, onMounted as te, onBeforeUnmount as le, openBlock as o, createElementBlock as i, createVNode as O, createCommentVNode as f, renderSlot as k, unref as r, normalizeStyle as se, normalizeClass as E, createElementVNode as w, toDisplayString as N, createBlock as h, Fragment as D, renderList as oe, withCtx as P, createSlots as ne, mergeProps as re, nextTick as ae } from "vue";
|
|
2
2
|
import p from "../Icon.vue.js";
|
|
3
|
-
import
|
|
3
|
+
import de from "../Input.vue.js";
|
|
4
4
|
/* empty css */
|
|
5
|
-
import
|
|
5
|
+
import ie from "./DropdownItem.vue.js";
|
|
6
6
|
import ce from "./DropdownBooleanItem.vue.js";
|
|
7
|
-
import ue from "./DropdownGroupedLayout.
|
|
7
|
+
import ue from "./DropdownGroupedLayout.vue2.js";
|
|
8
8
|
import { useDropdownNavigation as fe } from "./composables/useDropdownNavigation.js";
|
|
9
9
|
import { useDropdownIds as me } from "./composables/useDropdownIds.js";
|
|
10
10
|
import { $t as $ } from "../../utils/i18n.js";
|
|
@@ -27,7 +27,7 @@ const ve = ["dir"], ye = {
|
|
|
27
27
|
}, Oe = {
|
|
28
28
|
key: 3,
|
|
29
29
|
class: "shrink-0 rounded-b-md overflow-hidden"
|
|
30
|
-
},
|
|
30
|
+
}, Ve = /* @__PURE__ */ ee({
|
|
31
31
|
__name: "DropdownMenu",
|
|
32
32
|
props: {
|
|
33
33
|
options: { default: () => [] },
|
|
@@ -52,19 +52,19 @@ const ve = ["dir"], ye = {
|
|
|
52
52
|
searchEmptyMessage: {}
|
|
53
53
|
},
|
|
54
54
|
emits: ["select", "close", "load-more", "search"],
|
|
55
|
-
setup(a, { emit:
|
|
56
|
-
const t = a, m =
|
|
57
|
-
if (
|
|
55
|
+
setup(a, { emit: V }) {
|
|
56
|
+
const t = a, m = V, B = j(null), d = j(""), { getMenuId: z, getAllRecursiveIds: H } = me(), L = g(() => {
|
|
57
|
+
if (d.value && d.value.trim() !== "")
|
|
58
58
|
return t.searchEmptyMessage ? t.searchEmptyMessage : `No results found for
|
|
59
|
-
"${
|
|
59
|
+
"${d.value}"`;
|
|
60
60
|
const e = $("vlite.dropdown.empty");
|
|
61
61
|
return e !== "vlite.dropdown.empty" ? e : t.emptyMessage;
|
|
62
62
|
}), R = g(() => {
|
|
63
63
|
const e = $("vlite.dropdown.search");
|
|
64
64
|
return e !== "vlite.dropdown.search" ? e : "Search...";
|
|
65
|
-
}), u = g(() => t.options ? t.options.map((e) => typeof e == "string" || typeof e == "number" ? { label: String(e), value: String(e) } : e) : []),
|
|
65
|
+
}), u = g(() => t.options ? t.options.map((e) => typeof e == "string" || typeof e == "number" ? { label: String(e), value: String(e) } : e) : []), C = g(() => t.searchable ? d.value && d.value.trim() !== "" ? !0 : t.remote ? t.loading ? !0 : t.hasMore || (u.value.length || 0) > 5 : (u.value.length || 0) > 5 : !1);
|
|
66
66
|
let v = null;
|
|
67
|
-
T(
|
|
67
|
+
T(d, (e) => {
|
|
68
68
|
t.remote && (v && clearTimeout(v), v = setTimeout(() => {
|
|
69
69
|
e !== void 0 && m("search", e);
|
|
70
70
|
}, t.debounceTime));
|
|
@@ -78,20 +78,20 @@ const ve = ["dir"], ye = {
|
|
|
78
78
|
focusedIndex: b,
|
|
79
79
|
isKeyboardMode: M,
|
|
80
80
|
filteredOptions: F,
|
|
81
|
-
handleKeyDown:
|
|
82
|
-
handleMouseMove:
|
|
81
|
+
handleKeyDown: I,
|
|
82
|
+
handleMouseMove: _,
|
|
83
83
|
onMouseEnterItem: S,
|
|
84
84
|
scrollToIndex: K
|
|
85
85
|
} = fe({
|
|
86
86
|
options: u,
|
|
87
|
-
searchQuery:
|
|
88
|
-
containerRef:
|
|
87
|
+
searchQuery: d,
|
|
88
|
+
containerRef: B,
|
|
89
89
|
emit: (e, ...s) => m(e, ...s),
|
|
90
90
|
handleSelect: (e, s) => x(e)
|
|
91
|
-
}), y = g(() => t.remote ?
|
|
91
|
+
}), y = g(() => t.remote ? d.value ? u.value : t.cachedOptions.length ? t.cachedOptions : u.value : F.value), U = (e) => {
|
|
92
92
|
if (!(!t.selected || typeof t.selected != "object") && e.key && e.key in t.selected)
|
|
93
93
|
return t.selected[e.key];
|
|
94
|
-
},
|
|
94
|
+
}, G = (e) => e.disabled ? !1 : Array.isArray(t.selected) ? t.selected.includes(e.value) : t.selected && typeof t.selected == "object" && e.key ? t.selected[e.key] === e.value : t.selected === e.value, q = (e) => !e.key || !t.selected || typeof t.selected != "object" ? !1 : !!t.selected[e.key], J = (e, s) => {
|
|
95
95
|
if (!s.key) return;
|
|
96
96
|
const l = {
|
|
97
97
|
label: s.label,
|
|
@@ -125,19 +125,19 @@ const ve = ["dir"], ye = {
|
|
|
125
125
|
b.value = -1;
|
|
126
126
|
}
|
|
127
127
|
), te(() => {
|
|
128
|
-
W(), window.addEventListener("keydown",
|
|
128
|
+
W(), window.addEventListener("keydown", I);
|
|
129
129
|
}), le(() => {
|
|
130
|
-
window.removeEventListener("keydown",
|
|
130
|
+
window.removeEventListener("keydown", I), v && clearTimeout(v), d.value && t.remote && m("search", "");
|
|
131
131
|
});
|
|
132
132
|
const X = (e) => e.labelI18n ? $(e.labelI18n) : e.label, Y = (e) => e.showChevron !== !1;
|
|
133
|
-
return (e, s) => (o(),
|
|
133
|
+
return (e, s) => (o(), i("div", {
|
|
134
134
|
class: "dropdown-menu w-full flex flex-col",
|
|
135
135
|
dir: a.direction
|
|
136
136
|
}, [
|
|
137
|
-
|
|
138
|
-
O(
|
|
139
|
-
modelValue:
|
|
140
|
-
"onUpdate:modelValue": s[0] || (s[0] = (l) =>
|
|
137
|
+
C.value ? (o(), i("div", ye, [
|
|
138
|
+
O(de, {
|
|
139
|
+
modelValue: d.value,
|
|
140
|
+
"onUpdate:modelValue": s[0] || (s[0] = (l) => d.value = l),
|
|
141
141
|
placeholder: R.value,
|
|
142
142
|
icon: "lucide:search",
|
|
143
143
|
size: "sm",
|
|
@@ -150,14 +150,14 @@ const ve = ["dir"], ye = {
|
|
|
150
150
|
"data-testid": "dropdown-search-input"
|
|
151
151
|
}, null, 8, ["modelValue", "placeholder"])
|
|
152
152
|
])) : f("", !0),
|
|
153
|
-
e.$slots.header ? (o(),
|
|
153
|
+
e.$slots.header ? (o(), i("div", ge, [
|
|
154
154
|
k(e.$slots, "header", {}, void 0, !0)
|
|
155
155
|
])) : f("", !0),
|
|
156
|
-
u.value.length > 0 || y.value.length === 0 ? (o(),
|
|
156
|
+
u.value.length > 0 || y.value.length === 0 ? (o(), i("div", {
|
|
157
157
|
key: 2,
|
|
158
158
|
ref_key: "containerRef",
|
|
159
|
-
ref:
|
|
160
|
-
tabindex:
|
|
159
|
+
ref: B,
|
|
160
|
+
tabindex: C.value ? -1 : 0,
|
|
161
161
|
role: "menu",
|
|
162
162
|
class: E([
|
|
163
163
|
"w-full p-1 space-y-0.5 overflow-y-auto overflow-x-hidden focus:outline-none flex-1 scrollbar-thin",
|
|
@@ -165,10 +165,10 @@ const ve = ["dir"], ye = {
|
|
|
165
165
|
]),
|
|
166
166
|
style: se({ maxHeight: t.maxHeight }),
|
|
167
167
|
onMousemove: s[1] || (s[1] = //@ts-ignore
|
|
168
|
-
(...l) => r(
|
|
168
|
+
(...l) => r(_) && r(_)(...l)),
|
|
169
169
|
onScroll: A
|
|
170
170
|
}, [
|
|
171
|
-
!a.isCustomSlotMenu && y.value.length === 0 && !a.loading && !(u.value.length === 0 && e.$slots.menu) ? (o(),
|
|
171
|
+
!a.isCustomSlotMenu && y.value.length === 0 && !a.loading && !(u.value.length === 0 && e.$slots.menu) ? (o(), i("div", ke, [
|
|
172
172
|
O(p, {
|
|
173
173
|
icon: "lucide:inbox",
|
|
174
174
|
class: "w-8 h-8 mb-2 opacity-70"
|
|
@@ -182,11 +182,11 @@ const ve = ["dir"], ye = {
|
|
|
182
182
|
selectable: a.selectable,
|
|
183
183
|
columns: a.columns,
|
|
184
184
|
onSelect: x
|
|
185
|
-
}, null, 8, ["options", "selected", "selectable", "columns"])) : (o(!0),
|
|
186
|
-
l.label === "---" ? (o(),
|
|
185
|
+
}, null, 8, ["options", "selected", "selectable", "columns"])) : (o(!0), i(D, { key: 2 }, oe(y.value, (l, n) => (o(), i(D, { key: n }, [
|
|
186
|
+
l.label === "---" ? (o(), i("div", we)) : l.data?.isBoolean ? (o(), h(ce, {
|
|
187
187
|
key: 1,
|
|
188
188
|
option: l,
|
|
189
|
-
value:
|
|
189
|
+
value: q(l),
|
|
190
190
|
focused: r(M) && r(b) === n,
|
|
191
191
|
onChange: J,
|
|
192
192
|
onMouseenter: (c) => r(S)(n)
|
|
@@ -206,7 +206,7 @@ const ve = ["dir"], ye = {
|
|
|
206
206
|
direction: a.direction,
|
|
207
207
|
onOnSelect: (c) => Q(l, c)
|
|
208
208
|
}, {
|
|
209
|
-
trigger:
|
|
209
|
+
trigger: P(() => [
|
|
210
210
|
w("div", {
|
|
211
211
|
tabindex: 0,
|
|
212
212
|
"data-dropdown-item": "",
|
|
@@ -234,11 +234,11 @@ const ve = ["dir"], ye = {
|
|
|
234
234
|
], 42, pe)
|
|
235
235
|
]),
|
|
236
236
|
_: 2
|
|
237
|
-
}, 1032, ["position", "offset", "options", "selected", "menuId", "nestedPosition", "nestedOffset", "selectable", "ignoreClickOutside", "direction", "onOnSelect"])) : (o(), h(
|
|
237
|
+
}, 1032, ["position", "offset", "options", "selected", "menuId", "nestedPosition", "nestedOffset", "selectable", "ignoreClickOutside", "direction", "onOnSelect"])) : (o(), h(ie, {
|
|
238
238
|
key: 3,
|
|
239
239
|
option: l,
|
|
240
240
|
index: n,
|
|
241
|
-
selected:
|
|
241
|
+
selected: G(l),
|
|
242
242
|
focused: r(M) && r(b) === n,
|
|
243
243
|
selectable: a.selectable,
|
|
244
244
|
onClick: (c) => x(l),
|
|
@@ -246,14 +246,14 @@ const ve = ["dir"], ye = {
|
|
|
246
246
|
}, ne({ _: 2 }, [
|
|
247
247
|
e.$slots.item ? {
|
|
248
248
|
name: "default",
|
|
249
|
-
fn:
|
|
249
|
+
fn: P((c) => [
|
|
250
250
|
k(e.$slots, "item", re({ ref_for: !0 }, c), void 0, !0)
|
|
251
251
|
]),
|
|
252
252
|
key: "0"
|
|
253
253
|
} : void 0
|
|
254
254
|
]), 1032, ["option", "index", "selected", "focused", "selectable", "onClick", "onMouseenter"]))
|
|
255
255
|
], 64))), 128)),
|
|
256
|
-
a.loading ? (o(),
|
|
256
|
+
a.loading ? (o(), i("div", Se, [
|
|
257
257
|
O(p, {
|
|
258
258
|
icon: "lucide:loader-2",
|
|
259
259
|
class: "w-4 h-4 animate-spin text-muted-foreground"
|
|
@@ -261,12 +261,12 @@ const ve = ["dir"], ye = {
|
|
|
261
261
|
])) : f("", !0),
|
|
262
262
|
k(e.$slots, "menu", {}, void 0, !0)
|
|
263
263
|
], 46, be)) : f("", !0),
|
|
264
|
-
e.$slots.footer ? (o(),
|
|
264
|
+
e.$slots.footer ? (o(), i("div", Oe, [
|
|
265
265
|
k(e.$slots, "footer", {}, void 0, !0)
|
|
266
266
|
])) : f("", !0)
|
|
267
267
|
], 8, ve));
|
|
268
268
|
}
|
|
269
269
|
});
|
|
270
270
|
export {
|
|
271
|
-
|
|
271
|
+
Ve as default
|
|
272
272
|
};
|