Skip to content

Commit df34a8e

Browse files
proper visibility rules for rangeslider UI
1 parent a061a26 commit df34a8e

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
@@ -34,6 +34,7 @@ import {
3434
NumericFractionInverse,
3535
LayoutNumericFraction,
3636
LayoutNumericFractionInverse,
37+
RangesliderVisible,
3738
TraceOrientation,
3839
AxisOverlayDropdown,
3940
AxisSide,
@@ -73,6 +74,7 @@ export {
7374
Numeric,
7475
Radio,
7576
SymbolSelector,
77+
RangesliderVisible,
7678
TextEditor,
7779
TraceOrientation,
7880
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,
@@ -75,6 +76,7 @@ export {
7576
ImageAccordion,
7677
UpdateMenuAccordion,
7778
AnnotationArrowRef,
79+
RangesliderVisible,
7880
AnnotationRef,
7981
PositioningRef,
8082
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
@@ -58,6 +58,7 @@ import {
5858
SingleSidebarItem,
5959
SymbolSelector,
6060
TextEditor,
61+
RangesliderVisible,
6162
TraceAccordion,
6263
TraceMarkerSection,
6364
TraceRequiredPanel,
@@ -99,6 +100,7 @@ export {
99100
Dropdown,
100101
Dropzone,
101102
EDITOR_ACTIONS,
103+
RangesliderVisible,
102104
Flaglist,
103105
Fold,
104106
FontSelector,

0 commit comments

Comments
 (0)