刘光辉
9 小时以前 0dfe84494048ce27ba8449831782128412d3eb13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import Modeler from 'bpmn-js/lib/Modeler';
import YmPaletteProvider from '../..//palette';
import YmRenderer from '../renderer';
import YmElementFactory from '../../factory';
import YmOutline from '../../outline';
import YmBusinessData from '../../business';
import YmGridSnappingAutoPlaceBehavior from '../gridSnapping/autoPlacebehavior';
import YmContextPad from '../../simpleModeler/contextPad';
import YmContextPadProvider from '../../simpleModeler/contextPad/provider';
import YmCustomBpmnRules from '../../rule';
import CustomLabelEditingProvider from '../../labelEditing/labelEditingProvider';
import GridSnappingLayoutConnectionBehavior from '../gridSnapping/connect';
import BpmnKeyboardBindings from '../keyboard/BpmnKeyboardBindings';
let flowInfo: any;
const modeler: any = options => [
  {
    __init__: [
      'paletteProvider',
      'bpmnRenderer',
      'contextPadProvider',
      'replaceMenuProvider',
      'elementFactory',
      'jnpfData',
      'gridSnappingAutoPlaceBehavior',
      'alignElementsContextPadProvider',
      'alignElementsMenuProvider',
      'bpmnAlignElements',
      'outlineProvider',
      'contextPad',
      'bpmnRules',
      'keyboardBindings',
    ],
    paletteProvider: ['type', YmPaletteProvider], // 左侧的元素
    bpmnRenderer: ['type', YmRenderer, { options }], // 画布渲染
    elementFactory: ['type', YmElementFactory], // 元素工厂
    jnpfData: ['type', YmBusinessData], // 用于放置业务数据
    gridSnappingAutoPlaceBehavior: ['type', YmGridSnappingAutoPlaceBehavior], // 自动生成元素位置 在点击coontext-pad时计算元素生成位置
    outlineProvider: ['type', YmOutline], // 元素的外边框(用于修改边框颜色,注:线条颜色有svg获取标签再去修改颜色及箭头)
    contextPad: ['type', YmContextPad], // 点击元素后的元素右侧弹窗框(显示开始节点 结束节点等)
    contextPadProvider: ['type', YmContextPadProvider], // context-pad 属性
    bpmnRules: ['type', YmCustomBpmnRules], // 自定义规则
    labelEditingProvider: ['type', CustomLabelEditingProvider], // 编辑
    gridSnappingLayoutConnectionBehavior: ['type', GridSnappingLayoutConnectionBehavior], // 修改连线的排序
    keyboardBindings: ['type', BpmnKeyboardBindings], // 快捷键
  },
];
 
class jnpfModeler extends Modeler {
  constructor(options: any) {
    flowInfo = options.flowInfo;
    super(options);
  }
}
 
jnpfModeler.prototype['_modules'] = [].concat(jnpfModeler.prototype['_modules'], modeler(flowInfo));
 
export default jnpfModeler;