@abdellatifui/react 3.1.84 → 3.1.85

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