geekin-devtoys 0.3.8 → 0.3.10
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/GBubble/index.js +1 -2
- package/lib/GBubble/index.mjs +3 -210
- package/lib/GBubble-C3cM9Put.mjs +216 -0
- package/lib/GBubble-Dph0YDkU.js +2 -0
- package/lib/GButton/index.js +1 -1
- package/lib/GButton/index.mjs +81 -5
- package/lib/GButton/style.css +1 -0
- package/lib/GCard/index.js +1 -1
- package/lib/GCard/index.mjs +1 -1
- package/lib/GDialog/index.js +1 -1
- package/lib/GDialog/index.mjs +33 -34
- package/lib/GInput/index.js +1 -0
- package/lib/GInput/index.mjs +145 -0
- package/lib/GInput/style.css +1 -0
- package/lib/GInput.d.ts +1 -0
- package/lib/GInputTreeTag/index.js +1 -1
- package/lib/GInputTreeTag/index.mjs +77 -75
- package/lib/GInputTreeTag/style.css +1 -1
- package/lib/GPie3D/index.js +1 -1
- package/lib/GPie3D/index.mjs +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/GProgress/index.js +1 -1
- package/lib/GProgress/index.mjs +1 -1
- package/lib/GRing/index.js +1 -1
- package/lib/GRing/index.mjs +1 -1
- package/lib/GScroller/index.js +1 -1
- package/lib/GScroller/index.mjs +135 -152
- package/lib/GShinyText/index.js +1 -1
- package/lib/GShinyText/index.mjs +45 -119
- package/lib/GSteps/index.js +1 -1
- package/lib/GSteps/index.mjs +89 -43
- package/lib/GSteps/style.css +1 -1
- package/lib/GTable/index.js +1 -1
- package/lib/GTable/index.mjs +1 -1
- package/lib/GTag/index.js +1 -0
- package/lib/GTag/index.mjs +73 -0
- package/lib/GTag.d.ts +1 -0
- package/lib/GVideo/index.js +2 -2
- package/lib/GVideo/index.mjs +1 -1
- package/lib/assets/GTag.css +1 -0
- package/lib/components/GButton/index.d.ts +1 -1
- package/lib/components/GInput/index.d.ts +64 -0
- package/lib/components/GInputTreeTag/index.d.ts +27 -27
- package/lib/components/GTag/index.d.ts +41 -0
- package/lib/index/index.js +1 -1
- package/lib/index/index.mjs +38 -33
- package/lib/index/style.css +25 -1
- package/lib/index.d.ts +3 -1
- package/package.json +12 -20
- package/lib/AnimatePresence-26Wy0TGN.js +0 -9
- package/lib/AnimatePresence-nl0c23TZ.mjs +0 -136
- package/lib/_plugin-vue_export-helper-BHFhmbuH.js +0 -1
- package/lib/_plugin-vue_export-helper-CHgC5LLL.mjs +0 -9
- package/lib/index-B8Ap0044.js +0 -1
- package/lib/index-Bbr5fWvI.mjs +0 -5158
- package/lib/index-CWxEZ_zc.mjs +0 -74
- package/lib/index-Q0Ej8RIj.js +0 -1
package/lib/GDialog/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),Q=require("../AnimatePresence-26Wy0TGN.js"),ee=require("../index-B8Ap0044.js"),R=require("../_plugin-vue_export-helper-BHFhmbuH.js"),B=require("../index-Q0Ej8RIj.js"),L=Symbol("GDialogManager"),I={small:"380px",medium:"480px",large:"580px"},E={ICON_WIDTH:92,ICON_HEIGHT:34,GAP:8,BOTTOM_OFFSET:18,RIGHT_OFFSET:18,MAX_PER_ROW:8};function te(s){const f=new Map,{ICON_WIDTH:l,ICON_HEIGHT:r,GAP:p,BOTTOM_OFFSET:a,RIGHT_OFFSET:o,MAX_PER_ROW:c}=E;return s.forEach((d,u)=>{const i=Math.floor(u/c),n=u%c;f.set(d,{right:o+n*(l+p),bottom:a+i*(r+p)})}),f}function oe(){const s=e.reactive(new Map),f=e.computed(()=>{const i=[];return s.forEach(n=>{n.isMinimized&&i.push(n.id)}),i}),l=e.computed(()=>te(f.value));function r(i){s.set(i.id,{attentionTick:0,...i})}function p(i){s.delete(i)}function a(i){const n=s.get(i);if(n){if(n.isMinimized){n.attentionTick=(n.attentionTick??0)+1;return}n.isMinimized=!0}}function o(i){const n=s.get(i);n?.isMinimized&&(n.attentionTick=(n.attentionTick??0)+1)}function c(i){const n=s.get(i);n&&(n.isMinimized=!1)}function d(i){return e.computed(()=>l.value.get(i)??{right:E.RIGHT_OFFSET,bottom:E.BOTTOM_OFFSET})}const u=e.computed(()=>f.value.map(i=>s.get(i)).filter(Boolean));return{dialogs:s,register:r,unregister:p,minimize:a,remindMinimized:o,restore:c,getPosition:d,minimizedList:u}}function F(){return e.inject(L,null)}const b={viewBox:"0 0 1024 1024",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em"},H=()=>e.h("svg",b,[e.h("path",{d:"M874.666667 512a362.666667 362.666667 0 1 0-362.666667 362.666667V938.666667C276.352 938.666667 85.333333 747.648 85.333333 512S276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667-191.018667 426.666667-426.666667 426.666667v-64a362.666667 362.666667 0 0 0 362.666667-362.666667z"}),e.h("path",{d:"M318.72 318.72a32 32 0 0 1 45.226667 0l341.333333 341.333333a32 32 0 1 1-45.226667 45.226667l-341.333333-341.333333a32 32 0 0 1 0-45.226667z"}),e.h("path",{d:"M705.28 318.72a32 32 0 0 0-45.226667 0l-341.333333 341.333333a32 32 0 1 0 45.226667 45.226667l341.333333-341.333333a32 32 0 0 0 0-45.226667z"})]),P=()=>e.h("svg",b,[e.h("path",{d:"M661.333333 309.333333a266.666667 266.666667 0 1 1 0 533.333334H170.666667a32 32 0 0 1 0-64h490.666666a202.666667 202.666667 0 1 0 0-405.333334H170.666667a32 32 0 0 1 0-64h490.666666z"}),e.h("path",{d:"M98.133333 348.714667a8.533333 8.533333 0 0 1 0-14.762667l166.4-96.085333a8.533333 8.533333 0 0 1 12.8 7.381333v192.170667a8.533333 8.533333 0 0 1-12.8 7.381333L98.133333 348.714667z"})]),$=()=>e.h("svg",b,[e.h("path",{d:"M874.666667 512a362.666667 362.666667 0 1 0-362.666667 362.666667V938.666667C276.352 938.666667 85.333333 747.648 85.333333 512S276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667-191.018667 426.666667-426.666667 426.666667v-64a362.666667 362.666667 0 0 0 362.666667-362.666667z"}),e.h("path",{d:"M685.653333 361.386667a32 32 0 1 1 45.226667 45.226666l-249.472 249.514667a40.533333 40.533333 0 0 1-59.434667-2.304l-122.026666-142.336a32 32 0 0 1 48.64-41.642667l105.472 123.050667L685.653333 361.386667z"})]),q=()=>e.h("svg",b,[e.h("path",{d:"M130.133333 746.666667v-469.333334A138.666667 138.666667 0 0 1 268.8 138.666667h362.666667a32 32 0 0 1 0 64H268.8A74.666667 74.666667 0 0 0 194.133333 277.333333v469.333334c0 41.216 33.450667 74.666667 74.666667 74.666666h362.666667a32 32 0 0 1 0 64H268.8a138.666667 138.666667 0 0 1-138.666667-138.666666z"}),e.h("path",{d:"M635.562667 738.304a32.042667 32.042667 0 0 0 45.312 0l203.605333-203.690667a32 32 0 0 0 0-45.226666l-203.605333-203.690667a32.042667 32.042667 0 0 0-45.312 45.312l149.077333 148.992H477.866667a32 32 0 0 0 0 64h306.773333l-149.077333 148.992a32.042667 32.042667 0 0 0 0 45.312z"})]),ie={class:"g-dialog-pro-minimized-icon__icon","aria-hidden":"true"},ne={class:"g-dialog-pro-minimized-icon__title"},ae=e.defineComponent({name:"GDialogMinimizedIcon",__name:"GDialogMinimizedIcon",props:{title:{},position:{},attentionTick:{default:0}},emits:["restore"],setup(s,{emit:f}){const l=s,r=f,p=e.computed(()=>l.title||"弹窗"),a=e.computed(()=>`恢复 ${p.value}`),o={opacity:0,scale:.8,x:-24,y:12},c={opacity:1,scale:1,x:0,y:0},d={opacity:0,scale:.8,x:-24,y:12},u={duration:.28,ease:[.2,.8,.2,1]},i={scale:1.04,y:-2},n={scale:.98},y=e.computed(()=>({position:"fixed",right:`${l.position.right}px`,bottom:`${l.position.bottom}px`})),v=e.ref(!1);let k;e.watch(()=>l.attentionTick,(M,g)=>{g===void 0||M===g||(v.value=!1,window.clearTimeout(k),window.requestAnimationFrame(()=>{v.value=!0,k=window.setTimeout(()=>{v.value=!1},580)}))}),e.onUnmounted(()=>{window.clearTimeout(k)});function w(){r("restore")}return(M,g)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.unref(ee.motion).div,{class:e.normalizeClass(["g-dialog-pro-minimized-icon",{"is-attention":v.value}]),type:"button",style:e.normalizeStyle(y.value),title:a.value,"aria-label":a.value,initial:o,animate:c,exit:d,transition:u,"while-hover":i,"while-press":n,onClick:w},{default:e.withCtx(()=>[g[0]||(g[0]=e.createElementVNode("span",{class:"g-dialog-pro-minimized-icon__glow","aria-hidden":"true"},null,-1)),g[1]||(g[1]=e.createElementVNode("span",{class:"g-dialog-pro-minimized-icon__wave","aria-hidden":"true"},null,-1)),e.createElementVNode("span",ie,[e.createVNode(e.unref(q))]),e.createElementVNode("span",ne,e.toDisplayString(p.value),1)]),_:1,__:[0,1]},8,["class","style","title","aria-label"])]))}}),V=R._export_sfc(ae,[["__scopeId","data-v-e7d8c859"]]),le={class:"g-dialog-pro-header"},se={class:"g-dialog-pro-title"},re={class:"g-dialog-pro-operation-container","aria-label":"弹窗操作"},ce=["aria-label","title"],de={class:"g-dialog-pro-body"},ue={key:0,class:"g-dialog-pro-footer"},me={class:"g-dialog-pro-actions"},x="关闭",fe=e.defineComponent({name:"GDialog",inheritAttrs:!1,__name:"index",props:{title:{default:""},size:{default:"medium"},modelValue:{type:Boolean},hideFooter:{type:Boolean,default:!1},actions:{},showCancel:{type:Boolean,default:!0},showReset:{type:Boolean,default:!0},showSave:{type:Boolean,default:!0},cancelText:{default:"取消"},resetText:{default:"重置"},saveText:{default:"保存"},saveLoading:{type:Boolean,default:!1},saveDisabled:{type:Boolean,default:!1},beforeClose:{}},emits:["cancel","reset","save","minimize","action","update:modelValue"],setup(s,{emit:f}){const l=s,r=f,p=e.computed(()=>l.modelValue),a=e.useId?e.useId():`g-dialog-pro-${Date.now()}-${Math.random().toString(36).slice(2)}`,o=F(),c=e.ref(!1),d=e.ref(!0),u=e.ref(0),i=e.ref(!1),n=e.ref(!1),y=e.ref(!1),v=e.computed(()=>o?o.dialogs.get(a)?.isMinimized??!1:c.value),k=e.computed(()=>o?o.dialogs.get(a)?.attentionTick??0:u.value),w=e.computed(()=>o?!n.value:d.value),M=e.computed(()=>o?o.getPosition(a).value:{right:20,bottom:20});e.onMounted(()=>{o?.register({id:a,title:l.title,isMinimized:!1}),document.addEventListener("keydown",S)}),e.onUnmounted(()=>{o?.unregister(a),document.removeEventListener("keydown",S)}),e.watch(()=>l.title,t=>{if(o){const h=o.dialogs.get(a);h&&(h.title=t)}}),e.watch(()=>l.modelValue,t=>{if(t===!1){if(i.value)return;o?(o.restore(a),n.value=!1):(d.value=!0,c.value=!1)}t===!0&&(o?.dialogs.get(a)?.isMinimized?o.remindMinimized(a):c.value&&(u.value+=1))});const g=e.computed(()=>Object.prototype.hasOwnProperty.call(I,l.size)?I[l.size]:l.size),W=e.computed(()=>z.value?{}:{width:g.value});async function _(t){if(!l.beforeClose)return!0;try{return await l.beforeClose(t)!==!1}catch{return!1}}async function T(){await _("close")&&r("update:modelValue",!1)}function U(){T()}function S(t){t.key==="Escape"&&(!l.modelValue||!w.value||v.value||(t.stopPropagation(),T()))}async function D(){await _("cancel")&&r("cancel")}function O(){r("reset")}async function A(){await _("save")&&r("save")}const N=e.reactive({});async function Y(t){if(await _("action")&&(r("action",t.key),!!t.onClick))try{const h=t.onClick();h instanceof Promise&&(N[t.key]=!0,await h)}finally{N[t.key]=!1}}const z=e.ref(!1),Z=()=>{z.value=!z.value},G=e.computed(()=>z.value?"退出全屏":"全屏"),j=async()=>{if(!await _("minimize"))return;if(o?o.dialogs.get(a)?.isMinimized??!1:c.value){o?o.minimize(a):u.value+=1,r("minimize",{id:a});return}i.value=!0,o?o.minimize(a):c.value=!0,r("update:modelValue",!1),r("minimize",{id:a})},K=()=>{y.value=!0,i.value=!1,o?(n.value=!1,o.restore(a)):(d.value=!0,c.value=!1),r("update:modelValue",!0)},X=()=>{i.value&&(o?n.value=!0:d.value=!1,i.value=!1)},J=()=>{y.value=!1};return(t,h)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"g-dialog-pro-fade",onAfterEnter:J,onAfterLeave:X},{default:e.withCtx(()=>[w.value&&p.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"g-dialog-pro-overlay",onClick:e.withModifiers(U,["self"])},[e.createElementVNode("div",e.mergeProps(t.$attrs,{class:["g-dialog-pro",{"is-fullscreen":z.value,"is-leave-to-minimize":i.value,"is-enter-from-minimize":y.value}],style:W.value,role:"dialog","aria-modal":"true"}),[e.createElementVNode("header",le,[e.createElementVNode("p",se,e.toDisplayString(t.title),1),e.createElementVNode("div",re,[e.createElementVNode("button",{type:"button",class:"g-dialog-pro-control g-dialog-pro-control--minimize","aria-label":"最小化",title:"最小化",onClick:j}),e.createElementVNode("button",{type:"button",class:"g-dialog-pro-control g-dialog-pro-control--fullscreen","aria-label":G.value,title:G.value,onClick:Z},null,8,ce),e.createElementVNode("button",{type:"button",class:"g-dialog-pro-control g-dialog-pro-control--close","aria-label":x,title:x,onClick:T})])]),e.createElementVNode("div",de,[e.renderSlot(t.$slots,"default",{},void 0,!0)]),t.hideFooter?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("footer",ue,[e.renderSlot(t.$slots,"footer",{cancel:D,reset:O,save:A,close:T,loading:t.saveLoading},()=>[e.createElementVNode("div",me,[t.actions&&t.actions.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.actions,m=>(e.openBlock(),e.createBlock(B.GButton,{key:m.key,type:m.type,danger:m.danger,loading:m.loading||N[m.key],disabled:m.disabled,size:"small",onClick:pe=>Y(m)},e.createSlots({default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(m.label),1)]),_:2},[m.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.icon)))]),key:"0"}:void 0]),1032,["type","danger","loading","disabled","onClick"]))),128)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.showCancel?(e.openBlock(),e.createBlock(B.GButton,{key:0,size:"small",onClick:D},{icon:e.withCtx(()=>[e.createVNode(e.unref(H))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.cancelText),1)]),_:1})):e.createCommentVNode("",!0),t.showReset?(e.openBlock(),e.createBlock(B.GButton,{key:1,size:"small",onClick:O},{icon:e.withCtx(()=>[e.createVNode(e.unref(P))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.resetText),1)]),_:1})):e.createCommentVNode("",!0),t.showSave?(e.openBlock(),e.createBlock(B.GButton,{key:2,type:"primary",loading:t.saveLoading,disabled:t.saveDisabled,size:"small",onClick:A},{icon:e.withCtx(()=>[e.createVNode(e.unref($))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.saveText),1)]),_:1},8,["loading","disabled"])):e.createCommentVNode("",!0)],64)),e.renderSlot(t.$slots,"moreOperations",{},void 0,!0)])],!0)]))],16)])):e.createCommentVNode("",!0)]),_:3}),e.createVNode(e.unref(Q.AnimatePresence_default),null,{default:e.withCtx(()=>[v.value?(e.openBlock(),e.createBlock(V,{key:0,title:t.title,position:M.value,"attention-tick":k.value,onRestore:K},null,8,["title","position","attention-tick"])):e.createCommentVNode("",!0)]),_:1})]))}}),C=R._export_sfc(fe,[["__scopeId","data-v-5e0eed3b"]]);C.install=s=>{s.component(C.name,C),s.component(V.name,V)};exports.ChatDotRound=q;exports.CircleCheck=$;exports.DIALOG_MANAGER_KEY=L;exports.DIALOG_SIZES=I;exports.GDialog=C;exports.GDialogMinimizedIcon=V;exports.MINIMIZED_LAYOUT=E;exports.Refresh=P;exports.Remove=H;exports.createDialogManager=oe;exports.default=C;exports.useDialogManager=F;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),x=require("motion-v"),L=require("../GBubble-Dph0YDkU.js"),E=require("../GButton/index.js"),F=Symbol("GDialogManager"),I={small:"380px",medium:"480px",large:"580px"},V={ICON_WIDTH:92,ICON_HEIGHT:34,GAP:8,BOTTOM_OFFSET:18,RIGHT_OFFSET:18,MAX_PER_ROW:8};function ee(s){const f=new Map,{ICON_WIDTH:l,ICON_HEIGHT:r,GAP:p,BOTTOM_OFFSET:n,RIGHT_OFFSET:o,MAX_PER_ROW:c}=V;return s.forEach((d,u)=>{const i=Math.floor(u/c),a=u%c;f.set(d,{right:o+a*(l+p),bottom:n+i*(r+p)})}),f}function te(){const s=e.reactive(new Map),f=e.computed(()=>{const i=[];return s.forEach(a=>{a.isMinimized&&i.push(a.id)}),i}),l=e.computed(()=>ee(f.value));function r(i){s.set(i.id,{attentionTick:0,...i})}function p(i){s.delete(i)}function n(i){const a=s.get(i);if(a){if(a.isMinimized){a.attentionTick=(a.attentionTick??0)+1;return}a.isMinimized=!0}}function o(i){const a=s.get(i);a?.isMinimized&&(a.attentionTick=(a.attentionTick??0)+1)}function c(i){const a=s.get(i);a&&(a.isMinimized=!1)}function d(i){return e.computed(()=>l.value.get(i)??{right:V.RIGHT_OFFSET,bottom:V.BOTTOM_OFFSET})}const u=e.computed(()=>f.value.map(i=>s.get(i)).filter(Boolean));return{dialogs:s,register:r,unregister:p,minimize:n,remindMinimized:o,restore:c,getPosition:d,minimizedList:u}}function H(){return e.inject(F,null)}const B={viewBox:"0 0 1024 1024",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em"},P=()=>e.h("svg",B,[e.h("path",{d:"M874.666667 512a362.666667 362.666667 0 1 0-362.666667 362.666667V938.666667C276.352 938.666667 85.333333 747.648 85.333333 512S276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667-191.018667 426.666667-426.666667 426.666667v-64a362.666667 362.666667 0 0 0 362.666667-362.666667z"}),e.h("path",{d:"M318.72 318.72a32 32 0 0 1 45.226667 0l341.333333 341.333333a32 32 0 1 1-45.226667 45.226667l-341.333333-341.333333a32 32 0 0 1 0-45.226667z"}),e.h("path",{d:"M705.28 318.72a32 32 0 0 0-45.226667 0l-341.333333 341.333333a32 32 0 1 0 45.226667 45.226667l341.333333-341.333333a32 32 0 0 0 0-45.226667z"})]),$=()=>e.h("svg",B,[e.h("path",{d:"M661.333333 309.333333a266.666667 266.666667 0 1 1 0 533.333334H170.666667a32 32 0 0 1 0-64h490.666666a202.666667 202.666667 0 1 0 0-405.333334H170.666667a32 32 0 0 1 0-64h490.666666z"}),e.h("path",{d:"M98.133333 348.714667a8.533333 8.533333 0 0 1 0-14.762667l166.4-96.085333a8.533333 8.533333 0 0 1 12.8 7.381333v192.170667a8.533333 8.533333 0 0 1-12.8 7.381333L98.133333 348.714667z"})]),W=()=>e.h("svg",B,[e.h("path",{d:"M874.666667 512a362.666667 362.666667 0 1 0-362.666667 362.666667V938.666667C276.352 938.666667 85.333333 747.648 85.333333 512S276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667-191.018667 426.666667-426.666667 426.666667v-64a362.666667 362.666667 0 0 0 362.666667-362.666667z"}),e.h("path",{d:"M685.653333 361.386667a32 32 0 1 1 45.226667 45.226666l-249.472 249.514667a40.533333 40.533333 0 0 1-59.434667-2.304l-122.026666-142.336a32 32 0 0 1 48.64-41.642667l105.472 123.050667L685.653333 361.386667z"})]),q=()=>e.h("svg",B,[e.h("path",{d:"M130.133333 746.666667v-469.333334A138.666667 138.666667 0 0 1 268.8 138.666667h362.666667a32 32 0 0 1 0 64H268.8A74.666667 74.666667 0 0 0 194.133333 277.333333v469.333334c0 41.216 33.450667 74.666667 74.666667 74.666666h362.666667a32 32 0 0 1 0 64H268.8a138.666667 138.666667 0 0 1-138.666667-138.666666z"}),e.h("path",{d:"M635.562667 738.304a32.042667 32.042667 0 0 0 45.312 0l203.605333-203.690667a32 32 0 0 0 0-45.226666l-203.605333-203.690667a32.042667 32.042667 0 0 0-45.312 45.312l149.077333 148.992H477.866667a32 32 0 0 0 0 64h306.773333l-149.077333 148.992a32.042667 32.042667 0 0 0 0 45.312z"})]),oe={class:"g-dialog-pro-minimized-icon__icon","aria-hidden":"true"},ie={class:"g-dialog-pro-minimized-icon__title"},ae=e.defineComponent({name:"GDialogMinimizedIcon",__name:"GDialogMinimizedIcon",props:{title:{},position:{},attentionTick:{default:0}},emits:["restore"],setup(s,{emit:f}){const l=s,r=f,p=e.computed(()=>l.title||"弹窗"),n=e.computed(()=>`恢复 ${p.value}`),o={opacity:0,scale:.8,x:-24,y:12},c={opacity:1,scale:1,x:0,y:0},d={opacity:0,scale:.8,x:-24,y:12},u={duration:.28,ease:[.2,.8,.2,1]},i={scale:1.04,y:-2},a={scale:.98},y=e.computed(()=>({position:"fixed",right:`${l.position.right}px`,bottom:`${l.position.bottom}px`})),v=e.ref(!1);let k;e.watch(()=>l.attentionTick,(M,g)=>{g===void 0||M===g||(v.value=!1,window.clearTimeout(k),window.requestAnimationFrame(()=>{v.value=!0,k=window.setTimeout(()=>{v.value=!1},580)}))}),e.onUnmounted(()=>{window.clearTimeout(k)});function w(){r("restore")}return(M,g)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.unref(x.motion).div,{class:e.normalizeClass(["g-dialog-pro-minimized-icon",{"is-attention":v.value}]),type:"button",style:e.normalizeStyle(y.value),title:n.value,"aria-label":n.value,initial:o,animate:c,exit:d,transition:u,"while-hover":i,"while-press":a,onClick:w},{default:e.withCtx(()=>[g[0]||(g[0]=e.createElementVNode("span",{class:"g-dialog-pro-minimized-icon__glow","aria-hidden":"true"},null,-1)),g[1]||(g[1]=e.createElementVNode("span",{class:"g-dialog-pro-minimized-icon__wave","aria-hidden":"true"},null,-1)),e.createElementVNode("span",oe,[e.createVNode(e.unref(q))]),e.createElementVNode("span",ie,e.toDisplayString(p.value),1)]),_:1,__:[0,1]},8,["class","style","title","aria-label"])]))}}),b=L._export_sfc(ae,[["__scopeId","data-v-e7d8c859"]]),ne={class:"g-dialog-pro-header"},le={class:"g-dialog-pro-title"},se={class:"g-dialog-pro-operation-container","aria-label":"弹窗操作"},re=["aria-label","title"],ce={class:"g-dialog-pro-body"},de={key:0,class:"g-dialog-pro-footer"},ue={class:"g-dialog-pro-actions"},R="关闭",me=e.defineComponent({name:"GDialog",inheritAttrs:!1,__name:"index",props:{title:{default:""},size:{default:"medium"},modelValue:{type:Boolean},hideFooter:{type:Boolean,default:!1},actions:{},showCancel:{type:Boolean,default:!0},showReset:{type:Boolean,default:!0},showSave:{type:Boolean,default:!0},cancelText:{default:"取消"},resetText:{default:"重置"},saveText:{default:"保存"},saveLoading:{type:Boolean,default:!1},saveDisabled:{type:Boolean,default:!1},beforeClose:{}},emits:["cancel","reset","save","minimize","action","update:modelValue"],setup(s,{emit:f}){const l=s,r=f,p=e.computed(()=>l.modelValue),n=e.useId?e.useId():`g-dialog-pro-${Date.now()}-${Math.random().toString(36).slice(2)}`,o=H(),c=e.ref(!1),d=e.ref(!0),u=e.ref(0),i=e.ref(!1),a=e.ref(!1),y=e.ref(!1),v=e.computed(()=>o?o.dialogs.get(n)?.isMinimized??!1:c.value),k=e.computed(()=>o?o.dialogs.get(n)?.attentionTick??0:u.value),w=e.computed(()=>o?!a.value:d.value),M=e.computed(()=>o?o.getPosition(n).value:{right:20,bottom:20});e.onMounted(()=>{o?.register({id:n,title:l.title,isMinimized:!1}),document.addEventListener("keydown",S)}),e.onUnmounted(()=>{o?.unregister(n),document.removeEventListener("keydown",S)}),e.watch(()=>l.title,t=>{if(o){const h=o.dialogs.get(n);h&&(h.title=t)}}),e.watch(()=>l.modelValue,t=>{if(t===!1){if(i.value)return;o?(o.restore(n),a.value=!1):(d.value=!0,c.value=!1)}t===!0&&(o?.dialogs.get(n)?.isMinimized?o.remindMinimized(n):c.value&&(u.value+=1))});const g=e.computed(()=>Object.prototype.hasOwnProperty.call(I,l.size)?I[l.size]:l.size),U=e.computed(()=>C.value?{}:{width:g.value});async function z(t){if(!l.beforeClose)return!0;try{return await l.beforeClose(t)!==!1}catch{return!1}}async function T(){await z("close")&&r("update:modelValue",!1)}function Y(){T()}function S(t){t.key==="Escape"&&(!l.modelValue||!w.value||v.value||(t.stopPropagation(),T()))}async function D(){await z("cancel")&&r("cancel")}function O(){r("reset")}async function A(){await z("save")&&r("save")}const N=e.reactive({});async function Z(t){if(await z("action")&&(r("action",t.key),!!t.onClick))try{const h=t.onClick();h instanceof Promise&&(N[t.key]=!0,await h)}finally{N[t.key]=!1}}const C=e.ref(!1),j=()=>{C.value=!C.value},G=e.computed(()=>C.value?"退出全屏":"全屏"),K=async()=>{if(!await z("minimize"))return;if(o?o.dialogs.get(n)?.isMinimized??!1:c.value){o?o.minimize(n):u.value+=1,r("minimize",{id:n});return}i.value=!0,o?o.minimize(n):c.value=!0,r("update:modelValue",!1),r("minimize",{id:n})},X=()=>{y.value=!0,i.value=!1,o?(a.value=!1,o.restore(n)):(d.value=!0,c.value=!1),r("update:modelValue",!0)},J=()=>{i.value&&(o?a.value=!0:d.value=!1,i.value=!1)},Q=()=>{y.value=!1};return(t,h)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"g-dialog-pro-fade",onAfterEnter:Q,onAfterLeave:J},{default:e.withCtx(()=>[w.value&&p.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"g-dialog-pro-overlay",onClick:e.withModifiers(Y,["self"])},[e.createElementVNode("div",e.mergeProps(t.$attrs,{class:["g-dialog-pro",{"is-fullscreen":C.value,"is-leave-to-minimize":i.value,"is-enter-from-minimize":y.value}],style:U.value,role:"dialog","aria-modal":"true"}),[e.createElementVNode("header",ne,[e.createElementVNode("p",le,e.toDisplayString(t.title),1),e.createElementVNode("div",se,[e.createElementVNode("button",{type:"button",class:"g-dialog-pro-control g-dialog-pro-control--minimize","aria-label":"最小化",title:"最小化",onClick:K}),e.createElementVNode("button",{type:"button",class:"g-dialog-pro-control g-dialog-pro-control--fullscreen","aria-label":G.value,title:G.value,onClick:j},null,8,re),e.createElementVNode("button",{type:"button",class:"g-dialog-pro-control g-dialog-pro-control--close","aria-label":R,title:R,onClick:T})])]),e.createElementVNode("div",ce,[e.renderSlot(t.$slots,"default",{},void 0,!0)]),t.hideFooter?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("footer",de,[e.renderSlot(t.$slots,"footer",{cancel:D,reset:O,save:A,close:T,loading:t.saveLoading},()=>[e.createElementVNode("div",ue,[t.actions&&t.actions.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.actions,m=>(e.openBlock(),e.createBlock(E.default,{key:m.key,type:m.type,danger:m.danger,loading:m.loading||N[m.key],disabled:m.disabled,size:"small",onClick:fe=>Z(m)},e.createSlots({default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(m.label),1)]),_:2},[m.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.icon)))]),key:"0"}:void 0]),1032,["type","danger","loading","disabled","onClick"]))),128)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.showCancel?(e.openBlock(),e.createBlock(E.default,{key:0,size:"small",onClick:D},{icon:e.withCtx(()=>[e.createVNode(e.unref(P))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.cancelText),1)]),_:1})):e.createCommentVNode("",!0),t.showReset?(e.openBlock(),e.createBlock(E.default,{key:1,size:"small",onClick:O},{icon:e.withCtx(()=>[e.createVNode(e.unref($))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.resetText),1)]),_:1})):e.createCommentVNode("",!0),t.showSave?(e.openBlock(),e.createBlock(E.default,{key:2,type:"primary",loading:t.saveLoading,disabled:t.saveDisabled,size:"small",onClick:A},{icon:e.withCtx(()=>[e.createVNode(e.unref(W))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.saveText),1)]),_:1},8,["loading","disabled"])):e.createCommentVNode("",!0)],64)),e.renderSlot(t.$slots,"moreOperations",{},void 0,!0)])],!0)]))],16)])):e.createCommentVNode("",!0)]),_:3}),e.createVNode(e.unref(x.AnimatePresence),null,{default:e.withCtx(()=>[v.value?(e.openBlock(),e.createBlock(b,{key:0,title:t.title,position:M.value,"attention-tick":k.value,onRestore:X},null,8,["title","position","attention-tick"])):e.createCommentVNode("",!0)]),_:1})]))}}),_=L._export_sfc(me,[["__scopeId","data-v-5e0eed3b"]]);_.install=s=>{s.component(_.name,_),s.component(b.name,b)};exports.ChatDotRound=q;exports.CircleCheck=W;exports.DIALOG_MANAGER_KEY=F;exports.DIALOG_SIZES=I;exports.GDialog=_;exports.GDialogMinimizedIcon=b;exports.MINIMIZED_LAYOUT=V;exports.Refresh=$;exports.Remove=P;exports.createDialogManager=te;exports.default=_;exports.useDialogManager=H;
|
package/lib/GDialog/index.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { inject as fe, reactive as ee, computed as r, h as u, defineComponent as te, ref as _, watch as N, onUnmounted as ie, createBlock as k, openBlock as m, Teleport as oe, createVNode as w, unref as O, normalizeStyle as ge, normalizeClass as pe, withCtx as f, createElementVNode as d, toDisplayString as b, useId as Z, onMounted as ve, Transition as he, createElementBlock as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { G as L } from "../index-CWxEZ_zc.mjs";
|
|
1
|
+
import { inject as fe, reactive as ee, computed as r, h as u, defineComponent as te, ref as _, watch as N, onUnmounted as ie, createBlock as k, openBlock as m, Teleport as oe, createVNode as w, unref as O, normalizeStyle as ge, normalizeClass as pe, withCtx as f, createElementVNode as d, toDisplayString as b, useId as Z, onMounted as ve, Transition as he, createElementBlock as G, createCommentVNode as C, withModifiers as ye, mergeProps as ze, renderSlot as P, Fragment as q, renderList as _e, createSlots as ke, createTextVNode as H, resolveDynamicComponent as Me } from "vue";
|
|
2
|
+
import { motion as Te, AnimatePresence as we } from "motion-v";
|
|
3
|
+
import { _ as ae } from "../GBubble-C3cM9Put.mjs";
|
|
4
|
+
import L from "../GButton/index.mjs";
|
|
6
5
|
const Ce = /* @__PURE__ */ Symbol("GDialogManager"), J = {
|
|
7
6
|
small: "380px",
|
|
8
7
|
medium: "480px",
|
|
@@ -25,7 +24,7 @@ function be(l) {
|
|
|
25
24
|
});
|
|
26
25
|
}), h;
|
|
27
26
|
}
|
|
28
|
-
function
|
|
27
|
+
function Xe() {
|
|
29
28
|
const l = ee(/* @__PURE__ */ new Map()), h = r(() => {
|
|
30
29
|
const i = [];
|
|
31
30
|
return l.forEach((o) => {
|
|
@@ -111,17 +110,17 @@ const R = {
|
|
|
111
110
|
u("path", {
|
|
112
111
|
d: "M685.653333 361.386667a32 32 0 1 1 45.226667 45.226666l-249.472 249.514667a40.533333 40.533333 0 0 1-59.434667-2.304l-122.026666-142.336a32 32 0 0 1 48.64-41.642667l105.472 123.050667L685.653333 361.386667z"
|
|
113
112
|
})
|
|
114
|
-
]),
|
|
113
|
+
]), De = () => u("svg", R, [
|
|
115
114
|
u("path", {
|
|
116
115
|
d: "M130.133333 746.666667v-469.333334A138.666667 138.666667 0 0 1 268.8 138.666667h362.666667a32 32 0 0 1 0 64H268.8A74.666667 74.666667 0 0 0 194.133333 277.333333v469.333334c0 41.216 33.450667 74.666667 74.666667 74.666666h362.666667a32 32 0 0 1 0 64H268.8a138.666667 138.666667 0 0 1-138.666667-138.666666z"
|
|
117
116
|
}),
|
|
118
117
|
u("path", {
|
|
119
118
|
d: "M635.562667 738.304a32.042667 32.042667 0 0 0 45.312 0l203.605333-203.690667a32 32 0 0 0 0-45.226666l-203.605333-203.690667a32.042667 32.042667 0 0 0-45.312 45.312l149.077333 148.992H477.866667a32 32 0 0 0 0 64h306.773333l-149.077333 148.992a32.042667 32.042667 0 0 0 0 45.312z"
|
|
120
119
|
})
|
|
121
|
-
]),
|
|
120
|
+
]), Ae = {
|
|
122
121
|
class: "g-dialog-pro-minimized-icon__icon",
|
|
123
122
|
"aria-hidden": "true"
|
|
124
|
-
}, Be = { class: "g-dialog-pro-minimized-icon__title" },
|
|
123
|
+
}, Be = { class: "g-dialog-pro-minimized-icon__title" }, Fe = /* @__PURE__ */ te({
|
|
125
124
|
name: "GDialogMinimizedIcon",
|
|
126
125
|
__name: "GDialogMinimizedIcon",
|
|
127
126
|
props: {
|
|
@@ -146,11 +145,11 @@ const R = {
|
|
|
146
145
|
}), ie(() => {
|
|
147
146
|
window.clearTimeout(S);
|
|
148
147
|
});
|
|
149
|
-
function
|
|
148
|
+
function A() {
|
|
150
149
|
s("restore");
|
|
151
150
|
}
|
|
152
151
|
return (B, z) => (m(), k(oe, { to: "body" }, [
|
|
153
|
-
w(O(
|
|
152
|
+
w(O(Te).div, {
|
|
154
153
|
class: pe(["g-dialog-pro-minimized-icon", { "is-attention": M.value }]),
|
|
155
154
|
type: "button",
|
|
156
155
|
style: ge(I.value),
|
|
@@ -162,7 +161,7 @@ const R = {
|
|
|
162
161
|
transition: p,
|
|
163
162
|
"while-hover": i,
|
|
164
163
|
"while-press": o,
|
|
165
|
-
onClick:
|
|
164
|
+
onClick: A
|
|
166
165
|
}, {
|
|
167
166
|
default: f(() => [
|
|
168
167
|
z[0] || (z[0] = d("span", {
|
|
@@ -173,8 +172,8 @@ const R = {
|
|
|
173
172
|
class: "g-dialog-pro-minimized-icon__wave",
|
|
174
173
|
"aria-hidden": "true"
|
|
175
174
|
}, null, -1)),
|
|
176
|
-
d("span",
|
|
177
|
-
w(O(
|
|
175
|
+
d("span", Ae, [
|
|
176
|
+
w(O(De))
|
|
178
177
|
]),
|
|
179
178
|
d("span", Be, b(y.value), 1)
|
|
180
179
|
]),
|
|
@@ -183,7 +182,7 @@ const R = {
|
|
|
183
182
|
}, 8, ["class", "style", "title", "aria-label"])
|
|
184
183
|
]));
|
|
185
184
|
}
|
|
186
|
-
}), W = /* @__PURE__ */ ae(
|
|
185
|
+
}), W = /* @__PURE__ */ ae(Fe, [["__scopeId", "data-v-e7d8c859"]]), Ge = { class: "g-dialog-pro-header" }, He = { class: "g-dialog-pro-title" }, Le = {
|
|
187
186
|
class: "g-dialog-pro-operation-container",
|
|
188
187
|
"aria-label": "弹窗操作"
|
|
189
188
|
}, Re = ["aria-label", "title"], Ve = { class: "g-dialog-pro-body" }, Pe = {
|
|
@@ -211,7 +210,7 @@ const R = {
|
|
|
211
210
|
},
|
|
212
211
|
emits: ["cancel", "reset", "save", "minimize", "action", "update:modelValue"],
|
|
213
212
|
setup(l, { emit: h }) {
|
|
214
|
-
const n = l, s = h, y = r(() => n.modelValue), a = Z ? Z() : `g-dialog-pro-${Date.now()}-${Math.random().toString(36).slice(2)}`, t = Oe(), c = _(!1), g = _(!0), p = _(0), i = _(!1), o = _(!1), I = _(!1), M = r(() => t ? t.dialogs.get(a)?.isMinimized ?? !1 : c.value), S = r(() => t ? t.dialogs.get(a)?.attentionTick ?? 0 : p.value),
|
|
213
|
+
const n = l, s = h, y = r(() => n.modelValue), a = Z ? Z() : `g-dialog-pro-${Date.now()}-${Math.random().toString(36).slice(2)}`, t = Oe(), c = _(!1), g = _(!0), p = _(0), i = _(!1), o = _(!1), I = _(!1), M = r(() => t ? t.dialogs.get(a)?.isMinimized ?? !1 : c.value), S = r(() => t ? t.dialogs.get(a)?.attentionTick ?? 0 : p.value), A = r(() => t ? !o.value : g.value), B = r(() => t ? t.getPosition(a).value : { right: 20, bottom: 20 });
|
|
215
214
|
ve(() => {
|
|
216
215
|
t?.register({
|
|
217
216
|
id: a,
|
|
@@ -238,7 +237,7 @@ const R = {
|
|
|
238
237
|
e === !0 && (t?.dialogs.get(a)?.isMinimized ? t.remindMinimized(a) : c.value && (p.value += 1));
|
|
239
238
|
}
|
|
240
239
|
);
|
|
241
|
-
const z = r(() => Object.prototype.hasOwnProperty.call(J, n.size) ? J[n.size] : n.size), ne = r(() =>
|
|
240
|
+
const z = r(() => Object.prototype.hasOwnProperty.call(J, n.size) ? J[n.size] : n.size), ne = r(() => D.value ? {} : { width: z.value });
|
|
242
241
|
async function E(e) {
|
|
243
242
|
if (!n.beforeClose) return !0;
|
|
244
243
|
try {
|
|
@@ -247,14 +246,14 @@ const R = {
|
|
|
247
246
|
return !1;
|
|
248
247
|
}
|
|
249
248
|
}
|
|
250
|
-
async function
|
|
249
|
+
async function F() {
|
|
251
250
|
await E("close") && s("update:modelValue", !1);
|
|
252
251
|
}
|
|
253
252
|
function le() {
|
|
254
|
-
|
|
253
|
+
F();
|
|
255
254
|
}
|
|
256
255
|
function j(e) {
|
|
257
|
-
e.key === "Escape" && (!n.modelValue || !
|
|
256
|
+
e.key === "Escape" && (!n.modelValue || !A.value || M.value || (e.stopPropagation(), F()));
|
|
258
257
|
}
|
|
259
258
|
async function K() {
|
|
260
259
|
await E("cancel") && s("cancel");
|
|
@@ -275,9 +274,9 @@ const R = {
|
|
|
275
274
|
V[e.key] = !1;
|
|
276
275
|
}
|
|
277
276
|
}
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
}, Y = r(() =>
|
|
277
|
+
const D = _(!1), re = () => {
|
|
278
|
+
D.value = !D.value;
|
|
279
|
+
}, Y = r(() => D.value ? "退出全屏" : "全屏"), ce = async () => {
|
|
281
280
|
if (!await E("minimize")) return;
|
|
282
281
|
if (t ? t.dialogs.get(a)?.isMinimized ?? !1 : c.value) {
|
|
283
282
|
t ? t.minimize(a) : p.value += 1, s("minimize", { id: a });
|
|
@@ -298,14 +297,14 @@ const R = {
|
|
|
298
297
|
onAfterLeave: ue
|
|
299
298
|
}, {
|
|
300
299
|
default: f(() => [
|
|
301
|
-
|
|
300
|
+
A.value && y.value ? (m(), G("div", {
|
|
302
301
|
key: 0,
|
|
303
302
|
class: "g-dialog-pro-overlay",
|
|
304
303
|
onClick: ye(le, ["self"])
|
|
305
304
|
}, [
|
|
306
305
|
d("div", ze(e.$attrs, {
|
|
307
306
|
class: ["g-dialog-pro", {
|
|
308
|
-
"is-fullscreen":
|
|
307
|
+
"is-fullscreen": D.value,
|
|
309
308
|
"is-leave-to-minimize": i.value,
|
|
310
309
|
"is-enter-from-minimize": I.value
|
|
311
310
|
}],
|
|
@@ -313,7 +312,7 @@ const R = {
|
|
|
313
312
|
role: "dialog",
|
|
314
313
|
"aria-modal": "true"
|
|
315
314
|
}), [
|
|
316
|
-
d("header",
|
|
315
|
+
d("header", Ge, [
|
|
317
316
|
d("p", He, b(e.title), 1),
|
|
318
317
|
d("div", Le, [
|
|
319
318
|
d("button", {
|
|
@@ -335,23 +334,23 @@ const R = {
|
|
|
335
334
|
class: "g-dialog-pro-control g-dialog-pro-control--close",
|
|
336
335
|
"aria-label": Q,
|
|
337
336
|
title: Q,
|
|
338
|
-
onClick:
|
|
337
|
+
onClick: F
|
|
339
338
|
})
|
|
340
339
|
])
|
|
341
340
|
]),
|
|
342
341
|
d("div", Ve, [
|
|
343
342
|
P(e.$slots, "default", {}, void 0, !0)
|
|
344
343
|
]),
|
|
345
|
-
e.hideFooter ? C("", !0) : (m(),
|
|
344
|
+
e.hideFooter ? C("", !0) : (m(), G("footer", Pe, [
|
|
346
345
|
P(e.$slots, "footer", {
|
|
347
346
|
cancel: K,
|
|
348
347
|
reset: U,
|
|
349
348
|
save: X,
|
|
350
|
-
close:
|
|
349
|
+
close: F,
|
|
351
350
|
loading: e.saveLoading
|
|
352
351
|
}, () => [
|
|
353
352
|
d("div", $e, [
|
|
354
|
-
e.actions && e.actions.length ? (m(!0),
|
|
353
|
+
e.actions && e.actions.length ? (m(!0), G(q, { key: 0 }, _e(e.actions, (v) => (m(), k(L, {
|
|
355
354
|
key: v.key,
|
|
356
355
|
type: v.type,
|
|
357
356
|
danger: v.danger,
|
|
@@ -372,7 +371,7 @@ const R = {
|
|
|
372
371
|
]),
|
|
373
372
|
key: "0"
|
|
374
373
|
} : void 0
|
|
375
|
-
]), 1032, ["type", "danger", "loading", "disabled", "onClick"]))), 128)) : (m(),
|
|
374
|
+
]), 1032, ["type", "danger", "loading", "disabled", "onClick"]))), 128)) : (m(), G(q, { key: 1 }, [
|
|
376
375
|
e.showCancel ? (m(), k(L, {
|
|
377
376
|
key: 0,
|
|
378
377
|
size: "small",
|
|
@@ -425,7 +424,7 @@ const R = {
|
|
|
425
424
|
]),
|
|
426
425
|
_: 3
|
|
427
426
|
}),
|
|
428
|
-
w(O(
|
|
427
|
+
w(O(we), null, {
|
|
429
428
|
default: f(() => [
|
|
430
429
|
M.value ? (m(), k(W, {
|
|
431
430
|
key: 0,
|
|
@@ -444,7 +443,7 @@ $.install = (l) => {
|
|
|
444
443
|
l.component($.name, $), l.component(W.name, W);
|
|
445
444
|
};
|
|
446
445
|
export {
|
|
447
|
-
|
|
446
|
+
De as ChatDotRound,
|
|
448
447
|
Ee as CircleCheck,
|
|
449
448
|
Ce as DIALOG_MANAGER_KEY,
|
|
450
449
|
J as DIALOG_SIZES,
|
|
@@ -453,7 +452,7 @@ export {
|
|
|
453
452
|
x as MINIMIZED_LAYOUT,
|
|
454
453
|
Se as Refresh,
|
|
455
454
|
Ie as Remove,
|
|
456
|
-
|
|
455
|
+
Xe as createDialogManager,
|
|
457
456
|
$ as default,
|
|
458
457
|
Oe as useDialogManager
|
|
459
458
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("motion-v"),M=require("../GBubble-Dph0YDkU.js"),P={class:"g-input__wrapper"},T={key:0,class:"g-input__prefix"},q=["type","value","disabled","readonly","maxlength"],O={key:1,class:"g-input__suffix"},D={key:0,class:"g-input__slot-suffix"},F={key:1,class:"g-input__count"},L={key:0,class:"g-input__count-max"},R=e.defineComponent({name:"GInput",inheritAttrs:!1,__name:"index",props:{modelValue:{},type:{},size:{},disabled:{type:Boolean},readonly:{type:Boolean},clearable:{type:Boolean},showCount:{type:Boolean},maxlength:{},block:{type:Boolean}},emits:["update:modelValue","input","change","focus","blur","clear"],setup(c,{expose:y,emit:v}){const o=c,n=v,i=e.useAttrs(),_=e.useSlots(),g=e.computed(()=>{const{class:t,style:l,...d}=i;return d}),k=e.computed(()=>["g-input",`g-input--${o.size??"middle"}`,{"is-block":o.block,"is-disabled":o.disabled,"is-readonly":o.readonly,"is-focused":p.value},i.class]),h=e.computed(()=>i.style),s=e.ref(),r=e.ref(!1),p=e.ref(!1),B=e.computed(()=>m.value||!!_.suffix||o.showCount),m=e.computed(()=>o.clearable&&!o.disabled&&!o.readonly&&r.value&&String(o.modelValue??"").length>0),f=e.computed(()=>String(o.modelValue??"").length),b={opacity:0,scale:.6},C={opacity:1,scale:1},V={opacity:0,scale:.6},x={duration:.15,ease:"easeOut"},S={opacity:0,y:4},N={opacity:1,y:0},E={opacity:0,y:-4},w={duration:.15,ease:"easeOut"},A=t=>{const l=t.target.value;n("update:modelValue",l),n("input",l)},I=t=>{n("change",t.target.value)},$=t=>{p.value=!0,n("focus",t)},z=t=>{p.value=!1,n("blur",t)},G=()=>{n("update:modelValue",""),n("input",""),n("change",""),n("clear"),s.value?.focus()};return y({focus:()=>s.value?.focus(),blur:()=>s.value?.blur(),select:()=>s.value?.select()}),(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(k.value),style:e.normalizeStyle(h.value),onMouseenter:l[0]||(l[0]=d=>r.value=!0),onMouseleave:l[1]||(l[1]=d=>r.value=!1)},[e.createElementVNode("div",P,[t.$slots.prefix?(e.openBlock(),e.createElementBlock("span",T,[e.renderSlot(t.$slots,"prefix",{},void 0,!0)])):e.createCommentVNode("",!0),e.createElementVNode("input",e.mergeProps({ref_key:"inputRef",ref:s,class:"g-input__inner",type:t.type,value:t.modelValue??"",disabled:t.disabled,readonly:t.readonly,maxlength:t.maxlength},g.value,{onInput:A,onChange:I,onFocus:$,onBlur:z}),null,16,q),B.value?(e.openBlock(),e.createElementBlock("span",O,[e.createVNode(e.unref(u.AnimatePresence),null,{default:e.withCtx(()=>[m.value?(e.openBlock(),e.createBlock(e.unref(u.motion).span,{key:0,class:"g-input__clear",initial:b,animate:C,exit:V,transition:x,onClick:G})):e.createCommentVNode("",!0)]),_:1}),t.$slots.suffix?(e.openBlock(),e.createElementBlock("span",D,[e.renderSlot(t.$slots,"suffix",{},void 0,!0)])):e.createCommentVNode("",!0),t.showCount?(e.openBlock(),e.createElementBlock("span",F,[e.createVNode(e.unref(u.AnimatePresence),{mode:"popLayout"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(u.motion).span,{key:f.value,class:"g-input__count-text",initial:S,animate:N,exit:E,transition:w},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value),1)]),_:1}))]),_:1}),t.maxlength!=null?(e.openBlock(),e.createElementBlock("span",L," / "+e.toDisplayString(t.maxlength),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])],38))}}),a=M._export_sfc(R,[["__scopeId","data-v-76da4f4c"]]);a.install=c=>{c.component(a.name,a)};exports.GInput=a;exports.default=a;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { defineComponent as K, useAttrs as Q, useSlots as U, computed as a, ref as y, createElementBlock as l, openBlock as n, normalizeStyle as W, normalizeClass as X, createElementVNode as b, createCommentVNode as u, renderSlot as x, mergeProps as Y, createVNode as k, unref as r, withCtx as _, createBlock as C, createTextVNode as Z, toDisplayString as V } from "vue";
|
|
2
|
+
import { AnimatePresence as B, motion as S } from "motion-v";
|
|
3
|
+
import { _ as ee } from "../GBubble-C3cM9Put.mjs";
|
|
4
|
+
const te = { class: "g-input__wrapper" }, se = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "g-input__prefix"
|
|
7
|
+
}, oe = ["type", "value", "disabled", "readonly", "maxlength"], ne = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "g-input__suffix"
|
|
10
|
+
}, ae = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "g-input__slot-suffix"
|
|
13
|
+
}, le = {
|
|
14
|
+
key: 1,
|
|
15
|
+
class: "g-input__count"
|
|
16
|
+
}, ue = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "g-input__count-max"
|
|
19
|
+
}, ie = /* @__PURE__ */ K({
|
|
20
|
+
name: "GInput",
|
|
21
|
+
inheritAttrs: !1,
|
|
22
|
+
__name: "index",
|
|
23
|
+
props: {
|
|
24
|
+
modelValue: {},
|
|
25
|
+
type: {},
|
|
26
|
+
size: {},
|
|
27
|
+
disabled: { type: Boolean },
|
|
28
|
+
readonly: { type: Boolean },
|
|
29
|
+
clearable: { type: Boolean },
|
|
30
|
+
showCount: { type: Boolean },
|
|
31
|
+
maxlength: {},
|
|
32
|
+
block: { type: Boolean }
|
|
33
|
+
},
|
|
34
|
+
emits: ["update:modelValue", "input", "change", "focus", "blur", "clear"],
|
|
35
|
+
setup(c, { expose: w, emit: $ }) {
|
|
36
|
+
const t = c, s = $, p = Q(), A = U(), I = a(() => {
|
|
37
|
+
const { class: e, style: o, ...f } = p;
|
|
38
|
+
return f;
|
|
39
|
+
}), z = a(() => [
|
|
40
|
+
"g-input",
|
|
41
|
+
`g-input--${t.size ?? "middle"}`,
|
|
42
|
+
{
|
|
43
|
+
"is-block": t.block,
|
|
44
|
+
"is-disabled": t.disabled,
|
|
45
|
+
"is-readonly": t.readonly,
|
|
46
|
+
"is-focused": m.value
|
|
47
|
+
},
|
|
48
|
+
p.class
|
|
49
|
+
]), E = a(() => p.style), i = y(), d = y(!1), m = y(!1), N = a(() => g.value || !!A.suffix || t.showCount), g = a(
|
|
50
|
+
() => t.clearable && !t.disabled && !t.readonly && d.value && String(t.modelValue ?? "").length > 0
|
|
51
|
+
), h = a(() => String(t.modelValue ?? "").length), T = { opacity: 0, scale: 0.6 }, F = { opacity: 1, scale: 1 }, G = { opacity: 0, scale: 0.6 }, L = { duration: 0.15, ease: "easeOut" }, M = { opacity: 0, y: 4 }, O = { opacity: 1, y: 0 }, P = { opacity: 0, y: -4 }, R = { duration: 0.15, ease: "easeOut" }, D = (e) => {
|
|
52
|
+
const o = e.target.value;
|
|
53
|
+
s("update:modelValue", o), s("input", o);
|
|
54
|
+
}, H = (e) => {
|
|
55
|
+
s("change", e.target.value);
|
|
56
|
+
}, j = (e) => {
|
|
57
|
+
m.value = !0, s("focus", e);
|
|
58
|
+
}, q = (e) => {
|
|
59
|
+
m.value = !1, s("blur", e);
|
|
60
|
+
}, J = () => {
|
|
61
|
+
s("update:modelValue", ""), s("input", ""), s("change", ""), s("clear"), i.value?.focus();
|
|
62
|
+
};
|
|
63
|
+
return w({
|
|
64
|
+
/** 手动聚焦内部 input */
|
|
65
|
+
focus: () => i.value?.focus(),
|
|
66
|
+
/** 手动失焦内部 input */
|
|
67
|
+
blur: () => i.value?.blur(),
|
|
68
|
+
/** 全选内部文本 */
|
|
69
|
+
select: () => i.value?.select()
|
|
70
|
+
}), (e, o) => (n(), l("div", {
|
|
71
|
+
class: X(z.value),
|
|
72
|
+
style: W(E.value),
|
|
73
|
+
onMouseenter: o[0] || (o[0] = (f) => d.value = !0),
|
|
74
|
+
onMouseleave: o[1] || (o[1] = (f) => d.value = !1)
|
|
75
|
+
}, [
|
|
76
|
+
b("div", te, [
|
|
77
|
+
e.$slots.prefix ? (n(), l("span", se, [
|
|
78
|
+
x(e.$slots, "prefix", {}, void 0, !0)
|
|
79
|
+
])) : u("", !0),
|
|
80
|
+
b("input", Y({
|
|
81
|
+
ref_key: "inputRef",
|
|
82
|
+
ref: i,
|
|
83
|
+
class: "g-input__inner",
|
|
84
|
+
type: e.type,
|
|
85
|
+
value: e.modelValue ?? "",
|
|
86
|
+
disabled: e.disabled,
|
|
87
|
+
readonly: e.readonly,
|
|
88
|
+
maxlength: e.maxlength
|
|
89
|
+
}, I.value, {
|
|
90
|
+
onInput: D,
|
|
91
|
+
onChange: H,
|
|
92
|
+
onFocus: j,
|
|
93
|
+
onBlur: q
|
|
94
|
+
}), null, 16, oe),
|
|
95
|
+
N.value ? (n(), l("span", ne, [
|
|
96
|
+
k(r(B), null, {
|
|
97
|
+
default: _(() => [
|
|
98
|
+
g.value ? (n(), C(r(S).span, {
|
|
99
|
+
key: 0,
|
|
100
|
+
class: "g-input__clear",
|
|
101
|
+
initial: T,
|
|
102
|
+
animate: F,
|
|
103
|
+
exit: G,
|
|
104
|
+
transition: L,
|
|
105
|
+
onClick: J
|
|
106
|
+
})) : u("", !0)
|
|
107
|
+
]),
|
|
108
|
+
_: 1
|
|
109
|
+
}),
|
|
110
|
+
e.$slots.suffix ? (n(), l("span", ae, [
|
|
111
|
+
x(e.$slots, "suffix", {}, void 0, !0)
|
|
112
|
+
])) : u("", !0),
|
|
113
|
+
e.showCount ? (n(), l("span", le, [
|
|
114
|
+
k(r(B), { mode: "popLayout" }, {
|
|
115
|
+
default: _(() => [
|
|
116
|
+
(n(), C(r(S).span, {
|
|
117
|
+
key: h.value,
|
|
118
|
+
class: "g-input__count-text",
|
|
119
|
+
initial: M,
|
|
120
|
+
animate: O,
|
|
121
|
+
exit: P,
|
|
122
|
+
transition: R
|
|
123
|
+
}, {
|
|
124
|
+
default: _(() => [
|
|
125
|
+
Z(V(h.value), 1)
|
|
126
|
+
]),
|
|
127
|
+
_: 1
|
|
128
|
+
}))
|
|
129
|
+
]),
|
|
130
|
+
_: 1
|
|
131
|
+
}),
|
|
132
|
+
e.maxlength != null ? (n(), l("span", ue, " / " + V(e.maxlength), 1)) : u("", !0)
|
|
133
|
+
])) : u("", !0)
|
|
134
|
+
])) : u("", !0)
|
|
135
|
+
])
|
|
136
|
+
], 38));
|
|
137
|
+
}
|
|
138
|
+
}), v = /* @__PURE__ */ ee(ie, [["__scopeId", "data-v-76da4f4c"]]);
|
|
139
|
+
v.install = (c) => {
|
|
140
|
+
c.component(v.name, v);
|
|
141
|
+
};
|
|
142
|
+
export {
|
|
143
|
+
v as GInput,
|
|
144
|
+
v as default
|
|
145
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@charset "UTF-8";.g-input[data-v-76da4f4c]{display:inline-flex;align-items:stretch;width:var(--g-input-width, 240px);font-size:var(--g-input-font-size, 14px);color:var(--g-text-color, rgba(0, 0, 0, .88))}.g-input:not(.is-disabled):hover .g-input__wrapper[data-v-76da4f4c]{border-color:var(--g-primary-color, #039be5)}.g-input.is-focused:not(.is-disabled) .g-input__wrapper[data-v-76da4f4c]{border-color:var(--g-primary-color, #039be5);box-shadow:0 0 0 2px color-mix(in srgb,var(--g-primary-color, #039be5) 15%,transparent)}.g-input.is-block[data-v-76da4f4c]{display:flex;width:100%}.g-input.is-disabled[data-v-76da4f4c]{cursor:not-allowed;color:var(--g-input-disabled-text-color, rgba(0, 0, 0, .3))}.g-input.is-disabled .g-input__wrapper[data-v-76da4f4c]{background:var(--g-input-disabled-bg-color, #f2f3f5);border-color:var(--g-border-color, #dcdfe3)}.g-input.is-disabled .g-input__inner[data-v-76da4f4c]{cursor:not-allowed;-webkit-text-fill-color:var(--g-input-disabled-text-color, rgba(0, 0, 0, .3))}.g-input.is-disabled .g-input__inner[data-v-76da4f4c]::placeholder{color:var(--g-input-disabled-text-color, rgba(0, 0, 0, .3))}.g-input--large[data-v-76da4f4c]{--g-input-height: 40px;--g-input-font-size: 16px}.g-input--small[data-v-76da4f4c]{--g-input-height: 24px;--g-input-font-size: 12px}.g-input__wrapper[data-v-76da4f4c]{position:relative;flex:1;display:inline-flex;align-items:center;gap:4px;min-width:0;height:var(--g-input-height, 32px);padding:0 8px;background:var(--g-bg-color, #ffffff);border:1px solid var(--g-border-color, #dcdfe3);border-radius:var(--g-input-radius, 6px);transition:border-color .2s cubic-bezier(.645,.045,.355,1),box-shadow .2s cubic-bezier(.645,.045,.355,1)}.g-input__inner[data-v-76da4f4c]{flex:1;min-width:0;height:100%;padding:0;font:inherit;color:inherit;background:transparent;border:none;outline:none;caret-color:var(--g-primary-color, #039be5)}.g-input__inner[data-v-76da4f4c]::placeholder{color:var(--g-text-placeholder-color, rgba(0, 0, 0, .35))}.g-input__prefix[data-v-76da4f4c],.g-input__suffix[data-v-76da4f4c]{display:inline-flex;align-items:center;gap:4px;color:var(--g-text-placeholder-color, rgba(0, 0, 0, .35))}.g-input__prefix[data-v-76da4f4c] svg,.g-input__suffix[data-v-76da4f4c] svg{width:1em;height:1em;display:block}.g-input__clear[data-v-76da4f4c]{position:relative;flex-shrink:0;width:1em;height:1em;cursor:pointer;color:var(--g-text-placeholder-color, rgba(0, 0, 0, .35));transition:color .2s}.g-input__clear[data-v-76da4f4c]:before,.g-input__clear[data-v-76da4f4c]:after{content:"";position:absolute;left:50%;top:50%;width:100%;height:1px;background:currentcolor}.g-input__clear[data-v-76da4f4c]:before{transform:translate(-50%,-50%) rotate(45deg)}.g-input__clear[data-v-76da4f4c]:after{transform:translate(-50%,-50%) rotate(-45deg)}.g-input__clear[data-v-76da4f4c]:hover{color:var(--g-text-color, rgba(0, 0, 0, .88))}.g-input__count[data-v-76da4f4c]{flex-shrink:0;font-size:12px;font-variant-numeric:tabular-nums;color:var(--g-text-placeholder-color, rgba(0, 0, 0, .35))}.g-input__count-text[data-v-76da4f4c]{display:inline-block}
|
package/lib/GInput.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),
|
|
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"),F=require("element-plus"),x=require("motion-v"),ge=require("../GBubble-Dph0YDkU.js"),be={key:0,class:"g-input-tree-tag__tags"},he=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(E,{expose:$,emit:H}){const o=E,r=H,q=t.computed(()=>({label:o.props.label||"label",children:o.props.children||"children",disabled:o.props.disabled})),j=t.computed(()=>o.props.value||o.nodeKey||"id"),G=t.computed(()=>o.props.label||"label"),K=t.computed(()=>o.props.children||"children"),S=t.computed(()=>o.props.isLeaf),P=t.computed(()=>o.echoProps?.value||"value"),U=t.computed(()=>o.echoProps?.label||"label"),v=e=>e?e[j.value]:void 0,d=e=>e?e[G.value]:"",T=e=>e?e[K.value]:void 0,D=e=>e?.[P.value]??e?.value,Z=e=>e?.[U.value]??e?.label,c=e=>{if(!e)return!1;if(typeof o.selectable=="function")return o.selectable(e);if(S.value&&e[S.value]!==void 0)return!!e[S.value];const a=T(e);return!a||!a.length},C=t.computed(()=>{const e=new Map,a=(l=[])=>{l.forEach(n=>{c(n)&&e.set(v(n),n);const s=T(n);s?.length&&a(s)})};return a(o.data||[]),e}),u=t.computed(()=>(o.modelValue||[]).map(a=>{const l=o.valueFormat==="object"?D(a):a,n=C.value.get(l),s=o.valueFormat==="object"?Z(a):void 0;return{value:l,label:n?d(n):s??String(l??""),raw:n??(o.valueFormat==="object"?a:void 0)}})),y=e=>u.value.some(a=>a.value===e),w=t.ref(""),i=t.ref(!1),I=t.ref(null),N=t.ref(null),L=t.ref(null),p=t.ref(null),W=e=>{if(!e){p.value=null;return}p.value=e.$el??(e instanceof HTMLElement?e:null)},A=t.ref({}),m=t.ref("bottom"),J=t.computed(()=>({opacity:0,scale:.95,y:m.value==="bottom"?-8:8})),Q={opacity:1,scale:1,y:0},X=t.computed(()=>({opacity:0,scale:.95,y:m.value==="bottom"?-8:8})),Y={duration:.2,ease:"easeOut"},ee=t.computed(()=>({...A.value,transformOrigin:m.value==="bottom"?"top center":"bottom center"})),te={opacity:0,scale:.8},ae={opacity:1,scale:1},le={opacity:0,scale:.8},oe={duration:.2,ease:"easeOut"},ne=t.computed(()=>typeof o.width=="number"?`${o.width}px`:o.width),M=()=>{o.disabled||(i.value=!0)},k=()=>{if(!i.value)return;const e=L.value,a=p.value;if(!e||!a)return;const l=e.getBoundingClientRect(),n=a.offsetHeight||o.popperMaxHeight,B=window.innerHeight-l.bottom-o.popperOffset,pe=l.top-o.popperOffset,R=B>=n||B>=pe?"bottom":"top";m.value=R;const fe=R==="bottom"?l.bottom+o.popperOffset:l.top-n-o.popperOffset;A.value={position:"fixed",top:`${fe}px`,left:`${l.left}px`,width:`${l.width}px`,zIndex:String(o.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))},z=()=>{b?.disconnect(),b=null};t.watch(i,async e=>{if(!e){z();return}await t.nextTick(),k(),requestAnimationFrame(k),re()});const O=e=>{if(!i.value)return;const a=e.target;N.value?.contains(a)||p.value?.contains(a)||(i.value=!1)};t.onMounted(()=>{document.addEventListener("mousedown",O,!0),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g)}),t.onBeforeUnmount(()=>{document.removeEventListener("mousedown",O,!0),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),f&&cancelAnimationFrame(f),z()});const ue=e=>{i.value=!0,I.value?.filter(e),t.nextTick(k)},ie=(e,a)=>e?typeof o.filterMethod=="function"?o.filterMethod(e,a):String(d(a)??"").toLowerCase().includes(String(e).toLowerCase()):!0,se=(e,a)=>{if(r("node-click",e),!c(e)){a&&(a.expanded=!a.expanded);return}_(e),i.value=!1},de=e=>o.valueFormat==="object"?{value:e.value,label:e.label,raw:e.raw}:e.value,_=e=>{const a=v(e);if(a==null||a==="")return;if(y(a)){const s={value:a,label:d(e),raw:e};r("duplicate",s),o.duplicateMessage&&F.ElMessage.warning(o.duplicateMessage);return}const l={value:a,label:d(e),raw:e},n=[...o.modelValue||[],de(l)];r("update:modelValue",n),r("add",l),r("change",n,[...u.value,l]),o.clearInputAfterSelect&&(w.value="")},ce=()=>{if(!o.enterToAdd)return;const e=(w.value||"").trim();if(!e)return;let a=null;for(const l of C.value.values())if(d(l)===e){a=l;break}if(!a){r("not-found",e),o.notFoundMessage&&F.ElMessage.warning(o.notFoundMessage);return}_(a)},V=e=>{if(e<0||e>=u.value.length)return;const a=u.value[e],l=[...o.modelValue||[]];l.splice(e,1),r("update:modelValue",l),a&&r("remove",a,e);const n=u.value.filter((s,B)=>B!==e);r("change",l,n)};return $({open:M,close:()=>i.value=!1,clear:()=>{r("update:modelValue",[]),r("change",[],[])},addByValue:e=>{const a=C.value.get(e);a&&_(a)},removeByIndex:e=>{V(e)},removeByValue:e=>{const a=u.value.findIndex(l=>l.value===e);a>-1&&V(a)},getSelectedItems:()=>u.value}),(e,a)=>(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:N},[t.createElementVNode("div",{class:"g-input-tree-tag__input-box",ref_key:"inputBoxRef",ref:L,style:t.normalizeStyle({width:ne.value})},[t.createVNode(t.unref(ve.default),{modelValue:w.value,"onUpdate:modelValue":a[0]||(a[0]=l=>w.value=l),placeholder:e.placeholder,clearable:e.clearable,disabled:e.disabled,block:"",class:"g-input-tree-tag__input",onFocus:M,onClick:M,onInput:ue,onKeyup:t.withKeys(ce,["enter"])},null,8,["modelValue","placeholder","clearable","disabled"])],4),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.unref(x.AnimatePresence),null,{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createBlock(t.unref(x.motion).div,{key:0,ref:W,class:t.normalizeClass(["g-input-tree-tag__popover",`is-${m.value}`]),style:t.normalizeStyle(ee.value),initial:J.value,animate:Q,exit:X.value,transition:Y,onMousedown:a[1]||(a[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(F.ElTree),{ref_key:"treeRef",ref:I,data:e.data,props:q.value,"node-key":e.nodeKey,"filter-node-method":ie,"expand-on-click-node":!1,"default-expand-all":e.defaultExpandAll,onNodeClick:se},{default:t.withCtx(l=>[t.renderSlot(e.$slots,"tree-node",{data:l?.data,node:l?.node,selectable:c(l?.data),selected:y(v(l?.data))},()=>[l?.data?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(["g-input-tree-tag__node",{"is-selectable":c(l.data),"is-selected":c(l.data)&&y(v(l.data))}])},[t.renderSlot(e.$slots,"leaf-icon",{data:l.data,selectable:c(l.data),selected:y(v(l.data))},void 0,!0),t.createTextVNode(" "+t.toDisplayString(d(l.data)),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",be,[t.renderSlot(e.$slots,"tags",{items:u.value,remove:V},()=>[t.createVNode(t.unref(x.AnimatePresence),{mode:"popLayout"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,(l,n)=>(t.openBlock(),t.createBlock(t.unref(x.motion).div,{key:l.value,layout:!0,class:"g-input-tree-tag__tag-motion",initial:te,animate:ae,exit:le,transition:oe},{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:l,index:n},()=>[t.createTextVNode(t.toDisplayString(l.label),1)],!0)]),_:2},1032,["type","variant","closable","onClose"])]),_:2},1024))),128))]),_:3})],!0)])):t.createCommentVNode("",!0)],512)],2))}}),h=ge._export_sfc(he,[["__scopeId","data-v-d6c62619"]]);h.install=E=>{E.component(h.name,h)};exports.GInputTreeTag=h;exports.default=h;
|