lkt-menu 2.0.5 → 2.0.7

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.css CHANGED
@@ -1 +1 @@
1
- .lkt-menu{background:var(--lkt-menu--background);padding:var(--lkt-menu--padding);max-width:var(--lkt-menu--max-width);width:var(--lkt-menu--width);height:100%;display:var(--lkt-menu--display);flex-direction:var(--lkt-menu--flex-direction);align-items:var(--lkt-menu--align-items);gap:var(--lkt-menu--entry--gap)}.lkt-menu-entry-toggle-inner{transition:all linear .2s}.lkt-menu-entry-toggle-inner.is-opened{transform:rotate(180deg)}.lkt-entry-content{display:inline-flex;flex-direction:row;gap:var(--lkt-menu--gap)}.lkt-menu-entry-toggle{display:inline-flex;flex-direction:row;align-items:center;justify-content:center}.lkt-menu-entry{padding:var(--lkt-menu--entry--padding)}.lkt-menu-entry .lkt-anchor{width:100%}.lkt-menu-entry-main{display:flex;justify-content:space-between;position:relative}.lkt-entry-content{font-size:var(--lkt-menu--font-size);width:100%}.lkt-menu-outside{position:fixed;top:64px;right:0;left:0;bottom:0;background:var(--lkt-menu--outside--background);z-index:-1}.lkt-menu-entry-children{padding:var(--lkt-menu--children--padding)}.lkt-menu-entry-text{padding:var(--lkt-menu--text-without-icon--padding)}.lkt-menu.has-icon .lkt-menu-entry-text{padding:var(--lkt-menu--text--padding)}.lkt-menu.has-icon .lkt-menu-entry-icon+.lkt-menu-entry-text{padding:var(--lkt-menu--text-with-icon--padding)}
1
+ .lkt-menu-main{background:var(--lkt-menu--background);padding:var(--lkt-menu--padding);max-width:var(--lkt-menu--max-width);width:var(--lkt-menu--width);height:100%;display:var(--lkt-menu--display);flex-direction:var(--lkt-menu--flex-direction);align-items:var(--lkt-menu--align-items);gap:var(--lkt-menu--entry--gap)}.lkt-menu-entry-toggle-inner{transition:all linear .2s}.lkt-menu-entry-toggle-inner.is-opened{transform:rotate(180deg)}.lkt-entry-content{display:inline-flex;flex-direction:row;gap:var(--lkt-menu--gap)}.lkt-menu-entry-toggle{display:inline-flex;flex-direction:row;align-items:center;justify-content:center}.lkt-menu-entry{padding:var(--lkt-menu--entry--padding)}.lkt-menu-entry .lkt-anchor{width:100%}.lkt-menu-entry-main{display:flex;justify-content:space-between;position:relative}.lkt-entry-content{font-size:var(--lkt-menu--font-size);width:100%}.lkt-menu-outside{position:absolute;top:0;right:0;left:0;bottom:0;background:var(--lkt-menu--outside--background);z-index:-1}.lkt-menu-entry-children{padding:var(--lkt-menu--children--padding)}.lkt-menu-entry-text{padding:var(--lkt-menu--text-without-icon--padding)}.lkt-menu.has-icon .lkt-menu-entry-text{padding:var(--lkt-menu--text--padding)}.lkt-menu.has-icon .lkt-menu-entry-icon+.lkt-menu-entry-text{padding:var(--lkt-menu--text-with-icon--padding)}
package/dist/build.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- declare namespace ge {
1
+ declare namespace Ve {
2
2
  function install(r: any): void;
3
3
  }
4
- declare function _e(r: any): boolean;
5
- export { ge as default, _e as setMenuToggleSlot };
4
+ declare function $e(r: any): boolean;
5
+ export { Ve as default, $e as setMenuToggleSlot };
package/dist/build.js CHANGED
@@ -1,24 +1,24 @@
1
- import { defineComponent as G, ref as F, useSlots as H, computed as p, watch as R, onMounted as X, resolveComponent as K, createElementBlock as d, openBlock as s, normalizeClass as O, createElementVNode as $, createCommentVNode as S, createBlock as g, unref as k, normalizeProps as q, mergeProps as L, createSlots as P, withCtx as f, renderSlot as h, toDisplayString as Y, resolveDynamicComponent as Z, Fragment as Q, renderList as j, mergeDefaults as x } from "vue";
2
- import { MenuEntryType as z, getDefaultValues as ee, Menu as te } from "lkt-vue-kernel";
3
- import { useRouter as le } from "vue-router";
4
- import { DataState as ne } from "lkt-data-state";
5
- import { httpCall as oe } from "lkt-http-client";
6
- const W = (r, _) => (_.forEach((a) => {
7
- a.key && !r.includes(a.key) && r.push(a.key), a.children && a.children.length > 0 && W(r, a.children);
8
- }), r), T = class T {
1
+ import { defineComponent as G, ref as W, useSlots as Q, computed as m, watch as U, onMounted as Y, resolveComponent as R, createElementBlock as d, openBlock as u, normalizeClass as O, createElementVNode as _, createCommentVNode as g, createBlock as h, unref as v, normalizeProps as P, mergeProps as j, createSlots as H, withCtx as f, renderSlot as k, toDisplayString as Z, resolveDynamicComponent as x, Fragment as X, renderList as w, mergeDefaults as ee } from "vue";
2
+ import { MenuEntryType as T, getDefaultValues as te, Menu as le } from "lkt-vue-kernel";
3
+ import { useRouter as ne } from "vue-router";
4
+ import { DataState as oe } from "lkt-data-state";
5
+ import { httpCall as ue } from "lkt-http-client";
6
+ const q = (r, V) => (V.forEach((a) => {
7
+ a.key && !r.includes(a.key) && r.push(a.key), a.children && a.children.length > 0 && q(r, a.children);
8
+ }), r), J = class J {
9
9
  };
10
- T.toggleSlot = "", T.debugEnabled = !1;
11
- let b = T;
12
- const ue = { class: "lkt-menu-entry-main" }, se = { class: "lkt-entry-content" }, ae = {
10
+ J.toggleSlot = "", J.debugEnabled = !1;
11
+ let A = J;
12
+ const se = { class: "lkt-menu-entry-main" }, ae = { class: "lkt-entry-content" }, re = {
13
13
  key: 0,
14
14
  class: "lkt-menu-entry-icon"
15
- }, re = {
15
+ }, ie = {
16
16
  key: 1,
17
17
  class: "lkt-menu-entry-text"
18
- }, ie = {
18
+ }, ce = {
19
19
  key: 0,
20
20
  class: "lkt-menu-entry-children"
21
- }, ce = /* @__PURE__ */ G({
21
+ }, de = /* @__PURE__ */ G({
22
22
  __name: "MenuItem",
23
23
  props: {
24
24
  modelValue: { default: () => ({}) }
@@ -26,128 +26,128 @@ const ue = { class: "lkt-menu-entry-main" }, se = { class: "lkt-entry-content" }
26
26
  emits: [
27
27
  "update:modelValue"
28
28
  ],
29
- setup(r, { emit: _ }) {
30
- const a = _, v = r, e = F(v.modelValue), i = H(), V = le(), y = F(!1), A = () => {
29
+ setup(r, { emit: V }) {
30
+ const a = V, p = r, e = W(p.modelValue), i = Q(), $ = ne(), y = W(!1), D = () => {
31
31
  e.value.isOpened = !e.value.isOpened;
32
- }, U = () => {
32
+ }, K = () => {
33
33
  var t, o;
34
- return typeof e.value.children < "u" && ((t = e.value.children) == null ? void 0 : t.length) > 0 && !e.value.keepOpenOnChildClick && A(), typeof ((o = e.value.events) == null ? void 0 : o.click) == "function" && e.value.events.click({
34
+ return typeof e.value.children < "u" && ((t = e.value.children) == null ? void 0 : t.length) > 0 && !e.value.keepOpenOnChildClick && D(), typeof ((o = e.value.events) == null ? void 0 : o.click) == "function" && e.value.events.click({
35
35
  entry: e.value
36
36
  }), 1;
37
- }, D = p(() => i["icon-" + e.value.key] || e.value.icon !== ""), w = p(() => {
37
+ }, M = m(() => i["icon-" + e.value.key] || e.value.icon !== ""), L = m(() => {
38
38
  let t = [];
39
- return D.value && t.push("has-icon"), y.value && t.push("is-active"), e.value.type && t.push(`is-${e.value.type}`), t.join(" ");
40
- }), M = p(() => {
39
+ return M.value && t.push("has-icon"), y.value && t.push("is-active"), e.value.type && t.push(`is-${e.value.type}`), t.join(" ");
40
+ }), E = m(() => {
41
41
  var o;
42
- return W([], ((o = e.value) == null ? void 0 : o.children) ?? []);
43
- }), l = p(() => {
42
+ return q([], ((o = e.value) == null ? void 0 : o.children) ?? []);
43
+ }), l = m(() => {
44
44
  let t = [];
45
45
  for (let o in i)
46
- o.startsWith("icon-") && M.value.includes(o.substring(5)) && t.push(o);
46
+ o.startsWith("icon-") && E.value.includes(o.substring(5)) && t.push(o);
47
47
  return t;
48
- }), n = p(() => e.value.isActive ? !0 : typeof e.value.isActiveChecker == "function" ? !!e.value.isActiveChecker({
48
+ }), n = m(() => e.value.isActive ? !0 : typeof e.value.isActiveChecker == "function" ? !!e.value.isActiveChecker({
49
49
  entry: e.value
50
- }) : !1), u = p(() => !!b.toggleSlot), c = p(() => b.toggleSlot);
51
- return R(() => v.modelValue, (t) => {
50
+ }) : !1), s = m(() => !!A.toggleSlot), c = m(() => A.toggleSlot);
51
+ return U(() => p.modelValue, (t) => {
52
52
  e.value = t;
53
- }, { deep: !0 }), R(e, (t) => {
53
+ }, { deep: !0 }), U(e, (t) => {
54
54
  a("update:modelValue", t);
55
- }, { deep: !0 }), X(() => {
56
- var o, E, C;
57
- let t = V == null ? void 0 : V.currentRoute;
55
+ }, { deep: !0 }), Y(() => {
56
+ var o, I, B;
57
+ let t = $ == null ? void 0 : $.currentRoute;
58
58
  if (t) {
59
59
  if (t.value.path === ((o = e.value.anchor) == null ? void 0 : o.to))
60
60
  e.value.isOpened = !0;
61
- else if (typeof e.value.children < "u" && ((E = e.value.children) == null ? void 0 : E.length) > 0) {
62
- let I = !1;
63
- (C = e.value.children) == null || C.forEach((B) => {
64
- var m;
65
- t.value.path === ((m = B.anchor) == null ? void 0 : m.to) && (I = !0);
66
- }), I && (e.value.isOpened = !0);
61
+ else if (typeof e.value.children < "u" && ((I = e.value.children) == null ? void 0 : I.length) > 0) {
62
+ let C = !1;
63
+ (B = e.value.children) == null || B.forEach((z) => {
64
+ var S;
65
+ t.value.path === ((S = z.anchor) == null ? void 0 : S.to) && (C = !0);
66
+ }), C && (e.value.isOpened = !0);
67
67
  }
68
68
  }
69
69
  }), (t, o) => {
70
- var B;
71
- const E = K("lkt-button"), C = K("lkt-anchor"), I = K("menu-item", !0);
72
- return s(), d("div", {
73
- class: O(["lkt-menu-entry", w.value])
70
+ var S;
71
+ const I = R("lkt-button"), B = R("lkt-header"), C = R("lkt-anchor"), z = R("menu-item", !0);
72
+ return u(), d("div", {
73
+ class: O(["lkt-menu-entry", L.value])
74
74
  }, [
75
- $("div", ue, [
76
- e.value.type === k(z).Button ? (s(), g(E, q(L({ key: 0 }, e.value.button)), P({ _: 2 }, [
77
- k(i).tooltip ? {
75
+ _("div", se, [
76
+ e.value.type === v(T).Button ? (u(), h(I, P(j({ key: 0 }, e.value.button)), H({ _: 2 }, [
77
+ v(i).tooltip ? {
78
78
  name: "tooltip",
79
79
  fn: f(() => [
80
- h(t.$slots, "tooltip")
80
+ k(t.$slots, "tooltip")
81
81
  ]),
82
82
  key: "0"
83
83
  } : void 0,
84
- k(i).split ? {
84
+ v(i).split ? {
85
85
  name: "split",
86
86
  fn: f(() => [
87
- h(t.$slots, "split")
87
+ k(t.$slots, "split")
88
88
  ]),
89
89
  key: "1"
90
90
  } : void 0
91
- ]), 1040)) : e.value.type === k(z).Anchor ? (s(), g(C, q(L({ key: 1 }, e.value.anchor)), null, 16)) : (s(), g(C, L({ key: 2 }, e.value.anchor, {
92
- "on-click": U,
91
+ ]), 1040)) : e.value.type === v(T).Header ? (u(), h(B, P(j({ key: 1 }, e.value.header)), null, 16)) : e.value.type === v(T).Anchor ? (u(), h(C, P(j({ key: 2 }, e.value.anchor)), null, 16)) : (u(), h(C, j({ key: 3 }, e.value.anchor, {
92
+ "on-click": K,
93
93
  "is-active": n.value,
94
- onActive: o[0] || (o[0] = (m) => y.value = m)
94
+ onActive: o[0] || (o[0] = (b) => y.value = b)
95
95
  }), {
96
- text: f(({ text: m }) => [
97
- $("div", se, [
98
- D.value ? (s(), d("div", ae, [
99
- k(i)["icon-" + e.value.key] ? h(t.$slots, "icon-" + e.value.key, {
96
+ text: f(({ text: b }) => [
97
+ _("div", ae, [
98
+ M.value ? (u(), d("div", re, [
99
+ v(i)["icon-" + e.value.key] ? k(t.$slots, "icon-" + e.value.key, {
100
100
  key: e.value.key,
101
101
  entry: e.value
102
- }) : e.value.icon !== "" ? (s(), d("i", {
102
+ }) : e.value.icon !== "" ? (u(), d("i", {
103
103
  key: 1,
104
104
  class: O(e.value.icon)
105
- }, null, 2)) : S("", !0)
106
- ])) : S("", !0),
107
- m !== "" ? (s(), d("div", re, Y(m), 1)) : S("", !0)
105
+ }, null, 2)) : g("", !0)
106
+ ])) : g("", !0),
107
+ b !== "" ? (u(), d("div", ie, Z(b), 1)) : g("", !0)
108
108
  ])
109
109
  ]),
110
110
  _: 3
111
111
  }, 16, ["is-active"])),
112
- e.value.type !== k(z).Button && e.value.children && ((B = e.value.children) == null ? void 0 : B.length) > 0 ? (s(), d("div", {
113
- key: 3,
112
+ e.value.type !== v(T).Button && e.value.children && ((S = e.value.children) == null ? void 0 : S.length) > 0 ? (u(), d("div", {
113
+ key: 4,
114
114
  class: "lkt-menu-entry-toggle",
115
- onClick: A
115
+ onClick: D
116
116
  }, [
117
- u.value ? (s(), g(Z(c.value), {
117
+ s.value ? (u(), h(x(c.value), {
118
118
  key: 0,
119
119
  class: O(["lkt-menu-entry-toggle-inner", e.value.isOpened ? "is-opened" : ""])
120
- }, null, 8, ["class"])) : (s(), d("div", {
120
+ }, null, 8, ["class"])) : (u(), d("div", {
121
121
  key: 1,
122
122
  class: O(["lkt-menu-entry-toggle-inner", e.value.isOpened ? "is-opened" : ""])
123
123
  }, o[1] || (o[1] = [
124
- $("i", { class: "lkt-icn-angle-bottom" }, null, -1)
124
+ _("i", { class: "lkt-icn-angle-bottom" }, null, -1)
125
125
  ]), 2))
126
- ])) : S("", !0)
126
+ ])) : g("", !0)
127
127
  ]),
128
- e.value.isOpened ? (s(), d("div", ie, [
129
- (s(!0), d(Q, null, j(e.value.children, (m, J) => (s(), g(I, {
130
- modelValue: e.value.children[J],
131
- "onUpdate:modelValue": (N) => e.value.children[J] = N,
132
- key: e.value.children[J].key
133
- }, P({ _: 2 }, [
134
- j(l.value, (N) => ({
128
+ e.value.isOpened ? (u(), d("div", ce, [
129
+ (u(!0), d(X, null, w(e.value.children, (b, F) => (u(), h(z, {
130
+ modelValue: e.value.children[F],
131
+ "onUpdate:modelValue": (N) => e.value.children[F] = N,
132
+ key: e.value.children[F].key
133
+ }, H({ _: 2 }, [
134
+ w(l.value, (N) => ({
135
135
  name: N,
136
136
  fn: f(() => [
137
- h(t.$slots, N)
137
+ k(t.$slots, N)
138
138
  ])
139
139
  }))
140
140
  ]), 1032, ["modelValue", "onUpdate:modelValue"]))), 128))
141
- ])) : S("", !0)
141
+ ])) : g("", !0)
142
142
  ], 2);
143
143
  };
144
144
  }
145
- }), de = { class: "lkt-menu-container" }, ve = { class: "lkt-menu" }, pe = /* @__PURE__ */ G({
145
+ }), ve = { class: "lkt-menu" }, pe = { class: "lkt-menu-main" }, me = { class: "lkt-menu-entries" }, ke = /* @__PURE__ */ G({
146
146
  __name: "LktMenu",
147
- props: /* @__PURE__ */ x({
147
+ props: /* @__PURE__ */ ee({
148
148
  modelValue: {},
149
149
  http: {}
150
- }, ee(te)),
150
+ }, te(le)),
151
151
  emits: [
152
152
  "update:modelValue",
153
153
  "click-outside",
@@ -156,80 +156,83 @@ const ue = { class: "lkt-menu-entry-main" }, se = { class: "lkt-entry-content" }
156
156
  "response",
157
157
  "error"
158
158
  ],
159
- setup(r, { emit: _ }) {
160
- var M;
161
- const a = r, v = _, e = H(), i = F(a.modelValue), V = (l) => {
159
+ setup(r, { emit: V }) {
160
+ var E;
161
+ const a = r, p = V, e = Q(), i = W(a.modelValue), $ = (l) => {
162
162
  let n = {};
163
163
  typeof l == "object" && Object.keys(l).length > 0 && (n = JSON.parse(JSON.stringify(l)));
164
- for (let u in n)
165
- (Array.isArray(n[u]) || typeof n[u] == "object") && (n[u] = JSON.stringify(n[u]));
164
+ for (let s in n)
165
+ (Array.isArray(n[s]) || typeof n[s] == "object") && (n[s] = JSON.stringify(n[s]));
166
166
  return n;
167
167
  };
168
- let y = new ne({});
169
- y.increment(V(((M = a.http) == null ? void 0 : M.data) ?? {}));
170
- const A = p(() => W([], i.value)), U = p(() => {
168
+ let y = new oe({});
169
+ y.increment($(((E = a.http) == null ? void 0 : E.data) ?? {}));
170
+ const D = m(() => q([], i.value)), K = m(() => {
171
171
  let l = [];
172
172
  for (let n in e)
173
- n.startsWith("icon-") && A.value.includes(n.substring(5)) && l.push(n);
173
+ n.startsWith("icon-") && D.value.includes(n.substring(5)) && l.push(n);
174
174
  return l;
175
- }), D = () => {
176
- var n, u;
175
+ }), M = () => {
176
+ var n, s;
177
177
  if (!((n = a.http) != null && n.resource)) return;
178
178
  let l = y.getData();
179
- v("loading"), oe((u = a.http) == null ? void 0 : u.resource, l).then((c) => {
180
- y.turnStoredIntoOriginal(), i.value = c.data, v("results", c.data), v("response", c);
179
+ p("loading"), ue((s = a.http) == null ? void 0 : s.resource, l).then((c) => {
180
+ y.turnStoredIntoOriginal(), i.value = c.data, p("results", c.data), p("response", c);
181
181
  }).catch((c) => {
182
- v("error", c);
182
+ p("error", c);
183
183
  });
184
- }, w = () => {
185
- v("click-outside");
184
+ }, L = () => {
185
+ p("click-outside");
186
186
  };
187
- return R(() => a.modelValue, (l) => {
187
+ return U(() => a.modelValue, (l) => {
188
188
  i.value = l;
189
- }, { deep: !0 }), R(i, (l) => {
190
- v("update:modelValue", l);
191
- }, { deep: !0 }), D(), (l, n) => (s(), d("div", de, [
192
- $("div", ve, [
193
- (s(!0), d(Q, null, j(i.value, (u, c) => (s(), g(ce, {
194
- modelValue: i.value[c],
195
- "onUpdate:modelValue": (t) => i.value[c] = t,
196
- key: u.key,
197
- class: O(u.class)
198
- }, P({ _: 2 }, [
199
- j(U.value, (t) => ({
200
- name: t,
201
- fn: f(() => [
202
- h(l.$slots, t)
203
- ])
204
- })),
205
- k(e)[`tooltip-${u.key}`] ? {
206
- name: "tooltip",
207
- fn: f(() => [
208
- h(l.$slots, `tooltip-${u.key}`)
209
- ]),
210
- key: "0"
211
- } : void 0,
212
- k(e)[`split-${u.key}`] ? {
213
- name: "split",
214
- fn: f(() => [
215
- h(l.$slots, `split-${u.key}`)
216
- ]),
217
- key: "1"
218
- } : void 0
219
- ]), 1032, ["modelValue", "onUpdate:modelValue", "class"]))), 128))
189
+ }, { deep: !0 }), U(i, (l) => {
190
+ p("update:modelValue", l);
191
+ }, { deep: !0 }), M(), (l, n) => (u(), d("div", ve, [
192
+ _("div", pe, [
193
+ v(e).before ? k(l.$slots, "before", { key: 0 }) : g("", !0),
194
+ _("div", me, [
195
+ (u(!0), d(X, null, w(i.value, (s, c) => (u(), h(de, {
196
+ modelValue: i.value[c],
197
+ "onUpdate:modelValue": (t) => i.value[c] = t,
198
+ key: s.key,
199
+ class: O(s.class)
200
+ }, H({ _: 2 }, [
201
+ w(K.value, (t) => ({
202
+ name: t,
203
+ fn: f(() => [
204
+ k(l.$slots, t)
205
+ ])
206
+ })),
207
+ v(e)[`tooltip-${s.key}`] ? {
208
+ name: "tooltip",
209
+ fn: f(() => [
210
+ k(l.$slots, `tooltip-${s.key}`)
211
+ ]),
212
+ key: "0"
213
+ } : void 0,
214
+ v(e)[`split-${s.key}`] ? {
215
+ name: "split",
216
+ fn: f(() => [
217
+ k(l.$slots, `split-${s.key}`)
218
+ ]),
219
+ key: "1"
220
+ } : void 0
221
+ ]), 1032, ["modelValue", "onUpdate:modelValue", "class"]))), 128))
222
+ ])
220
223
  ]),
221
- $("div", {
224
+ _("div", {
222
225
  class: "lkt-menu-outside",
223
- onClick: w
226
+ onClick: L
224
227
  })
225
228
  ]));
226
229
  }
227
- }), ge = {
230
+ }), Ve = {
228
231
  install: (r) => {
229
- r.component("lkt-menu") === void 0 && r.component("lkt-menu", pe);
232
+ r.component("lkt-menu") === void 0 && r.component("lkt-menu", ke);
230
233
  }
231
- }, _e = (r) => (b.toggleSlot = r, !0);
234
+ }, $e = (r) => (A.toggleSlot = r, !0);
232
235
  export {
233
- ge as default,
234
- _e as setMenuToggleSlot
236
+ Ve as default,
237
+ $e as setMenuToggleSlot
235
238
  };