@rfkit/charts 1.2.28 → 1.3.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.
Files changed (105) hide show
  1. package/components/AxisY/occupancy/index.d.ts +1 -0
  2. package/components/AxisY/occupancy/type/Default/index.d.ts +4 -1
  3. package/components/AxisY/spectrum/useRanging/tools.d.ts +27 -11
  4. package/components/AxisY/tools.d.ts +2 -0
  5. package/components/Blaze/tools.d.ts +2 -1
  6. package/components/Cursor/tools.d.ts +1 -1
  7. package/components/Dashed/index.d.ts +1 -0
  8. package/components/DeltaMeasurement/Switch.d.ts +3 -0
  9. package/components/DeltaMeasurement/index.d.ts +3 -0
  10. package/components/DragSelectBox/index.d.ts +28 -0
  11. package/components/Dropdown/index.d.ts +1 -0
  12. package/components/EventBus/tools.d.ts +2 -2
  13. package/components/Markers/hooks/useMarkerEvents.d.ts +1 -0
  14. package/components/Markers/hooks/useMarkers.d.ts +2 -0
  15. package/components/Markers/tools.d.ts +15 -0
  16. package/components/Zoom/ZoomOffsetContainer/index.d.ts +1 -0
  17. package/config/constants.d.ts +12 -4
  18. package/config/setting.d.ts +9 -0
  19. package/hooks/data/index.d.ts +6 -0
  20. package/hooks/{useSegments.d.ts → data/useSegments.d.ts} +1 -1
  21. package/hooks/index.d.ts +12 -0
  22. package/hooks/publish/index.d.ts +6 -0
  23. package/hooks/{useMarkerPublish.d.ts → publish/useMarkerPublish.d.ts} +1 -1
  24. package/hooks/{usePublish.d.ts → publish/usePublish.d.ts} +2 -2
  25. package/hooks/{useSafePublish.d.ts → publish/useSafePublish.d.ts} +3 -3
  26. package/hooks/spectrum/index.d.ts +6 -0
  27. package/hooks/{useSpectrumChartType.d.ts → spectrum/useSpectrumChartType.d.ts} +1 -1
  28. package/hooks/{useSpectrumRule.d.ts → spectrum/useSpectrumRule.d.ts} +2 -2
  29. package/hooks/useChart/index.d.ts +14 -5
  30. package/hooks/useDragSelect.d.ts +32 -0
  31. package/hooks/useModuleSubscription.d.ts +66 -0
  32. package/hooks/useSeriesManager/index.d.ts +1 -1
  33. package/hooks/useSeriesManager/useFilteredSeries.d.ts +1 -1
  34. package/hooks/useSeriesManager/useSeriesManager.d.ts +0 -8
  35. package/index.d.ts +4 -2
  36. package/index.js +10953 -11488
  37. package/lib/Spectrum/Chart.d.ts +4 -3
  38. package/modules/Dial/render.d.ts +13 -8
  39. package/modules/Fluorescence/render.d.ts +13 -33
  40. package/modules/Gauge/render.d.ts +30 -9
  41. package/modules/Heatmap/render.d.ts +21 -21
  42. package/modules/IQEye/index.d.ts +6 -1
  43. package/modules/IQPlanisphere/index.d.ts +6 -1
  44. package/modules/IQStream/index.d.ts +5 -1
  45. package/modules/Occupancy/render.d.ts +14 -8
  46. package/modules/OccupancyPortal/index.d.ts +5 -2
  47. package/modules/SpatialSpectrum/render.d.ts +13 -8
  48. package/modules/Spectrum/render.d.ts +3 -2
  49. package/modules/base/BaseRenderer.d.ts +83 -0
  50. package/modules/base/CircularRenderer.d.ts +59 -0
  51. package/modules/base/GradientRenderer.d.ts +42 -0
  52. package/modules/base/IQRenderer.d.ts +41 -0
  53. package/modules/base/index.d.ts +7 -0
  54. package/modules/tools.d.ts +2 -1
  55. package/package.json +1 -1
  56. package/store/reducer.d.ts +2 -0
  57. package/types/common.d.ts +14 -12
  58. package/types/publish.d.ts +4 -1
  59. package/types/store/axis.d.ts +29 -0
  60. package/types/store/frequency.d.ts +19 -0
  61. package/types/store/heatmap.d.ts +53 -0
  62. package/types/store/index.d.ts +95 -0
  63. package/types/store/marker.d.ts +39 -0
  64. package/types/store/series.d.ts +16 -0
  65. package/types/store/signal.d.ts +27 -0
  66. package/types/store/ui.d.ts +98 -0
  67. package/types/store.d.ts +13 -328
  68. package/utils/array.d.ts +40 -0
  69. package/utils/frequency.d.ts +72 -0
  70. package/utils/index.d.ts +12 -114
  71. package/utils/object.d.ts +11 -0
  72. package/utils/series/events.d.ts +1 -1
  73. package/utils/series/index.d.ts +1 -1
  74. package/utils/series/modes.d.ts +1 -1
  75. package/utils/subscription.d.ts +20 -2
  76. package/utils/theme.d.ts +18 -0
  77. package/utils/throttle.d.ts +52 -0
  78. package/utils/time.d.ts +27 -0
  79. package/engine/ColorInterpolator.d.ts +0 -49
  80. package/engine/dial.d.ts +0 -13
  81. package/engine/engine.d.ts +0 -10
  82. package/engine/fillImageData.d.ts +0 -34
  83. package/engine/fluorescence.d.ts +0 -37
  84. package/engine/gauge.d.ts +0 -16
  85. package/engine/heatmap.d.ts +0 -13
  86. package/engine/index.d.ts +0 -11
  87. package/engine/iq.d.ts +0 -12
  88. package/engine/iqEye.d.ts +0 -17
  89. package/engine/radar.d.ts +0 -11
  90. package/engine/series.d.ts +0 -12
  91. package/engine/tools.d.ts +0 -30
  92. package/engine/type.d.ts +0 -32
  93. package/engine/utils.d.ts +0 -2
  94. package/engine/webglEngine.d.ts +0 -23
  95. package/engine/webglExample.d.ts +0 -21
  96. package/engine/webglSeries.d.ts +0 -21
  97. package/hooks/useHeatmapHeight.d.ts +0 -7
  98. package/hooks/useRuleUpdate.d.ts +0 -4
  99. package/hooks/useZoomMinSimulateWave.d.ts +0 -7
  100. package/modules/IQEye/render.d.ts +0 -12
  101. package/modules/IQPlanisphere/render.d.ts +0 -12
  102. package/modules/IQStream/render.d.ts +0 -12
  103. /package/hooks/{useChannel.d.ts → data/useChannel.d.ts} +0 -0
  104. /package/hooks/{usePoints.d.ts → data/usePoints.d.ts} +0 -0
  105. /package/hooks/{uselevelStreamAnalyzer.d.ts → useLevelStreamAnalyzer.d.ts} +0 -0
