diff --git a/.gitignore b/.gitignore index c34bcf4fc..2c1b5ee4b 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ es/ !tests/__mocks__/rc-util/lib examples/debug.tsx .history +~* # umi .umi diff --git a/package.json b/package.json index b25fca225..87159357a 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ }, "dependencies": { "@babel/runtime": "^7.10.1", - "@rc-component/context": "^1.2.0", + "@rc-component/context": "^1.3.0", "classnames": "^2.2.5", "rc-resize-observer": "^1.1.0", "rc-util": "^5.27.1" diff --git a/src/Table.tsx b/src/Table.tsx index 1f48333af..27047726b 100644 --- a/src/Table.tsx +++ b/src/Table.tsx @@ -25,6 +25,7 @@ */ import { makeImmutable } from '@rc-component/context'; +import type { CompareProps } from '@rc-component/context/lib/Immutable'; import classNames from 'classnames'; import ResizeObserver from 'rc-resize-observer'; import isVisible from 'rc-util/lib/Dom/isVisible'; @@ -832,7 +833,11 @@ function Table(tableProps: TableProps{fullTable}; } -const ImmutableTable = makeImmutable(Table); +export function genTable(shouldTriggerRender?: CompareProps): typeof Table { + return makeImmutable(Table, shouldTriggerRender); +} + +const ImmutableTable = genTable(); type ImmutableTableType = typeof ImmutableTable & { EXPAND_COLUMN: typeof EXPAND_COLUMN; Column: typeof Column; diff --git a/src/index.ts b/src/index.ts index 2d973fa05..e5d3624fc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,9 +2,9 @@ import { FooterComponents as Summary } from './Footer'; import Column from './sugar/Column'; import ColumnGroup from './sugar/ColumnGroup'; import type { TableProps } from './Table'; -import Table from './Table'; +import Table, { genTable } from './Table'; import { INTERNAL_COL_DEFINE } from './utils/legacyUtil'; -export { Summary, Column, ColumnGroup, TableProps, INTERNAL_COL_DEFINE }; +export { genTable, Summary, Column, ColumnGroup, TableProps, INTERNAL_COL_DEFINE }; export default Table;