@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.js
CHANGED
|
@@ -5733,17 +5733,18 @@ const PluridLink = properties => {
|
|
|
5733
5733
|
if (!planesRegistry) {
|
|
5734
5734
|
return React__default["default"].createElement(React__default["default"].Fragment, null, properties.children);
|
|
5735
5735
|
}
|
|
5736
|
-
const {children: children, route: planeRoute, devisible:
|
|
5736
|
+
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;
|
|
5737
5737
|
const planeControls = stateConfiguration.elements.plane.controls.show;
|
|
5738
5738
|
const previewAppearTime = previewFadeIn || pluridData.PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_IN;
|
|
5739
5739
|
const previewDisappearTime = previewFadeOut || pluridData.PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_OUT;
|
|
5740
5740
|
const planeRouteResolved = computePlaneAddress(planeRoute);
|
|
5741
5741
|
const absolutePlaneRoute = resolveRoute(planeRouteResolved, stateConfiguration.network.protocol, hostname || stateConfiguration.network.host);
|
|
5742
|
-
const suffix =
|
|
5743
|
-
const devisible =
|
|
5742
|
+
const suffix = suffixProperty !== null && suffixProperty !== void 0 ? suffixProperty : pluridData.PLURID_DEFAULT_CONFIGURATION_LINK_SUFFIX;
|
|
5743
|
+
const devisible = devisibleProperty !== null && devisibleProperty !== void 0 ? devisibleProperty : false;
|
|
5744
5744
|
const linkElement = React.useRef(null);
|
|
5745
5745
|
const hoverInTimeout = React.useRef(null);
|
|
5746
5746
|
const hoverOutTimeout = React.useRef(null);
|
|
5747
|
+
const planeRef = React.useRef();
|
|
5747
5748
|
const [mouseOver, setMouseOver] = React.useState(false);
|
|
5748
5749
|
const [showPreview, setShowPreview] = React.useState(false);
|
|
5749
5750
|
const [showLink, setShowLink] = React.useState(false);
|
|
@@ -5812,6 +5813,20 @@ const PluridLink = properties => {
|
|
|
5812
5813
|
const debouncedUpdateLinkCoordinates = pluridFunctionsReact.useDebouncedCallback((() => {
|
|
5813
5814
|
updateLinkCoordinates();
|
|
5814
5815
|
}), pluridData.PLURID_DEFAULT_RESIZE_DEBOUNCE_TIME);
|
|
5816
|
+
const assignTreePlaneToLink = (parentPlane, linkCoordinates) => {
|
|
5817
|
+
if (!parentPlane || !parentPlane.children) {
|
|
5818
|
+
return;
|
|
5819
|
+
}
|
|
5820
|
+
for (const plane of parentPlane.children) {
|
|
5821
|
+
if (!plane.linkCoordinates) {
|
|
5822
|
+
continue;
|
|
5823
|
+
}
|
|
5824
|
+
if (plane.linkCoordinates.x === linkCoordinates.x || plane.linkCoordinates.y === linkCoordinates.y) {
|
|
5825
|
+
setShowLink(true);
|
|
5826
|
+
setPluridPlaneID(plane.planeID);
|
|
5827
|
+
}
|
|
5828
|
+
}
|
|
5829
|
+
};
|
|
5815
5830
|
const updateTreeWithLink = event => {
|
|
5816
5831
|
if (!parentPlaneID || !absolutePlaneRoute) {
|
|
5817
5832
|
return;
|
|
@@ -5898,6 +5913,8 @@ const PluridLink = properties => {
|
|
|
5898
5913
|
setParentPlaneID(parentPlaneID);
|
|
5899
5914
|
const linkCoordinates = getPluridLinkCoordinates();
|
|
5900
5915
|
setLinkCoordinates(linkCoordinates);
|
|
5916
|
+
const parentPlane = pluridEngine.space.tree.logic.getTreePlaneByID(stateTree, parentPlaneID);
|
|
5917
|
+
assignTreePlaneToLink(parentPlane, linkCoordinates);
|
|
5901
5918
|
}), []);
|
|
5902
5919
|
React.useEffect((() => {
|
|
5903
5920
|
if (showLink) {
|
|
@@ -5970,10 +5987,17 @@ const PluridLink = properties => {
|
|
|
5970
5987
|
defaultPubSub.unsubscribe(closePlaneIndex);
|
|
5971
5988
|
};
|
|
5972
5989
|
}), [ showLink, pluridPlaneID, JSON.stringify(stateTree) ]);
|
|
5973
|
-
React.useEffect((() =>
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5990
|
+
React.useEffect((() => {
|
|
5991
|
+
const plane = pluridEngine.space.tree.logic.getTreePlaneByID(stateTree, pluridPlaneID);
|
|
5992
|
+
planeRef.current = plane;
|
|
5993
|
+
return () => {
|
|
5994
|
+
setTimeout((() => {
|
|
5995
|
+
var _a;
|
|
5996
|
+
if (showLink && linkElement.current === null && ((_a = planeRef.current) === null || _a === void 0 ? void 0 : _a.show) === false) {
|
|
5997
|
+
removePlane();
|
|
5998
|
+
}
|
|
5999
|
+
}), 10);
|
|
6000
|
+
};
|
|
5977
6001
|
}), [ showLink, showPreview, pluridPlaneID, parentPlaneID, JSON.stringify(stateTree) ]);
|
|
5978
6002
|
return React__default["default"].createElement(StyledPluridLink, {
|
|
5979
6003
|
ref: linkElement,
|