fix(lint): update bpmn designer compatibility code
parent
cb98b3a47e
commit
577efa56a9
|
|
@ -7,7 +7,7 @@ import { hasPrimaryModifier } from 'diagram-js/lib/util/Mouse';
|
|||
/**
|
||||
* A provider for BPMN 2.0 elements context pad
|
||||
*/
|
||||
export default function ContextPadProvider(
|
||||
function ContextPadProvider(
|
||||
config,
|
||||
injector,
|
||||
eventBus,
|
||||
|
|
@ -57,6 +57,8 @@ export default function ContextPadProvider(
|
|||
});
|
||||
}
|
||||
|
||||
export default ContextPadProvider;
|
||||
|
||||
ContextPadProvider.$inject = [
|
||||
'config.contextPad',
|
||||
'injector',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import PaletteProvider from 'bpmn-js/lib/features/palette/PaletteProvider';
|
||||
|
||||
export default function CustomPalette(
|
||||
function CustomPalette(
|
||||
palette,
|
||||
create,
|
||||
elementFactory,
|
||||
|
|
@ -24,11 +24,21 @@ export default function CustomPalette(
|
|||
);
|
||||
}
|
||||
|
||||
const F = function () {}; // 核心,利用空对象作为中介;
|
||||
F.prototype = PaletteProvider.prototype; // 核心,将父类的原型赋值给空对象F;
|
||||
CustomPalette.$inject = [
|
||||
'palette',
|
||||
'create',
|
||||
'elementFactory',
|
||||
'spaceTool',
|
||||
'lassoTool',
|
||||
'handTool',
|
||||
'globalConnect',
|
||||
'translate',
|
||||
];
|
||||
|
||||
// 利用中介函数重写原型链方法
|
||||
F.prototype.getPaletteEntries = function () {
|
||||
CustomPalette.prototype = Object.create(PaletteProvider.prototype);
|
||||
CustomPalette.prototype.constructor = CustomPalette;
|
||||
|
||||
CustomPalette.prototype.getPaletteEntries = function () {
|
||||
const actions = {};
|
||||
const create = this._create;
|
||||
const elementFactory = this._elementFactory;
|
||||
|
|
@ -94,8 +104,7 @@ F.prototype.getPaletteEntries = function () {
|
|||
'hand-tool': {
|
||||
group: 'tools',
|
||||
className: 'bpmn-icon-hand-tool',
|
||||
title: '激活抓手工具',
|
||||
// title: translate("Activate the hand tool"),
|
||||
title: translate('Activate the hand tool'),
|
||||
action: {
|
||||
click(event) {
|
||||
handTool.activateHand(event);
|
||||
|
|
@ -219,16 +228,4 @@ F.prototype.getPaletteEntries = function () {
|
|||
return actions;
|
||||
};
|
||||
|
||||
CustomPalette.$inject = [
|
||||
'palette',
|
||||
'create',
|
||||
'elementFactory',
|
||||
'spaceTool',
|
||||
'lassoTool',
|
||||
'handTool',
|
||||
'globalConnect',
|
||||
'translate',
|
||||
];
|
||||
|
||||
CustomPalette.prototype = new F(); // 核心,将 F的实例赋值给子类;
|
||||
CustomPalette.prototype.constructor = CustomPalette; // 修复子类CustomPalette的构造器指向,防止原型链的混乱;
|
||||
export default CustomPalette;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* A palette provider for BPMN 2.0 elements.
|
||||
*/
|
||||
export default function PaletteProvider(
|
||||
function PaletteProvider(
|
||||
palette,
|
||||
create,
|
||||
elementFactory,
|
||||
|
|
@ -23,6 +23,8 @@ export default function PaletteProvider(
|
|||
palette.registerProvider(this);
|
||||
}
|
||||
|
||||
export default PaletteProvider;
|
||||
|
||||
PaletteProvider.$inject = [
|
||||
'palette',
|
||||
'create',
|
||||
|
|
|
|||
|
|
@ -237,10 +237,8 @@ export default {
|
|||
'Due Date': '到期时间',
|
||||
'Follow Up Date': '跟踪日期',
|
||||
Priority: '优先级',
|
||||
'The follow up date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)':
|
||||
'跟踪日期必须符合EL表达式,如: ${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00',
|
||||
'The due date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)':
|
||||
'跟踪日期必须符合EL表达式,如: ${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00',
|
||||
[`The follow up date as an EL expression (e.g. \${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)`]: `跟踪日期必须符合EL表达式,如: \${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00`,
|
||||
[`The due date as an EL expression (e.g. \${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)`]: `跟踪日期必须符合EL表达式,如: \${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00`,
|
||||
Variables: '变量',
|
||||
'Candidate Starter Configuration': '候选人起动器配置',
|
||||
'Candidate Starter Groups': '候选人起动器组',
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ declare global {
|
|||
|
||||
const bpmnInstances = () => (window as any)?.bpmnInstances;
|
||||
|
||||
// @ts-expect-error no-unused-vars
|
||||
// @ts-expect-error: retained for legacy multi-instance mode compatibility
|
||||
// eslint-disable-next-line unused-imports/no-unused-vars
|
||||
const getElementLoop = (businessObject: any): void => {
|
||||
if (!businessObject.loopCharacteristics) {
|
||||
|
|
@ -140,7 +140,7 @@ const changeLoopCharacteristicsType = (type: any): void => {
|
|||
isSequential: true,
|
||||
})
|
||||
: bpmnInstances().moddle.create('bpmn:MultiInstanceLoopCharacteristics', {
|
||||
collection: '${coll_userList}',
|
||||
collection: `\${coll_userList}`,
|
||||
});
|
||||
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||
loopCharacteristics: toRaw(multiLoopInstance.value),
|
||||
|
|
@ -231,7 +231,7 @@ const updateLoopAsync = (key: any): void => {
|
|||
extensionElements: null,
|
||||
};
|
||||
} else {
|
||||
// @ts-expect-error
|
||||
// @ts-expect-error: dynamic async flags are assigned by runtime key
|
||||
asyncAttr[key] = loopInstanceForm.value[key];
|
||||
}
|
||||
bpmnInstances().modeling.updateModdleProperties(
|
||||
|
|
@ -246,7 +246,7 @@ const changeConfig = (config: string): void => {
|
|||
case '会签': {
|
||||
changeLoopCharacteristicsType('ParallelMultiInstance');
|
||||
|
||||
updateLoopCondition('${ nrOfCompletedInstances >= nrOfInstances }');
|
||||
updateLoopCondition(`\${ nrOfCompletedInstances >= nrOfInstances }`);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -254,14 +254,14 @@ const changeConfig = (config: string): void => {
|
|||
changeLoopCharacteristicsType('SequentialMultiInstance');
|
||||
updateLoopCardinality('1');
|
||||
|
||||
updateLoopCondition('${ nrOfCompletedInstances >= nrOfInstances }');
|
||||
updateLoopCondition(`\${ nrOfCompletedInstances >= nrOfInstances }`);
|
||||
|
||||
break;
|
||||
}
|
||||
case '或签': {
|
||||
changeLoopCharacteristicsType('ParallelMultiInstance');
|
||||
|
||||
updateLoopCondition('${ nrOfCompletedInstances > 0 }');
|
||||
updateLoopCondition(`\${ nrOfCompletedInstances > 0 }`);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -330,7 +330,7 @@ const updateLoopCharacteristics = (): void => {
|
|||
multiLoopInstance.value = bpmnInstances().moddle.create(
|
||||
'bpmn:MultiInstanceLoopCharacteristics',
|
||||
|
||||
{ isSequential: false, collection: '${coll_userList}' },
|
||||
{ isSequential: false, collection: `\${coll_userList}` },
|
||||
);
|
||||
multiLoopInstance.value.completionCondition =
|
||||
bpmnInstances().moddle.create('bpmn:FormalExpression', {
|
||||
|
|
@ -343,18 +343,18 @@ const updateLoopCharacteristics = (): void => {
|
|||
multiLoopInstance.value = bpmnInstances().moddle.create(
|
||||
'bpmn:MultiInstanceLoopCharacteristics',
|
||||
|
||||
{ isSequential: false, collection: '${coll_userList}' },
|
||||
{ isSequential: false, collection: `\${coll_userList}` },
|
||||
);
|
||||
multiLoopInstance.value.completionCondition =
|
||||
bpmnInstances().moddle.create('bpmn:FormalExpression', {
|
||||
body: '${ nrOfCompletedInstances > 0 }',
|
||||
body: `\${ nrOfCompletedInstances > 0 }`,
|
||||
});
|
||||
}
|
||||
if (approveMethod.value === ApproveMethodType.SEQUENTIAL_APPROVE) {
|
||||
multiLoopInstance.value = bpmnInstances().moddle.create(
|
||||
'bpmn:MultiInstanceLoopCharacteristics',
|
||||
|
||||
{ isSequential: true, collection: '${coll_userList}' },
|
||||
{ isSequential: true, collection: `\${coll_userList}` },
|
||||
);
|
||||
multiLoopInstance.value.loopCardinality = bpmnInstances().moddle.create(
|
||||
'bpmn:FormalExpression',
|
||||
|
|
@ -364,7 +364,7 @@ const updateLoopCharacteristics = (): void => {
|
|||
);
|
||||
multiLoopInstance.value.completionCondition =
|
||||
bpmnInstances().moddle.create('bpmn:FormalExpression', {
|
||||
body: '${ nrOfCompletedInstances >= nrOfInstances }',
|
||||
body: `\${ nrOfCompletedInstances >= nrOfInstances }`,
|
||||
});
|
||||
}
|
||||
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import BpmnRenderer from 'bpmn-js/lib/draw/BpmnRenderer';
|
||||
|
||||
export default function CustomRenderer(
|
||||
function CustomRenderer(
|
||||
config,
|
||||
eventBus,
|
||||
styles,
|
||||
|
|
@ -19,12 +19,10 @@ export default function CustomRenderer(
|
|||
2000,
|
||||
);
|
||||
|
||||
this.handlers.label = function () {
|
||||
return null;
|
||||
};
|
||||
this.handlers.label = () => null;
|
||||
}
|
||||
|
||||
const F = function () {}; // 核心,利用空对象作为中介;
|
||||
F.prototype = BpmnRenderer.prototype; // 核心,将父类的原型赋值给空对象F;
|
||||
CustomRenderer.prototype = new F(); // 核心,将 F的实例赋值给子类;
|
||||
CustomRenderer.prototype.constructor = CustomRenderer; // 修复子类CustomRenderer的构造器指向,防止原型链的混乱;
|
||||
CustomRenderer.prototype = Object.create(BpmnRenderer.prototype);
|
||||
CustomRenderer.prototype.constructor = CustomRenderer;
|
||||
|
||||
export default CustomRenderer;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import BpmnRules from 'bpmn-js/lib/features/rules/BpmnRules';
|
|||
// eslint-disable-next-line n/no-extraneous-import
|
||||
import inherits from 'inherits';
|
||||
|
||||
export default function CustomRules(eventBus) {
|
||||
function CustomRules(eventBus) {
|
||||
BpmnRules.call(this, eventBus);
|
||||
}
|
||||
|
||||
|
|
@ -15,3 +15,5 @@ CustomRules.prototype.canDrop = function () {
|
|||
CustomRules.prototype.canMove = function () {
|
||||
return false;
|
||||
};
|
||||
|
||||
export default CustomRules;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ type EnvType = 'h5' | 'miniapp'; // 环境类型
|
|||
|
||||
// UniApp WebView 类型声明
|
||||
interface UniWebView {
|
||||
postMessage: (options: { data: any }) => void;
|
||||
postMessage: (options: { data: any }, targetOrigin?: string) => void;
|
||||
getEnv: (callback: (res: any) => void) => void;
|
||||
navigateTo: (options: {
|
||||
fail?: () => void;
|
||||
|
|
@ -182,7 +182,7 @@ function postMessageToParent(message: { data: any; type: string }) {
|
|||
if (envType.value === 'miniapp') {
|
||||
if (window.uni?.postMessage) {
|
||||
// 传递的消息信息,必须写在 data 对象中
|
||||
window.uni.postMessage({ data: message.data });
|
||||
window.uni.postMessage({ data: message.data }, window.location.origin);
|
||||
} else {
|
||||
console.error('小程序环境下 uni 对象未定义');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { hasPrimaryModifier } from 'diagram-js/lib/util/Mouse';
|
|||
/**
|
||||
* A provider for BPMN 2.0 elements context pad
|
||||
*/
|
||||
export default function ContextPadProvider(
|
||||
function ContextPadProvider(
|
||||
config,
|
||||
injector,
|
||||
eventBus,
|
||||
|
|
@ -57,6 +57,8 @@ export default function ContextPadProvider(
|
|||
});
|
||||
}
|
||||
|
||||
export default ContextPadProvider;
|
||||
|
||||
ContextPadProvider.$inject = [
|
||||
'config.contextPad',
|
||||
'injector',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import PaletteProvider from 'bpmn-js/lib/features/palette/PaletteProvider';
|
||||
|
||||
export default function CustomPalette(
|
||||
function CustomPalette(
|
||||
palette,
|
||||
create,
|
||||
elementFactory,
|
||||
|
|
@ -24,11 +24,21 @@ export default function CustomPalette(
|
|||
);
|
||||
}
|
||||
|
||||
const F = function () {}; // 核心,利用空对象作为中介;
|
||||
F.prototype = PaletteProvider.prototype; // 核心,将父类的原型赋值给空对象F;
|
||||
CustomPalette.$inject = [
|
||||
'palette',
|
||||
'create',
|
||||
'elementFactory',
|
||||
'spaceTool',
|
||||
'lassoTool',
|
||||
'handTool',
|
||||
'globalConnect',
|
||||
'translate',
|
||||
];
|
||||
|
||||
// 利用中介函数重写原型链方法
|
||||
F.prototype.getPaletteEntries = function () {
|
||||
CustomPalette.prototype = Object.create(PaletteProvider.prototype);
|
||||
CustomPalette.prototype.constructor = CustomPalette;
|
||||
|
||||
CustomPalette.prototype.getPaletteEntries = function () {
|
||||
const actions = {};
|
||||
const create = this._create;
|
||||
const elementFactory = this._elementFactory;
|
||||
|
|
@ -94,8 +104,7 @@ F.prototype.getPaletteEntries = function () {
|
|||
'hand-tool': {
|
||||
group: 'tools',
|
||||
className: 'bpmn-icon-hand-tool',
|
||||
title: '激活抓手工具',
|
||||
// title: translate("Activate the hand tool"),
|
||||
title: translate('Activate the hand tool'),
|
||||
action: {
|
||||
click(event) {
|
||||
handTool.activateHand(event);
|
||||
|
|
@ -219,16 +228,4 @@ F.prototype.getPaletteEntries = function () {
|
|||
return actions;
|
||||
};
|
||||
|
||||
CustomPalette.$inject = [
|
||||
'palette',
|
||||
'create',
|
||||
'elementFactory',
|
||||
'spaceTool',
|
||||
'lassoTool',
|
||||
'handTool',
|
||||
'globalConnect',
|
||||
'translate',
|
||||
];
|
||||
|
||||
CustomPalette.prototype = new F(); // 核心,将 F的实例赋值给子类;
|
||||
CustomPalette.prototype.constructor = CustomPalette; // 修复子类CustomPalette的构造器指向,防止原型链的混乱;
|
||||
export default CustomPalette;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* A palette provider for BPMN 2.0 elements.
|
||||
*/
|
||||
export default function PaletteProvider(
|
||||
function PaletteProvider(
|
||||
palette,
|
||||
create,
|
||||
elementFactory,
|
||||
|
|
@ -23,6 +23,8 @@ export default function PaletteProvider(
|
|||
palette.registerProvider(this);
|
||||
}
|
||||
|
||||
export default PaletteProvider;
|
||||
|
||||
PaletteProvider.$inject = [
|
||||
'palette',
|
||||
'create',
|
||||
|
|
|
|||
|
|
@ -237,10 +237,8 @@ export default {
|
|||
'Due Date': '到期时间',
|
||||
'Follow Up Date': '跟踪日期',
|
||||
Priority: '优先级',
|
||||
'The follow up date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)':
|
||||
'跟踪日期必须符合EL表达式,如: ${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00',
|
||||
'The due date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)':
|
||||
'跟踪日期必须符合EL表达式,如: ${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00',
|
||||
[`The follow up date as an EL expression (e.g. \${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)`]: `跟踪日期必须符合EL表达式,如: \${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00`,
|
||||
[`The due date as an EL expression (e.g. \${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)`]: `跟踪日期必须符合EL表达式,如: \${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00`,
|
||||
Variables: '变量',
|
||||
'Candidate Starter Configuration': '候选人起动器配置',
|
||||
'Candidate Starter Groups': '候选人起动器组',
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ declare global {
|
|||
|
||||
const bpmnInstances = () => (window as any)?.bpmnInstances;
|
||||
|
||||
// @ts-expect-error
|
||||
// @ts-expect-error: retained for legacy multi-instance mode compatibility
|
||||
// eslint-disable-next-line unused-imports/no-unused-vars
|
||||
const getElementLoop = (businessObject: any): void => {
|
||||
if (!businessObject.loopCharacteristics) {
|
||||
|
|
@ -142,7 +142,7 @@ const changeLoopCharacteristicsType = (type: any): void => {
|
|||
isSequential: true,
|
||||
})
|
||||
: bpmnInstances().moddle.create('bpmn:MultiInstanceLoopCharacteristics', {
|
||||
collection: '${coll_userList}',
|
||||
collection: `\${coll_userList}`,
|
||||
});
|
||||
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||
loopCharacteristics: toRaw(multiLoopInstance.value),
|
||||
|
|
@ -233,7 +233,7 @@ const updateLoopAsync = (key: any): void => {
|
|||
extensionElements: null,
|
||||
};
|
||||
} else {
|
||||
// @ts-expect-error
|
||||
// @ts-expect-error: dynamic async flags are assigned by runtime key
|
||||
asyncAttr[key] = loopInstanceForm.value[key];
|
||||
}
|
||||
bpmnInstances().modeling.updateModdleProperties(
|
||||
|
|
@ -247,20 +247,20 @@ const changeConfig = (config: string): void => {
|
|||
switch (config) {
|
||||
case '会签': {
|
||||
changeLoopCharacteristicsType('ParallelMultiInstance');
|
||||
updateLoopCondition('${ nrOfCompletedInstances >= nrOfInstances }');
|
||||
updateLoopCondition(`\${ nrOfCompletedInstances >= nrOfInstances }`);
|
||||
|
||||
break;
|
||||
}
|
||||
case '依次审批': {
|
||||
changeLoopCharacteristicsType('SequentialMultiInstance');
|
||||
updateLoopCardinality('1');
|
||||
updateLoopCondition('${ nrOfCompletedInstances >= nrOfInstances }');
|
||||
updateLoopCondition(`\${ nrOfCompletedInstances >= nrOfInstances }`);
|
||||
|
||||
break;
|
||||
}
|
||||
case '或签': {
|
||||
changeLoopCharacteristicsType('ParallelMultiInstance');
|
||||
updateLoopCondition('${ nrOfCompletedInstances > 0 }');
|
||||
updateLoopCondition(`\${ nrOfCompletedInstances > 0 }`);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -328,7 +328,7 @@ const updateLoopCharacteristics = (): void => {
|
|||
if (approveMethod.value === ApproveMethodType.APPROVE_BY_RATIO) {
|
||||
multiLoopInstance.value = bpmnInstances().moddle.create(
|
||||
'bpmn:MultiInstanceLoopCharacteristics',
|
||||
{ isSequential: false, collection: '${coll_userList}' },
|
||||
{ isSequential: false, collection: `\${coll_userList}` },
|
||||
);
|
||||
multiLoopInstance.value.completionCondition =
|
||||
bpmnInstances().moddle.create('bpmn:FormalExpression', {
|
||||
|
|
@ -340,17 +340,17 @@ const updateLoopCharacteristics = (): void => {
|
|||
if (approveMethod.value === ApproveMethodType.ANY_APPROVE) {
|
||||
multiLoopInstance.value = bpmnInstances().moddle.create(
|
||||
'bpmn:MultiInstanceLoopCharacteristics',
|
||||
{ isSequential: false, collection: '${coll_userList}' },
|
||||
{ isSequential: false, collection: `\${coll_userList}` },
|
||||
);
|
||||
multiLoopInstance.value.completionCondition =
|
||||
bpmnInstances().moddle.create('bpmn:FormalExpression', {
|
||||
body: '${ nrOfCompletedInstances > 0 }',
|
||||
body: `\${ nrOfCompletedInstances > 0 }`,
|
||||
});
|
||||
}
|
||||
if (approveMethod.value === ApproveMethodType.SEQUENTIAL_APPROVE) {
|
||||
multiLoopInstance.value = bpmnInstances().moddle.create(
|
||||
'bpmn:MultiInstanceLoopCharacteristics',
|
||||
{ isSequential: true, collection: '${coll_userList}' },
|
||||
{ isSequential: true, collection: `\${coll_userList}` },
|
||||
);
|
||||
multiLoopInstance.value.loopCardinality = bpmnInstances().moddle.create(
|
||||
'bpmn:FormalExpression',
|
||||
|
|
@ -360,7 +360,7 @@ const updateLoopCharacteristics = (): void => {
|
|||
);
|
||||
multiLoopInstance.value.completionCondition =
|
||||
bpmnInstances().moddle.create('bpmn:FormalExpression', {
|
||||
body: '${ nrOfCompletedInstances >= nrOfInstances }',
|
||||
body: `\${ nrOfCompletedInstances >= nrOfInstances }`,
|
||||
});
|
||||
}
|
||||
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import BpmnRenderer from 'bpmn-js/lib/draw/BpmnRenderer';
|
||||
|
||||
export default function CustomRenderer(
|
||||
function CustomRenderer(
|
||||
config,
|
||||
eventBus,
|
||||
styles,
|
||||
|
|
@ -19,12 +19,10 @@ export default function CustomRenderer(
|
|||
2000,
|
||||
);
|
||||
|
||||
this.handlers.label = function () {
|
||||
return null;
|
||||
};
|
||||
this.handlers.label = () => null;
|
||||
}
|
||||
|
||||
const F = function () {}; // 核心,利用空对象作为中介;
|
||||
F.prototype = BpmnRenderer.prototype; // 核心,将父类的原型赋值给空对象F;
|
||||
CustomRenderer.prototype = new F(); // 核心,将 F的实例赋值给子类;
|
||||
CustomRenderer.prototype.constructor = CustomRenderer; // 修复子类CustomRenderer的构造器指向,防止原型链的混乱;
|
||||
CustomRenderer.prototype = Object.create(BpmnRenderer.prototype);
|
||||
CustomRenderer.prototype.constructor = CustomRenderer;
|
||||
|
||||
export default CustomRenderer;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import BpmnRules from 'bpmn-js/lib/features/rules/BpmnRules';
|
|||
// eslint-disable-next-line n/no-extraneous-import
|
||||
import inherits from 'inherits';
|
||||
|
||||
export default function CustomRules(eventBus) {
|
||||
function CustomRules(eventBus) {
|
||||
BpmnRules.call(this, eventBus);
|
||||
}
|
||||
|
||||
|
|
@ -15,3 +15,5 @@ CustomRules.prototype.canDrop = function () {
|
|||
CustomRules.prototype.canMove = function () {
|
||||
return false;
|
||||
};
|
||||
|
||||
export default CustomRules;
|
||||
|
|
|
|||
Loading…
Reference in New Issue