@rfkit/charts 1.1.31 → 1.1.33

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
@@ -4031,6 +4031,7 @@ function defaultState_createParams() {
4031
4031
  step: stepDefault,
4032
4032
  unit: constants_unitList["0"],
4033
4033
  unitList: constants_unitList,
4034
+ unitDisabled: false,
4034
4035
  type: axisYTypeList["default"],
4035
4036
  hidden: [],
4036
4037
  linkage: true,
@@ -10020,9 +10021,9 @@ const nextItem = (v, list)=>{
10020
10021
  };
10021
10022
  const Unit = ()=>{
10022
10023
  const { state: { axisY, globalID }, dispatch } = useStore_useStore();
10023
- const { unit, unitList, autoranging, onChange } = axisY;
10024
+ const { unit, unitList, unitDisabled, autoranging, onChange } = axisY;
10024
10025
  const updateUnit = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
10025
- if (autoranging) return;
10026
+ if (autoranging || unitDisabled) return;
10026
10027
  const newUnit = nextItem(unit, unitList);
10027
10028
  onChange?.({
10028
10029
  unit: newUnit
@@ -10039,6 +10040,7 @@ const Unit = ()=>{
10039
10040
  axisY,
10040
10041
  unit,
10041
10042
  autoranging,
10043
+ unitDisabled,
10042
10044
  unitList,
10043
10045
  onChange
10044
10046
  ]);
@@ -11131,6 +11133,149 @@ const SpacerLine = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_run
11131
11133
  className: components_ToolsBar_styles_module.spacerLine
11132
11134
  });
11133
11135
  const ToolsBar_SpacerLine = SpacerLine;
11136
+ const TOOL_CONFIGS = [
11137
+ {
11138
+ component: Autoranging,
11139
+ toolType: constants_ToolsBarItemType.AutorangingSwitch,
11140
+ supportedCharts: [],
11141
+ excludedCharts: [
11142
+ constants_ChartType.Heatmap,
11143
+ constants_ChartType.ScanDF360,
11144
+ constants_ChartType.LevelStream,
11145
+ constants_ChartType.LiteNormalized
11146
+ ]
11147
+ },
11148
+ {
11149
+ component: components_Unit,
11150
+ toolType: constants_ToolsBarItemType.UnitSwitch,
11151
+ supportedCharts: [],
11152
+ excludedCharts: [
11153
+ constants_ChartType.ScanDF360,
11154
+ constants_ChartType.LevelStream,
11155
+ constants_ChartType.LiteNormalized
11156
+ ]
11157
+ },
11158
+ {
11159
+ component: ToolsBar_GradientRibbon,
11160
+ toolType: constants_ToolsBarItemType.GradientRibbon,
11161
+ supportedCharts: [
11162
+ constants_ChartType.Heatmap
11163
+ ]
11164
+ },
11165
+ {
11166
+ component: ToolsBar_SpacerLine,
11167
+ toolType: constants_ToolsBarItemType.SpacerLine,
11168
+ supportedCharts: [],
11169
+ excludedCharts: [
11170
+ constants_ChartType.ScanDF360,
11171
+ constants_ChartType.LevelStream
11172
+ ]
11173
+ },
11174
+ {
11175
+ component: Reset,
11176
+ toolType: constants_ToolsBarItemType.Reset,
11177
+ supportedCharts: [],
11178
+ excludedCharts: [
11179
+ constants_ChartType.LiteNormalized
11180
+ ]
11181
+ },
11182
+ {
11183
+ component: StationAllocation_Switch,
11184
+ toolType: constants_ToolsBarItemType.StationAllocationSwitch,
11185
+ supportedCharts: [
11186
+ constants_ChartType.SingleFrequency,
11187
+ constants_ChartType.Scan,
11188
+ constants_ChartType.MScan
11189
+ ]
11190
+ },
11191
+ {
11192
+ component: ToolsBar_SeriesControl,
11193
+ toolType: constants_ToolsBarItemType.SeriesControl,
11194
+ supportedCharts: [
11195
+ constants_ChartType.SingleFrequency,
11196
+ constants_ChartType.Scan,
11197
+ constants_ChartType.MScan
11198
+ ],
11199
+ props: {
11200
+ type: 'dynamic'
11201
+ }
11202
+ },
11203
+ {
11204
+ component: FrequencyAllocation_Switch,
11205
+ toolType: constants_ToolsBarItemType.FrequencyAllocationSwitch,
11206
+ supportedCharts: [
11207
+ constants_ChartType.SingleFrequency,
11208
+ constants_ChartType.Scan,
11209
+ constants_ChartType.MScan,
11210
+ constants_ChartType.LiteNormalized
11211
+ ]
11212
+ },
11213
+ {
11214
+ component: Zoom_Switch,
11215
+ toolType: constants_ToolsBarItemType.ZoomSwitch,
11216
+ supportedCharts: [
11217
+ constants_ChartType.SingleFrequency,
11218
+ constants_ChartType.Scan,
11219
+ constants_ChartType.MScan
11220
+ ]
11221
+ },
11222
+ {
11223
+ component: Limit_Switch,
11224
+ toolType: constants_ToolsBarItemType.LimitSwitch,
11225
+ supportedCharts: [
11226
+ constants_ChartType.SingleFrequency,
11227
+ constants_ChartType.Scan,
11228
+ constants_ChartType.MScan
11229
+ ]
11230
+ },
11231
+ {
11232
+ component: Markers_Switch,
11233
+ toolType: constants_ToolsBarItemType.MarkersSwitch,
11234
+ supportedCharts: [
11235
+ constants_ChartType.SingleFrequency,
11236
+ constants_ChartType.Scan,
11237
+ constants_ChartType.MScan
11238
+ ]
11239
+ },
11240
+ {
11241
+ component: SegmentsDisplayControl,
11242
+ toolType: constants_ToolsBarItemType.SegmentsDisplayControl,
11243
+ supportedCharts: [
11244
+ constants_ChartType.Scan
11245
+ ]
11246
+ },
11247
+ {
11248
+ component: HeatmapCapture_Switch,
11249
+ toolType: constants_ToolsBarItemType.HeatmapCaptureSwitch,
11250
+ supportedCharts: [
11251
+ constants_ChartType.Heatmap
11252
+ ]
11253
+ },
11254
+ {
11255
+ component: TimeRange_Switch,
11256
+ toolType: constants_ToolsBarItemType.TimeRangeSwitch,
11257
+ supportedCharts: [
11258
+ constants_ChartType.Heatmap
11259
+ ]
11260
+ },
11261
+ {
11262
+ component: SeriesDisplayControl,
11263
+ toolType: constants_ToolsBarItemType.SeriesDisplayControl,
11264
+ supportedCharts: [
11265
+ constants_ChartType.SingleFrequency,
11266
+ constants_ChartType.Scan,
11267
+ constants_ChartType.LiteNormalized,
11268
+ constants_ChartType.MScan
11269
+ ]
11270
+ },
11271
+ {
11272
+ component: Fluorescence_Switch,
11273
+ toolType: constants_ToolsBarItemType.FluorescenceSwitch,
11274
+ supportedCharts: [
11275
+ constants_ChartType.SingleFrequency
11276
+ ]
11277
+ }
11278
+ ];
11134
11279
  const ToolsBar_ToolsBar = ({ type })=>{
11135
11280
  const { state: { toolsBar: { show, hiddenTools = [] } } } = useStore_useStore();
11136
11281
  const { width, pluginBoxWidth } = useAxisYWidth_useAxisYWidth();
@@ -11141,45 +11286,43 @@ const ToolsBar_ToolsBar = ({ type })=>{
11141
11286
  width,
11142
11287
  pluginBoxWidth
11143
11288
  ]);
11144
- const isToolHidden = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((toolType)=>hiddenTools.includes(toolType), [
11145
- hiddenTools
11289
+ const shouldShowTool = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
11290
+ const hiddenToolsSet = new Set(hiddenTools);
11291
+ return (config)=>{
11292
+ if (hiddenToolsSet.has(config.toolType)) return false;
11293
+ if (config.supportedCharts.length > 0) return config.supportedCharts.includes(type);
11294
+ if (config.excludedCharts && config.excludedCharts.length > 0) return !config.excludedCharts.includes(type);
11295
+ return true;
11296
+ };
11297
+ }, [
11298
+ hiddenTools,
11299
+ type
11300
+ ]);
11301
+ const visibleTools = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>TOOL_CONFIGS.filter(shouldShowTool).map((config)=>{
11302
+ const Component = config.component;
11303
+ let props = config.props || {};
11304
+ if ('dynamic' === props.type) {
11305
+ props = {
11306
+ ...props,
11307
+ type
11308
+ };
11309
+ delete props.type;
11310
+ props.type = type;
11311
+ }
11312
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Component, {
11313
+ ...props
11314
+ }, config.toolType);
11315
+ }), [
11316
+ shouldShowTool,
11317
+ type
11146
11318
  ]);
