element-plus
Version:
A Component Library for Vue 3
327 lines (326 loc) • 16.3 kB
TypeScript
import type { Component, StyleValue } from 'vue';
import type { UseEmptyValuesProps } from 'element-plus/es/hooks';
import type { ComponentSize } from 'element-plus/es/constants';
import type { Placement, PopperEffect } from 'element-plus/es/components/popper';
import type { CascaderCommonProps, CascaderNode, CascaderValue } from 'element-plus/es/components/cascader-panel';
import type { TagProps } from 'element-plus/es/components/tag';
type CascaderClassType = string | Record<string, boolean> | CascaderClassType[];
export interface CascaderComponentProps extends CascaderCommonProps, UseEmptyValuesProps {
/**
* @description size of input
*/
size?: ComponentSize;
/**
* @description placeholder of input
*/
placeholder?: string;
/**
* @description whether Cascader is disabled
*/
disabled?: boolean;
/**
* @description whether selected value can be cleared
*/
clearable?: boolean;
/**
* @description custom clear icon component
*/
clearIcon?: string | Component;
/**
* @description whether the options can be searched
*/
filterable?: boolean;
/**
* @description customize search logic, the first parameter is `node`, the second is `keyword`, and need return a boolean value indicating whether it hits.
*/
filterMethod?: (node: CascaderNode, keyword: string) => boolean;
/**
* @description option label separator
*/
separator?: string;
/**
* @description whether to display all levels of the selected value in the input
*/
showAllLevels?: boolean;
/**
* @description whether to collapse tags in multiple selection mode
*/
collapseTags?: boolean;
/**
* @description The max tags number to be shown. To use this, collapse-tags must be true
*/
maxCollapseTags?: number;
/**
* @description whether show all selected tags when mouse hover text of collapse-tags. To use this, collapse-tags must be true
*/
collapseTagsTooltip?: boolean;
/**
* @description The max height of collapse tags tooltip, in pixels. To use this, collapse-tags-tooltip must be true
*/
maxCollapseTagsTooltipHeight?: string | number;
/**
* @description debounce delay when typing filter keyword, in milliseconds
*/
debounce?: number;
/**
* @description hook function before filtering with the value to be filtered as its parameter. If `false` is returned or a `Promise` is returned and then is rejected, filtering will be aborted
*/
beforeFilter?: (value: string) => boolean | Promise<any>;
/**
* @description position of dropdown
*/
placement?: Placement;
/**
* @description list of possible positions for dropdown
*/
fallbackPlacements?: Placement[];
/**
* @description custom class name for Cascader's dropdown
*/
popperClass?: CascaderClassType;
/**
* @description custom style for Cascader's dropdown
*/
popperStyle?: StyleValue;
/**
* @description whether cascader popup is teleported
*/
teleported?: boolean;
/**
* @description tooltip theme, built-in theme: `dark` / `light`
*/
effect?: PopperEffect;
/**
* @description tag type
*/
tagType?: TagProps['type'];
/**
* @description tag effect
*/
tagEffect?: TagProps['effect'];
/**
* @description whether to trigger form validation
*/
validateEvent?: boolean;
/**
* @description when dropdown is inactive and `persistent` is `false`, dropdown will be destroyed
*/
persistent?: boolean;
/**
* @description Use `parent` when you want things tidy (like "Entire Collection" instead of listing 100 items)
* Use `child` when every single item matters (like important settings)
*/
showCheckedStrategy?: 'parent' | 'child';
/**
* @description whether to check or uncheck node when clicking on the node
*/
checkOnClickNode?: boolean;
/**
* @description whether to show the radio or checkbox prefix
*/
showPrefix?: boolean;
}
/**
* @deprecated Removed after 3.0.0, Use `CascaderComponentProps` instead.
*/
export declare const cascaderProps: {
emptyValues: ArrayConstructor;
valueOnClear: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null) | ((new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null))[], unknown, unknown, undefined, boolean>;
size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
placeholder: StringConstructor;
disabled: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
clearable: BooleanConstructor;
clearIcon: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | Component) & {}) | (() => string | Component) | ((new (...args: any[]) => (string | Component) & {}) | (() => string | Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
filterable: BooleanConstructor;
filterMethod: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (node: CascaderNode, keyword: string) => boolean) | (() => (node: CascaderNode, keyword: string) => boolean) | {
(): (node: CascaderNode, keyword: string) => boolean;
new (): any;
readonly prototype: any;
} | ((new (...args: any[]) => (node: CascaderNode, keyword: string) => boolean) | (() => (node: CascaderNode, keyword: string) => boolean) | {
(): (node: CascaderNode, keyword: string) => boolean;
new (): any;
readonly prototype: any;
})[], unknown, unknown, (node: CascaderNode, keyword: string) => boolean, boolean>;
separator: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
showAllLevels: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, boolean, boolean>;
collapseTags: BooleanConstructor;
maxCollapseTags: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
collapseTagsTooltip: BooleanConstructor;
maxCollapseTagsTooltipHeight: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(NumberConstructor | StringConstructor)[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
debounce: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
beforeFilter: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (value: string) => boolean | Promise<any>) | (() => (value: string) => boolean | Promise<any>) | {
(): (value: string) => boolean | Promise<any>;
new (): any;
readonly prototype: any;
} | ((new (...args: any[]) => (value: string) => boolean | Promise<any>) | (() => (value: string) => boolean | Promise<any>) | {
(): (value: string) => boolean | Promise<any>;
new (): any;
readonly prototype: any;
})[], unknown, unknown, () => true, boolean>;
placement: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "left" | "right" | "top" | "bottom" | "auto" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement) | ((new (...args: any[]) => "left" | "right" | "top" | "bottom" | "auto" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement))[], Placement, unknown, string, boolean>;
fallbackPlacements: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => Placement[]) | (() => Placement[]) | ((new (...args: any[]) => Placement[]) | (() => Placement[]))[], unknown, unknown, string[], boolean>;
popperClass: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | any)[])[])[])[])[])[])[])[])[])[])[]) | (() => string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | any)[])[])[])[])[])[])[])[])[])[])[]) | ((new (...args: any[]) => string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | any)[])[])[])[])[])[])[])[])[])[])[]) | (() => string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | any)[])[])[])[])[])[])[])[])[])[])[]))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
popperStyle: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string | false | import("vue").CSSProperties | StyleValue[]) | (() => StyleValue) | ((new (...args: any[]) => string | false | import("vue").CSSProperties | StyleValue[]) | (() => StyleValue))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
teleported: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
effect: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string) | (() => PopperEffect) | ((new (...args: any[]) => string) | (() => PopperEffect))[], unknown, unknown, string, boolean>;
tagType: {
default: string;
type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "primary" | "success" | "warning" | "info" | "danger", unknown>>;
required: false;
validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
tagEffect: {
default: string;
type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "dark" | "light" | "plain", unknown>>;
required: false;
validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, boolean, boolean>;
persistent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, boolean, boolean>;
showCheckedStrategy: import("element-plus/es/utils").EpPropFinalized<StringConstructor, string, unknown, string, boolean>;
checkOnClickNode: BooleanConstructor;
showPrefix: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, boolean, boolean>;
modelValue: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string | number | Record<string, any> | import("element-plus/es/components/cascader-panel").CascaderNodePathValue | (import("element-plus/es/components/cascader-panel").CascaderNodeValue | import("element-plus/es/components/cascader-panel").CascaderNodePathValue)[]) | (() => CascaderValue | null) | ((new (...args: any[]) => string | number | Record<string, any> | import("element-plus/es/components/cascader-panel").CascaderNodePathValue | (import("element-plus/es/components/cascader-panel").CascaderNodeValue | import("element-plus/es/components/cascader-panel").CascaderNodePathValue)[]) | (() => CascaderValue | null))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
options: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("element-plus/es/components/cascader-panel").CascaderOption[]) | (() => import("element-plus/es/components/cascader-panel").CascaderOption[]) | ((new (...args: any[]) => import("element-plus/es/components/cascader-panel").CascaderOption[]) | (() => import("element-plus/es/components/cascader-panel").CascaderOption[]))[], unknown, unknown, () => import("element-plus/es/components/cascader-panel").CascaderOption[], boolean>;
props: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("element-plus/es/components/cascader-panel").CascaderProps) | (() => import("element-plus/es/components/cascader-panel").CascaderProps) | ((new (...args: any[]) => import("element-plus/es/components/cascader-panel").CascaderProps) | (() => import("element-plus/es/components/cascader-panel").CascaderProps))[], unknown, unknown, () => import("element-plus/es/components/cascader-panel").CascaderProps, boolean>;
};
export declare const cascaderEmits: {
"update:modelValue": (value: CascaderValue | null | undefined) => boolean;
change: (value: CascaderValue | null | undefined) => boolean;
focus: (evt: FocusEvent) => boolean;
blur: (evt: FocusEvent) => boolean;
clear: () => boolean;
visibleChange: (val: boolean) => boolean;
expandChange: (val: CascaderValue) => boolean;
removeTag: (val: CascaderNode["valueByOption"]) => boolean;
};
export type CascaderEmits = typeof cascaderEmits;
export {};