在angular中引入bpmn(2)【扩展bpmn属性栏】

还是要强调,我是参照下面这个博主写的教程才学会使用的,可以先去看他的,
他写的特别棒。
BPMN-JS与Angular集成(1)
BPMN-JS与Angular集成(2)
BPMN-JS与Angular集成(3)

扩展成功的属性栏图片:
在这里插入图片描述
我这个只能算自己的总结笔记,我其实对这些原理不是很清楚,只是明白操作步骤,算是以一个小白的视角来描述步骤

1、扩展基础的bpmn属性栏,原生bpmn属性栏属性较少,可以通过引入Camunda扩展属性栏

npm install --save camunda-bpmn-moddle

2、 引入camunda privder (会出现重复,注释掉之前写的那一句就可以了)

import propertiesProvider from 'bpmn-js-properties-panel/lib/provider/camunda';

在这里插入图片描述
3、新建一个ts文件camunda.ts

  • 先在文件里面写上一句话:(const后面的要和文件名一致)
  • 然后在node_modules找到camunda.json文件,(地址为node_modules\camunda-bpmn-moddle\resources\camunda.json)
  • 把camunda.json文件全选复制,在等号后面粘贴,camunda.ts文件完成
export const camunda=
//粘贴全选内容

不想麻烦的话,直接复制我做好的文件就可以了,camunda.ts文件如下:

export const camunda = {
    "name": "Camunda",
    "uri": "http://camunda.org/schema/1.0/bpmn",
    "prefix": "camunda",
    "xml": {
        "tagAlias": "lowerCase"
    },
    "associations": [],
    "types": [
        {
            "name": "Definitions",
            "isAbstract": true,
            "extends": [
                "bpmn:Definitions"
            ],
            "properties": [
                {
                    "name": "diagramRelationId",
                    "isAttr": true,
                    "type": "String"
                }
            ]
        },
        {
            "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",
                    "bpmn:SignalEventDefinition"
                ]
            }
        },
        {
            "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": "JobPriorized",
            "isAbstract": true,
            "extends": [
                "bpmn:Process",
                "camunda: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": "camunda:errorMessage",
                    "isAttr": true,
                    "type": "String"
                }
            ]
        },
        {
            "name": "PotentialStarter",
            "superClass": [
                "Element"
            ],
            "properties": [
                {
                    "name": "resourceAssignmentExpression",
                    "type": "bpmn:ResourceAssignmentExpression"
                }
            ]
        },
        {
            "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": "assignee",
                    "isAttr": true,
                    "type": "String"
                },
                {
                    "name": "candidateUsers",
                    "isAttr": true,
                    "type": "String"
                },
                {
                    "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": "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": [
                "camunda:ServiceTaskLike"
            ],
            "properties": [
                {
                    "name": "type",
                    "isAttr": true,
                    "type": "String"
                },
                {
                    "name": "topic",
                    "isAttr": true,
                    "type": "String"
                }
            ]
        },
        {
            "name": "TaskPriorized",
            "extends": [
                "bpmn:Process",
                "camunda: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": [
                    "camunda:ServiceTaskLike"
                ]
            },
            "properties": [
                {
                    "name": "inputOutput",
                    "type": "InputOutput"
                },
                {
                    "name": "connectorId",
                    "type": "String"
                }
            ]
        },
        {
            "name": "InputOutput",
            "superClass": [
                "Element"
            ],
            "meta": {
                "allowedIn": [
                    "bpmn:FlowNode",
                    "camunda: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": [
                    "camunda:ServiceTaskLike",
                    "camunda:ExecutionListener",
                    "camunda:TaskListener"
                ]
            },
            "properties": [
                {
                    "name": "name",
                    "isAttr": true,
                    "type": "String"
                },
                {
                    "name": "expression",
                    "type": "String"
                },
                {
                    "name": "stringValue",
                    "isAttr": true,
                    "type": "String"
                },
                {
                    "name": "string",
                    "type": "String"
                }
            ]
        },
        {
            "name": "InputParameter",
            "superClass": ["InputOutputParameter"]
        },
        {
            "name": "OutputParameter",
            "superClass": ["InputOutputParameter"]
        },
        {
            "name": "Collectable",
            "isAbstract": true,
            "extends": ["bpmn:MultiInstanceLoopCharacteristics"],
            "superClass": ["camunda:AsyncCapable"],
            "properties": [
                {
                    "name": "collection",
                    "isAttr": true,
                    "type": "String"
                },
                {
                    "name": "elementVariable",
                    "isAttr": true,
                    "type": "String"
                }
            ]
        },
        {
            "name": "FailedJobRetryTimeCycle",
            "superClass": ["Element"],
            "meta": {
                "allowedIn": [
                    "camunda: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": "id",
                    "type": "String",
                    "isAttr": true
                },
                {
                    "name": "eventDefinitions",
                    "type": "bpmn:TimerEventDefinition",
                    "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": []
}

4、在组件中引入camunda.ts文件,比如你在abc文件夹创建了camunda.ts文件

import {camunda} from '../abc/camunda';

5、找到 initBpmn() 方法,添加一句话:
注意:第2个camunda才是文件名,和刚才引入的对应

  moddleExtensions: {
        camunda: camunda
      }

位置和写法如下面图片的写法,代码我就不放了,
在这里插入图片描述
如果有什么问题,可以给我留言,点个赞再走呗!

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值