@bpmn-io/properties-panel 0.18.0 → 0.19.0

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
@@ -468,11 +468,40 @@ function useShowEntryEvent(id) {
468
468
 
469
469
  function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky) {
470
470
  hooks.useEffect(() => {
471
+ const Observer = IntersectionObserver; // return early if IntersectionObserver is not available
471
472
 
472
- {
473
+ if (!Observer) {
473
474
  return;
474
475
  }
475
- }, [ref]);
476
+
477
+ let observer;
478
+
479
+ if (ref.current) {
480
+ const scrollContainer = minDom.query(scrollContainerSelector);
481
+ observer = new Observer(entries => {
482
+ entries.forEach(entry => {
483
+ if (entry.intersectionRatio < 1) {
484
+ setSticky(true);
485
+ } else if (entry.intersectionRatio === 1) {
486
+ setSticky(false);
487
+ }
488
+ });
489
+ }, {
490
+ root: scrollContainer,
491
+ rootMargin: '0px 0px 999999% 0px',
492
+ // Use bottom margin to avoid stickyness when scrolling out to bottom
493
+ threshold: [1]
494
+ });
495
+ observer.observe(ref.current);
496
+ } // Unobserve if unmounted
497
+
498
+
499
+ return () => {
500
+ if (ref.current && observer) {
501
+ observer.unobserve(ref.current);
502
+ }
503
+ };
504
+ }, [ref, scrollContainerSelector, setSticky]);
476
505
  }
477
506
 
478
507
  /**
@@ -531,7 +560,7 @@ function Group(props) {
531
560
  setEdited(hasOneEditedEntry);
532
561
  }, [entries]); // set css class when group is sticky to top
533
562
 
534
- useStickyIntersectionObserver(groupRef);
563
+ useStickyIntersectionObserver(groupRef, 'div.bio-properties-panel-scroll-container', setSticky);
535
564
  const propertiesPanelContext = { ...hooks.useContext(LayoutContext),
536
565
  onShow
537
566
  };
@@ -1108,7 +1137,7 @@ function ListGroup(props) {
1108
1137
  }
1109
1138
  }, [items, shouldHandleEffects]); // set css class when group is sticky to top
1110
1139
 
1111
- useStickyIntersectionObserver(groupRef);
1140
+ useStickyIntersectionObserver(groupRef, 'div.bio-properties-panel-scroll-container', setSticky);
1112
1141
 
1113
1142
  const toggleOpen = () => setOpen(!open);
1114
1143
 
@@ -1290,7 +1319,7 @@ function CheckboxEntry(props) {
1290
1319
  label: label,
1291
1320
  onChange: setValue,
1292
1321
  value: value
1293
- }), error && jsxRuntime.jsx("div", {
1322
+ }, element), error && jsxRuntime.jsx("div", {
1294
1323
  class: "bio-properties-panel-error",
1295
1324
  children: error
1296
1325
  }), jsxRuntime.jsx(Description, {
@@ -5330,7 +5359,7 @@ function FeelEntry(props) {
5330
5359
  value: value,
5331
5360
  variables: props.variables,
5332
5361
  OptionalComponent: props.OptionalComponent
5333
- }), error && jsxRuntime.jsx("div", {
5362
+ }, element), error && jsxRuntime.jsx("div", {
5334
5363
  class: "bio-properties-panel-error",
5335
5364
  children: error
5336
5365
  }), jsxRuntime.jsx(Description, {
@@ -5660,7 +5689,7 @@ function NumberFieldEntry(props) {
5660
5689
  min: min,
5661
5690
  step: step,
5662
5691
  value: value
5663
- }), jsxRuntime.jsx(Description, {
5692
+ }, element), jsxRuntime.jsx(Description, {
5664
5693
  forId: id,
5665
5694
  element: element,
5666
5695
  value: description
@@ -5766,7 +5795,7 @@ function SelectEntry(props) {
5766
5795
  onChange: setValue,
5767
5796
  options: options,
5768
5797
  disabled: disabled
5769
- }), error && jsxRuntime.jsx("div", {
5798
+ }, element), error && jsxRuntime.jsx("div", {
5770
5799
  class: "bio-properties-panel-error",
5771
5800
  children: error
5772
5801
  }), jsxRuntime.jsx(Description, {
@@ -5830,7 +5859,7 @@ function Simple(props) {
5830
5859
  onFocus: onFocus,
5831
5860
  onBlur: onBlur,
5832
5861
  value: localValue
5833
- })
5862
+ }, element)
5834
5863
  });
5835
5864
  }
5836
5865
  function isEdited$3(node) {
@@ -5935,7 +5964,7 @@ function TextAreaEntry(props) {
5935
5964
  debounce: debounce,
5936
5965
  monospace: monospace,
5937
5966
  disabled: disabled
5938
- }), error && jsxRuntime.jsx("div", {
5967
+ }, element), error && jsxRuntime.jsx("div", {
5939
5968
  class: "bio-properties-panel-error",
5940
5969
  children: error
5941
5970
  }), jsxRuntime.jsx(Description, {
@@ -6073,7 +6102,7 @@ function TextfieldEntry(props) {
6073
6102
  label: label,
6074
6103
  onInput: onInput,
6075
6104
  value: value
6076
- }), error && jsxRuntime.jsx("div", {
6105
+ }, element), error && jsxRuntime.jsx("div", {
6077
6106
  class: "bio-properties-panel-error",
6078
6107
  children: error
6079
6108
  }), jsxRuntime.jsx(Description, {