mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-07 15:45:08 +08:00
替换var 为const/let
删除未使用import 替换 == 为 ===
This commit is contained in:
@ -49,14 +49,14 @@ export default function ContextPadProvider(
|
||||
}
|
||||
|
||||
eventBus.on("create.end", 250, function(event) {
|
||||
var context = event.context,
|
||||
shape = context.shape;
|
||||
const context = event.context,
|
||||
shape = context.shape
|
||||
|
||||
if (!hasPrimaryModifier(event) || !contextPad.isOpen(shape)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var entries = contextPad.getEntries(shape);
|
||||
const entries = contextPad.getEntries(shape)
|
||||
|
||||
if (entries.replace) {
|
||||
entries.replace.action.click(event, shape);
|
||||
@ -81,7 +81,7 @@ ContextPadProvider.$inject = [
|
||||
];
|
||||
|
||||
ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
var contextPad = this._contextPad,
|
||||
const contextPad = this._contextPad,
|
||||
modeling = this._modeling,
|
||||
elementFactory = this._elementFactory,
|
||||
connect = this._connect,
|
||||
@ -90,15 +90,15 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
canvas = this._canvas,
|
||||
rules = this._rules,
|
||||
autoPlace = this._autoPlace,
|
||||
translate = this._translate;
|
||||
translate = this._translate
|
||||
|
||||
var actions = {};
|
||||
const actions = {}
|
||||
|
||||
if (element.type === "label") {
|
||||
return actions;
|
||||
}
|
||||
|
||||
var businessObject = element.businessObject;
|
||||
const businessObject = element.businessObject
|
||||
|
||||
function startConnect(event, element) {
|
||||
connect.start(event, element);
|
||||
@ -109,21 +109,21 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
}
|
||||
|
||||
function getReplaceMenuPosition(element) {
|
||||
var Y_OFFSET = 5;
|
||||
const Y_OFFSET = 5
|
||||
|
||||
var diagramContainer = canvas.getContainer(),
|
||||
pad = contextPad.getPad(element).html;
|
||||
const diagramContainer = canvas.getContainer(),
|
||||
pad = contextPad.getPad(element).html
|
||||
|
||||
var diagramRect = diagramContainer.getBoundingClientRect(),
|
||||
padRect = pad.getBoundingClientRect();
|
||||
const diagramRect = diagramContainer.getBoundingClientRect(),
|
||||
padRect = pad.getBoundingClientRect()
|
||||
|
||||
var top = padRect.top - diagramRect.top;
|
||||
var left = padRect.left - diagramRect.left;
|
||||
const top = padRect.top - diagramRect.top
|
||||
const left = padRect.left - diagramRect.left
|
||||
|
||||
var pos = {
|
||||
const pos = {
|
||||
x: left,
|
||||
y: top + padRect.height + Y_OFFSET
|
||||
};
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
@ -145,19 +145,19 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
}
|
||||
|
||||
function appendStart(event, element) {
|
||||
var shape = elementFactory.createShape(assign({ type: type }, options));
|
||||
const shape = elementFactory.createShape(assign({ type: type }, options))
|
||||
create.start(event, shape, {
|
||||
source: element
|
||||
});
|
||||
}
|
||||
|
||||
var append = autoPlace
|
||||
const append = autoPlace
|
||||
? function(event, element) {
|
||||
var shape = elementFactory.createShape(assign({ type: type }, options));
|
||||
const shape = elementFactory.createShape(assign({ type: type }, options))
|
||||
|
||||
autoPlace.append(element, shape);
|
||||
}
|
||||
: appendStart;
|
||||
autoPlace.append(element, shape)
|
||||
}
|
||||
: appendStart
|
||||
|
||||
return {
|
||||
group: "model",
|
||||
@ -182,7 +182,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
}
|
||||
|
||||
if (isAny(businessObject, ["bpmn:Lane", "bpmn:Participant"]) && isExpanded(businessObject)) {
|
||||
var childLanes = getChildLanes(element);
|
||||
const childLanes = getChildLanes(element)
|
||||
|
||||
assign(actions, {
|
||||
"lane-insert-above": {
|
||||
@ -302,9 +302,9 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
title: translate("Change type"),
|
||||
action: {
|
||||
click: function(event, element) {
|
||||
var position = assign(getReplaceMenuPosition(element), {
|
||||
const position = assign(getReplaceMenuPosition(element), {
|
||||
cursor: { x: event.x, y: event.y }
|
||||
});
|
||||
})
|
||||
|
||||
popupMenu.open(element, "bpmn-replace", position);
|
||||
}
|
||||
@ -350,7 +350,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
}
|
||||
|
||||
// delete element entry, only show if allowed by rules
|
||||
var deleteAllowed = rules.allowed("elements.delete", { elements: [element] });
|
||||
let deleteAllowed = rules.allowed('elements.delete', { elements: [element] })
|
||||
|
||||
if (isArray(deleteAllowed)) {
|
||||
// was the element returned as a deletion candidate?
|
||||
@ -376,10 +376,10 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
// helpers /////////
|
||||
|
||||
function isEventType(eventBo, type, definition) {
|
||||
var isType = eventBo.$instanceOf(type);
|
||||
var isDefinition = false;
|
||||
const isType = eventBo.$instanceOf(type)
|
||||
let isDefinition = false
|
||||
|
||||
var definitions = eventBo.eventDefinitions || [];
|
||||
const definitions = eventBo.eventDefinitions || []
|
||||
forEach(definitions, function(def) {
|
||||
if (def.$type === definition) {
|
||||
isDefinition = true;
|
||||
|
@ -1,12 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
var some = require("min-dash").some;
|
||||
const some = require('min-dash').some
|
||||
|
||||
var ALLOWED_TYPES = {
|
||||
FailedJobRetryTimeCycle: ["bpmn:StartEvent", "bpmn:BoundaryEvent", "bpmn:IntermediateCatchEvent", "bpmn:Activity"],
|
||||
Connector: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"],
|
||||
Field: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"]
|
||||
};
|
||||
const ALLOWED_TYPES = {
|
||||
FailedJobRetryTimeCycle: ['bpmn:StartEvent', 'bpmn:BoundaryEvent', 'bpmn:IntermediateCatchEvent', 'bpmn:Activity'],
|
||||
Connector: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent'],
|
||||
Field: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent']
|
||||
}
|
||||
|
||||
function is(element, type) {
|
||||
return element && typeof element.$instanceOf === "function" && element.$instanceOf(type);
|
||||
@ -32,8 +32,8 @@ function anyType(element, types) {
|
||||
}
|
||||
|
||||
function isAllowed(propName, propDescriptor, newElement) {
|
||||
var name = propDescriptor.name,
|
||||
types = ALLOWED_TYPES[name.replace(/activiti:/, "")];
|
||||
const name = propDescriptor.name,
|
||||
types = ALLOWED_TYPES[name.replace(/activiti:/, '')]
|
||||
|
||||
return name === propName && anyType(newElement, types);
|
||||
}
|
||||
@ -42,8 +42,8 @@ function ActivitiModdleExtension(eventBus) {
|
||||
eventBus.on(
|
||||
"property.clone",
|
||||
function(context) {
|
||||
var newElement = context.newElement,
|
||||
propDescriptor = context.propertyDescriptor;
|
||||
const newElement = context.newElement,
|
||||
propDescriptor = context.propertyDescriptor
|
||||
|
||||
this.canCloneProperty(newElement, propDescriptor);
|
||||
},
|
||||
|
@ -1,17 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
var isFunction = require("min-dash").isFunction,
|
||||
isObject = require("min-dash").isObject,
|
||||
some = require("min-dash").some;
|
||||
const isFunction = require('min-dash').isFunction,
|
||||
isObject = require('min-dash').isObject,
|
||||
some = require('min-dash').some
|
||||
|
||||
var WILDCARD = "*";
|
||||
const WILDCARD = '*'
|
||||
|
||||
function CamundaModdleExtension(eventBus) {
|
||||
var self = this;
|
||||
const self = this
|
||||
|
||||
eventBus.on("moddleCopy.canCopyProperty", function(context) {
|
||||
var property = context.property,
|
||||
parent = context.parent;
|
||||
const property = context.property,
|
||||
parent = context.parent
|
||||
|
||||
return self.canCopyProperty(property, parent);
|
||||
});
|
||||
@ -45,14 +45,14 @@ CamundaModdleExtension.prototype.canCopyProperty = function(property, parent) {
|
||||
|
||||
CamundaModdleExtension.prototype.canHostInputOutput = function(parent) {
|
||||
// allowed in camunda:Connector
|
||||
var connector = getParent(parent, "camunda:Connector");
|
||||
const connector = getParent(parent, 'camunda:Connector')
|
||||
|
||||
if (connector) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// special rules inside bpmn:FlowNode
|
||||
var flowNode = getParent(parent, "bpmn:FlowNode");
|
||||
const flowNode = getParent(parent, 'bpmn:FlowNode')
|
||||
|
||||
if (!flowNode) {
|
||||
return false;
|
||||
@ -62,15 +62,13 @@ CamundaModdleExtension.prototype.canHostInputOutput = function(parent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is(flowNode, "bpmn:SubProcess") && flowNode.get("triggeredByEvent")) {
|
||||
return false;
|
||||
}
|
||||
return !(is(flowNode, "bpmn:SubProcess") && flowNode.get("triggeredByEvent"));
|
||||
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
CamundaModdleExtension.prototype.canHostConnector = function(parent) {
|
||||
var serviceTaskLike = getParent(parent, "camunda:ServiceTaskLike");
|
||||
const serviceTaskLike = getParent(parent, 'camunda:ServiceTaskLike')
|
||||
|
||||
if (is(serviceTaskLike, "bpmn:MessageEventDefinition")) {
|
||||
// only allow on throw and end events
|
||||
@ -81,13 +79,13 @@ CamundaModdleExtension.prototype.canHostConnector = function(parent) {
|
||||
};
|
||||
|
||||
CamundaModdleExtension.prototype.canHostIn = function(parent) {
|
||||
var callActivity = getParent(parent, "bpmn:CallActivity");
|
||||
const callActivity = getParent(parent, 'bpmn:CallActivity')
|
||||
|
||||
if (callActivity) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var signalEventDefinition = getParent(parent, "bpmn:SignalEventDefinition");
|
||||
const signalEventDefinition = getParent(parent, 'bpmn:SignalEventDefinition')
|
||||
|
||||
if (signalEventDefinition) {
|
||||
// only allow on throw and end events
|
||||
@ -129,9 +127,9 @@ function getParent(element, type) {
|
||||
|
||||
function isAllowedInParent(property, parent) {
|
||||
// (1) find property descriptor
|
||||
var descriptor = property.$type && property.$model.getTypeDescriptor(property.$type);
|
||||
const descriptor = property.$type && property.$model.getTypeDescriptor(property.$type)
|
||||
|
||||
var allowedIn = descriptor && descriptor.meta && descriptor.meta.allowedIn;
|
||||
const allowedIn = descriptor && descriptor.meta && descriptor.meta.allowedIn
|
||||
|
||||
if (!allowedIn || isWildcard(allowedIn)) {
|
||||
return true;
|
||||
|
@ -1,12 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
var some = require("min-dash").some;
|
||||
const some = require('min-dash').some
|
||||
|
||||
var ALLOWED_TYPES = {
|
||||
FailedJobRetryTimeCycle: ["bpmn:StartEvent", "bpmn:BoundaryEvent", "bpmn:IntermediateCatchEvent", "bpmn:Activity"],
|
||||
Connector: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"],
|
||||
Field: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"]
|
||||
};
|
||||
const ALLOWED_TYPES = {
|
||||
FailedJobRetryTimeCycle: ['bpmn:StartEvent', 'bpmn:BoundaryEvent', 'bpmn:IntermediateCatchEvent', 'bpmn:Activity'],
|
||||
Connector: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent'],
|
||||
Field: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent']
|
||||
}
|
||||
|
||||
function is(element, type) {
|
||||
return element && typeof element.$instanceOf === "function" && element.$instanceOf(type);
|
||||
@ -32,8 +32,8 @@ function anyType(element, types) {
|
||||
}
|
||||
|
||||
function isAllowed(propName, propDescriptor, newElement) {
|
||||
var name = propDescriptor.name,
|
||||
types = ALLOWED_TYPES[name.replace(/flowable:/, "")];
|
||||
const name = propDescriptor.name,
|
||||
types = ALLOWED_TYPES[name.replace(/flowable:/, '')]
|
||||
|
||||
return name === propName && anyType(newElement, types);
|
||||
}
|
||||
@ -42,8 +42,8 @@ function FlowableModdleExtension(eventBus) {
|
||||
eventBus.on(
|
||||
"property.clone",
|
||||
function(context) {
|
||||
var newElement = context.newElement,
|
||||
propDescriptor = context.propertyDescriptor;
|
||||
const newElement = context.newElement,
|
||||
propDescriptor = context.propertyDescriptor
|
||||
|
||||
this.canCloneProperty(newElement, propDescriptor);
|
||||
},
|
||||
|
@ -10,18 +10,18 @@ F.prototype = PaletteProvider.prototype; // 核心,将父类的原型赋值给
|
||||
|
||||
// 利用中介函数重写原型链方法
|
||||
F.prototype.getPaletteEntries = function() {
|
||||
var actions = {},
|
||||
const actions = {},
|
||||
create = this._create,
|
||||
elementFactory = this._elementFactory,
|
||||
spaceTool = this._spaceTool,
|
||||
lassoTool = this._lassoTool,
|
||||
handTool = this._handTool,
|
||||
globalConnect = this._globalConnect,
|
||||
translate = this._translate;
|
||||
translate = this._translate
|
||||
|
||||
function createAction(type, group, className, title, options) {
|
||||
function createListener(event) {
|
||||
var shape = elementFactory.createShape(assign({ type: type }, options));
|
||||
const shape = elementFactory.createShape(assign({ type: type }, options))
|
||||
|
||||
if (options) {
|
||||
shape.businessObject.di.isExpanded = options.isExpanded;
|
||||
@ -30,7 +30,7 @@ F.prototype.getPaletteEntries = function() {
|
||||
create.start(event, shape);
|
||||
}
|
||||
|
||||
var shortType = type.replace(/^bpmn:/, "");
|
||||
const shortType = type.replace(/^bpmn:/, '')
|
||||
|
||||
return {
|
||||
group: group,
|
||||
@ -44,19 +44,19 @@ F.prototype.getPaletteEntries = function() {
|
||||
}
|
||||
|
||||
function createSubprocess(event) {
|
||||
var subProcess = elementFactory.createShape({
|
||||
type: "bpmn:SubProcess",
|
||||
const subProcess = elementFactory.createShape({
|
||||
type: 'bpmn:SubProcess',
|
||||
x: 0,
|
||||
y: 0,
|
||||
isExpanded: true
|
||||
});
|
||||
})
|
||||
|
||||
var startEvent = elementFactory.createShape({
|
||||
type: "bpmn:StartEvent",
|
||||
const startEvent = elementFactory.createShape({
|
||||
type: 'bpmn:StartEvent',
|
||||
x: 40,
|
||||
y: 82,
|
||||
parent: subProcess
|
||||
});
|
||||
})
|
||||
|
||||
create.start(event, [subProcess, startEvent], {
|
||||
hints: {
|
||||
|
@ -19,18 +19,18 @@ export default function PaletteProvider(palette, create, elementFactory, spaceTo
|
||||
PaletteProvider.$inject = ["palette", "create", "elementFactory", "spaceTool", "lassoTool", "handTool", "globalConnect", "translate"];
|
||||
|
||||
PaletteProvider.prototype.getPaletteEntries = function() {
|
||||
var actions = {},
|
||||
const actions = {},
|
||||
create = this._create,
|
||||
elementFactory = this._elementFactory,
|
||||
spaceTool = this._spaceTool,
|
||||
lassoTool = this._lassoTool,
|
||||
handTool = this._handTool,
|
||||
globalConnect = this._globalConnect,
|
||||
translate = this._translate;
|
||||
translate = this._translate
|
||||
|
||||
function createAction(type, group, className, title, options) {
|
||||
function createListener(event) {
|
||||
var shape = elementFactory.createShape(assign({ type: type }, options));
|
||||
const shape = elementFactory.createShape(assign({ type: type }, options))
|
||||
|
||||
if (options) {
|
||||
shape.businessObject.di.isExpanded = options.isExpanded;
|
||||
@ -39,7 +39,7 @@ PaletteProvider.prototype.getPaletteEntries = function() {
|
||||
create.start(event, shape);
|
||||
}
|
||||
|
||||
var shortType = type.replace(/^bpmn:/, "");
|
||||
const shortType = type.replace(/^bpmn:/, '')
|
||||
|
||||
return {
|
||||
group: group,
|
||||
@ -53,19 +53,19 @@ PaletteProvider.prototype.getPaletteEntries = function() {
|
||||
}
|
||||
|
||||
function createSubprocess(event) {
|
||||
var subProcess = elementFactory.createShape({
|
||||
type: "bpmn:SubProcess",
|
||||
const subProcess = elementFactory.createShape({
|
||||
type: 'bpmn:SubProcess',
|
||||
x: 0,
|
||||
y: 0,
|
||||
isExpanded: true
|
||||
});
|
||||
})
|
||||
|
||||
var startEvent = elementFactory.createShape({
|
||||
type: "bpmn:StartEvent",
|
||||
const startEvent = elementFactory.createShape({
|
||||
type: 'bpmn:StartEvent',
|
||||
x: 40,
|
||||
y: 82,
|
||||
parent: subProcess
|
||||
});
|
||||
})
|
||||
|
||||
create.start(event, [subProcess, startEvent], {
|
||||
hints: {
|
||||
|
@ -76,7 +76,7 @@ export default {
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
if (!value.match(/[a-zA-Z_][\-_.0-9_a-zA-Z$]*/)) {
|
||||
if (!value.match(/[a-zA-Z_][\-_.0-9a-zA-Z$]*/)) {
|
||||
console.log('key 不满足 XML NCName 规则,所以不进行赋值');
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user