PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.4.4
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.4.4
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 +24 -63 3.10.133.4.4 View file →
@@ -105,16 +105,14 @@
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,
115 - route: 'chartSelect',
116 - lazy: -1
114 + route: 'chartSelect'
117 115 });
118 116 }
119 117
120 118 editChart() {
@@ -123,11 +121,8 @@
123 121 }
124 122
125 123 editSettings( settings ) {
126 124 let chart = { ...this.state.chart };
127 - if ( '1' !== settings.pagination ) {
128 - delete settings.pageSize;
129 - }
130 125 chart['visualizer-settings'] = settings;
131 126 this.setState({
132 127 chart,
133 128 isModified: true
@@ -342,41 +337,22 @@
342 337
343 338 let map = series;
344 339 let fieldName = 'series';
345 340
346 - switch ( type ) {
347 - case 'pie':
348 - map = chartData;
349 - fieldName = 'slices';
341 + if ( 'pie' === type ) {
342 + map = chartData;
343 + fieldName = 'slices';
350 344
351 - // pie charts are finicky about a number being a number
352 - // and editing a number makes it a string
353 - // so let's convert it back into a number.
354 - chartData.map( ( i, index ) => {
355 - switch ( series[1].type ) {
356 - case 'number':
357 - i[1] = parseFloat( i[1]);
358 - break;
359 - }
360 - });
361 - break;
362 - case 'tabular':
363 -
364 - // table charts are finicky about a boolean being a boolean
365 - // and editing a boolean makes it a string
366 - // so let's convert it back into a boolean.
367 - chartData.map( ( i, index ) => {
368 - series.map( ( seriesObject, seriesIndex ) => {
369 - switch ( seriesObject.type ) {
370 - case 'boolean':
371 - if ( 'string' === typeof i[seriesIndex]) {
372 - i[seriesIndex] = 'true' === i[seriesIndex];
373 - }
374 - break;
375 - }
376 - });
377 - });
378 - break;
345 + // pie charts are finicky about a number being a number
346 + // and editing a number makes it a string
347 + // so let's convert it back into a number.
348 + chartData.map( ( i, index ) => {
349 + switch ( series[1].type ) {
350 + case 'number':
351 + i[1] = parseFloat( i[1]);
352 + break;
353 + }
354 + });
379 355 }
380 356
381 357 map.map( ( i, index ) => {
382 358 if ( 'pie' !== type && 0 === index ) {
@@ -384,20 +360,18 @@
384 360 }
385 361
386 362 const seriesIndex = 'pie' !== type ? index - 1 : index;
387 363
388 - if ( Array.isArray( settings[fieldName]) && settings[fieldName][seriesIndex] === undefined ) {
364 + if ( settings[fieldName][seriesIndex] === undefined ) {
389 365 settings[fieldName][seriesIndex] = {};
390 366 settings[fieldName][seriesIndex].temp = 1;
391 367 }
392 368 });
393 369
394 - if ( Array.isArray( settings[fieldName]) ) {
395 - settings[fieldName] = settings[fieldName].filter( ( i, index ) => {
396 - const length = -1 >= [ 'pie', 'tabular', 'dataTable' ].indexOf( type ) ? map.length - 1 : map.length;
397 - return index < length;
398 - });
399 - }
370 + settings[fieldName] = settings[fieldName].filter( ( i, index ) => {
371 + const length = -1 >= [ 'pie', 'tabular', 'dataTable' ].indexOf( type ) ? map.length - 1 : map.length;
372 + return index < length;
373 + });
400 374
401 375 chart['visualizer-source'] = source;
402 376 chart['visualizer-default-data'] = 0;
403 377 chart['visualizer-data'] = chartData;
@@ -468,20 +442,8 @@
468 442 </Notice>
469 443 );
470 444 }
471 445
472 - if ( '1' === visualizerLocalize.isFullSiteEditor ) {
473 - return (
474 - <Notice
475 - status="error"
476 - isDismissible={ false }
477 - >
478 - <Dashicon icon="chart-pie" />
479 - { __( 'Visualizer block charts are currently not available for selection here, you must visit the library, get the shortcode, and add the chart here in a shortcode tag.' ) }
480 - </Notice>
481 - );
482 - }
483 -
484 446 if ( 'renderChart' === this.state.route && null !== this.state.chart ) {
485 447 return (
486 448 <ChartRender
487 449 id={ this.props.attributes.id }
@@ -557,9 +519,8 @@
557 519
558 520 { ( 'chartSelect' === this.state.route && null !== this.state.chart ) &&
559 521 <ChartSelect
560 522 id={ this.props.attributes.id }
561 - attributes={ this.props.attributes }
562 523 chart={ this.state.chart }
563 524 editSettings={ this.editSettings }
564 525 editPermissions={ this.editPermissions }
565 526 url={ this.state.url }
@@ -586,9 +547,9 @@
586 547 { ( 'showCharts' === this.state.route || 'chartSelect' === this.state.route ) &&
587 548 <ButtonGroup>
588 549
589 550 <Button
590 - variant="secondary"
551 + isDefault
591 552 isLarge
592 553 onClick={ () => {
593 554 let route;
594 555 if ( 'showCharts' === this.state.route ) {
@@ -595,9 +556,9 @@
595 556 route = 'home';
596 557 } else if ( 'chartSelect' === this.state.route ) {
597 558 route = 'showCharts';
598 559 }
599 - this.setState({ route, isLoading: false });
560 + this.setState({ route });
600 561 this.props.setAttributes({ route });
601 562 } }
602 563 >
603 564 { __( 'Back' ) }
@@ -607,13 +568,13 @@
607 568 <Fragment>
608 569
609 570 { false === this.state.isModified ?
610 571 <Button
611 - variant="secondary"
572 + isDefault
612 573 isLarge
613 574 className="visualizer-bttn-done"
614 575 onClick={ () => {
615 - this.setState({ route: 'renderChart', isModified: true });
576 + this.setState({ route: 'renderChart' });
616 577 this.props.setAttributes({ route: 'renderChart' });
617 578 } }
618 579 >
619 580 { __( 'Done' ) }