vft 0.0.77 → 0.0.78

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