UNPKG

ant-design-x-vue-next

Version:

Ant Design X for Vue — community continuation aligned with @ant-design/x

102 lines (101 loc) 3.46 kB
import type { CSSProperties, HTMLAttributes, VNode } from "vue"; import { AvoidValidation } from '../type-utility'; export interface BasePromptItem { /** * @desc 唯一标识用于区分每个提示项。 * @descEN Unique identifier used to distinguish each prompt item. */ key: string; /** * @desc 提示图标显示在提示项的左侧。 * @descEN Prompt icon displayed on the left side of the prompt item. */ icon?: VNode; /** * @desc 提示标签显示提示的主要内容。 * @descEN Prompt label displaying the main content of the prompt. */ label?: VNode | string; /** * @desc 提示描述提供额外的信息。 * @descEN Prompt description providing additional information. */ description?: VNode | string; /** * @desc 设置为 true 时禁用点击事件。 * @descEN When set to true, click events are disabled. */ disabled?: boolean; } export interface PromptProps extends BasePromptItem { children?: BasePromptItem[]; } /** Align React `@ant-design/x` export name for prompt list items. */ export type PromptsItemType = PromptProps; /** Align React `BasePromptsItemType` naming. */ export type BasePromptsItemType = BasePromptItem; /** Align React Prompts SemanticType. */ export type SemanticType = 'root' | 'list' | 'item' | 'itemContent' | 'title' | 'subList' | 'subItem'; export type PromptsSemanticType = SemanticType; export interface PromptsRef { nativeElement: HTMLDivElement; } export interface PromptsProps extends Omit<HTMLAttributes, 'onClick' | 'title'> { /** * @desc 包含多个提示项的列表。 * @descEN List containing multiple prompt items. */ items?: PromptProps[]; /** * @desc 显示在提示列表顶部的标题。 * @descEN Title displayed at the top of the prompt list. */ title?: AvoidValidation<VNode | string | (() => VNode | string)>; /** * @desc Item 提示项被点击时的回调函数。 * @descEN Callback function when a prompt item is clicked. */ onItemClick?: (info: { data: PromptProps; }) => void; /** * @desc 提示列表是否垂直排列。 * @descEN Whether the prompt list is arranged vertically. */ vertical?: boolean; /** * @desc 提示列表是否换行。 * @descEN Whether the prompt list is wrapped. */ wrap?: boolean; /** * @desc 挂载时淡入动画。 * @descEN Fade-in animation on mount. */ fadeIn?: boolean; /** * @desc 挂载时从左淡入(与 fadeIn 同时设置时优先)。 * @descEN Left-mask fade-in on mount (wins over fadeIn when both set). */ fadeInLeft?: boolean; /** * @desc 自定义样式,用于各个提示项的不同部分。 * @descEN Custom styles for different parts of each prompt item. */ styles?: Partial<Record<SemanticType, CSSProperties>>; /** * @desc 自定义样式类名,用于各个提示项的不同部分。 * @descEN Custom style class names for different parts of each prompt item. */ classNames?: Partial<Record<SemanticType, string>>; /** * @desc 样式类名的前缀。 * @descEN Prefix for style class names. */ prefixCls?: string; /** * @desc 根节点的样式类名。 * @descEN Style class name for the root node. */ rootClassName?: string; }