lkt-menu 1.0.11 → 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 x {
2
- constructor(t: any, r: any, i: any);
3
- key: any;
4
- href: any;
5
- label: any;
6
- icon: string;
7
- isOpened: boolean;
8
- isActive: boolean;
9
- children: any[];
10
- setChildren(t: any): this;
11
- setOnClick(t: 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(t: 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(t?: boolean): this;
16
- setLabel(t: any): this;
17
- setIcon(t: any): this;
18
- doClose(): void;
19
- }
20
- declare function ke(o: any, t: any, r: 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: (t: any) => x;
29
- setOnClick: (t: any) => x;
30
- onClick: any;
31
- setIsActiveChecker: (t: any) => x;
32
- isActiveChecker: any;
33
- setIsActive: (t?: boolean) => x;
34
- setLabel: (t: any) => x;
35
- setIcon: (t: any) => x;
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 fe {
39
- function install(o: any): void;
158
+ declare namespace ct {
159
+ function install(e: any): void;
40
160
  }
41
- declare function ye(o: any): boolean;
42
- export { x as MenuEntry, ke as createMenuEntry, fe 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,14 +1,45 @@
1
- import { defineComponent as J, ref as $, useSlots as K, computed as c, watch as O, onMounted as q, resolveComponent as B, openBlock as u, createElementBlock as d, normalizeClass as b, createElementVNode as S, createVNode as G, withCtx as w, unref as H, renderSlot as L, createCommentVNode as k, toDisplayString as P, createBlock as R, resolveDynamicComponent as Q, Fragment as T, renderList as A, createSlots as W, reactive as X } from "vue";
2
- import { __ as Y } from "lkt-i18n";
3
- import { useRouter as Z } from "vue-router";
4
- import { DataState as ee } from "lkt-data-state";
5
- import { httpCall as te } from "lkt-http-client";
6
- class x {
7
- constructor(t, r, i) {
8
- this.key = "", this.href = "", this.label = "", this.icon = "", this.onClick = void 0, this.isActiveChecker = void 0, this.isOpened = !1, this.isActive = !1, this.parent = void 0, this.children = [], this.key = t, this.href = r, this.label = i;
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";
5
+ import "lkt-string-tools";
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) {
12
+ }
13
+ feed(t = {}, l = this) {
14
+ if (typeof t == "object") for (let [s, r] of Object.entries(t)) l.assignProp(s, r);
15
+ }
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);
9
40
  }
10
41
  setChildren(t) {
11
- return t.forEach((r) => r.parent = this), this.children = t, this;
42
+ return t.forEach((l) => l.parent = this), this.children = t, this;
12
43
  }
13
44
  setOnClick(t) {
14
45
  return this.onClick = t, this;
@@ -28,186 +59,224 @@ class x {
28
59
  doClose() {
29
60
  this.isOpened = !1;
30
61
  }
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;
74
+ };
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;
31
80
  }
32
- const j = (o, t) => (t.forEach((r) => {
33
- o.includes(r.key) || o.push(r.key), r.children.length > 0 && j(o, r.children);
34
- }), o), I = class I {
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 {
35
84
  };
36
- I.toggleSlot = "", I.debugEnabled = !1;
37
- let y = I;
38
- const le = { class: "lkt-menu-entry-main" }, ne = { class: "lkt-entry-content" }, re = {
85
+ O.toggleSlot = "", O.debugEnabled = !1;
86
+ let C = O;
87
+ const qe = { class: "lkt-menu-entry-main" }, Ge = { class: "lkt-entry-content" }, Qe = {
39
88
  key: 0,
40
89
  class: "lkt-menu-entry-icon"
41
- }, se = {
90
+ }, Xe = {
42
91
  key: 1,
43
92
  class: "lkt-menu-entry-text"
44
- }, oe = {
93
+ }, Ye = {
45
94
  key: 0,
46
95
  class: "lkt-menu-entry-children"
47
- }, ue = /* @__PURE__ */ J({
96
+ }, Ze = /* @__PURE__ */ J({
48
97
  __name: "MenuItem",
49
98
  props: {
50
- modelValue: { default: () => new x("", "", "") }
99
+ modelValue: { default: () => new F() }
51
100
  },
52
- emits: ["update:modelValue"],
53
- setup(o, { emit: t }) {
54
- const r = t, i = o, e = $(i.modelValue), a = K(), f = Z(), m = $(!1), g = () => {
55
- e.value.isOpened = !e.value.isOpened;
56
- }, E = () => (e.value.children.length > 0 && g(), typeof e.value.onClick == "function" && e.value.onClick({
57
- entry: e.value
58
- }), 1), _ = c(() => a["icon-" + e.value.key] || e.value.icon !== ""), D = c(() => {
59
- let n = [];
60
- return _.value && n.push("has-icon"), m.value && n.push("is-active"), n.join(" ");
61
- }), s = c(() => j([], e.value.children)), l = c(() => {
62
- let n = [];
63
- for (let v in a)
64
- v.startsWith("icon-") && s.value.includes(v.substring(5)) && n.push(v);
65
- return n;
66
- }), h = c(() => e.value.label.startsWith("__:") ? Y(e.value.label.substring(3)) : e.value.label), C = c(() => e.value.isActive ? !0 : typeof e.value.isActiveChecker == "function" ? !!e.value.isActiveChecker({
67
- entry: e.value
68
- }) : !1), p = c(() => !!y.toggleSlot), F = c(() => y.toggleSlot);
69
- return O(() => i.modelValue, (n) => {
70
- e.value = n;
71
- }, { deep: !0 }), O(e, (n) => {
72
- r("update:modelValue", n);
73
- }, { deep: !0 }), q(() => {
74
- let n = f == null ? void 0 : f.currentRoute;
75
- if (n) {
76
- if (n.value.path === e.value.href)
77
- e.value.isOpened = !0;
78
- else if (e.value.children.length > 0) {
79
- let v = !1;
80
- e.value.children.forEach((M) => {
81
- n.value.path === M.href && (v = !0);
82
- }), v && (e.value.isOpened = !0);
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);
83
140
  }
84
141
  }
85
- }), (n, v) => {
86
- const M = B("lkt-anchor"), z = B("menu-item", !0);
87
- return u(), d("div", {
88
- class: b(["lkt-menu-entry", D.value])
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])
89
147
  }, [
90
- S("div", le, [
91
- G(M, {
92
- to: e.value.href,
93
- "on-click": E,
94
- "is-active": C.value,
95
- onActive: v[0] || (v[0] = (U) => m.value = U)
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)
96
154
  }, {
97
- default: w(() => [
98
- S("div", ne, [
99
- _.value ? (u(), d("div", re, [
100
- H(a)["icon-" + e.value.key] ? L(n.$slots, "icon-" + e.value.key, {
101
- key: e.value.key,
102
- entry: e.value
103
- }) : e.value.icon !== "" ? (u(), 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", {
104
162
  key: 1,
105
- class: b(e.value.icon)
106
- }, null, 2)) : k("", !0)
107
- ])) : k("", !0),
108
- e.value.label !== "" ? (u(), d("div", se, P(h.value), 1)) : k("", !0)
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)
109
167
  ])
110
168
  ]),
111
169
  _: 3
112
170
  }, 8, ["to", "is-active"]),
113
- e.value.children.length > 0 ? (u(), d("div", {
171
+ ((V = r.value.children) == null ? void 0 : V.length) > 0 ? (u(), h("div", {
114
172
  key: 0,
115
173
  class: "lkt-menu-entry-toggle",
116
- onClick: g
174
+ onClick: b
117
175
  }, [
118
- p.value ? (u(), R(Q(F.value), {
176
+ k.value ? (u(), j(ae(X.value), {
119
177
  key: 0,
120
- class: b(["lkt-menu-entry-toggle-inner", e.value.isOpened ? "is-opened" : ""])
121
- }, null, 8, ["class"])) : (u(), d("div", {
178
+ class: D(["lkt-menu-entry-toggle-inner", r.value.isOpened ? "is-opened" : ""])
179
+ }, null, 8, ["class"])) : (u(), h("div", {
122
180
  key: 1,
123
- class: b(["lkt-menu-entry-toggle-inner lkt-menu-entry-toggle-triangle", e.value.isOpened ? "is-opened" : ""])
181
+ class: D(["lkt-menu-entry-toggle-inner lkt-menu-entry-toggle-triangle", r.value.isOpened ? "is-opened" : ""])
124
182
  }, null, 2))
125
- ])) : k("", !0)
183
+ ])) : g("", !0)
126
184
  ]),
127
- e.value.isOpened ? (u(), d("div", oe, [
128
- (u(!0), d(T, null, A(e.value.children, (U, N) => (u(), R(z, {
129
- modelValue: e.value.children[N],
130
- "onUpdate:modelValue": (V) => e.value.children[N] = V,
131
- key: e.value.children[N].key
132
- }, W({ _: 2 }, [
133
- A(l.value, (V) => ({
134
- name: V,
135
- fn: w(() => [
136
- L(n.$slots, V)
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, (_) => ({
192
+ name: _,
193
+ fn: U(() => [
194
+ z(a.$slots, _)
137
195
  ])
138
196
  }))
139
197
  ]), 1032, ["modelValue", "onUpdate:modelValue"]))), 128))
140
- ])) : k("", !0)
198
+ ])) : g("", !0)
141
199
  ], 2);
142
200
  };
143
201
  }
144
- }), ie = { class: "lkt-menu-container" }, ae = { class: "lkt-menu" }, ce = /* @__PURE__ */ J({
202
+ }), et = { class: "lkt-menu-container" }, tt = { class: "lkt-menu" }, rt = /* @__PURE__ */ J({
145
203
  __name: "LktMenu",
146
- props: {
147
- modelValue: { default: () => [] },
148
- resource: { default: "" },
149
- resourceData: { default: () => ({}) }
150
- },
151
- emits: ["update:modelValue", "click-outside", "loading", "results", "response", "error"],
152
- setup(o, { emit: t }) {
153
- const r = o, i = t, e = K(), a = $(r.modelValue), f = (s) => {
154
- let l = {};
155
- typeof s == "object" && Object.keys(s).length > 0 && (l = JSON.parse(JSON.stringify(s)));
156
- for (let h in l)
157
- (Array.isArray(l[h]) || typeof l[h] == "object") && (l[h] = JSON.stringify(l[h]));
158
- return l;
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]));
223
+ return o;
159
224
  };
160
- let m = new ee({});
161
- m.increment(f(r.resourceData));
162
- const g = c(() => j([], a.value)), E = c(() => {
163
- let s = [];
164
- for (let l in e)
165
- l.startsWith("icon-") && g.value.includes(l.substring(5)) && s.push(l);
166
- return s;
167
- }), _ = () => {
168
- if (!r.resource) return;
169
- let s = m.getData();
170
- i("loading"), te(r.resource, s).then((l) => {
171
- m.turnStoredIntoOriginal(), a.value = l.data, i("results", l.data), i("response", l);
172
- }).catch((l) => {
173
- i("error", l);
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);
174
239
  });
175
- }, D = () => {
176
- i("click-outside");
240
+ }, N = () => {
241
+ s("click-outside");
177
242
  };
178
- return O(() => r.modelValue, (s) => {
179
- a.value = s;
180
- }, { deep: !0 }), O(a, (s) => {
181
- i("update:modelValue", s);
182
- }, { deep: !0 }), _(), (s, l) => (u(), d("div", ie, [
183
- S("div", ae, [
184
- (u(!0), d(T, null, A(a.value, (h, C) => (u(), R(ue, {
185
- modelValue: a.value[C],
186
- "onUpdate:modelValue": (p) => a.value[C] = p,
187
- key: h.key
188
- }, W({ _: 2 }, [
189
- A(E.value, (p) => ({
190
- name: p,
191
- fn: w(() => [
192
- L(s.$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)
193
258
  ])
194
259
  }))
195
260
  ]), 1032, ["modelValue", "onUpdate:modelValue"]))), 128))
196
261
  ]),
197
- S("div", {
262
+ E("div", {
198
263
  class: "lkt-menu-outside",
199
- onClick: D
264
+ onClick: N
200
265
  })
201
266
  ]));
202
267
  }
203
- }), fe = {
204
- install: (o) => {
205
- o.component("lkt-menu") === void 0 && o.component("lkt-menu", ce);
268
+ }), ct = {
269
+ install: (e) => {
270
+ e.component("lkt-menu") === void 0 && e.component("lkt-menu", rt);
206
271
  }
207
- }, ke = (o, t, r) => X(new x(o, t, r)), ye = (o) => (y.toggleSlot = o, !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);
208
277
  export {
209
- x as MenuEntry,
210
- ke as createMenuEntry,
211
- fe as default,
212
- ye as setMenuToggleSlot
278
+ F as MenuEntry,
279
+ dt as createMenuEntry,
280
+ ct as default,
281
+ vt as setMenuToggleSlot
213
282
  };
@@ -0,0 +1,20 @@
1
+ export declare class MenuEntry {
2
+ key: string;
3
+ href: string;
4
+ label: string;
5
+ icon: string;
6
+ onClick: Function | undefined;
7
+ isActiveChecker: Function | undefined;
8
+ isOpened: boolean;
9
+ isActive: boolean;
10
+ parent: MenuEntry | undefined;
11
+ children: MenuEntry[];
12
+ constructor(key: string, href: string, label: string);
13
+ setChildren(children: MenuEntry[]): this;
14
+ setOnClick(fn: Function): this;
15
+ setIsActiveChecker(fn: Function): this;
16
+ setIsActive(enabled?: boolean): this;
17
+ setLabel(str: string): this;
18
+ setIcon(str: string): this;
19
+ doClose(): void;
20
+ }
@@ -0,0 +1,207 @@
1
+ import { LktObject, MenuEntry } from 'lkt-vue-kernel';
2
+ type __VLS_Props = {
3
+ modelValue?: MenuEntry;
4
+ };
5
+ declare const entry: import("vue").Ref<{
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;
47
+ setChildren: (children: MenuEntry[]) => MenuEntry;
48
+ setOnClick: (fn: Function) => MenuEntry;
49
+ setIsActiveChecker: (fn: Function) => MenuEntry;
50
+ setIsActive: (enabled?: boolean) => MenuEntry;
51
+ setLabel: (str: string) => MenuEntry;
52
+ setIcon: (str: string) => MenuEntry;
53
+ doClose: () => void;
54
+ feed: (data?: LktObject, target?: MenuEntry | undefined) => void;
55
+ assignProp: (key: string, value: any) => void;
56
+ }, MenuEntry | {
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;
98
+ setChildren: (children: MenuEntry[]) => MenuEntry;
99
+ setOnClick: (fn: Function) => MenuEntry;
100
+ setIsActiveChecker: (fn: Function) => MenuEntry;
101
+ setIsActive: (enabled?: boolean) => MenuEntry;
102
+ setLabel: (str: string) => MenuEntry;
103
+ setIcon: (str: string) => MenuEntry;
104
+ doClose: () => void;
105
+ feed: (data?: LktObject, target?: MenuEntry | undefined) => void;
106
+ assignProp: (key: string, value: any) => void;
107
+ }>, slots: Readonly<{
108
+ [name: string]: import("vue").Slot<any> | undefined;
109
+ }>, isActive: import("vue").Ref<boolean, boolean>;
110
+ declare const onClickToggle: () => void, onClick: () => number;
111
+ declare const canRenderIcon: import("vue").ComputedRef<boolean | import("vue").Slot<any>>, classes: import("vue").ComputedRef<string>;
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>;
113
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
114
+ declare var __VLS_9: string, __VLS_10: {
115
+ key: string | undefined;
116
+ entry: {
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;
158
+ setChildren: (children: MenuEntry[]) => MenuEntry;
159
+ setOnClick: (fn: Function) => MenuEntry;
160
+ setIsActiveChecker: (fn: Function) => MenuEntry;
161
+ setIsActive: (enabled?: boolean) => MenuEntry;
162
+ setLabel: (str: string) => MenuEntry;
163
+ setIcon: (str: string) => MenuEntry;
164
+ doClose: () => void;
165
+ feed: (data?: LktObject, target?: MenuEntry | undefined) => void;
166
+ assignProp: (key: string, value: any) => void;
167
+ };
168
+ }, __VLS_24: any, __VLS_25: {};
169
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
170
+ [K in NonNullable<typeof __VLS_9>]?: (props: typeof __VLS_10) => any;
171
+ } & {
172
+ [K in NonNullable<typeof __VLS_24>]?: (props: typeof __VLS_25) => any;
173
+ }>;
174
+ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
175
+ entry: typeof entry;
176
+ slots: typeof slots;
177
+ isActive: typeof isActive;
178
+ onClickToggle: typeof onClickToggle;
179
+ onClick: typeof onClick;
180
+ canRenderIcon: typeof canRenderIcon;
181
+ classes: typeof classes;
182
+ entryIconSlots: typeof entryIconSlots;
183
+ computedLabel: typeof computedLabel;
184
+ computedIsActive: typeof computedIsActive;
185
+ hasToggleSlot: typeof hasToggleSlot;
186
+ toggleSlot: typeof toggleSlot;
187
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
188
+ "update:modelValue": (...args: any[]) => void;
189
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
190
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
191
+ }>, {
192
+ modelValue: MenuEntry;
193
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
194
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
195
+ "update:modelValue": (...args: any[]) => void;
196
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
197
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
198
+ }>, {
199
+ modelValue: MenuEntry;
200
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
201
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
202
+ export default _default;
203
+ type __VLS_WithSlots<T, S> = T & {
204
+ new (): {
205
+ $slots: S;
206
+ };
207
+ };
@@ -0,0 +1,2 @@
1
+ import { MenuEntry } from "lkt-vue-kernel";
2
+ export declare const fetchKeys: (r: string[], entries: MenuEntry[]) => string[];
@@ -0,0 +1,8 @@
1
+ import { Component, Plugin } from 'vue';
2
+ import "../style.css";
3
+ import { MenuEntry } from "lkt-vue-kernel";
4
+ declare const LktMenu: Plugin;
5
+ export default LktMenu;
6
+ export declare const createMenuEntry: (key: string, href: string, label: string) => MenuEntry;
7
+ export declare const setMenuToggleSlot: (component: string | Component) => boolean;
8
+ export { MenuEntry };
@@ -0,0 +1,89 @@
1
+ import MenuItem from '../components/MenuItem.vue';
2
+ import { LktObject } from 'lkt-ts-interfaces';
3
+ import { MenuConfig } from 'lkt-vue-kernel';
4
+ declare const entries: import("vue").Ref<{
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;
32
+ }[]>;
33
+ declare const entryIconSlots: import("vue").ComputedRef<LktObject>;
34
+ declare const onClickOutside: () => void;
35
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
36
+ declare var __VLS_8: any, __VLS_9: {};
37
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
38
+ [K in NonNullable<typeof __VLS_8>]?: (props: typeof __VLS_9) => any;
39
+ }>;
40
+ declare const __VLS_self: import("vue").DefineComponent<MenuConfig, {
41
+ MenuItem: typeof MenuItem;
42
+ entries: typeof entries;
43
+ entryIconSlots: typeof entryIconSlots;
44
+ onClickOutside: typeof onClickOutside;
45
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
46
+ error: (...args: any[]) => void;
47
+ loading: (...args: any[]) => void;
48
+ results: (...args: any[]) => void;
49
+ "update:modelValue": (...args: any[]) => void;
50
+ "click-outside": (...args: any[]) => void;
51
+ response: (...args: any[]) => void;
52
+ }, string, import("vue").PublicProps, Readonly<MenuConfig> & Readonly<{
53
+ onError?: ((...args: any[]) => any) | undefined;
54
+ onLoading?: ((...args: any[]) => any) | undefined;
55
+ onResults?: ((...args: any[]) => any) | undefined;
56
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
57
+ "onClick-outside"?: ((...args: any[]) => any) | undefined;
58
+ onResponse?: ((...args: any[]) => any) | undefined;
59
+ }>, {
60
+ resource: string;
61
+ resourceData: import("lkt-vue-kernel").LktObject;
62
+ modelValue: import("lkt-vue-kernel").MenuEntryConfig[];
63
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
64
+ declare const __VLS_component: import("vue").DefineComponent<MenuConfig, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
65
+ error: (...args: any[]) => void;
66
+ loading: (...args: any[]) => void;
67
+ results: (...args: any[]) => void;
68
+ "update:modelValue": (...args: any[]) => void;
69
+ "click-outside": (...args: any[]) => void;
70
+ response: (...args: any[]) => void;
71
+ }, string, import("vue").PublicProps, Readonly<MenuConfig> & Readonly<{
72
+ onError?: ((...args: any[]) => any) | undefined;
73
+ onLoading?: ((...args: any[]) => any) | undefined;
74
+ onResults?: ((...args: any[]) => any) | undefined;
75
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
76
+ "onClick-outside"?: ((...args: any[]) => any) | undefined;
77
+ onResponse?: ((...args: any[]) => any) | undefined;
78
+ }>, {
79
+ resource: string;
80
+ resourceData: import("lkt-vue-kernel").LktObject;
81
+ modelValue: import("lkt-vue-kernel").MenuEntryConfig[];
82
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
83
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
84
+ export default _default;
85
+ type __VLS_WithSlots<T, S> = T & {
86
+ new (): {
87
+ $slots: S;
88
+ };
89
+ };
@@ -0,0 +1,5 @@
1
+ import { Component } from "vue";
2
+ export declare class Settings {
3
+ static toggleSlot: string | Component;
4
+ static debugEnabled: boolean;
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-menu",
3
- "version": "1.0.11",
3
+ "version": "1.4.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "lkt",
@@ -18,7 +18,7 @@
18
18
  ".": {
19
19
  "import": "./dist/build.js"
20
20
  },
21
- "./styles": "./dist/style.css",
21
+ "./styles": "./dist/build.css",
22
22
  "./theme": "./theme/default.css",
23
23
  "./theme/default": "./theme/default.css"
24
24
  },
@@ -31,34 +31,30 @@
31
31
  "license": "MIT",
32
32
  "sideEffects": false,
33
33
  "scripts": {
34
- "build": "rm -rf dist/*; vue-tsc --declaration --emitDeclarationOnly; vite build; tsc --project tsconfig.build.json; cp build/* dist/"
34
+ "build": "vue-tsc --declaration --emitDeclarationOnly; vite build; tsc --project tsconfig.build.json; cp build/* dist/",
35
+ "rebuild": "rm -rf dist/*; vue-tsc --declaration --emitDeclarationOnly; vite build; tsc --project tsconfig.build.json; cp build/* dist/"
35
36
  },
36
37
  "author": "Antonio Ibáñez",
38
+ "engines": {
39
+ "node": ">=18"
40
+ },
37
41
  "devDependencies": {
38
42
  "@babel/types": "^7.23.6",
39
43
  "@types/node": "^20.11.19",
40
44
  "@types/rollup": "^0.54.0",
41
45
  "@vitejs/plugin-vue": "^5.0.4",
42
- "rollup": "^4.9.6",
43
- "typescript": "^5.3.3",
44
- "vite": "^5.1.3",
46
+ "rollup": "^4.34.8",
47
+ "typescript": "^5.7.3",
48
+ "vite": "^6.1.1",
45
49
  "vue": "^3.3.0",
46
- "vue-tsc": "^1.8.27"
47
- },
48
- "engines": {
49
- "node": ">=18"
50
+ "vue-tsc": "^2.2.0"
50
51
  },
51
- "dependencies": {
52
- "lkt-anchor": "^1.1.4",
53
- "lkt-control-tools": "^1.0.3",
54
- "lkt-data-state": "^1.0.10",
55
- "lkt-events": "^1.0.2",
56
- "lkt-http-client": "^1.0.31",
57
- "lkt-i18n": "^1.0.4",
58
- "lkt-loader": "^1.0.1",
59
- "lkt-modal-confirm": "^1.0.0",
60
- "lkt-string-tools": "^1.0.1",
61
- "lkt-ts-interfaces": "^1.0.0",
52
+ "peerDependencies": {
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",
62
58
  "vue": "^3.3.0",
63
59
  "vue-router": "^4.3.3"
64
60
  }
@@ -1,18 +1,18 @@
1
1
  <script setup lang="ts">
2
- import {MenuEntry} from "../classes/MenuEntry";
3
- import {computed, onMounted, ref, useSlots, watch} from "vue";
4
- import {LktObject} from "lkt-ts-interfaces";
5
- import {fetchKeys} from "../functions/helpers";
6
- import {__} from "lkt-i18n";
7
- import {useRouter} from "vue-router";
8
- import {Settings} from "../settings/Settings";
2
+ import { extractI18nValue, LktObject, MenuEntry } from 'lkt-vue-kernel';
3
+ import { computed, onMounted, ref, useSlots, watch } from 'vue';
4
+ import { fetchKeys } from '../functions/helpers';
5
+ import { useRouter } from 'vue-router';
6
+ import { Settings } from '../settings/Settings';
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
@@ -60,10 +68,7 @@ const availableKeys = computed(() => {
60
68
  return r;
61
69
  }),
62
70
  computedLabel = computed(() => {
63
- if (entry.value.label.startsWith('__:')) {
64
- return __(entry.value.label.substring(3));
65
- }
66
- return entry.value.label;
71
+ return extractI18nValue(entry.value.label);
67
72
  }),
68
73
  computedIsActive = computed(() => {
69
74
  if (entry.value.isActive) return true;
@@ -98,9 +103,9 @@ onMounted(() => {
98
103
  if (currentRoute.value.path === entry.value.href) {
99
104
  entry.value.isOpened = true;
100
105
 
101
- } else if (entry.value.children.length > 0) {
106
+ } else if (entry.value.children?.length > 0) {
102
107
  let opened = false;
103
- entry.value.children.forEach((child) => {
108
+ entry.value.children?.forEach((child) => {
104
109
  if (currentRoute.value.path === child.href) opened = true;
105
110
  });
106
111
 
@@ -136,7 +141,7 @@ onMounted(() => {
136
141
  </div>
137
142
  </lkt-anchor>
138
143
 
139
- <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">
140
145
  <template v-if="hasToggleSlot">
141
146
  <component :is="toggleSlot" class="lkt-menu-entry-toggle-inner" :class="entry.isOpened ? 'is-opened' : '' "/>
142
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";
9
-
10
- const props = withDefaults(defineProps<{
11
- modelValue?: MenuEntry[],
12
- resource?: string
13
- resourceData: LktObject,
14
- }>(), {
15
- modelValue: () => [],
16
- resource: '',
17
- resourceData: () => ({}),
18
- });
19
-
20
- const emit = defineEmits(['update:modelValue', 'click-outside', 'loading', 'results', 'response', 'error']);
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
+
10
+ const props = withDefaults(defineProps<MenuConfig>(), getDefaultValues(Menu));
11
+
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
 
@@ -97,8 +96,4 @@ loadResource();
97
96
  </div>
98
97
  <div class="lkt-menu-outside" v-on:click="onClickOutside"/>
99
98
  </div>
100
- </template>
101
-
102
- <style scoped>
103
-
104
- </style>
99
+ </template>
File without changes