/** * WordPress dependencies */ const { __ } = wp.i18n; const { Component } = wp.element; const { ColorPalette } = wp.blockEditor || wp.editor; const { BaseControl, CheckboxControl, PanelBody } = wp.components; class TimelineSettings extends Component { constructor() { super( ...arguments ); this.mapValues = this.mapValues.bind( this ); } mapValues( settings, objName ) { if ( settings.timeline === undefined ) { return settings[ objName ]; } return settings.timeline[ objName ]; } render() { const settings = this.props.chart['visualizer-settings']; this.mapValues( settings, 'showRowLabels' ); return ( { if ( settings.timeline === undefined ) { settings.timeline = {}; } settings.timeline.showRowLabels = ! Number( this.mapValues( settings, 'showRowLabels' ) ); this.props.edit( settings ); } } /> { if ( settings.timeline === undefined ) { settings.timeline = {}; } settings.timeline.groupByRowLabel = ! Number( this.mapValues( settings, 'groupByRowLabel' ) ); this.props.edit( settings ); } } /> { if ( settings.timeline === undefined ) { settings.timeline = {}; } settings.timeline.colorByRowLabel = ! Number( this.mapValues( settings, 'colorByRowLabel' ) ); this.props.edit( settings ); } } /> { if ( settings.timeline === undefined ) { settings.timeline = {}; } settings.timeline.singleColor = e; this.props.edit( settings ); } } /> ); } } export default TimelineSettings;