@bpmn-io/properties-panel 1.8.1 → 2.0.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/assets/properties-panel.css +3 -7
- package/dist/index.esm.js +39 -30
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +39 -30
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -113,7 +113,9 @@
|
|
|
113
113
|
--font-family: sans-serif;
|
|
114
114
|
--font-family-monospace: monospace;
|
|
115
115
|
|
|
116
|
-
display:
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
flex: 1;
|
|
117
119
|
position: relative;
|
|
118
120
|
height: 100%;
|
|
119
121
|
width: 100%;
|
|
@@ -135,12 +137,6 @@
|
|
|
135
137
|
font-family: var(--font-family);
|
|
136
138
|
}
|
|
137
139
|
|
|
138
|
-
.bio-properties-panel.open {
|
|
139
|
-
display: flex;
|
|
140
|
-
flex-direction: column;
|
|
141
|
-
flex: 1;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
140
|
/**
|
|
145
141
|
* Placeholder (empty, multi select, ...)
|
|
146
142
|
*/
|
package/dist/index.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useContext, useRef, useEffect, useMemo, useCallback, useState, useLayoutEffect } from '../preact/hooks';
|
|
2
2
|
import { isFunction, isArray, get, assign, set, sortBy, find, isNumber, debounce } from 'min-dash';
|
|
3
|
-
import classnames from 'classnames';
|
|
4
3
|
import { forwardRef } from '../preact/compat';
|
|
5
4
|
import { jsx, jsxs } from '../preact/jsx-runtime';
|
|
5
|
+
import classnames from 'classnames';
|
|
6
6
|
import { query } from 'min-dom';
|
|
7
7
|
import { createContext, createElement } from '../preact';
|
|
8
8
|
import { FeelersEditor } from 'feelers';
|
|
@@ -383,6 +383,18 @@ function useShowEntryEvent(id) {
|
|
|
383
383
|
* @param {setSticky} setSticky
|
|
384
384
|
*/
|
|
385
385
|
function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky) {
|
|
386
|
+
const [scrollContainer, setScrollContainer] = useState(query(scrollContainerSelector));
|
|
387
|
+
const updateScrollContainer = useCallback(() => {
|
|
388
|
+
const newScrollContainer = query(scrollContainerSelector);
|
|
389
|
+
if (newScrollContainer !== scrollContainer) {
|
|
390
|
+
setScrollContainer(newScrollContainer);
|
|
391
|
+
}
|
|
392
|
+
}, [scrollContainerSelector, scrollContainer]);
|
|
393
|
+
useEffect(() => {
|
|
394
|
+
updateScrollContainer();
|
|
395
|
+
}, [updateScrollContainer]);
|
|
396
|
+
useEvent('propertiesPanel.attach', updateScrollContainer);
|
|
397
|
+
useEvent('propertiesPanel.detach', updateScrollContainer);
|
|
386
398
|
useEffect(() => {
|
|
387
399
|
const Observer = IntersectionObserver;
|
|
388
400
|
|
|
@@ -390,37 +402,36 @@ function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky)
|
|
|
390
402
|
if (!Observer) {
|
|
391
403
|
return;
|
|
392
404
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
405
|
+
|
|
406
|
+
// TODO(@barmac): test this
|
|
407
|
+
if (!ref.current || !scrollContainer) {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
const observer = new Observer(entries => {
|
|
411
|
+
// scroll container is unmounted, do not update sticky state
|
|
412
|
+
if (scrollContainer.scrollHeight === 0) {
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
entries.forEach(entry => {
|
|
416
|
+
if (entry.intersectionRatio < 1) {
|
|
417
|
+
setSticky(true);
|
|
418
|
+
} else if (entry.intersectionRatio === 1) {
|
|
419
|
+
setSticky(false);
|
|
400
420
|
}
|
|
401
|
-
entries.forEach(entry => {
|
|
402
|
-
if (entry.intersectionRatio < 1) {
|
|
403
|
-
setSticky(true);
|
|
404
|
-
} else if (entry.intersectionRatio === 1) {
|
|
405
|
-
setSticky(false);
|
|
406
|
-
}
|
|
407
|
-
});
|
|
408
|
-
}, {
|
|
409
|
-
root: scrollContainer,
|
|
410
|
-
rootMargin: '0px 0px 999999% 0px',
|
|
411
|
-
// Use bottom margin to avoid stickyness when scrolling out to bottom
|
|
412
|
-
threshold: [1]
|
|
413
421
|
});
|
|
414
|
-
|
|
415
|
-
|
|
422
|
+
}, {
|
|
423
|
+
root: scrollContainer,
|
|
424
|
+
rootMargin: '0px 0px 999999% 0px',
|
|
425
|
+
// Use bottom margin to avoid stickyness when scrolling out to bottom
|
|
426
|
+
threshold: [1]
|
|
427
|
+
});
|
|
428
|
+
observer.observe(ref.current);
|
|
416
429
|
|
|
417
430
|
// Unobserve if unmounted
|
|
418
431
|
return () => {
|
|
419
|
-
|
|
420
|
-
observer.unobserve(ref.current);
|
|
421
|
-
}
|
|
432
|
+
observer.unobserve(ref.current);
|
|
422
433
|
};
|
|
423
|
-
}, [ref,
|
|
434
|
+
}, [ref.current, scrollContainer, setSticky]);
|
|
424
435
|
}
|
|
425
436
|
|
|
426
437
|
/**
|
|
@@ -555,9 +566,7 @@ function Placeholder(props) {
|
|
|
555
566
|
});
|
|
556
567
|
}
|
|
557
568
|
|
|
558
|
-
const DEFAULT_LAYOUT = {
|
|
559
|
-
open: true
|
|
560
|
-
};
|
|
569
|
+
const DEFAULT_LAYOUT = {};
|
|
561
570
|
const DEFAULT_DESCRIPTION = {};
|
|
562
571
|
|
|
563
572
|
/**
|
|
@@ -721,7 +730,7 @@ function PropertiesPanel(props) {
|
|
|
721
730
|
children: jsx(EventContext.Provider, {
|
|
722
731
|
value: eventContext,
|
|
723
732
|
children: jsxs("div", {
|
|
724
|
-
class:
|
|
733
|
+
class: "bio-properties-panel",
|
|
725
734
|
children: [jsx(Header, {
|
|
726
735
|
element: element,
|
|
727
736
|
headerProvider: headerProvider
|