UNPKG

@douyinfe/semi-ui

Version:

A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.

151 lines (150 loc) 7.73 kB
import React, { MouseEvent, KeyboardEvent } from 'react'; import PropTypes from 'prop-types'; import { ContextValue } from '../configProvider/context'; import { TreeAdapter } from '@douyinfe/semi-foundation/lib/es/tree/foundation'; import BaseComponent from '../_base/baseComponent'; import Input from '../input/index'; import TreeNode from './treeNode'; import '@douyinfe/semi-foundation/lib/es/tree/tree.css'; import { TreeProps, TreeState, TreeNodeProps, TreeNodeData, FlattenNode, KeyEntity, OptionProps, ScrollData } from './interface'; export * from './interface'; export type { AutoSizerProps } from './autoSizer'; declare class Tree extends BaseComponent<TreeProps, TreeState> { static contextType: React.Context<ContextValue>; static propTypes: { autoMergeValue: PropTypes.Requireable<boolean>; blockNode: PropTypes.Requireable<boolean>; className: PropTypes.Requireable<string>; showClear: PropTypes.Requireable<boolean>; defaultExpandAll: PropTypes.Requireable<boolean>; defaultExpandedKeys: PropTypes.Requireable<any[]>; defaultValue: PropTypes.Requireable<NonNullable<string | any[]>>; directory: PropTypes.Requireable<boolean>; disabled: PropTypes.Requireable<boolean>; emptyContent: PropTypes.Requireable<PropTypes.ReactNodeLike>; expandAll: PropTypes.Requireable<boolean>; expandedKeys: PropTypes.Requireable<any[]>; filterTreeNode: PropTypes.Requireable<NonNullable<boolean | ((...args: any[]) => any)>>; icon: PropTypes.Requireable<PropTypes.ReactNodeLike>; onChangeWithObject: PropTypes.Requireable<boolean>; motion: PropTypes.Requireable<boolean>; multiple: PropTypes.Requireable<boolean>; onChange: PropTypes.Requireable<(...args: any[]) => any>; onExpand: PropTypes.Requireable<(...args: any[]) => any>; onSearch: PropTypes.Requireable<(...args: any[]) => any>; onSelect: PropTypes.Requireable<(...args: any[]) => any>; onContextMenu: PropTypes.Requireable<(...args: any[]) => any>; onDoubleClick: PropTypes.Requireable<(...args: any[]) => any>; searchClassName: PropTypes.Requireable<string>; searchPlaceholder: PropTypes.Requireable<string>; searchStyle: PropTypes.Requireable<object>; selectedKey: PropTypes.Requireable<string>; showFilteredOnly: PropTypes.Requireable<boolean>; showLine: PropTypes.Requireable<boolean>; style: PropTypes.Requireable<object>; treeData: PropTypes.Requireable<PropTypes.InferProps<{ key: PropTypes.Requireable<string>; value: PropTypes.Requireable<NonNullable<string | number>>; label: PropTypes.Requireable<any>; isLeaf: PropTypes.Requireable<boolean>; children: PropTypes.Requireable<any[]>; }>[]>; keyMaps: PropTypes.Requireable<object>; treeDataSimpleJson: PropTypes.Requireable<object>; treeNodeFilterProp: PropTypes.Requireable<string>; value: PropTypes.Requireable<NonNullable<string | number | object>>; virtualize: PropTypes.Requireable<object>; autoExpandParent: PropTypes.Requireable<boolean>; expandAction: PropTypes.Requireable<string | boolean>; searchRender: PropTypes.Requireable<NonNullable<boolean | ((...args: any[]) => any)>>; renderLabel: PropTypes.Requireable<(...args: any[]) => any>; renderFullLabel: PropTypes.Requireable<(...args: any[]) => any>; leafOnly: PropTypes.Requireable<boolean>; loadedKeys: PropTypes.Requireable<any[]>; loadData: PropTypes.Requireable<(...args: any[]) => any>; onLoad: PropTypes.Requireable<(...args: any[]) => any>; disableStrictly: PropTypes.Requireable<boolean>; draggable: PropTypes.Requireable<boolean>; autoExpandWhenDragEnter: PropTypes.Requireable<boolean>; hideDraggingNode: PropTypes.Requireable<boolean>; renderDraggingNode: PropTypes.Requireable<(...args: any[]) => any>; onDragEnd: PropTypes.Requireable<(...args: any[]) => any>; onDragEnter: PropTypes.Requireable<(...args: any[]) => any>; onDragLeave: PropTypes.Requireable<(...args: any[]) => any>; onDragOver: PropTypes.Requireable<(...args: any[]) => any>; onDragStart: PropTypes.Requireable<(...args: any[]) => any>; onDrop: PropTypes.Requireable<(...args: any[]) => any>; labelEllipsis: PropTypes.Requireable<boolean>; checkRelation: PropTypes.Requireable<string>; 'aria-label': PropTypes.Requireable<string>; preventScroll: PropTypes.Requireable<boolean>; }; static defaultProps: { showClear: boolean; disabled: boolean; blockNode: boolean; multiple: boolean; filterTreeNode: boolean; autoExpandParent: boolean; treeNodeFilterProp: string; defaultExpandAll: boolean; expandAll: boolean; onChangeWithObject: boolean; motion: boolean; leafOnly: boolean; showFilteredOnly: boolean; showLine: boolean; expandAction: boolean; disableStrictly: boolean; draggable: boolean; autoExpandWhenDragEnter: boolean; checkRelation: string; autoMergeValue: boolean; }; static TreeNode: typeof TreeNode; inputRef: React.RefObject<typeof Input>; optionsRef: React.RefObject<any>; dragNode: any; onNodeClick: any; onMotionEnd: any; context: ContextValue; virtualizedListRef: React.RefObject<any>; constructor(props: TreeProps); /** * Process of getDerivedStateFromProps was inspired by rc-tree * https://github.com/react-component/tree */ static getDerivedStateFromProps(props: TreeProps, prevState: TreeState): Partial<TreeState>; get adapter(): TreeAdapter; search: (value: string) => void; scrollTo: (scrollData: ScrollData) => void; renderInput(): React.JSX.Element; renderEmpty: () => React.JSX.Element; onNodeSelect: (e: MouseEvent | KeyboardEvent, treeNode: TreeNodeProps) => void; onNodeLoad: (data: TreeNodeData) => Promise<unknown>; onNodeCheck: (e: MouseEvent | KeyboardEvent, treeNode: TreeNodeProps) => void; onNodeExpand: (e: MouseEvent | KeyboardEvent, treeNode: TreeNodeProps) => void; onNodeRightClick: (e: MouseEvent, treeNode: TreeNodeProps) => void; onNodeDoubleClick: (e: MouseEvent, treeNode: TreeNodeProps) => void; onNodeDragStart: (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void; onNodeDragEnter: (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void; onNodeDragOver: (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void; onNodeDragLeave: (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void; onNodeDragEnd: (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void; onNodeDrop: (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void; getTreeNodeRequiredProps: () => { expandedKeys: Set<string>; selectedKeys: string[]; checkedKeys: Set<string>; halfCheckedKeys: Set<string>; filteredKeys: Set<string>; keyEntities: import("./interface").KeyEntities; }; getTreeNodeKey: (treeNode: TreeNodeData) => any; renderTreeNode: (treeNode: FlattenNode, ind?: number, style?: React.CSSProperties) => React.JSX.Element; itemKey: (index: number, data: KeyEntity) => any; option: ({ index, style, data }: OptionProps) => React.JSX.Element; renderNodeList(): React.JSX.Element; render(): React.JSX.Element; } export default Tree;