index.ts 1004 B

12345678910111213141516171819202122232425262728293031323334
  1. import ElementFactory from 'bpmn-js/lib/features/modeling/ElementFactory';
  2. import YmDefaultSize from './shapeSize';
  3. import { bpmnInclusive, typeConfluence } from '../config/variableName';
  4. class YmElementFactory extends ElementFactory {
  5. constructor(bpmnFactory: any, moddle: any, translate: any) {
  6. super(bpmnFactory, moddle, translate);
  7. }
  8. create(elementType: any, attrs: any): any {
  9. if (attrs.type === bpmnInclusive + '_confluence') {
  10. attrs.type = bpmnInclusive;
  11. attrs.businessObject.wnType = typeConfluence;
  12. }
  13. return super.create(elementType, attrs);
  14. }
  15. createBpmnElement(elementType: any, attrs: any) {
  16. // @ts-ignore
  17. return super.createBpmnElement(elementType, attrs);
  18. }
  19. getDefaultSize(element: any, di: any) {
  20. return YmDefaultSize(element, di);
  21. }
  22. createParticipantShape(attrs: any) {
  23. return super.createParticipantShape(attrs);
  24. }
  25. }
  26. YmElementFactory.$inject = ['bpmnFactory', 'moddle', 'translate'];
  27. export default YmElementFactory;