@rfkit/charts 1.6.0 → 1.8.0

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.
@@ -1,2 +1,2 @@
1
- declare const Dial: () => import("react/jsx-runtime").JSX.Element;
1
+ declare const Dial: () => import("react").JSX.Element;
2
2
  export default Dial;
@@ -2,5 +2,5 @@ import { type IQChartType } from '../base';
2
2
  interface IQEyeProps {
3
3
  type?: IQChartType;
4
4
  }
5
- export default function IQEye({ type }: IQEyeProps): import("react/jsx-runtime").JSX.Element;
5
+ export default function IQEye({ type }: IQEyeProps): import("react").JSX.Element;
6
6
  export {};
@@ -2,5 +2,5 @@ import { type IQChartType } from '../base';
2
2
  interface IQPlanisphereProps {
3
3
  type?: IQChartType;
4
4
  }
5
- export default function IQPlanisphere({ type }: IQPlanisphereProps): import("react/jsx-runtime").JSX.Element;
5
+ export default function IQPlanisphere({ type }: IQPlanisphereProps): import("react").JSX.Element;
6
6
  export {};
@@ -2,5 +2,5 @@ import type { RenderChartType } from '../../../types';
2
2
  interface AxisYCanvasProps {
3
3
  chart: RenderChartType | null;
4
4
  }
5
- export default function AxisYCanvas(props: AxisYCanvasProps): import("react/jsx-runtime").JSX.Element | null;
5
+ export default function AxisYCanvas(props: AxisYCanvasProps): import("react").JSX.Element | null;
6
6
  export {};
