UNPKG

bpmn-visualization

Version:

A TypeScript library for visualizing process execution data on BPMN diagrams

1,262 lines (1,191 loc) 2.92 MB
var bpmnvisu = (function (exports) { 'use strict'; /** * Copyright 2020 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. */ /** * @category Navigation */ exports.FitType = void 0; (function (FitType) { /** No fit, use dimensions and coordinates from the BPMN diagram. */ FitType["None"] = "None"; /** Fit the whole html container available to render the BPMN diagram. */ FitType["HorizontalVertical"] = "HorizontalVertical"; /** Fit only horizontally. */ FitType["Horizontal"] = "Horizontal"; /** Fit only vertically. */ FitType["Vertical"] = "Vertical"; /** Fit and center the BPMN Diagram. */ FitType["Center"] = "Center"; })(exports.FitType || (exports.FitType = {})); /** * @category Navigation * @since 0.24.0 */ exports.ZoomType = void 0; (function (ZoomType) { ZoomType["In"] = "in"; ZoomType["Out"] = "out"; })(exports.ZoomType || (exports.ZoomType = {})); /** * Copyright 2021 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. */ /** * The real name of the field in the BPMN XSD. * @category BPMN */ exports.ShapeBpmnElementKind = void 0; (function (ShapeBpmnElementKind) { ShapeBpmnElementKind["LANE"] = "lane"; ShapeBpmnElementKind["POOL"] = "pool"; ShapeBpmnElementKind["CALL_ACTIVITY"] = "callActivity"; ShapeBpmnElementKind["SUB_PROCESS"] = "subProcess"; // When adding support, uncomment related content in tests // test/unit/component/mxgraph/renderer/StyleComputer.test.ts // test/unit/component/parser/json/BpmnJsonParser.marker.test.ts (adhoc requires special checks as an additional marker should be present) // Generalize test/unit/component/parser/json/BpmnJsonParser.sub.process.test.ts // See also, ShapeBpmnSubProcessKind // SUB_PROCESS_AD_HOC = 'adHocSubProcess', // SUB_PROCESS_TRANSACTION = 'transaction', 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"; // When adding support for GATEWAY_COMPLEX, uncomment corresponding test in the following files // test/unit/component/parser/json/BpmnJsonParser.sequenceFlow.default.test.ts // test/unit/component/parser/json/BpmnJsonParser.sequenceFlow.conditional.test.ts // test/unit/component/parser/json/BpmnJsonParser.flowNode.test.ts // test/unit/component/parser/json/BpmnJsonParser.label.bounds.test.ts // test/unit/component/parser/json/BpmnJsonParser.label.font.test.ts // test/unit/component/parser/json/BpmnJsonParser.label.test.ts // Uncomment corresponding line in src/model/bpmn/shape/utils.ts FLOW_NODE_WITH_DEFAULT_SEQUENCE_FLOW_KINDS // 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 = {})); /** * @category BPMN */ exports.ShapeBpmnCallActivityKind = void 0; (function (ShapeBpmnCallActivityKind) { ShapeBpmnCallActivityKind["CALLING_PROCESS"] = "process"; ShapeBpmnCallActivityKind["CALLING_GLOBAL_TASK"] = "global task"; })(exports.ShapeBpmnCallActivityKind || (exports.ShapeBpmnCallActivityKind = {})); /** * Values available for the `eventGatewayType` property in the BPMN specification. * @category BPMN */ exports.ShapeBpmnEventBasedGatewayKind = void 0; (function (ShapeBpmnEventBasedGatewayKind) { ShapeBpmnEventBasedGatewayKind["Exclusive"] = "Exclusive"; /** When no type is provided in the BPMN source. */ ShapeBpmnEventBasedGatewayKind["None"] = "None"; ShapeBpmnEventBasedGatewayKind["Parallel"] = "Parallel"; })(exports.ShapeBpmnEventBasedGatewayKind || (exports.ShapeBpmnEventBasedGatewayKind = {})); /** * Base name of the EventDefinition fields in the BPMN XSD for event kinds. In the xsd, the value is <enum_value>EventDefinition. * * For instance, TERMINATE --> terminateEventDefinition * @category BPMN */ 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 = {})); /** * @category BPMN */ exports.ShapeBpmnMarkerKind = void 0; (function (ShapeBpmnMarkerKind) { ShapeBpmnMarkerKind["ADHOC"] = "adhoc"; ShapeBpmnMarkerKind["COMPENSATION"] = "compensation"; ShapeBpmnMarkerKind["EXPAND"] = "expand"; ShapeBpmnMarkerKind["LOOP"] = "loop"; ShapeBpmnMarkerKind["MULTI_INSTANCE_PARALLEL"] = "parallel multi instance"; ShapeBpmnMarkerKind["MULTI_INSTANCE_SEQUENTIAL"] = "sequential multi instance"; })(exports.ShapeBpmnMarkerKind || (exports.ShapeBpmnMarkerKind = {})); /** * Base name of the BPMN specification for sub-process kinds. * @category BPMN */ exports.ShapeBpmnSubProcessKind = void 0; (function (ShapeBpmnSubProcessKind) { ShapeBpmnSubProcessKind["EMBEDDED"] = "embedded"; ShapeBpmnSubProcessKind["EVENT"] = "event"; // The following may be only needed for rendering, as we have special types for adHoc and transaction subprocess in ShapeBpmnElementKind // TRANSACTION = 'transaction', // AD_HOC = 'ad_hoc', })(exports.ShapeBpmnSubProcessKind || (exports.ShapeBpmnSubProcessKind = {})); /** * Copyright 2021 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. */ function convertEmptyStringAndObject(element, acceptEmptyString) { if (element === '') { return acceptEmptyString ? {} : undefined; } return element; } /** * @internal */ function ensureIsArray(elements, acceptEmptyString = false) { if (elements === undefined || elements === null) { return []; } return ((!Array.isArray(elements) ? [elements] : elements) // convert empty elements .map(element => convertEmptyStringAndObject(element, acceptEmptyString)) // remove empty elements .filter(Boolean)); } /** * @internal */ function filter(arrayToFilter, suffix, options) { let pattern = ''; if (options === null || options === void 0 ? void 0 : options.startingWith) { pattern = pattern.concat(`^(${options.startingWith}).*`); } else if (options === null || options === void 0 ? void 0 : options.notStartingWith) { pattern = pattern.concat(`^(?!(${options.notStartingWith})).*`); } pattern = pattern.concat(`${suffix}$`); return arrayToFilter.filter(element => ((options === null || options === void 0 ? void 0 : options.ignoreCase) ? new RegExp(pattern, 'i').test(element) : new RegExp(pattern).test(element))); } /** * Copyright 2020 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. */ /** * Utils to simplify the management of {@link ShapeBpmnElementKind}. * * This class is mainly used for internal purpose. You may use it to customize the BPMN theme as proposed in the examples but be aware it is subject to change. * * @category BPMN * @experimental */ 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 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.includes(kind); } /** * Returns `true` if `kind` is related to a task, for instance {@link ShapeBpmnElementKind.TASK}, {@link ShapeBpmnElementKind.TASK_SERVICE}, but not a {@link ShapeBpmnElementKind.GLOBAL_TASK}. */ static isTask(kind) { return isKindOf(TASK_KINDS, kind); } /** * Returns all kinds related to a task, for instance {@link ShapeBpmnElementKind.TASK}, {@link ShapeBpmnElementKind.TASK_SEND}, but not a {@link ShapeBpmnElementKind.GLOBAL_TASK}. */ 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 = [ ...ACTIVITY_KINDS, exports.ShapeBpmnElementKind.GATEWAY_EXCLUSIVE, exports.ShapeBpmnElementKind.GATEWAY_INCLUSIVE, // Uncomment when supported // ShapeBpmnElementKind.GATEWAY_COMPLEX, ]; /** * Elements that are effectively used in BPMN diagram as base for eventDefinition i.e all {@link ShapeBpmnEventDefinitionKind} elements except {@link ShapeBpmnEventDefinitionKind.NONE} * @internal */ const eventDefinitionKinds = Object.values(exports.ShapeBpmnEventDefinitionKind).filter(kind => kind != exports.ShapeBpmnEventDefinitionKind.NONE); /** * Copyright 2021 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. */ /** * Enum values are using the real name of the field in the BPMN XSD. * @category BPMN */ exports.AssociationDirectionKind = void 0; (function (AssociationDirectionKind) { AssociationDirectionKind["NONE"] = "None"; AssociationDirectionKind["ONE"] = "One"; AssociationDirectionKind["BOTH"] = "Both"; })(exports.AssociationDirectionKind || (exports.AssociationDirectionKind = {})); /** * Enum values are using the real name of the field in the BPMN XSD. * @category BPMN */ exports.FlowKind = void 0; (function (FlowKind) { FlowKind["SEQUENCE_FLOW"] = "sequenceFlow"; FlowKind["MESSAGE_FLOW"] = "messageFlow"; FlowKind["ASSOCIATION_FLOW"] = "association"; })(exports.FlowKind || (exports.FlowKind = {})); /** * Enum values are using the real name of the `visible message` field in the BPMN XSD, except for `none` that is not present in the specification. * @category BPMN */ exports.MessageVisibleKind = void 0; (function (MessageVisibleKind) { MessageVisibleKind["NONE"] = "none"; MessageVisibleKind["INITIATING"] = "initiating"; MessageVisibleKind["NON_INITIATING"] = "non_initiating"; })(exports.MessageVisibleKind || (exports.MessageVisibleKind = {})); /** * Enum values are used internally to identify sequence the flow markers and to manage their related style. * @category BPMN */ 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 = {})); var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; var build = {exports: {}}; (function (module) { (function (root, factory) { if (module.exports) { module.exports = factory(); } else { root.mxgraph = factory(); } }(commonjsGlobal, function () { return function (opts) { for (var name in opts) { this[name] = opts[name]; } var __mxOutput = {}; /** * Copyright (c) 2006-2017, JGraph Ltd * Copyright (c) 2006-2017, Gaudenz Alder */ var mxClient = { /** * Class: mxClient * * Bootstrapping mechanism for the mxGraph thin client. The production version * of this file contains all code required to run the mxGraph thin client, as * well as global constants to identify the browser and operating system in * use. You may have to load chrome://global/content/contentAreaUtils.js in * your page to disable certain security restrictions in Mozilla. * * Variable: VERSION * * Contains the current version of the mxGraph library. The strings that * communicate versions of mxGraph use the following format. * * versionMajor.versionMinor.buildNumber.revisionNumber * * Current version is 4.2.2. */ VERSION: '4.2.2', /** * Variable: IS_IE * * True if the current browser is Internet Explorer 10 or below. Use <mxClient.IS_IE11> * to detect IE 11. */ IS_IE: navigator.userAgent != null && navigator.userAgent.indexOf('MSIE') >= 0, /** * Variable: IS_IE6 * * True if the current browser is Internet Explorer 6.x. */ IS_IE6: navigator.userAgent != null && navigator.userAgent.indexOf('MSIE 6') >= 0, /** * Variable: IS_IE11 * * True if the current browser is Internet Explorer 11.x. */ IS_IE11: navigator.userAgent != null && !!navigator.userAgent.match(/Trident\/7\./), /** * Variable: IS_EDGE * * True if the current browser is Microsoft Edge. */ IS_EDGE: navigator.userAgent != null && !!navigator.userAgent.match(/Edge\//), /** * Variable: IS_QUIRKS * * True if the current browser is Internet Explorer and it is in quirks mode. */ IS_QUIRKS: navigator.userAgent != null && navigator.userAgent.indexOf('MSIE') >= 0 && (document.documentMode == null || document.documentMode == 5), /** * Variable: IS_EM * * True if the browser is IE11 in enterprise mode (IE8 standards mode). */ IS_EM: 'spellcheck' in document.createElement('textarea') && document.documentMode == 8, /** * Variable: VML_PREFIX * * Prefix for VML namespace in node names. Default is 'v'. */ VML_PREFIX: 'v', /** * Variable: OFFICE_PREFIX * * Prefix for VML office namespace in node names. Default is 'o'. */ OFFICE_PREFIX: 'o', /** * Variable: IS_NS * * True if the current browser is Netscape (including Firefox). */ IS_NS: navigator.userAgent != null && navigator.userAgent.indexOf('Mozilla/') >= 0 && navigator.userAgent.indexOf('MSIE') < 0 && navigator.userAgent.indexOf('Edge/') < 0, /** * Variable: IS_OP * * True if the current browser is Opera. */ IS_OP: navigator.userAgent != null && (navigator.userAgent.indexOf('Opera/') >= 0 || navigator.userAgent.indexOf('OPR/') >= 0), /** * Variable: IS_OT * * True if -o-transform is available as a CSS style, ie for Opera browsers * based on a Presto engine with version 2.5 or later. */ 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, /** * Variable: IS_SF * * True if the current browser is Safari. */ IS_SF: /Apple Computer, Inc/.test(navigator.vendor), /** * Variable: IS_ANDROID * * Returns true if the user agent contains Android. */ IS_ANDROID: navigator.appVersion.indexOf('Android') >= 0, /** * Variable: IS_IOS * * Returns true if the user agent is an iPad, iPhone or iPod. */ IS_IOS: (/iP(hone|od|ad)/.test(navigator.platform)), /** * Variable: IS_GC * * True if the current browser is Google Chrome. */ IS_GC: /Google Inc/.test(navigator.vendor), /** * Variable: IS_CHROMEAPP * * True if the this is running inside a Chrome App. */ IS_CHROMEAPP: window.chrome != null && chrome.app != null && chrome.app.runtime != null, /** * Variable: IS_FF * * True if the current browser is Firefox. */ IS_FF: typeof InstallTrigger !== 'undefined', /** * Variable: IS_MT * * True if -moz-transform is available as a CSS style. This is the case * for all Firefox-based browsers newer than or equal 3, such as Camino, * Iceweasel, Seamonkey and Iceape. */ 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), /** * Variable: IS_VML * * True if the browser supports VML. */ IS_VML: navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER', /** * Variable: IS_SVG * * True if the browser supports SVG. */ IS_SVG: navigator.appName.toUpperCase() != 'MICROSOFT INTERNET EXPLORER', /** * Variable: NO_FO * * True if foreignObject support is not available. This is the case for * Opera, older SVG-based browsers and all versions of IE. */ NO_FO: !document.createElementNS || document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject') != '[object SVGForeignObjectElement]' || navigator.userAgent.indexOf('Opera/') >= 0, /** * Variable: IS_WIN * * True if the client is a Windows. */ IS_WIN: navigator.appVersion.indexOf('Win') > 0, /** * Variable: IS_MAC * * True if the client is a Mac. */ IS_MAC: navigator.appVersion.indexOf('Mac') > 0, /** * Variable: IS_CHROMEOS * * True if the client is a Chrome OS. */ IS_CHROMEOS: /\bCrOS\b/.test(navigator.appVersion), /** * Variable: IS_TOUCH * * True if this device supports touchstart/-move/-end events (Apple iOS, * Android, Chromebook and Chrome Browser on touch-enabled devices). */ IS_TOUCH: 'ontouchstart' in document.documentElement, /** * Variable: IS_POINTER * * True if this device supports Microsoft pointer events (always false on Macs). */ IS_POINTER: window.PointerEvent != null && !(navigator.appVersion.indexOf('Mac') > 0), /** * Variable: IS_LOCAL * * True if the documents location does not start with http:// or https://. */ IS_LOCAL: document.location.href.indexOf('http://') < 0 && document.location.href.indexOf('https://') < 0, /** * Variable: defaultBundles * * Contains the base names of the default bundles if mxLoadResources is false. */ defaultBundles: [], /** * Function: isBrowserSupported * * Returns true if the current browser is supported, that is, if * <mxClient.IS_VML> or <mxClient.IS_SVG> is true. * * Example: * * (code) * if (!mxClient.isBrowserSupported()) * { * mxUtils.error('Browser is not supported!', 200, false); * } * (end) */ isBrowserSupported: function() { return mxClient.IS_VML || mxClient.IS_SVG; }, /** * Function: link * * Adds a link node to the head of the document. Use this * to add a stylesheet to the page as follows: * * (code) * mxClient.link('stylesheet', filename); * (end) * * where filename is the (relative) URL of the stylesheet. The charset * is hardcoded to ISO-8859-1 and the type is text/css. * * Parameters: * * rel - String that represents the rel attribute of the link node. * href - String that represents the href attribute of the link node. * doc - Optional parent document of the link node. * id - unique id for the link element to check if it already exists */ link: function(rel, href, doc, id) { doc = doc || document; // Workaround for Operation Aborted in IE6 if base tag is used in head 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); } }, /** * Function: loadResources * * Helper method to load the default bundles if mxLoadResources is false. * * Parameters: * * fn - Function to call after all resources have been loaded. * lan - Optional string to pass to <mxResources.add>. */ 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); } }, /** * Function: include * * Dynamically adds a script node to the document header. * * In production environments, the includes are resolved in the mxClient.js * file to reduce the number of requests required for client startup. This * function should only be used in development environments, but not in * production systems. */ include: function(src) { document.write('<script src="'+src+'"></script>'); } }; /** * Variable: mxLoadResources * * Optional global config variable to toggle loading of the two resource files * in <mxGraph> and <mxEditor>. Default is true. NOTE: This is a global variable, * not a variable of mxClient. If this is false, you can use <mxClient.loadResources> * with its callback to load the default bundles asynchronously. * * (code) * <script type="text/javascript"> * var mxLoadResources = false; * </script> * <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script> * (end) */ if (typeof(mxLoadResources) == 'undefined') { mxLoadResources = true; } /** * Variable: mxForceIncludes * * Optional global config variable to force loading the JavaScript files in * development mode. Default is undefined. NOTE: This is a global variable, * not a variable of mxClient. * * (code) * <script type="text/javascript"> * var mxLoadResources = true; * </script> * <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script> * (end) */ if (typeof(mxForceIncludes) == 'undefined') { mxForceIncludes = false; } /** * Variable: mxResourceExtension * * Optional global config variable to specify the extension of resource files. * Default is true. NOTE: This is a global variable, not a variable of mxClient. * * (code) * <script type="text/javascript"> * var mxResourceExtension = '.txt'; * </script> * <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script> * (end) */ if (typeof(mxResourceExtension) == 'undefined') { mxResourceExtension = '.txt'; } /** * Variable: mxLoadStylesheets * * Optional global config variable to toggle loading of the CSS files when * the library is initialized. Default is true. NOTE: This is a global variable, * not a variable of mxClient. * * (code) * <script type="text/javascript"> * var mxLoadStylesheets = false; * </script> * <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script> * (end) */ if (typeof(mxLoadStylesheets) == 'undefined') { mxLoadStylesheets = true; } /** * Variable: basePath * * Basepath for all URLs in the core without trailing slash. Default is '.'. * Set mxBasePath prior to loading the mxClient library as follows to override * this setting: * * (code) * <script type="text/javascript"> * mxBasePath = '/path/to/core/directory'; * </script> * <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script> * (end) * * When using a relative path, the path is relative to the URL of the page that * contains the assignment. Trailing slashes are automatically removed. */ if (typeof(mxBasePath) != 'undefined' && mxBasePath.length > 0) { // Adds a trailing slash if required if (mxBasePath.substring(mxBasePath.length - 1) == '/') { mxBasePath = mxBasePath.substring(0, mxBasePath.length - 1); } mxClient.basePath = mxBasePath; } else { mxClient.basePath = '.'; } /** * Variable: imageBasePath * * Basepath for all images URLs in the core without trailing slash. Default is * <mxClient.basePath> + '/images'. Set mxImageBasePath prior to loading the * mxClient library as follows to override this setting: * * (code) * <script type="text/javascript"> * mxImageBasePath = '/path/to/image/directory'; * </script> * <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script> * (end) * * When using a relative path, the path is relative to the URL of the page that * contains the assignment. Trailing slashes are automatically removed. */ if (typeof(mxImageBasePath) != 'undefined' && mxImageBasePath.length > 0) { // Adds a trailing slash if required if (mxImageBasePath.substring(mxImageBasePath.length - 1) == '/') { mxImageBasePath = mxImageBasePath.substring(0, mxImageBasePath.length - 1); } mxClient.imageBasePath = mxImageBasePath; } else { mxClient.imageBasePath = mxClient.basePath + '/images'; } /** * Variable: language * * Defines the language of the client, eg. en for english, de for german etc. * The special value 'none' will disable all built-in internationalization and * resource loading. See <mxResources.getSpecialBundle> for handling identifiers * with and without a dash. * * Set mxLanguage prior to loading the mxClient library as follows to override * this setting: * * (code) * <script type="text/javascript"> * mxLanguage = 'en'; * </script> * <script type="text/javascript" src="js/mxClient.js"></script> * (end) * * If internationalization is disabled, then the following variables should be * overridden to reflect the current language of the system. These variables are * cleared when i18n is disabled. * <mxEditor.askZoomResource>, <mxEditor.lastSavedResource>, * <mxEditor.currentFileResource>, <mxEditor.propertiesResource>, * <mxEditor.tasksResource>, <mxEditor.helpResource>, <mxEditor.outlineResource>, * <mxElbowEdgeHandler.doubleClickOrientationResource>, <mxUtils.errorResource>, * <mxUtils.closeResource>, <mxGraphSelectionModel.doneResource>, * <mxGraphSelectionModel.updatingSelectionResource>, <mxGraphView.doneResource>, * <mxGraphView.updatingDocumentResource>, <mxCellRenderer.collapseExpandResource>, * <mxGraph.containsValidationErrorsResource> and * <mxGraph.alreadyConnectedResource>. */ if (typeof(mxLanguage) != 'undefined' && mxLanguage != null) { mxClient.language = mxLanguage; } else { mxClient.language = (mxClient.IS_IE) ? navigator.userLanguage : navigator.language; } /** * Variable: defaultLanguage * * Defines the default language which is used in the common resource files. Any * resources for this language will only load the common resource file, but not * the language-specific resource file. Default is 'en'. * * Set mxDefaultLanguage prior to loading the mxClient library as follows to override * this setting: * * (code) * <script type="text/javascript"> * mxDefaultLanguage = 'de'; * </script> * <script type="text/javascript" src="js/mxClient.js"></script> * (end) */ if (typeof(mxDefaultLanguage) != 'undefined' && mxDefaultLanguage != null) { mxClient.defaultLanguage = mxDefaultLanguage; } else { mxClient.defaultLanguage = 'en'; } // Adds all required stylesheets and namespaces if (mxLoadStylesheets) { mxClient.link('stylesheet', mxClient.basePath + '/css/common.css'); } /** * Variable: languages * * Defines the optional array of all supported language extensions. The default * language does not have to be part of this list. See * <mxResources.isLanguageSupported>. * * (code) * <script type="text/javascript"> * mxLanguages = ['de', 'it', 'fr']; * </script> * <script type="text/javascript" src="js/mxClient.js"></script> * (end) * * This is used to avoid unnecessary requests to language files, ie. if a 404 * will be returned. */ if (typeof(mxLanguages) != 'undefined' && mxLanguages != null) { mxClient.languages = mxLanguages; } // Adds required namespaces, stylesheets and memory handling for older IE browsers if (mxClient.IS_VML) { if (mxClient.IS_SVG) { mxClient.IS_VML = false; } else { // Enables support for IE8 standards mode. Note that this requires all attributes for VML // elements to be set using direct notation, ie. node.attr = value, not setAttribute. 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'); } } // Workaround for limited number of stylesheets in IE (does not work in standards mode) 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'); } } } // PREPROCESSOR-REMOVE-START // If script is loaded via CommonJS, do not write <script> tags to the page // for dependencies. These are already included in the build. if (mxForceIncludes || !(module.exports != null)) { // PREPROCESSOR-REMOVE-END 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'); // PREPROCESSOR-REMOVE-START } // PREPROCESSOR-REMOVE-END __mxOutput.mxClient = typeof mxClient !== 'undefined' ? mxClient : undefined; /** * Copyright (c) 2006-2015, JGraph Ltd * Copyright (c) 2006-2015, Gaudenz Alder */ var mxLog = { /** * Class: mxLog * * A singleton class that implements a simple console. * * Variable: consoleName * * Specifies the name of the console window. Default is 'Console'. */ consoleName: 'Console', /** * Variable: TRACE * * Specified if the output for <enter> and <leave> should be visible in the * console. Default is false. */ TRACE: false, /** * Variable: DEBUG * * Specifies if the output for <debug> should be visible in the console. * Default is true. */ DEBUG: true, /** * Variable: WARN * * Specifies if the output for <warn> should be visible in the console. * Default is true. */ WARN: true, /** * Variable: buffer * * Buffer for pre-initialized content. */ buffer: '', /** * Function: init * * Initializes the DOM node for the console. This requires document.body to * point to a non-null value. This is called from within <setVisible> if the * log has not yet been initialized. */ init: function() { if (mxLog.window == null && document.body != null) { var title = mxLog.consoleName + ' - mxGraph ' + mxClient.VERSION; // Creates a table that maintains the layout