lkt-menu 1.0.6 → 1.0.8
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/dist/build.d.ts +11 -11
- package/dist/build.js +102 -96
- package/dist/lib-components/LktMenu.vue.d.ts +2 -0
- package/dist/settings/Settings.d.ts +2 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/MenuItem.vue +11 -10
- package/src/lib-components/LktMenu.vue +8 -4
package/dist/build.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare class
|
|
1
|
+
declare class x {
|
|
2
2
|
constructor(t: any, s: any, d: any);
|
|
3
3
|
key: any;
|
|
4
4
|
href: any;
|
|
@@ -17,7 +17,7 @@ declare class W {
|
|
|
17
17
|
setIcon(t: any): this;
|
|
18
18
|
doClose(): void;
|
|
19
19
|
}
|
|
20
|
-
declare function
|
|
20
|
+
declare function pe(n: any, t: any, s: any): {
|
|
21
21
|
key: any;
|
|
22
22
|
href: any;
|
|
23
23
|
label: any;
|
|
@@ -25,18 +25,18 @@ declare function me(n: any, t: any, s: any): {
|
|
|
25
25
|
isOpened: boolean;
|
|
26
26
|
isActive: boolean;
|
|
27
27
|
children: any[];
|
|
28
|
-
setChildren: (t: any) =>
|
|
29
|
-
setOnClick: (t: any) =>
|
|
28
|
+
setChildren: (t: any) => x;
|
|
29
|
+
setOnClick: (t: any) => x;
|
|
30
30
|
onClick: any;
|
|
31
|
-
setIsActiveChecker: (t: any) =>
|
|
31
|
+
setIsActiveChecker: (t: any) => x;
|
|
32
32
|
isActiveChecker: any;
|
|
33
|
-
setIsActive: (t?: boolean) =>
|
|
34
|
-
setLabel: (t: any) =>
|
|
35
|
-
setIcon: (t: any) =>
|
|
33
|
+
setIsActive: (t?: boolean) => x;
|
|
34
|
+
setLabel: (t: any) => x;
|
|
35
|
+
setIcon: (t: any) => x;
|
|
36
36
|
doClose: () => void;
|
|
37
37
|
};
|
|
38
|
-
declare namespace
|
|
38
|
+
declare namespace ke {
|
|
39
39
|
function install(n: any): void;
|
|
40
40
|
}
|
|
41
|
-
declare function
|
|
42
|
-
export {
|
|
41
|
+
declare function fe(n: any): boolean;
|
|
42
|
+
export { x as MenuEntry, pe as createMenuEntry, ke as default, fe as setMenuToggleSlot };
|
package/dist/build.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { __ as
|
|
3
|
-
import { useRouter as
|
|
4
|
-
class
|
|
1
|
+
import { defineComponent as K, ref as w, useSlots as N, computed as o, watch as V, onMounted as H, resolveComponent as D, openBlock as u, createElementBlock as c, normalizeClass as _, createElementVNode as m, createVNode as J, withCtx as $, unref as P, renderSlot as L, createCommentVNode as C, toDisplayString as Q, createBlock as R, resolveDynamicComponent as X, withDirectives as Y, Fragment as T, renderList as b, createSlots as W, vShow as Z, reactive as ee } from "vue";
|
|
2
|
+
import { __ as te } from "lkt-i18n";
|
|
3
|
+
import { useRouter as le } from "vue-router";
|
|
4
|
+
class x {
|
|
5
5
|
constructor(t, s, d) {
|
|
6
6
|
this.key = "", this.href = "", this.label = "", this.icon = "", this.onClick = void 0, this.isActiveChecker = void 0, this.isOpened = !1, this.isActive = !1, this.parent = void 0, this.children = [], this.key = t, this.href = s, this.label = d;
|
|
7
7
|
}
|
|
@@ -27,159 +27,165 @@ class W {
|
|
|
27
27
|
this.isOpened = !1;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
const
|
|
31
|
-
n.includes(s.key) || n.push(s.key), s.children.length > 0 &&
|
|
30
|
+
const U = (n, t) => (t.forEach((s) => {
|
|
31
|
+
n.includes(s.key) || n.push(s.key), s.children.length > 0 && U(n, s.children);
|
|
32
32
|
}), n), A = class A {
|
|
33
33
|
};
|
|
34
34
|
A.toggleSlot = "", A.debugEnabled = !1;
|
|
35
|
-
let
|
|
36
|
-
const
|
|
35
|
+
let k = A;
|
|
36
|
+
const ne = { class: "lkt-menu-entry-main" }, se = { class: "lkt-entry-content" }, ue = {
|
|
37
37
|
key: 0,
|
|
38
38
|
class: "lkt-menu-entry-icon"
|
|
39
|
-
},
|
|
39
|
+
}, ie = {
|
|
40
40
|
key: 1,
|
|
41
41
|
class: "lkt-menu-entry-text"
|
|
42
|
-
},
|
|
43
|
-
key: 0,
|
|
44
|
-
class: "lkt-menu-entry-children"
|
|
45
|
-
}, ue = /* @__PURE__ */ B({
|
|
42
|
+
}, oe = { class: "lkt-menu-entry-children" }, re = /* @__PURE__ */ K({
|
|
46
43
|
__name: "MenuItem",
|
|
47
44
|
props: {
|
|
48
|
-
modelValue: { default: () => new
|
|
45
|
+
modelValue: { default: () => new x("", "", "") }
|
|
49
46
|
},
|
|
50
47
|
emits: ["update:modelValue"],
|
|
51
48
|
setup(n, { emit: t }) {
|
|
52
|
-
const s = t, d = n, e =
|
|
49
|
+
const s = t, d = n, e = w(d.modelValue), r = N(), S = le(), p = w(!1), f = () => {
|
|
53
50
|
e.value.isOpened = !e.value.isOpened;
|
|
54
|
-
},
|
|
51
|
+
}, i = () => (e.value.children.length > 0 && f(), typeof e.value.onClick == "function" && e.value.onClick({
|
|
55
52
|
entry: e.value
|
|
56
|
-
}), 1),
|
|
53
|
+
}), 1), v = o(() => r["icon-" + e.value.key] || e.value.icon !== ""), O = o(() => {
|
|
57
54
|
let l = [];
|
|
58
|
-
return
|
|
59
|
-
}),
|
|
55
|
+
return v.value && l.push("has-icon"), p.value && l.push("is-active"), l.join(" ");
|
|
56
|
+
}), y = o(() => U([], e.value.children)), h = o(() => {
|
|
60
57
|
let l = [];
|
|
61
|
-
for (let
|
|
62
|
-
|
|
58
|
+
for (let a in r)
|
|
59
|
+
a.startsWith("icon-") && y.value.includes(a.substring(5)) && l.push(a);
|
|
63
60
|
return l;
|
|
64
|
-
}), j =
|
|
61
|
+
}), j = o(() => e.value.label.startsWith("__:") ? te(e.value.label.substring(3)) : e.value.label), z = o(() => e.value.isActive ? !0 : typeof e.value.isActiveChecker == "function" ? !!e.value.isActiveChecker({
|
|
65
62
|
entry: e.value
|
|
66
|
-
}) : !1),
|
|
67
|
-
|
|
63
|
+
}) : !1), F = o(() => !!k.toggleSlot), q = o(() => k.toggleSlot);
|
|
64
|
+
V(() => d.modelValue, (l) => {
|
|
68
65
|
e.value = l;
|
|
69
|
-
}, { deep: !0 }),
|
|
66
|
+
}, { deep: !0 }), V(e, (l) => {
|
|
70
67
|
s("update:modelValue", l);
|
|
71
|
-
}, { deep: !0 }),
|
|
72
|
-
let l =
|
|
68
|
+
}, { deep: !0 }), H(() => {
|
|
69
|
+
let l = S.currentRoute;
|
|
73
70
|
if (l.value.path === e.value.href)
|
|
74
71
|
e.value.isOpened = !0;
|
|
75
72
|
else if (e.value.children.length > 0) {
|
|
76
|
-
let
|
|
77
|
-
e.value.children.forEach((
|
|
78
|
-
l.value.path ===
|
|
79
|
-
}),
|
|
73
|
+
let a = !1;
|
|
74
|
+
e.value.children.forEach((I) => {
|
|
75
|
+
l.value.path === I.href && (a = !0);
|
|
76
|
+
}), a && (e.value.isOpened = !0);
|
|
80
77
|
}
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
});
|
|
79
|
+
const E = o(() => e.value.isOpened);
|
|
80
|
+
return (l, a) => {
|
|
81
|
+
const I = D("lkt-anchor"), G = D("menu-item", !0);
|
|
82
|
+
return u(), c("div", {
|
|
83
|
+
class: _(["lkt-menu-entry", O.value])
|
|
85
84
|
}, [
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
m("div", ne, [
|
|
86
|
+
J(I, {
|
|
88
87
|
to: e.value.href,
|
|
89
|
-
"on-click":
|
|
90
|
-
"is-active":
|
|
91
|
-
onActive:
|
|
88
|
+
"on-click": i,
|
|
89
|
+
"is-active": z.value,
|
|
90
|
+
onActive: a[0] || (a[0] = (B) => p.value = B)
|
|
92
91
|
}, {
|
|
93
|
-
default:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
default: $(() => [
|
|
93
|
+
m("div", se, [
|
|
94
|
+
v.value ? (u(), c("div", ue, [
|
|
95
|
+
P(r)["icon-" + e.value.key] ? L(l.$slots, "icon-" + e.value.key, {
|
|
97
96
|
key: e.value.key,
|
|
98
97
|
entry: e.value
|
|
99
|
-
}) : e.value.icon !== "" ? (u(),
|
|
98
|
+
}) : e.value.icon !== "" ? (u(), c("i", {
|
|
100
99
|
key: 1,
|
|
101
|
-
class:
|
|
102
|
-
}, null, 2)) :
|
|
103
|
-
])) :
|
|
104
|
-
e.value.label !== "" ? (u(),
|
|
100
|
+
class: _(e.value.icon)
|
|
101
|
+
}, null, 2)) : C("", !0)
|
|
102
|
+
])) : C("", !0),
|
|
103
|
+
e.value.label !== "" ? (u(), c("div", ie, Q(j.value), 1)) : C("", !0)
|
|
105
104
|
])
|
|
106
105
|
]),
|
|
107
106
|
_: 3
|
|
108
107
|
}, 8, ["to", "is-active"]),
|
|
109
|
-
e.value.children.length > 0 ? (u(),
|
|
108
|
+
e.value.children.length > 0 ? (u(), c("div", {
|
|
110
109
|
key: 0,
|
|
111
110
|
class: "lkt-menu-entry-toggle",
|
|
112
|
-
onClick:
|
|
111
|
+
onClick: f
|
|
113
112
|
}, [
|
|
114
|
-
|
|
113
|
+
F.value ? (u(), R(X(q.value), {
|
|
115
114
|
key: 0,
|
|
116
|
-
class:
|
|
117
|
-
}, null, 8, ["class"])) : (u(),
|
|
115
|
+
class: _(["lkt-menu-entry-toggle-inner", E.value ? "is-opened" : ""])
|
|
116
|
+
}, null, 8, ["class"])) : (u(), c("div", {
|
|
118
117
|
key: 1,
|
|
119
|
-
class:
|
|
118
|
+
class: _(["lkt-menu-entry-toggle-inner lkt-menu-entry-toggle-triangle", E.value ? "is-opened" : ""])
|
|
120
119
|
}, null, 2))
|
|
121
|
-
])) :
|
|
120
|
+
])) : C("", !0)
|
|
122
121
|
]),
|
|
123
|
-
|
|
124
|
-
(u(!0),
|
|
125
|
-
modelValue: e.value.children[
|
|
126
|
-
"onUpdate:modelValue": (
|
|
127
|
-
key:
|
|
128
|
-
},
|
|
129
|
-
b(
|
|
130
|
-
name:
|
|
131
|
-
fn:
|
|
132
|
-
|
|
122
|
+
Y(m("div", oe, [
|
|
123
|
+
(u(!0), c(T, null, b(e.value.children, (B, M) => (u(), R(G, {
|
|
124
|
+
modelValue: e.value.children[M],
|
|
125
|
+
"onUpdate:modelValue": (g) => e.value.children[M] = g,
|
|
126
|
+
key: e.value.children[M].key
|
|
127
|
+
}, W({ _: 2 }, [
|
|
128
|
+
b(h.value, (g) => ({
|
|
129
|
+
name: g,
|
|
130
|
+
fn: $(() => [
|
|
131
|
+
L(l.$slots, g)
|
|
133
132
|
])
|
|
134
133
|
}))
|
|
135
134
|
]), 1032, ["modelValue", "onUpdate:modelValue"]))), 128))
|
|
136
|
-
])
|
|
135
|
+
], 512), [
|
|
136
|
+
[Z, E.value]
|
|
137
|
+
])
|
|
137
138
|
], 2);
|
|
138
139
|
};
|
|
139
140
|
}
|
|
140
|
-
}),
|
|
141
|
+
}), ae = { class: "lkt-menu-container" }, ce = { class: "lkt-menu" }, de = /* @__PURE__ */ K({
|
|
141
142
|
__name: "LktMenu",
|
|
142
143
|
props: {
|
|
143
144
|
modelValue: { default: () => [] }
|
|
144
145
|
},
|
|
145
|
-
emits: ["update:modelValue"],
|
|
146
|
+
emits: ["update:modelValue", "click-outside"],
|
|
146
147
|
setup(n, { emit: t }) {
|
|
147
|
-
const s = n, d = t, e =
|
|
148
|
-
let
|
|
148
|
+
const s = n, d = t, e = N(), r = w(s.modelValue), S = o(() => U([], r.value)), p = o(() => {
|
|
149
|
+
let i = [];
|
|
149
150
|
for (let v in e)
|
|
150
|
-
v.startsWith("icon-") &&
|
|
151
|
-
return
|
|
152
|
-
})
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}, { deep: !0 }), (
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
151
|
+
v.startsWith("icon-") && S.value.includes(v.substring(5)) && i.push(v);
|
|
152
|
+
return i;
|
|
153
|
+
}), f = () => {
|
|
154
|
+
d("click-outside");
|
|
155
|
+
};
|
|
156
|
+
return V(() => s.modelValue, (i) => {
|
|
157
|
+
r.value = i;
|
|
158
|
+
}, { deep: !0 }), V(r, (i) => {
|
|
159
|
+
d("update:modelValue", i);
|
|
160
|
+
}, { deep: !0 }), (i, v) => (u(), c("div", ae, [
|
|
161
|
+
m("div", ce, [
|
|
162
|
+
(u(!0), c(T, null, b(r.value, (O, y) => (u(), R(re, {
|
|
163
|
+
modelValue: r.value[y],
|
|
164
|
+
"onUpdate:modelValue": (h) => r.value[y] = h,
|
|
165
|
+
key: O.key
|
|
166
|
+
}, W({ _: 2 }, [
|
|
167
|
+
b(p.value, (h) => ({
|
|
165
168
|
name: h,
|
|
166
|
-
fn:
|
|
167
|
-
|
|
169
|
+
fn: $(() => [
|
|
170
|
+
L(i.$slots, h)
|
|
168
171
|
])
|
|
169
172
|
}))
|
|
170
173
|
]), 1032, ["modelValue", "onUpdate:modelValue"]))), 128))
|
|
171
174
|
]),
|
|
172
|
-
|
|
175
|
+
m("div", {
|
|
176
|
+
class: "lkt-menu-outside",
|
|
177
|
+
onClick: f
|
|
178
|
+
})
|
|
173
179
|
]));
|
|
174
180
|
}
|
|
175
|
-
}),
|
|
181
|
+
}), ke = {
|
|
176
182
|
install: (n) => {
|
|
177
|
-
n.component("lkt-menu") === void 0 && n.component("lkt-menu",
|
|
183
|
+
n.component("lkt-menu") === void 0 && n.component("lkt-menu", de);
|
|
178
184
|
}
|
|
179
|
-
},
|
|
185
|
+
}, pe = (n, t, s) => ee(new x(n, t, s)), fe = (n) => (k.toggleSlot = n, !0);
|
|
180
186
|
export {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
187
|
+
x as MenuEntry,
|
|
188
|
+
pe as createMenuEntry,
|
|
189
|
+
ke as default,
|
|
190
|
+
fe as setMenuToggleSlot
|
|
185
191
|
};
|
|
@@ -5,12 +5,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
5
5
|
modelValue: () => never[];
|
|
6
6
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
7
|
"update:modelValue": (...args: any[]) => void;
|
|
8
|
+
"click-outside": (...args: any[]) => void;
|
|
8
9
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
9
10
|
modelValue?: MenuEntry[] | undefined;
|
|
10
11
|
}>, {
|
|
11
12
|
modelValue: () => never[];
|
|
12
13
|
}>>> & {
|
|
13
14
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
15
|
+
"onClick-outside"?: ((...args: any[]) => any) | undefined;
|
|
14
16
|
}, {
|
|
15
17
|
modelValue: MenuEntry[];
|
|
16
18
|
}, {}>, Partial<Record<any, (_: {}) => any>>>;
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.lkt-menu{background:var(--lkt-menu-bg);padding:var(--lkt-menu-padding);max-width:var(--lkt-menu-max-width);width:var(--lkt-menu-width);height:100%;display:flex;flex-direction:column;align-items:stretch;gap:var(--lkt-menu-gap-entries)}.lkt-menu-entry-toggle-inner{transition:all linear .2s}.lkt-menu-entry-toggle-inner.is-opened{transform:rotate(180deg)}.lkt-menu-entry-toggle-triangle{width:0;height:0;border-style:solid;border-width:10px 10px 0 10px;border-color:var(--lkt-menu-color-toggle) transparent transparent transparent;transform:rotate(0);transition:all linear .2s}.lkt-entry-content{display:inline-flex;flex-direction:row;gap:var(--lkt-menu-gap)}.lkt-menu-entry-toggle{display:inline-flex;flex-direction:row;align-items:center;justify-content:center}.lkt-menu-entry{padding:var(--lkt-menu-padding-entry)}.lkt-menu-entry .lkt-anchor{width:100%}.lkt-menu-entry-main{display:flex;justify-content:space-between}.lkt-entry-content{font-size:var(--lkt-menu-font-size);width:100%}.lkt-menu-outside{position:fixed;top:64px;right:0;left:0;bottom:0;background:var(--lkt-menu-bg-outside);z-index:-1}.lkt-menu-entry-children{padding:var(--lkt-menu-padding-children)}.lkt-menu-entry-text{padding:var(--lkt-menu-padding-text-without-icon)}.lkt-menu.has-icon .lkt-menu-entry-text{padding:var(--lkt-menu-padding-text)}.lkt-menu.has-icon .lkt-menu-entry-icon+.lkt-menu-entry-text{padding:var(--lkt-menu-padding-text-with-icon)}
|
|
1
|
+
.lkt-menu{background:var(--lkt-menu-bg);padding:var(--lkt-menu-padding);max-width:var(--lkt-menu-max-width);width:var(--lkt-menu-width);height:100%;display:flex;flex-direction:column;align-items:stretch;gap:var(--lkt-menu-gap-entries)}.lkt-menu-entry-toggle-inner{transition:all linear .2s}.lkt-menu-entry-toggle-inner.is-opened{transform:rotate(180deg)}.lkt-menu-entry-toggle-triangle{width:0;height:0;border-style:solid;border-width:10px 10px 0 10px;border-color:var(--lkt-menu-color-toggle) transparent transparent transparent;transform:rotate(0);transition:all linear .2s}.lkt-entry-content{display:inline-flex;flex-direction:row;gap:var(--lkt-menu-gap)}.lkt-menu-entry-toggle{display:inline-flex;flex-direction:row;align-items:center;justify-content:center}.lkt-menu-entry{padding:var(--lkt-menu-padding-entry)}.lkt-menu-entry .lkt-anchor{width:100%}.lkt-menu-entry-main{display:flex;justify-content:space-between;position:relative}.lkt-entry-content{font-size:var(--lkt-menu-font-size);width:100%}.lkt-menu-outside{position:fixed;top:64px;right:0;left:0;bottom:0;background:var(--lkt-menu-bg-outside);z-index:-1}.lkt-menu-entry-children{padding:var(--lkt-menu-padding-children)}.lkt-menu-entry-text{padding:var(--lkt-menu-padding-text-without-icon)}.lkt-menu.has-icon .lkt-menu-entry-text{padding:var(--lkt-menu-padding-text)}.lkt-menu.has-icon .lkt-menu-entry-icon+.lkt-menu-entry-text{padding:var(--lkt-menu-padding-text-with-icon)}
|
package/package.json
CHANGED
|
@@ -98,6 +98,7 @@ onMounted(() => {
|
|
|
98
98
|
let currentRoute = router.currentRoute;
|
|
99
99
|
if (currentRoute.value.path === entry.value.href) {
|
|
100
100
|
entry.value.isOpened = true;
|
|
101
|
+
|
|
101
102
|
} else if (entry.value.children.length > 0) {
|
|
102
103
|
let opened = false;
|
|
103
104
|
entry.value.children.forEach((child) => {
|
|
@@ -106,6 +107,10 @@ onMounted(() => {
|
|
|
106
107
|
|
|
107
108
|
if (opened) entry.value.isOpened = true;
|
|
108
109
|
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
const isOpened = computed(() => {
|
|
113
|
+
return entry.value.isOpened;
|
|
109
114
|
})
|
|
110
115
|
</script>
|
|
111
116
|
|
|
@@ -116,7 +121,7 @@ onMounted(() => {
|
|
|
116
121
|
:to="entry.href"
|
|
117
122
|
:on-click="onClick"
|
|
118
123
|
:is-active="computedIsActive"
|
|
119
|
-
@active="isActive = $e"
|
|
124
|
+
@active="($e: any) => isActive = $e"
|
|
120
125
|
>
|
|
121
126
|
<div class="lkt-entry-content">
|
|
122
127
|
<div class="lkt-menu-entry-icon" v-if="canRenderIcon">
|
|
@@ -137,21 +142,17 @@ onMounted(() => {
|
|
|
137
142
|
|
|
138
143
|
<div class="lkt-menu-entry-toggle" v-if="entry.children.length > 0" @click="onClickToggle">
|
|
139
144
|
<template v-if="hasToggleSlot">
|
|
140
|
-
<component :is="toggleSlot" class="lkt-menu-entry-toggle-inner" :class="
|
|
145
|
+
<component :is="toggleSlot" class="lkt-menu-entry-toggle-inner" :class="isOpened ? 'is-opened' : '' "/>
|
|
141
146
|
</template>
|
|
142
|
-
<div v-else class="lkt-menu-entry-toggle-inner lkt-menu-entry-toggle-triangle" :class="
|
|
147
|
+
<div v-else class="lkt-menu-entry-toggle-inner lkt-menu-entry-toggle-triangle" :class="isOpened ? 'is-opened' : '' "/>
|
|
143
148
|
</div>
|
|
144
149
|
</div>
|
|
145
|
-
<div class="lkt-menu-entry-children" v-
|
|
146
|
-
<menu-item v-for="(child, i) in entry.children" v-model="entry.children[i]" :key="
|
|
150
|
+
<div class="lkt-menu-entry-children" v-show="isOpened">
|
|
151
|
+
<menu-item v-for="(child, i) in entry.children" v-model="entry.children[i]" :key="entry.children[i].key">
|
|
147
152
|
<template v-for="slot in entryIconSlots" v-slot:[slot]>
|
|
148
153
|
<slot :name="slot"/>
|
|
149
154
|
</template>
|
|
150
155
|
</menu-item>
|
|
151
156
|
</div>
|
|
152
157
|
</div>
|
|
153
|
-
</template>
|
|
154
|
-
|
|
155
|
-
<style scoped>
|
|
156
|
-
|
|
157
|
-
</style>
|
|
158
|
+
</template>
|
|
@@ -6,12 +6,12 @@ import {LktObject} from "lkt-ts-interfaces";
|
|
|
6
6
|
import {fetchKeys} from "../functions/helpers";
|
|
7
7
|
|
|
8
8
|
const props = withDefaults(defineProps<{
|
|
9
|
-
modelValue?: MenuEntry[]
|
|
9
|
+
modelValue?: MenuEntry[],
|
|
10
10
|
}>(), {
|
|
11
|
-
modelValue: () => []
|
|
11
|
+
modelValue: () => [],
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
const emit = defineEmits(['update:modelValue']);
|
|
14
|
+
const emit = defineEmits(['update:modelValue', 'click-outside']);
|
|
15
15
|
|
|
16
16
|
const slots = useSlots();
|
|
17
17
|
|
|
@@ -33,6 +33,10 @@ const availableKeys = computed(() => {
|
|
|
33
33
|
return r;
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
+
const onClickOutside = () => {
|
|
37
|
+
emit('click-outside');
|
|
38
|
+
}
|
|
39
|
+
|
|
36
40
|
watch(() => props.modelValue, (v) => {
|
|
37
41
|
entries.value = v;
|
|
38
42
|
}, {deep: true})
|
|
@@ -51,7 +55,7 @@ watch(entries, (v) => {
|
|
|
51
55
|
</template>
|
|
52
56
|
</menu-item>
|
|
53
57
|
</div>
|
|
54
|
-
<div class="lkt-menu-outside"/>
|
|
58
|
+
<div class="lkt-menu-outside" v-on:click="onClickOutside"/>
|
|
55
59
|
</div>
|
|
56
60
|
</template>
|
|
57
61
|
|