@rfkit/charts 1.1.11 → 1.1.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.
@@ -0,0 +1,3 @@
1
+ import type React from 'react';
2
+ declare const StationAllocationSwitch: React.FC;
3
+ export default StationAllocationSwitch;
package/index.js CHANGED
@@ -4308,7 +4308,10 @@ function defaultState_createParams() {
4308
4308
  cacheTime: 20000,
4309
4309
  granularity: 1
4310
4310
  },
4311
- stationInfo: []
4311
+ stationInfo: {
4312
+ show: true,
4313
+ data: []
4314
+ }
4312
4315
  };
4313
4316
  }
4314
4317
  const R = 50.0;
@@ -7293,10 +7296,10 @@ const FrequencyDataBoard = ({ left, updateKey, onChange })=>{
7293
7296
  onChange
7294
7297
  ]);
7295
7298
  const sf = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
7296
- if (left && stationInfo.length > 0) {
7299
+ if (left && stationInfo.data.length > 0) {
7297
7300
  const f = Number(frequency);
7298
- const item = stationInfo.find((i)=>{
7299
- const yian = i.bandwidth / 500;
7301
+ const item = stationInfo.data.find((i)=>{
7302
+ const yian = i.bandwidth / 2 / 1000;
7300
7303
  const startFrequency = i.frequency - yian;
7301
7304
  const endFrequency = i.frequency + yian;
7302
7305
  return f >= startFrequency && f <= endFrequency;
@@ -9335,7 +9338,7 @@ class Range {
9335
9338
  if (isUP && isTop) newMax -= step;
9336
9339
  if (!isUP && !isTop) newMin += step;
9337
9340
  if (isUP && !isTop) newMin -= step;
9338
- const rangeMin = 4 * step;
9341
+ const rangeMin = 1;
9339
9342
  if (newMax <= newMin + rangeMin) {
9340
9343
  if (isTop) newMax = newMin + rangeMin;
9341
9344
  if (!isTop) newMin = newMax - rangeMin;
@@ -12762,6 +12765,8 @@ const SegmentContainer_SegmentContainer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_M
12762
12765
  const StationAllocation_SegmentContainer = SegmentContainer_SegmentContainer;
12763
12766
  const StationAllocation_StationAllocation = ({ show = true, display = true })=>{
12764
12767
  const { state: { segments, axisX: { frequencyFormat }, zoom: { style: zoomOffStyle }, cursor: { coord: { left } }, stationInfo } } = useStore_useStore();
12768
+ const stationData = stationInfo.data;
12769
+ const shouldDisplay = stationInfo.show && display;
12765
12770
  const currentFrequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>Number(frequencyFormat(left)), [
12766
12771
  left,
12767
12772
  frequencyFormat
@@ -12782,17 +12787,17 @@ const StationAllocation_StationAllocation = ({ show = true, display = true })=>{
12782
12787
  left
12783
12788
  ]);
12784
12789
  const segmentData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
12785
- if (!segments?.length || !stationInfo.length) return [];
12790
+ if (!segments?.length || !stationData.length) return [];
12786
12791
  return segments.map((segment, segmentIndex)=>{
12787
- const segmentStations = stationInfo.filter((station)=>{
12788
- const yian = station.bandwidth / 500;
12792
+ const segmentStations = stationData.filter((station)=>{
12793
+ const yian = station.bandwidth / 2 / 1000;
12789
12794
  const startFreq = station.frequency - yian;
12790
12795
  const stopFreq = station.frequency + yian;
12791
12796
  return !(stopFreq < segment.start || startFreq > segment.stop);
12792
12797
  });
12793
12798
  const stationPositions = segmentStations.map((station)=>{
12794
12799
  const totalRange = segment.stop - segment.start;
12795
- const yian = station.bandwidth / 500;
12800
+ const yian = station.bandwidth / 2 / 1000;
12796
12801
  const startFreq = station.frequency - yian;
12797
12802
  const stopFreq = station.frequency + yian;
12798
12803
  let startIndex = Math.ceil((startFreq - segment.start) / totalRange * segment.point) - 1;
@@ -12844,9 +12849,9 @@ const StationAllocation_StationAllocation = ({ show = true, display = true })=>{
12844
12849
  });
12845
12850
  }, [
12846
12851
  segments,
12847
- stationInfo
12852
+ stationData
12848
12853
  ]);
12849
- if (!show || !display || 0 === left) return null;
12854
+ if (!show || !shouldDisplay || 0 === left) return null;
12850
12855
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
12851
12856
  className: components_StationAllocation_styles_module.StationAllocation,
12852
12857
  children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
@@ -13438,6 +13443,39 @@ const TimeRange_Switch_Switch = ()=>{
13438
13443
  });
13439
13444
  };
13440
13445
  const TimeRange_Switch = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].memo(TimeRange_Switch_Switch);
13446
+ const StationAllocationSwitch = ()=>{
13447
+ const { state: { stationInfo }, dispatch } = useStore_useStore();
13448
+ const { show } = stationInfo;
13449
+ const setActive = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((e)=>{
13450
+ dispatch({
13451
+ payload: {
13452
+ stationInfo: {
13453
+ ...stationInfo,
13454
+ show: !!e
13455
+ }
13456
+ }
13457
+ });
13458
+ }, [
13459
+ stationInfo,
13460
+ dispatch
13461
+ ]);
13462
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ToolsBar_IconBox, {
13463
+ onClick: ()=>{
13464
+ setActive(!show);
13465
+ },
13466
+ title: "\u4FE1\u53F7\u663E\u793A",
13467
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("svg", {
13468
+ viewBox: "0 0 1024 1024",
13469
+ xmlns: "http://www.w3.org/2000/svg",
13470
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
13471
+ fill: show ? 'var(--theme-color-primary)' : 'var(--theme-color-base)',
13472
+ d: "M563.072 376.48a79.456 79.456 0 0 0 28.928-61.12 80 80 0 1 0-160 0c0 24.672 11.392 46.432 28.928 61.12l-202.88 540.256a32 32 0 1 0 59.904 22.496l49.28-131.264h289.504l49.28 131.264a32.064 32.064 0 0 0 41.248 18.752c16.544-6.208 24.896-24.672 18.72-41.216l-202.912-540.288z m-1.312 178.624h-99.552L512 422.56l49.76 132.544z m-170.464 188.896l46.912-124.896h147.616l46.912 124.896h-241.44zM662.464 417.408a32 32 0 1 0 53.12 35.648 254.72 254.72 0 0 0 43.136-142.304 255.04 255.04 0 0 0-43.136-142.304 32 32 0 1 0-53.12 35.68 190.944 190.944 0 0 1 32.288 106.624 190.816 190.816 0 0 1-32.288 106.656zM289.888 453.024a32 32 0 1 0 53.184-35.616 191.36 191.36 0 0 1-32.32-106.656 191.328 191.328 0 0 1 32.32-106.656 32.064 32.064 0 0 0-8.768-44.416 32.096 32.096 0 0 0-44.416 8.768 254.976 254.976 0 0 0-43.136 142.304 254.976 254.976 0 0 0 43.136 142.272zM210.656 117.12A32 32 0 1 0 157.44 81.536a420.032 420.032 0 0 0-70.848 233.824 419.744 419.744 0 0 0 70.88 233.856 31.936 31.936 0 0 0 44.416 8.768 32 32 0 0 0 8.768-44.416 355.168 355.168 0 0 1-60.032-198.24A355.36 355.36 0 0 1 210.656 117.12zM896.224 154.304a416.96 416.96 0 0 0-38.912-72.768 32 32 0 1 0-53.184 35.584 354.912 354.912 0 0 1 60.064 198.24 355.2 355.2 0 0 1-60.064 198.208 32.032 32.032 0 0 0 53.184 35.648 418.816 418.816 0 0 0 70.88-233.856c0-55.68-10.752-109.856-31.968-161.056z",
13473
+ "p-id": "11215"
13474
+ })
13475
+ })
13476
+ });
13477
+ };
13478
+ const StationAllocation_Switch = StationAllocationSwitch;
13441
13479
  var Switch_styles_module = __webpack_require__("../../../../node_modules/.pnpm/@rsbuild+core@1.3.18/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[11].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[11].use[2]!../../../../node_modules/.pnpm/@rsbuild+plugin-less@1.3.1_@rsbuild+core@1.4.12/node_modules/@rsbuild/plugin-less/compiled/less-loader/index.js??ruleSet[1].rules[11].use[3]!./src/components/Zoom/Switch/styles.module.less");
13442
13480
  var Switch_styles_module_options = {};
13443
13481
  Switch_styles_module_options.styleTagTransform = styleTagTransform_default();
@@ -13568,7 +13606,7 @@ Dropdown_styles_module_options.domAPI = styleDomAPI_default();
13568
13606
  Dropdown_styles_module_options.insertStyleElement = insertStyleElement_default();
13569
13607
  injectStylesIntoStyleTag_default()(Dropdown_styles_module.Z, Dropdown_styles_module_options);
13570
13608
  const components_Dropdown_styles_module = Dropdown_styles_module.Z && Dropdown_styles_module.Z.locals ? Dropdown_styles_module.Z.locals : void 0;
13571
- const Dropdown_Dropdown = ({ value, options, onChange, placeholder = "\u8BF7\u9009\u62E9" })=>{
13609
+ const Dropdown = ({ value, options, onChange, placeholder = "\u8BF7\u9009\u62E9" })=>{
13572
13610
  const [isOpen, setIsOpen] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
13573
13611
  const handleSelect = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((value)=>{
13574
13612
  onChange(value);
@@ -13605,7 +13643,7 @@ const Dropdown_Dropdown = ({ value, options, onChange, placeholder = "\u8BF7\u90
13605
13643
  ]
13606
13644
  });
13607
13645
  };
13608
- const Dropdown = Dropdown_Dropdown;
13646
+ const components_Dropdown = Dropdown;
13609
13647
  function useChannel({ channel = 32, onChannelChange }) {
13610
13648
  const { state: { marker, globalID }, dispatch } = useStore_useStore();
13611
13649
  const channelList = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)([]);
@@ -13837,7 +13875,7 @@ const SegmentsDisplayControl_SegmentsDisplayControl = ()=>{
13837
13875
  label: `\u{9891}\u{6BB5} ${segment.start} - ${segment.stop}`
13838
13876
  }))
13839
13877
  ];
13840
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Dropdown, {
13878
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(components_Dropdown, {
13841
13879
  value: selectedIndex,
13842
13880
  options: options,
13843
13881
  onChange: handleSelect
@@ -13990,7 +14028,7 @@ SeriesDisplayControl_styles_module_options.domAPI = styleDomAPI_default();
13990
14028
  SeriesDisplayControl_styles_module_options.insertStyleElement = insertStyleElement_default();
13991
14029
  injectStylesIntoStyleTag_default()(SeriesDisplayControl_styles_module.Z, SeriesDisplayControl_styles_module_options);
13992
14030
  const ToolsBar_SeriesDisplayControl_styles_module = SeriesDisplayControl_styles_module.Z && SeriesDisplayControl_styles_module.Z.locals ? SeriesDisplayControl_styles_module.Z.locals : void 0;
13993
- const SeriesDisplayControl = ()=>{
14031
+ const SeriesDisplayControl_SeriesDisplayControl = ()=>{
13994
14032
  const { state: { globalID, series }, dispatch } = useStore_useStore();
13995
14033
  const { data, legendExternal, forceDisplay } = series;
13996
14034
  const seriesArray = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>Array.from(data.keys()).filter((name)=>!legendExternal.includes(name)).filter((name)=>name !== constants_SeriesType.TemplateData), [
@@ -14104,7 +14142,7 @@ const SeriesDisplayControl = ()=>{
14104
14142
  ]
14105
14143
  });
14106
14144
  };
14107
- const ToolsBar_SeriesDisplayControl = SeriesDisplayControl;
14145
+ const SeriesDisplayControl = SeriesDisplayControl_SeriesDisplayControl;
14108
14146
  const SpacerLine = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
14109
14147
  className: components_ToolsBar_styles_module.spacerLine
14110
14148
  });
@@ -14129,10 +14167,11 @@ const ToolsBar = ({ type })=>{
14129
14167
  type !== constants_ChartType.Heatmap && type !== constants_ChartType.ScanDF360 && type !== constants_ChartType.LevelStream && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Autoranging, {}),
14130
14168
  type !== constants_ChartType.ScanDF360 && type !== constants_ChartType.LevelStream && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(components_Unit, {}),
14131
14169
  type === constants_ChartType.Heatmap && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ToolsBar_GradientRibbon, {}),
14132
- type !== constants_ChartType.ScanDF360 && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ToolsBar_SpacerLine, {}),
14170
+ type !== constants_ChartType.ScanDF360 && type !== constants_ChartType.LevelStream && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ToolsBar_SpacerLine, {}),
14133
14171
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Reset, {}),
14134
14172
  (type === constants_ChartType.SingleFrequency || type === constants_ChartType.Scan || type === constants_ChartType.MScan) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
14135
14173
  children: [
14174
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(StationAllocation_Switch, {}),
14136
14175
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ToolsBar_SeriesControl, {}),
14137
14176
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(FrequencyAllocation_Switch, {}),
14138
14177
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Zoom_Switch, {}),
@@ -14149,7 +14188,7 @@ const ToolsBar = ({ type })=>{
14149
14188
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(TimeRange_Switch, {})
14150
14189
  ]
14151
14190
  }),
