chore: custom table sort

This commit is contained in:
jialin
2024-07-16 18:13:34 +08:00
parent a27fa9d56c
commit b05595f84b
8 changed files with 127 additions and 18 deletions
+16 -2
View File
@@ -24,6 +24,7 @@ const SealTable: React.FC<SealTableProps & { pagination: PaginationProps }> = (
rowKey,
childParentKey,
onExpand,
onSort,
expandedRowKeys,
loading,
expandable,
@@ -117,12 +118,25 @@ const SealTable: React.FC<SealTableProps & { pagination: PaginationProps }> = (
<Row className="row">
{React.Children.map(props.children, (child, i) => {
const { props: columnProps } = child as any;
const { title, align, span, headerStyle } =
columnProps as SealColumnProps;
const {
title,
dataIndex,
align,
span,
headerStyle,
sortOrder,
sorter,
defaultSortOrder
} = columnProps as SealColumnProps;
if (React.isValidElement(child)) {
return (
<Col span={span} key={i}>
<TableHeader
onSort={onSort}
sorter={sorter}
dataIndex={dataIndex}
sortOrder={sortOrder}
defaultSortOrder={defaultSortOrder}
title={title}
style={headerStyle}
firstCell={i === 0}