@visactor/vtable 0.12.0 → 0.12.1-alpha.0

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 (37) hide show
  1. package/cjs/PivotChart.js +3 -2
  2. package/cjs/PivotChart.js.map +1 -1
  3. package/cjs/components/title/title.d.ts +1 -0
  4. package/cjs/components/title/title.js +18 -17
  5. package/cjs/components/title/title.js.map +1 -1
  6. package/cjs/core/BaseTable.js +3 -2
  7. package/cjs/core/BaseTable.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/chart-helper/get-axis-config.js +6 -6
  12. package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
  13. package/cjs/layout/chart-helper/get-chart-spec.js +4 -4
  14. package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
  15. package/cjs/layout/pivot-header-layout.d.ts +2 -2
  16. package/cjs/layout/pivot-header-layout.js +17 -11
  17. package/cjs/layout/pivot-header-layout.js.map +1 -1
  18. package/dist/vtable.js +66 -33
  19. package/dist/vtable.min.js +2 -2
  20. package/es/PivotChart.js +3 -2
  21. package/es/PivotChart.js.map +1 -1
  22. package/es/components/title/title.d.ts +1 -0
  23. package/es/components/title/title.js +18 -17
  24. package/es/components/title/title.js.map +1 -1
  25. package/es/core/BaseTable.js +3 -2
  26. package/es/core/BaseTable.js.map +1 -1
  27. package/es/index.d.ts +1 -1
  28. package/es/index.js +1 -1
  29. package/es/index.js.map +1 -1
  30. package/es/layout/chart-helper/get-axis-config.js +6 -6
  31. package/es/layout/chart-helper/get-axis-config.js.map +1 -1
  32. package/es/layout/chart-helper/get-chart-spec.js +4 -4
  33. package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
  34. package/es/layout/pivot-header-layout.d.ts +2 -2
  35. package/es/layout/pivot-header-layout.js +17 -11
  36. package/es/layout/pivot-header-layout.js.map +1 -1
  37. package/package.json +3 -3
package/dist/vtable.js CHANGED
@@ -39797,7 +39797,7 @@
39797
39797
  const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
39798
39798
  ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
39799
39799
  : layout.dataset.collectedValues[defaultKey];
39800
- const colPath = layout.getColKeysPath(col);
39800
+ const colPath = layout.getColKeysPath(col, row);
39801
39801
  const range = merge$1({}, data?.[colPath ?? ''] ?? { min: 0, max: 1 });
