import type { CSSProperties, ReactNode } from 'react'; import type { PisellStepsProps } from '../PisellSteps/types'; /** * 步骤项数据 */ export interface StepItem { /** 步骤索引 */ index?: number; /** 步骤标题 */ title?: ReactNode; /** 步骤描述 */ description?: ReactNode; /** 其他数据 */ [key: string]: any; } /** * 步骤变化结果 */ export interface StepChangeResult { /** 是否成功 */ success: boolean; /** 当前步骤索引 */ currentStep: number; /** 当前步骤数据 */ currentItem: StepItem | null; } /** * PisellProcedure Ref 暴露的方法 * @description 通过 ref 可以调用的组件方法 */ export interface PisellProcedureRef { /** * 跳转到上一步 * @returns 步骤变化结果,如果无法跳转则返回 null */ goPrev: () => StepChangeResult | null; /** * 跳转到下一步 * @returns 步骤变化结果,如果无法跳转则返回 null */ goNext: () => StepChangeResult | null; /** * 跳转到指定步骤 * @param step - 目标步骤索引 * @returns 步骤变化结果,如果无法跳转则返回 null */ goToStep: (step: number) => StepChangeResult | null; /** * 获取当前步骤索引 * @returns 当前步骤索引 */ getCurrentStep: () => number; /** * 打开移动端总结弹窗 */ openSummaryModal: () => void; /** * 关闭移动端总结弹窗 */ closeSummaryModal: () => void; } /** * 返回确认弹窗配置 */ export interface BackConfirmModalConfig { /** * 是否启用返回确认弹窗 * @default true */ enabled?: boolean; /** * 弹窗标题 * @description 支持字符串格式 */ title?: string; /** * 弹窗描述内容 * @description 支持字符串格式 */ describe?: string; /** * 弹窗底部插槽 * @description 底部按钮区域,支持放置任意内容 */ footer?: ReactNode; } /** * 头部插槽顺序 */ export declare type HeaderSlotOrder = 'default' | 'reverse'; /** * ProcedureHeader 头部区域配置 */ export interface ProcedureHeaderProps { /** 自定义类名 */ className?: string; /** 自定义样式 */ style?: CSSProperties; /** 左侧插槽(上一步按钮、返回图标等) */ left?: ReactNode; /** 右侧插槽(关闭按钮、图标等) */ right?: ReactNode; /** * 插槽顺序 * @description 'default' - 默认顺序(left 在左,right 在右),'reverse' - 反转顺序(left 在右,right 在左) * @default 'default' */ slotOrder?: HeaderSlotOrder; /** 步骤条配置,透传给 PisellSteps 组件 */ stepsProps?: PisellStepsProps; /** * 是否显示步骤条 * @default true */ showSteps?: boolean; /** * 第一步时是否显示返回按钮 * @default false */ showBackOnFirstStep?: boolean; /** * 返回上一步确认弹窗配置 */ backConfirmModal?: BackConfirmModalConfig; /** * 关闭确认弹窗配置 */ closeConfirmModal?: BackConfirmModalConfig; } /** * 主体区域布局模式 */ export declare type BodyLayoutMode = 'fixed' | 'ratio'; /** * 内容区与信息区的比例配置 * @example '7:3' | '6:4' */ export declare type BodyLayoutRatio = `${number}:${number}`; /** * 主体区域排列方向 */ export declare type BodyDirection = 'horizontal' | 'vertical'; /** * 主体区域内容顺序 */ export declare type BodyContentOrder = 'content-first' | 'sidebar-first'; /** * ProcedureBody 主体区域配置 */ export interface ProcedureBodyProps { /** 自定义类名 */ className?: string; /** 自定义样式 */ style?: CSSProperties; /** * 排列方向 * @description 'horizontal' - 横向排列(左右布局),'vertical' - 纵向排列(上下布局) * @default 'horizontal' */ direction?: BodyDirection; /** * 内容顺序 * @description 'content-first' - 内容区在前(默认:横向时内容区在左,纵向时内容区在上) * @description 'sidebar-first' - 信息区在前(横向时信息区在左,纵向时信息区在上) * @default 'content-first' */ contentOrder?: BodyContentOrder; /** * 布局模式 * @description 'fixed' - 固定宽度(信息区宽度随屏幕断点变化) * @description 'ratio' - 比例布局(按设定比例分配宽度) * @default 'fixed' */ layoutMode?: BodyLayoutMode; /** * 内容区与信息区的比例 * @description 仅在 layoutMode='ratio' 时生效 * @example '7:3' - 内容区占 70%,信息区占 30% * @default '7:3' */ layoutRatio?: BodyLayoutRatio; /** 内容区插槽 */ contentSlot?: ReactNode; /** 内容区类名 */ contentClassName?: string; /** 内容区样式 */ contentStyle?: CSSProperties; /** 信息区插槽 */ sidebarSlot?: ReactNode; /** 信息区类名 */ sidebarClassName?: string; /** 信息区样式 */ sidebarStyle?: CSSProperties; /** * 信息区容器选择器(类名或 ID) * @description 用于计算信息区高度的容器元素,支持类名(如 '.modal-container')或 ID(如 '#dialog-container') * @description 如果不提供,则使用 window.innerHeight 作为基准 */ sidebarContainerSelector?: string; } /** * 底部操作区位置模式 */ export declare type FooterPositionMode = 'fixed-bottom' | 'fixed-content-bottom' | 'fixed-sidebar-bottom' | 'float-all' | 'float-content' | 'float-sidebar'; /** * ProcedureFooter 底部区域配置 */ export interface ProcedureFooterProps { /** 自定义类名 */ className?: string; /** 自定义样式 */ style?: CSSProperties; /** * 左侧插槽 * @description 底部左侧区域,可放置自定义内容(如总价信息、提示文案等) */ leftSlot?: ReactNode; /** * 右侧操作按钮组 * @description 底部右侧区域,放置操作按钮(如上一步、下一步、提交等) */ actions?: ReactNode; /** * 移动端总结按钮插槽 * @description 当宽度小于744px时显示,点击可弹窗展示信息区内容 */ summaryButton?: ReactNode; /** * 移动端弹窗标题 * @description summaryButton 点击后弹窗的标题 * @default '详情' */ summaryModalTitle?: string; /** * More 按钮文案 * @default 'More' */ moreText?: string; /** * 是否启用溢出收纳功能 * @description 当宽度不足时,将次序列的按钮收纳到 More 菜单中 * @default true */ enableOverflow?: boolean; /** * 底部操作区位置模式 * @description 控制底部操作区的展示位置 * @default 'float-sidebar' */ position?: FooterPositionMode; } /** * 组件使用模式 */ export declare type ProcedureMode = 'page' | 'modal'; /** * PisellProcedure 组件 Props * @description 流程容器组件,用于管理多步骤流程的复合容器 */ export interface PisellProcedureProps { /** * 自定义类名 */ className?: string; /** * 自定义样式 */ style?: CSSProperties; /** * 组件使用模式 * @description 'page' - 页面模式(默认),'modal' - 弹窗模式 * @description 弹窗模式下:不应用移动端模式、不隐藏信息部分、不设置底部为固定悬浮、不显示移动端总结按钮、不执行响应式类名计算 * @default 'page' */ mode?: ProcedureMode; /** * 是否显示头部区域 * @default true */ showHeader?: boolean; /** * 是否显示信息区(侧边栏) * @default true */ showSidebar?: boolean; /** * 是否显示底部区域 * @default true */ showFooter?: boolean; /** * 默认当前步骤 * @default 0 */ defaultCurrent?: number; /** * 步骤变化回调 * @description 当步骤变化时触发,返回步骤变化结果 */ onStepsChange?: (result: StepChangeResult) => void; /** * 头部区域配置 */ headerProps?: ProcedureHeaderProps; /** * 主体区域配置 */ bodyProps?: ProcedureBodyProps; /** * 底部区域配置 */ footerProps?: ProcedureFooterProps; /** * 上一步事件回调 * @description 当触发上一步操作时调用(在步骤更新之前触发) * @param current - 当前步骤索引 * @returns 返回 false 可以阻止步骤更新 */ onPrev?: (current: number) => boolean | void; /** * 下一步事件回调 * @description 当触发下一步操作时调用(在步骤更新之前触发) * @param current - 当前步骤索引 * @returns 返回 false 可以阻止步骤更新 */ onNext?: (current: number) => boolean | void; /** * 首步返回按钮点击回调 * @description 当在第一步且 showBackOnFirstStep 为 true 时,点击返回按钮触发此回调。如果不传递,默认跳转到首页(/) */ onFirstStepBack?: () => void; /** * 关闭按钮点击回调 */ onClose?: () => void; /** * 返回确认弹窗按钮回调 * @description 当点击返回确认弹窗的按钮时触发 * @param action - 'cancel' 点击清除按钮, 'ok'/'confirm' 点击保留按钮 */ onBackConfirm?: (action: 'cancel' | 'ok' | 'confirm') => void; /** * 关闭确认弹窗按钮回调 * @description 当点击关闭确认弹窗的按钮时触发 * @param action - 'cancel' 点击取消按钮, 'ok'/'confirm' 点击确认按钮 */ onCloseConfirm?: (action: 'cancel' | 'ok' | 'confirm') => void; /** * 设计模式标识 * @description 低代码引擎使用 */ __designMode?: 'design' | 'preview'; /** * 组件唯一标识 * @description 低代码引擎使用 */ __id?: string; /** * 其他扩展配置 * @description 用于透传额外属性 */ other?: Record; }