14152
- (type === constants_ChartType.SingleFrequency || type === constants_ChartType.Scan || type === constants_ChartType.MScan) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ToolsBar_SeriesDisplayControl, {})
14191
+ (type === constants_ChartType.SingleFrequency || type === constants_ChartType.Scan || type === constants_ChartType.MScan) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SeriesDisplayControl, {})
14153
14192
  ]
14154
14193
  })
14155
14194
  });
@@ -14868,7 +14907,7 @@ function useTemplateComparison() {
14868
14907
  };
14869
14908
  }
14870
14909
  function useSpectrumAnalyzer(props) {
14871
- const { state: { globalID, series: { enableMetrics, enableWaterfall }, axisY: { unit }, zoom: { interval }, heatmapCapture: { display: heatmapCaptureDisplay }, system: { width } }, dispatch } = useStore_useStore();
14910
+ const { state: { globalID, series: { enableMetrics, enableWaterfall }, axisY: { unit }, zoom: { interval }, heatmapCapture: { display: heatmapCaptureDisplay }, system: { width }, stationInfo }, dispatch } = useStore_useStore();
14872
14911
  const analyzer = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
14873
14912
  const globalIDRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(globalID);
14874
14913
  const intervalRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(interval);
@@ -14941,10 +14980,15 @@ function useSpectrumAnalyzer(props) {
14941
14980
  if (!data) return;
14942
14981
  if (globalIDRef.current) dispatch({
14943
14982
  payload: {
14944
- stationInfo: data
14983
+ stationInfo: {
14984
+ ...stationInfo,
14985
+ data: data
14986
+ }
14945
14987
  }
14946
14988
  });
14947
- }, []);
14989
+ }, [
14990
+ stationInfo
14991
+ ]);
14948
14992
  const heatmapCaptureDisplayRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(heatmapCaptureDisplay);
14949
14993
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
14950
14994
  heatmapCaptureDisplayRef.current = heatmapCaptureDisplay;
package/package.json CHANGED
@@ -5,6 +5,6 @@
5
5
  "types": "index.d.ts",
6
6
  "author": "Hxgh",
7
7
  "license": "MIT",
8
- "version": "1.1.11",
8
+ "version": "1.1.12",
9
9
  "private": false
10
10
  }
package/types/store.d.ts CHANGED
@@ -226,7 +226,10 @@ export interface EventBusProps {
226
226
  onDoubleClick: (frequency: string, e: RecursiveObject) => void;
227
227
  [key: string]: unknown;
228
228
  }
229
- export type StationInfoProps = StationInfoType[];
229
+ export interface StationInfoProps {
230
+ show: boolean;
231
+ data: StationInfoType[];
232
+ }
230
233
  export interface StoreState {
231
234
  globalID: string;
232
235
  config: unknown;