From d2d6377efd1e30ba339f439bd566985d026b3524 Mon Sep 17 00:00:00 2001 From: goodmice Date: Fri, 15 Oct 2021 16:03:09 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BE=D0=B1=D1=91=D1=80=D1=82=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20antd=20Table=20=D1=81=20=D0=B0=D0=B2=D1=82?= =?UTF-8?q?=D0=BE=D0=BF=D0=BE=D0=B4=D1=81=D1=82=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=D0=BC=20=D0=BF=D0=BE=D0=BB=D1=8F=20key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Table/EditableTable.jsx | 2 +- src/components/Table/index.tsx | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/Table/EditableTable.jsx b/src/components/Table/EditableTable.jsx index 9bdc333..568309a 100644 --- a/src/components/Table/EditableTable.jsx +++ b/src/components/Table/EditableTable.jsx @@ -5,7 +5,7 @@ import { EditableCell } from './EditableCell' const newRowKeyValue = 'newRow' -const tryAddKeys = (items) => { +export const tryAddKeys = (items) => { if(!items?.length || !items[0]) return [] if(items[0].key) diff --git a/src/components/Table/index.tsx b/src/components/Table/index.tsx index e726d2e..2d8f0a4 100644 --- a/src/components/Table/index.tsx +++ b/src/components/Table/index.tsx @@ -1,7 +1,8 @@ import { ReactNode } from 'react' +import { Table as RawTable } from 'antd' +import { tryAddKeys } from './EditableTable' import { makeNumericSorter, makeStringSorter} from './sorters' export { makeDateSorter, makeNumericSorter, makeStringSorter} from './sorters' -export { Table } from 'antd' export { EditableTable } from './EditableTable' export { DatePickerWrapper } from './DatePickerWrapper' export { SelectFromDictionary } from './SelectFromDictionary' @@ -186,3 +187,12 @@ export const makePaginationObject = (paginationContainer:PaginationContainer, .. current: page, } } + +interface TableContainer { + dataSource: any[]; + children?: any; +} + +export const Table = ({dataSource, children, ...other}: TableContainer) => { + return {children} +}