@bpmn-io/form-js-editor 1.14.1-alpha.0 → 1.15.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.
package/dist/index.es.js CHANGED
@@ -5515,19 +5515,19 @@ const ErrorsContext = createContext({
5515
5515
  errors: {}
5516
5516
  });
5517
5517
 
5518
- /**
5519
- * @typedef {Function} <propertiesPanel.showEntry> callback
5520
- *
5521
- * @example
5522
- *
5523
- * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
5524
- * // ...
5525
- * });
5526
- *
5527
- * @param {Object} context
5528
- * @param {boolean} [context.focus]
5529
- *
5530
- * @returns void
5518
+ /**
5519
+ * @typedef {Function} <propertiesPanel.showEntry> callback
5520
+ *
5521
+ * @example
5522
+ *
5523
+ * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
5524
+ * // ...
5525
+ * });
5526
+ *
5527
+ * @param {Object} context
5528
+ * @param {boolean} [context.focus]
5529
+ *
5530
+ * @returns void
5531
5531
  */
5532
5532
 
5533
5533
  const EventContext = createContext({
@@ -5544,20 +5544,20 @@ const TooltipContext = createContext({
5544
5544
  getTooltipForId: () => {}
5545
5545
  });
5546
5546
 
5547
- /**
5548
- * Accesses the global TooltipContext and returns a tooltip for a given id and element.
5549
- *
5550
- * @example
5551
- * ```jsx
5552
- * function TextField(props) {
5553
- * const tooltip = useTooltipContext('input1', element);
5554
- * }
5555
- * ```
5556
- *
5557
- * @param {string} id
5558
- * @param {object} element
5559
- *
5560
- * @returns {string}
5547
+ /**
5548
+ * Accesses the global TooltipContext and returns a tooltip for a given id and element.
5549
+ *
5550
+ * @example
5551
+ * ```jsx
5552
+ * function TextField(props) {
5553
+ * const tooltip = useTooltipContext('input1', element);
5554
+ * }
5555
+ * ```
5556
+ *
5557
+ * @param {string} id
5558
+ * @param {object} element
5559
+ *
5560
+ * @returns {string}
5561
5561
  */
5562
5562
  function useTooltipContext(id, element) {
5563
5563
  const {
@@ -5578,7 +5578,7 @@ function TooltipWrapper(props) {
5578
5578
  return jsx(Tooltip, {
5579
5579
  ...props,
5580
5580
  value: value,
5581
- forId: prefixId$9(forId)
5581
+ forId: `bio-properties-panel-${forId}`
5582
5582
  });
5583
5583
  }
5584
5584
  function Tooltip(props) {
@@ -5589,71 +5589,52 @@ function Tooltip(props) {
5589
5589
  direction = 'right',
5590
5590
  position
5591
5591
  } = props;
5592
- const [visible, setShow] = useState(false);
5593
- const [focusedViaKeyboard, setFocusedViaKeyboard] = useState(false);
5592
+ const [visible, setVisible] = useState(false);
5593
+
5594
+ // Tooltip will be shown after SHOW_DELAY ms from hovering over the source element.
5595
+ const SHOW_DELAY = 200;
5594
5596
  let timeout = null;
5595
5597
  const wrapperRef = useRef(null);
5596
5598
  const tooltipRef = useRef(null);
5597
- const showTooltip = async event => {
5598
- const show = () => setShow(true);
5599
- if (!visible && !timeout) {
5600
- if (event instanceof MouseEvent) {
5601
- timeout = setTimeout(show, 200);
5602
- } else {
5603
- show();
5604
- setFocusedViaKeyboard(true);
5605
- }
5599
+ const show = (_, delay) => {
5600
+ if (visible) return;
5601
+ if (delay) {
5602
+ timeout = setTimeout(() => {
5603
+ setVisible(true);
5604
+ }, SHOW_DELAY);
5605
+ } else {
5606
+ setVisible(true);
5606
5607
  }
5607
5608
  };
5608
- const hideTooltip = () => {
5609
- setShow(false);
5610
- setFocusedViaKeyboard(false);
5611
- };
5612
- const hideTooltipViaEscape = e => {
5613
- e.code === 'Escape' && hideTooltip();
5609
+ const hide = () => {
5610
+ clearTimeout(timeout);
5611
+ setVisible(false);
5614
5612
  };
5615
- const isTooltipHovered = ({
5616
- x,
5617
- y
5613
+ const handleMouseLeave = ({
5614
+ relatedTarget
5618
5615
  }) => {
5619
- const tooltip = tooltipRef.current;
5620
- const wrapper = wrapperRef.current;
5621
- return tooltip && (inBounds(x, y, wrapper.getBoundingClientRect()) || inBounds(x, y, tooltip.getBoundingClientRect()));
5616
+ // Don't hide the tooltip when moving mouse between the wrapper and the tooltip.
5617
+ if (relatedTarget === wrapperRef.current || relatedTarget === tooltipRef.current || relatedTarget?.parentElement === tooltipRef.current) {
5618
+ return;
5619
+ }
5620
+ hide();
5622
5621
  };
5623
- useEffect(() => {
5622
+ const handleFocusOut = e => {
5624
5623
  const {
5625
- current
5626
- } = wrapperRef;
5627
- if (!current) {
5624
+ target
5625
+ } = e;
5626
+
5627
+ // Don't hide the tooltip if the wrapper or the tooltip itself is clicked.
5628
+ const isHovered = target.matches(':hover') || tooltipRef.current?.matches(':hover');
5629
+ if (target === wrapperRef.current && isHovered) {
5630
+ e.stopPropagation();
5628
5631
  return;
5629
5632
  }
5630
- const hideHoveredTooltip = e => {
5631
- const isFocused = document.activeElement === wrapperRef.current || document.activeElement.closest('.bio-properties-panel-tooltip');
5632
- if (visible && !isTooltipHovered({
5633
- x: e.x,
5634
- y: e.y
5635
- }) && !(isFocused && focusedViaKeyboard)) {
5636
- hideTooltip();
5637
- }
5638
- };
5639
- const hideFocusedTooltip = e => {
5640
- const {
5641
- relatedTarget
5642
- } = e;
5643
- const isTooltipChild = el => !!el.closest('.bio-properties-panel-tooltip');
5644
- if (visible && !isHovered(wrapperRef.current) && relatedTarget && !isTooltipChild(relatedTarget)) {
5645
- hideTooltip();
5646
- }
5647
- };
5648
- document.addEventListener('wheel', hideHoveredTooltip);
5649
- document.addEventListener('focusout', hideFocusedTooltip);
5650
- document.addEventListener('mousemove', hideHoveredTooltip);
5651
- return () => {
5652
- document.removeEventListener('wheel', hideHoveredTooltip);
5653
- document.removeEventListener('mousemove', hideHoveredTooltip);
5654
- document.removeEventListener('focusout', hideFocusedTooltip);
5655
- };
5656
- }, [wrapperRef.current, visible, focusedViaKeyboard]);
5633
+ hide();
5634
+ };
5635
+ const hideTooltipViaEscape = e => {
5636
+ e.code === 'Escape' && hide();
5637
+ };
5657
5638
  const renderTooltip = () => {
5658
5639
  return jsxs("div", {
5659
5640
  class: `bio-properties-panel-tooltip ${direction}`,
@@ -5663,6 +5644,7 @@ function Tooltip(props) {
5663
5644
  style: position || getTooltipPosition(wrapperRef.current),
5664
5645
  ref: tooltipRef,
5665
5646
  onClick: e => e.stopPropagation(),
5647
+ onMouseLeave: handleMouseLeave,
5666
5648
  children: [jsx("div", {
5667
5649
  class: "bio-properties-panel-tooltip-content",
5668
5650
  children: value
@@ -5675,54 +5657,38 @@ function Tooltip(props) {
5675
5657
  class: "bio-properties-panel-tooltip-wrapper",
5676
5658
  tabIndex: "0",
5677
5659
  ref: wrapperRef,
5678
- onMouseEnter: showTooltip,
5679
- onMouseLeave: () => {
5680
- clearTimeout(timeout);
5681
- timeout = null;
5682
- },
5683
- onFocus: showTooltip,
5660
+ onMouseEnter: e => show(e, true),
5661
+ onMouseLeave: handleMouseLeave,
5662
+ onFocus: show,
5663
+ onBlur: handleFocusOut,
5684
5664
  onKeyDown: hideTooltipViaEscape,
5685
5665
  children: [props.children, visible ? parent ? createPortal(renderTooltip(), parent.current) : renderTooltip() : null]
5686
5666
  });
5687
5667
  }
5688
5668
 
5689
5669
  // helper
5690
- function inBounds(x, y, bounds) {
5691
- const {
5692
- top,
5693
- right,
5694
- bottom,
5695
- left
5696
- } = bounds;
5697
- return x >= left && x <= right && y >= top && y <= bottom;
5698
- }
5670
+
5699
5671
  function getTooltipPosition(refElement) {
5700
5672
  const refPosition = refElement.getBoundingClientRect();
5701
5673
  const right = `calc(100% - ${refPosition.x}px)`;
5702
5674
  const top = `${refPosition.top - 10}px`;
5703
5675
  return `right: ${right}; top: ${top};`;
5704
5676
  }
5705
- function isHovered(element) {
5706
- return element.matches(':hover');
5707
- }
5708
- function prefixId$9(id) {
5709
- return `bio-properties-panel-${id}`;
5710
- }
5711
5677
 
5712
- /**
5713
- * Accesses the global DescriptionContext and returns a description for a given id and element.
5714
- *
5715
- * @example
5716
- * ```jsx
5717
- * function TextField(props) {
5718
- * const description = useDescriptionContext('input1', element);
5719
- * }
5720
- * ```
5721
- *
5722
- * @param {string} id
5723
- * @param {object} element
5724
- *
5725
- * @returns {string}
5678
+ /**
5679
+ * Accesses the global DescriptionContext and returns a description for a given id and element.
5680
+ *
5681
+ * @example
5682
+ * ```jsx
5683
+ * function TextField(props) {
5684
+ * const description = useDescriptionContext('input1', element);
5685
+ * }
5686
+ * ```
5687
+ *
5688
+ * @param {string} id
5689
+ * @param {object} element
5690
+ *
5691
+ * @returns {string}
5726
5692
  */
5727
5693
  function useDescriptionContext(id, element) {
5728
5694
  const {
@@ -5743,11 +5709,11 @@ function useErrors() {
5743
5709
  return errors;
5744
5710
  }
5745
5711
 
5746
- /**
5747
- * Subscribe to an event immediately. Update subscription after inputs changed.
5748
- *
5749
- * @param {string} event
5750
- * @param {Function} callback
5712
+ /**
5713
+ * Subscribe to an event immediately. Update subscription after inputs changed.
5714
+ *
5715
+ * @param {string} event
5716
+ * @param {Function} callback
5751
5717
  */
5752
5718
  function useEvent(event, callback, eventBus) {
5753
5719
  const eventContext = useContext(EventContext);
@@ -5777,20 +5743,20 @@ function useEvent(event, callback, eventBus) {
5777
5743
  }, [callback, event, eventBus]);
5778
5744
  }
5779
5745
 
5780
- /**
5781
- * Creates a state that persists in the global LayoutContext.
5782
- *
5783
- * @example
5784
- * ```jsx
5785
- * function Group(props) {
5786
- * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
5787
- * }
5788
- * ```
5789
- *
5790
- * @param {(string|number)[]} path
5791
- * @param {any} [defaultValue]
5792
- *
5793
- * @returns {[ any, Function ]}
5746
+ /**
5747
+ * Creates a state that persists in the global LayoutContext.
5748
+ *
5749
+ * @example
5750
+ * ```jsx
5751
+ * function Group(props) {
5752
+ * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
5753
+ * }
5754
+ * ```
5755
+ *
5756
+ * @param {(string|number)[]} path
5757
+ * @param {any} [defaultValue]
5758
+ *
5759
+ * @returns {[ any, Function ]}
5794
5760
  */
5795
5761
  function useLayoutState(path, defaultValue) {
5796
5762
  const {
@@ -5804,11 +5770,11 @@ function useLayoutState(path, defaultValue) {
5804
5770
  return [layoutForKey, setState];
5805
5771
  }
5806
5772
 
5807
- /**
5808
- * @pinussilvestrus: we need to introduce our own hook to persist the previous
5809
- * state on updates.
5810
- *
5811
- * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
5773
+ /**
5774
+ * @pinussilvestrus: we need to introduce our own hook to persist the previous
5775
+ * state on updates.
5776
+ *
5777
+ * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
5812
5778
  */
5813
5779
 
5814
5780
  function usePrevious(value) {
@@ -5819,12 +5785,12 @@ function usePrevious(value) {
5819
5785
  return ref.current;
5820
5786
  }
5821
5787
 
5822
- /**
5823
- * Subscribe to `propertiesPanel.showEntry`.
5824
- *
5825
- * @param {string} id
5826
- *
5827
- * @returns {import('preact').Ref}
5788
+ /**
5789
+ * Subscribe to `propertiesPanel.showEntry`.
5790
+ *
5791
+ * @param {string} id
5792
+ *
5793
+ * @returns {import('preact').Ref}
5828
5794
  */
5829
5795
  function useShowEntryEvent(id) {
5830
5796
  const {
@@ -5855,20 +5821,20 @@ function useShowEntryEvent(id) {
5855
5821
  return ref;
5856
5822
  }
5857
5823
 
5858
- /**
5859
- * @callback setSticky
5860
- * @param {boolean} value
5824
+ /**
5825
+ * @callback setSticky
5826
+ * @param {boolean} value
5861
5827
  */
5862
5828
 
5863
- /**
5864
- * Use IntersectionObserver to identify when DOM element is in sticky mode.
5865
- * If sticky is observered setSticky(true) will be called.
5866
- * If sticky mode is left, setSticky(false) will be called.
5867
- *
5868
- *
5869
- * @param {Object} ref
5870
- * @param {string} scrollContainerSelector
5871
- * @param {setSticky} setSticky
5829
+ /**
5830
+ * Use IntersectionObserver to identify when DOM element is in sticky mode.
5831
+ * If sticky is observered setSticky(true) will be called.
5832
+ * If sticky mode is left, setSticky(false) will be called.
5833
+ *
5834
+ *
5835
+ * @param {Object} ref
5836
+ * @param {string} scrollContainerSelector
5837
+ * @param {setSticky} setSticky
5872
5838
  */
5873
5839
  function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky) {
5874
5840
  const [scrollContainer, setScrollContainer] = useState(query(scrollContainerSelector));
@@ -5922,19 +5888,19 @@ function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky)
5922
5888
  }, [ref.current, scrollContainer, setSticky]);
5923
5889
  }
5924
5890
 
5925
- /**
5926
- * Creates a static function reference with changing body.
5927
- * This is necessary when external libraries require a callback function
5928
- * that has references to state variables.
5929
- *
5930
- * Usage:
5931
- * const callback = useStaticCallback((val) => {val === currentState});
5932
- *
5933
- * The `callback` reference is static and can be safely used in external
5934
- * libraries or as a prop that does not cause rerendering of children.
5935
- *
5936
- * @param {Function} callback function with changing reference
5937
- * @returns {Function} static function reference
5891
+ /**
5892
+ * Creates a static function reference with changing body.
5893
+ * This is necessary when external libraries require a callback function
5894
+ * that has references to state variables.
5895
+ *
5896
+ * Usage:
5897
+ * const callback = useStaticCallback((val) => {val === currentState});
5898
+ *
5899
+ * The `callback` reference is static and can be safely used in external
5900
+ * libraries or as a prop that does not cause rerendering of children.
5901
+ *
5902
+ * @param {Function} callback function with changing reference
5903
+ * @returns {Function} static function reference
5938
5904
  */
5939
5905
  function useStaticCallback(callback) {
5940
5906
  const callbackRef = useRef(callback);
@@ -6075,13 +6041,13 @@ function DataMarker(props) {
6075
6041
  return null;
6076
6042
  }
6077
6043
 
6078
- /**
6079
- * @typedef { {
6080
- * text: (element: object) => string,
6081
- * icon?: (element: Object) => import('preact').Component
6082
- * } } PlaceholderDefinition
6083
- *
6084
- * @param { PlaceholderDefinition } props
6044
+ /**
6045
+ * @typedef { {
6046
+ * text: (element: object) => string,
6047
+ * icon?: (element: Object) => import('preact').Component
6048
+ * } } PlaceholderDefinition
6049
+ *
6050
+ * @param { PlaceholderDefinition } props
6085
6051
  */
6086
6052
  function Placeholder(props) {
6087
6053
  const {
@@ -6118,9 +6084,9 @@ function Description$1(props) {
6118
6084
  }
6119
6085
  const noop$6 = () => {};
6120
6086
 
6121
- /**
6122
- * Buffer `.focus()` calls while the editor is not initialized.
6123
- * Set Focus inside when the editor is ready.
6087
+ /**
6088
+ * Buffer `.focus()` calls while the editor is not initialized.
6089
+ * Set Focus inside when the editor is ready.
6124
6090
  */
6125
6091
  const useBufferedFocus$1 = function (editor, ref) {
6126
6092
  const [buffer, setBuffer] = useState(undefined);
@@ -6220,9 +6186,9 @@ const CodeEditor$1 = forwardRef((props, ref) => {
6220
6186
  });
6221
6187
  const noop$5 = () => {};
6222
6188
 
6223
- /**
6224
- * Buffer `.focus()` calls while the editor is not initialized.
6225
- * Set Focus inside when the editor is ready.
6189
+ /**
6190
+ * Buffer `.focus()` calls while the editor is not initialized.
6191
+ * Set Focus inside when the editor is ready.
6226
6192
  */
6227
6193
  const useBufferedFocus = function (editor, ref) {
6228
6194
  const [buffer, setBuffer] = useState(undefined);
@@ -6271,10 +6237,10 @@ const CodeEditor = forwardRef((props, ref) => {
6271
6237
  useEffect(() => {
6272
6238
  let editor;
6273
6239
 
6274
- /* Trigger FEEL toggle when
6275
- *
6276
- * - `backspace` is pressed
6277
- * - AND the cursor is at the beginning of the input
6240
+ /* Trigger FEEL toggle when
6241
+ *
6242
+ * - `backspace` is pressed
6243
+ * - AND the cursor is at the beginning of the input
6278
6244
  */
6279
6245
  const onKeyDown = e => {
6280
6246
  if (e.key !== 'Backspace' || !editor) {
@@ -6363,10 +6329,10 @@ function FeelIndicator(props) {
6363
6329
  }
6364
6330
  const noop$4 = () => {};
6365
6331
 
6366
- /**
6367
- * @param {Object} props
6368
- * @param {Object} props.label
6369
- * @param {String} props.feel
6332
+ /**
6333
+ * @param {Object} props
6334
+ * @param {Object} props.label
6335
+ * @param {String} props.feel
6370
6336
  */
6371
6337
  function FeelIcon(props) {
6372
6338
  const {
@@ -6400,22 +6366,22 @@ const FeelPopupContext = createContext({
6400
6366
  source: null
6401
6367
  });
6402
6368
 
6403
- /**
6404
- * Add a dragger that calls back the passed function with
6405
- * { event, delta } on drag.
6406
- *
6407
- * @example
6408
- *
6409
- * function dragMove(event, delta) {
6410
- * // we are dragging (!!)
6411
- * }
6412
- *
6413
- * domElement.addEventListener('dragstart', dragger(dragMove));
6414
- *
6415
- * @param {Function} fn
6416
- * @param {Element} [dragPreview]
6417
- *
6418
- * @return {Function} drag start callback function
6369
+ /**
6370
+ * Add a dragger that calls back the passed function with
6371
+ * { event, delta } on drag.
6372
+ *
6373
+ * @example
6374
+ *
6375
+ * function dragMove(event, delta) {
6376
+ * // we are dragging (!!)
6377
+ * }
6378
+ *
6379
+ * domElement.addEventListener('dragstart', dragger(dragMove));
6380
+ *
6381
+ * @param {Function} fn
6382
+ * @param {Element} [dragPreview]
6383
+ *
6384
+ * @return {Function} drag start callback function
6419
6385
  */
6420
6386
  function createDragger(fn, dragPreview) {
6421
6387
  let self;
@@ -6469,23 +6435,23 @@ function emptyCanvas() {
6469
6435
  }
6470
6436
  const noop$3 = () => {};
6471
6437
 
6472
- /**
6473
- * A generic popup component.
6474
- *
6475
- * @param {Object} props
6476
- * @param {HTMLElement} [props.container]
6477
- * @param {string} [props.className]
6478
- * @param {boolean} [props.delayInitialFocus]
6479
- * @param {{x: number, y: number}} [props.position]
6480
- * @param {number} [props.width]
6481
- * @param {number} [props.height]
6482
- * @param {Function} props.onClose
6483
- * @param {Function} [props.onPostActivate]
6484
- * @param {Function} [props.onPostDeactivate]
6485
- * @param {boolean} [props.returnFocus]
6486
- * @param {boolean} [props.closeOnEscape]
6487
- * @param {string} props.title
6488
- * @param {Ref} [ref]
6438
+ /**
6439
+ * A generic popup component.
6440
+ *
6441
+ * @param {Object} props
6442
+ * @param {HTMLElement} [props.container]
6443
+ * @param {string} [props.className]
6444
+ * @param {boolean} [props.delayInitialFocus]
6445
+ * @param {{x: number, y: number}} [props.position]
6446
+ * @param {number} [props.width]
6447
+ * @param {number} [props.height]
6448
+ * @param {Function} props.onClose
6449
+ * @param {Function} [props.onPostActivate]
6450
+ * @param {Function} [props.onPostDeactivate]
6451
+ * @param {boolean} [props.returnFocus]
6452
+ * @param {boolean} [props.closeOnEscape]
6453
+ * @param {string} props.title
6454
+ * @param {Ref} [ref]
6489
6455
  */
6490
6456
  function PopupComponent(props, globalRef) {
6491
6457
  const {
@@ -6703,12 +6669,12 @@ function getContainerNode(node) {
6703
6669
  const FEEL_POPUP_WIDTH = 700;
6704
6670
  const FEEL_POPUP_HEIGHT = 250;
6705
6671
 
6706
- /**
6707
- * FEEL popup component, built as a singleton. Emits lifecycle events as follows:
6708
- * - `feelPopup.open` - fired before the popup is mounted
6709
- * - `feelPopup.opened` - fired after the popup is mounted. Event context contains the DOM node of the popup
6710
- * - `feelPopup.close` - fired before the popup is unmounted. Event context contains the DOM node of the popup
6711
- * - `feelPopup.closed` - fired after the popup is unmounted
6672
+ /**
6673
+ * FEEL popup component, built as a singleton. Emits lifecycle events as follows:
6674
+ * - `feelPopup.open` - fired before the popup is mounted
6675
+ * - `feelPopup.opened` - fired after the popup is mounted. Event context contains the DOM node of the popup
6676
+ * - `feelPopup.close` - fired before the popup is unmounted. Event context contains the DOM node of the popup
6677
+ * - `feelPopup.closed` - fired after the popup is unmounted
6712
6678
  */
6713
6679
  function FEELPopupRoot(props) {
6714
6680
  const {
@@ -6935,11 +6901,11 @@ function autoCompletionOpen(element) {
6935
6901
  return element.closest('.cm-editor').querySelector('.cm-tooltip-autocomplete');
6936
6902
  }
6937
6903
 
6938
- /**
6939
- * This hook behaves like useEffect, but does not trigger on the first render.
6940
- *
6941
- * @param {Function} effect
6942
- * @param {Array} deps
6904
+ /**
6905
+ * This hook behaves like useEffect, but does not trigger on the first render.
6906
+ *
6907
+ * @param {Function} effect
6908
+ * @param {Array} deps
6943
6909
  */
6944
6910
  function useUpdateEffect(effect, deps) {
6945
6911
  const isMounted = useRef(false);
@@ -7016,19 +6982,19 @@ function ToggleSwitch(props) {
7016
6982
  });
7017
6983
  }
7018
6984
 
7019
- /**
7020
- * @param {Object} props
7021
- * @param {Object} props.element
7022
- * @param {String} props.id
7023
- * @param {String} props.description
7024
- * @param {String} props.label
7025
- * @param {String} props.switcherLabel
7026
- * @param {Boolean} props.inline
7027
- * @param {Function} props.getValue
7028
- * @param {Function} props.setValue
7029
- * @param {Function} props.onFocus
7030
- * @param {Function} props.onBlur
7031
- * @param {string|import('preact').Component} props.tooltip
6985
+ /**
6986
+ * @param {Object} props
6987
+ * @param {Object} props.element
6988
+ * @param {String} props.id
6989
+ * @param {String} props.description
6990
+ * @param {String} props.label
6991
+ * @param {String} props.switcherLabel
6992
+ * @param {Boolean} props.inline
6993
+ * @param {Function} props.getValue
6994
+ * @param {Function} props.setValue
6995
+ * @param {Function} props.onFocus
6996
+ * @param {Function} props.onBlur
6997
+ * @param {string|import('preact').Component} props.tooltip
7032
6998
  */
7033
6999
  function ToggleSwitchEntry(props) {
7034
7000
  const {
@@ -7135,22 +7101,22 @@ function NumberField(props) {
7135
7101
  });
7136
7102
  }
7137
7103
 
7138
- /**
7139
- * @param {Object} props
7140
- * @param {Boolean} props.debounce
7141
- * @param {String} props.description
7142
- * @param {Boolean} props.disabled
7143
- * @param {Object} props.element
7144
- * @param {Function} props.getValue
7145
- * @param {String} props.id
7146
- * @param {String} props.label
7147
- * @param {String} props.max
7148
- * @param {String} props.min
7149
- * @param {Function} props.setValue
7150
- * @param {Function} props.onFocus
7151
- * @param {Function} props.onBlur
7152
- * @param {String} props.step
7153
- * @param {Function} props.validate
7104
+ /**
7105
+ * @param {Object} props
7106
+ * @param {Boolean} props.debounce
7107
+ * @param {String} props.description
7108
+ * @param {Boolean} props.disabled
7109
+ * @param {Object} props.element
7110
+ * @param {Function} props.getValue
7111
+ * @param {String} props.id
7112
+ * @param {String} props.label
7113
+ * @param {String} props.max
7114
+ * @param {String} props.min
7115
+ * @param {Function} props.setValue
7116
+ * @param {Function} props.onFocus
7117
+ * @param {Function} props.onBlur
7118
+ * @param {String} props.step
7119
+ * @param {Function} props.validate
7154
7120
  */
7155
7121
  function NumberFieldEntry(props) {
7156
7122
  const {
@@ -7230,6 +7196,7 @@ function FeelTextfieldComponent(props) {
7230
7196
  label,
7231
7197
  hostLanguage,
7232
7198
  onInput,
7199
+ onBlur,
7233
7200
  onError,
7234
7201
  placeholder,
7235
7202
  feel,
@@ -7295,6 +7262,12 @@ function FeelTextfieldComponent(props) {
7295
7262
  setFocus(-1);
7296
7263
  }
7297
7264
  };
7265
+ const handleOnBlur = e => {
7266
+ if (onBlur) {
7267
+ onBlur(e);
7268
+ }
7269
+ setLocalValue(e.target.value.trim());
7270
+ };
7298
7271
  const handleLint = useStaticCallback((lint = []) => {
7299
7272
  const syntaxError = lint.some(report => report.type === 'Syntax Error');
7300
7273
  if (syntaxError) {
@@ -7416,6 +7389,7 @@ function FeelTextfieldComponent(props) {
7416
7389
  ...props,
7417
7390
  popupOpen: popuOpen,
7418
7391
  onInput: handleLocalInput,
7392
+ onBlur: handleOnBlur,
7419
7393
  contentAttributes: {
7420
7394
  'id': prefixId$5(id),
7421
7395
  'aria-label': label
@@ -7635,26 +7609,26 @@ forwardRef((props, ref) => {
7635
7609
  });
7636
7610
  });
7637
7611
 
7638
- /**
7639
- * @param {Object} props
7640
- * @param {Object} props.element
7641
- * @param {String} props.id
7642
- * @param {String} props.description
7643
- * @param {Boolean} props.debounce
7644
- * @param {Boolean} props.disabled
7645
- * @param {Boolean} props.feel
7646
- * @param {String} props.label
7647
- * @param {Function} props.getValue
7648
- * @param {Function} props.setValue
7649
- * @param {Function} props.tooltipContainer
7650
- * @param {Function} props.validate
7651
- * @param {Function} props.show
7652
- * @param {Function} props.example
7653
- * @param {Function} props.variables
7654
- * @param {Function} props.onFocus
7655
- * @param {Function} props.onBlur
7656
- * @param {string} [props.placeholder]
7657
- * @param {string|import('preact').Component} props.tooltip
7612
+ /**
7613
+ * @param {Object} props
7614
+ * @param {Object} props.element
7615
+ * @param {String} props.id
7616
+ * @param {String} props.description
7617
+ * @param {Boolean} props.debounce
7618
+ * @param {Boolean} props.disabled
7619
+ * @param {Boolean} props.feel
7620
+ * @param {String} props.label
7621
+ * @param {Function} props.getValue
7622
+ * @param {Function} props.setValue
7623
+ * @param {Function} props.tooltipContainer
7624
+ * @param {Function} props.validate
7625
+ * @param {Function} props.show
7626
+ * @param {Function} props.example
7627
+ * @param {Function} props.variables
7628
+ * @param {Function} props.onFocus
7629
+ * @param {Function} props.onBlur
7630
+ * @param {string} [props.placeholder]
7631
+ * @param {string|import('preact').Component} props.tooltip
7658
7632
  */
7659
7633
  function FeelEntry(props) {
7660
7634
  const {
@@ -7741,27 +7715,27 @@ function FeelEntry(props) {
7741
7715
  });
7742
7716
  }
7743
7717
 
7744
- /**
7745
- * @param {Object} props
7746
- * @param {Object} props.element
7747
- * @param {String} props.id
7748
- * @param {String} props.description
7749
- * @param {Boolean} props.debounce
7750
- * @param {Boolean} props.disabled
7751
- * @param {String} props.max
7752
- * @param {String} props.min
7753
- * @param {String} props.step
7754
- * @param {Boolean} props.feel
7755
- * @param {String} props.label
7756
- * @param {Function} props.getValue
7757
- * @param {Function} props.setValue
7758
- * @param {Function} props.tooltipContainer
7759
- * @param {Function} props.validate
7760
- * @param {Function} props.show
7761
- * @param {Function} props.example
7762
- * @param {Function} props.variables
7763
- * @param {Function} props.onFocus
7764
- * @param {Function} props.onBlur
7718
+ /**
7719
+ * @param {Object} props
7720
+ * @param {Object} props.element
7721
+ * @param {String} props.id
7722
+ * @param {String} props.description
7723
+ * @param {Boolean} props.debounce
7724
+ * @param {Boolean} props.disabled
7725
+ * @param {String} props.max
7726
+ * @param {String} props.min
7727
+ * @param {String} props.step
7728
+ * @param {Boolean} props.feel
7729
+ * @param {String} props.label
7730
+ * @param {Function} props.getValue
7731
+ * @param {Function} props.setValue
7732
+ * @param {Function} props.tooltipContainer
7733
+ * @param {Function} props.validate
7734
+ * @param {Function} props.show
7735
+ * @param {Function} props.example
7736
+ * @param {Function} props.variables
7737
+ * @param {Function} props.onFocus
7738
+ * @param {Function} props.onBlur
7765
7739
  */
7766
7740
  function FeelNumberEntry(props) {
7767
7741
  return jsx(FeelEntry, {
@@ -7771,24 +7745,24 @@ function FeelNumberEntry(props) {
7771
7745
  });
7772
7746
  }
7773
7747
 
7774
- /**
7775
- * @param {Object} props
7776
- * @param {Object} props.element
7777
- * @param {String} props.id
7778
- * @param {String} props.description
7779
- * @param {Boolean} props.debounce
7780
- * @param {Boolean} props.disabled
7781
- * @param {Boolean} props.feel
7782
- * @param {String} props.label
7783
- * @param {Function} props.getValue
7784
- * @param {Function} props.setValue
7785
- * @param {Function} props.tooltipContainer
7786
- * @param {Function} props.validate
7787
- * @param {Function} props.show
7788
- * @param {Function} props.example
7789
- * @param {Function} props.variables
7790
- * @param {Function} props.onFocus
7791
- * @param {Function} props.onBlur
7748
+ /**
7749
+ * @param {Object} props
7750
+ * @param {Object} props.element
7751
+ * @param {String} props.id
7752
+ * @param {String} props.description
7753
+ * @param {Boolean} props.debounce
7754
+ * @param {Boolean} props.disabled
7755
+ * @param {Boolean} props.feel
7756
+ * @param {String} props.label
7757
+ * @param {Function} props.getValue
7758
+ * @param {Function} props.setValue
7759
+ * @param {Function} props.tooltipContainer
7760
+ * @param {Function} props.validate
7761
+ * @param {Function} props.show
7762
+ * @param {Function} props.example
7763
+ * @param {Function} props.variables
7764
+ * @param {Function} props.onFocus
7765
+ * @param {Function} props.onBlur
7792
7766
  */
7793
7767
  function FeelToggleSwitchEntry(props) {
7794
7768
  return jsx(FeelEntry, {
@@ -7798,26 +7772,26 @@ function FeelToggleSwitchEntry(props) {
7798
7772
  });
7799
7773
  }
7800
7774
 
7801
- /**
7802
- * @param {Object} props
7803
- * @param {Object} props.element
7804
- * @param {String} props.id
7805
- * @param {String} props.description
7806
- * @param {String} props.hostLanguage
7807
- * @param {Boolean} props.singleLine
7808
- * @param {Boolean} props.debounce
7809
- * @param {Boolean} props.disabled
7810
- * @param {Boolean} props.feel
7811
- * @param {String} props.label
7812
- * @param {Function} props.getValue
7813
- * @param {Function} props.setValue
7814
- * @param {Function} props.tooltipContainer
7815
- * @param {Function} props.validate
7816
- * @param {Function} props.show
7817
- * @param {Function} props.example
7818
- * @param {Function} props.variables
7819
- * @param {Function} props.onFocus
7820
- * @param {Function} props.onBlur
7775
+ /**
7776
+ * @param {Object} props
7777
+ * @param {Object} props.element
7778
+ * @param {String} props.id
7779
+ * @param {String} props.description
7780
+ * @param {String} props.hostLanguage
7781
+ * @param {Boolean} props.singleLine
7782
+ * @param {Boolean} props.debounce
7783
+ * @param {Boolean} props.disabled
7784
+ * @param {Boolean} props.feel
7785
+ * @param {String} props.label
7786
+ * @param {Function} props.getValue
7787
+ * @param {Function} props.setValue
7788
+ * @param {Function} props.tooltipContainer
7789
+ * @param {Function} props.validate
7790
+ * @param {Function} props.show
7791
+ * @param {Function} props.example
7792
+ * @param {Function} props.variables
7793
+ * @param {Function} props.onFocus
7794
+ * @param {Function} props.onBlur
7821
7795
  */
7822
7796
  function FeelTemplatingEntry(props) {
7823
7797
  return jsx(FeelEntry, {
@@ -7885,85 +7859,85 @@ const DEFAULT_LAYOUT = {};
7885
7859
  const DEFAULT_DESCRIPTION = {};
7886
7860
  const DEFAULT_TOOLTIP = {};
7887
7861
 
7888
- /**
7889
- * @typedef { {
7890
- * component: import('preact').Component,
7891
- * id: String,
7892
- * isEdited?: Function
7893
- * } } EntryDefinition
7894
- *
7895
- * @typedef { {
7896
- * autoFocusEntry: String,
7897
- * autoOpen?: Boolean,
7898
- * entries: Array<EntryDefinition>,
7899
- * id: String,
7900
- * label: String,
7901
- * remove: (event: MouseEvent) => void
7902
- * } } ListItemDefinition
7903
- *
7904
- * @typedef { {
7905
- * add: (event: MouseEvent) => void,
7906
- * component: import('preact').Component,
7907
- * element: Object,
7908
- * id: String,
7909
- * items: Array<ListItemDefinition>,
7910
- * label: String,
7911
- * shouldOpen?: Boolean
7912
- * } } ListGroupDefinition
7913
- *
7914
- * @typedef { {
7915
- * component?: import('preact').Component,
7916
- * entries: Array<EntryDefinition>,
7917
- * id: String,
7918
- * label: String,
7919
- * shouldOpen?: Boolean
7920
- * } } GroupDefinition
7921
- *
7922
- * @typedef { {
7923
- * [id: String]: GetDescriptionFunction
7924
- * } } DescriptionConfig
7925
- *
7926
- * @typedef { {
7927
- * [id: String]: GetTooltipFunction
7928
- * } } TooltipConfig
7929
- *
7930
- * @callback { {
7931
- * @param {string} id
7932
- * @param {Object} element
7933
- * @returns {string}
7934
- * } } GetDescriptionFunction
7935
- *
7936
- * @callback { {
7937
- * @param {string} id
7938
- * @param {Object} element
7939
- * @returns {string}
7940
- * } } GetTooltipFunction
7941
- *
7942
- * @typedef { {
7943
- * getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition,
7944
- * getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition
7945
- * } } PlaceholderProvider
7946
- *
7862
+ /**
7863
+ * @typedef { {
7864
+ * component: import('preact').Component,
7865
+ * id: String,
7866
+ * isEdited?: Function
7867
+ * } } EntryDefinition
7868
+ *
7869
+ * @typedef { {
7870
+ * autoFocusEntry: String,
7871
+ * autoOpen?: Boolean,
7872
+ * entries: Array<EntryDefinition>,
7873
+ * id: String,
7874
+ * label: String,
7875
+ * remove: (event: MouseEvent) => void
7876
+ * } } ListItemDefinition
7877
+ *
7878
+ * @typedef { {
7879
+ * add: (event: MouseEvent) => void,
7880
+ * component: import('preact').Component,
7881
+ * element: Object,
7882
+ * id: String,
7883
+ * items: Array<ListItemDefinition>,
7884
+ * label: String,
7885
+ * shouldOpen?: Boolean
7886
+ * } } ListGroupDefinition
7887
+ *
7888
+ * @typedef { {
7889
+ * component?: import('preact').Component,
7890
+ * entries: Array<EntryDefinition>,
7891
+ * id: String,
7892
+ * label: String,
7893
+ * shouldOpen?: Boolean
7894
+ * } } GroupDefinition
7895
+ *
7896
+ * @typedef { {
7897
+ * [id: String]: GetDescriptionFunction
7898
+ * } } DescriptionConfig
7899
+ *
7900
+ * @typedef { {
7901
+ * [id: String]: GetTooltipFunction
7902
+ * } } TooltipConfig
7903
+ *
7904
+ * @callback { {
7905
+ * @param {string} id
7906
+ * @param {Object} element
7907
+ * @returns {string}
7908
+ * } } GetDescriptionFunction
7909
+ *
7910
+ * @callback { {
7911
+ * @param {string} id
7912
+ * @param {Object} element
7913
+ * @returns {string}
7914
+ * } } GetTooltipFunction
7915
+ *
7916
+ * @typedef { {
7917
+ * getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition,
7918
+ * getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition
7919
+ * } } PlaceholderProvider
7920
+ *
7947
7921
  */
7948
7922
 
7949
- /**
7950
- * A basic properties panel component. Describes *how* content will be rendered, accepts
7951
- * data from implementor to describe *what* will be rendered.
7952
- *
7953
- * @param {Object} props
7954
- * @param {Object|Array} props.element
7955
- * @param {import('./components/Header').HeaderProvider} props.headerProvider
7956
- * @param {PlaceholderProvider} [props.placeholderProvider]
7957
- * @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
7958
- * @param {Object} [props.layoutConfig]
7959
- * @param {Function} [props.layoutChanged]
7960
- * @param {DescriptionConfig} [props.descriptionConfig]
7961
- * @param {Function} [props.descriptionLoaded]
7962
- * @param {TooltipConfig} [props.tooltipConfig]
7963
- * @param {Function} [props.tooltipLoaded]
7964
- * @param {HTMLElement} [props.feelPopupContainer]
7965
- * @param {Function} [props.getFeelPopupLinks]
7966
- * @param {Object} [props.eventBus]
7923
+ /**
7924
+ * A basic properties panel component. Describes *how* content will be rendered, accepts
7925
+ * data from implementor to describe *what* will be rendered.
7926
+ *
7927
+ * @param {Object} props
7928
+ * @param {Object|Array} props.element
7929
+ * @param {import('./components/Header').HeaderProvider} props.headerProvider
7930
+ * @param {PlaceholderProvider} [props.placeholderProvider]
7931
+ * @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
7932
+ * @param {Object} [props.layoutConfig]
7933
+ * @param {Function} [props.layoutChanged]
7934
+ * @param {DescriptionConfig} [props.descriptionConfig]
7935
+ * @param {Function} [props.descriptionLoaded]
7936
+ * @param {TooltipConfig} [props.tooltipConfig]
7937
+ * @param {Function} [props.tooltipLoaded]
7938
+ * @param {HTMLElement} [props.feelPopupContainer]
7939
+ * @param {Function} [props.getFeelPopupLinks]
7940
+ * @param {Object} [props.eventBus]
7967
7941
  */
7968
7942
  function PropertiesPanel$1(props) {
7969
7943
  const {
@@ -8136,11 +8110,11 @@ function createTooltipContext(overrides = {}) {
8136
8110
 
8137
8111
  // hooks //////////////////
8138
8112
 
8139
- /**
8140
- * This hook behaves like useLayoutEffect, but does not trigger on the first render.
8141
- *
8142
- * @param {Function} effect
8143
- * @param {Array} deps
8113
+ /**
8114
+ * This hook behaves like useLayoutEffect, but does not trigger on the first render.
8115
+ *
8116
+ * @param {Function} effect
8117
+ * @param {Array} deps
8144
8118
  */
8145
8119
  function useUpdateLayoutEffect(effect, deps) {
8146
8120
  const isMounted = useRef(false);
@@ -8153,20 +8127,20 @@ function useUpdateLayoutEffect(effect, deps) {
8153
8127
  }, deps);
8154
8128
  }
8155
8129
 
8156
- /**
8157
- * @typedef { {
8158
- * [key: string]: string;
8159
- * } } TranslateReplacements
8130
+ /**
8131
+ * @typedef { {
8132
+ * [key: string]: string;
8133
+ * } } TranslateReplacements
8160
8134
  */
8161
8135
 
8162
- /**
8163
- * A simple translation stub to be used for multi-language support.
8164
- * Can be easily replaced with a more sophisticated solution.
8165
- *
8166
- * @param {string} template to interpolate
8167
- * @param {TranslateReplacements} [replacements] a map with substitutes
8168
- *
8169
- * @return {string} the translated string
8136
+ /**
8137
+ * A simple translation stub to be used for multi-language support.
8138
+ * Can be easily replaced with a more sophisticated solution.
8139
+ *
8140
+ * @param {string} template to interpolate
8141
+ * @param {TranslateReplacements} [replacements] a map with substitutes
8142
+ *
8143
+ * @return {string} the translated string
8170
8144
  */
8171
8145
  function translateFallback(template, replacements) {
8172
8146
  replacements = replacements || {};
@@ -8275,8 +8249,8 @@ function ListItem(props) {
8275
8249
  }
8276
8250
  const noop$1 = () => {};
8277
8251
 
8278
- /**
8279
- * @param {import('../PropertiesPanel').ListGroupDefinition} props
8252
+ /**
8253
+ * @param {import('../PropertiesPanel').ListGroupDefinition} props
8280
8254
  */
8281
8255
  function ListGroup(props) {
8282
8256
  const {
@@ -8467,18 +8441,18 @@ function Checkbox(props) {
8467
8441
  });
8468
8442
  }
8469
8443
 
8470
- /**
8471
- * @param {Object} props
8472
- * @param {Object} props.element
8473
- * @param {String} props.id
8474
- * @param {String} props.description
8475
- * @param {String} props.label
8476
- * @param {Function} props.getValue
8477
- * @param {Function} props.setValue
8478
- * @param {Function} props.onFocus
8479
- * @param {Function} props.onBlur
8480
- * @param {string|import('preact').Component} props.tooltip
8481
- * @param {boolean} [props.disabled]
8444
+ /**
8445
+ * @param {Object} props
8446
+ * @param {Object} props.element
8447
+ * @param {String} props.id
8448
+ * @param {String} props.description
8449
+ * @param {String} props.label
8450
+ * @param {Function} props.getValue
8451
+ * @param {Function} props.setValue
8452
+ * @param {Function} props.onFocus
8453
+ * @param {Function} props.onBlur
8454
+ * @param {string|import('preact').Component} props.tooltip
8455
+ * @param {boolean} [props.disabled]
8482
8456
  */
8483
8457
  function CheckboxEntry(props) {
8484
8458
  const {
@@ -8598,20 +8572,20 @@ function Select(props) {
8598
8572
  });
8599
8573
  }
8600
8574
 
8601
- /**
8602
- * @param {object} props
8603
- * @param {object} props.element
8604
- * @param {string} props.id
8605
- * @param {string} [props.description]
8606
- * @param {string} props.label
8607
- * @param {Function} props.getValue
8608
- * @param {Function} props.setValue
8609
- * @param {Function} props.onFocus
8610
- * @param {Function} props.onBlur
8611
- * @param {Function} props.getOptions
8612
- * @param {boolean} [props.disabled]
8613
- * @param {Function} [props.validate]
8614
- * @param {string|import('preact').Component} props.tooltip
8575
+ /**
8576
+ * @param {object} props
8577
+ * @param {object} props.element
8578
+ * @param {string} props.id
8579
+ * @param {string} [props.description]
8580
+ * @param {string} props.label
8581
+ * @param {Function} props.getValue
8582
+ * @param {Function} props.setValue
8583
+ * @param {Function} props.onFocus
8584
+ * @param {Function} props.onBlur
8585
+ * @param {Function} props.getOptions
8586
+ * @param {boolean} [props.disabled]
8587
+ * @param {Function} [props.validate]
8588
+ * @param {string|import('preact').Component} props.tooltip
8615
8589
  */
8616
8590
  function SelectEntry(props) {
8617
8591
  const {
@@ -8714,6 +8688,12 @@ function TextArea(props) {
8714
8688
  autoResize && resizeToContents(e.target);
8715
8689
  setLocalValue(e.target.value);
8716
8690
  };
8691
+ const handleOnBlur = e => {
8692
+ if (onBlur) {
8693
+ onBlur(e);
8694
+ }
8695
+ setLocalValue(e.target.value.trim());
8696
+ };
8717
8697
  useLayoutEffect(() => {
8718
8698
  autoResize && resizeToContents(ref.current);
8719
8699
  }, []);
@@ -8745,7 +8725,7 @@ function TextArea(props) {
8745
8725
  class: classnames('bio-properties-panel-input', monospace ? 'bio-properties-panel-input-monospace' : '', autoResize ? 'auto-resize' : ''),
8746
8726
  onInput: handleInput,
8747
8727
  onFocus: onFocus,
8748
- onBlur: onBlur,
8728
+ onBlur: handleOnBlur,
8749
8729
  placeholder: placeholder,
8750
8730
  rows: rows,
8751
8731
  value: localValue,
@@ -8863,6 +8843,12 @@ function Textfield(props) {
8863
8843
  const handleInputCallback = useMemo(() => {
8864
8844
  return debounce(target => onInput(target.value.length ? target.value : undefined));
8865
8845
  }, [onInput, debounce]);
8846
+ const handleOnBlur = e => {
8847
+ if (onBlur) {
8848
+ onBlur(e);
8849
+ }
8850
+ setLocalValue(e.target.value.trim());
8851
+ };
8866
8852
  const handleInput = e => {
8867
8853
  handleInputCallback(e.target);
8868
8854
  setLocalValue(e.target.value);
@@ -8895,27 +8881,27 @@ function Textfield(props) {
8895
8881
  class: "bio-properties-panel-input",
8896
8882
  onInput: handleInput,
8897
8883
  onFocus: onFocus,
8898
- onBlur: onBlur,
8884
+ onBlur: handleOnBlur,
8899
8885
  placeholder: placeholder,
8900
8886
  value: localValue
8901
8887
  })]
8902
8888
  });
8903
8889
  }
8904
8890
 
8905
- /**
8906
- * @param {Object} props
8907
- * @param {Object} props.element
8908
- * @param {String} props.id
8909
- * @param {String} props.description
8910
- * @param {Boolean} props.debounce
8911
- * @param {Boolean} props.disabled
8912
- * @param {String} props.label
8913
- * @param {Function} props.getValue
8914
- * @param {Function} props.setValue
8915
- * @param {Function} props.onFocus
8916
- * @param {Function} props.onBlur
8917
- * @param {string|import('preact').Component} props.tooltip
8918
- * @param {Function} props.validate
8891
+ /**
8892
+ * @param {Object} props
8893
+ * @param {Object} props.element
8894
+ * @param {String} props.id
8895
+ * @param {String} props.description
8896
+ * @param {Boolean} props.debounce
8897
+ * @param {Boolean} props.disabled
8898
+ * @param {String} props.label
8899
+ * @param {Function} props.getValue
8900
+ * @param {Function} props.setValue
8901
+ * @param {Function} props.onFocus
8902
+ * @param {Function} props.onBlur
8903
+ * @param {string|import('preact').Component} props.tooltip
8904
+ * @param {Function} props.validate
8919
8905
  */
8920
8906
  function TextfieldEntry(props) {
8921
8907
  const {
@@ -8990,20 +8976,20 @@ class FeelPopupModule {
8990
8976
  this._eventBus = eventBus;
8991
8977
  }
8992
8978
 
8993
- /**
8994
- * Check if the FEEL popup is open.
8995
- * @return {Boolean}
8979
+ /**
8980
+ * Check if the FEEL popup is open.
8981
+ * @return {Boolean}
8996
8982
  */
8997
8983
  isOpen() {
8998
8984
  return this._eventBus.fire('feelPopup._isOpen');
8999
8985
  }
9000
8986
 
9001
- /**
9002
- * Open the FEEL popup.
9003
- *
9004
- * @param {String} entryId
9005
- * @param {Object} popupConfig
9006
- * @param {HTMLElement} sourceElement
8987
+ /**
8988
+ * Open the FEEL popup.
8989
+ *
8990
+ * @param {String} entryId
8991
+ * @param {Object} popupConfig
8992
+ * @param {HTMLElement} sourceElement
9007
8993
  */
9008
8994
  open(entryId, popupConfig, sourceElement) {
9009
8995
  return this._eventBus.fire('feelPopup._open', {
@@ -9013,8 +8999,8 @@ class FeelPopupModule {
9013
8999
  });
9014
9000
  }
9015
9001
 
9016
- /**
9017
- * Close the FEEL popup.
9002
+ /**
9003
+ * Close the FEEL popup.
9018
9004
  */
9019
9005
  close() {
9020
9006
  return this._eventBus.fire('feelPopup._close');
@@ -10529,7 +10515,7 @@ function Height(props) {
10529
10515
  id,
10530
10516
  getValue,
10531
10517
  setValue,
10532
- validate: validate$a
10518
+ validate: validate$9
10533
10519
  });
10534
10520
  }
10535
10521
 
@@ -10539,7 +10525,7 @@ function Height(props) {
10539
10525
  * @param {number|void} value
10540
10526
  * @returns {string|null}
10541
10527
  */
10542
- const validate$a = value => {
10528
+ const validate$9 = value => {
10543
10529
  if (typeof value !== 'number') {
10544
10530
  return 'A number is required.';
10545
10531
  }
@@ -10603,7 +10589,7 @@ function Url(props) {
10603
10589
  setValue,
10604
10590
  singleLine: true,
10605
10591
  tooltip: getTooltip$1(),
10606
- validate: validate$9,
10592
+ validate: validate$8,
10607
10593
  variables
10608
10594
  });
10609
10595
  }
@@ -10631,7 +10617,7 @@ function getTooltip$1() {
10631
10617
  * @param {string|void} value
10632
10618
  * @returns {string|null}
10633
10619
  */
10634
- const validate$9 = value => {
10620
+ const validate$8 = value => {
10635
10621
  if (!value || value.startsWith('=')) {
10636
10622
  return;
10637
10623
  }
@@ -10722,7 +10708,7 @@ function Text(props) {
10722
10708
  };
10723
10709
  return FeelTemplatingEntry({
10724
10710
  debounce,
10725
- description: description$4,
10711
+ description: description$3,
10726
10712
  element: field,
10727
10713
  getValue,
10728
10714
  id,
@@ -10732,7 +10718,7 @@ function Text(props) {
10732
10718
  variables
10733
10719
  });
10734
10720
  }
10735
- const description$4 = jsxs(Fragment$1, {
10721
+ const description$3 = jsxs(Fragment$1, {
10736
10722
  children: ["Supports markdown and templating.", ' ', jsx("a", {
10737
10723
  href: "https://docs.camunda.io/docs/components/modeler/forms/form-element-library/forms-element-library-text/",
10738
10724
  target: "_blank",
@@ -10775,13 +10761,13 @@ function Content(props) {
10775
10761
  };
10776
10762
  return FeelTemplatingEntry({
10777
10763
  debounce,
10778
- description: description$3,
10764
+ description: description$2,
10779
10765
  element: field,
10780
10766
  getValue,
10781
10767
  id,
10782
10768
  label: 'Content',
10783
10769
  hostLanguage: 'html',
10784
- validate: validate$8,
10770
+ validate: validate$7,
10785
10771
  setValue,
10786
10772
  variables
10787
10773
  });
@@ -10789,7 +10775,7 @@ function Content(props) {
10789
10775
 
10790
10776
  // helpers //////////
10791
10777
 
10792
- const description$3 = jsxs(Fragment$1, {
10778
+ const description$2 = jsxs(Fragment$1, {
10793
10779
  children: ["Supports HTML, styling, and templating. Styles are automatically scoped to the HTML component.", ' ', jsx("a", {
10794
10780
  href: "https://docs.camunda.io/docs/components/modeler/forms/form-element-library/forms-element-library-html/",
10795
10781
  target: "_blank",
@@ -10802,7 +10788,7 @@ const description$3 = jsxs(Fragment$1, {
10802
10788
  * @param {string|void} value
10803
10789
  * @returns {string|null}
10804
10790
  */
10805
- const validate$8 = value => {
10791
+ const validate$7 = value => {
10806
10792
  // allow empty state
10807
10793
  if (typeof value !== 'string' || value === '') {
10808
10794
  return null;
@@ -11641,7 +11627,7 @@ function InputValuesKey(props) {
11641
11627
  id,
11642
11628
  label: 'Input values key',
11643
11629
  setValue,
11644
- validate: validate$7
11630
+ validate: validate$6
11645
11631
  });
11646
11632
  }
11647
11633
 
@@ -11651,7 +11637,7 @@ function InputValuesKey(props) {
11651
11637
  * @param {string|void} value
11652
11638
  * @returns {string|null}
11653
11639
  */
11654
- const validate$7 = value => {
11640
+ const validate$6 = value => {
11655
11641
  if (typeof value !== 'string' || value.length === 0) {
11656
11642
  return 'Must not be empty.';
11657
11643
  }
@@ -11677,7 +11663,14 @@ function StaticOptionsSourceEntry(props) {
11677
11663
  editField(field, OPTIONS_SOURCES_PATHS[OPTIONS_SOURCES.STATIC], arrayAdd(values, values.length, entry));
11678
11664
  };
11679
11665
  const removeEntry = entry => {
11680
- editField(field, OPTIONS_SOURCES_PATHS[OPTIONS_SOURCES.STATIC], without(values, entry));
11666
+ if (field.defaultValue === entry.value) {
11667
+ editField(field, {
11668
+ values: without(values, entry),
11669
+ defaultValue: undefined
11670
+ });
11671
+ } else {
11672
+ editField(field, OPTIONS_SOURCES_PATHS[OPTIONS_SOURCES.STATIC], without(values, entry));
11673
+ }
11681
11674
  };
11682
11675
  const validateFactory = (key, getValue) => {
11683
11676
  return value => {
@@ -12093,7 +12086,7 @@ function Source(props) {
12093
12086
  setValue,
12094
12087
  singleLine: true,
12095
12088
  variables,
12096
- validate: validate$6
12089
+ validate: validate$5
12097
12090
  });
12098
12091
  }
12099
12092
 
@@ -12103,7 +12096,7 @@ function Source(props) {
12103
12096
  * @param {string|void} value
12104
12097
  * @returns {string|null}
12105
12098
  */
12106
- const validate$6 = value => {
12099
+ const validate$5 = value => {
12107
12100
  if (!isString(value) || value.length === 0) {
12108
12101
  return 'Must not be empty.';
12109
12102
  }
@@ -12207,7 +12200,7 @@ function RowCount(props) {
12207
12200
  id,
12208
12201
  getValue,
12209
12202
  setValue,
12210
- validate: validate$5
12203
+ validate: validate$4
12211
12204
  });
12212
12205
  }
12213
12206
 
@@ -12217,7 +12210,7 @@ function RowCount(props) {
12217
12210
  * @param {string|void} value
12218
12211
  * @returns {string|null}
12219
12212
  */
12220
- const validate$5 = value => {
12213
+ const validate$4 = value => {
12221
12214
  if (isNil(value)) {
12222
12215
  return null;
12223
12216
  }
@@ -12391,7 +12384,7 @@ function ColumnsExpression(props) {
12391
12384
  setValue,
12392
12385
  singleLine: true,
12393
12386
  variables,
12394
- validate: validate$4
12387
+ validate: validate$3
12395
12388
  });
12396
12389
  }
12397
12390
 
@@ -12401,7 +12394,7 @@ function ColumnsExpression(props) {
12401
12394
  * @param {string|void} value
12402
12395
  * @returns {string|null}
12403
12396
  */
12404
- const validate$4 = value => {
12397
+ const validate$3 = value => {
12405
12398
  if (!isString(value) || value.length === 0 || value === '=') {
12406
12399
  return 'Must not be empty.';
12407
12400
  }
@@ -12499,7 +12492,7 @@ function Key(props) {
12499
12492
  id,
12500
12493
  label: 'Key',
12501
12494
  setValue,
12502
- validate: validate$3
12495
+ validate: validate$2
12503
12496
  });
12504
12497
  }
12505
12498
 
@@ -12509,7 +12502,7 @@ function Key(props) {
12509
12502
  * @param {string|void} value
12510
12503
  * @returns {string|null}
12511
12504
  */
12512
- function validate$3(value) {
12505
+ function validate$2(value) {
12513
12506
  if (!isString(value) || value.length === 0) {
12514
12507
  return 'Must not be empty.';
12515
12508
  }
@@ -12647,13 +12640,13 @@ function Accept(props) {
12647
12640
  singleLine: true,
12648
12641
  setValue,
12649
12642
  variables,
12650
- description: description$2
12643
+ description: description$1
12651
12644
  });
12652
12645
  }
12653
12646
 
12654
12647
  // helpers //////////
12655
12648
 
12656
- const description$2 = jsxs(Fragment$1, {
12649
+ const description$1 = jsxs(Fragment$1, {
12657
12650
  children: ["A comma-separated list of", ' ', jsx("a", {
12658
12651
  href: "https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers",
12659
12652
  target: "_blank",
@@ -12744,6 +12737,7 @@ function DocumentsDataSource(props) {
12744
12737
  const schema = `[
12745
12738
  {
12746
12739
  "documentId": "u123",
12740
+ "endpoint": "https://api.example.com/documents/u123",
12747
12741
  "metadata": {
12748
12742
  "fileName": "Document.pdf",
12749
12743
  "contentType": "application/pdf"
@@ -12761,84 +12755,15 @@ function DocumentsDataSource(props) {
12761
12755
  children: jsx("code", {
12762
12756
  children: schema
12763
12757
  })
12764
- })]
12765
- });
12766
- return FeelTemplatingEntry({
12767
- debounce,
12768
- element: field,
12769
- getValue,
12770
- id,
12771
- label: 'Document reference',
12772
- feel: 'required',
12773
- singleLine: true,
12774
- setValue,
12775
- variables,
12776
- tooltip,
12777
- validate: validate$2
12778
- });
12779
- }
12780
-
12781
- // helpers //////////
12782
-
12783
- /**
12784
- * @param {string|undefined} value
12785
- * @returns {string|null}
12786
- */
12787
- const validate$2 = value => {
12788
- if (typeof value !== 'string' || value.length === 0) {
12789
- return 'The document data source is required.';
12790
- }
12791
- };
12792
-
12793
- function EndpointKeyEntry(props) {
12794
- const {
12795
- editField,
12796
- field
12797
- } = props;
12798
- const entries = [];
12799
- entries.push({
12800
- id: 'endpointKey',
12801
- component: EndpointKey,
12802
- editField: editField,
12803
- field: field,
12804
- isEdited: isEdited$6,
12805
- isDefaultVisible: field => field.type === 'documentPreview'
12806
- });
12807
- return entries;
12808
- }
12809
- function EndpointKey(props) {
12810
- const {
12811
- editField,
12812
- field,
12813
- id
12814
- } = props;
12815
- const debounce = useService('debounce');
12816
- const variables = useVariables().map(name => ({
12817
- name
12818
- }));
12819
- const path = ['endpointKey'];
12820
- const getValue = () => {
12821
- return get(field, path, '');
12822
- };
12823
- const setValue = value => {
12824
- return editField(field, path, value);
12825
- };
12826
- const tooltip = jsxs("div", {
12827
- children: [jsx("p", {
12828
- children: "Enter a context key that generates a string with the API endpoint to download a document."
12829
- }), jsxs("p", {
12830
- children: ["The string must contain ", jsx("code", {
12831
- children: '{ documentId }'
12832
- }), ", which will be replaced with the document ID from the document\u2018s reference."]
12833
12758
  }), jsx("p", {
12834
- children: "If you\u2018re using the Camunda Tasklist, this variable is automatically added to the context for you."
12759
+ children: "When using Camunda Tasklist UI, additional document reference attributes are automatically handled. Modifying the document reference may affect the document preview functionality."
12835
12760
  }), jsxs("p", {
12836
- children: ["For more details, see the", ' ', jsx("a", {
12837
- href: "https://docs.camunda.io/docs/next/components/modeler/forms/form-element-library/forms-element-library-document-preview/",
12838
- rel: "noopener noreferrer",
12761
+ children: ["Learn more in our", ' ', jsx("a", {
12762
+ href: "https://docs.camunda.io/docs/8.7/components/modeler/forms/form-element-library/forms-element-library-document-preview/",
12839
12763
  target: "_blank",
12840
- children: "Camunda documentation"
12841
- })]
12764
+ rel: "noopener noreferrer",
12765
+ children: "documentation"
12766
+ }), "."]
12842
12767
  })]
12843
12768
  });
12844
12769
  return FeelTemplatingEntry({
@@ -12846,12 +12771,11 @@ function EndpointKey(props) {
12846
12771
  element: field,
12847
12772
  getValue,
12848
12773
  id,
12849
- label: 'Document URL',
12774
+ label: 'Document reference',
12850
12775
  feel: 'required',
12851
12776
  singleLine: true,
12852
12777
  setValue,
12853
12778
  variables,
12854
- description: description$1,
12855
12779
  tooltip,
12856
12780
  validate: validate$1
12857
12781
  });
@@ -12865,12 +12789,9 @@ function EndpointKey(props) {
12865
12789
  */
12866
12790
  const validate$1 = value => {
12867
12791
  if (typeof value !== 'string' || value.length === 0) {
12868
- return 'The document reference is required.';
12792
+ return 'The document data source is required.';
12869
12793
  }
12870
12794
  };
12871
- const description$1 = jsx(Fragment$1, {
12872
- children: "Define an API URL for downloading a document"
12873
- });
12874
12795
 
12875
12796
  function MaxHeightEntry(props) {
12876
12797
  const {
@@ -13652,21 +13573,6 @@ const TOOLTIP_TEXT = `"List of items" defines a constant, predefined set of form
13652
13573
  "Expression" defines options that are populated from a FEEL expression.
13653
13574
  `;
13654
13575
 
13655
- function DownloadSettings(field, editField) {
13656
- const entries = [...EndpointKeyEntry({
13657
- field,
13658
- editField
13659
- })];
13660
- if (!entries.length) {
13661
- return null;
13662
- }
13663
- return {
13664
- id: 'downloadSettings',
13665
- label: 'Download settings',
13666
- entries
13667
- };
13668
- }
13669
-
13670
13576
  class PropertiesProvider {
13671
13577
  constructor(propertiesPanel, injector) {
13672
13578
  this._injector = injector;
@@ -13702,7 +13608,7 @@ class PropertiesProvider {
13702
13608
  return groups;
13703
13609
  }
13704
13610
  const getService = (type, strict = true) => this._injector.get(type, strict);
13705
- groups = [...groups, GeneralGroup(field, editField, getService), DownloadSettings(field, editField), ...OptionsGroups(field, editField, getService), ...TableHeaderGroups(field, editField), SecurityAttributesGroup(field, editField), ConditionGroup(field, editField), LayoutGroup(field, editField), AppearanceGroup(field, editField), SerializationGroup(field, editField), ConstraintsGroup(field, editField), ValidationGroup(field, editField), CustomPropertiesGroup(field, editField)].filter(group => group != null);
13611
+ groups = [...groups, GeneralGroup(field, editField, getService), ...OptionsGroups(field, editField, getService), ...TableHeaderGroups(field, editField), SecurityAttributesGroup(field, editField), ConditionGroup(field, editField), LayoutGroup(field, editField), AppearanceGroup(field, editField), SerializationGroup(field, editField), ConstraintsGroup(field, editField), ValidationGroup(field, editField), CustomPropertiesGroup(field, editField)].filter(group => group != null);
13706
13612
  this._filterVisibleEntries(groups, field, getService);
13707
13613
 
13708
13614
  // contract: if a group has no entries or items, it should not be displayed at all