From 6a09ab9af3bde584de732ae3ff493df3f93f32da Mon Sep 17 00:00:00 2001 From: goodm2ice Date: Fri, 11 Mar 2022 15:28:41 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=81=D1=82=D0=BE=D0=BB=D0=B1=D1=86=D0=BE=D0=B2?= =?UTF-8?q?=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D0=BE=20=D1=81?= =?UTF-8?q?=D0=BA=D1=80=D1=8B=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Table/Table.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/Table/Table.tsx b/src/components/Table/Table.tsx index d6af60e..0283a8d 100644 --- a/src/components/Table/Table.tsx +++ b/src/components/Table/Table.tsx @@ -15,12 +15,11 @@ export type TableColumns = OmitExtends, ColumnSettin export type TableContainer = TableProps & { columns: TableColumns dataSource: any[] - children?: ReactNode tableName?: string - hideSettingsChanger?: boolean + showSettingsChanger?: boolean } -export const Table = memo(({ columns, dataSource, children, tableName, hideSettingsChanger, ...other }) => { +export const Table = memo(({ columns, dataSource, tableName, showSettingsChanger, ...other }) => { const [newColumns, setNewColumns] = useState([]) const [settings, setSettings] = useState({}) @@ -33,7 +32,7 @@ export const Table = memo(({ columns, dataSource, children, tabl useEffect(() => setSettings(tableName ? getTableSettings(tableName) : {}), [tableName]) useEffect(() => setNewColumns(() => { const newColumns = applySettings(columns, settings) - if (tableName && !hideSettingsChanger) { + if (tableName && showSettingsChanger) { const oldTitle = newColumns[0].title newColumns[0].title = (props) => (
@@ -45,14 +44,13 @@ export const Table = memo(({ columns, dataSource, children, tabl ) } return newColumns - }), [settings, columns, onSettingsChanged, hideSettingsChanger, tableName]) + }), [settings, columns, onSettingsChanged, showSettingsChanger, tableName]) return ( ) })