index-AOcxwHT9.js 4.3 KB

1
  1. import{c9 as D,ca as T,cb as A,cc as L,cd as M,ce as I,ag as S,cf as $,a$ as x,bw as j,cg as O,ch as z,ci as F,cj as _,bn as V,an as c,ck as R,ae as N,cl as H,I as p,cm as K,ah as P,ai as i,al as u,cn as W,c7 as v,am as y,aj as X,co as Y,ap as w,b6 as q,by as U,aO as Z,cp as G,aZ as h,cq as J,aW as B,aY as Q,aP as ee,az as ae,at as te,aX as se,cr as oe,aw as le}from"./index-D68iA7pN.js";const ne=D({fullscreen:Boolean,retainFocus:{type:Boolean,default:!0},scrollable:Boolean,...T({origin:"center center",scrollStrategy:"block",transition:{component:A},zIndex:2400})},"VDialog"),re=L()({name:"VDialog",props:ne(),emits:{"update:modelValue":s=>!0,afterEnter:()=>!0,afterLeave:()=>!0},setup(s,E){let{emit:f,slots:m}=E;const d=M(s,"modelValue"),{scopeId:b}=I(),t=S();function g(o){const e=o.relatedTarget,l=o.target;if(e!==l&&t.value?.contentEl&&t.value?.globalTop&&![document,t.value.contentEl].includes(l)&&!t.value.contentEl.contains(l)){const a=F(t.value.contentEl);if(!a.length)return;const n=a[0],r=a[a.length-1];e===n?r.focus():n.focus()}}$&&x(()=>d.value&&s.retainFocus,o=>{o?document.addEventListener("focusin",g):document.removeEventListener("focusin",g)},{immediate:!0});function C(){f("afterEnter"),t.value?.contentEl&&!t.value.contentEl.contains(document.activeElement)&&t.value.contentEl.focus({preventScroll:!0})}function k(){f("afterLeave")}return x(d,async o=>{o||(await j(),t.value.activatorEl?.focus({preventScroll:!0}))}),O(()=>{const o=_.filterProps(s),e=V({"aria-haspopup":"dialog"},s.activatorProps),l=V({tabindex:-1},s.contentProps);return c(_,V({ref:t,class:["v-dialog",{"v-dialog--fullscreen":s.fullscreen,"v-dialog--scrollable":s.scrollable},s.class],style:s.style},o,{modelValue:d.value,"onUpdate:modelValue":a=>d.value=a,"aria-modal":"true",activatorProps:e,contentProps:l,role:"dialog",onAfterEnter:C,onAfterLeave:k},b),{activator:m.activator,default:function(){for(var a=arguments.length,n=new Array(a),r=0;r<a;r++)n[r]=arguments[r];return c(R,{root:"VDialog"},{default:()=>[m.default?.(...n)]})}})}),z({},t)}}),ie={class:"d-flex justify-space-between align-center w-100 py-1"},ce={class:"title_box"},de=["src"],ue={class:"ml-2"},fe={key:1},me=N({__name:"index",props:{title:{default:"标题"},logo:{},cardClass:{},cardTextClass:{},cardActionClass:{},footerBtnList:{default:()=>[]},modelValue:{type:Boolean,default:!1},keys:{}},emits:["update:modelValue"],setup(s,{expose:E,emit:f}){const m=f,{dialog:d,dialogTitleEl:b,getMoveX:t,getMoveY:g,closeDialog:C}=H(),k=e=>{m("update:modelValue",e)},o=Object.assign({Escape:()=>C()},s.keys);return Object.keys(o).forEach(e=>{const l=o[e];(["Escape","Enter"].includes(e)?p.registerWithHighPrior.bind(p):p.register.bind(p))({key:[],winKey:{keyCode:K(e)},action:l,when(r){return r.isRunCommand?!1:d.value?.modelValue??!1}})}),E({getMoveX:t,getMoveY:g}),(e,l)=>(u(),P(re,{ref_key:"dialog",ref:d,"model-value":e.modelValue,contained:"",persistent:"","no-click-animation":"","retain-focus":""},{default:i(()=>[c(oe,{class:h(["w-100 h-100 rounded-0",e.cardClass||"bg-dialog-card box-shadow"])},{default:i(()=>[c(W,{class:"pa-0",ref_key:"dialogTitleEl",ref:b},{default:i(()=>[v(e.$slots,"header",{},()=>[y("div",ie,[y("div",ce,[v(e.$slots,"header-icon",{},()=>[y("img",{class:"ml-1",alt:"logo",width:"24",height:"24",src:e.logo||X(Y)()},null,8,de)],!0),y("span",ue,w(e.title),1)]),c(q,{size:"24px",class:"mr-2",variant:"plain",onClick:l[0]||(l[0]=U(a=>k(!1),["stop"]))},{default:i(()=>[c(Z,{size:"16px",icon:"cha"})]),_:1})])],!0)]),_:3},512),c(G,{class:h([e.cardTextClass||"mx-1 px-2 bg-dialog-card-text rounded-t","py-0"])},{default:i(()=>[v(e.$slots,"default",{},void 0,!0)]),_:3},8,["class"]),v(e.$slots,"actions",{},()=>[c(J,{class:h(["mx-1 mt-0 mb-1 py-0 px-2 d-flex justify-end",e.cardActionClass||"bg-dialog-card-text"])},{default:i(()=>[(u(!0),B(se,null,Q(e.footerBtnList,(a,n)=>(u(),P(ee,{key:n+a.name,onClick:a.fun,isAction:"",primary:a.primary,disabled:a.disabled?a.disabled():!1,class:h(["ml-3 px-2",a.disabled&&a.disabled()?"disabled":""])},{default:i(()=>[a.labelProps?(u(),P(ae,V({key:0,ref_for:!0},a.labelProps,{noTextCaption:""}),{default:i(()=>[te(w(e.t(a.name)),1)]),_:2},1040)):(u(),B("span",fe,w(e.t(a.name)),1))]),_:2},1032,["onClick","primary","disabled","class"]))),128))]),_:1},8,["class"])],!0)]),_:3},8,["class"])]),_:3},8,["model-value"]))}}),pe=le(me,[["__scopeId","data-v-a794a28c"]]);export{pe as M,re as V,ne as m};