PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.9.7
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.9.7
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.9.7, at classes/Visualizer/Gutenberg/src/Components/Sidebar/FrontendActions.js

164 lines 4.2 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 Button,
13 CheckboxControl,
14 PanelBody
15 } = wp.components;
16
17 class FrontendActions extends Component {
18 constructor() {
19 super( ...arguments );
20 }
21
22 componentDidMount() {
23 const settings = this.props.chart['visualizer-settings'];
24
25 if ( settings.actions === undefined ) {
26 settings.actions = [];
27 }
28
29 this.props.edit( settings );
30 }
31
32 render() {
33
34 const settings = this.props.chart['visualizer-settings'];
35 const type = this.props.chart['visualizer-chart-type'];
36
37 return (
38 ( '' !== visualizerLocalize.proFeaturesLocked ) ?
39 <PanelBody
40 title={ __( 'Frontend Actions' ) }
41 initialOpen={ false }
42 className="visualizer-advanced-panel"
43 >
44
45 { ( settings.actions !== undefined &&
46
47 <Fragment>
48
49 <CheckboxControl
50 label={ __( 'Print' ) }
51 help={ __( 'To enable printing the data.' ) }
52 checked={ ( 0 <= settings.actions.indexOf( 'print' ) ) }
53 onChange={ e => {
54 if ( 0 <= settings.actions.indexOf( 'print' ) ) {
55 const index = settings.actions.indexOf( 'print' );
56 if ( -1 !== index ) {
57 settings.actions.splice( index, 1 );
58 }
59 } else {
60 settings.actions.push( 'print' );
61 }
62 this.props.edit( settings );
63 } }
64 />
65
66 <CheckboxControl
67 label={ __( 'CSV' ) }
68 help={ __( 'To enable downloading the data as a CSV.' ) }
69 checked={ ( 0 <= settings.actions.indexOf( 'csv;application/csv' ) ) }
70 onChange={ e => {
71 if ( 0 <= settings.actions.indexOf( 'csv;application/csv' ) ) {
72 const index = settings.actions.indexOf( 'csv;application/csv' );
73 if ( -1 !== index ) {
74 settings.actions.splice( index, 1 );
75 }
76 } else {
77 settings.actions.push( 'csv;application/csv' );
78 }
79 this.props.edit( settings );
80 } }
81 />
82
83 <CheckboxControl
84 label={ __( 'Excel' ) }
85 help={ __( 'To enable downloading the data as an Excel spreadsheet.' ) }
86 checked={ ( 0 <= settings.actions.indexOf( 'xls;application/vnd.ms-excel' ) ) }
87 onChange={ e => {
88 if ( 0 <= settings.actions.indexOf( 'xls;application/vnd.ms-excel' ) ) {
89 const index = settings.actions.indexOf( 'xls;application/vnd.ms-excel' );
90 if ( -1 !== index ) {
91 settings.actions.splice( index, 1 );
92 }
93 } else {
94 settings.actions.push( 'xls;application/vnd.ms-excel' );
95 }
96 this.props.edit( settings );
97 } }
98 />
99
100 <CheckboxControl
101 label={ __( 'Copy' ) }
102 help={ __( 'To enable copying the data to the clipboard.' ) }
103 checked={ ( 0 <= settings.actions.indexOf( 'copy' ) ) }
104 onChange={ e => {
105 if ( 0 <= settings.actions.indexOf( 'copy' ) ) {
106 const index = settings.actions.indexOf( 'copy' );
107 if ( -1 !== index ) {
108 settings.actions.splice( index, 1 );
109 }
110 } else {
111 settings.actions.push( 'copy' );
112 }
113 this.props.edit( settings );
114 } }
115 />
116
117 { ( -1 >= [ 'dataTable', 'tabular', 'gauge', 'table' ].indexOf( type ) ) && (
118 <CheckboxControl
119 label={ __( 'Download Image' ) }
120 help={ __( 'To download the chart as an image.' ) }
121 checked={ ( 0 <= settings.actions.indexOf( 'image' ) ) }
122 onChange={ e => {
123 if ( 0 <= settings.actions.indexOf( 'image' ) ) {
124 const index = settings.actions.indexOf( 'image' );
125 if ( -1 !== index ) {
126 settings.actions.splice( index, 1 );
127 }
128 } else {
129 settings.actions.push( 'image' );
130 }
131 this.props.edit( settings );
132 } }
133 />
134 ) }
135
136 </Fragment>
137
138 ) }
139
140 </PanelBody> :
141 <PanelBody
142 title={ __( 'Frontend Actions' ) }
143 initialOpen={ false }
144 icon="lock"
145 className="visualizer-advanced-panel"
146 >
147
148 <p>{ __( 'Enable this feature in PRO version!' ) }</p>
149
150 <Button
151 isPrimary
152 href={ visualizerLocalize.proTeaser }
153 target="_blank"
154 >
155 { __( 'Buy Now' ) }
156 </Button>
157
158 </PanelBody>
159 );
160 }
161 }
162
163 export default FrontendActions;
164