@dv.net/ui-kit 7.5.9 → 7.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,71 @@
1
+ import { defineComponent as $, computed as c, createElementBlock as l, openBlock as u, normalizeClass as B, Fragment as v, renderList as y, createVNode as g } from "vue";
2
+ import { _ as R } from "./UiLayoutMenuItem.vue_vue_type_script_setup_true_lang.CDnwiaSr.js";
3
+ import "./style.C3xG1ALc.js";
4
+ import { useRoute as C } from "vue-router";
5
+ const L = /* @__PURE__ */ $({
6
+ __name: "UiLayoutMenu",
7
+ props: {
8
+ routeItems: {},
9
+ collapsed: { type: Boolean, default: !1 }
10
+ },
11
+ emits: ["selected"],
12
+ setup(k) {
13
+ const a = k, p = C(), h = (e) => (e.length > 1 ? e.replace(/\/+$/, "") : e).toLowerCase(), M = c(() => {
14
+ const e = (r) => {
15
+ let t = [];
16
+ return r.forEach((o) => {
17
+ t.push(o), o.children?.length && (t = t.concat(e(o.children)));
18
+ }), t;
19
+ };
20
+ return e(a.routeItems);
21
+ }), m = c(() => {
22
+ function e(r, t, o = []) {
23
+ for (const n of t)
24
+ if (n.children && n.children.length > 0 && (n.children.some((i) => i?.path === r) || e(r, n.children, o)))
25
+ return o.push(n?.path), o;
26
+ return null;
27
+ }
28
+ return e(p?.path, a.routeItems);
29
+ }), d = c(() => {
30
+ const e = h(p.path);
31
+ let r = null;
32
+ const t = (o) => {
33
+ o.forEach((n) => {
34
+ const s = h(n.path), f = s === e, i = s !== "/" && e.startsWith(`${s}/`);
35
+ (f || i) && (!r || s.length > r.length) && (r = s), n.children?.length && t(n.children);
36
+ });
37
+ };
38
+ return t(a.routeItems), r;
39
+ });
40
+ return (e, r) => (u(), l("ul", {
41
+ class: B(["ui-layout-menu", { "is-collapsed": e.collapsed }])
42
+ }, [
43
+ e.collapsed ? (u(!0), l(v, { key: 0 }, y(M.value, (t) => (u(), l("li", {
44
+ key: t?.path
45
+ }, [
46
+ g(R, {
47
+ "route-item": t,
48
+ collapsed: e.collapsed,
49
+ "route-items": e.routeItems,
50
+ parrentRoutes: m.value,
51
+ "active-menu-path": d.value,
52
+ onSelected: r[0] || (r[0] = (o) => e.$emit("selected", o))
53
+ }, null, 8, ["route-item", "collapsed", "route-items", "parrentRoutes", "active-menu-path"])
54
+ ]))), 128)) : (u(!0), l(v, { key: 1 }, y(e.routeItems, (t) => (u(), l("li", {
55
+ key: t?.path
56
+ }, [
57
+ g(R, {
58
+ "route-item": t,
59
+ collapsed: e.collapsed,
60
+ "route-items": e.routeItems,
61
+ parrentRoutes: m.value,
62
+ "active-menu-path": d.value,
63
+ onSelected: r[1] || (r[1] = (o) => e.$emit("selected", o))
64
+ }, null, 8, ["route-item", "collapsed", "route-items", "parrentRoutes", "active-menu-path"])
65
+ ]))), 128))
66
+ ], 2));
67
+ }
68
+ });
69
+ export {
70
+ L as _
71
+ };
@@ -1,8 +1,7 @@
1
- import { defineComponent as z, inject as A, ref as N, computed as g, resolveComponent as U, createElementBlock as m, openBlock as t, Fragment as I, createBlock as s, createCommentVNode as a, resolveDynamicComponent as C, withModifiers as L, withCtx as V, createElementVNode as B, withKeys as E, unref as p, normalizeClass as w, withDirectives as v, createVNode as S, vShow as y, toDisplayString as M, renderList as K } from "vue";
1
+ import { defineComponent as A, inject as D, ref as O, computed as M, resolveComponent as b, createElementBlock as m, openBlock as o, Fragment as I, createBlock as s, createCommentVNode as u, resolveDynamicComponent as k, withModifiers as P, withCtx as N, createElementVNode as S, withKeys as U, unref as p, normalizeClass as C, withDirectives as v, createVNode as w, vShow as h, toDisplayString as g, renderList as V } from "vue";
2
2
  import { _ as R } from "./UiIcon.vue_vue_type_script_setup_true_lang.DFsApq5s.js";
