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
|
|
2
|
-
import { VftMenu as
|
|
3
|
-
import { useNamespace as
|
|
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
|
|
8
|
+
import { isUrl as Z } from "@vft/utils";
|
|
9
9
|
import "../../utils/ns-cover.js";
|
|
10
|
-
import { useRouterHelper as
|
|
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
|
-
|
|
15
|
-
), ee =
|
|
14
|
+
Y("horizontal-menu")
|
|
15
|
+
), ee = B({
|
|
16
16
|
name: y.b()
|
|
17
|
-
}), fe = /* @__PURE__ */
|
|
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(
|
|
46
|
-
expose:
|
|
45
|
+
setup(t, {
|
|
46
|
+
expose: L,
|
|
47
47
|
emit: x
|
|
48
48
|
}) {
|
|
49
|
-
const
|
|
50
|
-
var a,
|
|
49
|
+
const z = C(() => (e, u) => {
|
|
50
|
+
var a, s, r, n;
|
|
51
51
|
return {
|
|
52
|
-
"grid-template-rows": `repeat(${Math.min(((
|
|
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
|
-
}),
|
|
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
|
-
...
|
|
62
|
-
})),
|
|
63
|
-
|
|
64
|
-
|
|
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:
|
|
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
|
-
},
|
|
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
|
|
93
|
-
let
|
|
94
|
-
if (
|
|
95
|
-
if (
|
|
96
|
-
const
|
|
97
|
-
if ((
|
|
98
|
-
const M = Math.max.apply(null,
|
|
99
|
-
for (let
|
|
100
|
-
|
|
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
|
-
|
|
101
|
+
w = c;
|
|
103
102
|
} else
|
|
104
|
-
for (let
|
|
105
|
-
|
|
106
|
-
return n != null && n.length || e != null && e.render ? v(
|
|
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 ??
|
|
111
|
-
disabled:
|
|
109
|
+
showArrow: e.showArrow ?? t.subMenuCfg.showArrow,
|
|
110
|
+
disabled: t.openDisabled && g,
|
|
112
111
|
toolTipCfg: {
|
|
113
|
-
...
|
|
112
|
+
...t.subMenuCfg.toolTipCfg || {},
|
|
114
113
|
...((N = e.subMenuCfg) == null ? void 0 : N.toolTipCfg) || {}
|
|
115
114
|
},
|
|
116
115
|
teleported: !1,
|
|
117
|
-
"popper-class": [
|
|
116
|
+
"popper-class": [O ? y.e("tile") : "", y.e("normal")]
|
|
118
117
|
}), {
|
|
119
|
-
default: () => [e != null && e.render ? e == null ? void 0 : e.render :
|
|
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
|
-
}, [
|
|
121
|
+
}, [l.map((d, H) => {
|
|
123
122
|
var V, A;
|
|
124
|
-
const h = (V = n == null ? void 0 : n[
|
|
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:
|
|
126
|
+
key: H
|
|
128
127
|
}, [v("span", {
|
|
129
128
|
class: h != null && h.length ? "title" : ""
|
|
130
|
-
}, [(A = n == null ? void 0 : n[
|
|
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:
|
|
133
|
-
}, [h.map((
|
|
134
|
-
})])) : n.map((
|
|
135
|
-
var
|
|
136
|
-
return (
|
|
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
|
-
}) :
|
|
138
|
+
}) : T(e, u, a);
|
|
140
139
|
};
|
|
141
|
-
async function
|
|
142
|
-
var u, a,
|
|
143
|
-
if (
|
|
140
|
+
async function $(e) {
|
|
141
|
+
var u, a, s;
|
|
142
|
+
if (t.useRouterJump) {
|
|
144
143
|
const {
|
|
145
144
|
go: r
|
|
146
|
-
} =
|
|
145
|
+
} = m(k), n = e.route;
|
|
147
146
|
let b = e.route;
|
|
148
|
-
e.indexPath.some((
|
|
149
|
-
const f = (
|
|
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
|
|
158
|
+
const j = C(() => {
|
|
160
159
|
var e;
|
|
161
|
-
return (e =
|
|
160
|
+
return (e = S.value) == null ? void 0 : e.inSubMenu;
|
|
162
161
|
});
|
|
163
|
-
return
|
|
164
|
-
isInSubMenu:
|
|
165
|
-
}), () => v(
|
|
166
|
-
ref:
|
|
167
|
-
onSelect:
|
|
168
|
-
onOpen:
|
|
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:
|
|
173
|
-
defaultOpeneds:
|
|
171
|
+
defaultActive: t.defaultActive,
|
|
172
|
+
defaultOpeneds: t.defaultOpeneds
|
|
174
173
|
}, {
|
|
175
174
|
default: () => {
|
|
176
175
|
var e;
|
|
177
|
-
return [(e =
|
|
176
|
+
return [(e = t.menus) != null && e.length ? t.menus.map((u, a) => I(u, a, !1)) : null];
|
|
178
177
|
}
|
|
179
178
|
});
|
|
180
179
|
}
|
package/es/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("vue"),
|
|
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;
|
package/lib/package.json.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.
|
|
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.
|
|
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/
|
|
56
|
+
"@vft/constants": "0.0.57",
|
|
57
57
|
"@vft/router": "0.0.26",
|
|
58
|
-
"@vft/
|
|
58
|
+
"@vft/store": "0.0.26",
|
|
59
59
|
"@vft/utils": "0.0.41",
|
|
60
60
|
"@vft/directives": "0.0.22",
|
|
61
|
-
"@vft/
|
|
61
|
+
"@vft/use": "0.0.29"
|
|
62
62
|
},
|
|
63
63
|
"vetur": {
|
|
64
64
|
"tags": "tags.json",
|