@rfkit/charts 1.10.4 → 1.10.6

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/README.md CHANGED
@@ -111,11 +111,13 @@ publish({ pstype: PSType.Signal, type: SignalDataType.Station, data: station });
111
111
  publish({ pstype: PSType.Signal, type: SignalDataType.Simple, data: simple });
112
112
  ```
113
113
 
114
- 同一来源后续发布会替换上一批数据,发布空数组可单独清空该来源。频谱游标命中台站库时显示完整台站信息,命中信号库时显示来源、频率范围、带宽、类型,以及合法信号的等级。
114
+ 同一来源后续发布会替换上一批数据,发布空数组可单独清空该来源。`SignalData.details` 可传入 `name`、`organization`、`modulation` 和 `remark`;频谱游标命中台站库或信号库时会展示两者共有的详情,合法信号库数据额外显示等级。
115
+
116
+ 树形筛选默认在台站库、信号库、类型和等级节点后显示当前发布数据的数量;业务侧可通过 `signal={{ showCount: false }}` 关闭数量显示,筛选和数据本身不受影响。
115
117
 
116
118
  内置颜色直接复用主题的 `success`、`primary`、`warning`、`destructive` 和 `mutedForeground` 语义 token;需要整体调整时通过 `initChartsTheme({ tokens: { semantic: ... } })` 覆盖,单条业务标注仍使用 `color` 覆盖。
117
119
 
118
- 筛选树色点表示分类的内置语义色;单条数据传入 `color` 后,图上标注和游标详情色点使用该实际颜色,不会反向改变整类数据的树图例。
120
+ 筛选树与游标详情直接使用类型或等级文字表达颜色,不再额外显示色点。信号库的“合法”父级保持中性文字,具体等级文字与图上标注颜色一致;其他类型文字与对应标注颜色一致。单条数据传入 `color` 时仍保持最高优先级;`rgba(...)` 的透明度只作用于图上标注,文字使用相同 RGB 色相的不透明颜色保证可读性。
119
121
 
120
122
  台站数据需要提供 `startFrequency` / `stopFrequency`(也可以由 MHz 中心频率和 kHz 带宽在业务侧计算)。
121
123
 
package/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export { type ChartsThemePreference, type ChartsThemeState, getChartsThemeState,
8
8
  export type { ChartsSizeTokensConfig, ChartsThemeTokensConfig } from './theme/theme-tokens';
9
9
  export type { AxisXProps, AxisYRange, BandProps, ChartRef, FrequencyAllocationChannel, FrequencyAllocationDensity, FrequencyAllocationItem, MarkerProps, MarkerType, Publish, PublishData, PublishDial, PublishGauge, PublishHeatmap, PublishIQ, PublishLevelStream, PublishOccupancy, PublishSpectrum, RecursiveFunction, // 递归方法 后期会删除
10
10
  RecursiveObject, // 递归对象 后期会删除
11
- Render, Reset, SegmentsOriginal, SeriesConfig, SetAntennaFactor, SetChannels, SetMarker, SetSegments, SetSeries, SetSpectrumBandwidth, SignalData, SpectrumBandwidth, SpectrumExtraData, StationInfoType } from './types';
11
+ Render, Reset, SegmentsOriginal, SeriesConfig, SetAntennaFactor, SetChannels, SetMarker, SetSegments, SetSeries, SetSpectrumBandwidth, SignalData, SignalDetails, SpectrumBandwidth, SpectrumExtraData, StationInfoType } from './types';
12
12
  export { HeatmapCaptureType, MarkerMode } from './types';
13
13
  export { SignalDataType } from './types/store';
14
14
  export type { FrequencyUnitResult } from './utils';
package/index.js CHANGED
@@ -831,11 +831,6 @@ var __webpack_modules__ = {
831
831
  display: inline-flex;
832
832
  }
833
833
 
834
- [data-rfkit-charts-root] .size-2 {
835
- width: calc(var(--spacing) * 2);
836
- height: calc(var(--spacing) * 2);
837
- }
838
-
839
834
  [data-rfkit-charts-root] .size-3 {
840
835
  width: calc(var(--spacing) * 3);
841
836
  height: calc(var(--spacing) * 3);
@@ -2213,10 +2208,6 @@ var __webpack_modules__ = {
2213
2208
  opacity: .3;
2214
2209
  }
2215
2210
 
2216
- [data-rfkit-charts-root] .opacity-35 {
2217
- opacity: .35;
2218
- }
2219
-
2220
2211
  [data-rfkit-charts-root] .opacity-40 {
2221
2212
  opacity: .4;
2222
2213
  }
@@ -2321,11 +2312,6 @@ var __webpack_modules__ = {
2321
2312
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
2322
2313
  }
2323
2314
 
2324
- [data-rfkit-charts-root] .ring-1 {
2325
- --tw-ring-shadow: var(--tw-ring-inset, ) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
2326
- box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
2327
- }
2328
-
2329
2315
  [data-rfkit-charts-root] .\\[box-shadow\\:0_0_0_1px_color-mix\\(in_srgb\\,var\\(--background\\)_82\\%\\,transparent\\)\\,[data-rfkit-charts-root] 0_1px_4px_color-mix\\(in_srgb\\,var\\(--foreground\\)_32\\%\\,transparent\\)\\] {
2330
2316
  box-shadow: 0 0 0 1px var(--background), 0 1px 4px var(--foreground);
2331
2317
  }
@@ -2346,20 +2332,6 @@ var __webpack_modules__ = {
2346
2332
  }
2347
2333
  }
2348
2334
 
2349
- [data-rfkit-charts-root] .ring-background\\/30 {
2350
- --tw-ring-color: var(--background);
2351
- }
2352
-
2353
- @supports (color: color-mix(in lab, red, red)) {
2354
- [data-rfkit-charts-root] .ring-background\\/30 {
2355
- --tw-ring-color: color-mix(in oklab, var(--background) 30%, transparent);
2356
- }
2357
- }
2358
-
2359
- [data-rfkit-charts-root] .ring-border {
2360
- --tw-ring-color: var(--border);
2361
- }
2362
-
2363
2335
  [data-rfkit-charts-root] .ring-offset-background {
2364
2336
  --tw-ring-offset-color: var(--background);
2365
2337
  }
@@ -2529,10 +2501,6 @@ var __webpack_modules__ = {
2529
2501
  animation-play-state: paused;
2530
2502
  }
2531
2503
 
2532
- [data-rfkit-charts-root] .ring-inset {
2533
- --tw-ring-inset: inset;
2534
- }
2535
-
2536
2504
  [data-rfkit-charts-root] .group-focus-within\\:opacity-90:is(:where(.group):focus-within *) {
2537
2505
  opacity: .9;
2538
2506
  }
@@ -5976,6 +5944,7 @@ function createParams() {
5976
5944
  display: false,
5977
5945
  data: [],
5978
5946
  hiddenCategoryKeys: [],
5947
+ showCount: true,
5979
5948
  onChange: ()=>{}
5980
5949
  },
5981
5950
  signalAnalysis: {
@@ -11104,6 +11073,12 @@ const withAlpha = (value1, opacity)=>{
11104
11073
  if (!color) return value1;
11105
11074
  return `rgba(${color.r}, ${color.g}, ${color.b}, ${Number((color.alpha * normalizedOpacity).toFixed(4))})`;
11106
11075
  };
11076
+ const toOpaqueCssColor = (value1)=>{
11077
+ const parsedHex = value1.startsWith('#') ? parseHexColor(value1) : null;
11078
+ const parsedRgb = parsedHex ? null : parseRgbColor(value1);
11079
+ const color = parsedHex ?? parsedRgb;
11080
+ return color ? `rgb(${color.r}, ${color.g}, ${color.b})` : value1;
11081
+ };
11107
11082
  function getThemeFillStyle(scopeTarget) {
11108
11083
  const themeColorBase = getThemePropertyValue('--foreground', scopeTarget);
11109
11084
  const themeColorPrimary = getThemePropertyValue('--primary', scopeTarget);
@@ -23174,7 +23149,36 @@ function getUnifiedSignalKey(item) {
23174
23149
  return `${source}:${item.frequency}-${item.bandwidth}`;
23175
23150
  }
23176
23151
  const buildSignalTree = (signalItems)=>{
23177
- const leafKeysWithData = new Set(signalItems.map(getSignalLeafKey));
23152
+ const leafKeysWithData = new Set();
23153
+ const leafCounts = new Map();
23154
+ const leafColors = new Map();
23155
+ for (const item of signalItems){
23156
+ const leafKey = getSignalLeafKey(item);
23157
+ const source = resolveSignalSource(item);
23158
+ leafKeysWithData.add(leafKey);
23159
+ leafCounts.set(leafKey, (leafCounts.get(leafKey) ?? 0) + 1);
23160
+ const colors = leafColors.get(leafKey) ?? new Set();
23161
+ colors.add(resolveSignalColor({
23162
+ ...item,
23163
+ source
23164
+ }));
23165
+ leafColors.set(leafKey, colors);
23166
+ }
23167
+ const resolveCount = (leafKeys)=>leafKeys.reduce((count, leafKey)=>count + (leafCounts.get(leafKey) ?? 0), 0);
23168
+ const resolveLeafColor = (leafKey)=>{
23169
+ const colors = leafColors.get(leafKey);
23170
+ return colors?.size === 1 ? [
23171
+ ...colors
23172
+ ][0] : void 0;
23173
+ };
23174
+ const resolveSharedColor = (leafKeys)=>{
23175
+ const resolvedColors = leafKeys.map(resolveLeafColor);
23176
+ if (resolvedColors.some((color)=>null == color)) return;
23177
+ const colors = new Set(resolvedColors);
23178
+ return 1 === colors.size ? [
23179
+ ...colors
23180
+ ][0] : void 0;
23181
+ };
23178
23182
  const sources = [];
23179
23183
  for (const source of SIGNAL_SOURCE_ORDER){
23180
23184
  const sourceDataLeafKeys = [
@@ -23188,6 +23192,7 @@ const buildSignalTree = (signalItems)=>{
23188
23192
  leafKeys: sourceDataLeafKeys,
23189
23193
  dataLeafKeys: sourceDataLeafKeys,
23190
23194
  hasData: true,
23195
+ count: resolveCount(sourceDataLeafKeys),
23191
23196
  types: []
23192
23197
  });
23193
23198
  continue;
@@ -23199,7 +23204,9 @@ const buildSignalTree = (signalItems)=>{
23199
23204
  level,
23200
23205
  label: SIGNAL_LEVEL_MAP[level].name,
23201
23206
  leafKey,
23202
- hasData: leafKeysWithData.has(leafKey)
23207
+ hasData: leafKeysWithData.has(leafKey),
23208
+ count: leafCounts.get(leafKey) ?? 0,
23209
+ color: resolveLeafColor(leafKey)
23203
23210
  };
23204
23211
  });
23205
23212
  const leafKeys = levels.map((level)=>level.leafKey);
@@ -23211,6 +23218,8 @@ const buildSignalTree = (signalItems)=>{
23211
23218
  leafKeys,
23212
23219
  dataLeafKeys,
23213
23220
  hasData: dataLeafKeys.length > 0,
23221
+ count: resolveCount(dataLeafKeys),
23222
+ color: resolveSharedColor(dataLeafKeys),
23214
23223
  levels: signalType === SignalType.LEGITIMATE ? levels.filter((level)=>level.hasData) : []
23215
23224
  };
23216
23225
  });
@@ -23223,6 +23232,7 @@ const buildSignalTree = (signalItems)=>{
23223
23232
  leafKeys,
23224
23233
  dataLeafKeys,
23225
23234
  hasData: true,
23235
+ count: resolveCount(dataLeafKeys),
23226
23236
  types
23227
23237
  });
23228
23238
  }
@@ -23326,6 +23336,11 @@ const resolveSignalPresentation = (item)=>{
23326
23336
  });
23327
23337
  const frequencyText = resolveFrequencyPresentation(item);
23328
23338
  const bandwidthText = null != item.bandwidth ? `\u{5E26}\u{5BBD}: ${item.bandwidth}kHz` : void 0;
23339
+ const details = tree_isStationInfo(item) ? {
23340
+ name: item.signalName,
23341
+ organization: item.orgName,
23342
+ modulation: item.modulation
23343
+ } : item.details;
23329
23344
  if (tree_isStationInfo(item)) return {
23330
23345
  color,
23331
23346
  tooltip: [
@@ -23338,9 +23353,12 @@ const resolveSignalPresentation = (item)=>{
23338
23353
  return {
23339
23354
  color,
23340
23355
  tooltip: [
23356
+ details?.name,
23341
23357
  SIGNAL_SOURCE_LABEL[source],
23342
23358
  frequencyText,
23359
+ details?.organization && `\u{5355}\u{4F4D}: ${details.organization}`,
23343
23360
  bandwidthText,
23361
+ details?.modulation && `\u{8C03}\u{5236}: ${details.modulation}`,
23344
23362
  signalTypeName && `\u{7C7B}\u{578B}: ${signalTypeName}`,
23345
23363
  signalType === SignalType.LEGITIMATE && levelName && `\u{7B49}\u{7EA7}: ${levelName}`
23346
23364
  ].filter(Boolean).join(' | ')
@@ -23550,26 +23568,23 @@ const SignalInfoRow = ({ label, value: value1, tabular = false })=>/*#__PURE__*/
23550
23568
  })
23551
23569
  ]
23552
23570
  });
23553
- const SignalMetaValue = ({ color, label, testId })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("span", {
23554
- className: "inline-flex items-center gap-1.5 font-medium text-foreground",
23555
- children: [
23556
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
23557
- "aria-hidden": "true",
23558
- className: "size-2 shrink-0 rounded-full ring-1 ring-inset ring-border",
23559
- "data-testid": testId,
23560
- style: {
23561
- backgroundColor: color
23562
- }
23563
- }),
23564
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
23565
- children: label
23566
- })
23567
- ]
23571
+ const SignalMetaValue = ({ color, label, testId })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
23572
+ className: "font-medium text-foreground",
23573
+ "data-testid": testId,
23574
+ style: color ? {
23575
+ color: toOpaqueCssColor(color)
23576
+ } : void 0,
23577
+ children: label
23568
23578
  });
23569
23579
  const SignalInfoPanel = ({ signalInfo })=>{
23570
23580
  if (!signalInfo) return null;
23571
23581
  const source = resolveSignalSource(signalInfo);
23572
- const stationInfo = tree_isStationInfo(signalInfo) ? signalInfo : void 0;
23582
+ const details = tree_isStationInfo(signalInfo) ? {
23583
+ name: signalInfo.signalName,
23584
+ organization: signalInfo.orgName,
23585
+ modulation: signalInfo.modulation,
23586
+ remark: signalInfo.remark
23587
+ } : signalInfo.details;
23573
23588
  const signalType = normalizeSignalType(signalInfo.signalType);
23574
23589
  const signalTypeInfo = SIGNAL_TYPE_MAP[signalType];
23575
23590
  const levelInfo = SIGNAL_LEVEL_MAP[normalizeSignalLevel(signalInfo.level)];
@@ -23578,7 +23593,7 @@ const SignalInfoPanel = ({ signalInfo })=>{
23578
23593
  ...signalInfo,
23579
23594
  source
23580
23595
  });
23581
- const typeColor = showLevel ? signalTypeInfo.color : resolvedColor;
23596
+ const typeColor = showLevel ? void 0 : resolvedColor;
23582
23597
  const hasFrequencyRange = null != signalInfo.startFrequency && null != signalInfo.stopFrequency;
23583
23598
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
23584
23599
  className: "mt-2 border-t border-border/60 pt-2 text-xs leading-5 text-foreground",
@@ -23591,13 +23606,13 @@ const SignalInfoPanel = ({ signalInfo })=>{
23591
23606
  label: "\u6765\u6E90",
23592
23607
  value: SIGNAL_SOURCE_LABEL[source]
23593
23608
  }),
23594
- stationInfo?.signalName ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalInfoRow, {
23609
+ details?.name ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalInfoRow, {
23595
23610
  label: "\u540D\u79F0",
23596
- value: stationInfo.signalName
23611
+ value: details.name
23597
23612
  }) : null,
23598
- stationInfo?.orgName ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalInfoRow, {
23613
+ details?.organization ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalInfoRow, {
23599
23614
  label: "\u5355\u4F4D",
23600
- value: stationInfo.orgName
23615
+ value: details.organization
23601
23616
  }) : null,
23602
23617
  null != signalInfo.frequency ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalInfoRow, {
23603
23618
  label: "\u9891\u7387",
@@ -23613,16 +23628,16 @@ const SignalInfoPanel = ({ signalInfo })=>{
23613
23628
  value: `${signalInfo.bandwidth}kHz`,
23614
23629
  tabular: true
23615
23630
  }) : null,
23616
- stationInfo?.modulation ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalInfoRow, {
23631
+ details?.modulation ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalInfoRow, {
23617
23632
  label: "\u8C03\u5236",
23618
- value: stationInfo.modulation
23633
+ value: details.modulation
23619
23634
  }) : null,
23620
23635
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalInfoRow, {
23621
23636
  label: "\u7C7B\u578B",
23622
23637
  value: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalMetaValue, {
23623
23638
  color: typeColor,
23624
23639
  label: signalTypeInfo.name,
23625
- testId: "signal-info-type-swatch"
23640
+ testId: "signal-info-type-color"
23626
23641
  })
23627
23642
  }),
23628
23643
  showLevel ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalInfoRow, {
@@ -23630,12 +23645,12 @@ const SignalInfoPanel = ({ signalInfo })=>{
23630
23645
  value: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalMetaValue, {
23631
23646
  color: resolvedColor,
23632
23647
  label: levelInfo.name,
23633
- testId: "signal-info-level-swatch"
23648
+ testId: "signal-info-level-color"
23634
23649
  })
23635
23650
  }) : null,
23636
- stationInfo?.remark ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalInfoRow, {
23651
+ details?.remark ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalInfoRow, {
23637
23652
  label: "\u5907\u6CE8",
23638
- value: stationInfo.remark
23653
+ value: details.remark
23639
23654
  }) : null
23640
23655
  ]
23641
23656
  })
@@ -29213,10 +29228,20 @@ const toCheckboxValue = (state)=>{
29213
29228
  if ('indeterminate' === state) return 'indeterminate';
29214
29229
  return false;
29215
29230
  };
29216
- const SignalTypeRow = ({ source, type, leafKeysWithData, hiddenKeys, expanded, onToggleExpanded, onToggleNode })=>{
29231
+ const SignalNodeCount = ({ count, show, testId })=>show ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("span", {
29232
+ className: "shrink-0 tabular-nums text-[11px] font-normal text-muted-foreground",
29233
+ "data-testid": testId,
29234
+ children: [
29235
+ "(",
29236
+ count,
29237
+ ")"
29238
+ ]
29239
+ }) : null;
29240
+ const SignalTypeRow = ({ source, type, leafKeysWithData, hiddenKeys, showCount, expanded, onToggleExpanded, onToggleNode })=>{
29217
29241
  const state = resolveNodeCheckState(leafKeysWithData, hiddenKeys, type.leafKeys);
29218
29242
  const checkboxId = `signal-tree-type-checkbox-${source.source}-${type.signalType}`;
29219
29243
  const hasLevels = type.levels.length > 0;
29244
+ const typeColor = hasLevels ? void 0 : type.color ?? SIGNAL_TYPE_MAP[type.signalType].color;
29220
29245
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
29221
29246
  children: [
29222
29247
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
@@ -29248,17 +29273,18 @@ const SignalTypeRow = ({ source, type, leafKeysWithData, hiddenKeys, expanded, o
29248
29273
  disabled: 'disabled' === state,
29249
29274
  onCheckedChange: ()=>onToggleNode(type.leafKeys)
29250
29275
  }),
29251
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
29252
- "aria-hidden": "true",
29253
- className: cn_cn('size-2 shrink-0 rounded-full ring-1 ring-inset ring-background/30', 'disabled' === state && 'opacity-35'),
29254
- "data-testid": `signal-tree-type-color-${source.source}-${type.signalType}`,
29255
- style: {
29256
- backgroundColor: SIGNAL_TYPE_MAP[type.signalType].color
29257
- }
29258
- }),
29259
29276
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
29260
29277
  className: cn_cn('min-w-0 truncate text-xs font-medium', 'disabled' === state ? 'text-muted-foreground' : 'text-foreground/90'),
29278
+ "data-testid": `signal-tree-type-color-${source.source}-${type.signalType}`,
29279
+ style: 'disabled' === state || null == typeColor ? void 0 : {
29280
+ color: toOpaqueCssColor(typeColor)
29281
+ },
29261
29282
  children: type.label
29283
+ }),
29284
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalNodeCount, {
29285
+ count: type.count,
29286
+ show: showCount,
29287
+ testId: `signal-tree-type-count-${source.source}-${type.signalType}`
29262
29288
  })
29263
29289
  ]
29264
29290
  })
@@ -29272,13 +29298,14 @@ const SignalTypeRow = ({ source, type, leafKeysWithData, hiddenKeys, expanded, o
29272
29298
  level: level,
29273
29299
  leafKeysWithData: leafKeysWithData,
29274
29300
  hiddenKeys: hiddenKeys,
29301
+ showCount: showCount,
29275
29302
  onToggleNode: onToggleNode
29276
29303
  }, level.leafKey))
29277
29304
  }) : null
29278
29305
  ]
29279
29306
  }, type.signalType);
29280
29307
  };
29281
- const SignalLevelRow = ({ source, signalType, level, leafKeysWithData, hiddenKeys, onToggleNode })=>{
29308
+ const SignalLevelRow = ({ source, signalType, level, leafKeysWithData, hiddenKeys, showCount, onToggleNode })=>{
29282
29309
  const state = resolveNodeCheckState(leafKeysWithData, hiddenKeys, [
29283
29310
  level.leafKey
29284
29311
  ]);
@@ -29300,22 +29327,23 @@ const SignalLevelRow = ({ source, signalType, level, leafKeysWithData, hiddenKey
29300
29327
  ])
29301
29328
  }),
29302
29329
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
29303
- "aria-hidden": "true",
29304
- className: cn_cn('size-2 shrink-0 rounded-full ring-1 ring-inset ring-background/30', 'disabled' === state && 'opacity-35'),
29330
+ className: cn_cn('text-xs font-medium', 'disabled' === state ? 'text-muted-foreground' : 'text-foreground/80'),
29305
29331
  "data-testid": `signal-tree-level-color-${source}-${signalType}-${level.level}`,
29306
- style: {
29307
- backgroundColor: SIGNAL_LEVEL_MAP[level.level].color
29308
- }
29309
- }),
29310
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
29311
- className: cn_cn('text-xs', 'disabled' === state ? 'text-muted-foreground' : 'text-foreground/80'),
29332
+ style: 'disabled' === state ? void 0 : {
29333
+ color: toOpaqueCssColor(level.color ?? SIGNAL_LEVEL_MAP[level.level].color)
29334
+ },
29312
29335
  children: level.label
29336
+ }),
29337
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalNodeCount, {
29338
+ count: level.count,
29339
+ show: showCount,
29340
+ testId: `signal-tree-level-count-${source}-${signalType}-${level.level}`
29313
29341
  })
29314
29342
  ]
29315
29343
  })
29316
29344
  });
29317
29345
  };
29318
- const SignalAnnotationTree = ({ tree, leafKeysWithData, hiddenKeys, onToggleNode })=>{
29346
+ const SignalAnnotationTree = ({ tree, leafKeysWithData, hiddenKeys, showCount, onToggleNode })=>{
29319
29347
  const [collapsedKeys, setCollapsedKeys] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(()=>new Set());
29320
29348
  const [collapsedSourceKeys, setCollapsedSourceKeys] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(()=>new Set());
29321
29349
  const toggleExpanded = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((key)=>{
@@ -29377,6 +29405,11 @@ const SignalAnnotationTree = ({ tree, leafKeysWithData, hiddenKeys, onToggleNode
29377
29405
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
29378
29406
  className: "text-xs font-medium text-foreground",
29379
29407
  children: source.label
29408
+ }),
29409
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalNodeCount, {
29410
+ count: source.count,
29411
+ show: showCount,
29412
+ testId: `signal-tree-source-count-${source.source}`
29380
29413
  })
29381
29414
  ]
29382
29415
  })
@@ -29389,6 +29422,7 @@ const SignalAnnotationTree = ({ tree, leafKeysWithData, hiddenKeys, onToggleNode
29389
29422
  type: type,
29390
29423
  leafKeysWithData: leafKeysWithData,
29391
29424
  hiddenKeys: hiddenKeys,
29425
+ showCount: showCount,
29392
29426
  expanded: !collapsedKeys.has(`${source.source}:${type.signalType}`),
29393
29427
  onToggleExpanded: ()=>toggleExpanded(`${source.source}:${type.signalType}`),
29394
29428
  onToggleNode: onToggleNode
@@ -29478,6 +29512,7 @@ const Signal_Switch_Switch = ()=>{
29478
29512
  tree: tree,
29479
29513
  leafKeysWithData: leafKeysWithData,
29480
29514
  hiddenKeys: hiddenKeys,
29515
+ showCount: false !== signal.showCount,
29481
29516
  onToggleNode: toggleNode
29482
29517
  })
29483
29518
  }),
@@ -27,6 +27,8 @@ export interface SignalTreeLevelNode {
27
27
  label: string;
28
28
  leafKey: string;
29
29
  hasData: boolean;
30
+ count: number;
31
+ color?: string;
30
32
  }
31
33
  export interface SignalTreeTypeNode {
32
34
  signalType: string;
@@ -34,6 +36,8 @@ export interface SignalTreeTypeNode {
34
36
  leafKeys: string[];
35
37
  dataLeafKeys: string[];
36
38
  hasData: boolean;
39
+ count: number;
40
+ color?: string;
37
41
  levels: SignalTreeLevelNode[];
38
42
  }
39
43
  export interface SignalTreeSourceNode {
@@ -42,6 +46,7 @@ export interface SignalTreeSourceNode {
42
46
  leafKeys: string[];
43
47
  dataLeafKeys: string[];
44
48
  hasData: boolean;
49
+ count: number;
45
50
  types: SignalTreeTypeNode[];
46
51
  }
47
52
  export interface SignalTree {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rfkit/charts",
3
- "version": "1.10.4",
3
+ "version": "1.10.6",
4
4
  "type": "module",
5
5
  "description": "Chart components for wireless monitoring web applications",
6
6
  "exports": {
@@ -3,5 +3,7 @@ export interface ThemeFillStyle {
3
3
  fillStylePrimary: string;
4
4
  fillStyleTransparentBase: string;
5
5
  }
6
+ /** 文本图例沿用颜色色相,但去除业务填充色的透明度以保证可读性。 */
7
+ export declare const toOpaqueCssColor: (value: string) => string;
6
8
  export declare function getThemeFillStyle(scopeTarget?: Element | null): ThemeFillStyle;
7
9
  export declare const getThemeColor: (property: string, opacity?: number, scopeTarget?: Element | null) => string;
@@ -2,6 +2,13 @@ export declare enum SignalDataType {
2
2
  Station = "station",// 台站信号(详细信息)
3
3
  Simple = "simple"
4
4
  }
5
+ /** 信号库可选详情;与台站库的公共展示信息保持一致。 */
6
+ export interface SignalDetails {
7
+ name?: string;
8
+ organization?: string;
9
+ modulation?: string;
10
+ remark?: string;
11
+ }
5
12
  export interface SignalData {
6
13
  id?: string;
7
14
  startFrequency?: number | string;
@@ -11,6 +18,7 @@ export interface SignalData {
11
18
  color?: string;
12
19
  signalType?: string;
13
20
  level?: number;
21
+ details?: SignalDetails;
14
22
  }
15
23
  export type SelectedSignal = {
16
24
  segIndex: number;
@@ -21,6 +29,7 @@ export interface SignalProps {
21
29
  display: boolean;
22
30
  data: SignalData[];
23
31
  hiddenCategoryKeys: string[];
32
+ showCount: boolean;
24
33
  onChange: (e: SelectedSignal) => void;
25
34
  }
26
35
  export interface SignalAnalysisProps {