lkt-menu 1.2.0 → 1.4.0

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,162 @@
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;
1
+ declare var F: {
2
+ new (t?: {}): {
3
+ setChildren(t: any): /*elided*/ any;
4
+ children: any;
5
+ setOnClick(t: any): /*elided*/ any;
6
+ onClick: any;
7
+ setIsActiveChecker(t: any): /*elided*/ any;
8
+ isActiveChecker: any;
9
+ setIsActive(t?: boolean): /*elided*/ any;
10
+ isActive: boolean | undefined;
11
+ setLabel(t: any): /*elided*/ any;
12
+ label: any;
13
+ setIcon(t: any): /*elided*/ any;
14
+ icon: any;
15
+ doClose(): void;
16
+ isOpened: boolean | undefined;
17
+ feed(t?: {}, l?: /*elided*/ any): void;
18
+ assignProp(t: any, l: any): void;
19
+ };
20
+ };
21
+ declare function dt(e: any, t: any, l: any): {
22
+ setChildren: (t: any) => {
23
+ setChildren(t: any): /*elided*/ any;
24
+ children: any;
25
+ setOnClick(t: any): /*elided*/ any;
26
+ onClick: any;
27
+ setIsActiveChecker(t: any): /*elided*/ any;
28
+ isActiveChecker: any;
29
+ setIsActive(t?: boolean): /*elided*/ any;
30
+ isActive: boolean | undefined;
31
+ setLabel(t: any): /*elided*/ any;
32
+ label: any;
33
+ setIcon(t: any): /*elided*/ any;
34
+ icon: any;
35
+ doClose(): void;
36
+ isOpened: boolean | undefined;
37
+ feed(t?: {}, l?: /*elided*/ any): void;
38
+ assignProp(t: any, l: any): void;
39
+ };
40
+ children: any;
41
+ setOnClick: (t: any) => {
42
+ setChildren(t: any): /*elided*/ any;
43
+ children: any;
44
+ setOnClick(t: any): /*elided*/ any;
45
+ onClick: any;
46
+ setIsActiveChecker(t: any): /*elided*/ any;
47
+ isActiveChecker: any;
48
+ setIsActive(t?: boolean): /*elided*/ any;
49
+ isActive: boolean | undefined;
50
+ setLabel(t: any): /*elided*/ any;
51
+ label: any;
52
+ setIcon(t: any): /*elided*/ any;
53
+ icon: any;
54
+ doClose(): void;
55
+ isOpened: boolean | undefined;
56
+ feed(t?: {}, l?: /*elided*/ any): void;
57
+ assignProp(t: any, l: any): void;
58
+ };
12
59
  onClick: any;
13
- setIsActiveChecker(r: any): this;
60
+ setIsActiveChecker: (t: any) => {
61
+ setChildren(t: any): /*elided*/ any;
62
+ children: any;
63
+ setOnClick(t: any): /*elided*/ any;
64
+ onClick: any;
65
+ setIsActiveChecker(t: any): /*elided*/ any;
66
+ isActiveChecker: any;
67
+ setIsActive(t?: boolean): /*elided*/ any;
68
+ isActive: boolean | undefined;
69
+ setLabel(t: any): /*elided*/ any;
70
+ label: any;
71
+ setIcon(t: any): /*elided*/ any;
72
+ icon: any;
73
+ doClose(): void;
74
+ isOpened: boolean | undefined;
75
+ feed(t?: {}, l?: /*elided*/ any): void;
76
+ assignProp(t: any, l: any): void;
77
+ };
14
78
  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;
79
+ setIsActive: (t?: boolean) => {
80
+ setChildren(t: any): /*elided*/ any;
81
+ children: any;
82
+ setOnClick(t: any): /*elided*/ any;
83
+ onClick: any;
84
+ setIsActiveChecker(t: any): /*elided*/ any;
85
+ isActiveChecker: any;
86
+ setIsActive(t?: boolean): /*elided*/ any;
87
+ isActive: boolean | undefined;
88
+ setLabel(t: any): /*elided*/ any;
89
+ label: any;
90
+ setIcon(t: any): /*elided*/ any;
91
+ icon: any;
92
+ doClose(): void;
93
+ isOpened: boolean | undefined;
94
+ feed(t?: {}, l?: /*elided*/ any): void;
95
+ assignProp(t: any, l: any): void;
96
+ };
97
+ isActive: boolean | undefined;
98
+ setLabel: (t: any) => {
99
+ setChildren(t: any): /*elided*/ any;
100
+ children: any;
101
+ setOnClick(t: any): /*elided*/ any;
102
+ onClick: any;
103
+ setIsActiveChecker(t: any): /*elided*/ any;
104
+ isActiveChecker: any;
105
+ setIsActive(t?: boolean): /*elided*/ any;
106
+ isActive: boolean | undefined;
107
+ setLabel(t: any): /*elided*/ any;
108
+ label: any;
109
+ setIcon(t: any): /*elided*/ any;
110
+ icon: any;
111
+ doClose(): void;
112
+ isOpened: boolean | undefined;
113
+ feed(t?: {}, l?: /*elided*/ any): void;
114
+ assignProp(t: any, l: any): void;
115
+ };
23
116
  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;
117
+ setIcon: (t: any) => {
118
+ setChildren(t: any): /*elided*/ any;
119
+ children: any;
120
+ setOnClick(t: any): /*elided*/ any;
121
+ onClick: any;
122
+ setIsActiveChecker(t: any): /*elided*/ any;
123
+ isActiveChecker: any;
124
+ setIsActive(t?: boolean): /*elided*/ any;
125
+ isActive: boolean | undefined;
126
+ setLabel(t: any): /*elided*/ any;
127
+ label: any;
128
+ setIcon(t: any): /*elided*/ any;
129
+ icon: any;
130
+ doClose(): void;
131
+ isOpened: boolean | undefined;
132
+ feed(t?: {}, l?: /*elided*/ any): void;
133
+ assignProp(t: any, l: any): void;
134
+ };
135
+ icon: any;
36
136
  doClose: () => void;
137
+ isOpened: boolean | undefined;
138
+ feed: (t?: {}, l?: {
139
+ setChildren(t: any): /*elided*/ any;
140
+ children: any;
141
+ setOnClick(t: any): /*elided*/ any;
142
+ onClick: any;
143
+ setIsActiveChecker(t: any): /*elided*/ any;
144
+ isActiveChecker: any;
145
+ setIsActive(t?: boolean): /*elided*/ any;
146
+ isActive: boolean | undefined;
147
+ setLabel(t: any): /*elided*/ any;
148
+ label: any;
149
+ setIcon(t: any): /*elided*/ any;
150
+ icon: any;
151
+ doClose(): void;
152
+ isOpened: boolean | undefined;
153
+ feed(t?: {}, l?: /*elided*/ any): void;
154
+ assignProp(t: any, l: any): void;
155
+ }) => void;
156
+ assignProp: (t: any, l: any) => void;
37
157
  };
