PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.4.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.4.0
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 3.10.4 All 148 releases
visualizer / classes / Visualizer / Gutenberg / src / Components / Sidebar / FrontendActions.js

FrontendActions.js in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.4.0, at classes/Visualizer/Gutenberg/src/Components/Sidebar/FrontendActions.js

124 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * WordPress dependencies
3 */
4 const { __ } = wp.i18n;
5
6 const {
7 Component,
8 Fragment
9 } = wp.element;
10
11 const {
12 CheckboxControl,
13 PanelBody
14 } = wp.components;
15
16 class FrontendActions extends Component {
17 constructor() {
18 super( ...arguments );
19 }
20
21 componentDidMount() {
22 const settings = this.props.chart['visualizer-settings'];
23
24 if ( settings.actions === undefined ) {
25 settings.actions = [];
26 }
27
28 this.props.edit( settings );
29 }
30
31 render() {
32
33 const settings = this.props.chart['visualizer-settings'];
34
35 return (
36 <PanelBody
37 title={ __( 'Frontend Actions' ) }
38 initialOpen={ false }
39 className="visualizer-advanced-panel"
40 >
41
42 { ( settings.actions !== undefined &&
43
44 <Fragment>
45
46 <CheckboxControl
47 label={ __( 'Print' ) }
48 help={ __( 'To enable printing the data.' ) }
49 checked={ ( 0 <= settings.actions.indexOf( 'print' ) ) }
50 onChange={ e => {
51 if ( 0 <= settings.actions.indexOf( 'print' ) ) {
52 const index = settings.actions.indexOf( 'print' );
53 if ( -1 !== index ) {
54 settings.actions.splice( index, 1 );
55 }
56 } else {
57 settings.actions.push( 'print' );
58 }
59 this.props.edit( settings );
60 } }
61 />
62
63 <CheckboxControl
64 label={ __( 'CSV' ) }
65 help={ __( 'To enable downloading the data as a CSV.' ) }
66 checked={ ( 0 <= settings.actions.indexOf( 'csv;application/csv' ) ) }
67 onChange={ e => {
68 if ( 0 <= settings.actions.indexOf( 'csv;application/csv' ) ) {
69 const index = settings.actions.indexOf( 'csv;application/csv' );
70 if ( -1 !== index ) {
71 settings.actions.splice( index, 1 );
72 }
73 } else {
74 settings.actions.push( 'csv;application/csv' );
75 }
76 this.props.edit( settings );
77 } }
78 />
79
80 <CheckboxControl
81 label={ __( 'Excel' ) }
82 help={ __( 'To enable downloading the data as an Excel spreadsheet.' ) }
83 checked={ ( 0 <= settings.actions.indexOf( 'xls;application/vnd.ms-excel' ) ) }
84 onChange={ e => {
85 if ( 0 <= settings.actions.indexOf( 'xls;application/vnd.ms-excel' ) ) {
86 const index = settings.actions.indexOf( 'xls;application/vnd.ms-excel' );
87 if ( -1 !== index ) {
88 settings.actions.splice( index, 1 );
89 }
90 } else {
91 settings.actions.push( 'xls;application/vnd.ms-excel' );
92 }
93 this.props.edit( settings );
94 } }
95 />
96
97 <CheckboxControl
98 label={ __( 'Copy' ) }
99 help={ __( 'To enable copying the data to the clipboard.' ) }
100 checked={ ( 0 <= settings.actions.indexOf( 'copy' ) ) }
101 onChange={ e => {
102 if ( 0 <= settings.actions.indexOf( 'copy' ) ) {
103 const index = settings.actions.indexOf( 'copy' );
104 if ( -1 !== index ) {
105 settings.actions.splice( index, 1 );
106 }
107 } else {
108 settings.actions.push( 'copy' );
109 }
110 this.props.edit( settings );
111 } }
112 />
113
114 </Fragment>
115
116 ) }
117
118 </PanelBody>
119 );
120 }
121 }
122
123 export default FrontendActions;
124