PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.3.3
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.3.3
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 / SlicesSettings.js

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

96 lines 2.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 { Component } = wp.element;
7
8 const { ColorPalette } = wp.editor;
9
10 const {
11 BaseControl,
12 PanelBody,
13 TextControl
14 } = wp.components;
15
16 class SlicesSettings extends Component {
17 constructor() {
18 super( ...arguments );
19 }
20
21 componentDidMount() {
22
23 /**
24 * We use deep-clean to remove all empty properties which causes a major issue with Slices Settings.
25 * So add a dummy property to make sure `slices` object isn't empty.
26 * Should be removed before saving the data.
27 */
28 const settings = this.props.chart['visualizer-settings'];
29
30 Object.keys( settings.slices )
31 .map( ( i ) => {
32 if ( settings.slices[i] !== undefined ) {
33 settings.slices[i].temp = 1;
34 }
35 }
36 );
37
38 this.props.edit( settings );
39 }
40
41 render() {
42
43 const settings = this.props.chart['visualizer-settings'];
44
45 const data = this.props.chart['visualizer-data'];
46
47 return (
48 <PanelBody
49 title={ __( 'Slices Settings' ) }
50 initialOpen={ false }
51 className="visualizer-advanced-panel"
52 >
53
54 { Object.keys( settings.slices )
55 .map( ( i ) => {
56 return (
57 <PanelBody
58 title={ data[i][0] }
59 className="visualizer-inner-sections"
60 initialOpen={ false }
61 >
62
63 <TextControl
64 label={ __( 'Slice Offset' ) }
65 help={ __( 'How far to separate the slice from the rest of the pie, from 0.0 (not at all) to 1.0 (the pie\'s radius).' ) }
66 value={ settings.slices[i].offset }
67 onChange={ e => {
68 settings.slices[i].offset = e;
69 this.props.edit( settings );
70 } }
71 />
72
73 <BaseControl
74 label={ __( 'Format' ) }
75 >
76 <ColorPalette
77 value={ settings.slices[i].color }
78 onChange={ e => {
79 settings.slices[i].color = e;
80 this.props.edit( settings );
81 } }
82 />
83 </BaseControl>
84
85 </PanelBody>
86 );
87 }
88 ) }
89
90 </PanelBody>
91 );
92 }
93 }
94
95 export default SlicesSettings;
96