@@ -0,0 +1,23 @@
1
+ interface AxisYCanvasHorizontalLayoutOptions {
2
+ axisLineWidth: number;
3
+ inside: boolean;
4
+ width: number;
5
+ }
6
+ export declare const resolveAxisYCanvasHorizontalLayout: ({ axisLineWidth, inside, width }: AxisYCanvasHorizontalLayoutOptions) => {
7
+ axisX: number;
8
+ majorTickEndX: number;
9
+ majorTickStartX: number;
10
+ minorTickEndX: number;
11
+ minorTickStartX: number;
12
+ textAlign: "left";
13
+ textX: number;
14
+ } | {
15
+ axisX: number;
16
+ majorTickEndX: number;
17
+ majorTickStartX: number;
18
+ minorTickEndX: number;
19
+ minorTickStartX: number;
20
+ textAlign: "right";
21
+ textX: number;
22
+ };
23
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { SegmentType } from '../../../types/common.ts';
2
+ import { type BandState } from '../../../types/store/ui.ts';
3
+ export { resolveBandState } from '../../../store/bandState.ts';
4
+ export interface BandPosition {
5
+ key: string;
6
+ left: number;
7
+ width: number;
8
+ }
9
+ export declare function resolveBandPositions(band: BandState, segments: SegmentType[]): BandPosition[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rfkit/charts",
3
- "version": "1.6.0",
3
+ "version": "1.8.0",
4
4
  "type": "module",
5
5
  "description": "Chart components for wireless monitoring web applications",
6
6
  "exports": {
@@ -0,0 +1,7 @@
1
+ import { type BandState } from '../types/store/ui.ts';
2
+ export type BandUpdateStrategy = 'merge' | 'replace';
3
+ /**
4
+ * 将 prop / publish 的 Band 输入归一化为唯一内部状态。
5
+ * 无效输入返回当前状态引用,避免破坏已生效的 Band。
6
+ */
7
+ export declare function resolveBandState(input: Record<string, unknown>, current?: BandState, strategy?: BandUpdateStrategy): BandState;
@@ -111,9 +111,9 @@ export interface PointsEvent {
111
111
  pstype: 'points';
112
112
  data: number[];
113
113
  }
114
- export interface BandEvent extends BandProps {
114
+ export type BandEvent = BandProps & {
115
115
  pstype: 'band';
116
- }
116
+ };
117
117
  export interface ScopeEvent extends RecursiveObject {
118
118
  pstype: 'scope';
119
119
  frequency: number;
@@ -1,6 +1,8 @@
1
+ import type { AxisPlacement } from '../../config';
1
2
  import type { AxisYRange, RecursiveObject } from '..';
2
3
  export interface AxisYProps {
3
4
  show?: boolean;
5
+ placement?: AxisPlacement;
4
6
  disabled?: boolean;
5
7
  gradientRibbon?: boolean;
6
8
  realRange?: number[];
@@ -24,7 +24,7 @@ import type { HeatmapCaptureProps } from './heatmap';
24
24
  import type { MarkerProps } from './marker';
25
25
  import type { LevelStreamProps, SeriesProps } from './series';
26
26
  import type { SignalAnalysisProps, SignalProps } from './signal';
27
- import type { BandProps, BlazeProps, CursorProps, DeltaMeasurementProps, EventBusProps, FluorescenceProps, FrequencyTagLineBoardProps, LegendProps, LimitProps, ScopeProps, StripeProps, SystemConfig, ToolbarProps, ZoomProps } from './ui';
27
+ import type { BandProps, BandState, BlazeProps, CursorProps, DeltaMeasurementProps, EventBusProps, FluorescenceProps, FrequencyTagLineBoardProps, LegendProps, LimitProps, ScopeProps, StripeProps, SystemConfig, ToolbarProps, ZoomProps } from './ui';
28
28
  export interface StoreState {
29
29
  globalID: string;
30
30
  config: unknown;
@@ -43,7 +43,7 @@ export interface StoreState {
43
43
  zoom: ZoomProps;
44
44
  signal: SignalProps;
45
45
  signalAnalysis: SignalAnalysisProps;
46
- band: BandProps;
46
+ band: BandState;
47
47
  scope: ScopeProps;
48
48
  gridLines: boolean;
49
49
  legend: LegendProps;
@@ -89,7 +89,7 @@ export interface ParamsProps {
89
89
  frequencyTagLine?: Partial<FrequencyTagLineBoardProps>;
90
90
  frequencyAllocation?: Partial<FrequencyAllocationProps>;
91
91
  toolbar?: Partial<ToolbarProps>;
92
- band?: Partial<BandProps>;
92
+ band?: BandProps;
93
93
  levelStream?: Partial<LevelStreamProps>;
94
94
  deltaMeasurement?: Partial<DeltaMeasurementProps>;
95
95
  publish?: Publish;
@@ -53,12 +53,62 @@ export interface ZoomProps {
53
53
  onChange: (se: [string, string], interval: AxisXRange) => void;
54
54
  autoCloseTimeout: number;
55
55
  }
56
- export interface BandProps {
56
+ type BandSharedProps = {
57
+ show?: boolean;
58
+ color?: string;
59
+ };
60
+ type BandPositionProps = {
61
+ left?: number;
62
+ width?: number;
63
+ frequency?: never;
64
+ bandwidth?: never;
65
+ startFrequency?: never;
66
+ stopFrequency?: never;
67
+ };
68
+ type BandCenterBandwidthProps = {
69
+ frequency: number;
70
+ bandwidth: number;
71
+ left?: never;
72
+ width?: never;
73
+ startFrequency?: never;
74
+ stopFrequency?: never;
75
+ };
76
+ type BandFrequencyRangeProps = {
77
+ startFrequency: number;
78
+ stopFrequency: number;
79
+ left?: never;
80
+ width?: never;
81
+ frequency?: never;
82
+ bandwidth?: never;
83
+ };
84
+ /** Band 对外配置:百分比、中心频率带宽、起止频率三种定位方式互斥。 */
85
+ export type BandProps = BandSharedProps & (BandPositionProps | BandCenterBandwidthProps | BandFrequencyRangeProps);
86
+ export declare const BandKind: {
87
+ readonly Position: "position";
88
+ readonly CenterBandwidth: "centerBandwidth";
89
+ readonly FrequencyRange: "frequencyRange";
90
+ };
91
+ export type BandKind = (typeof BandKind)[keyof typeof BandKind];
92
+ /** Band 内部归一化状态。 */
93
+ export type BandState = {
94
+ kind: typeof BandKind.Position;
57
95
  show: boolean;
96
+ color?: string;
58
97
  left?: number;
59
98
  width: number;
99
+ } | {
100
+ kind: typeof BandKind.CenterBandwidth;
101
+ show: boolean;
60
102
  color?: string;
61
- }
103
+ frequency: number;
104
+ bandwidth: number;
105
+ } | {
106
+ kind: typeof BandKind.FrequencyRange;
107
+ show: boolean;
108
+ color?: string;
109
+ startFrequency: number;
110
+ stopFrequency: number;
111
+ };
62
112
  export interface ScopeProps {
63
113
  show: boolean;
64
114
  left: number;
@@ -112,3 +162,4 @@ export interface EventBusProps {
112
162
  onDoubleClick: (frequency: string, e: RecursiveObject) => void;
113
163
  [key: string]: unknown;
114
164
  }
165
+ export {};
package/utils/object.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import type { RecursiveObject } from '../types';
5
5
  /**
6
- * 混合对象 - 将参数对象合并到源对象中
6
+ * 混合对象 - 将参数对象合并到源对象副本中
7
7
  * @param source 源对象
8
8
  * @param params 要混合的参数
9
9
  * @returns 混合后的对象