Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ es/
!tests/__mocks__/rc-util/lib
examples/debug.tsx
.history
~*

# umi
.umi
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 6 additions & 1 deletion src/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -832,7 +833,11 @@ function Table<RecordType extends DefaultRecordType>(tableProps: TableProps<Reco
return <TableContext.Provider value={TableContextValue}>{fullTable}</TableContext.Provider>;
}

const ImmutableTable = makeImmutable(Table);
export function genTable(shouldTriggerRender?: CompareProps<typeof Table>): typeof Table {
return makeImmutable(Table, shouldTriggerRender);
}

const ImmutableTable = genTable();
type ImmutableTableType = typeof ImmutableTable & {
EXPAND_COLUMN: typeof EXPAND_COLUMN;
Column: typeof Column;
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;