diff --git a/package.json b/package.json index b911cd6..223af4f 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "animate.css": "4.1.1", "await-to-js": "3.0.0", "axios": "1.7.8", - "bpmn-js": "16.4.0", "crypto-js": "4.2.0", "diagram-js": "12.3.0", "didi": "9.0.2", diff --git a/src/bpmn/assets/defaultXML.ts b/src/bpmn/assets/defaultXML.ts deleted file mode 100644 index dff0349..0000000 --- a/src/bpmn/assets/defaultXML.ts +++ /dev/null @@ -1,23 +0,0 @@ -function generateRandomValue() { - // 生成一个随机数 - const randomValue = Math.random().toString(36).slice(2, 12); - return `Process_${randomValue}`; -} - -const cartage: string = 'default'; -export default ` - - - - - - - - - - - - - - -`; diff --git a/src/bpmn/assets/lang/zh.ts b/src/bpmn/assets/lang/zh.ts deleted file mode 100644 index ee0c5de..0000000 --- a/src/bpmn/assets/lang/zh.ts +++ /dev/null @@ -1,126 +0,0 @@ -export const NodeName = { - 'bpmn:Process': '流程', - 'bpmn:StartEvent': '开始事件', - 'bpmn:IntermediateThrowEvent': '中间事件', - 'bpmn:Task': '任务', - 'bpmn:SendTask': '发送任务', - 'bpmn:ReceiveTask': '接收任务', - 'bpmn:UserTask': '用户任务', - 'bpmn:ManualTask': '手工任务', - 'bpmn:BusinessRuleTask': '业务规则任务', - 'bpmn:ServiceTask': '服务任务', - 'bpmn:ScriptTask': '脚本任务', - 'bpmn:EndEvent': '结束事件', - 'bpmn:SequenceFlow': '流程线', - 'bpmn:ExclusiveGateway': '互斥网关', - 'bpmn:ParallelGateway': '并行网关', - 'bpmn:InclusiveGateway': '相容网关', - 'bpmn:ComplexGateway': '复杂网关', - 'bpmn:EventBasedGateway': '事件网关', - 'bpmn:Participant': '池/参与者', - 'bpmn:SubProcess': '子流程', - 'bpmn:DataObjectReference': '数据对象引用', - 'bpmn:DataStoreReference': '数据存储引用', - 'bpmn:Group': '组' -}; - -export default { - 'Activate hand tool': '启动手动工具', - 'Activate lasso tool': '启动 Lasso 工具', - 'Activate create/remove space tool': '启动创建/删除空间工具', - 'Activate global connect tool': '启动全局连接工具', - 'Ad-hoc': 'Ad-hoc', - 'Add lane above': '在上方添加泳道', - 'Add lane below': '在下方添加泳道', - 'Business rule task': '规则任务', - 'Call activity': '引用流程', - 'Compensation end event': '结束补偿事件', - 'Compensation intermediate throw event': '中间补偿抛出事件', - 'Complex gateway': '复杂网关', - 'Conditional intermediate catch event': '中间条件捕获事件', - 'Conditional start event (non-interrupting)': '条件启动事件 (非中断)', - 'Conditional start event': '条件启动事件', - 'Connect using association': '文本关联', - 'Connect using sequence/message flow or association': '消息关联', - 'Change element': '更改元素', - 'Change type': '更改类型', - 'Create data object reference': '创建数据对象引用', - 'Create data store reference': '创建数据存储引用', - 'Create expanded sub-process': '创建可折叠子流程', - 'Create pool/participant': '创建池/参与者', - 'Collection': '集合', - 'Connect using data input association': '数据输入关联', - 'Data store reference': '数据存储引用', - 'Data object reference': '数据对象引用', - 'Divide into two lanes': '分成两个泳道', - 'Divide into three lanes': '分成三个泳道', - 'End event': '结束事件', - 'Error end event': '结束错误事件', - 'Escalation end event': '结束升级事件', - 'Escalation intermediate throw event': '中间升级抛出事件', - 'Event sub-process': '事件子流程', - 'Event-based gateway': '事件网关', - 'Exclusive gateway': '互斥网关', - 'Empty pool/participant (removes content)': '清空池/参与者 (删除内容)', - 'Empty pool/participant': '清空池/参与者', - 'Expanded pool/participant': '展开池/参与者', - 'Inclusive gateway': '相容网关', - 'Intermediate throw event': '中间抛出事件', - 'Loop': '循环', - 'Link intermediate catch event': '中间链接捕获事件', - 'Link intermediate throw event': '中间链接抛出事件', - 'Manual task': '手动任务', - 'Message end event': '结束消息事件', - 'Message intermediate catch event': '中间消息捕获事件', - 'Message intermediate throw event': '中间消息抛出事件', - 'Message start event': '消息启动事件', - 'Parallel gateway': '并行网关', - 'Parallel multi-instance': '并行多实例', - 'Participant multiplicity': '参与者多重性', - 'Receive task': '接受任务', - 'Remove': '移除', - 'Script task': '脚本任务', - 'Send task': '发送任务', - 'Sequential multi-instance': '串行多实例', - 'Service task': '服务任务', - 'Signal end event': '结束信号事件', - 'Signal intermediate catch event': '中间信号捕获事件', - 'Signal intermediate throw event': '中间信号抛出事件', - 'Signal start event (non-interrupting)': '信号启动事件 (非中断)', - 'Signal start event': '信号启动事件', - 'Start event': '开始事件', - 'Sub-process (collapsed)': '可折叠子流程', - 'Sub-process (expanded)': '可展开子流程', - 'Sub rocess': '子流程', - 'Task': '任务', - 'Transaction': '事务', - 'Terminate end event': '终止边界事件', - 'Timer intermediate catch event': '中间定时捕获事件', - 'Timer start event (non-interrupting)': '定时启动事件 (非中断)', - 'Timer start event': '定时启动事件', - 'User task': '用户任务', - 'Create start event': '创建开始事件', - 'Create gateway': '创建网关', - 'Create intermediate/boundary event': '创建中间/边界事件', - 'Create end event': '创建结束事件', - 'Create group': '创建组', - 'Create startEvent': '开始节点', - 'Create endEvent': '结束节点', - 'Create exclusiveGateway': '互斥网关', - 'Create parallelGateway': '并行网关', - 'Create task': '任务节点', - 'Create userTask': '用户任务节点', - 'Condition type': '条件类型', - 'Append end event': '追加结束事件节点', - 'Append gateway': '追加网关节点', - 'Append task': '追加任务', - 'Append user task': '追加用户任务节点', - 'Append text annotation': '追加文本注释', - 'Append intermediate/boundary event': '追加中间或边界事件', - 'Append receive task': '追加接收任务节点', - 'Append message intermediate catch event': '追加中间消息捕获事件', - 'Append timer intermediate catch event': '追加中间定时捕获事件', - 'Append conditional intermediate catch event': '追加中间条件捕获事件', - 'Append signal intermediate catch event': '追加中间信号捕获事件', - 'flow elements must be children of pools/participants': '流程元素必须是池/参与者的子元素' -}; diff --git a/src/bpmn/assets/moddle/flowable.ts b/src/bpmn/assets/moddle/flowable.ts deleted file mode 100644 index de959a6..0000000 --- a/src/bpmn/assets/moddle/flowable.ts +++ /dev/null @@ -1,1250 +0,0 @@ -export default { - 'name': 'Flowable', - 'uri': 'http://flowable.org/bpmn', - 'prefix': 'flowable', - 'xml': { - 'tagAlias': 'lowerCase' - }, - 'associations': [], - 'types': [ - { - 'name': 'flowable:extCandidateUsers', - 'isAbstract': true, - 'extends': [], - 'superClass': ['Element'], - 'meta': { - 'allowedIn': ['*'] - }, - 'properties': [ - { - 'name': 'body', - 'type': 'String', - 'isBody': true - } - ] - }, - { - 'name': 'flowable:extAssignee', - 'isAbstract': true, - 'extends': [], - 'superClass': ['Element'], - 'meta': { - 'allowedIn': ['*'] - }, - 'properties': [ - { - 'name': 'body', - 'type': 'String', - 'isBody': true - } - ] - }, - { - 'name': 'flowable:property', - 'superClass': ['Element'], - 'properties': [ - { - 'name': 'id', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'name', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'value', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'flowable:properties', - 'isAbstract': true, - 'extends': [], - 'superClass': ['Element'], - 'meta': { - 'allowedIn': ['*'] - }, - 'properties': [ - { - 'name': 'values', - 'type': 'flowable:property', - 'isMany': true - } - ] - }, - { - 'name': 'InOutBinding', - 'superClass': ['Element'], - 'isAbstract': true, - 'properties': [ - { - 'name': 'source', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'sourceExpression', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'target', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'businessKey', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'local', - 'isAttr': true, - 'type': 'Boolean', - 'default': false - }, - { - 'name': 'variables', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'In', - 'superClass': ['InOutBinding'], - 'meta': { - 'allowedIn': ['bpmn:CallActivity'] - } - }, - { - 'name': 'Out', - 'superClass': ['InOutBinding'], - 'meta': { - 'allowedIn': ['bpmn:CallActivity'] - } - }, - { - 'name': 'AsyncCapable', - 'isAbstract': true, - 'extends': ['bpmn:Activity', 'bpmn:Gateway', 'bpmn:Event'], - 'properties': [ - { - 'name': 'async', - 'isAttr': true, - 'type': 'Boolean', - 'default': false - }, - { - 'name': 'asyncBefore', - 'isAttr': true, - 'type': 'Boolean', - 'default': false - }, - { - 'name': 'asyncAfter', - 'isAttr': true, - 'type': 'Boolean', - 'default': false - }, - { - 'name': 'exclusive', - 'isAttr': true, - 'type': 'Boolean', - 'default': true - } - ] - }, - { - 'name': 'flowable:in', - 'superClass': ['Element'], - 'properties': [ - { - 'name': 'source', - 'type': 'string', - 'isAttr': true - }, - { - 'name': 'target', - 'type': 'string', - 'isAttr': true - } - ] - }, - { - 'name': 'flowable:out', - 'superClass': ['Element'], - 'properties': [ - { - 'name': 'source', - 'type': 'string', - 'isAttr': true - }, - { - 'name': 'target', - 'type': 'string', - 'isAttr': true - } - ] - }, - { - 'name': 'BoundaryEvent', - 'superClass': ['CatchEvent'], - 'properties': [ - { - 'name': 'cancelActivity', - 'default': true, - 'isAttr': true, - 'type': 'Boolean' - }, - { - 'name': 'attachedToRef', - 'type': 'Activity', - 'isAttr': true, - 'isReference': true - } - ] - }, - { - 'name': 'JobPriorized', - 'isAbstract': true, - 'extends': ['bpmn:Process', 'flowable:AsyncCapable'], - 'properties': [ - { - 'name': 'jobPriority', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'SignalEventDefinition', - 'isAbstract': true, - 'extends': ['bpmn:SignalEventDefinition'], - 'properties': [ - { - 'name': 'async', - 'isAttr': true, - 'type': 'Boolean', - 'default': false - } - ] - }, - { - 'name': 'ErrorEventDefinition', - 'isAbstract': true, - 'extends': ['bpmn:ErrorEventDefinition'], - 'properties': [ - { - 'name': 'errorCodeVariable', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'errorMessageVariable', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'Error', - 'isAbstract': true, - 'extends': ['bpmn:Error'], - 'properties': [ - { - 'name': 'flowable:errorMessage', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'PotentialStarter', - 'superClass': ['Element'], - 'properties': [ - { - 'name': 'resourceAssignmentExpression', - 'type': 'bpmn:ResourceAssignmentExpression' - } - ] - }, - { - 'name': 'UserTask', - 'isAbstract': true, - 'extends': ['bpmn:UserTask'], - 'properties': [ - { - 'name': 'timerEventDefinition', - 'type': 'Expression' - }, - { - 'name': 'multiInstanceLoopCharacteristics', - 'type': 'MultiInstanceLoopCharacteristics' - } - ] - }, - { - 'name': 'StartEvent', - 'isAbstract': true, - 'extends': ['bpmn:StartEvent'], - 'properties': [ - { - 'name': 'timerEventDefinition', - 'type': 'Expression' - } - ] - }, - { - 'name': 'FormSupported', - 'isAbstract': true, - 'extends': ['bpmn:StartEvent', 'bpmn:UserTask'], - 'properties': [ - { - 'name': 'formHandlerClass', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'formKey', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'TemplateSupported', - 'isAbstract': true, - 'extends': ['bpmn:Process', 'bpmn:FlowElement'], - 'properties': [ - { - 'name': 'modelerTemplate', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'Initiator', - 'isAbstract': true, - 'extends': ['bpmn:StartEvent'], - 'properties': [ - { - 'name': 'initiator', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'ScriptTask', - 'isAbstract': true, - 'extends': ['bpmn:ScriptTask'], - 'properties': [ - { - 'name': 'resultVariable', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'resource', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'Process', - 'isAbstract': true, - 'extends': ['bpmn:Process'], - 'properties': [ - { - 'name': 'candidateStarterGroups', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'candidateStarterUsers', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'versionTag', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'historyTimeToLive', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'isStartableInTasklist', - 'isAttr': true, - 'type': 'Boolean', - 'default': true - } - ] - }, - { - 'name': 'EscalationEventDefinition', - 'isAbstract': true, - 'extends': ['bpmn:EscalationEventDefinition'], - 'properties': [ - { - 'name': 'escalationCodeVariable', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'FormalExpression', - 'isAbstract': true, - 'extends': ['bpmn:FormalExpression'], - 'properties': [ - { - 'name': 'resource', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'Assignable', - 'extends': ['bpmn:UserTask'], - 'properties': [ - { - 'name': 'candidateGroups', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'dueDate', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'followUpDate', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'priority', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'CallActivity', - 'extends': ['bpmn:CallActivity'], - 'properties': [ - { - 'name': 'calledElementBinding', - 'isAttr': true, - 'type': 'String', - 'default': 'latest' - }, - { - 'name': 'calledElementVersion', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'calledElementVersionTag', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'calledElementTenantId', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'caseRef', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'caseBinding', - 'isAttr': true, - 'type': 'String', - 'default': 'latest' - }, - { - 'name': 'caseVersion', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'caseTenantId', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'variableMappingClass', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'variableMappingDelegateExpression', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'ServiceTaskLike', - 'extends': ['bpmn:ServiceTask', 'bpmn:BusinessRuleTask', 'bpmn:SendTask', 'bpmn:MessageEventDefinition'], - 'properties': [ - { - 'name': 'expression', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'class', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'delegateExpression', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'resultVariable', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'ExclusiveGateway', - 'isAbstract': true, - 'extends': ['bpmn:ExclusiveGateway'], - 'properties': [ - { - 'name': 'serviceClass', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'DmnCapable', - 'extends': ['bpmn:BusinessRuleTask'], - 'properties': [ - { - 'name': 'decisionRef', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'decisionRefBinding', - 'isAttr': true, - 'type': 'String', - 'default': 'latest' - }, - { - 'name': 'decisionRefVersion', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'mapDecisionResult', - 'isAttr': true, - 'type': 'String', - 'default': 'resultList' - }, - { - 'name': 'decisionRefTenantId', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'ExternalCapable', - 'extends': ['flowable:ServiceTaskLike'], - 'properties': [ - { - 'name': 'type', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'topic', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'TaskPriorized', - 'extends': ['bpmn:Process', 'flowable:ExternalCapable'], - 'properties': [ - { - 'name': 'taskPriority', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'Properties', - 'superClass': ['Element'], - 'meta': { - 'allowedIn': ['*'] - }, - 'properties': [ - { - 'name': 'values', - 'type': 'Property', - 'isMany': true - } - ] - }, - { - 'name': 'Property', - 'superClass': ['Element'], - 'properties': [ - { - 'name': 'id', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'name', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'value', - 'type': 'String', - 'isAttr': true - } - ] - }, - { - 'name': 'Connector', - 'superClass': ['Element'], - 'meta': { - 'allowedIn': ['flowable:ServiceTaskLike'] - }, - 'properties': [ - { - 'name': 'inputOutput', - 'type': 'InputOutput' - }, - { - 'name': 'connectorId', - 'type': 'String' - } - ] - }, - { - 'name': 'InputOutput', - 'superClass': ['Element'], - 'meta': { - 'allowedIn': ['bpmn:FlowNode', 'flowable:Connector'] - }, - 'properties': [ - { - 'name': 'inputOutput', - 'type': 'InputOutput' - }, - { - 'name': 'connectorId', - 'type': 'String' - }, - { - 'name': 'inputParameters', - 'isMany': true, - 'type': 'InputParameter' - }, - { - 'name': 'outputParameters', - 'isMany': true, - 'type': 'OutputParameter' - } - ] - }, - { - 'name': 'InputOutputParameter', - 'properties': [ - { - 'name': 'name', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'value', - 'isBody': true, - 'type': 'String' - }, - { - 'name': 'definition', - 'type': 'InputOutputParameterDefinition' - } - ] - }, - { - 'name': 'InputOutputParameterDefinition', - 'isAbstract': true - }, - { - 'name': 'List', - 'superClass': ['InputOutputParameterDefinition'], - 'properties': [ - { - 'name': 'items', - 'isMany': true, - 'type': 'InputOutputParameterDefinition' - } - ] - }, - { - 'name': 'Map', - 'superClass': ['InputOutputParameterDefinition'], - 'properties': [ - { - 'name': 'entries', - 'isMany': true, - 'type': 'Entry' - } - ] - }, - { - 'name': 'Entry', - 'properties': [ - { - 'name': 'key', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'value', - 'isBody': true, - 'type': 'String' - }, - { - 'name': 'definition', - 'type': 'InputOutputParameterDefinition' - } - ] - }, - { - 'name': 'Value', - 'superClass': ['InputOutputParameterDefinition'], - 'properties': [ - { - 'name': 'id', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'name', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'value', - 'isBody': true, - 'type': 'String' - } - ] - }, - { - 'name': 'Script', - 'superClass': ['InputOutputParameterDefinition'], - 'properties': [ - { - 'name': 'scriptFormat', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'resource', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'value', - 'isBody': true, - 'type': 'String' - } - ] - }, - { - 'name': 'Field', - 'superClass': ['Element'], - 'meta': { - 'allowedIn': ['flowable:ServiceTaskLike', 'flowable:ExecutionListener', 'flowable:TaskListener'] - }, - 'properties': [ - { - 'name': 'name', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'expression', - 'isAttr': true, - 'type': 'expression' - }, - { - 'name': 'string', - 'type': 'string' - }, - { - 'name': 'stringValue', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'string', - 'superClass': ['Element'], - 'meta': { - 'allowedIn': ['flowable:Field'] - }, - 'properties': [ - { - 'name': 'body', - 'isBody': true, - 'type': 'String' - } - ] - }, - { - 'name': 'expression', - 'superClass': ['Element'], - 'meta': { - 'allowedIn': ['flowable:Field'] - }, - 'properties': [ - { - 'name': 'body', - 'isBody': true, - 'type': 'String' - } - ] - }, - { - 'name': 'InputParameter', - 'superClass': ['InputOutputParameter'] - }, - { - 'name': 'OutputParameter', - 'superClass': ['InputOutputParameter'] - }, - { - 'name': 'Collectable', - 'isAbstract': true, - 'extends': ['bpmn:MultiInstanceLoopCharacteristics'], - 'superClass': ['flowable:AsyncCapable'], - 'properties': [ - { - 'name': 'collection', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'elementVariable', - 'isAttr': true, - 'type': 'String' - } - ] - }, - { - 'name': 'SequenceFlow', - 'superClass': ['FlowElement'], - 'properties': [ - { - 'name': 'isImmediate', - 'isAttr': true, - 'type': 'Boolean' - }, - { - 'name': 'conditionExpression', - 'type': 'Expression' - }, - { - 'name': 'sourceRef', - 'type': 'FlowNode', - 'isAttr': true, - 'isReference': true - }, - { - 'name': 'targetRef', - 'type': 'FlowNode', - 'isAttr': true, - 'isReference': true - } - ] - }, - { - 'name': 'MultiInstanceLoopCharacteristics', - 'superClass': ['LoopCharacteristics'], - 'properties': [ - { - 'name': 'isSequential', - 'default': false, - 'isAttr': true, - 'type': 'Boolean' - }, - { - 'name': 'behavior', - 'type': 'MultiInstanceBehavior', - 'default': 'All', - 'isAttr': true - }, - { - 'name': 'loopCardinality', - 'type': 'Expression', - 'xml': { - 'serialize': 'xsi:type' - } - }, - { - 'name': 'loopDataInputRef', - 'type': 'ItemAwareElement', - 'isReference': true - }, - { - 'name': 'loopDataOutputRef', - 'type': 'ItemAwareElement', - 'isReference': true - }, - { - 'name': 'inputDataItem', - 'type': 'DataInput', - 'xml': { - 'serialize': 'property' - } - }, - { - 'name': 'outputDataItem', - 'type': 'DataOutput', - 'xml': { - 'serialize': 'property' - } - }, - { - 'name': 'complexBehaviorDefinition', - 'type': 'ComplexBehaviorDefinition', - 'isMany': true - }, - { - 'name': 'completionCondition', - 'type': 'Expression', - 'xml': { - 'serialize': 'xsi:type' - } - }, - { - 'name': 'oneBehaviorEventRef', - 'type': 'EventDefinition', - 'isAttr': true, - 'isReference': true - }, - { - 'name': 'noneBehaviorEventRef', - 'type': 'EventDefinition', - 'isAttr': true, - 'isReference': true - } - ] - }, - { - 'name': 'FailedJobRetryTimeCycle', - 'superClass': ['Element'], - 'meta': { - 'allowedIn': ['flowable:AsyncCapable', 'bpmn:MultiInstanceLoopCharacteristics'] - }, - 'properties': [ - { - 'name': 'body', - 'isBody': true, - 'type': 'String' - } - ] - }, - { - 'name': 'ExecutionListener', - 'superClass': ['Element'], - 'meta': { - 'allowedIn': [ - 'bpmn:Task', - 'bpmn:ServiceTask', - 'bpmn:UserTask', - 'bpmn:BusinessRuleTask', - 'bpmn:ScriptTask', - 'bpmn:ReceiveTask', - 'bpmn:ManualTask', - 'bpmn:ExclusiveGateway', - 'bpmn:SequenceFlow', - 'bpmn:ParallelGateway', - 'bpmn:InclusiveGateway', - 'bpmn:EventBasedGateway', - 'bpmn:StartEvent', - 'bpmn:IntermediateCatchEvent', - 'bpmn:IntermediateThrowEvent', - 'bpmn:EndEvent', - 'bpmn:BoundaryEvent', - 'bpmn:CallActivity', - 'bpmn:SubProcess', - 'bpmn:Process' - ] - }, - 'properties': [ - { - 'name': 'expression', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'class', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'delegateExpression', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'event', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'script', - 'type': 'Script' - }, - { - 'name': 'fields', - 'type': 'Field', - 'isMany': true - } - ] - }, - { - 'name': 'TaskListener', - 'superClass': ['Element'], - 'meta': { - 'allowedIn': ['bpmn:UserTask'] - }, - 'properties': [ - { - 'name': 'expression', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'class', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'delegateExpression', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'event', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'script', - 'type': 'Script' - }, - { - 'name': 'fields', - 'type': 'Field', - 'isMany': true - } - ] - }, - { - 'name': 'FormProperty', - 'superClass': ['Element'], - 'meta': { - 'allowedIn': ['bpmn:StartEvent', 'bpmn:UserTask'] - }, - 'properties': [ - { - 'name': 'id', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'name', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'type', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'required', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'readable', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'writable', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'variable', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'expression', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'datePattern', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'default', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'values', - 'type': 'Value', - 'isMany': true - } - ] - }, - { - 'name': 'FormData', - 'superClass': ['Element'], - 'meta': { - 'allowedIn': ['bpmn:StartEvent', 'bpmn:UserTask'] - }, - 'properties': [ - { - 'name': 'fields', - 'type': 'FormField', - 'isMany': true - }, - { - 'name': 'businessKey', - 'type': 'String', - 'isAttr': true - } - ] - }, - { - 'name': 'FormField', - 'superClass': ['Element'], - 'properties': [ - { - 'name': 'id', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'label', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'type', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'datePattern', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'defaultValue', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'properties', - 'type': 'Properties' - }, - { - 'name': 'validation', - 'type': 'Validation' - }, - { - 'name': 'values', - 'type': 'Value', - 'isMany': true - } - ] - }, - { - 'name': 'Validation', - 'superClass': ['Element'], - 'properties': [ - { - 'name': 'constraints', - 'type': 'Constraint', - 'isMany': true - } - ] - }, - { - 'name': 'Constraint', - 'superClass': ['Element'], - 'properties': [ - { - 'name': 'name', - 'type': 'String', - 'isAttr': true - }, - { - 'name': 'config', - 'type': 'String', - 'isAttr': true - } - ] - }, - { - 'name': 'ConditionalEventDefinition', - 'isAbstract': true, - 'extends': ['bpmn:ConditionalEventDefinition'], - 'properties': [ - { - 'name': 'variableName', - 'isAttr': true, - 'type': 'String' - }, - { - 'name': 'variableEvent', - 'isAttr': true, - 'type': 'String' - } - ] - } - ], - 'emumerations': [] -}; diff --git a/src/bpmn/assets/module/ContextPad/CustomContextPadProvider.ts b/src/bpmn/assets/module/ContextPad/CustomContextPadProvider.ts deleted file mode 100644 index 13ccf50..0000000 --- a/src/bpmn/assets/module/ContextPad/CustomContextPadProvider.ts +++ /dev/null @@ -1,138 +0,0 @@ -import ContextPadProvider from 'bpmn-js/lib/features/context-pad/ContextPadProvider'; -import { Injector } from 'didi'; -import EventBus from 'diagram-js/lib/core/EventBus'; -import ContextPad from 'diagram-js/lib/features/context-pad/ContextPad'; -import Modeling from 'bpmn-js/lib/features/modeling/Modeling.js'; -import ElementFactory from 'bpmn-js/lib/features/modeling/ElementFactory'; -import Connect from 'diagram-js/lib/features/connect/Connect'; -import Create from 'diagram-js/lib/features/create/Create'; -import PopupMenu from 'diagram-js/lib/features/popup-menu/PopupMenu'; -import Canvas from 'diagram-js/lib/core/Canvas'; -import Rules from 'diagram-js/lib/features/rules/Rules'; -import { Element, Shape } from 'diagram-js/lib/model/Types'; -import BpmnFactory from 'bpmn-js/lib/features/modeling/BpmnFactory'; -import modeler from '@/store/modules/modeler'; - -// @Description: 增强元素连线事件 - -class CustomContextPadProvider extends ContextPadProvider { - private _contextPad: ContextPad; - private _modeling: Modeling; - private _elementFactory: ElementFactory; - private _autoPlace: any; - private _connect: Connect; - private _create: Create; - private _popupMenu: PopupMenu; - private _canvas: Canvas; - private _rules: Rules; - - constructor( - config: any, - injector: Injector, - eventBus: EventBus, - contextPad: ContextPad, - modeling: Modeling, - elementFactory: ElementFactory, - connect: Connect, - create: Create, - popupMenu: PopupMenu, - canvas: Canvas, - rules: Rules, - translate - ) { - // @ts-expect-error 忽略异常 - super(config, injector, eventBus, contextPad, modeling, elementFactory, connect, create, popupMenu, canvas, rules, translate); - - this._contextPad = contextPad; - this._modeling = modeling; - this._elementFactory = elementFactory; - this._connect = connect; - this._create = create; - this._popupMenu = popupMenu; - this._canvas = canvas; - this._rules = rules; - - this._autoPlace = injector.get('autoPlace', false); - } - - getContextPadEntries(element: Element) { - const actions: Record = {}; - - const appendUserTask = (event: Event, element: Shape) => { - const shape = this._elementFactory.createShape({ type: 'bpmn:UserTask' }); - this._create.start(event, shape, { - source: element - }); - }; - - const appendMultiInstanceUserTask = (event: Event, element: Shape) => { - const store = modeler(); - const bpmnFactory = store.getModeler().get('bpmnFactory') as BpmnFactory; - const businessObject = bpmnFactory.create('bpmn:UserTask', { - // name: '多实例用户任务', - isForCompensation: false - }); - businessObject.loopCharacteristics = bpmnFactory.create('bpmn:MultiInstanceLoopCharacteristics'); - // 创建 Shape - const shape = this._elementFactory.createShape({ - type: 'bpmn:UserTask', - businessObject: businessObject - }); - this._create.start(event, shape, { source: element }); - }; - - const appendTask = this._autoPlace - ? (event, element) => { - const bpmnFactory: BpmnFactory | undefined = modeler().getModeler().get('bpmnFactory'); - const businessObject = bpmnFactory.create('bpmn:UserTask', { - // name: '多实例用户任务',// 右键创建显示 - isForCompensation: false - }); - - // 创建多实例属性并分配给用户任务的 loopCharacteristics - businessObject.loopCharacteristics = bpmnFactory.create('bpmn:MultiInstanceLoopCharacteristics'); - - // 创建 Shape - const shape = this._elementFactory.createShape({ - type: 'bpmn:UserTask', - businessObject: businessObject - }); - - this._autoPlace.append(element, shape); - } - : appendMultiInstanceUserTask; - - const append = this._autoPlace - ? (event: Event, element: Shape) => { - const shape = this._elementFactory.createShape({ type: 'bpmn:UserTask' }); - this._autoPlace.append(element, shape); - } - : appendUserTask; - - // // 添加创建用户任务按钮 - actions['append.append-user-task'] = { - group: 'model', - className: 'bpmn-icon-user-task', - title: '用户任务', - action: { - dragstart: appendUserTask, - click: append - } - }; - - // 添加创建多实例用户任务按钮 - actions['append.append-multi-instance-user-task'] = { - group: 'model', - className: 'bpmn-icon-user', // 你可以使用多实例用户任务的图标 bpmn-icon-user bpmn-icon-user-task - title: '多实例用户任务', - action: { - dragstart: appendMultiInstanceUserTask, - click: appendTask - } - }; - - return actions; - } -} - -export default CustomContextPadProvider; diff --git a/src/bpmn/assets/module/Palette/CustomPaletteProvider.ts b/src/bpmn/assets/module/Palette/CustomPaletteProvider.ts deleted file mode 100644 index 8556d9b..0000000 --- a/src/bpmn/assets/module/Palette/CustomPaletteProvider.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { assign } from 'min-dash'; -import PaletteProvider from 'bpmn-js/lib/features/palette/PaletteProvider'; -import ElementFactory from 'bpmn-js/lib/features/modeling/ElementFactory'; -import Create from 'diagram-js/lib/features/create/Create'; -import SpaceTool from 'diagram-js/lib/features/space-tool/SpaceTool'; -import LassoTool from 'diagram-js/lib/features/lasso-tool/LassoTool'; -import HandTool from 'diagram-js/lib/features/hand-tool/HandTool'; -import GlobalConnect from 'diagram-js/lib/features/global-connect/GlobalConnect'; -import Palette from 'diagram-js/lib/features/palette/Palette'; -import modeler from '@/store/modules/modeler'; -import BpmnFactory from 'bpmn-js/lib/features/modeling/BpmnFactory'; - -// @Description: 增强左侧面板 -class CustomPaletteProvider extends PaletteProvider { - private readonly _palette: Palette; - private readonly _create: Create; - private readonly _elementFactory: ElementFactory; - private readonly _spaceTool: SpaceTool; - private readonly _lassoTool: LassoTool; - private readonly _handTool: HandTool; - private readonly _globalConnect: GlobalConnect; - private readonly _translate: any; - - constructor(palette, create, elementFactory, spaceTool, lassoTool, handTool, globalConnect, translate) { - super(palette, create, elementFactory, spaceTool, lassoTool, handTool, globalConnect, translate); - this._palette = palette; - this._create = create; - this._elementFactory = elementFactory; - this._spaceTool = spaceTool; - this._lassoTool = lassoTool; - this._handTool = handTool; - this._globalConnect = globalConnect; - this._translate = translate; - } - - getPaletteEntries() { - const actions = {}, - create = this._create, - elementFactory = this._elementFactory, - translate = this._translate; - - function createAction(type: string, group: string, className: string, title: string, options?: object) { - function createListener(event) { - const shape = elementFactory.createShape(assign({ type: type }, options)); - if (options) { - !shape.businessObject.di && (shape.businessObject.di = {}); - shape.businessObject.di.isExpanded = (options as { [key: string]: any }).isExpanded; - } - create.start(event, shape, null); - } - const shortType = type.replace(/^bpmn:/, ''); - return { - group: group, - className: className, - title: title || translate('Create {type}', { type: shortType }), - action: { - dragstart: createListener, - click: createListener - } - }; - } - - function createMultiInstanceUserTask(event) { - const bpmnFactory: BpmnFactory | undefined = modeler().getBpmnFactory(); - // 创建一个 bpmn:UserTask - const userTask = bpmnFactory.create('bpmn:UserTask', { - // name: '多实例用户任务', // 在画板中显示字段 - isForCompensation: false - }); - // 将多实例属性分配给 bpmn:UserTask 的 loopCharacteristics - userTask.loopCharacteristics = bpmnFactory.create('bpmn:MultiInstanceLoopCharacteristics'); - const customUserTask = elementFactory.createShape({ - type: 'bpmn:UserTask', - businessObject: userTask // 分配创建的 userTask 到 businessObject - }); - create.start(event, customUserTask, {}); - } - - assign(actions, { - 'create.parallel-gateway': createAction('bpmn:ParallelGateway', 'gateway', 'bpmn-icon-gateway-parallel', '并行网关'), - 'create.event-base-gateway': createAction('bpmn:EventBasedGateway', 'gateway', 'bpmn-icon-gateway-eventbased', '事件网关'), - // 分组线 - 'gateway-separator': { - group: 'gateway', - separator: true - }, - 'create.user-task': createAction('bpmn:UserTask', 'activity', 'bpmn-icon-user-task', '创建用户任务'), - 'create.multi-instance-user-task': { - group: 'activity', - type: 'bpmn:UserTask', - className: 'bpmn-icon-user task-multi-instance', - title: '创建多实例用户任务', - action: { - click: createMultiInstanceUserTask, - dragstart: createMultiInstanceUserTask - } - }, - 'task-separator': { - group: 'activity', - separator: true - } - }); - return actions; - } -} - -CustomPaletteProvider['$inject'] = ['palette', 'create', 'elementFactory', 'spaceTool', 'lassoTool', 'handTool', 'globalConnect', 'translate']; - -export default CustomPaletteProvider; diff --git a/src/bpmn/assets/module/Renderer/CustomRenderer.ts b/src/bpmn/assets/module/Renderer/CustomRenderer.ts deleted file mode 100644 index 6a4eb1a..0000000 --- a/src/bpmn/assets/module/Renderer/CustomRenderer.ts +++ /dev/null @@ -1,56 +0,0 @@ -import BaseRenderer from 'diagram-js/lib/draw/BaseRenderer'; -import { - append as svgAppend, - attr as svgAttr, - create as svgCreate, - select as svgSelect, - selectAll as svgSelectAll, - clone as svgClone, - clear as svgClear, - remove as svgRemove -} from 'tiny-svg'; - -const HIGH_PRIORITY = 1500; -export default class CustomRenderer extends BaseRenderer { - bpmnRenderer: BaseRenderer; - modeling: any; - constructor(eventBus, bpmnRenderer, modeling) { - super(eventBus, HIGH_PRIORITY); - this.bpmnRenderer = bpmnRenderer; - this.modeling = modeling; - } - canRender(element) { - // ignore labels - return !element.labelTarget; - } - - /** - * 自定义节点图形 - * @param {*} parentNode 当前元素的svgNode - * @param {*} element - * @returns - */ - drawShape(parentNode, element) { - const shape = this.bpmnRenderer.drawShape(parentNode, element); - const { type, width, height } = element; - // 开始 填充绿色 - if (type === 'bpmn:StartEvent') { - svgAttr(shape, { fill: '#77DF6D' }); - return shape; - } - if (type === 'bpmn:EndEvent') { - svgAttr(shape, { fill: '#EE7B77' }); - return shape; - } - if (type === 'bpmn:UserTask') { - svgAttr(shape, { fill: '#A9C4F8' }); - return shape; - } - return shape; - } - - getShapePath(shape) { - return this.bpmnRenderer.getShapePath(shape); - } -} -CustomRenderer['$inject'] = ['eventBus', 'bpmnRenderer']; diff --git a/src/bpmn/assets/module/Translate/index.ts b/src/bpmn/assets/module/Translate/index.ts deleted file mode 100644 index 6b52dae..0000000 --- a/src/bpmn/assets/module/Translate/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import zh from '../../lang/zh'; - -const customTranslate = (template: any, replacements: any) => { - replacements = replacements || {}; - template = zh[template] || template; - return template.replace(/{([^}]+)}/g, function (_: any, key: any) { - return replacements[key] || '{' + key + '}'; - }); -}; - -export const translateModule = { - translate: ['value', customTranslate] -}; - -export default translateModule; diff --git a/src/bpmn/assets/module/index.ts b/src/bpmn/assets/module/index.ts deleted file mode 100644 index 55f6b9f..0000000 --- a/src/bpmn/assets/module/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -// 翻译模块 -import TranslationModule from './Translate'; -import { ModuleDeclaration } from 'didi'; -import CustomPaletteProvider from './Palette/CustomPaletteProvider'; -import CustomRenderer from './Renderer/CustomRenderer'; -import CustomContextPadProvider from './ContextPad/CustomContextPadProvider'; - -const Module: ModuleDeclaration[] = [ - { - __init__: ['customPaletteProvider', 'customContextPadProvider', 'customRenderer'], - customPaletteProvider: ['type', CustomPaletteProvider], - customRenderer: ['type', CustomRenderer], - customContextPadProvider: ['type', CustomContextPadProvider] - }, - TranslationModule -]; -export default Module; diff --git a/src/bpmn/assets/showConfig.ts b/src/bpmn/assets/showConfig.ts deleted file mode 100644 index 853eb35..0000000 --- a/src/bpmn/assets/showConfig.ts +++ /dev/null @@ -1,50 +0,0 @@ -export default { - 'bpmn:EndEvent': {}, - 'bpmn:StartEvent': { - initiator: true, - formKey: true - }, - 'bpmn:UserTask': { - allocationType: true, - specifyDesc: true, - multipleUserAuditType: true, - async: true, - priority: true, - skipExpression: true, - dueDate: true, - taskListener: true, - executionListener: true - }, - 'bpmn:ServiceTask': { - async: true, - skipExpression: true, - isForCompensation: true, - triggerable: true, - class: true - }, - 'bpmn:ScriptTask': { - async: true, - isForCompensation: true, - autoStoreVariables: true - }, - 'bpmn:ManualTask': { - async: true, - isForCompensation: true - }, - 'bpmn:ReceiveTask': { - async: true, - isForCompensation: true - }, - 'bpmn:SendTask': { - async: true, - isForCompensation: true - }, - 'bpmn:BusinessRuleTask': { - async: true, - isForCompensation: true, - ruleVariablesInput: true, - rules: true, - resultVariable: true, - exclude: true - } -}; diff --git a/src/bpmn/assets/style/index.scss b/src/bpmn/assets/style/index.scss deleted file mode 100644 index 3c92792..0000000 --- a/src/bpmn/assets/style/index.scss +++ /dev/null @@ -1,284 +0,0 @@ -.djs-palette { - width: 300px; - - .bpmn-icon-hand-tool:hover { - &:after { - content: '启动手动工具'; - position: absolute; - left: 45px; - width: 120px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - .bpmn-icon-lasso-tool:hover { - &:after { - content: '启动套索工具'; - position: absolute; - left: 100px; - width: 120px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - .bpmn-icon-space-tool:hover { - &:after { - content: '启动创建/删除空间工具'; - position: absolute; - left: 45px; - width: 170px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - .bpmn-icon-connection-multi:hover { - &:after { - content: '启动全局连接工具'; - position: absolute; - left: 100px; - width: 140px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - .bpmn-icon-start-event-none:hover { - &:after { - content: '创建开始事件'; - position: absolute; - left: 45px; - width: 120px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - .bpmn-icon-intermediate-event-none:hover { - &:after { - content: '创建中间/边界事件'; - position: absolute; - left: 100px; - width: 140px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - .bpmn-icon-end-event-none:hover { - &:after { - content: '创建结束事件'; - position: absolute; - left: 45px; - width: 120px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - .bpmn-icon-gateway-none:hover { - &:after { - content: '创建网关'; - position: absolute; - left: 100px; - width: 90px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - .bpmn-icon-gateway-parallel:hover { - &:after { - content: '创建并行网关'; - position: absolute; - left: 45px; - width: 120px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - .bpmn-icon-gateway-eventbased:hover { - &:after { - content: '创建事件网关'; - position: absolute; - left: 100px; - width: 120px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - .bpmn-icon-task:hover { - &:after { - content: '创建任务'; - position: absolute; - left: 45px; - width: 80px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - .bpmn-icon-subprocess-expanded:hover { - &:after { - content: '创建可折叠子流程'; - position: absolute; - left: 100px; - width: 140px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - .bpmn-icon-user-task:hover { - &:after { - content: '创建用户任务'; - position: absolute; - left: 45px; - width: 120px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - - .task-multi-instance:hover { - &:after { - content: '创建多实例用户任务'; - position: absolute; - left: 100px; - width: 160px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - .bpmn-icon-participant:hover { - &:after { - content: '创建泳池/泳道'; - position: absolute; - left: 45px; - width: 120px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - .bpmn-icon-data-object { - display: none; - &:hover { - &:after { - content: '创建数据对象'; - position: absolute; - left: 45px; - width: 120px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - } - .bpmn-icon-data-store { - display: none; - &:hover { - &:after { - content: '创建数据存储'; - position: absolute; - left: 100px; - width: 120px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - } - .bpmn-icon-group { - display: none; - &:hover { - &:after { - content: '创建分组'; - position: absolute; - left: 100px; - width: 100px; - font-size: 15px; - font-weight: bold; - color: #3a84de; - border-radius: 2px; - border: 1px solid #cccccc; - background-color: #fafafa; - opacity: 0.8; - } - } - } -} diff --git a/src/bpmn/hooks/usePanel.ts b/src/bpmn/hooks/usePanel.ts deleted file mode 100644 index ace579b..0000000 --- a/src/bpmn/hooks/usePanel.ts +++ /dev/null @@ -1,145 +0,0 @@ -import showConfig from '../assets/showConfig'; -import type { ModdleElement } from 'bpmn'; -import useModelerStore from '@/store/modules/modeler'; -import { MultiInstanceTypeEnum } from '@/enums/bpmn/IndexEnums'; -interface Options { - element: ModdleElement; -} - -export default (ops: Options) => { - const { element } = ops; - const { getModeling, getModdle } = useModelerStore(); - const modeling = getModeling(); - const moddle = getModdle(); - - /** - * 当前节点类型 - */ - const elementType = computed(() => { - const bizObj = element.businessObject; - return bizObj.eventDefinitions ? bizObj.eventDefinitions[0].$type : bizObj.$type; - }); - - /** - * 用于控制面板字段显示与隐藏的配置 - */ - const config = computed(() => showConfig[elementType.value] || {}); - - /** - * 创建一个节点 - * @param elementType 节点类型 - * @param properties 属性 - * @param parent 父节点 - */ - const createModdleElement = (elementType: string, properties: any, parent: ModdleElement) => { - const element = moddle.create(elementType, properties); - parent && (element.$parent = parent); - return element; - }; - - /** - * 获取扩展属性,如果不存在会自动创建 - */ - const getExtensionElements = (create = true) => { - let extensionElements = element.businessObject.get('extensionElements'); - if (!extensionElements && create) { - extensionElements = createModdleElement('bpmn:ExtensionElements', { values: [] }, element.businessObject); - modeling.updateModdleProperties(element, element.businessObject, { extensionElements }); - } - return extensionElements; - }; - - /** - * 获取extensionElements下的properties - * @param extensionElements 可选参数,默认获取当前Element下的extensionElements下的Properties - */ - const getPropertiesElements = (extensionElements?: ModdleElement) => { - if (!extensionElements) { - extensionElements = getExtensionElements(); - } - let propertiesElements = extensionElements.values.find((item) => item.$type === 'flowable:properties'); - if (!propertiesElements) { - propertiesElements = createModdleElement('flowable:properties', { values: [] }, extensionElements); - modeling.updateModdleProperties(element, extensionElements, { - values: [...extensionElements.get<[]>('values'), propertiesElements] - }); - } - return propertiesElements; - }; - - /** - * 更新节点属性 - * @param properties 属性值 - */ - const updateProperties = (properties: any) => { - modeling.updateProperties(element, properties); - }; - - /** - * 更新节点信息 - * @param updateElement 需要更新的节点 - * @param properties 属性 - */ - const updateModdleProperties = (updateElement, properties: any) => { - modeling.updateModdleProperties(element, updateElement, properties); - }; - - /** - * 更新Property属性 - * @param name key值 - * @param value 值 - */ - const updateProperty = (name: string, value: string) => { - const propertiesElements = getPropertiesElements(); - - let propertyElements = propertiesElements.values.find((item) => item.name === name); - if (!propertyElements) { - propertyElements = createModdleElement('flowable:property', { name: name, value: value }, propertiesElements); - modeling.updateModdleProperties(element, propertiesElements, { - values: [...propertiesElements.get('values'), propertyElements] - }); - } else { - propertyElements.name = name; - propertyElements.value = value; - } - return propertyElements; - }; - - const idChange = (newVal: string) => { - if (newVal) { - updateProperties({ id: newVal }); - } - }; - const nameChange = (newVal: string) => { - if (newVal) { - updateProperties({ name: newVal }); - } - }; - const formKeyChange = (newVal: string) => { - updateProperties({ formKey: newVal }); - }; - const constant = { - MultiInstanceType: [ - { id: '373d4b81-a0d1-4eb8-8685-0d2fb1b468e2', label: '无', value: MultiInstanceTypeEnum.NONE }, - { id: 'b5acea7c-b7e5-46b0-8778-390db091bdab', label: '串行', value: MultiInstanceTypeEnum.SERIAL }, - { id: 'b4f0c683-1ccc-43c4-8380-e1b998986caf', label: '并行', value: MultiInstanceTypeEnum.PARALLEL } - ] - }; - - return { - elementType, - constant, - showConfig: config, - - updateProperties, - updateProperty, - updateModdleProperties, - - createModdleElement, - idChange, - nameChange, - formKeyChange, - getExtensionElements, - getPropertiesElements - }; -}; diff --git a/src/bpmn/hooks/useParseElement.ts b/src/bpmn/hooks/useParseElement.ts deleted file mode 100644 index e1a6054..0000000 --- a/src/bpmn/hooks/useParseElement.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { ModdleElement } from 'bpmn'; - -interface Options { - element: ModdleElement; -} - -interface Data { - id: string; -} - -export default (ops: Options) => { - const { element } = ops; - - const parseData = (): T => { - const result = { - ...element.businessObject, - ...element.businessObject.$attrs - }; - - // 移除flowable前缀,格式化数组 - for (const key in result) { - if (key.indexOf('flowable:') === 0) { - const newKey = key.replace('flowable:', ''); - result[newKey] = result[key]; - delete result[key]; - } - } - return { ...result } as T; - }; - - return { - parseData - }; -}; diff --git a/src/bpmn/index.vue b/src/bpmn/index.vue deleted file mode 100644 index 15437c8..0000000 --- a/src/bpmn/index.vue +++ /dev/null @@ -1,496 +0,0 @@ - - - - - diff --git a/src/bpmn/panel/GatewayPanel.vue b/src/bpmn/panel/GatewayPanel.vue deleted file mode 100644 index 20cc134..0000000 --- a/src/bpmn/panel/GatewayPanel.vue +++ /dev/null @@ -1,68 +0,0 @@ - - - - diff --git a/src/bpmn/panel/ParticipantPanel.vue b/src/bpmn/panel/ParticipantPanel.vue deleted file mode 100644 index b1d42e6..0000000 --- a/src/bpmn/panel/ParticipantPanel.vue +++ /dev/null @@ -1,68 +0,0 @@ - - - - diff --git a/src/bpmn/panel/ProcessPanel.vue b/src/bpmn/panel/ProcessPanel.vue deleted file mode 100644 index 9e118e2..0000000 --- a/src/bpmn/panel/ProcessPanel.vue +++ /dev/null @@ -1,71 +0,0 @@ - - - - - diff --git a/src/bpmn/panel/SequenceFlowPanel.vue b/src/bpmn/panel/SequenceFlowPanel.vue deleted file mode 100644 index eac8227..0000000 --- a/src/bpmn/panel/SequenceFlowPanel.vue +++ /dev/null @@ -1,95 +0,0 @@ - - - - diff --git a/src/bpmn/panel/StartEndPanel.vue b/src/bpmn/panel/StartEndPanel.vue deleted file mode 100644 index bde1212..0000000 --- a/src/bpmn/panel/StartEndPanel.vue +++ /dev/null @@ -1,67 +0,0 @@ - - - - diff --git a/src/bpmn/panel/SubProcessPanel.vue b/src/bpmn/panel/SubProcessPanel.vue deleted file mode 100644 index 3490fff..0000000 --- a/src/bpmn/panel/SubProcessPanel.vue +++ /dev/null @@ -1,193 +0,0 @@ - - - - diff --git a/src/bpmn/panel/TaskPanel.vue b/src/bpmn/panel/TaskPanel.vue deleted file mode 100644 index a42de8a..0000000 --- a/src/bpmn/panel/TaskPanel.vue +++ /dev/null @@ -1,491 +0,0 @@ - - - - diff --git a/src/bpmn/panel/index.vue b/src/bpmn/panel/index.vue deleted file mode 100644 index 445571a..0000000 --- a/src/bpmn/panel/index.vue +++ /dev/null @@ -1,110 +0,0 @@ - - - - diff --git a/src/bpmn/panel/property/DueDate.vue b/src/bpmn/panel/property/DueDate.vue deleted file mode 100644 index 882766b..0000000 --- a/src/bpmn/panel/property/DueDate.vue +++ /dev/null @@ -1,252 +0,0 @@ - - - diff --git a/src/bpmn/panel/property/ExecutionListener.vue b/src/bpmn/panel/property/ExecutionListener.vue deleted file mode 100644 index 3c584cb..0000000 --- a/src/bpmn/panel/property/ExecutionListener.vue +++ /dev/null @@ -1,308 +0,0 @@ - - - - diff --git a/src/bpmn/panel/property/ListenerParam.vue b/src/bpmn/panel/property/ListenerParam.vue deleted file mode 100644 index 21c6de1..0000000 --- a/src/bpmn/panel/property/ListenerParam.vue +++ /dev/null @@ -1,121 +0,0 @@ - - - - - diff --git a/src/bpmn/panel/property/TaskListener.vue b/src/bpmn/panel/property/TaskListener.vue deleted file mode 100644 index 9a32c47..0000000 --- a/src/bpmn/panel/property/TaskListener.vue +++ /dev/null @@ -1,310 +0,0 @@ - - - - diff --git a/src/components/BpmnDesign/index.vue b/src/components/BpmnDesign/index.vue deleted file mode 100644 index 1f84516..0000000 --- a/src/components/BpmnDesign/index.vue +++ /dev/null @@ -1,71 +0,0 @@ - - - - - diff --git a/src/components/BpmnView/index.vue b/src/components/BpmnView/index.vue deleted file mode 100644 index 845d41e..0000000 --- a/src/components/BpmnView/index.vue +++ /dev/null @@ -1,411 +0,0 @@ - - - - - diff --git a/src/enums/bpmn/IndexEnums.ts b/src/enums/bpmn/IndexEnums.ts deleted file mode 100644 index 8c39823..0000000 --- a/src/enums/bpmn/IndexEnums.ts +++ /dev/null @@ -1,17 +0,0 @@ -export enum AllocationTypeEnum { - USER = 'user', - CANDIDATE = 'candidate', - YOURSELF = 'yourself', - SPECIFY = 'specify' -} - -export enum SpecifyDescEnum { - SPECIFY_MULTIPLE = 'specifyMultiple', - SPECIFY_SINGLE = 'specifySingle' -} - -export enum MultiInstanceTypeEnum { - SERIAL = 'serial', - PARALLEL = 'parallel', - NONE = 'none' -} diff --git a/src/types/bpmn/editor/global.d.ts b/src/types/bpmn/editor/global.d.ts deleted file mode 100644 index 1b9a634..0000000 --- a/src/types/bpmn/editor/global.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { MessageApiInjection } from 'naive-ui/lib/message/src/MessageProvider'; - -declare global { - interface Window { - bpmnInstances: any; - __messageBox: MessageApiInjection; - URL: any; - } -} - -declare interface Window { - bpmnInstances: any; -} diff --git a/src/types/bpmn/index.d.ts b/src/types/bpmn/index.d.ts deleted file mode 100644 index f8e8d15..0000000 --- a/src/types/bpmn/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -declare module 'bpmn' { - import type modeler from 'bpmn-js/lib/Modeler'; - import type modeling from 'bpmn-js/lib/features/modeling/Modeling'; - import type canvas from 'diagram-js/lib/core/Canvas'; - import type elementRegistry from 'diagram-js/lib/core/ElementRegistry'; - import type bpmnFactory from 'bpmn-js/lib/features/modeling/BpmnFactory'; - - export type Modeler = modeler; - export type Modeling = modeling; - export type Canvas = canvas; - export type ElementRegistry = elementRegistry; - export type Moddle = import('moddle').Moddle; - export type ModdleElement = import('moddle').ModdleElement; - export type BpmnFactory = bpmnFactory; -} diff --git a/src/types/bpmn/moddle.d.ts b/src/types/bpmn/moddle.d.ts deleted file mode 100644 index 1ed7933..0000000 --- a/src/types/bpmn/moddle.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -declare module 'moddle' { - import type { Element as element } from 'bpmn-js/lib/model/Types'; - - export type Element = { - get(name: string): T; - - set(name: string, value: any): void; - } & element; - - export interface ModdleElement extends Element { - $model: Moddle; - readonly $type: string; - $attrs: object | {}; - $parent: any; - businessObject: ModdleElement; - type: string; - - [field: string]: any; - - hasType(element: ModdleElement, type?: string): boolean; - } - - export interface Package { - name: string; - prefix: string; - } - - export interface Moddle { - typeCache: Record; - - getPackage: typeof Registry.prototype.getPackage; - - getPackages: typeof Registry.prototype.getPackages; - - create(type: string, attrs?: any): ModdleElement; - } -} diff --git a/src/types/bpmn/panel.d.ts b/src/types/bpmn/panel.d.ts deleted file mode 100644 index 3179261..0000000 --- a/src/types/bpmn/panel.d.ts +++ /dev/null @@ -1,92 +0,0 @@ -declare module 'bpmnDesign' { - import { AllocationTypeEnum, SpecifyDescEnum, MultiInstanceTypeEnum } from '@/enums/bpmn/IndexEnums'; - - export interface ParamVO { - type: string; - name: string; - value: string; - } - - export interface TaskListenerVO { - event: string; - type: string; - name: string; - className: string; - params: ParamVO[]; - } - - export interface ExecutionListenerVO { - event: string; - type: string; - className: string; - params: ParamVO[]; - } - - interface BasePanel { - id: string; - name: string; - } - export interface ProcessPanel extends BasePanel {} - - export interface TaskPanel extends BasePanel { - allocationType: AllocationTypeEnum; - specifyDesc: SpecifyDescEnum; - multiInstanceType: MultiInstanceTypeEnum; - async?: boolean; - priority?: number; - formKey?: string; - skipExpression?: string; - isForCompensation?: boolean; - triggerServiceTask?: boolean; - autoStoreVariables?: boolean; - ruleVariablesInput?: string; - excludeTaskListener?: boolean; - exclude?: boolean; - class?: string; - dueDate?: string; - fixedAssignee?: string; - - candidateUsers?: string; - assignee?: string; - candidateGroups?: string; - collection?: string; - elementVariable?: string; - completionCondition?: string; - isSequential?: boolean; - - loopCharacteristics?: { - collection: string; - elementVariable: string; - isSequential: boolean; - completionCondition: { - body: string; - }; - }; - } - - export interface StartEndPanel extends BasePanel {} - export interface GatewayPanel extends BasePanel {} - export interface SequenceFlowPanel extends BasePanel { - conditionExpression: { - body: string; - }; - conditionExpressionValue: string; - skipExpression: string; - } - - export interface ParticipantPanel extends BasePanel {} - export interface SubProcessPanel extends BasePanel { - multiInstanceType: MultiInstanceTypeEnum; - collection?: string; - elementVariable?: string; - completionCondition?: string; - loopCharacteristics?: { - collection: string; - elementVariable: string; - isSequential: boolean; - completionCondition: { - body: string; - }; - }; - } -}