vft 0.0.108 → 0.0.109

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