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