"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "TBody", {
    enumerable: true,
    get: function() {
        return TBody;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _react = require("react");
const _tableContext = require("./tableContext");
const _row = require("./row");
const TBody = (props)=>{
    const { dataSource, columns, expandedRowKeys, canExpand, toggleExpandRow } = (0, _react.useContext)(_tableContext.TableContext);
    return /*#__PURE__*/ (0, _jsxruntime.jsx)("tbody", {
        className: "orderly-ui-table-body",
        children: dataSource?.map((record, index)=>{
            const key = typeof props.generatedRowKey === "function" ? props.generatedRowKey(record, index) : `${index}`; /// `record.ts_${record.price}_${record.size}_${index}`;
            const row = /*#__PURE__*/ (0, _jsxruntime.jsx)(_row.Row, {
                rowKey: key,
                index: index,
                columns: columns,
                record: record,
                canExpand: canExpand,
                justified: props.justified,
                bordered: props.bordered,
                onRow: props.onRow,
                onToggleExpand: toggleExpandRow,
                expanded: !!expandedRowKeys?.includes(key),
                expandRowRender: props.expandRowRender
            }, key);
            if (typeof props.renderRowContainer === "function") {
                return /*#__PURE__*/ (0, _jsxruntime.jsx)(_react.Fragment, {
                    children: props.renderRowContainer(record, index, row)
                }, key);
            }
            return row;
        })
    });
};

//# sourceMappingURL=tbody.js.map