@@ -1,6 +1,7 @@
1
1
  import type React from 'react';
2
2
  interface Props {
3
3
  disabled?: boolean;
4
+ inside?: boolean;
4
5
  }
5
6
  declare const AxisYOccupancy: React.FC<Props>;
6
7
  export default AxisYOccupancy;
@@ -1,3 +1,6 @@
1
1
  import React from 'react';
2
- declare const _default: React.NamedExoticComponent<{}>;
2
+ interface Props {
3
+ inside?: boolean;
4
+ }
5
+ declare const _default: React.NamedExoticComponent<Props>;
3
6
  export default _default;
@@ -1,24 +1,40 @@
1
+ /**
2
+ * 虚拟范围数据结构
3
+ */
4
+ interface VirtualRangeData {
5
+ flaw: number;
6
+ offset: number;
7
+ range: [number, number];
8
+ renderRange: [number, number];
9
+ }
1
10
  /**
2
11
  * 全局共享的虚拟范围值
3
12
  */
4
- export declare const VIRTUAL_RANGE: (globalID: string, virtual?: any) => any;
13
+ export declare const VIRTUAL_RANGE: (globalID: string, virtual?: VirtualRangeData) => VirtualRangeData;
14
+ interface VirtualRangeParams {
15
+ unit?: string;
16
+ realRange?: number[];
17
+ step?: number;
18
+ globalID: string;
19
+ }
5
20
  /**
6
21
  * 虚拟范围管理器
7
22
  */
8
- export declare function useVirtualRange({ unit, realRange, step, globalID }: any): {
9
- offset: number;
10
- range: any;
11
- renderRange: any;
12
- flaw: number;
13
- };
23
+ export declare function useVirtualRange({ unit, realRange, step, globalID }: VirtualRangeParams): VirtualRangeData;
24
+ interface Range2RealRangeParams {
25
+ range: [number, number];
26
+ unit?: string;
27
+ globalID: string;
28
+ }
14
29
  /**
15
30
  * 虚拟范围转真实范围
16
31
  */
