import{c as ge,a as be,d as fe,u as ye,p as pe,e as Ve,r as xe,g as Te,h as De,i as Ie,j as we,l as S,m as R,s as Se,o as Re,t as Be}from"./VDataTable-CYPG0MtF.js";import{u as Pe,m as ke,a as Fe}from"./VSelect-tV4GZAtn.js";import{v as Ge,x as He,W as Ee,ac as s,h as g,ab as B,Y as Ne,a as d,B as b,U as Ue,e as o,a7 as f}from"./index-CTxlYqj4.js";import{u as Oe,m as We}from"./filter-DaBUD6Rp.js";import{V as P}from"./VTable-B-HE2nmK.js";import{u as _e}from"./tag-Dx3OexMp.js";const je=He({...Ue(Re(),["hideDefaultFooter"]),...Se(),...ke(),...We()},"VDataTableVirtual"),Je=Ge()({name:"VDataTableVirtual",props:je(),emits:{"update:modelValue":e=>!0,"update:sortBy":e=>!0,"update:options":e=>!0,"update:groupBy":e=>!0,"update:expanded":e=>!0},setup(e,k){let{attrs:F,slots:a}=k;const{groupBy:u}=ge(e),{sortBy:i,multiSort:G,mustSort:H}=be(e),{disableSort:E}=Ee(e),{columns:c,headers:N,filterFunctions:U,sortFunctions:O,sortRawFunctions:W}=fe(e,{groupBy:u,showSelect:s(()=>e.showSelect),showExpand:s(()=>e.showExpand)}),{items:_}=ye(e,c),y=s(()=>e.search),{filteredItems:j}=Oe(e,_,y,{transform:t=>t.columns,customKeyFilter:U}),{toggleSort:z}=pe({sortBy:i,multiSort:G,mustSort:H}),{sortByWithGroups:A,opened:C,extractRows:K,isGroupOpen:Y,toggleGroup:q}=Ve({groupBy:u,sortBy:i,disableSort:E}),{sortedItems:J}=xe(e,j,A,{transform:t=>({...t.raw,...t.columns}),sortFunctions:O,sortRawFunctions:W}),{flatItems:v}=Te(J,u,C),m=g(()=>K(v.value)),{isSelected:L,select:M,selectAll:Q,toggleSelect:X,someSelected:Z,allSelected:$}=De(e,{allItems:m,currentPage:m}),{isExpanded:ee,toggleExpand:ae}=Ie(e),{containerRef:te,markerRef:le,paddingTop:re,paddingBottom:oe,computedItems:se,handleItemResize:ne,handleScroll:de,handleScrollend:ue,calculateVisibleItems:ie,scrollToIndex:ce}=Pe(e,v),me=g(()=>se.value.map(t=>t.raw));we({sortBy:i,page:B(1),itemsPerPage:B(-1),groupBy:u,search:y}),Ne({VDataTableRows:{hideNoData:s(()=>e.hideNoData),noDataText:s(()=>e.noDataText),loading:s(()=>e.loading),loadingText:s(()=>e.loadingText)}});const l=g(()=>({sortBy:i.value,toggleSort:z,someSelected:Z.value,allSelected:$.value,isSelected:L,select:M,selectAll:Q,toggleSelect:X,isExpanded:ee,toggleExpand:ae,isGroupOpen:Y,toggleGroup:q,items:m.value.map(t=>t.raw),internalItems:m.value,groupedItems:v.value,columns:c.value,headers:N.value}));return _e(()=>{const t=S.filterProps(e),ve=R.filterProps(e),he=P.filterProps(e);return d(P,b({class:["v-data-table",{"v-data-table--loading":e.loading},e.class],style:e.style},he,{fixedHeader:e.fixedHeader||e.sticky}),{top:()=>{var r;return(r=a.top)==null?void 0:r.call(a,l.value)},wrapper:()=>{var r,p,V,x,T,D;return o("div",{ref:te,onScrollPassive:de,onScrollend:ue,class:"v-table__wrapper",style:{height:f(e.height)}},[o("table",null,[(r=a.colgroup)==null?void 0:r.call(a,l.value),!e.hideDefaultHeader&&o("thead",{key:"thead"},[d(S,t,a)]),(p=a.thead)==null?void 0:p.call(a,l.value),!e.hideDefaultBody&&o("tbody",{key:"tbody"},[o("tr",{ref:le,style:{height:f(re.value),border:0}},[o("td",{colspan:c.value.length,style:{height:0,border:0}},null)]),(V=a["body.prepend"])==null?void 0:V.call(a,l.value),d(R,b(F,ve,{items:me.value}),{...a,item:n=>d(Fe,{key:n.internalItem.index,renderless:!0,"onUpdate:height":h=>ne(n.internalItem.index,h)},{default:h=>{var w;let{itemRef:I}=h;return((w=a.item)==null?void 0:w.call(a,{...n,itemRef:I}))??d(Be,b(n.props,{ref:I,key:n.internalItem.index,index:n.internalItem.index}),a)}})}),(x=a["body.append"])==null?void 0:x.call(a,l.value),o("tr",{style:{height:f(oe.value),border:0}},[o("td",{colspan:c.value.length,style:{height:0,border:0}},null)])]),(T=a.tbody)==null?void 0:T.call(a,l.value),(D=a.tfoot)==null?void 0:D.call(a,l.value)])])},bottom:()=>{var r;return(r=a.bottom)==null?void 0:r.call(a,l.value)}})}),{calculateVisibleItems:ie,scrollToIndex:ce}}});export{Je as V};