39802
39802
  if (range.positiveMax && range.positiveMax > range.max) {
39803
39803
  range.max = range.positiveMax;
@@ -39852,7 +39852,7 @@
39852
39852
  const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
39853
39853
  ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
39854
39854
  : layout.dataset.collectedValues[defaultKey];
39855
- const colPath = layout.getColKeysPath(col);
39855
+ const colPath = layout.getColKeysPath(col, row);
39856
39856
  const range = merge$1({}, data?.[colPath ?? ''] ?? { min: 0, max: 1 });
39857
39857
  if (range.positiveMax && range.positiveMax > range.max) {
39858
39858
  range.max = range.positiveMax;
@@ -39914,7 +39914,7 @@
39914
39914
  rowDimensionKey = rowDimensionKey[0];
39915
39915
  }
39916
39916
  const data = layout.dataset.collectedValues[rowDimensionKey] ?? [];
39917
- const rowPath = layout.getRowKeysPath(row);
39917
+ const rowPath = layout.getRowKeysPath(col, row);
39918
39918
  const domain = data[rowPath ?? ''] ?? [];
39919
39919
  const { axisOption, isPercent } = getAxisOption(col + 1, row, 'left', layout);
39920
39920
  if (axisOption?.visible === false) {
@@ -39944,7 +39944,7 @@
39944
39944
  const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
39945
39945
  ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
39946
39946
  : layout.dataset.collectedValues[defaultKey];
39947
- const rowPath = layout.getRowKeysPath(row);
39947
+ const rowPath = layout.getRowKeysPath(col, row);
39948
39948
  const range = merge$1({}, data?.[rowPath ?? ''] ?? { min: 0, max: 1 });
39949
39949
  if (range.positiveMax && range.positiveMax > range.max) {
39950
39950
  range.max = range.positiveMax;
@@ -40014,7 +40014,7 @@
40014
40014
  const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
40015
40015
  ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
40016
40016
  : layout.dataset.collectedValues[defaultKey];
40017
- const rowPath = layout.getRowKeysPath(row);
40017
+ const rowPath = layout.getRowKeysPath(col, row);
40018
40018
  const range = merge$1({}, data?.[rowPath ?? ''] ?? { min: 0, max: 1 });
40019
40019
  if (range.positiveMax && range.positiveMax > range.max) {
40020
40020
  range.max = range.positiveMax;
@@ -40068,7 +40068,7 @@
40068
40068
  columnDimensionKey = columnDimensionKey[0];
40069
40069
  }
40070
40070
  const data = layout.dataset.collectedValues[columnDimensionKey] ?? [];
40071
- const colPath = layout.getColKeysPath(col);
40071
+ const colPath = layout.getColKeysPath(col, row);
40072
40072
  const domain = data?.[colPath ?? ''] ?? [];
40073
40073
  const { axisOption, isPercent } = getAxisOption(col, row - 1, 'bottom', layout);
40074
40074
  if (axisOption?.visible === false) {
@@ -52776,7 +52776,7 @@
52776
52776
  return TABLE_EVENT_TYPE;
52777
52777
  }
52778
52778
  options;
52779
- version = "0.12.0";
52779
+ version = "0.12.1-alpha.0";
52780
52780
  pagination;
52781
52781
  id = `VTable${Date.now()}`;
52782
52782
  headerStyleCache;
@@ -54228,6 +54228,11 @@
54228
54228
  _setRecords(this, records);
54229
54229
  }
54230
54230
  this.scenegraph.createSceneGraph();
54231
+ if (this.internalProps.title && !this.internalProps.title.isReleased) {
54232
+ this._updateSize();
54233
+ this.internalProps.title.resize();
54234
+ this.scenegraph.resize();
54235
+ }
54231
54236
  this.render();
54232
54237
  }
54233
54238
  setRecord(record, col, row) {
@@ -54991,7 +54996,7 @@
54991
54996
  const data = layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]
54992
54997
  ? layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]
54993
54998
  : layout.dataset.collectedValues[key];
54994
- const colPath = layout.getColKeysPath(col);
54999
+ const colPath = layout.getColKeysPath(col, row);
54995
55000
  const range = merge$1({}, data?.[colPath ?? ''] ?? { min: 0, max: 1 });
