lkt-menu 1.2.0 → 1.4.1

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 CHANGED
@@ -1,42 +1,59 @@
1
- declare class H {
2
- constructor(r: any, a: any, s: any);
3
- key: any;
4
- href: any;
5
- label: any;
6
- icon: string;
7
- isOpened: boolean;
8
- isActive: boolean;
9
- children: any[];
10
- setChildren(r: any): this;
11
- setOnClick(r: any): this;
12
- onClick: any;
13
- setIsActiveChecker(r: any): this;
14
- isActiveChecker: any;
15
- setIsActive(r?: boolean): this;
16
- setLabel(r: any): this;
17
- setIcon(r: any): this;
18
- doClose(): void;
19
- }
20
- declare function Xe(e: any, r: any, a: any): {
21
- key: any;
22
- href: any;
23
- label: any;
24
- icon: string;
25
- isOpened: boolean;
26
- isActive: boolean;
27
- children: any[];
28
- setChildren: (r: any) => H;
29
- setOnClick: (r: any) => H;
30
- onClick: any;
31
- setIsActiveChecker: (r: any) => H;
32
- isActiveChecker: any;
33
- setIsActive: (r?: boolean) => H;
34
- setLabel: (r: any) => H;
35
- setIcon: (r: any) => H;
1
+ import { MenuEntry as be } from "lkt-vue-kernel";
2
+ declare function Ve(u: any, m: any, o: any): {
3
+ key?: string | undefined;
4
+ href?: string | undefined;
5
+ label?: string | undefined;
6
+ icon?: string | undefined;
7
+ isActiveChecker?: Function | undefined;
8
+ isOpened?: boolean | undefined;
9
+ isActive?: boolean | undefined;
10
+ parent?: {
11
+ key?: string | undefined;
12
+ href?: string | undefined;
13
+ label?: string | undefined;
14
+ icon?: string | undefined;
15
+ isActiveChecker?: Function | undefined;
16
+ isOpened?: boolean | undefined;
17
+ isActive?: boolean | undefined;
18
+ parent?: /*elided*/ any | undefined;
19
+ children?: /*elided*/ any[] | undefined;
20
+ events?: {
21
+ click?: Function | undefined;
22
+ } | undefined;
23
+ onClick?: Function | undefined;
24
+ } | undefined;
25
+ children?: {
26
+ key?: string | undefined;
27
+ href?: string | undefined;
28
+ label?: string | undefined;
29
+ icon?: string | undefined;
30
+ isActiveChecker?: Function | undefined;
31
+ isOpened?: boolean | undefined;
32
+ isActive?: boolean | undefined;
33
+ parent?: /*elided*/ any | undefined;
34
+ children?: /*elided*/ any[] | undefined;
35
+ events?: {
36
+ click?: Function | undefined;
37
+ } | undefined;
38
+ onClick?: Function | undefined;
39
+ }[] | undefined;
40
+ events?: {
41
+ click?: Function | undefined;
42
+ } | undefined;
43
+ onClick?: Function | undefined;
44
+ setChildren: (children: z[]) => z;
45
+ setOnClick: (fn: Function) => z;
46
+ setIsActiveChecker: (fn: Function) => z;
47
+ setIsActive: (enabled?: boolean) => z;
48
+ setLabel: (str: string) => z;
49
+ setIcon: (str: string) => z;
36
50
  doClose: () => void;
51
+ feed: (data?: import("lkt-vue-kernel").LktObject, target?: z | undefined) => void;
52
+ assignProp: (key: string, value: any) => void;
37
53
  };
38
- declare namespace Qe {
39
- function install(e: any): void;
54
+ declare namespace _e {
55
+ function install(u: any): void;
40
56
  }
41
- declare function Ye(e: any): boolean;
42
- export { H as MenuEntry, Xe as createMenuEntry, Qe as default, Ye as setMenuToggleSlot };
57
+ declare function Ce(u: any): boolean;
58
+ import { MenuEntry as z } from "lkt-vue-kernel";
59
+ export { be as MenuEntry, Ve as createMenuEntry, _e as default, Ce as setMenuToggleSlot };
package/dist/build.js CHANGED
@@ -1,218 +1,208 @@
1
- import { defineComponent as B, ref as O, useSlots as U, computed as c, watch as x, onMounted as J, resolveComponent as z, createElementBlock as d, openBlock as i, normalizeClass as S, createElementVNode as A, createCommentVNode as k, createVNode as W, withCtx as V, renderSlot as D, unref as q, toDisplayString as G, createBlock as R, resolveDynamicComponent as Q, Fragment as F, renderList as M, createSlots as $, reactive as X } from "vue";
2
- import { useRouter as Y } from "vue-router";
3
- import "lkt-string-tools";
4
- import { __ as Z } from "lkt-i18n";
5
- import { DataState as ee } from "lkt-data-state";
6
- import { httpCall as te } from "lkt-http-client";
7
- class H {
8
- constructor(r, a, s) {
9
- 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 = r, this.href = a, this.label = s;
10
- }
11
- setChildren(r) {
12
- return r.forEach((a) => a.parent = this), this.children = r, this;
13
- }
14
- setOnClick(r) {
15
- return this.onClick = r, this;
16
- }
17
- setIsActiveChecker(r) {
18
- return this.isActiveChecker = r, this;
19
- }
20
- setIsActive(r = !0) {
21
- return this.isActive = r, this;
22
- }
23
- setLabel(r) {
24
- return this.label = r, this;
25
- }
26
- setIcon(r) {
27
- return this.icon = r, this;
28
- }
29
- doClose() {
30
- this.isOpened = !1;
31
- }
32
- }
33
- const T = (e, r) => (r.forEach((a) => {
34
- e.includes(a.key) || e.push(a.key), a.children.length > 0 && T(e, a.children);
35
- }), e), w = class w {
1
+ import { defineComponent as K, ref as R, useSlots as T, computed as i, watch as M, onMounted as G, resolveComponent as J, createElementBlock as c, openBlock as r, normalizeClass as D, createElementVNode as A, createCommentVNode as h, createVNode as H, withCtx as j, renderSlot as x, unref as P, toDisplayString as Q, createBlock as L, resolveDynamicComponent as X, Fragment as F, renderList as E, createSlots as W, mergeDefaults as Y, reactive as Z } from "vue";
2
+ import { MenuEntry as z, extractI18nValue as ee, getDefaultValues as te, Menu as le } from "lkt-vue-kernel";
3
+ import { MenuEntry as be } from "lkt-vue-kernel";
4
+ import { useRouter as ne } from "vue-router";
5
+ import { DataState as ue } from "lkt-data-state";
6
+ import { httpCall as oe } from "lkt-http-client";
7
+ const U = (u, m) => (m.forEach((o) => {
8
+ u.includes(o.key) || u.push(o.key), o.children.length > 0 && U(u, o.children);
9
+ }), u), I = class I {
36
10
  };
37
- w.toggleSlot = "", w.debugEnabled = !1;
38
- let y = w;
39
- var re = ((e) => (e.Button = "button", e.Submit = "submit", e.Reset = "reset", e.Anchor = "anchor", e.Content = "content", e.Switch = "switch", e.HiddenSwitch = "hidden-switch", e.Split = "split", e.SplitLazy = "split-lazy", e.SplitEver = "split-ever", e.Tooltip = "tooltip", e.TooltipLazy = "tooltip-lazy", e.TooltipEver = "tooltip-ever", e))(re || {}), ne = ((e) => (e.Text = "text", e.Email = "email", e.Tel = "tel", e.Password = "password", e.Search = "search", e.Number = "number", e.Color = "color", e.Range = "range", e.Textarea = "textarea", e.Html = "html", e.Date = "date", e.File = "file", e.Image = "image", e.Select = "select", e.Check = "check", e.Switch = "switch", e.Calc = "calc", e.Card = "card", e.Elements = "elements", e))(ne || {}), le = ((e) => (e.Auto = "auto", e.Always = "always", e.Lazy = "lazy", e.Ever = "ever", e))(le || {}), ae = ((e) => (e.Transform = "transform", e.Height = "height", e.Display = "display", e))(ae || {}), oe = ((e) => (e.Href = "href", e.RouterLink = "router-link", e.RouterLinkBack = "router-link-back", e.Mail = "mail", e.Tel = "tel", e.Tab = "tab", e.Download = "download", e.Action = "action", e.Legacy = "", e))(oe || {}), ie = ((e) => (e.None = "", e.Field = "field", e.Button = "button", e.Anchor = "anchor", e))(ie || {}), se = ((e) => (e.List = "list", e.Inline = "inline", e.Count = "count", e))(se || {}), ue = ((e) => (e.None = "", e.Focus = "focus", e.Blur = "blur", e.Always = "always", e))(ue || {}), ce = ((e) => (e.MinStringLength = "min-str", e.MinNumber = "min-num", e.MaxStringLength = "max-str", e.MaxNumber = "max-num", e.Email = "email", e.Empty = "empty", e.EqualTo = "equal-to", e.MinNumbers = "min-numbers", e.MaxNumbers = "max-numbers", e.MinChars = "min-chars", e.MaxChars = "max-chars", e.MinUpperChars = "min-upper-chars", e.MaxUpperChars = "max-upper-chars", e.MinLowerChars = "min-lower-chars", e.MaxLowerChars = "max-lower-chars", e.MinSpecialChars = "min-special-chars", e.MaxSpecialChars = "max-special-chars", e))(ce || {}), de = ((e) => (e.Ok = "ok", e.Ko = "ko", e.Info = "info", e))(de || {}), ve = ((e) => (e.Create = "create", e.Update = "update", e.Read = "read", e))(ve || {}), me = ((e) => (e.Inline = "inline", e.Modal = "modal", e))(me || {}), he = ((e) => (e.Top = "top", e.Bottom = "bottom", e))(he || {}), pe = ((e) => (e.Changed = "changed", e.Always = "always", e.Never = "never", e))(pe || {}), fe = ((e) => (e.Manual = "manual", e.Auto = "auto", e.Delay = "delay", e))(fe || {}), ke = ((e) => (e.Toast = "toast", e.Inline = "inline", e))(ke || {}), ye = ((e) => (e.Pages = "pages", e.PrevNext = "prev-next", e.PagesPrevNext = "pages-prev-next", e.PagesPrevNextFirstLast = "pages-prev-next-first-last", e.LoadMore = "load-more", e.Infinite = "infinite", e))(ye || {}), ge = ((e) => (e.Table = "table", e.Item = "item", e.Ul = "ul", e.Ol = "ol", e))(ge || {}), Ce = ((e) => (e[e.Auto = 0] = "Auto", e[e.PreferItem = 1] = "PreferItem", e[e.PreferCustomItem = 2] = "PreferCustomItem", e[e.PreferColumns = 3] = "PreferColumns", e))(Ce || {}), be = ((e) => (e.NotDefined = "", e.ActionIcon = "action-icon", e))(be || {}), _e = ((e) => (e.Message = "message", e.Button = "button", e))(_e || {}), Se = ((e) => (e.Left = "left", e.Center = "center", e.Right = "right", e))(Se || {}), xe = ((e) => (e.Fixed = "fixed", e.Absolute = "absolute", e))(xe || {}), Ae = ((e) => (e.Top = "top", e.Bottom = "bottom", e.Center = "center", e.ReferrerCenter = "referrer-center", e))(Ae || {}), Me = ((e) => (e.Left = "left", e.Right = "right", e.Center = "center", e.LeftCorner = "left-corner", e.RightCorner = "right-corner", e))(Me || {}), we = ((e) => (e.Refresh = "refresh", e.Close = "close", e.ReOpen = "reOpen", e.Exec = "exec", e.Open = "open", e))(we || {}), Ie = ((e) => (e.Modal = "modal", e.Confirm = "confirm", e))(Ie || {}), Ee = ((e) => (e.None = "", e.Incremental = "incremental", e.Decremental = "decremental", e))(Ee || {}), Le = ((e) => (e.NotDefined = "", e.Hidden = "hidden", e.Integer = "integer", e.Decimal = "decimal", e.Auto = "auto", e))(Le || {}), Ne = ((e) => (e.Asc = "asc", e.Desc = "desc", e))(Ne || {}), Oe = ((e) => (e.Create = "create", e.Update = "update", e.Edit = "edit", e.Drop = "drop", e.Sort = "sort", e.SwitchEditMode = "switch-edit-mode", e.InlineEdit = "inline-edit", e.InlineCreate = "inline-create", e.ModalCreate = "modal-create", e.InlineCreateEver = "inline-create-ever", e))(Oe || {}), Ve = ((e) => (e.Lazy = "lazy", e.Ever = "ever", e))(Ve || {}), De = (e) => {
40
- let r = String(e);
41
- return r.startsWith("__:") ? Z(r.substring(3)) : r;
42
- };
43
- const Re = { class: "lkt-menu-entry-main" }, Te = { class: "lkt-entry-content" }, Pe = {
11
+ I.toggleSlot = "", I.debugEnabled = !1;
12
+ let y = I;
13
+ const re = { class: "lkt-menu-entry-main" }, ae = { class: "lkt-entry-content" }, se = {
44
14
  key: 0,
45
15
  class: "lkt-menu-entry-icon"
46
- }, ze = {
16
+ }, ie = {
47
17
  key: 1,
48
18
  class: "lkt-menu-entry-text"
49
- }, Be = {
19
+ }, ce = {
50
20
  key: 0,
51
21
  class: "lkt-menu-entry-children"
52
- }, Ue = /* @__PURE__ */ B({
22
+ }, de = /* @__PURE__ */ K({
53
23
  __name: "MenuItem",
54
24
  props: {
55
- modelValue: { default: () => new H("", "", "") }
25
+ modelValue: { default: () => new z() }
56
26
  },
57
- emits: ["update:modelValue"],
58
- setup(e, { emit: r }) {
59
- const a = r, s = e, t = O(s.modelValue), u = U(), f = Y(), h = O(!1), g = () => {
60
- t.value.isOpened = !t.value.isOpened;
61
- }, I = () => (t.value.children.length > 0 && g(), typeof t.value.onClick == "function" && t.value.onClick({
62
- entry: t.value
63
- }), 1), C = c(() => u["icon-" + t.value.key] || t.value.icon !== ""), E = c(() => {
64
- let l = [];
65
- return C.value && l.push("has-icon"), h.value && l.push("is-active"), l.join(" ");
66
- }), o = c(() => T([], t.value.children)), n = c(() => {
67
- let l = [];
68
- for (let v in u)
69
- v.startsWith("icon-") && o.value.includes(v.substring(5)) && l.push(v);
70
- return l;
71
- }), m = c(() => De(t.value.label)), b = c(() => t.value.isActive ? !0 : typeof t.value.isActiveChecker == "function" ? !!t.value.isActiveChecker({
72
- entry: t.value
73
- }) : !1), p = c(() => !!y.toggleSlot), j = c(() => y.toggleSlot);
74
- return x(() => s.modelValue, (l) => {
75
- t.value = l;
76
- }, { deep: !0 }), x(t, (l) => {
77
- a("update:modelValue", l);
78
- }, { deep: !0 }), J(() => {
79
- let l = f == null ? void 0 : f.currentRoute;
80
- if (l) {
81
- if (l.value.path === t.value.href)
82
- t.value.isOpened = !0;
83
- else if (t.value.children.length > 0) {
84
- let v = !1;
85
- t.value.children.forEach((L) => {
86
- l.value.path === L.href && (v = !0);
87
- }), v && (t.value.isOpened = !0);
27
+ emits: [
28
+ "update:modelValue"
29
+ ],
30
+ setup(u, { emit: m }) {
31
+ const o = m, d = u, e = R(d.modelValue), s = T(), k = ne(), p = R(!1), g = () => {
32
+ e.value.isOpened = !e.value.isOpened;
33
+ }, N = () => {
34
+ var t, a;
35
+ return ((t = e.value.children) == null ? void 0 : t.length) > 0 && g(), typeof ((a = e.value.events) == null ? void 0 : a.click) == "function" ? (e.value.events.click({
36
+ entry: e.value
37
+ }), 1) : (typeof e.value.onClick == "function" && e.value.onClick({
38
+ entry: e.value
39
+ }), 1);
40
+ }, _ = i(() => s["icon-" + e.value.key] || e.value.icon !== ""), $ = i(() => {
41
+ let t = [];
42
+ return _.value && t.push("has-icon"), p.value && t.push("is-active"), t.join(" ");
43
+ }), n = i(() => U([], e.value.children)), l = i(() => {
44
+ let t = [];
45
+ for (let a in s)
46
+ a.startsWith("icon-") && n.value.includes(a.substring(5)) && t.push(a);
47
+ return t;
48
+ }), v = i(() => ee(e.value.label)), V = i(() => e.value.isActive ? !0 : typeof e.value.isActiveChecker == "function" ? !!e.value.isActiveChecker({
49
+ entry: e.value
50
+ }) : !1), f = i(() => !!y.toggleSlot), q = i(() => y.toggleSlot);
51
+ return M(() => d.modelValue, (t) => {
52
+ e.value = t;
53
+ }, { deep: !0 }), M(e, (t) => {
54
+ o("update:modelValue", t);
55
+ }, { deep: !0 }), G(() => {
56
+ var a, C;
57
+ let t = k == null ? void 0 : k.currentRoute;
58
+ if (t) {
59
+ if (t.value.path === e.value.href)
60
+ e.value.isOpened = !0;
61
+ else if (((a = e.value.children) == null ? void 0 : a.length) > 0) {
62
+ let S = !1;
63
+ (C = e.value.children) == null || C.forEach((O) => {
64
+ t.value.path === O.href && (S = !0);
65
+ }), S && (e.value.isOpened = !0);
88
66
  }
89
67
  }
90
- }), (l, v) => {
91
- const L = z("lkt-anchor"), K = z("menu-item", !0);
92
- return i(), d("div", {
93
- class: S(["lkt-menu-entry", E.value])
68
+ }), (t, a) => {
69
+ var O;
70
+ const C = J("lkt-anchor"), S = J("menu-item", !0);
71
+ return r(), c("div", {
72
+ class: D(["lkt-menu-entry", $.value])
94
73
  }, [
95
- A("div", Re, [
96
- W(L, {
97
- to: t.value.href,
98
- "on-click": I,
99
- "is-active": b.value,
100
- onActive: v[0] || (v[0] = (P) => h.value = P)
74
+ A("div", re, [
75
+ H(C, {
76
+ to: e.value.href,
77
+ "on-click": N,
78
+ "is-active": V.value,
79
+ onActive: a[0] || (a[0] = (B) => p.value = B)
101
80
  }, {
102
- default: V(() => [
103
- A("div", Te, [
104
- C.value ? (i(), d("div", Pe, [
105
- q(u)["icon-" + t.value.key] ? D(l.$slots, "icon-" + t.value.key, {
106
- key: t.value.key,
107
- entry: t.value
108
- }) : t.value.icon !== "" ? (i(), d("i", {
81
+ default: j(() => [
82
+ A("div", ae, [
83
+ _.value ? (r(), c("div", se, [
84
+ P(s)["icon-" + e.value.key] ? x(t.$slots, "icon-" + e.value.key, {
85
+ key: e.value.key,
86
+ entry: e.value
87
+ }) : e.value.icon !== "" ? (r(), c("i", {
109
88
  key: 1,
110
- class: S(t.value.icon)
111
- }, null, 2)) : k("", !0)
112
- ])) : k("", !0),
113
- t.value.label !== "" ? (i(), d("div", ze, G(m.value), 1)) : k("", !0)
89
+ class: D(e.value.icon)
90
+ }, null, 2)) : h("", !0)
91
+ ])) : h("", !0),
92
+ e.value.label !== "" ? (r(), c("div", ie, Q(v.value), 1)) : h("", !0)
114
93
  ])
115
94
  ]),
116
95
  _: 3
117
96
  }, 8, ["to", "is-active"]),
118
- t.value.children.length > 0 ? (i(), d("div", {
97
+ ((O = e.value.children) == null ? void 0 : O.length) > 0 ? (r(), c("div", {
119
98
  key: 0,
120
99
  class: "lkt-menu-entry-toggle",
121
100
  onClick: g
122
101
  }, [
123
- p.value ? (i(), R(Q(j.value), {
102
+ f.value ? (r(), L(X(q.value), {
124
103
  key: 0,
125
- class: S(["lkt-menu-entry-toggle-inner", t.value.isOpened ? "is-opened" : ""])
126
- }, null, 8, ["class"])) : (i(), d("div", {
104
+ class: D(["lkt-menu-entry-toggle-inner", e.value.isOpened ? "is-opened" : ""])
105
+ }, null, 8, ["class"])) : (r(), c("div", {
127
106
  key: 1,
128
- class: S(["lkt-menu-entry-toggle-inner lkt-menu-entry-toggle-triangle", t.value.isOpened ? "is-opened" : ""])
107
+ class: D(["lkt-menu-entry-toggle-inner lkt-menu-entry-toggle-triangle", e.value.isOpened ? "is-opened" : ""])
129
108
  }, null, 2))
130
- ])) : k("", !0)
109
+ ])) : h("", !0)
131
110
  ]),
132
- t.value.isOpened ? (i(), d("div", Be, [
133
- (i(!0), d(F, null, M(t.value.children, (P, N) => (i(), R(K, {
134
- modelValue: t.value.children[N],
135
- "onUpdate:modelValue": (_) => t.value.children[N] = _,
136
- key: t.value.children[N].key
137
- }, $({ _: 2 }, [
138
- M(n.value, (_) => ({
139
- name: _,
140
- fn: V(() => [
141
- D(l.$slots, _)
111
+ e.value.isOpened ? (r(), c("div", ce, [
112
+ (r(!0), c(F, null, E(e.value.children, (B, w) => (r(), L(S, {
113
+ modelValue: e.value.children[w],
114
+ "onUpdate:modelValue": (b) => e.value.children[w] = b,
115
+ key: e.value.children[w].key
116
+ }, W({ _: 2 }, [
117
+ E(l.value, (b) => ({
118
+ name: b,
119
+ fn: j(() => [
120
+ x(t.$slots, b)
142
121
  ])
143
122
  }))
144
123
  ]), 1032, ["modelValue", "onUpdate:modelValue"]))), 128))
145
- ])) : k("", !0)
124
+ ])) : h("", !0)
146
125
  ], 2);
147
126
  };
148
127
  }
149
- }), Fe = { class: "lkt-menu-container" }, $e = { class: "lkt-menu" }, He = /* @__PURE__ */ B({
128
+ }), ve = { class: "lkt-menu-container" }, me = { class: "lkt-menu" }, pe = /* @__PURE__ */ K({
150
129
  __name: "LktMenu",
151
- props: {
152
- modelValue: { default: () => [] },
153
- resource: { default: "" },
154
- resourceData: { default: () => ({}) }
155
- },
156
- emits: ["update:modelValue", "click-outside", "loading", "results", "response", "error"],
157
- setup(e, { emit: r }) {
158
- const a = e, s = r, t = U(), u = O(a.modelValue), f = (o) => {
159
- let n = {};
160
- typeof o == "object" && Object.keys(o).length > 0 && (n = JSON.parse(JSON.stringify(o)));
161
- for (let m in n)
162
- (Array.isArray(n[m]) || typeof n[m] == "object") && (n[m] = JSON.stringify(n[m]));
163
- return n;
130
+ props: /* @__PURE__ */ Y({
131
+ modelValue: {},
132
+ resource: {},
133
+ resourceData: {}
134
+ }, te(le)),
135
+ emits: [
136
+ "update:modelValue",
137
+ "click-outside",
138
+ "loading",
139
+ "results",
140
+ "response",
141
+ "error"
142
+ ],
143
+ setup(u, { emit: m }) {
144
+ const o = u, d = m, e = T(), s = R(o.modelValue), k = (n) => {
145
+ let l = {};
146
+ typeof n == "object" && Object.keys(n).length > 0 && (l = JSON.parse(JSON.stringify(n)));
147
+ for (let v in l)
148
+ (Array.isArray(l[v]) || typeof l[v] == "object") && (l[v] = JSON.stringify(l[v]));
149
+ return l;
164
150
  };
165
- let h = new ee({});
166
- h.increment(f(a.resourceData));
167
- const g = c(() => T([], u.value)), I = c(() => {
168
- let o = [];
169
- for (let n in t)
170
- n.startsWith("icon-") && g.value.includes(n.substring(5)) && o.push(n);
171
- return o;
172
- }), C = () => {
173
- if (!a.resource) return;
174
- let o = h.getData();
175
- s("loading"), te(a.resource, o).then((n) => {
176
- h.turnStoredIntoOriginal(), u.value = n.data, s("results", n.data), s("response", n);
177
- }).catch((n) => {
178
- s("error", n);
151
+ let p = new ue({});
152
+ p.increment(k(o.resourceData));
153
+ const g = i(() => U([], s.value)), N = i(() => {
154
+ let n = [];
155
+ for (let l in e)
156
+ l.startsWith("icon-") && g.value.includes(l.substring(5)) && n.push(l);
157
+ return n;
158
+ }), _ = () => {
159
+ if (!o.resource) return;
160
+ let n = p.getData();
161
+ d("loading"), oe(o.resource, n).then((l) => {
162
+ p.turnStoredIntoOriginal(), s.value = l.data, d("results", l.data), d("response", l);
163
+ }).catch((l) => {
164
+ d("error", l);
179
165
  });
180
- }, E = () => {
181
- s("click-outside");
166
+ }, $ = () => {
167
+ d("click-outside");
182
168
  };
183
- return x(() => a.modelValue, (o) => {
184
- u.value = o;
185
- }, { deep: !0 }), x(u, (o) => {
186
- s("update:modelValue", o);
187
- }, { deep: !0 }), C(), (o, n) => (i(), d("div", Fe, [
188
- A("div", $e, [
189
- (i(!0), d(F, null, M(u.value, (m, b) => (i(), R(Ue, {
190
- modelValue: u.value[b],
191
- "onUpdate:modelValue": (p) => u.value[b] = p,
192
- key: m.key
193
- }, $({ _: 2 }, [
194
- M(I.value, (p) => ({
195
- name: p,
196
- fn: V(() => [
197
- D(o.$slots, p)
169
+ return M(() => o.modelValue, (n) => {
170
+ s.value = n;
171
+ }, { deep: !0 }), M(s, (n) => {
172
+ d("update:modelValue", n);
173
+ }, { deep: !0 }), _(), (n, l) => (r(), c("div", ve, [
174
+ A("div", me, [
175
+ (r(!0), c(F, null, E(s.value, (v, V) => (r(), L(de, {
176
+ modelValue: s.value[V],
177
+ "onUpdate:modelValue": (f) => s.value[V] = f,
178
+ key: v.key
179
+ }, W({ _: 2 }, [
180
+ E(N.value, (f) => ({
181
+ name: f,
182
+ fn: j(() => [
183
+ x(n.$slots, f)
198
184
  ])
199
185
  }))
200
186
  ]), 1032, ["modelValue", "onUpdate:modelValue"]))), 128))
201
187
  ]),
202
188
  A("div", {
203
189
  class: "lkt-menu-outside",
204
- onClick: E
190
+ onClick: $
205
191
  })
206
192
  ]));
207
193
  }
208
- }), Qe = {
209
- install: (e) => {
210
- e.component("lkt-menu") === void 0 && e.component("lkt-menu", He);
194
+ }), _e = {
195
+ install: (u) => {
196
+ u.component("lkt-menu") === void 0 && u.component("lkt-menu", pe);
211
197
  }
212
- }, Xe = (e, r, a) => X(new H(e, r, a)), Ye = (e) => (y.toggleSlot = e, !0);
198
+ }, Ve = (u, m, o) => Z(new z({
199
+ key: u,
200
+ href: m,
201
+ label: o
202
+ })), Ce = (u) => (y.toggleSlot = u, !0);
213
203
  export {
214
- H as MenuEntry,
215
- Xe as createMenuEntry,
216
- Qe as default,
217
- Ye as setMenuToggleSlot
204
+ be as MenuEntry,
205
+ Ve as createMenuEntry,
206
+ _e as default,
207
+ Ce as setMenuToggleSlot
218
208
  };
@@ -1,19 +1,49 @@
1
- import { MenuEntry } from '../classes/MenuEntry';
2
- import { LktObject } from 'lkt-ts-interfaces';
1
+ import { LktObject, MenuEntry } from 'lkt-vue-kernel';
3
2
  type __VLS_Props = {
4
3
  modelValue?: MenuEntry;
5
4
  };
6
5
  declare const entry: import("vue").Ref<{
7
- key: string;
8
- href: string;
9
- label: string;
10
- icon: string;
11
- onClick: Function | undefined;
12
- isActiveChecker: Function | undefined;
13
- isOpened: boolean;
14
- isActive: boolean;
15
- parent: /*elided*/ any | undefined;
16
- children: /*elided*/ any[];
6
+ key?: string | undefined;
7
+ href?: string | undefined;
8
+ label?: string | undefined;
9
+ icon?: string | undefined;
10
+ isActiveChecker?: Function | undefined;
11
+ isOpened?: boolean | undefined;
12
+ isActive?: boolean | undefined;
13
+ parent?: {
14
+ key?: string | undefined;
15
+ href?: string | undefined;
16
+ label?: string | undefined;
17
+ icon?: string | undefined;
18
+ isActiveChecker?: Function | undefined;
19
+ isOpened?: boolean | undefined;
20
+ isActive?: boolean | undefined;
21
+ parent?: /*elided*/ any | undefined;
22
+ children?: /*elided*/ any[] | undefined;
23
+ events?: {
24
+ click?: Function | undefined;
25
+ } | undefined;
26
+ onClick?: Function | undefined;
27
+ } | undefined;
28
+ children?: {
29
+ key?: string | undefined;
30
+ href?: string | undefined;
31
+ label?: string | undefined;
32
+ icon?: string | undefined;
33
+ isActiveChecker?: Function | undefined;
34
+ isOpened?: boolean | undefined;
35
+ isActive?: boolean | undefined;
36
+ parent?: /*elided*/ any | undefined;
37
+ children?: /*elided*/ any[] | undefined;
38
+ events?: {
39
+ click?: Function | undefined;
40
+ } | undefined;
41
+ onClick?: Function | undefined;
42
+ }[] | undefined;
43
+ events?: {
44
+ click?: Function | undefined;
45
+ } | undefined;
46
+ onClick?: Function | undefined;
17
47
  setChildren: (children: MenuEntry[]) => MenuEntry;
18
48
  setOnClick: (fn: Function) => MenuEntry;
19
49
  setIsActiveChecker: (fn: Function) => MenuEntry;
@@ -21,17 +51,50 @@ declare const entry: import("vue").Ref<{
21
51
  setLabel: (str: string) => MenuEntry;
22
52
  setIcon: (str: string) => MenuEntry;
23
53
  doClose: () => void;
54
+ feed: (data?: LktObject, target?: MenuEntry | undefined) => void;
55
+ assignProp: (key: string, value: any) => void;
24
56
  }, MenuEntry | {
25
- key: string;
26
- href: string;
27
- label: string;
28
- icon: string;
29
- onClick: Function | undefined;
30
- isActiveChecker: Function | undefined;
31
- isOpened: boolean;
32
- isActive: boolean;
33
- parent: /*elided*/ any | undefined;
34
- children: /*elided*/ any[];
57
+ key?: string | undefined;
58
+ href?: string | undefined;
59
+ label?: string | undefined;
60
+ icon?: string | undefined;
61
+ isActiveChecker?: Function | undefined;
62
+ isOpened?: boolean | undefined;
63
+ isActive?: boolean | undefined;
64
+ parent?: {
65
+ key?: string | undefined;
66
+ href?: string | undefined;
67
+ label?: string | undefined;
68
+ icon?: string | undefined;
69
+ isActiveChecker?: Function | undefined;
70
+ isOpened?: boolean | undefined;
71
+ isActive?: boolean | undefined;
72
+ parent?: /*elided*/ any | undefined;
73
+ children?: /*elided*/ any[] | undefined;
74
+ events?: {
75
+ click?: Function | undefined;
76
+ } | undefined;
77
+ onClick?: Function | undefined;
78
+ } | undefined;
79
+ children?: {
80
+ key?: string | undefined;
81
+ href?: string | undefined;
82
+ label?: string | undefined;
83
+ icon?: string | undefined;
84
+ isActiveChecker?: Function | undefined;
85
+ isOpened?: boolean | undefined;
86
+ isActive?: boolean | undefined;
87
+ parent?: /*elided*/ any | undefined;
88
+ children?: /*elided*/ any[] | undefined;
89
+ events?: {
90
+ click?: Function | undefined;
91
+ } | undefined;
92
+ onClick?: Function | undefined;
93
+ }[] | undefined;
94
+ events?: {
95
+ click?: Function | undefined;
96
+ } | undefined;
97
+ onClick?: Function | undefined;
35
98
  setChildren: (children: MenuEntry[]) => MenuEntry;
36
99
  setOnClick: (fn: Function) => MenuEntry;
37
100
  setIsActiveChecker: (fn: Function) => MenuEntry;
@@ -39,6 +102,8 @@ declare const entry: import("vue").Ref<{
39
102
  setLabel: (str: string) => MenuEntry;
40
103
  setIcon: (str: string) => MenuEntry;
41
104
  doClose: () => void;
105
+ feed: (data?: LktObject, target?: MenuEntry | undefined) => void;
106
+ assignProp: (key: string, value: any) => void;
42
107
  }>, slots: Readonly<{
43
108
  [name: string]: import("vue").Slot<any> | undefined;
44
109
  }>, isActive: import("vue").Ref<boolean, boolean>;
@@ -46,19 +111,50 @@ declare const onClickToggle: () => void, onClick: () => number;
46
111
  declare const canRenderIcon: import("vue").ComputedRef<boolean | import("vue").Slot<any>>, classes: import("vue").ComputedRef<string>;
47
112
  declare const entryIconSlots: import("vue").ComputedRef<LktObject>, computedLabel: import("vue").ComputedRef<any>, computedIsActive: import("vue").ComputedRef<boolean>, hasToggleSlot: import("vue").ComputedRef<boolean>, toggleSlot: import("vue").ComputedRef<string | import("vue").Component>;
48
113
  declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
49
- declare var __VLS_10: string, __VLS_11: {
50
- key: string;
114
+ declare var __VLS_9: string, __VLS_10: {
115
+ key: string | undefined;
51
116
  entry: {
52
- key: string;
53
- href: string;
54
- label: string;
55
- icon: string;
56
- onClick: Function | undefined;
57
- isActiveChecker: Function | undefined;
58
- isOpened: boolean;
59
- isActive: boolean;
60
- parent: /*elided*/ any | undefined;
61
- children: /*elided*/ any[];
117
+ key?: string | undefined;
118
+ href?: string | undefined;
119
+ label?: string | undefined;
120
+ icon?: string | undefined;
121
+ isActiveChecker?: Function | undefined;
122
+ isOpened?: boolean | undefined;
123
+ isActive?: boolean | undefined;
124
+ parent?: {
125
+ key?: string | undefined;
126
+ href?: string | undefined;
127
+ label?: string | undefined;
128
+ icon?: string | undefined;
129
+ isActiveChecker?: Function | undefined;
130
+ isOpened?: boolean | undefined;
131
+ isActive?: boolean | undefined;
132
+ parent?: /*elided*/ any | undefined;
133
+ children?: /*elided*/ any[] | undefined;
134
+ events?: {
135
+ click?: Function | undefined;
136
+ } | undefined;
137
+ onClick?: Function | undefined;
138
+ } | undefined;
139
+ children?: {
140
+ key?: string | undefined;
141
+ href?: string | undefined;
142
+ label?: string | undefined;
143
+ icon?: string | undefined;
144
+ isActiveChecker?: Function | undefined;
145
+ isOpened?: boolean | undefined;
146
+ isActive?: boolean | undefined;
147
+ parent?: /*elided*/ any | undefined;
148
+ children?: /*elided*/ any[] | undefined;
149
+ events?: {
150
+ click?: Function | undefined;
151
+ } | undefined;
152
+ onClick?: Function | undefined;
153
+ }[] | undefined;
154
+ events?: {
155
+ click?: Function | undefined;
156
+ } | undefined;
157
+ onClick?: Function | undefined;
62
158
  setChildren: (children: MenuEntry[]) => MenuEntry;
63
159
  setOnClick: (fn: Function) => MenuEntry;
64
160
  setIsActiveChecker: (fn: Function) => MenuEntry;
@@ -66,12 +162,14 @@ declare var __VLS_10: string, __VLS_11: {
66
162
  setLabel: (str: string) => MenuEntry;
67
163
  setIcon: (str: string) => MenuEntry;
68
164
  doClose: () => void;
165
+ feed: (data?: LktObject, target?: MenuEntry | undefined) => void;
166
+ assignProp: (key: string, value: any) => void;
69
167
  };
70
- }, __VLS_22: any, __VLS_23: {};
168
+ }, __VLS_24: any, __VLS_25: {};
71
169
  type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
72
- [K in NonNullable<typeof __VLS_10>]?: (props: typeof __VLS_11) => any;
170
+ [K in NonNullable<typeof __VLS_9>]?: (props: typeof __VLS_10) => any;
73
171
  } & {
74
- [K in NonNullable<typeof __VLS_22>]?: (props: typeof __VLS_23) => any;
172
+ [K in NonNullable<typeof __VLS_24>]?: (props: typeof __VLS_25) => any;
75
173
  }>;
76
174
  declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
77
175
  entry: typeof entry;
@@ -1,2 +1,2 @@
1
- import { MenuEntry } from "../classes/MenuEntry";
1
+ import { MenuEntry } from "lkt-vue-kernel";
2
2
  export declare const fetchKeys: (r: string[], entries: MenuEntry[]) => string[];
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Component, Plugin } from 'vue';
2
2
  import "../style.css";
3
- import { MenuEntry } from "./classes/MenuEntry";
3
+ import { MenuEntry } from "lkt-vue-kernel";
4
4
  declare const LktMenu: Plugin;
5
5
  export default LktMenu;
6
6
  export declare const createMenuEntry: (key: string, href: string, label: string) => MenuEntry;
@@ -1,56 +1,42 @@
1
- import { MenuEntry } from "../classes/MenuEntry";
2
- import MenuItem from "../components/MenuItem.vue";
3
- import { LktObject } from "lkt-ts-interfaces";
4
- type __VLS_Props = {
5
- modelValue?: MenuEntry[];
6
- resource?: string;
7
- resourceData: LktObject;
8
- };
1
+ import MenuItem from '../components/MenuItem.vue';
2
+ import { LktObject, MenuConfig } from 'lkt-vue-kernel';
9
3
  declare const entries: import("vue").Ref<{
10
- key: string;
11
- href: string;
12
- label: string;
13
- icon: string;
14
- onClick: Function | undefined;
15
- isActiveChecker: Function | undefined;
16
- isOpened: boolean;
17
- isActive: boolean;
18
- parent: /*elided*/ any | undefined;
19
- children: /*elided*/ any[];
20
- setChildren: (children: MenuEntry[]) => MenuEntry;
21
- setOnClick: (fn: Function) => MenuEntry;
22
- setIsActiveChecker: (fn: Function) => MenuEntry;
23
- setIsActive: (enabled?: boolean) => MenuEntry;
24
- setLabel: (str: string) => MenuEntry;
25
- setIcon: (str: string) => MenuEntry;
26
- doClose: () => void;
27
- }[], MenuEntry[] | {
28
- key: string;
29
- href: string;
30
- label: string;
31
- icon: string;
32
- onClick: Function | undefined;
33
- isActiveChecker: Function | undefined;
34
- isOpened: boolean;
35
- isActive: boolean;
36
- parent: /*elided*/ any | undefined;
37
- children: /*elided*/ any[];
38
- setChildren: (children: MenuEntry[]) => MenuEntry;
39
- setOnClick: (fn: Function) => MenuEntry;
40
- setIsActiveChecker: (fn: Function) => MenuEntry;
41
- setIsActive: (enabled?: boolean) => MenuEntry;
42
- setLabel: (str: string) => MenuEntry;
43
- setIcon: (str: string) => MenuEntry;
44
- doClose: () => void;
4
+ key?: string | undefined;
5
+ href?: string | undefined;
6
+ label?: string | undefined;
7
+ icon?: string | undefined;
8
+ isActiveChecker?: Function | undefined;
9
+ isOpened?: boolean | undefined;
10
+ isActive?: boolean | undefined;
11
+ parent?: /*elided*/ any | undefined;
12
+ children?: /*elided*/ any[] | undefined;
13
+ events?: {
14
+ click?: Function | undefined;
15
+ } | undefined;
16
+ onClick?: Function | undefined;
17
+ }[], import("lkt-vue-kernel").MenuEntryConfig[] | {
18
+ key?: string | undefined;
19
+ href?: string | undefined;
20
+ label?: string | undefined;
21
+ icon?: string | undefined;
22
+ isActiveChecker?: Function | undefined;
23
+ isOpened?: boolean | undefined;
24
+ isActive?: boolean | undefined;
25
+ parent?: /*elided*/ any | undefined;
26
+ children?: /*elided*/ any[] | undefined;
27
+ events?: {
28
+ click?: Function | undefined;
29
+ } | undefined;
30
+ onClick?: Function | undefined;
45
31
  }[]>;
46
32
  declare const entryIconSlots: import("vue").ComputedRef<LktObject>;
47
33
  declare const onClickOutside: () => void;
48
34
  declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
49
- declare var __VLS_5: any, __VLS_6: {};
35
+ declare var __VLS_8: any, __VLS_9: {};
50
36
  type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
51
- [K in NonNullable<typeof __VLS_5>]?: (props: typeof __VLS_6) => any;
37
+ [K in NonNullable<typeof __VLS_8>]?: (props: typeof __VLS_9) => any;
52
38
  }>;
53
- declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
39
+ declare const __VLS_self: import("vue").DefineComponent<MenuConfig, {
54
40
  MenuItem: typeof MenuItem;
55
41
  entries: typeof entries;
56
42
  entryIconSlots: typeof entryIconSlots;
@@ -62,7 +48,7 @@ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
62
48
  "update:modelValue": (...args: any[]) => void;
63
49
  "click-outside": (...args: any[]) => void;
64
50
  response: (...args: any[]) => void;
65
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
51
+ }, string, import("vue").PublicProps, Readonly<MenuConfig> & Readonly<{
66
52
  onError?: ((...args: any[]) => any) | undefined;
67
53
  onLoading?: ((...args: any[]) => any) | undefined;
68
54
  onResults?: ((...args: any[]) => any) | undefined;
@@ -72,16 +58,16 @@ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
72
58
  }>, {
73
59
  resource: string;
74
60
  resourceData: LktObject;
75
- modelValue: MenuEntry[];
61
+ modelValue: import("lkt-vue-kernel").MenuEntryConfig[];
76
62
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
77
- declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
63
+ declare const __VLS_component: import("vue").DefineComponent<MenuConfig, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
78
64
  error: (...args: any[]) => void;
79
65
  loading: (...args: any[]) => void;
80
66
  results: (...args: any[]) => void;
81
67
  "update:modelValue": (...args: any[]) => void;
82
68
  "click-outside": (...args: any[]) => void;
83
69
  response: (...args: any[]) => void;
84
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
70
+ }, string, import("vue").PublicProps, Readonly<MenuConfig> & Readonly<{
85
71
  onError?: ((...args: any[]) => any) | undefined;
86
72
  onLoading?: ((...args: any[]) => any) | undefined;
87
73
  onResults?: ((...args: any[]) => any) | undefined;
@@ -91,7 +77,7 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}
91
77
  }>, {
92
78
  resource: string;
93
79
  resourceData: LktObject;
94
- modelValue: MenuEntry[];
80
+ modelValue: import("lkt-vue-kernel").MenuEntryConfig[];
95
81
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
96
82
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
97
83
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-menu",
3
- "version": "1.2.0",
3
+ "version": "1.4.1",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "lkt",
@@ -50,11 +50,11 @@
50
50
  "vue-tsc": "^2.2.0"
51
51
  },
52
52
  "peerDependencies": {
53
- "lkt-anchor": "^1.1.4",
54
- "lkt-data-state": "^1.0.10",
55
- "lkt-http-client": "^1.0.31",
56
- "lkt-i18n": "^1.0.4",
57
- "lkt-vue-kernel": "^1.0.0",
53
+ "lkt-anchor": "^1.2.4",
54
+ "lkt-data-state": "^1.0.11",
55
+ "lkt-http-client": "^1.0.34",
56
+ "lkt-i18n": "^1.0.6",
57
+ "lkt-vue-kernel": "1.0.44",
58
58
  "vue": "^3.3.0",
59
59
  "vue-router": "^4.3.3"
60
60
  }
@@ -1,18 +1,18 @@
1
1
  <script setup lang="ts">
2
- import { MenuEntry } from '../classes/MenuEntry';
2
+ import { extractI18nValue, LktObject, MenuEntry } from 'lkt-vue-kernel';
3
3
  import { computed, onMounted, ref, useSlots, watch } from 'vue';
4
- import { LktObject } from 'lkt-ts-interfaces';
5
4
  import { fetchKeys } from '../functions/helpers';
6
5
  import { useRouter } from 'vue-router';
7
6
  import { Settings } from '../settings/Settings';
8
- import { extractI18nValue } from 'lkt-vue-kernel';
9
7
 
10
- const emit = defineEmits(['update:modelValue']);
8
+ const emit = defineEmits([
9
+ 'update:modelValue'
10
+ ]);
11
11
 
12
12
  const props = withDefaults(defineProps<{
13
13
  modelValue?: MenuEntry
14
14
  }>(), {
15
- modelValue: () => (new MenuEntry('', '', ''))
15
+ modelValue: () => (new MenuEntry())
16
16
  });
17
17
 
18
18
  const entry = ref(props.modelValue),
@@ -24,7 +24,15 @@ const onClickToggle = () => {
24
24
  entry.value.isOpened = !entry.value.isOpened;
25
25
  },
26
26
  onClick = () => {
27
- if (entry.value.children.length > 0) onClickToggle();
27
+ if (entry.value.children?.length > 0) onClickToggle();
28
+
29
+ if (typeof entry.value.events?.click === 'function') {
30
+ entry.value.events.click({
31
+ entry: entry.value
32
+ });
33
+ return 1;
34
+ }
35
+
28
36
  if (typeof entry.value.onClick === 'function') {
29
37
  entry.value.onClick({
30
38
  entry: entry.value
@@ -95,9 +103,9 @@ onMounted(() => {
95
103
  if (currentRoute.value.path === entry.value.href) {
96
104
  entry.value.isOpened = true;
97
105
 
98
- } else if (entry.value.children.length > 0) {
106
+ } else if (entry.value.children?.length > 0) {
99
107
  let opened = false;
100
- entry.value.children.forEach((child) => {
108
+ entry.value.children?.forEach((child) => {
101
109
  if (currentRoute.value.path === child.href) opened = true;
102
110
  });
103
111
 
@@ -133,7 +141,7 @@ onMounted(() => {
133
141
  </div>
134
142
  </lkt-anchor>
135
143
 
136
- <div class="lkt-menu-entry-toggle" v-if="entry.children.length > 0" @click="onClickToggle">
144
+ <div class="lkt-menu-entry-toggle" v-if="entry.children?.length > 0" @click="onClickToggle">
137
145
  <template v-if="hasToggleSlot">
138
146
  <component :is="toggleSlot" class="lkt-menu-entry-toggle-inner" :class="entry.isOpened ? 'is-opened' : '' "/>
139
147
  </template>
@@ -1,23 +1,21 @@
1
1
  <script setup lang="ts">
2
- import {MenuEntry} from "../classes/MenuEntry";
3
- import MenuItem from "../components/MenuItem.vue";
4
- import {computed, ref, useSlots, watch} from "vue";
5
- import {LktObject} from "lkt-ts-interfaces";
6
- import {fetchKeys} from "../functions/helpers";
7
- import {DataState} from "lkt-data-state";
8
- import {httpCall, HTTPResponse} from "lkt-http-client";
2
+ import MenuItem from '../components/MenuItem.vue';
3
+ import { computed, ref, useSlots, watch } from 'vue';
4
+ import { getDefaultValues, LktObject, Menu, MenuConfig } from 'lkt-vue-kernel';
5
+ import { fetchKeys } from '../functions/helpers';
6
+ import { DataState } from 'lkt-data-state';
7
+ import { httpCall, HTTPResponse } from 'lkt-http-client';
9
8
 
10
- const props = withDefaults(defineProps<{
11
- modelValue?: MenuEntry[]
12
- resource?: string
13
- resourceData: LktObject
14
- }>(), {
15
- modelValue: () => [],
16
- resource: '',
17
- resourceData: () => ({}),
18
- });
9
+ const props = withDefaults(defineProps<MenuConfig>(), getDefaultValues(Menu));
19
10
 
20
- const emit = defineEmits(['update:modelValue', 'click-outside', 'loading', 'results', 'response', 'error']);
11
+ const emit = defineEmits([
12
+ 'update:modelValue',
13
+ 'click-outside',
14
+ 'loading',
15
+ 'results',
16
+ 'response',
17
+ 'error'
18
+ ]);
21
19
 
22
20
  const slots = useSlots();
23
21