fixed-size-list-94898ca8.js 12 KB

12345678910
  1. <<<<<<<< HEAD:dist/assets/fixed-size-list-94898ca8.js
  2. import{b4 as ht,bp as dt,b5 as mt,d as St,am as gt,aC as pt,r as C,bq as V,K as w,a as r,l as vt,br as wt,bs as yt,M as st,aQ as K,bt as B,an as N,bu as xt,bv as Ot,__tla as Mt}from"./index-d75b4e4d.js";import{H as at,V as bt,v as zt,I as ot,S as rt,u as Tt,i as G,R as J,g as it,a as Rt,b as nt,c as It,B as Et,F as _t,d as Z,A as ct,e as Wt,C as ft,E as $t,f as Lt,h as kt,__tla as Ct}from"./el-virtual-list-d3ea4b87.js";let ut,Y,Dt=Promise.all([(()=>{try{return Mt}catch{}})(),(()=>{try{return Ct}catch{}})()]).then(async()=>{let tt;tt={[at]:"deltaX",[bt]:"deltaY"},Y=({name:u,getOffset:m,getItemSize:S,getItemOffset:E,getEstimatedTotalSize:_,getStartIndexForOffset:z,getStopIndexForStartIndex:T,initCache:g,clearCache:h,validateProps:R})=>St({name:u??"ElVirtualList",props:zt,emits:[ot,rt],setup(e,{emit:d,expose:y}){R(e);const Q=gt(),W=pt("vl"),x=C(g(e,Q)),$=Tt(),I=C(),D=C(),F=C(),i=C({isScrolling:!1,scrollDir:"forward",scrollOffset:V(e.initScrollOffset)?e.initScrollOffset:0,updateRequested:!1,isScrollbarDragging:!1,scrollbarAlwaysOn:e.scrollbarAlwaysOn}),q=w(()=>{const{total:t,cache:l}=e,{isScrolling:a,scrollDir:n,scrollOffset:s}=r(i);if(t===0)return[0,0,0,0];const o=z(e,s,r(x)),f=T(e,o,s,r(x)),c=a&&n!==Et?1:Math.max(1,l),v=a&&n!==_t?1:Math.max(1,l);return[Math.max(0,o-c),Math.max(0,Math.min(t-1,f+v)),o,f]}),p=w(()=>_(e,r(x))),O=w(()=>G(e.layout)),U=w(()=>[{position:"relative",["overflow-"+(O.value?"x":"y")]:"scroll",WebkitOverflowScrolling:"touch",willChange:"transform"},{direction:e.direction,height:V(e.height)?`${e.height}px`:e.height,width:V(e.width)?`${e.width}px`:e.width},e.style]),X=w(()=>{const t=r(p),l=r(O);return{height:l?"100%":`${t}px`,pointerEvents:r(i).isScrolling?"none":void 0,width:l?`${t}px`:"100%"}}),M=w(()=>O.value?e.width:e.height),{onWheel:j}=(({atEndEdge:t,atStartEdge:l,layout:a},n)=>{let s,o=0;const f=c=>c<0&&l.value||c>0&&t.value;return{hasReachedEdge:f,onWheel:c=>{ht(s);const v=c[tt[a.value]];f(o)&&f(o+v)||(o+=v,dt()||c.preventDefault(),s=mt(()=>{n(o),o=0}))}}})({atStartEdge:w(()=>i.value.scrollOffset<=0),atEndEdge:w(()=>i.value.scrollOffset>=p.value),layout:w(()=>e.layout)},t=>{var l,a;(a=(l=F.value).onMouseUp)==null||a.call(l),b(Math.min(i.value.scrollOffset+t,p.value-M.value))}),A=()=>{const{total:t}=e;if(t>0){const[s,o,f,c]=r(q);d(ot,s,o,f,c)}const{scrollDir:l,scrollOffset:a,updateRequested:n}=r(i);d(rt,l,a,n)},b=t=>{(t=Math.max(t,0))!==r(i).scrollOffset&&(i.value={...r(i),scrollOffset:t,scrollDir:Z(r(i).scrollOffset,t),updateRequested:!0},N(L))},H=(t,l=ct)=>{const{scrollOffset:a}=r(i);t=Math.max(0,Math.min(t,e.total-1)),b(m(e,t,l,a,r(x)))},L=()=>{i.value.isScrolling=!1,N(()=>{$.value(-1,null,null)})},k=()=>{const t=I.value;t&&(t.scrollTop=0)};vt(()=>{if(!wt)return;const{initScrollOffset:t}=e,l=r(I);V(t)&&l&&(r(O)?l.scrollLeft=t:l.scrollTop=t),A()}),yt(()=>{const{direction:t,layout:l}=e,{scrollOffset:a,updateRequested:n}=r(i),s=r(I);if(n&&s)if(l===at)if(t===J)switch(it()){case nt:s.scrollLeft=-a;break;case Rt:s.scrollLeft=a;break;default:{const{clientWidth:o,scrollWidth:f}=s;s.scrollLeft=f-o-a;break}}else s.scrollLeft=a;else s.scrollTop=a});const P={ns:W,clientSize:M,estimatedTotalSize:p,windowStyle:U,windowRef:I,innerRef:D,innerStyle:X,itemsToRender:q,scrollbarRef:F,states:i,getItemStyle:t=>{const{direction:l,itemSize:a,layout:n}=e,s=$.value(h&&a,h&&n,h&&l);let o;if(xt(s,String(t)))o=s[t];else{const f=E(e,t,r(x)),c=S(e,t,r(x)),v=r(O),et=l===J,lt=v?f:0;s[t]=o={position:"absolute",left:et?void 0:`${lt}px`,right:et?`${lt}px`:void 0,top:v?0:`${f}px`,height:v?"100%":`${c}px`,width:v?`${c}px`:"100%"}}return o},onScroll:t=>{r(O)?(l=>{const{clientWidth:a,scrollLeft:n,scrollWidth:s}=l.currentTarget,o=r(i);if(o.scrollOffset===n)return;const{direction:f}=e;let c=n;if(f===J)switch(it()){case nt:c=-n;break;case Wt:c=s-a-n}c=Math.max(0,Math.min(c,s-a)),i.value={...o,isScrolling:!0,scrollDir:Z(o.scrollOffset,c),scrollOffset:c,updateRequested:!1},N(L)})(t):(l=>{const{clientHeight:a,scrollHeight:n,scrollTop:s}=l.currentTarget,o=r(i);if(o.scrollOffset===s)return;const f=Math.max(0,Math.min(s,n-a));i.value={...o,isScrolling:!0,scrollDir:Z(o.scrollOffset,f),scrollOffset:f,updateRequested:!1},N(L)})(t),A()},onScrollbarScroll:(t,l)=>{const a=(p.value-M.value)/l*t;b(Math.min(p.value-M.value,a))},onWheel:j,scrollTo:b,scrollToItem:H,resetScrollTop:k};return y({windowRef:I,innerRef:D,getItemStyleCache:$,scrollTo:b,scrollToItem:H,resetScrollTop:k,states:i}),P},render(e){var d;const{$slots:y,className:Q,clientSize:W,containerElement:x,data:$,getItemStyle:I,innerElement:D,itemsToRender:F,innerStyle:i,layout:q,total:p,onScroll:O,onScrollbarScroll:U,onWheel:X,states:M,useIsScrolling:j,windowStyle:A,ns:b}=e,[H,L]=F,k=st(x),P=st(D),t=[];if(p>0)for(let s=H;s<=L;s++)t.push((d=y.default)==null?void 0:d.call(y,{data:$,key:s,index:s,isScrolling:j?M.isScrolling:void 0,style:I(s)}));const l=[K(P,{style:i,ref:"innerRef"},B(P)?t:{default:()=>t})],a=K(It,{ref:"scrollbarRef",clientSize:W,layout:q,onScroll:U,ratio:100*W/this.estimatedTotalSize,scrollFrom:M.scrollOffset/(this.estimatedTotalSize-W),total:p}),n=K(k,{class:[b.e("window"),Q],style:A,onScroll:O,onWheel:X,ref:"windowRef",key:0},B(k)?[l]:{default:()=>[l]});return K("div",{key:0,class:[b.e("wrapper"),M.scrollbarAlwaysOn?"always-on":""]},[n,a])}}),ut=Y({name:"ElFixedSizeList",getItemOffset:({itemSize:u},m)=>m*u,getItemSize:({itemSize:u})=>u,getEstimatedTotalSize:({total:u,itemSize:m})=>m*u,getOffset:({height:u,total:m,itemSize:S,layout:E,width:_},z,T,g)=>{const h=G(E)?_:u;B(h)&&Ot("[ElVirtualList]",`
  3. ========
  4. import{b4 as ht,bp as dt,b5 as mt,d as St,am as gt,aC as pt,r as C,bq as V,K as w,a as r,l as vt,br as wt,bs as yt,M as st,aQ as K,bt as B,an as N,bu as xt,bv as Ot,__tla as Mt}from"./index-c9fff140.js";import{H as at,V as bt,v as zt,I as ot,S as rt,u as Tt,i as G,R as J,g as it,a as Rt,b as nt,c as It,B as Et,F as _t,d as Z,A as ct,e as Wt,C as ft,E as $t,f as Lt,h as kt,__tla as Ct}from"./el-virtual-list-57272667.js";let ut,Y,Dt=Promise.all([(()=>{try{return Mt}catch{}})(),(()=>{try{return Ct}catch{}})()]).then(async()=>{let tt;tt={[at]:"deltaX",[bt]:"deltaY"},Y=({name:u,getOffset:m,getItemSize:S,getItemOffset:E,getEstimatedTotalSize:_,getStartIndexForOffset:z,getStopIndexForStartIndex:T,initCache:g,clearCache:h,validateProps:R})=>St({name:u??"ElVirtualList",props:zt,emits:[ot,rt],setup(e,{emit:d,expose:y}){R(e);const Q=gt(),W=pt("vl"),x=C(g(e,Q)),$=Tt(),I=C(),D=C(),F=C(),i=C({isScrolling:!1,scrollDir:"forward",scrollOffset:V(e.initScrollOffset)?e.initScrollOffset:0,updateRequested:!1,isScrollbarDragging:!1,scrollbarAlwaysOn:e.scrollbarAlwaysOn}),q=w(()=>{const{total:t,cache:l}=e,{isScrolling:a,scrollDir:n,scrollOffset:s}=r(i);if(t===0)return[0,0,0,0];const o=z(e,s,r(x)),f=T(e,o,s,r(x)),c=a&&n!==Et?1:Math.max(1,l),v=a&&n!==_t?1:Math.max(1,l);return[Math.max(0,o-c),Math.max(0,Math.min(t-1,f+v)),o,f]}),p=w(()=>_(e,r(x))),O=w(()=>G(e.layout)),U=w(()=>[{position:"relative",["overflow-"+(O.value?"x":"y")]:"scroll",WebkitOverflowScrolling:"touch",willChange:"transform"},{direction:e.direction,height:V(e.height)?`${e.height}px`:e.height,width:V(e.width)?`${e.width}px`:e.width},e.style]),X=w(()=>{const t=r(p),l=r(O);return{height:l?"100%":`${t}px`,pointerEvents:r(i).isScrolling?"none":void 0,width:l?`${t}px`:"100%"}}),M=w(()=>O.value?e.width:e.height),{onWheel:j}=(({atEndEdge:t,atStartEdge:l,layout:a},n)=>{let s,o=0;const f=c=>c<0&&l.value||c>0&&t.value;return{hasReachedEdge:f,onWheel:c=>{ht(s);const v=c[tt[a.value]];f(o)&&f(o+v)||(o+=v,dt()||c.preventDefault(),s=mt(()=>{n(o),o=0}))}}})({atStartEdge:w(()=>i.value.scrollOffset<=0),atEndEdge:w(()=>i.value.scrollOffset>=p.value),layout:w(()=>e.layout)},t=>{var l,a;(a=(l=F.value).onMouseUp)==null||a.call(l),b(Math.min(i.value.scrollOffset+t,p.value-M.value))}),A=()=>{const{total:t}=e;if(t>0){const[s,o,f,c]=r(q);d(ot,s,o,f,c)}const{scrollDir:l,scrollOffset:a,updateRequested:n}=r(i);d(rt,l,a,n)},b=t=>{(t=Math.max(t,0))!==r(i).scrollOffset&&(i.value={...r(i),scrollOffset:t,scrollDir:Z(r(i).scrollOffset,t),updateRequested:!0},N(L))},H=(t,l=ct)=>{const{scrollOffset:a}=r(i);t=Math.max(0,Math.min(t,e.total-1)),b(m(e,t,l,a,r(x)))},L=()=>{i.value.isScrolling=!1,N(()=>{$.value(-1,null,null)})},k=()=>{const t=I.value;t&&(t.scrollTop=0)};vt(()=>{if(!wt)return;const{initScrollOffset:t}=e,l=r(I);V(t)&&l&&(r(O)?l.scrollLeft=t:l.scrollTop=t),A()}),yt(()=>{const{direction:t,layout:l}=e,{scrollOffset:a,updateRequested:n}=r(i),s=r(I);if(n&&s)if(l===at)if(t===J)switch(it()){case nt:s.scrollLeft=-a;break;case Rt:s.scrollLeft=a;break;default:{const{clientWidth:o,scrollWidth:f}=s;s.scrollLeft=f-o-a;break}}else s.scrollLeft=a;else s.scrollTop=a});const P={ns:W,clientSize:M,estimatedTotalSize:p,windowStyle:U,windowRef:I,innerRef:D,innerStyle:X,itemsToRender:q,scrollbarRef:F,states:i,getItemStyle:t=>{const{direction:l,itemSize:a,layout:n}=e,s=$.value(h&&a,h&&n,h&&l);let o;if(xt(s,String(t)))o=s[t];else{const f=E(e,t,r(x)),c=S(e,t,r(x)),v=r(O),et=l===J,lt=v?f:0;s[t]=o={position:"absolute",left:et?void 0:`${lt}px`,right:et?`${lt}px`:void 0,top:v?0:`${f}px`,height:v?"100%":`${c}px`,width:v?`${c}px`:"100%"}}return o},onScroll:t=>{r(O)?(l=>{const{clientWidth:a,scrollLeft:n,scrollWidth:s}=l.currentTarget,o=r(i);if(o.scrollOffset===n)return;const{direction:f}=e;let c=n;if(f===J)switch(it()){case nt:c=-n;break;case Wt:c=s-a-n}c=Math.max(0,Math.min(c,s-a)),i.value={...o,isScrolling:!0,scrollDir:Z(o.scrollOffset,c),scrollOffset:c,updateRequested:!1},N(L)})(t):(l=>{const{clientHeight:a,scrollHeight:n,scrollTop:s}=l.currentTarget,o=r(i);if(o.scrollOffset===s)return;const f=Math.max(0,Math.min(s,n-a));i.value={...o,isScrolling:!0,scrollDir:Z(o.scrollOffset,f),scrollOffset:f,updateRequested:!1},N(L)})(t),A()},onScrollbarScroll:(t,l)=>{const a=(p.value-M.value)/l*t;b(Math.min(p.value-M.value,a))},onWheel:j,scrollTo:b,scrollToItem:H,resetScrollTop:k};return y({windowRef:I,innerRef:D,getItemStyleCache:$,scrollTo:b,scrollToItem:H,resetScrollTop:k,states:i}),P},render(e){var d;const{$slots:y,className:Q,clientSize:W,containerElement:x,data:$,getItemStyle:I,innerElement:D,itemsToRender:F,innerStyle:i,layout:q,total:p,onScroll:O,onScrollbarScroll:U,onWheel:X,states:M,useIsScrolling:j,windowStyle:A,ns:b}=e,[H,L]=F,k=st(x),P=st(D),t=[];if(p>0)for(let s=H;s<=L;s++)t.push((d=y.default)==null?void 0:d.call(y,{data:$,key:s,index:s,isScrolling:j?M.isScrolling:void 0,style:I(s)}));const l=[K(P,{style:i,ref:"innerRef"},B(P)?t:{default:()=>t})],a=K(It,{ref:"scrollbarRef",clientSize:W,layout:q,onScroll:U,ratio:100*W/this.estimatedTotalSize,scrollFrom:M.scrollOffset/(this.estimatedTotalSize-W),total:p}),n=K(k,{class:[b.e("window"),Q],style:A,onScroll:O,onWheel:X,ref:"windowRef",key:0},B(k)?[l]:{default:()=>[l]});return K("div",{key:0,class:[b.e("wrapper"),M.scrollbarAlwaysOn?"always-on":""]},[n,a])}}),ut=Y({name:"ElFixedSizeList",getItemOffset:({itemSize:u},m)=>m*u,getItemSize:({itemSize:u})=>u,getEstimatedTotalSize:({total:u,itemSize:m})=>m*u,getOffset:({height:u,total:m,itemSize:S,layout:E,width:_},z,T,g)=>{const h=G(E)?_:u;B(h)&&Ot("[ElVirtualList]",`
  5. >>>>>>>> 2589804fb89eb98fd6498c1ee41a354dcce32af3:dist/assets/fixed-size-list-c6afd5ad.js
  6. You should set
  7. width/height
  8. to number when your layout is
  9. horizontal/vertical
  10. `);const R=Math.max(0,m*S-h),e=Math.min(R,z*S),d=Math.max(0,(z+1)*S-h);switch(T===kt&&(T=g>=d-h&&g<=e+h?ct:ft),T){case Lt:return e;case $t:return d;case ft:{const y=Math.round(d+(e-d)/2);return y<Math.ceil(h/2)?0:y>R+Math.floor(h/2)?R:y}default:return g>=d&&g<=e?g:g<d?d:e}},getStartIndexForOffset:({total:u,itemSize:m},S)=>Math.max(0,Math.min(u-1,Math.floor(S/m))),getStopIndexForStartIndex:({height:u,total:m,itemSize:S,layout:E,width:_},z,T)=>{const g=z*S,h=G(E)?_:u,R=Math.ceil((h+T-g)/S);return Math.max(0,Math.min(m-1,z+R-1))},initCache(){},clearCache:!0,validateProps(){}})});export{ut as F,Dt as __tla,Y as c};