← All changes
|
classes/Visualizer/Gutenberg/src/Components/Sidebar/GeneralSettings.js
+21
-16
3.1.3
→
3.4.5
View file →
| @@ -4,9 +4,9 @@ | ||
| 4 | 4 | const { __ } = wp.i18n; |
| 5 | 5 | |
| 6 | 6 | const { Component } = wp.element; |
| 7 | 7 | |
| 8 | -const { ColorPalette } = wp.editor; | |
| 8 | +const { ColorPalette } = wp.blockEditor || wp.editor; | |
| 9 | 9 | |
| 10 | 10 | const { |
| 11 | 11 | BaseControl, |
| 12 | 12 | CheckboxControl, |
| @@ -33,8 +33,20 @@ | ||
| 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 | + | |
| 37 | 49 | return ( |
| 38 | 50 | <PanelBody |
| 39 | 51 | title={ __( 'General Settings' ) } |
| 40 | 52 | initialOpen={ false } |
| @@ -56,9 +68,9 @@ | ||
| 56 | 68 | this.props.edit( settings ); |
| 57 | 69 | } } |
| 58 | 70 | /> |
| 59 | 71 | |
| 60 | - { ( -1 >= [ 'table', 'gauge', 'geo', 'pie', 'timeline' ].indexOf( type ) ) && ( | |
| 72 | + { ( -1 >= [ 'tabular', 'dataTable', 'gauge', 'geo', 'pie', 'timeline' ].indexOf( type ) ) && ( | |
| 61 | 73 | <SelectControl |
| 62 | 74 | label={ __( 'Chart Title Position' ) } |
| 63 | 75 | help={ __( 'Where to place the chart title, compared to the chart area.' ) } |
| 64 | 76 | value={ settings.titlePosition ? settings.titlePosition : 'out' } |
| @@ -73,9 +85,9 @@ | ||
| 73 | 85 | } } |
| 74 | 86 | /> |
| 75 | 87 | ) } |
| 76 | 88 | |
| 77 | - { ( -1 >= [ 'table', 'gauge', 'geo', 'timeline' ].indexOf( type ) ) && ( | |
| 89 | + { ( -1 >= [ 'tabular', 'dataTable', 'gauge', 'geo', 'timeline' ].indexOf( type ) ) && ( | |
| 78 | 90 | <BaseControl |
| 79 | 91 | label={ __( 'Chart Title Color' ) } |
| 80 | 92 | > |
| 81 | 93 | <ColorPalette |
| @@ -87,9 +99,9 @@ | ||
| 87 | 99 | /> |
| 88 | 100 | </BaseControl> |
| 89 | 101 | ) } |
| 90 | 102 | |
| 91 | - { ( -1 >= [ 'table', 'gauge', 'geo', 'pie', 'timeline' ].indexOf( type ) ) && ( | |
| 103 | + { ( -1 >= [ 'tabular', 'dataTable', 'gauge', 'geo', 'pie', 'timeline' ].indexOf( type ) ) && ( | |
| 92 | 104 | <SelectControl |
| 93 | 105 | label={ __( 'Axes Titles Position' ) } |
| 94 | 106 | help={ __( 'Determines where to place the axis titles, compared to the chart area.' ) } |
| 95 | 107 | value={ settings.axisTitlesPosition ? settings.axisTitlesPosition : 'out' } |
| @@ -106,9 +118,9 @@ | ||
| 106 | 118 | ) } |
| 107 | 119 | |
| 108 | 120 | </PanelBody> |
| 109 | 121 | |
| 110 | - { ( -1 >= [ 'table', 'gauge', 'geo', 'pie', 'timeline' ].indexOf( type ) ) && ( | |
| 122 | + { ( -1 >= [ 'tabular', 'dataTable', 'gauge', 'geo', 'pie', 'timeline' ].indexOf( type ) ) && ( | |
| 111 | 123 | <PanelBody |
| 112 | 124 | title={ __( 'Font Styles' ) } |
| 113 | 125 | className="visualizer-inner-sections" |
| 114 | 126 | initialOpen={ false } |
| @@ -166,9 +178,9 @@ | ||
| 166 | 178 | |
| 167 | 179 | </PanelBody> |
| 168 | 180 | ) } |
| 169 | 181 | |
| 170 | - { ( -1 >= [ 'table', 'gauge', 'geo', 'timeline' ].indexOf( type ) ) && ( | |
| 182 | + { ( -1 >= [ 'tabular', 'dataTable', 'gauge', 'geo', 'timeline' ].indexOf( type ) ) && ( | |
| 171 | 183 | <PanelBody |
| 172 | 184 | title={ __( 'Legend' ) } |
| 173 | 185 | className="visualizer-inner-sections" |
| 174 | 186 | initialOpen={ false } |
| @@ -177,16 +189,9 @@ | ||
| 177 | 189 | <SelectControl |
| 178 | 190 | label={ __( 'Position' ) } |
| 179 | 191 | help={ __( 'Determines where to place the legend, compared to the chart area.' ) } |
| 180 | 192 | value={ settings.legend.position ? settings.legend.position : 'right' } |
| 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 | - ] } | |
| 193 | + options={ positions } | |
| 189 | 194 | onChange={ e => { |
| 190 | 195 | if ( 'pie' !== type ) { |
| 191 | 196 | let axis = 'left' === e ? 1 : 0; |
| 192 | 197 | |
| @@ -229,9 +234,9 @@ | ||
| 229 | 234 | |
| 230 | 235 | </PanelBody> |
| 231 | 236 | ) } |
| 232 | 237 | |
| 233 | - { ( -1 >= [ 'table', 'gauge', 'geo' ].indexOf( type ) ) && ( | |
| 238 | + { ( -1 >= [ 'tabular', 'gauge', 'geo', 'dataTable', 'timeline' ].indexOf( type ) ) && ( | |
| 234 | 239 | <PanelBody |
| 235 | 240 | title={ __( 'Tooltip' ) } |
| 236 | 241 | className="visualizer-inner-sections" |
| 237 | 242 | initialOpen={ false } |
| @@ -281,9 +286,9 @@ | ||
| 281 | 286 | |
| 282 | 287 | </PanelBody> |
| 283 | 288 | ) } |
| 284 | 289 | |
| 285 | - { ( -1 >= [ 'table', 'gauge', 'geo', 'pie', 'timeline' ].indexOf( type ) ) && ( | |
| 290 | + { ( -1 >= [ 'tabular', 'dataTable', 'gauge', 'geo', 'pie', 'timeline' ].indexOf( type ) ) && ( | |
| 286 | 291 | <PanelBody |
| 287 | 292 | title={ __( 'Animation' ) } |
| 288 | 293 | className="visualizer-inner-sections" |
| 289 | 294 | initialOpen={ false } |