import{c as $,a as ee,b as ae,d as te,u as oe,p as le,e as re,f as se,g as de,h as ue,i as ne,j as ie,k as T,l as V,m as x,n as ce,o as me,q as ge}from"./VDataTable-CYPG0MtF.js";import{v as ve,x as be,W as pe,h as g,ac as o,Y as Pe,a as s,B as w,e as i,F as B,ai as fe}from"./index-CTxlYqj4.js";import{V as I}from"./VTable-B-HE2nmK.js";import{c as he}from"./forwardRefs-BSESyuUp.js";import{u as ye}from"./tag-Dx3OexMp.js";const De=be({itemsLength:{type:[Number,String],required:!0},...ge(),...me(),...ce()},"VDataTableServer"),Be=ve()({name:"VDataTableServer",props:De(),emits:{"update:modelValue":e=>!0,"update:page":e=>!0,"update:itemsPerPage":e=>!0,"update:sortBy":e=>!0,"update:options":e=>!0,"update:expanded":e=>!0,"update:groupBy":e=>!0},setup(e,k){let{attrs:F,slots:a}=k;const{groupBy:d}=$(e),{sortBy:l,multiSort:R,mustSort:G}=ee(e),{page:u,itemsPerPage:c}=ae(e),{disableSort:H}=pe(e),E=g(()=>parseInt(e.itemsLength,10)),{columns:v,headers:N}=te(e,{groupBy:d,showSelect:o(()=>e.showSelect),showExpand:o(()=>e.showExpand)}),{items:n}=oe(e,v),{toggleSort:b}=le({sortBy:l,multiSort:R,mustSort:G,page:u}),{opened:_,isGroupOpen:C,toggleGroup:L,extractRows:q}=re({groupBy:d,sortBy:l,disableSort:H}),{pageCount:O,setItemsPerPage:W}=se({page:u,itemsPerPage:c,itemsLength:E}),{flatItems:p}=de(n,d,_),{isSelected:j,select:A,selectAll:Y,toggleSelect:z,someSelected:J,allSelected:K}=ue(e,{allItems:n,currentPage:n}),{isExpanded:M,toggleExpand:Q}=ne(e),P=g(()=>q(n.value));ie({page:u,itemsPerPage:c,sortBy:l,groupBy:d,search:o(()=>e.search)}),fe("v-data-table",{toggleSort:b,sortBy:l}),Pe({VDataTableRows:{hideNoData:o(()=>e.hideNoData),noDataText:o(()=>e.noDataText),loading:o(()=>e.loading),loadingText:o(()=>e.loadingText)}});const t=g(()=>({page:u.value,itemsPerPage:c.value,sortBy:l.value,pageCount:O.value,toggleSort:b,setItemsPerPage:W,someSelected:J.value,allSelected:K.value,isSelected:j,select:A,selectAll:Y,toggleSelect:z,isExpanded:M,toggleExpand:Q,isGroupOpen:C,toggleGroup:L,items:P.value.map(m=>m.raw),internalItems:P.value,groupedItems:p.value,columns:v.value,headers:N.value}));ye(()=>{const m=T.filterProps(e),U=V.filterProps(e),X=x.filterProps(e),Z=I.filterProps(e);return s(I,w({class:["v-data-table",{"v-data-table--loading":e.loading},e.class],style:e.style},Z,{fixedHeader:e.fixedHeader||e.sticky}),{top:()=>{var r;return(r=a.top)==null?void 0:r.call(a,t.value)},default:()=>{var r,f,h,y,D,S;return a.default?a.default(t.value):i(B,null,[(r=a.colgroup)==null?void 0:r.call(a,t.value),!e.hideDefaultHeader&&i("thead",{key:"thead",class:"v-data-table__thead",role:"rowgroup"},[s(V,U,a)]),(f=a.thead)==null?void 0:f.call(a,t.value),!e.hideDefaultBody&&i("tbody",{class:"v-data-table__tbody",role:"rowgroup"},[(h=a["body.prepend"])==null?void 0:h.call(a,t.value),a.body?a.body(t.value):s(x,w(F,X,{items:p.value}),a),(y=a["body.append"])==null?void 0:y.call(a,t.value)]),(D=a.tbody)==null?void 0:D.call(a,t.value),(S=a.tfoot)==null?void 0:S.call(a,t.value)])},bottom:()=>a.bottom?a.bottom(t.value):!e.hideDefaultFooter&&i(B,null,[s(he,null,null),s(T,m,{prepend:a["footer.prepend"]})])})})}});export{Be as V};
