@rfkit/charts 1.2.14 → 1.2.16

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.
@@ -3,7 +3,7 @@ export interface Props {
3
3
  type: ChartType;
4
4
  heatmapElementID?: string;
5
5
  }
6
- export default function useSpectrumChartType({ type, heatmapElementID }: Props): {
6
+ export default function useSpectrumChartType({ type, heatmapElementID, }: Props): {
7
7
  enableMetrics: boolean;
8
8
  enableWaterfall: boolean;
9
9
  };
package/index.js CHANGED
@@ -7559,10 +7559,24 @@ const ZoomOffsetContainer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.
7559
7559
  });
7560
7560
  });
7561
7561
  const Zoom_ZoomOffsetContainer = ZoomOffsetContainer;
7562
- const withStationDataUpdate = (globalID, name, func)=>subscription_createSubscriptionManager(`stationData-update-${globalID}`, name, func);
7562
+ const withStationDataUpdate = (globalID, name, func)=>{
7563
+ const subscriptionId = `stationData-update-${globalID}`;
7564
+ if (name && func) {
7565
+ subscription_createSubscriptionManager(subscriptionId, name, func);
7566
+ return ()=>{
7567
+ const k = 'charts';
7568
+ const c = window[k];
7569
+ if (c?.subscriptions?.[subscriptionId]?.[name]) delete c.subscriptions[subscriptionId][name];
7570
+ };
7571
+ }
7572
+ return subscription_createSubscriptionManager(subscriptionId);
7573
+ };
7563
7574
  const STATION_DATA = (globalID, data)=>{
7564
7575
  const result = subscription_openData(`stationData-${globalID}`, data, []);
7565
- if (void 0 !== data) withStationDataUpdate(globalID, 'trigger', ()=>result);
7576
+ if (void 0 !== data) {
7577
+ const triggerUpdate = withStationDataUpdate(globalID);
7578
+ triggerUpdate(result);
7579
+ }
7566
7580
  return result;
7567
7581
  };
7568
7582
  function isStationInfo(item) {
@@ -7580,9 +7594,12 @@ function useStationFinder({ frequency }) {
7580
7594
  const { state: { globalID, cursor: { coord: { left } }, segments, signal } } = useStore_useStore();
7581
7595
  const [updateTrigger, setUpdateTrigger] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(0);
7582
7596
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
7583
- const unsubscribe = withStationDataUpdate(globalID, `useStationFinder-${globalID}`, ()=>{
7597
+ const subscriberName = `useStationFinder-${globalID}-${Date.now()}`;
7598
+ const unsubscribe = withStationDataUpdate(globalID, subscriberName, ()=>{
7584
7599
  setUpdateTrigger((prev)=>prev + 1);
7585
7600
  });
7601
+ const existingData = STATION_DATA(globalID);
7602
+ if (existingData && existingData.length > 0) setUpdateTrigger((prev)=>prev + 1);
7586
7603
  return ()=>{
7587
7604
  if ('function' == typeof unsubscribe) unsubscribe();
7588
7605
  };
@@ -11146,6 +11163,7 @@ const Signal_Switch_Switch = ()=>{
11146
11163
  signal,
11147
11164
  dispatch
11148
11165
  ]);
11166
+ console.log('shouldShow', isActive, shouldShow);
11149
11167
  if (!shouldShow) return null;
11150
11168
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ToolsBar_IconBox, {
11151
11169
  onClick: ()=>{
@@ -11926,7 +11944,8 @@ const TOOL_CONFIGS = [
11926
11944
  supportedCharts: [
11927
11945
  constants_ChartType.SingleFrequency,
11928
11946
  constants_ChartType.Scan,
11929
- constants_ChartType.MScan
11947
+ constants_ChartType.MScan,
11948
+ constants_ChartType.DDC
11930
11949
  ]
11931
11950
  },
11932
11951
  {
@@ -14744,9 +14763,12 @@ const Signal = ({ show = true, display = true })=>{
14744
14763
  const { state: { globalID, segments, axisX: { frequencyFormat }, zoom: { style: zoomOffStyle }, cursor: { coord: { left } }, signal } } = useStore_useStore();
14745
14764
  const [updateTrigger, setUpdateTrigger] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(0);
14746
14765
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
14747
- const unsubscribe = withStationDataUpdate(globalID, `Signal-${globalID}`, ()=>{
14766
+ const subscriberName = `Signal-${globalID}-${Date.now()}`;
14767
+ const unsubscribe = withStationDataUpdate(globalID, subscriberName, ()=>{
14748
14768
  setUpdateTrigger((prev)=>prev + 1);
14749
14769
  });
14770
+ const existingData = STATION_DATA(globalID);
14771
+ if (existingData && existingData.length > 0) setUpdateTrigger((prev)=>prev + 1);
14750
14772
  return ()=>{
14751
14773
  if ('function' == typeof unsubscribe) unsubscribe();
14752
14774
  };
@@ -15984,15 +16006,13 @@ function useSpectrumChartType({ type, heatmapElementID }) {
15984
16006
  globalID
15985
16007
  ]);
15986
16008
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
15987
- if (type === constants_ChartType.SingleFrequency) signal.show = false;
16009
+ constants_ChartType.SingleFrequency;
15988
16010
  if (type === constants_ChartType.DDC) {
15989
16011
  limit.show = false;
15990
- signal.show = false;
15991
16012
  marker.visible = true;
15992
16013
  }
15993
16014
  if (type === constants_ChartType.Lite) {
15994
16015
  limit.show = false;
15995
- signal.show = false;
15996
16016
  marker.enabled = false;
15997
16017
  }
15998
16018
  if (type === constants_ChartType.LiteNormalized) {
@@ -16007,7 +16027,6 @@ function useSpectrumChartType({ type, heatmapElementID }) {
16007
16027
  }
16008
16028
  if (type === constants_ChartType.MScan) {
16009
16029
  limit.show = false;
16010
- signal.show = false;
16011
16030
  frequencyAllocation.show = false;
16012
16031
  }
16013
16032
  if (type === constants_ChartType.ScanDF360) {
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.2.14",
8
+ "version": "1.2.16",
9
9
  "private": false
10
10
  }