/** * @description table表格 * * @date 创建时间 2022-10-18 15:49 * @author 开发人员 */ import React from "react"; import Table from "@components/Table"; import type { TableProps, ColumnProps } from "@components/Table"; import { features, useTablePipeline } from "ali-react-table"; import styled from "styled-components"; const BasicCustomBaseTable = styled(Table)` &, .even > .art-table-cell { background: transparent; } .art-table .art-table-header-row > .first, .art-table .art-table-row > .first { padding-left: 16px; } .art-table .art-table-header-row > .last, .art-table .art-table-row > .last { padding-right: 16px; } .art-table-header-cell { font-weight: 500; } .art-table-header-cell svg { width: 12px; height: 12px; } `; const BasicCustomTable: React.FC = props => { const { currentSymbol, columns, dataSource } = props; const pipeline = useTablePipeline() .input({ columns, dataSource }) .use(features.sort({ mode: "single" })); // 选中 row pipeline.appendRowPropsGetter((row, rowIndex) => { const activeColor = row.symbol === currentSymbol ? "rgba(116, 116, 128, 0.08)" : ""; // const activeColor = row.like ? "var(--table-hover-bgcolor)" : "" // "--bgcolor": activeColor, return { style: { "background-color": activeColor } as React.CSSProperties // onClick() { // console.log(row.close, row.like, rowIndex) // } }; }); return ( ); }; export { ColumnProps }; export default BasicCustomTable;