@rfkit/charts 1.1.31 → 1.1.32

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.
Files changed (2) hide show
  1. package/index.js +174 -36
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -11131,6 +11131,149 @@ const SpacerLine = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_run
11131
11131
  className: components_ToolsBar_styles_module.spacerLine
11132
11132
  });
11133
11133
  const ToolsBar_SpacerLine = SpacerLine;
11134
+ const TOOL_CONFIGS = [
11135
+ {
11136
+ component: Autoranging,
11137
+ toolType: constants_ToolsBarItemType.AutorangingSwitch,
11138
+ supportedCharts: [],
11139
+ excludedCharts: [
11140
+ constants_ChartType.Heatmap,
11141
+ constants_ChartType.ScanDF360,
11142
+ constants_ChartType.LevelStream,
11143
+ constants_ChartType.LiteNormalized
11144
+ ]
11145
+ },
11146
+ {
11147
+ component: components_Unit,
11148
+ toolType: constants_ToolsBarItemType.UnitSwitch,
11149
+ supportedCharts: [],
11150
+ excludedCharts: [
11151
+ constants_ChartType.ScanDF360,
11152
+ constants_ChartType.LevelStream,
11153
+ constants_ChartType.LiteNormalized
11154
+ ]
11155
+ },
11156
+ {
11157
+ component: ToolsBar_GradientRibbon,
11158
+ toolType: constants_ToolsBarItemType.GradientRibbon,
11159
+ supportedCharts: [
11160
+ constants_ChartType.Heatmap
11161
+ ]
11162
+ },
11163
+ {
11164
+ component: ToolsBar_SpacerLine,
11165
+ toolType: constants_ToolsBarItemType.SpacerLine,
11166
+ supportedCharts: [],
11167
+ excludedCharts: [
11168
+ constants_ChartType.ScanDF360,
11169
+ constants_ChartType.LevelStream
11170
+ ]
11171
+ },
11172
+ {
11173
+ component: Reset,
11174
+ toolType: constants_ToolsBarItemType.Reset,
11175
+ supportedCharts: [],
11176
+ excludedCharts: [
11177
+ constants_ChartType.LiteNormalized
11178
+ ]
11179
+ },
11180
+ {
11181
+ component: StationAllocation_Switch,
11182
+ toolType: constants_ToolsBarItemType.StationAllocationSwitch,
11183
+ supportedCharts: [
11184
+ constants_ChartType.SingleFrequency,
11185
+ constants_ChartType.Scan,
11186
+ constants_ChartType.MScan
11187
+ ]
11188
+ },
11189
+ {
11190
+ component: ToolsBar_SeriesControl,
11191
+ toolType: constants_ToolsBarItemType.SeriesControl,
11192
+ supportedCharts: [
11193
+ constants_ChartType.SingleFrequency,
11194
+ constants_ChartType.Scan,
11195
+ constants_ChartType.MScan
11196
+ ],
11197
+ props: {
11198
+ type: 'dynamic'
11199
+ }
11200
+ },
11201
+ {
11202
+ component: FrequencyAllocation_Switch,
11203
+ toolType: constants_ToolsBarItemType.FrequencyAllocationSwitch,
11204
+ supportedCharts: [
11205
+ constants_ChartType.SingleFrequency,
11206
+ constants_ChartType.Scan,
11207
+ constants_ChartType.MScan,
11208
+ constants_ChartType.LiteNormalized
11209
+ ]
11210
+ },
11211
+ {
11212
+ component: Zoom_Switch,
11213
+ toolType: constants_ToolsBarItemType.ZoomSwitch,
11214
+ supportedCharts: [
11215
+ constants_ChartType.SingleFrequency,
11216
+ constants_ChartType.Scan,
11217
+ constants_ChartType.MScan
11218
+ ]
11219
+ },
11220
+ {
11221
+ component: Limit_Switch,
11222
+ toolType: constants_ToolsBarItemType.LimitSwitch,
11223
+ supportedCharts: [
11224
+ constants_ChartType.SingleFrequency,
11225
+ constants_ChartType.Scan,
11226
+ constants_ChartType.MScan
11227
+ ]
11228
+ },
11229
+ {
11230
+ component: Markers_Switch,
11231
+ toolType: constants_ToolsBarItemType.MarkersSwitch,
11232
+ supportedCharts: [
11233
+ constants_ChartType.SingleFrequency,
11234
+ constants_ChartType.Scan,
11235
+ constants_ChartType.MScan
11236
+ ]
11237
+ },
11238
+ {
11239
+ component: SegmentsDisplayControl,
11240
+ toolType: constants_ToolsBarItemType.SegmentsDisplayControl,
11241
+ supportedCharts: [
11242
+ constants_ChartType.Scan
11243
+ ]
11244
+ },
11245
+ {
11246
+ component: HeatmapCapture_Switch,
11247
+ toolType: constants_ToolsBarItemType.HeatmapCaptureSwitch,
11248
+ supportedCharts: [
11249
+ constants_ChartType.Heatmap
11250
+ ]
11251
+ },
11252
+ {
11253
+ component: TimeRange_Switch,
11254
+ toolType: constants_ToolsBarItemType.TimeRangeSwitch,
11255
+ supportedCharts: [
11256
+ constants_ChartType.Heatmap
11257
+ ]
11258
+ },
11259
+ {
11260
+ component: SeriesDisplayControl,
11261
+ toolType: constants_ToolsBarItemType.SeriesDisplayControl,
11262
+ supportedCharts: [
11263
+ constants_ChartType.SingleFrequency,
11264
+ constants_ChartType.Scan,
11265
+ constants_ChartType.LiteNormalized,
11266
+ constants_ChartType.MScan
11267
+ ]
11268
+ },
11269
+ {
11270
+ component: Fluorescence_Switch,
11271
+ toolType: constants_ToolsBarItemType.FluorescenceSwitch,
11272
+ supportedCharts: [
11273
+ constants_ChartType.SingleFrequency
11274
+ ]
11275
+ }
11276
+ ];
11134
11277
  const ToolsBar_ToolsBar = ({ type })=>{
11135
11278
  const { state: { toolsBar: { show, hiddenTools = [] } } } = useStore_useStore();
11136
11279
  const { width, pluginBoxWidth } = useAxisYWidth_useAxisYWidth();
@@ -11141,45 +11284,43 @@ const ToolsBar_ToolsBar = ({ type })=>{
11141
11284
  width,
11142
11285
  pluginBoxWidth
11143
11286
  ]);
