/
index.tsx
31 lines (25 loc) 路 971 Bytes
/
index.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
import React, { useMemo } from 'react';
import { FormControlPickerProps, RsRefForwardingComponent } from '../@types/common';
import CheckTreePicker, { ValueType } from '../CheckTreePicker';
import { TreeBaseProps } from '../Tree/Tree';
import TreeContext from '../Tree/TreeContext';
export interface CheckTreeProps
extends TreeBaseProps<ValueType>,
FormControlPickerProps<ValueType> {
/** Tree node cascade */
cascade?: boolean;
/** Set the option value for the check box not to be rendered */
uncheckableItemValues?: ValueType;
}
const CheckTree: RsRefForwardingComponent<'div', CheckTreeProps> = React.forwardRef(
(props: CheckTreeProps, ref: React.Ref<any>) => {
const contextValue = useMemo(() => ({ inline: true }), []);
return (
<TreeContext.Provider value={contextValue}>
<CheckTreePicker ref={ref} {...props} />
</TreeContext.Provider>
);
}
);
CheckTree.displayName = 'CheckTree';
export default CheckTree;