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