vft 0.0.110 → 0.0.112

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.
@@ -1,21 +1,21 @@
1
- import { defineComponent as B, computed as C, getCurrentInstance as F, useSlots as G, ref as K, createVNode as v, mergeProps as J } from "vue";
2
- import { VftMenu as Q, VftSubMenu as W, VftMenuItem as X } from "../menu/index.js";
3
- import { useNamespace as Y } from "../../hooks/use-namespace/index.js";
1
+ import { defineComponent as B, computed as C, getCurrentInstance as Q, useSlots as W, ref as X, createVNode as b, mergeProps as J } from "vue";
2
+ import { VftMenu as Y, VftSubMenu as Z, VftMenuItem as m } from "../menu/index.js";
3
+ import { useNamespace as _ } from "../../hooks/use-namespace/index.js";
4
4
  import "@popperjs/core";
5
5
  import "lodash";
6
6
  import "../../hooks/use-z-index/index.js";
7
7
  import "@vueuse/core";
8
- import { isUrl as Z } from "@vft/utils";
8
+ import { isUrl as ee } from "@vft/utils";
9
9
  import "../../utils/ns-cover.js";
10
- import { useRouterHelper as m } from "@vft/router";
11
- import { MenuTypeEnum as _ } from "./constants.js";
10
+ import { useRouterHelper as ne } from "@vft/router";
11
+ import { MenuTypeEnum as oe } from "./constants.js";
12
12
  const y = (
13
13
  /* hoist-static*/
14
- Y("horizontal-menu")
15
- ), ee = B({
14
+ _("horizontal-menu")
15
+ ), te = B({
16
16
  name: y.b()
17
- }), fe = /* @__PURE__ */ B({
18
- ...ee,
17
+ }), ve = /* @__PURE__ */ B({
18
+ ...te,
19
19
  props: {
20
20
  menus: {},
21
21
  attrMapping: {},
@@ -43,13 +43,13 @@ const y = (
43
43
  },
44
44
  emits: ["open", "close", "select"],
45
45
  setup(t, {
46
- expose: L,
47
- emit: x
46
+ expose: z,
47
+ emit: w
48
48
  }) {
49
- const z = C(() => (e, u) => {
50
- var a, s, r, n;
49
+ const D = C(() => (e, u, a) => {
50
+ var c, r, n, p;
51
51
  return {
52
- "grid-template-rows": `repeat(${Math.min(((s = (a = e == null ? void 0 : e[u]) == null ? void 0 : a[o.value.children]) == null ? void 0 : s.length) || 0, Number(t.maxRowLength ? t.maxRowLength : (n = (r = e == null ? void 0 : e[u]) == null ? void 0 : r[o.value.children]) == null ? void 0 : n.length))}, auto)`
52
+ "grid-template-rows": `repeat(${Math.min(((r = (c = e == null ? void 0 : e[u]) == null ? void 0 : c[o.value.children]) == null ? void 0 : r.length) || 0, Number(a || t.maxRowLength ? a || t.maxRowLength : (p = (n = e == null ? void 0 : e[u]) == null ? void 0 : n[o.value.children]) == null ? void 0 : p.length))}, auto)`
53
53
  };
54
54
  }), o = C(() => ({
55
55
  path: "path",
@@ -59,113 +59,113 @@ const y = (
59
59
  icon: "icon",
60
60
  disabled: "disabled",
61
61
  ...t.attrMapping
62
- })), D = F(), p = G(), S = K(), k = D.appContext.config.globalProperties.$router, T = (e, u, a) => {
63
- const s = e[o.value.path], r = e[o.value.title], n = e == null ? void 0 : e[o.value.index], b = e == null ? void 0 : e[o.value.icon], f = !!(e != null && e[o.value.disabled]), c = t.disabledJudgeTurnOver ? !f : f, i = n || s || u + r;
64
- return v(X, J(e, {
65
- key: i,
66
- index: String(i),
67
- icon: b,
68
- route: s,
62
+ })), P = Q(), f = W(), R = X(), S = P.appContext.config.globalProperties.$router, T = (e, u, a) => {
63
+ const c = e[o.value.path], r = e[o.value.title], n = e == null ? void 0 : e[o.value.index], p = e == null ? void 0 : e[o.value.icon], h = !!(e != null && e[o.value.disabled]), d = t.disabledJudgeTurnOver ? !h : h, x = n || c || u + r;
64
+ return b(m, J(e, {
65
+ key: x,
66
+ index: String(x),
67
+ icon: p,
68
+ route: c,
69
69
  title: r,
70
- disabled: t.openDisabled && c,
70
+ disabled: t.openDisabled && d,
71
71
  className: a ? "vft-menu-popup-item" : "vft-menu-no-popup-item"
72
72
  }), {
73
- default: a ? p.menuItem ? () => {
73
+ default: a ? f.menuItem ? () => {
74
74
  var g;
75
- return (g = p.menuItem) == null ? void 0 : g.call(p, {
75
+ return (g = f.menuItem) == null ? void 0 : g.call(f, {
76
76
  item: e
77
77
  });
78
- } : null : p.menuTopItem ? () => {
78
+ } : null : f.menuTopItem ? () => {
79
79
  var g;
80
- return (g = p.menuTopItem) == null ? void 0 : g.call(p, {
80
+ return (g = f.menuTopItem) == null ? void 0 : g.call(f, {
81
81
  item: e
82
82
  });
83
83
  } : null
84
84
  });
85
- }, P = () => {
86
- x("open");
87
85
  }, E = () => {
88
- x("close");
89
- }, I = (e, u, a) => {
90
- var N;
91
- const s = e[o.value.path], r = e[o.value.title], n = e == null ? void 0 : e[o.value.children], b = e == null ? void 0 : e[o.value.index], f = e == null ? void 0 : e[o.value.icon], c = e == null ? void 0 : e.menuOrder, i = !!(e != null && e[o.value.disabled]), g = t.disabledJudgeTurnOver ? !i : i, R = b || s || u + r, O = e.type === _.TILE;
92
- let w = [];
86
+ w("open");
87
+ }, $ = () => {
88
+ w("close");
89
+ }, k = (e, u, a) => {
90
+ var L;
91
+ const c = e[o.value.path], r = e[o.value.title], n = e == null ? void 0 : e[o.value.children], p = e == null ? void 0 : e[o.value.index], h = e == null ? void 0 : e[o.value.icon], d = e == null ? void 0 : e.menuOrder, x = e == null ? void 0 : e.maxRowLength, g = !!(e != null && e[o.value.disabled]), U = t.disabledJudgeTurnOver ? !g : g, I = p || c || u + r, O = e.type === oe.TILE;
92
+ let i = [];
93
93
  if (O)
94
- if (c) {
95
- const l = c.flat();
94
+ if (d) {
95
+ const l = d.flat();
96
96
  if ((l == null ? void 0 : l.length) < n.length) {
97
97
  const M = Math.max.apply(null, l);
98
- for (let d = M + 1; d < n.length; d++)
99
- c.push([d]);
98
+ for (let s = M + 1; s < n.length; s++)
99
+ d.push([s]);
100
100
  }
101
- w = c;
101
+ i = d;
102
102
  } else
103
103
  for (let l = 0; l < n.length; l++)
104
- w.push([l]);
105
- return n != null && n.length || e != null && e.render ? v(W, J(t.subMenuCfg, e, {
106
- index: String(R),
107
- key: R,
108
- icon: f,
104
+ i.push([l]);
105
+ return n != null && n.length || e != null && e.render ? b(Z, J(t.subMenuCfg, e, {
106
+ index: String(I),
107
+ key: I,
108
+ icon: h,
109
109
  showArrow: e.showArrow ?? t.subMenuCfg.showArrow,
110
- disabled: t.openDisabled && g,
110
+ disabled: t.openDisabled && U,
111
111
  toolTipCfg: {
112
112
  ...t.subMenuCfg.toolTipCfg || {},
113
- ...((N = e.subMenuCfg) == null ? void 0 : N.toolTipCfg) || {}
113
+ ...((L = e.subMenuCfg) == null ? void 0 : L.toolTipCfg) || {}
114
114
  },
115
115
  teleported: !1,
116
116
  "popper-class": [O ? y.e("tile") : "", y.e("normal")]
117
117
  }), {
118
- default: () => [e != null && e.render ? e == null ? void 0 : e.render : O ? w.map((l, M) => v("div", {
118
+ default: () => [e != null && e.render ? e == null ? void 0 : e.render : O ? i.map((l, M) => b("div", {
119
119
  class: "content-main",
120
120
  key: M
121
- }, [l.map((d, H) => {
122
- var V, A;
123
- const h = (V = n == null ? void 0 : n[d]) == null ? void 0 : V[o.value.children];
124
- return n != null && n.length ? v("div", {
121
+ }, [l.map((s, q) => {
122
+ var N, V, A;
123
+ const v = (N = n == null ? void 0 : n[s]) == null ? void 0 : N[o.value.children], F = (V = n == null ? void 0 : n[s]) == null ? void 0 : V.maxRowLength;
124
+ return n != null && n.length ? b("div", {
125
125
  class: "content-col",
126
- key: H
127
- }, [v("span", {
128
- class: h != null && h.length ? "title" : ""
129
- }, [(A = n == null ? void 0 : n[d]) == null ? void 0 : A[o.value.title]]), h != null && h.length ? v("div", {
126
+ key: q
127
+ }, [b("span", {
128
+ class: v != null && v.length ? "title" : ""
129
+ }, [(A = n == null ? void 0 : n[s]) == null ? void 0 : A[o.value.title]]), v != null && v.length ? b("div", {
130
130
  class: "content",
131
- style: z.value(n, d)
132
- }, [h.map((U, q) => T(U, q, !0))]) : null]) : null;
131
+ style: D.value(n, s, F || x)
132
+ }, [v.map((G, K) => T(G, K, !0))]) : null]) : null;
133
133
  })])) : n.map((l, M) => {
134
- var d;
135
- return (d = l[o.value.children]) != null && d.length ? I(l, M, !0) : T(l, M, !0);
134
+ var s;
135
+ return (s = l[o.value.children]) != null && s.length ? k(l, M, !0) : T(l, M, !0);
136
136
  })],
137
137
  title: () => r
138
138
  }) : T(e, u, a);
139
139
  };
140
- async function $(e) {
141
- var u, a, s;
140
+ async function j(e) {
141
+ var u, a, c;
142
142
  if (t.useRouterJump) {
143
143
  const {
144
144
  go: r
145
- } = m(k), n = e.route;
146
- let b = e.route;
147
- e.indexPath.some((c) => Z(c)) && (b = e.indexPath.slice(-2).join("/"));
148
- const f = (s = (a = (u = k.getRoutes().filter((c) => c.path === b)) == null ? void 0 : u[0]) == null ? void 0 : a.meta) == null ? void 0 : s.linkTarget;
149
- r(f ? {
145
+ } = ne(S), n = e.route;
146
+ let p = e.route;
147
+ e.indexPath.some((d) => ee(d)) && (p = e.indexPath.slice(-2).join("/"));
148
+ const h = (c = (a = (u = S.getRoutes().filter((d) => d.path === p)) == null ? void 0 : u[0]) == null ? void 0 : a.meta) == null ? void 0 : c.linkTarget;
149
+ r(h ? {
150
150
  url: n,
151
151
  winOpenOpt: {
152
- target: f
152
+ target: h
153
153
  }
154
154
  } : n);
155
155
  }
156
- x("select", e);
156
+ w("select", e);
157
157
  }
158
- const j = C(() => {
158
+ const H = C(() => {
159
159
  var e;
160
- return (e = S.value) == null ? void 0 : e.inSubMenu;
160
+ return (e = R.value) == null ? void 0 : e.inSubMenu;
161
161
  });
162
- return L({
163
- isInSubMenu: j
164
- }), () => v(Q, {
165
- ref: S,
166
- onSelect: $,
167
- onOpen: P,
168
- onClose: E,
162
+ return z({
163
+ isInSubMenu: H
164
+ }), () => b(Y, {
165
+ ref: R,
166
+ onSelect: j,
167
+ onOpen: E,
168
+ onClose: $,
169
169
  mode: "horizontal",
170
170
  class: y.b(),
171
171
  defaultActive: t.defaultActive,
@@ -173,11 +173,11 @@ const y = (
173
173
  }, {
174
174
  default: () => {
175
175
  var e;
176
- return [(e = t.menus) != null && e.length ? t.menus.map((u, a) => I(u, a, !1)) : null];
176
+ return [(e = t.menus) != null && e.length ? t.menus.map((u, a) => k(u, a, !1)) : null];
177
177
  }
178
178
  });
179
179
  }
180
180
  });
181
181
  export {
182
- fe as default
182
+ ve as default
183
183
  };