import type { CSSProperties, ReactNode } from 'react'; /** * 布局模式 */ export declare type BatchActionBarPosition = 'sticky-top' | 'sticky-bottom' | 'float' | 'inline'; /** * 确认弹窗配置 */ export interface BatchActionConfirmConfig { /** * 弹窗标题 */ title?: string; /** * 弹窗描述内容 */ description?: string; /** * 确认按钮文案 */ okText?: string; /** * 取消按钮文案 */ cancelText?: string; } /** * 默认操作按钮配置 * @description 固定四个基础操作按钮:全选、反选、取消选择、删除 */ export interface DefaultActionsConfig { /** * 是否显示默认操作按钮(全选、反选、取消选择、删除) * @default true */ showDefaultActions?: boolean; /** * 是否显示全选按钮 * @default true */ showSelectAll?: boolean; /** * 是否显示反选按钮 * @default true */ showInvert?: boolean; /** * 是否显示取消选择按钮 * @default true */ showClear?: boolean; /** * 是否显示删除按钮 * @default true */ showDelete?: boolean; } /** * 自定义操作按钮配置 */ export interface BatchActionItem { /** * 操作唯一标识 */ key: string; /** * 按钮文案 */ label: ReactNode; /** * 按钮图标 */ icon?: ReactNode; /** * 按钮尺寸 * @description 对应 GraphicTextCard 的 size 属性 * @default 'small' */ size?: 'small' | 'default' | 'large'; /** * 是否禁用 * @description 支持函数形式,基于 selection 动态判断 */ disabled?: boolean | ((selectedKeys: React.Key[], selectedRows?: any[]) => boolean); /** * 是否显示 * @description 支持函数形式,基于 selection 动态判断 * @default true */ visible?: boolean | ((selectedKeys: React.Key[], selectedRows?: any[]) => boolean); /** * 是否显示 loading 状态 */ loading?: boolean; /** * 是否需要确认弹窗 * @default false */ confirm?: boolean | BatchActionConfirmConfig; /** * 自定义样式 */ style?: CSSProperties; /** * 自定义类名 */ className?: string; /** * 按钮组标识 * @description 相同 group 的按钮会分组展示 */ group?: string; /** * 按钮点击回调 * @description 如果配置了此回调,会优先使用此回调,否则使用组件级别的 onActionClick */ onClick?: (selectedKeys: React.Key[], selectedRows?: any[]) => void | Promise; } /** * PisellBatchActionBar 组件 Props * @description 批量操作栏组件,用于承载基于选中对象的批量行为操作 */ export interface PisellBatchActionBarProps { /** * 自定义类名 */ className?: string; /** * 自定义样式 */ style?: CSSProperties; /** * 选中的 key 数组 * @description 必填,用于感知选择状态 */ selectedKeys: React.Key[]; /** * 选中的行数据数组 * @description 可选,用于传递给操作回调 */ selectedRows?: any[]; /** * 总数据量 * @description 用于判断全选状态 */ total?: number; /** * 当前页数据量 * @description 用于判断全选当前页状态 */ currentPageTotal?: number; /** * 当前页数据 key 数组 * @description 用于判断全选当前页状态 */ currentPageKeys?: React.Key[]; /** * 布局模式 * @default 'float' */ position?: BatchActionBarPosition; /** * 吸顶/吸底时的偏移量 * @default 0 */ offset?: number; /** * 是否显示选中数量提示 * @default true */ showSelectedCount?: boolean; /** * 选中数量提示文案 * @description 支持字符串模板(使用 {count} 占位符)或函数形式,默认使用国际化文本 * @default getText('batch-action-bar-selected-count', count) */ selectedCountText?: string | ((count: number) => string); /** * 默认操作按钮配置 * @description 只包含前三个基础选择操作按钮,其他操作按钮通过 actions 传入 */ defaultActions?: DefaultActionsConfig; /** * 自定义操作按钮配置 */ actions?: BatchActionItem[]; /** * 操作按钮排序 * @description 通过 key 数组控制按钮顺序 */ actionOrder?: string[]; /** * 是否启用溢出折叠 * @default true */ enableOverflow?: boolean; /** * 溢出折叠阈值(按钮数量) * @default 5 */ overflowThreshold?: number; /** * "更多"按钮文案 * @description 默认使用国际化文本 * @default getText('batch-action-bar-more') */ moreText?: string; /** * 全选回调 */ onSelectAll?: () => void; /** * 反选回调 * @description 反选操作,将当前选中的变为未选中,未选中的变为选中 */ onInvert?: () => void; /** * 清空选择回调 */ onClear?: () => void; /** * 删除回调 * @description 删除选中项,点击后会先弹出确认弹窗 */ onDelete?: (selectedKeys: React.Key[], selectedRows?: any[]) => void; /** * 删除确认弹窗配置 * @description 自定义删除确认弹窗的标题和内容 */ deleteConfirmConfig?: BatchActionConfirmConfig; /** * 自定义操作按钮点击回调 * @description 当 actions 中的按钮被点击时触发,通过 action.key 区分不同的操作 * @description 如果 action 中配置了 onClick,则优先使用 action.onClick */ onActionClick?: (key: string, selectedKeys: React.Key[], selectedRows?: any[]) => void | Promise; }