UNPKG

bpmn-visualization

Version:

A TypeScript library for visualizing process execution data on BPMN diagrams

1,341 lines (1,327 loc) 1.71 MB
/* Copyright 2020-2025 Bonitasoft S.A. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ var bpmnvisu = (function (exports) { 'use strict'; exports.FitType = void 0; (function (FitType) { FitType["None"] = "None"; FitType["HorizontalVertical"] = "HorizontalVertical"; FitType["Horizontal"] = "Horizontal"; FitType["Vertical"] = "Vertical"; FitType["Center"] = "Center"; })(exports.FitType || (exports.FitType = {})); exports.ZoomType = void 0; (function (ZoomType) { ZoomType["In"] = "in"; ZoomType["Out"] = "out"; })(exports.ZoomType || (exports.ZoomType = {})); function htmlElement(element) { if (element instanceof HTMLElement) { return element; } return document.querySelector(`#${element}`); } exports.ShapeBpmnElementKind = void 0; (function (ShapeBpmnElementKind) { ShapeBpmnElementKind["LANE"] = "lane"; ShapeBpmnElementKind["POOL"] = "pool"; ShapeBpmnElementKind["CALL_ACTIVITY"] = "callActivity"; ShapeBpmnElementKind["SUB_PROCESS"] = "subProcess"; ShapeBpmnElementKind["TASK"] = "task"; ShapeBpmnElementKind["TASK_USER"] = "userTask"; ShapeBpmnElementKind["TASK_SERVICE"] = "serviceTask"; ShapeBpmnElementKind["TASK_RECEIVE"] = "receiveTask"; ShapeBpmnElementKind["TASK_SEND"] = "sendTask"; ShapeBpmnElementKind["TASK_MANUAL"] = "manualTask"; ShapeBpmnElementKind["TASK_SCRIPT"] = "scriptTask"; ShapeBpmnElementKind["TASK_BUSINESS_RULE"] = "businessRuleTask"; ShapeBpmnElementKind["GLOBAL_TASK"] = "globalTask"; ShapeBpmnElementKind["GLOBAL_TASK_USER"] = "globalUserTask"; ShapeBpmnElementKind["GLOBAL_TASK_MANUAL"] = "globalManualTask"; ShapeBpmnElementKind["GLOBAL_TASK_SCRIPT"] = "globalScriptTask"; ShapeBpmnElementKind["GLOBAL_TASK_BUSINESS_RULE"] = "globalBusinessRuleTask"; ShapeBpmnElementKind["GROUP"] = "group"; ShapeBpmnElementKind["TEXT_ANNOTATION"] = "textAnnotation"; ShapeBpmnElementKind["GATEWAY_PARALLEL"] = "parallelGateway"; ShapeBpmnElementKind["GATEWAY_EXCLUSIVE"] = "exclusiveGateway"; ShapeBpmnElementKind["GATEWAY_INCLUSIVE"] = "inclusiveGateway"; ShapeBpmnElementKind["GATEWAY_EVENT_BASED"] = "eventBasedGateway"; ShapeBpmnElementKind["GATEWAY_COMPLEX"] = "complexGateway"; ShapeBpmnElementKind["EVENT_START"] = "startEvent"; ShapeBpmnElementKind["EVENT_END"] = "endEvent"; ShapeBpmnElementKind["EVENT_INTERMEDIATE_CATCH"] = "intermediateCatchEvent"; ShapeBpmnElementKind["EVENT_INTERMEDIATE_THROW"] = "intermediateThrowEvent"; ShapeBpmnElementKind["EVENT_BOUNDARY"] = "boundaryEvent"; })(exports.ShapeBpmnElementKind || (exports.ShapeBpmnElementKind = {})); exports.ShapeBpmnCallActivityKind = void 0; (function (ShapeBpmnCallActivityKind) { ShapeBpmnCallActivityKind["CALLING_PROCESS"] = "process"; ShapeBpmnCallActivityKind["CALLING_GLOBAL_TASK"] = "global task"; })(exports.ShapeBpmnCallActivityKind || (exports.ShapeBpmnCallActivityKind = {})); exports.ShapeBpmnEventBasedGatewayKind = void 0; (function (ShapeBpmnEventBasedGatewayKind) { ShapeBpmnEventBasedGatewayKind["Exclusive"] = "Exclusive"; ShapeBpmnEventBasedGatewayKind["None"] = "None"; ShapeBpmnEventBasedGatewayKind["Parallel"] = "Parallel"; })(exports.ShapeBpmnEventBasedGatewayKind || (exports.ShapeBpmnEventBasedGatewayKind = {})); exports.ShapeBpmnEventDefinitionKind = void 0; (function (ShapeBpmnEventDefinitionKind) { ShapeBpmnEventDefinitionKind["NONE"] = "none"; ShapeBpmnEventDefinitionKind["TERMINATE"] = "terminate"; ShapeBpmnEventDefinitionKind["CANCEL"] = "cancel"; ShapeBpmnEventDefinitionKind["COMPENSATION"] = "compensate"; ShapeBpmnEventDefinitionKind["CONDITIONAL"] = "conditional"; ShapeBpmnEventDefinitionKind["ERROR"] = "error"; ShapeBpmnEventDefinitionKind["ESCALATION"] = "escalation"; ShapeBpmnEventDefinitionKind["LINK"] = "link"; ShapeBpmnEventDefinitionKind["MESSAGE"] = "message"; ShapeBpmnEventDefinitionKind["SIGNAL"] = "signal"; ShapeBpmnEventDefinitionKind["TIMER"] = "timer"; })(exports.ShapeBpmnEventDefinitionKind || (exports.ShapeBpmnEventDefinitionKind = {})); exports.ShapeBpmnMarkerKind = void 0; (function (ShapeBpmnMarkerKind) { ShapeBpmnMarkerKind["ADHOC"] = "adhoc"; ShapeBpmnMarkerKind["COMPENSATION"] = "compensation"; ShapeBpmnMarkerKind["EXPAND"] = "expand"; ShapeBpmnMarkerKind["LOOP"] = "loop"; ShapeBpmnMarkerKind["MULTI_INSTANCE_PARALLEL"] = "multi-parallel"; ShapeBpmnMarkerKind["MULTI_INSTANCE_SEQUENTIAL"] = "multi-sequential"; })(exports.ShapeBpmnMarkerKind || (exports.ShapeBpmnMarkerKind = {})); exports.ShapeBpmnSubProcessKind = void 0; (function (ShapeBpmnSubProcessKind) { ShapeBpmnSubProcessKind["AD_HOC"] = "adhoc"; ShapeBpmnSubProcessKind["EMBEDDED"] = "embedded"; ShapeBpmnSubProcessKind["EVENT"] = "event"; ShapeBpmnSubProcessKind["TRANSACTION"] = "transaction"; })(exports.ShapeBpmnSubProcessKind || (exports.ShapeBpmnSubProcessKind = {})); function convertEmptyStringAndObject(element, acceptEmptyString) { if (element === '') { return acceptEmptyString ? {} : undefined; } return element; } function ensureIsArray(elements, acceptEmptyString = false) { if (elements === undefined || elements === null) { return []; } return ((Array.isArray(elements) ? elements : [elements]) .map(element => convertEmptyStringAndObject(element, acceptEmptyString)) .filter(Boolean)); } function filter(arrayToFilter, suffix, options) { const patterns = []; if (options === null || options === void 0 ? void 0 : options.startingWith) { patterns.push(`^(${options.startingWith}).*`); } else if (options === null || options === void 0 ? void 0 : options.notStartingWith) { patterns.push(`^(?!(${options.notStartingWith})).*`); } patterns.push(`${suffix}$`); const pattern = patterns.join(''); return arrayToFilter.filter(element => ((options === null || options === void 0 ? void 0 : options.ignoreCase) ? new RegExp(pattern, 'i').test(element) : new RegExp(pattern).test(element))); } class ShapeUtil { static isEvent(kind) { return isKindOf(EVENT_KINDS, kind); } static eventKinds() { return [...EVENT_KINDS]; } static isBoundaryEvent(kind) { return exports.ShapeBpmnElementKind.EVENT_BOUNDARY === kind; } static isStartEvent(kind) { return exports.ShapeBpmnElementKind.EVENT_START === kind; } static isCatchEvent(kind) { return exports.ShapeBpmnElementKind.EVENT_INTERMEDIATE_CATCH === kind || exports.ShapeBpmnElementKind.EVENT_BOUNDARY === kind || exports.ShapeBpmnElementKind.EVENT_START === kind; } static isIntermediateCatchEvent(kind) { return exports.ShapeBpmnElementKind.EVENT_INTERMEDIATE_CATCH === kind; } static isIntermediateThrowEvent(kind) { return exports.ShapeBpmnElementKind.EVENT_INTERMEDIATE_THROW === kind; } static isCallActivity(kind) { return exports.ShapeBpmnElementKind.CALL_ACTIVITY === kind; } static isSubProcess(kind) { return exports.ShapeBpmnElementKind.SUB_PROCESS === kind; } static canHaveNoneEvent(kind) { return exports.ShapeBpmnElementKind.EVENT_INTERMEDIATE_THROW === kind || exports.ShapeBpmnElementKind.EVENT_END === kind || exports.ShapeBpmnElementKind.EVENT_START === kind; } static isActivity(kind) { return isKindOf(ACTIVITY_KINDS, kind); } static activityKinds() { return [...ACTIVITY_KINDS]; } static isWithDefaultSequenceFlow(kind) { return FLOW_NODE_WITH_DEFAULT_SEQUENCE_FLOW_KINDS.has(kind); } static isTask(kind) { return isKindOf(TASK_KINDS, kind); } static taskKinds() { return [...TASK_KINDS]; } static gatewayKinds() { return [...GATEWAY_KINDS]; } static isGateway(kind) { return isKindOf(GATEWAY_KINDS, kind); } static flowNodeKinds() { return Object.values(exports.ShapeBpmnElementKind).filter(kind => !ShapeUtil.isPoolOrLane(kind)); } static isPoolOrLane(kind) { return kind == exports.ShapeBpmnElementKind.POOL || kind == exports.ShapeBpmnElementKind.LANE; } } function filterKind(suffix, options) { return filter(Object.values(exports.ShapeBpmnElementKind), suffix, options); } function isKindOf(referenceKinds, kind) { return Object.values(referenceKinds) .map(value => value) .includes(kind); } const EVENT_KINDS = filterKind('Event'); const GATEWAY_KINDS = filterKind('Gateway'); const TASK_KINDS = filterKind('Task', { ignoreCase: true, notStartingWith: 'global' }); const ACTIVITY_KINDS = [...TASK_KINDS, exports.ShapeBpmnElementKind.CALL_ACTIVITY, exports.ShapeBpmnElementKind.SUB_PROCESS]; const FLOW_NODE_WITH_DEFAULT_SEQUENCE_FLOW_KINDS = new Set([ ...ACTIVITY_KINDS, exports.ShapeBpmnElementKind.GATEWAY_EXCLUSIVE, exports.ShapeBpmnElementKind.GATEWAY_INCLUSIVE, exports.ShapeBpmnElementKind.GATEWAY_COMPLEX, ]); const eventDefinitionKinds = Object.values(exports.ShapeBpmnEventDefinitionKind).filter(kind => kind != exports.ShapeBpmnEventDefinitionKind.NONE); exports.AssociationDirectionKind = void 0; (function (AssociationDirectionKind) { AssociationDirectionKind["NONE"] = "None"; AssociationDirectionKind["ONE"] = "One"; AssociationDirectionKind["BOTH"] = "Both"; })(exports.AssociationDirectionKind || (exports.AssociationDirectionKind = {})); exports.FlowKind = void 0; (function (FlowKind) { FlowKind["SEQUENCE_FLOW"] = "sequenceFlow"; FlowKind["MESSAGE_FLOW"] = "messageFlow"; FlowKind["ASSOCIATION_FLOW"] = "association"; })(exports.FlowKind || (exports.FlowKind = {})); exports.MessageVisibleKind = void 0; (function (MessageVisibleKind) { MessageVisibleKind["NONE"] = "none"; MessageVisibleKind["INITIATING"] = "initiating"; MessageVisibleKind["NON_INITIATING"] = "non_initiating"; })(exports.MessageVisibleKind || (exports.MessageVisibleKind = {})); exports.SequenceFlowKind = void 0; (function (SequenceFlowKind) { SequenceFlowKind["NORMAL"] = "normal"; SequenceFlowKind["DEFAULT"] = "default"; SequenceFlowKind["CONDITIONAL_FROM_ACTIVITY"] = "conditional_from_activity"; SequenceFlowKind["CONDITIONAL_FROM_GATEWAY"] = "conditional_from_gateway"; })(exports.SequenceFlowKind || (exports.SequenceFlowKind = {})); class Flow { constructor(id, name, kind, sourceReferenceId, targetReferenceId) { Object.defineProperty(this, "id", { enumerable: true, configurable: true, writable: true, value: id }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: name }); Object.defineProperty(this, "kind", { enumerable: true, configurable: true, writable: true, value: kind }); Object.defineProperty(this, "sourceReferenceId", { enumerable: true, configurable: true, writable: true, value: sourceReferenceId }); Object.defineProperty(this, "targetReferenceId", { enumerable: true, configurable: true, writable: true, value: targetReferenceId }); } } class SequenceFlow extends Flow { constructor(id, name, sourceReferenceId, targetReferenceId, sequenceFlowKind = exports.SequenceFlowKind.NORMAL) { super(id, name, exports.FlowKind.SEQUENCE_FLOW, sourceReferenceId, targetReferenceId); Object.defineProperty(this, "sequenceFlowKind", { enumerable: true, configurable: true, writable: true, value: sequenceFlowKind }); } } class MessageFlow extends Flow { constructor(id, name, sourceReferenceId, targetReferenceId) { super(id, name, exports.FlowKind.MESSAGE_FLOW, sourceReferenceId, targetReferenceId); } } class AssociationFlow extends Flow { constructor(id, name, sourceReferenceId, targetReferenceId, associationDirectionKind = exports.AssociationDirectionKind.NONE) { super(id, name, exports.FlowKind.ASSOCIATION_FLOW, sourceReferenceId, targetReferenceId); Object.defineProperty(this, "associationDirectionKind", { enumerable: true, configurable: true, writable: true, value: associationDirectionKind }); } } function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } var build$1 = {exports: {}}; var build = build$1.exports; var hasRequiredBuild; function requireBuild () { if (hasRequiredBuild) return build$1.exports; hasRequiredBuild = 1; (function (module) { (function (root, factory) { if (module.exports) { module.exports = factory(); } else { root.mxgraph = factory(); } }(build, function () { return function (opts) { for (var name in opts) { this[name] = opts[name]; } var __mxOutput = {}; var mxClient = { VERSION: '4.2.2', IS_IE: navigator.userAgent != null && navigator.userAgent.indexOf('MSIE') >= 0, IS_IE6: navigator.userAgent != null && navigator.userAgent.indexOf('MSIE 6') >= 0, IS_IE11: navigator.userAgent != null && !!navigator.userAgent.match(/Trident\/7\./), IS_EDGE: navigator.userAgent != null && !!navigator.userAgent.match(/Edge\//), IS_QUIRKS: navigator.userAgent != null && navigator.userAgent.indexOf('MSIE') >= 0 && (document.documentMode == null || document.documentMode == 5), IS_EM: 'spellcheck' in document.createElement('textarea') && document.documentMode == 8, VML_PREFIX: 'v', OFFICE_PREFIX: 'o', IS_NS: navigator.userAgent != null && navigator.userAgent.indexOf('Mozilla/') >= 0 && navigator.userAgent.indexOf('MSIE') < 0 && navigator.userAgent.indexOf('Edge/') < 0, IS_OP: navigator.userAgent != null && (navigator.userAgent.indexOf('Opera/') >= 0 || navigator.userAgent.indexOf('OPR/') >= 0), IS_OT: navigator.userAgent != null && navigator.userAgent.indexOf('Presto/') >= 0 && navigator.userAgent.indexOf('Presto/2.4.') < 0 && navigator.userAgent.indexOf('Presto/2.3.') < 0 && navigator.userAgent.indexOf('Presto/2.2.') < 0 && navigator.userAgent.indexOf('Presto/2.1.') < 0 && navigator.userAgent.indexOf('Presto/2.0.') < 0 && navigator.userAgent.indexOf('Presto/1.') < 0, IS_SF: /Apple Computer, Inc/.test(navigator.vendor), IS_ANDROID: navigator.appVersion.indexOf('Android') >= 0, IS_IOS: (/iP(hone|od|ad)/.test(navigator.platform)), IS_GC: /Google Inc/.test(navigator.vendor), IS_CHROMEAPP: window.chrome != null && chrome.app != null && chrome.app.runtime != null, IS_FF: typeof InstallTrigger !== 'undefined', IS_MT: (navigator.userAgent.indexOf('Firefox/') >= 0 && navigator.userAgent.indexOf('Firefox/1.') < 0 && navigator.userAgent.indexOf('Firefox/2.') < 0) || (navigator.userAgent.indexOf('Iceweasel/') >= 0 && navigator.userAgent.indexOf('Iceweasel/1.') < 0 && navigator.userAgent.indexOf('Iceweasel/2.') < 0) || (navigator.userAgent.indexOf('SeaMonkey/') >= 0 && navigator.userAgent.indexOf('SeaMonkey/1.') < 0) || (navigator.userAgent.indexOf('Iceape/') >= 0 && navigator.userAgent.indexOf('Iceape/1.') < 0), IS_VML: navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER', IS_SVG: navigator.appName.toUpperCase() != 'MICROSOFT INTERNET EXPLORER', NO_FO: !document.createElementNS || document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject') != '[object SVGForeignObjectElement]' || navigator.userAgent.indexOf('Opera/') >= 0, IS_WIN: navigator.appVersion.indexOf('Win') > 0, IS_MAC: navigator.appVersion.indexOf('Mac') > 0, IS_CHROMEOS: /\bCrOS\b/.test(navigator.appVersion), IS_TOUCH: 'ontouchstart' in document.documentElement, IS_POINTER: window.PointerEvent != null && !(navigator.appVersion.indexOf('Mac') > 0), IS_LOCAL: document.location.href.indexOf('http://') < 0 && document.location.href.indexOf('https://') < 0, defaultBundles: [], isBrowserSupported: function() { return mxClient.IS_VML || mxClient.IS_SVG; }, link: function(rel, href, doc, id) { doc = doc || document; if (mxClient.IS_IE6) { doc.write('<link rel="' + rel + '" href="' + href + '" charset="UTF-8" type="text/css"/>'); } else { var link = doc.createElement('link'); link.setAttribute('rel', rel); link.setAttribute('href', href); link.setAttribute('charset', 'UTF-8'); link.setAttribute('type', 'text/css'); if (id) { link.setAttribute('id', id); } var head = doc.getElementsByTagName('head')[0]; head.appendChild(link); } }, loadResources: function(fn, lan) { var pending = mxClient.defaultBundles.length; function callback() { if (--pending == 0) { fn(); } } for (var i = 0; i < mxClient.defaultBundles.length; i++) { mxResources.add(mxClient.defaultBundles[i], lan, callback); } }, include: function(src) { document.write('<script src="'+src+'"></script>'); } }; if (typeof(mxLoadResources) == 'undefined') { mxLoadResources = true; } if (typeof(mxForceIncludes) == 'undefined') { mxForceIncludes = false; } if (typeof(mxResourceExtension) == 'undefined') { mxResourceExtension = '.txt'; } if (typeof(mxLoadStylesheets) == 'undefined') { mxLoadStylesheets = true; } if (typeof(mxBasePath) != 'undefined' && mxBasePath.length > 0) { if (mxBasePath.substring(mxBasePath.length - 1) == '/') { mxBasePath = mxBasePath.substring(0, mxBasePath.length - 1); } mxClient.basePath = mxBasePath; } else { mxClient.basePath = '.'; } if (typeof(mxImageBasePath) != 'undefined' && mxImageBasePath.length > 0) { if (mxImageBasePath.substring(mxImageBasePath.length - 1) == '/') { mxImageBasePath = mxImageBasePath.substring(0, mxImageBasePath.length - 1); } mxClient.imageBasePath = mxImageBasePath; } else { mxClient.imageBasePath = mxClient.basePath + '/images'; } if (typeof(mxLanguage) != 'undefined' && mxLanguage != null) { mxClient.language = mxLanguage; } else { mxClient.language = (mxClient.IS_IE) ? navigator.userLanguage : navigator.language; } if (typeof(mxDefaultLanguage) != 'undefined' && mxDefaultLanguage != null) { mxClient.defaultLanguage = mxDefaultLanguage; } else { mxClient.defaultLanguage = 'en'; } if (mxLoadStylesheets) { mxClient.link('stylesheet', mxClient.basePath + '/css/common.css'); } if (typeof(mxLanguages) != 'undefined' && mxLanguages != null) { mxClient.languages = mxLanguages; } if (mxClient.IS_VML) { if (mxClient.IS_SVG) { mxClient.IS_VML = false; } else { if (document.namespaces != null) { if (document.documentMode == 8) { document.namespaces.add(mxClient.VML_PREFIX, 'urn:schemas-microsoft-com:vml', '#default#VML'); document.namespaces.add(mxClient.OFFICE_PREFIX, 'urn:schemas-microsoft-com:office:office', '#default#VML'); } else { document.namespaces.add(mxClient.VML_PREFIX, 'urn:schemas-microsoft-com:vml'); document.namespaces.add(mxClient.OFFICE_PREFIX, 'urn:schemas-microsoft-com:office:office'); } } if (mxClient.IS_QUIRKS && document.styleSheets.length >= 30) { (function() { var node = document.createElement('style'); node.type = 'text/css'; node.styleSheet.cssText = mxClient.VML_PREFIX + '\\:*{behavior:url(#default#VML)}' + mxClient.OFFICE_PREFIX + '\\:*{behavior:url(#default#VML)}'; document.getElementsByTagName('head')[0].appendChild(node); })(); } else { document.createStyleSheet().cssText = mxClient.VML_PREFIX + '\\:*{behavior:url(#default#VML)}' + mxClient.OFFICE_PREFIX + '\\:*{behavior:url(#default#VML)}'; } if (mxLoadStylesheets) { mxClient.link('stylesheet', mxClient.basePath + '/css/explorer.css'); } } } if (mxForceIncludes || !(module.exports != null)) { mxClient.include(mxClient.basePath+'/js/util/mxLog.js'); mxClient.include(mxClient.basePath+'/js/util/mxObjectIdentity.js'); mxClient.include(mxClient.basePath+'/js/util/mxDictionary.js'); mxClient.include(mxClient.basePath+'/js/util/mxResources.js'); mxClient.include(mxClient.basePath+'/js/util/mxPoint.js'); mxClient.include(mxClient.basePath+'/js/util/mxRectangle.js'); mxClient.include(mxClient.basePath+'/js/util/mxEffects.js'); mxClient.include(mxClient.basePath+'/js/util/mxUtils.js'); mxClient.include(mxClient.basePath+'/js/util/mxConstants.js'); mxClient.include(mxClient.basePath+'/js/util/mxEventObject.js'); mxClient.include(mxClient.basePath+'/js/util/mxMouseEvent.js'); mxClient.include(mxClient.basePath+'/js/util/mxEventSource.js'); mxClient.include(mxClient.basePath+'/js/util/mxEvent.js'); mxClient.include(mxClient.basePath+'/js/util/mxXmlRequest.js'); mxClient.include(mxClient.basePath+'/js/util/mxClipboard.js'); mxClient.include(mxClient.basePath+'/js/util/mxWindow.js'); mxClient.include(mxClient.basePath+'/js/util/mxForm.js'); mxClient.include(mxClient.basePath+'/js/util/mxImage.js'); mxClient.include(mxClient.basePath+'/js/util/mxDivResizer.js'); mxClient.include(mxClient.basePath+'/js/util/mxDragSource.js'); mxClient.include(mxClient.basePath+'/js/util/mxToolbar.js'); mxClient.include(mxClient.basePath+'/js/util/mxUndoableEdit.js'); mxClient.include(mxClient.basePath+'/js/util/mxUndoManager.js'); mxClient.include(mxClient.basePath+'/js/util/mxUrlConverter.js'); mxClient.include(mxClient.basePath+'/js/util/mxPanningManager.js'); mxClient.include(mxClient.basePath+'/js/util/mxPopupMenu.js'); mxClient.include(mxClient.basePath+'/js/util/mxAutoSaveManager.js'); mxClient.include(mxClient.basePath+'/js/util/mxAnimation.js'); mxClient.include(mxClient.basePath+'/js/util/mxMorphing.js'); mxClient.include(mxClient.basePath+'/js/util/mxImageBundle.js'); mxClient.include(mxClient.basePath+'/js/util/mxImageExport.js'); mxClient.include(mxClient.basePath+'/js/util/mxAbstractCanvas2D.js'); mxClient.include(mxClient.basePath+'/js/util/mxXmlCanvas2D.js'); mxClient.include(mxClient.basePath+'/js/util/mxSvgCanvas2D.js'); mxClient.include(mxClient.basePath+'/js/util/mxVmlCanvas2D.js'); mxClient.include(mxClient.basePath+'/js/util/mxGuide.js'); mxClient.include(mxClient.basePath+'/js/shape/mxShape.js'); mxClient.include(mxClient.basePath+'/js/shape/mxStencil.js'); mxClient.include(mxClient.basePath+'/js/shape/mxStencilRegistry.js'); mxClient.include(mxClient.basePath+'/js/shape/mxMarker.js'); mxClient.include(mxClient.basePath+'/js/shape/mxActor.js'); mxClient.include(mxClient.basePath+'/js/shape/mxCloud.js'); mxClient.include(mxClient.basePath+'/js/shape/mxRectangleShape.js'); mxClient.include(mxClient.basePath+'/js/shape/mxEllipse.js'); mxClient.include(mxClient.basePath+'/js/shape/mxDoubleEllipse.js'); mxClient.include(mxClient.basePath+'/js/shape/mxRhombus.js'); mxClient.include(mxClient.basePath+'/js/shape/mxPolyline.js'); mxClient.include(mxClient.basePath+'/js/shape/mxArrow.js'); mxClient.include(mxClient.basePath+'/js/shape/mxArrowConnector.js'); mxClient.include(mxClient.basePath+'/js/shape/mxText.js'); mxClient.include(mxClient.basePath+'/js/shape/mxTriangle.js'); mxClient.include(mxClient.basePath+'/js/shape/mxHexagon.js'); mxClient.include(mxClient.basePath+'/js/shape/mxLine.js'); mxClient.include(mxClient.basePath+'/js/shape/mxImageShape.js'); mxClient.include(mxClient.basePath+'/js/shape/mxLabel.js'); mxClient.include(mxClient.basePath+'/js/shape/mxCylinder.js'); mxClient.include(mxClient.basePath+'/js/shape/mxConnector.js'); mxClient.include(mxClient.basePath+'/js/shape/mxSwimlane.js'); mxClient.include(mxClient.basePath+'/js/layout/mxGraphLayout.js'); mxClient.include(mxClient.basePath+'/js/layout/mxStackLayout.js'); mxClient.include(mxClient.basePath+'/js/layout/mxPartitionLayout.js'); mxClient.include(mxClient.basePath+'/js/layout/mxCompactTreeLayout.js'); mxClient.include(mxClient.basePath+'/js/layout/mxRadialTreeLayout.js'); mxClient.include(mxClient.basePath+'/js/layout/mxFastOrganicLayout.js'); mxClient.include(mxClient.basePath+'/js/layout/mxCircleLayout.js'); mxClient.include(mxClient.basePath+'/js/layout/mxParallelEdgeLayout.js'); mxClient.include(mxClient.basePath+'/js/layout/mxCompositeLayout.js'); mxClient.include(mxClient.basePath+'/js/layout/mxEdgeLabelLayout.js'); mxClient.include(mxClient.basePath+'/js/layout/hierarchical/model/mxGraphAbstractHierarchyCell.js'); mxClient.include(mxClient.basePath+'/js/layout/hierarchical/model/mxGraphHierarchyNode.js'); mxClient.include(mxClient.basePath+'/js/layout/hierarchical/model/mxGraphHierarchyEdge.js'); mxClient.include(mxClient.basePath+'/js/layout/hierarchical/model/mxGraphHierarchyModel.js'); mxClient.include(mxClient.basePath+'/js/layout/hierarchical/model/mxSwimlaneModel.js'); mxClient.include(mxClient.basePath+'/js/layout/hierarchical/stage/mxHierarchicalLayoutStage.js'); mxClient.include(mxClient.basePath+'/js/layout/hierarchical/stage/mxMedianHybridCrossingReduction.js'); mxClient.include(mxClient.basePath+'/js/layout/hierarchical/stage/mxMinimumCycleRemover.js'); mxClient.include(mxClient.basePath+'/js/layout/hierarchical/stage/mxCoordinateAssignment.js'); mxClient.include(mxClient.basePath+'/js/layout/hierarchical/stage/mxSwimlaneOrdering.js'); mxClient.include(mxClient.basePath+'/js/layout/hierarchical/mxHierarchicalLayout.js'); mxClient.include(mxClient.basePath+'/js/layout/hierarchical/mxSwimlaneLayout.js'); mxClient.include(mxClient.basePath+'/js/model/mxGraphModel.js'); mxClient.include(mxClient.basePath+'/js/model/mxCell.js'); mxClient.include(mxClient.basePath+'/js/model/mxGeometry.js'); mxClient.include(mxClient.basePath+'/js/model/mxCellPath.js'); mxClient.include(mxClient.basePath+'/js/view/mxPerimeter.js'); mxClient.include(mxClient.basePath+'/js/view/mxPrintPreview.js'); mxClient.include(mxClient.basePath+'/js/view/mxStylesheet.js'); mxClient.include(mxClient.basePath+'/js/view/mxCellState.js'); mxClient.include(mxClient.basePath+'/js/view/mxGraphSelectionModel.js'); mxClient.include(mxClient.basePath+'/js/view/mxCellEditor.js'); mxClient.include(mxClient.basePath+'/js/view/mxCellRenderer.js'); mxClient.include(mxClient.basePath+'/js/view/mxEdgeStyle.js'); mxClient.include(mxClient.basePath+'/js/view/mxStyleRegistry.js'); mxClient.include(mxClient.basePath+'/js/view/mxGraphView.js'); mxClient.include(mxClient.basePath+'/js/view/mxGraph.js'); mxClient.include(mxClient.basePath+'/js/view/mxCellOverlay.js'); mxClient.include(mxClient.basePath+'/js/view/mxOutline.js'); mxClient.include(mxClient.basePath+'/js/view/mxMultiplicity.js'); mxClient.include(mxClient.basePath+'/js/view/mxLayoutManager.js'); mxClient.include(mxClient.basePath+'/js/view/mxSwimlaneManager.js'); mxClient.include(mxClient.basePath+'/js/view/mxTemporaryCellStates.js'); mxClient.include(mxClient.basePath+'/js/view/mxCellStatePreview.js'); mxClient.include(mxClient.basePath+'/js/view/mxConnectionConstraint.js'); mxClient.include(mxClient.basePath+'/js/handler/mxGraphHandler.js'); mxClient.include(mxClient.basePath+'/js/handler/mxPanningHandler.js'); mxClient.include(mxClient.basePath+'/js/handler/mxPopupMenuHandler.js'); mxClient.include(mxClient.basePath+'/js/handler/mxCellMarker.js'); mxClient.include(mxClient.basePath+'/js/handler/mxSelectionCellsHandler.js'); mxClient.include(mxClient.basePath+'/js/handler/mxConnectionHandler.js'); mxClient.include(mxClient.basePath+'/js/handler/mxConstraintHandler.js'); mxClient.include(mxClient.basePath+'/js/handler/mxRubberband.js'); mxClient.include(mxClient.basePath+'/js/handler/mxHandle.js'); mxClient.include(mxClient.basePath+'/js/handler/mxVertexHandler.js'); mxClient.include(mxClient.basePath+'/js/handler/mxEdgeHandler.js'); mxClient.include(mxClient.basePath+'/js/handler/mxElbowEdgeHandler.js'); mxClient.include(mxClient.basePath+'/js/handler/mxEdgeSegmentHandler.js'); mxClient.include(mxClient.basePath+'/js/handler/mxKeyHandler.js'); mxClient.include(mxClient.basePath+'/js/handler/mxTooltipHandler.js'); mxClient.include(mxClient.basePath+'/js/handler/mxCellTracker.js'); mxClient.include(mxClient.basePath+'/js/handler/mxCellHighlight.js'); mxClient.include(mxClient.basePath+'/js/editor/mxDefaultKeyHandler.js'); mxClient.include(mxClient.basePath+'/js/editor/mxDefaultPopupMenu.js'); mxClient.include(mxClient.basePath+'/js/editor/mxDefaultToolbar.js'); mxClient.include(mxClient.basePath+'/js/editor/mxEditor.js'); mxClient.include(mxClient.basePath+'/js/io/mxCodecRegistry.js'); mxClient.include(mxClient.basePath+'/js/io/mxCodec.js'); mxClient.include(mxClient.basePath+'/js/io/mxObjectCodec.js'); mxClient.include(mxClient.basePath+'/js/io/mxCellCodec.js'); mxClient.include(mxClient.basePath+'/js/io/mxModelCodec.js'); mxClient.include(mxClient.basePath+'/js/io/mxRootChangeCodec.js'); mxClient.include(mxClient.basePath+'/js/io/mxChildChangeCodec.js'); mxClient.include(mxClient.basePath+'/js/io/mxTerminalChangeCodec.js'); mxClient.include(mxClient.basePath+'/js/io/mxGenericChangeCodec.js'); mxClient.include(mxClient.basePath+'/js/io/mxGraphCodec.js'); mxClient.include(mxClient.basePath+'/js/io/mxGraphViewCodec.js'); mxClient.include(mxClient.basePath+'/js/io/mxStylesheetCodec.js'); mxClient.include(mxClient.basePath+'/js/io/mxDefaultKeyHandlerCodec.js'); mxClient.include(mxClient.basePath+'/js/io/mxDefaultToolbarCodec.js'); mxClient.include(mxClient.basePath+'/js/io/mxDefaultPopupMenuCodec.js'); mxClient.include(mxClient.basePath+'/js/io/mxEditorCodec.js'); } __mxOutput.mxClient = typeof mxClient !== 'undefined' ? mxClient : undefined; var mxLog = { consoleName: 'Console', TRACE: false, DEBUG: true, WARN: true, buffer: '', init: function() { if (mxLog.window == null && document.body != null) { var title = mxLog.consoleName + ' - mxGraph ' + mxClient.VERSION; var table = document.createElement('table'); table.setAttribute('width', '100%'); table.setAttribute('height', '100%'); var tbody = document.createElement('tbody'); var tr = document.createElement('tr'); var td = document.createElement('td'); td.style.verticalAlign = 'top'; mxLog.textarea = document.createElement('textarea'); mxLog.textarea.setAttribute('wrap', 'off'); mxLog.textarea.setAttribute('readOnly', 'true'); mxLog.textarea.style.height = '100%'; mxLog.textarea.style.resize = 'none'; mxLog.textarea.value = mxLog.buffer; if (mxClient.IS_NS && document.compatMode != 'BackCompat') { mxLog.textarea.style.width = '99%'; } else { mxLog.textarea.style.width = '100%'; } td.appendChild(mxLog.textarea); tr.appendChild(td); tbody.appendChild(tr); tr = document.createElement('tr'); mxLog.td = document.createElement('td'); mxLog.td.style.verticalAlign = 'top'; mxLog.td.setAttribute('height', '30px'); tr.appendChild(mxLog.td); tbody.appendChild(tr); table.appendChild(tbody); mxLog.addButton('Info', function (evt) { mxLog.info(); }); mxLog.addButton('DOM', function (evt) { var content = mxUtils.getInnerHtml(document.body); mxLog.debug(content); }); mxLog.addButton('Trace', function (evt) { mxLog.TRACE = !mxLog.TRACE; if (mxLog.TRACE) { mxLog.debug('Tracing enabled'); } else { mxLog.debug('Tracing disabled'); } }); mxLog.addButton('Copy', function (evt) { try { mxUtils.copy(mxLog.textarea.value); } catch (err) { mxUtils.alert(err); } }); mxLog.addButton('Show', function (evt) { try { mxUtils.popup(mxLog.textarea.value); } catch (err) { mxUtils.alert(err); } }); mxLog.addButton('Clear', function (evt) { mxLog.textarea.value = ''; }); var h = 0; var w = 0; if (typeof(window.innerWidth) === 'number') { h = window.innerHeight; w = window.innerWidth; } else { h = (document.documentElement.clientHeight || document.body.clientHeight); w = document.body.clientWidth; } mxLog.window = new mxWindow(title, table, Math.max(0, w - 320), Math.max(0, h - 210), 300, 160); mxLog.window.setMaximizable(true); mxLog.window.setScrollable(false); mxLog.window.setResizable(true); mxLog.window.setClosable(true); mxLog.window.destroyOnClose = false; if (((mxClient.IS_NS || mxClient.IS_IE) && !mxClient.IS_GC && !mxClient.IS_SF && document.compatMode != 'BackCompat') || document.documentMode == 11) { var elt = mxLog.window.getElement(); var resizeHandler = function(sender, evt) { mxLog.textarea.style.height = Math.max(0, elt.offsetHeight - 70) + 'px'; }; mxLog.window.addListener(mxEvent.RESIZE_END, resizeHandler); mxLog.window.addListener(mxEvent.MAXIMIZE, resizeHandler); mxLog.window.addListener(mxEvent.NORMALIZE, resizeHandler); mxLog.textarea.style.height = '92px'; } } }, info: function() { mxLog.writeln(mxUtils.toString(navigator)); }, addButton: function(lab, funct) { var button = document.createElement('button'); mxUtils.write(button, lab); mxEvent.addListener(button, 'click', funct); mxLog.td.appendChild(button); }, isVisible: function() { if (mxLog.window != null) { return mxLog.window.isVisible(); } return false; }, show: function() { mxLog.setVisible(true); }, setVisible: function(visible) { if (mxLog.window == null) { mxLog.init(); } if (mxLog.window != null) { mxLog.window.setVisible(visible); } }, enter: function(string) { if (mxLog.TRACE) { mxLog.writeln('Entering '+string); return new Date().getTime(); } }, leave: function(string, t0) { if (mxLog.TRACE) { var dt = (t0 != 0) ? ' ('+(new Date().getTime() - t0)+' ms)' : ''; mxLog.writeln('Leaving '+string+dt); } }, debug: function() { if (mxLog.DEBUG) { mxLog.writeln.apply(this, arguments); } }, warn: function() { if (mxLog.WARN) { mxLog.writeln.apply(this, arguments); } }, write: function() { var string = ''; for (var i = 0; i < arguments.length; i++) { string += arguments[i]; if (i < arguments.length - 1) { string += ' '; } } if (mxLog.textarea != null) { mxLog.textarea.value = mxLog.textarea.value + string; if (navigator.userAgent != null && navigator.userAgent.indexOf('Presto/2.5') >= 0) { mxLog.textarea.style.visibility = 'hidden'; mxLog.textarea.style.visibility = 'visible'; } mxLog.textarea.scrollTop = mxLog.textarea.scrollHeight; } else { mxLog.buffer += string; } }, writeln: function() { var string = ''; for (var i = 0; i < arguments.length; i++) { string += arguments[i]; if (i < arguments.length - 1) { string += ' '; } } mxLog.write(string + '\n'); } }; __mxOutput.mxLog = typeof mxLog !== 'undefined' ? mxLog : undefined; var mxObjectIdentity = { FIELD_NAME: 'mxObjectId', counter: 0, get: function(obj) { if (obj != null) { if (obj[mxObjectIdentity.FIELD_NAME] == null) { if (typeof obj === 'object') { var ctor = mxUtils.getFunctionName(obj.constructor); obj[mxObjectIdentity.FIELD_NAME] = ctor + '#' + mxObjectIdentity.counter++; } else if (typeof obj === 'function') { obj[mxObjectIdentity.FIELD_NAME] = 'Function#' + mxObjectIdentity.counter++; } } return obj[mxObjectIdentity.FIELD_NAME]; } return null; }, clear: function(obj) { if (typeof(obj) === 'object' || typeof obj === 'function') { delete obj[mxObjectIdentity.FIELD_NAME]; } } }; __mxOutput.mxObjectIdentity = typeof mxObjectIdentity !== 'undefined' ? mxObjectIdentity : undefined; function mxDictionary() { this.clear(); } mxDictionary.prototype.map = null; mxDictionary.prototype.clear = function() { this.map = {}; }; mxDictionary.prototype.get = function(key) { var id = mxObjectIdentity.get(key); return this.map[id]; }; mxDictionary.prototype.put = function(key, value) { var id = mxObjectIdentity.get(key); var previous = this.map[id]; this.map[id] = value; return previous; }; mxDictionary.prototype.remove = function(key) { var id = mxObjectIdentity.get(key); var previous = this.map[id]; delete this.map[id]; return previous; }; mxDictionary.prototype.getKeys = function() { var result = []; for (var key in this.map) { result.push(key); } return result; }; mxDictionary.prototype.getValues = function() { var result = []; for (var key in this.map) { result.push(this.map[key]); } return result; }; mxDictionary.prototype.visit = function(visitor) { for (var key in this.map) { visitor(key, this.map[key]); } }; __mxOutput.mxDictionary = typeof mxDictionary !== 'undefined' ? mxDictionary : undefined; var mxResources = { resources: {}, extension: mxResourceExtension, resourcesEncoded: false, loadDefaultBundle: true, loadSpecialBundle: true, isLanguageSupported: function(lan) { if (mxClient.languages != null) { return mxUtils.indexOf(mxClient.languages, lan) >= 0; } return true; }, getDefaultBundle: function(basename, lan) { if (mxResources.loadDefaultBundle || !mxResources.isLanguageSupported(lan)) { return basename + mxResources.extension; } else { return null; } }, getSpecialBundle: function(basename, lan) { if (mxClient.languages == null || !this.isLanguageSupported(lan)) { var dash = lan.indexOf('-'); if (dash > 0) { lan = lan.substring(0, dash); } } if (mxResources.loadSpecialBundle && mxResources.isLanguageSupported(lan) && lan != mxClient.defaultLanguage) { return basename + '_' + lan + mxResources.extension; } else { return null; } }, add: function(basename, lan, callback) { lan = (lan != null) ? lan : ((mxClient.language != null) ? mxClient.language.toLowerCase() : mxConstants.NONE); if (lan != mxConstants.NONE) { var defaultBundle = mxResources.getDefaultBundle(basename, lan); var specialBundle = mxResources.getSpecialBundle(basename, lan); var loadSpecialBundle = function() { if (specialBundle != null) { if (callback) { mxUtils.get(specialBundle, function(req) { mxResources.parse(req.getText()); callback(); }, function() { callback(); }); } else { try { var req = mxUtils.load(specialBundle); if (req.isReady()) { mxResources.parse(req.getText()); } } catch (e) { } } } else if (callback != null) { callback(); } }; if (defaultBundle != null) { if (callback) { mxUtils.get(defaultBundle, function(req) { mxResources.parse(req.getText()); loadSpecialBundle(); }, function() { loadSpecialBundle(); }); } else { try { var req = mxUtils.load(defaultBundle); if (req.isReady()) { mxResources.parse(req.getText()); } loadSpecialBundle(); } catch (e) { } } } else { loadSpecialBundle(); } } }, parse: function(text) { if (text != null) { var lines = text.split('\n'); for (var i = 0; i < lines.length; i++) { if (lines[i].charAt(0) != '#') { var index = lines[i].indexOf('='); if (index > 0) { var key = lines[i].substring(0, index); var idx = lines[i].length; if (lines[i].charCodeAt(idx - 1) == 13) { idx--; } var value = lines[i].substring(index + 1, idx); if (this.resourcesEncoded) { value = value.replace(/\\(?=u[a-fA-F\d]{4})/g,"%"); mxResources.resources[key] = unescape(value); } else { mxResources.resources[key] = value; } } } } } }, get: function(key, params, defaultValue) { var value = mxResources.resources[key]; if (value == null) { value = defaultValue; } if (value != null && params != null) { value = mxResources.replacePlaceholders(value, params); } return value; }, replacePlaceholders: function(value, params) { var result = []; var index = null; for (var i = 0; i < value.length; i++) { var c = value.charAt(i); if (c == '{') { index = ''; } else if (index != null && c == '}') { index = parseInt(index)-1; if (index >= 0 && index < params.length) { result.push(params[index]); } index = null; } else if (index != null) { index += c; } else { result.push(c); } } return result.join(''); }, loadResources: function(callback) { mxResources.add(mxClient.basePath+'/resources/editor', null, function() { mxResources.add(mxClient.basePath+'/resources/graph', null, callback); }); } }; __mxOutput.mxResources = typeof mxResources !== 'undefined' ? mxResources : undefined; function mxPoint(x, y) { this.x = (x != null) ? x : 0; this.y = (y != null) ? y : 0; } mxPoint.prototype.x = null; mxPoint.prototype.y = null; mxPoint.prototype.equals = function(obj) { return obj != null && obj.x == this.x && obj.y == this.y; }; mxPoint.prototype.clone = function() { return mxUtils.clone(this); }; __mxOutput.mxPoint = typeof mxPoint !== 'undefined' ? mxPoint : undefined; function mxRectangle(x, y, width, height) { mxPoint.call(this, x, y); this.width = (width != null) ? width : 0; this.height = (height != null) ? height : 0; } mxRectangle.prototype = new mxPoint(); mxRectangle.prototype.constructor = mxRectangle; mxRectangle.prototype.width = null; mxRectangle.prototype.height = null; mxRectangle.prototype.setRect = function(x, y, w, h) { this.x = x; this.y = y; this.width = w; this.height = h; }; mxRectangle.prototype.getCenterX = function () { return this.x + this.width/2; }; mxRectangle.prototype.getCenterY = function () { return this.y + this.height/2; }; mxRectangle.prototype.add = function(rect) { if (rect != null) { var minX = Math.min(this.x, rect.x); var minY = Math.min(this.y, rect.y); var maxX = Math.max(this.x + this.width, rect.x + rect.width); var maxY = Math.max(this.y + this.height, rect.y + rect.height); this.x = minX; this.y = minY; this.width = maxX - minX; this.height = maxY - minY; } }; mxRectangle.prototype.intersect = function(rect) { if (rect != null) { var r1 = this.x + this.width; var r2 = rect.x + rect.width; var b1 = this.y + this.height; var b2 = rect.y + rect.height; this.x = Math.max(this.x, rect.x); this.y = Math.max(this.y, rect.y); this.width = Math.min(r1, r2) - this.x; this.height = Math.min(b1, b2) - this.y; } }; mxRectangle.prototype.grow = function(amount) { this.x -= amount; this.y -= amount; this.width += 2 * amount; this.height += 2 * amount; return this; }; mxRectangle.prototype.getPoint = function() { return new mxPoint(this.x, this.y); }; mxRectangle.prototype.rotate90 = function() { var t = (this.width - this.height) / 2; this.x += t; this.y -= t; var tmp = this.width; this.width = this.height; this.height = tmp; }; mxRectangle.prototype.equals = function(obj) { return obj != null && obj.x == this.x && obj.y == this.y && obj.width == this.width && obj.height == this.height; }; mxRectangle.fromRectangle = function(rect) { return new mxRectangle(rect.x, rect.y, rect.width, rect.height); }; __mxOutput.mxRectangle = typeof mxRectangle !== 'undefined' ? mxRectangle : undefined; var mxEffects = { animateChanges: function(graph, changes, done) { var maxStep = 10; var step = 0; var animate = function() { var isRequired = false; for (var i = 0; i < changes.length; i++) { var change = changes[i]; if (change instanceof mxGeometryChange || change instanceof mxTerminalChange || change instanceof mxValueChange || change instanceof mxChildChange || change instanceof mxStyleChange) { var state = graph.getView().getState(change.cell || change.child, false); if (state != null) { isRequired = true; if (change.constructor != mxGeometryChange || graph.model.isEdge(change.cell)) { mxUtils.setOpacity(state.shape.node, 100 * step / maxStep); } else { var scale = graph.getView().scale; var dx = (change.geometry.x - change.previous.x) * scale; var dy = (change.geometry.y - change.previous.y) * scale; var sx = (change.geometry.width - change.previous.width) * scale; var sy = (change.geometry.height - change.previous.height) * scale; if (step == 0) { state.x -=