11147
11319
  if (type === constants_ChartType.Occupancy || !show) return null;
11148
11320
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
11149
11321
  className: components_ToolsBar_styles_module.ToolsBar,
11150
11322
  style: axisStyle,
11151
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
11323
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
11152
11324
  className: components_ToolsBar_styles_module.fun,
11153
- children: [
11154
- type !== constants_ChartType.Heatmap && type !== constants_ChartType.ScanDF360 && type !== constants_ChartType.LevelStream && !isToolHidden(constants_ToolsBarItemType.AutorangingSwitch) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Autoranging, {}),
11155
- type !== constants_ChartType.ScanDF360 && type !== constants_ChartType.LevelStream && !isToolHidden(constants_ToolsBarItemType.UnitSwitch) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(components_Unit, {}),
11156
- type === constants_ChartType.Heatmap && !isToolHidden(constants_ToolsBarItemType.GradientRibbon) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ToolsBar_GradientRibbon, {}),
11157
- type !== constants_ChartType.ScanDF360 && type !== constants_ChartType.LevelStream && !isToolHidden(constants_ToolsBarItemType.SpacerLine) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ToolsBar_SpacerLine, {}),
11158
- !isToolHidden(constants_ToolsBarItemType.Reset) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Reset, {}),
11159
- (type === constants_ChartType.SingleFrequency || type === constants_ChartType.Scan || type === constants_ChartType.MScan) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
11160
- children: [
11161
- !isToolHidden(constants_ToolsBarItemType.StationAllocationSwitch) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(StationAllocation_Switch, {}),
11162
- !isToolHidden(constants_ToolsBarItemType.SeriesControl) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ToolsBar_SeriesControl, {
11163
- type: type
11164
- }),
11165
- !isToolHidden(constants_ToolsBarItemType.FrequencyAllocationSwitch) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(FrequencyAllocation_Switch, {}),
11166
- !isToolHidden(constants_ToolsBarItemType.ZoomSwitch) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Zoom_Switch, {}),
11167
- !isToolHidden(constants_ToolsBarItemType.LimitSwitch) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Limit_Switch, {}),
11168
- !isToolHidden(constants_ToolsBarItemType.MarkersSwitch) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Markers_Switch, {})
11169
- ]
11170
- }),
11171
- type === constants_ChartType.Scan && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
11172
- children: !isToolHidden(constants_ToolsBarItemType.SegmentsDisplayControl) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SegmentsDisplayControl, {})
11173
- }),
11174
- type === constants_ChartType.Heatmap && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
11175
- children: [
11176
- !isToolHidden(constants_ToolsBarItemType.HeatmapCaptureSwitch) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(HeatmapCapture_Switch, {}),
11177
- !isToolHidden(constants_ToolsBarItemType.TimeRangeSwitch) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(TimeRange_Switch, {})
11178
- ]
11179
- }),
11180
- (type === constants_ChartType.SingleFrequency || type === constants_ChartType.Scan || type === constants_ChartType.MScan) && !isToolHidden(constants_ToolsBarItemType.SeriesDisplayControl) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SeriesDisplayControl, {}),
11181
- type === constants_ChartType.SingleFrequency && !isToolHidden(constants_ToolsBarItemType.FluorescenceSwitch) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Fluorescence_Switch, {})
11182
- ]
11325
+ children: visibleTools
11183
11326
  })
