12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985 |
- import {
- query
- } from "./chunk-XZ2PVW7M.js";
- import {
- e
- } from "./chunk-6C2KFJ7V.js";
- import {
- getLabel
- } from "./chunk-PSXVIVF4.js";
- import {
- black,
- createLine,
- getBounds,
- getCirclePath,
- getDiamondPath,
- getFillColor,
- getHeight,
- getLabelColor,
- getRectPath,
- getRoundRectPath,
- getStrokeColor,
- getWidth,
- isCollection,
- isThrowEvent,
- isTypedEvent
- } from "./chunk-LSRYXWJD.js";
- import {
- append,
- attr,
- classes,
- create,
- createTransform,
- transform
- } from "./chunk-IQOBXLIK.js";
- import {
- isEventSubProcess,
- isExpanded,
- isHorizontal
- } from "./chunk-ZH5JUQV2.js";
- import {
- getBusinessObject,
- getDi,
- is
- } from "./chunk-L5SG54UC.js";
- import {
- assign,
- forEach,
- isObject
- } from "./chunk-4AK4GF4H.js";
- // node_modules/.pnpm/diagram-js@13.4.0/node_modules/diagram-js/lib/draw/BaseRenderer.js
- var DEFAULT_RENDER_PRIORITY = 1e3;
- function BaseRenderer(eventBus, renderPriority) {
- var self = this;
- renderPriority = renderPriority || DEFAULT_RENDER_PRIORITY;
- eventBus.on(["render.shape", "render.connection"], renderPriority, function(evt, context) {
- var type = evt.type, element = context.element, visuals = context.gfx, attrs = context.attrs;
- if (self.canRender(element)) {
- if (type === "render.shape") {
- return self.drawShape(visuals, element, attrs);
- } else {
- return self.drawConnection(visuals, element, attrs);
- }
- }
- });
- eventBus.on(["render.getShapePath", "render.getConnectionPath"], renderPriority, function(evt, element) {
- if (self.canRender(element)) {
- if (evt.type === "render.getShapePath") {
- return self.getShapePath(element);
- } else {
- return self.getConnectionPath(element);
- }
- }
- });
- }
- BaseRenderer.prototype.canRender = function(element) {
- };
- BaseRenderer.prototype.drawShape = function(visuals, shape) {
- };
- BaseRenderer.prototype.drawConnection = function(visuals, connection) {
- };
- BaseRenderer.prototype.getShapePath = function(shape) {
- };
- BaseRenderer.prototype.getConnectionPath = function(connection) {
- };
- // node_modules/.pnpm/diagram-js@13.4.0/node_modules/diagram-js/lib/util/SvgTransformUtil.js
- function transform2(gfx, x, y, angle, amount) {
- var translate2 = createTransform();
- translate2.setTranslate(x, y);
- var rotate2 = createTransform();
- rotate2.setRotate(angle || 0, 0, 0);
- var scale = createTransform();
- scale.setScale(amount || 1, amount || 1);
- transform(gfx, [translate2, rotate2, scale]);
- }
- function translate(gfx, x, y) {
- var translate2 = createTransform();
- translate2.setTranslate(x, y);
- transform(gfx, translate2);
- }
- function rotate(gfx, angle) {
- var rotate2 = createTransform();
- rotate2.setRotate(angle, 0, 0);
- transform(gfx, rotate2);
- }
- // node_modules/.pnpm/ids@1.0.5/node_modules/ids/dist/index.esm.js
- function createCommonjsModule(fn, module) {
- return module = { exports: {} }, fn(module, module.exports), module.exports;
- }
- var hat_1 = createCommonjsModule(function(module) {
- var hat = module.exports = function(bits, base) {
- if (!base)
- base = 16;
- if (bits === void 0)
- bits = 128;
- if (bits <= 0)
- return "0";
- var digits = Math.log(Math.pow(2, bits)) / Math.log(base);
- for (var i = 2; digits === Infinity; i *= 2) {
- digits = Math.log(Math.pow(2, bits / i)) / Math.log(base) * i;
- }
- var rem = digits - Math.floor(digits);
- var res = "";
- for (var i = 0; i < Math.floor(digits); i++) {
- var x = Math.floor(Math.random() * base).toString(base);
- res = x + res;
- }
- if (rem) {
- var b = Math.pow(base, rem);
- var x = Math.floor(Math.random() * b).toString(base);
- res = x + res;
- }
- var parsed = parseInt(res, base);
- if (parsed !== Infinity && parsed >= Math.pow(2, bits)) {
- return hat(bits, base);
- } else
- return res;
- };
- hat.rack = function(bits, base, expandBy) {
- var fn = function(data) {
- var iters = 0;
- do {
- if (iters++ > 10) {
- if (expandBy)
- bits += expandBy;
- else
- throw new Error("too many ID collisions, use more bits");
- }
- var id = hat(bits, base);
- } while (Object.hasOwnProperty.call(hats, id));
- hats[id] = data;
- return id;
- };
- var hats = fn.hats = {};
- fn.get = function(id) {
- return fn.hats[id];
- };
- fn.set = function(id, value) {
- fn.hats[id] = value;
- return fn;
- };
- fn.bits = bits || 128;
- fn.base = base || 16;
- return fn;
- };
- });
- function Ids(seed) {
- if (!(this instanceof Ids)) {
- return new Ids(seed);
- }
- seed = seed || [128, 36, 1];
- this._seed = seed.length ? hat_1.rack(seed[0], seed[1], seed[2]) : seed;
- }
- Ids.prototype.next = function(element) {
- return this._seed(element || true);
- };
- Ids.prototype.nextPrefixed = function(prefix, element) {
- var id;
- do {
- id = prefix + this.next(true);
- } while (this.assigned(id));
- this.claim(id, element);
- return id;
- };
- Ids.prototype.claim = function(id, element) {
- this._seed.set(id, element || true);
- };
- Ids.prototype.assigned = function(id) {
- return this._seed.get(id) || false;
- };
- Ids.prototype.unclaim = function(id) {
- delete this._seed.hats[id];
- };
- Ids.prototype.clear = function() {
- var hats = this._seed.hats, id;
- for (id in hats) {
- this.unclaim(id);
- }
- };
- var index_esm_default = Ids;
- // node_modules/.pnpm/bpmn-js@16.3.2/node_modules/bpmn-js/lib/draw/BpmnRenderer.js
- var rendererIds = new index_esm_default();
- var ELEMENT_LABEL_DISTANCE = 10;
- var INNER_OUTER_DIST = 3;
- var PARTICIPANT_STROKE_WIDTH = 1.5;
- var TASK_BORDER_RADIUS = 10;
- var DEFAULT_OPACITY = 0.95;
- var FULL_OPACITY = 1;
- var LOW_OPACITY = 0.25;
- function BpmnRenderer(config, eventBus, styles, pathMap, canvas, textRenderer, priority) {
- BaseRenderer.call(this, eventBus, priority);
- var defaultFillColor = config && config.defaultFillColor, defaultStrokeColor = config && config.defaultStrokeColor, defaultLabelColor = config && config.defaultLabelColor;
- var rendererId = rendererIds.next();
- var markers = {};
- function shapeStyle(attrs) {
- return styles.computeStyle(attrs, {
- strokeLinecap: "round",
- strokeLinejoin: "round",
- stroke: black,
- strokeWidth: 2,
- fill: "white"
- });
- }
- function lineStyle(attrs) {
- return styles.computeStyle(attrs, ["no-fill"], {
- strokeLinecap: "round",
- strokeLinejoin: "round",
- stroke: black,
- strokeWidth: 2
- });
- }
- function addMarker(id, options) {
- var {
- ref = { x: 0, y: 0 },
- scale = 1,
- element
- } = options;
- var marker2 = create("marker", {
- id,
- viewBox: "0 0 20 20",
- refX: ref.x,
- refY: ref.y,
- markerWidth: 20 * scale,
- markerHeight: 20 * scale,
- orient: "auto"
- });
- append(marker2, element);
- var defs = query("defs", canvas._svg);
- if (!defs) {
- defs = create("defs");
- append(canvas._svg, defs);
- }
- append(defs, marker2);
- markers[id] = marker2;
- }
- function colorEscape(str) {
- return str.replace(/[^0-9a-zA-Z]+/g, "_");
- }
- function marker(type, fill, stroke) {
- var id = type + "-" + colorEscape(fill) + "-" + colorEscape(stroke) + "-" + rendererId;
- if (!markers[id]) {
- createMarker(id, type, fill, stroke);
- }
- return "url(#" + id + ")";
- }
- function createMarker(id, type, fill, stroke) {
- if (type === "sequenceflow-end") {
- var sequenceflowEnd = create("path", {
- d: "M 1 5 L 11 10 L 1 15 Z",
- ...shapeStyle({
- fill: stroke,
- stroke,
- strokeWidth: 1
- })
- });
- addMarker(id, {
- element: sequenceflowEnd,
- ref: { x: 11, y: 10 },
- scale: 0.5
- });
- }
- if (type === "messageflow-start") {
- var messageflowStart = create("circle", {
- cx: 6,
- cy: 6,
- r: 3.5,
- ...shapeStyle({
- fill,
- stroke,
- strokeWidth: 1,
- // fix for safari / chrome / firefox bug not correctly
- // resetting stroke dash array
- strokeDasharray: [1e4, 1]
- })
- });
- addMarker(id, {
- element: messageflowStart,
- ref: { x: 6, y: 6 }
- });
- }
- if (type === "messageflow-end") {
- var messageflowEnd = create("path", {
- d: "m 1 5 l 0 -3 l 7 3 l -7 3 z",
- ...shapeStyle({
- fill,
- stroke,
- strokeWidth: 1,
- // fix for safari / chrome / firefox bug not correctly
- // resetting stroke dash array
- strokeDasharray: [1e4, 1]
- })
- });
- addMarker(id, {
- element: messageflowEnd,
- ref: { x: 8.5, y: 5 }
- });
- }
- if (type === "association-start") {
- var associationStart = create("path", {
- d: "M 11 5 L 1 10 L 11 15",
- ...lineStyle({
- fill: "none",
- stroke,
- strokeWidth: 1.5,
- // fix for safari / chrome / firefox bug not correctly
- // resetting stroke dash array
- strokeDasharray: [1e4, 1]
- })
- });
- addMarker(id, {
- element: associationStart,
- ref: { x: 1, y: 10 },
- scale: 0.5
- });
- }
- if (type === "association-end") {
- var associationEnd = create("path", {
- d: "M 1 5 L 11 10 L 1 15",
- ...lineStyle({
- fill: "none",
- stroke,
- strokeWidth: 1.5,
- // fix for safari / chrome / firefox bug not correctly
- // resetting stroke dash array
- strokeDasharray: [1e4, 1]
- })
- });
- addMarker(id, {
- element: associationEnd,
- ref: { x: 11, y: 10 },
- scale: 0.5
- });
- }
- if (type === "conditional-flow-marker") {
- var conditionalFlowMarker = create("path", {
- d: "M 0 10 L 8 6 L 16 10 L 8 14 Z",
- ...shapeStyle({
- fill,
- stroke
- })
- });
- addMarker(id, {
- element: conditionalFlowMarker,
- ref: { x: -1, y: 10 },
- scale: 0.5
- });
- }
- if (type === "conditional-default-flow-marker") {
- var defaultFlowMarker = create("path", {
- d: "M 6 4 L 10 16",
- ...shapeStyle({
- stroke
- })
- });
- addMarker(id, {
- element: defaultFlowMarker,
- ref: { x: 0, y: 10 },
- scale: 0.5
- });
- }
- }
- function drawCircle(parentGfx, width, height, offset, attrs = {}) {
- if (isObject(offset)) {
- attrs = offset;
- offset = 0;
- }
- offset = offset || 0;
- attrs = shapeStyle(attrs);
- var cx = width / 2, cy = height / 2;
- var circle = create("circle", {
- cx,
- cy,
- r: Math.round((width + height) / 4 - offset),
- ...attrs
- });
- append(parentGfx, circle);
- return circle;
- }
- function drawRect(parentGfx, width, height, r, offset, attrs) {
- if (isObject(offset)) {
- attrs = offset;
- offset = 0;
- }
- offset = offset || 0;
- attrs = shapeStyle(attrs);
- var rect = create("rect", {
- x: offset,
- y: offset,
- width: width - offset * 2,
- height: height - offset * 2,
- rx: r,
- ry: r,
- ...attrs
- });
- append(parentGfx, rect);
- return rect;
- }
- function drawDiamond(parentGfx, width, height, attrs) {
- var x_2 = width / 2;
- var y_2 = height / 2;
- var points = [
- { x: x_2, y: 0 },
- { x: width, y: y_2 },
- { x: x_2, y: height },
- { x: 0, y: y_2 }
- ];
- var pointsString = points.map(function(point) {
- return point.x + "," + point.y;
- }).join(" ");
- attrs = shapeStyle(attrs);
- var polygon = create("polygon", {
- ...attrs,
- points: pointsString
- });
- append(parentGfx, polygon);
- return polygon;
- }
- function drawLine(parentGfx, waypoints, attrs, radius) {
- attrs = lineStyle(attrs);
- var line = createLine(waypoints, attrs, radius);
- append(parentGfx, line);
- return line;
- }
- function drawConnectionSegments(parentGfx, waypoints, attrs) {
- return drawLine(parentGfx, waypoints, attrs, 5);
- }
- function drawPath(parentGfx, d, attrs) {
- attrs = lineStyle(attrs);
- var path = create("path", {
- ...attrs,
- d
- });
- append(parentGfx, path);
- return path;
- }
- function drawMarker(type, parentGfx, path, attrs) {
- return drawPath(parentGfx, path, assign({ "data-marker": type }, attrs));
- }
- function renderer(type) {
- return handlers[type];
- }
- function as(type) {
- return function(parentGfx, element, attrs) {
- return renderer(type)(parentGfx, element, attrs);
- };
- }
- var eventIconRenderers = {
- "bpmn:MessageEventDefinition": function(parentGfx, element, attrs = {}, isThrowing) {
- var pathData = pathMap.getScaledPath("EVENT_MESSAGE", {
- xScaleFactor: 0.9,
- yScaleFactor: 0.9,
- containerWidth: element.width,
- containerHeight: element.height,
- position: {
- mx: 0.235,
- my: 0.315
- }
- });
- var fill = isThrowing ? getStrokeColor(element, defaultStrokeColor, attrs.stroke) : getFillColor(element, defaultFillColor, attrs.fill);
- var stroke = isThrowing ? getFillColor(element, defaultFillColor, attrs.fill) : getStrokeColor(element, defaultStrokeColor, attrs.stroke);
- var messagePath = drawPath(parentGfx, pathData, {
- fill,
- stroke,
- strokeWidth: 1
- });
- return messagePath;
- },
- "bpmn:TimerEventDefinition": function(parentGfx, element, attrs = {}) {
- var circle = drawCircle(parentGfx, element.width, element.height, 0.2 * element.height, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 2
- });
- var pathData = pathMap.getScaledPath("EVENT_TIMER_WH", {
- xScaleFactor: 0.75,
- yScaleFactor: 0.75,
- containerWidth: element.width,
- containerHeight: element.height,
- position: {
- mx: 0.5,
- my: 0.5
- }
- });
- drawPath(parentGfx, pathData, {
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 2
- });
- for (var i = 0; i < 12; i++) {
- var linePathData = pathMap.getScaledPath("EVENT_TIMER_LINE", {
- xScaleFactor: 0.75,
- yScaleFactor: 0.75,
- containerWidth: element.width,
- containerHeight: element.height,
- position: {
- mx: 0.5,
- my: 0.5
- }
- });
- var width = element.width / 2, height = element.height / 2;
- drawPath(parentGfx, linePathData, {
- strokeWidth: 1,
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- transform: "rotate(" + i * 30 + "," + height + "," + width + ")"
- });
- }
- return circle;
- },
- "bpmn:EscalationEventDefinition": function(parentGfx, event, attrs = {}, isThrowing) {
- var pathData = pathMap.getScaledPath("EVENT_ESCALATION", {
- xScaleFactor: 1,
- yScaleFactor: 1,
- containerWidth: event.width,
- containerHeight: event.height,
- position: {
- mx: 0.5,
- my: 0.2
- }
- });
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : getFillColor(event, defaultFillColor, attrs.fill);
- return drawPath(parentGfx, pathData, {
- fill,
- stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- },
- "bpmn:ConditionalEventDefinition": function(parentGfx, event, attrs = {}) {
- var pathData = pathMap.getScaledPath("EVENT_CONDITIONAL", {
- xScaleFactor: 1,
- yScaleFactor: 1,
- containerWidth: event.width,
- containerHeight: event.height,
- position: {
- mx: 0.5,
- my: 0.222
- }
- });
- return drawPath(parentGfx, pathData, {
- fill: getFillColor(event, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- },
- "bpmn:LinkEventDefinition": function(parentGfx, event, attrs = {}, isThrowing) {
- var pathData = pathMap.getScaledPath("EVENT_LINK", {
- xScaleFactor: 1,
- yScaleFactor: 1,
- containerWidth: event.width,
- containerHeight: event.height,
- position: {
- mx: 0.57,
- my: 0.263
- }
- });
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : getFillColor(event, defaultFillColor, attrs.fill);
- return drawPath(parentGfx, pathData, {
- fill,
- stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- },
- "bpmn:ErrorEventDefinition": function(parentGfx, event, attrs = {}, isThrowing) {
- var pathData = pathMap.getScaledPath("EVENT_ERROR", {
- xScaleFactor: 1.1,
- yScaleFactor: 1.1,
- containerWidth: event.width,
- containerHeight: event.height,
- position: {
- mx: 0.2,
- my: 0.722
- }
- });
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : getFillColor(event, defaultFillColor, attrs.fill);
- return drawPath(parentGfx, pathData, {
- fill,
- stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- },
- "bpmn:CancelEventDefinition": function(parentGfx, event, attrs = {}, isThrowing) {
- var pathData = pathMap.getScaledPath("EVENT_CANCEL_45", {
- xScaleFactor: 1,
- yScaleFactor: 1,
- containerWidth: event.width,
- containerHeight: event.height,
- position: {
- mx: 0.638,
- my: -0.055
- }
- });
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : "none";
- var path = drawPath(parentGfx, pathData, {
- fill,
- stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- rotate(path, 45);
- return path;
- },
- "bpmn:CompensateEventDefinition": function(parentGfx, event, attrs = {}, isThrowing) {
- var pathData = pathMap.getScaledPath("EVENT_COMPENSATION", {
- xScaleFactor: 1,
- yScaleFactor: 1,
- containerWidth: event.width,
- containerHeight: event.height,
- position: {
- mx: 0.22,
- my: 0.5
- }
- });
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : getFillColor(event, defaultFillColor, attrs.fill);
- return drawPath(parentGfx, pathData, {
- fill,
- stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- },
- "bpmn:SignalEventDefinition": function(parentGfx, event, attrs = {}, isThrowing) {
- var pathData = pathMap.getScaledPath("EVENT_SIGNAL", {
- xScaleFactor: 0.9,
- yScaleFactor: 0.9,
- containerWidth: event.width,
- containerHeight: event.height,
- position: {
- mx: 0.5,
- my: 0.2
- }
- });
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : getFillColor(event, defaultFillColor, attrs.fill);
- return drawPath(parentGfx, pathData, {
- strokeWidth: 1,
- fill,
- stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke)
- });
- },
- "bpmn:MultipleEventDefinition": function(parentGfx, event, attrs = {}, isThrowing) {
- var pathData = pathMap.getScaledPath("EVENT_MULTIPLE", {
- xScaleFactor: 1.1,
- yScaleFactor: 1.1,
- containerWidth: event.width,
- containerHeight: event.height,
- position: {
- mx: 0.222,
- my: 0.36
- }
- });
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : getFillColor(event, defaultFillColor, attrs.fill);
- return drawPath(parentGfx, pathData, {
- fill,
- strokeWidth: 1
- });
- },
- "bpmn:ParallelMultipleEventDefinition": function(parentGfx, event, attrs = {}) {
- var pathData = pathMap.getScaledPath("EVENT_PARALLEL_MULTIPLE", {
- xScaleFactor: 1.2,
- yScaleFactor: 1.2,
- containerWidth: event.width,
- containerHeight: event.height,
- position: {
- mx: 0.458,
- my: 0.194
- }
- });
- return drawPath(parentGfx, pathData, {
- fill: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
- stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- },
- "bpmn:TerminateEventDefinition": function(parentGfx, element, attrs = {}) {
- var circle = drawCircle(parentGfx, element.width, element.height, 8, {
- fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 4
- });
- return circle;
- }
- };
- function renderEventIcon(element, parentGfx, attrs = {}) {
- var semantic = getBusinessObject(element), isThrowing = isThrowEvent(semantic);
- if (semantic.get("eventDefinitions") && semantic.get("eventDefinitions").length > 1) {
- if (semantic.get("parallelMultiple")) {
- return eventIconRenderers["bpmn:ParallelMultipleEventDefinition"](parentGfx, element, attrs, isThrowing);
- } else {
- return eventIconRenderers["bpmn:MultipleEventDefinition"](parentGfx, element, attrs, isThrowing);
- }
- }
- if (isTypedEvent(semantic, "bpmn:MessageEventDefinition")) {
- return eventIconRenderers["bpmn:MessageEventDefinition"](parentGfx, element, attrs, isThrowing);
- }
- if (isTypedEvent(semantic, "bpmn:TimerEventDefinition")) {
- return eventIconRenderers["bpmn:TimerEventDefinition"](parentGfx, element, attrs, isThrowing);
- }
- if (isTypedEvent(semantic, "bpmn:ConditionalEventDefinition")) {
- return eventIconRenderers["bpmn:ConditionalEventDefinition"](parentGfx, element, attrs, isThrowing);
- }
- if (isTypedEvent(semantic, "bpmn:SignalEventDefinition")) {
- return eventIconRenderers["bpmn:SignalEventDefinition"](parentGfx, element, attrs, isThrowing);
- }
- if (isTypedEvent(semantic, "bpmn:EscalationEventDefinition")) {
- return eventIconRenderers["bpmn:EscalationEventDefinition"](parentGfx, element, attrs, isThrowing);
- }
- if (isTypedEvent(semantic, "bpmn:LinkEventDefinition")) {
- return eventIconRenderers["bpmn:LinkEventDefinition"](parentGfx, element, attrs, isThrowing);
- }
- if (isTypedEvent(semantic, "bpmn:ErrorEventDefinition")) {
- return eventIconRenderers["bpmn:ErrorEventDefinition"](parentGfx, element, attrs, isThrowing);
- }
- if (isTypedEvent(semantic, "bpmn:CancelEventDefinition")) {
- return eventIconRenderers["bpmn:CancelEventDefinition"](parentGfx, element, attrs, isThrowing);
- }
- if (isTypedEvent(semantic, "bpmn:CompensateEventDefinition")) {
- return eventIconRenderers["bpmn:CompensateEventDefinition"](parentGfx, element, attrs, isThrowing);
- }
- if (isTypedEvent(semantic, "bpmn:TerminateEventDefinition")) {
- return eventIconRenderers["bpmn:TerminateEventDefinition"](parentGfx, element, attrs, isThrowing);
- }
- return null;
- }
- var taskMarkerRenderers = {
- "ParticipantMultiplicityMarker": function(parentGfx, element, attrs = {}) {
- var width = getWidth(element, attrs), height = getHeight(element, attrs);
- var markerPath = pathMap.getScaledPath("MARKER_PARALLEL", {
- xScaleFactor: 1,
- yScaleFactor: 1,
- containerWidth: width,
- containerHeight: height,
- position: {
- mx: (width / 2 - 6) / width,
- my: (height - 15) / height
- }
- });
- drawMarker("participant-multiplicity", parentGfx, markerPath, {
- strokeWidth: 2,
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
- });
- },
- "SubProcessMarker": function(parentGfx, element, attrs = {}) {
- var markerRect = drawRect(parentGfx, 14, 14, 0, {
- strokeWidth: 1,
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
- });
- translate(markerRect, element.width / 2 - 7.5, element.height - 20);
- var markerPath = pathMap.getScaledPath("MARKER_SUB_PROCESS", {
- xScaleFactor: 1.5,
- yScaleFactor: 1.5,
- containerWidth: element.width,
- containerHeight: element.height,
- position: {
- mx: (element.width / 2 - 7.5) / element.width,
- my: (element.height - 20) / element.height
- }
- });
- drawMarker("sub-process", parentGfx, markerPath, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
- });
- },
- "ParallelMarker": function(parentGfx, element, attrs) {
- var width = getWidth(element, attrs), height = getHeight(element, attrs);
- var markerPath = pathMap.getScaledPath("MARKER_PARALLEL", {
- xScaleFactor: 1,
- yScaleFactor: 1,
- containerWidth: width,
- containerHeight: height,
- position: {
- mx: (width / 2 + attrs.parallel) / width,
- my: (height - 20) / height
- }
- });
- drawMarker("parallel", parentGfx, markerPath, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
- });
- },
- "SequentialMarker": function(parentGfx, element, attrs) {
- var markerPath = pathMap.getScaledPath("MARKER_SEQUENTIAL", {
- xScaleFactor: 1,
- yScaleFactor: 1,
- containerWidth: element.width,
- containerHeight: element.height,
- position: {
- mx: (element.width / 2 + attrs.seq) / element.width,
- my: (element.height - 19) / element.height
- }
- });
- drawMarker("sequential", parentGfx, markerPath, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
- });
- },
- "CompensationMarker": function(parentGfx, element, attrs) {
- var markerMath = pathMap.getScaledPath("MARKER_COMPENSATION", {
- xScaleFactor: 1,
- yScaleFactor: 1,
- containerWidth: element.width,
- containerHeight: element.height,
- position: {
- mx: (element.width / 2 + attrs.compensation) / element.width,
- my: (element.height - 13) / element.height
- }
- });
- drawMarker("compensation", parentGfx, markerMath, {
- strokeWidth: 1,
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
- });
- },
- "LoopMarker": function(parentGfx, element, attrs) {
- var width = getWidth(element, attrs), height = getHeight(element, attrs);
- var markerPath = pathMap.getScaledPath("MARKER_LOOP", {
- xScaleFactor: 1,
- yScaleFactor: 1,
- containerWidth: width,
- containerHeight: height,
- position: {
- mx: (width / 2 + attrs.loop) / width,
- my: (height - 7) / height
- }
- });
- drawMarker("loop", parentGfx, markerPath, {
- strokeWidth: 1.5,
- fill: "none",
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeMiterlimit: 0.5
- });
- },
- "AdhocMarker": function(parentGfx, element, attrs) {
- var width = getWidth(element, attrs), height = getHeight(element, attrs);
- var markerPath = pathMap.getScaledPath("MARKER_ADHOC", {
- xScaleFactor: 1,
- yScaleFactor: 1,
- containerWidth: width,
- containerHeight: height,
- position: {
- mx: (width / 2 + attrs.adhoc) / width,
- my: (height - 15) / height
- }
- });
- drawMarker("adhoc", parentGfx, markerPath, {
- strokeWidth: 1,
- fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
- });
- }
- };
- function renderTaskMarker(type, parentGfx, element, attrs) {
- taskMarkerRenderers[type](parentGfx, element, attrs);
- }
- function renderTaskMarkers(parentGfx, element, taskMarkers, attrs = {}) {
- attrs = {
- fill: attrs.fill,
- stroke: attrs.stroke,
- width: getWidth(element, attrs),
- height: getHeight(element, attrs)
- };
- var semantic = getBusinessObject(element);
- var subprocess = taskMarkers && taskMarkers.includes("SubProcessMarker");
- if (subprocess) {
- attrs = {
- ...attrs,
- seq: -21,
- parallel: -22,
- compensation: -42,
- loop: -18,
- adhoc: 10
- };
- } else {
- attrs = {
- ...attrs,
- seq: -5,
- parallel: -6,
- compensation: -27,
- loop: 0,
- adhoc: 10
- };
- }
- forEach(taskMarkers, function(marker2) {
- renderTaskMarker(marker2, parentGfx, element, attrs);
- });
- if (semantic.get("isForCompensation")) {
- renderTaskMarker("CompensationMarker", parentGfx, element, attrs);
- }
- if (is(semantic, "bpmn:AdHocSubProcess")) {
- renderTaskMarker("AdhocMarker", parentGfx, element, attrs);
- }
- var loopCharacteristics = semantic.get("loopCharacteristics"), isSequential = loopCharacteristics && loopCharacteristics.get("isSequential");
- if (loopCharacteristics) {
- if (isSequential === void 0) {
- renderTaskMarker("LoopMarker", parentGfx, element, attrs);
- }
- if (isSequential === false) {
- renderTaskMarker("ParallelMarker", parentGfx, element, attrs);
- }
- if (isSequential === true) {
- renderTaskMarker("SequentialMarker", parentGfx, element, attrs);
- }
- }
- }
- function renderLabel(parentGfx, label, attrs = {}) {
- attrs = assign({
- size: {
- width: 100
- }
- }, attrs);
- var text = textRenderer.createText(label || "", attrs);
- classes(text).add("djs-label");
- append(parentGfx, text);
- return text;
- }
- function renderEmbeddedLabel(parentGfx, element, align, attrs = {}) {
- var semantic = getBusinessObject(element);
- var box = getBounds({
- x: element.x,
- y: element.y,
- width: element.width,
- height: element.height
- }, attrs);
- return renderLabel(parentGfx, semantic.name, {
- align,
- box,
- padding: 7,
- style: {
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
- }
- });
- }
- function renderExternalLabel(parentGfx, element, attrs = {}) {
- var box = {
- width: 90,
- height: 30,
- x: element.width / 2 + element.x,
- y: element.height / 2 + element.y
- };
- return renderLabel(parentGfx, getLabel(element), {
- box,
- fitBox: true,
- style: assign(
- {},
- textRenderer.getExternalStyle(),
- {
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
- }
- )
- });
- }
- function renderLaneLabel(parentGfx, text, element, attrs = {}) {
- var isHorizontalLane = isHorizontal(element);
- var textBox = renderLabel(parentGfx, text, {
- box: {
- height: 30,
- width: isHorizontalLane ? getHeight(element, attrs) : getWidth(element, attrs)
- },
- align: "center-middle",
- style: {
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
- }
- });
- if (isHorizontalLane) {
- var top = -1 * getHeight(element, attrs);
- transform2(textBox, 0, -top, 270);
- }
- }
- function renderActivity(parentGfx, element, attrs = {}) {
- var {
- width,
- height
- } = getBounds(element, attrs);
- return drawRect(parentGfx, width, height, TASK_BORDER_RADIUS, {
- ...attrs,
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- fillOpacity: DEFAULT_OPACITY,
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
- });
- }
- function renderAssociation(parentGfx, element, attrs = {}) {
- var semantic = getBusinessObject(element);
- var fill = getFillColor(element, defaultFillColor, attrs.fill), stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
- if (semantic.get("associationDirection") === "One" || semantic.get("associationDirection") === "Both") {
- attrs.markerEnd = marker("association-end", fill, stroke);
- }
- if (semantic.get("associationDirection") === "Both") {
- attrs.markerStart = marker("association-start", fill, stroke);
- }
- attrs = pickAttrs(attrs, [
- "markerStart",
- "markerEnd"
- ]);
- return drawConnectionSegments(parentGfx, element.waypoints, {
- ...attrs,
- stroke,
- strokeDasharray: "0, 5"
- });
- }
- function renderDataObject(parentGfx, element, attrs = {}) {
- var fill = getFillColor(element, defaultFillColor, attrs.fill), stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
- var pathData = pathMap.getScaledPath("DATA_OBJECT_PATH", {
- xScaleFactor: 1,
- yScaleFactor: 1,
- containerWidth: element.width,
- containerHeight: element.height,
- position: {
- mx: 0.474,
- my: 0.296
- }
- });
- var dataObject = drawPath(parentGfx, pathData, {
- fill,
- fillOpacity: DEFAULT_OPACITY,
- stroke
- });
- var semantic = getBusinessObject(element);
- if (isCollection(semantic)) {
- var collectionPathData = pathMap.getScaledPath("DATA_OBJECT_COLLECTION_PATH", {
- xScaleFactor: 1,
- yScaleFactor: 1,
- containerWidth: element.width,
- containerHeight: element.height,
- position: {
- mx: 0.33,
- my: (element.height - 18) / element.height
- }
- });
- drawPath(parentGfx, collectionPathData, {
- strokeWidth: 2,
- fill,
- stroke
- });
- }
- return dataObject;
- }
- function renderEvent(parentGfx, element, attrs = {}) {
- return drawCircle(parentGfx, element.width, element.height, {
- fillOpacity: DEFAULT_OPACITY,
- ...attrs,
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
- });
- }
- function renderGateway(parentGfx, element, attrs = {}) {
- return drawDiamond(parentGfx, element.width, element.height, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- fillOpacity: DEFAULT_OPACITY,
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
- });
- }
- function renderLane(parentGfx, element, attrs = {}) {
- var lane = drawRect(parentGfx, getWidth(element, attrs), getHeight(element, attrs), 0, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- fillOpacity: attrs.fillOpacity || DEFAULT_OPACITY,
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1.5
- });
- var semantic = getBusinessObject(element);
- if (is(semantic, "bpmn:Lane")) {
- var text = semantic.get("name");
- renderLaneLabel(parentGfx, text, element, attrs);
- }
- return lane;
- }
- function renderSubProcess(parentGfx, element, attrs = {}) {
- var activity = renderActivity(parentGfx, element, attrs);
- if (isEventSubProcess(element)) {
- attr(activity, {
- strokeDasharray: "0, 5.5",
- strokeWidth: 2.5
- });
- }
- var expanded = isExpanded(element);
- renderEmbeddedLabel(parentGfx, element, expanded ? "center-top" : "center-middle", attrs);
- if (expanded) {
- renderTaskMarkers(parentGfx, element, void 0, attrs);
- } else {
- renderTaskMarkers(parentGfx, element, ["SubProcessMarker"], attrs);
- }
- return activity;
- }
- function renderTask(parentGfx, element, attrs = {}) {
- var activity = renderActivity(parentGfx, element, attrs);
- renderEmbeddedLabel(parentGfx, element, "center-middle", attrs);
- renderTaskMarkers(parentGfx, element, void 0, attrs);
- return activity;
- }
- var handlers = this.handlers = {
- "bpmn:AdHocSubProcess": function(parentGfx, element, attrs = {}) {
- if (isExpanded(element)) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke",
- "width",
- "height"
- ]);
- } else {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- }
- return renderSubProcess(parentGfx, element, attrs);
- },
- "bpmn:Association": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- return renderAssociation(parentGfx, element, attrs);
- },
- "bpmn:BoundaryEvent": function(parentGfx, element, attrs = {}) {
- var { renderIcon = true } = attrs;
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var semantic = getBusinessObject(element), cancelActivity = semantic.get("cancelActivity");
- attrs = {
- strokeWidth: 1.5,
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- fillOpacity: FULL_OPACITY,
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
- };
- if (!cancelActivity) {
- attrs.strokeDasharray = "6";
- }
- var event = renderEvent(parentGfx, element, attrs);
- drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
- ...attrs,
- fill: "none"
- });
- if (renderIcon) {
- renderEventIcon(element, parentGfx, attrs);
- }
- return event;
- },
- "bpmn:BusinessRuleTask": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var task = renderTask(parentGfx, element, attrs);
- var headerData = pathMap.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN", {
- abspos: {
- x: 8,
- y: 8
- }
- });
- var businessPath = drawPath(parentGfx, headerData);
- attr(businessPath, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- var headerPathData = pathMap.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER", {
- abspos: {
- x: 8,
- y: 8
- }
- });
- var businessHeaderPath = drawPath(parentGfx, headerPathData);
- attr(businessHeaderPath, {
- fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- return task;
- },
- "bpmn:CallActivity": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- return renderSubProcess(parentGfx, element, {
- strokeWidth: 5,
- ...attrs
- });
- },
- "bpmn:ComplexGateway": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var gateway = renderGateway(parentGfx, element, attrs);
- var pathData = pathMap.getScaledPath("GATEWAY_COMPLEX", {
- xScaleFactor: 0.5,
- yScaleFactor: 0.5,
- containerWidth: element.width,
- containerHeight: element.height,
- position: {
- mx: 0.46,
- my: 0.26
- }
- });
- drawPath(parentGfx, pathData, {
- fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- return gateway;
- },
- "bpmn:DataInput": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var arrowPathData = pathMap.getRawPath("DATA_ARROW");
- var dataObject = renderDataObject(parentGfx, element, attrs);
- drawPath(parentGfx, arrowPathData, {
- fill: "none",
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- return dataObject;
- },
- "bpmn:DataInputAssociation": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- return renderAssociation(parentGfx, element, {
- ...attrs,
- markerEnd: marker("association-end", getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
- });
- },
- "bpmn:DataObject": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- return renderDataObject(parentGfx, element, attrs);
- },
- "bpmn:DataObjectReference": as("bpmn:DataObject"),
- "bpmn:DataOutput": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var arrowPathData = pathMap.getRawPath("DATA_ARROW");
- var dataObject = renderDataObject(parentGfx, element, attrs);
- drawPath(parentGfx, arrowPathData, {
- strokeWidth: 1,
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
- });
- return dataObject;
- },
- "bpmn:DataOutputAssociation": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- return renderAssociation(parentGfx, element, {
- ...attrs,
- markerEnd: marker("association-end", getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
- });
- },
- "bpmn:DataStoreReference": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var dataStorePath = pathMap.getScaledPath("DATA_STORE", {
- xScaleFactor: 1,
- yScaleFactor: 1,
- containerWidth: element.width,
- containerHeight: element.height,
- position: {
- mx: 0,
- my: 0.133
- }
- });
- return drawPath(parentGfx, dataStorePath, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- fillOpacity: DEFAULT_OPACITY,
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 2
- });
- },
- "bpmn:EndEvent": function(parentGfx, element, attrs = {}) {
- var { renderIcon = true } = attrs;
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var event = renderEvent(parentGfx, element, {
- ...attrs,
- strokeWidth: 4
- });
- if (renderIcon) {
- renderEventIcon(element, parentGfx, attrs);
- }
- return event;
- },
- "bpmn:EventBasedGateway": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var semantic = getBusinessObject(element);
- var diamond = renderGateway(parentGfx, element, attrs);
- drawCircle(parentGfx, element.width, element.height, element.height * 0.2, {
- fill: getFillColor(element, "none", attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- var type = semantic.get("eventGatewayType"), instantiate = !!semantic.get("instantiate");
- function drawEvent() {
- var pathData2 = pathMap.getScaledPath("GATEWAY_EVENT_BASED", {
- xScaleFactor: 0.18,
- yScaleFactor: 0.18,
- containerWidth: element.width,
- containerHeight: element.height,
- position: {
- mx: 0.36,
- my: 0.44
- }
- });
- drawPath(parentGfx, pathData2, {
- fill: "none",
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 2
- });
- }
- if (type === "Parallel") {
- var pathData = pathMap.getScaledPath("GATEWAY_PARALLEL", {
- xScaleFactor: 0.4,
- yScaleFactor: 0.4,
- containerWidth: element.width,
- containerHeight: element.height,
- position: {
- mx: 0.474,
- my: 0.296
- }
- });
- drawPath(parentGfx, pathData, {
- fill: "none",
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- } else if (type === "Exclusive") {
- if (!instantiate) {
- drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
- fill: "none",
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- }
- drawEvent();
- }
- return diamond;
- },
- "bpmn:ExclusiveGateway": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var gateway = renderGateway(parentGfx, element, attrs);
- var pathData = pathMap.getScaledPath("GATEWAY_EXCLUSIVE", {
- xScaleFactor: 0.4,
- yScaleFactor: 0.4,
- containerWidth: element.width,
- containerHeight: element.height,
- position: {
- mx: 0.32,
- my: 0.3
- }
- });
- var di = getDi(element);
- if (di.get("isMarkerVisible")) {
- drawPath(parentGfx, pathData, {
- fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- }
- return gateway;
- },
- "bpmn:Gateway": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- return renderGateway(parentGfx, element, attrs);
- },
- "bpmn:Group": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke",
- "width",
- "height"
- ]);
- return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1.5,
- strokeDasharray: "10, 6, 0, 6",
- fill: "none",
- pointerEvents: "none",
- width: getWidth(element, attrs),
- height: getHeight(element, attrs)
- });
- },
- "bpmn:InclusiveGateway": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var gateway = renderGateway(parentGfx, element, attrs);
- drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 2.5
- });
- return gateway;
- },
- "bpmn:IntermediateEvent": function(parentGfx, element, attrs = {}) {
- var { renderIcon = true } = attrs;
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var outer = renderEvent(parentGfx, element, {
- ...attrs,
- strokeWidth: 1.5
- });
- drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
- fill: "none",
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1.5
- });
- if (renderIcon) {
- renderEventIcon(element, parentGfx, attrs);
- }
- return outer;
- },
- "bpmn:IntermediateCatchEvent": as("bpmn:IntermediateEvent"),
- "bpmn:IntermediateThrowEvent": as("bpmn:IntermediateEvent"),
- "bpmn:Lane": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke",
- "width",
- "height"
- ]);
- return renderLane(parentGfx, element, {
- ...attrs,
- fillOpacity: LOW_OPACITY
- });
- },
- "bpmn:ManualTask": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var task = renderTask(parentGfx, element, attrs);
- var pathData = pathMap.getScaledPath("TASK_TYPE_MANUAL", {
- abspos: {
- x: 17,
- y: 15
- }
- });
- drawPath(parentGfx, pathData, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 0.5
- });
- return task;
- },
- "bpmn:MessageFlow": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var semantic = getBusinessObject(element), di = getDi(element);
- var fill = getFillColor(element, defaultFillColor, attrs.fill), stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
- var path = drawConnectionSegments(parentGfx, element.waypoints, {
- markerEnd: marker("messageflow-end", fill, stroke),
- markerStart: marker("messageflow-start", fill, stroke),
- stroke,
- strokeDasharray: "10, 11",
- strokeWidth: 1.5
- });
- if (semantic.get("messageRef")) {
- var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
- var markerPathData = pathMap.getScaledPath("MESSAGE_FLOW_MARKER", {
- abspos: {
- x: midPoint.x,
- y: midPoint.y
- }
- });
- var messageAttrs = {
- strokeWidth: 1
- };
- if (di.get("messageVisibleKind") === "initiating") {
- messageAttrs.fill = fill;
- messageAttrs.stroke = stroke;
- } else {
- messageAttrs.fill = stroke;
- messageAttrs.stroke = fill;
- }
- var message = drawPath(parentGfx, markerPathData, messageAttrs);
- var messageRef = semantic.get("messageRef"), name = messageRef.get("name");
- var label = renderLabel(parentGfx, name, {
- align: "center-top",
- fitBox: true,
- style: {
- fill: stroke
- }
- });
- var messageBounds = message.getBBox(), labelBounds = label.getBBox();
- var translateX = midPoint.x - labelBounds.width / 2, translateY = midPoint.y + messageBounds.height / 2 + ELEMENT_LABEL_DISTANCE;
- transform2(label, translateX, translateY, 0);
- }
- return path;
- },
- "bpmn:ParallelGateway": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var diamond = renderGateway(parentGfx, element, attrs);
- var pathData = pathMap.getScaledPath("GATEWAY_PARALLEL", {
- xScaleFactor: 0.6,
- yScaleFactor: 0.6,
- containerWidth: element.width,
- containerHeight: element.height,
- position: {
- mx: 0.46,
- my: 0.2
- }
- });
- drawPath(parentGfx, pathData, {
- fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- return diamond;
- },
- "bpmn:Participant": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke",
- "width",
- "height"
- ]);
- var participant = renderLane(parentGfx, element, attrs);
- var expandedParticipant = isExpanded(element);
- var horizontalParticipant = isHorizontal(element);
- var semantic = getBusinessObject(element), name = semantic.get("name");
- if (expandedParticipant) {
- var waypoints = horizontalParticipant ? [
- {
- x: 30,
- y: 0
- },
- {
- x: 30,
- y: getHeight(element, attrs)
- }
- ] : [
- {
- x: 0,
- y: 30
- },
- {
- x: getWidth(element, attrs),
- y: 30
- }
- ];
- drawLine(parentGfx, waypoints, {
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: PARTICIPANT_STROKE_WIDTH
- });
- renderLaneLabel(parentGfx, name, element, attrs);
- } else {
- var bounds = getBounds(element, attrs);
- if (!horizontalParticipant) {
- bounds.height = getWidth(element, attrs);
- bounds.width = getHeight(element, attrs);
- }
- var textBox = renderLabel(parentGfx, name, {
- box: bounds,
- align: "center-middle",
- style: {
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
- }
- });
- if (!horizontalParticipant) {
- var top = -1 * getHeight(element, attrs);
- transform2(textBox, 0, -top, 270);
- }
- }
- if (semantic.get("participantMultiplicity")) {
- renderTaskMarker("ParticipantMultiplicityMarker", parentGfx, element, attrs);
- }
- return participant;
- },
- "bpmn:ReceiveTask": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var semantic = getBusinessObject(element);
- var task = renderTask(parentGfx, element, attrs);
- var pathData;
- if (semantic.get("instantiate")) {
- drawCircle(parentGfx, 28, 28, 20 * 0.22, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- pathData = pathMap.getScaledPath("TASK_TYPE_INSTANTIATING_SEND", {
- abspos: {
- x: 7.77,
- y: 9.52
- }
- });
- } else {
- pathData = pathMap.getScaledPath("TASK_TYPE_SEND", {
- xScaleFactor: 0.9,
- yScaleFactor: 0.9,
- containerWidth: 21,
- containerHeight: 14,
- position: {
- mx: 0.3,
- my: 0.4
- }
- });
- }
- drawPath(parentGfx, pathData, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- return task;
- },
- "bpmn:ScriptTask": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var task = renderTask(parentGfx, element, attrs);
- var pathData = pathMap.getScaledPath("TASK_TYPE_SCRIPT", {
- abspos: {
- x: 15,
- y: 20
- }
- });
- drawPath(parentGfx, pathData, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- return task;
- },
- "bpmn:SendTask": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var task = renderTask(parentGfx, element, attrs);
- var pathData = pathMap.getScaledPath("TASK_TYPE_SEND", {
- xScaleFactor: 1,
- yScaleFactor: 1,
- containerWidth: 21,
- containerHeight: 14,
- position: {
- mx: 0.285,
- my: 0.357
- }
- });
- drawPath(parentGfx, pathData, {
- fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- stroke: getFillColor(element, defaultFillColor, attrs.fill),
- strokeWidth: 1
- });
- return task;
- },
- "bpmn:SequenceFlow": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var fill = getFillColor(element, defaultFillColor, attrs.fill), stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
- var connection = drawConnectionSegments(parentGfx, element.waypoints, {
- markerEnd: marker("sequenceflow-end", fill, stroke),
- stroke
- });
- var semantic = getBusinessObject(element);
- var { source } = element;
- if (source) {
- var sourceSemantic = getBusinessObject(source);
- if (semantic.get("conditionExpression") && is(sourceSemantic, "bpmn:Activity")) {
- attr(connection, {
- markerStart: marker("conditional-flow-marker", fill, stroke)
- });
- }
- if (sourceSemantic.get("default") && (is(sourceSemantic, "bpmn:Gateway") || is(sourceSemantic, "bpmn:Activity")) && sourceSemantic.get("default") === semantic) {
- attr(connection, {
- markerStart: marker("conditional-default-flow-marker", fill, stroke)
- });
- }
- }
- return connection;
- },
- "bpmn:ServiceTask": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var task = renderTask(parentGfx, element, attrs);
- drawCircle(parentGfx, 10, 10, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: "none",
- transform: "translate(6, 6)"
- });
- var pathDataService1 = pathMap.getScaledPath("TASK_TYPE_SERVICE", {
- abspos: {
- x: 12,
- y: 18
- }
- });
- drawPath(parentGfx, pathDataService1, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- drawCircle(parentGfx, 10, 10, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: "none",
- transform: "translate(11, 10)"
- });
- var pathDataService2 = pathMap.getScaledPath("TASK_TYPE_SERVICE", {
- abspos: {
- x: 17,
- y: 22
- }
- });
- drawPath(parentGfx, pathDataService2, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1
- });
- return task;
- },
- "bpmn:StartEvent": function(parentGfx, element, attrs = {}) {
- var { renderIcon = true } = attrs;
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var semantic = getBusinessObject(element);
- if (!semantic.get("isInterrupting")) {
- attrs = {
- ...attrs,
- strokeDasharray: "6"
- };
- }
- var event = renderEvent(parentGfx, element, attrs);
- if (renderIcon) {
- renderEventIcon(element, parentGfx, attrs);
- }
- return event;
- },
- "bpmn:SubProcess": function(parentGfx, element, attrs = {}) {
- if (isExpanded(element)) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke",
- "width",
- "height"
- ]);
- } else {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- }
- return renderSubProcess(parentGfx, element, attrs);
- },
- "bpmn:Task": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- return renderTask(parentGfx, element, attrs);
- },
- "bpmn:TextAnnotation": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke",
- "width",
- "height"
- ]);
- var {
- width,
- height
- } = getBounds(element, attrs);
- var textElement = drawRect(parentGfx, width, height, 0, 0, {
- fill: "none",
- stroke: "none"
- });
- var textPathData = pathMap.getScaledPath("TEXT_ANNOTATION", {
- xScaleFactor: 1,
- yScaleFactor: 1,
- containerWidth: width,
- containerHeight: height,
- position: {
- mx: 0,
- my: 0
- }
- });
- drawPath(parentGfx, textPathData, {
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
- });
- var semantic = getBusinessObject(element), text = semantic.get("text") || "";
- renderLabel(parentGfx, text, {
- align: "left-top",
- box: getBounds(element, attrs),
- padding: 7,
- style: {
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
- }
- });
- return textElement;
- },
- "bpmn:Transaction": function(parentGfx, element, attrs = {}) {
- if (isExpanded(element)) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke",
- "width",
- "height"
- ]);
- } else {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- }
- var outer = renderSubProcess(parentGfx, element, {
- strokeWidth: 1.5,
- ...attrs
- });
- var innerAttrs = styles.style(["no-fill", "no-events"], {
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 1.5
- });
- var expanded = isExpanded(element);
- if (!expanded) {
- attrs = {};
- }
- drawRect(
- parentGfx,
- getWidth(element, attrs),
- getHeight(element, attrs),
- TASK_BORDER_RADIUS - INNER_OUTER_DIST,
- INNER_OUTER_DIST,
- innerAttrs
- );
- return outer;
- },
- "bpmn:UserTask": function(parentGfx, element, attrs = {}) {
- attrs = pickAttrs(attrs, [
- "fill",
- "stroke"
- ]);
- var task = renderTask(parentGfx, element, attrs);
- var x = 15;
- var y = 12;
- var pathDataUser1 = pathMap.getScaledPath("TASK_TYPE_USER_1", {
- abspos: {
- x,
- y
- }
- });
- drawPath(parentGfx, pathDataUser1, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 0.5
- });
- var pathDataUser2 = pathMap.getScaledPath("TASK_TYPE_USER_2", {
- abspos: {
- x,
- y
- }
- });
- drawPath(parentGfx, pathDataUser2, {
- fill: getFillColor(element, defaultFillColor, attrs.fill),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 0.5
- });
- var pathDataUser3 = pathMap.getScaledPath("TASK_TYPE_USER_3", {
- abspos: {
- x,
- y
- }
- });
- drawPath(parentGfx, pathDataUser3, {
- fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
- strokeWidth: 0.5
- });
- return task;
- },
- "label": function(parentGfx, element, attrs = {}) {
- return renderExternalLabel(parentGfx, element, attrs);
- }
- };
- this._drawPath = drawPath;
- this._renderer = renderer;
- }
- e(BpmnRenderer, BaseRenderer);
- BpmnRenderer.$inject = [
- "config.bpmnRenderer",
- "eventBus",
- "styles",
- "pathMap",
- "canvas",
- "textRenderer"
- ];
- BpmnRenderer.prototype.canRender = function(element) {
- return is(element, "bpmn:BaseElement");
- };
- BpmnRenderer.prototype.drawShape = function(parentGfx, element, attrs = {}) {
- var { type } = element;
- var handler = this._renderer(type);
- return handler(parentGfx, element, attrs);
- };
- BpmnRenderer.prototype.drawConnection = function(parentGfx, element, attrs = {}) {
- var { type } = element;
- var handler = this._renderer(type);
- return handler(parentGfx, element, attrs);
- };
- BpmnRenderer.prototype.getShapePath = function(element) {
- if (is(element, "bpmn:Event")) {
- return getCirclePath(element);
- }
- if (is(element, "bpmn:Activity")) {
- return getRoundRectPath(element, TASK_BORDER_RADIUS);
- }
- if (is(element, "bpmn:Gateway")) {
- return getDiamondPath(element);
- }
- return getRectPath(element);
- };
- function pickAttrs(attrs, keys = []) {
- return keys.reduce((pickedAttrs, key) => {
- if (attrs[key]) {
- pickedAttrs[key] = attrs[key];
- }
- return pickedAttrs;
- }, {});
- }
- export {
- BaseRenderer,
- transform2 as transform,
- translate,
- rotate,
- index_esm_default,
- BpmnRenderer
- };
- //# sourceMappingURL=chunk-PK6SUIG5.js.map
|