1 line
4.1 KiB
JavaScript
1 line
4.1 KiB
JavaScript
import{c as R,i as E,e as _,l as P,p as H,a,h as r,b as K,g as Q,d as N,r as d,f as O,j as b,k as p,w as V,o as I,m as U,_ as A,n as D,q as G,s as J,t as X,u as C,v as y,x as L}from"./index.a72ef313.js";import{Q as Y,a as q}from"./QResizeObserver.60d75b0c.js";var Z=R({name:"QPageContainer",setup(t,{slots:h}){const{proxy:{$q:s}}=Q(),o=E(P,_);if(o===_)return console.error("QPageContainer needs to be child of QLayout"),_;H(N,!0);const u=a(()=>{const l={};return o.header.space===!0&&(l.paddingTop=`${o.header.size}px`),o.right.space===!0&&(l[`padding${s.lang.rtl===!0?"Left":"Right"}`]=`${o.right.size}px`),o.footer.space===!0&&(l.paddingBottom=`${o.footer.size}px`),o.left.space===!0&&(l[`padding${s.lang.rtl===!0?"Right":"Left"}`]=`${o.left.size}px`),l});return()=>r("div",{class:"q-page-container",style:u.value},K(h.default))}}),ee=R({name:"QLayout",props:{container:Boolean,view:{type:String,default:"hhh lpr fff",validator:t=>/^(h|l)h(h|r) lpr (f|l)f(f|r)$/.test(t.toLowerCase())},onScroll:Function,onScrollHeight:Function,onResize:Function},setup(t,{slots:h,emit:s}){const{proxy:{$q:o}}=Q(),u=d(null),l=d(o.screen.height),f=d(t.container===!0?0:o.screen.width),z=d({position:0,direction:"down",inflectionPoint:0}),m=d(0),i=d(O.value===!0?0:b()),T=a(()=>"q-layout q-layout--"+(t.container===!0?"containerized":"standard")),B=a(()=>t.container===!1?{minHeight:o.screen.height+"px"}:null),F=a(()=>i.value!==0?{[o.lang.rtl===!0?"left":"right"]:`${i.value}px`}:null),W=a(()=>i.value!==0?{[o.lang.rtl===!0?"right":"left"]:0,[o.lang.rtl===!0?"left":"right"]:`-${i.value}px`,width:`calc(100% + ${i.value}px)`}:null);function k(e){if(t.container===!0||document.qScrollPrevented!==!0){const n={position:e.position.top,direction:e.direction,directionChanged:e.directionChanged,inflectionPoint:e.inflectionPoint.top,delta:e.delta.top};z.value=n,t.onScroll!==void 0&&s("scroll",n)}}function M(e){const{height:n,width:c}=e;let v=!1;l.value!==n&&(v=!0,l.value=n,t.onScrollHeight!==void 0&&s("scrollHeight",n),S()),f.value!==c&&(v=!0,f.value=c),v===!0&&t.onResize!==void 0&&s("resize",e)}function j({height:e}){m.value!==e&&(m.value=e,S())}function S(){if(t.container===!0){const e=l.value>m.value?b():0;i.value!==e&&(i.value=e)}}let g=null;const $={instances:{},view:a(()=>t.view),isContainer:a(()=>t.container),rootRef:u,height:l,containerHeight:m,scrollbarWidth:i,totalWidth:a(()=>f.value+i.value),rows:a(()=>{const e=t.view.toLowerCase().split(" ");return{top:e[0].split(""),middle:e[1].split(""),bottom:e[2].split("")}}),header:p({size:0,offset:0,space:!1}),right:p({size:300,offset:0,space:!1}),footer:p({size:0,offset:0,space:!1}),left:p({size:300,offset:0,space:!1}),scroll:z,animate(){g!==null?clearTimeout(g):document.body.classList.add("q-body--layout-animate"),g=setTimeout(()=>{g=null,document.body.classList.remove("q-body--layout-animate")},155)},update(e,n,c){$[e][n]=c}};if(H(P,$),b()>0){let c=function(){e=null,n.classList.remove("hide-scrollbar")},v=function(){if(e===null){if(n.scrollHeight>o.screen.height)return;n.classList.add("hide-scrollbar")}else clearTimeout(e);e=setTimeout(c,300)},w=function(x){e!==null&&x==="remove"&&(clearTimeout(e),c()),window[`${x}EventListener`]("resize",v)},e=null;const n=document.body;V(()=>t.container!==!0?"add":"remove",w),t.container!==!0&&w("add"),I(()=>{w("remove")})}return()=>{const e=U(h.default,[r(Y,{onScroll:k}),r(q,{onResize:M})]),n=r("div",{class:T.value,style:B.value,ref:t.container===!0?void 0:u,tabindex:-1},e);return t.container===!0?r("div",{class:"q-layout-container overflow-hidden",ref:u},[r(q,{onResize:j}),r("div",{class:"absolute-full",style:F.value},[r("div",{class:"scroll",style:W.value},[n])])]):n}}});const te=D({name:"MainLayout",setup(){return{}}}),oe={class:"row q-mb-sm q-mt-md"},ne=y("div",{class:"col-lg-2 col-md-1 col-sm-0"},null,-1),le={class:"col-lg-8 col-md-10 col-sm-12 auto-width q-pl-md q-pr-md"},ie=y("div",{class:"col-lg-2 col-md-1 col-sm-0"},null,-1);function ae(t,h,s,o,u,l){const f=G("router-view");return J(),X(ee,{view:"lHh Lpr lFf"},{default:C(()=>[y("div",oe,[ne,y("div",le,[L(Z,null,{default:C(()=>[L(f)]),_:1})]),ie])]),_:1})}var ce=A(te,[["render",ae]]);export{ce as default};
|