← All changes
|
classes/Visualizer/Gutenberg/src/Components/Sidebar/ColumnSettings.js
+1
-48
3.10.13
→
3.4.2
View file →
| @@ -27,12 +27,8 @@ | ||
| 27 | 27 | * Should be removed before saving the data. |
| 28 | 28 | */ |
| 29 | 29 | const settings = this.props.chart['visualizer-settings']; |
| 30 | 30 | |
| 31 | - if ( ! settings.series ) { | |
| 32 | - return; | |
| 33 | - } | |
| 34 | - | |
| 35 | 31 | Object.keys( settings.series ) |
| 36 | 32 | .map( i => { |
| 37 | 33 | if ( settings.series[i] !== undefined ) { |
| 38 | 34 | settings.series[i].temp = 1; |
| @@ -48,14 +44,8 @@ | ||
| 48 | 44 | const settings = this.props.chart['visualizer-settings']; |
| 49 | 45 | |
| 50 | 46 | const series = this.props.chart['visualizer-series']; |
| 51 | 47 | |
| 52 | - const type = this.props.chart['visualizer-chart-type']; | |
| 53 | - | |
| 54 | - if ( ! settings.series ) { | |
| 55 | - return null; | |
| 56 | - } | |
| 57 | - | |
| 58 | 48 | return ( |
| 59 | 49 | <PanelBody |
| 60 | 50 | title={ __( 'Column Settings' ) } |
| 61 | 51 | initialOpen={ false } |
| @@ -63,14 +53,8 @@ | ||
| 63 | 53 | > |
| 64 | 54 | |
| 65 | 55 | { Object.keys( settings.series ) |
| 66 | 56 | .map( ( i ) => { |
| 67 | - | |
| 68 | - // don't show string columns. | |
| 69 | - if ( 'string' === series[i].type ) { | |
| 70 | - return null; | |
| 71 | - } | |
| 72 | - | |
| 73 | 57 | return ( |
| 74 | 58 | <PanelBody |
| 75 | 59 | title={ series[i].label } |
| 76 | 60 | className="visualizer-inner-sections" |
| @@ -76,9 +60,9 @@ | ||
| 76 | 60 | className="visualizer-inner-sections" |
| 77 | 61 | initialOpen={ false } |
| 78 | 62 | > |
| 79 | 63 | |
| 80 | - { 0 <= [ 'date', 'datetime', 'timeofday' ].indexOf( series[i].type ) && ( | |
| 64 | + { ( 'date' === series[i].type || 'datetime' === series[i].type || 'timeofday' === series[i].type ) && ( | |
| 81 | 65 | <Fragment> |
| 82 | 66 | <TextControl |
| 83 | 67 | label={ __( 'Display Date Format' ) } |
| 84 | 68 | help={ __( 'Enter custom format pattern to apply to this series value.' ) } |
| @@ -144,9 +128,8 @@ | ||
| 144 | 128 | label={ __( 'Precision' ) } |
| 145 | 129 | help={ __( 'Round values to how many decimal places?' ) } |
| 146 | 130 | value={ settings.series[i].format ? settings.series[i].format.precision : '' } |
| 147 | 131 | type="number" |
| 148 | - min="0" | |
| 149 | 132 | onChange={ e => { |
| 150 | 133 | if ( 100 < e ) { |
| 151 | 134 | return; |
| 152 | 135 | } |
| @@ -181,38 +164,8 @@ | ||
| 181 | 164 | settings.series[i].format.suffix = e; |
| 182 | 165 | this.props.edit( settings ); |
| 183 | 166 | } } |
| 184 | 167 | /> |
| 185 | - </Fragment> | |
| 186 | - ) } | |
| 187 | - | |
| 188 | - { ( 'boolean' === series[i].type ) && ( | |
| 189 | - <Fragment> | |
| 190 | - <TextControl | |
| 191 | - label={ __( 'Truthy value' ) } | |
| 192 | - help= { __( 'Provide the HTML entity code for the value the table should display when the value of the column is true. e.g. tick mark (Code: ✔) instead of true' ) } | |
| 193 | - value={ settings.series[i].format ? settings.series[i].format.truthy : '' } | |
| 194 | - onChange={ e => { | |
| 195 | - if ( ! settings.series[i].truthy ) { | |
| 196 | - settings.series[i].truthy = {}; | |
| 197 | - } | |
| 198 | - settings.series[i].format.truthy = e; | |
| 199 | - this.props.edit( settings ); | |
| 200 | - } } | |
| 201 | - /> | |
| 202 | - <TextControl | |
| 203 | - label={ __( 'Falsy value' ) } | |
| 204 | - help= { __( 'Provide the HTML entity code for the value the table should display when the value of the column is false. e.g. cross mark (Code: ✖) instead of false' ) } | |
| 205 | - value={ settings.series[i].format ? settings.series[i].format.falsy : '' } | |
| 206 | - onChange={ e => { | |
| 207 | - if ( ! settings.series[i].falsy ) { | |
| 208 | - settings.series[i].falsy = {}; | |
| 209 | - } | |
| 210 | - settings.series[i].format.falsy = e; | |
| 211 | - this.props.edit( settings ); | |
| 212 | - } } | |
| 213 | - /> | |
| 214 | - | |
| 215 | 168 | </Fragment> |
| 216 | 169 | ) } |
| 217 | 170 | |
| 218 | 171 | </PanelBody> |