-
-
Notifications
You must be signed in to change notification settings - Fork 604
/
Copy pathTableContext.tsx
76 lines (65 loc) · 2.01 KB
/
TableContext.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { createContext, createImmutable } from '@rc-component/context';
import type {
ColumnsType,
ColumnType,
Direction,
ExpandableType,
ExpandedRowRender,
GetComponent,
GetComponentProps,
GetRowKey,
RenderExpandIcon,
RowClassName,
TableLayout,
TriggerEventHandler,
} from '../interface';
import type { FixedInfo } from '../utils/fixUtil';
const { makeImmutable, responseImmutable, useImmutableMark } = createImmutable();
export { makeImmutable, responseImmutable, useImmutableMark };
export interface TableContextProps<RecordType = any> {
// Scroll
scrollX: number | string | true;
// Table
prefixCls: string;
getComponent: GetComponent;
scrollbarSize: number;
direction: Direction;
fixedInfoList: readonly FixedInfo[];
isSticky: boolean;
supportSticky: boolean;
componentWidth: number;
fixHeader: boolean;
fixColumn: boolean;
horizonScroll: boolean;
// Body
rowClassName: string | RowClassName<RecordType>;
expandedRowClassName: string | RowClassName<RecordType>;
onRow?: GetComponentProps<RecordType>;
emptyNode?: React.ReactNode;
tableLayout: TableLayout;
indentSize: number;
expandableType: ExpandableType;
expandRowByClick: boolean;
expandedRowRender: ExpandedRowRender<RecordType>;
expandIcon: RenderExpandIcon<RecordType>;
onTriggerExpand: TriggerEventHandler<RecordType>;
expandIconColumnIndex: number;
allColumnsFixedLeft: boolean;
// Column
columns: ColumnsType<RecordType>;
flattenColumns: readonly ColumnType<RecordType>[];
onColumnResize: (columnKey: React.Key, width: number) => void;
// Row
hoverStartRow: number;
hoverEndRow: number;
onHover: (start: number, end: number) => void;
rowExpandable: (record: RecordType) => boolean;
expandedKeys: Set<React.Key>;
getRowKey: GetRowKey<RecordType>;
childrenColumnName: string;
headerCellRefs: React.MutableRefObject<HTMLTableCellElement[]>;
rowHoverable?: boolean;
bodyScrollLeft?: number;
}
const TableContext = createContext<TableContextProps>();
export default TableContext;