@abdellatifui/react 3.1.89 → 3.1.91

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;
@@ -12725,13 +12722,13 @@ const LazyContainer = (props) => {
12725
12722
  ) });
12726
12723
  };
12727
12724
  const hex2rgb = (hex) => {
12728
- let hexValue = hex.startsWith("#") ? hex.slice(1) : hex;
12729
- if (hexValue.length === 3) {
12725
+ let hexValue = (hex == null ? void 0 : hex.startsWith("#")) ? hex == null ? void 0 : hex.slice(1) : hex;
12726
+ if ((hexValue == null ? void 0 : hexValue.length) === 3) {
12730
12727
  hexValue = hexValue.split("").map((char2) => char2 + char2).join("");
12731
12728
  }
12732
- const r2 = parseInt(hexValue.substring(0, 2), 16);
12733
- const g = parseInt(hexValue.substring(2, 4), 16);
12734
- const b = parseInt(hexValue.substring(4, 6), 16);
12729
+ const r2 = parseInt(hexValue == null ? void 0 : hexValue.substring(0, 2), 16);
12730
+ const g = parseInt(hexValue == null ? void 0 : hexValue.substring(2, 4), 16);
12731
+ const b = parseInt(hexValue == null ? void 0 : hexValue.substring(4, 6), 16);
12735
12732
  return [r2, g, b];
12736
12733
  };
12737
12734
  const createDefaultNodeTempate = (params) => {
@@ -14147,11 +14144,19 @@ const useCreatePath = ({ connections = [], mapApi, options: options2, selectedCo
14147
14144
  const [currentTime, setTime] = useState(0);
14148
14145
  const loopLength = 20;
14149
14146
  const animationSpeed = 5;
14150
- const layer0conns = useMemo(() => {
14151
- return connections == null ? void 0 : connections.filter((item) => (item == null ? void 0 : item.layer) == 0);
14152
- }, [
14153
- connections
14154
- ]);
14147
+ const layer0conns = useMemo(
14148
+ () => {
14149
+ var _a;
14150
+ const seen = /* @__PURE__ */ new Set();
14151
+ const f0 = (_a = connections == null ? void 0 : connections.filter((item) => (item == null ? void 0 : item.layer) === 0)) == null ? void 0 : _a.filter((item) => {
14152
+ if (seen.has(item.sourcesId)) return false;
14153
+ seen.add(item.sourcesId);
14154
+ return true;
14155
+ });
14156
+ return f0;
14157
+ },
14158
+ [connections]
14159
+ );
14155
14160
  const layer1conns = useMemo(() => {
14156
14161
  console.log("layer1conns", connections);
14157
14162
  const a = connections == null ? void 0 : connections.filter((item) => (item == null ? void 0 : item.layer) == 1);
@@ -14285,7 +14290,8 @@ const CustomMarker = (props) => {
14285
14290
  latitude,
14286
14291
  children,
14287
14292
  offset = [0, 0],
14288
- markerProps = {}
14293
+ markerProps = {},
14294
+ style: style2 = {}
14289
14295
  } = props;
14290
14296
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14291
14297
  Marker,
@@ -14294,7 +14300,8 @@ const CustomMarker = (props) => {
14294
14300
  latitude,
14295
14301
  anchor: "center",
14296
14302
  style: {
14297
- zIndex: 30
14303
+ zIndex: 30,
14304
+ ...style2
14298
14305
  },
14299
14306
  offset,
14300
14307
  children
@@ -14337,7 +14344,8 @@ const LinkCountCircule = (props) => {
14337
14344
  mapApi,
14338
14345
  mapZooming,
14339
14346
  getCenterBox,
14340
- hoveredConnection
14347
+ hoveredConnection,
14348
+ draggingMode: draggingMode2
14341
14349
  } = props;
14342
14350
  const [midpoint, setMidpoint] = useState(null);
14343
14351
  const [isVisible, setIsVisible] = useState(true);
@@ -14364,6 +14372,9 @@ const LinkCountCircule = (props) => {
14364
14372
  {
14365
14373
  longitude: midpoint == null ? void 0 : midpoint.lng,
14366
14374
  latitude: midpoint == null ? void 0 : midpoint.lat,
14375
+ style: {
14376
+ opacity: draggingMode2 ? 0 : 1
14377
+ },
14367
14378
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
14368
14379
  ConnectionBadge,
14369
14380
  {
@@ -14411,7 +14422,10 @@ const LinkOverContainer = (props) => {
14411
14422
  onMouseLeave: () => {
14412
14423
  setElement(null);
14413
14424
  },
14414
- className: "absolute z-30 pointer-events-auto",
14425
+ className: cn(
14426
+ "absolute z-30 pointer-events-auto",
14427
+ draggingMode && "hidden"
14428
+ ),
14415
14429
  style: {
14416
14430
  transform: "translate(-50%, -50%)",
14417
14431
  left: position2[0],
@@ -14422,20 +14436,23 @@ const LinkOverContainer = (props) => {
14422
14436
  );
14423
14437
  };
14424
14438
  const PortText = (props) => {
14439
+ var _a;
14425
14440
  const ref = useRef(null);
14426
14441
  const {
14427
14442
  text,
14428
14443
  rotation,
14429
14444
  isVisible,
14430
14445
  data,
14431
- isFocused
14446
+ isFocused,
14447
+ fontSize,
14448
+ isSource
14432
14449
  } = props;
14433
14450
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14434
14451
  "div",
14435
14452
  {
14436
14453
  ref,
14437
14454
  className: cn(
14438
- "w-fit h-fit font-geist text-xs z-[300] rounded-full text-accent px-1 cursor-default pointer-events-all hover:!scale-[1.5] transition-all duration-300",
14455
+ "w-fit h-fit font-geist space-y-1 text-xs z-[300] rounded-full text-accent px-1 cursor-default pointer-events-all hover:!scale-[1.5] transition-all duration-300",
14439
14456
  isFocused && "!scale-[1.5]"
14440
14457
  ),
14441
14458
  style: {
@@ -14445,21 +14462,29 @@ const PortText = (props) => {
14445
14462
  alignItems: "center",
14446
14463
  justifyContent: "center",
14447
14464
  backgroundColor: data == null ? void 0 : data.linkColorHex,
14448
- opacity: isVisible ? 1 : 0
14465
+ opacity: isVisible ? 1 : 0,
14466
+ fontSize: fontSize + "rem"
14449
14467
  },
14450
- children: text
14468
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: (_a = data == null ? void 0 : data.linksGroup) == null ? void 0 : _a.map((item) => {
14469
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn(
14470
+ "px-2 bg-black/20 rounded-full "
14471
+ ), children: (item == null ? void 0 : item.isSource) ? item == null ? void 0 : item.sourcePort : item == null ? void 0 : item.destinationPort }, "txtport-" + (item == null ? void 0 : item.u_id));
14472
+ }) })
14451
14473
  }
14452
14474
  );
14453
14475
  };
14454
14476
  const SourcesPorts = (props) => {
14455
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
14477
+ var _a, _b, _c, _d;
14456
14478
  const {
14457
14479
  data,
14458
14480
  mapApi,
14459
14481
  currentZoomLevel,
14460
14482
  hoveredConnection,
14461
14483
  mapDragging,
14462
- getEndpointText
14484
+ getEndpointText,
14485
+ mapRotating,
14486
+ fontSize,
14487
+ draggingMode: draggingMode2
14463
14488
  } = props;
14464
14489
  const [midpoint, setMidpoint] = useState(null);
14465
14490
  const [isVisible, setIsVisible] = useState(true);
@@ -14472,6 +14497,10 @@ const SourcesPorts = (props) => {
14472
14497
  setIsVisible(false);
14473
14498
  return;
14474
14499
  } else {
14500
+ if (mapDragging) {
14501
+ setIsVisible(false);
14502
+ return;
14503
+ }
14475
14504
  setIsVisible(true);
14476
14505
  }
14477
14506
  if (currentZoomLevel < 5) {
@@ -14480,8 +14509,14 @@ const SourcesPorts = (props) => {
14480
14509
  } else if (currentZoomLevel > 6) {
14481
14510
  setIsVisible(true);
14482
14511
  }
14483
- }, [currentZoomLevel]);
14512
+ }, [currentZoomLevel, mapDragging]);
14484
14513
  useEffect(() => {
14514
+ if (draggingMode2) {
14515
+ setIsVisible(false);
14516
+ return;
14517
+ } else {
14518
+ setIsVisible(true);
14519
+ }
14485
14520
  if (!hoveredConnection) {
14486
14521
  setIsVisible(true);
14487
14522
  setIsFocused(false);
@@ -14494,25 +14529,9 @@ const SourcesPorts = (props) => {
14494
14529
  setIsVisible(false);
14495
14530
  setIsFocused(false);
14496
14531
  }
14497
- }, [hoveredConnection == null ? void 0 : hoveredConnection.u_id, data == null ? void 0 : data.u_id, currentZoomLevel]);
14498
- useEffect(() => {
14499
- const map = mapApi == null ? void 0 : mapApi.current;
14500
- if (!map) return;
14501
- const onMove = () => setViewportRevision((v) => v + 1);
14502
- map.on("move", onMove);
14503
- map.on("zoom", onMove);
14504
- map.on("rotate", onMove);
14505
- return () => {
14506
- try {
14507
- map.off("move", onMove);
14508
- map.off("zoom", onMove);
14509
- map.off("rotate", onMove);
14510
- } catch (e) {
14511
- }
14512
- };
14513
- }, [mapApi == null ? void 0 : mapApi.current]);
14532
+ }, [hoveredConnection == null ? void 0 : hoveredConnection.u_id, data == null ? void 0 : data.u_id, currentZoomLevel, draggingMode2]);
14514
14533
  const sourceLabel = useMemo(() => {
14515
- var _a2, _b2, _c2, _d2, _e2, _f2;
14534
+ var _a2, _b2, _c2, _d2, _e, _f;
14516
14535
  try {
14517
14536
  const map = mapApi == null ? void 0 : mapApi.current;
14518
14537
  if (!map || !(data == null ? void 0 : data.source) || !(data == null ? void 0 : data.destination)) return null;
@@ -14525,7 +14544,7 @@ const SourcesPorts = (props) => {
14525
14544
  const uy = dy / length2;
14526
14545
  const nx = -uy;
14527
14546
  const ny = ux;
14528
- 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;
14547
+ 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;
14529
14548
  const totalLength = length2;
14530
14549
  const defaultOffset = { along: 100, perpendicular: 0 };
14531
14550
  const customOffset = (data == null ? void 0 : data.sourcePortOffset) || {};
@@ -14547,9 +14566,9 @@ const SourcesPorts = (props) => {
14547
14566
  } catch (e) {
14548
14567
  return null;
14549
14568
  }
14550
- }, [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]);
14569
+ }, [mapApi == null ? void 0 : mapApi.current, mapRotating, currentZoomLevel, draggingMode2]);
14551
14570
  const destinationLabel = useMemo(() => {
14552
- var _a2, _b2, _c2, _d2, _e2, _f2;
14571
+ var _a2, _b2, _c2, _d2, _e, _f;
14553
14572
  try {
14554
14573
  const map = mapApi == null ? void 0 : mapApi.current;
14555
14574
  if (!map || !(data == null ? void 0 : data.source) || !(data == null ? void 0 : data.destination)) return null;
@@ -14562,7 +14581,7 @@ const SourcesPorts = (props) => {
14562
14581
  const uy = dy / length2;
14563
14582
  const nx = -uy;
14564
14583
  const ny = ux;
14565
- 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;
14584
+ 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;
14566
14585
  const totalLength = length2;
14567
14586
  const defaultOffset = { along: 100, perpendicular: 0 };
14568
14587
  const customOffset = (data == null ? void 0 : data.destinationPortOffset) || {};
@@ -14584,20 +14603,23 @@ const SourcesPorts = (props) => {
14584
14603
  } catch (e) {
14585
14604
  return null;
14586
14605
  }
14587
- }, [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]);
14606
+ }, [mapApi == null ? void 0 : mapApi.current, mapRotating, currentZoomLevel, draggingMode2]);
14588
14607
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
14589
14608
  sourceLabel && /* @__PURE__ */ jsxRuntimeExports.jsx(
14590
14609
  CustomMarker$1,
14591
14610
  {
14592
- longitude: (_m = sourceLabel == null ? void 0 : sourceLabel.position) == null ? void 0 : _m.lng,
14593
- latitude: (_n = sourceLabel == null ? void 0 : sourceLabel.position) == null ? void 0 : _n.lat,
14611
+ longitude: (_a = sourceLabel == null ? void 0 : sourceLabel.position) == null ? void 0 : _a.lng,
14612
+ latitude: (_b = sourceLabel == null ? void 0 : sourceLabel.position) == null ? void 0 : _b.lat,
14594
14613
  offset: [0, 0],
14595
14614
  children: getEndpointText ? getEndpointText({
14596
14615
  ...data,
14597
14616
  rotation: sourceLabel == null ? void 0 : sourceLabel.rotation,
14598
14617
  isVisible,
14599
14618
  text: data == null ? void 0 : data.sourcePort,
14600
- isFocused
14619
+ isFocused,
14620
+ fontSize,
14621
+ isSource: true,
14622
+ draggingMode: draggingMode2
14601
14623
  }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
14602
14624
  PortText,
14603
14625
  {
@@ -14605,7 +14627,9 @@ const SourcesPorts = (props) => {
14605
14627
  rotation: sourceLabel == null ? void 0 : sourceLabel.rotation,
14606
14628
  isVisible,
14607
14629
  data,
14608
- isFocused
14630
+ isFocused,
14631
+ fontSize,
14632
+ isSource: true
14609
14633
  }
14610
14634
  )
14611
14635
  }
@@ -14613,15 +14637,18 @@ const SourcesPorts = (props) => {
14613
14637
  destinationLabel && (data == null ? void 0 : data.destinationPort) && /* @__PURE__ */ jsxRuntimeExports.jsx(
14614
14638
  CustomMarker$1,
14615
14639
  {
14616
- longitude: (_o = destinationLabel == null ? void 0 : destinationLabel.position) == null ? void 0 : _o.lng,
14617
- latitude: (_p = destinationLabel == null ? void 0 : destinationLabel.position) == null ? void 0 : _p.lat,
14640
+ longitude: (_c = destinationLabel == null ? void 0 : destinationLabel.position) == null ? void 0 : _c.lng,
14641
+ latitude: (_d = destinationLabel == null ? void 0 : destinationLabel.position) == null ? void 0 : _d.lat,
14618
14642
  offset: [0, 0],
14619
14643
  children: getEndpointText ? getEndpointText({
14620
14644
  ...data,
14621
14645
  rotation: destinationLabel == null ? void 0 : destinationLabel.rotation,
14622
14646
  isVisible,
14623
14647
  text: data == null ? void 0 : data.destinationPort,
14624
- isFocused
14648
+ isFocused,
14649
+ fontSize,
14650
+ isSource: false,
14651
+ draggingMode: draggingMode2
14625
14652
  }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
14626
14653
  PortText,
14627
14654
  {
@@ -14630,7 +14657,9 @@ const SourcesPorts = (props) => {
14630
14657
  isVisible,
14631
14658
  data,
14632
14659
  getEndpointText,
14633
- isFocused
14660
+ isFocused,
14661
+ fontSize,
14662
+ isSource: false
14634
14663
  }
14635
14664
  )
14636
14665
  }
@@ -14638,6 +14667,7 @@ const SourcesPorts = (props) => {
14638
14667
  ] });
14639
14668
  };
14640
14669
  const SourcesPorts$1 = memo(SourcesPorts);
14670
+ const baseFont = 0.75;
14641
14671
  const mapStyles = [
14642
14672
  { "name": "street1", url: "https://api.maptiler.com/maps/streets/style.json?key=4s1cX8zNpChcrWFsQqbP" },
14643
14673
  { "name": "street2", url: "https://api.maptiler.com/maps/streets-v2/style.json?key=4s1cX8zNpChcrWFsQqbP" },
@@ -14658,14 +14688,20 @@ function DeckGLOverlay(props) {
14658
14688
  const NetworkMapComponent = forwardRef((props, ref) => {
14659
14689
  const {
14660
14690
  nodes = [],
14691
+ initialZoomLevel = 6,
14661
14692
  connections = [],
14662
14693
  linkHighlightedColorHex = "#ffffff",
14663
14694
  defaultLinkColorHex = "#1d6591",
14664
14695
  defaultAnimationLinkColor = "#f0f3f5",
14665
14696
  hideLinksOnDrag = false,
14697
+ MapLogo,
14698
+ boundMargin = 0.5,
14699
+ MapLogoClassName,
14700
+ MapLogoStyle,
14666
14701
  linkAnimation = true,
14667
14702
  onConnClick = () => {
14668
14703
  },
14704
+ onConnection,
14669
14705
  onNodeClick = () => {
14670
14706
  },
14671
14707
  getEndpointText,
@@ -14688,7 +14724,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14688
14724
  hideLinks = false,
14689
14725
  getCenterBox,
14690
14726
  enableLngLatBox = true,
14691
- draggingMode = false,
14727
+ draggingMode: draggingMode2 = false,
14692
14728
  mapProps = {},
14693
14729
  menuItems = [],
14694
14730
  nodeMenuItems = [],
@@ -14701,6 +14737,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14701
14737
  className = ""
14702
14738
  } = props;
14703
14739
  const networkMapRef = useRef();
14740
+ const mapId = useGeneratedId(4, true, false);
14704
14741
  const mapApi = useRef({});
14705
14742
  useRef();
14706
14743
  const [currentCoordinates, setCurrentCoordinates] = useState([]);
@@ -14716,10 +14753,11 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14716
14753
  const [hoveredNode, setHoveredNode] = useState({});
14717
14754
  const [mapZooming, setMapZooming] = useState(false);
14718
14755
  const [startLinkCounterRerender, setStartLinkCounterRerender] = useState(false);
14719
- const [currentZoomLevel, setCurrentZoomLevel] = useState(6);
14756
+ const [currentZoomLevel, setCurrentZoomLevel] = useState(initialZoomLevel);
14720
14757
  const [mapRotating, setMapRotating] = useState();
14721
14758
  const [inViewNodes, setInViewNodes] = useState([]);
14722
14759
  const [inViewConnections, setInViewConnections] = useState([]);
14760
+ const [hasInternet, setHasInternet] = useState(true);
14723
14761
  useEffect(() => {
14724
14762
  if (debug) {
14725
14763
  console.log(props);
@@ -14741,7 +14779,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14741
14779
  hideLinksOnDrag,
14742
14780
  hideLinks,
14743
14781
  showHoveredLinksOnly,
14744
- draggingMode,
14782
+ draggingMode: draggingMode2,
14745
14783
  isolateNonSelectedLinksOnNodeClick,
14746
14784
  staticMapColor,
14747
14785
  mapStyle
@@ -14781,13 +14819,18 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14781
14819
  showHoveredLinksOnly,
14782
14820
  hideLinks,
14783
14821
  mapStyle,
14784
- draggingMode,
14822
+ draggingMode: draggingMode2,
14785
14823
  isolateNonSelectedLinksOnNodeClick,
14786
14824
  showLinkCount,
14787
14825
  maxZoomOutForLinkCount,
14788
14826
  nodeSizeScaler
14789
14827
  }));
14790
- }, [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]);
14828
+ }, [linkAnimation, nodeSizeScaler, maxZoomOutForLinkCount, showLinkCount, mapApi == null ? void 0 : mapApi.current, isolateNonSelectedLinksOnNodeClick, draggingMode2, showHoveredLinksOnly, mapStyle == null ? void 0 : mapStyle.name, hideLinks, defaultLinkColorHex, linkHighlightedColorHex, defaultAnimationLinkColor, enableNativeContextMenu, enableLngLatBox, hideLinksOnDrag, maxZoomOutForLinkCount, nodeSizeScaler]);
14829
+ const sourcePortsFontSizePercentage = useMemo(() => {
14830
+ const scale = currentZoomLevel / initialZoomLevel;
14831
+ const fontSize = baseFont * scale - 0.3;
14832
+ return fontSize;
14833
+ }, [currentZoomLevel]);
14791
14834
  function _onLinkSelected(obj) {
14792
14835
  setSelectedConn(obj);
14793
14836
  onConnClick(obj);
@@ -14798,17 +14841,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14798
14841
  ...node2,
14799
14842
  connections: []
14800
14843
  }));
14801
- const countHowManyDuplicateConnections = (conn) => {
14802
- const s = _connections.filter((item) => {
14803
- if (((item == null ? void 0 : item.sourceId) == (conn == null ? void 0 : conn.sourceId) && (item == null ? void 0 : item.destinationId) == (conn == null ? void 0 : conn.destinationId) || (item == null ? void 0 : item.destinationId) == (conn == null ? void 0 : conn.sourceId) && (item == null ? void 0 : item.sourceId) == (conn == null ? void 0 : conn.destinationId)) && (item == null ? void 0 : item.layer) == 0) {
14804
- return item;
14805
- }
14806
- return null;
14807
- });
14808
- return s == null ? void 0 : s.filter((item) => item != null);
14809
- };
14810
14844
  const processedConnections = updateOnly ? _connections : _connections == null ? void 0 : _connections.map((conn) => {
14811
- const linksGroup = countHowManyDuplicateConnections(conn);
14812
14845
  return {
14813
14846
  ...conn,
14814
14847
  u_id: conn.u_id || useRandomId(),
@@ -14824,8 +14857,10 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14824
14857
  data: conn,
14825
14858
  connCountBoxId: useRandomId(),
14826
14859
  timestamp: [0, 5, 10, 15],
14827
- linkCount: linksGroup == null ? void 0 : linksGroup.length,
14828
- linksGroup
14860
+ // linkCount : linksGroup?.length,
14861
+ // linksGroup : linksGroup ,
14862
+ sourcesId: (conn.sourceId + conn.destinationId).toString().split("").sort().join(""),
14863
+ fullSourcesId: (conn.sourceId + (conn == null ? void 0 : conn.sourcePort) + conn.destinationId + (conn == null ? void 0 : conn.destinationPort)).toString().split("").sort().join("")
14829
14864
  };
14830
14865
  });
14831
14866
  processedNodes.forEach((node2, nodeIndex) => {
@@ -14844,6 +14879,12 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14844
14879
  }
14845
14880
  });
14846
14881
  });
14882
+ processedConnections == null ? void 0 : processedConnections.map((con) => {
14883
+ const sourcesId = con == null ? void 0 : con.sourcesId;
14884
+ const s = processedConnections == null ? void 0 : processedConnections.filter((item) => (item == null ? void 0 : item.sourcesId) == sourcesId);
14885
+ con.linkCount = s == null ? void 0 : s.length;
14886
+ con.linksGroup = s;
14887
+ });
14847
14888
  if (debug) {
14848
14889
  console.log("Processed Nodes", processedNodes);
14849
14890
  console.log("Processed Connections", processedConnections);
@@ -14933,6 +14974,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14933
14974
  }));