17
- export declare function range2realRange({ range, unit, globalID }: any): {
18
- realRange: any;
19
- renderRange: any;
32
+ export declare function range2realRange({ range, unit, globalID }: Range2RealRangeParams): {
33
+ realRange: [number, number];
34
+ renderRange: [number, number];
20
35
  };
21
36
  /**
22
37
  * 获取虚拟电频值
23
38
  */
24
- export declare function getVirtualLevel(unit: string, v: number | any): any;
39
+ export declare function getVirtualLevel(unit: string, v: number): number;
40
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { AxisYRange } from '../../types';
2
+ export declare function getAxisYDoubleClickResetRange(restrict: number[] | undefined): AxisYRange;
@@ -1 +1,2 @@
1
- export declare const BLAZE_PROGRESS: (globalID: string, func?: any) => (...args: any[]) => void;
1
+ import { type CSMCallback } from '../../utils/subscription';
2
+ export declare const BLAZE_PROGRESS: (globalID: string, func?: CSMCallback) => (...args: any[]) => void;
@@ -1,5 +1,5 @@
1
1
  import type { RecursiveFunction } from '../../types';
2
- export declare const CURSOR_TIMEOUT: (globalID: string, timer?: number | NodeJS.Timeout) => any;
2
+ export declare const CURSOR_TIMEOUT: (globalID: string, timer?: number | NodeJS.Timeout) => number | NodeJS.Timeout;
3
3
  export declare const CURSOR_SETACTIVE: (globalID: string, func?: RecursiveFunction) => (...args: any[]) => void;
4
4
  /**
5
5
  * 将位置信息转换为视觉left
@@ -5,6 +5,7 @@ interface Props {
5
5
  color?: string;
6
6
  x?: boolean;
7
7
  y?: boolean;
8
+ lineWidth?: number;
8
9
  }
9
10
  declare const Dashed: React.FC<Props>;
10
11
  export default Dashed;
@@ -0,0 +1,3 @@
1
+ import type React from 'react';
2
+ declare const DeltaMeasurementSwitch: React.FC;
3
+ export default DeltaMeasurementSwitch;
@@ -0,0 +1,3 @@
1
+ import type React from 'react';
2
+ declare const DeltaMeasurement: React.FC;
3
+ export default DeltaMeasurement;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * 通用拖拽框选组件
3
+ * 用于创建可拖拽、可调整大小的矩形框
4
+ */
5
+ import type React from 'react';
6
+ import type { ReactNode } from 'react';
7
+ import { type RectPosition } from '../../hooks/useDragSelect';
8
+ export interface DragSelectBoxProps {
9
+ enabled: boolean;
10
+ defaultRect?: Partial<RectPosition>;
11
+ minSize?: number;
12
+ maxSize?: number;
13
+ snapThreshold?: number;
14
+ onChange?: (rect: RectPosition) => void;
15
+ onDragEnd?: (rect: RectPosition) => void;
16
+ children?: ReactNode;
17
+ labels?: {
18
+ top?: ReactNode;
19
+ bottom?: ReactNode;
20
+ left?: ReactNode;
21
+ right?: ReactNode;
22
+ };
23
+ className?: string;
24
+ zIndex?: number;
25
+ showBoundaryLines?: boolean;
26
+ }
27
+ declare const DragSelectBox: React.FC<DragSelectBoxProps>;
28
+ export default DragSelectBox;
@@ -4,6 +4,7 @@ export interface DropdownOption {
4
4
  label: string;
5
5
  style?: React.CSSProperties;
6
6
  render?: () => React.ReactNode;
7
+ disabled?: boolean;
7
8
  }
8
9
  interface DropdownProps {
9
10
  value: string | number | null;
@@ -45,8 +45,8 @@ export declare const CURSOR_STYLE_MAP: {
45
45
  zoom: string;
46
46
  area: string;
47
47
  };
48
- export declare const getEventLevel: (id: string, level?: string) => any;
49
- export declare const getEventType: (id: string, type?: string) => any;
48
+ export declare const getEventLevel: (id: string, level?: string) => string;
49
+ export declare const getEventType: (id: string, type?: string) => string;
50
50
  /**
51
51
  * 比较事件优先级
52
52
  * @param id 事件ID
@@ -9,6 +9,7 @@ interface UseMarkerEventsProps {
9
9
  }) => void;
10
10
  onDeleteMarker: (id: string) => void;
11
11
  onUpdateMarker: (id: string, position: TopRightBottomLeft) => void;
12
+ onToggleSelect: (id: string) => void;
12
13
  onHover: (e: {
13
14
  left: number;
14
15
  }) => void;
@@ -40,6 +40,8 @@ export declare const useMarkers: (props: UseMarkersProps) => {
40
40
  left: number;
41
41
  }) => string;
42
42
  resetHover: () => void;
43
+ toggleMainSecondaryPeaks: () => void;
44
+ moveToAdjacentPeak: (direction: "left" | "right", markerId: string) => void;
43
45
  setState: import("react").Dispatch<import("react").SetStateAction<MarkerState>>;
44
46
  };
45
47
  export {};
@@ -7,6 +7,19 @@ export declare const MARKER_UPDATE_RESET: (id: string, func?: RecursiveFunction)
7
7
  export declare const MARKER_COUNT_CHANGE: (id: string, func?: RecursiveFunction<[{
8
8
  count: number;
9
9
  }]>) => (...args: any[]) => void;
10
+ export declare const MARKER_SELECTION_CHANGE: (id: string, func?: RecursiveFunction<[{
11
+ selectedId: string | null;
12
+ }]>) => (...args: any[]) => void;
13
+ export type MarkerCommand = {
14
+ type: 'main-secondary-peaks';
15
+ } | {
16
+ type: 'left-peak';
17
+ selectedId: string;
18
+ } | {
19
+ type: 'right-peak';
20
+ selectedId: string;
21
+ };
22
+ export declare const MARKER_COMMAND: (id: string, func?: RecursiveFunction) => (...args: any[]) => void;
10
23
  export declare const leftDataSelectMax: (left: number, data: Float32Array) => number;
11
24
  export declare function fixLocation(location: number, len: number): number;
12
25
  interface ZoomLeftParams {
@@ -23,7 +36,9 @@ export interface PeakPoint {
23
36
  value: number;
24
37
  index: number;
25
38
  }
39
+ export declare function findMaxPeak(data: Float32Array): PeakPoint | null;
26
40
  export declare function findPeaks(data: Float32Array): PeakPoint[] | null;
41
+ export declare function findTopPeaks(data: Float32Array, count?: number, threshold?: number, minDistance?: number): PeakPoint[];
27
42
  export declare function findMultiplePeaks(data: Float32Array, threshold?: number, minDistance?: number): PeakPoint[];
28
43
  export declare function findNearbyPeak(data: Float32Array, targetIndex: number, searchRadius?: number): PeakPoint | null;
29
44
  export declare const setMarkerMove: (marker: MarkerType, segments: SegmentsType, callback: RecursiveFunction) => void;
@@ -1,6 +1,7 @@
1
1
  interface Props {
2
2
  children: React.ReactNode;
3
3
  className?: string;
4
+ style?: React.CSSProperties;
4
5
  }
5
6
  declare const ZoomOffsetContainer: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLDivElement>>;
6
7
  export default ZoomOffsetContainer;
@@ -9,8 +9,16 @@ export declare const SERIES: {
9
9
  };
10
10
  export declare const SERIES_NAMES: string[];
11
11
  export declare const REAL_DATA_NAME: string;
12
- export declare const ZOOM_MIN_RANGE = 10;
13
- export declare const POPOVER_MARGIN = 16;
12
+ /** @deprecated 使用 UI_CONFIG.ZOOM_MIN_RANGE */
13
+ export declare const ZOOM_MIN_RANGE: 10;
14
+ /** @deprecated 使用 UI_CONFIG.POPOVER_MARGIN */
15
+ export declare const POPOVER_MARGIN: 16;
16
+ export declare enum FrequencyUnit {
17
+ Hz = "Hz",
18
+ kHz = "kHz",
19
+ MHz = "MHz",
20
+ GHz = "GHz"
21
+ }
14
22
  export declare enum ChartType {
15
23
  SingleFrequency = "singleFrequency",
16
24
  Scan = "scan",
@@ -39,7 +47,6 @@ export declare enum ModuleType {
39
47
  IQPlanisphere = "iqPlanisphere",
40
48
  IQEye = "iqEye",
41
49
  IQLine = "iqLine",
42
- Factor = "factor",
43
50
  SpatialSpectrum = "spatialSpectrum"
44
51
  }
45
52
  export declare enum PSType {
@@ -128,7 +135,8 @@ export declare enum ToolsBarItemType {
128
135
  SignalSwitch = "SignalSwitch",
129
136
  SegmentsDisplayControl = "SegmentsDisplayControl",
130
137
  SeriesDisplayControl = "SeriesDisplayControl",
131
- FluorescenceSwitch = "FluorescenceSwitch"
138
+ FluorescenceSwitch = "FluorescenceSwitch",
139
+ DeltaMeasurementSwitch = "DeltaMeasurementSwitch"
132
140
  }
133
141
  export declare enum SeriesType {
134
142
  RealData = "realData",
@@ -1,3 +1,12 @@
1
+ /**
2
+ * UI 配置常量
3
+ */
4
+ export declare const UI_CONFIG: {
5
+ /** 缩放最小范围 */
6
+ readonly ZOOM_MIN_RANGE: 10;
7
+ /** Popover 边距 */
8
+ readonly POPOVER_MARGIN: 16;
9
+ };
1
10
  export interface LineConfig {
2
11
  name: string;
3
12
  color: string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 数据处理相关 hooks
3
+ */
4
+ export { default as useChannel } from './useChannel';
5
+ export { default as usePoints } from './usePoints';
6
+ export { default as useSegments } from './useSegments';
@@ -1,2 +1,2 @@
1
- import type { SegmentsType } from '../types';
1
+ import type { SegmentsType } from '../../types';
2
2
  export default function useSegments(): [SegmentsType, (s: SegmentsType) => void];
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Hooks 统一导出
3
+ */
4
+ export { useChannel, usePoints, useSegments } from './data';
5
+ export { PUB_SUB, useMarkerPublish, usePublish, useSafePublish } from './publish';
6
+ export { SET_SEGMENTS_DISPLAY, type UseSpectrumChartTypeProps, useSpectrumChartType, useSpectrumRule } from './spectrum';
7
+ export { default as useChart } from './useChart';
8
+ export { type EnhancedPublish, withChartPublisher } from './useChartComponent';
9
+ export { default as useLevelStreamAnalyzer } from './useLevelStreamAnalyzer';
10
+ export { useModuleSubscription } from './useModuleSubscription';
11
+ export { useFilteredSeries, useSeriesForComponent, useSeriesManager } from './useSeriesManager';
12
+ export { default as useSpectrumAnalyzer } from './useSpectrumAnalyzer';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 发布相关 hooks
3
+ */
4
+ export { default as useMarkerPublish } from './useMarkerPublish';
5
+ export { default as usePublish, PUB_SUB } from './usePublish';
6
+ export { default as useSafePublish } from './useSafePublish';
@@ -1,4 +1,4 @@
1
- import type { PublishData } from '../types';
1
+ import type { PublishData } from '../../types';
2
2
  interface UseMarkerPublishProps {
3
3
  globalID: string;
4
4
  }
@@ -1,5 +1,5 @@
1
- import type { Publish } from '../types';
2
- import { type CSMCallback } from '../utils/subscription';
1
+ import type { Publish } from '../../types';
2
+ import { type CSMCallback } from '../../utils/subscription';
3
3
  export declare const PUB_SUB: (globalID: string, func?: CSMCallback) => (...args: any[]) => void;
4
4
  interface Props {
5
5
  subscribe?: CSMCallback;
@@ -1,8 +1,8 @@
1
- import type { Publish, PublishData } from '../index';
2
- import type { rawData } from '../utils/subscription';
1
+ import type { Publish, PublishData } from '../../index';
2
+ import type { rawData } from '../../utils/subscription';
3
3
  interface EnhancedPublish extends Publish {
4
4
  isReady: () => boolean;
5
- onReady: (callback: () => void | (() => void)) => void | (() => void);
5
+ onReady: (callback: () => undefined | (() => void)) => undefined | (() => void);
6
6
  getSourceData: () => rawData;
7
7
  }
8
8
  export interface UseSafePublishReturn {
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 频谱相关 hooks
3
+ */
4
+ export type { Props as UseSpectrumChartTypeProps } from './useSpectrumChartType';
5
+ export { default as useSpectrumChartType } from './useSpectrumChartType';
6
+ export { default as useSpectrumRule, SET_SEGMENTS_DISPLAY } from './useSpectrumRule';
@@ -1,4 +1,4 @@
1
- import { ChartType } from '../config';
1
+ import { ChartType } from '../../config';
2
2
  export interface Props {
3
3
  type: ChartType;
4
4
  heatmapElementID?: string;
@@ -1,4 +1,4 @@
1
- import { ChartType } from '../config';
2
- import type { PublishData, RecursiveFunction } from '../types';
1
+ import { ChartType } from '../../config';
2
+ import type { PublishData, RecursiveFunction } from '../../types';
3
3
  export declare const SET_SEGMENTS_DISPLAY: (globalID: string, func?: RecursiveFunction) => (...args: any[]) => void;
4
4
  export default function useSpectrumRule(type: ChartType): (e: PublishData) => void;
@@ -1,12 +1,21 @@
1
+ import type React from 'react';
1
2
  import type { RecursiveObject, RenderChartType } from '../../types';
2
- interface Props {
3
- Render: any;
3
+ /**
4
+ * Render 类构造函数类型
5
+ * 所有 render 类必须接受 id 和 globalID 参数,并实现 RenderChartType 接口
6
+ */
7
+ type RenderConstructor<T extends RenderChartType = RenderChartType> = new (props: {
8
+ id: string;
9
+ globalID: string;
10
+ } & RecursiveObject) => T;
11
+ interface Props<T extends RenderChartType = RenderChartType> {
12
+ Render: RenderConstructor<T>;
4
13
  params?: RecursiveObject;
5
14
  onIDChange?: (id: string) => void;
6
15
  }
7
- declare const useChart: (props: Props) => {
16
+ declare const useChart: <T extends RenderChartType = RenderChartType>(props: Props<T>) => {
8
17
  id: string;
9
- chart: RenderChartType;
10
- Chart: (e: any) => import("react/jsx-runtime").JSX.Element;
18
+ chart: T;
19
+ Chart: (e: React.HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
11
20
  };
12
21
  export default useChart;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * 通用拖拽框选 Hook
3
+ * 提炼自 HeatmapCapture/Slider 的框选能力
4
+ */
5
+ export type DragType = 'top' | 'bottom' | 'left' | 'right' | 'middle' | null;
6
+ export interface RectPosition {
7
+ position: number;
8
+ height: number;
9
+ leftPosition: number;
10
+ width: number;
11
+ }
12
+ export interface UseDragSelectConfig {
13
+ enabled?: boolean;
14
+ defaultRect?: Partial<RectPosition>;
15
+ minSize?: number;
16
+ maxSize?: number;
17
+ snapThreshold?: number;
18
+ onChange?: (rect: RectPosition) => void;
19
+ onDragEnd?: (rect: RectPosition) => void;
20
+ }
21
+ /**
22
+ * 通用拖拽框选 Hook
23
+ */
24
+ export declare const useDragSelect: (config?: UseDragSelectConfig) => {
25
+ rect: RectPosition;
26
+ isDragging: boolean;
27
+ dragType: DragType;
28
+ containerRef: import("react").RefObject<HTMLDivElement>;
29
+ handleMouseDown: (e: React.MouseEvent<HTMLDivElement>, type: DragType) => void;
30
+ resetRect: (newRect: Partial<RectPosition>) => void;
31
+ setRect: (newRect: RectPosition) => void;
32
+ };
@@ -0,0 +1,66 @@
1
+ import type { ModuleType } from '../config';
2
+ import type { PublishData } from '../types';
3
+ /**
4
+ * 模块订阅所需的图表接口(最小化)
5
+ */
6
+ interface ChartSubscriptionInterface<TData = unknown> {
7
+ updateSeries?(data: TData): void;
8
+ reset(): void;
9
+ resize(): void;
10
+ }
11
+ type DataExtractor<TData> = (d: PublishData) => TData;
12
+ type CustomHandler = (d: PublishData) => boolean | undefined;
13
+ interface UseModuleSubscriptionOptions<TData = unknown> {
14
+ /**
15
+ * 模块类型
16
+ */
17
+ moduleType: ModuleType;
18
+ /**
19
+ * 图表实例
20
+ */
21
+ chart: ChartSubscriptionInterface<TData> | null | undefined;
22
+ /**
23
+ * 从 PublishData 中提取数据(默认直接传递整个 d)
24
+ */
25
+ extractData?: DataExtractor<TData>;
26
+ /**
27
+ * 自定义处理器(返回 true 表示已处理,跳过默认逻辑)
28
+ */
29
+ customHandler?: CustomHandler;
30
+ }
31
+ /**
32
+ * 模块订阅 Hook
33
+ *
34
+ * 提供统一的数据订阅模式,处理 Render/Reset/Resize 事件
35
+ *
36
+ * @example
37
+ * // 基础用法
38
+ * useModuleSubscription({
39
+ * moduleType: ModuleType.Dial,
40
+ * chart
41
+ * });
42
+ *
43
+ * @example
44
+ * // 提取特定数据字段
45
+ * useModuleSubscription({
46
+ * moduleType: ModuleType.Occupancy,
47
+ * chart,
48
+ * extractData: (d) => d.data
49
+ * });
50
+ *
51
+ * @example
52
+ * // 自定义处理
53
+ * useModuleSubscription({
54
+ * moduleType: ModuleType.Heatmap,
55
+ * chart,
56
+ * customHandler: (d) => {
57
+ * if (d.pstype === PSType.Option) {
58
+ * // 自定义处理
59
+ * return true; // 已处理
60
+ * }
61
+ * return false; // 继续默认处理
62
+ * }
63
+ * });
64
+ */
65
+ export declare function useModuleSubscription<TData = unknown>({ moduleType, chart, extractData, customHandler }: UseModuleSubscriptionOptions<TData>): void;
66
+ export default useModuleSubscription;
@@ -3,4 +3,4 @@
3
3
  * 提供所有 series 相关的 hooks
4
4
  */
5
5
  export { useFilteredSeries } from './useFilteredSeries';
6
- export { useSeriesData, useSeriesForComponent, useSeriesManager } from './useSeriesManager';
6
+ export { useSeriesForComponent, useSeriesManager } from './useSeriesManager';
@@ -14,6 +14,6 @@ export declare function useFilteredSeries(globalID: string | undefined, filter?:
14
14
  color: string;
15
15
  thickness: number;
16
16
  display: boolean;
17
- type: import("../../engine").GraphicType;
17
+ type: import("@rfkit/renderer").GraphicType;
18
18
  }[];
19
19
  export default useFilteredSeries;
@@ -28,14 +28,6 @@ export interface UseSeriesManagerResult {
28
28
  * 统一的 Series 管理 Hook
29
29
  */
30
30
  export declare function useSeriesManager(globalID: string | undefined, options?: UseSeriesManagerOptions): UseSeriesManagerResult;
31
- /**
32
- * 轻量级版本 - 只获取数据,不订阅变化
33
- */
34
- export declare function useSeriesData(globalID: string | undefined): {
35
- series: Map<string, SeriesConfig>;
36
- mode: SeriesMode;
37
- getSeries: (name: string) => SeriesConfig | undefined;
38
- };
39
31
  /**
40
32
  * 专门用于组件的版本 - 自动订阅所有变化
41
33
  */
package/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  export { setFrequencyAllocationToCache } from './components/FrequencyAllocation/tools';
2
- export { ChartType, MarkerEventType, OptionKey, PSType, SegmentsEvent, SeriesType, ToolsBarItemType } from './config';
3
- export { default as useSafePublish } from './hooks/useSafePublish';
2
+ export { ChartType, FrequencyUnit, MarkerEventType, ModuleType, OptionKey, PSType, SegmentsEvent, SeriesType, ToolsBarItemType, ToolType } from './config';
3
+ export { type EnhancedPublish, useSafePublish, withChartPublisher } from './hooks';
4
4
  export { Dial, Gauge, Heatmap, IQ, LevelStream, Occupancy, Spectrum } from './lib';
5
5
  export type { AxisXProps, AxisYRange, ChartRef, FrequencyAllocationItem, MarkerProps, MarkerType, Publish, PublishData, PublishDial, PublishGauge, PublishHeatmap, PublishIQ, PublishLevelStream, PublishOccupancy, PublishSpectrum, RecursiveFunction, // 递归方法 后期会删除
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
9
  export { SignalDataType } from './types/store';
10
+ export { formatFrequencyUnit, formatFrequencyUnitFromHz, formatFrequencyUnitFromMHz } from './utils';
11
+ export type { FrequencyUnitResult } from './utils';