@rfkit/charts 1.2.13 → 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.
|
@@ -6,5 +6,5 @@ interface UseAllocationFinderProps {
|
|
|
6
6
|
* 频率划分查找 Hook
|
|
7
7
|
* 基于当前频率,在频率划分数据中查找匹配的项
|
|
8
8
|
*/
|
|
9
|
-
export declare function useAllocationFinder({ frequency
|
|
9
|
+
export declare function useAllocationFinder({ frequency }: UseAllocationFinderProps): FrequencyAllocationItem | undefined;
|
|
10
10
|
export {};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type { StationInfoType } from '../../types';
|
|
1
|
+
import type { RecursiveFunction, StationInfoType } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* 台站数据更新订阅管理器
|
|
4
|
+
* 用于通知组件台站数据已更新,触发重新渲染
|
|
5
|
+
*/
|
|
6
|
+
export declare const withStationDataUpdate: (globalID: string, name?: string, func?: RecursiveFunction) => (...args: any[]) => void;
|
|
2
7
|
/**
|
|
3
8
|
* 全局台站信号数据存储
|
|
4
9
|
* 用于在全局 openData 中存储和读取台站信号信息
|
|
@@ -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,7 +7559,26 @@ const ZoomOffsetContainer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.
|
|
|
7559
7559
|
});
|
|
7560
7560
|
});
|
|
7561
7561
|
const Zoom_ZoomOffsetContainer = ZoomOffsetContainer;
|
|
7562
|
-
const
|
|
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
|
+
};
|
|
7574
|
+
const STATION_DATA = (globalID, data)=>{
|
|
7575
|
+
const result = subscription_openData(`stationData-${globalID}`, data, []);
|
|
7576
|
+
if (void 0 !== data) {
|
|
7577
|
+
const triggerUpdate = withStationDataUpdate(globalID);
|
|
7578
|
+
triggerUpdate(result);
|
|
7579
|
+
}
|
|
7580
|
+
return result;
|
|
7581
|
+
};
|
|
7563
7582
|
function isStationInfo(item) {
|
|
7564
7583
|
return 'signalName' in item && 'orgName' in item;
|
|
7565
7584
|
}
|
|
@@ -7573,6 +7592,20 @@ function toFrequencyRangeInput(item) {
|
|
|
7573
7592
|
}
|
|
7574
7593
|
function useStationFinder({ frequency }) {
|
|
7575
7594
|
const { state: { globalID, cursor: { coord: { left } }, segments, signal } } = useStore_useStore();
|
|
7595
|
+
const [updateTrigger, setUpdateTrigger] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(0);
|
|
7596
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
7597
|
+
const subscriberName = `useStationFinder-${globalID}-${Date.now()}`;
|
|
7598
|
+
const unsubscribe = withStationDataUpdate(globalID, subscriberName, ()=>{
|
|
7599
|
+
setUpdateTrigger((prev)=>prev + 1);
|
|
7600
|
+
});
|
|
7601
|
+
const existingData = STATION_DATA(globalID);
|
|
7602
|
+
if (existingData && existingData.length > 0) setUpdateTrigger((prev)=>prev + 1);
|
|
7603
|
+
return ()=>{
|
|
7604
|
+
if ('function' == typeof unsubscribe) unsubscribe();
|
|
7605
|
+
};
|
|
7606
|
+
}, [
|
|
7607
|
+
globalID
|
|
7608
|
+
]);
|
|
7576
7609
|
const allSignals = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
7577
7610
|
const stationData = STATION_DATA(globalID);
|
|
7578
7611
|
const signalData = signal.data || [];
|
|
@@ -7582,7 +7615,8 @@ function useStationFinder({ frequency }) {
|
|
|
7582
7615
|
];
|
|
7583
7616
|
}, [
|
|
7584
7617
|
globalID,
|
|
7585
|
-
signal.data
|
|
7618
|
+
signal.data,
|
|
7619
|
+
updateTrigger
|
|
7586
7620
|
]);
|
|
7587
7621
|
const currentPosition = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>(0, utils.hK)(left, segments), [
|
|
7588
7622
|
left,
|
|
@@ -14725,6 +14759,20 @@ const SegmentContainer_SegmentContainer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_M
|
|
|
14725
14759
|
const Signal_SegmentContainer = SegmentContainer_SegmentContainer;
|
|
14726
14760
|
const Signal = ({ show = true, display = true })=>{
|
|
14727
14761
|
const { state: { globalID, segments, axisX: { frequencyFormat }, zoom: { style: zoomOffStyle }, cursor: { coord: { left } }, signal } } = useStore_useStore();
|
|
14762
|
+
const [updateTrigger, setUpdateTrigger] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(0);
|
|
14763
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
14764
|
+
const subscriberName = `Signal-${globalID}-${Date.now()}`;
|
|
14765
|
+
const unsubscribe = withStationDataUpdate(globalID, subscriberName, ()=>{
|
|
14766
|
+
setUpdateTrigger((prev)=>prev + 1);
|
|
14767
|
+
});
|
|
14768
|
+
const existingData = STATION_DATA(globalID);
|
|
14769
|
+
if (existingData && existingData.length > 0) setUpdateTrigger((prev)=>prev + 1);
|
|
14770
|
+
return ()=>{
|
|
14771
|
+
if ('function' == typeof unsubscribe) unsubscribe();
|
|
14772
|
+
};
|
|
14773
|
+
}, [
|
|
14774
|
+
globalID
|
|
14775
|
+
]);
|
|
14728
14776
|
const allSignals = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
14729
14777
|
if (!signal.show || !signal.display) return [];
|
|
14730
14778
|
const stationData = STATION_DATA(globalID);
|
|
@@ -14737,7 +14785,8 @@ const Signal = ({ show = true, display = true })=>{
|
|
|
14737
14785
|
globalID,
|
|
14738
14786
|
signal.data,
|
|
14739
14787
|
signal.show,
|
|
14740
|
-
signal.display
|
|
14788
|
+
signal.display,
|
|
14789
|
+
updateTrigger
|
|
14741
14790
|
]);
|
|
14742
14791
|
const shouldDisplay = signal.show && signal.display && display;
|
|
14743
14792
|
const currentFrequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>Number(frequencyFormat(left)), [
|
|
@@ -15955,15 +16004,13 @@ function useSpectrumChartType({ type, heatmapElementID }) {
|
|
|
15955
16004
|
globalID
|
|
15956
16005
|
]);
|
|
15957
16006
|
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
15958
|
-
|
|
16007
|
+
constants_ChartType.SingleFrequency;
|
|
15959
16008
|
if (type === constants_ChartType.DDC) {
|
|
15960
16009
|
limit.show = false;
|
|
15961
|
-
signal.show = false;
|
|
15962
16010
|
marker.visible = true;
|
|
15963
16011
|
}
|
|
15964
16012
|
if (type === constants_ChartType.Lite) {
|
|
15965
16013
|
limit.show = false;
|
|
15966
|
-
signal.show = false;
|
|
15967
16014
|
marker.enabled = false;
|
|
15968
16015
|
}
|
|
15969
16016
|
if (type === constants_ChartType.LiteNormalized) {
|
|
@@ -15978,7 +16025,6 @@ function useSpectrumChartType({ type, heatmapElementID }) {
|
|
|
15978
16025
|
}
|
|
15979
16026
|
if (type === constants_ChartType.MScan) {
|
|
15980
16027
|
limit.show = false;
|
|
15981
|
-
signal.show = false;
|
|
15982
16028
|
frequencyAllocation.show = false;
|
|
15983
16029
|
}
|
|
15984
16030
|
if (type === constants_ChartType.ScanDF360) {
|