@abdellatifui/react 3.1.83 → 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,7 +14389,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14389
14389
  } = props;
14390
14390
  const networkMapRef = useRef();
14391
14391
  const mapApi = useRef({});
14392
- const deckRef = useRef();
14392
+ useRef();
14393
14393
  const [currentCoordinates, setCurrentCoordinates] = useState([]);
14394
14394
  const [_conns, setConns] = useState([]);
14395
14395
  const [_nodes, setNodes] = useState(nodes);
@@ -14404,6 +14404,9 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14404
14404
  const [mapZooming, setMapZooming] = useState(false);
14405
14405
  const [startLinkCounterRerender, setStartLinkCounterRerender] = useState(false);
14406
14406
  const [currentZoomLevel, setCurrentZoomLevel] = useState(6);
14407
+ const [mapRotating, setMapRotating] = useState();
14408
+ const [inViewNodes, setInViewNodes] = useState([]);
14409
+ const [inViewConnections, setInViewConnections] = useState([]);
14407
14410
  useEffect(() => {
14408
14411
  if (debug) {
14409
14412
  console.log(props);
@@ -14633,7 +14636,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14633
14636
  loadOptions,
14634
14637
  FlyToNodeApi,
14635
14638
  ...mapApi.current
14636
- }), [mapApi.current]);
14639
+ }));
14637
14640
  const _menuItems = useMemo(() => {
14638
14641
  return (menuItems == null ? void 0 : menuItems.map((item) => ({
14639
14642
  ...item,
@@ -14647,7 +14650,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14647
14650
  });
14648
14651
  }
14649
14652
  }))) || [];
14650
- }, [menuItems, contextMenuEvent, selectedConn]);
14653
+ }, [menuItems == null ? void 0 : menuItems.length, contextMenuEvent, selectedConn]);
14651
14654
  const _nodeMenuItems = useMemo(() => {
14652
14655
  return (nodeMenuItems == null ? void 0 : nodeMenuItems.map((item) => ({
14653
14656
  ...item,
@@ -14661,9 +14664,20 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14661
14664
  });
14662
14665
  }
14663
14666
  }))) || [];
14664
- }, [nodeMenuItems, NodeContextMenuEvent, selectedNode]);
14665
- const handleMoveEnd = () => {
14667
+ }, [nodeMenuItems == null ? void 0 : nodeMenuItems.length, NodeContextMenuEvent, selectedNode]);
14668
+ const handleMoveEnd = (e) => {
14669
+ var _a;
14666
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);
14667
14681
  };
14668
14682
  const handleHover = (e) => {
14669
14683
  var _a, _b, _c;
@@ -14739,9 +14753,9 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14739
14753
  position: "relative"
14740
14754
  },
14741
14755
  initialViewState: {
14742
- longitude: 26.8206,
14743
- latitude: 30.8025,
14744
- zoom: 6,
14756
+ longitude: 31.233334,
14757
+ latitude: 30.033333,
14758
+ zoom: 9,
14745
14759
  bearing: 0,
14746
14760
  minZoom: 3,
14747
14761
  maxZoom: 10
@@ -14752,6 +14766,10 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14752
14766
  setCurrentZoomLevel((_a = e == null ? void 0 : e.target) == null ? void 0 : _a.getZoom());
14753
14767
  setMapZooming((prev2) => !prev2);
14754
14768
  },
14769
+ onRotate: (e) => {
14770
+ var _a;
14771
+ setMapRotating((_a = e == null ? void 0 : e.viewState) == null ? void 0 : _a.bearing);
14772
+ },
14755
14773
  onDragStart: () => setMapDragging(true),
14756
14774
  onDragEnd: () => setMapDragging(false),
14757
14775
  onMoveEnd: handleMoveEnd,
@@ -14762,7 +14780,6 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14762
14780
  {
14763
14781
  layers: [...paths],
14764
14782
  onHover: handleHover,
14765
- ref: deckRef,
14766
14783
  onClick: (e) => {
14767
14784
  if (!(e == null ? void 0 : e.layer)) {
14768
14785
  setSelectedConn((prev2) => {
@@ -14779,7 +14796,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14779
14796
  style: { zIndex: 0 }
14780
14797
  }
14781
14798
  ),
14782
- _nodes == null ? void 0 : _nodes.map((item) => {
14799
+ inViewNodes == null ? void 0 : inViewNodes.map((item) => {
14783
14800
  var _a, _b;
14784
14801
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14785
14802
  PinItem$1,
@@ -14815,7 +14832,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14815
14832
  getOverLinkElementDelay
14816
14833
  }
14817
14834
  ),
14818
- showLinkCount && !mapDragging && (_conns == null ? void 0 : _conns.map((con, index) => {
14835
+ showLinkCount && !mapDragging && (inViewConnections == null ? void 0 : inViewConnections.map((con, index) => {
14819
14836
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14820
14837
  LinkCountCircule$1,
14821
14838
  {
@@ -14828,7 +14845,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14828
14845
  "_lnk_count_circule_" + index
14829
14846
  );
14830
14847
  })),
14831
- showEndpoints && (_conns == null ? void 0 : _conns.map((con, index) => {
14848
+ showEndpoints && (inViewConnections == null ? void 0 : inViewConnections.map((con, index) => {
14832
14849
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14833
14850
  SourcesPorts$1,
14834
14851
  {
@@ -14837,7 +14854,8 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14837
14854
  currentZoomLevel,
14838
14855
  hoveredConnection,
14839
14856
  mapDragging,
14840
- getEndpointText
14857
+ getEndpointText,
14858
+ mapRotating
14841
14859
  },
14842
14860
  "_source_port_" + index
14843
14861
  );