← All changes
|
classes/Visualizer/Gutenberg/src/Components/Sidebar/SeriesSettings.js
+16
-9
3.1.2
→
3.4.10
View file →
| @@ -7,9 +7,9 @@ | ||
| 7 | 7 | Component, |
| 8 | 8 | Fragment |
| 9 | 9 | } = wp.element; |
| 10 | 10 | |
| 11 | -const { ColorPalette } = wp.editor; | |
| 11 | +const { ColorPalette } = wp.blockEditor || wp.editor; | |
| 12 | 12 | |
| 13 | 13 | const { |
| 14 | 14 | BaseControl, |
| 15 | 15 | ExternalLink, |
| @@ -59,9 +59,16 @@ | ||
| 59 | 59 | > |
| 60 | 60 | |
| 61 | 61 | { Object.keys( settings.series ) |
| 62 | 62 | .map( ( i, index ) => { |
| 63 | + let indexToFormat = parseInt( i ); | |
| 64 | + | |
| 65 | + if ( 'tabular' !== type ) { | |
| 66 | + indexToFormat = index; | |
| 67 | + } | |
| 68 | + | |
| 63 | 69 | i++; |
| 70 | + | |
| 64 | 71 | return ( |
| 65 | 72 | <PanelBody |
| 66 | 73 | title={ series[i].label } |
| 67 | 74 | className="visualizer-inner-sections" |
| @@ -67,9 +74,9 @@ | ||
| 67 | 74 | className="visualizer-inner-sections" |
| 68 | 75 | initialOpen={ false } |
| 69 | 76 | > |
| 70 | 77 | |
| 71 | - { ( -1 >= [ 'table', 'pie' ].indexOf( type ) ) && ( | |
| 78 | + { ( -1 >= [ 'tabular', 'pie' ].indexOf( type ) ) && ( | |
| 72 | 79 | <SelectControl |
| 73 | 80 | label={ __( 'Visible In Legend' ) } |
| 74 | 81 | help={ __( 'Determines whether the series has to be presented in the legend or not.' ) } |
| 75 | 82 | value={ settings.series[index].visibleInLegend ? settings.series[index].visibleInLegend : '1' } |
| @@ -83,9 +90,9 @@ | ||
| 83 | 90 | } } |
| 84 | 91 | /> |
| 85 | 92 | ) } |
| 86 | 93 | |
| 87 | - { ( -1 >= [ 'table', 'candlestick', 'combo', 'column', 'bar' ].indexOf( type ) ) && ( | |
| 94 | + { ( -1 >= [ 'tabular', 'candlestick', 'combo', 'column', 'bar' ].indexOf( type ) ) && ( | |
| 88 | 95 | |
| 89 | 96 | <Fragment> |
| 90 | 97 | |
| 91 | 98 | <TextControl |
| @@ -120,11 +127,11 @@ | ||
| 120 | 127 | |
| 121 | 128 | <TextControl |
| 122 | 129 | label={ __( 'Format' ) } |
| 123 | 130 | help={ __( 'Enter custom format pattern to apply to this series value.' ) } |
| 124 | - value={ settings.series[index].format } | |
| 131 | + value={ settings.series[indexToFormat].format } | |
| 125 | 132 | onChange={ e => { |
| 126 | - settings.series[index].format = e; | |
| 133 | + settings.series[indexToFormat].format = e; | |
| 127 | 134 | this.props.edit( settings ); |
| 128 | 135 | } } |
| 129 | 136 | /> |
| 130 | 137 | |
| @@ -139,9 +146,9 @@ | ||
| 139 | 146 | </Fragment> |
| 140 | 147 | |
| 141 | 148 | ) : |
| 142 | 149 | |
| 143 | - ( 'date' === series[i].type ) && ( | |
| 150 | + ( 0 <= [ 'date', 'datetime', 'timeofday' ].indexOf( series[i].type ) ) && ( | |
| 144 | 151 | |
| 145 | 152 | <Fragment> |
| 146 | 153 | |
| 147 | 154 | <TextControl |
| @@ -147,11 +154,11 @@ | ||
| 147 | 154 | <TextControl |
| 148 | 155 | label={ __( 'Date Format' ) } |
| 149 | 156 | help={ __( 'Enter custom format pattern to apply to this series value.' ) } |
| 150 | 157 | placeholder="dd LLLL yyyy" |
| 151 | - value={ settings.series[index].format } | |
| 158 | + value={ settings.series[indexToFormat].format } | |
| 152 | 159 | onChange={ e => { |
| 153 | - settings.series[index].format = e; | |
| 160 | + settings.series[indexToFormat].format = e; | |
| 154 | 161 | this.props.edit( settings ); |
| 155 | 162 | } } |
| 156 | 163 | /> |
| 157 | 164 | |
| @@ -220,9 +227,9 @@ | ||
| 220 | 227 | /> |
| 221 | 228 | |
| 222 | 229 | ) } |
| 223 | 230 | |
| 224 | - { ( -1 >= [ 'table' ].indexOf( type ) ) && ( | |
| 231 | + { ( -1 >= [ 'tabular' ].indexOf( type ) ) && ( | |
| 225 | 232 | |
| 226 | 233 | <BaseControl |
| 227 | 234 | label={ __( 'Color' ) } |
| 228 | 235 | > |