@rfkit/charts 1.0.105 → 1.1.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
@@ -175,9 +175,14 @@ export interface SpectrumExtraData {
175
175
  // 推送频谱数据
176
176
  export interface PublishSpectrum {
177
177
  pstype: PSType.Spectrum;
178
- data: Float32Array;
178
+ data?: Float32Array;
179
+ // 一般仅在静态绘制
180
+ maxData?: Float32Array;
181
+ minData?: Float32Array;
182
+ avgData?: Float32Array;
183
+ backgroundNoiseData?: Float32Array;
184
+ templateData?: Float32Array;
179
185
  extraData?: SpectrumExtraData;
180
- template?: Float32Array;
181
186
  // 瀑布图可选参数
182
187
  timestamp?: number;
183
188
  // 扫描可选参数
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import useBand from './useBand.js';
2
+ import useBand from './useBand';
3
3
  export { useBand };
4
4
  declare const Band: React.FC;
5
5
  export default Band;
@@ -1,6 +1,6 @@
1
1
  import type React from 'react';
2
- import Counter from './lib/Counter.js';
3
- import Selecter from './lib/Selecter.js';
2
+ import Counter from './lib/Counter';
3
+ import Selecter from './lib/Selecter';
4
4
  import { bandwidthfrequency2frequency, MARKER_UPDATE_ATTRIBUTE, MARKER_UPDATE_PARAMS, MARKER_UPDATE_RESET, startstop2frequency } from './lib/tools';
5
5
  export { Counter, Selecter, startstop2frequency, bandwidthfrequency2frequency, MARKER_UPDATE_PARAMS, MARKER_UPDATE_ATTRIBUTE, MARKER_UPDATE_RESET };
6
6
  interface Props {
@@ -3,8 +3,9 @@ export declare const SERIES: {
3
3
  minData: import("./setting").LineConfig;
4
4
  maxData: import("./setting").LineConfig;
5
5
  avgData: import("./setting").LineConfig;
6
- threshold: import("./setting").LineConfig;
7
- template: import("./setting").LineConfig;
6
+ thresholdData: import("./setting").LineConfig;
7
+ templateData: import("./setting").LineConfig;
8
+ backgroundNoiseData: import("./setting").LineConfig;
8
9
  };
9
10
  export declare const SERIES_NAMES: string[];
10
11
  export declare const REAL_DATA_NAME: string;
@@ -106,6 +107,7 @@ export declare enum SeriesType {
106
107
  MaxData = "maxData",
107
108
  MinData = "minData",
108
109
  AvgData = "avgData",
109
- ThresholdData = "threshold",
110
- TemplateData = "template"
110
+ ThresholdData = "thresholdData",
111
+ TemplateData = "templateData",
112
+ BackgroundNoiseData = "backgroundNoiseData"
111
113
  }
@@ -23,8 +23,9 @@ interface Config {
23
23
  minData: LineConfig;
24
24
  maxData: LineConfig;
25
25
  avgData: LineConfig;
26
- threshold: LineConfig;
27
- template: LineConfig;
26
+ thresholdData: LineConfig;
27
+ templateData: LineConfig;
28
+ backgroundNoiseData: LineConfig;
28
29
  };
29
30
  gradient: GradientConfig;
30
31
  levelStream: LevelStreamConfig;
@@ -0,0 +1,17 @@
1
+ import React, { type ComponentType } from 'react';
2
+ import type { Publish } from '../types';
3
+ import type { rawData } from '../utils/subscription';
4
+ export interface EnhancedPublish extends Publish {
5
+ isReady: () => boolean;
6
+ onReady: (callback: () => (() => void) | undefined) => (() => void) | undefined;
7
+ getSourceData: () => rawData;
8
+ }
9
+ /**
10
+ * 创建图表组件的高阶函数,提供安全的publish功能
11
+ * @param ChartComponent 要包装的图表组件
12
+ * @param componentName 组件名称,用于调试
13
+ * @returns 包装后的forwardRef组件
14
+ */
15
+ export declare function withChartPublisher<TProps extends {
16
+ publish?: Publish;
17
+ }>(ChartComponent: ComponentType<TProps>, componentName: string): React.ForwardRefExoticComponent<React.PropsWithoutRef<Omit<TProps, "publish">> & React.RefAttributes<Publish>>;
@@ -1,8 +1,9 @@
1
+ import type { Publish } from '../types';
1
2
  import { type CSMCallback } from '../utils/subscription';
2
3
  export declare const PUB_SUB: (globalID: string, func?: CSMCallback) => (...args: any[]) => void;
3
4
  interface Props {
4
5
  subscribe?: CSMCallback;
5
- publish?: CSMCallback;
6
+ publish: Publish;
6
7
  }
7
8
  declare const usePublish: ({ publish, subscribe }: Props) => void;
8
9
  export default usePublish;
@@ -0,0 +1,13 @@
1
+ import type { Publish, PublishData } from '../index';
2
+ import type { rawData } from '../utils/subscription';
3
+ interface EnhancedPublish extends Publish {
4
+ isReady: () => boolean;
5
+ onReady: (callback: () => void | (() => void)) => void | (() => void);
6
+ getSourceData: () => rawData;
7
+ }
8
+ export interface UseSafePublishReturn {
9
+ publish: (data: PublishData) => void;
10
+ chartRef: React.RefObject<EnhancedPublish>;
11
+ }
12
+ export default function useSafePublish(): UseSafePublishReturn;
13
+ export {};
@@ -1,4 +1,4 @@
1
- import { SpectrumOutputData } from '@rfkit/spectrum-analyzer';
1
+ import type { SpectrumOutputData } from '@rfkit/spectrum-analyzer';
2
2
  /**
3
3
  * 模板数据比较 Hook
4
4
  * 用于处理模板超出数据的转换
package/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { ChartType, MarkerEventType, OptionKey, PSType, SegmentsEvent, SeriesType } from './config';
2
+ export { default as useSafePublish } from './hooks/useSafePublish';
2
3
  export { Dial, Gauge, Heatmap, IQ, LevelStream, Occupancy, Spectrum } from './lib';
3
- export type { AxisXProps, AxisYRange, MarkerType, Publish, PublishData, PublishDial, PublishGauge, PublishHeatmap, PublishIQ, PublishLevelStream, PublishOccupancy, PublishSpectrum, RecursiveFunction, // 递归方法 后期会删除
4
+ export type { AxisXProps, AxisYRange, ChartRef, MarkerType, Publish, PublishData, PublishDial, PublishGauge, PublishHeatmap, PublishIQ, PublishLevelStream, PublishOccupancy, PublishSpectrum, RecursiveFunction, // 递归方法 后期会删除
4
5
  RecursiveObject, // 递归对象 后期会删除
5
- Render, Reset, SegmentsOriginal, SeriesConfig, SetAntennaFactor, SetChannels, SetMarker, SetSegments, SetSeries, SetSpectrumBandwidth, SpectrumBandwidth, SpectrumExtraData } from './types';
6
+ Render, Reset, SegmentsOriginal, SeriesConfig, SetAntennaFactor, SetChannels, SetMarker, SetSegments, SetSeries, SetSpectrumBandwidth, SpectrumBandwidth, SpectrumExtraData, StationInfoType } from './types';
6
7
  export { HeatmapCaptureType } from './types';