From 8c4730a4abcc061b64a20edcd97dcc5311585da3 Mon Sep 17 00:00:00 2001 From: sealday Date: Sat, 30 Mar 2024 22:53:30 +0800 Subject: [PATCH] fix: table style error --- .../schema-component/antd/table-v2/Table.tsx | 153 +++++++++--------- 1 file changed, 77 insertions(+), 76 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/table-v2/Table.tsx b/packages/core/client/src/schema-component/antd/table-v2/Table.tsx index 29d577330..30a15da15 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/Table.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/Table.tsx @@ -285,7 +285,7 @@ export const Table: any = withDynamicSchemaProps( const isTableSelector = schema?.parent?.['x-decorator'] === 'TableSelectorProvider'; const ctx = isTableSelector ? useTableSelectorContext() : useTableBlockContext(); const { expandFlag, allIncludesChildren } = ctx; - const onRowDragEnd = useMemoizedFn(others.onRowDragEnd || (() => { })); + const onRowDragEnd = useMemoizedFn(others.onRowDragEnd || (() => {})); const paginationProps = usePaginationProps(pagination1, pagination2); const [expandedKeys, setExpandesKeys] = useState([]); const [selectedRowKeys, setSelectedRowKeys] = useState(field?.data?.selectedRowKeys || []); @@ -437,40 +437,40 @@ export const Table: any = withDynamicSchemaProps( const restProps = { rowSelection: rowSelection ? { - type: 'checkbox', - selectedRowKeys: selectedRowKeys, - onChange(selectedRowKeys: any[], selectedRows: any[]) { - field.data = field.data || {}; - field.data.selectedRowKeys = selectedRowKeys; - setSelectedRowKeys(selectedRowKeys); - onRowSelectionChange?.(selectedRowKeys, selectedRows); - }, - getCheckboxProps(record) { - return { - 'aria-label': `checkbox`, - }; - }, - renderCell: (checked, record, index, originNode) => { - if (!dragSort && !showIndex) { - return originNode; - } - const current = props?.pagination?.current; - const pageSize = props?.pagination?.pageSize || 20; - if (current) { - index = index + (current - 1) * pageSize + 1; - } else { - index = index + 1; - } - if (record.__index) { - index = extractIndex(record.__index); - } - return ( -
{ + if (!dragSort && !showIndex) { + return originNode; + } + const current = props?.pagination?.current; + const pageSize = props?.pagination?.pageSize || 20; + if (current) { + index = index + (current - 1) * pageSize + 1; + } else { + index = index + 1; + } + if (record.__index) { + index = extractIndex(record.__index); + } + return ( +
-
+
- {dragSort && } - {showIndex && } -
- {isRowSelect && ( -
+ {dragSort && } + {showIndex && } +
+ {isRowSelect && ( +
- {originNode} -
- )} -
- ); - }, - ...rowSelection, - } + )} + > + {originNode} +
+ )} +
+ ); + }, + ...rowSelection, + } : undefined, }; const SortableWrapper = useCallback( ({ children }) => { return dragSort ? React.createElement>( - SortableContext, - { - items: field.value?.map?.(getRowKey) || [], - }, - children, - ) + SortableContext, + { + items: field.value?.map?.(getRowKey) || [], + }, + children, + ) : React.createElement(React.Fragment, {}, children); }, [field, dragSort], @@ -560,12 +560,12 @@ export const Table: any = withDynamicSchemaProps( const scroll = useMemo(() => { return fixedBlock ? { - x: 'max-content', - y: tableHeight, - } + x: 'max-content', + y: tableHeight, + } : { - x: 'max-content', - }; + x: 'max-content', + }; }, [fixedBlock, tableHeight]); return (