camunda-bpmn-js 5.6.0 → 5.6.1

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.
@@ -46255,6 +46255,7 @@
46255
46255
 
46256
46256
  /**
46257
46257
  * @typedef {import('didi').Injector} Injector
46258
+ * @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
46258
46259
  *
46259
46260
  * @typedef {import('../../model/Types').Shape} Shape
46260
46261
  *
@@ -46264,13 +46265,17 @@
46264
46265
 
46265
46266
  /**
46266
46267
  * @param {Injector} injector
46268
+ * @param {Canvas} canvas
46267
46269
  */
46268
- function BpmnSpaceTool(injector) {
46270
+ function BpmnSpaceTool(injector, canvas) {
46269
46271
  injector.invoke(SpaceTool, this);
46272
+
46273
+ this._canvas = canvas;
46270
46274
  }
46271
46275
 
46272
46276
  BpmnSpaceTool.$inject = [
46273
- 'injector'
46277
+ 'injector',
46278
+ 'canvas'
46274
46279
  ];
46275
46280
 
46276
46281
  e$7(BpmnSpaceTool, SpaceTool);
@@ -46284,7 +46289,26 @@
46284
46289
  * @return {Object}
46285
46290
  */
46286
46291
  BpmnSpaceTool.prototype.calculateAdjustments = function(elements, axis, delta, start) {
46287
- var adjustments = SpaceTool.prototype.calculateAdjustments.call(this, elements, axis, delta, start);
46292
+
46293
+ var canvasRoot = this._canvas.getRootElement(),
46294
+ spaceRoot = elements[0] === canvasRoot ? null : elements[0],
46295
+ enclosedArtifacts = [];
46296
+
46297
+ // ensure
46298
+ if (spaceRoot) {
46299
+ enclosedArtifacts = values(
46300
+ getEnclosedElements(
46301
+ canvasRoot.children.filter(
46302
+ (child) => is$5(child, 'bpmn:Artifact')
46303
+ ),
46304
+ getBBox(spaceRoot)
46305
+ )
46306
+ );
46307
+ }
46308
+
46309
+ const elementsToMove = [ ...elements, ...enclosedArtifacts ];
46310
+
46311
+ var adjustments = SpaceTool.prototype.calculateAdjustments.call(this, elementsToMove, axis, delta, start);
46288
46312
 
46289
46313
  // do not resize:
46290
46314
  //
@@ -99503,19 +99527,19 @@
99503
99527
  errors: {}
99504
99528
  });
99505
99529
 
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
99530
+ /**
99531
+ * @typedef {Function} <propertiesPanel.showEntry> callback
99532
+ *
99533
+ * @example
99534
+ *
99535
+ * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
99536
+ * // ...
99537
+ * });
99538
+ *
99539
+ * @param {Object} context
99540
+ * @param {boolean} [context.focus]
99541
+ *
99542
+ * @returns void
99519
99543
  */
99520
99544
 
99521
99545
  const EventContext = F$2({
@@ -99534,20 +99558,20 @@
99534
99558
  getTooltipForId: () => {}
99535
99559
  });
99536
99560
 
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}
99561
+ /**
99562
+ * Accesses the global TooltipContext and returns a tooltip for a given id and element.
99563
+ *
99564
+ * @example
99565
+ * ```jsx
99566
+ * function TextField(props) {
99567
+ * const tooltip = useTooltipContext('input1', element);
99568
+ * }
99569
+ * ```
99570
+ *
99571
+ * @param {string} id
99572
+ * @param {object} element
99573
+ *
99574
+ * @returns {string}
99551
99575
  */
99552
99576
  function useTooltipContext(id, element) {
99553
99577
  const {
@@ -99569,7 +99593,7 @@
99569
99593
  return u(Tooltip, {
99570
99594
  ...props,
99571
99595
  value: value,
99572
- forId: prefixId$9(forId)
99596
+ forId: `bio-properties-panel-${forId}`
99573
99597
  });
99574
99598
  }
99575
99599
  function Tooltip(props) {
@@ -99580,71 +99604,52 @@
99580
99604
  direction = 'right',
99581
99605
  position
99582
99606
  } = props;
99583
- const [visible, setShow] = h(false);
99584
- const [focusedViaKeyboard, setFocusedViaKeyboard] = h(false);
99607
+ const [visible, setVisible] = h(false);
99608
+
99609
+ // Tooltip will be shown after SHOW_DELAY ms from hovering over the source element.
99610
+ const SHOW_DELAY = 200;
99585
99611
  let timeout = null;
99586
99612
  const wrapperRef = _(null);
99587
99613
  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
- }
99614
+ const show = (_, delay) => {
99615
+ if (visible) return;
99616
+ if (delay) {
99617
+ timeout = setTimeout(() => {
99618
+ setVisible(true);
99619
+ }, SHOW_DELAY);
99620
+ } else {
99621
+ setVisible(true);
99597
99622
  }
99598
99623
  };