11144
- const isToolHidden = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((toolType)=>hiddenTools.includes(toolType), [
11145
- hiddenTools
11287
+ const shouldShowTool = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
11288
+ const hiddenToolsSet = new Set(hiddenTools);
11289
+ return (config)=>{
11290
+ if (hiddenToolsSet.has(config.toolType)) return false;
11291
+ if (config.supportedCharts.length > 0) return config.supportedCharts.includes(type);
11292
+ if (config.excludedCharts && config.excludedCharts.length > 0) return !config.excludedCharts.includes(type);
11293
+ return true;
11294
+ };
11295
+ }, [
11296
+ hiddenTools,
11297
+ type
11298
+ ]);
11299
+ const visibleTools = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>TOOL_CONFIGS.filter(shouldShowTool).map((config)=>{
11300
+ const Component = config.component;
11301
+ let props = config.props || {};
11302
+ if ('dynamic' === props.type) {
11303
+ props = {
11304
+ ...props,
11305
+ type
11306
+ };
11307
+ delete props.type;
11308
+ props.type = type;
11309
+ }
11310
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Component, {
11311
+ ...props
11312
+ }, config.toolType);
11313
+ }), [
11314
+ shouldShowTool,
11315
+ type
11146
11316
  ]);
11147
11317
  if (type === constants_ChartType.Occupancy || !show) return null;
11148
11318
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
11149
11319
  className: components_ToolsBar_styles_module.ToolsBar,
11150
11320
  style: axisStyle,
11151
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
11321
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
11152
11322
  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
- ]
11323
+ children: visibleTools
11183
11324
  })
11184
11325
  });
11185
11326
  };
@@ -15296,9 +15437,6 @@ function useSpectrumChartType({ type, heatmapElementID }) {
15296
15437
  if (type === constants_ChartType.LiteNormalized) {
15297
15438
  limit.show = false;
15298
15439
  signal.show = false;
15299
- marker.enabled = false;
15300
- frequencyAllocation.show = false;
15301
- toolsBar.show = false;
15302
15440
  axisY.restrict = [
15303
15441
  0,
15304
15442
  1
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.32",
9
9
  "private": false
10
10
  }