@rfkit/charts 1.2.13 → 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, }: UseAllocationFinderProps): FrequencyAllocationItem | undefined;
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 中存储和读取台站信号信息
package/index.js CHANGED
@@ -7559,7 +7559,12 @@ const ZoomOffsetContainer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.
7559
7559
  });
7560
7560
  });
7561
7561
  const Zoom_ZoomOffsetContainer = ZoomOffsetContainer;
7562
- const STATION_DATA = (globalID, data)=>subscription_openData(`stationData-${globalID}`, data, []);
7562
+ const withStationDataUpdate = (globalID, name, func)=>subscription_createSubscriptionManager(`stationData-update-${globalID}`, name, func);
7563
+ const STATION_DATA = (globalID, data)=>{
7564
+ const result = subscription_openData(`stationData-${globalID}`, data, []);
7565
+ if (void 0 !== data) withStationDataUpdate(globalID, 'trigger', ()=>result);
7566
+ return result;
7567
+ };
7563
7568
  function isStationInfo(item) {
7564
7569
  return 'signalName' in item && 'orgName' in item;
7565
7570
  }
@@ -7573,6 +7578,17 @@ function toFrequencyRangeInput(item) {
7573
7578
  }
7574
7579
  function useStationFinder({ frequency }) {
7575
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
+ ]);
7576
7592
  const allSignals = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
7577
7593
  const stationData = STATION_DATA(globalID);
7578
7594
  const signalData = signal.data || [];
@@ -7582,7 +7598,8 @@ function useStationFinder({ frequency }) {
7582
7598
  ];
7583
7599
  }, [
7584
7600
  globalID,
7585
- signal.data
7601
+ signal.data,
7602
+ updateTrigger
7586
7603
  ]);
7587
7604
  const currentPosition = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>(0, utils.hK)(left, segments), [
7588
7605
  left,
@@ -14725,6 +14742,17 @@ const SegmentContainer_SegmentContainer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_M
14725
14742
  const Signal_SegmentContainer = SegmentContainer_SegmentContainer;
14726
14743
  const Signal = ({ show = true, display = true })=>{
14727
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
+ ]);
14728
14756
  const allSignals = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
14729
14757
  if (!signal.show || !signal.display) return [];
14730
14758
  const stationData = STATION_DATA(globalID);
@@ -14737,7 +14765,8 @@ const Signal = ({ show = true, display = true })=>{
14737
14765
  globalID,
14738
14766
  signal.data,
14739
14767
  signal.show,
14740
- signal.display
14768
+ signal.display,
14769
+ updateTrigger
14741
14770
  ]);
14742
14771
  const shouldDisplay = signal.show && signal.display && display;
14743
14772
  const currentFrequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>Number(frequencyFormat(left)), [
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.13",
8
+ "version": "1.2.14",
9
9
  "private": false
10
10
  }