38
- declare namespace Qe {
158
+ declare namespace ct {
39
159
  function install(e: any): void;
40
160
  }
41
- declare function Ye(e: any): boolean;
42
- export { H as MenuEntry, Xe as createMenuEntry, Qe as default, Ye as setMenuToggleSlot };
161
+ declare function vt(e: any): boolean;
162
+ export { F as MenuEntry, dt as createMenuEntry, ct as default, vt as setMenuToggleSlot };
package/dist/build.js CHANGED
@@ -1,218 +1,282 @@
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";
1
+ var Y = Object.defineProperty;
2
+ var Z = (e, t, l) => t in e ? Y(e, t, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[t] = l;
3
+ var n = (e, t, l) => Z(e, typeof t != "symbol" ? t + "" : t, l);
4
+ import { defineComponent as J, ref as B, useSlots as W, computed as m, watch as M, onMounted as ee, resolveComponent as K, createElementBlock as h, openBlock as u, normalizeClass as D, createElementVNode as E, createCommentVNode as g, createVNode as te, withCtx as U, renderSlot as z, unref as re, toDisplayString as le, createBlock as j, resolveDynamicComponent as ae, Fragment as q, renderList as I, createSlots as G, mergeDefaults as ne, reactive as oe } from "vue";
3
5
  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;
6
+ import { __ as se } from "lkt-i18n";
7
+ import { useRouter as ie } from "vue-router";
8
+ import { DataState as ue } from "lkt-data-state";
9
+ import { httpCall as ce } from "lkt-http-client";
10
+ var de = ((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))(de || {}), ve = ((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))(ve || {}), me = ["lktDateProps", "lktStrictItem", "lktExcludedProps"], d, Q = (d = class {
11
+ constructor(t) {
10
12
  }
11
- setChildren(r) {
12
- return r.forEach((a) => a.parent = this), this.children = r, this;
13
+ feed(t = {}, l = this) {
14
+ if (typeof t == "object") for (let [s, r] of Object.entries(t)) l.assignProp(s, r);
13
15
  }
14
- setOnClick(r) {
15
- return this.onClick = r, this;
16
+ assignProp(t, l) {
17
+ if (!(me.includes(t) || d.lktExcludedProps.includes(t))) {
18
+ if (d.lktDateProps.includes(t)) {
19
+ this[t] = new Date(l);
20
+ return;
21
+ }
22
+ this[t] = l;
23
+ }
24
+ }
25
+ }, n(d, "lktAllowUndefinedProps", []), n(d, "lktExcludedProps", []), n(d, "lktDateProps", []), n(d, "lktStrictItem", !1), n(d, "lktDefaultValues", []), d), he = ((e) => (e.Auto = "auto", e.Always = "always", e.Lazy = "lazy", e.Ever = "ever", e))(he || {}), pe = ((e) => (e.Transform = "transform", e.Height = "height", e.Display = "display", e))(pe || {}), fe = ((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))(fe || {}), ke = ((e) => (e.None = "", e.Field = "field", e.Button = "button", e.Anchor = "anchor", e))(ke || {}), ye = ((e) => (e.List = "list", e.Inline = "inline", e.Count = "count", e))(ye || {}), ge = ((e) => (e.None = "", e.Focus = "focus", e.Blur = "blur", e.Always = "always", e))(ge || {}), 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 || {}), be = ((e) => (e.Ok = "ok", e.Ko = "ko", e.Info = "info", e))(be || {}), xe = ((e) => (e.NotDefined = "", e.Button = "button", e))(xe || {}), Ae = ((e) => (e.Create = "create", e.Update = "update", e.Read = "read", e))(Ae || {}), Se = ((e) => (e.Inline = "inline", e.Modal = "modal", e))(Se || {}), we = ((e) => (e.Top = "top", e.Bottom = "bottom", e))(we || {}), Ve = ((e) => (e.Changed = "changed", e.Always = "always", e.Never = "never", e))(Ve || {}), _e = ((e) => (e.Manual = "manual", e.Auto = "auto", e.Delay = "delay", e))(_e || {}), De = ((e) => (e.Toast = "toast", e.Inline = "inline", e))(De || {}), R, F = (R = class extends Q {
26
+ constructor(t = {}) {
27
+ super();
28
+ n(this, "key", "");
29
+ n(this, "href", "");
30
+ n(this, "label", "");
31
+ n(this, "icon", "");
32
+ n(this, "isActiveChecker");
33
+ n(this, "isOpened", !1);
34
+ n(this, "isActive", !1);
35
+ n(this, "parent");
36
+ n(this, "children");
37
+ n(this, "events", {});
38
+ n(this, "onClick");
39
+ this.feed(t);
40
+ }
41
+ setChildren(t) {
42
+ return t.forEach((l) => l.parent = this), this.children = t, this;
16
43
  }
17
- setIsActiveChecker(r) {
18
- return this.isActiveChecker = r, this;
44
+ setOnClick(t) {
45
+ return this.onClick = t, this;
19
46
  }
20
- setIsActive(r = !0) {
21
- return this.isActive = r, this;
47
+ setIsActiveChecker(t) {
48
+ return this.isActiveChecker = t, this;
22
49
  }
23
- setLabel(r) {
24
- return this.label = r, this;
50
+ setIsActive(t = !0) {
51
+ return this.isActive = t, this;
25
52
  }
26
- setIcon(r) {
27
- return this.icon = r, this;
53
+ setLabel(t) {
54
+ return this.label = t, this;
55
+ }
56
+ setIcon(t) {
57
+ return this.icon = t, this;
28
58
  }
29
59
  doClose() {
30
60
  this.isOpened = !1;
31
61
  }
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 {
62
+ }, n(R, "lktDefaultValues", ["key", "href", "label", "icon", "isActiveChecker", "isOpened", "isActive", "parent", "children", "events", "onClick"]), R), T, Me = (T = class extends Q {
63
+ constructor(t = {}) {
64
+ var l;
65
+ super();
66
+ n(this, "modelValue", []);
67
+ n(this, "resource", "");
68
+ n(this, "resourceData", {});
69
+ this.feed(t), this.modelValue = ((l = this.modelValue) == null ? void 0 : l.map((s) => new F(s))) || [];
70
+ }
71
+ }, n(T, "lktDefaultValues", ["modelValue", "resource", "resourceData"]), T), Ee = ((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))(Ee || {}), Ie = ((e) => (e.None = "", e.Incremental = "incremental", e.Decremental = "decremental", e))(Ie || {}), Oe = ((e) => (e.NotDefined = "", e.Hidden = "hidden", e.Integer = "integer", e.Decimal = "decimal", e.Auto = "auto", e))(Oe || {}), Le = ((e) => (e.Table = "table", e.Item = "item", e.Ul = "ul", e.Ol = "ol", e))(Le || {}), Ne = ((e) => (e[e.Auto = 0] = "Auto", e[e.PreferItem = 1] = "PreferItem", e[e.PreferCustomItem = 2] = "PreferCustomItem", e[e.PreferColumns = 3] = "PreferColumns", e))(Ne || {}), Pe = ((e) => (e.NotDefined = "", e.ActionIcon = "action-icon", e))(Pe || {}), Re = ((e) => (e.Message = "message", e.Button = "button", e))(Re || {}), Te = ((e) => (e.Left = "left", e.Center = "center", e.Right = "right", e))(Te || {}), Be = ((e) => (e.Fixed = "fixed", e.Absolute = "absolute", e))(Be || {}), Ue = ((e) => (e.Top = "top", e.Bottom = "bottom", e.Center = "center", e.ReferrerCenter = "referrer-center", e))(Ue || {}), ze = ((e) => (e.Left = "left", e.Right = "right", e.Center = "center", e.LeftCorner = "left-corner", e.RightCorner = "right-corner", e))(ze || {}), je = ((e) => (e.Refresh = "refresh", e.Close = "close", e.ReOpen = "reOpen", e.Exec = "exec", e.Open = "open", e))(je || {}), Fe = ((e) => (e.Modal = "modal", e.Confirm = "confirm", e))(Fe || {}), $e = ((e) => (e.Asc = "asc", e.Desc = "desc", e))($e || {}), He = ((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))(He || {}), Ke = ((e) => (e.Lazy = "lazy", e.Ever = "ever", e))(Ke || {}), Je = (e) => {
72
+ let t = String(e);
73
+ return t.startsWith("__:") ? se(t.substring(3)) : t;
36
74
  };
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;
75
+ function We(e) {
76
+ let t = new e(), l = {};
77
+ if (!Array.isArray(e.lktDefaultValues)) throw new Error("lktDefaultValues must be a keys array.");
78
+ for (let s of e.lktDefaultValues) s in t && (l[s] = t[s]);
79
+ return l;
80
+ }
81
+ const $ = (e, t) => (t.forEach((l) => {
82
+ e.includes(l.key) || e.push(l.key), l.children.length > 0 && $(e, l.children);
83
+ }), e), O = class O {
42
84
  };
43
- const Re = { class: "lkt-menu-entry-main" }, Te = { class: "lkt-entry-content" }, Pe = {
85
+ O.toggleSlot = "", O.debugEnabled = !1;
86
+ let C = O;
87
+ const qe = { class: "lkt-menu-entry-main" }, Ge = { class: "lkt-entry-content" }, Qe = {
44
88
  key: 0,
45
89
  class: "lkt-menu-entry-icon"
46
- }, ze = {
90
+ }, Xe = {
47
91
  key: 1,
48
92
  class: "lkt-menu-entry-text"
49
- }, Be = {
93
+ }, Ye = {
50
94
  key: 0,
51
95
  class: "lkt-menu-entry-children"
52
- }, Ue = /* @__PURE__ */ B({
96
+ }, Ze = /* @__PURE__ */ J({
53
97
  __name: "MenuItem",
54
98
  props: {
55
- modelValue: { default: () => new H("", "", "") }
99
+ modelValue: { default: () => new F() }
56
100
  },
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);
101
+ emits: [
102
+ "update:modelValue"
103
+ ],
104
+ setup(e, { emit: t }) {
105
+ const l = t, s = e, r = B(s.modelValue), v = W(), y = ie(), f = B(!1), b = () => {
106
+ r.value.isOpened = !r.value.isOpened;
107
+ }, L = () => {
108
+ var a, c;
109
+ return ((a = r.value.children) == null ? void 0 : a.length) > 0 && b(), typeof ((c = r.value.events) == null ? void 0 : c.click) == "function" ? (r.value.events.click({
110
+ entry: r.value
111
+ }), 1) : (typeof r.value.onClick == "function" && r.value.onClick({
112
+ entry: r.value
113
+ }), 1);
114
+ }, x = m(() => v["icon-" + r.value.key] || r.value.icon !== ""), N = m(() => {
115
+ let a = [];
116
+ return x.value && a.push("has-icon"), f.value && a.push("is-active"), a.join(" ");
117
+ }), i = m(() => $([], r.value.children)), o = m(() => {
118
+ let a = [];
119
+ for (let c in v)
120
+ c.startsWith("icon-") && i.value.includes(c.substring(5)) && a.push(c);
121
+ return a;
122
+ }), p = m(() => Je(r.value.label)), A = m(() => r.value.isActive ? !0 : typeof r.value.isActiveChecker == "function" ? !!r.value.isActiveChecker({
123
+ entry: r.value
124
+ }) : !1), k = m(() => !!C.toggleSlot), X = m(() => C.toggleSlot);
125
+ return M(() => s.modelValue, (a) => {
126
+ r.value = a;
127
+ }, { deep: !0 }), M(r, (a) => {
128
+ l("update:modelValue", a);
129
+ }, { deep: !0 }), ee(() => {
130
+ var c, S;
131
+ let a = y == null ? void 0 : y.currentRoute;
132
+ if (a) {
133
+ if (a.value.path === r.value.href)
134
+ r.value.isOpened = !0;
135
+ else if (((c = r.value.children) == null ? void 0 : c.length) > 0) {
136
+ let w = !1;
137
+ (S = r.value.children) == null || S.forEach((V) => {
138
+ a.value.path === V.href && (w = !0);
139
+ }), w && (r.value.isOpened = !0);
88
140
  }
89
141
  }
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])
142
+ }), (a, c) => {
143
+ var V;
144
+ const S = K("lkt-anchor"), w = K("menu-item", !0);
145
+ return u(), h("div", {
146
+ class: D(["lkt-menu-entry", N.value])
94
147
  }, [
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)
148
+ E("div", qe, [
149
+ te(S, {
150
+ to: r.value.href,
151
+ "on-click": L,
152
+ "is-active": A.value,
153
+ onActive: c[0] || (c[0] = (H) => f.value = H)
101
154
  }, {
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", {
155
+ default: U(() => [
156
+ E("div", Ge, [
157
+ x.value ? (u(), h("div", Qe, [
158
+ re(v)["icon-" + r.value.key] ? z(a.$slots, "icon-" + r.value.key, {
159
+ key: r.value.key,
160
+ entry: r.value
161
+ }) : r.value.icon !== "" ? (u(), h("i", {
109
162
  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)
163
+ class: D(r.value.icon)
164
+ }, null, 2)) : g("", !0)
165
+ ])) : g("", !0),
166
+ r.value.label !== "" ? (u(), h("div", Xe, le(p.value), 1)) : g("", !0)
114
167
  ])
115
168
  ]),
116
169
  _: 3
117
170
  }, 8, ["to", "is-active"]),
118
- t.value.children.length > 0 ? (i(), d("div", {
171
+ ((V = r.value.children) == null ? void 0 : V.length) > 0 ? (u(), h("div", {
119
172
  key: 0,
120
173
  class: "lkt-menu-entry-toggle",
121
- onClick: g
174
+ onClick: b
122
175
  }, [
123
- p.value ? (i(), R(Q(j.value), {
176
+ k.value ? (u(), j(ae(X.value), {
124
177
  key: 0,
125
- class: S(["lkt-menu-entry-toggle-inner", t.value.isOpened ? "is-opened" : ""])
126
- }, null, 8, ["class"])) : (i(), d("div", {
178
+ class: D(["lkt-menu-entry-toggle-inner", r.value.isOpened ? "is-opened" : ""])
179
+ }, null, 8, ["class"])) : (u(), h("div", {
127
180
  key: 1,
128
- class: S(["lkt-menu-entry-toggle-inner lkt-menu-entry-toggle-triangle", t.value.isOpened ? "is-opened" : ""])
181
+ class: D(["lkt-menu-entry-toggle-inner lkt-menu-entry-toggle-triangle", r.value.isOpened ? "is-opened" : ""])
129
182
  }, null, 2))
130
- ])) : k("", !0)
183
+ ])) : g("", !0)
131
184
  ]),
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, (_) => ({
185
+ r.value.isOpened ? (u(), h("div", Ye, [
186
+ (u(!0), h(q, null, I(r.value.children, (H, P) => (u(), j(w, {
187
+ modelValue: r.value.children[P],
188
+ "onUpdate:modelValue": (_) => r.value.children[P] = _,
189
+ key: r.value.children[P].key
190
+ }, G({ _: 2 }, [
191
+ I(o.value, (_) => ({
139
192
  name: _,
140
- fn: V(() => [
141
- D(l.$slots, _)
193
+ fn: U(() => [
194
+ z(a.$slots, _)
142
195
  ])
143
196
  }))
144
197
  ]), 1032, ["modelValue", "onUpdate:modelValue"]))), 128))
145
- ])) : k("", !0)
198
+ ])) : g("", !0)
146
199
  ], 2);
147
200
  };
148
201
  }
149
- }), Fe = { class: "lkt-menu-container" }, $e = { class: "lkt-menu" }, He = /* @__PURE__ */ B({
202
+ }), et = { class: "lkt-menu-container" }, tt = { class: "lkt-menu" }, rt = /* @__PURE__ */ J({
150
203
  __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;
164
- };
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);
204
+ props: /* @__PURE__ */ ne({
205
+ modelValue: {},
206
+ resource: {},
207
+ resourceData: {}
208
+ }, We(Me)),
209
+ emits: [
210
+ "update:modelValue",
211
+ "click-outside",
212
+ "loading",
213
+ "results",
214
+ "response",
215
+ "error"
216
+ ],
217
+ setup(e, { emit: t }) {
218
+ const l = e, s = t, r = W(), v = B(l.modelValue), y = (i) => {
219
+ let o = {};
220
+ typeof i == "object" && Object.keys(i).length > 0 && (o = JSON.parse(JSON.stringify(i)));
221
+ for (let p in o)
222
+ (Array.isArray(o[p]) || typeof o[p] == "object") && (o[p] = JSON.stringify(o[p]));
171
223
  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);
224
+ };
225
+ let f = new ue({});
226
+ f.increment(y(l.resourceData));
227
+ const b = m(() => $([], v.value)), L = m(() => {
228
+ let i = [];
229
+ for (let o in r)
230
+ o.startsWith("icon-") && b.value.includes(o.substring(5)) && i.push(o);
231
+ return i;
232
+ }), x = () => {
233
+ if (!l.resource) return;
234
+ let i = f.getData();
235
+ s("loading"), ce(l.resource, i).then((o) => {
236
+ f.turnStoredIntoOriginal(), v.value = o.data, s("results", o.data), s("response", o);
237
+ }).catch((o) => {
238
+ s("error", o);
179
239
  });
180
- }, E = () => {
240
+ }, N = () => {
181
241
  s("click-outside");
182
242
  };
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)
243
+ return M(() => l.modelValue, (i) => {
244
+ v.value = i;
245
+ }, { deep: !0 }), M(v, (i) => {
246
+ s("update:modelValue", i);
247
+ }, { deep: !0 }), x(), (i, o) => (u(), h("div", et, [
248
+ E("div", tt, [
249
+ (u(!0), h(q, null, I(v.value, (p, A) => (u(), j(Ze, {
250
+ modelValue: v.value[A],
251
+ "onUpdate:modelValue": (k) => v.value[A] = k,
252
+ key: p.key
253
+ }, G({ _: 2 }, [
254
+ I(L.value, (k) => ({
255
+ name: k,
256
+ fn: U(() => [
257
+ z(i.$slots, k)
198
258
  ])
199
259
  }))
200
260
  ]), 1032, ["modelValue", "onUpdate:modelValue"]))), 128))
201
261
  ]),
202
- A("div", {
262
+ E("div", {
203
263
  class: "lkt-menu-outside",
204
- onClick: E
264
+ onClick: N
205
265
  })
206
266
  ]));
207
267
  }
208
- }), Qe = {
268
+ }), ct = {
209
269
  install: (e) => {
210
- e.component("lkt-menu") === void 0 && e.component("lkt-menu", He);
270
+ e.component("lkt-menu") === void 0 && e.component("lkt-menu", rt);
211
271
  }
212
- }, Xe = (e, r, a) => X(new H(e, r, a)), Ye = (e) => (y.toggleSlot = e, !0);
272
+ }, dt = (e, t, l) => oe(new F({
273
+ key: e,
274
+ href: t,
275
+ label: l
276
+ })), vt = (e) => (C.toggleSlot = e, !0);
213
277
  export {
214
- H as MenuEntry,
215
- Xe as createMenuEntry,
216
- Qe as default,
217
- Ye as setMenuToggleSlot
278
+ F as MenuEntry,
279
+ dt as createMenuEntry,
280
+ ct as default,
281
+ vt as setMenuToggleSlot
218
282
  };
@@ -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,43 @@
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 } from 'lkt-ts-interfaces';
3
+ import { MenuConfig } from 'lkt-vue-kernel';
9
4
  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;
5
+ key?: string | undefined;
6
+ href?: string | undefined;
7
+ label?: string | undefined;
8
+ icon?: string | undefined;
9
+ isActiveChecker?: Function | undefined;
10
+ isOpened?: boolean | undefined;
11
+ isActive?: boolean | undefined;
12
+ parent?: /*elided*/ any | undefined;
13
+ children?: /*elided*/ any[] | undefined;
14
+ events?: {
15
+ click?: Function | undefined;
16
+ } | undefined;
17
+ onClick?: Function | undefined;
18
+ }[], import("lkt-vue-kernel").MenuEntryConfig[] | {
19
+ key?: string | undefined;
20
+ href?: string | undefined;
21
+ label?: string | undefined;
22
+ icon?: string | undefined;
23
+ isActiveChecker?: Function | undefined;
24
+ isOpened?: boolean | undefined;
25
+ isActive?: boolean | undefined;
26
+ parent?: /*elided*/ any | undefined;
27
+ children?: /*elided*/ any[] | undefined;
28
+ events?: {
29
+ click?: Function | undefined;
30
+ } | undefined;
31
+ onClick?: Function | undefined;
45
32
  }[]>;
46
33
  declare const entryIconSlots: import("vue").ComputedRef<LktObject>;
47
34
  declare const onClickOutside: () => void;
48
35
  declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
49
- declare var __VLS_5: any, __VLS_6: {};
36
+ declare var __VLS_8: any, __VLS_9: {};
50
37
  type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
51
- [K in NonNullable<typeof __VLS_5>]?: (props: typeof __VLS_6) => any;
38
+ [K in NonNullable<typeof __VLS_8>]?: (props: typeof __VLS_9) => any;
52
39
  }>;
53
- declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
40
+ declare const __VLS_self: import("vue").DefineComponent<MenuConfig, {
54
41
  MenuItem: typeof MenuItem;
55
42
  entries: typeof entries;
56
43
  entryIconSlots: typeof entryIconSlots;
@@ -62,7 +49,7 @@ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
62
49
  "update:modelValue": (...args: any[]) => void;
63
50
  "click-outside": (...args: any[]) => void;
64
51
  response: (...args: any[]) => void;
65
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
52
+ }, string, import("vue").PublicProps, Readonly<MenuConfig> & Readonly<{
66
53
  onError?: ((...args: any[]) => any) | undefined;
67
54
  onLoading?: ((...args: any[]) => any) | undefined;
68
55
  onResults?: ((...args: any[]) => any) | undefined;
@@ -71,17 +58,17 @@ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
71
58
  onResponse?: ((...args: any[]) => any) | undefined;
72
59
  }>, {
73
60
  resource: string;
74
- resourceData: LktObject;
75
- modelValue: MenuEntry[];
61
+ resourceData: import("lkt-vue-kernel").LktObject;
62
+ modelValue: import("lkt-vue-kernel").MenuEntryConfig[];
76
63
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
77
- declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
64
+ declare const __VLS_component: import("vue").DefineComponent<MenuConfig, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
78
65
  error: (...args: any[]) => void;
79
66
  loading: (...args: any[]) => void;
80
67
  results: (...args: any[]) => void;
81
68
  "update:modelValue": (...args: any[]) => void;
82
69
  "click-outside": (...args: any[]) => void;
83
70
  response: (...args: any[]) => void;
84
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
71
+ }, string, import("vue").PublicProps, Readonly<MenuConfig> & Readonly<{
85
72
  onError?: ((...args: any[]) => any) | undefined;
86
73
  onLoading?: ((...args: any[]) => any) | undefined;
87
74
  onResults?: ((...args: any[]) => any) | undefined;
@@ -90,8 +77,8 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}
90
77
  onResponse?: ((...args: any[]) => any) | undefined;
91
78
  }>, {
92
79
  resource: string;
93
- resourceData: LktObject;
94
- modelValue: MenuEntry[];
80
+ resourceData: import("lkt-vue-kernel").LktObject;
81
+ modelValue: import("lkt-vue-kernel").MenuEntryConfig[];
95
82
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
96
83
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
97
84
  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.0",
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.32",
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,22 @@
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 { LktObject } from 'lkt-ts-interfaces';
5
+ import { fetchKeys } from '../functions/helpers';
6
+ import { DataState } from 'lkt-data-state';
7
+ import { httpCall, HTTPResponse } from 'lkt-http-client';
8
+ import { getDefaultValues, Menu, MenuConfig } from 'lkt-vue-kernel';
9
9
 
10
- const props = withDefaults(defineProps<{
11
- modelValue?: MenuEntry[]
12
- resource?: string
13
- resourceData: LktObject
14
- }>(), {
15
- modelValue: () => [],
16
- resource: '',
17
- resourceData: () => ({}),
18
- });
10
+ const props = withDefaults(defineProps<MenuConfig>(), getDefaultValues(Menu));
19
11
 
20
- const emit = defineEmits(['update:modelValue', 'click-outside', 'loading', 'results', 'response', 'error']);
12
+ const emit = defineEmits([
13
+ 'update:modelValue',
14
+ 'click-outside',
15
+ 'loading',
16
+ 'results',
17
+ 'response',
18
+ 'error'
19
+ ]);
21
20
 
22
21
  const slots = useSlots();
23
22