camunda-bpmn-js 5.6.0 → 5.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40735,6 +40735,7 @@
40735
40735
 
40736
40736
  if (
40737
40737
  !is$5(newShape, 'bpmn:SubProcess') ||
40738
+ is$5(newShape,'bpmn:AdHocSubProcess') ||
40738
40739
  ! (is$5(oldShape, 'bpmn:Task') || is$5(oldShape, 'bpmn:CallActivity')) ||
40739
40740
  !isExpanded$1(newShape)
40740
40741
  ) {
@@ -46255,6 +46256,7 @@
46255
46256
 
46256
46257
  /**
46257
46258
  * @typedef {import('didi').Injector} Injector
46259
+ * @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
46258
46260
  *
46259
46261
  * @typedef {import('../../model/Types').Shape} Shape
46260
46262
  *
@@ -46264,13 +46266,17 @@
46264
46266
 
46265
46267
  /**
46266
46268
  * @param {Injector} injector
46269
+ * @param {Canvas} canvas
46267
46270
  */
46268
- function BpmnSpaceTool(injector) {
46271
+ function BpmnSpaceTool(injector, canvas) {
46269
46272
  injector.invoke(SpaceTool, this);
46273
+
46274
+ this._canvas = canvas;
46270
46275
  }
46271
46276
 
46272
46277
  BpmnSpaceTool.$inject = [
46273
- 'injector'
46278
+ 'injector',
46279
+ 'canvas'
46274
46280
  ];
46275
46281
 
46276
46282
  e$7(BpmnSpaceTool, SpaceTool);
@@ -46284,7 +46290,26 @@
46284
46290
  * @return {Object}
46285
46291
  */
46286
46292
  BpmnSpaceTool.prototype.calculateAdjustments = function(elements, axis, delta, start) {
46287
- var adjustments = SpaceTool.prototype.calculateAdjustments.call(this, elements, axis, delta, start);
46293
+
46294
+ var canvasRoot = this._canvas.getRootElement(),
46295
+ spaceRoot = elements[0] === canvasRoot ? null : elements[0],
46296
+ enclosedArtifacts = [];
46297
+
46298
+ // ensure
46299
+ if (spaceRoot) {
46300
+ enclosedArtifacts = values(
46301
+ getEnclosedElements(
46302
+ canvasRoot.children.filter(
46303
+ (child) => is$5(child, 'bpmn:Artifact')
46304
+ ),
46305
+ getBBox(spaceRoot)
46306
+ )
46307
+ );
46308
+ }
46309
+
46310
+ const elementsToMove = [ ...elements, ...enclosedArtifacts ];
46311
+
46312
+ var adjustments = SpaceTool.prototype.calculateAdjustments.call(this, elementsToMove, axis, delta, start);
46288
46313
 
46289
46314
  // do not resize:
46290
46315
  //
@@ -61627,6 +61652,7 @@
61627
61652
  */
61628
61653
 
61629
61654
  var COLLAB_ERR_MSG = 'flow elements must be children of pools/participants';
61655
+ var DATA_OBJECT_ERR_MSG = 'Data object must be placed within a pool/participant.';
61630
61656
 
61631
61657
  /**
61632
61658
  * @param {EventBus} eventBus
@@ -61652,8 +61678,12 @@
61652
61678
  shape = context.shape,
61653
61679
  target = context.target;
61654
61680
 
61655
- if (is$5(target, 'bpmn:Collaboration') && is$5(shape, 'bpmn:FlowNode')) {
61656
- showError(event, translate(COLLAB_ERR_MSG));
61681
+ if (is$5(target, 'bpmn:Collaboration')) {
61682
+ if (is$5(shape, 'bpmn:FlowNode')) {
61683
+ showError(event, translate(COLLAB_ERR_MSG));
61684
+ } else if (is$5(shape, 'bpmn:DataObjectReference')) {
61685
+ showError(event, translate(DATA_OBJECT_ERR_MSG));
61686
+ }
61657
61687
  }
61658
61688
  });
61659
61689
 
@@ -99503,19 +99533,19 @@
99503
99533
  errors: {}
99504
99534
  });
99505
99535
 
99506
- /**
99507
- * @typedef {Function} <propertiesPanel.showEntry> callback
99508
- *
99509
- * @example
99510
- *
99511
- * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
99512
- * // ...
99513
- * });
99514
- *
99515
- * @param {Object} context
99516
- * @param {boolean} [context.focus]
99517
- *
99518
- * @returns void
99536
+ /**
99537
+ * @typedef {Function} <propertiesPanel.showEntry> callback
99538
+ *
99539
+ * @example
99540
+ *
99541
+ * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
99542
+ * // ...
99543
+ * });
99544
+ *
99545
+ * @param {Object} context
99546
+ * @param {boolean} [context.focus]
99547
+ *
99548
+ * @returns void
99519
99549
  */
99520
99550
 
99521
99551
  const EventContext = F$2({
@@ -99534,20 +99564,20 @@
99534
99564
  getTooltipForId: () => {}
99535
99565
  });
99536
99566
 
99537
- /**
99538
- * Accesses the global TooltipContext and returns a tooltip for a given id and element.
99539
- *
99540
- * @example
99541
- * ```jsx
99542
- * function TextField(props) {
99543
- * const tooltip = useTooltipContext('input1', element);
99544
- * }
99545
- * ```
99546
- *
99547
- * @param {string} id
99548
- * @param {object} element
99549
- *
99550
- * @returns {string}
99567
+ /**
99568
+ * Accesses the global TooltipContext and returns a tooltip for a given id and element.
99569
+ *
99570
+ * @example
99571
+ * ```jsx
99572
+ * function TextField(props) {
99573
+ * const tooltip = useTooltipContext('input1', element);
99574
+ * }
99575
+ * ```
99576
+ *
99577
+ * @param {string} id
99578
+ * @param {object} element
99579
+ *
99580
+ * @returns {string}
99551
99581
  */
99552
99582
  function useTooltipContext(id, element) {
99553
99583
  const {
@@ -99569,7 +99599,7 @@
99569
99599
  return u(Tooltip, {
99570
99600
  ...props,
99571
99601
  value: value,
99572
- forId: prefixId$9(forId)
99602
+ forId: `bio-properties-panel-${forId}`
99573
99603
  });
99574
99604
  }
99575
99605
  function Tooltip(props) {
@@ -99580,71 +99610,52 @@
99580
99610
  direction = 'right',
99581
99611
  position
99582
99612
  } = props;
99583
- const [visible, setShow] = h(false);
99584
- const [focusedViaKeyboard, setFocusedViaKeyboard] = h(false);
99613
+ const [visible, setVisible] = h(false);
99614
+
99615
+ // Tooltip will be shown after SHOW_DELAY ms from hovering over the source element.
99616
+ const SHOW_DELAY = 200;
99585
99617
  let timeout = null;
99586
99618
  const wrapperRef = _(null);
99587
99619
  const tooltipRef = _(null);
99588
- const showTooltip = async event => {
99589
- const show = () => setShow(true);
99590
- if (!visible && !timeout) {
99591
- if (event instanceof MouseEvent) {
99592
- timeout = setTimeout(show, 200);
99593
- } else {
99594
- show();
99595
- setFocusedViaKeyboard(true);
99596
- }
99620
+ const show = (_, delay) => {
99621
+ if (visible) return;
99622
+ if (delay) {
99623
+ timeout = setTimeout(() => {
99624
+ setVisible(true);
99625
+ }, SHOW_DELAY);
99626
+ } else {
99627
+ setVisible(true);
99597
99628
  }
99598
99629
  };
99599
- const hideTooltip = () => {
99600
- setShow(false);
99601
- setFocusedViaKeyboard(false);
99602
- };
99603
- const hideTooltipViaEscape = e => {
99604
- e.code === 'Escape' && hideTooltip();
99630
+ const hide = () => {
99631
+ clearTimeout(timeout);
99632
+ setVisible(false);
99605
99633
  };
99606
- const isTooltipHovered = ({
99607
- x,
99608
- y
99634
+ const handleMouseLeave = ({
99635
+ relatedTarget
99609
99636
  }) => {
99610
- const tooltip = tooltipRef.current;
99611
- const wrapper = wrapperRef.current;
99612
- return tooltip && (inBounds(x, y, wrapper.getBoundingClientRect()) || inBounds(x, y, tooltip.getBoundingClientRect()));
99637
+ // Don't hide the tooltip when moving mouse between the wrapper and the tooltip.
99638
+ if (relatedTarget === wrapperRef.current || relatedTarget === tooltipRef.current || relatedTarget?.parentElement === tooltipRef.current) {
99639
+ return;
99640
+ }
99641
+ hide();
99613
99642
  };
99614
- p$1(() => {
99643
+ const handleFocusOut = e => {
99615
99644
  const {
99616
- current
99617
- } = wrapperRef;
99618
- if (!current) {
99645
+ target
99646
+ } = e;
99647
+
99648
+ // Don't hide the tooltip if the wrapper or the tooltip itself is clicked.
99649
+ const isHovered = target.matches(':hover') || tooltipRef.current?.matches(':hover');
99650
+ if (target === wrapperRef.current && isHovered) {
99651
+ e.stopPropagation();
99619
99652
  return;
99620
99653
  }
99621
- const hideHoveredTooltip = e => {
99622
- const isFocused = document.activeElement === wrapperRef.current || document.activeElement.closest('.bio-properties-panel-tooltip');
99623
- if (visible && !isTooltipHovered({
99624
- x: e.x,
99625
- y: e.y
99626
- }) && !(isFocused && focusedViaKeyboard)) {
99627
- hideTooltip();
99628
- }
99629
- };
99630
- const hideFocusedTooltip = e => {
99631
- const {
99632
- relatedTarget
99633
- } = e;
99634
- const isTooltipChild = el => !!el.closest('.bio-properties-panel-tooltip');
99635
- if (visible && !isHovered(wrapperRef.current) && relatedTarget && !isTooltipChild(relatedTarget)) {
99636
- hideTooltip();
99637
- }
99638
- };
99639
- document.addEventListener('wheel', hideHoveredTooltip);
99640
- document.addEventListener('focusout', hideFocusedTooltip);
99641
- document.addEventListener('mousemove', hideHoveredTooltip);
99642
- return () => {
99643
- document.removeEventListener('wheel', hideHoveredTooltip);
99644
- document.removeEventListener('mousemove', hideHoveredTooltip);
99645
- document.removeEventListener('focusout', hideFocusedTooltip);
99646
- };
99647
- }, [wrapperRef.current, visible, focusedViaKeyboard]);
99654
+ hide();
99655
+ };
99656
+ const hideTooltipViaEscape = e => {
99657
+ e.code === 'Escape' && hide();
99658
+ };
99648
99659
  const renderTooltip = () => {
99649
99660
  return u("div", {
99650
99661
  class: `bio-properties-panel-tooltip ${direction}`,
@@ -99654,6 +99665,7 @@
99654
99665
  style: position || getTooltipPosition(wrapperRef.current),
99655
99666
  ref: tooltipRef,
99656
99667
  onClick: e => e.stopPropagation(),
99668
+ onMouseLeave: handleMouseLeave,
99657
99669
  children: [u("div", {
99658
99670
  class: "bio-properties-panel-tooltip-content",
99659
99671
  children: value
@@ -99666,54 +99678,38 @@
99666
99678
  class: "bio-properties-panel-tooltip-wrapper",
99667
99679
  tabIndex: "0",
99668
99680
  ref: wrapperRef,
99669
- onMouseEnter: showTooltip,
99670
- onMouseLeave: () => {
99671
- clearTimeout(timeout);
99672
- timeout = null;
99673
- },
99674
- onFocus: showTooltip,
99681
+ onMouseEnter: e => show(e, true),
99682
+ onMouseLeave: handleMouseLeave,
99683
+ onFocus: show,
99684
+ onBlur: handleFocusOut,
99675
99685
  onKeyDown: hideTooltipViaEscape,
99676
99686
  children: [props.children, visible ? parent ? j(renderTooltip(), parent.current) : renderTooltip() : null]
99677
99687
  });
99678
99688
  }
99679
99689
 
99680
99690
  // helper
99681
- function inBounds(x, y, bounds) {
99682
- const {
99683
- top,
99684
- right,
99685
- bottom,
99686
- left
99687
- } = bounds;
99688
- return x >= left && x <= right && y >= top && y <= bottom;
99689
- }
99691
+
99690
99692
  function getTooltipPosition(refElement) {
99691
99693
  const refPosition = refElement.getBoundingClientRect();
99692
99694
  const right = `calc(100% - ${refPosition.x}px)`;
99693
99695
  const top = `${refPosition.top - 10}px`;
99694
99696
  return `right: ${right}; top: ${top};`;
99695
99697
  }
99696
- function isHovered(element) {
99697
- return element.matches(':hover');
99698
- }
99699
- function prefixId$9(id) {
99700
- return `bio-properties-panel-${id}`;
99701
- }
99702
99698
 
99703
- /**
99704
- * Accesses the global DescriptionContext and returns a description for a given id and element.
99705
- *
99706
- * @example
99707
- * ```jsx
99708
- * function TextField(props) {
99709
- * const description = useDescriptionContext('input1', element);
99710
- * }
99711
- * ```
99712
- *
99713
- * @param {string} id
99714
- * @param {object} element
99715
- *
99716
- * @returns {string}
99699
+ /**
99700
+ * Accesses the global DescriptionContext and returns a description for a given id and element.
99701
+ *
99702
+ * @example
99703
+ * ```jsx
99704
+ * function TextField(props) {
99705
+ * const description = useDescriptionContext('input1', element);
99706
+ * }
99707
+ * ```
99708
+ *
99709
+ * @param {string} id
99710
+ * @param {object} element
99711
+ *
99712
+ * @returns {string}
99717
99713
  */
99718
99714
  function useDescriptionContext(id, element) {
99719
99715
  const {
@@ -99735,11 +99731,11 @@
99735
99731
  return errors;
99736
99732
  }
99737
99733
 
99738
- /**
99739
- * Subscribe to an event immediately. Update subscription after inputs changed.
99740
- *
99741
- * @param {string} event
99742
- * @param {Function} callback
99734
+ /**
99735
+ * Subscribe to an event immediately. Update subscription after inputs changed.
99736
+ *
99737
+ * @param {string} event
99738
+ * @param {Function} callback
99743
99739
  */
99744
99740
  function useEvent(event, callback, eventBus) {
99745
99741
  const eventContext = q$1(EventContext);
@@ -99771,24 +99767,24 @@
99771
99767
 
99772
99768
  const KEY_LENGTH = 6;
99773
99769
 
99774
- /**
99775
- * Create a persistent key factory for plain objects without id.
99776
- *
99777
- * @example
99778
- * ```jsx
99779
- * function List({ objects }) {
99780
- * const getKey = useKeyFactory();
99781
- * return (<ol>{
99782
- * objects.map(obj => {
99783
- * const key = getKey(obj);
99784
- * return <li key={key}>obj.name</li>
99785
- * })
99786
- * }</ol>);
99787
- * }
99788
- * ```
99789
- *
99790
- * @param {any[]} dependencies
99791
- * @returns {(element: object) => string}
99770
+ /**
99771
+ * Create a persistent key factory for plain objects without id.
99772
+ *
99773
+ * @example
99774
+ * ```jsx
99775
+ * function List({ objects }) {
99776
+ * const getKey = useKeyFactory();
99777
+ * return (<ol>{
99778
+ * objects.map(obj => {
99779
+ * const key = getKey(obj);
99780
+ * return <li key={key}>obj.name</li>
99781
+ * })
99782
+ * }</ol>);
99783
+ * }
99784
+ * ```
99785
+ *
99786
+ * @param {any[]} dependencies
99787
+ * @returns {(element: object) => string}
99792
99788
  */
99793
99789
  function useKeyFactory(dependencies = []) {
99794
99790
  const map = F$1(() => new Map(), dependencies);
@@ -99803,20 +99799,20 @@
99803
99799
  return getKey;
99804
99800
  }
99805
99801
 
99806
- /**
99807
- * Creates a state that persists in the global LayoutContext.
99808
- *
99809
- * @example
99810
- * ```jsx
99811
- * function Group(props) {
99812
- * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
99813
- * }
99814
- * ```
99815
- *
99816
- * @param {(string|number)[]} path
99817
- * @param {any} [defaultValue]
99818
- *
99819
- * @returns {[ any, Function ]}
99802
+ /**
99803
+ * Creates a state that persists in the global LayoutContext.
99804
+ *
99805
+ * @example
99806
+ * ```jsx
99807
+ * function Group(props) {
99808
+ * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
99809
+ * }
99810
+ * ```
99811
+ *
99812
+ * @param {(string|number)[]} path
99813
+ * @param {any} [defaultValue]
99814
+ *
99815
+ * @returns {[ any, Function ]}
99820
99816
  */
99821
99817
  function useLayoutState(path, defaultValue) {
99822
99818
  const {
@@ -99830,11 +99826,11 @@
99830
99826
  return [layoutForKey, setState];
99831
99827
  }
99832
99828
 
99833
- /**
99834
- * @pinussilvestrus: we need to introduce our own hook to persist the previous
99835
- * state on updates.
99836
- *
99837
- * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
99829
+ /**
99830
+ * @pinussilvestrus: we need to introduce our own hook to persist the previous
99831
+ * state on updates.
99832
+ *
99833
+ * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
99838
99834
  */
99839
99835
 
99840
99836
  function usePrevious(value) {
@@ -99845,12 +99841,12 @@
99845
99841
  return ref.current;
99846
99842
  }
99847
99843
 
99848
- /**
99849
- * Subscribe to `propertiesPanel.showEntry`.
99850
- *
99851
- * @param {string} id
99852
- *
99853
- * @returns {import('preact').Ref}
99844
+ /**
99845
+ * Subscribe to `propertiesPanel.showEntry`.
99846
+ *
99847
+ * @param {string} id
99848
+ *
99849
+ * @returns {import('preact').Ref}
99854
99850
  */
99855
99851
  function useShowEntryEvent(id) {
99856
99852
  const {
@@ -99881,20 +99877,20 @@
99881
99877
  return ref;
99882
99878
  }
99883
99879
 
99884
- /**
99885
- * @callback setSticky
99886
- * @param {boolean} value
99880
+ /**
99881
+ * @callback setSticky
99882
+ * @param {boolean} value
99887
99883
  */
99888
99884
 
99889
- /**
99890
- * Use IntersectionObserver to identify when DOM element is in sticky mode.
99891
- * If sticky is observered setSticky(true) will be called.
99892
- * If sticky mode is left, setSticky(false) will be called.
99893
- *
99894
- *
99895
- * @param {Object} ref
99896
- * @param {string} scrollContainerSelector
99897
- * @param {setSticky} setSticky
99885
+ /**
99886
+ * Use IntersectionObserver to identify when DOM element is in sticky mode.
99887
+ * If sticky is observered setSticky(true) will be called.
99888
+ * If sticky mode is left, setSticky(false) will be called.
99889
+ *
99890
+ *
99891
+ * @param {Object} ref
99892
+ * @param {string} scrollContainerSelector
99893
+ * @param {setSticky} setSticky
99898
99894
  */
99899
99895
  function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky) {
99900
99896
  const [scrollContainer, setScrollContainer] = h(query$1(scrollContainerSelector));
@@ -99948,19 +99944,19 @@
99948
99944
  }, [ref.current, scrollContainer, setSticky]);
99949
99945
  }
99950
99946
 
99951
- /**
99952
- * Creates a static function reference with changing body.
99953
- * This is necessary when external libraries require a callback function
99954
- * that has references to state variables.
99955
- *
99956
- * Usage:
99957
- * const callback = useStaticCallback((val) => {val === currentState});
99958
- *
99959
- * The `callback` reference is static and can be safely used in external
99960
- * libraries or as a prop that does not cause rerendering of children.
99961
- *
99962
- * @param {Function} callback function with changing reference
99963
- * @returns {Function} static function reference
99947
+ /**
99948
+ * Creates a static function reference with changing body.
99949
+ * This is necessary when external libraries require a callback function
99950
+ * that has references to state variables.
99951
+ *
99952
+ * Usage:
99953
+ * const callback = useStaticCallback((val) => {val === currentState});
99954
+ *
99955
+ * The `callback` reference is static and can be safely used in external
99956
+ * libraries or as a prop that does not cause rerendering of children.
99957
+ *
99958
+ * @param {Function} callback function with changing reference
99959
+ * @returns {Function} static function reference
99964
99960
  */
99965
99961
  function useStaticCallback(callback) {
99966
99962
  const callbackRef = _(callback);
@@ -100103,13 +100099,13 @@
100103
100099
  return null;
100104
100100
  }
100105
100101
 
100106
- /**
100107
- * @typedef { {
100108
- * text: (element: object) => string,
100109
- * icon?: (element: Object) => import('preact').Component
100110
- * } } PlaceholderDefinition
100111
- *
100112
- * @param { PlaceholderDefinition } props
100102
+ /**
100103
+ * @typedef { {
100104
+ * text: (element: object) => string,
100105
+ * icon?: (element: Object) => import('preact').Component
100106
+ * } } PlaceholderDefinition
100107
+ *
100108
+ * @param { PlaceholderDefinition } props
100113
100109
  */
100114
100110
  function Placeholder(props) {
100115
100111
  const {
@@ -100148,9 +100144,9 @@
100148
100144
 
100149
100145
  const noop$6 = () => {};
100150
100146
 
100151
- /**
100152
- * Buffer `.focus()` calls while the editor is not initialized.
100153
- * Set Focus inside when the editor is ready.
100147
+ /**
100148
+ * Buffer `.focus()` calls while the editor is not initialized.
100149
+ * Set Focus inside when the editor is ready.
100154
100150
  */
100155
100151
  const useBufferedFocus$1 = function (editor, ref) {
100156
100152
  const [buffer, setBuffer] = h(undefined);
@@ -100251,9 +100247,9 @@
100251
100247
 
100252
100248
  const noop$5 = () => {};
100253
100249
 
100254
- /**
100255
- * Buffer `.focus()` calls while the editor is not initialized.
100256
- * Set Focus inside when the editor is ready.
100250
+ /**
100251
+ * Buffer `.focus()` calls while the editor is not initialized.
100252
+ * Set Focus inside when the editor is ready.
100257
100253
  */
100258
100254
  const useBufferedFocus = function (editor, ref) {
100259
100255
  const [buffer, setBuffer] = h(undefined);
@@ -100302,10 +100298,10 @@
100302
100298
  p$1(() => {
100303
100299
  let editor;
100304
100300
 
100305
- /* Trigger FEEL toggle when
100306
- *
100307
- * - `backspace` is pressed
100308
- * - AND the cursor is at the beginning of the input
100301
+ /* Trigger FEEL toggle when
100302
+ *
100303
+ * - `backspace` is pressed
100304
+ * - AND the cursor is at the beginning of the input
100309
100305
  */
100310
100306
  const onKeyDown = e => {
100311
100307
  if (e.key !== 'Backspace' || !editor) {
@@ -100387,22 +100383,22 @@
100387
100383
  source: null
100388
100384
  });
100389
100385
 
100390
- /**
100391
- * Add a dragger that calls back the passed function with
100392
- * { event, delta } on drag.
100393
- *
100394
- * @example
100395
- *
100396
- * function dragMove(event, delta) {
100397
- * // we are dragging (!!)
100398
- * }
100399
- *
100400
- * domElement.addEventListener('dragstart', dragger(dragMove));
100401
- *
100402
- * @param {Function} fn
100403
- * @param {Element} [dragPreview]
100404
- *
100405
- * @return {Function} drag start callback function
100386
+ /**
100387
+ * Add a dragger that calls back the passed function with
100388
+ * { event, delta } on drag.
100389
+ *
100390
+ * @example
100391
+ *
100392
+ * function dragMove(event, delta) {
100393
+ * // we are dragging (!!)
100394
+ * }
100395
+ *
100396
+ * domElement.addEventListener('dragstart', dragger(dragMove));
100397
+ *
100398
+ * @param {Function} fn
100399
+ * @param {Element} [dragPreview]
100400
+ *
100401
+ * @return {Function} drag start callback function
100406
100402
  */
100407
100403
  function createDragger(fn, dragPreview) {
100408
100404
  let self;
@@ -100457,23 +100453,23 @@
100457
100453
 
100458
100454
  const noop$3 = () => {};
100459
100455
 
100460
- /**
100461
- * A generic popup component.
100462
- *
100463
- * @param {Object} props
100464
- * @param {HTMLElement} [props.container]
100465
- * @param {string} [props.className]
100466
- * @param {boolean} [props.delayInitialFocus]
100467
- * @param {{x: number, y: number}} [props.position]
100468
- * @param {number} [props.width]
100469
- * @param {number} [props.height]
100470
- * @param {Function} props.onClose
100471
- * @param {Function} [props.onPostActivate]
100472
- * @param {Function} [props.onPostDeactivate]
100473
- * @param {boolean} [props.returnFocus]
100474
- * @param {boolean} [props.closeOnEscape]
100475
- * @param {string} props.title
100476
- * @param {Ref} [ref]
100456
+ /**
100457
+ * A generic popup component.
100458
+ *
100459
+ * @param {Object} props
100460
+ * @param {HTMLElement} [props.container]
100461
+ * @param {string} [props.className]
100462
+ * @param {boolean} [props.delayInitialFocus]
100463
+ * @param {{x: number, y: number}} [props.position]
100464
+ * @param {number} [props.width]
100465
+ * @param {number} [props.height]
100466
+ * @param {Function} props.onClose
100467
+ * @param {Function} [props.onPostActivate]
100468
+ * @param {Function} [props.onPostDeactivate]
100469
+ * @param {boolean} [props.returnFocus]
100470
+ * @param {boolean} [props.closeOnEscape]
100471
+ * @param {string} props.title
100472
+ * @param {Ref} [ref]
100477
100473
  */
100478
100474
  function PopupComponent(props, globalRef) {
100479
100475
  const {
@@ -100692,12 +100688,12 @@
100692
100688
  const FEEL_POPUP_WIDTH = 700;
100693
100689
  const FEEL_POPUP_HEIGHT = 250;
100694
100690
 
100695
- /**
100696
- * FEEL popup component, built as a singleton. Emits lifecycle events as follows:
100697
- * - `feelPopup.open` - fired before the popup is mounted
100698
- * - `feelPopup.opened` - fired after the popup is mounted. Event context contains the DOM node of the popup
100699
- * - `feelPopup.close` - fired before the popup is unmounted. Event context contains the DOM node of the popup
100700
- * - `feelPopup.closed` - fired after the popup is unmounted
100691
+ /**
100692
+ * FEEL popup component, built as a singleton. Emits lifecycle events as follows:
100693
+ * - `feelPopup.open` - fired before the popup is mounted
100694
+ * - `feelPopup.opened` - fired after the popup is mounted. Event context contains the DOM node of the popup
100695
+ * - `feelPopup.close` - fired before the popup is unmounted. Event context contains the DOM node of the popup
100696
+ * - `feelPopup.closed` - fired after the popup is unmounted
100701
100697
  */
100702
100698
  function FEELPopupRoot(props) {
100703
100699
  const {
@@ -100923,11 +100919,11 @@
100923
100919
  return element.closest('.cm-editor').querySelector('.cm-tooltip-autocomplete');
100924
100920
  }
100925
100921
 
100926
- /**
100927
- * This hook behaves like useEffect, but does not trigger on the first render.
100928
- *
100929
- * @param {Function} effect
100930
- * @param {Array} deps
100922
+ /**
100923
+ * This hook behaves like useEffect, but does not trigger on the first render.
100924
+ *
100925
+ * @param {Function} effect
100926
+ * @param {Array} deps
100931
100927
  */
100932
100928
  function useUpdateEffect(effect, deps) {
100933
100929
  const isMounted = _(false);
@@ -101005,19 +101001,19 @@
101005
101001
  });
101006
101002
  }
101007
101003
 
101008
- /**
101009
- * @param {Object} props
101010
- * @param {Object} props.element
101011
- * @param {String} props.id
101012
- * @param {String} props.description
101013
- * @param {String} props.label
101014
- * @param {String} props.switcherLabel
101015
- * @param {Boolean} props.inline
101016
- * @param {Function} props.getValue
101017
- * @param {Function} props.setValue
101018
- * @param {Function} props.onFocus
101019
- * @param {Function} props.onBlur
101020
- * @param {string|import('preact').Component} props.tooltip
101004
+ /**
101005
+ * @param {Object} props
101006
+ * @param {Object} props.element
101007
+ * @param {String} props.id
101008
+ * @param {String} props.description
101009
+ * @param {String} props.label
101010
+ * @param {String} props.switcherLabel
101011
+ * @param {Boolean} props.inline
101012
+ * @param {Function} props.getValue
101013
+ * @param {Function} props.setValue
101014
+ * @param {Function} props.onFocus
101015
+ * @param {Function} props.onBlur
101016
+ * @param {string|import('preact').Component} props.tooltip
101021
101017
  */
101022
101018
  function ToggleSwitchEntry(props) {
101023
101019
  const {
@@ -101343,85 +101339,85 @@
101343
101339
  const DEFAULT_DESCRIPTION = {};
101344
101340
  const DEFAULT_TOOLTIP = {};
101345
101341
 
101346
- /**
101347
- * @typedef { {
101348
- * component: import('preact').Component,
101349
- * id: String,
101350
- * isEdited?: Function
101351
- * } } EntryDefinition
101352
- *
101353
- * @typedef { {
101354
- * autoFocusEntry: String,
101355
- * autoOpen?: Boolean,
101356
- * entries: Array<EntryDefinition>,
101357
- * id: String,
101358
- * label: String,
101359
- * remove: (event: MouseEvent) => void
101360
- * } } ListItemDefinition
101361
- *
101362
- * @typedef { {
101363
- * add: (event: MouseEvent) => void,
101364
- * component: import('preact').Component,
101365
- * element: Object,
101366
- * id: String,
101367
- * items: Array<ListItemDefinition>,
101368
- * label: String,
101369
- * shouldOpen?: Boolean
101370
- * } } ListGroupDefinition
101371
- *
101372
- * @typedef { {
101373
- * component?: import('preact').Component,
101374
- * entries: Array<EntryDefinition>,
101375
- * id: String,
101376
- * label: String,
101377
- * shouldOpen?: Boolean
101378
- * } } GroupDefinition
101379
- *
101380
- * @typedef { {
101381
- * [id: String]: GetDescriptionFunction
101382
- * } } DescriptionConfig
101383
- *
101384
- * @typedef { {
101385
- * [id: String]: GetTooltipFunction
101386
- * } } TooltipConfig
101387
- *
101388
- * @callback { {
101389
- * @param {string} id
101390
- * @param {Object} element
101391
- * @returns {string}
101392
- * } } GetDescriptionFunction
101393
- *
101394
- * @callback { {
101395
- * @param {string} id
101396
- * @param {Object} element
101397
- * @returns {string}
101398
- * } } GetTooltipFunction
101399
- *
101400
- * @typedef { {
101401
- * getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition,
101402
- * getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition
101403
- * } } PlaceholderProvider
101404
- *
101342
+ /**
101343
+ * @typedef { {
101344
+ * component: import('preact').Component,
101345
+ * id: String,
101346
+ * isEdited?: Function
101347
+ * } } EntryDefinition
101348
+ *
101349
+ * @typedef { {
101350
+ * autoFocusEntry: String,
101351
+ * autoOpen?: Boolean,
101352
+ * entries: Array<EntryDefinition>,
101353
+ * id: String,
101354
+ * label: String,
101355
+ * remove: (event: MouseEvent) => void
101356
+ * } } ListItemDefinition
101357
+ *
101358
+ * @typedef { {
101359
+ * add: (event: MouseEvent) => void,
101360
+ * component: import('preact').Component,
101361
+ * element: Object,
101362
+ * id: String,
101363
+ * items: Array<ListItemDefinition>,
101364
+ * label: String,
101365
+ * shouldOpen?: Boolean
101366
+ * } } ListGroupDefinition
101367
+ *
101368
+ * @typedef { {
101369
+ * component?: import('preact').Component,
101370
+ * entries: Array<EntryDefinition>,
101371
+ * id: String,
101372
+ * label: String,
101373
+ * shouldOpen?: Boolean
101374
+ * } } GroupDefinition
101375
+ *
101376
+ * @typedef { {
101377
+ * [id: String]: GetDescriptionFunction
101378
+ * } } DescriptionConfig
101379
+ *
101380
+ * @typedef { {
101381
+ * [id: String]: GetTooltipFunction
101382
+ * } } TooltipConfig
101383
+ *
101384
+ * @callback { {
101385
+ * @param {string} id
101386
+ * @param {Object} element
101387
+ * @returns {string}
101388
+ * } } GetDescriptionFunction
101389
+ *
101390
+ * @callback { {
101391
+ * @param {string} id
101392
+ * @param {Object} element
101393
+ * @returns {string}
101394
+ * } } GetTooltipFunction
101395
+ *
101396
+ * @typedef { {
101397
+ * getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition,
101398
+ * getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition
101399
+ * } } PlaceholderProvider
101400
+ *
101405
101401
  */
101406
101402
 
101407
- /**
101408
- * A basic properties panel component. Describes *how* content will be rendered, accepts
101409
- * data from implementor to describe *what* will be rendered.
101410
- *
101411
- * @param {Object} props
101412
- * @param {Object|Array} props.element
101413
- * @param {import('./components/Header').HeaderProvider} props.headerProvider
101414
- * @param {PlaceholderProvider} [props.placeholderProvider]
101415
- * @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
101416
- * @param {Object} [props.layoutConfig]
101417
- * @param {Function} [props.layoutChanged]
101418
- * @param {DescriptionConfig} [props.descriptionConfig]
101419
- * @param {Function} [props.descriptionLoaded]
101420
- * @param {TooltipConfig} [props.tooltipConfig]
101421
- * @param {Function} [props.tooltipLoaded]
101422
- * @param {HTMLElement} [props.feelPopupContainer]
101423
- * @param {Function} [props.getFeelPopupLinks]
101424
- * @param {Object} [props.eventBus]
101403
+ /**
101404
+ * A basic properties panel component. Describes *how* content will be rendered, accepts
101405
+ * data from implementor to describe *what* will be rendered.
101406
+ *
101407
+ * @param {Object} props
101408
+ * @param {Object|Array} props.element
101409
+ * @param {import('./components/Header').HeaderProvider} props.headerProvider
101410
+ * @param {PlaceholderProvider} [props.placeholderProvider]
101411
+ * @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
101412
+ * @param {Object} [props.layoutConfig]
101413
+ * @param {Function} [props.layoutChanged]
101414
+ * @param {DescriptionConfig} [props.descriptionConfig]
101415
+ * @param {Function} [props.descriptionLoaded]
101416
+ * @param {TooltipConfig} [props.tooltipConfig]
101417
+ * @param {Function} [props.tooltipLoaded]
101418
+ * @param {HTMLElement} [props.feelPopupContainer]
101419
+ * @param {Function} [props.getFeelPopupLinks]
101420
+ * @param {Object} [props.eventBus]
101425
101421
  */
101426
101422
  function PropertiesPanel(props) {
101427
101423
  const {
@@ -101594,11 +101590,11 @@
101594
101590
 
101595
101591
  // hooks //////////////////
101596
101592
 
101597
- /**
101598
- * This hook behaves like useLayoutEffect, but does not trigger on the first render.
101599
- *
101600
- * @param {Function} effect
101601
- * @param {Array} deps
101593
+ /**
101594
+ * This hook behaves like useLayoutEffect, but does not trigger on the first render.
101595
+ *
101596
+ * @param {Function} effect
101597
+ * @param {Array} deps
101602
101598
  */
101603
101599
  function useUpdateLayoutEffect(effect, deps) {
101604
101600
  const isMounted = _(false);
@@ -101673,15 +101669,15 @@
101673
101669
  });
101674
101670
  }
101675
101671
 
101676
- /**
101677
- *
101678
- * @param {Array<null | Element>} ignoredElements
101679
- * @param {Function} callback
101672
+ /**
101673
+ *
101674
+ * @param {Array<null | Element>} ignoredElements
101675
+ * @param {Function} callback
101680
101676
  */
101681
101677
  function useGlobalClick(ignoredElements, callback) {
101682
101678
  p$1(() => {
101683
- /**
101684
- * @param {MouseEvent} event
101679
+ /**
101680
+ * @param {MouseEvent} event
101685
101681
  */
101686
101682
  function listener(event) {
101687
101683
  if (ignoredElements.some(element => element && element.contains(event.target))) {
@@ -101714,20 +101710,20 @@
101714
101710
  });
101715
101711
  }
101716
101712
 
101717
- /**
101718
- * @typedef { {
101719
- * [key: string]: string;
101720
- * } } TranslateReplacements
101713
+ /**
101714
+ * @typedef { {
101715
+ * [key: string]: string;
101716
+ * } } TranslateReplacements
101721
101717
  */
101722
101718
 
101723
- /**
101724
- * A simple translation stub to be used for multi-language support.
101725
- * Can be easily replaced with a more sophisticated solution.
101726
- *
101727
- * @param {string} template to interpolate
101728
- * @param {TranslateReplacements} [replacements] a map with substitutes
101729
- *
101730
- * @return {string} the translated string
101719
+ /**
101720
+ * A simple translation stub to be used for multi-language support.
101721
+ * Can be easily replaced with a more sophisticated solution.
101722
+ *
101723
+ * @param {string} template to interpolate
101724
+ * @param {TranslateReplacements} [replacements] a map with substitutes
101725
+ *
101726
+ * @return {string} the translated string
101731
101727
  */
101732
101728
  function translateFallback(template, replacements) {
101733
101729
  replacements = replacements || {};
@@ -101839,8 +101835,8 @@
101839
101835
 
101840
101836
  const noop$1 = () => {};
101841
101837
 
101842
- /**
101843
- * @param {import('../PropertiesPanel').ListGroupDefinition} props
101838
+ /**
101839
+ * @param {import('../PropertiesPanel').ListGroupDefinition} props
101844
101840
  */
101845
101841
  function ListGroup(props) {
101846
101842
  const {
@@ -102032,18 +102028,18 @@
102032
102028
  });
102033
102029
  }
102034
102030
 
102035
- /**
102036
- * @param {Object} props
102037
- * @param {Object} props.element
102038
- * @param {String} props.id
102039
- * @param {String} props.description
102040
- * @param {String} props.label
102041
- * @param {Function} props.getValue
102042
- * @param {Function} props.setValue
102043
- * @param {Function} props.onFocus
102044
- * @param {Function} props.onBlur
102045
- * @param {string|import('preact').Component} props.tooltip
102046
- * @param {boolean} [props.disabled]
102031
+ /**
102032
+ * @param {Object} props
102033
+ * @param {Object} props.element
102034
+ * @param {String} props.id
102035
+ * @param {String} props.description
102036
+ * @param {String} props.label
102037
+ * @param {Function} props.getValue
102038
+ * @param {Function} props.setValue
102039
+ * @param {Function} props.onFocus
102040
+ * @param {Function} props.onBlur
102041
+ * @param {string|import('preact').Component} props.tooltip
102042
+ * @param {boolean} [props.disabled]
102047
102043
  */
102048
102044
  function CheckboxEntry(props) {
102049
102045
  const {
@@ -102117,8 +102113,8 @@
102117
102113
  }
102118
102114
  }, [open, hasItems]);
102119
102115
 
102120
- /**
102121
- * @param {MouseEvent} event
102116
+ /**
102117
+ * @param {MouseEvent} event
102122
102118
  */
102123
102119
  function addItem(event) {
102124
102120
  event.stopPropagation();
@@ -102310,20 +102306,20 @@
102310
102306
  });
102311
102307
  }
102312
102308
 
102313
- /**
102314
- * @param {object} props
102315
- * @param {object} props.element
102316
- * @param {string} props.id
102317
- * @param {string} [props.description]
102318
- * @param {string} props.label
102319
- * @param {Function} props.getValue
102320
- * @param {Function} props.setValue
102321
- * @param {Function} props.onFocus
102322
- * @param {Function} props.onBlur
102323
- * @param {Function} props.getOptions
102324
- * @param {boolean} [props.disabled]
102325
- * @param {Function} [props.validate]
102326
- * @param {string|import('preact').Component} props.tooltip
102309
+ /**
102310
+ * @param {object} props
102311
+ * @param {object} props.element
102312
+ * @param {string} props.id
102313
+ * @param {string} [props.description]
102314
+ * @param {string} props.label
102315
+ * @param {Function} props.getValue
102316
+ * @param {Function} props.setValue
102317
+ * @param {Function} props.onFocus
102318
+ * @param {Function} props.onBlur
102319
+ * @param {Function} props.getOptions
102320
+ * @param {boolean} [props.disabled]
102321
+ * @param {Function} [props.validate]
102322
+ * @param {string|import('preact').Component} props.tooltip
102327
102323
  */
102328
102324
  function SelectEntry(props) {
102329
102325
  const {
@@ -102641,7 +102637,7 @@
102641
102637
  return u("div", {
102642
102638
  class: "bio-properties-panel-textfield",
102643
102639
  children: [u("label", {
102644
- for: prefixId$a(id),
102640
+ for: prefixId$9(id),
102645
102641
  class: "bio-properties-panel-label",
102646
102642
  children: u(TooltipWrapper, {
102647
102643
  value: tooltip,
@@ -102651,7 +102647,7 @@
102651
102647
  })
102652
102648
  }), u("input", {
102653
102649
  ref: ref,
102654
- id: prefixId$a(id),
102650
+ id: prefixId$9(id),
102655
102651
  type: "text",
102656
102652
  name: id,
102657
102653
  spellCheck: "false",
@@ -102667,20 +102663,20 @@
102667
102663
  });
102668
102664
  }
102669
102665
 
102670
- /**
102671
- * @param {Object} props
102672
- * @param {Object} props.element
102673
- * @param {String} props.id
102674
- * @param {String} props.description
102675
- * @param {Boolean} props.debounce
102676
- * @param {Boolean} props.disabled
102677
- * @param {String} props.label
102678
- * @param {Function} props.getValue
102679
- * @param {Function} props.setValue
102680
- * @param {Function} props.onFocus
102681
- * @param {Function} props.onBlur
102682
- * @param {string|import('preact').Component} props.tooltip
102683
- * @param {Function} props.validate
102666
+ /**
102667
+ * @param {Object} props
102668
+ * @param {Object} props.element
102669
+ * @param {String} props.id
102670
+ * @param {String} props.description
102671
+ * @param {Boolean} props.debounce
102672
+ * @param {Boolean} props.disabled
102673
+ * @param {String} props.label
102674
+ * @param {Function} props.getValue
102675
+ * @param {Function} props.setValue
102676
+ * @param {Function} props.onFocus
102677
+ * @param {Function} props.onBlur
102678
+ * @param {string|import('preact').Component} props.tooltip
102679
+ * @param {Function} props.validate
102684
102680
  */
102685
102681
  function TextfieldEntry(props) {
102686
102682
  const {
@@ -102747,7 +102743,7 @@
102747
102743
 
102748
102744
  // helpers /////////////////
102749
102745
 
102750
- function prefixId$a(id) {
102746
+ function prefixId$9(id) {
102751
102747
  return `bio-properties-panel-${id}`;
102752
102748
  }
102753
102749
 
@@ -102773,20 +102769,20 @@
102773
102769
  this._eventBus = eventBus;
102774
102770
  }
102775
102771
 
102776
- /**
102777
- * Check if the FEEL popup is open.
102778
- * @return {Boolean}
102772
+ /**
102773
+ * Check if the FEEL popup is open.
102774
+ * @return {Boolean}
102779
102775
  */
102780
102776
  isOpen() {
102781
102777
  return this._eventBus.fire('feelPopup._isOpen');
102782
102778
  }
102783
102779
 
102784
- /**
102785
- * Open the FEEL popup.
102786
- *
102787
- * @param {String} entryId
102788
- * @param {Object} popupConfig
102789
- * @param {HTMLElement} sourceElement
102780
+ /**
102781
+ * Open the FEEL popup.
102782
+ *
102783
+ * @param {String} entryId
102784
+ * @param {Object} popupConfig
102785
+ * @param {HTMLElement} sourceElement
102790
102786
  */
102791
102787
  open(entryId, popupConfig, sourceElement) {
102792
102788
  return this._eventBus.fire('feelPopup._open', {
@@ -102796,8 +102792,8 @@
102796
102792
  });
102797
102793
  }
102798
102794
 
102799
- /**
102800
- * Close the FEEL popup.
102795
+ /**
102796
+ * Close the FEEL popup.
102801
102797
  */
102802
102798
  close() {
102803
102799
  return this._eventBus.fire('feelPopup._close');
@@ -121636,7 +121632,7 @@
121636
121632
  }
121637
121633
 
121638
121634
  // eslint-disable-next-line no-undef
121639
- const packageVersion = "2.5.2";
121635
+ const packageVersion = "2.5.3";
121640
121636
 
121641
121637
  /**
121642
121638
  * Registry for element templates.
@@ -122616,109 +122612,6 @@
122616
122612
  return bo;
122617
122613
  }
122618
122614
 
122619
- class RemoveElementTemplateHandler {
122620
- constructor(modeling, elementFactory, elementRegistry, canvas, bpmnFactory, replace, commandStack) {
122621
- this._modeling = modeling;
122622
- this._elementFactory = elementFactory;
122623
- this._elementRegistry = elementRegistry;
122624
- this._canvas = canvas;
122625
- this._bpmnFactory = bpmnFactory;
122626
- this._replace = replace;
122627
- this._commandStack = commandStack;
122628
- }
122629
- preExecute(context) {
122630
- const {
122631
- element
122632
- } = context;
122633
- if (element.parent) {
122634
- context.newElement = this._removeTemplate(element);
122635
- } else {
122636
- context.newElement = this._removeRootTemplate(element);
122637
- }
122638
- }
122639
- _removeTemplate(element) {
122640
- const replace = this._replace;
122641
- const businessObject = getBusinessObject$1(element);
122642
- const type = businessObject.$type,
122643
- eventDefinitionType = this._getEventDefinitionType(businessObject);
122644
- const newBusinessObject = this._createBlankBusinessObject(element);
122645
- return replace.replaceElement(element, {
122646
- type: type,
122647
- businessObject: newBusinessObject,
122648
- eventDefinitionType: eventDefinitionType
122649
- }, {
122650
- createElementsBehavior: false
122651
- });
122652
- }
122653
-
122654
- /**
122655
- * Remove template from a given element.
122656
- *
122657
- * @param {djs.model.Base} element
122658
- *
122659
- * @return {djs.model.Base} the updated element
122660
- */
122661
- _removeRootTemplate(element) {
122662
- var modeling = this._modeling,
122663
- elementFactory = this._elementFactory,
122664
- elementRegistry = this._elementRegistry,
122665
- canvas = this._canvas;
122666
-
122667
- // We are inside a collapsed subprocess, move up to the parent before replacing the collapsed object
122668
- if (isPlane$1(element)) {
122669
- const shapeId = getShapeIdFromPlane(element);
122670
- const shape = elementRegistry.get(shapeId);
122671
- if (shape && shape !== element) {
122672
- canvas.setRootElement(canvas.findRoot(shape));
122673
- return this._removeTemplate(shape);
122674
- }
122675
- }
122676
- const businessObject = getBusinessObject$1(element);
122677
- const type = businessObject.$type;
122678
- const newBusinessObject = this._createBlankBusinessObject(element);
122679
- const newRoot = elementFactory.create('root', {
122680
- type: type,
122681
- businessObject: newBusinessObject
122682
- });
122683
- this._commandStack.execute('canvas.updateRoot', {
122684
- newRoot: newRoot,
122685
- oldRoot: element
122686
- });
122687
- modeling.moveElements(element.children, {
122688
- x: 0,
122689
- y: 0
122690
- }, newRoot);
122691
- return newRoot;
122692
- }
122693
- _getEventDefinitionType(businessObject) {
122694
- if (!businessObject.eventDefinitions) {
122695
- return null;
122696
- }
122697
- const eventDefinition = businessObject.eventDefinitions[0];
122698
- if (!eventDefinition) {
122699
- return null;
122700
- }
122701
- return eventDefinition.$type;
122702
- }
122703
- _createBlankBusinessObject(element) {
122704
- const bpmnFactory = this._bpmnFactory;
122705
- const bo = getBusinessObject$1(element),
122706
- newBo = bpmnFactory.create(bo.$type),
122707
- label = getLabel(element);
122708
- if (!label) {
122709
- return newBo;
122710
- }
122711
- if (is$5(element, 'bpmn:Group')) {
122712
- newBo.categoryValueRef = bpmnFactory.create('bpmn:CategoryValue');
122713
- }
122714
- setLabel({
122715
- businessObject: newBo
122716
- }, label);
122717
- return newBo;
122718
- }
122719
- }
122720
- RemoveElementTemplateHandler.$inject = ['modeling', 'elementFactory', 'elementRegistry', 'canvas', 'bpmnFactory', 'replace', 'commandStack'];
122721
-
122722
122615
  /**
122723
122616
  * A handler that combines and executes multiple commands.
122724
122617
  *
@@ -126154,6 +126047,109 @@
126154
126047
  return array;
126155
126048
  }
126156
126049
 
126050
+ class RemoveElementTemplateHandler {
126051
+ constructor(modeling, elementFactory, elementRegistry, canvas, bpmnFactory, replace, commandStack) {
126052
+ this._modeling = modeling;
126053
+ this._elementFactory = elementFactory;
126054
+ this._elementRegistry = elementRegistry;
126055
+ this._canvas = canvas;
126056
+ this._bpmnFactory = bpmnFactory;
126057
+ this._replace = replace;
126058
+ this._commandStack = commandStack;
126059
+ }
126060
+ preExecute(context) {
126061
+ const {
126062
+ element
126063
+ } = context;
126064
+ if (element.parent) {
126065
+ context.newElement = this._removeTemplate(element);
126066
+ } else {
126067
+ context.newElement = this._removeRootTemplate(element);
126068
+ }
126069
+ }
126070
+ _removeTemplate(element) {
126071
+ const replace = this._replace;
126072
+ const businessObject = getBusinessObject$1(element);
126073
+ const type = businessObject.$type,
126074
+ eventDefinitionType = this._getEventDefinitionType(businessObject);
126075
+ const newBusinessObject = this._createBlankBusinessObject(element);
126076
+ return replace.replaceElement(element, {
126077
+ type: type,
126078
+ businessObject: newBusinessObject,
126079
+ eventDefinitionType: eventDefinitionType
126080
+ }, {
126081
+ createElementsBehavior: false
126082
+ });
126083
+ }
126084
+
126085
+ /**
126086
+ * Remove template from a given element.
126087
+ *
126088
+ * @param {djs.model.Base} element
126089
+ *
126090
+ * @return {djs.model.Base} the updated element
126091
+ */
126092
+ _removeRootTemplate(element) {
126093
+ var modeling = this._modeling,
126094
+ elementFactory = this._elementFactory,
126095
+ elementRegistry = this._elementRegistry,
126096
+ canvas = this._canvas;
126097
+
126098
+ // We are inside a collapsed subprocess, move up to the parent before replacing the collapsed object
126099
+ if (isPlane$1(element)) {
126100
+ const shapeId = getShapeIdFromPlane(element);
126101
+ const shape = elementRegistry.get(shapeId);
126102
+ if (shape && shape !== element) {
126103
+ canvas.setRootElement(canvas.findRoot(shape));
126104
+ return this._removeTemplate(shape);
126105
+ }
126106
+ }
126107
+ const businessObject = getBusinessObject$1(element);
126108
+ const type = businessObject.$type;
126109
+ const newBusinessObject = this._createBlankBusinessObject(element);
126110
+ const newRoot = elementFactory.create('root', {
126111
+ type: type,
126112
+ businessObject: newBusinessObject
126113
+ });
126114
+ this._commandStack.execute('canvas.updateRoot', {
126115
+ newRoot: newRoot,
126116
+ oldRoot: element
126117
+ });
126118
+ modeling.moveElements(element.children, {
126119
+ x: 0,
126120
+ y: 0
126121
+ }, newRoot);
126122
+ return newRoot;
126123
+ }
126124
+ _getEventDefinitionType(businessObject) {
126125
+ if (!businessObject.eventDefinitions) {
126126
+ return null;
126127
+ }
126128
+ const eventDefinition = businessObject.eventDefinitions[0];
126129
+ if (!eventDefinition) {
126130
+ return null;
126131
+ }
126132
+ return eventDefinition.$type;
126133
+ }
126134
+ _createBlankBusinessObject(element) {
126135
+ const bpmnFactory = this._bpmnFactory;
126136
+ const bo = getBusinessObject$1(element),
126137
+ newBo = bpmnFactory.create(bo.$type),
126138
+ label = getLabel(element);
126139
+ if (!label) {
126140
+ return newBo;
126141
+ }
126142
+ if (is$5(element, 'bpmn:Group')) {
126143
+ newBo.categoryValueRef = bpmnFactory.create('bpmn:CategoryValue');
126144
+ }
126145
+ setLabel({
126146
+ businessObject: newBo
126147
+ }, label);
126148
+ return newBo;
126149
+ }
126150
+ }
126151
+ RemoveElementTemplateHandler.$inject = ['modeling', 'elementFactory', 'elementRegistry', 'canvas', 'bpmnFactory', 'replace', 'commandStack'];
126152
+
126157
126153
  class ElementTemplatesCommands {
126158
126154
  constructor(commandStack, elementTemplates, eventBus) {
126159
126155
  commandStack.registerHandler('element-templates.multi-command-executor', MultiCommandHandler);