← All changes
|
classes/Visualizer/Gutenberg/src/Components/Sidebar/GeneralSettings.js
+19
-37
3.10.15
→
3.4.2
View file →
| @@ -33,31 +33,8 @@ | ||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | tooltipTriggers[2] = { label: __( 'The tooltip will not be displayed' ), value: 'none' }; |
| 36 | 36 | |
| 37 | - let positions = [ | |
| 38 | - { label: __( 'Left of the chart' ), value: 'left' }, | |
| 39 | - { label: __( 'Right of the chart' ), value: 'right' }, | |
| 40 | - { label: __( 'Above the chart' ), value: 'top' }, | |
| 41 | - { label: __( 'Below the chart' ), value: 'bottom' }, | |
| 42 | - { label: __( 'Omit the legend' ), value: 'none' } | |
| 43 | - ]; | |
| 44 | - | |
| 45 | - if ( 'pie' !== type ) { | |
| 46 | - positions.push({ label: __( 'Inside the chart' ), value: 'in' }); | |
| 47 | - } | |
| 48 | - | |
| 49 | - if ( 'bubble' === type ) { | |
| 50 | - positions = positions.filter( function( obj ) { | |
| 51 | - return 'left' !== obj.value; | |
| 52 | - }); | |
| 53 | - } | |
| 54 | - | |
| 55 | - let titleHelp = __( 'Text to display above the chart.' ); | |
| 56 | - if ( 0 <= [ 'tabular', 'dataTable', 'gauge', 'geo', 'timeline' ].indexOf( type ) ) { | |
| 57 | - titleHelp = __( 'Text to display in the back-end admin area' ); | |
| 58 | - } | |
| 59 | - | |
| 60 | 37 | return ( |
| 61 | 38 | <PanelBody |
| 62 | 39 | title={ __( 'General Settings' ) } |
| 63 | 40 | initialOpen={ false } |
| @@ -71,9 +48,9 @@ | ||
| 71 | 48 | > |
| 72 | 49 | |
| 73 | 50 | <TextControl |
| 74 | 51 | label={ __( 'Chart Title' ) } |
| 75 | - help={ titleHelp } | |
| 52 | + help={ __( 'Text to display above the chart.' ) } | |
| 76 | 53 | value={ settings.title } |
| 77 | 54 | onChange={ e => { |
| 78 | 55 | settings.title = e; |
| 79 | 56 | this.props.edit( settings ); |
| @@ -79,9 +56,9 @@ | ||
| 79 | 56 | this.props.edit( settings ); |
| 80 | 57 | } } |
| 81 | 58 | /> |
| 82 | 59 | |
| 83 | - { ( -1 >= [ 'tabular', 'dataTable', 'gauge', 'geo', 'pie', 'timeline' ].indexOf( type ) ) && ( | |
| 60 | + { ( -1 >= [ 'table', 'gauge', 'geo', 'pie', 'timeline', 'dataTable' ].indexOf( type ) ) && ( | |
| 84 | 61 | <SelectControl |
| 85 | 62 | label={ __( 'Chart Title Position' ) } |
| 86 | 63 | help={ __( 'Where to place the chart title, compared to the chart area.' ) } |
| 87 | 64 | value={ settings.titlePosition ? settings.titlePosition : 'out' } |
| @@ -96,9 +73,9 @@ | ||
| 96 | 73 | } } |
| 97 | 74 | /> |
| 98 | 75 | ) } |
| 99 | 76 | |
| 100 | - { ( -1 >= [ 'tabular', 'dataTable', 'gauge', 'geo', 'timeline' ].indexOf( type ) ) && ( | |
| 77 | + { ( -1 >= [ 'table', 'gauge', 'geo', 'timeline', 'dataTable' ].indexOf( type ) ) && ( | |
| 101 | 78 | <BaseControl |
| 102 | 79 | label={ __( 'Chart Title Color' ) } |
| 103 | 80 | > |
| 104 | 81 | <ColorPalette |
| @@ -110,9 +87,9 @@ | ||
| 110 | 87 | /> |
| 111 | 88 | </BaseControl> |
| 112 | 89 | ) } |
| 113 | 90 | |
| 114 | - { ( -1 >= [ 'tabular', 'dataTable', 'gauge', 'geo', 'pie', 'timeline' ].indexOf( type ) ) && ( | |
| 91 | + { ( -1 >= [ 'table', 'gauge', 'geo', 'pie', 'timeline', 'dataTable' ].indexOf( type ) ) && ( | |
| 115 | 92 | <SelectControl |
| 116 | 93 | label={ __( 'Axes Titles Position' ) } |
| 117 | 94 | help={ __( 'Determines where to place the axis titles, compared to the chart area.' ) } |
| 118 | 95 | value={ settings.axisTitlesPosition ? settings.axisTitlesPosition : 'out' } |
| @@ -129,9 +106,9 @@ | ||
| 129 | 106 | ) } |
| 130 | 107 | |
| 131 | 108 | </PanelBody> |
| 132 | 109 | |
| 133 | - { ( -1 >= [ 'tabular', 'dataTable', 'gauge', 'geo', 'pie', 'timeline' ].indexOf( type ) ) && ( | |
| 110 | + { ( -1 >= [ 'table', 'gauge', 'geo', 'pie', 'timeline', 'dataTable' ].indexOf( type ) ) && ( | |
| 134 | 111 | <PanelBody |
| 135 | 112 | title={ __( 'Font Styles' ) } |
| 136 | 113 | className="visualizer-inner-sections" |
| 137 | 114 | initialOpen={ false } |
| @@ -189,9 +166,9 @@ | ||
| 189 | 166 | |
| 190 | 167 | </PanelBody> |
| 191 | 168 | ) } |
| 192 | 169 | |
| 193 | - { ( -1 >= [ 'tabular', 'dataTable', 'gauge', 'geo', 'timeline' ].indexOf( type ) ) && ( | |
| 170 | + { ( -1 >= [ 'table', 'gauge', 'geo', 'timeline', 'dataTable' ].indexOf( type ) ) && ( | |
| 194 | 171 | <PanelBody |
| 195 | 172 | title={ __( 'Legend' ) } |
| 196 | 173 | className="visualizer-inner-sections" |
| 197 | 174 | initialOpen={ false } |
| @@ -200,18 +177,23 @@ | ||
| 200 | 177 | <SelectControl |
| 201 | 178 | label={ __( 'Position' ) } |
| 202 | 179 | help={ __( 'Determines where to place the legend, compared to the chart area.' ) } |
| 203 | 180 | value={ settings.legend.position ? settings.legend.position : 'right' } |
| 204 | - options={ positions } | |
| 181 | + options={ [ | |
| 182 | + { label: __( 'Left of the chart' ), value: 'left' }, | |
| 183 | + { label: __( 'Right of the chart' ), value: 'right' }, | |
| 184 | + { label: __( 'Above the chart' ), value: 'top' }, | |
| 185 | + { label: __( 'Below the chart' ), value: 'bottom' }, | |
| 186 | + { label: __( 'Inside the chart' ), value: 'in' }, | |
| 187 | + { label: __( 'Omit the legend' ), value: 'none' } | |
| 188 | + ] } | |
| 205 | 189 | onChange={ e => { |
| 206 | 190 | if ( 'pie' !== type ) { |
| 207 | 191 | let axis = 'left' === e ? 1 : 0; |
| 208 | 192 | |
| 209 | - if ( settings.series ) { | |
| 210 | - Object.keys( settings.series ).map( i => { | |
| 211 | - settings.series[i].targetAxisIndex = axis; | |
| 212 | - }); | |
| 213 | - } | |
| 193 | + Object.keys( settings.series ).map( i => { | |
| 194 | + settings.series[i].targetAxisIndex = axis; | |
| 195 | + }); | |
| 214 | 196 | } |
| 215 | 197 | |
| 216 | 198 | settings.legend.position = e; |
| 217 | 199 | this.props.edit( settings ); |
| @@ -247,9 +229,9 @@ | ||
| 247 | 229 | |
| 248 | 230 | </PanelBody> |
| 249 | 231 | ) } |
| 250 | 232 | |
| 251 | - { ( -1 >= [ 'tabular', 'gauge', 'geo', 'dataTable', 'timeline' ].indexOf( type ) ) && ( | |
| 233 | + { ( -1 >= [ 'table', 'gauge', 'geo', 'dataTable' ].indexOf( type ) ) && ( | |
| 252 | 234 | <PanelBody |
| 253 | 235 | title={ __( 'Tooltip' ) } |
| 254 | 236 | className="visualizer-inner-sections" |
| 255 | 237 | initialOpen={ false } |
| @@ -299,9 +281,9 @@ | ||
| 299 | 281 | |
| 300 | 282 | </PanelBody> |
| 301 | 283 | ) } |
| 302 | 284 | |
| 303 | - { ( -1 >= [ 'tabular', 'dataTable', 'gauge', 'geo', 'pie', 'timeline' ].indexOf( type ) ) && ( | |
| 285 | + { ( -1 >= [ 'table', 'gauge', 'geo', 'pie', 'timeline', 'dataTable' ].indexOf( type ) ) && ( | |
| 304 | 286 | <PanelBody |
| 305 | 287 | title={ __( 'Animation' ) } |
| 306 | 288 | className="visualizer-inner-sections" |
| 307 | 289 | initialOpen={ false } |