@rfkit/charts 1.2.14 → 1.2.15

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
  };
@@ -14744,9 +14761,12 @@ const Signal = ({ show = true, display = true })=>{
14744
14761
  const { state: { globalID, segments, axisX: { frequencyFormat }, zoom: { style: zoomOffStyle }, cursor: { coord: { left } }, signal } } = useStore_useStore();
14745
14762
  const [updateTrigger, setUpdateTrigger] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(0);
14746
14763
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
14747
- const unsubscribe = withStationDataUpdate(globalID, `Signal-${globalID}`, ()=>{
14764
+ const subscriberName = `Signal-${globalID}-${Date.now()}`;
14765
+ const unsubscribe = withStationDataUpdate(globalID, subscriberName, ()=>{
14748
14766
  setUpdateTrigger((prev)=>prev + 1);
14749
14767
  });
14768
+ const existingData = STATION_DATA(globalID);
14769
+ if (existingData && existingData.length > 0) setUpdateTrigger((prev)=>prev + 1);
14750
14770
  return ()=>{
14751
14771
  if ('function' == typeof unsubscribe) unsubscribe();
14752
14772
  };
@@ -15984,15 +16004,13 @@ function useSpectrumChartType({ type, heatmapElementID }) {
15984
16004
  globalID
15985
16005
  ]);
15986
16006
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
15987
- if (type === constants_ChartType.SingleFrequency) signal.show = false;
16007
+ constants_ChartType.SingleFrequency;
15988
16008
  if (type === constants_ChartType.DDC) {
15989
16009
  limit.show = false;
15990
- signal.show = false;
15991
16010
  marker.visible = true;
15992
16011
  }
15993
16012
  if (type === constants_ChartType.Lite) {
15994
16013
  limit.show = false;
15995
- signal.show = false;
15996
16014
  marker.enabled = false;
15997
16015
  }
15998
16016
  if (type === constants_ChartType.LiteNormalized) {
@@ -16007,7 +16025,6 @@ function useSpectrumChartType({ type, heatmapElementID }) {
16007
16025
  }
16008
16026
  if (type === constants_ChartType.MScan) {
16009
16027
  limit.show = false;
16010
- signal.show = false;
16011
16028
  frequencyAllocation.show = false;
16012
16029
  }
16013
16030
  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.15",
9
9
  "private": false
10
10
  }