@rfkit/charts 1.0.97 → 1.0.99

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.
@@ -11,6 +11,8 @@ interface SegmentContainerProps {
11
11
  style: React.CSSProperties;
12
12
  stationPositions: StationPosition[];
13
13
  currentFrequency: number;
14
+ segmentIndex: number;
15
+ isCurrentSegment: boolean;
14
16
  }
15
17
  declare const SegmentContainer: React.FC<SegmentContainerProps>;
16
18
  export default SegmentContainer;
package/index.js CHANGED
@@ -2432,7 +2432,7 @@ var __webpack_modules__ = {
2432
2432
  .segmentContainer-gDwnhB {
2433
2433
  box-sizing: border-box;
2434
2434
  height: 100%;
2435
- position: relative;
2435
+ position: absolute;
2436
2436
  }
2437
2437
 
2438
2438
  .segmentContainer-gDwnhB .item-ybDTIt {
@@ -11426,11 +11426,11 @@ StationAllocation_styles_module_options.domAPI = styleDomAPI_default();
11426
11426
  StationAllocation_styles_module_options.insertStyleElement = insertStyleElement_default();
11427
11427
  injectStylesIntoStyleTag_default()(StationAllocation_styles_module.Z, StationAllocation_styles_module_options);
11428
11428
  const components_StationAllocation_styles_module = StationAllocation_styles_module.Z && StationAllocation_styles_module.Z.locals ? StationAllocation_styles_module.Z.locals : void 0;
11429
- const SegmentContainer_SegmentContainer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.memo)(({ style, stationPositions, currentFrequency })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
11429
+ const SegmentContainer_SegmentContainer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.memo)(({ style, stationPositions, currentFrequency, segmentIndex, isCurrentSegment })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
11430
11430
  className: components_StationAllocation_styles_module.segmentContainer,
11431
11431
  style: style,
11432
11432
  children: stationPositions.map(({ station, position }, index)=>{
11433
- const isActive = currentFrequency >= station.startFrequency && currentFrequency <= station.stopFrequency;
11433
+ const isActive = isCurrentSegment && currentFrequency >= station.startFrequency && currentFrequency <= station.stopFrequency;
11434
11434
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
11435
11435
  className: `${components_StationAllocation_styles_module.item} ${isActive ? components_StationAllocation_styles_module.active : ''}`,
11436
11436
  style: {
@@ -11438,7 +11438,7 @@ const SegmentContainer_SegmentContainer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_M
11438
11438
  width: position.width
11439
11439
  },
11440
11440
  title: `${station.signalName} - ${station.frequency}${station.orgName ? ` (${station.orgName})` : ''}`
11441
- }, `station-${station.signalName}-${station.frequency}-${index}`);
11441
+ }, `segment-${segmentIndex}-station-${station.signalName}-${station.frequency}-${index}`);
11442
11442
  })
11443
11443
  }));
11444
11444
  const StationAllocation_SegmentContainer = SegmentContainer_SegmentContainer;
@@ -11448,6 +11448,21 @@ const StationAllocation_StationAllocation = ({ show = true, display = true })=>{
11448
11448
  left,
11449
11449
  frequencyFormat
11450
11450
  ]);
11451
+ const currentSegmentIndex = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
11452
+ if (!segments?.length) return -1;
11453
+ let totalPoints = 0;
11454
+ const totalSegmentPoints = segments.reduce((sum, s)=>sum + s.point, 0);
11455
+ const mousePositionRatio = left / 100;
11456
+ for(let i = 0; i < segments.length; i++){
11457
+ const segmentRatio = segments[i].point / totalSegmentPoints;
11458
+ if (mousePositionRatio >= totalPoints && mousePositionRatio <= totalPoints + segmentRatio) return i;
11459
+ totalPoints += segmentRatio;
11460
+ }
11461
+ return -1;
11462
+ }, [
11463
+ segments,
11464
+ left
11465
+ ]);
11451
11466
  const segmentData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
11452
11467
  if (!segments?.length || !stationInfo.length) return [];
11453
11468
  return segments.map((segment, segmentIndex)=>{
@@ -11513,7 +11528,7 @@ const StationAllocation_StationAllocation = ({ show = true, display = true })=>{
11513
11528
  segments,
11514
11529
  stationInfo
11515
11530
  ]);
11516
- if (!show || !display) return null;
11531
+ if (!show || !display || 0 === left) return null;
11517
11532
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
11518
11533
  className: components_StationAllocation_styles_module.StationAllocation,
11519
11534
  children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
@@ -11522,7 +11537,9 @@ const StationAllocation_StationAllocation = ({ show = true, display = true })=>{
11522
11537
  children: segmentData.map(({ segmentIndex, stationPositions, style })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(StationAllocation_SegmentContainer, {
11523
11538
  style: style,
11524
11539
  stationPositions: stationPositions,
11525
- currentFrequency: currentFrequency
11540
+ currentFrequency: currentFrequency,
11541
+ segmentIndex: segmentIndex,
11542
+ isCurrentSegment: currentSegmentIndex === segmentIndex
11526
11543
  }, `segment-${segmentIndex}`))
11527
11544
  })
11528
11545
  });
package/package.json CHANGED
@@ -5,6 +5,6 @@
5
5
  "types": "index.d.ts",
6
6
  "author": "Hxgh",
7
7
  "license": "MIT",
8
- "version": "1.0.97",
8
+ "version": "1.0.99",
9
9
  "private": false
10
10
  }