@bpmn-io/properties-panel 3.22.1 → 3.22.3
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.esm.js +24 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +24 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -712,6 +712,24 @@ function useStaticCallback(callback) {
|
|
|
712
712
|
return hooks.useCallback((...args) => callbackRef.current(...args), []);
|
|
713
713
|
}
|
|
714
714
|
|
|
715
|
+
function useElementVisible(element) {
|
|
716
|
+
const [visible, setVisible] = hooks.useState(!!element && !!element.clientHeight);
|
|
717
|
+
hooks.useLayoutEffect(() => {
|
|
718
|
+
if (!element) return;
|
|
719
|
+
const resizeObserver = new ResizeObserver(([entry]) => {
|
|
720
|
+
requestAnimationFrame(() => {
|
|
721
|
+
const newVisible = !!entry.contentRect.height;
|
|
722
|
+
if (newVisible !== visible) {
|
|
723
|
+
setVisible(newVisible);
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
});
|
|
727
|
+
resizeObserver.observe(element);
|
|
728
|
+
return () => resizeObserver.disconnect();
|
|
729
|
+
}, [element, visible]);
|
|
730
|
+
return visible;
|
|
731
|
+
}
|
|
732
|
+
|
|
715
733
|
function Group(props) {
|
|
716
734
|
const {
|
|
717
735
|
element,
|
|
@@ -3992,6 +4010,7 @@ function TextArea(props) {
|
|
|
3992
4010
|
} = props;
|
|
3993
4011
|
const [localValue, setLocalValue] = hooks.useState(value);
|
|
3994
4012
|
const ref = useShowEntryEvent(id);
|
|
4013
|
+
const visible = useElementVisible(ref.current);
|
|
3995
4014
|
const handleInputCallback = hooks.useMemo(() => {
|
|
3996
4015
|
return debounce(target => onInput(target.value.length ? target.value : undefined));
|
|
3997
4016
|
}, [onInput, debounce]);
|
|
@@ -4002,7 +4021,10 @@ function TextArea(props) {
|
|
|
4002
4021
|
};
|
|
4003
4022
|
hooks.useLayoutEffect(() => {
|
|
4004
4023
|
autoResize && resizeToContents(ref.current);
|
|
4005
|
-
});
|
|
4024
|
+
}, []);
|
|
4025
|
+
hooks.useLayoutEffect(() => {
|
|
4026
|
+
visible && autoResize && resizeToContents(ref.current);
|
|
4027
|
+
}, [visible]);
|
|
4006
4028
|
hooks.useEffect(() => {
|
|
4007
4029
|
if (value === localValue) {
|
|
4008
4030
|
return;
|
|
@@ -4382,6 +4404,7 @@ exports.isTextAreaEntryEdited = isEdited$1;
|
|
|
4382
4404
|
exports.isTextFieldEntryEdited = isEdited;
|
|
4383
4405
|
exports.isToggleSwitchEntryEdited = isEdited$8;
|
|
4384
4406
|
exports.useDescriptionContext = useDescriptionContext;
|
|
4407
|
+
exports.useElementVisible = useElementVisible;
|
|
4385
4408
|
exports.useError = useError;
|
|
4386
4409
|
exports.useErrors = useErrors;
|
|
4387
4410
|
exports.useEvent = useEvent;
|