@abdellatifui/react 3.1.90 → 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
@@ -12722,13 +12722,13 @@ const LazyContainer = (props) => {
12722
12722
  ) });
12723
12723
  };
12724
12724
  const hex2rgb = (hex) => {
12725
- let hexValue = hex.startsWith("#") ? hex.slice(1) : hex;
12726
- 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) {
12727
12727
  hexValue = hexValue.split("").map((char2) => char2 + char2).join("");
12728
12728
  }
12729
- const r2 = parseInt(hexValue.substring(0, 2), 16);
12730
- const g = parseInt(hexValue.substring(2, 4), 16);
12731
- 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);
12732
12732
  return [r2, g, b];
12733
12733
  };
12734
12734
  const createDefaultNodeTempate = (params) => {
@@ -14144,11 +14144,19 @@ const useCreatePath = ({ connections = [], mapApi, options: options2, selectedCo
14144
14144
  const [currentTime, setTime] = useState(0);
14145
14145
  const loopLength = 20;
14146
14146
  const animationSpeed = 5;
14147
- const layer0conns = useMemo(() => {
14148
- return connections == null ? void 0 : connections.filter((item) => (item == null ? void 0 : item.layer) == 0);
14149
- }, [
14150
- connections
14151
- ]);
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
+ );
14152
14160
  const layer1conns = useMemo(() => {
14153
14161
  console.log("layer1conns", connections);
14154
14162
  const a = connections == null ? void 0 : connections.filter((item) => (item == null ? void 0 : item.layer) == 1);
@@ -14282,7 +14290,8 @@ const CustomMarker = (props) => {
14282
14290
  latitude,
14283
14291
  children,
14284
14292
  offset = [0, 0],
14285
- markerProps = {}
14293
+ markerProps = {},
14294
+ style: style2 = {}
14286
14295
  } = props;
14287
14296
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14288
14297
  Marker,
@@ -14291,7 +14300,8 @@ const CustomMarker = (props) => {
14291
14300
  latitude,
14292
14301
  anchor: "center",
14293
14302
  style: {
14294
- zIndex: 30
14303
+ zIndex: 30,
14304
+ ...style2
14295
14305
  },
14296
14306
  offset,
14297
14307
  children
@@ -14334,7 +14344,8 @@ const LinkCountCircule = (props) => {
14334
14344
  mapApi,
14335
14345
  mapZooming,
14336
14346
  getCenterBox,
14337
- hoveredConnection
14347
+ hoveredConnection,
14348
+ draggingMode: draggingMode2
14338
14349
  } = props;
14339
14350
  const [midpoint, setMidpoint] = useState(null);
14340
14351
  const [isVisible, setIsVisible] = useState(true);
@@ -14361,6 +14372,9 @@ const LinkCountCircule = (props) => {
14361
14372
  {
14362
14373
  longitude: midpoint == null ? void 0 : midpoint.lng,
14363
14374
  latitude: midpoint == null ? void 0 : midpoint.lat,
14375
+ style: {
14376
+ opacity: draggingMode2 ? 0 : 1
14377
+ },
14364
14378
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
14365
14379
  ConnectionBadge,
14366
14380
  {
@@ -14408,7 +14422,10 @@ const LinkOverContainer = (props) => {
14408
14422
  onMouseLeave: () => {
14409
14423
  setElement(null);
14410
14424
  },
14411
- className: "absolute z-30 pointer-events-auto",
14425
+ className: cn(
14426
+ "absolute z-30 pointer-events-auto",
14427
+ draggingMode && "hidden"
14428
+ ),
14412
14429
  style: {
14413
14430
  transform: "translate(-50%, -50%)",
14414
14431
  left: position2[0],
@@ -14419,6 +14436,7 @@ const LinkOverContainer = (props) => {
14419
14436
  );
14420
14437
  };
14421
14438
  const PortText = (props) => {
14439
+ var _a;
14422
14440
  const ref = useRef(null);
14423
14441
  const {
14424
14442
  text,
@@ -14426,14 +14444,15 @@ const PortText = (props) => {
14426
14444
  isVisible,
14427
14445
  data,
14428
14446
  isFocused,
14429
- fontSize
14447
+ fontSize,
14448
+ isSource
14430
14449
  } = props;
14431
14450
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14432
14451
  "div",
14433
14452
  {
14434
14453
  ref,
14435
14454
  className: cn(
14436
- "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",
14437
14456
  isFocused && "!scale-[1.5]"
14438
14457
  ),
14439
14458
  style: {
@@ -14446,7 +14465,11 @@ const PortText = (props) => {
14446
14465
  opacity: isVisible ? 1 : 0,
14447
14466
  fontSize: fontSize + "rem"
14448
14467
  },
14449
- 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
+ }) })
14450
14473
  }
14451
14474
  );
14452
14475
  };
@@ -14460,7 +14483,8 @@ const SourcesPorts = (props) => {
14460
14483
  mapDragging,
14461
14484
  getEndpointText,
14462
14485
  mapRotating,
14463
- fontSize
14486
+ fontSize,
14487
+ draggingMode: draggingMode2
14464
14488
  } = props;
14465
14489
  const [midpoint, setMidpoint] = useState(null);
14466
14490
  const [isVisible, setIsVisible] = useState(true);
@@ -14473,6 +14497,10 @@ const SourcesPorts = (props) => {
14473
14497
  setIsVisible(false);
14474
14498
  return;
14475
14499
  } else {
14500
+ if (mapDragging) {
14501
+ setIsVisible(false);
14502
+ return;
14503
+ }
14476
14504
  setIsVisible(true);
14477
14505
  }
14478
14506
  if (currentZoomLevel < 5) {
@@ -14483,6 +14511,12 @@ const SourcesPorts = (props) => {
14483
14511
  }
14484
14512
  }, [currentZoomLevel, mapDragging]);
14485
14513
  useEffect(() => {
14514
+ if (draggingMode2) {
14515
+ setIsVisible(false);
14516
+ return;
14517
+ } else {
14518
+ setIsVisible(true);
14519
+ }
14486
14520
  if (!hoveredConnection) {
14487
14521
  setIsVisible(true);
14488
14522
  setIsFocused(false);
@@ -14495,7 +14529,7 @@ const SourcesPorts = (props) => {
14495
14529
  setIsVisible(false);
14496
14530
  setIsFocused(false);
14497
14531
  }
14498
- }, [hoveredConnection == null ? void 0 : hoveredConnection.u_id, data == null ? void 0 : data.u_id, currentZoomLevel]);
14532
+ }, [hoveredConnection == null ? void 0 : hoveredConnection.u_id, data == null ? void 0 : data.u_id, currentZoomLevel, draggingMode2]);
14499
14533
  const sourceLabel = useMemo(() => {
14500
14534
  var _a2, _b2, _c2, _d2, _e, _f;
14501
14535
  try {
@@ -14532,7 +14566,7 @@ const SourcesPorts = (props) => {
14532
14566
  } catch (e) {
14533
14567
  return null;
14534
14568
  }
14535
- }, [mapApi == null ? void 0 : mapApi.current, mapRotating, currentZoomLevel]);
14569
+ }, [mapApi == null ? void 0 : mapApi.current, mapRotating, currentZoomLevel, draggingMode2]);
14536
14570
  const destinationLabel = useMemo(() => {
14537
14571
  var _a2, _b2, _c2, _d2, _e, _f;
14538
14572
  try {
@@ -14569,7 +14603,7 @@ const SourcesPorts = (props) => {
14569
14603
  } catch (e) {
14570
14604
  return null;
14571
14605
  }
14572
- }, [mapApi == null ? void 0 : mapApi.current, mapRotating, currentZoomLevel]);
14606
+ }, [mapApi == null ? void 0 : mapApi.current, mapRotating, currentZoomLevel, draggingMode2]);
14573
14607
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
14574
14608
  sourceLabel && /* @__PURE__ */ jsxRuntimeExports.jsx(
14575
14609
  CustomMarker$1,
@@ -14583,7 +14617,9 @@ const SourcesPorts = (props) => {
14583
14617
  isVisible,
14584
14618
  text: data == null ? void 0 : data.sourcePort,
14585
14619
  isFocused,
14586
- fontSize
14620
+ fontSize,
14621
+ isSource: true,
14622
+ draggingMode: draggingMode2
14587
14623
  }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
14588
14624
  PortText,
14589
14625
  {
@@ -14592,7 +14628,8 @@ const SourcesPorts = (props) => {
14592
14628
  isVisible,
14593
14629
  data,
14594
14630
  isFocused,
14595
- fontSize
14631
+ fontSize,
14632
+ isSource: true
14596
14633
  }
14597
14634
  )
14598
14635
  }
@@ -14609,7 +14646,9 @@ const SourcesPorts = (props) => {
14609
14646
  isVisible,
14610
14647
  text: data == null ? void 0 : data.destinationPort,
14611
14648
  isFocused,
14612
- fontSize
14649
+ fontSize,
14650
+ isSource: false,
14651
+ draggingMode: draggingMode2
14613
14652
  }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
14614
14653
  PortText,
14615
14654
  {
@@ -14619,7 +14658,8 @@ const SourcesPorts = (props) => {
14619
14658
  data,
14620
14659
  getEndpointText,
14621
14660
  isFocused,
14622
- fontSize
14661
+ fontSize,
14662
+ isSource: false
14623
14663
  }
14624
14664
  )
14625
14665
  }
@@ -14684,7 +14724,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14684
14724
  hideLinks = false,
14685
14725
  getCenterBox,
14686
14726
  enableLngLatBox = true,
14687
- draggingMode = false,
14727
+ draggingMode: draggingMode2 = false,
14688
14728
  mapProps = {},
14689
14729
  menuItems = [],
14690
14730
  nodeMenuItems = [],
@@ -14739,7 +14779,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14739
14779
  hideLinksOnDrag,
14740
14780
  hideLinks,
14741
14781
  showHoveredLinksOnly,
14742
- draggingMode,
14782
+ draggingMode: draggingMode2,
14743
14783
  isolateNonSelectedLinksOnNodeClick,
14744
14784
  staticMapColor,
14745
14785
  mapStyle
@@ -14779,13 +14819,13 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14779
14819
  showHoveredLinksOnly,
14780
14820
  hideLinks,
14781
14821
  mapStyle,
14782
- draggingMode,
14822
+ draggingMode: draggingMode2,
14783
14823
  isolateNonSelectedLinksOnNodeClick,
14784
14824
  showLinkCount,
14785
14825
  maxZoomOutForLinkCount,
14786
14826
  nodeSizeScaler
14787
14827
  }));
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]);
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]);
14789
14829
  const sourcePortsFontSizePercentage = useMemo(() => {
14790
14830
  const scale = currentZoomLevel / initialZoomLevel;
14791
14831
  const fontSize = baseFont * scale - 0.3;
@@ -14801,17 +14841,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14801
14841
  ...node2,
14802
14842
  connections: []
14803
14843
  }));
