Skip to content

Commit

Permalink
feat: export gen table (#931)
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ authored Jan 5, 2023
1 parent 2a2fd97 commit 8d13855
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
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;

1 comment on commit 8d13855

@vercel
Copy link

@vercel vercel bot commented on 8d13855 Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

table – ./

table-git-master-react-component.vercel.app
table-react-component.vercel.app

Please sign in to comment.