Skip to content

Commit 1943594

Browse files
proper visibility rules for rangeslider UI
1 parent 9228226 commit 1943594

File tree

5 files changed

+21
-1
lines changed

5 files changed

+21
-1
lines changed

src/components/fields/derived.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ export const AxisOverlayDropdown = connectToContainer(UnconnectedDropdown, {
7878
},
7979
});
8080

81+
export const RangesliderVisible = connectToContainer(UnconnectedRadio, {
82+
modifyPlotProps: (props, context, plotProps) => {
83+
if (
84+
!plotProps.isVisible &&
85+
context.fullContainer._id &&
86+
context.fullContainer._id.startsWith('x')
87+
) {
88+
plotProps.isVisible = true;
89+
return;
90+
}
91+
},
92+
});
93+
8194
export const AxisSide = connectToContainer(UnconnectedRadio, {
8295
modifyPlotProps: (props, context, plotProps) => {
8396
const _ = props.localize;

src/components/fields/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
NumericFractionInverse,
3434
LayoutNumericFraction,
3535
LayoutNumericFractionInverse,
36+
RangesliderVisible,
3637
TraceOrientation,
3738
AxisOverlayDropdown,
3839
AxisSide,
@@ -72,6 +73,7 @@ export {
7273
Numeric,
7374
Radio,
7475
SymbolSelector,
76+
RangesliderVisible,
7577
TextEditor,
7678
TraceOrientation,
7779
TraceSelector,

src/components/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
LineShapeSelector,
3333
Numeric,
3434
Radio,
35+
RangesliderVisible,
3536
AxisCreator,
3637
SymbolSelector,
3738
TextEditor,
@@ -74,6 +75,7 @@ export {
7475
ImageAccordion,
7576
UpdateMenuAccordion,
7677
AnnotationArrowRef,
78+
RangesliderVisible,
7779
AnnotationRef,
7880
PositioningRef,
7981
ArrowSelector,

src/default_panels/StyleAxesPanel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
TraceRequiredPanel,
1919
AxesFold,
2020
TraceTypeSection,
21+
RangesliderVisible,
2122
} from '../components';
2223

2324
import {localize} from '../lib';
@@ -309,7 +310,7 @@ class StyleAxesPanel extends Component {
309310
</AxesFold>
310311

311312
<AxesFold name={_('Range Slider')}>
312-
<Radio
313+
<RangesliderVisible
313314
attr="rangeslider.visible"
314315
options={[
315316
{label: _('Show'), value: true},

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import {
5757
SingleSidebarItem,
5858
SymbolSelector,
5959
TextEditor,
60+
RangesliderVisible,
6061
TraceAccordion,
6162
TraceMarkerSection,
6263
TraceRequiredPanel,
@@ -97,6 +98,7 @@ export {
9798
DataSelector,
9899
Dropdown,
99100
EDITOR_ACTIONS,
101+
RangesliderVisible,
100102
Flaglist,
101103
Fold,
102104
FontSelector,

0 commit comments

Comments
 (0)