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