import{useInjectTable as e}from"../context/TableContext.mjs";import{useProvideHover as t}from"../context/HoverContext.mjs";import{getColumnsKey as n}from"../utils/valueUtil.mjs";import{useInjectBody as r}from"../context/BodyContext.mjs";import{useInjectResize as i}from"../context/ResizeContext.mjs";import a from"../hooks/useFlattenRecords.mjs";import o from"./ExpandedRow.mjs";import s from"./BodyRow.mjs";import c from"./MeasureCell.mjs";import{createVNode as l,defineComponent as u,shallowRef as d,toRef as f}from"vue";var p=u({name:`TableBody`,props:[`data`,`getRowKey`,`measureColumnWidth`,`expandedKeys`,`customRow`,`rowExpandable`,`childrenColumnName`],setup(u,{slots:p}){let m=i(),h=e(),g=r(),_=a(f(u,`data`),f(u,`childrenColumnName`),f(u,`expandedKeys`),f(u,`getRowKey`)),v=d(-1),y=d(-1),b;return t({startRow:v,endRow:y,onHover:(e,t)=>{clearTimeout(b),b=setTimeout(()=>{v.value=e,y.value=t},100)}}),()=>{let{data:e,getRowKey:t,measureColumnWidth:r,expandedKeys:i,customRow:a,rowExpandable:d,childrenColumnName:f}=u,{onColumnResize:v}=m,{prefixCls:y,getComponent:b}=h,{flattenColumns:x}=g,S=b([`body`,`wrapper`],`tbody`),C=b([`body`,`row`],`tr`),w=b([`body`,`cell`],`td`),T;T=e.length?_.value.map((e,n)=>{let{record:r,indent:o,index:c}=e,u=t(r,n);return l(s,{key:u,rowKey:u,record:r,recordKey:u,index:n,renderIndex:c,rowComponent:C,cellComponent:w,expandedKeys:i,customRow:a,getRowKey:t,rowExpandable:d,childrenColumnName:f,indent:o},null)}):l(o,{expanded:!0,class:`${y}-placeholder`,prefixCls:y,component:C,cellComponent:w,colSpan:x.length,isEmpty:!0},{default:()=>[p.emptyNode?.()]});let E=n(x);return l(S,{class:`${y}-tbody`},{default:()=>[r&&l(`tr`,{"aria-hidden":`true`,class:`${y}-measure-row`,style:{height:0,fontSize:0}},[E.map(e=>l(c,{key:e,columnKey:e,onColumnResize:v},null))]),T]})}}});export{p as default};