@rfkit/charts 1.2.12 → 1.2.14
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,8 +1,11 @@
|
|
|
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
|
-
*
|
|
5
|
-
* - 写入时:同时存到 openData(按 globalID)和 sessionStorage(按 globalID)
|
|
6
|
-
* - 读取时:优先从 openData 读取,如果为空则从 sessionStorage 恢复
|
|
9
|
+
* 用于在全局 openData 中存储和读取台站信号信息
|
|
7
10
|
*/
|
|
8
11
|
export declare const STATION_DATA: (globalID: string, data?: StationInfoType[]) => StationInfoType[];
|
package/index.js
CHANGED
|
@@ -2833,7 +2833,7 @@ var __webpack_modules__ = {
|
|
|
2833
2833
|
|
|
2834
2834
|
.segmentContainer-P_hPRM .item-MCHNyr:after {
|
|
2835
2835
|
content: "";
|
|
2836
|
-
opacity:
|
|
2836
|
+
opacity: 1;
|
|
2837
2837
|
background: var(--station-bg-color, var(--theme-color-base));
|
|
2838
2838
|
pointer-events: none;
|
|
2839
2839
|
width: 100%;
|
|
@@ -2850,7 +2850,7 @@ var __webpack_modules__ = {
|
|
|
2850
2850
|
}
|
|
2851
2851
|
|
|
2852
2852
|
.segmentContainer-P_hPRM .item-MCHNyr.active-zf78pN:after {
|
|
2853
|
-
opacity:
|
|
2853
|
+
opacity: .5;
|
|
2854
2854
|
background: var(--station-bg-color, var(--theme-color-primary));
|
|
2855
2855
|
}
|
|
2856
2856
|
`,
|
|
@@ -7559,37 +7559,11 @@ const ZoomOffsetContainer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.
|
|
|
7559
7559
|
});
|
|
7560
7560
|
});
|
|
7561
7561
|
const Zoom_ZoomOffsetContainer = ZoomOffsetContainer;
|
|
7562
|
-
const
|
|
7563
|
-
function getStationDataFromStorage(globalID) {
|
|
7564
|
-
try {
|
|
7565
|
-
const stored = sessionStorage.getItem(`${STORAGE_KEY_PREFIX}-${globalID}`);
|
|
7566
|
-
if (stored) return JSON.parse(stored);
|
|
7567
|
-
} catch (error) {
|
|
7568
|
-
console.error("\u8BFB\u53D6\u53F0\u7AD9\u6570\u636E\u5931\u8D25:", error);
|
|
7569
|
-
}
|
|
7570
|
-
return [];
|
|
7571
|
-
}
|
|
7572
|
-
function saveStationDataToStorage(globalID, data) {
|
|
7573
|
-
try {
|
|
7574
|
-
sessionStorage.setItem(`${STORAGE_KEY_PREFIX}-${globalID}`, JSON.stringify(data));
|
|
7575
|
-
} catch (error) {
|
|
7576
|
-
console.error("\u4FDD\u5B58\u53F0\u7AD9\u6570\u636E\u5931\u8D25:", error);
|
|
7577
|
-
}
|
|
7578
|
-
}
|
|
7562
|
+
const withStationDataUpdate = (globalID, name, func)=>subscription_createSubscriptionManager(`stationData-update-${globalID}`, name, func);
|
|
7579
7563
|
const STATION_DATA = (globalID, data)=>{
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
return data;
|
|
7584
|
-
}
|
|
7585
|
-
const openDataResult = subscription_openData(`stationData-${globalID}`, void 0, null);
|
|
7586
|
-
if (openDataResult && openDataResult.length > 0) return openDataResult;
|
|
7587
|
-
const storedData = getStationDataFromStorage(globalID);
|
|
7588
|
-
if (storedData.length > 0) {
|
|
7589
|
-
subscription_openData(`stationData-${globalID}`, storedData, []);
|
|
7590
|
-
return storedData;
|
|
7591
|
-
}
|
|
7592
|
-
return [];
|
|
7564
|
+
const result = subscription_openData(`stationData-${globalID}`, data, []);
|
|
7565
|
+
if (void 0 !== data) withStationDataUpdate(globalID, 'trigger', ()=>result);
|
|
7566
|
+
return result;
|
|
7593
7567
|
};
|
|
7594
7568
|
function isStationInfo(item) {
|
|
7595
7569
|
return 'signalName' in item && 'orgName' in item;
|
|
@@ -7604,6 +7578,17 @@ function toFrequencyRangeInput(item) {
|
|
|
7604
7578
|
}
|
|
7605
7579
|
function useStationFinder({ frequency }) {
|
|
7606
7580
|
const { state: { globalID, cursor: { coord: { left } }, segments, signal } } = useStore_useStore();
|
|
7581
|
+
const [updateTrigger, setUpdateTrigger] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(0);
|
|
7582
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
7583
|
+
const unsubscribe = withStationDataUpdate(globalID, `useStationFinder-${globalID}`, ()=>{
|
|
7584
|
+
setUpdateTrigger((prev)=>prev + 1);
|
|
7585
|
+
});
|
|
7586
|
+
return ()=>{
|
|
7587
|
+
if ('function' == typeof unsubscribe) unsubscribe();
|
|
7588
|
+
};
|
|
7589
|
+
}, [
|
|
7590
|
+
globalID
|
|
7591
|
+
]);
|
|
7607
7592
|
const allSignals = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
7608
7593
|
const stationData = STATION_DATA(globalID);
|
|
7609
7594
|
const signalData = signal.data || [];
|
|
@@ -7613,7 +7598,8 @@ function useStationFinder({ frequency }) {
|
|
|
7613
7598
|
];
|
|
7614
7599
|
}, [
|
|
7615
7600
|
globalID,
|
|
7616
|
-
signal.data
|
|
7601
|
+
signal.data,
|
|
7602
|
+
updateTrigger
|
|
7617
7603
|
]);
|
|
7618
7604
|
const currentPosition = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>(0, utils.hK)(left, segments), [
|
|
7619
7605
|
left,
|
|
@@ -14756,6 +14742,17 @@ const SegmentContainer_SegmentContainer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_M
|
|
|
14756
14742
|
const Signal_SegmentContainer = SegmentContainer_SegmentContainer;
|
|
14757
14743
|
const Signal = ({ show = true, display = true })=>{
|
|
14758
14744
|
const { state: { globalID, segments, axisX: { frequencyFormat }, zoom: { style: zoomOffStyle }, cursor: { coord: { left } }, signal } } = useStore_useStore();
|
|
14745
|
+
const [updateTrigger, setUpdateTrigger] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(0);
|
|
14746
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
14747
|
+
const unsubscribe = withStationDataUpdate(globalID, `Signal-${globalID}`, ()=>{
|
|
14748
|
+
setUpdateTrigger((prev)=>prev + 1);
|
|
14749
|
+
});
|
|
14750
|
+
return ()=>{
|
|
14751
|
+
if ('function' == typeof unsubscribe) unsubscribe();
|
|
14752
|
+
};
|
|
14753
|
+
}, [
|
|
14754
|
+
globalID
|
|
14755
|
+
]);
|
|
14759
14756
|
const allSignals = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
14760
14757
|
if (!signal.show || !signal.display) return [];
|
|
14761
14758
|
const stationData = STATION_DATA(globalID);
|
|
@@ -14768,7 +14765,8 @@ const Signal = ({ show = true, display = true })=>{
|
|
|
14768
14765
|
globalID,
|
|
14769
14766
|
signal.data,
|
|
14770
14767
|
signal.show,
|
|
14771
|
-
signal.display
|
|
14768
|
+
signal.display,
|
|
14769
|
+
updateTrigger
|
|
14772
14770
|
]);
|
|
14773
14771
|
const shouldDisplay = signal.show && signal.display && display;
|
|
14774
14772
|
const currentFrequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>Number(frequencyFormat(left)), [
|