import { CSSProperties, ReactNode, MouseEventHandler, ComponentType, ReactElement } from 'react'; import { ButtonProps } from 'antd/lib/button'; /** * 图标模式 * @description 定义图标的显示模式:纯图标或按钮形式 */ export type ProIconModeType = 'icon' | 'button'; /** * 图标映射对象 */ interface ProIconMapType { /** * 图标类型 * @description 唯一标识图标的类型名称 * @default undefined */ type: string; /** * 中文显示文本 * @description 图标对应的中文描述 * @default undefined */ 'text-cn'?: string; /** * 英文显示文本 * @description 图标对应的英文描述 * @default undefined */ 'text-en'?: string; } /** * 主题映射对象 */ interface ProIconThemeMapType { /** * 主题颜色映射 * @description 不同主题下的颜色值数组 * @default undefined */ [key: string]: string[]; } /** * 操作映射对象 */ interface ProIconActionMapType { /** * 主题颜色映射 * @description 不同主题下的颜色映射 * @default undefined */ themeMap?: ProIconThemeMapType; /** * 主题填充颜色映射 * @description 不同主题下的填充颜色映射 * @default undefined */ themeFillMap?: ProIconThemeMapType; /** * 渐变色值 * @description 渐变色值数组 * @default undefined */ gradation?: string[]; /** * 填充色值 * @description 填充色值数组 * @default undefined */ fill?: string[]; } export interface ProIconType { /** * 自定义 SVG 组件 * @description 自定义 SVG React 组件或 SVG 文件路径,支持传入组件类型、组件实例或字符串路径,优先级高于 src 和 type * @default undefined */ component?: ComponentType | ReactElement | string; /** * 图标路径 * @description 本地import引入的图标路径 * @default undefined */ src?: string; /** * 图标名称 * @description 图标的类型名称,用于识别特定图标 * @default null */ type?: string | null; /** * 图标大小 * @description 图标的大小,同时设置图标的width以及height * @default '1em' */ size?: number | string; /** * 旋转角度 * @description 图标旋转角度(IE9 无效) * @default undefined */ rotate?: number; /** * 是否旋转 * @description 图标是否旋转loading效果 * @default false */ spin?: boolean; /** * 图标颜色 * @description 图标的颜色,设置svg的fill属性 * @default undefined */ color?: string; /** * 是否禁用 * @description 设置图标为禁用状态 * @default false */ disabled?: boolean; /** * 提示信息 * @description 鼠标悬停时显示的提示信息 * @default undefined */ tooltip?: string | ReactNode; /** * 是否跟随主题 * @description 是否跟随系统主题色变化 * @default false */ theme?: boolean; /** * 点击事件 * @description 图标的点击事件处理函数 * @default undefined */ onClick?: MouseEventHandler; /** * 自定义类名 * @description 自定义图标的CSS类名 * @default undefined */ className?: string; /** * 自定义样式 * @description 计算后的svg元素样式,优先级高于size/color/rotate属性 * @default {} */ style?: CSSProperties; /** * 显示模式 * @description 图标的显示模式:图标或按钮 * @default 'icon' */ mode?: ProIconModeType; /** * 按钮属性 * @description mode为button时的按钮属性,与antd Button接收props一致 * @default {} */ buttonProps?: ButtonProps; /** * 图标映射表 * @description 图标与中英文文本的映射表 * @default [] */ mapList?: ProIconMapType[]; /** * SVG操作表 * @description SVG变更操作表,用于主题配置 * @default undefined */ actionMap?: ProIconActionMapType; /** * 按钮图标标记 * @description 内部使用,标记图标作为按钮使用 * @default true */ buttonIcon?: boolean; } export {};