@rfkit/charts 1.1.40 → 1.2.0

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.
package/index.js CHANGED
@@ -61,12 +61,15 @@ var __webpack_modules__ = {
61
61
  }
62
62
  function throttleRequestAnimationFrame(func = ()=>{}) {
63
63
  let scheduled = false;
64
+ let latestEvent = null;
64
65
  return (e)=>{
66
+ latestEvent = e;
65
67
  if (!scheduled) {
66
68
  scheduled = true;
67
69
  requestAnimationFrame(()=>{
68
- func(e);
70
+ func(latestEvent);
69
71
  scheduled = false;
72
+ latestEvent = null;
70
73
  });
71
74
  }
72
75
  };
@@ -1314,7 +1317,7 @@ var __webpack_modules__ = {
1314
1317
  background: var(--theme-bg-base);
1315
1318
  border: 1px solid var(--theme-border-base);
1316
1319
  border-radius: var(--size-border-radius-base);
1317
- min-width: 120px;
1320
+ min-width: 140px;
1318
1321
  box-shadow: var(--theme-box-shadow-base);
1319
1322
  padding: calc(var(--size-gap-base) / 2);
1320
1323
  z-index: 11;
@@ -1490,7 +1493,7 @@ var __webpack_modules__ = {
1490
1493
  background: none;
1491
1494
  align-items: center;
1492
1495
  width: 100%;
1493
- height: 18px;
1496
+ height: 14px;
1494
1497
  display: flex;
1495
1498
  position: absolute;
1496
1499
  bottom: 0;
@@ -1525,7 +1528,7 @@ var __webpack_modules__ = {
1525
1528
  text-align: center;
1526
1529
  height: 100%;
1527
1530
  color: var(--theme-color-base);
1528
- opacity: .68;
1531
+ opacity: .5;
1529
1532
  -webkit-backdrop-filter: blur(4px);
1530
1533
  backdrop-filter: blur(4px);
1531
1534
  will-change: opacity, box-shadow;
@@ -2685,6 +2688,7 @@ var __webpack_modules__ = {
2685
2688
  height: 100%;
2686
2689
  display: flex;
2687
2690
  position: absolute;
2691
+ top: 0;
2688
2692
  left: 0;
2689
2693
  overflow: hidden;
2690
2694
  }
@@ -2707,27 +2711,46 @@ var __webpack_modules__ = {
2707
2711
 
2708
2712
  .segmentContainer-gDwnhB .item-ybDTIt {
2709
2713
  box-sizing: border-box;
2710
- border-top: 1px solid var(--theme-bg-second);
2711
- border-bottom: 1px solid var(--theme-bg-second);
2714
+ white-space: nowrap;
2715
+ text-overflow: ellipsis;
2716
+ text-align: center;
2712
2717
  height: 100%;
2718
+ color: var(--theme-color-base);
2719
+ opacity: .68;
2720
+ justify-content: center;
2721
+ align-items: center;
2722
+ height: 4px;
2723
+ font-size: 12px;
2724
+ display: flex;
2713
2725
  position: absolute;
2726
+ top: 0;
2727
+ overflow: hidden;
2714
2728
  }
2715
2729
 
2716
- .segmentContainer-gDwnhB .item-ybDTIt.active-qDPFJm {
2717
- border-top: 1px dashed var(--theme-color-primary);
2718
- border-bottom: 1px dashed var(--theme-color-primary);
2719
- }
2720
-
2721
- .segmentContainer-gDwnhB .item-ybDTIt.active-qDPFJm:after {
2730
+ .segmentContainer-gDwnhB .item-ybDTIt:after {
2722
2731
  content: "";
2723
- opacity: .05;
2724
- background: var(--theme-color-primary);
2732
+ opacity: .32;
2733
+ background: var(--theme-color-base);
2725
2734
  width: 100%;
2726
2735
  height: 100%;
2727
2736
  position: absolute;
2728
2737
  top: 0;
2729
2738
  left: 0;
2730
2739
  }
2740
+
2741
+ .segmentContainer-gDwnhB .item-ybDTIt.active-qDPFJm {
2742
+ opacity: 1;
2743
+ height: 100%;
2744
+ }
2745
+
2746
+ .segmentContainer-gDwnhB .item-ybDTIt.active-qDPFJm:after {
2747
+ opacity: .68;
2748
+ background: var(--theme-color-primary);
2749
+ }
2750
+
2751
+ .segmentContainer-gDwnhB .item-ybDTIt:hover {
2752
+ opacity: 1;
2753
+ }
2731
2754
  `,
2732
2755
  ""
2733
2756
  ]);
@@ -4067,7 +4090,6 @@ function defaultState_createParams() {
4067
4090
  weaken: weakenDefault,
4068
4091
  zoomMinSimulateWave: false,
4069
4092
  dataRate: dataRateDefault,
4070
- data: new Map(),
4071
4093
  forceDisplay: false,
4072
4094
  legendExternal: [
4073
4095
  constants_SeriesType.ThresholdData,
@@ -4215,22 +4237,17 @@ function subscription_openData(globalID, data, defaultData) {
4215
4237
  return o[globalID] || defaultData || void 0;
4216
4238
  }
4217
4239
  subscription_c.subscriptions = {};
4218
- const subscriptions = subscription_c.subscriptions;
4240
+ const subscription_subscriptions = subscription_c.subscriptions;
4219
4241
  function subscription_createSubscriptionManager(id, name, func) {
4220
4242
  if (!id) throw new Error("createSubscriptionManager 订阅失效");
4221
- if (!subscriptions[id]) subscriptions[id] = {};
4222
- if ('function' == typeof func && name) subscriptions[id][name] = func;
4243
+ if (!subscription_subscriptions[id]) subscription_subscriptions[id] = {};
4244
+ if ('function' == typeof func && name) subscription_subscriptions[id][name] = func;
4223
4245
  return (...args)=>{
4224
- const funcs = subscriptions[id];
4246
+ const funcs = subscription_subscriptions[id];
4225
4247
  for(const key in funcs)funcs[key](...args);
4226
4248
  };
4227
4249
  }
4228
4250
  const getDefaultData = ()=>({
4229
- spectrumExtra: new Map(),
4230
- occupancy: {
4231
- data: new Float32Array(),
4232
- totalOccupancy: 0
4233
- },
4234
4251
  getAllRawData: ()=>({
4235
4252
  realData: new Float32Array(),
4236
4253
  maxData: new Float32Array(),
@@ -4243,7 +4260,9 @@ const getDefaultData = ()=>({
4243
4260
  probabilityRangeData: new Float32Array(),
4244
4261
  spectrumData: new Float32Array(),
4245
4262
  timestampData: new Float32Array()
4246
- }
4263
+ },
4264
+ occupancyData: new Float32Array(),
4265
+ extraData: {}
4247
4266
  })
4248
4267
  });
4249
4268
  function withDatabase(globalID, data) {
@@ -7404,6 +7423,397 @@ const ZoomOffsetContainer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.
7404
7423
  });
7405
7424
  });
7406
7425
  const Zoom_ZoomOffsetContainer = ZoomOffsetContainer;
7426
+ const events_SeriesEventName = {
7427
+ UPDATED: 'series:updated',
7428
+ ADDED: 'series:added',
7429
+ REMOVED: 'series:removed',
7430
+ MODE_CHANGED: 'series:mode-changed',
7431
+ TYPE_OVERRIDE_CHANGED: 'series:type-override-changed',
7432
+ BATCH_UPDATED: 'series:batch-updated',
7433
+ RESET: 'series:reset'
7434
+ };
7435
+ class EventManager {
7436
+ listeners = new Map();
7437
+ on(event, listener) {
7438
+ if (!this.listeners.has(event)) this.listeners.set(event, new Set());
7439
+ const eventListeners = this.listeners.get(event);
7440
+ if (!eventListeners) throw new Error(`Failed to get event listeners for ${event}`);
7441
+ eventListeners.add(listener);
7442
+ return ()=>{
7443
+ eventListeners.delete(listener);
7444
+ if (0 === eventListeners.size) this.listeners.delete(event);
7445
+ };
7446
+ }
7447
+ emit(event, data) {
7448
+ const eventListeners = this.listeners.get(event);
7449
+ if (eventListeners) eventListeners.forEach((listener)=>{
7450
+ try {
7451
+ listener(data);
7452
+ } catch (error) {
7453
+ console.error(`Error in event listener for ${event}:`, error);
7454
+ }
7455
+ });
7456
+ }
7457
+ removeAllListeners(event) {
7458
+ if (event) this.listeners.delete(event);
7459
+ else this.listeners.clear();
7460
+ }
7461
+ getListenerCount(event) {
7462
+ return this.listeners.get(event)?.size || 0;
7463
+ }
7464
+ }
7465
+ const globalEventManager = new EventManager();
7466
+ const seriesEvents = {
7467
+ on: globalEventManager.on.bind(globalEventManager),
7468
+ emit: globalEventManager.emit.bind(globalEventManager),
7469
+ removeAllListeners: globalEventManager.removeAllListeners.bind(globalEventManager),
7470
+ getListenerCount: globalEventManager.getListenerCount.bind(globalEventManager)
7471
+ };
7472
+ function subscribeToSeries(globalID, event, listener) {
7473
+ return seriesEvents.on(event, (data)=>{
7474
+ if (data.globalID === globalID) listener(data);
7475
+ });
7476
+ }
7477
+ function events_emitSeriesEvent(event, data) {
7478
+ seriesEvents.emit(event, data);
7479
+ }
7480
+ var modes_SeriesMode = /*#__PURE__*/ function(SeriesMode) {
7481
+ SeriesMode["Line"] = "line";
7482
+ SeriesMode["StepLine"] = "stepline";
7483
+ SeriesMode["Bar"] = "bar";
7484
+ SeriesMode["Area"] = "area";
7485
+ return SeriesMode;
7486
+ }({});
7487
+ const SERIES_MODES = {
7488
+ ["line"]: {
7489
+ name: 'line',
7490
+ label: "\u7EBF\u56FE",
7491
+ icon: 'line',
7492
+ realData: type_GraphicType.Line,
7493
+ minData: type_GraphicType.Line,
7494
+ maxData: type_GraphicType.Line,
7495
+ avgData: type_GraphicType.Line
7496
+ },
7497
+ ["stepline"]: {
7498
+ name: 'stepline',
7499
+ label: "\u9636\u68AF\u7EBF\u56FE",
7500
+ icon: 'stepline',
7501
+ realData: type_GraphicType.Stepline,
7502
+ minData: type_GraphicType.Stepline,
7503
+ maxData: type_GraphicType.Stepline,
7504
+ avgData: type_GraphicType.Stepline
7505
+ },
7506
+ ["bar"]: {
7507
+ name: 'bar',
7508
+ label: "\u67F1\u72B6\u56FE",
7509
+ icon: 'bar',
7510
+ realData: type_GraphicType.Bar,
7511
+ minData: type_GraphicType.Line,
7512
+ maxData: type_GraphicType.Line,
7513
+ avgData: type_GraphicType.Line
7514
+ },
7515
+ ["area"]: {
7516
+ name: 'area',
7517
+ label: "\u9762\u79EF\u56FE",
7518
+ icon: 'area',
7519
+ realData: type_GraphicType.Area,
7520
+ minData: type_GraphicType.Stepline,
7521
+ maxData: type_GraphicType.Stepline,
7522
+ avgData: type_GraphicType.Stepline
7523
+ }
7524
+ };
7525
+ const seriesModes = new Map();
7526
+ function modes_getSeriesMode(globalID) {
7527
+ return seriesModes.get(globalID) || "line";
7528
+ }
7529
+ function getNextMode(currentMode) {
7530
+ const modes = Object.values(modes_SeriesMode);
7531
+ const currentIndex = modes.indexOf(currentMode);
7532
+ const nextIndex = (currentIndex + 1) % modes.length;
7533
+ return modes[nextIndex];
7534
+ }
7535
+ function setSeriesMode(globalID, mode) {
7536
+ seriesModes.set(globalID, mode);
7537
+ const modeConfig = SERIES_MODES[mode];
7538
+ events_emitSeriesEvent(events_SeriesEventName.MODE_CHANGED, {
7539
+ globalID,
7540
+ mode,
7541
+ config: modeConfig
7542
+ });
7543
+ }
7544
+ function toggleSeriesMode(globalID, currentMode) {
7545
+ const mode = currentMode || modes_getSeriesMode(globalID);
7546
+ const nextMode = getNextMode(mode);
7547
+ setSeriesMode(globalID, nextMode);
7548
+ }
7549
+ const chartTypeSeriesOverrides = new Map();
7550
+ function setChartTypeSeriesOverride(globalID, seriesName, type) {
7551
+ if (!chartTypeSeriesOverrides.has(globalID)) chartTypeSeriesOverrides.set(globalID, new Map());
7552
+ chartTypeSeriesOverrides.get(globalID)?.set(seriesName, type);
7553
+ events_emitSeriesEvent(events_SeriesEventName.TYPE_OVERRIDE_CHANGED, {
7554
+ globalID,
7555
+ seriesName,
7556
+ type
7557
+ });
7558
+ }
7559
+ function clearChartTypeSeriesOverrides(globalID) {
7560
+ const hadOverrides = chartTypeSeriesOverrides.has(globalID);
7561
+ chartTypeSeriesOverrides.delete(globalID);
7562
+ if (hadOverrides) events_emitSeriesEvent(events_SeriesEventName.TYPE_OVERRIDE_CHANGED, {
7563
+ globalID
7564
+ });
7565
+ }
7566
+ const managers = new Map();
7567
+ function getDefaultSeriesConfigs() {
7568
+ const lineConfigs = getSeriesConfig();
7569
+ return Object.values(lineConfigs).map((config)=>({
7570
+ name: config.name,
7571
+ label: config.label,
7572
+ color: config.color,
7573
+ thickness: config.thickness,
7574
+ display: config.display,
7575
+ type: type_GraphicType.Line
7576
+ }));
7577
+ }
7578
+ function getSeriesManager(globalID) {
7579
+ if (!globalID) throw new Error("globalID \u4E0D\u80FD\u4E3A\u7A7A");
7580
+ if (!managers.has(globalID)) {
7581
+ const manager = new __WEBPACK_EXTERNAL_MODULE__rfkit_spectrum_analyzer_159ab12b__.SeriesManager([]);
7582
+ const defaultConfigs = getDefaultSeriesConfigs();
7583
+ defaultConfigs.forEach((config)=>{
7584
+ manager.addSeries({
7585
+ name: config.name,
7586
+ label: config.label,
7587
+ color: config.color,
7588
+ display: config.display,
7589
+ type: config.type || type_GraphicType.Line,
7590
+ thickness: config.thickness
7591
+ });
7592
+ });
7593
+ managers.set(globalID, manager);
7594
+ }
7595
+ const managerInstance = managers.get(globalID);
7596
+ if (!managerInstance) throw new Error(`SeriesManager for globalID "${globalID}" not found`);
7597
+ return managerInstance;
7598
+ }
7599
+ function series_getSeriesMap(globalID) {
7600
+ const manager = getSeriesManager(globalID);
7601
+ const allSeries = manager.getAllSeries();
7602
+ const seriesMap = new Map();
7603
+ if (Array.isArray(allSeries)) allSeries.forEach((series)=>{
7604
+ seriesMap.set(series.name, {
7605
+ name: series.name,
7606
+ label: series.label || '',
7607
+ color: series.color,
7608
+ display: void 0 !== series.display ? series.display : true,
7609
+ type: series.type || type_GraphicType.Line,
7610
+ thickness: series.thickness || 1
7611
+ });
7612
+ });
7613
+ return seriesMap;
7614
+ }
7615
+ function mergeSeriesConfig(config, existing) {
7616
+ const defaults = {
7617
+ label: '',
7618
+ display: true,
7619
+ type: type_GraphicType.Line,
7620
+ thickness: 1
7621
+ };
7622
+ return {
7623
+ name: config.name,
7624
+ label: config.label ?? existing?.label ?? defaults.label,
7625
+ color: config.color ?? existing?.color ?? (()=>{
7626
+ throw new Error(`Series "${config.name}" does not exist and must have a color defined`);
7627
+ })(),
7628
+ display: config.display ?? existing?.display ?? defaults.display,
7629
+ type: config.type ?? existing?.type ?? defaults.type,
7630
+ thickness: config.thickness ?? existing?.thickness ?? defaults.thickness
7631
+ };
7632
+ }
7633
+ function updateSeries(globalID, config) {
7634
+ if (!config?.name) return;
7635
+ const manager = getSeriesManager(globalID);
7636
+ const existing = manager.getSeries(config.name);
7637
+ const finalConfig = mergeSeriesConfig(config, existing);
7638
+ if (existing) manager.removeSeries(config.name);
7639
+ manager.addSeries(finalConfig);
7640
+ events_emitSeriesEvent(events_SeriesEventName.UPDATED, {
7641
+ globalID,
7642
+ seriesName: config.name,
7643
+ config: {
7644
+ name: finalConfig.name,
7645
+ label: finalConfig.label,
7646
+ color: finalConfig.color,
7647
+ thickness: finalConfig.thickness,
7648
+ display: finalConfig.display,
7649
+ type: finalConfig.type
7650
+ }
7651
+ });
7652
+ }
7653
+ function resetSeries(globalID) {
7654
+ const manager = getSeriesManager(globalID);
7655
+ manager.clear();
7656
+ const defaultConfigs = getDefaultSeriesConfigs();
7657
+ defaultConfigs.forEach((config)=>{
7658
+ manager.addSeries({
7659
+ name: config.name,
7660
+ label: config.label,
7661
+ color: config.color,
7662
+ display: config.display,
7663
+ type: config.type || type_GraphicType.Line,
7664
+ thickness: config.thickness
7665
+ });
7666
+ });
7667
+ }
7668
+ function getSeriesWithGraphicType(globalID) {
7669
+ const seriesMap = series_getSeriesMap(globalID);
7670
+ const currentMode = modes_getSeriesMode(globalID);
7671
+ const modeConfig = SERIES_MODES[currentMode];
7672
+ const chartTypeOverrides = chartTypeSeriesOverrides.get(globalID);
7673
+ const result = new Map();
7674
+ seriesMap.forEach((config)=>{
7675
+ const updatedConfig = {
7676
+ ...config
7677
+ };
7678
+ const overrideType = chartTypeOverrides?.get(config.name);
7679
+ if (overrideType) {
7680
+ updatedConfig.type = overrideType;
7681
+ result.set(config.name, updatedConfig);
7682
+ return;
7683
+ }
7684
+ if ('templateData' === config.name) updatedConfig.type = type_GraphicType.Area;
7685
+ else {
7686
+ const graphicType = modeConfig[config.name];
7687
+ if (graphicType) updatedConfig.type = graphicType;
7688
+ }
7689
+ result.set(config.name, updatedConfig);
7690
+ });
7691
+ return result;
7692
+ }
7693
+ function useSeriesManager(globalID, options = {}) {
7694
+ const { subscribeToMode = true, subscribeToData = true, watchSeries } = options;
7695
+ const [, setUpdateCounter] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(0);
7696
+ const [mode, setMode] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(()=>globalID ? modes_getSeriesMode(globalID) : 'line');
7697
+ const forceUpdate = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
7698
+ setUpdateCounter((prev)=>prev + 1);
7699
+ }, []);
7700
+ const series = globalID ? series_getSeriesMap(globalID) : new Map();
7701
+ const handleUpdateSeries = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((config)=>{
7702
+ if (globalID) updateSeries(globalID, config);
7703
+ }, [
7704
+ globalID
7705
+ ]);
7706
+ const getSeries = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((name)=>series.get(name), [
7707
+ series
7708
+ ]);
7709
+ (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
7710
+ if (!globalID) return;
7711
+ const unsubscribers = [];
7712
+ if (subscribeToMode) {
7713
+ setMode(modes_getSeriesMode(globalID));
7714
+ const unsubscribeMode = subscribeToSeries(globalID, events_SeriesEventName.MODE_CHANGED, (data)=>{
7715
+ setMode(data.mode);
7716
+ });
7717
+ unsubscribers.push(unsubscribeMode);
7718
+ }
7719
+ if (subscribeToData) {
7720
+ const unsubscribeUpdated = subscribeToSeries(globalID, events_SeriesEventName.UPDATED, (data)=>{
7721
+ if (watchSeries && !watchSeries.includes(data.seriesName)) return;
7722
+ forceUpdate();
7723
+ });
7724
+ unsubscribers.push(unsubscribeUpdated);
7725
+ const unsubscribeAdded = subscribeToSeries(globalID, events_SeriesEventName.ADDED, (data)=>{
7726
+ if (watchSeries && !watchSeries.includes(data.seriesName)) return;
7727
+ forceUpdate();
7728
+ });
7729
+ unsubscribers.push(unsubscribeAdded);
7730
+ const unsubscribeRemoved = subscribeToSeries(globalID, events_SeriesEventName.REMOVED, (data)=>{
7731
+ if (watchSeries && !watchSeries.includes(data.seriesName)) return;
7732
+ forceUpdate();
7733
+ });
7734
+ unsubscribers.push(unsubscribeRemoved);
7735
+ const unsubscribeBatchUpdated = subscribeToSeries(globalID, events_SeriesEventName.BATCH_UPDATED, ()=>{
7736
+ forceUpdate();
7737
+ });
7738
+ unsubscribers.push(unsubscribeBatchUpdated);
7739
+ const unsubscribeReset = subscribeToSeries(globalID, events_SeriesEventName.RESET, ()=>{
7740
+ forceUpdate();
7741
+ });
7742
+ unsubscribers.push(unsubscribeReset);
7743
+ }
7744
+ return ()=>{
7745
+ for (const unsubscribe of unsubscribers)unsubscribe();
7746
+ };
7747
+ }, [
7748
+ globalID,
7749
+ subscribeToMode,
7750
+ subscribeToData,
7751
+ watchSeries,
7752
+ forceUpdate
7753
+ ]);
7754
+ return {
7755
+ series,
7756
+ mode,
7757
+ updateSeries: handleUpdateSeries,
7758
+ forceUpdate,
7759
+ getSeries
7760
+ };
7761
+ }
7762
+ function useSeriesForComponent(globalID) {
7763
+ return useSeriesManager(globalID, {
7764
+ subscribeToMode: true,
7765
+ subscribeToData: true
7766
+ });
7767
+ }
7768
+ const stableOrderMap = new Map();
7769
+ function getStableOrder(globalID, currentNames) {
7770
+ const stored = stableOrderMap.get(globalID) || [];
7771
+ const needsUpdate = 0 === stored.length || currentNames.some((name)=>!stored.includes(name)) || stored.some((name)=>!currentNames.includes(name));
7772
+ if (needsUpdate) {
7773
+ const newOrder = [
7774
+ ...stored.filter((name)=>currentNames.includes(name)),
7775
+ ...currentNames.filter((name)=>!stored.includes(name))
7776
+ ];
7777
+ stableOrderMap.set(globalID, newOrder);
7778
+ return newOrder;
7779
+ }
7780
+ return stored;
7781
+ }
7782
+ function useFilteredSeries(globalID, filter) {
7783
+ const { series } = useSeriesManager(globalID);
7784
+ const { state: { series: { legendExternal } } } = useStore_useStore();
7785
+ const filteredData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
7786
+ const filtered = Array.from(series.values()).filter((config)=>{
7787
+ if (legendExternal.includes(config.name)) return false;
7788
+ if (config.name === constants_SeriesType.TemplateData) return false;
7789
+ return filter ? filter(config) : true;
7790
+ });
7791
+ if (!globalID) return filtered.map((config, index)=>({
7792
+ ...config,
7793
+ originalIndex: index
7794
+ }));
7795
+ const currentNames = filtered.map((s)=>s.name);
7796
+ const stableOrder = getStableOrder(globalID, currentNames);
7797
+ const orderMap = new Map(stableOrder.map((name, i)=>[
7798
+ name,
7799
+ i
7800
+ ]));
7801
+ return filtered.sort((a, b)=>{
7802
+ const orderA = orderMap.get(a.name) ?? Number.MAX_SAFE_INTEGER;
7803
+ const orderB = orderMap.get(b.name) ?? Number.MAX_SAFE_INTEGER;
7804
+ return orderA - orderB;
7805
+ }).map((config, index)=>({
7806
+ ...config,
7807
+ originalIndex: index
7808
+ }));
7809
+ }, [
7810
+ series,
7811
+ legendExternal,
7812
+ filter,
7813
+ globalID
7814
+ ]);
7815
+ return filteredData;
7816
+ }
7407
7817
  var StationInfo_styles_module = __webpack_require__("../../../../node_modules/.pnpm/@rsbuild+core@1.3.18/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[11].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[11].use[2]!../../../../node_modules/.pnpm/@rsbuild+plugin-less@1.5.0_@rsbuild+core@1.5.17/node_modules/@rsbuild/plugin-less/compiled/less-loader/index.js??ruleSet[1].rules[11].use[3]!./src/components/FrequencyDataBoard/StationInfo/styles.module.less");
7408
7818
  var StationInfo_styles_module_options = {};
7409
7819
  StationInfo_styles_module_options.styleTagTransform = styleTagTransform_default();
@@ -7413,7 +7823,7 @@ StationInfo_styles_module_options.domAPI = styleDomAPI_default();
7413
7823
  StationInfo_styles_module_options.insertStyleElement = insertStyleElement_default();
7414
7824
  injectStylesIntoStyleTag_default()(StationInfo_styles_module.Z, StationInfo_styles_module_options);
7415
7825
  const FrequencyDataBoard_StationInfo_styles_module = StationInfo_styles_module.Z && StationInfo_styles_module.Z.locals ? StationInfo_styles_module.Z.locals : void 0;
7416
- const StationInfo_StationInfo = ({ stationInfo })=>{
7826
+ const StationInfo = ({ stationInfo })=>{
7417
7827
  if (!stationInfo) return null;
7418
7828
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
7419
7829
  className: FrequencyDataBoard_StationInfo_styles_module.stationInfo,
@@ -7465,7 +7875,7 @@ const StationInfo_StationInfo = ({ stationInfo })=>{
7465
7875
  ]
7466
7876
  });
7467
7877
  };
7468
- const StationInfo = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].memo(StationInfo_StationInfo);
7878
+ const FrequencyDataBoard_StationInfo = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].memo(StationInfo);
7469
7879
  var FrequencyDataBoard_styles_module = __webpack_require__("../../../node_modules/.pnpm/@rsbuild+core@1.3.18/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[11].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[11].use[2]!../../../node_modules/.pnpm/@rsbuild+plugin-less@1.5.0_@rsbuild+core@1.5.17/node_modules/@rsbuild/plugin-less/compiled/less-loader/index.js??ruleSet[1].rules[11].use[3]!./src/components/FrequencyDataBoard/styles.module.less");
7470
7880
  var FrequencyDataBoard_styles_module_options = {};
7471
7881
  FrequencyDataBoard_styles_module_options.styleTagTransform = styleTagTransform_default();
@@ -7476,7 +7886,8 @@ FrequencyDataBoard_styles_module_options.insertStyleElement = insertStyleElement
7476
7886
  injectStylesIntoStyleTag_default()(FrequencyDataBoard_styles_module.Z, FrequencyDataBoard_styles_module_options);
7477
7887
  const components_FrequencyDataBoard_styles_module = FrequencyDataBoard_styles_module.Z && FrequencyDataBoard_styles_module.Z.locals ? FrequencyDataBoard_styles_module.Z.locals : void 0;
7478
7888
  const FrequencyDataBoard = ({ left, updateKey, onChange })=>{
7479
- const { state: { axisY, axisX: { frequencyFormat, unit }, series: { data: seriesData, legendExternal }, globalID, stationInfo } } = useStore_useStore();
7889
+ const { state: { axisY, axisX: { frequencyFormat, unit }, globalID, stationInfo } } = useStore_useStore();
7890
+ const filteredSeries = useFilteredSeries(globalID);
7480
7891
  const index = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(Number.NaN);
7481
7892
  const calculateIndex = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((data, n, series)=>{
7482
7893
  const values = data[n] || [];
@@ -7492,7 +7903,7 @@ const FrequencyDataBoard = ({ left, updateKey, onChange })=>{
7492
7903
  children: [
7493
7904
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
7494
7905
  className: components_FrequencyDataBoard_styles_module.label,
7495
- children: series?.label
7906
+ children: series?.label || n
7496
7907
  }),
7497
7908
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
7498
7909
  children: [
@@ -7517,28 +7928,24 @@ const FrequencyDataBoard = ({ left, updateKey, onChange })=>{
7517
7928
  const db = withDatabase(globalID);
7518
7929
  if (!db) return null;
7519
7930
  const rawData = db.getAllRawData();
7520
- const { spectrumExtra } = db;
7521
- const renderedSeries = [];
7522
- SERIES_NAMES.forEach((name)=>{
7523
- const series = seriesData.get(name);
7524
- if (series?.display && !legendExternal.includes(name)) renderedSeries.push(calculateIndex(rawData, name, series));
7525
- });
7526
- if (spectrumExtra) for (const [name, { originalData: d }] of spectrumExtra){
7527
- const series = seriesData.get(name);
7528
- if (series?.display && d && !legendExternal.includes(name)) renderedSeries.push(calculateIndex({
7529
- [name]: d
7530
- }, name, series));
7531
- }
7931
+ const { extraData } = rawData;
7932
+ const renderedSeries = filteredSeries.map((seriesItem)=>{
7933
+ const seriesData = rawData[seriesItem.name];
7934
+ if (seriesData) return calculateIndex(rawData, seriesItem.name, seriesItem);
7935
+ if (extraData?.[seriesItem.name]) return calculateIndex({
7936
+ [seriesItem.name]: extraData[seriesItem.name]
7937
+ }, seriesItem.name, seriesItem);
7938
+ return null;
7939
+ }).filter((item)=>null !== item);
7532
7940
  return renderedSeries;
7533
7941
  }, [
7534
7942
  calculateIndex,
7535
7943
  globalID,
7536
7944
  SERIES_NAMES,
7537
- seriesData,
7945
+ filteredSeries,
7538
7946
  updateKey,
7539
7947
  left,
7540
- axisY.unit,
7541
- legendExternal
7948
+ axisY.unit
7542
7949
  ]);
7543
7950
  const frequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>frequencyFormat(left), [
7544
7951
  left,
@@ -7569,7 +7976,11 @@ const FrequencyDataBoard = ({ left, updateKey, onChange })=>{
7569
7976
  frequency,
7570
7977
  stationInfo
7571
7978
  ]);
7572
- if (!frequency || left < 0) return null;
7979
+ const hasValue = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>value && (Array.isArray(value) ? value.length > 0 : true), [
7980
+ value
7981
+ ]);
7982
+ if (left < 0) return null;
7983
+ if (!frequency && !hasValue) return null;
7573
7984
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(Mask, {
7574
7985
  children: [
7575
7986
  frequency && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
@@ -7580,7 +7991,7 @@ const FrequencyDataBoard = ({ left, updateKey, onChange })=>{
7580
7991
  ]
7581
7992
  }),
7582
7993
  value,
7583
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(StationInfo, {
7994
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(FrequencyDataBoard_StationInfo, {
7584
7995
  stationInfo: sf
7585
7996
  })
7586
7997
  ]
@@ -7615,11 +8026,12 @@ const SpectrumPopover = ({ id })=>{
7615
8026
  });
7616
8027
  };
7617
8028
  const HeatmapPopover = ({ id })=>{
7618
- const { state: { cursor: { coord }, axisX: { frequencyFormat, unit: axisXUnit }, globalID, axisY: { unit: axisYUnit }, series: { data: seriesData } } } = useStore_useStore();
8029
+ const { state: { cursor: { coord }, axisX: { frequencyFormat, unit: axisXUnit }, globalID, axisY: { unit: axisYUnit } } } = useStore_useStore();
7619
8030
  const { left, top } = coord;
7620
8031
  const updateKey = useUpdateKey('HeatmapPopover', id);
7621
8032
  const [value, setValue] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)('');
7622
8033
  const [timestamp, setTimestamp] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)('');
8034
+ const { getSeries } = useSeriesForComponent(globalID);
7623
8035
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
7624
8036
  if (globalID && 0 !== left && 0 !== top) {
7625
8037
  const { waterfallData } = withDatabase(globalID).getAllRawData();
@@ -7644,8 +8056,8 @@ const HeatmapPopover = ({ id })=>{
7644
8056
  left,
7645
8057
  frequencyFormat
7646
8058
  ]);
7647
- const attr = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>seriesData.get(REAL_DATA_NAME), [
7648
- seriesData
8059
+ const attr = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>getSeries(REAL_DATA_NAME), [
8060
+ getSeries
7649
8061
  ]);
7650
8062
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(Mask, {
7651
8063
  children: [
@@ -7692,14 +8104,14 @@ const LevelStreamPopover = ({ id })=>{
7692
8104
  const [timestamp, setTimestamp] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)('');
7693
8105
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
7694
8106
  if (globalID && 0 !== left) {
7695
- const rawData = withDatabase(globalID).getAllRawData();
7696
- if (rawData.levelStreamData?.spectrumData && rawData.levelStreamData.spectrumData.length > 0) {
7697
- const index = Math.ceil(left / 100 * rawData.levelStreamData.spectrumData.length) - 1;
7698
- const clampedIndex = Math.max(0, Math.min(index, rawData.levelStreamData.spectrumData.length - 1));
7699
- const dataValue = rawData.levelStreamData.spectrumData[clampedIndex];
8107
+ const { levelStreamData } = withDatabase(globalID).getAllRawData();
8108
+ if (levelStreamData?.spectrumData && levelStreamData.spectrumData.length > 0) {
8109
+ const index = Math.ceil(left / 100 * levelStreamData.spectrumData.length) - 1;
8110
+ const clampedIndex = Math.max(0, Math.min(index, levelStreamData.spectrumData.length - 1));
8111
+ const dataValue = levelStreamData.spectrumData[clampedIndex];
7700
8112
  setValue(Number.isFinite(dataValue) ? dataValue.toFixed(1) : '');
7701
- if (rawData.levelStreamData.timestampData && rawData.levelStreamData.timestampData.length > clampedIndex) {
7702
- const timestampValue = rawData.levelStreamData.timestampData[clampedIndex];
8113
+ if (levelStreamData.timestampData && levelStreamData.timestampData.length > clampedIndex) {
8114
+ const timestampValue = levelStreamData.timestampData[clampedIndex];
7703
8115
  if (timestampValue) setTimestamp((0, utils.Fc)(timestampValue));
7704
8116
  }
7705
8117
  }
@@ -7743,13 +8155,12 @@ const OccupancyPopover = ()=>{
7743
8155
  const { state: { cursor: { coord }, axisX: { frequencyFormat, unit: axisXUnit }, globalID } } = useStore_useStore();
7744
8156
  const { left } = coord;
7745
8157
  const value = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
7746
- const { occupancy } = withDatabase(globalID);
7747
- const data = occupancy.data;
7748
- if (data && data.length > 0) {
8158
+ const { occupancyData } = withDatabase(globalID).getAllRawData();
8159
+ if (occupancyData && occupancyData.length > 0) {
7749
8160
  const { left } = coord;
7750
- let index = Math.ceil(left / 100 * data.length) - 1;
7751
- index = Math.max(0, Math.min(index, data.length - 1));
7752
- const item = Number.parseFloat(Number(data[index]).toFixed(1));
8161
+ let index = Math.ceil(left / 100 * occupancyData.length) - 1;
8162
+ index = Math.max(0, Math.min(index, occupancyData.length - 1));
8163
+ const item = Number.parseFloat(Number(occupancyData[index]).toFixed(1));
7753
8164
  return item;
7754
8165
  }
7755
8166
  return '';
@@ -7987,7 +8398,7 @@ const EventBus_EventBus = ({ id })=>{
7987
8398
  }, [
7988
8399
  EID
7989
8400
  ]);
7990
- const handleMouseMove = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((0, utils.P2)((e)=>{
8401
+ const handleMouseMove = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((0, utils.uA)((e)=>{
7991
8402
  createMoveEventManager(EID)(e, calculateEventRelativePosition(e));
7992
8403
  updateCursor();
7993
8404
  if (dragState.current.isDragging && dragState.current.startPoint.event) {
@@ -8170,7 +8581,7 @@ Area_styles_module_options.insertStyleElement = insertStyleElement_default();
8170
8581
  injectStylesIntoStyleTag_default()(Area_styles_module.Z, Area_styles_module_options);
8171
8582
  const HeatmapCapture_Area_styles_module = Area_styles_module.Z && Area_styles_module.Z.locals ? Area_styles_module.Z.locals : void 0;
8172
8583
  const Area_COMPONENT_KEY = constants_ToolType.HeatmapCapture;
8173
- const Area_Area = (props)=>{
8584
+ const Area = (props)=>{
8174
8585
  const { state: { heatmapCapture, segments, axisX: { frequencyFormat, unit }, system, globalID } } = useStore_useStore();
8175
8586
  const { id } = props;
8176
8587
  const { type, show, sync, onChange } = heatmapCapture;
@@ -8337,7 +8748,7 @@ const Area_Area = (props)=>{
8337
8748
  ]
8338
8749
  });
8339
8750
  };
8340
- const Area = Area_Area;
8751
+ const HeatmapCapture_Area = Area;
8341
8752
  var RowIndex_styles_module = __webpack_require__("../../../../node_modules/.pnpm/@rsbuild+core@1.3.18/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[11].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[11].use[2]!../../../../node_modules/.pnpm/@rsbuild+plugin-less@1.5.0_@rsbuild+core@1.5.17/node_modules/@rsbuild/plugin-less/compiled/less-loader/index.js??ruleSet[1].rules[11].use[3]!./src/components/HeatmapCapture/RowIndex/styles.module.less");
8342
8753
  var RowIndex_styles_module_options = {};
8343
8754
  RowIndex_styles_module_options.styleTagTransform = styleTagTransform_default();
@@ -8721,7 +9132,7 @@ const HeatmapCapture_HeatmapCapture = (props)=>{
8721
9132
  ...props
8722
9133
  }) : type === store_HeatmapCaptureType.RowIndex ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(HeatmapCapture_RowIndex, {
8723
9134
  ...props
8724
- }) : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Area, {
9135
+ }) : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(HeatmapCapture_Area, {
8725
9136
  ...props
8726
9137
  });
8727
9138
  };
@@ -8735,7 +9146,7 @@ PluginBox_styles_module_options.domAPI = styleDomAPI_default();
8735
9146
  PluginBox_styles_module_options.insertStyleElement = insertStyleElement_default();
8736
9147
  injectStylesIntoStyleTag_default()(PluginBox_styles_module.Z, PluginBox_styles_module_options);
8737
9148
  const components_PluginBox_styles_module = PluginBox_styles_module.Z && PluginBox_styles_module.Z.locals ? PluginBox_styles_module.Z.locals : void 0;
8738
- const PluginBox = (props)=>{
9149
+ const PluginBox_PluginBox = (props)=>{
8739
9150
  const { children } = props;
8740
9151
  const { pluginBoxWidth } = useAxisYWidth_useAxisYWidth();
8741
9152
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
@@ -8746,7 +9157,7 @@ const PluginBox = (props)=>{
8746
9157
  children: children
8747
9158
  });
8748
9159
  };
8749
- const components_PluginBox = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].memo(PluginBox);
9160
+ const PluginBox = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].memo(PluginBox_PluginBox);
8750
9161
  const info2step = (info)=>{
8751
9162
  const { min, max } = info;
8752
9163
  const diff = max - min;
@@ -8804,10 +9215,13 @@ class Range {
8804
9215
  const { realRange } = axisY;
8805
9216
  if (!realRange || !globalID) return;
8806
9217
  const db = withDatabase(globalID).getAllRawData?.();
9218
+ const realData = db[SERIES.realData.name] || new Float32Array();
9219
+ const maxData = db[SERIES.maxData.name] || new Float32Array();
9220
+ const minData = db[SERIES.minData.name] || new Float32Array();
8807
9221
  const allData = [
8808
- ...db[SERIES.realData.name],
8809
- ...db[SERIES.maxData.name],
8810
- ...db[SERIES.minData.name]
9222
+ ...Array.from(realData),
9223
+ ...Array.from(maxData),
9224
+ ...Array.from(minData)
8811
9225
  ];
8812
9226
  const allInfo = (0, utils.kL)(allData);
8813
9227
  let { avg } = allInfo;
@@ -9176,7 +9590,7 @@ const Heatmap_Heatmap = (props)=>{
9176
9590
  id: id,
9177
9591
  chart: chart
9178
9592
  }),
9179
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(components_PluginBox, {
9593
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(PluginBox, {
9180
9594
  children: [
9181
9595
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Boundary, {}),
9182
9596
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Chart, {}),
@@ -9657,12 +10071,12 @@ const useRange = ({ chart })=>{
9657
10071
  return ranging;
9658
10072
  };
9659
10073
  const spectrum_useRanging = useRange;
9660
- const passThroughSeries = (globalID, series)=>subscription_openData(`passThroughSeries-${globalID}`, series, {});
9661
10074
  class Spectrum {
9662
10075
  state;
9663
10076
  useRangeAutoFocus;
9664
10077
  useRangeSet;
9665
10078
  firstRenderAutoFocus;
10079
+ seriesUnsubscribe;
9666
10080
  constructor(props){
9667
10081
  this.state = {
9668
10082
  chart: null,
@@ -9677,6 +10091,32 @@ class Spectrum {
9677
10091
  };
9678
10092
  this.firstRenderAutoFocus = false;
9679
10093
  this.init();
10094
+ this.initSeriesSubscription();
10095
+ }
10096
+ initSeriesSubscription() {
10097
+ if (!this.state.globalID) return;
10098
+ const subscriptions = [];
10099
+ subscriptions.push(subscribeToSeries(this.state.globalID, events_SeriesEventName.UPDATED, (data)=>{
10100
+ this.setSeries(data.config, true);
10101
+ }));
10102
+ subscriptions.push(subscribeToSeries(this.state.globalID, events_SeriesEventName.MODE_CHANGED, ()=>{
10103
+ this.initSeries();
10104
+ }));
10105
+ subscriptions.push(subscribeToSeries(this.state.globalID, events_SeriesEventName.TYPE_OVERRIDE_CHANGED, ()=>{
10106
+ this.initSeries();
10107
+ }));
10108
+ subscriptions.push(subscribeToSeries(this.state.globalID, events_SeriesEventName.BATCH_UPDATED, (data)=>{
10109
+ data.configs.forEach((config)=>{
10110
+ this.setSeries(config, true);
10111
+ });
10112
+ }));
10113
+ subscriptions.push(subscribeToSeries(this.state.globalID, events_SeriesEventName.RESET, ()=>{
10114
+ this.state.series = {};
10115
+ this.initSeries();
10116
+ }));
10117
+ this.seriesUnsubscribe = ()=>{
10118
+ for (const unsubscribe of subscriptions)unsubscribe();
10119
+ };
9680
10120
  }
9681
10121
  init() {
9682
10122
  const { id, renderRange } = this.state;
@@ -9695,10 +10135,11 @@ class Spectrum {
9695
10135
  });
9696
10136
  }
9697
10137
  initSeries() {
9698
- Object.values(SERIES).forEach((config)=>{
9699
- if (config.name === SERIES.templateData.name) config.type = type_GraphicType.Area;
9700
- this.setSeries(JSON.parse(JSON.stringify(config)));
9701
- return config;
10138
+ const { globalID } = this.state;
10139
+ if (!globalID) throw new Error('globalID is required for series initialization');
10140
+ const seriesWithTypes = getSeriesWithGraphicType(globalID);
10141
+ seriesWithTypes.forEach((config)=>{
10142
+ this.setSeries(config);
9702
10143
  });
9703
10144
  }
9704
10145
  updateSeries(d, extraData) {
@@ -9717,13 +10158,17 @@ class Spectrum {
9717
10158
  }
9718
10159
  }
9719
10160
  }
9720
- if (extraData) for (const [name, { outputData }] of extraData){
9721
- const seriesConfig = series[name];
9722
- if (outputData) chart.render({
9723
- ...seriesConfig,
9724
- name,
9725
- data: outputData
9726
- });
10161
+ if (extraData) {
10162
+ const extraDataArray = Object.entries(extraData);
10163
+ for(let i = 0; i < extraDataArray.length; i += 1){
10164
+ const [name, outputData] = extraDataArray[i];
10165
+ const seriesConfig = series[name];
10166
+ if (outputData) chart.render({
10167
+ ...seriesConfig,
10168
+ name,
10169
+ data: outputData
10170
+ });
10171
+ }
9727
10172
  }
9728
10173
  }
9729
10174
  updateMainSeries(data) {
@@ -9746,7 +10191,7 @@ class Spectrum {
9746
10191
  ...params
9747
10192
  };
9748
10193
  }
9749
- setSeries(config) {
10194
+ setSeries(config, skipEventEmit = false) {
9750
10195
  const { chart, series, globalID } = this.state;
9751
10196
  const { name } = config;
9752
10197
  if (!chart || !name || !config) return;
@@ -9763,7 +10208,18 @@ class Spectrum {
9763
10208
  };
9764
10209
  series[name] = c;
9765
10210
  chart.setSeries(c);
9766
- passThroughSeries(globalID, series);
10211
+ if (!skipEventEmit && globalID) try {
10212
+ updateSeries(globalID, {
10213
+ name,
10214
+ label: config.label || name,
10215
+ color,
10216
+ thickness,
10217
+ display,
10218
+ type
10219
+ });
10220
+ } catch (error) {
10221
+ console.warn('Failed to update series in new management system:', error);
10222
+ }
9767
10223
  }
9768
10224
  setDisabledClearRect(disabledClearRect) {
9769
10225
  const { chart } = this.state;
@@ -9794,6 +10250,10 @@ class Spectrum {
9794
10250
  this.state.chart.resize();
9795
10251
  }
9796
10252
  clear() {
10253
+ if (this.seriesUnsubscribe) {
10254
+ this.seriesUnsubscribe();
10255
+ this.seriesUnsubscribe = void 0;
10256
+ }
9797
10257
  const { chart } = this.state;
9798
10258
  chart.clear();
9799
10259
  }
@@ -10681,7 +11141,7 @@ const components_Dropdown_styles_module = Dropdown_styles_module.Z && Dropdown_s
10681
11141
  const Dropdown = ({ value, options, onChange, placeholder = "\u8BF7\u9009\u62E9", closeOnSelect = true })=>{
10682
11142
  const [isOpen, setIsOpen] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
10683
11143
  const handleSelect = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((value)=>{
10684
- onChange(value);
11144
+ onChange?.(value);
10685
11145
  if (closeOnSelect) setIsOpen(false);
10686
11146
  }, [
10687
11147
  onChange,
@@ -10920,150 +11380,126 @@ const SegmentsDisplayControl_SegmentsDisplayControl = ()=>{
10920
11380
  };
10921
11381
  const SegmentsDisplayControl = SegmentsDisplayControl_SegmentsDisplayControl;
10922
11382
  const SeriesControl = ({ type })=>{
10923
- const [currentMode, setCurrentMode] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)('line');
10924
- const { state: { publish } } = useStore_useStore();
10925
- const seriesModes = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>({
10926
- line: {
10927
- realData: type_GraphicType.Line,
10928
- minData: type_GraphicType.Line,
10929
- maxData: type_GraphicType.Line,
10930
- avgData: type_GraphicType.Line,
10931
- label: "\u6298\u7EBF\u6A21\u5F0F"
10932
- },
10933
- stepline: {
10934
- realData: type_GraphicType.Stepline,
10935
- minData: type_GraphicType.Stepline,
10936
- maxData: type_GraphicType.Stepline,
10937
- avgData: type_GraphicType.Stepline,
10938
- label: "\u9636\u68AF\u7EBF\u6A21\u5F0F"
10939
- },
10940
- bar: {
10941
- realData: type_GraphicType.Bar,
10942
- minData: type_GraphicType.Line,
10943
- maxData: type_GraphicType.Line,
10944
- avgData: type_GraphicType.Line,
10945
- label: "\u67F1\u72B6\u56FE\u6A21\u5F0F"
10946
- },
10947
- area: {
10948
- realData: type_GraphicType.Area,
10949
- minData: type_GraphicType.Stepline,
10950
- maxData: type_GraphicType.Stepline,
10951
- avgData: type_GraphicType.Stepline,
10952
- label: "\u9762\u79EF\u56FE\u6A21\u5F0F"
10953
- }
10954
- }), []);
11383
+ const { state: { globalID } } = useStore_useStore();
11384
+ const { mode: currentMode } = useSeriesManager(globalID);
10955
11385
  const handleSeriesControl = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
10956
11386
  if (type === constants_ChartType.MScan || type === constants_ChartType.ScanDF360) return;
10957
- const modes = [
10958
- 'bar',
10959
- 'stepline',
10960
- 'line',
10961
- 'area'
10962
- ];
10963
- const currentIndex = modes.indexOf(currentMode);
10964
- const nextMode = modes[(currentIndex + 1) % modes.length];
10965
- setCurrentMode(nextMode);
10966
- const modeConfig = seriesModes[nextMode];
10967
- if (publish) {
10968
- publish({
10969
- pstype: constants_PSType.Series,
10970
- name: 'realData',
10971
- type: modeConfig.realData
10972
- });
10973
- publish({
10974
- pstype: constants_PSType.Series,
10975
- name: 'minData',
10976
- type: modeConfig.minData
10977
- });
10978
- publish({
10979
- pstype: constants_PSType.Series,
10980
- name: 'maxData',
10981
- type: modeConfig.maxData
10982
- });
10983
- publish({
10984
- pstype: constants_PSType.Series,
10985
- name: 'avgData',
10986
- type: modeConfig.avgData
10987
- });
10988
- }
11387
+ if (!globalID) return;
11388
+ toggleSeriesMode(globalID);
10989
11389
  }, [
10990
- currentMode,
10991
- publish,
10992
- seriesModes,
11390
+ globalID,
10993
11391
  type
10994
11392
  ]);
10995
11393
  const title = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
10996
11394
  if (type === constants_ChartType.MScan || type === constants_ChartType.ScanDF360) return `\u{56FE}\u{5F62}\u{6A21}\u{5F0F}\u{5207}\u{6362}\u{5DF2}\u{7981}\u{7528}`;
10997
- return `${seriesModes[currentMode].label}-\u{70B9}\u{51FB}\u{5207}\u{6362}`;
11395
+ return `\u{5F53}\u{524D}\u{56FE}\u{5F62}\u{6A21}\u{5F0F}\u{FF1A}${SERIES_MODES[currentMode]?.label || currentMode}`;
10998
11396
  }, [
10999
11397
  currentMode,
11000
- seriesModes,
11001
11398
  type
11002
11399
  ]);
11003
- const isDisabled = type === constants_ChartType.MScan || type === constants_ChartType.ScanDF360;
11400
+ const renderIcon = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>()=>{
11401
+ switch(currentMode){
11402
+ case modes_SeriesMode.Bar:
11403
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("svg", {
11404
+ width: "16",
11405
+ height: "16",
11406
+ viewBox: "0 0 16 16",
11407
+ fill: "none",
11408
+ xmlns: "http://www.w3.org/2000/svg",
11409
+ children: [
11410
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("rect", {
11411
+ x: "2",
11412
+ y: "8",
11413
+ width: "2",
11414
+ height: "6",
11415
+ fill: "currentColor"
11416
+ }),
11417
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("rect", {
11418
+ x: "5",
11419
+ y: "4",
11420
+ width: "2",
11421
+ height: "10",
11422
+ fill: "currentColor"
11423
+ }),
11424
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("rect", {
11425
+ x: "8",
11426
+ y: "6",
11427
+ width: "2",
11428
+ height: "8",
11429
+ fill: "currentColor"
11430
+ }),
11431
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("rect", {
11432
+ x: "11",
11433
+ y: "2",
11434
+ width: "2",
11435
+ height: "12",
11436
+ fill: "currentColor"
11437
+ })
11438
+ ]
11439
+ });
11440
+ case modes_SeriesMode.StepLine:
11441
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("svg", {
11442
+ width: "16",
11443
+ height: "16",
11444
+ viewBox: "0 0 16 16",
11445
+ fill: "none",
11446
+ xmlns: "http://www.w3.org/2000/svg",
11447
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
11448
+ d: "M2 12H4V8H6V8H8V4H10V4H12V2H14",
11449
+ stroke: "currentColor",
11450
+ strokeWidth: "1.5",
11451
+ fill: "none"
11452
+ })
11453
+ });
11454
+ case modes_SeriesMode.Line:
11455
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("svg", {
11456
+ width: "16",
11457
+ height: "16",
11458
+ viewBox: "0 0 16 16",
11459
+ fill: "none",
11460
+ xmlns: "http://www.w3.org/2000/svg",
11461
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
11462
+ d: "M2 12L5 8L8 10L11 4L14 6",
11463
+ stroke: "currentColor",
11464
+ strokeWidth: "1.5",
11465
+ fill: "none"
11466
+ })
11467
+ });
11468
+ case modes_SeriesMode.Area:
11469
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("svg", {
11470
+ width: "16",
11471
+ height: "16",
11472
+ viewBox: "0 0 16 16",
11473
+ fill: "none",
11474
+ xmlns: "http://www.w3.org/2000/svg",
11475
+ children: [
11476
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
11477
+ d: "M2 12L5 8L8 10L11 4L14 6V14H2V12Z",
11478
+ fill: "currentColor",
11479
+ opacity: "0.6"
11480
+ }),
11481
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
11482
+ d: "M2 12L5 8L8 10L11 4L14 6",
11483
+ stroke: "currentColor",
11484
+ strokeWidth: "1.5",
11485
+ fill: "none"
11486
+ })
11487
+ ]
11488
+ });
11489
+ default:
11490
+ return null;
11491
+ }
11492
+ }, [
11493
+ currentMode
11494
+ ]);
11004
11495
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ToolsBar_IconBox, {
11005
- onClick: isDisabled ? void 0 : handleSeriesControl,
11006
11496
  title: title,
11007
- style: isDisabled ? {
11497
+ onClick: type === constants_ChartType.MScan || type === constants_ChartType.ScanDF360 ? void 0 : handleSeriesControl,
11498
+ style: type === constants_ChartType.MScan || type === constants_ChartType.ScanDF360 ? {
11008
11499
  opacity: 0.5,
11009
11500
  cursor: 'not-allowed'
11010
11501
  } : void 0,
11011
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("svg", {
11012
- viewBox: "0 0 1024 1024",
11013
- xmlns: "http://www.w3.org/2000/svg",
11014
- children: [
11015
- 'bar' === currentMode && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("g", {
11016
- children: [
11017
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
11018
- d: "M556.8 128l128 0 0 768-128 0 0-768Z",
11019
- fill: "var(--theme-color-primary)"
11020
- }),
11021
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
11022
- d: "M768 512l128 0 0 384-128 0 0-384Z",
11023
- fill: "var(--theme-color-primary)"
11024
- }),
11025
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
11026
- d: "M352 384l128 0 0 512-128 0 0-512Z",
11027
- fill: "var(--theme-color-primary)"
11028
- }),
11029
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
11030
- d: "M128 640l128 0 0 256-128 0 0-256Z",
11031
- fill: "var(--theme-color-primary)"
11032
- })
11033
- ]
11034
- }),
11035
- 'line' === currentMode && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("g", {
11036
- children: [
11037
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
11038
- d: "M62.1 844.9H959v60.7H62.1zM275.8 606.5L494 763.7 956.1 491l-51.4-83.5-404.3 240.7-231-163.7L64 651.4l61 77z",
11039
- fill: "var(--theme-color-primary)"
11040
- }),
11041
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
11042
- d: "M275.8 317.7L494 474.9l462.1-272.7-51.4-83.5-404.3 240.7-231-163.6L64 362.6l61 77z",
11043
- fill: "var(--theme-color-primary)"
11044
- })
11045
- ]
11046
- }),
11047
- 'stepline' === currentMode && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("g", {
11048
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
11049
- d: "M375.466667 930.133333H136.533333v-268.8h68.266667v200.533334h102.4v-768h238.933333v512h102.4v-384h238.933334v610.133333h-68.266667V290.133333h-102.4v384h-238.933333v-512H375.466667z",
11050
- fill: "var(--theme-color-primary)"
11051
- })
11052
- }),
11053
- 'area' === currentMode && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("g", {
11054
- children: [
11055
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
11056
- d: "M128 512l256-256 256 256 256-256v640H128V512z",
11057
- fill: "var(--theme-color-primary)"
11058
- }),
11059
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
11060
- d: "M896 928H128a32 32 0 0 1-32-32V512a32 32 0 0 1 9.28-22.72l256-256a32 32 0 0 1 45.44 0l233.28 233.6 233.28-233.6a32 32 0 0 1 34.88-6.72A32 32 0 0 1 928 256v640a32 32 0 0 1-32 32zM160 864h704V333.12l-201.28 201.6a32 32 0 0 1-45.44 0L384 301.12l-224 224z",
11061
- fill: "var(--theme-color-primary)"
11062
- })
11063
- ]
11064
- })
11065
- ]
11066
- })
11502
+ children: renderIcon()
11067
11503
  });
11068
11504
  };
11069
11505
  const ToolsBar_SeriesControl = SeriesControl;
@@ -11076,197 +11512,137 @@ SeriesDisplayControl_styles_module_options.domAPI = styleDomAPI_default();
11076
11512
  SeriesDisplayControl_styles_module_options.insertStyleElement = insertStyleElement_default();
11077
11513
  injectStylesIntoStyleTag_default()(SeriesDisplayControl_styles_module.Z, SeriesDisplayControl_styles_module_options);
11078
11514
  const ToolsBar_SeriesDisplayControl_styles_module = SeriesDisplayControl_styles_module.Z && SeriesDisplayControl_styles_module.Z.locals ? SeriesDisplayControl_styles_module.Z.locals : void 0;
11079
- const SeriesDisplayControl_SeriesDisplayControl = ()=>{
11080
- const { state: { globalID, series }, dispatch } = useStore_useStore();
11081
- const { data, legendExternal, forceDisplay } = series;
11082
- const [updateCounter, setUpdateCounter] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(0);
11083
- const dataSnapshot = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
11084
- const snapshot = {};
11085
- data.forEach((value, key)=>{
11086
- snapshot[key] = {
11087
- ...value
11088
- };
11089
- });
11090
- return snapshot;
11091
- }, [
11092
- data,
11093
- updateCounter
11094
- ]);
11095
- const seriesArray = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>Object.keys(dataSnapshot).filter((name)=>!legendExternal.includes(name)).filter((name)=>name !== constants_SeriesType.TemplateData), [
11096
- dataSnapshot,
11097
- legendExternal
11098
- ]);
11099
- const seriesDataSnapshot = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
11100
- const snapshot = {};
11101
- seriesArray.forEach((name)=>{
11102
- const item = dataSnapshot[name];
11103
- if (item) snapshot[name] = {
11104
- display: item.display,
11105
- label: item.label || name,
11106
- color: item.color || 'var(--theme-color-primary)'
11107
- };
11108
- });
11109
- return snapshot;
11110
- }, [
11111
- seriesArray,
11112
- dataSnapshot
11113
- ]);
11114
- const handleDropdownClick = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
11115
- setUpdateCounter((prev)=>prev + 1);
11116
- }, []);
11117
- const handleSeriesToggle = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((name, isDisplayTrue)=>{
11118
- if (globalID) {
11119
- const item = data.get(name);
11120
- if (item) {
11121
- const newDisplay = isDisplayTrue ? true : !item.display;
11122
- data.set(name, {
11123
- ...item,
11124
- display: newDisplay
11125
- });
11126
- series.data = data;
11127
- setUpdateCounter((prev)=>prev + 1);
11128
- dispatch({
11129
- payload: {
11130
- series
11131
- }
11132
- });
11133
- tools(globalID, constants_ModuleType.Spectrum)({
11134
- pstype: constants_PSType.Series,
11515
+ const SeriesDisplayControl = ()=>{
11516
+ const { state: { globalID, series: seriesConfig } } = useStore_useStore();
11517
+ const filteredSeries = useFilteredSeries(globalID);
11518
+ const { forceUpdate } = useSeriesForComponent(globalID);
11519
+ (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
11520
+ if (!globalID || !seriesConfig?.forceDisplay) return;
11521
+ const hiddenSeries = filteredSeries.filter((item)=>!item.display);
11522
+ if (hiddenSeries.length > 0) {
11523
+ hiddenSeries.forEach(({ name })=>{
11524
+ updateSeries(globalID, {
11135
11525
  name,
11136
- display: newDisplay
11526
+ display: true
11137
11527
  });
11138
- }
11528
+ });
11529
+ forceUpdate();
11139
11530
  }
11140
11531
  }, [
11141
- series,
11142
- data,
11143
11532
  globalID,
11144
- dispatch
11533
+ seriesConfig?.forceDisplay,
11534
+ filteredSeries.length
11145
11535
  ]);
11146
- (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
11147
- if (forceDisplay) Object.values(SERIES).filter((s)=>!s.display).map((s)=>s.name).forEach((s)=>{
11148
- if (!legendExternal.includes(s)) setTimeout(()=>{
11149
- handleSeriesToggle(s, true);
11150
- }, 1);
11536
+ const updateSeriesDisplay = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((updates)=>{
11537
+ updates.forEach(({ name, display })=>{
11538
+ updateSeries(globalID, {
11539
+ name,
11540
+ display
11541
+ });
11151
11542
  });
11543
+ forceUpdate();
11152
11544
  }, [
11153
- forceDisplay,
11154
- seriesArray,
11155
- handleSeriesToggle
11545
+ globalID,
11546
+ forceUpdate
11156
11547
  ]);
11157
- const handleSelect = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((value)=>{
11158
- if (null === value) {
11159
- const allDisplayed = seriesArray.every((name)=>{
11160
- const item = data.get(name);
11161
- return item?.display;
11162
- });
11163
- seriesArray.forEach((name)=>{
11164
- handleSeriesToggle(name, !allDisplayed);
11165
- });
11166
- } else if ('string' == typeof value) handleSeriesToggle(value);
11548
+ const handleSeriesToggle = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((seriesName, display)=>{
11549
+ updateSeriesDisplay([
11550
+ {
11551
+ name: seriesName,
11552
+ display
11553
+ }
11554
+ ]);
11167
11555
  }, [
11168
- seriesArray,
11169
- data,
11170
- handleSeriesToggle
11556
+ updateSeriesDisplay
11171
11557
  ]);
11172
- const displayedSeries = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
11173
- const displayed = seriesArray.filter((name)=>{
11174
- const isDisplayed = seriesDataSnapshot[name]?.display;
11175
- return isDisplayed;
11176
- });
11177
- return displayed;
11558
+ const handleSelectAll = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((selectAll)=>{
11559
+ const updates = filteredSeries.filter((item)=>item.display !== selectAll).map((item)=>({
11560
+ name: item.name,
11561
+ display: selectAll
11562
+ }));
11563
+ if (updates.length > 0) updateSeriesDisplay(updates);
11178
11564
  }, [
11179
- seriesArray,
11180
- seriesDataSnapshot
11565
+ filteredSeries,
11566
+ updateSeriesDisplay
11181
11567
  ]);
11182
- const options = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
11183
- const allDisplayed = seriesArray.every((name)=>seriesDataSnapshot[name]?.display);
11184
- const baseOptions = [
11185
- {
11186
- value: null,
11187
- label: allDisplayed ? "\u9690\u85CF\u6240\u6709\u7CFB\u5217" : "\u663E\u793A\u6240\u6709\u7CFB\u5217"
11188
- }
11189
- ];
11190
- const seriesOptions = seriesArray.map((name)=>{
11191
- const itemSnapshot = seriesDataSnapshot[name];
11568
+ const dropdownOptions = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
11569
+ const allVisible = filteredSeries.every((item)=>item.display);
11570
+ const seriesOptions = filteredSeries.map((item)=>{
11571
+ const displayClass = item.display ? ToolsBar_SeriesDisplayControl_styles_module.displayed : ToolsBar_SeriesDisplayControl_styles_module.hidden;
11192
11572
  return {
11193
- value: name,
11194
- label: itemSnapshot?.label || name,
11195
- render: ()=>{
11196
- const currentSnapshot = seriesDataSnapshot[name];
11197
- const isDisplayed = currentSnapshot?.display;
11198
- if (!currentSnapshot) return null;
11199
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
11573
+ label: item.label || item.name,
11574
+ value: item.name,
11575
+ render: ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
11200
11576
  className: ToolsBar_SeriesDisplayControl_styles_module.seriesOption,
11577
+ onClick: ()=>handleSeriesToggle(item.name, !item.display),
11201
11578
  children: [
11202
11579
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
11203
- className: `${ToolsBar_SeriesDisplayControl_styles_module.seriesIndicator} ${isDisplayed ? ToolsBar_SeriesDisplayControl_styles_module.displayed : ToolsBar_SeriesDisplayControl_styles_module.hidden}`,
11580
+ className: `${ToolsBar_SeriesDisplayControl_styles_module.seriesIndicator} ${displayClass}`,
11204
11581
  style: {
11205
- backgroundColor: isDisplayed ? currentSnapshot.color : 'transparent'
11582
+ backgroundColor: item.display ? item.color : 'transparent'
11206
11583
  }
11207
11584
  }),
11208
11585
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
11209
- className: `${ToolsBar_SeriesDisplayControl_styles_module.seriesLabel} ${isDisplayed ? ToolsBar_SeriesDisplayControl_styles_module.displayed : ToolsBar_SeriesDisplayControl_styles_module.hidden}`,
11210
- children: currentSnapshot.label
11586
+ className: `${ToolsBar_SeriesDisplayControl_styles_module.seriesLabel} ${displayClass}`,
11587
+ children: item.label || item.name
11211
11588
  })
11212
11589
  ]
11213
- });
11214
- }
11590
+ })
11215
11591
  };
11216
11592
  });
11217
11593
  return [
11218
- ...baseOptions,
11594
+ {
11595
+ label: allVisible ? "\u5168\u4E0D\u9009" : "\u5168\u9009",
11596
+ value: 'select-all',
11597
+ render: ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
11598
+ className: ToolsBar_SeriesDisplayControl_styles_module.selectAllOption,
11599
+ onClick: ()=>handleSelectAll(!allVisible),
11600
+ children: allVisible ? "\u5168\u4E0D\u9009" : "\u5168\u9009"
11601
+ })
11602
+ },
11219
11603
  ...seriesOptions
11220
11604
  ];
11221
11605
  }, [
11222
- seriesArray,
11223
- seriesDataSnapshot
11606
+ filteredSeries,
11607
+ handleSeriesToggle,
11608
+ handleSelectAll
11224
11609
  ]);
11225
11610
  const currentValue = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
11226
- if (0 === displayedSeries.length) return "\u65E0\u7CFB\u5217\u663E\u793A";
11227
- if (1 === displayedSeries.length) {
11228
- const singleSeries = displayedSeries[0];
11229
- const label = seriesDataSnapshot[singleSeries]?.label || singleSeries;
11230
- return label;
11231
- }
11232
- const value = `${displayedSeries.length} \u{4E2A}\u{7CFB}\u{5217}`;
11233
- return value;
11611
+ const visibleCount = filteredSeries.filter((item)=>item.display).length;
11612
+ const totalCount = filteredSeries.length;
11613
+ if (0 === visibleCount) return "\u65E0\u9009\u62E9";
11614
+ if (visibleCount === totalCount) return "\u5168\u90E8";
11615
+ return `${visibleCount}/${totalCount}`;
11234
11616
  }, [
11235
- displayedSeries,
11236
- seriesDataSnapshot
11617
+ filteredSeries
11237
11618
  ]);
11238
- if (!(data instanceof Map)) return null;
11239
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
11240
- onClick: handleDropdownClick,
11241
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(components_Dropdown, {
11242
- value: currentValue,
11243
- options: options,
11244
- onChange: handleSelect,
11245
- placeholder: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ToolsBar_IconBox, {
11246
- title: "\u7CFB\u5217\u663E\u793A\u63A7\u5236",
11247
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("svg", {
11248
- viewBox: "0 0 1024 1024",
11249
- version: "1.1",
11250
- xmlns: "http://www.w3.org/2000/svg",
11251
- width: "16",
11252
- height: "16",
11253
- children: [
11254
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
11255
- d: "M930.909091 896H93.090909c-18.618182 0-34.909091-16.290909-34.909091-34.909091V162.909091c0-18.618182 16.290909-34.909091 34.909091-34.909091h837.818182c18.618182 0 34.909091 16.290909 34.909091 34.909091v698.181818c0 18.618182-16.290909 34.909091-34.909091 34.909091z m-802.909091-69.818182h770.327273v-628.363636H128v628.363636z",
11256
- fill: "var(--theme-color-primary)"
11257
- }),
11258
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
11259
- d: "M232.727273 640c-4.654545 0-9.309091 0-13.963637-2.327273-16.290909-6.981818-25.6-27.927273-18.618181-44.218182l116.363636-279.272727c4.654545-11.636364 16.290909-20.945455 30.254545-20.945454 13.963636 0 25.6 4.654545 32.581819 16.290909l83.781818 146.618182H814.545455c18.618182 0 34.909091 16.290909 34.90909 34.90909s-16.290909 34.909091-34.90909 34.909091H442.181818c-11.636364 0-23.272727-6.981818-30.254545-16.290909l-58.181818-102.4-90.763637 216.436364c-4.654545 6.981818-16.290909 16.290909-30.254545 16.290909zM814.545455 663.272727H488.727273c-18.618182 0-34.909091-16.290909-34.909091-34.909091s16.290909-34.909091 34.909091-34.909091h325.818182c18.618182 0 34.909091 16.290909 34.90909 34.909091s-16.290909 34.909091-34.90909 34.909091z",
11260
- fill: "var(--theme-color-primary)"
11261
- })
11262
- ]
11263
- })
11264
- }),
11265
- closeOnSelect: false
11266
- })
11619
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(components_Dropdown, {
11620
+ value: currentValue,
11621
+ options: dropdownOptions,
11622
+ placeholder: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ToolsBar_IconBox, {
11623
+ title: "\u7CFB\u5217\u663E\u793A\u63A7\u5236",
11624
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("svg", {
11625
+ viewBox: "0 0 1024 1024",
11626
+ version: "1.1",
11627
+ xmlns: "http://www.w3.org/2000/svg",
11628
+ width: "16",
11629
+ height: "16",
11630
+ children: [
11631
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
11632
+ d: "M930.909091 896H93.090909c-18.618182 0-34.909091-16.290909-34.909091-34.909091V162.909091c0-18.618182 16.290909-34.909091 34.909091-34.909091h837.818182c18.618182 0 34.909091 16.290909 34.909091 34.909091v698.181818c0 18.618182-16.290909 34.909091-34.909091 34.909091z m-802.909091-69.818182h770.327273v-628.363636H128v628.363636z",
11633
+ fill: "var(--theme-color-primary)"
11634
+ }),
11635
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
11636
+ d: "M232.727273 640c-4.654545 0-9.309091 0-13.963637-2.327273-16.290909-6.981818-25.6-27.927273-18.618181-44.218182l116.363636-279.272727c4.654545-11.636364 16.290909-20.945455 30.254545-20.945454 13.963636 0 25.6 4.654545 32.581819 16.290909l83.781818 146.618182H814.545455c18.618182 0 34.909091 16.290909 34.90909 34.90909s-16.290909 34.909091-34.90909 34.909091H442.181818c-11.636364 0-23.272727-6.981818-30.254545-16.290909l-58.181818-102.4-90.763637 216.436364c-4.654545 6.981818-16.290909 16.290909-30.254545 16.290909zM814.545455 663.272727H488.727273c-18.618182 0-34.909091-16.290909-34.909091-34.909091s16.290909-34.909091 34.909091-34.909091h325.818182c18.618182 0 34.909091 16.290909 34.90909 34.909091s-16.290909 34.909091-34.90909 34.909091z",
11637
+ fill: "var(--theme-color-primary)"
11638
+ })
11639
+ ]
11640
+ })
11641
+ }),
11642
+ closeOnSelect: false
11267
11643
  });
11268
11644
  };
11269
- const SeriesDisplayControl = SeriesDisplayControl_SeriesDisplayControl;
11645
+ const ToolsBar_SeriesDisplayControl = SeriesDisplayControl;
11270
11646
  const SpacerLine = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
11271
11647
  className: components_ToolsBar_styles_module.spacerLine
11272
11648
  });
@@ -11404,7 +11780,7 @@ const TOOL_CONFIGS = [
11404
11780
  ]
11405
11781
  },
11406
11782
  {
11407
- component: SeriesDisplayControl,
11783
+ component: ToolsBar_SeriesDisplayControl,
11408
11784
  toolType: constants_ToolsBarItemType.SeriesDisplayControl,
11409
11785
  supportedCharts: [
11410
11786
  constants_ChartType.SingleFrequency,
@@ -11651,7 +12027,7 @@ const LINE_WIDTH_BASE = 0.5;
11651
12027
  const MAJOR_TICK_LENGTH = 6;
11652
12028
  const MINOR_TICK_LENGTH = 4;
11653
12029
  const TEXT_OFFSET = 8;
11654
- const MINOR_TICK_DIVISIONS = 4;
12030
+ const MINOR_TICK_DIVISIONS = 2;
11655
12031
  const MIN_TICK_SPACING = 4;
11656
12032
  const MIN_CONTAINER_HEIGHT = 100;
11657
12033
  const IDEAL_TICK_COUNT = 7;
@@ -11693,18 +12069,14 @@ function useCanvasAxisY(options = {}) {
11693
12069
  resizeObserver.observe(container);
11694
12070
  return ()=>resizeObserver.disconnect();
11695
12071
  }, []);
11696
- const formatTickLabel = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((value)=>{
11697
- if (Math.abs(value) >= 1000) return `${(value / 1000).toFixed(1)}k`;
11698
- if (Math.abs(value) < 0.01 && 0 !== value) return value.toExponential(1);
11699
- const rangeSpan = range.max - range.min;
11700
- if (rangeSpan < 1) {
11701
- const decimalPlaces = Math.max(2, Math.ceil(-Math.log10(rangeSpan)) + 1);
11702
- return value.toFixed(Math.min(decimalPlaces, 4));
12072
+ const formatTickLabel = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((value, formatStrategy)=>{
12073
+ if (formatStrategy.useScientific) return value.toExponential(1);
12074
+ if (formatStrategy.useKFormat) {
12075
+ const kValue = value / 1000;
12076
+ return formatStrategy.useDecimals ? `${kValue.toFixed(1)}k` : `${Math.round(kValue)}k`;
11703
12077
  }
11704
- return value.toFixed(Math.abs(value) < 1 ? 2 : 1);
11705
- }, [
11706
- range
11707
- ]);
12078
+ return formatStrategy.useDecimals ? value.toFixed(1) : Math.round(value).toString();
12079
+ }, []);
11708
12080
  const ticksData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
11709
12081
  if (0 === containerHeight) return {
11710
12082
  majorTicks: [],
@@ -11719,8 +12091,18 @@ function useCanvasAxisY(options = {}) {
11719
12091
  interval = normalizedInterval <= 1 ? magnitude : normalizedInterval <= 2 ? 2 * magnitude : normalizedInterval <= 5 ? 5 * magnitude : 10 * magnitude;
11720
12092
  const minTickInterval = MIN_RANGE_SPAN / (2 * IDEAL_TICK_COUNT);
11721
12093
  interval = Math.max(interval, minTickInterval);
11722
- const majorTicks = [];
12094
+ const majorTickValues = [];
11723
12095
  const startTick = Math.ceil(range.min / interval) * interval;
12096
+ for(let value = startTick; value <= range.max; value += interval)majorTickValues.push(value);
12097
+ const hasLargeValues = majorTickValues.some((v)=>Math.abs(v) >= 1000);
12098
+ const hasSmallValues = majorTickValues.some((v)=>Math.abs(v) < 0.01 && 0 !== v);
12099
+ const hasDecimals = majorTickValues.some((v)=>v % 1 !== 0);
12100
+ const formatStrategy = {
12101
+ useScientific: hasSmallValues,
12102
+ useKFormat: hasLargeValues && !hasSmallValues,
12103
+ useDecimals: hasDecimals
12104
+ };
12105
+ const majorTicks = [];
11724
12106
  for(let value = startTick; value <= range.max; value += interval){
11725
12107
  const position = (range.max - value) / rangeSpan * containerHeight;
11726
12108
  let textPosition = position;
@@ -11743,7 +12125,7 @@ function useCanvasAxisY(options = {}) {
11743
12125
  value,
11744
12126
  position,
11745
12127
  textPosition,
11746
- label: formatTickLabel(value),
12128
+ label: formatTickLabel(value, formatStrategy),
11747
12129
  isAdjusted
11748
12130
  });
11749
12131
  }
@@ -14217,23 +14599,27 @@ StationAllocation_styles_module_options.domAPI = styleDomAPI_default();
14217
14599
  StationAllocation_styles_module_options.insertStyleElement = insertStyleElement_default();
14218
14600
  injectStylesIntoStyleTag_default()(StationAllocation_styles_module.Z, StationAllocation_styles_module_options);
14219
14601
  const components_StationAllocation_styles_module = StationAllocation_styles_module.Z && StationAllocation_styles_module.Z.locals ? StationAllocation_styles_module.Z.locals : void 0;
14220
- const StationAllocation_SegmentContainer_SegmentContainer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.memo)(({ style, stationPositions, currentFrequency, segmentIndex, isCurrentSegment })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
14602
+ const StationAllocation_SegmentContainer_SegmentContainer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.memo)(({ style, stationPositions, currentFrequency, segmentIndex, isCurrentSegment, onStationMouseEnter, onStationMouseLeave, isStationInHoverRange })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
14221
14603
  className: components_StationAllocation_styles_module.segmentContainer,
14222
14604
  style: style,
14223
14605
  children: stationPositions.map(({ station, position }, index)=>{
14224
14606
  const isActive = isCurrentSegment && currentFrequency >= station.startFrequency && currentFrequency <= station.stopFrequency;
14607
+ const isHovered = isStationInHoverRange(station);
14225
14608
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
14226
- className: `${components_StationAllocation_styles_module.item} ${isActive ? components_StationAllocation_styles_module.active : ''}`,
14609
+ className: `${components_StationAllocation_styles_module.item} ${isActive ? components_StationAllocation_styles_module.active : ''} ${isHovered ? components_StationAllocation_styles_module.hovered : ''}`,
14227
14610
  style: {
14228
14611
  left: position.left,
14229
14612
  width: position.width
14230
14613
  },
14231
- title: `${station.signalName} - ${station.frequency}${station.orgName ? ` (${station.orgName})` : ''}`
14614
+ title: `${station.signalName} - ${station.frequency}${station.orgName ? ` (${station.orgName})` : ''}`,
14615
+ onMouseEnter: ()=>onStationMouseEnter(station),
14616
+ onMouseLeave: onStationMouseLeave
14232
14617
  }, `segment-${segmentIndex}-station-${station.signalName}-${station.frequency}-${index}`);
14233
14618
  })
14234
14619
  }));
14235
14620
  const StationAllocation_SegmentContainer = StationAllocation_SegmentContainer_SegmentContainer;
14236
14621
  const StationAllocation_StationAllocation = ({ show = true, display = true })=>{
14622
+ const [hoveredFrequencyRange, setHoveredFrequencyRange] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(null);
14237
14623
  const { state: { segments, axisX: { frequencyFormat }, zoom: { style: zoomOffStyle }, cursor: { coord: { left } }, stationInfo } } = useStore_useStore();
14238
14624
  const stationData = stationInfo.data;
14239
14625
  const shouldDisplay = stationInfo.show && display;
@@ -14241,6 +14627,25 @@ const StationAllocation_StationAllocation = ({ show = true, display = true })=>{
14241
14627
  left,
14242
14628
  frequencyFormat
14243
14629
  ]);
14630
+ const handleStationMouseEnter = (station)=>{
14631
+ const yian = station.bandwidth / 2 / 1000;
14632
+ const startFreq = station.frequency - yian;
14633
+ const stopFreq = station.frequency + yian;
14634
+ setHoveredFrequencyRange({
14635
+ start: startFreq,
14636
+ stop: stopFreq
14637
+ });
14638
+ };
14639
+ const handleStationMouseLeave = ()=>{
14640
+ setHoveredFrequencyRange(null);
14641
+ };
14642
+ const isStationInHoverRange = (station)=>{
14643
+ if (!hoveredFrequencyRange) return false;
14644
+ const yian = station.bandwidth / 2 / 1000;
14645
+ const startFreq = station.frequency - yian;
14646
+ const stopFreq = station.frequency + yian;
14647
+ return !(stopFreq < hoveredFrequencyRange.start || startFreq > hoveredFrequencyRange.stop);
14648
+ };
14244
14649
  const currentSegmentIndex = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
14245
14650
  if (!segments?.length) return -1;
14246
14651
  let totalPoints = 0;
@@ -14321,7 +14726,7 @@ const StationAllocation_StationAllocation = ({ show = true, display = true })=>{
14321
14726
  segments,
14322
14727
  stationData
14323
14728
  ]);
14324
- if (!show || !shouldDisplay || 0 === left) return null;
14729
+ if (!show || !shouldDisplay) return null;
14325
14730
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
14326
14731
  className: components_StationAllocation_styles_module.StationAllocation,
14327
14732
  children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
@@ -14332,7 +14737,10 @@ const StationAllocation_StationAllocation = ({ show = true, display = true })=>{
14332
14737
  stationPositions: stationPositions,
14333
14738
  currentFrequency: currentFrequency,
14334
14739
  segmentIndex: segmentIndex,
14335
- isCurrentSegment: currentSegmentIndex === segmentIndex
14740
+ isCurrentSegment: currentSegmentIndex === segmentIndex,
14741
+ onStationMouseEnter: handleStationMouseEnter,
14742
+ onStationMouseLeave: handleStationMouseLeave,
14743
+ isStationInHoverRange: isStationInHoverRange
14336
14744
  }, `segment-${segmentIndex}`))
14337
14745
  })
14338
14746
  });
@@ -14348,7 +14756,7 @@ Stripe_styles_module_options.insertStyleElement = insertStyleElement_default();
14348
14756
  injectStylesIntoStyleTag_default()(Stripe_styles_module.Z, Stripe_styles_module_options);
14349
14757
  const components_Stripe_styles_module = Stripe_styles_module.Z && Stripe_styles_module.Z.locals ? Stripe_styles_module.Z.locals : void 0;
14350
14758
  const Stripe_COMPONENT_KEY = constants_ToolType.Stripe;
14351
- const Stripe = ({ id })=>{
14759
+ const Stripe_Stripe = ({ id })=>{
14352
14760
  const { state: { stripe, axisX: { frequencyFormat, unit } }, dispatch } = useStore_useStore();
14353
14761
  const { show, display, left, right, defaultLeft, defaultRight, onChange } = stripe;
14354
14762
  const [isDown, setIsDown] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(0);
@@ -14461,7 +14869,7 @@ const Stripe = ({ id })=>{
14461
14869
  })
14462
14870
  });
14463
14871
  };
14464
- const components_Stripe = Stripe;
14872
+ const Stripe = Stripe_Stripe;
14465
14873
  function usePoints() {
14466
14874
  const { dispatch, state: { axisX } } = useStore_useStore();
14467
14875
  const setPoints = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((points)=>{
@@ -14550,7 +14958,7 @@ const Spectrum_Spectrum = (props)=>{
14550
14958
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(AxisYByCanvas, {
14551
14959
  chart: chart
14552
14960
  }),
14553
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(components_PluginBox, {
14961
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(PluginBox, {
14554
14962
  children: [
14555
14963
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(components_GridLines, {}),
14556
14964
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Chart, {}),
@@ -14579,7 +14987,7 @@ const Spectrum_Spectrum = (props)=>{
14579
14987
  }),
14580
14988
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Band, {}),
14581
14989
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(components_Scope, {}),
14582
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(components_Stripe, {
14990
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Stripe, {
14583
14991
  id: id
14584
14992
  }),
14585
14993
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(FrequencyTagLine, {
@@ -14622,7 +15030,7 @@ const LevelStream_Chart_Chart = (props)=>{
14622
15030
  }),
14623
15031
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(components_FlexBox, {
14624
15032
  children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(modules_Spectrum, {
14625
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(components_PluginBox, {
15033
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(PluginBox, {
14626
15034
  children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Level, {
14627
15035
  opacity: 0.5
14628
15036
  })
@@ -14707,7 +15115,7 @@ const AxisYOccupancy = (props)=>{
14707
15115
  if (false === show || disabled) return null;
14708
15116
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(occupancy_type_Default, {});
14709
15117
  };
14710
- const AxisY_occupancy = AxisYOccupancy;
15118
+ const occupancy = AxisYOccupancy;
14711
15119
  var Occdahsed_styles_module = __webpack_require__("../../../../node_modules/.pnpm/@rsbuild+core@1.3.18/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[11].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[11].use[2]!../../../../node_modules/.pnpm/@rsbuild+plugin-less@1.5.0_@rsbuild+core@1.5.17/node_modules/@rsbuild/plugin-less/compiled/less-loader/index.js??ruleSet[1].rules[11].use[3]!./src/components/GridLines/Occdahsed/styles.module.less");
14712
15120
  var Occdahsed_styles_module_options = {};
14713
15121
  Occdahsed_styles_module_options.styleTagTransform = styleTagTransform_default();
@@ -14782,7 +15190,7 @@ const Occupancy_Occupancy = (props)=>{
14782
15190
  {
14783
15191
  const { data, totalOccupancy } = d;
14784
15192
  if (data) chart.updateSeries(data);
14785
- if (void 0 !== totalOccupancy) setValue(totalOccupancy);
15193
+ if (void 0 !== totalOccupancy && totalOccupancy !== value) setValue(totalOccupancy);
14786
15194
  }
14787
15195
  break;
14788
15196
  case constants_PSType.Reset:
@@ -14802,10 +15210,10 @@ const Occupancy_Occupancy = (props)=>{
14802
15210
  useZoomEvent(id, constants_ModuleType.Occupancy);
14803
15211
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(components_FlexBox, {
14804
15212
  children: [
14805
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(AxisY_occupancy, {
15213
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(occupancy, {
14806
15214
  disabled: occupancyAxisYDisabled
14807
15215
  }),
14808
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(components_PluginBox, {
15216
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(PluginBox, {
14809
15217
  children: [
14810
15218
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Occdahsed, {}),
14811
15219
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Chart, {}),
@@ -15178,7 +15586,7 @@ const Zoom_Zoom = ()=>{
15178
15586
  return null;
15179
15587
  };
15180
15588
  const Zoom = Zoom_Zoom;
15181
- const useMarkerPublish_useMarkerPublish = ({ globalID })=>{
15589
+ const useMarkerPublish = ({ globalID })=>{
15182
15590
  const handleMarkerPublish = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((e)=>{
15183
15591
  if (!globalID) return;
15184
15592
  switch(e.pstype){
@@ -15200,91 +15608,7 @@ const useMarkerPublish_useMarkerPublish = ({ globalID })=>{
15200
15608
  handleMarkerPublish
15201
15609
  };
15202
15610
  };
15203
- const useMarkerPublish = useMarkerPublish_useMarkerPublish;
15204
- const SET_SERIES = (globalID, func)=>subscription_createSubscriptionManager(`SET_SERIES-${globalID}`, '0', func);
15205
- const SERIES_DEFAULT_CONFIG = {
15206
- label: '',
15207
- color: '#11111150',
15208
- thickness: 1,
15209
- display: true,
15210
- type: type_GraphicType.Line
15211
- };
15212
- function useSeries() {
15213
- const { state: { globalID, series: seriesStore }, dispatch } = useStore_useStore();
15214
- const seriesRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(new Map());
15215
- const globalIDRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(globalID);
15216
- const handleSeriesChange = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
15217
- seriesRef.current.clear();
15218
- globalIDRef.current = globalID;
15219
- Object.values(SERIES).forEach((config)=>{
15220
- const newConfig = {
15221
- ...SERIES_DEFAULT_CONFIG,
15222
- ...JSON.parse(JSON.stringify(config))
15223
- };
15224
- seriesRef.current.set(config.name, newConfig);
15225
- seriesStore.data = seriesRef.current;
15226
- dispatch({
15227
- payload: {
15228
- series: seriesStore
15229
- }
15230
- });
15231
- tools(globalIDRef.current, constants_ModuleType.Spectrum)({
15232
- pstype: constants_PSType.Series,
15233
- ...newConfig
15234
- });
15235
- });
15236
- }, [
15237
- globalID,
15238
- seriesStore
15239
- ]);
15240
- const updateSeries = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((config)=>{
15241
- if (!config?.name) return;
15242
- const { name, label, data } = config;
15243
- const existingSeries = seriesRef.current.get(name);
15244
- const newConfig = {
15245
- ...SERIES_DEFAULT_CONFIG,
15246
- ...existingSeries,
15247
- ...config,
15248
- label: label || existingSeries?.label || name || existingSeries?.name,
15249
- data: data || existingSeries?.data
15250
- };
15251
- if (!SERIES_NAMES.includes(name) && !seriesStore.data.has(name) && void 0 === config.display) newConfig.display = true;
15252
- seriesRef.current.set(name, newConfig);
15253
- seriesStore.data = seriesRef.current;
15254
- dispatch({
15255
- payload: {
15256
- series: seriesStore
15257
- }
15258
- });
15259
- tools(globalIDRef.current, constants_ModuleType.Spectrum)({
15260
- pstype: constants_PSType.Series,
15261
- ...newConfig
15262
- });
15263
- }, [
15264
- seriesStore
15265
- ]);
15266
- const resetSeries = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
15267
- handleSeriesChange();
15268
- }, [
15269
- handleSeriesChange
15270
- ]);
15271
- (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
15272
- if (globalID) {
15273
- handleSeriesChange();
15274
- SET_SERIES(globalID, (config)=>{
15275
- updateSeries(config);
15276
- });
15277
- }
15278
- }, [
15279
- globalID,
15280
- updateSeries
15281
- ]);
15282
- return {
15283
- series: seriesRef.current,
15284
- updateSeries,
15285
- resetSeries
15286
- };
15287
- }
15611
+ const hooks_useMarkerPublish = useMarkerPublish;
15288
15612
  function useTemplateComparison() {
15289
15613
  const { state: { globalID, axisX: { frequencyFormat }, signal: { onChange } } } = useStore_useStore();
15290
15614
  const frequencyFormatRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(frequencyFormat);
@@ -15336,71 +15660,7 @@ function useSpectrumAnalyzer(props) {
15336
15660
  const analyzer = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
15337
15661
  const globalIDRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(globalID);
15338
15662
  const intervalRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(interval);
15339
- const srcIndexCache = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(new Uint32Array());
15340
- const extraOutputData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(new Map());
15341
- const occupancyData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(new Float32Array());
15342
15663
  const totalOccupancyData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(0);
15343
- const { series, updateSeries, resetSeries } = useSeries();
15344
- const getExtraData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((data)=>{
15345
- const len = srcIndexCache.current?.length;
15346
- if (len) {
15347
- const outputData = new Float32Array(len);
15348
- const start = Math.floor(intervalRef.current.start);
15349
- const end = Math.ceil(intervalRef.current.end);
15350
- const float32Data = new Float32Array(data);
15351
- const dataSubarray = float32Data.subarray(start, end + 1);
15352
- for(let i = 0; i < len; i++){
15353
- const dataIndex = srcIndexCache.current[i];
15354
- outputData[i] = dataSubarray[dataIndex];
15355
- }
15356
- return outputData;
15357
- }
15358
- return data;
15359
- }, []);
15360
- const updateExtraData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((extraData)=>{
15361
- if (!extraData) return;
15362
- Object.entries(extraData).forEach(([name, data])=>{
15363
- if (!data) return;
15364
- updateSeries({
15365
- name,
15366
- data
15367
- });
15368
- if (data && !SERIES_NAMES.includes(name) && globalIDRef.current) {
15369
- extraOutputData.current.set(name, {
15370
- outputData: getExtraData(data),
15371
- originalData: data
15372
- });
15373
- tools(globalIDRef.current, constants_ModuleType.Spectrum)({
15374
- pstype: constants_PSType.Render,
15375
- extraData: extraOutputData.current
15376
- });
15377
- const db = withDatabase(globalIDRef.current);
15378
- db.spectrumExtra = extraOutputData.current;
15379
- }
15380
- });
15381
- }, [
15382
- updateSeries,
15383
- getExtraData
15384
- ]);
15385
- const updateOccupancyData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(({ totalOccupancy, data })=>{
15386
- if (!data) return;
15387
- if (globalIDRef.current) {
15388
- occupancyData.current = new Float32Array(data);
15389
- totalOccupancyData.current = totalOccupancy;
15390
- tools(globalIDRef.current, constants_ModuleType.Occupancy)({
15391
- pstype: constants_PSType.Render,
15392
- data: getExtraData(occupancyData.current),
15393
- totalOccupancy
15394
- });
15395
- const db = withDatabase(globalIDRef.current);
15396
- db.occupancy = {
15397
- data: occupancyData.current,
15398
- totalOccupancy
15399
- };
15400
- }
15401
- }, [
15402
- getExtraData
15403
- ]);
15404
15664
  const updateStationInfo = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((data)=>{
15405
15665
  if (!data) return;
15406
15666
  if (globalIDRef.current) dispatch({
@@ -15423,12 +15683,9 @@ function useSpectrumAnalyzer(props) {
15423
15683
  const updateSpectrum = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((renderData)=>{
15424
15684
  tools(globalIDRef.current, constants_ModuleType.Spectrum)({
15425
15685
  pstype: constants_PSType.Render,
15426
- data: renderData,
15427
- extraData: extraOutputData.current
15686
+ data: renderData
15428
15687
  });
15429
- }, [
15430
- srcIndexCache
15431
- ]);
15688
+ }, []);
15432
15689
  const updateWaterfall = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((waterfallData)=>{
15433
15690
  tools(globalIDRef.current, constants_ModuleType.Heatmap)({
15434
15691
  pstype: constants_PSType.Render,
@@ -15458,6 +15715,15 @@ function useSpectrumAnalyzer(props) {
15458
15715
  fluorescenceMaxCount: data.fluorescenceMaxCount
15459
15716
  }
15460
15717
  });
15718
+ if (data.occupancyData) tools(globalIDRef.current, constants_ModuleType.Occupancy)({
15719
+ pstype: constants_PSType.Render,
15720
+ data: data.occupancyData,
15721
+ totalOccupancy: totalOccupancyData.current
15722
+ });
15723
+ if (data.extraData) tools(globalIDRef.current, constants_ModuleType.Spectrum)({
15724
+ pstype: constants_PSType.Render,
15725
+ extraData: data.extraData
15726
+ });
15461
15727
  }, [
15462
15728
  updateSpectrum,
15463
15729
  updateWaterfall,
@@ -15494,25 +15760,10 @@ function useSpectrumAnalyzer(props) {
15494
15760
  const oldEnd = Math.ceil(intervalRef.current.end);
15495
15761
  if ((newStart !== oldStart || newEnd !== oldEnd) && analyzer.current) {
15496
15762
  intervalRef.current = interval;
15497
- srcIndexCache.current = analyzer.current.updateSamplingRange(newStart, newEnd + 1) || new Uint32Array();
15498
- for (const [name, item] of series)if (!SERIES_NAMES.includes(name) && item.data) extraOutputData.current?.set(name, {
15499
- outputData: getExtraData(item.data),
15500
- originalData: item.data
15501
- });
15502
- if (extraOutputData.current.size > 0) tools(globalIDRef.current, constants_ModuleType.Spectrum)({
15503
- pstype: constants_PSType.Render,
15504
- extraData: extraOutputData.current
15505
- });
15506
- if (occupancyData.current) tools(globalIDRef.current, constants_ModuleType.Occupancy)({
15507
- pstype: constants_PSType.Render,
15508
- data: getExtraData(occupancyData.current),
15509
- totalOccupancy: totalOccupancyData.current
15510
- });
15763
+ analyzer.current.updateSamplingRange(newStart, newEnd + 1);
15511
15764
  }
15512
15765
  }, [
15513
- interval,
15514
- series,
15515
- getExtraData
15766
+ interval
15516
15767
  ]);
15517
15768
  const resetAll = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(async (haveSeries = false)=>{
15518
15769
  setTimeout(()=>{
@@ -15525,15 +15776,9 @@ function useSpectrumAnalyzer(props) {
15525
15776
  tools(globalIDRef.current, constants_ModuleType.Occupancy)({
15526
15777
  pstype: constants_PSType.Reset
15527
15778
  });
15528
- const db = withDatabase(globalIDRef.current);
15529
- db.spectrumExtra = getDefaultData().spectrumExtra;
15530
- if (haveSeries) resetSeries();
15531
- extraOutputData.current.clear();
15779
+ if (haveSeries) resetSeries(globalIDRef.current);
15532
15780
  }, 1);
15533
- }, [
15534
- series,
15535
- resetSeries
15536
- ]);
15781
+ }, []);
15537
15782
  const handlePublish = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(async (e)=>{
15538
15783
  if (!analyzer.current) return;
15539
15784
  switch(e.pstype){
@@ -15550,7 +15795,7 @@ function useSpectrumAnalyzer(props) {
15550
15795
  if (e.avgData) analyzer.current.setAvgData(e.avgData);
15551
15796
  if (e.templateData) analyzer.current.setTemplateData(e.templateData);
15552
15797
  if (e.backgroundNoiseData) analyzer.current.setBackgroundNoiseData(e.backgroundNoiseData);
15553
- if (e.extraData) updateExtraData(e.extraData);
15798
+ if (e.extraData) analyzer.current?.setExtraData(e.extraData);
15554
15799
  break;
15555
15800
  case constants_PSType.Heatmap:
15556
15801
  if (e.data) {
@@ -15560,7 +15805,8 @@ function useSpectrumAnalyzer(props) {
15560
15805
  }
15561
15806
  break;
15562
15807
  case constants_PSType.Occupancy:
15563
- updateOccupancyData(e);
15808
+ analyzer.current?.setOccupancyData(e.data);
15809
+ totalOccupancyData.current = e.totalOccupancy;
15564
15810
  break;
15565
15811
  case constants_PSType.Segments:
15566
15812
  analyzer.current.initializeSegments(e.data);
@@ -15571,7 +15817,7 @@ function useSpectrumAnalyzer(props) {
15571
15817
  analyzer.current.reset();
15572
15818
  break;
15573
15819
  case constants_PSType.Series:
15574
- updateSeries(e);
15820
+ updateSeries(globalIDRef.current, e);
15575
15821
  break;
15576
15822
  case constants_PSType.Reset:
15577
15823
  analyzer.current.reset();
@@ -15588,8 +15834,6 @@ function useSpectrumAnalyzer(props) {
15588
15834
  }
15589
15835
  }, [
15590
15836
  updateStationInfo,
15591
- updateExtraData,
15592
- updateOccupancyData,
15593
15837
  updateSeries,
15594
15838
  resetAll
15595
15839
  ]);
@@ -15604,20 +15848,15 @@ function useSpectrumAnalyzer(props) {
15604
15848
  function useSpectrumChartType({ type, heatmapElementID }) {
15605
15849
  const { state: { axisY, limit, signal, marker, cursor, frequencyAllocation, zoom, toolsBar, globalID }, dispatch } = useStore_useStore();
15606
15850
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
15607
- if (type === constants_ChartType.MScan && globalID) setTimeout(()=>{
15608
- SET_SERIES(globalID)({
15609
- name: REAL_DATA_NAME,
15610
- type: type_GraphicType.Bar
15611
- });
15612
- }, 100);
15613
- if (type === constants_ChartType.ScanDF360 && globalID) setTimeout(()=>{
15614
- SET_SERIES(globalID)({
15615
- name: REAL_DATA_NAME,
15616
- type: type_GraphicType.Rect
15617
- });
15851
+ if (!globalID) return;
15852
+ clearChartTypeSeriesOverrides(globalID);
15853
+ if (type === constants_ChartType.MScan) setChartTypeSeriesOverride(globalID, REAL_DATA_NAME, type_GraphicType.Bar);
15854
+ if (type === constants_ChartType.ScanDF360) {
15855
+ setChartTypeSeriesOverride(globalID, REAL_DATA_NAME, type_GraphicType.Rect);
15618
15856
  setScanDF360Prob(globalID)(true);
15619
- }, 100);
15857
+ }
15620
15858
  }, [
15859
+ type,
15621
15860
  globalID
15622
15861
  ]);
15623
15862
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
@@ -15639,7 +15878,7 @@ function useSpectrumChartType({ type, heatmapElementID }) {
15639
15878
  0,
15640
15879
  1
15641
15880
  ];
15642
- axisY.unitDisabled = true;
15881
+ axisY.unitDisabled = false;
15643
15882
  }
15644
15883
  if (type === constants_ChartType.MScan) {
15645
15884
  limit.show = false;
@@ -15891,7 +16130,7 @@ const Spectrum_Chart_Chart = (props)=>{
15891
16130
  }
15892
16131
  });
15893
16132
  const handleSpectrumRule = useSpectrumRule();
15894
- const { handleMarkerPublish } = useMarkerPublish({
16133
+ const { handleMarkerPublish } = hooks_useMarkerPublish({
15895
16134
  globalID
15896
16135
  });
15897
16136
  hooks_usePublish({
@@ -15923,7 +16162,7 @@ const Spectrum_Chart_Chart = (props)=>{
15923
16162
  type: type,
15924
16163
  occupancyElementID: occupancyElementID
15925
16164
  }),
15926
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(components_PluginBox, {
16165
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(PluginBox, {
15927
16166
  children: [
15928
16167
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Zoom, {}),
15929
16168
  type === constants_ChartType.Scan && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {