UNPKG

owl-rich-table

Version:

富文本编辑表格,react组件

35 lines (34 loc) 1.24 kB
import { useContext } from 'react'; import TableDataContext from "../../context/TableDataContext"; import TableColgroup from "../table-colgroup"; import Tr from "../table-tr"; /** * @description table表格view * @author Huang Wenjie * @createDate 2023-10-19 */ import { jsx as _jsx } from "react/jsx-runtime"; import { jsxs as _jsxs } from "react/jsx-runtime"; export default function Table() { var _tableRenderData$valu; var _useContext = useContext(TableDataContext), tableRenderData = _useContext.tableRenderData, tableRef = _useContext.tableRef; return /*#__PURE__*/_jsxs("table", { ref: tableRef, className: "rich-table", border: 1 // style={{ // maxWidth: tableRenderData?.width?.reduce((cur, next) => cur + next), // }} , children: [/*#__PURE__*/_jsx(TableColgroup, {}), /*#__PURE__*/_jsx("tbody", { children: tableRenderData === null || tableRenderData === void 0 ? void 0 : (_tableRenderData$valu = tableRenderData.value) === null || _tableRenderData$valu === void 0 ? void 0 : _tableRenderData$valu.map(function (row, rowIndex) { return /*#__PURE__*/_jsx(Tr, { rowDataSource: row, rowIndex: rowIndex }, row.key); }) })] }); }