@bpmn-io/properties-panel 0.24.0 → 0.24.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.js CHANGED
@@ -17,52 +17,50 @@ var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
17
17
  var FeelEditor__default = /*#__PURE__*/_interopDefaultLegacy(FeelEditor);
18
18
 
19
19
  var ArrowIcon = function ArrowIcon(props) {
20
- return jsxRuntime.jsx("svg", { ...props,
20
+ return jsxRuntime.jsx("svg", {
21
+ ...props,
21
22
  children: jsxRuntime.jsx("path", {
22
23
  fillRule: "evenodd",
23
24
  d: "m11.657 8-4.95 4.95a1 1 0 0 1-1.414-1.414L8.828 8 5.293 4.464A1 1 0 1 1 6.707 3.05L11.657 8Z"
24
25
  })
25
26
  });
26
27
  };
27
-
28
28
  ArrowIcon.defaultProps = {
29
29
  xmlns: "http://www.w3.org/2000/svg",
30
30
  width: "16",
31
31
  height: "16"
32
32
  };
33
-
34
33
  var CreateIcon = function CreateIcon(props) {
35
- return jsxRuntime.jsx("svg", { ...props,
34
+ return jsxRuntime.jsx("svg", {
35
+ ...props,
36
36
  children: jsxRuntime.jsx("path", {
37
37
  fillRule: "evenodd",
38
38
  d: "M9 13V9h4a1 1 0 0 0 0-2H9V3a1 1 0 1 0-2 0v4H3a1 1 0 1 0 0 2h4v4a1 1 0 0 0 2 0Z"
39
39
  })
40
40
  });
41
41
  };
42
-
43
42
  CreateIcon.defaultProps = {
44
43
  xmlns: "http://www.w3.org/2000/svg",
45
44
  width: "16",
46
45
  height: "16"
47
46
  };
48
-
49
47
  var DeleteIcon = function DeleteIcon(props) {
50
- return jsxRuntime.jsx("svg", { ...props,
48
+ return jsxRuntime.jsx("svg", {
49
+ ...props,
51
50
  children: jsxRuntime.jsx("path", {
52
51
  fillRule: "evenodd",
53
52
  d: "M12 6v7c0 1.1-.4 1.55-1.5 1.55h-5C4.4 14.55 4 14.1 4 13V6h8Zm-1.5 1.5h-5v4.3c0 .66.5 1.2 1.111 1.2H9.39c.611 0 1.111-.54 1.111-1.2V7.5ZM13 3h-2l-1-1H6L5 3H3v1.5h10V3Z"
54
53
  })
55
54
  });
56
55
  };
57
-
58
56
  DeleteIcon.defaultProps = {
59
57
  xmlns: "http://www.w3.org/2000/svg",
60
58
  width: "16",
61
59
  height: "16"
62
60
  };
63
-
64
61
  var ExternalLinkIcon = function ExternalLinkIcon(props) {
65
- return jsxRuntime.jsx("svg", { ...props,
62
+ return jsxRuntime.jsx("svg", {
63
+ ...props,
66
64
  children: jsxRuntime.jsx("path", {
67
65
  fillRule: "evenodd",
68
66
  clipRule: "evenodd",
@@ -71,16 +69,15 @@ var ExternalLinkIcon = function ExternalLinkIcon(props) {
71
69
  })
72
70
  });
73
71
  };
74
-
75
72
  ExternalLinkIcon.defaultProps = {
76
73
  width: "16",
77
74
  height: "16",
78
75
  fill: "none",
79
76
  xmlns: "http://www.w3.org/2000/svg"
80
77
  };
81
-
82
78
  var FeelRequiredIcon = function FeelRequiredIcon(props) {
83
- return jsxRuntime.jsxs("svg", { ...props,
79
+ return jsxRuntime.jsxs("svg", {
80
+ ...props,
84
81
  children: [jsxRuntime.jsx("path", {
85
82
  d: "M5.8 7.06V5.95h4.307v1.11H5.8Zm0 3.071v-1.11h4.307v1.11H5.8Z",
86
83
  fill: "currentColor"
@@ -95,15 +92,14 @@ var FeelRequiredIcon = function FeelRequiredIcon(props) {
95
92
  })]
96
93
  });
97
94
  };
98
-
99
95
  FeelRequiredIcon.defaultProps = {
100
96
  viewBox: "0 0 16 16",
101
97
  fill: "none",
102
98
  xmlns: "http://www.w3.org/2000/svg"
103
99
  };
104
-
105
100
  var FeelOptionalIcon = function FeelOptionalIcon(props) {
106
- return jsxRuntime.jsxs("svg", { ...props,
101
+ return jsxRuntime.jsxs("svg", {
102
+ ...props,
107
103
  children: [jsxRuntime.jsx("path", {
108
104
  d: "M5.845 7.04V5.93h4.307v1.11H5.845Zm0 3.07V9h4.307v1.11H5.845Z",
109
105
  fill: "currentColor"
@@ -115,7 +111,6 @@ var FeelOptionalIcon = function FeelOptionalIcon(props) {
115
111
  })]
116
112
  });
117
113
  };
118
-
119
114
  FeelOptionalIcon.defaultProps = {
120
115
  viewBox: "0 0 16 16",
121
116
  fill: "none",
@@ -220,7 +215,6 @@ const LayoutContext = preact.createContext({
220
215
  *
221
216
  * @returns {string}
222
217
  */
223
-
224
218
  function useDescriptionContext(id, element) {
225
219
  const {
226
220
  getDescriptionForId
@@ -241,28 +235,25 @@ function useError(id) {
241
235
  * @param {string} event
242
236
  * @param {Function} callback
243
237
  */
244
-
245
238
  function useEvent(event, callback, eventBus) {
246
239
  const eventContext = hooks.useContext(EventContext);
247
-
248
240
  if (!eventBus) {
249
241
  ({
250
242
  eventBus
251
243
  } = eventContext);
252
244
  }
245
+ const didMount = hooks.useRef(false);
253
246
 
254
- const didMount = hooks.useRef(false); // (1) subscribe immediately
255
-
247
+ // (1) subscribe immediately
256
248
  if (eventBus && !didMount.current) {
257
249
  eventBus.on(event, callback);
258
- } // (2) update subscription after inputs changed
259
-
250
+ }
260
251
 
252
+ // (2) update subscription after inputs changed
261
253
  hooks.useEffect(() => {
262
254
  if (eventBus && didMount.current) {
263
255
  eventBus.on(event, callback);
264
256
  }
265
-
266
257
  didMount.current = true;
267
258
  return () => {
268
259
  if (eventBus) {
@@ -273,6 +264,7 @@ function useEvent(event, callback, eventBus) {
273
264
  }
274
265
 
275
266
  const KEY_LENGTH = 6;
267
+
276
268
  /**
277
269
  * Create a persistent key factory for plain objects without id.
278
270
  *
@@ -292,21 +284,16 @@ const KEY_LENGTH = 6;
292
284
  * @param {any[]} dependencies
293
285
  * @returns {(element: object) => string}
294
286
  */
295
-
296
287
  function useKeyFactory(dependencies = []) {
297
288
  const map = hooks.useMemo(() => new Map(), dependencies);
298
-
299
289
  const getKey = el => {
300
290
  let key = map.get(el);
301
-
302
291
  if (!key) {
303
292
  key = Math.random().toString().slice(-KEY_LENGTH);
304
293
  map.set(el, key);
305
294
  }
306
-
307
295
  return key;
308
296
  };
309
-
310
297
  return getKey;
311
298
  }
312
299
 
@@ -325,7 +312,6 @@ function useKeyFactory(dependencies = []) {
325
312
  *
326
313
  * @returns {[ any, Function ]}
327
314
  */
328
-
329
315
  function useLayoutState(path, defaultValue) {
330
316
  const {
331
317
  getLayoutForKey,
@@ -333,14 +319,13 @@ function useLayoutState(path, defaultValue) {
333
319
  } = hooks.useContext(LayoutContext);
334
320
  const layoutForKey = getLayoutForKey(path, defaultValue);
335
321
  const [value, set] = hooks.useState(layoutForKey);
336
-
337
322
  const setState = newValue => {
338
323
  // (1) set component state
339
- set(newValue); // (2) set context
324
+ set(newValue);
340
325
 
326
+ // (2) set context
341
327
  setLayoutForKey(path, newValue);
342
328
  };
343
-
344
329
  return [value, setState];
345
330
  }
346
331
 
@@ -366,7 +351,6 @@ function usePrevious(value) {
366
351
  *
367
352
  * @returns {import('preact').Ref}
368
353
  */
369
-
370
354
  function useShowEntryEvent(id) {
371
355
  const {
372
356
  onShow
@@ -376,7 +360,6 @@ function useShowEntryEvent(id) {
376
360
  const onShowEntry = hooks.useCallback(event => {
377
361
  if (event.id === id) {
378
362
  onShow();
379
-
380
363
  if (!focus.current) {
381
364
  focus.current = true;
382
365
  }
@@ -387,11 +370,9 @@ function useShowEntryEvent(id) {
387
370
  if (minDash.isFunction(ref.current.focus)) {
388
371
  ref.current.focus();
389
372
  }
390
-
391
373
  if (minDash.isFunction(ref.current.select)) {
392
374
  ref.current.select();
393
375
  }
394
-
395
376
  focus.current = false;
396
377
  }
397
378
  });
@@ -414,17 +395,15 @@ function useShowEntryEvent(id) {
414
395
  * @param {string} scrollContainerSelector
415
396
  * @param {setSticky} setSticky
416
397
  */
417
-
418
398
  function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky) {
419
399
  hooks.useEffect(() => {
420
- const Observer = IntersectionObserver; // return early if IntersectionObserver is not available
400
+ const Observer = IntersectionObserver;
421
401
 
402
+ // return early if IntersectionObserver is not available
422
403
  if (!Observer) {
423
404
  return;
424
405
  }
425
-
426
406
  let observer;
427
-
428
407
  if (ref.current) {
429
408
  const scrollContainer = minDom.query(scrollContainerSelector);
430
409
  observer = new Observer(entries => {
@@ -442,9 +421,9 @@ function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky)
442
421
  threshold: [1]
443
422
  });
444
423
  observer.observe(ref.current);
445
- } // Unobserve if unmounted
446
-
424
+ }
447
425
 
426
+ // Unobserve if unmounted
448
427
  return () => {
449
428
  if (ref.current && observer) {
450
429
  observer.unobserve(ref.current);
@@ -467,7 +446,6 @@ function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky)
467
446
  * @param {Function} callback function with changing reference
468
447
  * @returns {Function} static function reference
469
448
  */
470
-
471
449
  function useStaticCallback(callback) {
472
450
  const callbackRef = hooks.useRef(callback);
473
451
  callbackRef.current = callback;
@@ -485,12 +463,11 @@ function Group(props) {
485
463
  const groupRef = hooks.useRef(null);
486
464
  const [open, setOpen] = useLayoutState(['groups', id, 'open'], shouldOpen);
487
465
  const onShow = hooks.useCallback(() => setOpen(true), [setOpen]);
488
-
489
466
  const toggleOpen = () => setOpen(!open);
490
-
491
467
  const [edited, setEdited] = hooks.useState(false);
492
- const [sticky, setSticky] = hooks.useState(false); // set edited state depending on all entries
468
+ const [sticky, setSticky] = hooks.useState(false);
493
469
 
470
+ // set edited state depending on all entries
494
471
  hooks.useEffect(() => {
495
472
  const hasOneEditedEntry = entries.find(entry => {
496
473
  const {
@@ -498,19 +475,19 @@ function Group(props) {
498
475
  isEdited
499
476
  } = entry;
500
477
  const entryNode = minDom.query(`[data-entry-id="${id}"]`);
501
-
502
478
  if (!minDash.isFunction(isEdited) || !entryNode) {
503
479
  return false;
504
480
  }
505
-
506
481
  const inputNode = minDom.query('.bio-properties-panel-input', entryNode);
507
482
  return isEdited(inputNode);
508
483
  });
509
484
  setEdited(hasOneEditedEntry);
510
- }, [entries]); // set css class when group is sticky to top
485
+ }, [entries]);
511
486
 
487
+ // set css class when group is sticky to top
512
488
  useStickyIntersectionObserver(groupRef, 'div.bio-properties-panel-scroll-container', setSticky);
513
- const propertiesPanelContext = { ...hooks.useContext(LayoutContext),
489
+ const propertiesPanelContext = {
490
+ ...hooks.useContext(LayoutContext),
514
491
  onShow
515
492
  };
516
493
  return jsxRuntime.jsxs("div", {
@@ -543,7 +520,8 @@ function Group(props) {
543
520
  component: Component,
544
521
  id
545
522
  } = entry;
546
- return preact.createElement(Component, { ...entry,
523
+ return preact.createElement(Component, {
524
+ ...entry,
547
525
  element: element,
548
526
  key: id
549
527
  });
@@ -552,7 +530,6 @@ function Group(props) {
552
530
  })]
553
531
  });
554
532
  }
555
-
556
533
  function DataMarker() {
557
534
  return jsxRuntime.jsx("div", {
558
535
  title: "Section contains data",
@@ -591,6 +568,7 @@ const DEFAULT_LAYOUT = {
591
568
  open: true
592
569
  };
593
570
  const DEFAULT_DESCRIPTION = {};
571
+
594
572
  /**
595
573
  * @typedef { {
596
574
  * component: import('preact').Component,
@@ -658,7 +636,6 @@ const DEFAULT_DESCRIPTION = {};
658
636
  * @param {Function} [props.descriptionLoaded]
659
637
  * @param {Object} [props.eventBus]
660
638
  */
661
-
662
639
  function PropertiesPanel(props) {
663
640
  const {
664
641
  element,
@@ -670,52 +647,46 @@ function PropertiesPanel(props) {
670
647
  descriptionConfig = {},
671
648
  descriptionLoaded,
672
649
  eventBus
673
- } = props; // set-up layout context
650
+ } = props;
674
651
 
652
+ // set-up layout context
675
653
  const [layout, setLayout] = hooks.useState(createLayout(layoutConfig));
676
654
  hooks.useEffect(() => {
677
655
  if (typeof layoutChanged === 'function') {
678
656
  layoutChanged(layout);
679
657
  }
680
658
  }, [layout, layoutChanged]);
681
-
682
659
  const getLayoutForKey = (key, defaultValue) => {
683
660
  return minDash.get(layout, key, defaultValue);
684
661
  };
685
-
686
662
  const setLayoutForKey = (key, config) => {
687
663
  const newLayout = minDash.assign({}, layout);
688
664
  minDash.set(newLayout, key, config);
689
665
  setLayout(newLayout);
690
666
  };
691
-
692
667
  const layoutContext = {
693
668
  layout,
694
669
  setLayout,
695
670
  getLayoutForKey,
696
671
  setLayoutForKey
697
- }; // set-up description context
672
+ };
698
673
 
674
+ // set-up description context
699
675
  const description = createDescriptionContext(descriptionConfig);
700
-
701
676
  if (typeof descriptionLoaded === 'function') {
702
677
  descriptionLoaded(description);
703
678
  }
704
-
705
679
  const getDescriptionForId = (id, element) => {
706
680
  return description[id] && description[id](element);
707
681
  };
708
-
709
682
  const descriptionContext = {
710
683
  description,
711
684
  getDescriptionForId
712
685
  };
713
686
  const [errors, setErrors] = hooks.useState({});
714
-
715
687
  const onSetErrors = ({
716
688
  errors
717
689
  }) => setErrors(errors);
718
-
719
690
  useEvent('propertiesPanel.setErrors', onSetErrors, eventBus);
720
691
  const errorsContext = {
721
692
  errors
@@ -725,19 +696,21 @@ function PropertiesPanel(props) {
725
696
  };
726
697
  const propertiesPanelContext = {
727
698
  element
728
- }; // empty state
699
+ };
729
700
 
701
+ // empty state
730
702
  if (placeholderProvider && !element) {
731
- return jsxRuntime.jsx(Placeholder, { ...placeholderProvider.getEmpty()
703
+ return jsxRuntime.jsx(Placeholder, {
704
+ ...placeholderProvider.getEmpty()
732
705
  });
733
- } // multiple state
734
-
706
+ }
735
707
 
708
+ // multiple state
736
709
  if (placeholderProvider && minDash.isArray(element)) {
737
- return jsxRuntime.jsx(Placeholder, { ...placeholderProvider.getMultiple()
710
+ return jsxRuntime.jsx(Placeholder, {
711
+ ...placeholderProvider.getMultiple()
738
712
  });
739
713
  }
740
-
741
714
  return jsxRuntime.jsx(LayoutContext.Provider, {
742
715
  value: propertiesPanelContext,
743
716
  children: jsxRuntime.jsx(ErrorsContext.Provider, {
@@ -760,7 +733,8 @@ function PropertiesPanel(props) {
760
733
  component: Component = Group,
761
734
  id
762
735
  } = group;
763
- return preact.createElement(Component, { ...group,
736
+ return preact.createElement(Component, {
737
+ ...group,
764
738
  key: id,
765
739
  element: element
766
740
  });
@@ -772,16 +746,19 @@ function PropertiesPanel(props) {
772
746
  })
773
747
  })
774
748
  });
775
- } // helpers //////////////////
749
+ }
750
+
751
+ // helpers //////////////////
776
752
 
777
753
  function createLayout(overrides) {
778
- return { ...DEFAULT_LAYOUT,
754
+ return {
755
+ ...DEFAULT_LAYOUT,
779
756
  ...overrides
780
757
  };
781
758
  }
782
-
783
759
  function createDescriptionContext(overrides) {
784
- return { ...DEFAULT_DESCRIPTION,
760
+ return {
761
+ ...DEFAULT_DESCRIPTION,
785
762
  ...overrides
786
763
  };
787
764
  }
@@ -795,24 +772,19 @@ function DropdownButton(props) {
795
772
  const dropdownRef = hooks.useRef(null);
796
773
  const menuRef = hooks.useRef(null);
797
774
  const [open, setOpen] = hooks.useState(false);
798
-
799
775
  const close = () => setOpen(false);
800
-
801
776
  function onDropdownToggle(event) {
802
777
  if (menuRef.current && menuRef.current.contains(event.target)) {
803
778
  return;
804
779
  }
805
-
806
780
  event.stopPropagation();
807
781
  setOpen(open => !open);
808
782
  }
809
-
810
783
  function onActionClick(event, action) {
811
784
  event.stopPropagation();
812
785
  close();
813
786
  action();
814
787
  }
815
-
816
788
  useGlobalClick([dropdownRef.current], () => close());
817
789
  return jsxRuntime.jsxs("div", {
818
790
  class: classnames__default["default"]('bio-properties-panel-dropdown-button', {
@@ -830,7 +802,6 @@ function DropdownButton(props) {
830
802
  })]
831
803
  });
832
804
  }
833
-
834
805
  function MenuItem({
835
806
  item,
836
807
  onClick
@@ -840,7 +811,6 @@ function MenuItem({
840
811
  class: "bio-properties-panel-dropdown-button__menu-item bio-properties-panel-dropdown-button__menu-item--separator"
841
812
  });
842
813
  }
843
-
844
814
  if (item.action) {
845
815
  return jsxRuntime.jsx("button", {
846
816
  class: "bio-properties-panel-dropdown-button__menu-item bio-properties-panel-dropdown-button__menu-item--actionable",
@@ -848,19 +818,17 @@ function MenuItem({
848
818
  children: item.entry
849
819
  });
850
820
  }
851
-
852
821
  return jsxRuntime.jsx("div", {
853
822
  class: "bio-properties-panel-dropdown-button__menu-item",
854
823
  children: item.entry
855
824
  });
856
825
  }
826
+
857
827
  /**
858
828
  *
859
829
  * @param {Array<null | Element>} ignoredElements
860
830
  * @param {Function} callback
861
831
  */
862
-
863
-
864
832
  function useGlobalClick(ignoredElements, callback) {
865
833
  hooks.useEffect(() => {
866
834
  /**
@@ -870,10 +838,8 @@ function useGlobalClick(ignoredElements, callback) {
870
838
  if (ignoredElements.some(element => element && element.contains(event.target))) {
871
839
  return;
872
840
  }
873
-
874
841
  callback();
875
842
  }
876
-
877
843
  document.addEventListener('click', listener, {
878
844
  capture: true
879
845
  });
@@ -890,7 +856,8 @@ function HeaderButton(props) {
890
856
  onClick = () => {},
891
857
  ...otherProps
892
858
  } = props;
893
- return jsxRuntime.jsx("button", { ...otherProps,
859
+ return jsxRuntime.jsx("button", {
860
+ ...otherProps,
894
861
  onClick: onClick,
895
862
  class: classnames__default["default"]('bio-properties-panel-group-header-button', classname),
896
863
  children: children
@@ -907,22 +874,21 @@ function CollapsibleEntry(props) {
907
874
  remove
908
875
  } = props;
909
876
  const [open, setOpen] = hooks.useState(shouldOpen);
910
-
911
877
  const toggleOpen = () => setOpen(!open);
912
-
913
878
  const {
914
879
  onShow
915
880
  } = hooks.useContext(LayoutContext);
916
- const propertiesPanelContext = { ...hooks.useContext(LayoutContext),
881
+ const propertiesPanelContext = {
882
+ ...hooks.useContext(LayoutContext),
917
883
  onShow: hooks.useCallback(() => {
918
884
  setOpen(true);
919
-
920
885
  if (minDash.isFunction(onShow)) {
921
886
  onShow();
922
887
  }
923
888
  }, [onShow, setOpen])
924
- }; // todo(pinussilvestrus): translate once we have a translate mechanism for the core
889
+ };
925
890
 
891
+ // todo(pinussilvestrus): translate once we have a translate mechanism for the core
926
892
  const placeholderLabel = '<empty>';
927
893
  return jsxRuntime.jsxs("div", {
928
894
  "data-entry-id": id,
@@ -955,7 +921,8 @@ function CollapsibleEntry(props) {
955
921
  component: Component,
956
922
  id
957
923
  } = entry;
958
- return preact.createElement(Component, { ...entry,
924
+ return preact.createElement(Component, {
925
+ ...entry,
959
926
  element: element,
960
927
  key: id
961
928
  });
@@ -969,13 +936,13 @@ function ListItem(props) {
969
936
  const {
970
937
  autoFocusEntry,
971
938
  autoOpen
972
- } = props; // focus specified entry on auto open
939
+ } = props;
973
940
 
941
+ // focus specified entry on auto open
974
942
  hooks.useEffect(() => {
975
943
  if (autoOpen && autoFocusEntry) {
976
944
  const entry = minDom.query(`[data-entry-id="${autoFocusEntry}"]`);
977
945
  const focusableInput = minDom.query('.bio-properties-panel-input', entry);
978
-
979
946
  if (focusableInput) {
980
947
  if (minDash.isFunction(focusableInput.select)) {
981
948
  focusableInput.select();
@@ -987,18 +954,18 @@ function ListItem(props) {
987
954
  }, [autoOpen, autoFocusEntry]);
988
955
  return jsxRuntime.jsx("div", {
989
956
  class: "bio-properties-panel-list-item",
990
- children: jsxRuntime.jsx(CollapsibleEntry, { ...props,
957
+ children: jsxRuntime.jsx(CollapsibleEntry, {
958
+ ...props,
991
959
  open: autoOpen
992
960
  })
993
961
  });
994
962
  }
995
963
 
996
964
  const noop$2 = () => {};
965
+
997
966
  /**
998
967
  * @param {import('../PropertiesPanel').ListGroupDefinition} props
999
968
  */
1000
-
1001
-
1002
969
  function ListGroup(props) {
1003
970
  const {
1004
971
  add,
@@ -1018,20 +985,23 @@ function ListGroup(props) {
1018
985
  const prevItems = usePrevious(items);
1019
986
  const prevElement = usePrevious(element);
1020
987
  const elementChanged = element !== prevElement;
1021
- const shouldHandleEffects = !elementChanged && (shouldSort || shouldOpen); // reset initial ordering when element changes (before first render)
988
+ const shouldHandleEffects = !elementChanged && (shouldSort || shouldOpen);
1022
989
 
990
+ // reset initial ordering when element changes (before first render)
1023
991
  if (elementChanged) {
1024
992
  setOrdering(createOrdering(shouldSort ? sortItems(items) : items));
1025
- } // keep ordering in sync to items - and open changes
1026
- // (0) set initial ordering from given items
993
+ }
1027
994
 
995
+ // keep ordering in sync to items - and open changes
1028
996
 
997
+ // (0) set initial ordering from given items
1029
998
  hooks.useEffect(() => {
1030
999
  if (!prevItems || !shouldSort) {
1031
1000
  setOrdering(createOrdering(items));
1032
1001
  }
1033
- }, [items, element]); // (1) items were added
1002
+ }, [items, element]);
1034
1003
 
1004
+ // (1) items were added
1035
1005
  hooks.useEffect(() => {
1036
1006
  if (shouldHandleEffects && prevItems && items.length > prevItems.length) {
1037
1007
  let add = [];
@@ -1040,38 +1010,40 @@ function ListGroup(props) {
1040
1010
  add.push(item.id);
1041
1011
  }
1042
1012
  });
1043
- let newOrdering = ordering; // open if not open and configured
1013
+ let newOrdering = ordering;
1044
1014
 
1015
+ // open if not open and configured
1045
1016
  if (!open && shouldOpen) {
1046
- toggleOpen(); // if I opened and I should sort, then sort items
1017
+ toggleOpen();
1047
1018
 
1019
+ // if I opened and I should sort, then sort items
1048
1020
  if (shouldSort) {
1049
1021
  newOrdering = createOrdering(sortItems(items));
1050
1022
  }
1051
- } // add new items on top or bottom depending on sorting behavior
1052
-
1023
+ }
1053
1024
 
1025
+ // add new items on top or bottom depending on sorting behavior
1054
1026
  newOrdering = newOrdering.filter(item => !add.includes(item));
1055
-
1056
1027
  if (shouldSort) {
1057
1028
  newOrdering.unshift(...add);
1058
1029
  } else {
1059
1030
  newOrdering.push(...add);
1060
1031
  }
1061
-
1062
1032
  setOrdering(newOrdering);
1063
1033
  setNewItemAdded(true);
1064
1034
  } else {
1065
1035
  setNewItemAdded(false);
1066
1036
  }
1067
- }, [items, open, shouldHandleEffects]); // (2) sort items on open if shouldSort is set
1037
+ }, [items, open, shouldHandleEffects]);
1068
1038
 
1039
+ // (2) sort items on open if shouldSort is set
1069
1040
  hooks.useEffect(() => {
1070
1041
  if (shouldSort && open && !newItemAdded) {
1071
1042
  setOrdering(createOrdering(sortItems(items)));
1072
1043
  }
1073
- }, [open, shouldSort]); // (3) items were deleted
1044
+ }, [open, shouldSort]);
1074
1045
 
1046
+ // (3) items were deleted
1075
1047
  hooks.useEffect(() => {
1076
1048
  if (shouldHandleEffects && prevItems && items.length < prevItems.length) {
1077
1049
  let keep = [];
@@ -1082,14 +1054,14 @@ function ListGroup(props) {
1082
1054
  });
1083
1055
  setOrdering(keep);
1084
1056
  }
1085
- }, [items, shouldHandleEffects]); // set css class when group is sticky to top
1057
+ }, [items, shouldHandleEffects]);
1086
1058
 
1059
+ // set css class when group is sticky to top
1087
1060
  useStickyIntersectionObserver(groupRef, 'div.bio-properties-panel-scroll-container', setSticky);
1088
-
1089
1061
  const toggleOpen = () => setOpen(!open);
1090
-
1091
1062
  const hasItems = !!items.length;
1092
- const propertiesPanelContext = { ...hooks.useContext(LayoutContext),
1063
+ const propertiesPanelContext = {
1064
+ ...hooks.useContext(LayoutContext),
1093
1065
  onShow
1094
1066
  };
1095
1067
  return jsxRuntime.jsxs("div", {
@@ -1131,17 +1103,17 @@ function ListGroup(props) {
1131
1103
  value: propertiesPanelContext,
1132
1104
  children: ordering.map((o, index) => {
1133
1105
  const item = getItem(items, o);
1134
-
1135
1106
  if (!item) {
1136
1107
  return;
1137
1108
  }
1138
-
1139
1109
  const {
1140
1110
  id
1141
- } = item; // if item was added, open first or last item based on ordering
1111
+ } = item;
1142
1112
 
1113
+ // if item was added, open first or last item based on ordering
1143
1114
  const autoOpen = newItemAdded && (shouldSort ? index === 0 : index === ordering.length - 1);
1144
- return preact.createElement(ListItem, { ...item,
1115
+ return preact.createElement(ListItem, {
1116
+ ...item,
1145
1117
  autoOpen: autoOpen,
1146
1118
  element: element,
1147
1119
  index: index,
@@ -1151,20 +1123,19 @@ function ListGroup(props) {
1151
1123
  })
1152
1124
  })]
1153
1125
  });
1154
- } // helpers ////////////////////
1126
+ }
1127
+
1128
+ // helpers ////////////////////
1155
1129
 
1156
1130
  /**
1157
1131
  * Sorts given items alphanumeric by label
1158
1132
  */
1159
-
1160
1133
  function sortItems(items) {
1161
1134
  return minDash.sortBy(items, i => i.label.toLowerCase());
1162
1135
  }
1163
-
1164
1136
  function getItem(items, id) {
1165
1137
  return minDash.find(items, i => i.id === id);
1166
1138
  }
1167
-
1168
1139
  function createOrdering(items) {
1169
1140
  return items.map(i => i.id);
1170
1141
  }
@@ -1177,7 +1148,6 @@ function Description(props) {
1177
1148
  } = props;
1178
1149
  const contextDescription = useDescriptionContext(forId, element);
1179
1150
  const description = value || contextDescription;
1180
-
1181
1151
  if (description) {
1182
1152
  return jsxRuntime.jsx("div", {
1183
1153
  class: "bio-properties-panel-description",
@@ -1197,23 +1167,19 @@ function Checkbox(props) {
1197
1167
  onBlur
1198
1168
  } = props;
1199
1169
  const [localValue, setLocalValue] = hooks.useState(value);
1200
-
1201
1170
  const handleChangeCallback = ({
1202
1171
  target
1203
1172
  }) => {
1204
1173
  onChange(target.checked);
1205
1174
  };
1206
-
1207
1175
  const handleChange = e => {
1208
1176
  handleChangeCallback(e);
1209
1177
  setLocalValue(e.target.value);
1210
1178
  };
1211
-
1212
1179
  hooks.useEffect(() => {
1213
1180
  if (value === localValue) {
1214
1181
  return;
1215
1182
  }
1216
-
1217
1183
  setLocalValue(value);
1218
1184
  }, [value]);
1219
1185
  const ref = useShowEntryEvent(id);
@@ -1237,6 +1203,7 @@ function Checkbox(props) {
1237
1203
  })]
1238
1204
  });
1239
1205
  }
1206
+
1240
1207
  /**
1241
1208
  * @param {Object} props
1242
1209
  * @param {Object} props.element
@@ -1249,8 +1216,6 @@ function Checkbox(props) {
1249
1216
  * @param {Function} props.onBlur
1250
1217
  * @param {boolean} [props.disabled]
1251
1218
  */
1252
-
1253
-
1254
1219
  function CheckboxEntry(props) {
1255
1220
  const {
1256
1221
  element,
@@ -1288,7 +1253,9 @@ function CheckboxEntry(props) {
1288
1253
  }
1289
1254
  function isEdited$7(node) {
1290
1255
  return node && !!node.checked;
1291
- } // helpers /////////////////
1256
+ }
1257
+
1258
+ // helpers /////////////////
1292
1259
 
1293
1260
  function prefixId$7(id) {
1294
1261
  return `bio-properties-panel-${id}`;
@@ -1297,11 +1264,14 @@ function prefixId$7(id) {
1297
1264
  const useBufferedFocus = function (editor, ref) {
1298
1265
  const [buffer, setBuffer] = hooks.useState(undefined);
1299
1266
  ref.current = hooks.useMemo(() => ({
1300
- focus: argument => {
1267
+ focus: offset => {
1301
1268
  if (editor) {
1302
- editor.focus(argument);
1269
+ editor.focus(offset);
1303
1270
  } else {
1304
- setBuffer(argument);
1271
+ if (typeof offset === 'undefined') {
1272
+ offset = Infinity;
1273
+ }
1274
+ setBuffer(offset);
1305
1275
  }
1306
1276
  }
1307
1277
  }), [editor]);
@@ -1312,7 +1282,6 @@ const useBufferedFocus = function (editor, ref) {
1312
1282
  }
1313
1283
  }, [editor, buffer]);
1314
1284
  };
1315
-
1316
1285
  const CodeEditor = compat.forwardRef((props, ref) => {
1317
1286
  const {
1318
1287
  value,
@@ -1332,25 +1301,22 @@ const CodeEditor = compat.forwardRef((props, ref) => {
1332
1301
  });
1333
1302
  hooks.useEffect(() => {
1334
1303
  let editor;
1304
+
1335
1305
  /* Trigger FEEL toggle when
1336
1306
  *
1337
1307
  * - `backspace` is pressed
1338
1308
  * - AND the cursor is at the beginning of the input
1339
1309
  */
1340
-
1341
1310
  const onKeyDown = e => {
1342
1311
  if (e.key !== 'Backspace' || !editor) {
1343
1312
  return;
1344
1313
  }
1345
-
1346
1314
  const selection = editor.getSelection();
1347
1315
  const range = selection.ranges[selection.mainIndex];
1348
-
1349
1316
  if (range.from === 0 && range.to === 0) {
1350
1317
  onFeelToggle();
1351
1318
  }
1352
1319
  };
1353
-
1354
1320
  editor = new FeelEditor__default["default"]({
1355
1321
  container: inputRef.current,
1356
1322
  onChange: handleInput,
@@ -1365,24 +1331,26 @@ const CodeEditor = compat.forwardRef((props, ref) => {
1365
1331
  inputRef.current.innerHTML = '';
1366
1332
  setEditor(null);
1367
1333
  };
1368
- }, [variables]);
1334
+ }, []);
1369
1335
  hooks.useEffect(() => {
1370
1336
  if (!editor) {
1371
1337
  return;
1372
1338
  }
1373
-
1374
1339
  if (value === localValue) {
1375
1340
  return;
1376
1341
  }
1377
-
1378
1342
  editor.setValue(value);
1379
1343
  setLocalValue(value);
1380
1344
  }, [value]);
1381
-
1345
+ hooks.useEffect(() => {
1346
+ if (!editor) {
1347
+ return;
1348
+ }
1349
+ editor.setVariables(variables);
1350
+ }, [variables]);
1382
1351
  const handleClick = () => {
1383
1352
  ref.current.focus();
1384
1353
  };
1385
-
1386
1354
  return jsxRuntime.jsx("div", {
1387
1355
  class: classnames__default["default"]('bio-properties-panel-feel-editor-container', disabled ? 'disabled' : null),
1388
1356
  children: jsxRuntime.jsx("div", {
@@ -1398,11 +1366,9 @@ function FeelIndicator(props) {
1398
1366
  const {
1399
1367
  active
1400
1368
  } = props;
1401
-
1402
1369
  if (!active) {
1403
1370
  return null;
1404
1371
  }
1405
-
1406
1372
  return jsxRuntime.jsx("span", {
1407
1373
  class: "bio-properties-panel-feel-indicator",
1408
1374
  children: "="
@@ -1410,13 +1376,12 @@ function FeelIndicator(props) {
1410
1376
  }
1411
1377
 
1412
1378
  const noop$1 = () => {};
1379
+
1413
1380
  /**
1414
1381
  * @param {Object} props
1415
1382
  * @param {Object} props.label
1416
1383
  * @param {String} props.feel
1417
1384
  */
1418
-
1419
-
1420
1385
  function FeelIcon(props) {
1421
1386
  const {
1422
1387
  label,
@@ -1427,15 +1392,14 @@ function FeelIcon(props) {
1427
1392
  } = props;
1428
1393
  const feelRequiredLabel = ' must be a FEEL expression';
1429
1394
  const feelOptionalLabel = ' can optionally be a FEEL expression';
1430
-
1431
1395
  const handleClick = e => {
1432
- onClick(e); // when pointer event was created from keyboard, keep focus on button
1396
+ onClick(e);
1433
1397
 
1398
+ // when pointer event was created from keyboard, keep focus on button
1434
1399
  if (!e.pointerType) {
1435
1400
  e.stopPropagation();
1436
1401
  }
1437
1402
  };
1438
-
1439
1403
  return jsxRuntime.jsx("button", {
1440
1404
  class: classnames__default["default"]('bio-properties-panel-feel-icon', active ? 'active' : null, feel === 'required' ? 'required' : 'optional'),
1441
1405
  onClick: handleClick,
@@ -1446,7 +1410,6 @@ function FeelIcon(props) {
1446
1410
  }
1447
1411
 
1448
1412
  const noop = () => {};
1449
-
1450
1413
  function FeelTextfield(props) {
1451
1414
  const {
1452
1415
  debounce,
@@ -1466,66 +1429,54 @@ function FeelTextfield(props) {
1466
1429
  const feelActive = localValue.startsWith('=') || feel === 'required';
1467
1430
  const feelOnlyValue = localValue.startsWith('=') ? localValue.substring(1) : localValue;
1468
1431
  const [focus, _setFocus] = hooks.useState(undefined);
1469
-
1470
1432
  const setFocus = (offset = 0) => {
1471
- const hasFocus = containerRef.current.contains(document.activeElement); // Keep caret position if it is already focused, otherwise focus at the end
1433
+ const hasFocus = containerRef.current.contains(document.activeElement);
1472
1434
 
1435
+ // Keep caret position if it is already focused, otherwise focus at the end
1473
1436
  const position = hasFocus ? document.activeElement.selectionStart : Infinity;
1474
-
1475
1437
  _setFocus(position + offset);
1476
1438
  };
1477
-
1478
1439
  const handleInputCallback = hooks.useMemo(() => {
1479
1440
  return debounce(newValue => {
1480
1441
  onInput(newValue);
1481
1442
  });
1482
1443
  }, [onInput, debounce]);
1483
-
1484
1444
  const setLocalValue = newValue => {
1485
1445
  _setLocalValue(newValue);
1486
-
1487
1446
  if (!newValue || newValue === '=') {
1488
1447
  handleInputCallback(undefined);
1489
1448
  } else {
1490
1449
  handleInputCallback(newValue);
1491
1450
  }
1492
1451
  };
1493
-
1494
1452
  const handleFeelToggle = useStaticCallback(() => {
1495
1453
  if (feel === 'required') {
1496
1454
  return;
1497
1455
  }
1498
-
1499
1456
  if (!feelActive) {
1500
1457
  setLocalValue('=' + localValue);
1501
1458
  } else {
1502
1459
  setLocalValue(feelOnlyValue);
1503
1460
  }
1504
1461
  });
1505
-
1506
1462
  const handleLocalInput = newValue => {
1507
1463
  if (feelActive) {
1508
1464
  newValue = '=' + newValue;
1509
1465
  }
1510
-
1511
1466
  if (newValue === localValue) {
1512
1467
  return;
1513
1468
  }
1514
-
1515
1469
  setLocalValue(newValue);
1516
-
1517
1470
  if (!feelActive && newValue.startsWith('=')) {
1518
1471
  // focus is behind `=` sign that will be removed
1519
1472
  setFocus(-1);
1520
1473
  }
1521
1474
  };
1522
-
1523
1475
  const handleLint = useStaticCallback(lint => {
1524
1476
  if (!(lint && lint.length)) {
1525
1477
  onError(undefined);
1526
1478
  return;
1527
1479
  }
1528
-
1529
1480
  const error = lint[0];
1530
1481
  const message = `${error.source}: ${error.message}`;
1531
1482
  onError(message);
@@ -1533,40 +1484,35 @@ function FeelTextfield(props) {
1533
1484
  hooks.useEffect(() => {
1534
1485
  if (typeof focus !== 'undefined') {
1535
1486
  editorRef.current.focus(focus);
1536
-
1537
1487
  _setFocus(undefined);
1538
1488
  }
1539
1489
  }, [focus]);
1540
1490
  hooks.useEffect(() => {
1541
1491
  if (value === localValue) {
1542
1492
  return;
1543
- } // External value change removed content => keep FEEL configuration
1544
-
1493
+ }
1545
1494
 
1495
+ // External value change removed content => keep FEEL configuration
1546
1496
  if (!value) {
1547
1497
  setLocalValue(feelActive ? '=' : '');
1548
1498
  return;
1549
1499
  }
1550
-
1551
1500
  setLocalValue(value);
1552
- }, [value]); // copy-paste integration
1501
+ }, [value]);
1553
1502
 
1503
+ // copy-paste integration
1554
1504
  hooks.useEffect(() => {
1555
1505
  const copyHandler = event => {
1556
1506
  if (!feelActive) {
1557
1507
  return;
1558
1508
  }
1559
-
1560
1509
  event.clipboardData.setData('application/FEEL', event.clipboardData.getData('text'));
1561
1510
  };
1562
-
1563
1511
  const pasteHandler = event => {
1564
1512
  if (feelActive) {
1565
1513
  return;
1566
1514
  }
1567
-
1568
1515
  const data = event.clipboardData.getData('application/FEEL');
1569
-
1570
1516
  if (data) {
1571
1517
  setTimeout(() => {
1572
1518
  handleFeelToggle();
@@ -1574,7 +1520,6 @@ function FeelTextfield(props) {
1574
1520
  });
1575
1521
  }
1576
1522
  };
1577
-
1578
1523
  containerRef.current.addEventListener('copy', copyHandler);
1579
1524
  containerRef.current.addEventListener('cut', copyHandler);
1580
1525
  containerRef.current.addEventListener('paste', pasteHandler);
@@ -1616,7 +1561,8 @@ function FeelTextfield(props) {
1616
1561
  value: feelOnlyValue,
1617
1562
  variables: variables,
1618
1563
  ref: editorRef
1619
- }) : jsxRuntime.jsx(OptionalComponent, { ...props,
1564
+ }) : jsxRuntime.jsx(OptionalComponent, {
1565
+ ...props,
1620
1566
  onInput: handleLocalInput,
1621
1567
  value: localValue,
1622
1568
  ref: editorRef
@@ -1624,7 +1570,6 @@ function FeelTextfield(props) {
1624
1570
  })]
1625
1571
  });
1626
1572
  }
1627
-
1628
1573
  const OptionalFeelInput = compat.forwardRef((props, ref) => {
1629
1574
  const {
1630
1575
  id,
@@ -1634,24 +1579,21 @@ const OptionalFeelInput = compat.forwardRef((props, ref) => {
1634
1579
  onFocus,
1635
1580
  onBlur
1636
1581
  } = props;
1637
- const inputRef = hooks.useRef(); // To be consistent with the FEEL editor, set focus at start of input
1638
- // this ensures clean editing experience when switching with the keyboard
1582
+ const inputRef = hooks.useRef();
1639
1583
 
1584
+ // To be consistent with the FEEL editor, set focus at start of input
1585
+ // this ensures clean editing experience when switching with the keyboard
1640
1586
  ref.current = {
1641
1587
  focus: position => {
1642
1588
  const input = inputRef.current;
1643
-
1644
1589
  if (!input) {
1645
1590
  return;
1646
1591
  }
1647
-
1648
1592
  input.focus();
1649
-
1650
1593
  if (typeof position === 'number') {
1651
1594
  if (position > value.length) {
1652
1595
  position = value.length;
1653
1596
  }
1654
-
1655
1597
  input.setSelectionRange(position, position);
1656
1598
  }
1657
1599
  }
@@ -1680,17 +1622,16 @@ const OptionalFeelTextArea = compat.forwardRef((props, ref) => {
1680
1622
  onFocus,
1681
1623
  onBlur
1682
1624
  } = props;
1683
- const inputRef = hooks.useRef(); // To be consistent with the FEEL editor, set focus at start of input
1684
- // this ensures clean editing experience when switching with the keyboard
1625
+ const inputRef = hooks.useRef();
1685
1626
 
1627
+ // To be consistent with the FEEL editor, set focus at start of input
1628
+ // this ensures clean editing experience when switching with the keyboard
1686
1629
  ref.current = {
1687
1630
  focus: () => {
1688
1631
  const input = inputRef.current;
1689
-
1690
1632
  if (!input) {
1691
1633
  return;
1692
1634
  }
1693
-
1694
1635
  input.focus();
1695
1636
  input.setSelectionRange(0, 0);
1696
1637
  }
@@ -1710,6 +1651,7 @@ const OptionalFeelTextArea = compat.forwardRef((props, ref) => {
1710
1651
  value: value || ''
1711
1652
  });
1712
1653
  });
1654
+
1713
1655
  /**
1714
1656
  * @param {Object} props
1715
1657
  * @param {Object} props.element
@@ -1722,7 +1664,6 @@ const OptionalFeelTextArea = compat.forwardRef((props, ref) => {
1722
1664
  * @param {Function} props.setValue
1723
1665
  * @param {Function} props.validate
1724
1666
  */
1725
-
1726
1667
  function FeelEntry(props) {
1727
1668
  const {
1728
1669
  element,
@@ -1754,11 +1695,9 @@ function FeelEntry(props) {
1754
1695
  }, [value]);
1755
1696
  const onInput = useStaticCallback(newValue => {
1756
1697
  let newValidationError = null;
1757
-
1758
1698
  if (minDash.isFunction(validate)) {
1759
1699
  newValidationError = validate(newValue) || null;
1760
1700
  }
1761
-
1762
1701
  if (newValidationError) {
1763
1702
  setCachedInvalidValue(newValue);
1764
1703
  } else {
@@ -1767,17 +1706,14 @@ function FeelEntry(props) {
1767
1706
  setValue(newValue);
1768
1707
  }
1769
1708
  }
1770
-
1771
1709
  setValidationError(newValidationError);
1772
1710
  });
1773
1711
  const onError = hooks.useCallback(err => {
1774
1712
  setLocalError(err);
1775
1713
  }, []);
1776
-
1777
1714
  if (previousValue === value && validationError) {
1778
1715
  value = cachedInvalidValue;
1779
1716
  }
1780
-
1781
1717
  const temporaryError = useError(id);
1782
1718
  const error = localError || temporaryError || validationError;
1783
1719
  return jsxRuntime.jsxs("div", {
@@ -1808,6 +1744,7 @@ function FeelEntry(props) {
1808
1744
  })]
1809
1745
  });
1810
1746
  }
1747
+
1811
1748
  /**
1812
1749
  * @param {Object} props
1813
1750
  * @param {Object} props.element
@@ -1822,7 +1759,6 @@ function FeelEntry(props) {
1822
1759
  * @param {Function} props.onBlur
1823
1760
  * @param {Function} props.validate
1824
1761
  */
1825
-
1826
1762
  function FeelTextArea(props) {
1827
1763
  return jsxRuntime.jsx(FeelEntry, {
1828
1764
  class: "bio-properties-panel-feel-textarea",
@@ -1832,7 +1768,9 @@ function FeelTextArea(props) {
1832
1768
  }
1833
1769
  function isEdited$6(node) {
1834
1770
  return node && (!!node.value || node.classList.contains('edited'));
1835
- } // helpers /////////////////
1771
+ }
1772
+
1773
+ // helpers /////////////////
1836
1774
 
1837
1775
  function prefixId$6(id) {
1838
1776
  return `bio-properties-panel-${id}`;
@@ -1854,9 +1792,7 @@ function List(props) {
1854
1792
  } = props;
1855
1793
  const [open, setOpen] = hooks.useState(!!shouldOpen);
1856
1794
  const hasItems = !!items.length;
1857
-
1858
1795
  const toggleOpen = () => hasItems && setOpen(!open);
1859
-
1860
1796
  const opening = !usePrevious(open) && open;
1861
1797
  const elementChanged = usePrevious(element) !== element;
1862
1798
  const shouldReset = opening || elementChanged;
@@ -1867,19 +1803,17 @@ function List(props) {
1867
1803
  setOpen(false);
1868
1804
  }
1869
1805
  }, [open, hasItems]);
1806
+
1870
1807
  /**
1871
1808
  * @param {MouseEvent} event
1872
1809
  */
1873
-
1874
1810
  function addItem(event) {
1875
1811
  event.stopPropagation();
1876
1812
  onAdd();
1877
-
1878
1813
  if (!open) {
1879
1814
  setOpen(true);
1880
1815
  }
1881
1816
  }
1882
-
1883
1817
  return jsxRuntime.jsxs("div", {
1884
1818
  "data-entry-id": id,
1885
1819
  class: classnames__default["default"]('bio-properties-panel-entry', 'bio-properties-panel-list-entry', hasItems ? '' : 'empty', open ? 'open' : ''),
@@ -1912,7 +1846,8 @@ function List(props) {
1912
1846
  })
1913
1847
  })]
1914
1848
  })]
1915
- }), hasItems && jsxRuntime.jsx(ItemsList, { ...restProps,
1849
+ }), hasItems && jsxRuntime.jsx(ItemsList, {
1850
+ ...restProps,
1916
1851
  autoFocusEntry: autoFocusEntry,
1917
1852
  component: component,
1918
1853
  element: element,
@@ -1924,7 +1859,6 @@ function List(props) {
1924
1859
  })]
1925
1860
  });
1926
1861
  }
1927
-
1928
1862
  function ItemsList(props) {
1929
1863
  const {
1930
1864
  autoFocusEntry,
@@ -1942,11 +1876,13 @@ function ItemsList(props) {
1942
1876
  hooks.useEffect(() => {
1943
1877
  if (newItem && autoFocusEntry) {
1944
1878
  // (0) select the parent entry (containing all list items)
1945
- const entry = minDom.query(`[data-entry-id="${id}"]`); // (1) select the first input or a custom element to be focussed
1879
+ const entry = minDom.query(`[data-entry-id="${id}"]`);
1946
1880
 
1881
+ // (1) select the first input or a custom element to be focussed
1947
1882
  const selector = typeof autoFocusEntry === 'boolean' ? '.bio-properties-panel-input' : autoFocusEntry;
1948
- const focusableInput = minDom.query(selector, entry); // (2) set focus
1883
+ const focusableInput = minDom.query(selector, entry);
1949
1884
 
1885
+ // (2) set focus
1950
1886
  if (focusableInput) {
1951
1887
  if (minDash.isFunction(focusableInput.select)) {
1952
1888
  focusableInput.select();
@@ -1962,7 +1898,8 @@ function ItemsList(props) {
1962
1898
  const key = getKey(item);
1963
1899
  return jsxRuntime.jsxs("li", {
1964
1900
  class: "bio-properties-panel-list-entry-item",
1965
- children: [jsxRuntime.jsx(Component, { ...restProps,
1901
+ children: [jsxRuntime.jsx(Component, {
1902
+ ...restProps,
1966
1903
  element: element,
1967
1904
  id: id,
1968
1905
  index: index,
@@ -1979,6 +1916,7 @@ function ItemsList(props) {
1979
1916
  })
1980
1917
  });
1981
1918
  }
1919
+
1982
1920
  /**
1983
1921
  * Place new items in the beginning of the list and sort the rest with provided function.
1984
1922
  *
@@ -1988,41 +1926,36 @@ function ItemsList(props) {
1988
1926
  * @param {boolean} [shouldReset=false] set to `true` to reset state of the hook
1989
1927
  * @returns {Item[]}
1990
1928
  */
1991
-
1992
-
1993
1929
  function useSortedItems(currentItems, compareFn, shouldReset = false) {
1994
- const itemsRef = hooks.useRef(currentItems.slice()); // (1) Reset and optionally sort.
1930
+ const itemsRef = hooks.useRef(currentItems.slice());
1995
1931
 
1932
+ // (1) Reset and optionally sort.
1996
1933
  if (shouldReset) {
1997
1934
  itemsRef.current = currentItems.slice();
1998
-
1999
1935
  if (compareFn) {
2000
1936
  itemsRef.current.sort(compareFn);
2001
1937
  }
2002
1938
  } else {
2003
- const items = itemsRef.current; // (2) Add new item to the list.
1939
+ const items = itemsRef.current;
2004
1940
 
1941
+ // (2) Add new item to the list.
2005
1942
  for (const item of currentItems) {
2006
1943
  if (!items.includes(item)) {
2007
1944
  // Unshift or push depending on whether we have a compareFn
2008
1945
  compareFn ? items.unshift(item) : items.push(item);
2009
1946
  }
2010
- } // (3) Filter out removed items.
2011
-
1947
+ }
2012
1948
 
1949
+ // (3) Filter out removed items.
2013
1950
  itemsRef.current = items.filter(item => currentItems.includes(item));
2014
1951
  }
2015
-
2016
1952
  return itemsRef.current;
2017
1953
  }
2018
-
2019
1954
  function useNewItems(items = [], shouldReset) {
2020
1955
  const previousItems = usePrevious(items.slice()) || [];
2021
-
2022
1956
  if (shouldReset) {
2023
1957
  return [];
2024
1958
  }
2025
-
2026
1959
  return previousItems ? items.filter(item => !previousItems.includes(item)) : [];
2027
1960
  }
2028
1961
 
@@ -2047,23 +1980,19 @@ function NumberField(props) {
2047
1980
  validity,
2048
1981
  value
2049
1982
  } = event.target;
2050
-
2051
1983
  if (validity.valid) {
2052
1984
  onInput(value ? parseFloat(value) : undefined);
2053
1985
  }
2054
1986
  });
2055
1987
  }, [onInput, debounce]);
2056
-
2057
1988
  const handleInput = e => {
2058
1989
  handleInputCallback(e);
2059
1990
  setLocalValue(e.target.value);
2060
1991
  };
2061
-
2062
1992
  hooks.useEffect(() => {
2063
1993
  if (value === localValue) {
2064
1994
  return;
2065
1995
  }
2066
-
2067
1996
  setLocalValue(value);
2068
1997
  }, [value]);
2069
1998
  return jsxRuntime.jsxs("div", {
@@ -2090,6 +2019,7 @@ function NumberField(props) {
2090
2019
  })]
2091
2020
  });
2092
2021
  }
2022
+
2093
2023
  /**
2094
2024
  * @param {Object} props
2095
2025
  * @param {Boolean} props.debounce
@@ -2106,8 +2036,6 @@ function NumberField(props) {
2106
2036
  * @param {Function} props.onBlur
2107
2037
  * @param {String} props.step
2108
2038
  */
2109
-
2110
-
2111
2039
  function NumberFieldEntry(props) {
2112
2040
  const {
2113
2041
  debounce,
@@ -2149,7 +2077,9 @@ function NumberFieldEntry(props) {
2149
2077
  }
2150
2078
  function isEdited$5(node) {
2151
2079
  return node && !!node.value;
2152
- } // helpers /////////////////
2080
+ }
2081
+
2082
+ // helpers /////////////////
2153
2083
 
2154
2084
  function prefixId$5(id) {
2155
2085
  return `bio-properties-panel-${id}`;
@@ -2168,23 +2098,19 @@ function Select(props) {
2168
2098
  } = props;
2169
2099
  const ref = useShowEntryEvent(id);
2170
2100
  const [localValue, setLocalValue] = hooks.useState(value);
2171
-
2172
2101
  const handleChangeCallback = ({
2173
2102
  target
2174
2103
  }) => {
2175
2104
  onChange(target.value);
2176
2105
  };
2177
-
2178
2106
  const handleChange = e => {
2179
2107
  handleChangeCallback(e);
2180
2108
  setLocalValue(e.target.value);
2181
2109
  };
2182
-
2183
2110
  hooks.useEffect(() => {
2184
2111
  if (value === localValue) {
2185
2112
  return;
2186
2113
  }
2187
-
2188
2114
  setLocalValue(value);
2189
2115
  }, [value]);
2190
2116
  return jsxRuntime.jsxs("div", {
@@ -2213,6 +2139,7 @@ function Select(props) {
2213
2139
  })]
2214
2140
  });
2215
2141
  }
2142
+
2216
2143
  /**
2217
2144
  * @param {object} props
2218
2145
  * @param {object} props.element
@@ -2226,8 +2153,6 @@ function Select(props) {
2226
2153
  * @param {Function} props.getOptions
2227
2154
  * @param {boolean} [props.disabled]
2228
2155
  */
2229
-
2230
-
2231
2156
  function SelectEntry(props) {
2232
2157
  const {
2233
2158
  element,
@@ -2268,7 +2193,9 @@ function SelectEntry(props) {
2268
2193
  }
2269
2194
  function isEdited$4(node) {
2270
2195
  return node && !!node.value;
2271
- } // helpers /////////////////
2196
+ }
2197
+
2198
+ // helpers /////////////////
2272
2199
 
2273
2200
  function prefixId$4(id) {
2274
2201
  return `bio-properties-panel-${id}`;
@@ -2292,17 +2219,14 @@ function Simple(props) {
2292
2219
  target
2293
2220
  }) => setValue(target.value.length ? target.value : undefined));
2294
2221
  }, [setValue, debounce]);
2295
-
2296
2222
  const handleInput = e => {
2297
2223
  handleInputCallback(e);
2298
2224
  setLocalValue(e.target.value);
2299
2225
  };
2300
-
2301
2226
  hooks.useEffect(() => {
2302
2227
  if (value === localValue) {
2303
2228
  return;
2304
2229
  }
2305
-
2306
2230
  setLocalValue(value);
2307
2231
  }, [value]);
2308
2232
  return jsxRuntime.jsx("div", {
@@ -2325,7 +2249,9 @@ function Simple(props) {
2325
2249
  }
2326
2250
  function isEdited$3(node) {
2327
2251
  return node && !!node.value;
2328
- } // helpers /////////////////
2252
+ }
2253
+
2254
+ // helpers /////////////////
2329
2255
 
2330
2256
  function prefixId$3(id) {
2331
2257
  return `bio-properties-panel-${id}`;
@@ -2351,17 +2277,14 @@ function TextArea(props) {
2351
2277
  target
2352
2278
  }) => onInput(target.value.length ? target.value : undefined));
2353
2279
  }, [onInput, debounce]);
2354
-
2355
2280
  const handleInput = e => {
2356
2281
  handleInputCallback(e);
2357
2282
  setLocalValue(e.target.value);
2358
2283
  };
2359
-
2360
2284
  hooks.useEffect(() => {
2361
2285
  if (value === localValue) {
2362
2286
  return;
2363
2287
  }
2364
-
2365
2288
  setLocalValue(value);
2366
2289
  }, [value]);
2367
2290
  return jsxRuntime.jsxs("div", {
@@ -2385,6 +2308,7 @@ function TextArea(props) {
2385
2308
  })]
2386
2309
  });
2387
2310
  }
2311
+
2388
2312
  /**
2389
2313
  * @param {object} props
2390
2314
  * @param {object} props.element
@@ -2400,8 +2324,6 @@ function TextArea(props) {
2400
2324
  * @param {boolean} props.monospace
2401
2325
  * @param {boolean} [props.disabled]
2402
2326
  */
2403
-
2404
-
2405
2327
  function TextAreaEntry(props) {
2406
2328
  const {
2407
2329
  element,
@@ -2445,7 +2367,9 @@ function TextAreaEntry(props) {
2445
2367
  }
2446
2368
  function isEdited$2(node) {
2447
2369
  return node && !!node.value;
2448
- } // helpers /////////////////
2370
+ }
2371
+
2372
+ // helpers /////////////////
2449
2373
 
2450
2374
  function prefixId$2(id) {
2451
2375
  return `bio-properties-panel-${id}`;
@@ -2469,17 +2393,14 @@ function Textfield(props) {
2469
2393
  target
2470
2394
  }) => onInput(target.value.length ? target.value : undefined));
2471
2395
  }, [onInput, debounce]);
2472
-
2473
2396
  const handleInput = e => {
2474
2397
  handleInputCallback(e);
2475
2398
  setLocalValue(e.target.value);
2476
2399
  };
2477
-
2478
2400
  hooks.useEffect(() => {
2479
2401
  if (value === localValue) {
2480
2402
  return;
2481
2403
  }
2482
-
2483
2404
  setLocalValue(value);
2484
2405
  }, [value]);
2485
2406
  return jsxRuntime.jsxs("div", {
@@ -2504,6 +2425,7 @@ function Textfield(props) {
2504
2425
  })]
2505
2426
  });
2506
2427
  }
2428
+
2507
2429
  /**
2508
2430
  * @param {Object} props
2509
2431
  * @param {Object} props.element
@@ -2518,8 +2440,6 @@ function Textfield(props) {
2518
2440
  * @param {Function} props.onBlur
2519
2441
  * @param {Function} props.validate
2520
2442
  */
2521
-
2522
-
2523
2443
  function TextfieldEntry(props) {
2524
2444
  const {
2525
2445
  element,
@@ -2545,27 +2465,21 @@ function TextfieldEntry(props) {
2545
2465
  setLocalError(newValidationError);
2546
2466
  }
2547
2467
  }, [value]);
2548
-
2549
2468
  const onInput = newValue => {
2550
2469
  let newValidationError = null;
2551
-
2552
2470
  if (minDash.isFunction(validate)) {
2553
2471
  newValidationError = validate(newValue) || null;
2554
2472
  }
2555
-
2556
2473
  if (newValidationError) {
2557
2474
  setCachedInvalidValue(newValue);
2558
2475
  } else {
2559
2476
  setValue(newValue);
2560
2477
  }
2561
-
2562
2478
  setLocalError(newValidationError);
2563
2479
  };
2564
-
2565
2480
  if (previousValue === value && localError) {
2566
2481
  value = cachedInvalidValue;
2567
2482
  }
2568
-
2569
2483
  const error = globalError || localError;
2570
2484
  return jsxRuntime.jsxs("div", {
2571
2485
  class: classnames__default["default"]('bio-properties-panel-entry', error ? 'has-error' : ''),
@@ -2591,7 +2505,9 @@ function TextfieldEntry(props) {
2591
2505
  }
2592
2506
  function isEdited$1(node) {
2593
2507
  return node && !!node.value;
2594
- } // helpers /////////////////
2508
+ }
2509
+
2510
+ // helpers /////////////////
2595
2511
 
2596
2512
  function prefixId$1(id) {
2597
2513
  return `bio-properties-panel-${id}`;
@@ -2608,21 +2524,17 @@ function ToggleSwitch(props) {
2608
2524
  onBlur
2609
2525
  } = props;
2610
2526
  const [localValue, setLocalValue] = hooks.useState(value);
2611
-
2612
2527
  const handleInputCallback = async () => {
2613
2528
  onInput(!value);
2614
2529
  };
2615
-
2616
2530
  const handleInput = e => {
2617
2531
  handleInputCallback();
2618
2532
  setLocalValue(e.target.value);
2619
2533
  };
2620
-
2621
2534
  hooks.useEffect(() => {
2622
2535
  if (value === localValue) {
2623
2536
  return;
2624
2537
  }
2625
-
2626
2538
  setLocalValue(value);
2627
2539
  }, [value]);
2628
2540
  return jsxRuntime.jsxs("div", {
@@ -2654,6 +2566,7 @@ function ToggleSwitch(props) {
2654
2566
  })]
2655
2567
  });
2656
2568
  }
2569
+
2657
2570
  /**
2658
2571
  * @param {Object} props
2659
2572
  * @param {Object} props.element
@@ -2666,8 +2579,6 @@ function ToggleSwitch(props) {
2666
2579
  * @param {Function} props.onFocus
2667
2580
  * @param {Function} props.onBlur
2668
2581
  */
2669
-
2670
-
2671
2582
  function ToggleSwitchEntry(props) {
2672
2583
  const {
2673
2584
  element,
@@ -2701,7 +2612,9 @@ function ToggleSwitchEntry(props) {
2701
2612
  }
2702
2613
  function isEdited(node) {
2703
2614
  return node && !!node.checked;
2704
- } // helpers /////////////////
2615
+ }
2616
+
2617
+ // helpers /////////////////
2705
2618
 
2706
2619
  function prefixId(id) {
2707
2620
  return `bio-properties-panel-${id}`;