shineout
Version:
Shein 前端组件库
60 lines (59 loc) • 2.44 kB
TypeScript
import React from 'react';
import { PureComponent } from '../component';
import { ResultItem, KeygenResult, RegularAttributes } from '../@types/common';
import { TreeSelectValueType, OriginTreeSelectProps } from './Props';
interface TreeSelectState {
focus: boolean;
position: RegularAttributes.ListPosition;
}
export default class TreeSelect<Item, Value extends TreeSelectValueType> extends PureComponent<OriginTreeSelectProps<Item, Value>, TreeSelectState> {
static defaultProps: {
clearable: boolean;
compressed: boolean;
absolute: boolean;
multiple: boolean;
line: boolean;
renderItem: <Item_1 extends {}>(e: Item_1) => Item_1;
height: number;
data: never[];
defaultExpanded: never[];
};
treeSelectId: string;
handleClick: any;
handleBlur: any;
resetAbsoluteListPosition: (clean?: boolean) => void;
inputReset: (fn: () => void) => void;
element: HTMLDivElement;
constructor(props: OriginTreeSelectProps<Item, Value>);
componentDidUpdate(_prevProps: OriginTreeSelectProps<Item, Value>, prevState: TreeSelectState): void;
componentWillUnmount(): void;
onExpandHandler(...args: [any]): void;
getText(key: string): any;
setInputReset(fn: (_fn: () => void) => void): void;
getValue(): Value;
getDataByValue(value?: KeygenResult | KeygenResult[]): Item | {
IS_NOT_MATCHED_VALUE: boolean;
value: KeygenResult;
} | (Item | {
IS_NOT_MATCHED_VALUE: boolean;
value: KeygenResult;
} | null)[] | null | undefined;
getDataByValues(values: Value): Value extends any[] ? ResultItem<Item>[] : ResultItem<Item>;
getResetPosition(update: (clean?: boolean) => void): void;
bindElement(el: HTMLDivElement): void;
shouldFocus(el: HTMLDivElement): boolean;
bindClickAway(): void;
clearClickAway(): void;
handleClickAway(e: any): void;
handleState(focus: boolean, e?: any): void;
handleFocus(e: React.FocusEvent<HTMLDivElement>): void;
handleKeyDown(e: React.KeyboardEvent<HTMLDivElement>): void;
handleRemove(data: ResultItem<Item>): void;
handleChange(data: Item, id: string | number): void;
handleClear(): void;
renderItem(data: Item): any;
renderActive(data: Item, expanded: boolean, active: boolean, id: KeygenResult): JSX.Element;
renderTreeOptions(): JSX.Element;
render(): JSX.Element;
}
export {};