14934
14975
  }
14935
14976
  useImperativeHandle(ref, () => ({
14977
+ id: mapId,
14936
14978
  getCanvas: () => {
14937
14979
  var _a, _b;
14938
14980
  return (_b = (_a = mapApi.current) == null ? void 0 : _a.getCanvas) == null ? void 0 : _b.call(_a);
@@ -14948,6 +14990,22 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14948
14990
  saveOptions,
14949
14991
  loadOptions,
14950
14992
  FlyToNodeApi,
14993
+ setCurrentZoomLevel,
14994
+ setOptions,
14995
+ setMapDragging,
14996
+ hasInternet,
14997
+ setMapZooming,
14998
+ setMapRotating,
14999
+ setStartLinkCounterRerender,
15000
+ setInViewNodes,
15001
+ setInViewConnections,
15002
+ setHoveredNode,
15003
+ setHoveredConnection,
15004
+ setContextMenuEvent,
15005
+ setNodeContextMenuEvent,
15006
+ setSelectedConn,
15007
+ setSelectedNode,
15008
+ setOnScreenLinksGroup,
14951
15009
  ...mapApi.current
14952
15010
  }));
14953
15011
  const _menuItems = useMemo(() => {
@@ -14983,8 +15041,9 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14983
15041
  setStartLinkCounterRerender(true);
14984
15042
  const bounds = (_a = mapApi.current) == null ? void 0 : _a.getBounds();
14985
15043
  console.log("Bounds : ", bounds);
15044
+ const MARGIN = boundMargin;
14986
15045
  const filtered = _nodes.filter(
14987
- (n) => n.location.lng >= bounds.getWest() && n.location.lng <= bounds.getEast() && n.location.lat >= bounds.getSouth() && n.location.lat <= bounds.getNorth()
15046
+ (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
14988
15047
  );
14989
15048
  console.log("In View Nodes : ", filtered);
14990
15049
  const cs = [...new Set(filtered.flatMap((node2) => node2 == null ? void 0 : node2.connections))];
@@ -15012,175 +15071,212 @@ const NetworkMapComponent = forwardRef((props, ref) => {
15012
15071
  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 });
15013
15072
  }
15014
15073
  };
15015
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn(
15016
- "w-full h-full relative rounded overflow-hidden",
15017
- className
15018
- ), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
15074
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
15019
15075
  "div",
15020
15076
  {
15021
- onContextMenu: (e) => {
15022
- if (!(selectedConn == null ? void 0 : selectedConn.x)) {
15023
- return;
15024
- }
15025
- setContextMenuEvent(e);
15026
- onLinkContextMenu({
15027
- data: selectedConn,
15028
- event: e,
15029
- mapApi,
15030
- type: "connection"
15031
- });
15032
- },
15033
- className: "network-map-canvas w-full h-full",
15034
- ref: networkMapRef,
15035
- children: [
15036
- enableNativeContextMenu && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
15037
- /* @__PURE__ */ jsxRuntimeExports.jsx(
15038
- ContextMenu,
15039
- {
15040
- event: contextMenuEvent,
15041
- items: {
15042
- title: _menuTitle,
15043
- items: _menuItems
15044
- }
15045
- }
15046
- ),
15047
- /* @__PURE__ */ jsxRuntimeExports.jsx(
15048
- ContextMenu,
15049
- {
15050
- event: NodeContextMenuEvent,
15051
- items: {
15052
- title: _nodeMenuTitle,
15053
- items: _nodeMenuItems
15054
- }
15077
+ id: "#" + mapId,
15078
+ className: cn(
15079
+ "w-full h-full relative rounded overflow-hidden abdellatifuimap",
15080
+ className
15081
+ ),
15082
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
15083
+ "div",
15084
+ {
15085
+ onContextMenu: (e) => {
15086
+ if (!(selectedConn == null ? void 0 : selectedConn.x)) {
15087
+ return;
15055
15088
  }
15056
- )
15057
- ] }),
15058
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
15059
- Map$1,
15060
- {
15061
- ref: mapApi,
15062
- onMoveStart: () => setStartLinkCounterRerender(false),
15063
- style: {
15064
- width: "100%",
15065
- height: "100%",
15066
- position: "relative"
15067
- },
15068
- initialViewState: {
15069
- longitude: 31.233334,
15070
- latitude: 30.033333,
15071
- zoom: 9,
15072
- bearing: 0,
15073
- minZoom: 3,
15074
- maxZoom: 10
15075
- },
15076
- mapStyle: MapStyleUrl,
15077
- onZoom: (e) => {
15078
- var _a;
15079
- setCurrentZoomLevel((_a = e == null ? void 0 : e.target) == null ? void 0 : _a.getZoom());
15080
- setMapZooming((prev2) => !prev2);
15081
- },
15082
- onRotate: (e) => {
15083
- var _a;
15084
- setMapRotating((_a = e == null ? void 0 : e.viewState) == null ? void 0 : _a.bearing);
15085
- },
15086
- onDragStart: () => setMapDragging(true),
15087
- onDragEnd: () => setMapDragging(false),
15088
- onMoveEnd: handleMoveEnd,
15089
- ...mapProps,
15090
- children: [
15089
+ setContextMenuEvent(e);
15090
+ onLinkContextMenu({
15091
+ data: selectedConn,
15092
+ event: e,
15093
+ mapApi,
15094
+ type: "connection"
15095
+ });
15096
+ },
15097
+ className: "network-map-canvas w-full h-full",
15098
+ ref: networkMapRef,
15099
+ children: [
15100
+ enableNativeContextMenu && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
15091
15101
  /* @__PURE__ */ jsxRuntimeExports.jsx(
15092
- DeckGLOverlay,
15102
+ ContextMenu,
15093
15103
  {
15094
- layers: [...paths],
15095
- onHover: handleHover,
15096
- onClick: (e) => {
15097
- if (!(e == null ? void 0 : e.layer)) {
15098
- setSelectedConn((prev2) => {
15099
- var _a, _b;
15100
- (_b = (_a = prev2 == null ? void 0 : prev2.object) == null ? void 0 : _a.nodes) == null ? void 0 : _b.map((item) => {
15101
- var _a2, _b2;
15102
- (_b2 = (_a2 = item == null ? void 0 : item.ref) == null ? void 0 : _a2.current) == null ? void 0 : _b2.changeMarkerOutline(false);
15103
- });
15104
- return {};
15105
- });
15106
- setOnScreenLinksGroup({ connections: [], nodes: [], countBoxes: [] });
15107
- }
15108
- },
15109
- style: { zIndex: 0 }
15104
+ event: contextMenuEvent,
15105
+ items: {
15106
+ title: _menuTitle,
15107
+ items: _menuItems
15108
+ }
15110
15109
  }
15111
15110
  ),
15112
- inViewNodes == null ? void 0 : inViewNodes.map((item) => {
15113
- var _a, _b;
15114
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
15115
- PinItem$1,
15116
- {
15117
- name: item == null ? void 0 : item.name,
15118
- item,
15119
- nodeSizeScaler,
15120
- longitude: (_a = item == null ? void 0 : item.location) == null ? void 0 : _a.lng,
15121
- options: options2,
15122
- CreateMapObjectsScheme,
15123
- latitude: (_b = item == null ? void 0 : item.location) == null ? void 0 : _b.lat,
15124
- nodeIconMapper,
15125
- hoveredConnection,
15126
- onScreenLinksGroup,
15127
- selectedNode,
15128
- onNodeSelected: _onNodeSelected,
15129
- onNodeMouseOver: _onNodeMouseOver,
15130
- mapApi,
15131
- nodes: _nodes,
15132
- connections: _conns,
15133
- setNodeContextMenuEvent
15134
- },
15135
- "_node_" + (item == null ? void 0 : item.elementId)
15136
- );
15137
- }),
15138
- getOverLinkElement && /* @__PURE__ */ jsxRuntimeExports.jsx(
15139
- LinkOverContainer,
15111
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
15112
+ ContextMenu,
15140
15113
  {
15141
- conn: hoveredConnection,
15142
- coordinates: currentCoordinates,
15143
- mapApi,
15144
- getOverLinkElement,
15145
- getOverLinkElementDelay
15114
+ event: NodeContextMenuEvent,
15115
+ items: {
15116
+ title: _nodeMenuTitle,
15117
+ items: _nodeMenuItems
15118
+ }
15146
15119
  }
15147
- ),
15148
- showLinkCount && !mapDragging && (inViewConnections == null ? void 0 : inViewConnections.map((con, index) => {
15149
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
15150
- LinkCountCircule$1,
15151
- {
15152
- data: con,
15153
- mapApi,
15154
- mapDragging,
15155
- getCenterBox,
15156
- hoveredConnection
15157
- },
15158
- "_lnk_count_circule_" + (con == null ? void 0 : con.u_id)
15159
- );
15160
- })),
15161
- showEndpoints && (inViewConnections == null ? void 0 : inViewConnections.map((con, index) => {
15162
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
15163
- SourcesPorts$1,
15164
- {
15165
- data: con,
15166
- mapApi,
15167
- currentZoomLevel,
15168
- hoveredConnection,
15169
- mapDragging,
15170
- getEndpointText,
15171
- mapRotating
15172
- },
15173
- "_source_port_" + (con == null ? void 0 : con.u_id)
15174
- );
15175
- })),
15176
- /* @__PURE__ */ jsxRuntimeExports.jsx(NavigationControl, {}),
15177
- enableLngLatBox && /* @__PURE__ */ jsxRuntimeExports.jsx(LngLatBox, { coordinates: currentCoordinates })
15178
- ]
15179
- }
15180
- )
15181
- ]
15120
+ )
15121
+ ] }),
15122
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
15123
+ Map$1,
15124
+ {
15125
+ ref: mapApi,
15126
+ onMoveStart: () => setStartLinkCounterRerender(false),
15127
+ style: {
15128
+ width: "100%",
15129
+ height: "100%",
15130
+ position: "relative"
15131
+ },
15132
+ initialViewState: {
15133
+ longitude: 31.233334,
15134
+ latitude: 30.033333,
15135
+ zoom: initialZoomLevel,
15136
+ bearing: 0,
15137
+ minZoom: 3,
15138
+ maxZoom: 10
15139
+ },
15140
+ mapStyle: MapStyleUrl,
15141
+ onZoom: (e) => {
15142
+ var _a;
15143
+ setCurrentZoomLevel((_a = e == null ? void 0 : e.target) == null ? void 0 : _a.getZoom());
15144
+ setMapZooming((prev2) => !prev2);
15145
+ },
15146
+ onRotate: (e) => {
15147
+ var _a;
15148
+ setMapRotating((_a = e == null ? void 0 : e.viewState) == null ? void 0 : _a.bearing);
15149
+ },
15150
+ onDragStart: () => setMapDragging(true),
15151
+ onDragEnd: () => setMapDragging(false),
15152
+ onMoveEnd: handleMoveEnd,
15153
+ onSourceData: (e) => {
15154
+ if (onConnection) {
15155
+ onConnection({ mapApi: mapApi.current, event: e, hasInternet: true });
15156
+ }
15157
+ },
15158
+ onError: (e) => {
15159
+ var _a;
15160
+ const x = ((_a = e.error) == null ? void 0 : _a.status) == 0;
15161
+ if (onConnection) {
15162
+ onConnection({ mapApi: mapApi.current, event: e, hasInternet: x == 0 ? false : true });
15163
+ }
15164
+ },
15165
+ ...mapProps,
15166
+ children: [
15167
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
15168
+ DeckGLOverlay,
15169
+ {
15170
+ layers: [...paths],
15171
+ onHover: handleHover,
15172
+ onClick: (e) => {
15173
+ if (!(e == null ? void 0 : e.layer)) {
15174
+ setSelectedConn((prev2) => {
15175
+ var _a, _b;
15176
+ (_b = (_a = prev2 == null ? void 0 : prev2.object) == null ? void 0 : _a.nodes) == null ? void 0 : _b.map((item) => {
15177
+ var _a2, _b2;
15178
+ (_b2 = (_a2 = item == null ? void 0 : item.ref) == null ? void 0 : _a2.current) == null ? void 0 : _b2.changeMarkerOutline(false);
15179
+ });
15180
+ return {};
15181
+ });
15182
+ setOnScreenLinksGroup({ connections: [], nodes: [], countBoxes: [] });
15183
+ }
15184
+ },
15185
+ style: { zIndex: 0 }
15186
+ }
15187
+ ),
15188
+ inViewNodes == null ? void 0 : inViewNodes.map((item) => {
15189
+ var _a, _b;
15190
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
15191
+ PinItem$1,
15192
+ {
15193
+ name: item == null ? void 0 : item.name,
15194
+ item,
15195
+ nodeSizeScaler,
15196
+ longitude: (_a = item == null ? void 0 : item.location) == null ? void 0 : _a.lng,
15197
+ options: options2,
15198
+ CreateMapObjectsScheme,
15199
+ latitude: (_b = item == null ? void 0 : item.location) == null ? void 0 : _b.lat,
15200
+ nodeIconMapper,
15201
+ hoveredConnection,
15202
+ onScreenLinksGroup,
15203
+ selectedNode,
15204
+ onNodeSelected: _onNodeSelected,
15205
+ onNodeMouseOver: _onNodeMouseOver,
15206
+ mapApi,
15207
+ nodes: _nodes,
15208
+ connections: _conns,
15209
+ setNodeContextMenuEvent
15210
+ },
15211
+ "_node_" + (item == null ? void 0 : item.elementId)
15212
+ );
15213
+ }),
15214
+ getOverLinkElement && /* @__PURE__ */ jsxRuntimeExports.jsx(
15215
+ LinkOverContainer,
15216
+ {
15217
+ conn: hoveredConnection,
15218
+ coordinates: currentCoordinates,
15219
+ mapApi,
15220
+ getOverLinkElement,
15221
+ getOverLinkElementDelay,
15222
+ draggingMode: draggingMode2
15223
+ }
15224
+ ),
15225
+ showLinkCount && !mapDragging && (inViewConnections == null ? void 0 : inViewConnections.map((con, index) => {
15226
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
15227
+ LinkCountCircule$1,
15228
+ {
15229
+ data: con,
15230
+ mapApi,
15231
+ mapDragging,
15232
+ getCenterBox,
15233
+ hoveredConnection,
15234
+ draggingMode: draggingMode2
15235
+ },
15236
+ "_lnk_count_circule_" + (con == null ? void 0 : con.u_id)
15237
+ );
15238
+ })),
15239
+ showEndpoints && (inViewConnections == null ? void 0 : inViewConnections.map((con, index) => {
15240
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
15241
+ SourcesPorts$1,
15242
+ {
15243
+ fontSize: sourcePortsFontSizePercentage,
15244
+ data: con,
15245
+ mapApi,
15246
+ currentZoomLevel,
15247
+ hoveredConnection,
15248
+ mapDragging,
15249
+ getEndpointText,
15250
+ mapRotating,
15251
+ draggingMode: draggingMode2
15252
+ },
15253
+ "_source_port_" + (con == null ? void 0 : con.u_id)
15254
+ );
15255
+ })),
15256
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
15257
+ NavigationControl,
15258
+ {}
15259
+ ),
15260
+ MapLogo && /* @__PURE__ */ jsxRuntimeExports.jsx(
15261
+ "div",
15262
+ {
15263
+ className: cn(
15264
+ "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",
15265
+ MapLogoClassName
15266
+ ),
15267
+ style: MapLogoStyle || {},
15268
+ children: MapLogo
15269
+ }
15270
+ ),
15271
+ enableLngLatBox && /* @__PURE__ */ jsxRuntimeExports.jsx(LngLatBox, { coordinates: currentCoordinates })
15272
+ ]
15273
+ }
15274
+ )
15275
+ ]
15276
+ }
15277
+ )
15182
15278
  }
15183
- ) });
15279
+ );
15184
15280
  });
15185
15281
  const NetworkMap = memo(NetworkMapComponent);
15186
15282
  const Accordion = AccordionPrimitive.Root;