@@ -11,7 +11,14 @@ import Info from './Info';
11
11
import { UnconnectedColorPicker } from './ColorPicker' ;
12
12
import { UnconnectedTextEditor } from './TextEditor' ;
13
13
import { UnconnectedVisibilitySelect } from './VisibilitySelect' ;
14
- import { connectToContainer , getAllAxes , getAxisTitle , axisIdToAxisName } from 'lib' ;
14
+ import {
15
+ applyCustomConfigVisibility ,
16
+ connectToContainer ,
17
+ getAllAxes ,
18
+ getAxisTitle ,
19
+ axisIdToAxisName ,
20
+ isValidCustomConfigObject ,
21
+ } from 'lib' ;
15
22
16
23
export const AxisAnchorDropdown = connectToContainer ( UnconnectedDropdown , {
17
24
modifyPlotProps : ( props , context , plotProps ) => {
@@ -80,7 +87,9 @@ export const RangesliderVisible = connectToContainer(UnconnectedRadio, {
80
87
if ( ! plotProps . fullValue ) {
81
88
plotProps . fullValue = false ;
82
89
plotProps . visible = false ;
83
- plotProps . isVisible = true ;
90
+ plotProps . isVisible = isValidCustomConfigObject ( context . customConfig )
91
+ ? applyCustomConfigVisibility ( props , plotProps . fullValue , context . customConfig )
92
+ : true ;
84
93
return ;
85
94
}
86
95
} ,
@@ -162,7 +171,9 @@ export const TickFormat = connectToContainer(UnconnectedDropdownCustom, {
162
171
export const ShowInLegend = connectToContainer ( UnconnectedVisibilitySelect , {
163
172
modifyPlotProps : ( props , context , plotProps ) => {
164
173
if ( context . container . type && context . container . type !== 'sunburst' ) {
165
- plotProps . isVisible = context . fullLayout . showlegend ;
174
+ plotProps . isVisible = isValidCustomConfigObject ( context . customConfig )
175
+ ? plotProps . isVisible && context . fullLayout . showlegend
176
+ : context . fullLayout . showlegend ;
166
177
}
167
178
168
179
return plotProps ;
@@ -171,23 +182,31 @@ export const ShowInLegend = connectToContainer(UnconnectedVisibilitySelect, {
171
182
172
183
export const HistogramInfoVertical = connectToContainer ( Info , {
173
184
modifyPlotProps : ( props , context , plotProps ) => {
174
- plotProps . isVisible =
175
- context . fullContainer . type === 'histogram' && context . fullContainer . orientation === 'v' ;
185
+ plotProps . isVisible = isValidCustomConfigObject ( context . customConfig )
186
+ ? plotProps . isVisible &&
187
+ context . fullContainer . type === 'histogram' &&
188
+ context . fullContainer . orientation === 'v'
189
+ : context . fullContainer . type === 'histogram' && context . fullContainer . orientation === 'v' ;
176
190
return plotProps ;
177
191
} ,
178
192
} ) ;
179
193
180
194
export const HistogramInfoHorizontal = connectToContainer ( Info , {
181
195
modifyPlotProps : ( props , context , plotProps ) => {
182
- plotProps . isVisible =
183
- context . fullContainer . type === 'histogram' && context . fullContainer . orientation === 'h' ;
196
+ plotProps . isVisible = isValidCustomConfigObject ( context . customConfig )
197
+ ? plotProps . isVisible &&
198
+ context . fullContainer . type === 'histogram' &&
199
+ context . fullContainer . orientation === 'h'
200
+ : context . fullContainer . type === 'histogram' && context . fullContainer . orientation === 'h' ;
184
201
return plotProps ;
185
202
} ,
186
203
} ) ;
187
204
188
205
export const Histogram2d = connectToContainer ( Info , {
189
206
modifyPlotProps : ( props , context , plotProps ) => {
190
- plotProps . isVisible = context . fullContainer . type === 'histogram2d' ;
207
+ plotProps . isVisible = isValidCustomConfigObject ( context . customConfig )
208
+ ? plotProps . isVisible && context . fullContainer . type === 'histogram2d'
209
+ : context . fullContainer . type === 'histogram2d' ;
191
210
return plotProps ;
192
211
} ,
193
212
} ) ;
@@ -707,7 +726,9 @@ export const HovermodeDropdown = connectToContainer(UnconnectedVisibilitySelect,
707
726
708
727
export const HoverColor = connectToContainer ( UnconnectedColorPicker , {
709
728
modifyPlotProps : ( props , context , plotProps ) => {
710
- plotProps . isVisible = Boolean ( context . fullLayout . hovermode ) ;
729
+ plotProps . isVisible = isValidCustomConfigObject ( context . customConfig )
730
+ ? plotProps . isVisible && Boolean ( context . fullLayout . hovermode )
731
+ : Boolean ( context . fullLayout . hovermode ) ;
711
732
return plotProps ;
712
733
} ,
713
734
} ) ;
@@ -717,7 +738,9 @@ export const LevelRendered = connectToContainer(UnconnectedDropdown, {
717
738
const _ = context . localize ;
718
739
719
740
if ( context . container . ids && context . container . ids . length ) {
720
- plotProps . isVisible = true ;
741
+ plotProps . isVisible = isValidCustomConfigObject ( context . customConfig )
742
+ ? plotProps . isVisible
743
+ : true ;
721
744
plotProps . options = [ { label : _ ( 'Root' ) , value : '' } ] . concat (
722
745
context . container . ids . map ( i => ( { label : i , value : i } ) )
723
746
) ;
0 commit comments