@rfkit/charts 1.1.10 → 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;
@@ -5814,6 +5817,7 @@ var type_GraphicType = /*#__PURE__*/ function(GraphicType1) {
5814
5817
  GraphicType1["Area"] = "area";
5815
5818
  return GraphicType1;
5816
5819
  }({});
5820
+ const ENABLE_AREA_GRADIENT = false;
5817
5821
  class Series extends engine_Engine {
5818
5822
  init(props) {
5819
5823
  super.init(props);
@@ -6033,10 +6037,12 @@ class Series extends engine_Engine {
6033
6037
  ctx.lineTo(endX, lastY);
6034
6038
  ctx.lineTo(endX, 0);
6035
6039
  ctx.closePath();
6036
- const gradient = ctx.createLinearGradient(0, 0, 0, height);
6037
- gradient.addColorStop(0, `rgba(${r}, ${g}, ${b}, 0)`);
6038
- gradient.addColorStop(1, `rgba(${r}, ${g}, ${b}, 0.5)`);
6039
- ctx.fillStyle = gradient;
6040
+ if (ENABLE_AREA_GRADIENT) {
6041
+ const gradient = ctx.createLinearGradient(0, 0, 0, height);
6042
+ gradient.addColorStop(0, `rgba(${r}, ${g}, ${b}, 0)`);
6043
+ gradient.addColorStop(1, `rgba(${r}, ${g}, ${b}, 0.5)`);
6044
+ ctx.fillStyle = gradient;
6045
+ } else ctx.fillStyle = `rgba(${r}, ${g}, ${b}, 1)`;
6040
6046
  ctx.fill();
6041
6047
  };
6042
6048
  for(let i = 0; i < len; i += 1){
@@ -7290,10 +7296,10 @@ const FrequencyDataBoard = ({ left, updateKey, onChange })=>{
7290
7296
  onChange
7291
7297
  ]);
7292
7298
  const sf = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
7293
- if (left && stationInfo.length > 0) {
7299
+ if (left && stationInfo.data.length > 0) {
7294
7300
  const f = Number(frequency);
7295
- const item = stationInfo.find((i)=>{
7296
- const yian = i.bandwidth / 500;
7301
+ const item = stationInfo.data.find((i)=>{
7302
+ const yian = i.bandwidth / 2 / 1000;
7297
7303
  const startFrequency = i.frequency - yian;
7298
7304
  const endFrequency = i.frequency + yian;
7299
7305
  return f >= startFrequency && f <= endFrequency;
@@ -9332,7 +9338,7 @@ class Range {
9332
9338
  if (isUP && isTop) newMax -= step;
9333
9339
  if (!isUP && !isTop) newMin += step;
9334
9340
  if (isUP && !isTop) newMin -= step;
9335
- const rangeMin = 4 * step;
9341
+ const rangeMin = 1;
9336
9342
  if (newMax <= newMin + rangeMin) {
9337
9343
  if (isTop) newMax = newMin + rangeMin;
9338
9344
  if (!isTop) newMin = newMax - rangeMin;
@@ -12759,6 +12765,8 @@ const SegmentContainer_SegmentContainer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_M
12759
12765
  const StationAllocation_SegmentContainer = SegmentContainer_SegmentContainer;
12760
12766
  const StationAllocation_StationAllocation = ({ show = true, display = true })=>{
12761
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;
12762
12770
  const currentFrequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>Number(frequencyFormat(left)), [
12763
12771
  left,
12764
12772
  frequencyFormat
@@ -12779,17 +12787,17 @@ const StationAllocation_StationAllocation = ({ show = true, display = true })=>{
12779
12787
  left
12780
12788
  ]);
12781
12789
  const segmentData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
12782
- if (!segments?.length || !stationInfo.length) return [];
12790
+ if (!segments?.length || !stationData.length) return [];
12783
12791
  return segments.map((segment, segmentIndex)=>{
12784
- const segmentStations = stationInfo.filter((station)=>{
12785
- const yian = station.bandwidth / 500;
12792
+ const segmentStations = stationData.filter((station)=>{
12793
+ const yian = station.bandwidth / 2 / 1000;
12786
12794
  const startFreq = station.frequency - yian;
12787
12795
  const stopFreq = station.frequency + yian;
12788
12796
  return !(stopFreq < segment.start || startFreq > segment.stop);
12789
12797
  });
12790
12798
  const stationPositions = segmentStations.map((station)=>{
12791
12799
  const totalRange = segment.stop - segment.start;
12792
- const yian = station.bandwidth / 500;
12800
+ const yian = station.bandwidth / 2 / 1000;
12793
12801
  const startFreq = station.frequency - yian;
12794
12802
  const stopFreq = station.frequency + yian;
12795
12803
  let startIndex = Math.ceil((startFreq - segment.start) / totalRange * segment.point) - 1;
@@ -12841,9 +12849,9 @@ const StationAllocation_StationAllocation = ({ show = true, display = true })=>{
12841
12849
  });
12842
12850
  }, [
12843
12851
  segments,
12844
- stationInfo
12852
+ stationData
12845
12853
  ]);
12846
- if (!show || !display || 0 === left) return null;
12854
+ if (!show || !shouldDisplay || 0 === left) return null;
12847
12855
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
12848
12856
  className: components_StationAllocation_styles_module.StationAllocation,
12849
12857
  children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
@@ -13435,6 +13443,39 @@ const TimeRange_Switch_Switch = ()=>{
13435
13443
  });
13436
13444
  };
13437
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;
13438
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");
13439
13480
  var Switch_styles_module_options = {};
13440
13481
  Switch_styles_module_options.styleTagTransform = styleTagTransform_default();
@@ -13565,7 +13606,7 @@ Dropdown_styles_module_options.domAPI = styleDomAPI_default();
13565
13606
  Dropdown_styles_module_options.insertStyleElement = insertStyleElement_default();
13566
13607
  injectStylesIntoStyleTag_default()(Dropdown_styles_module.Z, Dropdown_styles_module_options);
13567
13608
  const components_Dropdown_styles_module = Dropdown_styles_module.Z && Dropdown_styles_module.Z.locals ? Dropdown_styles_module.Z.locals : void 0;
13568
- const Dropdown_Dropdown = ({ value, options, onChange, placeholder = "\u8BF7\u9009\u62E9" })=>{
13609
+ const Dropdown = ({ value, options, onChange, placeholder = "\u8BF7\u9009\u62E9" })=>{
13569
13610
  const [isOpen, setIsOpen] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
13570
13611
  const handleSelect = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((value)=>{
13571
13612
  onChange(value);
@@ -13602,7 +13643,7 @@ const Dropdown_Dropdown = ({ value, options, onChange, placeholder = "\u8BF7\u90
13602
13643
  ]
13603
13644
  });
13604
13645
  };
13605
- const Dropdown = Dropdown_Dropdown;
13646
+ const components_Dropdown = Dropdown;
13606
13647
  function useChannel({ channel = 32, onChannelChange }) {
13607
13648
  const { state: { marker, globalID }, dispatch } = useStore_useStore();
13608
13649
  const channelList = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)([]);
@@ -13834,7 +13875,7 @@ const SegmentsDisplayControl_SegmentsDisplayControl = ()=>{
13834
13875
  label: `\u{9891}\u{6BB5} ${segment.start} - ${segment.stop}`
13835
13876
  }))
13836
13877
  ];
13837
- 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, {
13838
13879
  value: selectedIndex,
13839
13880
  options: options,
13840
13881
  onChange: handleSelect
@@ -13987,7 +14028,7 @@ SeriesDisplayControl_styles_module_options.domAPI = styleDomAPI_default();
13987
14028
  SeriesDisplayControl_styles_module_options.insertStyleElement = insertStyleElement_default();
13988
14029
  injectStylesIntoStyleTag_default()(SeriesDisplayControl_styles_module.Z, SeriesDisplayControl_styles_module_options);
13989
14030
  const ToolsBar_SeriesDisplayControl_styles_module = SeriesDisplayControl_styles_module.Z && SeriesDisplayControl_styles_module.Z.locals ? SeriesDisplayControl_styles_module.Z.locals : void 0;
13990
- const SeriesDisplayControl = ()=>{
14031
+ const SeriesDisplayControl_SeriesDisplayControl = ()=>{
13991
14032
  const { state: { globalID, series }, dispatch } = useStore_useStore();
13992
14033
  const { data, legendExternal, forceDisplay } = series;
13993
14034
  const seriesArray = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>Array.from(data.keys()).filter((name)=>!legendExternal.includes(name)).filter((name)=>name !== constants_SeriesType.TemplateData), [
@@ -14101,7 +14142,7 @@ const SeriesDisplayControl = ()=>{
14101
14142
  ]
14102
14143
  });
14103
14144
  };
14104
- const ToolsBar_SeriesDisplayControl = SeriesDisplayControl;
14145
+ const SeriesDisplayControl = SeriesDisplayControl_SeriesDisplayControl;
14105
14146
  const SpacerLine = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
14106
14147
  className: components_ToolsBar_styles_module.spacerLine
14107
14148
  });
@@ -14126,10 +14167,11 @@ const ToolsBar = ({ type })=>{
14126
14167
  type !== constants_ChartType.Heatmap && type !== constants_ChartType.ScanDF360 && type !== constants_ChartType.LevelStream && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Autoranging, {}),
14127
14168
  type !== constants_ChartType.ScanDF360 && type !== constants_ChartType.LevelStream && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(components_Unit, {}),
14128
14169
  type === constants_ChartType.Heatmap && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ToolsBar_GradientRibbon, {}),
14129
- 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, {}),
14130
14171
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Reset, {}),
14131
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, {
14132
14173
  children: [
14174
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(StationAllocation_Switch, {}),
14133
14175
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ToolsBar_SeriesControl, {}),
14134
14176
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(FrequencyAllocation_Switch, {}),
14135
14177
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Zoom_Switch, {}),
@@ -14146,7 +14188,7 @@ const ToolsBar = ({ type })=>{
14146
14188
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(TimeRange_Switch, {})
14147
14189
  ]
14148
14190
  }),
14149
- (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, {})
14150
14192
  ]
14151
14193
  })
14152
14194
  });
@@ -14865,7 +14907,7 @@ function useTemplateComparison() {
14865
14907
  };
14866
14908
  }
14867
14909
  function useSpectrumAnalyzer(props) {
14868
- 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();
14869
14911
  const analyzer = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
14870
14912
  const globalIDRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(globalID);
14871
14913
  const intervalRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(interval);
@@ -14938,10 +14980,15 @@ function useSpectrumAnalyzer(props) {
14938
14980
  if (!data) return;
14939
14981
  if (globalIDRef.current) dispatch({
14940
14982
  payload: {
14941
- stationInfo: data
14983
+ stationInfo: {
14984
+ ...stationInfo,
14985
+ data: data
14986
+ }
14942
14987
  }
14943
14988
  });
14944
- }, []);
14989
+ }, [
14990
+ stationInfo
14991
+ ]);
14945
14992
  const heatmapCaptureDisplayRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(heatmapCaptureDisplay);
14946
14993
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
14947
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.10",
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;