Skip to content

Commit 4fd3e12

Browse files
committed
Add auto / fixed tables
1 parent 26f6b10 commit 4fd3e12

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from "react";
2+
import BaseTable, { BaseTableProps } from "./BaseTable";
3+
4+
export interface AutoModeTableProps<RecordType> extends BaseTableProps<RecordType> {
5+
// No additional props needed - auto mode is simple!
6+
}
7+
8+
function AutoModeTableComp<RecordType extends object>(props: AutoModeTableProps<RecordType>) {
9+
const { ...baseProps } = props;
10+
11+
// Auto mode configuration: natural growth, no height constraints
12+
return (
13+
<BaseTable<RecordType>
14+
{...baseProps}
15+
// Override any height-related props for auto mode
16+
containerHeight={undefined}
17+
isFixedHeight={false}
18+
/>
19+
);
20+
}
21+
22+
const AutoModeTable = React.memo(AutoModeTableComp) as typeof AutoModeTableComp;
23+
export default AutoModeTable;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from "react";
2+
import BaseTable, { BaseTableProps } from "./BaseTable";
3+
4+
export interface FixedModeTableProps<RecordType> extends BaseTableProps<RecordType> {
5+
bodyHeight: number;
6+
}
7+
8+
function FixedModeTableComp<RecordType extends object>(props: FixedModeTableProps<RecordType>) {
9+
const { bodyHeight, ...baseProps } = props;
10+
11+
// Fixed mode configuration: height constraints and internal scrolling
12+
return (
13+
<BaseTable<RecordType>
14+
{...baseProps}
15+
containerHeight={bodyHeight}
16+
isFixedHeight={true}
17+
/>
18+
);
19+
}
20+
21+
const FixedModeTable = React.memo(FixedModeTableComp) as typeof FixedModeTableComp;
22+
export default FixedModeTable;

0 commit comments

Comments
 (0)