zy-react-library/components/Table/index.js

20 lines
680 B
JavaScript
Raw Normal View History

2025-10-22 14:43:42 +08:00
import Table from "@cqsjjb/jjb-react-admin-component/Table";
import { getIndexColumn } from "../../utils/index";
function TablePro(props) {
const {
columns = [],
showIndex = true,
useAlignCenter = true,
...restProps
} = props;
const storeIndex = props.storeIndex || `${window.process.env.app.antd["ant-prefix"]}_${Math.random().toString(36).substring(2)}`;
function calcColumns() {
showIndex && columns.unshift(getIndexColumn(props.pagination));
return columns.map(item => ({ ...item, align: useAlignCenter ? "center" : "left" }));
}
return <Table storeIndex={storeIndex} columns={calcColumns()} {...restProps} />;
}
export default TablePro;