@visactor/vtable 1.16.3-alpha.0 → 1.16.3-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/cjs/PivotChart.d.ts +2 -0
  2. package/cjs/PivotChart.js +60 -1
  3. package/cjs/PivotChart.js.map +1 -1
  4. package/cjs/core/BaseTable.js +2 -3
  5. package/cjs/core/BaseTable.js.map +1 -1
  6. package/cjs/event/listener/container-dom.js +1 -1
  7. package/cjs/event/listener/container-dom.js.map +1 -1
  8. package/cjs/index.d.ts +1 -1
  9. package/cjs/index.js +1 -1
  10. package/cjs/index.js.map +1 -1
  11. package/cjs/layout/index.js +2 -1
  12. package/cjs/layout/pivot-header-layout.js +0 -1
  13. package/cjs/scenegraph/graphic/chart.js +4 -4
  14. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  15. package/cjs/scenegraph/graphic/contributions/chart-render-helper.d.ts +2 -0
  16. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +3 -1
  17. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  18. package/cjs/scenegraph/scenegraph.d.ts +1 -1
  19. package/cjs/scenegraph/scenegraph.js +3 -2
  20. package/cjs/scenegraph/scenegraph.js.map +1 -1
  21. package/cjs/vrender.js.map +1 -1
  22. package/dist/vtable.js +79 -6
  23. package/dist/vtable.min.js +1 -1
  24. package/es/PivotChart.d.ts +2 -0
  25. package/es/PivotChart.js +61 -0
  26. package/es/PivotChart.js.map +1 -1
  27. package/es/core/BaseTable.js +2 -3
  28. package/es/core/BaseTable.js.map +1 -1
  29. package/es/event/listener/container-dom.js +1 -1
  30. package/es/event/listener/container-dom.js.map +1 -1
  31. package/es/index.d.ts +1 -1
  32. package/es/index.js +1 -1
  33. package/es/index.js.map +1 -1
  34. package/es/layout/index.js +2 -1
  35. package/es/layout/pivot-header-layout.js +1 -2
  36. package/es/scenegraph/graphic/chart.js +4 -4
  37. package/es/scenegraph/graphic/chart.js.map +1 -1
  38. package/es/scenegraph/graphic/contributions/chart-render-helper.d.ts +2 -0
  39. package/es/scenegraph/graphic/contributions/chart-render-helper.js +1 -1
  40. package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  41. package/es/scenegraph/scenegraph.d.ts +1 -1
  42. package/es/scenegraph/scenegraph.js +3 -2
  43. package/es/scenegraph/scenegraph.js.map +1 -1
  44. package/es/vrender.js.map +1 -1
  45. package/package.json +4 -4
@@ -86,6 +86,8 @@ export declare class PivotChart extends BaseTable implements PivotChartAPI {
86
86
  chartInstance?: undefined;
87
87
  bounds?: undefined;
88
88
  };
89
+ activateChartInstance(cellHeaderPaths: IPivotTableCellHeaderPaths): any;
90
+ replaceChartCacheImage(cellHeaderPaths: IPivotTableCellHeaderPaths, chartInstance: any): void;
89
91
  _getDimensionSortArray(): string[] | undefined;
90
92
  setRecords(records: Array<any>): void;
91
93
  _hasCustomRenderOrLayout(): boolean;
package/es/PivotChart.js CHANGED
@@ -38,6 +38,8 @@ import { registerChartCell, registerCheckboxCell, registerImageCell, registerPro
38
38
 
39
39
  import { hasLinearAxis } from "./layout/chart-helper/get-axis-config";
40
40
 
41
+ import { cacheStageCanvas } from "./scenegraph/graphic/contributions/chart-render-helper";
42
+
41
43
  registerAxis(), registerEmptyTip(), registerLegend(), registerMenu(), registerTitle(),
42
44
  registerTooltip(), registerChartCell(), registerCheckboxCell(), registerImageCell(),
43
45
  registerProgressBarCell(), registerRadioCell(), registerSparkLineCell(), registerTextCell(),
@@ -650,6 +652,65 @@ export class PivotChart extends BaseTable {
650
652
  }
651
653
  return {};
652
654
  }
