lkt-menu 2.0.3 → 2.0.4
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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as G, ref as F, useSlots as H, computed as p, watch as R, onMounted as X, resolveComponent as K, createElementBlock as d, openBlock as
|
|
1
|
+
import { defineComponent as G, ref as F, useSlots as H, computed as p, watch as R, onMounted as X, resolveComponent as K, createElementBlock as d, openBlock as a, normalizeClass as $, createElementVNode as b, createCommentVNode as S, createBlock as g, unref as k, normalizeProps as q, mergeProps as L, createSlots as P, withCtx as f, renderSlot as h, toDisplayString as Y, resolveDynamicComponent as Z, Fragment as Q, renderList as j, mergeDefaults as x } from "vue";
|
|
2
2
|
import { MenuEntryType as z, getDefaultValues as ee, Menu as te } from "lkt-vue-kernel";
|
|
3
3
|
import { useRouter as le } from "vue-router";
|
|
4
4
|
import { DataState as ne } from "lkt-data-state";
|
|
@@ -8,7 +8,7 @@ const W = (r, _) => (_.forEach((s) => {
|
|
|
8
8
|
}), r), T = class T {
|
|
9
9
|
};
|
|
10
10
|
T.toggleSlot = "", T.debugEnabled = !1;
|
|
11
|
-
let
|
|
11
|
+
let O = T;
|
|
12
12
|
const ue = { class: "lkt-menu-entry-main" }, ae = { class: "lkt-entry-content" }, se = {
|
|
13
13
|
key: 0,
|
|
14
14
|
class: "lkt-menu-entry-icon"
|
|
@@ -27,55 +27,55 @@ const ue = { class: "lkt-menu-entry-main" }, ae = { class: "lkt-entry-content" }
|
|
|
27
27
|
"update:modelValue"
|
|
28
28
|
],
|
|
29
29
|
setup(r, { emit: _ }) {
|
|
30
|
-
const s = _, v = r, e = F(v.modelValue), i = H(), V = le(), y = F(!1),
|
|
30
|
+
const s = _, v = r, e = F(v.modelValue), i = H(), V = le(), y = F(!1), A = () => {
|
|
31
31
|
e.value.isOpened = !e.value.isOpened;
|
|
32
32
|
}, U = () => {
|
|
33
33
|
var t, o;
|
|
34
|
-
return typeof e.value.children < "u" && ((t = e.value.children) == null ? void 0 : t.length) > 0 &&
|
|
34
|
+
return typeof e.value.children < "u" && ((t = e.value.children) == null ? void 0 : t.length) > 0 && A(), typeof ((o = e.value.events) == null ? void 0 : o.click) == "function" ? (e.value.events.click({
|
|
35
35
|
entry: e.value
|
|
36
36
|
}), 1) : (typeof e.value.onClick == "function" && e.value.onClick({
|
|
37
37
|
entry: e.value
|
|
38
38
|
}), 1);
|
|
39
|
-
},
|
|
39
|
+
}, D = p(() => i["icon-" + e.value.key] || e.value.icon !== ""), w = p(() => {
|
|
40
40
|
let t = [];
|
|
41
|
-
return
|
|
42
|
-
}),
|
|
41
|
+
return D.value && t.push("has-icon"), y.value && t.push("is-active"), e.value.type && t.push(`is-${e.value.type}`), t.join(" ");
|
|
42
|
+
}), M = p(() => {
|
|
43
43
|
var o;
|
|
44
44
|
return W([], ((o = e.value) == null ? void 0 : o.children) ?? []);
|
|
45
45
|
}), l = p(() => {
|
|
46
46
|
let t = [];
|
|
47
47
|
for (let o in i)
|
|
48
|
-
o.startsWith("icon-") &&
|
|
48
|
+
o.startsWith("icon-") && M.value.includes(o.substring(5)) && t.push(o);
|
|
49
49
|
return t;
|
|
50
50
|
}), n = p(() => e.value.isActive ? !0 : typeof e.value.isActiveChecker == "function" ? !!e.value.isActiveChecker({
|
|
51
51
|
entry: e.value
|
|
52
|
-
}) : !1),
|
|
52
|
+
}) : !1), u = p(() => !!O.toggleSlot), c = p(() => O.toggleSlot);
|
|
53
53
|
return R(() => v.modelValue, (t) => {
|
|
54
54
|
e.value = t;
|
|
55
55
|
}, { deep: !0 }), R(e, (t) => {
|
|
56
56
|
s("update:modelValue", t);
|
|
57
57
|
}, { deep: !0 }), X(() => {
|
|
58
|
-
var o,
|
|
58
|
+
var o, E, C;
|
|
59
59
|
let t = V == null ? void 0 : V.currentRoute;
|
|
60
60
|
if (t) {
|
|
61
61
|
if (t.value.path === ((o = e.value.anchor) == null ? void 0 : o.to))
|
|
62
62
|
e.value.isOpened = !0;
|
|
63
|
-
else if (typeof e.value.children < "u" && ((
|
|
64
|
-
let
|
|
65
|
-
(C = e.value.children) == null || C.forEach((
|
|
63
|
+
else if (typeof e.value.children < "u" && ((E = e.value.children) == null ? void 0 : E.length) > 0) {
|
|
64
|
+
let I = !1;
|
|
65
|
+
(C = e.value.children) == null || C.forEach((B) => {
|
|
66
66
|
var m;
|
|
67
|
-
t.value.path === ((m =
|
|
68
|
-
}),
|
|
67
|
+
t.value.path === ((m = B.anchor) == null ? void 0 : m.to) && (I = !0);
|
|
68
|
+
}), I && (e.value.isOpened = !0);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}), (t, o) => {
|
|
72
|
-
var
|
|
73
|
-
const
|
|
74
|
-
return
|
|
75
|
-
class:
|
|
72
|
+
var B;
|
|
73
|
+
const E = K("lkt-button"), C = K("lkt-anchor"), I = K("menu-item", !0);
|
|
74
|
+
return a(), d("div", {
|
|
75
|
+
class: $(["lkt-menu-entry", w.value])
|
|
76
76
|
}, [
|
|
77
|
-
|
|
78
|
-
e.value.type === k(z).Button ? (
|
|
77
|
+
b("div", ue, [
|
|
78
|
+
e.value.type === k(z).Button ? (a(), g(E, q(L({ key: 0 }, e.value.button)), P({ _: 2 }, [
|
|
79
79
|
k(i).tooltip ? {
|
|
80
80
|
name: "tooltip",
|
|
81
81
|
fn: f(() => [
|
|
@@ -90,53 +90,53 @@ const ue = { class: "lkt-menu-entry-main" }, ae = { class: "lkt-entry-content" }
|
|
|
90
90
|
]),
|
|
91
91
|
key: "1"
|
|
92
92
|
} : void 0
|
|
93
|
-
]), 1040)) : e.value.type === k(z).Anchor ? (
|
|
93
|
+
]), 1040)) : e.value.type === k(z).Anchor ? (a(), g(C, q(L({ key: 1 }, e.value.anchor)), null, 16)) : (a(), g(C, L({ key: 2 }, e.value.anchor, {
|
|
94
94
|
"on-click": U,
|
|
95
95
|
"is-active": n.value,
|
|
96
96
|
onActive: o[0] || (o[0] = (m) => y.value = m)
|
|
97
97
|
}), {
|
|
98
98
|
text: f(({ text: m }) => [
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
b("div", ae, [
|
|
100
|
+
D.value ? (a(), d("div", se, [
|
|
101
101
|
k(i)["icon-" + e.value.key] ? h(t.$slots, "icon-" + e.value.key, {
|
|
102
102
|
key: e.value.key,
|
|
103
103
|
entry: e.value
|
|
104
|
-
}) : e.value.icon !== "" ? (
|
|
104
|
+
}) : e.value.icon !== "" ? (a(), d("i", {
|
|
105
105
|
key: 1,
|
|
106
|
-
class:
|
|
106
|
+
class: $(e.value.icon)
|
|
107
107
|
}, null, 2)) : S("", !0)
|
|
108
108
|
])) : S("", !0),
|
|
109
|
-
m !== "" ? (
|
|
109
|
+
m !== "" ? (a(), d("div", re, Y(m), 1)) : S("", !0)
|
|
110
110
|
])
|
|
111
111
|
]),
|
|
112
112
|
_: 3
|
|
113
113
|
}, 16, ["is-active"])),
|
|
114
|
-
e.value.type !== k(z).Button && e.value.children && ((
|
|
114
|
+
e.value.type !== k(z).Button && e.value.children && ((B = e.value.children) == null ? void 0 : B.length) > 0 ? (a(), d("div", {
|
|
115
115
|
key: 3,
|
|
116
116
|
class: "lkt-menu-entry-toggle",
|
|
117
|
-
onClick:
|
|
117
|
+
onClick: A
|
|
118
118
|
}, [
|
|
119
|
-
|
|
119
|
+
u.value ? (a(), g(Z(c.value), {
|
|
120
120
|
key: 0,
|
|
121
|
-
class:
|
|
122
|
-
}, null, 8, ["class"])) : (
|
|
121
|
+
class: $(["lkt-menu-entry-toggle-inner", e.value.isOpened ? "is-opened" : ""])
|
|
122
|
+
}, null, 8, ["class"])) : (a(), d("div", {
|
|
123
123
|
key: 1,
|
|
124
|
-
class:
|
|
124
|
+
class: $(["lkt-menu-entry-toggle-inner", e.value.isOpened ? "is-opened" : ""])
|
|
125
125
|
}, o[1] || (o[1] = [
|
|
126
|
-
|
|
126
|
+
b("i", { class: "lkt-icn-angle-bottom" }, null, -1)
|
|
127
127
|
]), 2))
|
|
128
128
|
])) : S("", !0)
|
|
129
129
|
]),
|
|
130
|
-
e.value.isOpened ? (
|
|
131
|
-
(
|
|
130
|
+
e.value.isOpened ? (a(), d("div", ie, [
|
|
131
|
+
(a(!0), d(Q, null, j(e.value.children, (m, J) => (a(), g(I, {
|
|
132
132
|
modelValue: e.value.children[J],
|
|
133
|
-
"onUpdate:modelValue": (
|
|
133
|
+
"onUpdate:modelValue": (N) => e.value.children[J] = N,
|
|
134
134
|
key: e.value.children[J].key
|
|
135
135
|
}, P({ _: 2 }, [
|
|
136
|
-
j(l.value, (
|
|
137
|
-
name:
|
|
136
|
+
j(l.value, (N) => ({
|
|
137
|
+
name: N,
|
|
138
138
|
fn: f(() => [
|
|
139
|
-
h(t.$slots,
|
|
139
|
+
h(t.$slots, N)
|
|
140
140
|
])
|
|
141
141
|
}))
|
|
142
142
|
]), 1032, ["modelValue", "onUpdate:modelValue"]))), 128))
|
|
@@ -159,26 +159,26 @@ const ue = { class: "lkt-menu-entry-main" }, ae = { class: "lkt-entry-content" }
|
|
|
159
159
|
"error"
|
|
160
160
|
],
|
|
161
161
|
setup(r, { emit: _ }) {
|
|
162
|
-
var
|
|
162
|
+
var M;
|
|
163
163
|
const s = r, v = _, e = H(), i = F(s.modelValue), V = (l) => {
|
|
164
164
|
let n = {};
|
|
165
165
|
typeof l == "object" && Object.keys(l).length > 0 && (n = JSON.parse(JSON.stringify(l)));
|
|
166
|
-
for (let
|
|
167
|
-
(Array.isArray(n[
|
|
166
|
+
for (let u in n)
|
|
167
|
+
(Array.isArray(n[u]) || typeof n[u] == "object") && (n[u] = JSON.stringify(n[u]));
|
|
168
168
|
return n;
|
|
169
169
|
};
|
|
170
170
|
let y = new ne({});
|
|
171
|
-
y.increment(V(((
|
|
172
|
-
const
|
|
171
|
+
y.increment(V(((M = s.http) == null ? void 0 : M.data) ?? {}));
|
|
172
|
+
const A = p(() => W([], i.value)), U = p(() => {
|
|
173
173
|
let l = [];
|
|
174
174
|
for (let n in e)
|
|
175
|
-
n.startsWith("icon-") &&
|
|
175
|
+
n.startsWith("icon-") && A.value.includes(n.substring(5)) && l.push(n);
|
|
176
176
|
return l;
|
|
177
|
-
}),
|
|
178
|
-
var n,
|
|
177
|
+
}), D = () => {
|
|
178
|
+
var n, u;
|
|
179
179
|
if (!((n = s.http) != null && n.resource)) return;
|
|
180
180
|
let l = y.getData();
|
|
181
|
-
v("loading"), oe((
|
|
181
|
+
v("loading"), oe((u = s.http) == null ? void 0 : u.resource, l).then((c) => {
|
|
182
182
|
y.turnStoredIntoOriginal(), i.value = c.data, v("results", c.data), v("response", c);
|
|
183
183
|
}).catch((c) => {
|
|
184
184
|
v("error", c);
|
|
@@ -190,12 +190,13 @@ const ue = { class: "lkt-menu-entry-main" }, ae = { class: "lkt-entry-content" }
|
|
|
190
190
|
i.value = l;
|
|
191
191
|
}, { deep: !0 }), R(i, (l) => {
|
|
192
192
|
v("update:modelValue", l);
|
|
193
|
-
}, { deep: !0 }),
|
|
194
|
-
|
|
195
|
-
(
|
|
193
|
+
}, { deep: !0 }), D(), (l, n) => (a(), d("div", de, [
|
|
194
|
+
b("div", ve, [
|
|
195
|
+
(a(!0), d(Q, null, j(i.value, (u, c) => (a(), g(ce, {
|
|
196
196
|
modelValue: i.value[c],
|
|
197
197
|
"onUpdate:modelValue": (t) => i.value[c] = t,
|
|
198
|
-
key:
|
|
198
|
+
key: u.key,
|
|
199
|
+
class: $(u.class)
|
|
199
200
|
}, P({ _: 2 }, [
|
|
200
201
|
j(U.value, (t) => ({
|
|
201
202
|
name: t,
|
|
@@ -203,23 +204,23 @@ const ue = { class: "lkt-menu-entry-main" }, ae = { class: "lkt-entry-content" }
|
|
|
203
204
|
h(l.$slots, t)
|
|
204
205
|
])
|
|
205
206
|
})),
|
|
206
|
-
k(e)[`tooltip-${
|
|
207
|
+
k(e)[`tooltip-${u.key}`] ? {
|
|
207
208
|
name: "tooltip",
|
|
208
209
|
fn: f(() => [
|
|
209
|
-
h(l.$slots, `tooltip-${
|
|
210
|
+
h(l.$slots, `tooltip-${u.key}`)
|
|
210
211
|
]),
|
|
211
212
|
key: "0"
|
|
212
213
|
} : void 0,
|
|
213
|
-
k(e)[`split-${
|
|
214
|
+
k(e)[`split-${u.key}`] ? {
|
|
214
215
|
name: "split",
|
|
215
216
|
fn: f(() => [
|
|
216
|
-
h(l.$slots, `split-${
|
|
217
|
+
h(l.$slots, `split-${u.key}`)
|
|
217
218
|
]),
|
|
218
219
|
key: "1"
|
|
219
220
|
} : void 0
|
|
220
|
-
]), 1032, ["modelValue", "onUpdate:modelValue"]))), 128))
|
|
221
|
+
]), 1032, ["modelValue", "onUpdate:modelValue", "class"]))), 128))
|
|
221
222
|
]),
|
|
222
|
-
|
|
223
|
+
b("div", {
|
|
223
224
|
class: "lkt-menu-outside",
|
|
224
225
|
onClick: w
|
|
225
226
|
})
|
|
@@ -229,7 +230,7 @@ const ue = { class: "lkt-menu-entry-main" }, ae = { class: "lkt-entry-content" }
|
|
|
229
230
|
install: (r) => {
|
|
230
231
|
r.component("lkt-menu") === void 0 && r.component("lkt-menu", pe);
|
|
231
232
|
}
|
|
232
|
-
}, _e = (r) => (
|
|
233
|
+
}, _e = (r) => (O.toggleSlot = r, !0);
|
|
233
234
|
export {
|
|
234
235
|
ge as default,
|
|
235
236
|
_e as setMenuToggleSlot
|
|
@@ -5,6 +5,7 @@ type __VLS_Props = {
|
|
|
5
5
|
declare const entry: import("vue").Ref<{
|
|
6
6
|
key?: string | undefined;
|
|
7
7
|
type?: MenuEntryType | undefined;
|
|
8
|
+
class?: string | undefined;
|
|
8
9
|
icon?: string | undefined;
|
|
9
10
|
anchor?: {
|
|
10
11
|
type?: import("lkt-vue-kernel").AnchorType | undefined;
|
|
@@ -1506,6 +1507,7 @@ declare const entry: import("vue").Ref<{
|
|
|
1506
1507
|
}, MenuEntryConfig | {
|
|
1507
1508
|
key?: string | undefined;
|
|
1508
1509
|
type?: MenuEntryType | undefined;
|
|
1510
|
+
class?: string | undefined;
|
|
1509
1511
|
icon?: string | undefined;
|
|
1510
1512
|
anchor?: {
|
|
1511
1513
|
type?: import("lkt-vue-kernel").AnchorType | undefined;
|
|
@@ -3016,6 +3018,7 @@ declare var __VLS_5: {}, __VLS_7: {}, __VLS_22: string, __VLS_23: {
|
|
|
3016
3018
|
entry: {
|
|
3017
3019
|
key?: string | undefined;
|
|
3018
3020
|
type?: MenuEntryType | undefined;
|
|
3021
|
+
class?: string | undefined;
|
|
3019
3022
|
icon?: string | undefined;
|
|
3020
3023
|
anchor?: {
|
|
3021
3024
|
type?: import("lkt-vue-kernel").AnchorType | undefined;
|
|
@@ -6,6 +6,7 @@ declare const slots: Readonly<{
|
|
|
6
6
|
declare const entries: import("vue").Ref<{
|
|
7
7
|
key?: string | undefined;
|
|
8
8
|
type?: import("lkt-vue-kernel").MenuEntryType | undefined;
|
|
9
|
+
class?: string | undefined;
|
|
9
10
|
icon?: string | undefined;
|
|
10
11
|
anchor?: {
|
|
11
12
|
type?: import("lkt-vue-kernel").AnchorType | undefined;
|
|
@@ -1507,6 +1508,7 @@ declare const entries: import("vue").Ref<{
|
|
|
1507
1508
|
}[], import("lkt-vue-kernel").MenuEntryConfig[] | {
|
|
1508
1509
|
key?: string | undefined;
|
|
1509
1510
|
type?: import("lkt-vue-kernel").MenuEntryType | undefined;
|
|
1511
|
+
class?: string | undefined;
|
|
1510
1512
|
icon?: string | undefined;
|
|
1511
1513
|
anchor?: {
|
|
1512
1514
|
type?: import("lkt-vue-kernel").AnchorType | undefined;
|
package/package.json
CHANGED
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
<template>
|
|
88
88
|
<div class="lkt-menu-container">
|
|
89
89
|
<div class="lkt-menu">
|
|
90
|
-
<menu-item v-for="(entry, i) in entries" v-model="entries[i]" :key="entry.key">
|
|
90
|
+
<menu-item v-for="(entry, i) in entries" v-model="entries[i]" :key="entry.key" :class="entry.class">
|
|
91
91
|
<template v-for="slot in entryIconSlots" v-slot:[slot]>
|
|
92
92
|
<slot :name="slot" />
|
|
93
93
|
</template>
|
package/theme/default.css
CHANGED
|
@@ -2,16 +2,12 @@
|
|
|
2
2
|
--lkt-menu--display: flex;
|
|
3
3
|
--lkt-menu--flex-direction: column;
|
|
4
4
|
--lkt-menu--align-items: stretch;
|
|
5
|
-
|
|
6
|
-
/** Font */
|
|
7
5
|
--lkt-menu--font-family: system-ui, Helvetica;
|
|
8
6
|
--lkt-menu--font-size: 16px;
|
|
9
7
|
--lkt-menu--font-weight: 400;
|
|
10
8
|
--lkt-menu--line-height: 1;
|
|
11
9
|
--lkt-menu--text-align: left;
|
|
12
10
|
--lkt-menu--text-decoration: none;
|
|
13
|
-
|
|
14
|
-
/** Sizing */
|
|
15
11
|
--lkt-menu--width: 100%;
|
|
16
12
|
--lkt-menu--min-width: 0;
|
|
17
13
|
--lkt-menu--max-width: initial;
|
|
@@ -19,8 +15,6 @@
|
|
|
19
15
|
--lkt-menu--padding: 15px;
|
|
20
16
|
--lkt-menu--gap: 15px;
|
|
21
17
|
--lkt-menu--entry--gap: 0;
|
|
22
|
-
|
|
23
|
-
/** Colors */
|
|
24
18
|
--lkt-menu--background: #ffffff;
|
|
25
19
|
--lkt-menu--toggle--color: #444444;
|
|
26
20
|
|