@plurid/plurid-react 0.0.0-30 → 0.0.0-31
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/distribution/index.es.js
CHANGED
|
@@ -5695,17 +5695,18 @@ const PluridLink = properties => {
|
|
|
5695
5695
|
if (!planesRegistry) {
|
|
5696
5696
|
return React.createElement(React.Fragment, null, properties.children);
|
|
5697
5697
|
}
|
|
5698
|
-
const {children: children, route: planeRoute, devisible:
|
|
5698
|
+
const {children: children, route: planeRoute, devisible: devisibleProperty, suffix: suffixProperty, atClick: atClick, style: style, className: className, preview: preview, previewComponent: previewComponent, previewFadeIn: previewFadeIn, previewFadeOut: previewFadeOut, previewOffsetX: previewOffsetX, previewOffsetY: previewOffsetY, stateTree: stateTree, stateLastClosedPlane: stateLastClosedPlane, stateGeneralTheme: stateGeneralTheme, stateConfiguration: stateConfiguration, stateViewSize: stateViewSize, dispatch: dispatch, dispatchSetTree: dispatchSetTree, dispatchSetSpaceField: dispatchSetSpaceField, dispatchUpdateSpaceLinkCoordinates: dispatchUpdateSpaceLinkCoordinates} = properties;
|
|
5699
5699
|
const planeControls = stateConfiguration.elements.plane.controls.show;
|
|
5700
5700
|
const previewAppearTime = previewFadeIn || PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_IN;
|
|
5701
5701
|
const previewDisappearTime = previewFadeOut || PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_OUT;
|
|
5702
5702
|
const planeRouteResolved = computePlaneAddress(planeRoute);
|
|
5703
5703
|
const absolutePlaneRoute = resolveRoute(planeRouteResolved, stateConfiguration.network.protocol, hostname || stateConfiguration.network.host);
|
|
5704
|
-
const suffix =
|
|
5705
|
-
const devisible =
|
|
5704
|
+
const suffix = suffixProperty !== null && suffixProperty !== void 0 ? suffixProperty : PLURID_DEFAULT_CONFIGURATION_LINK_SUFFIX;
|
|
5705
|
+
const devisible = devisibleProperty !== null && devisibleProperty !== void 0 ? devisibleProperty : false;
|
|
5706
5706
|
const linkElement = useRef(null);
|
|
5707
5707
|
const hoverInTimeout = useRef(null);
|
|
5708
5708
|
const hoverOutTimeout = useRef(null);
|
|
5709
|
+
const planeRef = useRef();
|
|
5709
5710
|
const [mouseOver, setMouseOver] = useState(false);
|
|
5710
5711
|
const [showPreview, setShowPreview] = useState(false);
|
|
5711
5712
|
const [showLink, setShowLink] = useState(false);
|
|
@@ -5774,6 +5775,20 @@ const PluridLink = properties => {
|
|
|
5774
5775
|
const debouncedUpdateLinkCoordinates = useDebouncedCallback((() => {
|
|
5775
5776
|
updateLinkCoordinates();
|
|
5776
5777
|
}), PLURID_DEFAULT_RESIZE_DEBOUNCE_TIME);
|
|
5778
|
+
const assignTreePlaneToLink = (parentPlane, linkCoordinates) => {
|
|
5779
|
+
if (!parentPlane || !parentPlane.children) {
|
|
5780
|
+
return;
|
|
5781
|
+
}
|
|
5782
|
+
for (const plane of parentPlane.children) {
|
|
5783
|
+
if (!plane.linkCoordinates) {
|
|
5784
|
+
continue;
|
|
5785
|
+
}
|
|
5786
|
+
if (plane.linkCoordinates.x === linkCoordinates.x || plane.linkCoordinates.y === linkCoordinates.y) {
|
|
5787
|
+
setShowLink(true);
|
|
5788
|
+
setPluridPlaneID(plane.planeID);
|
|
5789
|
+
}
|
|
5790
|
+
}
|
|
5791
|
+
};
|
|
5777
5792
|
const updateTreeWithLink = event => {
|
|
5778
5793
|
if (!parentPlaneID || !absolutePlaneRoute) {
|
|
5779
5794
|
return;
|
|
@@ -5860,6 +5875,8 @@ const PluridLink = properties => {
|
|
|
5860
5875
|
setParentPlaneID(parentPlaneID);
|
|
5861
5876
|
const linkCoordinates = getPluridLinkCoordinates();
|
|
5862
5877
|
setLinkCoordinates(linkCoordinates);
|
|
5878
|
+
const parentPlane = space$2.tree.logic.getTreePlaneByID(stateTree, parentPlaneID);
|
|
5879
|
+
assignTreePlaneToLink(parentPlane, linkCoordinates);
|
|
5863
5880
|
}), []);
|
|
5864
5881
|
useEffect((() => {
|
|
5865
5882
|
if (showLink) {
|
|
@@ -5932,10 +5949,17 @@ const PluridLink = properties => {
|
|
|
5932
5949
|
defaultPubSub.unsubscribe(closePlaneIndex);
|
|
5933
5950
|
};
|
|
5934
5951
|
}), [ showLink, pluridPlaneID, JSON.stringify(stateTree) ]);
|
|
5935
|
-
useEffect((() =>
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5952
|
+
useEffect((() => {
|
|
5953
|
+
const plane = space$2.tree.logic.getTreePlaneByID(stateTree, pluridPlaneID);
|
|
5954
|
+
planeRef.current = plane;
|
|
5955
|
+
return () => {
|
|
5956
|
+
setTimeout((() => {
|
|
5957
|
+
var _a;
|
|
5958
|
+
if (showLink && linkElement.current === null && ((_a = planeRef.current) === null || _a === void 0 ? void 0 : _a.show) === false) {
|
|
5959
|
+
removePlane();
|
|
5960
|
+
}
|
|
5961
|
+
}), 10);
|
|
5962
|
+
};
|
|
5939
5963
|
}), [ showLink, showPreview, pluridPlaneID, parentPlaneID, JSON.stringify(stateTree) ]);
|
|
5940
5964
|
return React.createElement(StyledPluridLink, {
|
|
5941
5965
|
ref: linkElement,
|