/** * WordPress dependencies */ const { __ } = wp.i18n; const { Component, Fragment } = wp.element; const { Button, CheckboxControl, PanelBody } = wp.components; class FrontendActions extends Component { constructor() { super( ...arguments ); } componentDidMount() { const settings = this.props.chart['visualizer-settings']; if ( settings.actions === undefined ) { settings.actions = []; } this.props.edit( settings ); } render() { const settings = this.props.chart['visualizer-settings']; const type = this.props.chart['visualizer-chart-type']; return ( ( '' !== visualizerLocalize.proFeaturesLocked ) ? { ( settings.actions !== undefined && { if ( 0 <= settings.actions.indexOf( 'print' ) ) { const index = settings.actions.indexOf( 'print' ); if ( -1 !== index ) { settings.actions.splice( index, 1 ); } } else { settings.actions.push( 'print' ); } this.props.edit( settings ); } } /> { if ( 0 <= settings.actions.indexOf( 'csv;application/csv' ) ) { const index = settings.actions.indexOf( 'csv;application/csv' ); if ( -1 !== index ) { settings.actions.splice( index, 1 ); } } else { settings.actions.push( 'csv;application/csv' ); } this.props.edit( settings ); } } /> { if ( 0 <= settings.actions.indexOf( 'xls;application/vnd.ms-excel' ) ) { const index = settings.actions.indexOf( 'xls;application/vnd.ms-excel' ); if ( -1 !== index ) { settings.actions.splice( index, 1 ); } } else { settings.actions.push( 'xls;application/vnd.ms-excel' ); } this.props.edit( settings ); } } /> { if ( 0 <= settings.actions.indexOf( 'copy' ) ) { const index = settings.actions.indexOf( 'copy' ); if ( -1 !== index ) { settings.actions.splice( index, 1 ); } } else { settings.actions.push( 'copy' ); } this.props.edit( settings ); } } /> { ( -1 >= [ 'dataTable', 'tabular', 'gauge', 'table' ].indexOf( type ) ) && ( { if ( 0 <= settings.actions.indexOf( 'image' ) ) { const index = settings.actions.indexOf( 'image' ); if ( -1 !== index ) { settings.actions.splice( index, 1 ); } } else { settings.actions.push( 'image' ); } this.props.edit( settings ); } } /> ) } ) } : { __( 'Enable this feature in PRO version!' ) } { __( 'Buy Now' ) } ); } } export default FrontendActions;
{ __( 'Enable this feature in PRO version!' ) }