Skip to content

Commit 8d13855

Browse files
authored
feat: export gen table (#931)
1 parent 2a2fd97 commit 8d13855

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ es/
3535
!tests/__mocks__/rc-util/lib
3636
examples/debug.tsx
3737
.history
38+
~*
3839

3940
# umi
4041
.umi

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
},
5454
"dependencies": {
5555
"@babel/runtime": "^7.10.1",
56-
"@rc-component/context": "^1.2.0",
56+
"@rc-component/context": "^1.3.0",
5757
"classnames": "^2.2.5",
5858
"rc-resize-observer": "^1.1.0",
5959
"rc-util": "^5.27.1"

src/Table.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626

2727
import { makeImmutable } from '@rc-component/context';
28+
import type { CompareProps } from '@rc-component/context/lib/Immutable';
2829
import classNames from 'classnames';
2930
import ResizeObserver from 'rc-resize-observer';
3031
import isVisible from 'rc-util/lib/Dom/isVisible';
@@ -832,7 +833,11 @@ function Table<RecordType extends DefaultRecordType>(tableProps: TableProps<Reco
832833
return <TableContext.Provider value={TableContextValue}>{fullTable}</TableContext.Provider>;
833834
}
834835

835-
const ImmutableTable = makeImmutable(Table);
836+
export function genTable(shouldTriggerRender?: CompareProps<typeof Table>): typeof Table {
837+
return makeImmutable(Table, shouldTriggerRender);
838+
}
839+
840+
const ImmutableTable = genTable();
836841
type ImmutableTableType = typeof ImmutableTable & {
837842
EXPAND_COLUMN: typeof EXPAND_COLUMN;
838843
Column: typeof Column;

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { FooterComponents as Summary } from './Footer';
22
import Column from './sugar/Column';
33
import ColumnGroup from './sugar/ColumnGroup';
44
import type { TableProps } from './Table';
5-
import Table from './Table';
5+
import Table, { genTable } from './Table';
66
import { INTERNAL_COL_DEFINE } from './utils/legacyUtil';
77

8-
export { Summary, Column, ColumnGroup, TableProps, INTERNAL_COL_DEFINE };
8+
export { genTable, Summary, Column, ColumnGroup, TableProps, INTERNAL_COL_DEFINE };
99

1010
export default Table;

0 commit comments

Comments
 (0)