@rfkit/charts 1.16.0 → 1.17.1

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/README.md CHANGED
@@ -133,8 +133,10 @@ export function AudioWaveformDemo() {
133
133
 
134
134
  `PublishDial` 支持推送 `series`、`range`、`yawAngle`、`isNorthFacing`,以及可选 `polygon: DialPolygon[]` 绘制雷达多边形:每个多边形提供 `values`(各方向归一化值 0-1,长度即方向数,按 0..360 度均匀分布)、可选 `color`(缺省走主题主色)与可选 `showDots`(是否绘制顶点小圆点,缺省 true)。各方向值决定半径,连成闭合多边形,径向渐变填充 + 细描边 + 顶点圆点;`series` 已改为可选,纯雷达数据可以只传 `polygon`。
135
135
 
136
+ `Dial` 的低频属性 `directionLabelMode` 使用公开枚举 `DialDirectionLabelMode`(组件属性类型 `DialProps`),默认是 `DialDirectionLabelMode.Cardinal`,在 0° / 180° 显示“北 / 南”。设置 `DialDirectionLabelMode.Degrees` 显示“0 / 180”,保留原有红 / 蓝颜色以及偏航、朝向语义;属性可运行时切换,不需要重新推送数据。
137
+
136
138
  ```tsx
137
- import { Dial, PSType, type Publish } from '@rfkit/charts';
139
+ import { Dial, DialDirectionLabelMode, PSType, type Publish } from '@rfkit/charts';
138
140
 
139
141
  const dialRef = useRef<Publish>(null);
140
142
 
@@ -142,6 +144,8 @@ dialRef.current?.({
142
144
  pstype: PSType.Dial,
143
145
  polygon: [{ values: [0.9, 0.6, 0.8, 0.45, 0.75, 0.5, 0.85, 0.7] }]
144
146
  });
147
+
148
+ <Dial ref={dialRef} directionLabelMode={DialDirectionLabelMode.Degrees} />;
145
149
  ```
146
150
 
147
151
  `PublishSpectrum` 支持推送内置频谱数据线,包括 `data`、`maxData`、`minData`、`avgData`、`thresholdData`、`templateData`、`backgroundNoiseData` 和 `extraData`。`thresholdData` 不传 `segmentOffset` / `offset` 时按整条门限替换;传入 `segmentOffset` 或 `offset` 时按局部门限写入。
@@ -170,6 +174,30 @@ publish({ pstype: PSType.Signal, type: SignalDataType.Simple, data: simpleData }
170
174
 
171
175
  台站数据需要提供 `startFrequency` / `stopFrequency`(也可以由 MHz 中心频率和 kHz 带宽在业务侧计算)。
172
176
 
177
+ ## Band 悬停详情
178
+
179
+ 频谱游标命中 Band 时,会在同一游标信息面板内统一展示起始频率、结束频率(MHz)和带宽(kHz),不展示百分比。频率最多保留 6 位小数、带宽最多保留 3 位小数,均去除末尾多余的零。业务端可通过 prop 或 `'band'` publish 传入 `details`;可选字段缺失时不显示,不传详情仍可查看基础信息。
180
+
181
+ ```tsx
182
+ <Spectrum
183
+ band={{
184
+ show: true,
185
+ frequency: 107.8,
186
+ bandwidth: 1800,
187
+ details: {
188
+ name: '广播接收频段',
189
+ organization: '监测站',
190
+ modulation: 'FM',
191
+ remark: '业务侧详情'
192
+ }
193
+ }}
194
+ />
195
+ ```
196
+
197
+ Band 支持 `left + width`(%)、`frequency`(MHz)+ `bandwidth`(kHz)、`startFrequency + stopFrequency`(MHz)三种互斥定位方式。离开 Band 后其详情自动隐藏,Band 原有遮罩样式保持不变。
198
+
199
+ ## 独立瀑布图缩放
200
+
173
201
  独立 `Heatmap` 可以显式开启 X/Y 同步缩放:
174
202
 
175
203
  ```tsx
@@ -1,6 +1,8 @@
1
+ import type { DialDirectionLabelMode } from '@rfkit/renderer';
1
2
  import type React from 'react';
2
3
  import type { ParamsProps } from '../../types/index.js';
3
4
  export interface Props extends ParamsProps {
5
+ directionLabelMode?: DialDirectionLabelMode;
4
6
  }
5
7
  declare const Chart: React.FC<Props>;
6
8
  export default Chart;
@@ -1,4 +1,7 @@
1
1
  import type React from 'react';
2
+ import type { Publish } from '../../types/index.js';
2
3
  import type { Props } from './Chart.js';
3
- declare const Dial: React.ForwardRefExoticComponent<Omit<Omit<Props, "publish">, "ref"> & React.RefAttributes<import("../../index.js").Publish>>;
4
+ export { DialDirectionLabelMode } from '@rfkit/renderer';
5
+ export type { Props as DialProps } from './Chart.js';
6
+ declare const Dial: React.ForwardRefExoticComponent<Omit<Props, 'publish'> & Pick<Props, 'directionLabelMode'> & React.RefAttributes<Publish>>;
4
7
  export default Dial;
@@ -1,9 +1,10 @@
1
- export declare const TOOLBAR_SHELL_CLASS_NAME = "relative flex h-10 w-full items-center justify-between pl-[var(--size-gap-base)] text-xs text-foreground";
1
+ export declare const TOOLBAR_SHELL_CLASS_NAME = "relative flex h-10 min-w-0 w-full items-center justify-between pl-[var(--size-gap-base)] text-xs text-foreground";
2
2
  export declare const TOOLBAR_SHELL_STYLE: {
3
3
  readonly background: 'linear-gradient(to bottom, var(--background), var(--mix-background-86))';
4
4
  readonly boxShadow: '0 1px 4px var(--mix-border-72)';
5
5
  };
6
- export declare const TOOLBAR_ITEMS_CLASS_NAME = "flex h-full items-center gap-[var(--size-gap-base)]";
6
+ export declare const TOOLBAR_ITEMS_CLASS_NAME = "flex h-full w-max min-w-full items-center gap-[var(--size-gap-base)]";
7
+ export declare const TOOLBAR_VIEWPORT_CLASS_NAME = "min-w-0 flex-1 overflow-x-auto overflow-y-hidden";
7
8
  export declare const TOOLBAR_SEPARATOR_BASE_CLASS_NAME = "self-center";
8
9
  export declare const TOOLBAR_SEPARATOR_CLASS_NAME = "self-center h-[18px]";
9
10
  export declare const TOOLBAR_GROUP_SEPARATOR_CLASS_NAME = "self-center h-3.5";
@@ -11,6 +11,7 @@ export interface RectBounds {
11
11
  right: number;
12
12
  top: number;
13
13
  }
14
+ export declare const intersectsViewport: (rect: RectPosition) => boolean;
14
15
  export interface UseDragSelectConfig {
15
16
  enabled?: boolean;
16
17
  defaultRect?: Partial<RectPosition>;
@@ -24,6 +25,7 @@ export interface UseDragSelectConfig {
24
25
  preserveDefaultRect?: boolean;
25
26
  bounds?: RectBounds;
26
27
  }
28
+ export declare const constrainDragPosition: (position: number, size: number, min: number, max: number, snapThreshold: number) => number;
27
29
  export declare const useDragSelect: (config?: UseDragSelectConfig) => {
28
30
  rect: RectPosition;
29
31
  isDragging: boolean;
package/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import './theme/library.css';
2
2
  export type { TemplateDetectionRegion, TemplateDetectionSnapshot } from '@rfkit/spectrum-analyzer';
3
3
  export { AudioWaveform, Dial, Gauge, Heatmap, IQ, LevelStream, Occupancy, Spectrum } from './charts/index.js';
4
4
  export type { AudioWaveformPalette, AudioWaveformProps } from './charts/AudioWaveform/index.js';
5
+ export { DialDirectionLabelMode, type DialProps } from './charts/Dial/index.js';
5
6
  export { AxisPlacement, ChartType, FrequencyUnit, MarkerEventType, ModuleType, OptionKey, PSType, SegmentsEvent, SeriesType, ToolbarItemType, ToolType } from './config/index.js';
6
7
  export { type EnhancedPublish, useSafePublish, withChartPublisher } from './hooks/index.js';
7
8
  export { setFrequencyAllocationChannelsToCache, setFrequencyAllocationToCache } from './modules/Spectrum/FrequencyAllocation/tools.js';