/** * * This file may have been modified by Bytedance Inc. (“Bytedance Inc.'s Modifications”). * All Bytedance Inc.'s Modifications are Copyright (year) Bytedance Inc.. * * This source code is licensed under the Apache license. * See LICENSE file in the project root for license information. * */ import * as React from 'react'; import { ConfigConsumerProps, RenderEmptyHandler } from '../config-provider'; import { SizeType } from '../config-provider/component/SizeContext'; import { InputProps } from '../input'; import Transfer from './transfer'; export interface CascaderOptionType { value?: string | number; label?: React.ReactNode; disabled?: boolean; isLeaf?: boolean; loading?: boolean; children?: Array; [key: string]: any; } export interface FieldNamesType { value?: string | number; label?: string; children?: string; disabled?: string; } export interface FilledFieldNamesType { value: string | number; label: string; children: string; disabled: string; } export declare type CascaderExpandTrigger = 'click' | 'hover'; export declare type CascaderValueType = (string | number)[]; export interface ShowSearchType { filter?: (inputValue: string, path: CascaderOptionType[], names: FilledFieldNamesType) => boolean; render?: (inputValue: string, path: CascaderOptionType[], prefixCls: string | undefined, names: FilledFieldNamesType) => React.ReactNode; sort?: (a: CascaderOptionType[], b: CascaderOptionType[], inputValue: string, names: FilledFieldNamesType) => number; matchInputWidth?: boolean; limit?: number | false; } export interface renderTagProp { index: number; label: React.ReactNode; labelArr: string[]; selectedOptions?: CascaderOptionType[]; value: CascaderValueType | CascaderValueType[]; closable: boolean; onClose: (event: React.MouseEvent) => void; } export interface CascaderProps { options: CascaderOptionType[]; defaultValue?: CascaderValueType | CascaderValueType[]; value?: CascaderValueType | CascaderValueType[]; onChange?: (value: CascaderValueType | CascaderValueType[], selectedOptions?: CascaderOptionType[]) => void; multiple?: boolean; displayRender?: (label: string[], selectedOptions?: CascaderOptionType[], value?: CascaderValueType | CascaderValueType[]) => React.ReactNode; style?: React.CSSProperties; className?: string; popupClassName?: string; popupPlacement?: string; placeholder?: string; size?: SizeType; bordered?: boolean; disabled?: boolean; maxTagCount?: number | 'responsive'; maxTagPlaceholder?: React.ReactNode | ((omittedValues: CascaderValueType[]) => React.ReactNode); maxTagTextLength?: number; allowClear?: boolean; autoFocus?: boolean; showSearch?: boolean | ShowSearchType; notFoundContent?: React.ReactNode; loadData?: (selectedOptions?: CascaderOptionType[]) => void; expandTrigger?: CascaderExpandTrigger; expandIcon?: React.ReactNode; changeOnSelect?: boolean; transitionName?: string; onPopupVisibleChange?: (popupVisible: boolean) => void; prefixCls?: string; inputPrefixCls?: string; getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement; popupVisible?: boolean; fieldNames?: FieldNamesType; suffixIcon?: React.ReactNode; dropdownRender?: (menus: React.ReactNode) => React.ReactNode; labelRender?: (menus: CascaderOptionType) => React.ReactNode; showItemStrategy?: 'default' | 'child'; onlyCheckLeaf?: boolean; showAllCheckbox?: boolean; searchInMenu?: boolean; searchPlaceholder?: string; tagRender?: (obj: renderTagProp) => React.ReactNode; onSearch?: (value: string) => void; onBlur?: React.FocusEventHandler; checkboxRender?: (option: CascaderOptionType) => boolean; } export interface CascaderState { inputFocused: boolean; inputValue: string; value: CascaderValueType; multipleValue: CascaderValueType[]; popupVisible: boolean | undefined; flattenOptions: CascaderOptionType[][] | undefined; prevProps: CascaderProps; multipleSearchInputWidth: number | null | undefined; } interface CascaderLocale { placeholder?: string; selectAll?: string; } declare class Cascader extends React.Component { static defaultProps: { options: never[]; disabled: boolean; allowClear: boolean; bordered: boolean; }; static Transfer: typeof Transfer; static getDerivedStateFromProps(nextProps: CascaderProps, { prevProps }: CascaderState): Partial; cachedOptions: CascaderOptionType[]; rootMultipleRef: HTMLDivElement | null; clearSelectionTimeout: any; private input; private measureRef; constructor(props: CascaderProps); componentDidUpdate(_: CascaderProps, nextState: CascaderState): void; componentWillUnmount(): void; setValue: (value: CascaderValueType, selectedOptions?: CascaderOptionType[]) => void; getLabel(): any; saveInput: (node: InputProps) => void; saveMeasureInput: (node: HTMLSpanElement) => void; getActiveLabel(names: FilledFieldNamesType, activeValue: CascaderValueType): CascaderOptionType[]; handleChange: (value: any, selectedOptions: CascaderOptionType[]) => void; handlePopupVisibleChange: (popupVisible: boolean) => void; handleInputBlur: () => void; handleInputClick: (e: React.MouseEvent) => void; handleKeyDown: (e: React.KeyboardEvent) => void; handleInputChange: (e: React.ChangeEvent) => void; clearSelection: (e: React.MouseEvent) => void; removeMultipleItem: (index: number, e: React.MouseEvent) => void; generateFilteredOptions(prefixCls: string | undefined, renderEmpty: RenderEmptyHandler): any; focus(): void; blur(): void; getPopupPlacement(direction?: string): string; renderCascader: ({ getPopupContainer: getContextPopupContainer, getPrefixCls, renderEmpty, direction }: ConfigConsumerProps, locale: CascaderLocale) => JSX.Element; render(): JSX.Element; } export { Transfer as TransferRef }; export default Cascader;