@rfkit/charts 1.2.10 → 1.2.12
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/components/FrequencyAllocation/AllocationInfo/index.d.ts +12 -0
- package/components/FrequencyAllocation/Tooltip/index.d.ts +4 -0
- package/components/FrequencyAllocation/index.d.ts +3 -0
- package/components/FrequencyAllocation/useAllocationFinder.d.ts +10 -0
- package/components/Signal/SegmentContainer.d.ts +16 -7
- package/components/Signal/Switch/index.d.ts +4 -0
- package/components/Signal/index.d.ts +8 -6
- package/components/Signal/tools.d.ts +8 -0
- package/components/Signal/useSignalDataManager.d.ts +12 -0
- package/components/{FrequencyDataBoard → Signal}/useStationFinder.d.ts +3 -3
- package/components/Signal/utils.d.ts +15 -0
- package/config/constants.d.ts +1 -1
- package/hooks/useSpectrumRule.d.ts +2 -1
- package/index.d.ts +2 -1
- package/index.js +587 -626
- package/package.json +1 -1
- package/store/reducer.d.ts +0 -2
- package/types/publish.d.ts +6 -5
- package/types/store.d.ts +6 -6
- package/utils/frequencyCalculation.d.ts +166 -0
- package/utils/index.d.ts +7 -0
- package/components/Signal/useSignal.d.ts +0 -3
- package/components/StationAllocation/SegmentContainer.d.ts +0 -24
- package/components/StationAllocation/Switch/index.d.ts +0 -3
- package/components/StationAllocation/index.d.ts +0 -8
- /package/components/{StationAllocation → Signal}/type.d.ts +0 -0
package/package.json
CHANGED
package/store/reducer.d.ts
CHANGED
|
@@ -29,7 +29,6 @@ export declare const defaultState: () => {
|
|
|
29
29
|
frequencyAllocation: import("../types").FrequencyAllocationProps;
|
|
30
30
|
levelStream?: import("../types").LevelStreamProps;
|
|
31
31
|
timeRange?: number;
|
|
32
|
-
stationInfo: import("../types").StationInfoProps;
|
|
33
32
|
fluorescence: import("../types").FluorescenceProps;
|
|
34
33
|
publish?: import("..").Publish;
|
|
35
34
|
};
|
|
@@ -62,7 +61,6 @@ export declare const reducer: (state: StoreState, action: DispatchAction) => {
|
|
|
62
61
|
frequencyAllocation: import("../types").FrequencyAllocationProps;
|
|
63
62
|
levelStream?: import("../types").LevelStreamProps;
|
|
64
63
|
timeRange?: number;
|
|
65
|
-
stationInfo: import("../types").StationInfoProps;
|
|
66
64
|
fluorescence: import("../types").FluorescenceProps;
|
|
67
65
|
publish?: import("..").Publish;
|
|
68
66
|
};
|
package/types/publish.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MarkerEventType, OptionKey, PSType, SegmentsEvent } from '../config';
|
|
2
2
|
import type { rawData } from '../utils/subscription';
|
|
3
3
|
import type { SegmentsOriginal, SeriesConfig, SpectrumBandwidth, StationInfoType } from './common';
|
|
4
|
-
import type { MarkerType, ParamsProps } from './store';
|
|
4
|
+
import type { MarkerType, ParamsProps, SignalData, SignalDataType } from './store';
|
|
5
5
|
export interface SetOption {
|
|
6
6
|
pstype: PSType.Option;
|
|
7
7
|
key: OptionKey;
|
|
@@ -26,9 +26,10 @@ export interface SetAntennaFactor {
|
|
|
26
26
|
pstype: PSType.AntennaFactor;
|
|
27
27
|
data: Float32Array;
|
|
28
28
|
}
|
|
29
|
-
export interface
|
|
30
|
-
pstype: PSType.
|
|
31
|
-
|
|
29
|
+
export interface SetSignal {
|
|
30
|
+
pstype: PSType.Signal;
|
|
31
|
+
type: SignalDataType;
|
|
32
|
+
data: StationInfoType[] | SignalData[];
|
|
32
33
|
}
|
|
33
34
|
export interface SetChannels {
|
|
34
35
|
pstype: PSType.Channels;
|
|
@@ -110,7 +111,7 @@ export interface Render {
|
|
|
110
111
|
pstype: PSType.Render;
|
|
111
112
|
[key: string]: unknown;
|
|
112
113
|
}
|
|
113
|
-
export type PublishData = SetOption | SetSeries | SetSpectrumBandwidth | SetSegments | SetChannels | SetMarker | SetAntennaFactor |
|
|
114
|
+
export type PublishData = SetOption | SetSeries | SetSpectrumBandwidth | SetSegments | SetChannels | SetMarker | SetAntennaFactor | SetSignal | PublishSpectrum | PublishHeatmap | PublishFluorescence | PublishOccupancy | PublishLevelStream | PublishIQ | PublishDial | PublishGauge | Reset | Clear | Resize | Render;
|
|
114
115
|
export type Publish = ((p: PublishData) => void) & {
|
|
115
116
|
getSourceData: () => rawData;
|
|
116
117
|
};
|
package/types/store.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TimestampedFloat32Array } from '@rfkit/spectrum-analyzer';
|
|
2
2
|
import type { MarkerEventType, ModuleType, SeriesType } from '../config';
|
|
3
|
-
import type { AxisXRange, AxisYRange, Publish, RecursiveObject, SegmentsType,
|
|
3
|
+
import type { AxisXRange, AxisYRange, Publish, RecursiveObject, SegmentsType, TopRightBottomLeft } from './';
|
|
4
4
|
export interface SystemConfig {
|
|
5
5
|
width: number;
|
|
6
6
|
height: number;
|
|
@@ -158,12 +158,17 @@ export interface ZoomProps {
|
|
|
158
158
|
onChange: (se: [string, string], interval: AxisXRange) => void;
|
|
159
159
|
autoCloseTimeout: number;
|
|
160
160
|
}
|
|
161
|
+
export declare enum SignalDataType {
|
|
162
|
+
Station = "station",// 台站信号(详细信息)
|
|
163
|
+
Simple = "simple"
|
|
164
|
+
}
|
|
161
165
|
export interface SignalData {
|
|
162
166
|
startFrequency?: number | string;
|
|
163
167
|
stopFrequency?: number | string;
|
|
164
168
|
frequency?: number | string;
|
|
165
169
|
bandwidth?: number | string;
|
|
166
170
|
color?: string;
|
|
171
|
+
signalType?: string;
|
|
167
172
|
}
|
|
168
173
|
export type SelectedSignal = {
|
|
169
174
|
segIndex: number;
|
|
@@ -243,10 +248,6 @@ export interface EventBusProps {
|
|
|
243
248
|
onDoubleClick: (frequency: string, e: RecursiveObject) => void;
|
|
244
249
|
[key: string]: unknown;
|
|
245
250
|
}
|
|
246
|
-
export interface StationInfoProps {
|
|
247
|
-
show: boolean;
|
|
248
|
-
data: StationInfoType[];
|
|
249
|
-
}
|
|
250
251
|
export interface FluorescenceProps {
|
|
251
252
|
show: boolean;
|
|
252
253
|
display: boolean;
|
|
@@ -279,7 +280,6 @@ export interface StoreState {
|
|
|
279
280
|
frequencyAllocation: FrequencyAllocationProps;
|
|
280
281
|
levelStream?: LevelStreamProps;
|
|
281
282
|
timeRange?: number;
|
|
282
|
-
stationInfo: StationInfoProps;
|
|
283
283
|
fluorescence: FluorescenceProps;
|
|
284
284
|
[key: string]: unknown;
|
|
285
285
|
publish?: Publish;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 频率计算工具包
|
|
3
|
+
*
|
|
4
|
+
* 提供统一的频率范围、索引计算、位置计算等功能
|
|
5
|
+
* 用于 StationAllocation、FrequencyAllocation、Signal 等组件的核心计算逻辑
|
|
6
|
+
*/
|
|
7
|
+
import type { SegmentType } from '../types';
|
|
8
|
+
/**
|
|
9
|
+
* 频率范围(起止频率)
|
|
10
|
+
*/
|
|
11
|
+
export interface FrequencyRange {
|
|
12
|
+
/** 起始频率 (MHz) */
|
|
13
|
+
startFreq: number;
|
|
14
|
+
/** 结束频率 (MHz) */
|
|
15
|
+
stopFreq: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 频率范围输入(支持两种格式)
|
|
19
|
+
*/
|
|
20
|
+
export interface FrequencyRangeInput {
|
|
21
|
+
/** 格式1: 中心频率 (MHz) */
|
|
22
|
+
frequency?: number;
|
|
23
|
+
/** 格式1: 带宽 (kHz) */
|
|
24
|
+
bandwidth?: number;
|
|
25
|
+
/** 格式2: 起始频率 (MHz) */
|
|
26
|
+
startFrequency?: number;
|
|
27
|
+
/** 格式2: 结束频率 (MHz) */
|
|
28
|
+
stopFrequency?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 索引范围
|
|
32
|
+
*/
|
|
33
|
+
export interface IndexRange {
|
|
34
|
+
/** 起始索引 */
|
|
35
|
+
startIndex: number;
|
|
36
|
+
/** 结束索引 */
|
|
37
|
+
stopIndex: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 位置信息(百分比)
|
|
41
|
+
*/
|
|
42
|
+
export interface Position {
|
|
43
|
+
/** 左侧位置 (%) */
|
|
44
|
+
left: number;
|
|
45
|
+
/** 宽度 (%) */
|
|
46
|
+
width: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 当前光标位置信息
|
|
50
|
+
*/
|
|
51
|
+
export interface CursorPosition {
|
|
52
|
+
/** 所在段索引 */
|
|
53
|
+
segmentIndex: number;
|
|
54
|
+
/** 段内点索引 */
|
|
55
|
+
pointIndex: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 精确搜索范围(前后各 5 个点)
|
|
59
|
+
* 用于在 frequencyCache 中精确查找最接近的索引
|
|
60
|
+
*/
|
|
61
|
+
export declare const SEARCH_RANGE = 5;
|
|
62
|
+
/**
|
|
63
|
+
* Active 判断容差(前后各 2 个点)
|
|
64
|
+
* 用于处理 left 步进跳跃时的窄带检测
|
|
65
|
+
*/
|
|
66
|
+
export declare const ACTIVE_TOLERANCE = 2;
|
|
67
|
+
/**
|
|
68
|
+
* 计算频率范围
|
|
69
|
+
*
|
|
70
|
+
* 支持两种输入格式:
|
|
71
|
+
* 1. frequency + bandwidth (中心频率 + 带宽)
|
|
72
|
+
* 2. startFrequency + stopFrequency (起止频率)
|
|
73
|
+
*
|
|
74
|
+
* @param input 频率范围输入
|
|
75
|
+
* @returns 频率范围(起止频率,单位 MHz)
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* // 格式1: 中心频率 + 带宽
|
|
79
|
+
* calculateFrequencyRange({ frequency: 100, bandwidth: 20 })
|
|
80
|
+
* // => { startFreq: 99.99, stopFreq: 100.01 }
|
|
81
|
+
*
|
|
82
|
+
* // 格式2: 起止频率
|
|
83
|
+
* calculateFrequencyRange({ startFrequency: 99.99, stopFrequency: 100.01 })
|
|
84
|
+
* // => { startFreq: 99.99, stopFreq: 100.01 }
|
|
85
|
+
*/
|
|
86
|
+
export declare function calculateFrequencyRange(input: FrequencyRangeInput): FrequencyRange | null;
|
|
87
|
+
/**
|
|
88
|
+
* 计算初步索引范围(粗略计算)
|
|
89
|
+
*
|
|
90
|
+
* 基于频率范围和 segment 信息,计算初步的索引范围
|
|
91
|
+
*
|
|
92
|
+
* @param range 频率范围
|
|
93
|
+
* @param segment 段信息
|
|
94
|
+
* @returns 初步索引范围
|
|
95
|
+
*/
|
|
96
|
+
export declare function calculateRoughIndexRange(range: FrequencyRange, segment: SegmentType): IndexRange;
|
|
97
|
+
/**
|
|
98
|
+
* 精确查找索引范围
|
|
99
|
+
*
|
|
100
|
+
* 使用 frequencyCache 在粗略索引附近精确搜索,找到最接近的索引
|
|
101
|
+
*
|
|
102
|
+
* @param range 频率范围
|
|
103
|
+
* @param segment 段信息
|
|
104
|
+
* @param searchRange 搜索范围(默认 5)
|
|
105
|
+
* @returns 精确索引范围
|
|
106
|
+
*/
|
|
107
|
+
export declare function findPreciseIndexRange(range: FrequencyRange, segment: SegmentType, searchRange?: number): IndexRange;
|
|
108
|
+
/**
|
|
109
|
+
* 从索引范围计算位置信息
|
|
110
|
+
*
|
|
111
|
+
* 将索引范围转换为百分比位置和宽度
|
|
112
|
+
*
|
|
113
|
+
* @param indexRange 索引范围
|
|
114
|
+
* @param segment 段信息
|
|
115
|
+
* @returns 位置信息(百分比)
|
|
116
|
+
*/
|
|
117
|
+
export declare function calculatePositionFromIndex(indexRange: IndexRange, segment: SegmentType): Position;
|
|
118
|
+
/**
|
|
119
|
+
* 从频率范围直接计算位置(一步到位)
|
|
120
|
+
*
|
|
121
|
+
* 组合上述函数,从频率范围直接计算出精确的位置和索引
|
|
122
|
+
*
|
|
123
|
+
* @param range 频率范围
|
|
124
|
+
* @param segment 段信息
|
|
125
|
+
* @returns 位置信息和索引范围
|
|
126
|
+
*/
|
|
127
|
+
export declare function calculatePositionFromFrequencyRange(range: FrequencyRange, segment: SegmentType): Position & IndexRange;
|
|
128
|
+
/**
|
|
129
|
+
* 计算当前光标位置
|
|
130
|
+
*
|
|
131
|
+
* 从 left(百分比)计算当前所在的 segment 和 segment 内的 point 索引
|
|
132
|
+
*
|
|
133
|
+
* @param left 光标位置(百分比 0-100)
|
|
134
|
+
* @param segments 所有段信息
|
|
135
|
+
* @returns 光标位置信息
|
|
136
|
+
*/
|
|
137
|
+
export declare function calculateCursorPosition(left: number, segments: SegmentType[]): CursorPosition;
|
|
138
|
+
/**
|
|
139
|
+
* 判断光标是否在频率范围内(使用索引 + 容差)
|
|
140
|
+
*
|
|
141
|
+
* 使用索引范围判断,支持容差(用于处理 left 步进跳跃)
|
|
142
|
+
*
|
|
143
|
+
* @param cursorPointIndex 光标在段内的点索引
|
|
144
|
+
* @param indexRange 目标频率范围的索引
|
|
145
|
+
* @param tolerance 容差(默认 2)
|
|
146
|
+
* @returns 是否在范围内
|
|
147
|
+
*/
|
|
148
|
+
export declare function isInRangeByIndex(cursorPointIndex: number, indexRange: IndexRange, tolerance?: number): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* 判断光标是否在频率范围内(使用频率)
|
|
151
|
+
*
|
|
152
|
+
* 直接使用频率值判断(兜底方案)
|
|
153
|
+
*
|
|
154
|
+
* @param currentFrequency 当前频率
|
|
155
|
+
* @param range 目标频率范围
|
|
156
|
+
* @returns 是否在范围内
|
|
157
|
+
*/
|
|
158
|
+
export declare function isInRangeByFrequency(currentFrequency: number, range: FrequencyRange): boolean;
|
|
159
|
+
/**
|
|
160
|
+
* 判断频率范围是否与 segment 有交集
|
|
161
|
+
*
|
|
162
|
+
* @param range 频率范围
|
|
163
|
+
* @param segment 段信息
|
|
164
|
+
* @returns 是否有交集
|
|
165
|
+
*/
|
|
166
|
+
export declare function isRangeIntersectSegment(range: FrequencyRange, segment: SegmentType): boolean;
|
package/utils/index.d.ts
CHANGED
|
@@ -45,6 +45,12 @@ export declare function arrayFindMin(arr: Array<any>): 0 | {
|
|
|
45
45
|
minIndex: number;
|
|
46
46
|
};
|
|
47
47
|
export declare const generateFrequencySegments: (e: RecursiveObject) => SegmentsType;
|
|
48
|
+
/**
|
|
49
|
+
* 为无频率规则的模式生成默认 segments(如 LiteNormalized)
|
|
50
|
+
* @param totalPoints 数据点数
|
|
51
|
+
* @returns SegmentsType
|
|
52
|
+
*/
|
|
53
|
+
export declare const generateNormalizedSegments: (totalPoints: number) => SegmentsType;
|
|
48
54
|
export declare const generateGreatSegments: (prevSegments: SegmentsOriginal[]) => SegmentsType;
|
|
49
55
|
/**
|
|
50
56
|
* 获取平均值、最大值、最小值
|
|
@@ -105,3 +111,4 @@ export declare const debounce: <T extends (...args: unknown[]) => unknown>(fn: T
|
|
|
105
111
|
*/
|
|
106
112
|
export declare function debounceRequestAnimationFrame<T extends unknown[]>(func?: (...args: T) => void): (...args: T) => void;
|
|
107
113
|
export declare const getThemeColor: (property: string, opacity?: number) => string;
|
|
114
|
+
export * from './frequencyCalculation';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { StationInfoType } from '../../types';
|
|
3
|
-
interface StationPosition {
|
|
4
|
-
station: StationInfoType;
|
|
5
|
-
position: {
|
|
6
|
-
left: string;
|
|
7
|
-
width: string;
|
|
8
|
-
};
|
|
9
|
-
startIndex: number;
|
|
10
|
-
stopIndex: number;
|
|
11
|
-
signalColor?: string;
|
|
12
|
-
signalTypeName?: string;
|
|
13
|
-
tooltip: string;
|
|
14
|
-
}
|
|
15
|
-
interface SegmentContainerProps {
|
|
16
|
-
style: React.CSSProperties;
|
|
17
|
-
stationPositions: StationPosition[];
|
|
18
|
-
currentFrequency: number;
|
|
19
|
-
segmentIndex: number;
|
|
20
|
-
isCurrentSegment: boolean;
|
|
21
|
-
currentPointIndex: number;
|
|
22
|
-
}
|
|
23
|
-
declare const SegmentContainer: React.FC<SegmentContainerProps>;
|
|
24
|
-
export default SegmentContainer;
|
|
File without changes
|