99599
- const hideTooltip = () => {
99600
- setShow(false);
99601
- setFocusedViaKeyboard(false);
99602
- };
99603
- const hideTooltipViaEscape = e => {
99604
- e.code === 'Escape' && hideTooltip();
99624
+ const hide = () => {
99625
+ clearTimeout(timeout);
99626
+ setVisible(false);
99605
99627
  };
99606
- const isTooltipHovered = ({
99607
- x,
99608
- y
99628
+ const handleMouseLeave = ({
99629
+ relatedTarget
99609
99630
  }) => {
99610
- const tooltip = tooltipRef.current;
99611
- const wrapper = wrapperRef.current;
99612
- return tooltip && (inBounds(x, y, wrapper.getBoundingClientRect()) || inBounds(x, y, tooltip.getBoundingClientRect()));
99631
+ // Don't hide the tooltip when moving mouse between the wrapper and the tooltip.
99632
+ if (relatedTarget === wrapperRef.current || relatedTarget === tooltipRef.current || relatedTarget?.parentElement === tooltipRef.current) {
99633
+ return;
99634
+ }
99635
+ hide();
99613
99636
  };
99614
- p$1(() => {
99637
+ const handleFocusOut = e => {
99615
99638
  const {
99616
- current
99617
- } = wrapperRef;
99618
- if (!current) {
99639
+ target
99640
+ } = e;
99641
+
99642
+ // Don't hide the tooltip if the wrapper or the tooltip itself is clicked.
99643
+ const isHovered = target.matches(':hover') || tooltipRef.current?.matches(':hover');
99644
+ if (target === wrapperRef.current && isHovered) {
99645
+ e.stopPropagation();
99619
99646
  return;
99620
99647
  }
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]);
99648
+ hide();
99649
+ };
99650
+ const hideTooltipViaEscape = e => {
99651
+ e.code === 'Escape' && hide();
99652
+ };
99648
99653
  const renderTooltip = () => {
99649
99654
  return u("div", {
99650
99655
  class: `bio-properties-panel-tooltip ${direction}`,
@@ -99654,6 +99659,7 @@
99654
99659
  style: position || getTooltipPosition(wrapperRef.current),
99655
99660
  ref: tooltipRef,
99656
99661
  onClick: e => e.stopPropagation(),
99662
+ onMouseLeave: handleMouseLeave,
99657
99663
  children: [u("div", {
99658
99664
  class: "bio-properties-panel-tooltip-content",
99659
99665
  children: value
@@ -99666,54 +99672,38 @@
99666
99672
  class: "bio-properties-panel-tooltip-wrapper",
99667
99673
  tabIndex: "0",
99668
99674
  ref: wrapperRef,
99669
- onMouseEnter: showTooltip,
99670
- onMouseLeave: () => {
99671
- clearTimeout(timeout);
99672
- timeout = null;
99673
- },
99674
- onFocus: showTooltip,
99675
+ onMouseEnter: e => show(e, true),
99676
+ onMouseLeave: handleMouseLeave,
99677
+ onFocus: show,
99678
+ onBlur: handleFocusOut,
99675
99679
  onKeyDown: hideTooltipViaEscape,
99676
99680
  children: [props.children, visible ? parent ? j(renderTooltip(), parent.current) : renderTooltip() : null]
99677
99681
  });
99678
99682
  }
99679
99683
 
99680
99684
  // 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
- }
99685
+
99690
99686
  function getTooltipPosition(refElement) {
99691
99687
  const refPosition = refElement.getBoundingClientRect();
99692
99688
  const right = `calc(100% - ${refPosition.x}px)`;
99693
99689
  const top = `${refPosition.top - 10}px`;
99694
99690
  return `right: ${right}; top: ${top};`;
99695
99691
  }
99696
- function isHovered(element) {
99697
- return element.matches(':hover');
99698
- }
99699
- function prefixId$9(id) {
99700
- return `bio-properties-panel-${id}`;
99701
- }
99702
99692
 
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}
99693
+ /**
99694
+ * Accesses the global DescriptionContext and returns a description for a given id and element.
99695
+ *
99696
+ * @example
99697
+ * ```jsx
99698
+ * function TextField(props) {
99699
+ * const description = useDescriptionContext('input1', element);
99700
+ * }
99701
+ * ```
99702
+ *
99703
+ * @param {string} id
99704
+ * @param {object} element
99705
+ *
99706
+ * @returns {string}
99717
99707
  */
99718
99708
  function useDescriptionContext(id, element) {
99719
99709
  const {
@@ -99735,11 +99725,11 @@
99735
99725
  return errors;
99736
99726
  }
99737
99727
 
99738
- /**
99739
- * Subscribe to an event immediately. Update subscription after inputs changed.
99740
- *
99741
- * @param {string} event
99742
- * @param {Function} callback
99728
+ /**
99729
+ * Subscribe to an event immediately. Update subscription after inputs changed.
99730
+ *
99731
+ * @param {string} event
99732
+ * @param {Function} callback
99743
99733
  */
99744
99734
  function useEvent(event, callback, eventBus) {
99745
99735
  const eventContext = q$1(EventContext);
@@ -99771,24 +99761,24 @@
99771
99761
 
99772
99762
  const KEY_LENGTH = 6;
99773
99763
 
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}
99764
+ /**
99765
+ * Create a persistent key factory for plain objects without id.
99766
+ *
99767
+ * @example
99768
+ * ```jsx
99769
+ * function List({ objects }) {
99770
+ * const getKey = useKeyFactory();
99771
+ * return (<ol>{
99772
+ * objects.map(obj => {
99773
+ * const key = getKey(obj);
99774
+ * return <li key={key}>obj.name</li>
99775
+ * })
99776
+ * }</ol>);
99777
+ * }
99778
+ * ```
99779
+ *
99780
+ * @param {any[]} dependencies
99781
+ * @returns {(element: object) => string}
99792
99782
  */
99793
99783
  function useKeyFactory(dependencies = []) {
99794
99784
  const map = F$1(() => new Map(), dependencies);
@@ -99803,20 +99793,20 @@
99803
99793
  return getKey;
99804
99794
  }
99805
99795
 
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 ]}
99796
+ /**
99797
+ * Creates a state that persists in the global LayoutContext.
99798
+ *
99799
+ * @example
99800
+ * ```jsx
99801
+ * function Group(props) {
99802
+ * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
99803
+ * }
99804
+ * ```
99805
+ *
99806
+ * @param {(string|number)[]} path
99807
+ * @param {any} [defaultValue]
99808
+ *
99809
+ * @returns {[ any, Function ]}
99820
99810
  */
99821
99811
  function useLayoutState(path, defaultValue) {
99822
99812
  const {
@@ -99830,11 +99820,11 @@
99830
99820
  return [layoutForKey, setState];
99831
99821
  }
99832
99822
 
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
99823
+ /**
99824
+ * @pinussilvestrus: we need to introduce our own hook to persist the previous
99825
+ * state on updates.
99826
+ *
99827
+ * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
99838
99828
  */
99839
99829
 
99840
99830
  function usePrevious(value) {
@@ -99845,12 +99835,12 @@
99845
99835
  return ref.current;
99846
99836
  }
99847
99837
 
99848
- /**
99849
- * Subscribe to `propertiesPanel.showEntry`.
99850
- *
99851
- * @param {string} id
99852
- *
99853
- * @returns {import('preact').Ref}
99838
+ /**
99839
+ * Subscribe to `propertiesPanel.showEntry`.
99840
+ *
99841
+ * @param {string} id
99842
+ *
99843
+ * @returns {import('preact').Ref}
99854
99844
  */
99855
99845
  function useShowEntryEvent(id) {
99856
99846
  const {
@@ -99881,20 +99871,20 @@
99881
99871
  return ref;
99882
99872
  }
99883
99873
 
99884
- /**
99885
- * @callback setSticky
99886
- * @param {boolean} value
99874
+ /**
99875
+ * @callback setSticky
99876
+ * @param {boolean} value
99887
99877
  */
99888
99878
 
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
99879
+ /**
99880
+ * Use IntersectionObserver to identify when DOM element is in sticky mode.
99881
+ * If sticky is observered setSticky(true) will be called.
99882
+ * If sticky mode is left, setSticky(false) will be called.
99883
+ *
99884
+ *
99885
+ * @param {Object} ref
99886
+ * @param {string} scrollContainerSelector
99887
+ * @param {setSticky} setSticky
99898
99888
  */
99899
99889
  function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky) {
99900
99890
  const [scrollContainer, setScrollContainer] = h(query$1(scrollContainerSelector));
@@ -99948,19 +99938,19 @@
99948
99938
  }, [ref.current, scrollContainer, setSticky]);
99949
99939
  }
99950
99940
 
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
99941
+ /**
99942
+ * Creates a static function reference with changing body.
99943
+ * This is necessary when external libraries require a callback function
99944
+ * that has references to state variables.
99945
+ *
99946
+ * Usage:
99947
+ * const callback = useStaticCallback((val) => {val === currentState});
99948
+ *
99949
+ * The `callback` reference is static and can be safely used in external
99950
+ * libraries or as a prop that does not cause rerendering of children.
99951
+ *
99952
+ * @param {Function} callback function with changing reference
99953
+ * @returns {Function} static function reference
99964
99954
  */
99965
99955
  function useStaticCallback(callback) {
99966
99956
  const callbackRef = _(callback);
@@ -100103,13 +100093,13 @@
100103
100093
  return null;
100104
100094
  }
100105
100095
 
100106
- /**
100107
- * @typedef { {
100108
- * text: (element: object) => string,
100109
- * icon?: (element: Object) => import('preact').Component
100110
- * } } PlaceholderDefinition
100111
- *
100112
- * @param { PlaceholderDefinition } props
100096
+ /**
100097
+ * @typedef { {
100098
+ * text: (element: object) => string,
100099
+ * icon?: (element: Object) => import('preact').Component
100100
+ * } } PlaceholderDefinition
100101
+ *
100102
+ * @param { PlaceholderDefinition } props
100113
100103
  */
100114
100104
  function Placeholder(props) {
100115
100105
  const {
@@ -100148,9 +100138,9 @@
100148
100138
 
100149
100139
  const noop$6 = () => {};
100150
100140
 
100151
- /**
100152
- * Buffer `.focus()` calls while the editor is not initialized.
100153
- * Set Focus inside when the editor is ready.
100141
+ /**
100142
+ * Buffer `.focus()` calls while the editor is not initialized.
100143
+ * Set Focus inside when the editor is ready.
100154
100144
  */
100155
100145
  const useBufferedFocus$1 = function (editor, ref) {
100156
100146
  const [buffer, setBuffer] = h(undefined);
@@ -100251,9 +100241,9 @@
100251
100241
 
100252
100242
  const noop$5 = () => {};
100253
100243
 
100254
- /**
100255
- * Buffer `.focus()` calls while the editor is not initialized.
100256
- * Set Focus inside when the editor is ready.
100244
+ /**
100245
+ * Buffer `.focus()` calls while the editor is not initialized.
100246
+ * Set Focus inside when the editor is ready.
100257
100247
  */
100258
100248
  const useBufferedFocus = function (editor, ref) {
100259
100249
  const [buffer, setBuffer] = h(undefined);
@@ -100302,10 +100292,10 @@
100302
100292
  p$1(() => {
100303
100293
  let editor;
100304
100294
 
100305
- /* Trigger FEEL toggle when
100306
- *
100307
- * - `backspace` is pressed
100308
- * - AND the cursor is at the beginning of the input
100295
+ /* Trigger FEEL toggle when
100296
+ *
100297
+ * - `backspace` is pressed
100298
+ * - AND the cursor is at the beginning of the input
100309
100299
  */
100310
100300
  const onKeyDown = e => {
100311
100301
  if (e.key !== 'Backspace' || !editor) {
@@ -100387,22 +100377,22 @@
100387
100377
  source: null
100388
100378
  });
100389
100379
 
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
100380
+ /**
100381
+ * Add a dragger that calls back the passed function with
100382
+ * { event, delta } on drag.
100383
+ *
100384
+ * @example
100385
+ *
100386
+ * function dragMove(event, delta) {
100387
+ * // we are dragging (!!)
100388
+ * }
100389
+ *
100390
+ * domElement.addEventListener('dragstart', dragger(dragMove));
100391
+ *
100392
+ * @param {Function} fn
100393
+ * @param {Element} [dragPreview]
100394
+ *
100395
+ * @return {Function} drag start callback function
100406
100396
  */
100407
100397
  function createDragger(fn, dragPreview) {
100408
100398
  let self;
@@ -100457,23 +100447,23 @@
100457
100447
 
100458
100448
  const noop$3 = () => {};
100459
100449
 
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]
100450
+ /**
100451
+ * A generic popup component.
100452
+ *
100453
+ * @param {Object} props
100454
+ * @param {HTMLElement} [props.container]
100455
+ * @param {string} [props.className]
100456
+ * @param {boolean} [props.delayInitialFocus]
100457
+ * @param {{x: number, y: number}} [props.position]
100458
+ * @param {number} [props.width]
100459
+ * @param {number} [props.height]
100460
+ * @param {Function} props.onClose
100461
+ * @param {Function} [props.onPostActivate]
100462
+ * @param {Function} [props.onPostDeactivate]
100463
+ * @param {boolean} [props.returnFocus]
100464
+ * @param {boolean} [props.closeOnEscape]
100465
+ * @param {string} props.title
100466
+ * @param {Ref} [ref]
100477
100467
  */
100478
100468
  function PopupComponent(props, globalRef) {
100479
100469
  const {
@@ -100692,12 +100682,12 @@
100692
100682
  const FEEL_POPUP_WIDTH = 700;
100693
100683
  const FEEL_POPUP_HEIGHT = 250;
100694
100684
 
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
100685
+ /**
100686
+ * FEEL popup component, built as a singleton. Emits lifecycle events as follows:
100687
+ * - `feelPopup.open` - fired before the popup is mounted
100688
+ * - `feelPopup.opened` - fired after the popup is mounted. Event context contains the DOM node of the popup
100689
+ * - `feelPopup.close` - fired before the popup is unmounted. Event context contains the DOM node of the popup
100690
+ * - `feelPopup.closed` - fired after the popup is unmounted
100701
100691
  */
100702
100692
  function FEELPopupRoot(props) {
100703
100693
  const {
@@ -100923,11 +100913,11 @@
100923
100913
  return element.closest('.cm-editor').querySelector('.cm-tooltip-autocomplete');
100924
100914
  }
100925
100915
 
100926
- /**
100927
- * This hook behaves like useEffect, but does not trigger on the first render.
100928
- *
100929
- * @param {Function} effect
100930
- * @param {Array} deps
100916
+ /**
100917
+ * This hook behaves like useEffect, but does not trigger on the first render.
100918
+ *
100919
+ * @param {Function} effect
100920
+ * @param {Array} deps
100931
100921
  */
100932
100922
  function useUpdateEffect(effect, deps) {
100933
100923
  const isMounted = _(false);
@@ -101005,19 +100995,19 @@
101005
100995
  });
101006
100996
  }
101007
100997
 
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
100998
+ /**
100999
+ * @param {Object} props
101000
+ * @param {Object} props.element
101001
+ * @param {String} props.id
101002
+ * @param {String} props.description
101003
+ * @param {String} props.label
101004
+ * @param {String} props.switcherLabel
101005
+ * @param {Boolean} props.inline
101006
+ * @param {Function} props.getValue
101007
+ * @param {Function} props.setValue
101008
+ * @param {Function} props.onFocus
101009
+ * @param {Function} props.onBlur
101010
+ * @param {string|import('preact').Component} props.tooltip
101021
101011
  */
101022
101012
  function ToggleSwitchEntry(props) {
101023
101013
  const {
@@ -101343,85 +101333,85 @@
101343
101333
  const DEFAULT_DESCRIPTION = {};
101344
101334
  const DEFAULT_TOOLTIP = {};
101345
101335
 
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
- *
101336
+ /**
101337
+ * @typedef { {
101338
+ * component: import('preact').Component,
101339
+ * id: String,
101340
+ * isEdited?: Function
101341
+ * } } EntryDefinition
101342
+ *
101343
+ * @typedef { {
101344
+ * autoFocusEntry: String,
101345
+ * autoOpen?: Boolean,
101346
+ * entries: Array<EntryDefinition>,
101347
+ * id: String,
101348
+ * label: String,
101349
+ * remove: (event: MouseEvent) => void
101350
+ * } } ListItemDefinition
101351
+ *
101352
+ * @typedef { {
101353
+ * add: (event: MouseEvent) => void,
101354
+ * component: import('preact').Component,
101355
+ * element: Object,
101356
+ * id: String,
101357
+ * items: Array<ListItemDefinition>,
101358
+ * label: String,
101359
+ * shouldOpen?: Boolean
101360
+ * } } ListGroupDefinition
101361
+ *
101362
+ * @typedef { {
101363
+ * component?: import('preact').Component,
101364
+ * entries: Array<EntryDefinition>,
101365
+ * id: String,
101366
+ * label: String,
101367
+ * shouldOpen?: Boolean
101368
+ * } } GroupDefinition
101369
+ *
101370
+ * @typedef { {
101371
+ * [id: String]: GetDescriptionFunction
101372
+ * } } DescriptionConfig
101373
+ *
101374
+ * @typedef { {
101375
+ * [id: String]: GetTooltipFunction
101376
+ * } } TooltipConfig
101377
+ *
101378
+ * @callback { {
101379
+ * @param {string} id
101380
+ * @param {Object} element
101381
+ * @returns {string}
101382
+ * } } GetDescriptionFunction
101383
+ *
101384
+ * @callback { {
101385
+ * @param {string} id
101386
+ * @param {Object} element
101387
+ * @returns {string}
101388
+ * } } GetTooltipFunction
101389
+ *
101390
+ * @typedef { {
101391
+ * getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition,
101392
+ * getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition
101393
+ * } } PlaceholderProvider
101394
+ *
101405
101395
  */
101406
101396
 
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]
101397
+ /**
101398
+ * A basic properties panel component. Describes *how* content will be rendered, accepts
101399
+ * data from implementor to describe *what* will be rendered.
101400
+ *
101401
+ * @param {Object} props
101402
+ * @param {Object|Array} props.element
101403
+ * @param {import('./components/Header').HeaderProvider} props.headerProvider
101404
+ * @param {PlaceholderProvider} [props.placeholderProvider]
101405
+ * @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
101406
+ * @param {Object} [props.layoutConfig]
101407
+ * @param {Function} [props.layoutChanged]
101408
+ * @param {DescriptionConfig} [props.descriptionConfig]
101409
+ * @param {Function} [props.descriptionLoaded]
101410
+ * @param {TooltipConfig} [props.tooltipConfig]
101411
+ * @param {Function} [props.tooltipLoaded]
101412
+ * @param {HTMLElement} [props.feelPopupContainer]
101413
+ * @param {Function} [props.getFeelPopupLinks]
101414
+ * @param {Object} [props.eventBus]
101425
101415
  */
101426
101416
  function PropertiesPanel(props) {
101427
101417
  const {
@@ -101594,11 +101584,11 @@
101594
101584
 
101595
101585
  // hooks //////////////////
101596
101586
 
101597
- /**
101598
- * This hook behaves like useLayoutEffect, but does not trigger on the first render.
101599
- *
101600
- * @param {Function} effect
101601
- * @param {Array} deps
101587
+ /**
101588
+ * This hook behaves like useLayoutEffect, but does not trigger on the first render.
101589
+ *
101590
+ * @param {Function} effect
101591
+ * @param {Array} deps
101602
101592
  */
101603
101593
  function useUpdateLayoutEffect(effect, deps) {
101604
101594
  const isMounted = _(false);
@@ -101673,15 +101663,15 @@
101673
101663
  });
101674
101664
  }
101675
101665
 
101676
- /**
101677
- *
101678
- * @param {Array<null | Element>} ignoredElements
101679
- * @param {Function} callback
101666
+ /**
101667
+ *
101668
+ * @param {Array<null | Element>} ignoredElements
101669
+ * @param {Function} callback
101680
101670
  */
101681
101671
  function useGlobalClick(ignoredElements, callback) {
101682
101672
  p$1(() => {
101683
- /**
101684
- * @param {MouseEvent} event
101673
+ /**
101674
+ * @param {MouseEvent} event
101685
101675
  */
101686
101676
  function listener(event) {
101687
101677
  if (ignoredElements.some(element => element && element.contains(event.target))) {
@@ -101714,20 +101704,20 @@
101714
101704
  });
101715
101705
  }
101716
101706
 
101717
- /**
101718
- * @typedef { {
101719
- * [key: string]: string;
101720
- * } } TranslateReplacements
101707
+ /**
101708
+ * @typedef { {
101709
+ * [key: string]: string;
101710
+ * } } TranslateReplacements
101721
101711
  */
101722
101712
 
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
101713
+ /**
101714
+ * A simple translation stub to be used for multi-language support.
101715
+ * Can be easily replaced with a more sophisticated solution.
101716
+ *
101717
+ * @param {string} template to interpolate
101718
+ * @param {TranslateReplacements} [replacements] a map with substitutes
101719
+ *
101720
+ * @return {string} the translated string
101731
101721
  */
101732
101722
  function translateFallback(template, replacements) {
101733
101723
  replacements = replacements || {};
@@ -101839,8 +101829,8 @@
101839
101829
 
101840
101830
  const noop$1 = () => {};
101841
101831
 
101842
- /**
101843
- * @param {import('../PropertiesPanel').ListGroupDefinition} props
101832
+ /**
101833
+ * @param {import('../PropertiesPanel').ListGroupDefinition} props
101844
101834
  */
101845
101835
  function ListGroup(props) {
101846
101836
  const {
@@ -102032,18 +102022,18 @@
102032
102022
  });
102033
102023
  }
102034
102024
 
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]
102025
+ /**
102026
+ * @param {Object} props
102027
+ * @param {Object} props.element
102028
+ * @param {String} props.id
102029
+ * @param {String} props.description
102030
+ * @param {String} props.label
102031
+ * @param {Function} props.getValue
102032
+ * @param {Function} props.setValue
102033
+ * @param {Function} props.onFocus
102034
+ * @param {Function} props.onBlur
102035
+ * @param {string|import('preact').Component} props.tooltip
102036
+ * @param {boolean} [props.disabled]
102047
102037
  */
102048
102038
  function CheckboxEntry(props) {
102049
102039
  const {
@@ -102117,8 +102107,8 @@
102117
102107
  }
102118
102108
  }, [open, hasItems]);
102119
102109
 
102120
- /**
102121
- * @param {MouseEvent} event
102110
+ /**
102111
+ * @param {MouseEvent} event
102122
102112
  */
102123
102113
  function addItem(event) {
102124
102114
  event.stopPropagation();
@@ -102310,20 +102300,20 @@
102310
102300
  });
102311
102301
  }
102312
102302
 
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
102303
+ /**
102304
+ * @param {object} props
102305
+ * @param {object} props.element
102306
+ * @param {string} props.id
102307
+ * @param {string} [props.description]
102308
+ * @param {string} props.label
102309
+ * @param {Function} props.getValue
102310
+ * @param {Function} props.setValue
102311
+ * @param {Function} props.onFocus
102312
+ * @param {Function} props.onBlur
102313
+ * @param {Function} props.getOptions
102314
+ * @param {boolean} [props.disabled]
102315
+ * @param {Function} [props.validate]
102316
+ * @param {string|import('preact').Component} props.tooltip
102327
102317
  */
102328
102318
  function SelectEntry(props) {
102329
102319
  const {
@@ -102641,7 +102631,7 @@
102641
102631
  return u("div", {
102642
102632
  class: "bio-properties-panel-textfield",
102643
102633
  children: [u("label", {
102644
- for: prefixId$a(id),
102634
+ for: prefixId$9(id),
102645
102635
  class: "bio-properties-panel-label",
102646
102636
  children: u(TooltipWrapper, {
102647
102637
  value: tooltip,
@@ -102651,7 +102641,7 @@
102651
102641
  })
102652
102642
  }), u("input", {
102653
102643
  ref: ref,
102654
- id: prefixId$a(id),
102644
+ id: prefixId$9(id),
102655
102645
  type: "text",
102656
102646
  name: id,
102657
102647
  spellCheck: "false",
@@ -102667,20 +102657,20 @@
102667
102657
  });
102668
102658
  }
102669
102659
 
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
102660
+ /**
102661
+ * @param {Object} props
102662
+ * @param {Object} props.element
102663
+ * @param {String} props.id
102664
+ * @param {String} props.description
102665
+ * @param {Boolean} props.debounce
102666
+ * @param {Boolean} props.disabled
102667
+ * @param {String} props.label
102668
+ * @param {Function} props.getValue
102669
+ * @param {Function} props.setValue
102670
+ * @param {Function} props.onFocus
102671
+ * @param {Function} props.onBlur
102672
+ * @param {string|import('preact').Component} props.tooltip
102673
+ * @param {Function} props.validate
102684
102674
  */
102685
102675
  function TextfieldEntry(props) {
102686
102676
  const {
@@ -102747,7 +102737,7 @@
102747
102737
 
102748
102738
  // helpers /////////////////
102749
102739
 
102750
- function prefixId$a(id) {
102740
+ function prefixId$9(id) {
102751
102741
  return `bio-properties-panel-${id}`;
102752
102742
  }
102753
102743
 
@@ -102773,20 +102763,20 @@
102773
102763
  this._eventBus = eventBus;
102774
102764
  }
102775
102765
 
102776
- /**
102777
- * Check if the FEEL popup is open.
102778
- * @return {Boolean}
102766
+ /**
102767
+ * Check if the FEEL popup is open.
102768
+ * @return {Boolean}
102779
102769
  */
102780
102770
  isOpen() {
102781
102771
  return this._eventBus.fire('feelPopup._isOpen');
102782
102772
  }
102783
102773
 
102784
- /**
102785
- * Open the FEEL popup.
102786
- *
102787
- * @param {String} entryId
102788
- * @param {Object} popupConfig
102789
- * @param {HTMLElement} sourceElement
102774
+ /**
102775
+ * Open the FEEL popup.
102776
+ *
102777
+ * @param {String} entryId
102778
+ * @param {Object} popupConfig
102779
+ * @param {HTMLElement} sourceElement
102790
102780
  */
102791
102781
  open(entryId, popupConfig, sourceElement) {
102792
102782
  return this._eventBus.fire('feelPopup._open', {
@@ -102796,8 +102786,8 @@
102796
102786
  });
102797
102787
  }
102798
102788
 
102799
- /**
102800
- * Close the FEEL popup.
102789
+ /**
102790
+ * Close the FEEL popup.
102801
102791
  */
102802
102792
  close() {
102803
102793
  return this._eventBus.fire('feelPopup._close');
@@ -121636,7 +121626,7 @@
121636
121626
  }
121637
121627
 
121638
121628
  // eslint-disable-next-line no-undef
121639
- const packageVersion = "2.5.2";
121629
+ const packageVersion = "2.5.3";
121640
121630
 
121641
121631
  /**
121642
121632
  * Registry for element templates.
@@ -122616,109 +122606,6 @@
122616
122606
  return bo;
122617
122607
  }
122618
122608
 
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
122609
  /**
122723
122610
  * A handler that combines and executes multiple commands.
122724
122611
  *
@@ -126154,6 +126041,109 @@
126154
126041
  return array;
126155
126042
  }
126156
126043
 
126044
+ class RemoveElementTemplateHandler {
126045
+ constructor(modeling, elementFactory, elementRegistry, canvas, bpmnFactory, replace, commandStack) {
126046
+ this._modeling = modeling;
126047
+ this._elementFactory = elementFactory;
126048
+ this._elementRegistry = elementRegistry;
126049
+ this._canvas = canvas;
126050
+ this._bpmnFactory = bpmnFactory;
126051
+ this._replace = replace;
126052
+ this._commandStack = commandStack;
126053
+ }
126054
+ preExecute(context) {
126055
+ const {
126056
+ element
126057
+ } = context;
126058
+ if (element.parent) {
126059
+ context.newElement = this._removeTemplate(element);
126060
+ } else {
126061
+ context.newElement = this._removeRootTemplate(element);
126062
+ }
126063
+ }
126064
+ _removeTemplate(element) {
126065
+ const replace = this._replace;
126066
+ const businessObject = getBusinessObject$1(element);
126067
+ const type = businessObject.$type,
126068
+ eventDefinitionType = this._getEventDefinitionType(businessObject);
126069
+ const newBusinessObject = this._createBlankBusinessObject(element);
126070
+ return replace.replaceElement(element, {
126071
+ type: type,
126072
+ businessObject: newBusinessObject,
126073
+ eventDefinitionType: eventDefinitionType
126074
+ }, {
126075
+ createElementsBehavior: false
126076
+ });
126077
+ }
126078
+
126079
+ /**
126080
+ * Remove template from a given element.
126081
+ *
126082
+ * @param {djs.model.Base} element
126083
+ *
126084
+ * @return {djs.model.Base} the updated element
126085
+ */
126086
+ _removeRootTemplate(element) {
126087
+ var modeling = this._modeling,
126088
+ elementFactory = this._elementFactory,
126089
+ elementRegistry = this._elementRegistry,
126090
+ canvas = this._canvas;
126091
+
126092
+ // We are inside a collapsed subprocess, move up to the parent before replacing the collapsed object
126093
+ if (isPlane$1(element)) {
126094
+ const shapeId = getShapeIdFromPlane(element);
126095
+ const shape = elementRegistry.get(shapeId);
126096
+ if (shape && shape !== element) {
126097
+ canvas.setRootElement(canvas.findRoot(shape));
126098
+ return this._removeTemplate(shape);
126099
+ }
126100
+ }
126101
+ const businessObject = getBusinessObject$1(element);
126102
+ const type = businessObject.$type;
126103
+ const newBusinessObject = this._createBlankBusinessObject(element);
126104
+ const newRoot = elementFactory.create('root', {
126105
+ type: type,
126106
+ businessObject: newBusinessObject
126107
+ });
126108
+ this._commandStack.execute('canvas.updateRoot', {
126109
+ newRoot: newRoot,
126110
+ oldRoot: element
126111
+ });
126112
+ modeling.moveElements(element.children, {
126113
+ x: 0,
126114
+ y: 0
126115
+ }, newRoot);
126116
+ return newRoot;
126117
+ }
126118
+ _getEventDefinitionType(businessObject) {
126119
+ if (!businessObject.eventDefinitions) {
126120
+ return null;
126121
+ }
126122
+ const eventDefinition = businessObject.eventDefinitions[0];
126123
+ if (!eventDefinition) {
126124
+ return null;
126125
+ }
126126
+ return eventDefinition.$type;
126127
+ }
126128
+ _createBlankBusinessObject(element) {
126129
+ const bpmnFactory = this._bpmnFactory;
126130
+ const bo = getBusinessObject$1(element),
126131
+ newBo = bpmnFactory.create(bo.$type),
126132
+ label = getLabel(element);
126133
+ if (!label) {
126134
+ return newBo;
126135
+ }
126136
+ if (is$5(element, 'bpmn:Group')) {
126137
+ newBo.categoryValueRef = bpmnFactory.create('bpmn:CategoryValue');
126138
+ }
126139
+ setLabel({
126140
+ businessObject: newBo
126141
+ }, label);
126142
+ return newBo;
126143
+ }
126144
+ }
126145
+ RemoveElementTemplateHandler.$inject = ['modeling', 'elementFactory', 'elementRegistry', 'canvas', 'bpmnFactory', 'replace', 'commandStack'];
126146
+
126157
126147
  class ElementTemplatesCommands {
126158
126148
  constructor(commandStack, elementTemplates, eventBus) {
126159
126149
  commandStack.registerHandler('element-templates.multi-command-executor', MultiCommandHandler);