@rfkit/charts 1.2.9 → 1.2.11

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.
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import type { FrequencyAllocationItem } from '../../../types';
3
+ interface Props {
4
+ allocationInfo?: FrequencyAllocationItem & {
5
+ startFrequency?: string | number;
6
+ stopFrequency?: string | number;
7
+ centerFrequency?: string | number;
8
+ };
9
+ variant?: 'default' | 'board';
10
+ }
11
+ declare const _default: React.NamedExoticComponent<Props>;
12
+ export default _default;
@@ -1,4 +1,8 @@
1
1
  import type React from 'react';
2
2
  import type { TooltipState } from '../types';
3
+ /**
4
+ * 频率划分 Tooltip 组件
5
+ * 包含定位逻辑,内部使用 AllocationInfo 展示内容
6
+ */
3
7
  declare const Tooltip: React.FC<TooltipState>;
4
8
  export default Tooltip;
@@ -1,3 +1,6 @@
1
1
  import type React from 'react';
2
+ import AllocationInfo from './AllocationInfo';
3
+ export { AllocationInfo };
4
+ export { useAllocationFinder } from './useAllocationFinder';
2
5
  declare const FrequencyAllocation: React.FC;
3
6
  export default FrequencyAllocation;
@@ -0,0 +1,10 @@
1
+ import type { FrequencyAllocationItem } from '../../types';
2
+ interface UseAllocationFinderProps {
3
+ frequency: string;
4
+ }
5
+ /**
6
+ * 频率划分查找 Hook
7
+ * 基于当前频率,在频率划分数据中查找匹配的项
8
+ */
9
+ export declare function useAllocationFinder({ frequency, }: UseAllocationFinderProps): FrequencyAllocationItem | undefined;
10
+ export {};
@@ -1,10 +1,18 @@
1
- import React from 'react';
2
- import type { SignalData } from '../../types/store';
1
+ import type React from 'react';
2
+ import { type UnifiedSignalItem } from './utils';
3
+ /**
4
+ * 统一的信号位置数据(兼容 StationInfo 和 SignalData)
5
+ */
3
6
  interface SignalPosition {
4
- left: number;
5
- width: number;
7
+ item: UnifiedSignalItem;
8
+ position: {
9
+ left: string;
10
+ width: string;
11
+ };
12
+ startIndex: number;
13
+ stopIndex: number;
6
14
  color: string;
7
- data: SignalData;
15
+ tooltip?: string;
8
16
  }
