| 1 |
/** |
| 2 |
* External dependencies |
| 3 |
*/ |
| 4 |
import GeneralSettings from './Sidebar/GeneralSettings.js'; |
| 5 |
import InstanceSettings from './Sidebar/InstanceSettings.js'; |
| 6 |
import HorizontalAxisSettings from './Sidebar/HorizontalAxisSettings.js'; |
| 7 |
import VerticalAxisSettings from './Sidebar/VerticalAxisSettings.js'; |
| 8 |
import PieSettings from './Sidebar/PieSettings.js'; |
| 9 |
import ResidueSettings from './Sidebar/ResidueSettings.js'; |
| 10 |
import LinesSettings from './Sidebar/LinesSettings.js'; |
| 11 |
import BarsSettings from './Sidebar/BarsSettings.js'; |
| 12 |
import CandlesSettings from './Sidebar/CandlesSettings.js'; |
| 13 |
import MapSettings from './Sidebar/MapSettings.js'; |
| 14 |
import ColorAxis from './Sidebar/ColorAxis.js'; |
| 15 |
import SizeAxis from './Sidebar/SizeAxis.js'; |
| 16 |
import MagnifyingGlass from './Sidebar/MagnifyingGlass.js'; |
| 17 |
import GaugeSettings from './Sidebar/GaugeSettings.js'; |
| 18 |
import TimelineSettings from './Sidebar/TimelineSettings.js'; |
| 19 |
import TableSettings from './Sidebar/TableSettings.js'; |
| 20 |
import RowCellSettings from './Sidebar/RowCellSettings.js'; |
| 21 |
import ComboSettings from './Sidebar/ComboSettings.js'; |
| 22 |
import SeriesSettings from './Sidebar/SeriesSettings.js'; |
| 23 |
import SlicesSettings from './Sidebar/SlicesSettings.js'; |
| 24 |
import BubbleSettings from './Sidebar/BubbleSettings.js'; |
| 25 |
import ColumnSettings from './Sidebar/ColumnSettings.js'; |
| 26 |
import LayoutAndChartArea from './Sidebar/LayoutAndChartArea.js'; |
| 27 |
import FrontendActions from './Sidebar/FrontendActions.js'; |
| 28 |
import ManualConfiguration from './Sidebar/ManualConfiguration.js'; |
| 29 |
|
| 30 |
/** |
| 31 |
* WordPress dependencies |
| 32 |
*/ |
| 33 |
const { |
| 34 |
Component, |
| 35 |
Fragment |
| 36 |
} = wp.element; |
| 37 |
|
| 38 |
class Sidebar extends Component { |
| 39 |
constructor() { |
| 40 |
super( ...arguments ); |
| 41 |
} |
| 42 |
|
| 43 |
render() { |
| 44 |
|
| 45 |
const type = this.props.chart['visualizer-chart-type']; |
| 46 |
const library = this.props.chart['visualizer-chart-library']; |
| 47 |
|
| 48 |
return ( |
| 49 |
<Fragment> |
| 50 |
|
| 51 |
<InstanceSettings chart={ this.props.chart } attributes={ this.props.attributes } edit={ this.props.edit } /> |
| 52 |
|
| 53 |
<GeneralSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 54 |
|
| 55 |
{ ( -1 >= [ 'tabular', 'dataTable', 'gauge', 'geo', 'pie', 'timeline' ].indexOf( type ) ) && ( |
| 56 |
<HorizontalAxisSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 57 |
) } |
| 58 |
|
| 59 |
{ ( -1 >= [ 'tabular', 'dataTable', 'gauge', 'geo', 'pie', 'timeline' ].indexOf( type ) ) && ( |
| 60 |
<VerticalAxisSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 61 |
) } |
| 62 |
|
| 63 |
{ ( 0 <= [ 'pie' ].indexOf( type ) ) && ( |
| 64 |
<Fragment> |
| 65 |
|
| 66 |
<PieSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 67 |
|
| 68 |
<ResidueSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 69 |
|
| 70 |
</Fragment> |
| 71 |
) } |
| 72 |
|
| 73 |
{ ( 0 <= [ 'area', 'scatter', 'line' ].indexOf( type ) ) && ( |
| 74 |
<LinesSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 75 |
) } |
| 76 |
|
| 77 |
{ ( 0 <= [ 'bar', 'column' ].indexOf( type ) ) && ( |
| 78 |
<BarsSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 79 |
) } |
| 80 |
|
| 81 |
{ ( 0 <= [ 'candlestick' ].indexOf( type ) ) && ( |
| 82 |
<CandlesSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 83 |
) } |
| 84 |
|
| 85 |
{ ( 0 <= [ 'geo' ].indexOf( type ) ) && ( |
| 86 |
<Fragment> |
| 87 |
|
| 88 |
<MapSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 89 |
|
| 90 |
<ColorAxis chart={ this.props.chart } edit={ this.props.edit } /> |
| 91 |
|
| 92 |
<SizeAxis chart={ this.props.chart } edit={ this.props.edit } /> |
| 93 |
|
| 94 |
<MagnifyingGlass chart={ this.props.chart } edit={ this.props.edit } /> |
| 95 |
|
| 96 |
</Fragment> |
| 97 |
) } |
| 98 |
|
| 99 |
{ ( 0 <= [ 'gauge' ].indexOf( type ) ) && ( |
| 100 |
<GaugeSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 101 |
) } |
| 102 |
|
| 103 |
{ ( 0 <= [ 'timeline' ].indexOf( type ) ) && ( |
| 104 |
<TimelineSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 105 |
) } |
| 106 |
|
| 107 |
{ ( 0 <= [ 'tabular', 'dataTable' ].indexOf( type ) ) && ( |
| 108 |
<Fragment> |
| 109 |
|
| 110 |
<TableSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 111 |
|
| 112 |
<RowCellSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 113 |
|
| 114 |
</Fragment> |
| 115 |
) } |
| 116 |
|
| 117 |
{ ( 0 <= [ 'combo' ].indexOf( type ) ) && ( |
| 118 |
<ComboSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 119 |
) } |
| 120 |
|
| 121 |
{ ( -1 >= [ 'timeline', 'bubble', 'gauge', 'geo', 'pie', 'tabular', 'dataTable' ].indexOf( type ) ) && ( |
| 122 |
<SeriesSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 123 |
) } |
| 124 |
|
| 125 |
{ ( 'tabular' === type && 'GoogleCharts' === library ) && ( |
| 126 |
<SeriesSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 127 |
) } |
| 128 |
|
| 129 |
{ ( 0 <= [ 'bubble' ].indexOf( type ) ) && ( |
| 130 |
<BubbleSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 131 |
) } |
| 132 |
|
| 133 |
|
| 134 |
{ ( 0 <= [ 'pie' ].indexOf( type ) ) && ( |
| 135 |
<SlicesSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 136 |
) } |
| 137 |
|
| 138 |
{ ( 'DataTable' === library ) && ( |
| 139 |
<ColumnSettings chart={ this.props.chart } edit={ this.props.edit } /> |
| 140 |
) } |
| 141 |
|
| 142 |
{ ( 'DataTable' !== library ) && ( |
| 143 |
<LayoutAndChartArea chart={ this.props.chart } edit={ this.props.edit } /> |
| 144 |
) } |
| 145 |
|
| 146 |
<FrontendActions chart={ this.props.chart } edit={ this.props.edit } /> |
| 147 |
|
| 148 |
{ ( 'DataTable' !== library ) && ( |
| 149 |
<ManualConfiguration chart={ this.props.chart } edit={ this.props.edit } /> |
| 150 |
) } |
| 151 |
</Fragment> |
| 152 |
); |
| 153 |
} |
| 154 |
} |
| 155 |
|
| 156 |
export default Sidebar; |
| 157 |
|