PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.4.5
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.4.5
4.0.8 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 All 149 releases
← All changes | classes/Visualizer/Gutenberg/src/Editor.js +21 -43 3.10.03.4.5 View file →
@@ -105,10 +105,9 @@
105 105
106 106 this.setState({
107 107 route: 'chartSelect',
108 108 chart: result['chart_data'],
109 - isLoading: true,
110 - isModified: true
109 + isLoading: false
111 110 });
112 111
113 112 this.props.setAttributes({
114 113 id,
@@ -339,41 +338,22 @@
339 338
340 339 let map = series;
341 340 let fieldName = 'series';
342 341
343 - switch ( type ) {
344 - case 'pie':
345 - map = chartData;
346 - fieldName = 'slices';
342 + if ( 'pie' === type ) {
343 + map = chartData;
344 + fieldName = 'slices';
347 345
348 - // pie charts are finicky about a number being a number
349 - // and editing a number makes it a string
350 - // so let's convert it back into a number.
351 - chartData.map( ( i, index ) => {
352 - switch ( series[1].type ) {
353 - case 'number':
354 - i[1] = parseFloat( i[1]);
355 - break;
356 - }
357 - });
358 - break;
359 - case 'tabular':
360 -
361 - // table charts are finicky about a boolean being a boolean
362 - // and editing a boolean makes it a string
363 - // so let's convert it back into a boolean.
364 - chartData.map( ( i, index ) => {
365 - series.map( ( seriesObject, seriesIndex ) => {
366 - switch ( seriesObject.type ) {
367 - case 'boolean':
368 - if ( 'string' === typeof i[seriesIndex]) {
369 - i[seriesIndex] = 'true' === i[seriesIndex];
370 - }
371 - break;
372 - }
373 - });
374 - });
375 - break;
346 + // pie charts are finicky about a number being a number
347 + // and editing a number makes it a string
348 + // so let's convert it back into a number.
349 + chartData.map( ( i, index ) => {
350 + switch ( series[1].type ) {
351 + case 'number':
352 + i[1] = parseFloat( i[1]);
353 + break;
354 + }
355 + });
376 356 }
377 357
378 358 map.map( ( i, index ) => {
379 359 if ( 'pie' !== type && 0 === index ) {
@@ -381,20 +361,18 @@
381 361 }
382 362
383 363 const seriesIndex = 'pie' !== type ? index - 1 : index;
384 364
385 - if ( Array.isArray( settings[fieldName]) && settings[fieldName][seriesIndex] === undefined ) {
365 + if ( settings[fieldName][seriesIndex] === undefined ) {
386 366 settings[fieldName][seriesIndex] = {};
387 367 settings[fieldName][seriesIndex].temp = 1;
388 368 }
389 369 });
390 370
391 - if ( Array.isArray( settings[fieldName]) ) {
392 - settings[fieldName] = settings[fieldName].filter( ( i, index ) => {
393 - const length = -1 >= [ 'pie', 'tabular', 'dataTable' ].indexOf( type ) ? map.length - 1 : map.length;
394 - return index < length;
395 - });
396 - }
371 + settings[fieldName] = settings[fieldName].filter( ( i, index ) => {
372 + const length = -1 >= [ 'pie', 'tabular', 'dataTable' ].indexOf( type ) ? map.length - 1 : map.length;
373 + return index < length;
374 + });
397 375
398 376 chart['visualizer-source'] = source;
399 377 chart['visualizer-default-data'] = 0;
400 378 chart['visualizer-data'] = chartData;
@@ -580,9 +558,9 @@
580 558 route = 'home';
581 559 } else if ( 'chartSelect' === this.state.route ) {
582 560 route = 'showCharts';
583 561 }
584 - this.setState({ route, isLoading: false });
562 + this.setState({ route });
585 563 this.props.setAttributes({ route });
586 564 } }
587 565 >
588 566 { __( 'Back' ) }
@@ -596,9 +574,9 @@
596 574 isDefault
597 575 isLarge
598 576 className="visualizer-bttn-done"
599 577 onClick={ () => {
600 - this.setState({ route: 'renderChart', isModified: true });
578 + this.setState({ route: 'renderChart' });
601 579 this.props.setAttributes({ route: 'renderChart' });
602 580 } }
603 581 >
604 582 { __( 'Done' ) }