Skip to content

Commit 33799fc

Browse files
committed
chore: refactor name
1 parent 298024d commit 33799fc

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
4343
"test": "vitest",
4444
"coverage": "vitest run --coverage",
45-
"prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish",
45+
"prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish --branch static-table",
4646
"lint": "eslint src/ --ext .tsx,.ts",
4747
"lint:tsc": "tsc -p tsconfig.json --noEmit",
4848
"now-build": "npm run docs:build",

src/StaticTable/BodyLine.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useContext } from '@rc-component/context';
1+
import { responseImmutable, useContext } from '@rc-component/context';
22
import classNames from 'classnames';
33
import * as React from 'react';
44
import { useRowInfo } from '../Body/BodyRow';
@@ -68,8 +68,10 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
6868
);
6969
});
7070

71+
const ResponseBodyLine = responseImmutable(BodyLine);
72+
7173
if (process.env.NODE_ENV !== 'production') {
72-
BodyLine.displayName = 'BodyLine';
74+
ResponseBodyLine.displayName = 'BodyLine';
7375
}
7476

75-
export default BodyLine;
77+
export default ResponseBodyLine;

src/StaticTable/index.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { CompareProps, makeImmutable } from '@rc-component/context/lib/Immutable';
12
import * as React from 'react';
23
import { INTERNAL_HOOKS } from '..';
34
import type { CustomizeScrollBody } from '../interface';
@@ -19,7 +20,7 @@ export interface StaticTableProps<RecordType> extends Omit<TableProps<RecordType
1920
};
2021
}
2122

22-
export default function StaticTable<RecordType>(props: StaticTableProps<RecordType>) {
23+
function VirtualTable<RecordType>(props: StaticTableProps<RecordType>) {
2324
const { columns, scroll } = props;
2425

2526
const { x: scrollX, y: scrollY } = scroll || {};
@@ -42,3 +43,11 @@ export default function StaticTable<RecordType>(props: StaticTableProps<RecordTy
4243
</StaticContext.Provider>
4344
);
4445
}
46+
47+
export function genVirtualTable(
48+
shouldTriggerRender?: CompareProps<typeof Table>,
49+
): typeof VirtualTable {
50+
return makeImmutable(VirtualTable, shouldTriggerRender);
51+
}
52+
53+
export default genVirtualTable();

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EXPAND_COLUMN, INTERNAL_HOOKS } from './constant';
22
import { FooterComponents as Summary } from './Footer';
3-
import StaticTable from './StaticTable';
3+
import VirtualTable, { genVirtualTable } from './StaticTable';
44
import Column from './sugar/Column';
55
import ColumnGroup from './sugar/ColumnGroup';
66
import type { TableProps } from './Table';
@@ -16,7 +16,8 @@ export {
1616
INTERNAL_COL_DEFINE,
1717
EXPAND_COLUMN,
1818
INTERNAL_HOOKS,
19-
StaticTable,
19+
VirtualTable,
20+
genVirtualTable,
2021
};
2122

2223
export default Table;

0 commit comments

Comments
 (0)