UNPKG

element-nice-ui

Version:

A Component Library for Vue.js.

1,425 lines (1,274 loc) 418 kB
module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/dist/"; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 210); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "is", function() { return is; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getBusinessObject", function() { return getBusinessObject; }); /** * Is an element of the given BPMN type? * * @param {djs.model.Base|ModdleElement} element * @param {string} type * * @return {boolean} */ function is(element, type) { var bo = getBusinessObject(element); return bo && typeof bo.$instanceOf === 'function' && bo.$instanceOf(type); } /** * Return the business object for a given element. * * @param {djs.model.Base|ModdleElement} element * * @return {ModdleElement} */ function getBusinessObject(element) { return element && element.businessObject || element; } /***/ }), /* 1 */ /***/ (function(module, exports) { module.exports = require("min-dash"); /***/ }), /* 2 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; }); /* globals __VUE_SSR_CONTEXT__ */ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules). // This module is a runtime utility for cleaner component module output and will // be included in the final webpack user bundle. function normalizeComponent( scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier /* server only */, shadowMode /* vue-cli only */ ) { // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // render functions if (render) { options.render = render options.staticRenderFns = staticRenderFns options._compiled = true } // functional template if (functionalTemplate) { options.functional = true } // scopedId if (scopeId) { options._scopeId = 'data-v-' + scopeId } var hook if (moduleIdentifier) { // server build hook = function (context) { // 2.3 injection context = context || // cached call (this.$vnode && this.$vnode.ssrContext) || // stateful (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional // 2.2 with runInNewContext: true if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { context = __VUE_SSR_CONTEXT__ } // inject component styles if (injectStyles) { injectStyles.call(this, context) } // register component module identifier for async chunk inferrence if (context && context._registeredComponents) { context._registeredComponents.add(moduleIdentifier) } } // used by ssr in case component is cached and beforeCreate // never gets called options._ssrRegister = hook } else if (injectStyles) { hook = shadowMode ? function () { injectStyles.call( this, (options.functional ? this.parent : this).$root.$options.shadowRoot ) } : injectStyles } if (hook) { if (options.functional) { // for template-only hot-reload because in that case the render fn doesn't // go through the normalizer options._injectStyles = hook // register for functional component in vue file var originalRender = options.render options.render = function renderWithStyleInjection(h, context) { hook.call(context) return originalRender(h, context) } } else { // inject component registration as beforeCreate hook var existing = options.beforeCreate options.beforeCreate = existing ? [].concat(existing, hook) : [hook] } } return { exports: scriptExports, options: options } } /***/ }), /* 3 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return isTypedEvent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return isThrowEvent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return isCollection; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getDi; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return getSemantic; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getFillColor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return getStrokeColor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getCirclePath; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return getRoundRectPath; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getDiamondPath; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getRectPath; }); /* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); /* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(min_dash__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var diagram_js_lib_util_RenderUtil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(45); /* harmony import */ var diagram_js_lib_util_RenderUtil__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(diagram_js_lib_util_RenderUtil__WEBPACK_IMPORTED_MODULE_1__); // element utils ////////////////////// /** * Checks if eventDefinition of the given element matches with semantic type. * * @return {boolean} true if element is of the given semantic type */ function isTypedEvent(event, eventDefinitionType, filter) { function matches(definition, filter) { return Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["every"])(filter, function (val, key) { // we want a == conversion here, to be able to catch // undefined == false and friends /* jshint -W116 */ return definition[key] == val; }); } return Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["some"])(event.eventDefinitions, function (definition) { return definition.$type === eventDefinitionType && matches(event, filter); }); } function isThrowEvent(event) { return event.$type === 'bpmn:IntermediateThrowEvent' || event.$type === 'bpmn:EndEvent'; } function isCollection(element) { var dataObject = element.dataObjectRef; return element.isCollection || dataObject && dataObject.isCollection; } function getDi(element) { return element.businessObject.di; } function getSemantic(element) { return element.businessObject; } // color access ////////////////////// function getFillColor(element, defaultColor) { return getDi(element).get('bioc:fill') || defaultColor || 'white'; } function getStrokeColor(element, defaultColor) { return getDi(element).get('bioc:stroke') || defaultColor || 'black'; } // cropping path customizations ////////////////////// function getCirclePath(shape) { var cx = shape.x + shape.width / 2, cy = shape.y + shape.height / 2, radius = shape.width / 2; var circlePath = [['M', cx, cy], ['m', 0, -radius], ['a', radius, radius, 0, 1, 1, 0, 2 * radius], ['a', radius, radius, 0, 1, 1, 0, -2 * radius], ['z']]; return Object(diagram_js_lib_util_RenderUtil__WEBPACK_IMPORTED_MODULE_1__["componentsToPath"])(circlePath); } function getRoundRectPath(shape, borderRadius) { var x = shape.x, y = shape.y, width = shape.width, height = shape.height; var roundRectPath = [['M', x + borderRadius, y], ['l', width - borderRadius * 2, 0], ['a', borderRadius, borderRadius, 0, 0, 1, borderRadius, borderRadius], ['l', 0, height - borderRadius * 2], ['a', borderRadius, borderRadius, 0, 0, 1, -borderRadius, borderRadius], ['l', borderRadius * 2 - width, 0], ['a', borderRadius, borderRadius, 0, 0, 1, -borderRadius, -borderRadius], ['l', 0, borderRadius * 2 - height], ['a', borderRadius, borderRadius, 0, 0, 1, borderRadius, -borderRadius], ['z']]; return Object(diagram_js_lib_util_RenderUtil__WEBPACK_IMPORTED_MODULE_1__["componentsToPath"])(roundRectPath); } function getDiamondPath(shape) { var width = shape.width, height = shape.height, x = shape.x, y = shape.y, halfWidth = width / 2, halfHeight = height / 2; var diamondPath = [['M', x + halfWidth, y], ['l', halfWidth, halfHeight], ['l', -halfWidth, halfHeight], ['l', -halfWidth, -halfHeight], ['z']]; return Object(diagram_js_lib_util_RenderUtil__WEBPACK_IMPORTED_MODULE_1__["componentsToPath"])(diamondPath); } function getRectPath(shape) { var x = shape.x, y = shape.y, width = shape.width, height = shape.height; var rectPath = [['M', x, y], ['l', width, 0], ['l', 0, height], ['l', -width, 0], ['z']]; return Object(diagram_js_lib_util_RenderUtil__WEBPACK_IMPORTED_MODULE_1__["componentsToPath"])(rectPath); } /***/ }), /* 4 */, /* 5 */, /* 6 */ /***/ (function(module, exports) { module.exports = require("diagram-js/lib/command/CommandInterceptor"); /***/ }), /* 7 */ /***/ (function(module, exports) { module.exports = require("inherits"); /***/ }), /* 8 */, /* 9 */ /***/ (function(module, exports) { module.exports = require("diagram-js/lib/layout/LayoutUtil"); /***/ }), /* 10 */ /***/ (function(module, exports) { module.exports = require("tiny-svg"); /***/ }), /* 11 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isExpanded; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return isInterrupting; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isEventSubProcess; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return hasEventDefinition; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return hasErrorEventDefinition; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return hasEscalationEventDefinition; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasCompensateEventDefinition; }); /* harmony import */ var _ModelUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); /* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1); /* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(min_dash__WEBPACK_IMPORTED_MODULE_1__); function isExpanded(element) { if (Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["is"])(element, 'bpmn:CallActivity')) { return false; } if (Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["is"])(element, 'bpmn:SubProcess')) { return Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["getBusinessObject"])(element).di && !!Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["getBusinessObject"])(element).di.isExpanded; } if (Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["is"])(element, 'bpmn:Participant')) { return !!Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["getBusinessObject"])(element).processRef; } return true; } function isInterrupting(element) { return element && Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["getBusinessObject"])(element).isInterrupting !== false; } function isEventSubProcess(element) { return element && !!Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["getBusinessObject"])(element).triggeredByEvent; } function hasEventDefinition(element, eventType) { var bo = Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["getBusinessObject"])(element), hasEventDefinition = false; if (bo.eventDefinitions) { Object(min_dash__WEBPACK_IMPORTED_MODULE_1__["forEach"])(bo.eventDefinitions, function (event) { if (Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["is"])(event, eventType)) { hasEventDefinition = true; } }); } return hasEventDefinition; } function hasErrorEventDefinition(element) { return hasEventDefinition(element, 'bpmn:ErrorEventDefinition'); } function hasEscalationEventDefinition(element) { return hasEventDefinition(element, 'bpmn:EscalationEventDefinition'); } function hasCompensateEventDefinition(element) { return hasEventDefinition(element, 'bpmn:CompensateEventDefinition'); } /***/ }), /* 12 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isAny; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getParent; }); /* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); /* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(min_dash__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0); /** * Return true if element has any of the given types. * * @param {djs.model.Base} element * @param {Array<string>} types * * @return {boolean} */ function isAny(element, types) { return Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["some"])(types, function (t) { return Object(_util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__["is"])(element, t); }); } /** * Return the parent of the element with any of the given types. * * @param {djs.model.Base} element * @param {string|Array<string>} anyType * * @return {djs.model.Base} */ function getParent(element, anyType) { if (typeof anyType === 'string') { anyType = [anyType]; } while (element = element.parent) { if (isAny(element, anyType)) { return element; } } return null; } /***/ }), /* 13 */, /* 14 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DEFAULT_LABEL_SIZE; }); /* unused harmony export FLOW_LABEL_INDENT */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isLabelExternal; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return hasExternalLabel; }); /* unused harmony export getFlowLabelPosition */ /* unused harmony export getWaypointsMid */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getExternalLabelMid; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getExternalLabelBounds; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isLabel; }); /* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); /* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(min_dash__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _ModelUtil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0); var DEFAULT_LABEL_SIZE = { width: 90, height: 20 }; var FLOW_LABEL_INDENT = 15; /** * Returns true if the given semantic has an external label * * @param {BpmnElement} semantic * @return {boolean} true if has label */ function isLabelExternal(semantic) { return Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_1__["is"])(semantic, 'bpmn:Event') || Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_1__["is"])(semantic, 'bpmn:Gateway') || Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_1__["is"])(semantic, 'bpmn:DataStoreReference') || Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_1__["is"])(semantic, 'bpmn:DataObjectReference') || Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_1__["is"])(semantic, 'bpmn:DataInput') || Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_1__["is"])(semantic, 'bpmn:DataOutput') || Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_1__["is"])(semantic, 'bpmn:SequenceFlow') || Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_1__["is"])(semantic, 'bpmn:MessageFlow') || Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_1__["is"])(semantic, 'bpmn:Group'); } /** * Returns true if the given element has an external label * * @param {djs.model.shape} element * @return {boolean} true if has label */ function hasExternalLabel(element) { return isLabel(element.label); } /** * Get the position for sequence flow labels * * @param {Array<Point>} waypoints * @return {Point} the label position */ function getFlowLabelPosition(waypoints) { // get the waypoints mid var mid = waypoints.length / 2 - 1; var first = waypoints[Math.floor(mid)]; var second = waypoints[Math.ceil(mid + 0.01)]; // get position var position = getWaypointsMid(waypoints); // calculate angle var angle = Math.atan((second.y - first.y) / (second.x - first.x)); var x = position.x, y = position.y; if (Math.abs(angle) < Math.PI / 2) { y -= FLOW_LABEL_INDENT; } else { x += FLOW_LABEL_INDENT; } return { x: x, y: y }; } /** * Get the middle of a number of waypoints * * @param {Array<Point>} waypoints * @return {Point} the mid point */ function getWaypointsMid(waypoints) { var mid = waypoints.length / 2 - 1; var first = waypoints[Math.floor(mid)]; var second = waypoints[Math.ceil(mid + 0.01)]; return { x: first.x + (second.x - first.x) / 2, y: first.y + (second.y - first.y) / 2 }; } function getExternalLabelMid(element) { if (element.waypoints) { return getFlowLabelPosition(element.waypoints); } else if (Object(_ModelUtil__WEBPACK_IMPORTED_MODULE_1__["is"])(element, 'bpmn:Group')) { return { x: element.x + element.width / 2, y: element.y + DEFAULT_LABEL_SIZE.height / 2 }; } else { return { x: element.x + element.width / 2, y: element.y + element.height + DEFAULT_LABEL_SIZE.height / 2 }; } } /** * Returns the bounds of an elements label, parsed from the elements DI or * generated from its bounds. * * @param {BpmnElement} semantic * @param {djs.model.Base} element */ function getExternalLabelBounds(semantic, element) { var mid, size, bounds, di = semantic.di, label = di.label; if (label && label.bounds) { bounds = label.bounds; size = { width: Math.max(DEFAULT_LABEL_SIZE.width, bounds.width), height: bounds.height }; mid = { x: bounds.x + bounds.width / 2, y: bounds.y + bounds.height / 2 }; } else { mid = getExternalLabelMid(element); size = DEFAULT_LABEL_SIZE; } return Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["assign"])({ x: mid.x - size.width / 2, y: mid.y - size.height / 2 }, size); } function isLabel(element) { return element && !!element.labelTarget; } /***/ }), /* 15 */ /***/ (function(module, exports) { module.exports = require("diagram-js/lib/util/Collections"); /***/ }), /* 16 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LANE_INDENTATION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return collectLanes; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getChildLanes; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getLanesRoot; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return computeLanesResize; }); /* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); /* harmony import */ var _ModelingUtil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12); /* harmony import */ var diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9); /* harmony import */ var diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var diagram_js_lib_features_resize_ResizeUtil__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(44); /* harmony import */ var diagram_js_lib_features_resize_ResizeUtil__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(diagram_js_lib_features_resize_ResizeUtil__WEBPACK_IMPORTED_MODULE_3__); var abs = Math.abs; function getTRBLResize(oldBounds, newBounds) { return Object(diagram_js_lib_features_resize_ResizeUtil__WEBPACK_IMPORTED_MODULE_3__["substractTRBL"])(Object(diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_2__["asTRBL"])(newBounds), Object(diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_2__["asTRBL"])(oldBounds)); } var LANE_PARENTS = ['bpmn:Participant', 'bpmn:Process', 'bpmn:SubProcess']; var LANE_INDENTATION = 30; /** * Collect all lane shapes in the given paren * * @param {djs.model.Shape} shape * @param {Array<djs.model.Base>} [collectedShapes] * * @return {Array<djs.model.Base>} */ function collectLanes(shape, collectedShapes) { collectedShapes = collectedShapes || []; shape.children.filter(function (s) { if (Object(_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["is"])(s, 'bpmn:Lane')) { collectLanes(s, collectedShapes); collectedShapes.push(s); } }); return collectedShapes; } /** * Return the lane children of the given element. * * @param {djs.model.Shape} shape * * @return {Array<djs.model.Shape>} */ function getChildLanes(shape) { return shape.children.filter(function (c) { return Object(_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["is"])(c, 'bpmn:Lane'); }); } /** * Return the root element containing the given lane shape * * @param {djs.model.Shape} shape * * @return {djs.model.Shape} */ function getLanesRoot(shape) { return Object(_ModelingUtil__WEBPACK_IMPORTED_MODULE_1__[/* getParent */ "a"])(shape, LANE_PARENTS) || shape; } /** * Compute the required resize operations for lanes * adjacent to the given shape, assuming it will be * resized to the given new bounds. * * @param {djs.model.Shape} shape * @param {Bounds} newBounds * * @return {Array<Object>} */ function computeLanesResize(shape, newBounds) { var rootElement = getLanesRoot(shape); var initialShapes = Object(_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["is"])(rootElement, 'bpmn:Process') ? [] : [rootElement]; var allLanes = collectLanes(rootElement, initialShapes), shapeTrbl = Object(diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_2__["asTRBL"])(shape), shapeNewTrbl = Object(diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_2__["asTRBL"])(newBounds), trblResize = getTRBLResize(shape, newBounds), resizeNeeded = []; allLanes.forEach(function (other) { if (other === shape) { return; } var topResize = 0, rightResize = trblResize.right, bottomResize = 0, leftResize = trblResize.left; var otherTrbl = Object(diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_2__["asTRBL"])(other); if (trblResize.top) { if (abs(otherTrbl.bottom - shapeTrbl.top) < 10) { bottomResize = shapeNewTrbl.top - otherTrbl.bottom; } if (abs(otherTrbl.top - shapeTrbl.top) < 5) { topResize = shapeNewTrbl.top - otherTrbl.top; } } if (trblResize.bottom) { if (abs(otherTrbl.top - shapeTrbl.bottom) < 10) { topResize = shapeNewTrbl.bottom - otherTrbl.top; } if (abs(otherTrbl.bottom - shapeTrbl.bottom) < 5) { bottomResize = shapeNewTrbl.bottom - otherTrbl.bottom; } } if (topResize || rightResize || bottomResize || leftResize) { resizeNeeded.push({ shape: other, newBounds: Object(diagram_js_lib_features_resize_ResizeUtil__WEBPACK_IMPORTED_MODULE_3__["resizeTRBL"])(other, { top: topResize, right: rightResize, bottom: bottomResize, left: leftResize }) }); } }); return resizeNeeded; } /***/ }), /* 17 */, /* 18 */, /* 19 */, /* 20 */, /* 21 */, /* 22 */, /* 23 */, /* 24 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return elementToString; }); function elementToString(e) { if (!e) { return '<null>'; } return '<' + e.$type + (e.id ? ' id="' + e.id : '') + '" />'; } /***/ }), /* 25 */, /* 26 */, /* 27 */, /* 28 */, /* 29 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getLabel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return setLabel; }); /* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); function getLabelAttr(semantic) { if (Object(_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["is"])(semantic, 'bpmn:FlowElement') || Object(_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["is"])(semantic, 'bpmn:Participant') || Object(_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["is"])(semantic, 'bpmn:Lane') || Object(_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["is"])(semantic, 'bpmn:SequenceFlow') || Object(_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["is"])(semantic, 'bpmn:MessageFlow') || Object(_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["is"])(semantic, 'bpmn:DataInput') || Object(_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["is"])(semantic, 'bpmn:DataOutput')) { return 'name'; } if (Object(_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["is"])(semantic, 'bpmn:TextAnnotation')) { return 'text'; } if (Object(_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__["is"])(semantic, 'bpmn:Group')) { return 'categoryValueRef'; } } function getCategoryValue(semantic) { var categoryValueRef = semantic['categoryValueRef']; if (!categoryValueRef) { return ''; } return categoryValueRef.value || ''; } function getLabel(element) { var semantic = element.businessObject, attr = getLabelAttr(semantic); if (attr) { if (attr === 'categoryValueRef') { return getCategoryValue(semantic); } return semantic[attr] || ''; } } function setLabel(element, text, isExternal) { var semantic = element.businessObject, attr = getLabelAttr(semantic); if (attr) { if (attr === 'categoryValueRef') { semantic['categoryValueRef'].value = text; } else { semantic[attr] = text; } } return element; } /***/ }), /* 30 */, /* 31 */, /* 32 */, /* 33 */, /* 34 */ /***/ (function(module, exports) { module.exports = require("diagram-js/lib/util/Elements"); /***/ }), /* 35 */, /* 36 */, /* 37 */, /* 38 */, /* 39 */, /* 40 */ /***/ (function(module, exports) { module.exports = require("min-dom"); /***/ }), /* 41 */, /* 42 */ /***/ (function(module, exports) { module.exports = require("diagram-js/lib/i18n/translate"); /***/ }), /* 43 */ /***/ (function(module, exports) { module.exports = require("diagram-js/lib/features/selection"); /***/ }), /* 44 */ /***/ (function(module, exports) { module.exports = require("diagram-js/lib/features/resize/ResizeUtil"); /***/ }), /* 45 */ /***/ (function(module, exports) { module.exports = require("diagram-js/lib/util/RenderUtil"); /***/ }), /* 46 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return wrapForCompatibility; }); /* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); /* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(min_dash__WEBPACK_IMPORTED_MODULE_0__); // TODO(nikku): remove with future bpmn-js version /** * Wraps APIs to check: * * 1) If a callback is passed -> Warn users about callback deprecation. * 2) If Promise class is implemented in current environment. * * @private */ function wrapForCompatibility(api) { return function () { if (!window.Promise) { throw new Error('Promises is not supported in this environment. Please polyfill Promise.'); } var argLen = arguments.length; if (argLen >= 1 && Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["isFunction"])(arguments[argLen - 1])) { var callback = arguments[argLen - 1]; console.warn(new Error('Passing callbacks to ' + api.name + ' is deprecated and will be removed in a future major release. ' + 'Please switch to promises: https://bpmn.io/l/moving-to-promises.html')); var argsWithoutCallback = Array.prototype.slice.call(arguments, 0, -1); api.apply(this, argsWithoutCallback).then(function (result) { var firstKey = Object.keys(result)[0]; // The APIs we are wrapping all resolve a single item depending on the API. // For instance, importXML resolves { warnings } and saveXML returns { xml }. // That's why we can call the callback with the first item of result. return callback(null, result[firstKey]); // Passing a second paramter instead of catch because we don't want to // catch errors thrown by callback(). }, function (err) { return callback(err, err.warnings); }); } else { return api.apply(this, arguments); } }; } /***/ }), /* 47 */, /* 48 */, /* 49 */, /* 50 */, /* 51 */, /* 52 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ModdleCopy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getPropertyNames; }); /* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); /* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(min_dash__WEBPACK_IMPORTED_MODULE_0__); var DISALLOWED_PROPERTIES = ['artifacts', 'dataInputAssociations', 'dataOutputAssociations', 'default', 'flowElements', 'lanes', 'incoming', 'outgoing']; /** * @typedef {Function} <moddleCopy.canCopyProperties> listener * * @param {Object} context * @param {Array<string>} context.propertyNames * @param {ModdleElement} context.sourceElement * @param {ModdleElement} context.targetElement * * @returns {Array<string>|boolean} - Return properties to be copied or false to disallow * copying. */ /** * @typedef {Function} <moddleCopy.canCopyProperty> listener * * @param {Object} context * @param {ModdleElement} context.parent * @param {*} context.property * @param {string} context.propertyName * * @returns {*|boolean} - Return copied property or false to disallow * copying. */ /** * @typedef {Function} <moddleCopy.canSetCopiedProperty> listener * * @param {Object} context * @param {ModdleElement} context.parent * @param {*} context.property * @param {string} context.propertyName * * @returns {boolean} - Return false to disallow * setting copied property. */ /** * Utility for copying model properties from source element to target element. * * @param {EventBus} eventBus * @param {BpmnFactory} bpmnFactory * @param {BpmnModdle} moddle */ function ModdleCopy(eventBus, bpmnFactory, moddle) { this._bpmnFactory = bpmnFactory; this._eventBus = eventBus; this._moddle = moddle; // copy extension elements last eventBus.on('moddleCopy.canCopyProperties', function (context) { var propertyNames = context.propertyNames; if (!propertyNames || !propertyNames.length) { return; } return Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["sortBy"])(propertyNames, function (propertyName) { return propertyName === 'extensionElements'; }); }); // default check whether property can be copied eventBus.on('moddleCopy.canCopyProperty', function (context) { var parent = context.parent, parentDescriptor = Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["isObject"])(parent) && parent.$descriptor, propertyName = context.propertyName; if (propertyName && DISALLOWED_PROPERTIES.indexOf(propertyName) !== -1) { // disallow copying property return false; } if (propertyName && parentDescriptor && !Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["find"])(parentDescriptor.properties, Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["matchPattern"])({ name: propertyName }))) { // disallow copying property return false; } }); // do NOT allow to copy empty extension elements eventBus.on('moddleCopy.canSetCopiedProperty', function (context) { var property = context.property; if (is(property, 'bpmn:ExtensionElements') && (!property.values || !property.values.length)) { // disallow setting copied property return false; } }); } ModdleCopy.$inject = ['eventBus', 'bpmnFactory', 'moddle']; /** * Copy model properties of source element to target element. * * @param {ModdleElement} sourceElement * @param {ModdleElement} targetElement * @param {Array<string>} [propertyNames] * * @param {ModdleElement} */ ModdleCopy.prototype.copyElement = function (sourceElement, targetElement, propertyNames) { var self = this; if (propertyNames && !Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["isArray"])(propertyNames)) { propertyNames = [propertyNames]; } propertyNames = propertyNames || getPropertyNames(sourceElement.$descriptor); var canCopyProperties = this._eventBus.fire('moddleCopy.canCopyProperties', { propertyNames: propertyNames, sourceElement: sourceElement, targetElement: targetElement }); if (canCopyProperties === false) { return targetElement; } if (Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["isArray"])(canCopyProperties)) { propertyNames = canCopyProperties; } // copy properties Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["forEach"])(propertyNames, function (propertyName) { var sourceProperty; if (Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["has"])(sourceElement, propertyName)) { sourceProperty = sourceElement.get(propertyName); } var copiedProperty = self.copyProperty(sourceProperty, targetElement, propertyName); var canSetProperty = self._eventBus.fire('moddleCopy.canSetCopiedProperty', { parent: targetElement, property: copiedProperty, propertyName: propertyName }); if (canSetProperty === false) { return; } if (Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["isDefined"])(copiedProperty)) { targetElement.set(propertyName, copiedProperty); } }); return targetElement; }; /** * Copy model property. * * @param {*} property * @param {ModdleElement} parent * @param {string} propertyName * * @returns {*} */ ModdleCopy.prototype.copyProperty = function (property, parent, propertyName) { var self = this; // allow others to copy property var copiedProperty = this._eventBus.fire('moddleCopy.canCopyProperty', { parent: parent, property: property, propertyName: propertyName }); // return if copying is NOT allowed if (copiedProperty === false) { return; } if (copiedProperty) { if (Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["isObject"])(copiedProperty) && copiedProperty.$type && !copiedProperty.$parent) { copiedProperty.$parent = parent; } return copiedProperty; } var propertyDescriptor = this._moddle.getPropertyDescriptor(parent, propertyName); // do NOT copy Ids and references if (propertyDescriptor.isId || propertyDescriptor.isReference) { return; } // copy arrays if (Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["isArray"])(property)) { return Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["reduce"])(property, function (childProperties, childProperty) { // recursion copiedProperty = self.copyProperty(childProperty, parent, propertyName); // copying might NOT be allowed if (copiedProperty) { copiedProperty.$parent = parent; return childProperties.concat(copiedProperty); } return childProperties; }, []); } // copy model elements if (Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["isObject"])(property) && property.$type) { if (this._moddle.getElementDescriptor(property).isGeneric) { return; } copiedProperty = self._bpmnFactory.create(property.$type); copiedProperty.$parent = parent; // recursion copiedProperty = self.copyElement(property, copiedProperty); return copiedProperty; } // copy primitive properties return property; }; // helpers ////////// function getPropertyNames(descriptor, keepDefaultProperties) { return Object(min_dash__WEBPACK_IMPORTED_MODULE_0__["reduce"])(descriptor.properties, function (properties, property) { if (keepDefaultProperties && property.default) { return properties; } return properties.concat(property.name); }, []); } function is(element, type) { return element && typeof element.$instanceOf === 'function' && element.$instanceOf(type); } /***/ }), /* 53 */, /* 54 */ /***/ (function(module, exports) { module.exports = require("diagram-js/lib/util/SvgTransformUtil"); /***/ }), /* 55 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ BaseViewer; }); // EXTERNAL MODULE: external "min-dash" var external_min_dash_ = __webpack_require__(1); // EXTERNAL MODULE: external "min-dom" var external_min_dom_ = __webpack_require__(40); // EXTERNAL MODULE: external "tiny-svg" var external_tiny_svg_ = __webpack_require__(10); // EXTERNAL MODULE: external "diagram-js" var external_diagram_js_ = __webpack_require__(56); var external_diagram_js_default = /*#__PURE__*/__webpack_require__.n(external_diagram_js_); // EXTERNAL MODULE: external "bpmn-moddle" var external_bpmn_moddle_ = __webpack_require__(98); var external_bpmn_moddle_default = /*#__PURE__*/__webpack_require__.n(external_bpmn_moddle_); // EXTERNAL MODULE: external "inherits" var external_inherits_ = __webpack_require__(7); var external_inherits_default = /*#__PURE__*/__webpack_require__.n(external_inherits_); // EXTERNAL MODULE: external "object-refs" var external_object_refs_ = __webpack_require__(99); var external_object_refs_default = /*#__PURE__*/__webpack_require__.n(external_object_refs_); // EXTERNAL MODULE: ./packages/bpmn/src/bpmn-js/import/Util.js var Util = __webpack_require__(24); // CONCATENATED MODULE: ./packages/bpmn/src/bpmn-js/import/BpmnTreeWalker.js var diRefs = new external_object_refs_default.a({ name: 'bpmnElement', enumerable: true }, { name: 'di', configurable: true }); /** * Returns true if an element has the given meta-model type * * @param {ModdleElement} element * @param {string} type * * @return {boolean} */ function is(element, type) { return element.$instanceOf(type); } /** * Find a suitable display candidate for definitions where the DI does not * correctly specify one. */ function findDisplayCandidate(definitions) { return Object(external_min_dash_["find"])(definitions.rootElements, function (e) { return is(e, 'bpmn:Process') || is(e, 'bpmn:Collaboration'); }); } function BpmnTreeWalker(handler, translate) { // list of containers already walked var handledElements = {}; // list of elements to handle deferred to ensure // prerequisites are drawn var deferred = []; // Helpers ////////////////////// function contextual(fn, ctx) { return function (e) { fn(e, ctx); }; } function handled(element) { handledElements[element.id] = element; } function isHandled(element) { return handledElements[element.id]; } function visit(element, ctx) { var gfx = element.gfx; // avoid multiple rendering of elements if (gfx) { throw new Error(translate('already rendered {element}', { element: Object(Util["a" /* elementToString */])(element) })); } // call handler return handler.element(element, ctx); } function visitRoot(element, diagram) { return handler.root(element, diagram); } function visitIfDi(element, ctx) { try { var gfx = element.di && visit(element, ctx); handled(element); return gfx; } catch (e) { logError(e.message, { element: element, error: e }); console.error(translate('failed to import {element}', { element: Object(Util["a" /* elementToString */])(element) })); console.error(e); } } function logError(message, context) { handler.error(message, context); } // DI handling ////////////////////// function registerDi(di) { var bpmnElement = di.bpmnElement; if (bpmnElement) { if (bpmnElement.di) { logError(translate('multiple DI elements defined for {element}', { element: Object(Util["a" /* elementToString */])(bpmnElement) }), { element: bpmnElement }); } else { diRefs.bind(bpmnElement, 'di'); bpmnElement.di = di; } } else { logError(translate('no bpmnElement referenced in {element}', { element: Object(Util["a" /* elementToString */])(di) }), { element: di }); } } function handleDiagram(diagram) { handlePlane(diagram.plane); } function handlePlane(plane) { registerDi(plane); Object(external_min_dash_["forEach"])(plane.planeElement, handlePlaneElement); } function handlePlaneElement(planeElement) { registerDi(planeElement); } // Semantic handling ////////////////////// /** * Handle definitions and return the rendered diagram (if any) * * @param {ModdleElement} definitions to walk and import * @param {ModdleElement} [diagram] specific diagram to import and display * * @throws {Error} if no diagram to display could be found */ function handleDefinitions(definitions, diagram) { // make sure we walk the correct bpmnElement var diagrams = definitions.diagrams; if (diagram && diagrams.indexOf(diagram) === -1) { throw new Error(translate('diagram not part of bpmn:Definitions')); } if (!diagram && diagrams && diagrams.length) { diagram = diagrams[0]; } // no diagram -> nothing to import if (!diagram) { throw new Error(translate('no diagram to display')); } // load DI from selected diagram only handleDiagram(diagram); var plane = diagram.plane; if (!plane) { throw new Error(translate('no plane for {element}', { element: Object(Util["a" /* elementToString */])(diagram) })); } var rootElement = plane.bpmnElement; // ensure we default to a suitable display candidate (process or collaboration), // even if non is specified in DI if (!rootElement) { rootElement = findDisplayCandidate(definitions); if (!rootElement) { throw new Error(translate('no process or collaboration to display')); } else { logError(translate('correcting missing bpmnElement on {plane} to {rootElement}', { plane: Object(Util["a" /* elementToString */])(plane), rootElement: Object(Util["a" /* elementToString */])(rootElement) })); // correct DI on the fly plane.bpmnElement = rootElement; registerDi(plane); } } var ctx = visitRoot(rootElement, plane); if (is(rootElement, 'bpmn:Process')) { handleProcess(rootElement, ctx); } else if (is(rootElement, 'bpmn:Collaboration')) { handleCollaboration(rootElement, ctx); // force drawing of everything not yet drawn that is part of the target DI handleUnhandledProcesses(definitions.rootElements, ctx); } else { throw new Error(translate('unsupported bpmnElement for {plane}: {rootElement}', { plane: Object(Util["a" /* elementToString */])(plane), rootElement: Object(Util["a" /* elementToString */])(rootElement) })); } // handle all deferred elements handleDeferred(deferred); } function handleDeferred() { var fn; // drain deferred until empty while (deferred.length) { fn = deferred.shift(); fn(); } } function handleProcess(process, context) { handleFlowElementsContainer(process, context); handleIoSpecification(process.ioSpecification, context); handleArtifacts(process.artifacts, context); // log process handled handled(process); } function handleUnhandledProcesses(rootElements, ctx) { // walk through all processes that have not yet been drawn and draw them // if they contain lanes with DI information. // we do this to pass the free-floating lane test cases in the MIWG test suite var processes = Object(external_min_dash_["filter"])(rootElements, function (e) { return !isHandled(e) && is(e, 'bpmn:Process') && e.laneSets; }); processes.forEach(contextual(handleProcess, ctx)); } function handleMessageFlow(messageFlow, context) { visitIfDi(messageFlow, context); } function handleMessageFlows(messageFlows, context) { Object(external_min_dash_["forEach"])(messageFlows, contextual(handleMessageFlow, context)); } function handleDataAssociation(association, context) { visitIfDi(association, context); } function handleDataInput(dataInput, context) { visitIfDi(dataInput, context); } function handleDataOutput(dataOutput, context) { visitIfDi(dataOutput, context); } function handleArtifact(artifact, context) {