-
Notifications
You must be signed in to change notification settings - Fork 196
/
Copy pathTreeSelectContext.ts
28 lines (24 loc) · 1 KB
/
TreeSelectContext.ts
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
import * as React from 'react';
import type { ExpandAction } from 'rc-tree/lib/Tree';
import type { DataNode, FieldNames, Key } from './interface';
import type useDataEntities from './hooks/useDataEntities';
export interface TreeSelectContextProps {
virtual?: boolean;
popupMatchSelectWidth?: boolean | number;
listHeight: number;
listItemHeight: number;
listItemScrollOffset?: number;
treeData: DataNode[];
fieldNames: FieldNames;
onSelect: (value: Key, info: { selected: boolean }) => void;
treeExpandAction?: ExpandAction;
treeTitleRender?: (node: any) => React.ReactNode;
onPopupScroll?: React.UIEventHandler<HTMLDivElement>;
// For `maxCount` usage
leftMaxCount: number | null;
/** When `true`, only take leaf node as count, or take all as count with `maxCount` limitation */
leafCountOnly: boolean;
valueEntities: ReturnType<typeof useDataEntities>['valueEntities'];
}
const TreeSelectContext = React.createContext<TreeSelectContextProps>(null as any);
export default TreeSelectContext;