lkt-menu 1.0.9 → 1.0.11
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 +6 -6
- package/dist/build.js +131 -108
- package/package.json +4 -3
- package/src/components/MenuItem.vue +17 -18
- package/src/lib-components/LktMenu.vue +42 -2
- package/dist/classes/MenuEntry.d.ts +0 -20
- package/dist/components/MenuItem.vue.d.ts +0 -60
- package/dist/functions/helpers.d.ts +0 -2
- package/dist/index.d.ts +0 -8
- package/dist/lib-components/LktMenu.vue.d.ts +0 -41
- package/dist/settings/Settings.d.ts +0 -5
package/dist/build.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare class x {
|
|
2
|
-
constructor(t: any,
|
|
2
|
+
constructor(t: any, r: any, i: any);
|
|
3
3
|
key: any;
|
|
4
4
|
href: any;
|
|
5
5
|
label: any;
|
|
@@ -17,7 +17,7 @@ declare class x {
|
|
|
17
17
|
setIcon(t: any): this;
|
|
18
18
|
doClose(): void;
|
|
19
19
|
}
|
|
20
|
-
declare function
|
|
20
|
+
declare function ke(o: any, t: any, r: any): {
|
|
21
21
|
key: any;
|
|
22
22
|
href: any;
|
|
23
23
|
label: any;
|
|
@@ -35,8 +35,8 @@ declare function he(n: any, t: any, s: any): {
|
|
|
35
35
|
setIcon: (t: any) => x;
|
|
36
36
|
doClose: () => void;
|
|
37
37
|
};
|
|
38
|
-
declare namespace
|
|
39
|
-
function install(
|
|
38
|
+
declare namespace fe {
|
|
39
|
+
function install(o: any): void;
|
|
40
40
|
}
|
|
41
|
-
declare function
|
|
42
|
-
export { x as MenuEntry,
|
|
41
|
+
declare function ye(o: any): boolean;
|
|
42
|
+
export { x as MenuEntry, ke as createMenuEntry, fe as default, ye as setMenuToggleSlot };
|
package/dist/build.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as J, ref as $, useSlots as K, computed as c, watch as O, onMounted as q, resolveComponent as B, openBlock as u, createElementBlock as d, normalizeClass as b, createElementVNode as S, createVNode as G, withCtx as w, unref as H, renderSlot as L, createCommentVNode as k, toDisplayString as P, createBlock as R, resolveDynamicComponent as Q, Fragment as T, renderList as A, createSlots as W, reactive as X } from "vue";
|
|
2
2
|
import { __ as Y } from "lkt-i18n";
|
|
3
3
|
import { useRouter as Z } from "vue-router";
|
|
4
|
+
import { DataState as ee } from "lkt-data-state";
|
|
5
|
+
import { httpCall as te } from "lkt-http-client";
|
|
4
6
|
class x {
|
|
5
|
-
constructor(t,
|
|
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 =
|
|
7
|
+
constructor(t, r, i) {
|
|
8
|
+
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 = r, this.label = i;
|
|
7
9
|
}
|
|
8
10
|
setChildren(t) {
|
|
9
|
-
return t.forEach((
|
|
11
|
+
return t.forEach((r) => r.parent = this), this.children = t, this;
|
|
10
12
|
}
|
|
11
13
|
setOnClick(t) {
|
|
12
14
|
return this.onClick = t, this;
|
|
@@ -27,164 +29,185 @@ class x {
|
|
|
27
29
|
this.isOpened = !1;
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
}),
|
|
32
|
+
const j = (o, t) => (t.forEach((r) => {
|
|
33
|
+
o.includes(r.key) || o.push(r.key), r.children.length > 0 && j(o, r.children);
|
|
34
|
+
}), o), I = class I {
|
|
33
35
|
};
|
|
34
|
-
|
|
35
|
-
let
|
|
36
|
-
const
|
|
36
|
+
I.toggleSlot = "", I.debugEnabled = !1;
|
|
37
|
+
let y = I;
|
|
38
|
+
const le = { class: "lkt-menu-entry-main" }, ne = { class: "lkt-entry-content" }, re = {
|
|
37
39
|
key: 0,
|
|
38
40
|
class: "lkt-menu-entry-icon"
|
|
39
|
-
},
|
|
41
|
+
}, se = {
|
|
40
42
|
key: 1,
|
|
41
43
|
class: "lkt-menu-entry-text"
|
|
42
|
-
},
|
|
44
|
+
}, oe = {
|
|
43
45
|
key: 0,
|
|
44
46
|
class: "lkt-menu-entry-children"
|
|
45
|
-
}, ue = /* @__PURE__ */
|
|
47
|
+
}, ue = /* @__PURE__ */ J({
|
|
46
48
|
__name: "MenuItem",
|
|
47
49
|
props: {
|
|
48
50
|
modelValue: { default: () => new x("", "", "") }
|
|
49
51
|
},
|
|
50
52
|
emits: ["update:modelValue"],
|
|
51
|
-
setup(
|
|
52
|
-
const
|
|
53
|
+
setup(o, { emit: t }) {
|
|
54
|
+
const r = t, i = o, e = $(i.modelValue), a = K(), f = Z(), m = $(!1), g = () => {
|
|
53
55
|
e.value.isOpened = !e.value.isOpened;
|
|
54
|
-
},
|
|
56
|
+
}, E = () => (e.value.children.length > 0 && g(), typeof e.value.onClick == "function" && e.value.onClick({
|
|
55
57
|
entry: e.value
|
|
56
|
-
}), 1),
|
|
57
|
-
let
|
|
58
|
-
return
|
|
59
|
-
}),
|
|
60
|
-
let
|
|
61
|
-
for (let
|
|
62
|
-
|
|
63
|
-
return
|
|
64
|
-
}),
|
|
58
|
+
}), 1), _ = c(() => a["icon-" + e.value.key] || e.value.icon !== ""), D = c(() => {
|
|
59
|
+
let n = [];
|
|
60
|
+
return _.value && n.push("has-icon"), m.value && n.push("is-active"), n.join(" ");
|
|
61
|
+
}), s = c(() => j([], e.value.children)), l = c(() => {
|
|
62
|
+
let n = [];
|
|
63
|
+
for (let v in a)
|
|
64
|
+
v.startsWith("icon-") && s.value.includes(v.substring(5)) && n.push(v);
|
|
65
|
+
return n;
|
|
66
|
+
}), h = c(() => e.value.label.startsWith("__:") ? Y(e.value.label.substring(3)) : e.value.label), C = c(() => e.value.isActive ? !0 : typeof e.value.isActiveChecker == "function" ? !!e.value.isActiveChecker({
|
|
65
67
|
entry: e.value
|
|
66
|
-
}) : !1),
|
|
67
|
-
return
|
|
68
|
-
e.value =
|
|
69
|
-
}, { deep: !0 }),
|
|
70
|
-
|
|
71
|
-
}, { deep: !0 }),
|
|
72
|
-
let
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
68
|
+
}) : !1), p = c(() => !!y.toggleSlot), F = c(() => y.toggleSlot);
|
|
69
|
+
return O(() => i.modelValue, (n) => {
|
|
70
|
+
e.value = n;
|
|
71
|
+
}, { deep: !0 }), O(e, (n) => {
|
|
72
|
+
r("update:modelValue", n);
|
|
73
|
+
}, { deep: !0 }), q(() => {
|
|
74
|
+
let n = f == null ? void 0 : f.currentRoute;
|
|
75
|
+
if (n) {
|
|
76
|
+
if (n.value.path === e.value.href)
|
|
77
|
+
e.value.isOpened = !0;
|
|
78
|
+
else if (e.value.children.length > 0) {
|
|
79
|
+
let v = !1;
|
|
80
|
+
e.value.children.forEach((M) => {
|
|
81
|
+
n.value.path === M.href && (v = !0);
|
|
82
|
+
}), v && (e.value.isOpened = !0);
|
|
83
|
+
}
|
|
80
84
|
}
|
|
81
|
-
}), (
|
|
82
|
-
const
|
|
83
|
-
return u(),
|
|
84
|
-
class:
|
|
85
|
+
}), (n, v) => {
|
|
86
|
+
const M = B("lkt-anchor"), z = B("menu-item", !0);
|
|
87
|
+
return u(), d("div", {
|
|
88
|
+
class: b(["lkt-menu-entry", D.value])
|
|
85
89
|
}, [
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
S("div", le, [
|
|
91
|
+
G(M, {
|
|
88
92
|
to: e.value.href,
|
|
89
|
-
"on-click":
|
|
90
|
-
"is-active":
|
|
91
|
-
onActive:
|
|
93
|
+
"on-click": E,
|
|
94
|
+
"is-active": C.value,
|
|
95
|
+
onActive: v[0] || (v[0] = (U) => m.value = U)
|
|
92
96
|
}, {
|
|
93
|
-
default:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
default: w(() => [
|
|
98
|
+
S("div", ne, [
|
|
99
|
+
_.value ? (u(), d("div", re, [
|
|
100
|
+
H(a)["icon-" + e.value.key] ? L(n.$slots, "icon-" + e.value.key, {
|
|
97
101
|
key: e.value.key,
|
|
98
102
|
entry: e.value
|
|
99
|
-
}) : e.value.icon !== "" ? (u(),
|
|
103
|
+
}) : e.value.icon !== "" ? (u(), d("i", {
|
|
100
104
|
key: 1,
|
|
101
|
-
class:
|
|
102
|
-
}, null, 2)) :
|
|
103
|
-
])) :
|
|
104
|
-
e.value.label !== "" ? (u(),
|
|
105
|
+
class: b(e.value.icon)
|
|
106
|
+
}, null, 2)) : k("", !0)
|
|
107
|
+
])) : k("", !0),
|
|
108
|
+
e.value.label !== "" ? (u(), d("div", se, P(h.value), 1)) : k("", !0)
|
|
105
109
|
])
|
|
106
110
|
]),
|
|
107
111
|
_: 3
|
|
108
112
|
}, 8, ["to", "is-active"]),
|
|
109
|
-
e.value.children.length > 0 ? (u(),
|
|
113
|
+
e.value.children.length > 0 ? (u(), d("div", {
|
|
110
114
|
key: 0,
|
|
111
115
|
class: "lkt-menu-entry-toggle",
|
|
112
|
-
onClick:
|
|
116
|
+
onClick: g
|
|
113
117
|
}, [
|
|
114
|
-
|
|
118
|
+
p.value ? (u(), R(Q(F.value), {
|
|
115
119
|
key: 0,
|
|
116
|
-
class:
|
|
117
|
-
}, null, 8, ["class"])) : (u(),
|
|
120
|
+
class: b(["lkt-menu-entry-toggle-inner", e.value.isOpened ? "is-opened" : ""])
|
|
121
|
+
}, null, 8, ["class"])) : (u(), d("div", {
|
|
118
122
|
key: 1,
|
|
119
|
-
class:
|
|
123
|
+
class: b(["lkt-menu-entry-toggle-inner lkt-menu-entry-toggle-triangle", e.value.isOpened ? "is-opened" : ""])
|
|
120
124
|
}, null, 2))
|
|
121
|
-
])) :
|
|
125
|
+
])) : k("", !0)
|
|
122
126
|
]),
|
|
123
|
-
e.value.isOpened ? (u(),
|
|
124
|
-
(u(!0),
|
|
125
|
-
modelValue: e.value.children[
|
|
126
|
-
"onUpdate:modelValue": (
|
|
127
|
-
key: e.value.children[
|
|
127
|
+
e.value.isOpened ? (u(), d("div", oe, [
|
|
128
|
+
(u(!0), d(T, null, A(e.value.children, (U, N) => (u(), R(z, {
|
|
129
|
+
modelValue: e.value.children[N],
|
|
130
|
+
"onUpdate:modelValue": (V) => e.value.children[N] = V,
|
|
131
|
+
key: e.value.children[N].key
|
|
128
132
|
}, W({ _: 2 }, [
|
|
129
|
-
|
|
130
|
-
name:
|
|
131
|
-
fn:
|
|
132
|
-
L(
|
|
133
|
+
A(l.value, (V) => ({
|
|
134
|
+
name: V,
|
|
135
|
+
fn: w(() => [
|
|
136
|
+
L(n.$slots, V)
|
|
133
137
|
])
|
|
134
138
|
}))
|
|
135
139
|
]), 1032, ["modelValue", "onUpdate:modelValue"]))), 128))
|
|
136
|
-
])) :
|
|
140
|
+
])) : k("", !0)
|
|
137
141
|
], 2);
|
|
138
142
|
};
|
|
139
143
|
}
|
|
140
|
-
}), ie = { class: "lkt-menu-container" },
|
|
144
|
+
}), ie = { class: "lkt-menu-container" }, ae = { class: "lkt-menu" }, ce = /* @__PURE__ */ J({
|
|
141
145
|
__name: "LktMenu",
|
|
142
146
|
props: {
|
|
143
|
-
modelValue: { default: () => [] }
|
|
147
|
+
modelValue: { default: () => [] },
|
|
148
|
+
resource: { default: "" },
|
|
149
|
+
resourceData: { default: () => ({}) }
|
|
144
150
|
},
|
|
145
|
-
emits: ["update:modelValue", "click-outside"],
|
|
146
|
-
setup(
|
|
147
|
-
const
|
|
148
|
-
let
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
emits: ["update:modelValue", "click-outside", "loading", "results", "response", "error"],
|
|
152
|
+
setup(o, { emit: t }) {
|
|
153
|
+
const r = o, i = t, e = K(), a = $(r.modelValue), f = (s) => {
|
|
154
|
+
let l = {};
|
|
155
|
+
typeof s == "object" && Object.keys(s).length > 0 && (l = JSON.parse(JSON.stringify(s)));
|
|
156
|
+
for (let h in l)
|
|
157
|
+
(Array.isArray(l[h]) || typeof l[h] == "object") && (l[h] = JSON.stringify(l[h]));
|
|
158
|
+
return l;
|
|
159
|
+
};
|
|
160
|
+
let m = new ee({});
|
|
161
|
+
m.increment(f(r.resourceData));
|
|
162
|
+
const g = c(() => j([], a.value)), E = c(() => {
|
|
163
|
+
let s = [];
|
|
164
|
+
for (let l in e)
|
|
165
|
+
l.startsWith("icon-") && g.value.includes(l.substring(5)) && s.push(l);
|
|
166
|
+
return s;
|
|
167
|
+
}), _ = () => {
|
|
168
|
+
if (!r.resource) return;
|
|
169
|
+
let s = m.getData();
|
|
170
|
+
i("loading"), te(r.resource, s).then((l) => {
|
|
171
|
+
m.turnStoredIntoOriginal(), a.value = l.data, i("results", l.data), i("response", l);
|
|
172
|
+
}).catch((l) => {
|
|
173
|
+
i("error", l);
|
|
174
|
+
});
|
|
175
|
+
}, D = () => {
|
|
176
|
+
i("click-outside");
|
|
154
177
|
};
|
|
155
|
-
return
|
|
156
|
-
|
|
157
|
-
}, { deep: !0 }),
|
|
158
|
-
|
|
159
|
-
}, { deep: !0 }), (
|
|
160
|
-
|
|
161
|
-
(u(!0),
|
|
162
|
-
modelValue:
|
|
163
|
-
"onUpdate:modelValue": (
|
|
164
|
-
key:
|
|
178
|
+
return O(() => r.modelValue, (s) => {
|
|
179
|
+
a.value = s;
|
|
180
|
+
}, { deep: !0 }), O(a, (s) => {
|
|
181
|
+
i("update:modelValue", s);
|
|
182
|
+
}, { deep: !0 }), _(), (s, l) => (u(), d("div", ie, [
|
|
183
|
+
S("div", ae, [
|
|
184
|
+
(u(!0), d(T, null, A(a.value, (h, C) => (u(), R(ue, {
|
|
185
|
+
modelValue: a.value[C],
|
|
186
|
+
"onUpdate:modelValue": (p) => a.value[C] = p,
|
|
187
|
+
key: h.key
|
|
165
188
|
}, W({ _: 2 }, [
|
|
166
|
-
|
|
167
|
-
name:
|
|
168
|
-
fn:
|
|
169
|
-
L(
|
|
189
|
+
A(E.value, (p) => ({
|
|
190
|
+
name: p,
|
|
191
|
+
fn: w(() => [
|
|
192
|
+
L(s.$slots, p)
|
|
170
193
|
])
|
|
171
194
|
}))
|
|
172
195
|
]), 1032, ["modelValue", "onUpdate:modelValue"]))), 128))
|
|
173
196
|
]),
|
|
174
|
-
|
|
197
|
+
S("div", {
|
|
175
198
|
class: "lkt-menu-outside",
|
|
176
|
-
onClick:
|
|
199
|
+
onClick: D
|
|
177
200
|
})
|
|
178
201
|
]));
|
|
179
202
|
}
|
|
180
|
-
}),
|
|
181
|
-
install: (
|
|
182
|
-
|
|
203
|
+
}), fe = {
|
|
204
|
+
install: (o) => {
|
|
205
|
+
o.component("lkt-menu") === void 0 && o.component("lkt-menu", ce);
|
|
183
206
|
}
|
|
184
|
-
},
|
|
207
|
+
}, ke = (o, t, r) => X(new x(o, t, r)), ye = (o) => (y.toggleSlot = o, !0);
|
|
185
208
|
export {
|
|
186
209
|
x as MenuEntry,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
210
|
+
ke as createMenuEntry,
|
|
211
|
+
fe as default,
|
|
212
|
+
ye as setMenuToggleSlot
|
|
190
213
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lkt-menu",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lkt",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"./theme": "./theme/default.css",
|
|
23
23
|
"./theme/default": "./theme/default.css"
|
|
24
24
|
},
|
|
25
|
-
"types": "./dist/
|
|
25
|
+
"types": "./dist/build.d.ts",
|
|
26
26
|
"files": [
|
|
27
27
|
"dist/*",
|
|
28
28
|
"src/**/*.vue",
|
|
@@ -51,8 +51,9 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"lkt-anchor": "^1.1.4",
|
|
53
53
|
"lkt-control-tools": "^1.0.3",
|
|
54
|
+
"lkt-data-state": "^1.0.10",
|
|
54
55
|
"lkt-events": "^1.0.2",
|
|
55
|
-
"lkt-http-client": "^1.0.
|
|
56
|
+
"lkt-http-client": "^1.0.31",
|
|
56
57
|
"lkt-i18n": "^1.0.4",
|
|
57
58
|
"lkt-loader": "^1.0.1",
|
|
58
59
|
"lkt-modal-confirm": "^1.0.0",
|
|
@@ -15,13 +15,10 @@ const props = withDefaults(defineProps<{
|
|
|
15
15
|
modelValue: () => (new MenuEntry('', '', ''))
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
const entry = ref(props.modelValue)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const router = useRouter();
|
|
23
|
-
|
|
24
|
-
const isActive = ref(false);
|
|
18
|
+
const entry = ref(props.modelValue),
|
|
19
|
+
slots = useSlots(),
|
|
20
|
+
router = useRouter(),
|
|
21
|
+
isActive = ref(false);
|
|
25
22
|
|
|
26
23
|
const onClickToggle = () => {
|
|
27
24
|
entry.value.isOpened = !entry.value.isOpened;
|
|
@@ -96,17 +93,19 @@ watch(entry, (v) => {
|
|
|
96
93
|
}, {deep: true});
|
|
97
94
|
|
|
98
95
|
onMounted(() => {
|
|
99
|
-
let currentRoute = router
|
|
100
|
-
if (currentRoute
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
96
|
+
let currentRoute = router?.currentRoute;
|
|
97
|
+
if (currentRoute) {
|
|
98
|
+
if (currentRoute.value.path === entry.value.href) {
|
|
99
|
+
entry.value.isOpened = true;
|
|
100
|
+
|
|
101
|
+
} else if (entry.value.children.length > 0) {
|
|
102
|
+
let opened = false;
|
|
103
|
+
entry.value.children.forEach((child) => {
|
|
104
|
+
if (currentRoute.value.path === child.href) opened = true;
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
if (opened) entry.value.isOpened = true;
|
|
108
|
+
}
|
|
110
109
|
}
|
|
111
110
|
});
|
|
112
111
|
</script>
|
|
@@ -4,19 +4,40 @@ import MenuItem from "../components/MenuItem.vue";
|
|
|
4
4
|
import {computed, ref, useSlots, watch} from "vue";
|
|
5
5
|
import {LktObject} from "lkt-ts-interfaces";
|
|
6
6
|
import {fetchKeys} from "../functions/helpers";
|
|
7
|
+
import {DataState} from "lkt-data-state";
|
|
8
|
+
import {httpCall, HTTPResponse} from "lkt-http-client";
|
|
7
9
|
|
|
8
10
|
const props = withDefaults(defineProps<{
|
|
9
11
|
modelValue?: MenuEntry[],
|
|
12
|
+
resource?: string
|
|
13
|
+
resourceData: LktObject,
|
|
10
14
|
}>(), {
|
|
11
15
|
modelValue: () => [],
|
|
16
|
+
resource: '',
|
|
17
|
+
resourceData: () => ({}),
|
|
12
18
|
});
|
|
13
19
|
|
|
14
|
-
const emit = defineEmits(['update:modelValue', 'click-outside']);
|
|
20
|
+
const emit = defineEmits(['update:modelValue', 'click-outside', 'loading', 'results', 'response', 'error']);
|
|
15
21
|
|
|
16
22
|
const slots = useSlots();
|
|
17
23
|
|
|
18
24
|
const entries = ref(props.modelValue);
|
|
19
25
|
|
|
26
|
+
const parseFilters = (filters: LktObject) => {
|
|
27
|
+
let d: LktObject = {};
|
|
28
|
+
if (typeof filters === 'object' && Object.keys(filters).length > 0) {
|
|
29
|
+
d = JSON.parse(JSON.stringify(filters));
|
|
30
|
+
}
|
|
31
|
+
for (let k in d) {
|
|
32
|
+
if (Array.isArray(d[k]) || typeof d[k] === 'object') {
|
|
33
|
+
d[k] = JSON.stringify(d[k]);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return d;
|
|
37
|
+
}
|
|
38
|
+
let resourceDataState = new DataState({});
|
|
39
|
+
resourceDataState.increment(parseFilters(props.resourceData))
|
|
40
|
+
|
|
20
41
|
const availableKeys = computed(() => {
|
|
21
42
|
let r:string[] = [];
|
|
22
43
|
return fetchKeys(r, entries.value);
|
|
@@ -31,7 +52,24 @@ const availableKeys = computed(() => {
|
|
|
31
52
|
}
|
|
32
53
|
}
|
|
33
54
|
return r;
|
|
34
|
-
})
|
|
55
|
+
}),
|
|
56
|
+
loadResource = () => {
|
|
57
|
+
if (!props.resource) return;
|
|
58
|
+
|
|
59
|
+
let d = resourceDataState.getData();
|
|
60
|
+
emit('loading');
|
|
61
|
+
|
|
62
|
+
httpCall(props.resource, d).then((r: HTTPResponse) => {
|
|
63
|
+
resourceDataState.turnStoredIntoOriginal();
|
|
64
|
+
//@ts-ignore
|
|
65
|
+
entries.value = r.data;
|
|
66
|
+
emit('results', r.data);
|
|
67
|
+
emit('response', r);
|
|
68
|
+
|
|
69
|
+
}).catch((r: any) => {
|
|
70
|
+
emit('error', r);
|
|
71
|
+
});
|
|
72
|
+
};
|
|
35
73
|
|
|
36
74
|
const onClickOutside = () => {
|
|
37
75
|
emit('click-outside');
|
|
@@ -44,6 +82,8 @@ watch(() => props.modelValue, (v) => {
|
|
|
44
82
|
watch(entries, (v) => {
|
|
45
83
|
emit('update:modelValue', v);
|
|
46
84
|
}, {deep: true})
|
|
85
|
+
|
|
86
|
+
loadResource();
|
|
47
87
|
</script>
|
|
48
88
|
|
|
49
89
|
<template>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare class MenuEntry {
|
|
2
|
-
key: string;
|
|
3
|
-
href: string;
|
|
4
|
-
label: string;
|
|
5
|
-
icon: string;
|
|
6
|
-
onClick: Function | undefined;
|
|
7
|
-
isActiveChecker: Function | undefined;
|
|
8
|
-
isOpened: boolean;
|
|
9
|
-
isActive: boolean;
|
|
10
|
-
parent: MenuEntry | undefined;
|
|
11
|
-
children: MenuEntry[];
|
|
12
|
-
constructor(key: string, href: string, label: string);
|
|
13
|
-
setChildren(children: MenuEntry[]): this;
|
|
14
|
-
setOnClick(fn: Function): this;
|
|
15
|
-
setIsActiveChecker(fn: Function): this;
|
|
16
|
-
setIsActive(enabled?: boolean): this;
|
|
17
|
-
setLabel(str: string): this;
|
|
18
|
-
setIcon(str: string): this;
|
|
19
|
-
doClose(): void;
|
|
20
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { MenuEntry } from "../classes/MenuEntry";
|
|
2
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
-
modelValue?: MenuEntry | undefined;
|
|
4
|
-
}>, {
|
|
5
|
-
modelValue: () => MenuEntry;
|
|
6
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
-
"update:modelValue": (...args: any[]) => void;
|
|
8
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
9
|
-
modelValue?: MenuEntry | undefined;
|
|
10
|
-
}>, {
|
|
11
|
-
modelValue: () => MenuEntry;
|
|
12
|
-
}>>> & {
|
|
13
|
-
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
14
|
-
}, {
|
|
15
|
-
modelValue: MenuEntry;
|
|
16
|
-
}, {}>, Partial<Record<string, (_: {
|
|
17
|
-
key: string;
|
|
18
|
-
entry: {
|
|
19
|
-
key: string;
|
|
20
|
-
href: string;
|
|
21
|
-
label: string;
|
|
22
|
-
icon: string;
|
|
23
|
-
onClick: Function | undefined;
|
|
24
|
-
isActiveChecker: Function | undefined;
|
|
25
|
-
isOpened: boolean;
|
|
26
|
-
isActive: boolean;
|
|
27
|
-
parent: any | undefined;
|
|
28
|
-
children: any[];
|
|
29
|
-
setChildren: (children: MenuEntry[]) => MenuEntry;
|
|
30
|
-
setOnClick: (fn: Function) => MenuEntry;
|
|
31
|
-
setIsActiveChecker: (fn: Function) => MenuEntry;
|
|
32
|
-
setIsActive: (enabled?: boolean) => MenuEntry;
|
|
33
|
-
setLabel: (str: string) => MenuEntry;
|
|
34
|
-
setIcon: (str: string) => MenuEntry;
|
|
35
|
-
doClose: () => void;
|
|
36
|
-
};
|
|
37
|
-
}) => any>> & Partial<Record<any, (_: {}) => any>>>;
|
|
38
|
-
export default _default;
|
|
39
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
40
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
41
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
42
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
43
|
-
} : {
|
|
44
|
-
type: import('vue').PropType<T[K]>;
|
|
45
|
-
required: true;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
type __VLS_WithDefaults<P, D> = {
|
|
49
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
50
|
-
default: D[K];
|
|
51
|
-
}> : P[K];
|
|
52
|
-
};
|
|
53
|
-
type __VLS_Prettify<T> = {
|
|
54
|
-
[K in keyof T]: T[K];
|
|
55
|
-
} & {};
|
|
56
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
57
|
-
new (): {
|
|
58
|
-
$slots: S;
|
|
59
|
-
};
|
|
60
|
-
};
|
package/dist/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Component, Plugin } from 'vue';
|
|
2
|
-
import "../style.css";
|
|
3
|
-
import { MenuEntry } from "./classes/MenuEntry";
|
|
4
|
-
declare const LktMenu: Plugin;
|
|
5
|
-
export default LktMenu;
|
|
6
|
-
export declare const createMenuEntry: (key: string, href: string, label: string) => MenuEntry;
|
|
7
|
-
export declare const setMenuToggleSlot: (component: string | Component) => boolean;
|
|
8
|
-
export { MenuEntry };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { MenuEntry } from "../classes/MenuEntry";
|
|
2
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
-
modelValue?: MenuEntry[] | undefined;
|
|
4
|
-
}>, {
|
|
5
|
-
modelValue: () => never[];
|
|
6
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
-
"update:modelValue": (...args: any[]) => void;
|
|
8
|
-
"click-outside": (...args: any[]) => void;
|
|
9
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
10
|
-
modelValue?: MenuEntry[] | undefined;
|
|
11
|
-
}>, {
|
|
12
|
-
modelValue: () => never[];
|
|
13
|
-
}>>> & {
|
|
14
|
-
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
15
|
-
"onClick-outside"?: ((...args: any[]) => any) | undefined;
|
|
16
|
-
}, {
|
|
17
|
-
modelValue: MenuEntry[];
|
|
18
|
-
}, {}>, Partial<Record<any, (_: {}) => any>>>;
|
|
19
|
-
export default _default;
|
|
20
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
21
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
22
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
23
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
24
|
-
} : {
|
|
25
|
-
type: import('vue').PropType<T[K]>;
|
|
26
|
-
required: true;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
type __VLS_WithDefaults<P, D> = {
|
|
30
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
31
|
-
default: D[K];
|
|
32
|
-
}> : P[K];
|
|
33
|
-
};
|
|
34
|
-
type __VLS_Prettify<T> = {
|
|
35
|
-
[K in keyof T]: T[K];
|
|
36
|
-
} & {};
|
|
37
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
38
|
-
new (): {
|
|
39
|
-
$slots: S;
|
|
40
|
-
};
|
|
41
|
-
};
|