interface.d.ts
6.35 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import * as React from 'react';
/**
* ColumnType which applied in antd: https://ant.design/components/table-cn/#Column
* - defaultSortOrder
* - filterDropdown
* - filterDropdownVisible
* - filtered
* - filteredValue
* - filterIcon
* - filterMultiple
* - filters
* - sorter
* - sortOrder
* - sortDirections
* - onFilter
* - onFilterDropdownVisibleChange
*/
export declare type Key = React.Key;
export declare type FixedType = 'left' | 'right' | boolean;
export declare type DefaultRecordType = Record<string, any>;
export declare type TableLayout = 'auto' | 'fixed';
export declare type RowClassName<RecordType> = (record: RecordType, index: number, indent: number) => string;
export interface CellType<RecordType> {
key?: Key;
className?: string;
style?: React.CSSProperties;
children?: React.ReactNode;
column?: ColumnsType<RecordType>[number];
colSpan?: number;
rowSpan?: number;
/** Only used for table header */
hasSubColumns?: boolean;
colStart?: number;
colEnd?: number;
}
export interface RenderedCell<RecordType> {
props?: CellType<RecordType>;
children?: React.ReactNode;
}
export declare type DataIndex = string | number | (string | number)[];
export declare type CellEllipsisType = {
showTitle?: boolean;
} | boolean;
interface ColumnSharedType<RecordType> {
title?: React.ReactNode;
key?: Key;
className?: string;
fixed?: FixedType;
onHeaderCell?: GetComponentProps<ColumnsType<RecordType>[number]>;
ellipsis?: CellEllipsisType;
align?: AlignType;
}
export interface ColumnGroupType<RecordType> extends ColumnSharedType<RecordType> {
children: ColumnsType<RecordType>;
}
export declare type AlignType = 'left' | 'center' | 'right';
export interface ColumnType<RecordType> extends ColumnSharedType<RecordType> {
colSpan?: number;
dataIndex?: DataIndex;
render?: (value: any, record: RecordType, index: number) => React.ReactNode | RenderedCell<RecordType>;
shouldCellUpdate?: (record: RecordType, prevRecord: RecordType) => boolean;
rowSpan?: number;
width?: number | string;
onCell?: GetComponentProps<RecordType>;
/** @deprecated Please use `onCell` instead */
onCellClick?: (record: RecordType, e: React.MouseEvent<HTMLElement>) => void;
}
export declare type ColumnsType<RecordType = unknown> = (ColumnGroupType<RecordType> | ColumnType<RecordType>)[];
export declare type GetRowKey<RecordType> = (record: RecordType, index?: number) => Key;
export interface StickyOffsets {
left: number[];
right: number[];
isSticky?: boolean;
}
export declare type GetComponentProps<DataType> = (data: DataType, index?: number) => React.HTMLAttributes<HTMLElement>;
declare type Component<P> = React.ComponentType<P> | React.ForwardRefExoticComponent<P> | React.FC<P> | keyof React.ReactHTML;
export declare type CustomizeComponent = Component<any>;
export declare type CustomizeScrollBody<RecordType> = (data: RecordType[], info: {
scrollbarSize: number;
ref: React.Ref<{
scrollLeft: number;
}>;
onScroll: (info: {
currentTarget?: HTMLElement;
scrollLeft?: number;
}) => void;
}) => React.ReactNode;
export interface TableComponents<RecordType> {
table?: CustomizeComponent;
header?: {
wrapper?: CustomizeComponent;
row?: CustomizeComponent;
cell?: CustomizeComponent;
};
body?: CustomizeScrollBody<RecordType> | {
wrapper?: CustomizeComponent;
row?: CustomizeComponent;
cell?: CustomizeComponent;
};
}
export declare type GetComponent = (path: string[], defaultComponent?: CustomizeComponent) => CustomizeComponent;
export declare type ExpandableType = false | 'row' | 'nest';
export interface LegacyExpandableProps<RecordType> {
/** @deprecated Use `expandable.expandedRowKeys` instead */
expandedRowKeys?: Key[];
/** @deprecated Use `expandable.defaultExpandedRowKeys` instead */
defaultExpandedRowKeys?: Key[];
/** @deprecated Use `expandable.expandedRowRender` instead */
expandedRowRender?: ExpandedRowRender<RecordType>;
/** @deprecated Use `expandable.expandRowByClick` instead */
expandRowByClick?: boolean;
/** @deprecated Use `expandable.expandIcon` instead */
expandIcon?: RenderExpandIcon<RecordType>;
/** @deprecated Use `expandable.onExpand` instead */
onExpand?: (expanded: boolean, record: RecordType) => void;
/** @deprecated Use `expandable.onExpandedRowsChange` instead */
onExpandedRowsChange?: (expandedKeys: Key[]) => void;
/** @deprecated Use `expandable.defaultExpandAllRows` instead */
defaultExpandAllRows?: boolean;
/** @deprecated Use `expandable.indentSize` instead */
indentSize?: number;
/** @deprecated Use `expandable.expandIconColumnIndex` instead */
expandIconColumnIndex?: number;
/** @deprecated Use `expandable.expandedRowClassName` instead */
expandedRowClassName?: RowClassName<RecordType>;
/** @deprecated Use `expandable.childrenColumnName` instead */
childrenColumnName?: string;
}
export declare type ExpandedRowRender<ValueType> = (record: ValueType, index: number, indent: number, expanded: boolean) => React.ReactNode;
export interface RenderExpandIconProps<RecordType> {
prefixCls: string;
expanded: boolean;
record: RecordType;
expandable: boolean;
onExpand: TriggerEventHandler<RecordType>;
}
export declare type RenderExpandIcon<RecordType> = (props: RenderExpandIconProps<RecordType>) => React.ReactNode;
export interface ExpandableConfig<RecordType> {
expandedRowKeys?: Key[];
defaultExpandedRowKeys?: Key[];
expandedRowRender?: ExpandedRowRender<RecordType>;
expandRowByClick?: boolean;
expandIcon?: RenderExpandIcon<RecordType>;
onExpand?: (expanded: boolean, record: RecordType) => void;
onExpandedRowsChange?: (expandedKeys: Key[]) => void;
defaultExpandAllRows?: boolean;
indentSize?: number;
expandIconColumnIndex?: number;
expandedRowClassName?: RowClassName<RecordType>;
childrenColumnName?: string;
rowExpandable?: (record: RecordType) => boolean;
}
export declare type PanelRender<RecordType> = (data: RecordType[]) => React.ReactNode;
export declare type TriggerEventHandler<RecordType> = (record: RecordType, event: React.MouseEvent<HTMLElement>) => void;
export interface TableSticky {
offsetHeader?: number;
offsetScroll?: number;
getContainer?: () => Window | HTMLElement;
}
export {};