655
+ activateChartInstance(cellHeaderPaths) {
656
+ var _a, _b, _c, _d, _e;
657
+ const cellAddr = this.getCellAddressByHeaderPaths(cellHeaderPaths);
658
+ if (cellAddr) {
659
+ const col = cellAddr.col, row = cellAddr.row, cellGroup = this.scenegraph.getCell(col, row), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0], activeChartInstance = this.scenegraph.activateChart(col, row), {dataId: dataId, data: data, axes: axes, spec: spec} = chartNode.attribute, viewBox = chartNode.getViewBox();
660
+ null == axes || axes.forEach(((axis, index) => {
661
+ var _a, _b, _c, _d, _e;
662
+ "linear" === axis.type ? activeChartInstance.updateModelSpecSync({
663
+ type: "axes",
664
+ index: index
665
+ }, {
666
+ min: null !== (_b = null === (_a = axis.range) || void 0 === _a ? void 0 : _a.min) && void 0 !== _b ? _b : 0,
667
+ max: null !== (_d = null === (_c = axis.range) || void 0 === _c ? void 0 : _c.max) && void 0 !== _d ? _d : 0,
668
+ tick: {
669
+ tickMode: null === (_e = axis.tick) || void 0 === _e ? void 0 : _e.tickMode
670
+ }
671
+ }, !0) : "band" === axis.type && activeChartInstance.updateModelSpec({
672
+ type: "axes",
673
+ index: index
674
+ }, {
675
+ domain: axis.domain.slice(0)
676
+ }, !0);
677
+ })), activeChartInstance.updateViewBox({
678
+ x1: 0,
679
+ x2: viewBox.x2 - viewBox.x1,
680
+ y1: 0,
681
+ y2: viewBox.y2 - viewBox.y1
682
+ }, !1, !1);
683
+ const chartStage = activeChartInstance.getStage();
684
+ chartStage.needRender = !0;
685
+ const matrix = chartNode.globalTransMatrix.clone(), stageMatrix = chartNode.stage.window.getViewBoxTransform().clone();
686
+ if (stageMatrix.multiply(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f),
687
+ chartStage.window.setViewBoxTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f),
688
+ "string" == typeof dataId) activeChartInstance.updateDataSync(dataId, null != data ? data : []); else {
689
+ const dataBatch = [];
690
+ for (const dataIdStr in dataId) {
691
+ const dataIdAndField = dataId[dataIdStr], series = spec.series.find((item => {
692
+ var _a;
693
+ return (null === (_a = null == item ? void 0 : item.data) || void 0 === _a ? void 0 : _a.id) === dataIdStr;
694
+ }));
695
+ dataBatch.push({
696
+ id: dataIdStr,
697
+ values: dataIdAndField ? null !== (_b = null == data ? void 0 : data.filter((item => item.hasOwnProperty(dataIdAndField)))) && void 0 !== _b ? _b : [] : null != data ? data : [],
698
+ fields: null === (_c = null == series ? void 0 : series.data) || void 0 === _c ? void 0 : _c.fields
699
+ }), activeChartInstance.updateFullDataSync || activeChartInstance.updateDataSync(dataIdStr, dataIdAndField ? null !== (_d = null == data ? void 0 : data.filter((item => item.hasOwnProperty(dataIdAndField)))) && void 0 !== _d ? _d : [] : null != data ? data : []);
700
+ }
701
+ null === (_e = activeChartInstance.updateFullDataSync) || void 0 === _e || _e.call(activeChartInstance, dataBatch);
702
+ }
703
+ return activeChartInstance;
704
+ }
705
+ }
706
+ replaceChartCacheImage(cellHeaderPaths, chartInstance) {
707
+ var _a;
708
+ const cellAddr = this.getCellAddressByHeaderPaths(cellHeaderPaths);
709
+ if (cellAddr) {
710
+ const cellGroup = this.scenegraph.getCell(cellAddr.col, cellAddr.row), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
711
+ cacheStageCanvas(chartInstance.getStage(), chartNode);
712
+ }
713
+ }
653
714
  _getDimensionSortArray() {
654
715
  var _a, _b;
655
716
  if (null === (_b = null === (_a = this.options) || void 0 === _a ? void 0 : _a.axes) || void 0 === _b ? void 0 : _b.length) {