UNPKG

@cainiaofe/cn-ui-m

Version:
101 lines (100 loc) 2.33 kB
import type { ReactNode } from 'react'; import type { CnModalProps } from "../../cn-modal"; import type { CnDialogButtonProps } from './cn-dialog-button-props'; import type { FooterAction } from './footer-action'; export interface CnDialogProps extends CnModalProps { /** * 是否显示 */ visible?: boolean; /** * 对话框的标题内容 */ title?: any; /** * 对话框内容 */ content?: string | ReactNode; /** * 按钮尺寸 */ size?: string; /** * 内容区域类名 */ contentClassName?: string; /** * 背景图片 */ bgImg?: string; /** * 是否居中展示 */ centered?: boolean; /** * 可震动的 */ vibrative?: boolean; /** * 是否展示底部关闭按钮 */ showBottomCloseIcon?: boolean; /** * 对话框类型 * 可选值: * normal,alert,confirm */ type?: 'normal' | 'alert' | 'confirm' | 'success' | 'error' | 'notice' | 'warning' | 'help'; /** * 显示提示类图标 */ showIcon?: boolean; /** * 关闭对话框模式 * 可选值: * close-关闭图标 (仅非 centered 模式生效) * mask-遮罩 * ok-确认按钮 * cancel-取消按钮 * 任意组合 */ closeMode?: CloseMode[]; /** * 确认按钮的属性,参见 CnButton 组件, 可通过 {text:'okText'} 额外修改按钮文案 */ okProps?: CnDialogButtonProps; /** * 确认按钮的属性,参见 CnButton 组件, 可通过 {text:'okText'} 额外修改按钮文案 */ cancelProps?: CnDialogButtonProps; /** * 底部内容,传入 false 时可禁不显示底部 */ footer?: any; /** * 按钮数组 * 可选值: * ['ok'] * ['cancel'] * ['ok', 'cancel'] * ['cancel', 'ok'] */ footerActions?: FooterAction[]; /** * 内容 */ children?: ReactNode; /** * 确定按钮被点击时回调 */ onOk?: (e: any) => void; /** * 取消按钮被点击时回调 */ onCancel?: (e: any) => void; /** * 关闭时调用 */ onClose?: (reason: string, e?: any) => void; } export type CloseMode = 'mask' | 'cancel' | 'ok' | 'close';