From 9f6b16278267b1b0445cc64d3e74de049091d00b Mon Sep 17 00:00:00 2001 From: Junyi Date: Thu, 17 Oct 2024 18:00:58 +0800 Subject: [PATCH] fix(client): fix selected background color of table row (#5445) --- .../src/schema-component/antd/table-v2/Table.tsx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 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 2d35c1456..38d106bc4 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 @@ -476,18 +476,15 @@ export const Table: any = withDynamicSchemaProps( const highlightRowCss = useMemo(() => { return css` & > td { - background-color: ${token.controlItemBgActiveHover} !important; + background-color: ${token.controlItemBgActive} !important; } &:hover > td { background-color: ${token.controlItemBgActiveHover} !important; } `; - }, [token.controlItemBgActiveHover]); + }, [token.controlItemBgActive, token.controlItemBgActiveHover]); - const highlightRow = useMemo( - () => (onClickRow ? highlightRowCss : ''), - [onClickRow, token.controlItemBgActiveHover], - ); + const highlightRow = useMemo(() => (onClickRow ? highlightRowCss : ''), [highlightRowCss, onClickRow]); const onRow = useMemo(() => { if (onClickRow) { @@ -581,7 +578,7 @@ export const Table: any = withDynamicSchemaProps( const BodyCellComponent = useCallback( (props) => { const isIndex = props.className?.includes('selection-column'); - const { record, schema, rowIndex } = props; + const { record, schema, rowIndex, ...others } = props; const { ref, inView } = useInView({ threshold: 0, triggerOnce: true, @@ -594,7 +591,7 @@ export const Table: any = withDynamicSchemaProps( // fix the problem of blank rows at the beginning of a table block if (rowIndex < 20) { return ( - + {props.children} );