9
17
  interface SegmentContainerProps {
10
18
  style: React.CSSProperties;
@@ -12,6 +20,7 @@ interface SegmentContainerProps {
12
20
  currentFrequency: number;
13
21
  segmentIndex: number;
14
22
  isCurrentSegment: boolean;
23
+ currentPointIndex: number;
15
24
  }
16
- declare const _default: React.NamedExoticComponent<SegmentContainerProps>;
17
- export default _default;
25
+ declare const SegmentContainer: React.FC<SegmentContainerProps>;
26
+ export default SegmentContainer;
@@ -1,3 +1,7 @@
1
1
  import type React from 'react';
2
+ /**
3
+ * Signal 开关组件
4
+ * 控制 signal 的显示状态
5
+ */
2
6
  declare const Switch: React.FC;
3
7
  export default Switch;
@@ -1,9 +1,11 @@
1
- import React from 'react';
1
+ import type React from 'react';
2
2
  import SignalSwitch from './Switch';
3
- import useSignal from './useSignal';
4
- export { SignalSwitch, useSignal };
3
+ export { SignalSwitch };
4
+ export { useStationFinder } from './useStationFinder';
5
5
  interface Props {
6
- id: string;
6
+ left?: number;
7
+ show?: boolean;
8
+ display?: boolean;
7
9
  }
8
- declare const _default: React.NamedExoticComponent<Props>;
9
- export default _default;
10
+ declare const Signal: React.FC<Props>;
11
+ export default Signal;
@@ -0,0 +1,8 @@
1
+ import type { StationInfoType } from '../../types';
2
+ /**
3
+ * 全局台站信号数据存储
4
+ * 支持本地持久化(业务层面通用,不区分 globalID):
5
+ * - 写入时:同时存到 openData(按 globalID)和 localStorage(全局通用)
6
+ * - 读取时:优先从 openData 读取,如果为空则从 localStorage 恢复
7
+ */
8
+ export declare const STATION_DATA: (globalID: string, data?: StationInfoType[]) => StationInfoType[];
@@ -0,0 +1,12 @@
1
+ import type { SignalData, SignalDataType, StationInfoType } from '../../types';
2
+ /**
3
+ * Signal 数据管理 Hook
4
+ * - 台站信息 → 全局 openData(通过 STATION_DATA)
5
+ * - 简单信号 → store.signal.signalData
6
+ */
7
+ export declare function useSignalDataManager(): {
8
+ updateSignalData: (params: {
9
+ type: SignalDataType;
10
+ data: StationInfoType[] | SignalData[];
11
+ }) => void;
12
+ };
@@ -0,0 +1,12 @@
1
+ import type { StationInfoType } from '../../types';
2
+ interface UseStationFinderProps {
3
+ frequency: string;
4
+ }
5
+ /**
6
+ * 信号查找 Hook
7
+ * 基于鼠标位置(left)和频率,在信号数据中查找匹配的信号(台站信号 + 简单信号)
8
+ *
9
+ * 使用索引 + 容差判断,解决 step 跳跃和窄信号难以 hover 的问题
10
+ */
11
+ export declare function useStationFinder({ frequency }: UseStationFinderProps): StationInfoType | undefined;
12
+ export {};
@@ -0,0 +1,15 @@
1
+ import type { StationInfoType } from '../../types';
2
+ import type { SignalData } from '../../types/store';
3
+ import type { FrequencyRangeInput } from '../../utils';
4
+ /**
5
+ * 统一的信号数据类型(兼容 StationInfo 和 SignalData)
6
+ */
7
+ export type UnifiedSignalItem = StationInfoType | SignalData;
8
+ /**
9
+ * 判断是否为完整的台站信息
10
+ */
11
+ export declare function isStationInfo(item: UnifiedSignalItem): item is StationInfoType;
12
+ /**
13
+ * 将统一的信号数据转换为频率范围输入(处理 string | number 类型)
14
+ */
15
+ export declare function toFrequencyRangeInput(item: UnifiedSignalItem): FrequencyRangeInput;
@@ -45,7 +45,7 @@ export declare enum ModuleType {
45
45
  export declare enum PSType {
46
46
  Spectrum = "spectrum",
47
47
  AntennaFactor = "antennaFactor",
48
- StationInfo = "stationInfo",
48
+ Signal = "signal",
49
49
  Occupancy = "occupancy",
50
50
  LevelStream = "levelStream",
51
51
  Heatmap = "heatmap",
@@ -1,3 +1,4 @@
1
+ import { ChartType } from '../config';
1
2
  import type { PublishData, RecursiveFunction } from '../types';
2
3
  export declare const SET_SEGMENTS_DISPLAY: (globalID: string, func?: RecursiveFunction) => (...args: any[]) => void;
3
- export default function useSpectrumRule(): (e: PublishData) => void;
4
+ export default function useSpectrumRule(type: ChartType): (e: PublishData) => void;
package/index.d.ts CHANGED
@@ -6,3 +6,4 @@ export type { AxisXProps, AxisYRange, ChartRef, MarkerProps, MarkerType, Publish
6
6
  RecursiveObject, // 递归对象 后期会删除
7
7
  Render, Reset, SegmentsOriginal, SeriesConfig, SetAntennaFactor, SetChannels, SetMarker, SetSegments, SetSeries, SetSpectrumBandwidth, SpectrumBandwidth, SpectrumExtraData, StationInfoType } from './types';
8
8
  export { HeatmapCaptureType, MarkerMode } from './types';
9
+ export { SignalDataType } from './types/store';