generated from VLADIMIR/template_frontend
1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
import{$ as e,A as t,D as n,L as r,O as i,P as a,U as o,X as s,it as c,j as l,st as u,z as d}from"./vue-router-bPs2Bq2h.js";import{R as f,et as p,z as m}from"./light-BDe84dgP.js";import{A as h,C as g,E as _,S as v,_ as y,b,j as x,k as S,v as C,x as w}from"./Card-fPjzaRm8.js";import{J as T,q as E}from"./index-Bqh_AnJt.js";var D=[],O=new WeakMap;function k(){D.forEach(e=>e(...O.get(e))),D=[]}function A(e,...t){O.set(e,t),!D.includes(e)&&D.push(e)===1&&requestAnimationFrame(k)}var j=S?document?.fonts?.ready:void 0,M=!1;j===void 0?M=!0:j.then(()=>{M=!0});function N(e){if(M)return;let t=!1;d(()=>{M||j?.then(()=>{t||e()})}),r(()=>{t=!0})}var P=m(`n-internal-select-menu`),F=m(`n-internal-select-menu-body`),I=`__disabled__`;function L(e){let t=l(g,null),n=l(_,null),i=l(v,null),a=l(F,null),o=c();if(typeof document<`u`){o.value=document.fullscreenElement;let e=()=>{o.value=document.fullscreenElement};d(()=>{x(`fullscreenchange`,document,e)}),r(()=>{h(`fullscreenchange`,document,e)})}return T(()=>{let{to:r}=e;return r===void 0?t?.value?t.value.$el??t.value:n?.value?n.value:i?.value?i.value:a?.value?a.value:r??(o.value||`body`):r===!1?I:r===!0?o.value||`body`:r})}L.tdkey=I,L.propTo={type:[String,Object,Boolean],default:void 0};var R=null;function z(){if(R===null&&(R=document.getElementById(`v-binder-view-measurer`),R===null)){R=document.createElement(`div`),R.id=`v-binder-view-measurer`;let{style:e}=R;e.position=`fixed`,e.left=`0`,e.right=`0`,e.top=`0`,e.bottom=`0`,e.pointerEvents=`none`,e.visibility=`hidden`,document.body.appendChild(R)}return R.getBoundingClientRect()}function B(e,t){let n=z();return{top:t,left:e,height:0,width:0,right:n.width-e,bottom:n.height-t}}function V(e){let t=e.getBoundingClientRect(),n=z();return{left:t.left-n.left,top:t.top-n.top,bottom:n.height+n.top-t.bottom,right:n.width+n.left-t.right,width:t.width,height:t.height}}function H(e){return e.nodeType===9?null:e.parentNode}function U(e){if(e===null)return null;let t=H(e);if(t===null)return null;if(t.nodeType===9)return document;if(t.nodeType===1){let{overflow:e,overflowX:n,overflowY:r}=getComputedStyle(t);if(/(auto|scroll|overlay)/.test(e+r+n))return t}return U(t)}var W=n({name:`Binder`,props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(e){o(`VBinder`,i()?.proxy);let t=l(`VBinder`,null),n=c(null),a=r=>{n.value=r,t&&e.syncTargetWithParent&&t.setTargetRef(r)},s=[],u=()=>{let e=n.value;for(;e=U(e),e!==null;)s.push(e);for(let e of s)x(`scroll`,e,g,!0)},d=()=>{for(let e of s)h(`scroll`,e,g,!0);s=[]},f=new Set,p=e=>{f.size===0&&u(),f.has(e)||f.add(e)},m=e=>{f.has(e)&&f.delete(e),f.size===0&&d()},g=()=>{A(_)},_=()=>{f.forEach(e=>e())},v=new Set,y=e=>{v.size===0&&x(`resize`,window,S),v.has(e)||v.add(e)},b=e=>{v.has(e)&&v.delete(e),v.size===0&&h(`resize`,window,S)},S=()=>{v.forEach(e=>e())};return r(()=>{h(`resize`,window,S),d()}),{targetRef:n,setTargetRef:a,addScrollListener:p,removeScrollListener:m,addResizeListener:y,removeResizeListener:b}},render(){return w(`binder`,this.$slots)}}),G=n({name:`Target`,setup(){let{setTargetRef:e,syncTarget:t}=l(`VBinder`);return{syncTarget:t,setTargetDirective:{mounted:e,updated:e}}},render(){let{syncTarget:t,setTargetDirective:n}=this;return t?e(b(`follower`,this.$slots),[[n]]):b(`follower`,this.$slots)}}),{c:K}=p(),q=`vueuc-style`,J={top:`bottom`,bottom:`top`,left:`right`,right:`left`},Y={start:`end`,center:`center`,end:`start`},X={top:`height`,bottom:`height`,left:`width`,right:`width`},Z={"bottom-start":`top left`,bottom:`top center`,"bottom-end":`top right`,"top-start":`bottom left`,top:`bottom center`,"top-end":`bottom right`,"right-start":`top left`,right:`center left`,"right-end":`bottom left`,"left-start":`top right`,left:`center right`,"left-end":`bottom right`},ee={"bottom-start":`bottom left`,bottom:`bottom center`,"bottom-end":`bottom right`,"top-start":`top left`,top:`top center`,"top-end":`top right`,"right-start":`top right`,right:`center right`,"right-end":`bottom right`,"left-start":`top left`,left:`center left`,"left-end":`bottom left`},te={"bottom-start":`right`,"bottom-end":`left`,"top-start":`right`,"top-end":`left`,"right-start":`bottom`,"right-end":`top`,"left-start":`bottom`,"left-end":`top`},Q={top:!0,bottom:!1,left:!0,right:!1},$={top:`end`,bottom:`start`,left:`end`,right:`start`};function ne(e,t,n,r,i,a){if(!i||a)return{placement:e,top:0,left:0};let[o,s]=e.split(`-`),c=s??`center`,l={top:0,left:0},u=(e,i,a)=>{let o=0,s=0,c=n[e]-t[i]-t[e];return c>0&&r&&(a?s=Q[i]?c:-c:o=Q[i]?c:-c),{left:o,top:s}},d=o===`left`||o===`right`;if(c!==`center`){let r=te[e],i=J[r],a=X[r];if(n[a]>t[a]){if(t[r]+t[a]<n[a]){let e=(n[a]-t[a])/2;t[r]<e||t[i]<e?t[r]<t[i]?(c=Y[s],l=u(a,i,d)):l=u(a,r,d):c=`center`}}else n[a]<t[a]&&t[i]<0&&t[r]>t[i]&&(c=Y[s])}else{let e=o===`bottom`||o===`top`?`left`:`top`,r=J[e],i=X[e],a=(n[i]-t[i])/2;(t[e]<a||t[r]<a)&&(t[e]>t[r]?(c=$[e],l=u(i,e,d)):(c=$[r],l=u(i,r,d)))}let f=o;return t[o]<n[X[o]]&&t[o]<t[J[o]]&&(f=J[o]),{placement:c===`center`?f:`${f}-${c}`,left:l.left,top:l.top}}function re(e,t){return t?ee[e]:Z[e]}function ie(e,t,n,r,i,a){if(a)switch(e){case`bottom-start`:return{top:`${Math.round(n.top-t.top+n.height)}px`,left:`${Math.round(n.left-t.left)}px`,transform:`translateY(-100%)`};case`bottom-end`:return{top:`${Math.round(n.top-t.top+n.height)}px`,left:`${Math.round(n.left-t.left+n.width)}px`,transform:`translateX(-100%) translateY(-100%)`};case`top-start`:return{top:`${Math.round(n.top-t.top)}px`,left:`${Math.round(n.left-t.left)}px`,transform:``};case`top-end`:return{top:`${Math.round(n.top-t.top)}px`,left:`${Math.round(n.left-t.left+n.width)}px`,transform:`translateX(-100%)`};case`right-start`:return{top:`${Math.round(n.top-t.top)}px`,left:`${Math.round(n.left-t.left+n.width)}px`,transform:`translateX(-100%)`};case`right-end`:return{top:`${Math.round(n.top-t.top+n.height)}px`,left:`${Math.round(n.left-t.left+n.width)}px`,transform:`translateX(-100%) translateY(-100%)`};case`left-start`:return{top:`${Math.round(n.top-t.top)}px`,left:`${Math.round(n.left-t.left)}px`,transform:``};case`left-end`:return{top:`${Math.round(n.top-t.top+n.height)}px`,left:`${Math.round(n.left-t.left)}px`,transform:`translateY(-100%)`};case`top`:return{top:`${Math.round(n.top-t.top)}px`,left:`${Math.round(n.left-t.left+n.width/2)}px`,transform:`translateX(-50%)`};case`right`:return{top:`${Math.round(n.top-t.top+n.height/2)}px`,left:`${Math.round(n.left-t.left+n.width)}px`,transform:`translateX(-100%) translateY(-50%)`};case`left`:return{top:`${Math.round(n.top-t.top+n.height/2)}px`,left:`${Math.round(n.left-t.left)}px`,transform:`translateY(-50%)`};default:return{top:`${Math.round(n.top-t.top+n.height)}px`,left:`${Math.round(n.left-t.left+n.width/2)}px`,transform:`translateX(-50%) translateY(-100%)`}}switch(e){case`bottom-start`:return{top:`${Math.round(n.top-t.top+n.height+r)}px`,left:`${Math.round(n.left-t.left+i)}px`,transform:``};case`bottom-end`:return{top:`${Math.round(n.top-t.top+n.height+r)}px`,left:`${Math.round(n.left-t.left+n.width+i)}px`,transform:`translateX(-100%)`};case`top-start`:return{top:`${Math.round(n.top-t.top+r)}px`,left:`${Math.round(n.left-t.left+i)}px`,transform:`translateY(-100%)`};case`top-end`:return{top:`${Math.round(n.top-t.top+r)}px`,left:`${Math.round(n.left-t.left+n.width+i)}px`,transform:`translateX(-100%) translateY(-100%)`};case`right-start`:return{top:`${Math.round(n.top-t.top+r)}px`,left:`${Math.round(n.left-t.left+n.width+i)}px`,transform:``};case`right-end`:return{top:`${Math.round(n.top-t.top+n.height+r)}px`,left:`${Math.round(n.left-t.left+n.width+i)}px`,transform:`translateY(-100%)`};case`left-start`:return{top:`${Math.round(n.top-t.top+r)}px`,left:`${Math.round(n.left-t.left+i)}px`,transform:`translateX(-100%)`};case`left-end`:return{top:`${Math.round(n.top-t.top+n.height+r)}px`,left:`${Math.round(n.left-t.left+i)}px`,transform:`translateX(-100%) translateY(-100%)`};case`top`:return{top:`${Math.round(n.top-t.top+r)}px`,left:`${Math.round(n.left-t.left+n.width/2+i)}px`,transform:`translateY(-100%) translateX(-50%)`};case`right`:return{top:`${Math.round(n.top-t.top+n.height/2+r)}px`,left:`${Math.round(n.left-t.left+n.width+i)}px`,transform:`translateY(-50%)`};case`left`:return{top:`${Math.round(n.top-t.top+n.height/2+r)}px`,left:`${Math.round(n.left-t.left+i)}px`,transform:`translateY(-50%) translateX(-100%)`};default:return{top:`${Math.round(n.top-t.top+n.height+r)}px`,left:`${Math.round(n.left-t.left+n.width/2+i)}px`,transform:`translateX(-50%)`}}}var ae=K([K(`.v-binder-follower-container`,{position:`absolute`,left:`0`,right:`0`,top:`0`,height:`0`,pointerEvents:`none`,zIndex:`auto`}),K(`.v-binder-follower-content`,{position:`absolute`,zIndex:`auto`},[K(`> *`,{pointerEvents:`all`})])]),oe=n({name:`Follower`,inheritAttrs:!1,props:{show:Boolean,enabled:{type:Boolean,default:void 0},placement:{type:String,default:`bottom`},syncTrigger:{type:Array,default:[`resize`,`scroll`]},to:[String,Object],flip:{type:Boolean,default:!0},internalShift:Boolean,x:Number,y:Number,width:String,minWidth:String,containerClass:String,teleportDisabled:Boolean,zindexable:{type:Boolean,default:!0},zIndex:Number,overlap:Boolean},setup(e){let t=l(`VBinder`),n=T(()=>e.enabled===void 0?e.show:e.enabled),i=c(null),o=c(null),p=()=>{let{syncTrigger:n}=e;n.includes(`scroll`)&&t.addScrollListener(g),n.includes(`resize`)&&t.addResizeListener(g)},m=()=>{t.removeScrollListener(g),t.removeResizeListener(g)};d(()=>{n.value&&(g(),p())});let h=f();ae.mount({id:`vueuc/binder`,head:!0,anchorMetaName:q,ssr:h}),r(()=>{m()}),N(()=>{n.value&&g()});let g=()=>{if(!n.value)return;let r=i.value;if(r===null)return;let a=t.targetRef,{x:s,y:c,overlap:l}=e,u=s!==void 0&&c!==void 0?B(s,c):V(a);r.style.setProperty(`--v-target-width`,`${Math.round(u.width)}px`),r.style.setProperty(`--v-target-height`,`${Math.round(u.height)}px`);let{width:d,minWidth:f,placement:p,internalShift:m,flip:h}=e;r.setAttribute(`v-placement`,p),l?r.setAttribute(`v-overlap`,``):r.removeAttribute(`v-overlap`);let{style:g}=r;d===`target`?g.width=`${u.width}px`:d===void 0?g.width=``:g.width=d,f===`target`?g.minWidth=`${u.width}px`:f===void 0?g.minWidth=``:g.minWidth=f;let _=V(r),v=V(o.value),{left:y,top:b,placement:x}=ne(p,u,_,m,h,l),S=re(x,l),{left:C,top:w,transform:T}=ie(x,v,u,b,y,l);r.setAttribute(`v-placement`,x),r.style.setProperty(`--v-offset-left`,`${Math.round(y)}px`),r.style.setProperty(`--v-offset-top`,`${Math.round(b)}px`),r.style.transform=`translateX(${C}) translateY(${w}) ${T}`,r.style.setProperty(`--v-transform-origin`,S),r.style.transformOrigin=S};s(n,e=>{e?(p(),_()):m()});let _=()=>{a().then(g).catch(e=>console.error(e))};[`placement`,`x`,`y`,`internalShift`,`flip`,`width`,`overlap`,`minWidth`].forEach(t=>{s(u(e,t),g)}),[`teleportDisabled`].forEach(t=>{s(u(e,t),_)}),s(u(e,`syncTrigger`),e=>{e.includes(`resize`)?t.addResizeListener(g):t.removeResizeListener(g),e.includes(`scroll`)?t.addScrollListener(g):t.removeScrollListener(g)});let v=E();return{VBinder:t,mergedEnabled:n,offsetContainerRef:o,followerRef:i,mergedTo:T(()=>{let{to:t}=e;if(t!==void 0)return t;v.value}),syncPosition:g}},render(){return t(y,{show:this.show,to:this.mergedTo,disabled:this.teleportDisabled},{default:()=>{var n;let r=t(`div`,{class:[`v-binder-follower-container`,this.containerClass],ref:`offsetContainerRef`},[t(`div`,{class:`v-binder-follower-content`,ref:`followerRef`},(n=this.$slots).default?.call(n))]);return this.zindexable?e(r,[[C,{enabled:this.mergedEnabled,zIndex:this.zIndex}]]):r}})}});export{W as a,P as c,G as i,N as l,K as n,L as o,q as r,F as s,oe as t,A as u}; |