@plurid/plurid-react 0.0.0-31 → 0.0.0-32
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/components/links/Link/index.d.ts +2 -1
- package/distribution/index.d.ts +1 -1
- package/distribution/index.es.js +26 -22
- package/distribution/index.es.js.map +1 -1
- package/distribution/index.js +25 -21
- package/distribution/index.js.map +1 -1
- package/distribution/index.min.js +2 -2
- package/distribution/index.min.js.map +1 -1
- package/distribution/services/state/actions/index.d.ts +4 -0
- package/distribution/services/state/modules/space/index.d.ts +2 -0
- package/package.json +1 -1
package/distribution/index.js
CHANGED
|
@@ -638,6 +638,10 @@ const space = toolkit.createSlice({
|
|
|
638
638
|
},
|
|
639
639
|
spaceSetCulledView: (state, action) => {
|
|
640
640
|
state.culledView = action.payload;
|
|
641
|
+
},
|
|
642
|
+
removePlane: (state, action) => {
|
|
643
|
+
const updatedTree = pluridEngine.space.tree.logic.removePlaneFromTree(pluridFunctions.objects.clone(state.tree), action.payload);
|
|
644
|
+
state.tree = updatedTree;
|
|
641
645
|
}
|
|
642
646
|
}
|
|
643
647
|
});
|
|
@@ -5733,7 +5737,7 @@ const PluridLink = properties => {
|
|
|
5733
5737
|
if (!planesRegistry) {
|
|
5734
5738
|
return React__default["default"].createElement(React__default["default"].Fragment, null, properties.children);
|
|
5735
5739
|
}
|
|
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;
|
|
5740
|
+
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, dispatchRemovePlane: dispatchRemovePlane} = properties;
|
|
5737
5741
|
const planeControls = stateConfiguration.elements.plane.controls.show;
|
|
5738
5742
|
const previewAppearTime = previewFadeIn || pluridData.PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_IN;
|
|
5739
5743
|
const previewDisappearTime = previewFadeOut || pluridData.PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_OUT;
|
|
@@ -5744,7 +5748,6 @@ const PluridLink = properties => {
|
|
|
5744
5748
|
const linkElement = React.useRef(null);
|
|
5745
5749
|
const hoverInTimeout = React.useRef(null);
|
|
5746
5750
|
const hoverOutTimeout = React.useRef(null);
|
|
5747
|
-
const planeRef = React.useRef();
|
|
5748
5751
|
const [mouseOver, setMouseOver] = React.useState(false);
|
|
5749
5752
|
const [showPreview, setShowPreview] = React.useState(false);
|
|
5750
5753
|
const [showLink, setShowLink] = React.useState(false);
|
|
@@ -5822,6 +5825,9 @@ const PluridLink = properties => {
|
|
|
5822
5825
|
continue;
|
|
5823
5826
|
}
|
|
5824
5827
|
if (plane.linkCoordinates.x === linkCoordinates.x || plane.linkCoordinates.y === linkCoordinates.y) {
|
|
5828
|
+
if (pluridPlaneID === plane.planeID) {
|
|
5829
|
+
continue;
|
|
5830
|
+
}
|
|
5825
5831
|
setShowLink(true);
|
|
5826
5832
|
setPluridPlaneID(plane.planeID);
|
|
5827
5833
|
}
|
|
@@ -5887,9 +5893,12 @@ const PluridLink = properties => {
|
|
|
5887
5893
|
}
|
|
5888
5894
|
};
|
|
5889
5895
|
const removePlane = () => {
|
|
5890
|
-
const
|
|
5891
|
-
|
|
5892
|
-
|
|
5896
|
+
const pluridPlane = document.getElementById(pluridPlaneID);
|
|
5897
|
+
if (!pluridPlane) {
|
|
5898
|
+
return;
|
|
5899
|
+
}
|
|
5900
|
+
dispatchRemovePlane(pluridPlaneID);
|
|
5901
|
+
setShowLink(false);
|
|
5893
5902
|
setShowPreview(false);
|
|
5894
5903
|
};
|
|
5895
5904
|
const handleClick = React.useCallback((event => {
|
|
@@ -5909,11 +5918,11 @@ const PluridLink = properties => {
|
|
|
5909
5918
|
return;
|
|
5910
5919
|
};
|
|
5911
5920
|
React.useEffect((() => {
|
|
5912
|
-
const
|
|
5913
|
-
setParentPlaneID(
|
|
5921
|
+
const newParentPlaneID = getPluridPlaneIDByData$1(linkElement.current);
|
|
5922
|
+
setParentPlaneID(newParentPlaneID);
|
|
5914
5923
|
const linkCoordinates = getPluridLinkCoordinates();
|
|
5915
5924
|
setLinkCoordinates(linkCoordinates);
|
|
5916
|
-
const parentPlane = pluridEngine.space.tree.logic.getTreePlaneByID(stateTree,
|
|
5925
|
+
const parentPlane = pluridEngine.space.tree.logic.getTreePlaneByID(stateTree, newParentPlaneID);
|
|
5917
5926
|
assignTreePlaneToLink(parentPlane, linkCoordinates);
|
|
5918
5927
|
}), []);
|
|
5919
5928
|
React.useEffect((() => {
|
|
@@ -5948,7 +5957,6 @@ const PluridLink = properties => {
|
|
|
5948
5957
|
}
|
|
5949
5958
|
};
|
|
5950
5959
|
}), [ preview, mouseOver ]);
|
|
5951
|
-
React.useEffect((() => {}), []);
|
|
5952
5960
|
React.useEffect((() => {
|
|
5953
5961
|
const openClosedPlaneIndex = defaultPubSub.subscribe({
|
|
5954
5962
|
topic: pluridData.PLURID_PUBSUB_TOPIC.OPEN_CLOSED_PLANE,
|
|
@@ -5987,17 +5995,12 @@ const PluridLink = properties => {
|
|
|
5987
5995
|
defaultPubSub.unsubscribe(closePlaneIndex);
|
|
5988
5996
|
};
|
|
5989
5997
|
}), [ showLink, pluridPlaneID, JSON.stringify(stateTree) ]);
|
|
5990
|
-
React.useEffect((() => {
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
if (showLink && linkElement.current === null && ((_a = planeRef.current) === null || _a === void 0 ? void 0 : _a.show) === false) {
|
|
5997
|
-
removePlane();
|
|
5998
|
-
}
|
|
5999
|
-
}), 10);
|
|
6000
|
-
};
|
|
5998
|
+
React.useEffect((() => () => {
|
|
5999
|
+
setTimeout((() => {
|
|
6000
|
+
if (pluridPlaneID && showLink && linkElement.current === null) {
|
|
6001
|
+
removePlane();
|
|
6002
|
+
}
|
|
6003
|
+
}), 10);
|
|
6001
6004
|
}), [ showLink, showPreview, pluridPlaneID, parentPlaneID, JSON.stringify(stateTree) ]);
|
|
6002
6005
|
return React__default["default"].createElement(StyledPluridLink, {
|
|
6003
6006
|
ref: linkElement,
|
|
@@ -6036,7 +6039,8 @@ const mapDispatchToProperties$5 = dispatch => ({
|
|
|
6036
6039
|
dispatch: dispatch,
|
|
6037
6040
|
dispatchSetTree: payload => dispatch(actions.space.setTree(payload)),
|
|
6038
6041
|
dispatchSetSpaceField: payload => dispatch(actions.space.setSpaceField(payload)),
|
|
6039
|
-
dispatchUpdateSpaceLinkCoordinates: payload => dispatch(actions.space.updateSpaceLinkCoordinates(payload))
|
|
6042
|
+
dispatchUpdateSpaceLinkCoordinates: payload => dispatch(actions.space.updateSpaceLinkCoordinates(payload)),
|
|
6043
|
+
dispatchRemovePlane: payload => dispatch(actions.space.removePlane(payload))
|
|
6040
6044
|
});
|
|
6041
6045
|
|
|
6042
6046
|
const ConnectedPluridLink = reactRedux.connect(mapStateToProperties$5, mapDispatchToProperties$5, null, {
|