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