From 3dcc4a52b1e3e81e0674d2a2759fefce2edbedcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A0=97=E5=98=89=E7=94=B7?= <574980606@qq.com> Date: Sun, 29 Sep 2024 00:15:47 +0800 Subject: [PATCH] demo: update demo --- docs/examples/virtual.tsx | 57 ++++++++++++++++++++++++++++----------- src/interface.ts | 2 +- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/docs/examples/virtual.tsx b/docs/examples/virtual.tsx index bcb1a59fe..d1dfa0857 100644 --- a/docs/examples/virtual.tsx +++ b/docs/examples/virtual.tsx @@ -189,31 +189,37 @@ const data: RecordType[] = new Array(4 * 10000).fill(null).map((_, index) => ({ })); const Demo = () => { - const tblRef = React.useRef(); - + const table1Ref = React.useRef(); + const table2Ref = React.useRef(); return (
- + - b || c} scroll={{ x: 1300, y: 200 }} @@ -229,14 +235,33 @@ const Demo = () => { rowClassName="nice-try" getContainerWidth={(ele, width) => { // Minus border - const borderWidth = getComputedStyle( - ele.querySelector('.rc-table-tbody'), - ).borderInlineStartWidth; - const mergedWidth = width - parseInt(borderWidth, 10); - + const { borderInlineStartWidth } = getComputedStyle(ele.querySelector('.rc-table-tbody')); + const mergedWidth = width - parseInt(borderInlineStartWidth, 10); + return mergedWidth; + }} + /> + b || c} + scroll={{ x: 1300, y: 200 }} + data={data} + // data={[]} + rowKey="indexKey" + expandable={{ + expandedRowRender: () => 2333, + columnWidth: 60, + expandedRowClassName: 'good-one-string', + }} + // onRow={() => ({ className: 'rowed' })} + rowClassName="nice-try" + getContainerWidth={(ele, width) => { + // Minus border + const { borderInlineStartWidth } = getComputedStyle(ele.querySelector('.rc-table-tbody')); + const mergedWidth = width - parseInt(borderInlineStartWidth, 10); return mergedWidth; }} - ref={tblRef} />
); diff --git a/src/interface.ts b/src/interface.ts index 051ac57ae..e645b2145 100644 --- a/src/interface.ts +++ b/src/interface.ts @@ -247,7 +247,7 @@ export interface ExpandableConfig { /** @deprecated Please use `EXPAND_COLUMN` in `columns` directly */ expandIconColumnIndex?: number; showExpandColumn?: boolean; - expandedRowClassName?: RowClassName; + expandedRowClassName?: string | RowClassName; childrenColumnName?: string; rowExpandable?: (record: RecordType) => boolean; columnWidth?: number | string;