3
3
  /* empty css */
4
- import { useRoute as j } from "vue-router";
5
- import { _ as F } from "./UiAnimation.vue_vue_type_script_setup_true_lang.DaVsSmL9.js";
4
+ import { _ as E } from "./UiAnimation.vue_vue_type_script_setup_true_lang.DaVsSmL9.js";
6
5
  import "./style.C3xG1ALc.js";
7
6
  /* empty css */
8
7
  import "../config/index.js";
@@ -25,7 +24,8 @@ import "../components/UiDatepicker/composables/useDatePickerPresets.js";
25
24
  /* empty css */
26
25
  /* empty css */
27
26
  /* empty css */
28
- import { menuProvideDefault as H } from "../components/UiLayout/types.js";
27
+ import { menuProvideDefault as F } from "../components/UiLayout/types.js";
28
+ import "vue-router";
29
29
  /* empty css */
30
30
  /* empty css */
31
31
  /* empty css */
@@ -33,135 +33,135 @@ import { menuProvideDefault as H } from "../components/UiLayout/types.js";
33
33
  /* empty css */
34
34
  /* empty css */
35
35
  /* empty css */
36
- import { w as q } from "./index.DeYcP251.js";
37
- const G = {
36
+ import { w as K } from "./index.DeYcP251.js";
37
+ const j = {
38
38
  key: 3,
39
39
  class: "ui-layout-menu-item__indicator"
40
- }, J = {
40
+ }, H = {
41
41
  key: 0,
42
42
  class: "ui-layout-menu"
43
- }, Pe = /* @__PURE__ */ z({
43
+ }, ge = /* @__PURE__ */ A({
44
44
  __name: "UiLayoutMenuItem",
45
45
  props: {
46
46
  routeItem: {},
47
47
  collapsed: { type: Boolean },
48
48
  parrentRoutes: {},
49
- routeItems: {}
49
+ routeItems: {},
50
+ activeMenuPath: {}
50
51
  },
51
52
  emits: ["selected"],
52
- setup(P) {
53
- const n = P, { onMenuItemSelect: c } = A("menu") || H, h = j(), u = N(n.parrentRoutes?.includes(n.routeItem?.path)), f = g(() => n.routeItem?.meta?.isButton), i = g(() => {
54
- const { path: e, meta: r, children: k } = n.routeItem, o = !!r?.isChildren, d = e?.toLowerCase(), O = h?.matched.map((l) => l.path?.toLowerCase());
55
- if (k?.length)
56
- return {
57
- isSelected: O.includes(d),
58
- isChildren: o
59
- };
60
- const $ = h?.path.split("/").map((l) => l.toLowerCase()), b = d.split("/")[1];
53
+ setup(B) {
54
+ const t = B, { onMenuItemSelect: c } = D("menu") || F, a = O(t.parrentRoutes?.includes(t.routeItem?.path)), y = M(() => t.routeItem?.meta?.isButton), r = M(() => {
55
+ const { path: e, meta: i } = t.routeItem, f = !!i?.isChildren, n = (l) => (l.length > 1 ? l.replace(/\/+$/, "") : l).toLowerCase(), d = n(e), $ = (t.activeMenuPath ? n(t.activeMenuPath) : null) === d, z = !!t.parrentRoutes?.some(
56
+ (l) => n(l) === d
57
+ );
61
58
  return {
62
- isSelected: o ? e === h?.path : $.some((l) => l === b),
63
- isChildren: o
59
+ // Parent items are active only when the current route belongs to their declared children tree.
60
+ // Leaf items are active only on exact path match.
61
+ isSelected: $ || z,
62
+ isChildren: f
64
63
  };
65
64
  });
66
- function D() {
67
- f.value && (n.routeItem.meta.click ? n.routeItem?.meta?.click() : f.value && (u.value = !u.value));
65
+ function L() {
66
+ y.value && (t.routeItem.meta.click ? t.routeItem?.meta?.click() : y.value && (a.value = !a.value));
68
67
  }
69
- return q(
70
- () => n.parrentRoutes,
68
+ return K(
69
+ () => t.parrentRoutes,
71
70
  () => {
72
- n.parrentRoutes && n.parrentRoutes?.includes(n.routeItem?.path) && (u.value = !0);
71
+ t.parrentRoutes && t.parrentRoutes?.includes(t.routeItem?.path) && (a.value = !0);
73
72
  }
74
- ), (e, r) => {
75
- const k = U("UiLayoutMenuItem", !0);
76
- return t(), m(I, null, [
77
- (t(), s(C(f.value ? "button" : "RouterLink"), {
78
- onClick: L(D, ["stop"]),
73
+ ), (e, i) => {
74
+ const f = b("UiLayoutMenuItem", !0);
75
+ return o(), m(I, null, [
76
+ (o(), s(k(y.value ? "button" : "RouterLink"), {
77
+ onClick: P(L, ["stop"]),
79
78
  to: e.routeItem?.path,
80
79
  class: "ui-layout-menu-item__link"
81
80
  }, {
82
- default: V(() => [
83
- B("span", {
84
- class: w(["ui-layout-menu-item", [
85
- { "is-selected": i.value.isSelected && !i.value.isChildren },
81
+ default: N(() => [
82
+ S("span", {
83
+ class: C(["ui-layout-menu-item", [
84
+ { "is-selected": r.value.isSelected && !r.value.isChildren },
86
85
  { "is-collapsed": e.collapsed },
87
86
  e.routeItem.meta?.class
88
87
  ]]),
89
- onClick: r[1] || (r[1] = //@ts-ignore
90
- (...o) => p(c) && p(c)(...o)),
91
- onKeyup: r[2] || (r[2] = E(
88
+ onClick: i[1] || (i[1] = //@ts-ignore
89
+ (...n) => p(c) && p(c)(...n)),
90
+ onKeyup: i[2] || (i[2] = U(
92
91
  //@ts-ignore
93
- (...o) => p(c) && p(c)(...o),
92
+ (...n) => p(c) && p(c)(...n),
94
93
  ["enter"]
95
94
  ))
96
95
  }, [
97
- e.routeItem?.meta?.animationIcon ? (t(), s(p(F), {
96
+ e.routeItem?.meta?.animationIcon ? (o(), s(p(E), {
98
97
  key: 0,
99
- autoPlay: i.value.isSelected,
98
+ autoPlay: r.value.isSelected,
100
99
  width: 24,
101
100
  height: 24,
102
101
  "icon-component": e.routeItem?.meta?.animationIcon,
103
102
  class: "ui-layout-menu-item__animation"
104
- }, null, 8, ["autoPlay", "icon-component"])) : a("", !0),
105
- e.routeItem?.meta?.icon && e.routeItem?.meta?.iconActive ? (t(), m(I, { key: 1 }, [
106
- v(S(R, {
103
+ }, null, 8, ["autoPlay", "icon-component"])) : u("", !0),
104
+ e.routeItem?.meta?.icon && e.routeItem?.meta?.iconActive ? (o(), m(I, { key: 1 }, [
105
+ v(w(R, {
107
106
  size: "lg",
108
107
  name: e.routeItem.meta.iconActive,
109
108
  type: "filled"
110
109
  }, null, 8, ["name"]), [
111
- [y, i.value.isSelected]
110
+ [h, r.value.isSelected]
112
111
  ]),
113
- v(S(R, {
112
+ v(w(R, {
114
113
  size: "lg",
115
114
  name: e.routeItem.meta.icon,
116
115
  type: "100"
117
116
  }, null, 8, ["name"]), [
118
- [y, !i.value.isSelected]
117
+ [h, !r.value.isSelected]
119
118
  ])
120
- ], 64)) : a("", !0),
121
- e.routeItem.meta?.iconComponent ? (t(), m(I, { key: 2 }, [
122
- v((t(), s(C(e.routeItem.meta?.iconComponentActive), null, null, 512)), [
123
- [y, i.value.isSelected]
119
+ ], 64)) : u("", !0),
120
+ e.routeItem.meta?.iconComponent ? (o(), m(I, { key: 2 }, [
121
+ v((o(), s(k(e.routeItem.meta?.iconComponentActive), null, null, 512)), [
122
+ [h, r.value.isSelected]
124
123
  ]),
125
- v((t(), s(C(e.routeItem.meta?.iconComponent), null, null, 512)), [
126
- [y, !i.value.isSelected]
124
+ v((o(), s(k(e.routeItem.meta?.iconComponent), null, null, 512)), [
125
+ [h, !r.value.isSelected]
127
126
  ])
128
- ], 64)) : a("", !0),
129
- B("span", {
130
- class: w(["ui-layout-menu-item__title", [{ children: i.value.isChildren }, { "children-active": i.value.isSelected }]])
131
- }, M(e.routeItem.meta?.title), 3),
132
- e.routeItem.meta.indicator ? (t(), m("span", G, M(e.routeItem.meta.indicator), 1)) : a("", !0),
133
- e.routeItem.children?.length && !e.collapsed && !e.routeItem.meta.alwaysOpen ? (t(), m("button", {
127
+ ], 64)) : u("", !0),
128
+ S("span", {
129
+ class: C(["ui-layout-menu-item__title", [{ children: r.value.isChildren }, { "children-active": r.value.isSelected }]])
130
+ }, g(e.routeItem.meta?.title), 3),
131
+ e.routeItem.meta.indicator ? (o(), m("span", j, g(e.routeItem.meta.indicator), 1)) : u("", !0),
132
+ e.routeItem.children?.length && !e.collapsed && !e.routeItem.meta.alwaysOpen ? (o(), m("button", {
134
133
  key: 4,
135
- onClick: r[0] || (r[0] = L((o) => u.value = !u.value, ["stop", "prevent"])),
136
- class: w(["ui-layout-menu-item__chevron", { "is-open": u.value }])
134
+ onClick: i[0] || (i[0] = P((n) => a.value = !a.value, ["stop", "prevent"])),
135
+ class: C(["ui-layout-menu-item__chevron", { "is-open": a.value }])
137
136
  }, [
138
- S(R, {
137
+ w(R, {
139
138
  name: "keyboard-arrow-down",
140
139
  type: "400"
141
140
  })
142
- ], 2)) : a("", !0)
141
+ ], 2)) : u("", !0)
143
142
  ], 34)
144
143
  ]),
145
144
  _: 1
146
145
  }, 8, ["to"])),
147
- e.routeItem?.children && e.routeItem.children?.length && !e.collapsed && (u.value || e.routeItem.meta.alwaysOpen) ? (t(), m("ul", J, [
148
- (t(!0), m(I, null, K(e.routeItem.children, (o) => (t(), m("li", {
149
- key: o?.path
146
+ e.routeItem?.children && e.routeItem.children?.length && !e.collapsed && (a.value || e.routeItem.meta.alwaysOpen) ? (o(), m("ul", H, [
147
+ (o(!0), m(I, null, V(e.routeItem.children, (n) => (o(), m("li", {
148
+ key: n?.path
150
149
  }, [
151
- (t(), s(k, {
150
+ (o(), s(f, {
152
151
  routeItems: e.routeItems,
153
- key: o?.path,
154
- "route-item": o,
152
+ key: n?.path,
153
+ "route-item": n,
155
154
  collapsed: e.collapsed,
156
155
  parrentRoutes: e.parrentRoutes,
157
- onSelected: r[3] || (r[3] = (d) => e.$emit("selected", d))
158
- }, null, 8, ["routeItems", "route-item", "collapsed", "parrentRoutes"]))
156
+ "active-menu-path": e.activeMenuPath,
157
+ onSelected: i[3] || (i[3] = (d) => e.$emit("selected", d))
158
+ }, null, 8, ["routeItems", "route-item", "collapsed", "parrentRoutes", "active-menu-path"]))
159
159
  ]))), 128))
160
- ])) : a("", !0)
160
+ ])) : u("", !0)
161
161
  ], 64);
162
162
  };
163
163
  }
164
164
  });
165
165
  export {
166
- Pe as _
166
+ ge as _
167
167
  };
@@ -1,4 +1,4 @@
1
- import { _ as m } from "../../assets/UiLayoutMenu.vue_vue_type_script_setup_true_lang.Bpce0J4j.js";
1
+ import { _ as m } from "../../assets/UiLayoutMenu.vue_vue_type_script_setup_true_lang.s_cerqGK.js";
2
2
  import "../../assets/style.C3xG1ALc.js";
3
3
  export {
4
4
  m as default
@@ -1,4 +1,4 @@
1
- import { _ as m } from "../../assets/UiLayoutMenuItem.vue_vue_type_script_setup_true_lang.DFKZwWfN.js";
1
+ import { _ as m } from "../../assets/UiLayoutMenuItem.vue_vue_type_script_setup_true_lang.CDnwiaSr.js";
2
2
  import "../../assets/style.C3xG1ALc.js";
3
3
  export {
4
4
  m as default
@@ -26,4 +26,5 @@ export interface UiLayoutMenuItemProps {
26
26
  collapsed: boolean;
27
27
  parrentRoutes: string[] | null;
28
28
  routeItems: RouteItem[];
29
+ activeMenuPath: string | null;
29
30
  }
package/dist/index.js CHANGED
@@ -33,8 +33,8 @@ import { _ as xo } from "./assets/UiLanguages.vue_vue_type_script_setup_true_lan
33
33
  import { _ as _o } from "./assets/UiLayout.vue_vue_type_script_setup_true_lang.CELUDfDH.js";
34
34
  /* empty css */
35
35
  import { default as lo } from "./components/UiLayoutAuth/UiLayoutAuth.js";
36
- import { _ as co } from "./assets/UiLayoutMenu.vue_vue_type_script_setup_true_lang.Bpce0J4j.js";
37
- import { _ as yo } from "./assets/UiLayoutMenuItem.vue_vue_type_script_setup_true_lang.DFKZwWfN.js";
36
+ import { _ as co } from "./assets/UiLayoutMenu.vue_vue_type_script_setup_true_lang.s_cerqGK.js";
37
+ import { _ as yo } from "./assets/UiLayoutMenuItem.vue_vue_type_script_setup_true_lang.CDnwiaSr.js";
38
38
  import { _ as To } from "./assets/UiLink.vue_vue_type_script_setup_true_lang.BdNoHssP.js";
39
39
  /* empty css */
40
40
  import { _ as Lo } from "./assets/UiLoading.vue_vue_type_script_setup_true_lang.CGIpSwtF.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dv.net/ui-kit",
3
3
  "private": false,
4
- "version": "7.5.9",
4
+ "version": "7.5.10",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "module": "dist/index.js",
@@ -1,59 +0,0 @@
1
- import { defineComponent as k, computed as a, createElementBlock as s, openBlock as u, normalizeClass as F, Fragment as p, renderList as m, createVNode as d } from "vue";
2
- import { _ as c } from "./UiLayoutMenuItem.vue_vue_type_script_setup_true_lang.DFKZwWfN.js";
3
- import "./style.C3xG1ALc.js";
4
- import { useRoute as I } from "vue-router";
5
- const L = /* @__PURE__ */ k({
6
- __name: "UiLayoutMenu",
7
- props: {
8
- routeItems: {},
9
- collapsed: { type: Boolean, default: !1 }
10
- },
11
- emits: ["selected"],
12
- setup(f) {
13
- const n = f, h = I(), y = a(() => {
14
- const e = (r) => {
15
- let o = [];
16
- return r.forEach((t) => {
17
- o.push(t), t.children?.length && (o = o.concat(e(t.children)));
18
- }), o;
19
- };
20
- return e(n.routeItems);
21
- }), i = a(() => {
22
- function e(r, o, t = []) {
23
- for (const l of o)
24
- if (l.children && l.children.length > 0 && (l.children.some((R) => R?.path === r) || e(r, l.children, t)))
25
- return t.push(l?.path), t;
26
- return null;
27
- }
28
- return e(h?.path, n.routeItems);
29
- });
30
- return (e, r) => (u(), s("ul", {
31
- class: F(["ui-layout-menu", { "is-collapsed": e.collapsed }])
32
- }, [
33
- e.collapsed ? (u(!0), s(p, { key: 0 }, m(y.value, (o) => (u(), s("li", {
34
- key: o?.path
35
- }, [
36
- d(c, {
37
- "route-item": o,
38
- collapsed: e.collapsed,
39
- "route-items": e.routeItems,
40
- parrentRoutes: i.value,
41
- onSelected: r[0] || (r[0] = (t) => e.$emit("selected", t))
42
- }, null, 8, ["route-item", "collapsed", "route-items", "parrentRoutes"])
43
- ]))), 128)) : (u(!0), s(p, { key: 1 }, m(e.routeItems, (o) => (u(), s("li", {
44
- key: o?.path
45
- }, [
46
- d(c, {
47
- "route-item": o,
48
- collapsed: e.collapsed,
49
- "route-items": e.routeItems,
50
- parrentRoutes: i.value,
51
- onSelected: r[1] || (r[1] = (t) => e.$emit("selected", t))
52
- }, null, 8, ["route-item", "collapsed", "route-items", "parrentRoutes"])
53
- ]))), 128))
54
- ], 2));
55
- }
56
- });
57
- export {
58
- L as _
59
- };