@abdellatifui/react 3.1.84 → 3.1.86

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/nextgen.js CHANGED
@@ -14155,6 +14155,7 @@ const SourcesPorts = (props) => {
14155
14155
  const [viewportRevision, setViewportRevision] = useState(0);
14156
14156
  const [isFocused, setIsFocused] = useState(false);
14157
14157
  useEffect(() => {
14158
+ console.log("ENDPOINT TEXT");
14158
14159
  if (mapDragging) {
14159
14160
  setIsVisible(false);
14160
14161
  return;
@@ -14389,6 +14390,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14389
14390
  } = props;
14390
14391
  const networkMapRef = useRef();
14391
14392
  const mapApi = useRef({});
14393
+ useRef();
14392
14394
  const [currentCoordinates, setCurrentCoordinates] = useState([]);
14393
14395
  const [_conns, setConns] = useState([]);
14394
14396
  const [_nodes, setNodes] = useState(nodes);
@@ -14403,6 +14405,9 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14403
14405
  const [mapZooming, setMapZooming] = useState(false);
14404
14406
  const [startLinkCounterRerender, setStartLinkCounterRerender] = useState(false);
14405
14407
  const [currentZoomLevel, setCurrentZoomLevel] = useState(6);
14408
+ const [mapRotating, setMapRotating] = useState();
14409
+ const [inViewNodes, setInViewNodes] = useState([]);
14410
+ const [inViewConnections, setInViewConnections] = useState([]);
14406
14411
  useEffect(() => {
14407
14412
  if (debug) {
14408
14413
  console.log(props);
@@ -14632,7 +14637,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14632
14637
  loadOptions,
14633
14638
  FlyToNodeApi,
14634
14639
  ...mapApi.current
14635
- }), [mapApi.current]);
14640
+ }));
14636
14641
  const _menuItems = useMemo(() => {
14637
14642
  return (menuItems == null ? void 0 : menuItems.map((item) => ({
14638
14643
  ...item,
@@ -14646,7 +14651,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14646
14651
  });
14647
14652
  }
14648
14653
  }))) || [];
14649
- }, [menuItems, contextMenuEvent, selectedConn]);
14654
+ }, [menuItems == null ? void 0 : menuItems.length, contextMenuEvent, selectedConn]);
14650
14655
  const _nodeMenuItems = useMemo(() => {
14651
14656
  return (nodeMenuItems == null ? void 0 : nodeMenuItems.map((item) => ({
14652
14657
  ...item,
@@ -14660,9 +14665,20 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14660
14665
  });
14661
14666
  }
14662
14667
  }))) || [];
14663
- }, [nodeMenuItems, NodeContextMenuEvent, selectedNode]);
14664
- const handleMoveEnd = () => {
14668
+ }, [nodeMenuItems == null ? void 0 : nodeMenuItems.length, NodeContextMenuEvent, selectedNode]);
14669
+ const handleMoveEnd = (e) => {
14670
+ var _a;
14665
14671
  setStartLinkCounterRerender(true);
14672
+ const bounds = (_a = mapApi.current) == null ? void 0 : _a.getBounds();
14673
+ console.log("Bounds : ", bounds);
14674
+ const filtered = _nodes.filter(
14675
+ (n) => n.location.lng >= bounds.getWest() && n.location.lng <= bounds.getEast() && n.location.lat >= bounds.getSouth() && n.location.lat <= bounds.getNorth()
14676
+ );
14677
+ console.log("In View Nodes : ", filtered);
14678
+ const cs = [...new Set(filtered.flatMap((node2) => node2 == null ? void 0 : node2.connections))];
14679
+ console.log("Connections : ", cs);
14680
+ setInViewNodes(filtered);
14681
+ setInViewConnections(cs);
14666
14682
  };
14667
14683
  const handleHover = (e) => {
14668
14684
  var _a, _b, _c;
@@ -14738,9 +14754,9 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14738
14754
  position: "relative"
14739
14755
  },
14740
14756
  initialViewState: {
14741
- longitude: 26.8206,
14742
- latitude: 30.8025,
14743
- zoom: 6,
14757
+ longitude: 31.233334,
14758
+ latitude: 30.033333,
14759
+ zoom: 9,
14744
14760
  bearing: 0,
14745
14761
  minZoom: 3,
14746
14762
  maxZoom: 10
@@ -14751,6 +14767,10 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14751
14767
  setCurrentZoomLevel((_a = e == null ? void 0 : e.target) == null ? void 0 : _a.getZoom());
14752
14768
  setMapZooming((prev2) => !prev2);
14753
14769
  },
14770
+ onRotate: (e) => {
14771
+ var _a;
14772
+ setMapRotating((_a = e == null ? void 0 : e.viewState) == null ? void 0 : _a.bearing);
14773
+ },
14754
14774
  onDragStart: () => setMapDragging(true),
14755
14775
  onDragEnd: () => setMapDragging(false),
14756
14776
  onMoveEnd: handleMoveEnd,
@@ -14777,7 +14797,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14777
14797
  style: { zIndex: 0 }
14778
14798
  }
14779
14799
  ),
14780
- _nodes == null ? void 0 : _nodes.map((item) => {
14800
+ inViewNodes == null ? void 0 : inViewNodes.map((item) => {
14781
14801
  var _a, _b;
14782
14802
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14783
14803
  PinItem$1,
@@ -14813,7 +14833,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14813
14833
  getOverLinkElementDelay
14814
14834
  }
14815
14835
  ),
14816
- showLinkCount && !mapDragging && (_conns == null ? void 0 : _conns.map((con, index) => {
14836
+ showLinkCount && !mapDragging && (inViewConnections == null ? void 0 : inViewConnections.map((con, index) => {
14817
14837
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14818
14838
  LinkCountCircule$1,
14819
14839
  {
@@ -14823,10 +14843,10 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14823
14843
  getCenterBox,
14824
14844
  hoveredConnection
14825
14845
  },
14826
- "_lnk_count_circule_" + index
14846
+ "_lnk_count_circule_" + (con == null ? void 0 : con.u_id)
14827
14847
  );
14828
14848
  })),
14829
- showEndpoints && (_conns == null ? void 0 : _conns.map((con, index) => {
14849
+ showEndpoints && (inViewConnections == null ? void 0 : inViewConnections.map((con, index) => {
14830
14850
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14831
14851
  SourcesPorts$1,
14832
14852
  {
@@ -14835,9 +14855,10 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14835
14855
  currentZoomLevel,
14836
14856
  hoveredConnection,
14837
14857
  mapDragging,
14838
- getEndpointText
14858
+ getEndpointText,
14859
+ mapRotating
14839
14860
  },
14840
- "_source_port_" + index
14861
+ "_source_port_" + (con == null ? void 0 : con.u_id)
14841
14862
  );
14842
14863
  })),
14843
14864
  /* @__PURE__ */ jsxRuntimeExports.jsx(NavigationControl, {}),