/** * @Date: 2024-10-2 14:22:08 * @Description: 侧边属性栏 * @Author: MoJie */ import BpmnModeler from 'bpmn-js/lib/Modeler'; import { CSSProperties, ReactNode } from 'react'; import { BusinessObjectType } from './panel'; export interface Option { value: any; label: string; } export interface BpmnProps { /** * @description 国际化 */ locale?: 'zh-CN' | 'en-CN'; /** * @description 画布字符串 * @default */ data?: string; /** * @description 异步获取画布xml */ request?: () => Promise; /** * @description 设计器高度(屏幕可视高度) * @default 60 */ height?: number; /** * @description 设计器样式 * @default {@link bpmnDefaultStyle} */ bpmnStyle?: CSSProperties; /** * @description 设计器位置 * @default default */ align?: 'center' | 'default'; /** * @description 工具栏属性 */ toolbar?: { /** * @description 保存方法 */ save?: (data: SaveProps) => Promise; /** * @description 样式 */ style?: CSSProperties; /** * @description 标题 */ title?: ReactNode | false; /** * @description 是否保存base64信息 */ isBase64?: boolean; }; /** * @description 工具栏自定义渲染 @param modeler 设计器实例 */ toolbarRender?: ((modeler: BpmnModeler) => ReactNode) | false; /** * @description 属性面板属性 */ panel?: { /** * @description 节点前缀 */ attrPrefix?: string; /** * @description 抽屉样式 */ style?: CSSProperties; /** * @description 抽屉宽度 */ width?: number; /** 用户列表 */ users?: Option[] | (() => Promise); /** 候选组列表,可以是角色、部门... */ groups?: Option[] | (() => Promise); }; /** * @description 自定义属性面板 @param modeler 设计器实例 */ panelRender?: ((modeler: BpmnModeler) => ReactNode) | false; /** * @description 流程key, flowable部署会用到,一般就是模型key */ flowKey?: string; /** * @description 流程名称:流程部署后显示的信息 */ flowName?: string; /** * @description 设计器加载完成之后的事件 * @param modeler 设计器对象 */ loadAfter?: (modeler: BpmnModeler) => void; /** * @description 设计器加载失败的事件 * @param modeler 设计器对象 * @param err 加载失败信息 */ loadError?: (modeler: BpmnModeler, err: any) => void; } interface SaveProps { /** * @description 设计器数据 */ xml: string; /** * @description 设计器缩略图 */ base64?: string; /** * @description 模型名称 */ name?: string; /** * @description 模型描述 */ description?: string; } export interface ToolbarProps { /** * @description 导入的xml */ uploadXml: (xml: string) => void; /** bpmn对象 */ modeler: BpmnModeler; /** * @description 是否保存base64信息 */ isBase64?: boolean; /** 保存方法 */ save?: (data: SaveProps) => Promise; /** 样式 */ style?: CSSProperties; /** 标题 */ title?: ReactNode | false; /** * bpmn模型信息 */ bpmnData?: SaveProps; } export type Element = import('bpmn-js/lib/model/Types').Element & { businessObject: BusinessObjectType; }; /** * 默认画布样式 */ export declare const bpmnDefaultStyle: CSSProperties; /** * 顶部工具栏样式 */ export declare const toolbarDefaultStyle: CSSProperties; /** * bpmn默认字符串 * 在flowable定义时存入库中,flowable会解析xml的id和name * @param flowKey 流程标识 * @param flowName 流程名称 * isExecutable:可执行的 * @returns */ export declare const xmlStr: (flowKey?: string, flowName?: string) => string; /** * 下载当前流程设计图片 */ export declare const downloadSvg: (modeler: any, isBase64?: ((str: string) => void) | undefined) => Promise; export {};