11184
11327
  });
11185
11328
  };
@@ -15296,13 +15439,11 @@ function useSpectrumChartType({ type, heatmapElementID }) {
15296
15439
  if (type === constants_ChartType.LiteNormalized) {
15297
15440
  limit.show = false;
15298
15441
  signal.show = false;
15299
- marker.enabled = false;
15300
- frequencyAllocation.show = false;
15301
- toolsBar.show = false;
15302
15442
  axisY.restrict = [
15303
15443
  0,
15304
15444
  1
15305
15445
  ];
15446
+ axisY.unitDisabled = true;
15306
15447
  }
15307
15448
  if (type === constants_ChartType.MScan) {
15308
15449
  limit.show = false;
package/package.json CHANGED
@@ -5,6 +5,6 @@
5
5
  "types": "index.d.ts",
6
6
  "author": "Hxgh",
7
7
  "license": "MIT",
8
- "version": "1.1.31",
8
+ "version": "1.1.33",
9
9
  "private": false
10
10
  }
package/types/store.d.ts CHANGED
@@ -21,6 +21,7 @@ export interface AxisYProps {
21
21
  step?: number;
22
22
  unit?: string;
23
23
  unitList?: string[];
24
+ unitDisabled?: boolean;
24
25
  type?: string;
25
26
  hidden?: string[];
26
27
  linkage?: boolean;