@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/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ All notable changes to [`@bpmn-io/properties-panel`](https://github.com/bpmn-io/
6
6
 
7
7
  ___Note:__ Yet to be released changes appear here._
8
8
 
9
+ ## 0.19.0
10
+
11
+ * `FEAT`: make group headers sticky ([#175](https://github.com/bpmn-io/properties-panel/pull/175))
12
+ * `CHORE`: use element as key for entries ([#176](https://github.com/bpmn-io/properties-panel/pull/176))
13
+
9
14
  ## 0.18.0
10
15
 
11
16
  * `FEAT`: pass variables to FEEL editor ([#171](https://github.com/bpmn-io/properties-panel/pull/171))
@@ -176,7 +176,7 @@
176
176
  background-color: var(--header-background-color);
177
177
  border-bottom: 1px solid var(--header-bottom-border-color);
178
178
  width: 100%;
179
- z-index: 1;
179
+ z-index: 10;
180
180
  max-height: 64px;
181
181
  overflow: hidden;
182
182
  }
@@ -246,16 +246,10 @@
246
246
  justify-content: space-between;
247
247
  margin-bottom: -1px; /* avoid double borders */
248
248
  position: relative; /* browsers not supporting sticky */
249
-
250
- /**
251
- * @pinussilvestrus Note: we exclude the sticky header feature until we
252
- * find a proper fix for https://github.com/bpmn-io/bpmn-js-properties-panel/issues/726
253
- */
254
-
255
- /* position: -webkit-sticky; /* for safari */
256
- /* position: sticky; */
249
+ position: -webkit-sticky; /* for safari */
250
+ position: sticky;
257
251
  top: 0;
258
- z-index: 1;
252
+ z-index: 10;
259
253
  }
260
254
 
261
255
  .bio-properties-panel-group-header .bio-properties-panel-group-header-title {
package/dist/index.esm.js CHANGED
@@ -460,11 +460,40 @@ function useShowEntryEvent(id) {
460
460
 
461
461
  function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky) {
462
462
  useEffect(() => {
463
+ const Observer = IntersectionObserver; // return early if IntersectionObserver is not available
463
464
 
464
- {
465
+ if (!Observer) {
465
466
  return;
466
467
  }
467
- }, [ref]);
468
+
469
+ let observer;
470
+
471
+ if (ref.current) {
472
+ const scrollContainer = query(scrollContainerSelector);
473
+ observer = new Observer(entries => {
474
+ entries.forEach(entry => {
475
+ if (entry.intersectionRatio < 1) {
476
+ setSticky(true);
477
+ } else if (entry.intersectionRatio === 1) {
478
+ setSticky(false);
479
+ }
480
+ });
481
+ }, {
482
+ root: scrollContainer,
483
+ rootMargin: '0px 0px 999999% 0px',
484
+ // Use bottom margin to avoid stickyness when scrolling out to bottom
485
+ threshold: [1]
486
+ });
487
+ observer.observe(ref.current);
488
+ } // Unobserve if unmounted
489
+
490
+
491
+ return () => {
492
+ if (ref.current && observer) {
493
+ observer.unobserve(ref.current);
494
+ }
495
+ };
496
+ }, [ref, scrollContainerSelector, setSticky]);
468
497
  }
469
498
 
470
499
  /**
@@ -523,7 +552,7 @@ function Group(props) {
523
552
  setEdited(hasOneEditedEntry);
524
553
  }, [entries]); // set css class when group is sticky to top
525
554
 
526
- useStickyIntersectionObserver(groupRef);
555
+ useStickyIntersectionObserver(groupRef, 'div.bio-properties-panel-scroll-container', setSticky);
527
556
  const propertiesPanelContext = { ...useContext(LayoutContext),
528
557
  onShow
529
558
  };
@@ -1100,7 +1129,7 @@ function ListGroup(props) {
1100
1129
  }
1101
1130
  }, [items, shouldHandleEffects]); // set css class when group is sticky to top
1102
1131
 
1103
- useStickyIntersectionObserver(groupRef);
1132
+ useStickyIntersectionObserver(groupRef, 'div.bio-properties-panel-scroll-container', setSticky);
1104
1133
 
1105
1134
  const toggleOpen = () => setOpen(!open);
1106
1135
 
@@ -1282,7 +1311,7 @@ function CheckboxEntry(props) {
1282
1311
  label: label,
1283
1312
  onChange: setValue,
1284
1313
  value: value
1285
- }), error && jsx("div", {
1314
+ }, element), error && jsx("div", {
1286
1315
  class: "bio-properties-panel-error",
1287
1316
  children: error
1288
1317
  }), jsx(Description, {
@@ -5322,7 +5351,7 @@ function FeelEntry(props) {
5322
5351
  value: value,
5323
5352
  variables: props.variables,
5324
5353
  OptionalComponent: props.OptionalComponent
5325
- }), error && jsx("div", {
5354
+ }, element), error && jsx("div", {
5326
5355
  class: "bio-properties-panel-error",
5327
5356
  children: error
5328
5357
  }), jsx(Description, {
@@ -5652,7 +5681,7 @@ function NumberFieldEntry(props) {
5652
5681
  min: min,
5653
5682
  step: step,
5654
5683
  value: value
5655
- }), jsx(Description, {
5684
+ }, element), jsx(Description, {
5656
5685
  forId: id,
5657
5686
  element: element,
5658
5687
  value: description
@@ -5758,7 +5787,7 @@ function SelectEntry(props) {
5758
5787
  onChange: setValue,
5759
5788
  options: options,
5760
5789
  disabled: disabled
5761
- }), error && jsx("div", {
5790
+ }, element), error && jsx("div", {
5762
5791
  class: "bio-properties-panel-error",
5763
5792
  children: error
5764
5793
  }), jsx(Description, {
@@ -5822,7 +5851,7 @@ function Simple(props) {
5822
5851
  onFocus: onFocus,
5823
5852
  onBlur: onBlur,
5824
5853
  value: localValue
5825
- })
5854
+ }, element)
5826
5855
  });
5827
5856
  }
5828
5857
  function isEdited$3(node) {
@@ -5927,7 +5956,7 @@ function TextAreaEntry(props) {
5927
5956
  debounce: debounce,
5928
5957
  monospace: monospace,
5929
5958
  disabled: disabled
5930
- }), error && jsx("div", {
5959
+ }, element), error && jsx("div", {
5931
5960
  class: "bio-properties-panel-error",
5932
5961
  children: error
5933
5962
  }), jsx(Description, {
@@ -6065,7 +6094,7 @@ function TextfieldEntry(props) {
6065
6094
  label: label,
6066
6095
  onInput: onInput,
6067
6096
  value: value
6068
- }), error && jsx("div", {
6097
+ }, element), error && jsx("div", {
6069
6098
  class: "bio-properties-panel-error",
6070
6099
  children: error
6071
6100
  }), jsx(Description, {