Skip to content

Commit

Permalink
chore: refactor name
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Aug 18, 2023
1 parent 298024d commit 33799fc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
"test": "vitest",
"coverage": "vitest run --coverage",
"prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish",
"prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish --branch static-table",
"lint": "eslint src/ --ext .tsx,.ts",
"lint:tsc": "tsc -p tsconfig.json --noEmit",
"now-build": "npm run docs:build",
Expand Down
8 changes: 5 additions & 3 deletions src/StaticTable/BodyLine.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContext } from '@rc-component/context';
import { responseImmutable, useContext } from '@rc-component/context';
import classNames from 'classnames';
import * as React from 'react';
import { useRowInfo } from '../Body/BodyRow';
Expand Down Expand Up @@ -68,8 +68,10 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
);
});

const ResponseBodyLine = responseImmutable(BodyLine);

if (process.env.NODE_ENV !== 'production') {
BodyLine.displayName = 'BodyLine';
ResponseBodyLine.displayName = 'BodyLine';
}

export default BodyLine;
export default ResponseBodyLine;
11 changes: 10 additions & 1 deletion src/StaticTable/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { CompareProps, makeImmutable } from '@rc-component/context/lib/Immutable';
import * as React from 'react';
import { INTERNAL_HOOKS } from '..';
import type { CustomizeScrollBody } from '../interface';
Expand All @@ -19,7 +20,7 @@ export interface StaticTableProps<RecordType> extends Omit<TableProps<RecordType
};
}

export default function StaticTable<RecordType>(props: StaticTableProps<RecordType>) {
function VirtualTable<RecordType>(props: StaticTableProps<RecordType>) {
const { columns, scroll } = props;

const { x: scrollX, y: scrollY } = scroll || {};
Expand All @@ -42,3 +43,11 @@ export default function StaticTable<RecordType>(props: StaticTableProps<RecordTy
</StaticContext.Provider>
);
}

export function genVirtualTable(
shouldTriggerRender?: CompareProps<typeof Table>,
): typeof VirtualTable {
return makeImmutable(VirtualTable, shouldTriggerRender);
}

export default genVirtualTable();
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EXPAND_COLUMN, INTERNAL_HOOKS } from './constant';
import { FooterComponents as Summary } from './Footer';
import StaticTable from './StaticTable';
import VirtualTable, { genVirtualTable } from './StaticTable';
import Column from './sugar/Column';
import ColumnGroup from './sugar/ColumnGroup';
import type { TableProps } from './Table';
Expand All @@ -16,7 +16,8 @@ export {
INTERNAL_COL_DEFINE,
EXPAND_COLUMN,
INTERNAL_HOOKS,
StaticTable,
VirtualTable,
genVirtualTable,
};

export default Table;

0 comments on commit 33799fc

Please sign in to comment.