@rfkit/charts 1.1.0 → 1.1.1
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 +27 -20
- package/modules/Spectrum/render.d.ts +0 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -9767,7 +9767,6 @@ class Spectrum {
|
|
|
9767
9767
|
interval: 1,
|
|
9768
9768
|
series: {},
|
|
9769
9769
|
globalID: '',
|
|
9770
|
-
forceDisplay: false,
|
|
9771
9770
|
...props
|
|
9772
9771
|
};
|
|
9773
9772
|
this.firstRenderAutoFocus = false;
|
|
@@ -9838,7 +9837,7 @@ class Spectrum {
|
|
|
9838
9837
|
};
|
|
9839
9838
|
}
|
|
9840
9839
|
setSeries(config) {
|
|
9841
|
-
const { chart, series, globalID
|
|
9840
|
+
const { chart, series, globalID } = this.state;
|
|
9842
9841
|
const { name } = config;
|
|
9843
9842
|
if (!chart || !name || !config) return;
|
|
9844
9843
|
const { type = type_GraphicType.Stepline, color = SERIES[name]?.color, thickness = 1, display = false } = {
|
|
@@ -9852,7 +9851,6 @@ class Spectrum {
|
|
|
9852
9851
|
thickness,
|
|
9853
9852
|
display
|
|
9854
9853
|
};
|
|
9855
|
-
if (forceDisplay) c.display = true;
|
|
9856
9854
|
series[name] = c;
|
|
9857
9855
|
chart.setSeries(c);
|
|
9858
9856
|
passThroughSeries(globalID, series);
|
|
@@ -12465,20 +12463,12 @@ function usePoints() {
|
|
|
12465
12463
|
}
|
|
12466
12464
|
const Spectrum_Spectrum = (props)=>{
|
|
12467
12465
|
const { selecter, children } = props;
|
|
12468
|
-
const { state: { axisY: { autoranging }, series: { weaken
|
|
12469
|
-
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
12470
|
-
chart?.updateProps({
|
|
12471
|
-
forceDisplay
|
|
12472
|
-
});
|
|
12473
|
-
}, [
|
|
12474
|
-
forceDisplay
|
|
12475
|
-
]);
|
|
12466
|
+
const { state: { axisY: { autoranging }, series: { weaken }, globalID } } = useStore_useStore();
|
|
12476
12467
|
const { id, chart, Chart } = hooks_useChart({
|
|
12477
12468
|
Render: Spectrum,
|
|
12478
12469
|
params: {
|
|
12479
12470
|
autoranging,
|
|
12480
|
-
weaken
|
|
12481
|
-
forceDisplay
|
|
12471
|
+
weaken
|
|
12482
12472
|
}
|
|
12483
12473
|
});
|
|
12484
12474
|
useZoomEvent(id, constants_ModuleType.Spectrum);
|
|
@@ -13847,14 +13837,18 @@ SeriesDisplayControl_styles_module_options.domAPI = styleDomAPI_default();
|
|
|
13847
13837
|
SeriesDisplayControl_styles_module_options.insertStyleElement = insertStyleElement_default();
|
|
13848
13838
|
injectStylesIntoStyleTag_default()(SeriesDisplayControl_styles_module.Z, SeriesDisplayControl_styles_module_options);
|
|
13849
13839
|
const ToolsBar_SeriesDisplayControl_styles_module = SeriesDisplayControl_styles_module.Z && SeriesDisplayControl_styles_module.Z.locals ? SeriesDisplayControl_styles_module.Z.locals : void 0;
|
|
13850
|
-
const
|
|
13840
|
+
const SeriesDisplayControl_SeriesDisplayControl = ()=>{
|
|
13851
13841
|
const { state: { globalID, series }, dispatch } = useStore_useStore();
|
|
13852
13842
|
const { data, legendExternal, forceDisplay } = series;
|
|
13853
|
-
const
|
|
13843
|
+
const seriesType = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>Array.from(data.keys()).filter((name)=>!legendExternal.includes(name)).filter((name)=>name !== constants_SeriesType.TemplateData), [
|
|
13844
|
+
data,
|
|
13845
|
+
legendExternal
|
|
13846
|
+
]);
|
|
13847
|
+
const onClick = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((name, isDisplayTrue)=>{
|
|
13854
13848
|
if (globalID) {
|
|
13855
13849
|
const item = data.get(name);
|
|
13856
13850
|
if (item) {
|
|
13857
|
-
const newDisplay = !item.display;
|
|
13851
|
+
const newDisplay = isDisplayTrue ? true : !item.display;
|
|
13858
13852
|
data.set(name, {
|
|
13859
13853
|
...item,
|
|
13860
13854
|
display: newDisplay
|
|
@@ -13877,6 +13871,19 @@ const SeriesDisplayControl = ()=>{
|
|
|
13877
13871
|
data,
|
|
13878
13872
|
globalID
|
|
13879
13873
|
]);
|
|
13874
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
13875
|
+
if (forceDisplay) [
|
|
13876
|
+
constants_SeriesType.MinData,
|
|
13877
|
+
constants_SeriesType.MaxData
|
|
13878
|
+
].forEach((s)=>{
|
|
13879
|
+
if (!legendExternal.includes(s)) setTimeout(()=>{
|
|
13880
|
+
onClick(s, true);
|
|
13881
|
+
}, 1);
|
|
13882
|
+
});
|
|
13883
|
+
}, [
|
|
13884
|
+
forceDisplay,
|
|
13885
|
+
seriesType
|
|
13886
|
+
]);
|
|
13880
13887
|
const [isCollapsed, setIsCollapsed] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(true);
|
|
13881
13888
|
const toggleCollapse = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
|
|
13882
13889
|
setIsCollapsed((prev)=>!prev);
|
|
@@ -13924,9 +13931,9 @@ const SeriesDisplayControl = ()=>{
|
|
|
13924
13931
|
CollapsedIcon,
|
|
13925
13932
|
!isCollapsed && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
13926
13933
|
className: ToolsBar_SeriesDisplayControl_styles_module.itemsContainer,
|
|
13927
|
-
children:
|
|
13934
|
+
children: seriesType.map((name)=>{
|
|
13928
13935
|
const series = data.get(name);
|
|
13929
|
-
const dp =
|
|
13936
|
+
const dp = series?.display;
|
|
13930
13937
|
const label = series?.label;
|
|
13931
13938
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Tooltip, {
|
|
13932
13939
|
content: `${label} \u{5DF2}${dp ? "\u663E\u793A" : "\u9690\u85CF"}`,
|
|
@@ -13947,7 +13954,7 @@ const SeriesDisplayControl = ()=>{
|
|
|
13947
13954
|
]
|
|
13948
13955
|
});
|
|
13949
13956
|
};
|
|
13950
|
-
const
|
|
13957
|
+
const SeriesDisplayControl = SeriesDisplayControl_SeriesDisplayControl;
|
|
13951
13958
|
const SpacerLine = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
13952
13959
|
className: components_ToolsBar_styles_module.spacerLine
|
|
13953
13960
|
});
|
|
@@ -13991,7 +13998,7 @@ const ToolsBar = ({ type })=>{
|
|
|
13991
13998
|
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(TimeRange_Switch, {})
|
|
13992
13999
|
]
|
|
13993
14000
|
}),
|
|
13994
|
-
(type === constants_ChartType.SingleFrequency || type === constants_ChartType.Scan || type === constants_ChartType.MScan) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(
|
|
14001
|
+
(type === constants_ChartType.SingleFrequency || type === constants_ChartType.Scan || type === constants_ChartType.MScan) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SeriesDisplayControl, {})
|
|
13995
14002
|
]
|
|
13996
14003
|
})
|
|
13997
14004
|
});
|