@abdellatifui/react 3.1.88 → 3.1.90

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
@@ -12441,17 +12441,14 @@ const Sidebar = forwardRef((props, ref) => {
12441
12441
  }
12442
12442
  } = props;
12443
12443
  const content = useMemo(() => {
12444
- if (children) {
12445
- return children;
12446
- }
12447
- return null;
12444
+ return children ? children : null;
12448
12445
  }, [children]);
12449
12446
  const handleOpen = useCallback(() => {
12450
12447
  var _a;
12451
12448
  (_a = modelRef.current) == null ? void 0 : _a.open();
12452
- window.setTimeout(() => {
12449
+ setTimeout(() => {
12453
12450
  setIsOpen(true);
12454
- }, 200);
12451
+ }, 50);
12455
12452
  }, []);
12456
12453
  const handleClose = useCallback(() => {
12457
12454
  var _a;
@@ -12500,8 +12497,12 @@ const Sidebar = forwardRef((props, ref) => {
12500
12497
  }
12501
12498
  }, [isOpen]);
12502
12499
  useEffect(() => {
12500
+ var _a;
12503
12501
  if (defaultOpen) {
12504
- setIsOpen(true);
12502
+ (_a = modelRef.current) == null ? void 0 : _a.open();
12503
+ window.setTimeout(() => {
12504
+ setIsOpen(true);
12505
+ }, 50);
12505
12506
  }
12506
12507
  }, [defaultOpen]);
12507
12508
  const mergedModelProps = useMemo(() => ({
@@ -14424,7 +14425,8 @@ const PortText = (props) => {
14424
14425
  rotation,
14425
14426
  isVisible,
14426
14427
  data,
14427
- isFocused
14428
+ isFocused,
14429
+ fontSize
14428
14430
  } = props;
14429
14431
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14430
14432
  "div",
@@ -14441,21 +14443,24 @@ const PortText = (props) => {
14441
14443
  alignItems: "center",
14442
14444
  justifyContent: "center",
14443
14445
  backgroundColor: data == null ? void 0 : data.linkColorHex,
14444
- opacity: isVisible ? 1 : 0
14446
+ opacity: isVisible ? 1 : 0,
14447
+ fontSize: fontSize + "rem"
14445
14448
  },
14446
14449
  children: text
14447
14450
  }
14448
14451
  );
14449
14452
  };
14450
14453
  const SourcesPorts = (props) => {
14451
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
14454
+ var _a, _b, _c, _d;
14452
14455
  const {
14453
14456
  data,
14454
14457
  mapApi,
14455
14458
  currentZoomLevel,
14456
14459
  hoveredConnection,
14457
14460
  mapDragging,
14458
- getEndpointText
14461
+ getEndpointText,
14462
+ mapRotating,
14463
+ fontSize
14459
14464
  } = props;
14460
14465
  const [midpoint, setMidpoint] = useState(null);
14461
14466
  const [isVisible, setIsVisible] = useState(true);
@@ -14476,7 +14481,7 @@ const SourcesPorts = (props) => {
14476
14481
  } else if (currentZoomLevel > 6) {
14477
14482
  setIsVisible(true);
14478
14483
  }
14479
- }, [currentZoomLevel]);
14484
+ }, [currentZoomLevel, mapDragging]);
14480
14485
  useEffect(() => {
14481
14486
  if (!hoveredConnection) {
14482
14487
  setIsVisible(true);
@@ -14491,24 +14496,8 @@ const SourcesPorts = (props) => {
14491
14496
  setIsFocused(false);
14492
14497
  }
14493
14498
  }, [hoveredConnection == null ? void 0 : hoveredConnection.u_id, data == null ? void 0 : data.u_id, currentZoomLevel]);
14494
- useEffect(() => {
14495
- const map = mapApi == null ? void 0 : mapApi.current;
14496
- if (!map) return;
14497
- const onMove = () => setViewportRevision((v) => v + 1);
14498
- map.on("move", onMove);
14499
- map.on("zoom", onMove);
14500
- map.on("rotate", onMove);
14501
- return () => {
14502
- try {
14503
- map.off("move", onMove);
14504
- map.off("zoom", onMove);
14505
- map.off("rotate", onMove);
14506
- } catch (e) {
14507
- }
14508
- };
14509
- }, [mapApi == null ? void 0 : mapApi.current]);
14510
14499
  const sourceLabel = useMemo(() => {
14511
- var _a2, _b2, _c2, _d2, _e2, _f2;
14500
+ var _a2, _b2, _c2, _d2, _e, _f;
14512
14501
  try {
14513
14502
  const map = mapApi == null ? void 0 : mapApi.current;
14514
14503
  if (!map || !(data == null ? void 0 : data.source) || !(data == null ? void 0 : data.destination)) return null;
@@ -14521,7 +14510,7 @@ const SourcesPorts = (props) => {
14521
14510
  const uy = dy / length2;
14522
14511
  const nx = -uy;
14523
14512
  const ny = ux;
14524
- const markerHalfSize = ((_e2 = data == null ? void 0 : data.source) == null ? void 0 : _e2.markerSize) ? ((_f2 = data == null ? void 0 : data.source) == null ? void 0 : _f2.markerSize) / 2 : 12;
14513
+ const markerHalfSize = ((_e = data == null ? void 0 : data.source) == null ? void 0 : _e.markerSize) ? ((_f = data == null ? void 0 : data.source) == null ? void 0 : _f.markerSize) / 2 : 12;
14525
14514
  const totalLength = length2;
14526
14515
  const defaultOffset = { along: 100, perpendicular: 0 };
14527
14516
  const customOffset = (data == null ? void 0 : data.sourcePortOffset) || {};
@@ -14543,9 +14532,9 @@ const SourcesPorts = (props) => {
14543
14532
  } catch (e) {
14544
14533
  return null;
14545
14534
  }
14546
- }, [mapApi == null ? void 0 : mapApi.current, (_a = data == null ? void 0 : data.source) == null ? void 0 : _a.lat, (_b = data == null ? void 0 : data.source) == null ? void 0 : _b.lng, (_c = data == null ? void 0 : data.destination) == null ? void 0 : _c.lat, (_d = data == null ? void 0 : data.destination) == null ? void 0 : _d.lng, (_e = data == null ? void 0 : data.sourcePortOffset) == null ? void 0 : _e.along, (_f = data == null ? void 0 : data.sourcePortOffset) == null ? void 0 : _f.perpendicular, viewportRevision, currentZoomLevel]);
14535
+ }, [mapApi == null ? void 0 : mapApi.current, mapRotating, currentZoomLevel]);
14547
14536
  const destinationLabel = useMemo(() => {
14548
- var _a2, _b2, _c2, _d2, _e2, _f2;
14537
+ var _a2, _b2, _c2, _d2, _e, _f;
14549
14538
  try {
14550
14539
  const map = mapApi == null ? void 0 : mapApi.current;
14551
14540
  if (!map || !(data == null ? void 0 : data.source) || !(data == null ? void 0 : data.destination)) return null;
@@ -14558,7 +14547,7 @@ const SourcesPorts = (props) => {
14558
14547
  const uy = dy / length2;
14559
14548
  const nx = -uy;
14560
14549
  const ny = ux;
14561
- const markerHalfSize = ((_e2 = data == null ? void 0 : data.destination) == null ? void 0 : _e2.markerSize) ? ((_f2 = data == null ? void 0 : data.destination) == null ? void 0 : _f2.markerSize) / 2 : 12;
14550
+ const markerHalfSize = ((_e = data == null ? void 0 : data.destination) == null ? void 0 : _e.markerSize) ? ((_f = data == null ? void 0 : data.destination) == null ? void 0 : _f.markerSize) / 2 : 12;
14562
14551
  const totalLength = length2;
14563
14552
  const defaultOffset = { along: 100, perpendicular: 0 };
14564
14553
  const customOffset = (data == null ? void 0 : data.destinationPortOffset) || {};
@@ -14580,20 +14569,21 @@ const SourcesPorts = (props) => {
14580
14569
  } catch (e) {
14581
14570
  return null;
14582
14571
  }
14583
- }, [mapApi == null ? void 0 : mapApi.current, (_g = data == null ? void 0 : data.source) == null ? void 0 : _g.lat, (_h = data == null ? void 0 : data.source) == null ? void 0 : _h.lng, (_i = data == null ? void 0 : data.destination) == null ? void 0 : _i.lat, (_j = data == null ? void 0 : data.destination) == null ? void 0 : _j.lng, (_k = data == null ? void 0 : data.destinationPortOffset) == null ? void 0 : _k.along, (_l = data == null ? void 0 : data.destinationPortOffset) == null ? void 0 : _l.perpendicular, viewportRevision, currentZoomLevel]);
14572
+ }, [mapApi == null ? void 0 : mapApi.current, mapRotating, currentZoomLevel]);
14584
14573
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
14585
14574
  sourceLabel && /* @__PURE__ */ jsxRuntimeExports.jsx(
14586
14575
  CustomMarker$1,
14587
14576
  {
14588
- longitude: (_m = sourceLabel == null ? void 0 : sourceLabel.position) == null ? void 0 : _m.lng,
14589
- latitude: (_n = sourceLabel == null ? void 0 : sourceLabel.position) == null ? void 0 : _n.lat,
14577
+ longitude: (_a = sourceLabel == null ? void 0 : sourceLabel.position) == null ? void 0 : _a.lng,
14578
+ latitude: (_b = sourceLabel == null ? void 0 : sourceLabel.position) == null ? void 0 : _b.lat,
14590
14579
  offset: [0, 0],
14591
14580
  children: getEndpointText ? getEndpointText({
14592
14581
  ...data,
14593
14582
  rotation: sourceLabel == null ? void 0 : sourceLabel.rotation,
14594
14583
  isVisible,
14595
14584
  text: data == null ? void 0 : data.sourcePort,
14596
- isFocused
14585
+ isFocused,
14586
+ fontSize
14597
14587
  }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
14598
14588
  PortText,
14599
14589
  {
@@ -14601,7 +14591,8 @@ const SourcesPorts = (props) => {
14601
14591
  rotation: sourceLabel == null ? void 0 : sourceLabel.rotation,
14602
14592
  isVisible,
14603
14593
  data,
14604
- isFocused
14594
+ isFocused,
14595
+ fontSize
14605
14596
  }
14606
14597
  )
14607
14598
  }
@@ -14609,15 +14600,16 @@ const SourcesPorts = (props) => {
14609
14600
  destinationLabel && (data == null ? void 0 : data.destinationPort) && /* @__PURE__ */ jsxRuntimeExports.jsx(
14610
14601
  CustomMarker$1,
14611
14602
  {
14612
- longitude: (_o = destinationLabel == null ? void 0 : destinationLabel.position) == null ? void 0 : _o.lng,
14613
- latitude: (_p = destinationLabel == null ? void 0 : destinationLabel.position) == null ? void 0 : _p.lat,
14603
+ longitude: (_c = destinationLabel == null ? void 0 : destinationLabel.position) == null ? void 0 : _c.lng,
14604
+ latitude: (_d = destinationLabel == null ? void 0 : destinationLabel.position) == null ? void 0 : _d.lat,
14614
14605
  offset: [0, 0],
14615
14606
  children: getEndpointText ? getEndpointText({
14616
14607
  ...data,
14617
14608
  rotation: destinationLabel == null ? void 0 : destinationLabel.rotation,
14618
14609
  isVisible,
14619
14610
  text: data == null ? void 0 : data.destinationPort,
14620
- isFocused
14611
+ isFocused,
14612
+ fontSize
14621
14613
  }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
14622
14614
  PortText,
14623
14615
  {
@@ -14626,7 +14618,8 @@ const SourcesPorts = (props) => {
14626
14618
  isVisible,
14627
14619
  data,
14628
14620
  getEndpointText,
14629
- isFocused
14621
+ isFocused,
14622
+ fontSize
14630
14623
  }
14631
14624
  )
14632
14625
  }
@@ -14634,6 +14627,7 @@ const SourcesPorts = (props) => {
14634
14627
  ] });
14635
14628
  };
14636
14629
  const SourcesPorts$1 = memo(SourcesPorts);
14630
+ const baseFont = 0.75;
14637
14631
  const mapStyles = [
14638
14632
  { "name": "street1", url: "https://api.maptiler.com/maps/streets/style.json?key=4s1cX8zNpChcrWFsQqbP" },
14639
14633
  { "name": "street2", url: "https://api.maptiler.com/maps/streets-v2/style.json?key=4s1cX8zNpChcrWFsQqbP" },
@@ -14654,14 +14648,20 @@ function DeckGLOverlay(props) {
14654
14648
  const NetworkMapComponent = forwardRef((props, ref) => {
14655
14649
  const {
14656
14650
  nodes = [],
14651
+ initialZoomLevel = 6,
14657
14652
  connections = [],
14658
14653
  linkHighlightedColorHex = "#ffffff",
14659
14654
  defaultLinkColorHex = "#1d6591",
14660
14655
  defaultAnimationLinkColor = "#f0f3f5",
14661
14656
  hideLinksOnDrag = false,
14657
+ MapLogo,
14658
+ boundMargin = 0.5,
14659
+ MapLogoClassName,
14660
+ MapLogoStyle,
14662
14661
  linkAnimation = true,
14663
14662
  onConnClick = () => {
14664
14663
  },
14664
+ onConnection,
14665
14665
  onNodeClick = () => {
14666
14666
  },
14667
14667
  getEndpointText,
@@ -14697,6 +14697,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14697
14697
  className = ""
14698
14698
  } = props;
14699
14699
  const networkMapRef = useRef();
14700
+ const mapId = useGeneratedId(4, true, false);
14700
14701
  const mapApi = useRef({});
14701
14702
  useRef();
14702
14703
  const [currentCoordinates, setCurrentCoordinates] = useState([]);
@@ -14712,10 +14713,11 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14712
14713
  const [hoveredNode, setHoveredNode] = useState({});
14713
14714
  const [mapZooming, setMapZooming] = useState(false);
14714
14715
  const [startLinkCounterRerender, setStartLinkCounterRerender] = useState(false);
14715
- const [currentZoomLevel, setCurrentZoomLevel] = useState(6);
14716
+ const [currentZoomLevel, setCurrentZoomLevel] = useState(initialZoomLevel);
14716
14717
  const [mapRotating, setMapRotating] = useState();
14717
14718
  const [inViewNodes, setInViewNodes] = useState([]);
14718
14719
  const [inViewConnections, setInViewConnections] = useState([]);
14720
+ const [hasInternet, setHasInternet] = useState(true);
14719
14721
  useEffect(() => {
14720
14722
  if (debug) {
14721
14723
  console.log(props);
@@ -14784,6 +14786,11 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14784
14786
  nodeSizeScaler
14785
14787
  }));
14786
14788
  }, [linkAnimation, nodeSizeScaler, maxZoomOutForLinkCount, showLinkCount, mapApi == null ? void 0 : mapApi.current, isolateNonSelectedLinksOnNodeClick, draggingMode, showHoveredLinksOnly, mapStyle == null ? void 0 : mapStyle.name, hideLinks, defaultLinkColorHex, linkHighlightedColorHex, defaultAnimationLinkColor, enableNativeContextMenu, enableLngLatBox, hideLinksOnDrag, maxZoomOutForLinkCount, nodeSizeScaler]);
14789
+ const sourcePortsFontSizePercentage = useMemo(() => {
14790
+ const scale = currentZoomLevel / initialZoomLevel;
14791
+ const fontSize = baseFont * scale - 0.3;
14792
+ return fontSize;
14793
+ }, [currentZoomLevel]);
14787
14794
  function _onLinkSelected(obj) {
14788
14795
  setSelectedConn(obj);
14789
14796
  onConnClick(obj);
@@ -14929,6 +14936,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14929
14936
  }));
14930
14937
  }
14931
14938
  useImperativeHandle(ref, () => ({
14939
+ id: mapId,
14932
14940
  getCanvas: () => {
14933
14941
  var _a, _b;
14934
14942
  return (_b = (_a = mapApi.current) == null ? void 0 : _a.getCanvas) == null ? void 0 : _b.call(_a);
@@ -14944,6 +14952,22 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14944
14952
  saveOptions,
14945
14953
  loadOptions,
14946
14954
  FlyToNodeApi,
14955
+ setCurrentZoomLevel,
14956
+ setOptions,
14957
+ setMapDragging,
14958
+ hasInternet,
14959
+ setMapZooming,
14960
+ setMapRotating,
14961
+ setStartLinkCounterRerender,
14962
+ setInViewNodes,
14963
+ setInViewConnections,
14964
+ setHoveredNode,
14965
+ setHoveredConnection,
14966
+ setContextMenuEvent,
14967
+ setNodeContextMenuEvent,
14968
+ setSelectedConn,
14969
+ setSelectedNode,
14970
+ setOnScreenLinksGroup,
14947
14971
  ...mapApi.current
14948
14972
  }));
14949
14973
  const _menuItems = useMemo(() => {
@@ -14979,8 +15003,9 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14979
15003
  setStartLinkCounterRerender(true);
14980
15004
  const bounds = (_a = mapApi.current) == null ? void 0 : _a.getBounds();
14981
15005
  console.log("Bounds : ", bounds);
15006
+ const MARGIN = boundMargin;
14982
15007
  const filtered = _nodes.filter(
14983
- (n) => n.location.lng >= bounds.getWest() && n.location.lng <= bounds.getEast() && n.location.lat >= bounds.getSouth() && n.location.lat <= bounds.getNorth()
15008
+ (n) => n.location.lng >= bounds.getWest() - MARGIN && n.location.lng <= bounds.getEast() + MARGIN && n.location.lat >= bounds.getSouth() - MARGIN && n.location.lat <= bounds.getNorth() + MARGIN
14984
15009
  );
14985
15010
  console.log("In View Nodes : ", filtered);
14986
15011
  const cs = [...new Set(filtered.flatMap((node2) => node2 == null ? void 0 : node2.connections))];
@@ -15008,175 +15033,209 @@ const NetworkMapComponent = forwardRef((props, ref) => {
15008
15033
  onLinkMouseOver({ event: e, data: e == null ? void 0 : e.object, type: "connection", id: (_c = e == null ? void 0 : e.object) == null ? void 0 : _c.id, mapApi });
15009
15034
  }
15010
15035
  };
15011
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn(
15012
- "w-full h-full relative rounded overflow-hidden",
15013
- className
15014
- ), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
15036
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
15015
15037
  "div",
15016
15038
  {
15017
- onContextMenu: (e) => {
15018
- if (!(selectedConn == null ? void 0 : selectedConn.x)) {
15019
- return;
15020
- }
15021
- setContextMenuEvent(e);
15022
- onLinkContextMenu({
15023
- data: selectedConn,
15024
- event: e,
15025
- mapApi,
15026
- type: "connection"
15027
- });
15028
- },
15029
- className: "network-map-canvas w-full h-full",
15030
- ref: networkMapRef,
15031
- children: [
15032
- enableNativeContextMenu && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
15033
- /* @__PURE__ */ jsxRuntimeExports.jsx(
15034
- ContextMenu,
15035
- {
15036
- event: contextMenuEvent,
15037
- items: {
15038
- title: _menuTitle,
15039
- items: _menuItems
15040
- }
15041
- }
15042
- ),
15043
- /* @__PURE__ */ jsxRuntimeExports.jsx(
15044
- ContextMenu,
15045
- {
15046
- event: NodeContextMenuEvent,
15047
- items: {
15048
- title: _nodeMenuTitle,
15049
- items: _nodeMenuItems
15050
- }
15039
+ id: "#" + mapId,
15040
+ className: cn(
15041
+ "w-full h-full relative rounded overflow-hidden abdellatifuimap",
15042
+ className
15043
+ ),
15044
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
15045
+ "div",
15046
+ {
15047
+ onContextMenu: (e) => {
15048
+ if (!(selectedConn == null ? void 0 : selectedConn.x)) {
15049
+ return;
15051
15050
  }
15052
- )
15053
- ] }),
15054
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
15055
- Map$1,
15056
- {
15057
- ref: mapApi,
15058
- onMoveStart: () => setStartLinkCounterRerender(false),
15059
- style: {
15060
- width: "100%",
15061
- height: "100%",
15062
- position: "relative"
15063
- },
15064
- initialViewState: {
15065
- longitude: 31.233334,
15066
- latitude: 30.033333,
15067
- zoom: 9,
15068
- bearing: 0,
15069
- minZoom: 3,
15070
- maxZoom: 10
15071
- },
15072
- mapStyle: MapStyleUrl,
15073
- onZoom: (e) => {
15074
- var _a;
15075
- setCurrentZoomLevel((_a = e == null ? void 0 : e.target) == null ? void 0 : _a.getZoom());
15076
- setMapZooming((prev2) => !prev2);
15077
- },
15078
- onRotate: (e) => {
15079
- var _a;
15080
- setMapRotating((_a = e == null ? void 0 : e.viewState) == null ? void 0 : _a.bearing);
15081
- },
15082
- onDragStart: () => setMapDragging(true),
15083
- onDragEnd: () => setMapDragging(false),
15084
- onMoveEnd: handleMoveEnd,
15085
- ...mapProps,
15086
- children: [
15051
+ setContextMenuEvent(e);
15052
+ onLinkContextMenu({
15053
+ data: selectedConn,
15054
+ event: e,
15055
+ mapApi,
15056
+ type: "connection"
15057
+ });
15058
+ },
15059
+ className: "network-map-canvas w-full h-full",
15060
+ ref: networkMapRef,
15061
+ children: [
15062
+ enableNativeContextMenu && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
15087
15063
  /* @__PURE__ */ jsxRuntimeExports.jsx(
15088
- DeckGLOverlay,
15064
+ ContextMenu,
15089
15065
  {
15090
- layers: [...paths],
15091
- onHover: handleHover,
15092
- onClick: (e) => {
15093
- if (!(e == null ? void 0 : e.layer)) {
15094
- setSelectedConn((prev2) => {
15095
- var _a, _b;
15096
- (_b = (_a = prev2 == null ? void 0 : prev2.object) == null ? void 0 : _a.nodes) == null ? void 0 : _b.map((item) => {
15097
- var _a2, _b2;
15098
- (_b2 = (_a2 = item == null ? void 0 : item.ref) == null ? void 0 : _a2.current) == null ? void 0 : _b2.changeMarkerOutline(false);
15099
- });
15100
- return {};
15101
- });
15102
- setOnScreenLinksGroup({ connections: [], nodes: [], countBoxes: [] });
15103
- }
15104
- },
15105
- style: { zIndex: 0 }
15066
+ event: contextMenuEvent,
15067
+ items: {
15068
+ title: _menuTitle,
15069
+ items: _menuItems
15070
+ }
15106
15071
  }
15107
15072
  ),
15108
- inViewNodes == null ? void 0 : inViewNodes.map((item) => {
15109
- var _a, _b;
15110
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
15111
- PinItem$1,
15112
- {
15113
- name: item == null ? void 0 : item.name,
15114
- item,
15115
- nodeSizeScaler,
15116
- longitude: (_a = item == null ? void 0 : item.location) == null ? void 0 : _a.lng,
15117
- options: options2,
15118
- CreateMapObjectsScheme,
15119
- latitude: (_b = item == null ? void 0 : item.location) == null ? void 0 : _b.lat,
15120
- nodeIconMapper,
15121
- hoveredConnection,
15122
- onScreenLinksGroup,
15123
- selectedNode,
15124
- onNodeSelected: _onNodeSelected,
15125
- onNodeMouseOver: _onNodeMouseOver,
15126
- mapApi,
15127
- nodes: _nodes,
15128
- connections: _conns,
15129
- setNodeContextMenuEvent
15130
- },
15131
- "_node_" + (item == null ? void 0 : item.elementId)
15132
- );
15133
- }),
15134
- getOverLinkElement && /* @__PURE__ */ jsxRuntimeExports.jsx(
15135
- LinkOverContainer,
15073
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
15074
+ ContextMenu,
15136
15075
  {
15137
- conn: hoveredConnection,
15138
- coordinates: currentCoordinates,
15139
- mapApi,
15140
- getOverLinkElement,
15141
- getOverLinkElementDelay
15076
+ event: NodeContextMenuEvent,
15077
+ items: {
15078
+ title: _nodeMenuTitle,
15079
+ items: _nodeMenuItems
15080
+ }
15142
15081
  }
15143
- ),
15144
- showLinkCount && !mapDragging && (inViewConnections == null ? void 0 : inViewConnections.map((con, index) => {
15145
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
15146
- LinkCountCircule$1,
15147
- {
15148
- data: con,
15149
- mapApi,
15150
- mapDragging,
15151
- getCenterBox,
15152
- hoveredConnection
15153
- },
15154
- "_lnk_count_circule_" + (con == null ? void 0 : con.u_id)
15155
- );
15156
- })),
15157
- showEndpoints && (inViewConnections == null ? void 0 : inViewConnections.map((con, index) => {
15158
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
15159
- SourcesPorts$1,
15160
- {
15161
- data: con,
15162
- mapApi,
15163
- currentZoomLevel,
15164
- hoveredConnection,
15165
- mapDragging,
15166
- getEndpointText,
15167
- mapRotating
15168
- },
15169
- "_source_port_" + (con == null ? void 0 : con.u_id)
15170
- );
15171
- })),
15172
- /* @__PURE__ */ jsxRuntimeExports.jsx(NavigationControl, {}),
15173
- enableLngLatBox && /* @__PURE__ */ jsxRuntimeExports.jsx(LngLatBox, { coordinates: currentCoordinates })
15174
- ]
15175
- }
15176
- )
15177
- ]
15082
+ )
15083
+ ] }),
15084
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
15085
+ Map$1,
15086
+ {
15087
+ ref: mapApi,
15088
+ onMoveStart: () => setStartLinkCounterRerender(false),
15089
+ style: {
15090
+ width: "100%",
15091
+ height: "100%",
15092
+ position: "relative"
15093
+ },
15094
+ initialViewState: {
15095
+ longitude: 31.233334,
15096
+ latitude: 30.033333,
15097
+ zoom: initialZoomLevel,
15098
+ bearing: 0,
15099
+ minZoom: 3,
15100
+ maxZoom: 10
15101
+ },
15102
+ mapStyle: MapStyleUrl,
15103
+ onZoom: (e) => {
15104
+ var _a;
15105
+ setCurrentZoomLevel((_a = e == null ? void 0 : e.target) == null ? void 0 : _a.getZoom());
15106
+ setMapZooming((prev2) => !prev2);
15107
+ },
15108
+ onRotate: (e) => {
15109
+ var _a;
15110
+ setMapRotating((_a = e == null ? void 0 : e.viewState) == null ? void 0 : _a.bearing);
15111
+ },
15112
+ onDragStart: () => setMapDragging(true),
15113
+ onDragEnd: () => setMapDragging(false),
15114
+ onMoveEnd: handleMoveEnd,
15115
+ onSourceData: (e) => {
15116
+ if (onConnection) {
15117
+ onConnection({ mapApi: mapApi.current, event: e, hasInternet: true });
15118
+ }
15119
+ },
15120
+ onError: (e) => {
15121
+ var _a;
15122
+ const x = ((_a = e.error) == null ? void 0 : _a.status) == 0;
15123
+ if (onConnection) {
15124
+ onConnection({ mapApi: mapApi.current, event: e, hasInternet: x == 0 ? false : true });
15125
+ }
15126
+ },
15127
+ ...mapProps,
15128
+ children: [
15129
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
15130
+ DeckGLOverlay,
15131
+ {
15132
+ layers: [...paths],
15133
+ onHover: handleHover,
15134
+ onClick: (e) => {
15135
+ if (!(e == null ? void 0 : e.layer)) {
15136
+ setSelectedConn((prev2) => {
15137
+ var _a, _b;
15138
+ (_b = (_a = prev2 == null ? void 0 : prev2.object) == null ? void 0 : _a.nodes) == null ? void 0 : _b.map((item) => {
15139
+ var _a2, _b2;
15140
+ (_b2 = (_a2 = item == null ? void 0 : item.ref) == null ? void 0 : _a2.current) == null ? void 0 : _b2.changeMarkerOutline(false);
15141
+ });
15142
+ return {};
15143
+ });
15144
+ setOnScreenLinksGroup({ connections: [], nodes: [], countBoxes: [] });
15145
+ }
15146
+ },
15147
+ style: { zIndex: 0 }
15148
+ }
15149
+ ),
15150
+ inViewNodes == null ? void 0 : inViewNodes.map((item) => {
15151
+ var _a, _b;
15152
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
15153
+ PinItem$1,
15154
+ {
15155
+ name: item == null ? void 0 : item.name,
15156
+ item,
15157
+ nodeSizeScaler,
15158
+ longitude: (_a = item == null ? void 0 : item.location) == null ? void 0 : _a.lng,
15159
+ options: options2,
15160
+ CreateMapObjectsScheme,
15161
+ latitude: (_b = item == null ? void 0 : item.location) == null ? void 0 : _b.lat,
15162
+ nodeIconMapper,
15163
+ hoveredConnection,
15164
+ onScreenLinksGroup,
15165
+ selectedNode,
15166
+ onNodeSelected: _onNodeSelected,
15167
+ onNodeMouseOver: _onNodeMouseOver,
15168
+ mapApi,
15169
+ nodes: _nodes,
15170
+ connections: _conns,
15171
+ setNodeContextMenuEvent
15172
+ },
15173
+ "_node_" + (item == null ? void 0 : item.elementId)
15174
+ );
15175
+ }),
15176
+ getOverLinkElement && /* @__PURE__ */ jsxRuntimeExports.jsx(
15177
+ LinkOverContainer,
15178
+ {
15179
+ conn: hoveredConnection,
15180
+ coordinates: currentCoordinates,
15181
+ mapApi,
15182
+ getOverLinkElement,
15183
+ getOverLinkElementDelay
15184
+ }
15185
+ ),
15186
+ showLinkCount && !mapDragging && (inViewConnections == null ? void 0 : inViewConnections.map((con, index) => {
15187
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
15188
+ LinkCountCircule$1,
15189
+ {
15190
+ data: con,
15191
+ mapApi,
15192
+ mapDragging,
15193
+ getCenterBox,
15194
+ hoveredConnection
15195
+ },
15196
+ "_lnk_count_circule_" + (con == null ? void 0 : con.u_id)
15197
+ );
15198
+ })),
15199
+ showEndpoints && (inViewConnections == null ? void 0 : inViewConnections.map((con, index) => {
15200
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
15201
+ SourcesPorts$1,
15202
+ {
15203
+ fontSize: sourcePortsFontSizePercentage,
15204
+ data: con,
15205
+ mapApi,
15206
+ currentZoomLevel,
15207
+ hoveredConnection,
15208
+ mapDragging,
15209
+ getEndpointText,
15210
+ mapRotating
15211
+ },
15212
+ "_source_port_" + (con == null ? void 0 : con.u_id)
15213
+ );
15214
+ })),
15215
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
15216
+ NavigationControl,
15217
+ {}
15218
+ ),
15219
+ MapLogo && /* @__PURE__ */ jsxRuntimeExports.jsx(
15220
+ "div",
15221
+ {
15222
+ className: cn(
15223
+ "absolute border bg-white p-2 w-fit h-fit z-50 bottom-2 left-2 cursor-default hover:scale-105 transition-all duration-300 select-none",
15224
+ MapLogoClassName
15225
+ ),
15226
+ style: MapLogoStyle || {},
15227
+ children: MapLogo
15228
+ }
15229
+ ),
15230
+ enableLngLatBox && /* @__PURE__ */ jsxRuntimeExports.jsx(LngLatBox, { coordinates: currentCoordinates })
15231
+ ]
15232
+ }
15233
+ )
15234
+ ]
15235
+ }
15236
+ )
15178
15237
  }
15179
- ) });
15238
+ );
15180
15239
  });
15181
15240
  const NetworkMap = memo(NetworkMapComponent);
15182
15241
  const Accordion = AccordionPrimitive.Root;