2 lines
1.1 KiB
JavaScript
2 lines
1.1 KiB
JavaScript
import{c as P,r as p,a as h,w as b,bd as x,h as y,g as Q,be as C}from"./index.e908c8ed.js";import{u as j,a as k,Q as M}from"./QMenu.33f05db8.js";var H=P({name:"QPopupProxy",props:{...j,breakpoint:{type:[String,Number],default:450}},emits:["show","hide"],setup(a,{slots:g,emit:c,attrs:v}){const{proxy:u}=Q(),{$q:l}=u,n=p(!1),t=p(null),i=h(()=>parseInt(a.breakpoint,10)),{canShow:f}=k({showing:n});function r(){return l.screen.width<i.value||l.screen.height<i.value?"dialog":"menu"}const o=p(r()),d=h(()=>o.value==="menu"?{maxHeight:"99vh"}:{});b(()=>r(),e=>{n.value!==!0&&(o.value=e)});function m(e){n.value=!0,c("show",e)}function w(e){n.value=!1,o.value=r(),c("hide",e)}return Object.assign(u,{show(e){f(e)===!0&&t.value.show(e)},hide(e){t.value.hide(e)},toggle(e){t.value.toggle(e)}}),x(u,"currentComponent",()=>({type:o.value,ref:t.value})),()=>{const e={ref:t,...d.value,...v,onShow:m,onHide:w};let s;return o.value==="dialog"?s=C:(s=M,Object.assign(e,{target:a.target,contextMenu:a.contextMenu,noParentEvent:!0,separateClosePopup:!0})),y(s,e,g.default)}}});export{H as Q};
|