///
import type { LocaleProps, Option, OptionValue, ThemeProps } from 'jamis-core';
import type { ItemRenderStates } from '../../types';
interface IDropIndicator {
left: number;
top: number;
width: number;
height?: number;
}
export interface IDropInfo {
/** 拖动的节点 */
dragNode: Option | null;
/** 放置的节点 */
node: Option;
/** 拖动的三种情况, 上/下/里面 */
position: 'top' | 'bottom' | 'self';
indicator: IDropIndicator;
}
export interface TreeCompProps extends ThemeProps, LocaleProps {
highlightTxt?: string;
onRef?: any;
showIcon?: boolean;
initiallyOpen?: boolean;
unfoldedLevel?: number;
showRadio?: boolean;
multiple?: boolean;
disabled?: boolean;
withChildren?: boolean;
onlyChildren?: boolean;
onlyLeaf?: boolean;
labelField: string;
valueField: string;
iconField: string;
unfoldedField: string;
foldedField: string;
disabledField: string;
showOutline?: boolean;
className?: string;
itemClassName?: string;
joinValues?: boolean;
extractValue?: boolean;
delimiter?: string;
options: Option[];
value: any;
onChange: Function;
placeholder?: string;
hideRoot?: boolean;
rootLabel?: string;
rootValue?: any;
enableNodePath?: boolean;
pathSeparator?: string;
nodePath: any[];
/** ui级联关系,true代表级联选中,false代表不级联,默认为true */
autoCheckChildren: boolean;
cascade?: boolean;
/**
* 在多选情况下, 点击label时是否不选中, 默认是false
*/
clickLabelNoCheck?: boolean;
/** 点击label时的回调事件 */
dispatchEvent?: (eventName: 'click' | 'sort-asc' | 'sort-desc', value: Record) => void;
selfDisabledAffectChildren?: boolean;
minLength?: number;
maxLength?: number;
bultinCUD?: boolean;
rootCreatable?: boolean;
rootCreateTip?: string;
creatable?: boolean;
createTip?: string;
/** 是否可排序 */
sortable?: boolean;
onAdd?: (idx?: number | Array, value?: any, skipForm?: boolean) => void;
editable?: boolean;
editTip?: string;
onEdit?: (value: Option, origin?: Option, skipForm?: boolean) => void;
removable?: boolean;
removeTip?: string;
draggable?: boolean;
/** 是否使用手风琴模式 */
accordion?: boolean;
onDelete?: (value: Option) => void;
onDeferLoad?: (option: Option) => void;
onExpandTree?: (nodePathArr: any[]) => void;
onMove?: (dropInfo: IDropInfo) => void;
itemRender?: (option: Option, states: ItemRenderStates) => JSX.Element;
setOptions?: (options: any[], skipNormalize: boolean) => void;
}
export interface TreeCompState {
value: Array