54996
55001
  if (range.positiveMax && range.positiveMax > range.max) {
54997
55002
  range.max = range.positiveMax;
@@ -55038,7 +55043,7 @@
55038
55043
  const data = layout.dataset.cacheCollectedValues[rowDimensionKey] ||
55039
55044
  layout.dataset.collectedValues[rowDimensionKey] ||
55040
55045
  [];
55041
- const rowPath = layout.getRowKeysPath(row);
55046
+ const rowPath = layout.getRowKeysPath(col, row);
55042
55047
  const domain = data[rowPath ?? ''];
55043
55048
  const { axisOption, isPercent } = getAxisOption(col, row, 'left', layout);
55044
55049
  axes.push(merge$1({
@@ -55056,7 +55061,7 @@
55056
55061
  }
55057
55062
  else {
55058
55063
  const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);
55059
- const rowPath = layout.getRowKeysPath(row);
55064
+ const rowPath = layout.getRowKeysPath(col, row);
55060
55065
  indicatorKeys.forEach((key, index) => {
55061
55066
  if (isArray$5(key)) {
55062
55067
  key = key[0];
@@ -55111,7 +55116,7 @@
55111
55116
  const data = layout.dataset.cacheCollectedValues[columnDimensionKey] ||
55112
55117
  layout.dataset.collectedValues[columnDimensionKey] ||
55113
55118
  [];
55114
- const colPath = layout.getColKeysPath(col);
55119
+ const colPath = layout.getColKeysPath(col, row);
55115
55120
  const domain = data?.[colPath ?? ''] ?? [];
55116
55121
  const { axisOption, isPercent } = getAxisOption(col, row, 'bottom', layout);
55117
55122
  axes.push(merge$1({
@@ -55826,6 +55831,7 @@
55826
55831
  class Title {
55827
55832
  table;
55828
55833
  _titleOption;
55834
+ isReleased = false;
55829
55835
  _titleComponent;
55830
55836
  _cacheAttrs;
55831
55837
  constructor(titleOption, table) {
@@ -55855,6 +55861,8 @@
55855
55861
  const padding = getQuadProps(this._titleOption.padding ?? 10);
55856
55862
  const realWidth = this._titleOption.width ??
55857
55863
  Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width) - padding[1] - padding[3];
55864
+ const realHeight = this._titleOption.height ??
55865
+ Math.min(this.table.tableNoFrameHeight, this.table.getDrawRange().height) - padding[0] - padding[2];
55858
55866
  this._titleComponent.setAttributes({
55859
55867
  x: this._titleOption.x ?? this._titleOption.orient === 'right'
55860
55868
  ? this.table.tableX + Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width)
@@ -55862,7 +55870,12 @@
55862
55870
  y: this._titleOption.y ?? this._titleOption.orient === 'bottom'
55863
55871
  ? this.table.tableY + this.table.tableNoFrameHeight
55864
55872
  : this.table.tableY,
55865
- width: realWidth,
55873
+ width: this._titleOption.orient === 'top' || this._titleOption.orient === 'bottom'
55874
+ ? realWidth
55875
+ : this._titleOption.width,
55876
+ height: this._titleOption.orient === 'left' || this._titleOption.orient === 'right'
55877
+ ? realHeight
55878
+ : this._titleOption.height,
55866
55879
  textStyle: {
55867
55880
  width: realWidth,
55868
55881
  ...this._titleOption.textStyle
@@ -55906,11 +55919,14 @@
55906
55919
  release() {
55907
55920
  this._titleComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this._titleComponent);
55908
55921
  this._titleComponent = null;
55922
+ this.isReleased = true;
55909
55923
  }
55910
55924
  _getTitleAttrs() {
55911
55925
  const padding = getQuadProps(this._titleOption.padding ?? 10);
55912
55926
  const realWidth = this._titleOption.width ??
55913
55927
  Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width) - padding[1] - padding[3];
55928
+ const realHeight = this._titleOption.height ??
55929
+ Math.min(this.table.tableNoFrameHeight, this.table.getDrawRange().height) - padding[0] - padding[2];
55914
55930
  return {
55915
55931
  text: this._titleOption.text ?? '',
55916
55932
  subtext: this._titleOption.subtext ?? '',
@@ -55922,8 +55938,10 @@
55922
55938
  : this.table.tableY,
55923
55939
  width: this._titleOption.orient === 'top' || this._titleOption.orient === 'bottom'
55924
55940
  ? realWidth
55941
+ : this._titleOption.width,
55942
+ height: this._titleOption.orient === 'left' || this._titleOption.orient === 'right'
55943
+ ? realHeight
55925
55944
  : this._titleOption.height,
55926
- height: this._titleOption.height,
55927
55945
  minWidth: this._titleOption.minWidth,
55928
55946
  maxWidth: this._titleOption.maxWidth,
55929
55947
  minHeight: this._titleOption.minHeight,
@@ -56757,6 +56775,16 @@
56757
56775
  this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(rowKeys);
56758
56776
  });
56759
56777
  }
56778
+ if (this._table.isPivotChart()) {
56779
+ this.hasTwoIndicatorAxes = this._indicators.some(indicatorObject => {
56780
+ if (indicatorObject.chartSpec &&
56781
+ indicatorObject.chartSpec.series &&
56782
+ indicatorObject.chartSpec.series.length > 1) {
56783
+ return true;
56784
+ }
56785
+ return false;
56786
+ });
56787
+ }
56760
56788
  if (this.cornerSetting.titleOnDimension === 'column') {
56761
56789
  this.cornerHeaderObjs = this._addCornerHeaders(this.columnHeaderTitle ? [''].concat(this.colDimensionKeys) : this.colDimensionKeys, this.columnsDefine);
56762
56790
  }
@@ -56795,14 +56823,6 @@
56795
56823
  }
56796
56824
  this.setPagination(table.options.pagination);
56797
56825
  if (this._table.isPivotChart()) {
56798
- this.hasTwoIndicatorAxes = this._indicators.some(indicatorObject => {
56799
- if (indicatorObject.chartSpec &&
56800
- indicatorObject.chartSpec.series &&
56801
- indicatorObject.chartSpec.series.length > 1) {
56802
- return true;
56803
- }
56804
- return false;
56805
- });
56806
56826
  this._chartItemSpanSize = 0;
56807
56827
  this._chartItemBandSize = 0;
56808
56828
  this._indicators.find(indicatorObject => {
@@ -57371,6 +57391,9 @@
57371
57391
  if (this.columnHeaderTitle) {
57372
57392
  count += 1;
57373
57393
  }
57394
+ if (this._table.isPivotChart() && this.indicatorsAsCol && !this.hasTwoIndicatorAxes) {
57395
+ count -= 1;
57396
+ }
57374
57397
  return count;
57375
57398
  }
57376
57399
  return 0;
@@ -58513,18 +58536,28 @@
58513
58536
  get bottomAxesCount() {
58514
58537
  return this.bottomFrozenRowCount;
58515
58538
  }
58516
- getColKeysPath(col) {
58517
- const index = !this.indicatorsAsCol
58518
- ? col - this.rowHeaderLevelCount
58519
- : Math.floor((col - this.rowHeaderLevelCount) / this.indicatorKeys.length);
58520
- const colKey = this.dataset.colKeys[index];
58539
+ getColKeysPath(col, row) {
58540
+ const path = this.getCellHeaderPaths(col, row);
58541
+ const colKey = [];
58542
+ if (path.colHeaderPaths.length) {
58543
+ path.colHeaderPaths.forEach(path => {
58544
+ if (path.dimensionKey) {
58545
+ colKey.push(path.value);
58546
+ }
58547
+ });
58548
+ }
58521
58549
  return colKey?.join(this.dataset.stringJoinChar);
58522
58550
  }
58523
- getRowKeysPath(row) {
58524
- const index = this.indicatorsAsCol
58525
- ? row - this.columnHeaderLevelCount
58526
- : Math.floor((row - this.columnHeaderLevelCount) / this.indicatorKeys.length);
58527
- const rowKey = this.dataset.rowKeys[index];
58551
+ getRowKeysPath(col, row) {
58552
+ const path = this.getCellHeaderPaths(col, row);
58553
+ const rowKey = [];
58554
+ if (path.rowHeaderPaths.length) {
58555
+ path.rowHeaderPaths.forEach(path => {
58556
+ if (path.dimensionKey) {
58557
+ rowKey.push(path.value);
58558
+ }
58559
+ });
58560
+ }
58528
58561
  return rowKey?.join(this.dataset.stringJoinChar);
58529
58562
  }
58530
58563
  getIndicatorInfo(indicatorKey, indicatorValue = '') {
@@ -60772,7 +60805,7 @@
60772
60805
  !options.indicatorsAsCol && !options.rows?.length && !options.rowTree ? [] : cloneDeep$1(options.rowTree);
60773
60806
  this.setCustomStateNameToSpec();
60774
60807
  internalProps.columnResizeType = options.columnResizeType ?? 'column';
60775
- internalProps.dataConfig = {};
60808
+ internalProps.dataConfig = { isPivotChart: true };
60776
60809
  this._axes = isArray$5(options.axes) ? options.axes : [];
60777
60810
  if (options.rows || options.columns) {
60778
60811
  const rowKeys = options.rows.reduce((keys, rowObj) => {
@@ -62281,7 +62314,7 @@
62281
62314
  return new Tag(params ? params.attribute : {});
62282
62315
  }
62283
62316
 
62284
- const version = "0.12.0";
62317
+ const version = "0.12.1-alpha.0";
62285
62318
  function getIcons() {
62286
62319
  return get$1();
62287
62320
  }