const e=require("../../_util/classNames.js"),t=require("../context/TableContext.js"),n=require("../utils/valueUtil.js"),r=require("../Cell/index.js"),i=require("../context/BodyContext.js"),a=require("./ExpandedRow.js");let o=require("vue");var s=(0,o.defineComponent)({name:`BodyRow`,inheritAttrs:!1,props:[`record`,`index`,`renderIndex`,`recordKey`,`expandedKeys`,`rowComponent`,`cellComponent`,`customRow`,`rowExpandable`,`indent`,`rowKey`,`getRowKey`,`childrenColumnName`],setup(s,{attrs:c}){let l=t.useInjectTable(),u=i.useInjectBody(),d=(0,o.shallowRef)(!1),f=(0,o.computed)(()=>s.expandedKeys&&s.expandedKeys.has(s.recordKey));(0,o.watchEffect)(()=>{f.value&&(d.value=!0)});let p=(0,o.computed)(()=>u.expandableType===`row`&&(!s.rowExpandable||s.rowExpandable(s.record))),m=(0,o.computed)(()=>u.expandableType===`nest`),h=(0,o.computed)(()=>s.childrenColumnName&&s.record&&s.record[s.childrenColumnName]),g=(0,o.computed)(()=>p.value||m.value),_=(e,t)=>{u.onTriggerExpand(e,t)},v=(0,o.computed)(()=>s.customRow?.(s.record,s.index)||{}),y=(e,...t)=>{u.expandRowByClick&&g.value&&_(s.record,e),v.value?.onClick?.(e,...t)},b=(0,o.computed)(()=>{let{record:e,index:t,indent:n}=s,{rowClassName:r}=u;return typeof r==`string`?r:typeof r==`function`?r(e,t,n):``}),x=(0,o.computed)(()=>n.getColumnsKey(u.flattenColumns));return()=>{let{class:t,style:n}=c,{record:i,index:g,rowKey:S,indent:C=0,rowComponent:w,cellComponent:T}=s,{prefixCls:E,fixedInfoList:D,transformCellText:O}=l,{flattenColumns:k,expandedRowClassName:A,indentSize:j,expandIcon:M,expandedRowRender:N,expandIconColumnIndex:P}=u,F=(0,o.createVNode)(w,{...v.value,"data-row-key":S,class:e.default(t,`${E}-row`,`${E}-row-level-${C}`,b.value,v.value.class),style:[n,v.value.style],onClick:y},{default:()=>[k.map((e,t)=>{let{customRender:n,dataIndex:a,className:c}=e,l=x[t],u=D[t],d;e.customCell&&(d=e.customCell(i,g,e));let p=t===(P||0)&&m.value?(0,o.createVNode)(o.Fragment,null,[(0,o.createVNode)(`span`,{style:{paddingLeft:`${j*C}px`},class:`${E}-row-indent indent-level-${C}`},null),M({prefixCls:E,expanded:f.value,expandable:h.value,record:i,onExpand:_})]):null;return(0,o.createVNode)(r.default,{cellType:`body`,class:c,ellipsis:e.ellipsis,align:e.align,component:T,prefixCls:E,key:l,record:i,index:g,renderIndex:s.renderIndex,dataIndex:a,customRender:n,...u,additionalProps:d,column:e,transformCellText:O,appendNode:p},null)})]}),I;if(p.value&&(d.value||f.value)){let t=N({record:i,index:g,indent:C+1,expanded:f.value}),n=A&&A(i,g,C);I=(0,o.createVNode)(a.default,{expanded:f.value,class:e.default(`${E}-expanded-row`,`${E}-expanded-row-level-${C+1}`,n),prefixCls:E,component:w,cellComponent:T,colSpan:k.length,isEmpty:!1},{default:()=>[t]})}return(0,o.createVNode)(o.Fragment,null,[F,I])}}});exports.default=s;