geekin-devtoys 0.3.9 → 0.3.11
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.
- package/lib/GButton/index.js +1 -1
- package/lib/GButton/index.mjs +1 -1
- package/lib/GButton/style.css +1 -1
- package/lib/GInputTreeTag/index.js +1 -1
- package/lib/GInputTreeTag/index.mjs +133 -136
- package/lib/GInputTreeTag/style.css +1 -1
- package/lib/GPluginVideo/index.js +1 -1
- package/lib/GPluginVideo/index.mjs +149 -2072
- package/lib/GPluginVideo/web-control.esm.min.js +2 -0
- package/lib/GTag/index.js +1 -1
- package/lib/GTag/index.mjs +4 -4
- package/lib/GTree/index.js +1 -0
- package/lib/GTree/index.mjs +295 -0
- package/lib/GTree/style.css +1 -0
- package/lib/GTree.d.ts +1 -0
- package/lib/assets/GTag.css +1 -1
- package/lib/components/GButton/index.d.ts +1 -1
- package/lib/components/GInputTreeTag/index.d.ts +322 -2006
- package/lib/components/GTag/index.d.ts +1 -1
- package/lib/components/GTree/index.d.ts +83 -0
- package/lib/components/GTree/types.d.ts +53 -0
- package/lib/index/index.js +1 -1
- package/lib/index/index.mjs +9 -6
- package/lib/index/style.css +4 -2
- package/lib/index.d.ts +2 -1
- package/package.json +9 -1
package/lib/GButton/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("motion-v"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("motion-v"),k=require("../GBubble-Dph0YDkU.js"),B=["type","disabled"],h={key:0,class:"g-button__loading"},_={key:1,class:"g-button__icon"},f={key:2,class:"g-button__text"},v=e.defineComponent({name:"GButton",__name:"index",props:{type:{},size:{},loading:{type:Boolean},disabled:{type:Boolean},block:{type:Boolean},nativeType:{}},emits:["click"],setup(i,{emit:d}){const s=i,u=d,p=t=>{if(!(s.disabled||s.loading)){if(s.type!=="link"&&!b.value){const o=t.currentTarget.getBoundingClientRect(),c=t.clientX!==0||t.clientY!==0,g={id:++m,x:c?t.clientX-o.left:o.width/2,y:c?t.clientY-o.top:o.height/2,size:Math.hypot(o.width,o.height)*2};l.value.push(g)}u("click",t)}},l=e.ref([]);let m=0;const y=t=>{l.value=l.value.filter(a=>a.id!==t)},b=r.useReducedMotion();return(t,a)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["g-button",["g-button--"+t.type,"g-button--"+t.size,{"is-block":t.block,"is-loading":t.loading,"is-disabled":t.disabled}]]),type:t.nativeType,disabled:t.disabled||t.loading,onClick:p},[t.loading?(e.openBlock(),e.createElementBlock("span",h)):e.createCommentVNode("",!0),t.$slots.icon?(e.openBlock(),e.createElementBlock("span",_,[e.renderSlot(t.$slots,"icon",{},void 0,!0)])):e.createCommentVNode("",!0),t.$slots.default?(e.openBlock(),e.createElementBlock("span",f,[e.renderSlot(t.$slots,"default",{},void 0,!0)])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,o=>(e.openBlock(),e.createBlock(e.unref(r.motion).span,{key:o.id,class:"g-button__wave",initial:{x:"-50%",y:"-50%",scale:0,opacity:.2},animate:{x:"-50%",y:"-50%",scale:1,opacity:0},transition:{duration:.6,ease:"easeOut"},style:e.normalizeStyle({left:o.x+"px",top:o.y+"px",width:o.size+"px",height:o.size+"px"}),onAnimationComplete:c=>y(o.id)},null,8,["style","onAnimationComplete"]))),128))],10,B))}}),n=k._export_sfc(v,[["__scopeId","data-v-054c5b31"]]);n.install=i=>{i.component(n.name,n)};exports.GButton=n;exports.default=n;
|
package/lib/GButton/index.mjs
CHANGED
|
@@ -74,7 +74,7 @@ const G = ["type", "disabled"], I = {
|
|
|
74
74
|
}, null, 8, ["style", "onAnimationComplete"]))), 128))
|
|
75
75
|
], 10, G));
|
|
76
76
|
}
|
|
77
|
-
}), r = /* @__PURE__ */ A(X, [["__scopeId", "data-v-
|
|
77
|
+
}), r = /* @__PURE__ */ A(X, [["__scopeId", "data-v-054c5b31"]]);
|
|
78
78
|
r.install = (s) => {
|
|
79
79
|
s.component(r.name, r);
|
|
80
80
|
};
|
package/lib/GButton/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.g-button[data-v-
|
|
1
|
+
@charset "UTF-8";.g-button[data-v-054c5b31]{--g-button-wave-color: currentcolor;position:relative;display:inline-flex;align-items:center;justify-content:center;gap:6px;height:32px;padding:0 15px;font-size:var(--g-button-font-size, 14px);line-height:1;white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none;overflow:hidden;color:var(--g-text-color, rgba(0, 0, 0, .88));background:var(--g-button-bg-color, var(--g-button-default-color, #e8e8eb));border:none;border-radius:var(--g-button-radius, 6px);outline:none;transition:all .2s cubic-bezier(.645,.045,.355,1)}.g-button[data-v-054c5b31]:not(.is-disabled):hover,.g-button[data-v-054c5b31]:not(.is-disabled):focus-visible{border-color:var(--g-primary-color, #039be5);color:var(--g-primary-color, #039be5)}.g-button[data-v-054c5b31]:not(.is-disabled):active{border-color:color-mix(in srgb,var(--g-primary-color, #039be5) 70%,#000);color:color-mix(in srgb,var(--g-primary-color, #039be5) 70%,#000)}.g-button.is-block[data-v-054c5b31]{display:flex;width:100%}.g-button.is-disabled[data-v-054c5b31]{cursor:not-allowed;opacity:.5}.g-button--large[data-v-054c5b31]{height:40px;padding:0 20px;font-size:16px;border-radius:calc(var(--g-button-radius, 6px) + 2px)}.g-button--small[data-v-054c5b31]{height:24px;padding:0 7px;font-size:12px;border-radius:calc(var(--g-button-radius, 6px) - 2px)}.g-button--primary[data-v-054c5b31]{--g-button-wave-color: #fff;color:#fff;background:var(--g-primary-color, #039be5);border-color:var(--g-primary-color, #039be5)}.g-button--primary[data-v-054c5b31]:not(.is-disabled):hover,.g-button--primary[data-v-054c5b31]:not(.is-disabled):focus-visible{color:#fff;background:color-mix(in srgb,var(--g-primary-color, #039be5) 85%,#fff)}.g-button--primary[data-v-054c5b31]:not(.is-disabled):active{color:#fff;background:color-mix(in srgb,var(--g-primary-color, #039be5) 70%,#000)}.g-button--success[data-v-054c5b31],.g-button--warning[data-v-054c5b31],.g-button--danger[data-v-054c5b31]{--g-button-wave-color: #fff;color:#fff}.g-button--success[data-v-054c5b31]:not(.is-disabled):hover,.g-button--success[data-v-054c5b31]:not(.is-disabled):focus-visible,.g-button--warning[data-v-054c5b31]:not(.is-disabled):hover,.g-button--warning[data-v-054c5b31]:not(.is-disabled):focus-visible,.g-button--danger[data-v-054c5b31]:not(.is-disabled):hover,.g-button--danger[data-v-054c5b31]:not(.is-disabled):focus-visible{color:#fff;background:color-mix(in srgb,var(--g-button-type-color) 85%,#fff)}.g-button--success[data-v-054c5b31]:not(.is-disabled):active,.g-button--warning[data-v-054c5b31]:not(.is-disabled):active,.g-button--danger[data-v-054c5b31]:not(.is-disabled):active{color:#fff;background:color-mix(in srgb,var(--g-button-type-color) 70%,#000)}.g-button--success[data-v-054c5b31]{--g-button-type-color: var(--g-success-color, #50c189);background:var(--g-button-type-color);border-color:var(--g-button-type-color)}.g-button--warning[data-v-054c5b31]{--g-button-type-color: var(--g-warning-color, #f78716);background:var(--g-button-type-color);border-color:var(--g-button-type-color)}.g-button--danger[data-v-054c5b31]{--g-button-type-color: var(--g-danger-color, #e1594d);background:var(--g-button-type-color);border-color:var(--g-button-type-color)}.g-button--emphasis[data-v-054c5b31]{--g-button-wave-color: var(--g-emphasis-text-color, #fff);color:var(--g-emphasis-text-color, #fff);background:var(--g-emphasis-color, #000)}.g-button--emphasis[data-v-054c5b31]:not(.is-disabled):hover,.g-button--emphasis[data-v-054c5b31]:not(.is-disabled):focus-visible{color:var(--g-emphasis-text-color, #fff);background:color-mix(in srgb,var(--g-emphasis-color, #000) 85%,var(--g-emphasis-text-color, #fff))}.g-button--emphasis[data-v-054c5b31]:not(.is-disabled):active{color:var(--g-emphasis-text-color, #fff);background:color-mix(in srgb,var(--g-emphasis-color, #000) 70%,var(--g-emphasis-text-color, #fff))}.g-button--link[data-v-054c5b31]{height:auto;padding:2px 5px;background:transparent;border-color:transparent}.g-button--link[data-v-054c5b31]:not(.is-disabled):hover,.g-button--link[data-v-054c5b31]:not(.is-disabled):focus-visible{color:color-mix(in srgb,var(--g-primary-color, #039be5) 85%,#fff);background:transparent}.g-button__loading[data-v-054c5b31]{width:1em;height:1em;border:2px solid currentcolor;border-top-color:transparent;border-radius:50%;animation:g-button-spin-054c5b31 .6s linear infinite}.g-button__icon[data-v-054c5b31]{display:inline-flex;align-items:center}.g-button__icon[data-v-054c5b31] svg{width:1em;height:1em;display:block}.g-button__wave[data-v-054c5b31]{position:absolute;border-radius:50%;background:var(--g-button-wave-color);opacity:.2;pointer-events:none}@keyframes g-button-spin-054c5b31{to{transform:rotate(360deg)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),ve=require("../GInput/index.js"),me=require("../GTag/index.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),ve=require("../GInput/index.js"),me=require("../GTag/index.js"),ge=require("../GTree/index.js"),O=require("element-plus"),E=require("motion-v"),be=require("../GBubble-Dph0YDkU.js"),he={key:0,class:"g-input-tree-tag__tags"},ye=t.defineComponent({__name:"index",props:{modelValue:{default:()=>[]},data:{default:()=>[]},props:{default:()=>({})},echoProps:{},nodeKey:{default:"id"},placeholder:{default:"请输入关键字搜索"},width:{default:320},popperMaxHeight:{default:320},popperZIndex:{default:2e3},popperOffset:{default:4},defaultExpandAll:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},closable:{type:Boolean,default:!0},tagType:{default:"primary"},tagVariant:{default:"filled"},clearInputAfterSelect:{type:Boolean,default:!0},enterToAdd:{type:Boolean,default:!0},valueFormat:{default:"value"},selectable:{},filterMethod:{},duplicateMessage:{default:"该项已添加"},notFoundMessage:{default:"未找到匹配项"}},emits:["update:modelValue","change","add","remove","node-click","duplicate","not-found"],setup(x,{expose:R,emit:$}){const a=x,r=$,H=t.computed(()=>({label:a.props.label||"label",children:a.props.children||"children",disabled:a.props.disabled})),q=t.computed(()=>a.props.value||a.nodeKey||"id"),G=t.computed(()=>a.props.label||"label"),j=t.computed(()=>a.props.children||"children"),S=t.computed(()=>a.props.isLeaf),K=t.computed(()=>a.echoProps?.value||"value"),U=t.computed(()=>a.echoProps?.label||"label"),v=e=>e?e[q.value]:void 0,c=e=>e?e[G.value]:"",F=e=>e?e[j.value]:void 0,Z=e=>e?.[K.value]??e?.value,W=e=>e?.[U.value]??e?.label,d=e=>{if(!e)return!1;if(typeof a.selectable=="function")return a.selectable(e);if(S.value&&e[S.value]!==void 0)return!!e[S.value];const l=F(e);return!l||!l.length},C=t.computed(()=>{const e=new Map,l=(o=[])=>{o.forEach(n=>{d(n)&&e.set(v(n),n);const s=F(n);s?.length&&l(s)})};return l(a.data||[]),e}),u=t.computed(()=>(a.modelValue||[]).map(l=>{const o=a.valueFormat==="object"?Z(l):l,n=C.value.get(o),s=a.valueFormat==="object"?W(l):void 0;return{value:o,label:n?c(n):s??String(o??""),raw:n??(a.valueFormat==="object"?l:void 0)}})),y=e=>u.value.some(l=>l.value===e),w=t.ref(""),i=t.ref(!1),T=t.ref(null),I=t.ref(null),N=t.ref(null),p=t.ref(null),J=e=>{if(!e){p.value=null;return}p.value=e.$el??(e instanceof HTMLElement?e:null)},L=t.ref({}),m=t.ref("bottom"),Q=t.computed(()=>({opacity:0,scale:.95,y:m.value==="bottom"?-8:8})),X={opacity:1,scale:1,y:0},Y=t.computed(()=>({opacity:0,scale:.95,y:m.value==="bottom"?-8:8})),D={duration:.2,ease:"easeOut"},ee=t.computed(()=>({...L.value,transformOrigin:m.value==="bottom"?"top center":"bottom center"})),te={opacity:0,scale:.8},le={opacity:1,scale:1},oe={opacity:0,scale:.8},ae={duration:.2,ease:"easeOut"},ne=t.computed(()=>typeof a.width=="number"?`${a.width}px`:a.width),M=()=>{a.disabled||(i.value=!0)},k=()=>{if(!i.value)return;const e=N.value,l=p.value;if(!e||!l)return;const o=e.getBoundingClientRect(),n=l.offsetHeight||a.popperMaxHeight,B=window.innerHeight-o.bottom-a.popperOffset,pe=o.top-a.popperOffset,z=B>=n||B>=pe?"bottom":"top";m.value=z;const fe=z==="bottom"?o.bottom+a.popperOffset:o.top-n-a.popperOffset;L.value={position:"fixed",top:`${fe}px`,left:`${o.left}px`,width:`${o.width}px`,zIndex:String(a.popperZIndex)}};let f=null;const g=()=>{i.value&&(f&&cancelAnimationFrame(f),f=requestAnimationFrame(()=>{f=null,k()}))};let b=null;const re=()=>{typeof ResizeObserver>"u"||!p.value||(b?.disconnect(),b=new ResizeObserver(()=>g()),b.observe(p.value))},P=()=>{b?.disconnect(),b=null};t.watch(i,async e=>{if(!e){P();return}await t.nextTick(),k(),requestAnimationFrame(k),re()});const A=e=>{if(!i.value)return;const l=e.target;I.value?.contains(l)||p.value?.contains(l)||(i.value=!1)};t.onMounted(()=>{document.addEventListener("mousedown",A,!0),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g)}),t.onBeforeUnmount(()=>{document.removeEventListener("mousedown",A,!0),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),f&&cancelAnimationFrame(f),P()});const se=e=>{i.value=!0,T.value?.filter(e),t.nextTick(k)},ue=(e,l)=>e?typeof a.filterMethod=="function"?a.filterMethod(e,l):String(c(l)??"").toLowerCase().includes(String(e).toLowerCase()):!0,ie=e=>{r("node-click",e),d(e)&&(_(e),i.value=!1)},ce=e=>a.valueFormat==="object"?{value:e.value,label:e.label,raw:e.raw}:e.value,_=e=>{const l=v(e);if(l==null||l==="")return;if(y(l)){const s={value:l,label:c(e),raw:e};r("duplicate",s),a.duplicateMessage&&O.ElMessage.warning(a.duplicateMessage);return}const o={value:l,label:c(e),raw:e},n=[...a.modelValue||[],ce(o)];r("update:modelValue",n),r("add",o),r("change",n,[...u.value,o]),a.clearInputAfterSelect&&(w.value="")},de=()=>{if(!a.enterToAdd)return;const e=(w.value||"").trim();if(!e)return;let l=null;for(const o of C.value.values())if(c(o)===e){l=o;break}if(!l){r("not-found",e),a.notFoundMessage&&O.ElMessage.warning(a.notFoundMessage);return}_(l)},V=e=>{if(e<0||e>=u.value.length)return;const l=u.value[e],o=[...a.modelValue||[]];o.splice(e,1),r("update:modelValue",o),l&&r("remove",l,e);const n=u.value.filter((s,B)=>B!==e);r("change",o,n)};return R({open:M,close:()=>i.value=!1,clear:()=>{r("update:modelValue",[]),r("change",[],[])},addByValue:e=>{const l=C.value.get(e);l&&_(l)},removeByIndex:e=>{V(e)},removeByValue:e=>{const l=u.value.findIndex(o=>o.value===e);l>-1&&V(l)},getSelectedItems:()=>u.value}),(e,l)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["g-input-tree-tag",{"is-disabled":e.disabled}])},[t.createElementVNode("div",{class:"g-input-tree-tag__wrap",ref_key:"wrapRef",ref:I},[t.createElementVNode("div",{class:"g-input-tree-tag__input-box",ref_key:"inputBoxRef",ref:N,style:t.normalizeStyle({width:ne.value})},[t.createVNode(t.unref(ve.default),{modelValue:w.value,"onUpdate:modelValue":l[0]||(l[0]=o=>w.value=o),placeholder:e.placeholder,clearable:e.clearable,disabled:e.disabled,block:"",class:"g-input-tree-tag__input",onFocus:M,onClick:M,onInput:se,onKeyup:t.withKeys(de,["enter"])},null,8,["modelValue","placeholder","clearable","disabled"])],4),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.unref(E.AnimatePresence),null,{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createBlock(t.unref(E.motion).div,{key:0,ref:J,class:t.normalizeClass(["g-input-tree-tag__popover",`is-${m.value}`]),style:t.normalizeStyle(ee.value),initial:Q.value,animate:X,exit:Y.value,transition:D,onMousedown:l[1]||(l[1]=t.withModifiers(()=>{},["prevent"]))},{default:t.withCtx(()=>[t.createElementVNode("div",{class:"g-input-tree-tag__tree-wrap",style:t.normalizeStyle({maxHeight:e.popperMaxHeight+"px"})},[t.createVNode(t.unref(ge.default),{ref_key:"treeRef",ref:T,data:e.data,props:H.value,"node-key":e.nodeKey,"filter-method":ue,"default-expand-all":e.defaultExpandAll,"highlight-current":!1,onNodeClick:ie},{default:t.withCtx(({data:o,level:n,expanded:s})=>[t.renderSlot(e.$slots,"tree-node",{data:o,node:{level:n,expanded:s},selectable:d(o),selected:y(v(o))},()=>[o?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(["g-input-tree-tag__node",{"is-selectable":d(o),"is-selected":d(o)&&y(v(o))}])},[t.renderSlot(e.$slots,"leaf-icon",{data:o,selectable:d(o),selected:y(v(o))},void 0,!0),t.createTextVNode(" "+t.toDisplayString(c(o)),1)],2)):t.createCommentVNode("",!0)],!0)]),_:3},8,["data","props","node-key","default-expand-all"])],4)]),_:3},8,["class","style","initial","exit"])):t.createCommentVNode("",!0)]),_:3})])),u.value.length?(t.openBlock(),t.createElementBlock("div",he,[t.renderSlot(e.$slots,"tags",{items:u.value,remove:V},()=>[t.createVNode(t.unref(E.AnimatePresence),{mode:"popLayout"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,(o,n)=>(t.openBlock(),t.createBlock(t.unref(E.motion).div,{key:o.value,layout:!0,class:"g-input-tree-tag__tag-motion",initial:te,animate:le,exit:oe,transition:ae},{default:t.withCtx(()=>[t.createVNode(t.unref(me.default),{class:"g-input-tree-tag__tag",type:e.tagType,variant:e.tagVariant,closable:e.closable&&!e.disabled,onClose:s=>V(n)},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"tag",{item:o,index:n},()=>[t.createTextVNode(t.toDisplayString(o.label),1)],!0)]),_:2},1032,["type","variant","closable","onClose"])]),_:2},1024))),128))]),_:3})],!0)])):t.createCommentVNode("",!0)],512)],2))}}),h=be._export_sfc(ye,[["__scopeId","data-v-4e5882e3"]]);h.install=x=>{x.component(h.name,h)};exports.GInputTreeTag=h;exports.default=h;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { defineComponent as Le, computed as n, ref as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { defineComponent as Le, computed as n, ref as p, watch as Se, nextTick as J, onMounted as Te, onBeforeUnmount as Ae, createElementBlock as M, openBlock as d, normalizeClass as P, createElementVNode as O, createBlock as R, createCommentVNode as N, normalizeStyle as $, createVNode as V, unref as c, withKeys as Ce, Teleport as Pe, withCtx as b, withModifiers as Oe, renderSlot as B, createTextVNode as Q, toDisplayString as X, Fragment as Re, renderList as Ne } from "vue";
|
|
2
|
+
import $e from "../GInput/index.mjs";
|
|
3
|
+
import ze from "../GTag/index.mjs";
|
|
4
|
+
import He from "../GTree/index.mjs";
|
|
5
|
+
import { ElMessage as Y } from "element-plus";
|
|
6
|
+
import { AnimatePresence as D, motion as ee } from "motion-v";
|
|
7
|
+
import { _ as Ke } from "../GBubble-C3cM9Put.mjs";
|
|
8
|
+
const je = {
|
|
8
9
|
key: 0,
|
|
9
10
|
class: "g-input-tree-tag__tags"
|
|
10
|
-
},
|
|
11
|
+
}, Ge = /* @__PURE__ */ Le({
|
|
11
12
|
__name: "index",
|
|
12
13
|
props: {
|
|
13
14
|
modelValue: { default: () => [] },
|
|
@@ -35,40 +36,40 @@ const Ge = {
|
|
|
35
36
|
notFoundMessage: { default: "未找到匹配项" }
|
|
36
37
|
},
|
|
37
38
|
emits: ["update:modelValue", "change", "add", "remove", "node-click", "duplicate", "not-found"],
|
|
38
|
-
setup(L, { expose: te, emit:
|
|
39
|
-
const
|
|
40
|
-
label:
|
|
41
|
-
children:
|
|
42
|
-
disabled:
|
|
43
|
-
})), oe = n(() =>
|
|
39
|
+
setup(L, { expose: te, emit: le }) {
|
|
40
|
+
const a = L, r = le, ae = n(() => ({
|
|
41
|
+
label: a.props.label || "label",
|
|
42
|
+
children: a.props.children || "children",
|
|
43
|
+
disabled: a.props.disabled
|
|
44
|
+
})), oe = n(() => a.props.value || a.nodeKey || "id"), ne = n(() => a.props.label || "label"), re = n(() => a.props.children || "children"), S = n(() => a.props.isLeaf), se = n(() => a.echoProps?.value || "value"), ie = n(() => a.echoProps?.label || "label"), h = (e) => e ? e[oe.value] : void 0, f = (e) => e ? e[ne.value] : "", H = (e) => e ? e[re.value] : void 0, ue = (e) => e?.[se.value] ?? e?.value, pe = (e) => e?.[ie.value] ?? e?.label, v = (e) => {
|
|
44
45
|
if (!e) return !1;
|
|
45
|
-
if (typeof
|
|
46
|
+
if (typeof a.selectable == "function") return a.selectable(e);
|
|
46
47
|
if (S.value && e[S.value] !== void 0) return !!e[S.value];
|
|
47
|
-
const t =
|
|
48
|
+
const t = H(e);
|
|
48
49
|
return !t || !t.length;
|
|
49
50
|
}, T = n(() => {
|
|
50
|
-
const e = /* @__PURE__ */ new Map(), t = (
|
|
51
|
-
|
|
51
|
+
const e = /* @__PURE__ */ new Map(), t = (l = []) => {
|
|
52
|
+
l.forEach((o) => {
|
|
52
53
|
v(o) && e.set(h(o), o);
|
|
53
|
-
const
|
|
54
|
-
|
|
54
|
+
const s = H(o);
|
|
55
|
+
s?.length && t(s);
|
|
55
56
|
});
|
|
56
57
|
};
|
|
57
|
-
return t(
|
|
58
|
-
}), i = n(() => (
|
|
59
|
-
const
|
|
58
|
+
return t(a.data || []), e;
|
|
59
|
+
}), i = n(() => (a.modelValue || []).map((t) => {
|
|
60
|
+
const l = a.valueFormat === "object" ? ue(t) : t, o = T.value.get(l), s = a.valueFormat === "object" ? pe(t) : void 0;
|
|
60
61
|
return {
|
|
61
|
-
value:
|
|
62
|
-
label: o ? f(o) :
|
|
63
|
-
raw: o ?? (
|
|
62
|
+
value: l,
|
|
63
|
+
label: o ? f(o) : s ?? String(l ?? ""),
|
|
64
|
+
raw: o ?? (a.valueFormat === "object" ? t : void 0)
|
|
64
65
|
};
|
|
65
|
-
})),
|
|
66
|
+
})), E = (e) => i.value.some((t) => t.value === e), F = p(""), u = p(!1), K = p(null), j = p(null), G = p(null), m = p(null), de = (e) => {
|
|
66
67
|
if (!e) {
|
|
67
68
|
m.value = null;
|
|
68
69
|
return;
|
|
69
70
|
}
|
|
70
71
|
m.value = e.$el ?? (e instanceof HTMLElement ? e : null);
|
|
71
|
-
},
|
|
72
|
+
}, U = p({}), y = p("bottom"), ce = n(() => ({
|
|
72
73
|
opacity: 0,
|
|
73
74
|
scale: 0.95,
|
|
74
75
|
y: y.value === "bottom" ? -8 : 8
|
|
@@ -77,101 +78,97 @@ const Ge = {
|
|
|
77
78
|
scale: 0.95,
|
|
78
79
|
y: y.value === "bottom" ? -8 : 8
|
|
79
80
|
})), me = { duration: 0.2, ease: "easeOut" }, ge = n(() => ({
|
|
80
|
-
...
|
|
81
|
+
...U.value,
|
|
81
82
|
transformOrigin: y.value === "bottom" ? "top center" : "bottom center"
|
|
82
83
|
})), be = { opacity: 0, scale: 0.8 }, he = { opacity: 1, scale: 1 }, ye = { opacity: 0, scale: 0.8 }, we = { duration: 0.2, ease: "easeOut" }, ke = n(
|
|
83
|
-
() => typeof
|
|
84
|
+
() => typeof a.width == "number" ? `${a.width}px` : a.width
|
|
84
85
|
), A = () => {
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
if (!
|
|
88
|
-
const e =
|
|
86
|
+
a.disabled || (u.value = !0);
|
|
87
|
+
}, _ = () => {
|
|
88
|
+
if (!u.value) return;
|
|
89
|
+
const e = G.value, t = m.value;
|
|
89
90
|
if (!e || !t) return;
|
|
90
|
-
const
|
|
91
|
-
y.value =
|
|
92
|
-
const Be =
|
|
93
|
-
|
|
91
|
+
const l = e.getBoundingClientRect(), o = t.offsetHeight || a.popperMaxHeight, I = window.innerHeight - l.bottom - a.popperOffset, Me = l.top - a.popperOffset, W = I >= o || I >= Me ? "bottom" : "top";
|
|
92
|
+
y.value = W;
|
|
93
|
+
const Be = W === "bottom" ? l.bottom + a.popperOffset : l.top - o - a.popperOffset;
|
|
94
|
+
U.value = {
|
|
94
95
|
position: "fixed",
|
|
95
96
|
top: `${Be}px`,
|
|
96
|
-
left: `${
|
|
97
|
-
width: `${
|
|
98
|
-
zIndex: String(
|
|
97
|
+
left: `${l.left}px`,
|
|
98
|
+
width: `${l.width}px`,
|
|
99
|
+
zIndex: String(a.popperZIndex)
|
|
99
100
|
};
|
|
100
101
|
};
|
|
101
102
|
let g = null;
|
|
102
103
|
const w = () => {
|
|
103
|
-
|
|
104
|
-
g = null,
|
|
104
|
+
u.value && (g && cancelAnimationFrame(g), g = requestAnimationFrame(() => {
|
|
105
|
+
g = null, _();
|
|
105
106
|
}));
|
|
106
107
|
};
|
|
107
108
|
let k = null;
|
|
108
109
|
const Ve = () => {
|
|
109
110
|
typeof ResizeObserver > "u" || !m.value || (k?.disconnect(), k = new ResizeObserver(() => w()), k.observe(m.value));
|
|
110
|
-
},
|
|
111
|
+
}, q = () => {
|
|
111
112
|
k?.disconnect(), k = null;
|
|
112
113
|
};
|
|
113
|
-
Se(
|
|
114
|
+
Se(u, async (e) => {
|
|
114
115
|
if (!e) {
|
|
115
|
-
|
|
116
|
+
q();
|
|
116
117
|
return;
|
|
117
118
|
}
|
|
118
|
-
await
|
|
119
|
+
await J(), _(), requestAnimationFrame(_), Ve();
|
|
119
120
|
});
|
|
120
121
|
const Z = (e) => {
|
|
121
|
-
if (!
|
|
122
|
+
if (!u.value) return;
|
|
122
123
|
const t = e.target;
|
|
123
|
-
|
|
124
|
+
j.value?.contains(t) || m.value?.contains(t) || (u.value = !1);
|
|
124
125
|
};
|
|
125
126
|
Te(() => {
|
|
126
127
|
document.addEventListener("mousedown", Z, !0), window.addEventListener("scroll", w, !0), window.addEventListener("resize", w);
|
|
127
128
|
}), Ae(() => {
|
|
128
|
-
document.removeEventListener("mousedown", Z, !0), window.removeEventListener("scroll", w, !0), window.removeEventListener("resize", w), g && cancelAnimationFrame(g),
|
|
129
|
+
document.removeEventListener("mousedown", Z, !0), window.removeEventListener("scroll", w, !0), window.removeEventListener("resize", w), g && cancelAnimationFrame(g), q();
|
|
129
130
|
});
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
C(e), s.value = !1;
|
|
138
|
-
}, _e = (e) => l.valueFormat === "object" ? { value: e.value, label: e.label, raw: e.raw } : e.value, C = (e) => {
|
|
131
|
+
const Ee = (e) => {
|
|
132
|
+
u.value = !0, K.value?.filter(e), J(_);
|
|
133
|
+
}, Fe = (e, t) => e ? typeof a.filterMethod == "function" ? a.filterMethod(e, t) : String(f(t) ?? "").toLowerCase().includes(String(e).toLowerCase()) : !0, _e = (e) => {
|
|
134
|
+
r("node-click", e), v(e) && (C(e), u.value = !1);
|
|
135
|
+
}, xe = (e) => a.valueFormat === "object" ? { value: e.value, label: e.label, raw: e.raw } : e.value, C = (e) => {
|
|
139
136
|
const t = h(e);
|
|
140
137
|
if (t == null || t === "") return;
|
|
141
|
-
if (
|
|
142
|
-
const
|
|
143
|
-
r("duplicate",
|
|
138
|
+
if (E(t)) {
|
|
139
|
+
const s = { value: t, label: f(e), raw: e };
|
|
140
|
+
r("duplicate", s), a.duplicateMessage && Y.warning(a.duplicateMessage);
|
|
144
141
|
return;
|
|
145
142
|
}
|
|
146
|
-
const
|
|
147
|
-
r("update:modelValue", o), r("add",
|
|
143
|
+
const l = { value: t, label: f(e), raw: e }, o = [...a.modelValue || [], xe(l)];
|
|
144
|
+
r("update:modelValue", o), r("add", l), r("change", o, [...i.value, l]), a.clearInputAfterSelect && (F.value = "");
|
|
148
145
|
}, Ie = () => {
|
|
149
|
-
if (!
|
|
150
|
-
const e = (
|
|
146
|
+
if (!a.enterToAdd) return;
|
|
147
|
+
const e = (F.value || "").trim();
|
|
151
148
|
if (!e) return;
|
|
152
149
|
let t = null;
|
|
153
|
-
for (const
|
|
154
|
-
if (f(
|
|
155
|
-
t =
|
|
150
|
+
for (const l of T.value.values())
|
|
151
|
+
if (f(l) === e) {
|
|
152
|
+
t = l;
|
|
156
153
|
break;
|
|
157
154
|
}
|
|
158
155
|
if (!t) {
|
|
159
|
-
r("not-found", e),
|
|
156
|
+
r("not-found", e), a.notFoundMessage && Y.warning(a.notFoundMessage);
|
|
160
157
|
return;
|
|
161
158
|
}
|
|
162
159
|
C(t);
|
|
163
|
-
},
|
|
160
|
+
}, x = (e) => {
|
|
164
161
|
if (e < 0 || e >= i.value.length) return;
|
|
165
|
-
const t = i.value[e],
|
|
166
|
-
|
|
167
|
-
const o = i.value.filter((
|
|
168
|
-
r("change",
|
|
162
|
+
const t = i.value[e], l = [...a.modelValue || []];
|
|
163
|
+
l.splice(e, 1), r("update:modelValue", l), t && r("remove", t, e);
|
|
164
|
+
const o = i.value.filter((s, I) => I !== e);
|
|
165
|
+
r("change", l, o);
|
|
169
166
|
};
|
|
170
167
|
return te({
|
|
171
168
|
/** 主动打开下拉面板 */
|
|
172
169
|
open: A,
|
|
173
170
|
/** 主动关闭下拉面板 */
|
|
174
|
-
close: () =>
|
|
171
|
+
close: () => u.value = !1,
|
|
175
172
|
/** 清空已选 */
|
|
176
173
|
clear: () => {
|
|
177
174
|
r("update:modelValue", []), r("change", [], []);
|
|
@@ -183,32 +180,32 @@ const Ge = {
|
|
|
183
180
|
},
|
|
184
181
|
/** 根据索引移除,触发与关闭 tag 一致的事件 */
|
|
185
182
|
removeByIndex: (e) => {
|
|
186
|
-
|
|
183
|
+
x(e);
|
|
187
184
|
},
|
|
188
185
|
/** 根据 value 移除,触发与关闭 tag 一致的事件 */
|
|
189
186
|
removeByValue: (e) => {
|
|
190
|
-
const t = i.value.findIndex((
|
|
191
|
-
t > -1 &&
|
|
187
|
+
const t = i.value.findIndex((l) => l.value === e);
|
|
188
|
+
t > -1 && x(t);
|
|
192
189
|
},
|
|
193
190
|
/** 获取当前归一化后的已选项 */
|
|
194
191
|
getSelectedItems: () => i.value
|
|
195
|
-
}), (e, t) => (
|
|
196
|
-
class:
|
|
192
|
+
}), (e, t) => (d(), M("div", {
|
|
193
|
+
class: P(["g-input-tree-tag", { "is-disabled": e.disabled }])
|
|
197
194
|
}, [
|
|
198
|
-
|
|
195
|
+
O("div", {
|
|
199
196
|
class: "g-input-tree-tag__wrap",
|
|
200
197
|
ref_key: "wrapRef",
|
|
201
|
-
ref:
|
|
198
|
+
ref: j
|
|
202
199
|
}, [
|
|
203
|
-
|
|
200
|
+
O("div", {
|
|
204
201
|
class: "g-input-tree-tag__input-box",
|
|
205
202
|
ref_key: "inputBoxRef",
|
|
206
|
-
ref:
|
|
207
|
-
style:
|
|
203
|
+
ref: G,
|
|
204
|
+
style: $({ width: ke.value })
|
|
208
205
|
}, [
|
|
209
|
-
V(
|
|
210
|
-
modelValue:
|
|
211
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
206
|
+
V(c($e), {
|
|
207
|
+
modelValue: F.value,
|
|
208
|
+
"onUpdate:modelValue": t[0] || (t[0] = (l) => F.value = l),
|
|
212
209
|
placeholder: e.placeholder,
|
|
213
210
|
clearable: e.clearable,
|
|
214
211
|
disabled: e.disabled,
|
|
@@ -216,65 +213,65 @@ const Ge = {
|
|
|
216
213
|
class: "g-input-tree-tag__input",
|
|
217
214
|
onFocus: A,
|
|
218
215
|
onClick: A,
|
|
219
|
-
onInput:
|
|
216
|
+
onInput: Ee,
|
|
220
217
|
onKeyup: Ce(Ie, ["enter"])
|
|
221
218
|
}, null, 8, ["modelValue", "placeholder", "clearable", "disabled"])
|
|
222
219
|
], 4),
|
|
223
|
-
(
|
|
224
|
-
V(
|
|
220
|
+
(d(), R(Pe, { to: "body" }, [
|
|
221
|
+
V(c(D), null, {
|
|
225
222
|
default: b(() => [
|
|
226
|
-
|
|
223
|
+
u.value ? (d(), R(c(ee).div, {
|
|
227
224
|
key: 0,
|
|
228
|
-
ref:
|
|
229
|
-
class:
|
|
230
|
-
style:
|
|
231
|
-
initial:
|
|
225
|
+
ref: de,
|
|
226
|
+
class: P(["g-input-tree-tag__popover", `is-${y.value}`]),
|
|
227
|
+
style: $(ge.value),
|
|
228
|
+
initial: ce.value,
|
|
232
229
|
animate: fe,
|
|
233
230
|
exit: ve.value,
|
|
234
231
|
transition: me,
|
|
235
|
-
onMousedown: t[1] || (t[1] =
|
|
232
|
+
onMousedown: t[1] || (t[1] = Oe(() => {
|
|
236
233
|
}, ["prevent"]))
|
|
237
234
|
}, {
|
|
238
235
|
default: b(() => [
|
|
239
|
-
|
|
236
|
+
O("div", {
|
|
240
237
|
class: "g-input-tree-tag__tree-wrap",
|
|
241
|
-
style:
|
|
238
|
+
style: $({ maxHeight: e.popperMaxHeight + "px" })
|
|
242
239
|
}, [
|
|
243
|
-
V(
|
|
240
|
+
V(c(He), {
|
|
244
241
|
ref_key: "treeRef",
|
|
245
|
-
ref:
|
|
242
|
+
ref: K,
|
|
246
243
|
data: e.data,
|
|
247
|
-
props:
|
|
244
|
+
props: ae.value,
|
|
248
245
|
"node-key": e.nodeKey,
|
|
249
|
-
"filter-
|
|
250
|
-
"expand-on-click-node": !1,
|
|
246
|
+
"filter-method": Fe,
|
|
251
247
|
"default-expand-all": e.defaultExpandAll,
|
|
252
|
-
|
|
248
|
+
"highlight-current": !1,
|
|
249
|
+
onNodeClick: _e
|
|
253
250
|
}, {
|
|
254
|
-
default: b((
|
|
251
|
+
default: b(({ data: l, level: o, expanded: s }) => [
|
|
255
252
|
B(e.$slots, "tree-node", {
|
|
256
|
-
data:
|
|
257
|
-
node:
|
|
258
|
-
selectable: v(
|
|
259
|
-
selected:
|
|
253
|
+
data: l,
|
|
254
|
+
node: { level: o, expanded: s },
|
|
255
|
+
selectable: v(l),
|
|
256
|
+
selected: E(h(l))
|
|
260
257
|
}, () => [
|
|
261
|
-
|
|
258
|
+
l ? (d(), M("span", {
|
|
262
259
|
key: 0,
|
|
263
|
-
class:
|
|
260
|
+
class: P([
|
|
264
261
|
"g-input-tree-tag__node",
|
|
265
262
|
{
|
|
266
|
-
"is-selectable": v(
|
|
267
|
-
"is-selected": v(
|
|
263
|
+
"is-selectable": v(l),
|
|
264
|
+
"is-selected": v(l) && E(h(l))
|
|
268
265
|
}
|
|
269
266
|
])
|
|
270
267
|
}, [
|
|
271
268
|
B(e.$slots, "leaf-icon", {
|
|
272
|
-
data:
|
|
273
|
-
selectable: v(
|
|
274
|
-
selected:
|
|
269
|
+
data: l,
|
|
270
|
+
selectable: v(l),
|
|
271
|
+
selected: E(h(l))
|
|
275
272
|
}, void 0, !0),
|
|
276
|
-
|
|
277
|
-
], 2)) :
|
|
273
|
+
Q(" " + X(f(l)), 1)
|
|
274
|
+
], 2)) : N("", !0)
|
|
278
275
|
], !0)
|
|
279
276
|
]),
|
|
280
277
|
_: 3
|
|
@@ -282,20 +279,20 @@ const Ge = {
|
|
|
282
279
|
], 4)
|
|
283
280
|
]),
|
|
284
281
|
_: 3
|
|
285
|
-
}, 8, ["class", "style", "initial", "exit"])) :
|
|
282
|
+
}, 8, ["class", "style", "initial", "exit"])) : N("", !0)
|
|
286
283
|
]),
|
|
287
284
|
_: 3
|
|
288
285
|
})
|
|
289
286
|
])),
|
|
290
|
-
i.value.length ? (
|
|
287
|
+
i.value.length ? (d(), M("div", je, [
|
|
291
288
|
B(e.$slots, "tags", {
|
|
292
289
|
items: i.value,
|
|
293
|
-
remove:
|
|
290
|
+
remove: x
|
|
294
291
|
}, () => [
|
|
295
|
-
V(
|
|
292
|
+
V(c(D), { mode: "popLayout" }, {
|
|
296
293
|
default: b(() => [
|
|
297
|
-
(
|
|
298
|
-
key:
|
|
294
|
+
(d(!0), M(Re, null, Ne(i.value, (l, o) => (d(), R(c(ee).div, {
|
|
295
|
+
key: l.value,
|
|
299
296
|
layout: !0,
|
|
300
297
|
class: "g-input-tree-tag__tag-motion",
|
|
301
298
|
initial: be,
|
|
@@ -304,19 +301,19 @@ const Ge = {
|
|
|
304
301
|
transition: we
|
|
305
302
|
}, {
|
|
306
303
|
default: b(() => [
|
|
307
|
-
V(
|
|
304
|
+
V(c(ze), {
|
|
308
305
|
class: "g-input-tree-tag__tag",
|
|
309
306
|
type: e.tagType,
|
|
310
307
|
variant: e.tagVariant,
|
|
311
308
|
closable: e.closable && !e.disabled,
|
|
312
|
-
onClose: (
|
|
309
|
+
onClose: (s) => x(o)
|
|
313
310
|
}, {
|
|
314
311
|
default: b(() => [
|
|
315
312
|
B(e.$slots, "tag", {
|
|
316
|
-
item:
|
|
313
|
+
item: l,
|
|
317
314
|
index: o
|
|
318
315
|
}, () => [
|
|
319
|
-
|
|
316
|
+
Q(X(l.label), 1)
|
|
320
317
|
], !0)
|
|
321
318
|
]),
|
|
322
319
|
_: 2
|
|
@@ -328,15 +325,15 @@ const Ge = {
|
|
|
328
325
|
_: 3
|
|
329
326
|
})
|
|
330
327
|
], !0)
|
|
331
|
-
])) :
|
|
328
|
+
])) : N("", !0)
|
|
332
329
|
], 512)
|
|
333
330
|
], 2));
|
|
334
331
|
}
|
|
335
|
-
}),
|
|
336
|
-
|
|
337
|
-
L.component(
|
|
332
|
+
}), z = /* @__PURE__ */ Ke(Ge, [["__scopeId", "data-v-4e5882e3"]]);
|
|
333
|
+
z.install = (L) => {
|
|
334
|
+
L.component(z.name, z);
|
|
338
335
|
};
|
|
339
336
|
export {
|
|
340
|
-
|
|
341
|
-
|
|
337
|
+
z as GInputTreeTag,
|
|
338
|
+
z as default
|
|
342
339
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.g-input-tree-tag[data-v-
|
|
1
|
+
@charset "UTF-8";.g-input-tree-tag[data-v-4e5882e3]{width:100%}.g-input-tree-tag__wrap[data-v-4e5882e3]{display:flex;flex-direction:column;align-items:flex-start;gap:8px;width:100%}.g-input-tree-tag__tags[data-v-4e5882e3]{display:flex;flex-wrap:wrap;gap:8px;width:100%}.g-input-tree-tag__tag-motion[data-v-4e5882e3]{display:inline-flex}.g-input-tree-tag__tag[data-v-4e5882e3]{margin:0}.g-input-tree-tag.is-disabled[data-v-4e5882e3]{cursor:not-allowed}.g-input-tree-tag__popover{box-sizing:border-box;background:var(--el-bg-color-overlay, #fff);border:1px solid var(--el-border-color-light);border-radius:4px;box-shadow:var(--el-box-shadow-light);padding:8px 0}.g-input-tree-tag__popover .g-input-tree-tag__tree-wrap{overflow:auto}.g-input-tree-tag__popover .g-input-tree-tag__node{display:inline-flex;align-items:center;gap:4px;font-size:13px}.g-input-tree-tag__popover .g-input-tree-tag__node.is-selectable{cursor:pointer;color:var(--el-text-color-primary)}.g-input-tree-tag__popover .g-input-tree-tag__node.is-selected{color:var(--el-color-primary)}
|