14804
- const countHowManyDuplicateConnections = (conn) => {
14805
- const s = _connections.filter((item) => {
14806
- 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) {
14807
- return item;
14808
- }
14809
- return null;
14810
- });
14811
- return s == null ? void 0 : s.filter((item) => item != null);
14812
- };
14813
14844
  const processedConnections = updateOnly ? _connections : _connections == null ? void 0 : _connections.map((conn) => {
14814
- const linksGroup = countHowManyDuplicateConnections(conn);
14815
14845
  return {
14816
14846
  ...conn,
14817
14847
  u_id: conn.u_id || useRandomId(),
@@ -14827,8 +14857,10 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14827
14857
  data: conn,
14828
14858
  connCountBoxId: useRandomId(),
14829
14859
  timestamp: [0, 5, 10, 15],
14830
- linkCount: linksGroup == null ? void 0 : linksGroup.length,
14831
- 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("")
14832
14864
  };
14833
14865
  });
14834
14866
  processedNodes.forEach((node2, nodeIndex) => {
@@ -14847,6 +14879,12 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14847
14879
  }
14848
14880
  });
14849
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
+ });
14850
14888
  if (debug) {
14851
14889
  console.log("Processed Nodes", processedNodes);
14852
14890
  console.log("Processed Connections", processedConnections);
@@ -15180,7 +15218,8 @@ const NetworkMapComponent = forwardRef((props, ref) => {
15180
15218
  coordinates: currentCoordinates,
15181
15219
  mapApi,
15182
15220
  getOverLinkElement,
15183
- getOverLinkElementDelay
15221
+ getOverLinkElementDelay,
15222
+ draggingMode: draggingMode2
15184
15223
  }
15185
15224
  ),
15186
15225
  showLinkCount && !mapDragging && (inViewConnections == null ? void 0 : inViewConnections.map((con, index) => {
@@ -15191,7 +15230,8 @@ const NetworkMapComponent = forwardRef((props, ref) => {
15191
15230
  mapApi,
15192
15231
  mapDragging,
15193
15232
  getCenterBox,
15194
- hoveredConnection
15233
+ hoveredConnection,
15234
+ draggingMode: draggingMode2
15195
15235
  },
15196
15236
  "_lnk_count_circule_" + (con == null ? void 0 : con.u_id)
15197
15237
  );
@@ -15207,7 +15247,8 @@ const NetworkMapComponent = forwardRef((props, ref) => {
15207
15247
  hoveredConnection,
15208
15248
  mapDragging,
15209
15249
  getEndpointText,
15210
- mapRotating
15250
+ mapRotating,
15251
+ draggingMode: draggingMode2
15211
15252
  },
15212
15253
  "_source_port_" + (con == null ? void 0 : con.u_id)
15213
15254
  );