@visactor/vtable 0.12.1-alpha.0 → 0.12.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 (79) hide show
  1. package/cjs/components/menu/dom/logic/MenuContainer.js +3 -13
  2. package/cjs/components/menu/dom/logic/MenuContainer.js.map +1 -1
  3. package/cjs/components/menu/dom/logic/MenuElement.js +3 -13
  4. package/cjs/components/menu/dom/logic/MenuElement.js.map +1 -1
  5. package/cjs/components/tooltip/TooltipHandler.js +17 -8
  6. package/cjs/components/tooltip/TooltipHandler.js.map +1 -1
  7. package/cjs/components/tooltip/logic/BubbleTooltipElement.js +4 -14
  8. package/cjs/components/tooltip/logic/BubbleTooltipElement.js.map +1 -1
  9. package/cjs/core/BaseTable.d.ts +6 -2
  10. package/cjs/core/BaseTable.js +18 -2
  11. package/cjs/core/BaseTable.js.map +1 -1
  12. package/cjs/dataset/dataset.d.ts +1 -0
  13. package/cjs/dataset/dataset.js +89 -58
  14. package/cjs/dataset/dataset.js.map +1 -1
  15. package/cjs/dataset/flatDataToObject.js +1 -2
  16. package/cjs/event/EventHandler.js +3 -2
  17. package/cjs/event/EventHandler.js.map +1 -1
  18. package/cjs/event/sparkline-event.js +2 -1
  19. package/cjs/index.d.ts +1 -1
  20. package/cjs/index.js +1 -1
  21. package/cjs/index.js.map +1 -1
  22. package/cjs/layout/chart-helper/get-axis-config.d.ts +11 -0
  23. package/cjs/layout/chart-helper/get-axis-config.js +65 -62
  24. package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
  25. package/cjs/layout/chart-helper/get-chart-spec.js +9 -24
  26. package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
  27. package/cjs/layout/pivot-header-layout.d.ts +6 -2
  28. package/cjs/layout/pivot-header-layout.js +32 -5
  29. package/cjs/layout/pivot-header-layout.js.map +1 -1
  30. package/cjs/layout/simple-header-layout.d.ts +7 -3
  31. package/cjs/layout/simple-header-layout.js +36 -8
  32. package/cjs/layout/simple-header-layout.js.map +1 -1
  33. package/cjs/scenegraph/refresh-node/update-chart.js +6 -3
  34. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  35. package/cjs/ts-types/base-table.d.ts +6 -0
  36. package/cjs/ts-types/base-table.js.map +1 -1
  37. package/cjs/ts-types/list-table/layout-map/api.d.ts +4 -0
  38. package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
  39. package/dist/vtable.js +376 -269
  40. package/dist/vtable.min.js +2 -2
  41. package/es/components/menu/dom/logic/MenuContainer.js +3 -13
  42. package/es/components/menu/dom/logic/MenuContainer.js.map +1 -1
  43. package/es/components/menu/dom/logic/MenuElement.js +3 -13
  44. package/es/components/menu/dom/logic/MenuElement.js.map +1 -1
  45. package/es/components/tooltip/TooltipHandler.js +17 -8
  46. package/es/components/tooltip/TooltipHandler.js.map +1 -1
  47. package/es/components/tooltip/logic/BubbleTooltipElement.js +4 -14
  48. package/es/components/tooltip/logic/BubbleTooltipElement.js.map +1 -1
  49. package/es/core/BaseTable.d.ts +6 -2
  50. package/es/core/BaseTable.js +18 -2
  51. package/es/core/BaseTable.js.map +1 -1
  52. package/es/dataset/dataset.d.ts +1 -0
  53. package/es/dataset/dataset.js +89 -58
  54. package/es/dataset/dataset.js.map +1 -1
  55. package/es/dataset/flatDataToObject.js +1 -2
  56. package/es/event/EventHandler.js +3 -2
  57. package/es/event/EventHandler.js.map +1 -1
  58. package/es/event/sparkline-event.js +2 -1
  59. package/es/index.d.ts +1 -1
  60. package/es/index.js +1 -1
  61. package/es/index.js.map +1 -1
  62. package/es/layout/chart-helper/get-axis-config.d.ts +11 -0
  63. package/es/layout/chart-helper/get-axis-config.js +61 -57
  64. package/es/layout/chart-helper/get-axis-config.js.map +1 -1
  65. package/es/layout/chart-helper/get-chart-spec.js +6 -21
  66. package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
  67. package/es/layout/pivot-header-layout.d.ts +6 -2
  68. package/es/layout/pivot-header-layout.js +32 -5
  69. package/es/layout/pivot-header-layout.js.map +1 -1
  70. package/es/layout/simple-header-layout.d.ts +7 -3
  71. package/es/layout/simple-header-layout.js +37 -7
  72. package/es/layout/simple-header-layout.js.map +1 -1
  73. package/es/scenegraph/refresh-node/update-chart.js +6 -3
  74. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  75. package/es/ts-types/base-table.d.ts +6 -0
  76. package/es/ts-types/base-table.js.map +1 -1
  77. package/es/ts-types/list-table/layout-map/api.d.ts +4 -0
  78. package/es/ts-types/list-table/layout-map/api.js.map +1 -1
  79. package/package.json +3 -3
package/dist/vtable.js CHANGED
@@ -3365,7 +3365,7 @@
3365
3365
  if (id == null) {
3366
3366
  return;
3367
3367
  }
3368
- const obj = this.listeners[id];
3368
+ const obj = this.listeners?.[id];
3369
3369
  if (!obj) {
3370
3370
  return;
3371
3371
  }
@@ -3415,7 +3415,7 @@
3415
3415
  return;
3416
3416
  }
3417
3417
  this.clear();
3418
- this.listeners = null;
3418
+ this.listeners = {};
3419
3419
  }
3420
3420
  }
3421
3421
 
@@ -39785,35 +39785,14 @@
39785
39785
  row === layout.columnHeaderLevelCount - 1 &&
39786
39786
  col >= layout.rowHeaderLevelCount &&
39787
39787
  col < layout.colCount - layout.rightFrozenColCount) {
39788
- const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, layout.columnHeaderLevelCount - 1);
39789
- let defaultKey = indicatorKeys?.[1];
39790
- if (isArray$5(defaultKey)) {
39791
- defaultKey = defaultKey[0];
39792
- }
39793
- if (!defaultKey) {
39794
- return undefined;
39788
+ const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col, row + 1, 'top', layout);
39789
+ if (axisOption?.visible === false) {
39790
+ return;
39795
39791
  }
39796
- const { axisOption, isPercent, isZeroAlign } = getAxisOption(col, row + 1, 'top', layout);
39797
- const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
39798
- ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
39799
- : layout.dataset.collectedValues[defaultKey];
39792
+ const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, layout.columnHeaderLevelCount - 1);
39800
39793
  const colPath = layout.getColKeysPath(col, row);
39801
- const range = merge$1({}, data?.[colPath ?? ''] ?? { min: 0, max: 1 });
39802
- if (range.positiveMax && range.positiveMax > range.max) {
39803
- range.max = range.positiveMax;
39804
- }
39805
- if (range.negativeMin && range.negativeMin < range.min) {
39806
- range.min = range.negativeMin;
39807
- }
39808
- if (range.min === range.max) {
39809
- if (range.min > 0) {
39810
- range.min = 0;
39811
- }
39812
- else {
39813
- range.max = 0;
39814
- }
39815
- }
39816
- if (axisOption?.visible === false) {
39794
+ const range = getAxisRange(layout.dataset.collectedValues, indicatorKeys, isZeroAlign, colPath, seriesIndice ?? 1);
39795
+ if (!range) {
39817
39796
  return;
39818
39797
  }
39819
39798
  if (isPercent) {
@@ -39843,30 +39822,15 @@
39843
39822
  else if (row === layout.rowCount - layout.bottomFrozenRowCount &&
39844
39823
  col >= layout.rowHeaderLevelCount &&
39845
39824
  col < layout.colCount - layout.rightFrozenColCount) {
39825
+ const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col, row - 1, 'bottom', layout);
39826
+ if (axisOption?.visible === false) {
39827
+ return;
39828
+ }
39846
39829
  const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);
39847
- let defaultKey = indicatorKeys?.[0];
39848
- if (isArray$5(defaultKey)) {
39849
- defaultKey = defaultKey[0];
39850
- }
39851
- const { axisOption, isPercent, isZeroAlign } = getAxisOption(col, row - 1, 'bottom', layout);
39852
- const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
39853
- ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
39854
- : layout.dataset.collectedValues[defaultKey];
39855
39830
  const colPath = layout.getColKeysPath(col, row);
39856
- const range = merge$1({}, data?.[colPath ?? ''] ?? { min: 0, max: 1 });
39857
- if (range.positiveMax && range.positiveMax > range.max) {
39858
- range.max = range.positiveMax;
39859
- }
39860
- if (range.negativeMin && range.negativeMin < range.min) {
39861
- range.min = range.negativeMin;
39862
- }
39863
- if (range.min === range.max) {
39864
- if (range.min > 0) {
39865
- range.min = 0;
39866
- }
39867
- else {
39868
- range.max = 0;
39869
- }
39831
+ const range = getAxisRange(layout.dataset.collectedValues, indicatorKeys, isZeroAlign, colPath, seriesIndice ?? 0);
39832
+ if (!range) {
39833
+ return;
39870
39834
  }
39871
39835
  let indicatorInfo = null;
39872
39836
  indicatorKeys?.forEach(key => {
@@ -39875,9 +39839,6 @@
39875
39839
  indicatorInfo = info;
39876
39840
  }
39877
39841
  });
39878
- if (axisOption?.visible === false) {
39879
- return;
39880
- }
39881
39842
  if (isPercent) {
39882
39843
  range.min = range.min < 0 ? -1 : 0;
39883
39844
  range.max = range.max > 0 ? 1 : 0;
@@ -39935,30 +39896,15 @@
39935
39896
  if (col === layout.rowHeaderLevelCount - 1 &&
39936
39897
  row >= layout.columnHeaderLevelCount &&
39937
39898
  row < layout.rowCount - layout.bottomFrozenRowCount) {
39899
+ const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col + 1, row, 'left', layout);
39900
+ if (axisOption?.visible === false) {
39901
+ return;
39902
+ }
39938
39903
  const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);
39939
- let defaultKey = indicatorKeys?.[0];
39940
- if (isArray$5(defaultKey)) {
39941
- defaultKey = defaultKey[0];
39942
- }
39943
- const { axisOption, isPercent, isZeroAlign } = getAxisOption(col + 1, row, 'left', layout);
39944
- const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
39945
- ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
39946
- : layout.dataset.collectedValues[defaultKey];
39947
39904
  const rowPath = layout.getRowKeysPath(col, row);
39948
- const range = merge$1({}, data?.[rowPath ?? ''] ?? { min: 0, max: 1 });
39949
- if (range.positiveMax && range.positiveMax > range.max) {
39950
- range.max = range.positiveMax;
39951
- }
39952
- if (range.negativeMin && range.negativeMin < range.min) {
39953
- range.min = range.negativeMin;
39954
- }
39955
- if (range.min === range.max) {
39956
- if (range.min > 0) {
39957
- range.min = 0;
39958
- }
39959
- else {
39960
- range.max = 0;
39961
- }
39905
+ const range = getAxisRange(layout.dataset.collectedValues, indicatorKeys, isZeroAlign, rowPath, seriesIndice ?? 0);
39906
+ if (!range) {
39907
+ return;
39962
39908
  }
39963
39909
  let indicatorInfo = null;
39964
39910
  indicatorKeys?.forEach(key => {
@@ -39967,9 +39913,6 @@
39967
39913
  indicatorInfo = info;
39968
39914
  }
39969
39915
  });
39970
- if (axisOption?.visible === false) {
39971
- return;
39972
- }
39973
39916
  if (isPercent) {
39974
39917
  range.min = range.min < 0 ? -1 : 0;
39975
39918
  range.max = range.max > 0 ? 1 : 0;
@@ -40002,35 +39945,14 @@
40002
39945
  else if (col === layout.colCount - layout.rightFrozenColCount &&
40003
39946
  row >= layout.columnHeaderLevelCount &&
40004
39947
  row < layout.rowCount - layout.bottomFrozenRowCount) {
40005
- const indicatorKeys = layout.getIndicatorKeyInChartSpec(layout.rowHeaderLevelCount - 1, row);
40006
- let defaultKey = indicatorKeys?.[1];
40007
- if (isArray$5(defaultKey)) {
40008
- defaultKey = defaultKey[0];
40009
- }
40010
- if (!defaultKey) {
40011
- return undefined;
39948
+ const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col - 1, row, 'right', layout);
39949
+ if (axisOption?.visible === false) {
39950
+ return;
40012
39951
  }
40013
- const { axisOption, isPercent, isZeroAlign } = getAxisOption(col - 1, row, 'right', layout);
40014
- const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
40015
- ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
40016
- : layout.dataset.collectedValues[defaultKey];
39952
+ const indicatorKeys = layout.getIndicatorKeyInChartSpec(layout.rowHeaderLevelCount - 1, row);
40017
39953
  const rowPath = layout.getRowKeysPath(col, row);
40018
- const range = merge$1({}, data?.[rowPath ?? ''] ?? { min: 0, max: 1 });
40019
- if (range.positiveMax && range.positiveMax > range.max) {
40020
- range.max = range.positiveMax;
40021
- }
40022
- if (range.negativeMin && range.negativeMin < range.min) {
40023
- range.min = range.negativeMin;
40024
- }
40025
- if (range.min === range.max) {
40026
- if (range.min > 0) {
40027
- range.min = 0;
40028
- }
40029
- else {
40030
- range.max = 0;
40031
- }
40032
- }
40033
- if (axisOption?.visible === false) {
39954
+ const range = getAxisRange(layout.dataset.collectedValues, indicatorKeys, isZeroAlign, rowPath, seriesIndice ?? 1);
39955
+ if (!range) {
40034
39956
  return;
40035
39957
  }
40036
39958
  if (isPercent) {
@@ -40091,10 +40013,19 @@
40091
40013
  return axis.orient === orient;
40092
40014
  });
40093
40015
  if (axisOption) {
40016
+ const { seriesIndex, seriesId } = axisOption;
40017
+ let seriesIndice;
40018
+ if (isValid$5(seriesId) && isArray$5(spec.series)) {
40019
+ seriesIndice = (isArray$5(seriesId) ? seriesId : [seriesId]).map(id => spec.series.findIndex((s) => s.id === id));
40020
+ }
40021
+ else if (isValid$5(seriesIndex) && isArray$5(spec.series)) {
40022
+ seriesIndice = seriesIndex;
40023
+ }
40094
40024
  return {
40095
40025
  axisOption,
40096
40026
  isPercent: spec.percent,
40097
- isZeroAlign: checkZeroAlign(spec, orient, layout)
40027
+ isZeroAlign: checkZeroAlign(spec, orient, layout),
40028
+ seriesIndice
40098
40029
  };
40099
40030
  }
40100
40031
  }
@@ -40143,6 +40074,48 @@
40143
40074
  }
40144
40075
  return false;
40145
40076
  }
40077
+ function getAxisRange(collectedValues, indicatorKeys, isZeroAlign, colPath, seriesId) {
40078
+ if (isArray$5(seriesId)) {
40079
+ const range = { min: Infinity, max: -Infinity };
40080
+ for (let i = 0; i < seriesId.length; i++) {
40081
+ const singleRange = getAxisRange(collectedValues, indicatorKeys, isZeroAlign, colPath, seriesId[i]);
40082
+ if (singleRange) {
40083
+ range.min = Math.min(range.min, singleRange.min);
40084
+ range.max = Math.max(range.max, singleRange.max);
40085
+ }
40086
+ }
40087
+ if (isFinite(range.min) && isFinite(range.max)) {
40088
+ return range;
40089
+ }
40090
+ return null;
40091
+ }
40092
+ let defaultKey = indicatorKeys?.[seriesId];
40093
+ if (isArray$5(defaultKey)) {
40094
+ defaultKey = defaultKey[0];
40095
+ }
40096
+ if (!defaultKey) {
40097
+ return null;
40098
+ }
40099
+ const data = collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
40100
+ ? collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
40101
+ : collectedValues[defaultKey];
40102
+ const range = merge$1({}, data?.[colPath ?? ''] ?? { min: 0, max: 1 });
40103
+ if (range.positiveMax && range.positiveMax > range.max) {
40104
+ range.max = range.positiveMax;
40105
+ }
40106
+ if (range.negativeMin && range.negativeMin < range.min) {
40107
+ range.min = range.negativeMin;
40108
+ }
40109
+ if (range.min === range.max) {
40110
+ if (range.min > 0) {
40111
+ range.min = 0;
40112
+ }
40113
+ else {
40114
+ range.max = 0;
40115
+ }
40116
+ }
40117
+ return range;
40118
+ }
40146
40119
 
40147
40120
  function computeAxisComponentWidth(config, table) {
40148
40121
  const attribute = merge$1({}, commonAxis, config);
@@ -45766,7 +45739,7 @@
45766
45739
  function updateChartSize(scenegraph, col) {
45767
45740
  for (let c = col; c <= scenegraph.proxy.colEnd; c++) {
45768
45741
  const columnGroup = scenegraph.getColGroup(c);
45769
- columnGroup.getChildren().forEach((cellNode) => {
45742
+ columnGroup.getChildren()?.forEach((cellNode) => {
45770
45743
  const width = scenegraph.table.getColWidth(cellNode.col);
45771
45744
  const height = scenegraph.table.getRowHeight(cellNode.row);
45772
45745
  cellNode.children.forEach((node) => {
@@ -45782,7 +45755,7 @@
45782
45755
  function clearChartCacheImage(scenegraph) {
45783
45756
  for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {
45784
45757
  const columnGroup = scenegraph.getColGroup(c);
45785
- columnGroup.getChildren().forEach((cellNode) => {
45758
+ columnGroup.getChildren()?.forEach((cellNode) => {
45786
45759
  cellNode.children.forEach((node) => {
45787
45760
  if (node.type === 'chart') {
45788
45761
  node.cacheCanvas = null;
@@ -45796,7 +45769,7 @@
45796
45769
  const table = scenegraph.table;
45797
45770
  for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {
45798
45771
  const columnGroup = scenegraph.getColGroup(c);
45799
- columnGroup.getChildren().forEach((cellNode) => {
45772
+ columnGroup.getChildren()?.forEach((cellNode) => {
45800
45773
  const col = cellNode.col;
45801
45774
  const row = cellNode.row;
45802
45775
  cellNode.children.forEach((node) => {
@@ -50677,23 +50650,13 @@
50677
50650
  const rect = table.getCellRangeRelativeRect({ col, row });
50678
50651
  const element = table.getElement();
50679
50652
  const { top, bottom, left, right } = rect;
50680
- const { frozenRowCount, frozenColCount } = table;
50681
- if (row >= frozenRowCount && frozenRowCount > 0) {
50682
- const frozenRect = table.getCellRangeRelativeRect({ col, row: frozenRowCount - 1 });
50683
- if (bottom < frozenRect.bottom) {
50684
- return false;
50685
- }
50686
- }
50687
- else if (bottom < 0) {
50688
- return false;
50689
- }
50690
- if (col >= frozenColCount && frozenColCount > 0) {
50691
- const frozenRect = table.getCellRangeRelativeRect({ col: frozenColCount - 1, row });
50692
- if (right < frozenRect.right) {
50693
- return false;
50694
- }
50653
+ if (table.isFrozenCell(col, row)) {
50654
+ return true;
50695
50655
  }
50696
- else if (right < 0) {
50656
+ else if (bottom < table.getFrozenRowsHeight() ||
50657
+ right < table.getFrozenColsWidth() ||
50658
+ left > table.tableNoFrameWidth - table.getRightFrozenColsWidth() ||
50659
+ top > table.tableNoFrameHeight - table.getBottomFrozenRowsHeight()) {
50697
50660
  return false;
50698
50661
  }
50699
50662
  const { offsetHeight, offsetWidth } = element;
@@ -51353,31 +51316,21 @@
51353
51316
  _canBindToCell(table, col, row) {
51354
51317
  const rect = table.getCellRangeRelativeRect({ col, row });
51355
51318
  const element = table.getElement();
51356
- const { bottom, left, right } = rect;
51357
- const { frozenRowCount, frozenColCount } = table;
51358
- if (row >= frozenRowCount && frozenRowCount > 0) {
51359
- const frozenRect = table.getCellRangeRelativeRect({ col, row: frozenRowCount - 1 });
51360
- if (bottom < frozenRect.bottom) {
51361
- return false;
51362
- }
51363
- }
51364
- else if (bottom < 0) {
51365
- return false;
51366
- }
51367
- if (col >= frozenColCount && frozenColCount > 0) {
51368
- const frozenRect = table.getCellRangeRelativeRect({ col: frozenColCount - 1, row });
51369
- if (right < frozenRect.right) {
51370
- return false;
51371
- }
51319
+ const { bottom, left, right, top } = rect;
51320
+ if (table.isFrozenCell(col, row)) {
51321
+ return true;
51372
51322
  }
51373
- else if (left < 0) {
51323
+ else if (bottom < table.getFrozenRowsHeight() ||
51324
+ right < table.getFrozenColsWidth() ||
51325
+ left > table.tableNoFrameWidth - table.getRightFrozenColsWidth() ||
51326
+ top > table.tableNoFrameHeight - table.getBottomFrozenRowsHeight()) {
51374
51327
  return false;
51375
51328
  }
51376
51329
  const { offsetHeight, offsetWidth } = element;
51377
- if (offsetHeight < bottom) {
51330
+ if (top > offsetHeight) {
51378
51331
  return false;
51379
51332
  }
51380
- if (offsetWidth < left) {
51333
+ if (left > offsetWidth) {
51381
51334
  return false;
51382
51335
  }
51383
51336
  return true;
@@ -51640,16 +51593,27 @@
51640
51593
  return;
51641
51594
  }
51642
51595
  }
51643
- if (table.internalProps.tooltip?.isShowOverflowTextTooltip) {
51596
+ let tooltipOption;
51597
+ const headerDescription = table.getHeaderDescription(col, row);
51598
+ if (headerDescription) {
51599
+ const rect = table.getCellRangeRelativeRect({ col, row });
51600
+ tooltipOption = {
51601
+ content: headerDescription,
51602
+ referencePosition: {
51603
+ placement: Placement.bottom,
51604
+ rect
51605
+ },
51606
+ style: { arrowMark: false }
51607
+ };
51608
+ }
51609
+ else if (table.internalProps.tooltip?.isShowOverflowTextTooltip) {
51644
51610
  const overflowText = table.getCellOverflowText(col, row);
51645
- const headerDescription = table.getHeaderDescription(col, row);
51646
51611
  const rect = table.getCellRangeRelativeRect({ col, row });
51647
- let tooltipOption;
51648
51612
  if (overflowText) {
51649
51613
  tooltipOption = {
51650
51614
  content: headerDescription
51651
51615
  ? `${headerDescription}
51652
- ${overflowText}`
51616
+ ${overflowText}`
51653
51617
  : overflowText,
51654
51618
  referencePosition: {
51655
51619
  placement: Placement.bottom,
@@ -51658,19 +51622,9 @@
51658
51622
  style: { arrowMark: false }
51659
51623
  };
51660
51624
  }
51661
- if (headerDescription) {
51662
- tooltipOption = {
51663
- content: headerDescription,
51664
- referencePosition: {
51665
- placement: Placement.bottom,
51666
- rect
51667
- },
51668
- style: { arrowMark: false }
51669
- };
51670
- }
51671
- if (tooltipOption) {
51672
- this._bindToCell(e.col, e.row, tooltipOption);
51673
- }
51625
+ }
51626
+ if (tooltipOption) {
51627
+ this._bindToCell(e.col, e.row, tooltipOption);
51674
51628
  }
51675
51629
  });
51676
51630
  table.on(TABLE_EVENT_TYPE.MOUSEMOVE_CELL, e => {
@@ -51870,23 +51824,13 @@
51870
51824
  const rect = table.getCellRangeRelativeRect({ col, row });
51871
51825
  const element = table.getElement();
51872
51826
  const { top, bottom, left, right } = rect;
51873
- const { frozenRowCount, frozenColCount } = table;
51874
- if (row >= frozenRowCount && frozenRowCount > 0) {
51875
- const frozenRect = table.getCellRangeRelativeRect({ col, row: frozenRowCount - 1 });
51876
- if (bottom < frozenRect.bottom) {
51877
- return false;
51878
- }
51879
- }
51880
- else if (bottom < 0) {
51881
- return false;
51882
- }
51883
- if (col >= frozenColCount && frozenColCount > 0) {
51884
- const frozenRect = table.getCellRangeRelativeRect({ col: frozenColCount - 1, row });
51885
- if (right < frozenRect.right) {
51886
- return false;
51887
- }
51827
+ if (table.isFrozenCell(col, row)) {
51828
+ return true;
51888
51829
  }
51889
- else if (right < 0) {
51830
+ else if (bottom < table.getFrozenRowsHeight() ||
51831
+ right < table.getFrozenColsWidth() ||
51832
+ left > table.tableNoFrameWidth - table.getRightFrozenColsWidth() ||
51833
+ top > table.tableNoFrameHeight - table.getBottomFrozenRowsHeight()) {
51890
51834
  return false;
51891
51835
  }
51892
51836
  const { offsetHeight, offsetWidth } = element;
@@ -52776,7 +52720,7 @@
52776
52720
  return TABLE_EVENT_TYPE;
52777
52721
  }
52778
52722
  options;
52779
- version = "0.12.1-alpha.0";
52723
+ version = "0.12.1";
52780
52724
  pagination;
52781
52725
  id = `VTable${Date.now()}`;
52782
52726
  headerStyleCache;
@@ -53503,9 +53447,8 @@
53503
53447
  return this.getCellsRectWidth(cellRange.start.col, cellRange.start.row, cellRange.end.col, cellRange.end.row);
53504
53448
  }
53505
53449
  isFrozenCell(col, row) {
53506
- const { frozenRowCount, frozenColCount } = this.internalProps;
53507
- const isFrozenRow = (frozenRowCount > 0 && row < frozenRowCount) || this.isBottomFrozenRow(col, row);
53508
- const isFrozenCol = (frozenColCount > 0 && col < frozenColCount) || this.isRightFrozenColumn(col, row);
53450
+ const isFrozenRow = this.isFrozenRow(row) || this.isBottomFrozenRow(row);
53451
+ const isFrozenCol = this.isFrozenRow(col) || this.isRightFrozenColumn(col);
53509
53452
  if (isFrozenRow || isFrozenCol) {
53510
53453
  return {
53511
53454
  row: isFrozenRow,
@@ -54257,9 +54200,21 @@
54257
54200
  isCornerHeader(col, row) {
54258
54201
  return this.internalProps.layoutMap?.isCornerHeader(col, row);
54259
54202
  }
54203
+ isFrozenColumn(col, row) {
54204
+ return this.internalProps.layoutMap?.isFrozenColumn(col, row);
54205
+ }
54206
+ isLeftFrozenColumn(col, row) {
54207
+ return this.internalProps.layoutMap?.isFrozenColumn(col, row);
54208
+ }
54260
54209
  isRightFrozenColumn(col, row) {
54261
54210
  return this.internalProps.layoutMap?.isRightFrozenColumn(col, row);
54262
54211
  }
54212
+ isFrozenRow(col, row) {
54213
+ return this.internalProps.layoutMap?.isFrozenRow(col, row);
54214
+ }
54215
+ isTopFrozenRow(col, row) {
54216
+ return this.internalProps.layoutMap?.isFrozenRow(col, row);
54217
+ }
54263
54218
  isBottomFrozenRow(col, row) {
54264
54219
  return this.internalProps.layoutMap?.isBottomFrozenRow(col, row);
54265
54220
  }
@@ -54987,23 +54942,10 @@
54987
54942
  const axes = [];
54988
54943
  if (layout.indicatorsAsCol) {
54989
54944
  const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);
54990
- layout.getRecordIndexByCol(col);
54945
+ const colPath = layout.getColKeysPath(col, row);
54991
54946
  indicatorKeys.forEach((key, index) => {
54992
- if (isArray$5(key)) {
54993
- key = key[0];
54994
- }
54995
- const { axisOption, isPercent, isZeroAlign } = getAxisOption(col, row, index === 0 ? 'bottom' : 'top', layout);
54996
- const data = layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]
54997
- ? layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]
54998
- : layout.dataset.collectedValues[key];
54999
- const colPath = layout.getColKeysPath(col, row);
55000
- const range = merge$1({}, data?.[colPath ?? ''] ?? { min: 0, max: 1 });
55001
- if (range.positiveMax && range.positiveMax > range.max) {
55002
- range.max = range.positiveMax;
55003
- }
55004
- if (range.negativeMin && range.negativeMin < range.min) {
55005
- range.min = range.negativeMin;
55006
- }
54947
+ const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col, row, index === 0 ? 'bottom' : 'top', layout);
54948
+ const range = getAxisRange(layout.dataset.collectedValues, indicatorKeys, isZeroAlign, colPath, seriesIndice ?? index);
55007
54949
  if (isPercent) {
55008
54950
  range.min = range.min < 0 ? -1 : 0;
55009
54951
  range.max = range.max > 0 ? 1 : 0;
@@ -55063,20 +55005,8 @@
55063
55005
  const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);
55064
55006
  const rowPath = layout.getRowKeysPath(col, row);
55065
55007
  indicatorKeys.forEach((key, index) => {
55066
- if (isArray$5(key)) {
55067
- key = key[0];
55068
- }
55069
- const { axisOption, isPercent, isZeroAlign } = getAxisOption(col, row, index === 0 ? 'left' : 'right', layout);
55070
- const data = layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]
55071
- ? layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]
55072
- : layout.dataset.collectedValues[key];
55073
- const range = merge$1({}, data?.[rowPath ?? ''] ?? { min: 0, max: 1 });
55074
- if (range.positiveMax && range.positiveMax > range.max) {
55075
- range.max = range.positiveMax;
55076
- }
55077
- if (range.negativeMin && range.negativeMin < range.min) {
55078
- range.min = range.negativeMin;
55079
- }
55008
+ const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col, row, index === 0 ? 'left' : 'right', layout);
55009
+ const range = getAxisRange(layout.dataset.collectedValues, indicatorKeys, isZeroAlign, rowPath, seriesIndice ?? index);
55080
55010
  if (isPercent) {
55081
55011
  range.min = range.min < 0 ? -1 : 0;
55082
55012
  range.max = range.max > 0 ? 1 : 0;
@@ -55216,25 +55146,73 @@
55216
55146
  }
55217
55147
  return 'body';
55218
55148
  }
55149
+ isRowHeader(col, row) {
55150
+ if (this.transpose && col < this.headerLevelCount) {
55151
+ return true;
55152
+ }
55153
+ return false;
55154
+ }
55219
55155
  isColumnHeader(col, row) {
55220
55156
  if (!this.transpose && row < this.headerLevelCount) {
55221
55157
  return true;
55222
55158
  }
55223
55159
  return false;
55224
55160
  }
55161
+ isFrozenColumn(col, row) {
55162
+ if (isValid$6(row)) {
55163
+ if (col < this.frozenColCount && row >= this.frozenRowCount && row < this.rowCount - this.bottomFrozenRowCount) {
55164
+ return true;
55165
+ }
55166
+ }
55167
+ else {
55168
+ if (this.frozenColCount > 0 && col < this.frozenColCount) {
55169
+ return true;
55170
+ }
55171
+ }
55172
+ return false;
55173
+ }
55225
55174
  isRightFrozenColumn(col, row) {
55226
- if (col >= this.colCount - this.rightFrozenColCount &&
55227
- row >= this.columnHeaderLevelCount &&
55228
- row < this.rowCount - this.bottomFrozenRowCount) {
55229
- return true;
55175
+ if (isValid$6(row)) {
55176
+ if (col >= this.colCount - this.rightFrozenColCount &&
55177
+ row >= this.frozenRowCount &&
55178
+ row < this.rowCount - this.bottomFrozenRowCount) {
55179
+ return true;
55180
+ }
55181
+ }
55182
+ else {
55183
+ if (this.rightFrozenColCount > 0 && col >= this.colCount - this.rightFrozenColCount) {
55184
+ return true;
55185
+ }
55186
+ }
55187
+ return false;
55188
+ }
55189
+ isFrozenRow(col, row) {
55190
+ if (isValid$6(row)) {
55191
+ if (row < this.frozenRowCount && col >= this.frozenColCount && col < this.colCount - this.rightFrozenColCount) {
55192
+ return true;
55193
+ }
55194
+ }
55195
+ else {
55196
+ row = col;
55197
+ if (this.frozenRowCount > 0 && row < this.frozenRowCount) {
55198
+ return true;
55199
+ }
55230
55200
  }
55231
55201
  return false;
55232
55202
  }
55233
55203
  isBottomFrozenRow(col, row) {
55234
- if (col >= this.rowHeaderLevelCount &&
55235
- row >= this.rowCount - this.bottomFrozenRowCount &&
55236
- col < this.colCount - this.rightFrozenColCount) {
55237
- return true;
55204
+ if (isValid$6(row)) {
55205
+ if (row >= this.rowCount - this.bottomFrozenRowCount &&
55206
+ col >= this.frozenColCount &&
55207
+ col < this.colCount - this.rightFrozenColCount) {
55208
+ return true;
55209
+ }
55210
+ }
55211
+ else {
55212
+ row = col;
55213
+ if (this.frozenRowCount > 0 && row >= this.rowCount - this.bottomFrozenRowCount) {
55214
+ return true;
55215
+ }
55238
55216
  }
55239
55217
  return false;
55240
55218
  }
@@ -55259,12 +55237,6 @@
55259
55237
  isCornerHeader(col, row) {
55260
55238
  return false;
55261
55239
  }
55262
- isRowHeader(col, row) {
55263
- if (this.transpose && col < this.headerLevelCount) {
55264
- return true;
55265
- }
55266
- return false;
55267
- }
55268
55240
  getColumnHeaderRange() {
55269
55241
  if (this.transpose) {
55270
55242
  return {
@@ -55313,11 +55285,17 @@
55313
55285
  get rowHeaderLevelCount() {
55314
55286
  return this.transpose ? this.headerLevelCount : 0;
55315
55287
  }
55288
+ get frozenColCount() {
55289
+ return this._table.internalProps.frozenColCount ?? 0;
55290
+ }
55291
+ get frozenRowCount() {
55292
+ return this._table.internalProps.frozenRowCount ?? 0;
55293
+ }
55316
55294
  get bottomFrozenRowCount() {
55317
- return 0;
55295
+ return this._table.internalProps.bottomFrozenRowCount ?? 0;
55318
55296
  }
55319
55297
  get rightFrozenColCount() {
55320
- return 0;
55298
+ return this._table.internalProps.rightFrozenColCount ?? 0;
55321
55299
  }
55322
55300
  get colCount() {
55323
55301
  return this.transpose ? this.headerLevelCount + this.recordsCount : this._columns.length;
@@ -56890,7 +56868,7 @@
56890
56868
  });
56891
56869
  const cell = {
56892
56870
  id,
56893
- title: hd.value ?? indicatorInfo.title,
56871
+ title: hd.value ?? indicatorInfo?.title,
56894
56872
  field: hd.dimensionKey,
56895
56873
  style: typeof (indicatorInfo ?? dimensionInfo)?.headerStyle === 'function'
56896
56874
  ? (indicatorInfo ?? dimensionInfo)?.headerStyle
@@ -57310,19 +57288,61 @@
57310
57288
  }
57311
57289
  return false;
57312
57290
  }
57291
+ isFrozenColumn(col, row) {
57292
+ if (isValid$6(row)) {
57293
+ if (col < this.frozenColCount && row >= this.frozenRowCount && row < this.rowCount - this.bottomFrozenRowCount) {
57294
+ return true;
57295
+ }
57296
+ }
57297
+ else {
57298
+ if (this.frozenColCount > 0 && col < this.frozenColCount) {
57299
+ return true;
57300
+ }
57301
+ }
57302
+ return false;
57303
+ }
57313
57304
  isRightFrozenColumn(col, row) {
57314
- if (col >= this.colCount - this.rightFrozenColCount &&
57315
- row >= this.columnHeaderLevelCount &&
57316
- row < this.rowCount - this.bottomFrozenRowCount) {
57317
- return true;
57305
+ if (isValid$6(row)) {
57306
+ if (col >= this.colCount - this.rightFrozenColCount &&
57307
+ row >= this.frozenRowCount &&
57308
+ row < this.rowCount - this.bottomFrozenRowCount) {
57309
+ return true;
57310
+ }
57311
+ }
57312
+ else {
57313
+ if (this.rightFrozenColCount > 0 && col >= this.colCount - this.rightFrozenColCount) {
57314
+ return true;
57315
+ }
57316
+ }
57317
+ return false;
57318
+ }
57319
+ isFrozenRow(col, row) {
57320
+ if (isValid$6(row)) {
57321
+ if (row < this.frozenRowCount && col >= this.frozenColCount && col < this.colCount - this.rightFrozenColCount) {
57322
+ return true;
57323
+ }
57324
+ }
57325
+ else {
57326
+ row = col;
57327
+ if (this.frozenRowCount > 0 && row < this.frozenRowCount) {
57328
+ return true;
57329
+ }
57318
57330
  }
57319
57331
  return false;
57320
57332
  }
57321
57333
  isBottomFrozenRow(col, row) {
57322
- if (col >= this.rowHeaderLevelCount &&
57323
- row >= this.rowCount - this.bottomFrozenRowCount &&
57324
- col < this.colCount - this.rightFrozenColCount) {
57325
- return true;
57334
+ if (isValid$6(row)) {
57335
+ if (row >= this.rowCount - this.bottomFrozenRowCount &&
57336
+ col >= this.frozenColCount &&
57337
+ col < this.colCount - this.rightFrozenColCount) {
57338
+ return true;
57339
+ }
57340
+ }
57341
+ else {
57342
+ row = col;
57343
+ if (this.frozenRowCount > 0 && row >= this.rowCount - this.bottomFrozenRowCount) {
57344
+ return true;
57345
+ }
57326
57346
  }
57327
57347
  return false;
57328
57348
  }
@@ -57370,6 +57390,12 @@
57370
57390
  }
57371
57391
  resetCellIds() {
57372
57392
  }
57393
+ get frozenColCount() {
57394
+ return this._table.internalProps.frozenColCount ?? 0;
57395
+ }
57396
+ get frozenRowCount() {
57397
+ return this._table.internalProps.frozenRowCount ?? 0;
57398
+ }
57373
57399
  get headerLevelCount() {
57374
57400
  return this.columnHeaderLevelCount;
57375
57401
  }
@@ -57426,7 +57452,7 @@
57426
57452
  return this.columnDimensionTree.tree.size + this.rowHeaderLevelCount + this.rightFrozenColCount;
57427
57453
  }
57428
57454
  get rowCount() {
57429
- return Math.max(this._rowHeaderCellIds.length, 1) + this.columnHeaderLevelCount + this.bottomFrozenRowCount;
57455
+ return (this._rowHeaderCellIds?.length ?? 0) + this.columnHeaderLevelCount + this.bottomFrozenRowCount;
57430
57456
  }
57431
57457
  get bodyRowCount() {
57432
57458
  return this.rowDimensionTree.tree.size;
@@ -57554,7 +57580,7 @@
57554
57580
  }
57555
57581
  getCellRange(col, row) {
57556
57582
  const result = { start: { col, row }, end: { col, row } };
57557
- if (!this.isHeader(col, row) || col === -1 || row === -1 || this.isIndicatorHeader(col, row)) {
57583
+ if (!this.isHeader(col, row) || col === -1 || row === -1) {
57558
57584
  return result;
57559
57585
  }
57560
57586
  if (this.isRightFrozenColumn(col, row) || this.isBottomFrozenRow(col, row)) {
@@ -59303,6 +59329,7 @@
59303
59329
  rowHierarchyType;
59304
59330
  indicators;
59305
59331
  indicatorsAsCol;
59332
+ totalRecordsTree = {};
59306
59333
  constructor(dataConfig, rows, columns, indicatorKeys, indicators, indicatorsAsCol, records, rowHierarchyType, customColTree, customRowTree, needSplitPositiveAndNegative) {
59307
59334
  this.registerAggregators();
59308
59335
  this.dataConfig = dataConfig;
@@ -59357,10 +59384,14 @@
59357
59384
  }
59358
59385
  else {
59359
59386
  if (this.rowHierarchyType === 'tree') {
59360
- this.rowHeaderTree = this.ArrToTree1(this.rowKeys, this.rows, indicatorsAsCol ? undefined : indicators);
59387
+ this.rowHeaderTree = this.ArrToTree1(this.rowKeys, this.rows, indicatorsAsCol ? undefined : indicators, this?.totals?.row?.showGrandTotals ||
59388
+ (!indicatorsAsCol && this.columns.length === 0) ||
59389
+ (indicatorsAsCol && this.rows.length === 0), this.rowGrandTotalLabel);
59361
59390
  }
59362
59391
  else {
59363
- this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows, indicatorsAsCol ? undefined : indicators, this.rowsIsTotal, this?.totals?.row?.showGrandTotals || this.columns.length === 0, this.rowGrandTotalLabel, this.rowSubTotalLabel);
59392
+ this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows, indicatorsAsCol ? undefined : indicators, this.rowsIsTotal, this?.totals?.row?.showGrandTotals ||
59393
+ (!indicatorsAsCol && this.columns.length === 0) ||
59394
+ (indicatorsAsCol && this.rows.length === 0), this.rowGrandTotalLabel, this.rowSubTotalLabel);
59364
59395
  }
59365
59396
  }
59366
59397
  if (customColTree) {
@@ -59481,16 +59512,6 @@
59481
59512
  this.derivedFieldRules?.forEach((derivedFieldRule, i) => {
59482
59513
  record[derivedFieldRule.fieldName] = derivedFieldRule.derivedFunc(record);
59483
59514
  });
59484
- const colKey = [];
59485
- const rowKey = [];
59486
- for (let l = 0, len1 = this.rows.length; l < len1; l++) {
59487
- const rowAttr = this.rows[l];
59488
- rowKey.push(record[rowAttr]);
59489
- }
59490
- for (let n = 0, len2 = this.columns.length; n < len2; n++) {
59491
- const colAttr = this.columns[n];
59492
- colKey.push(record[colAttr]);
59493
- }
59494
59515
  for (const field in this.collectValuesBy) {
59495
59516
  if (record[field]) {
59496
59517
  if (!this.collectedValues[field]) {
@@ -59531,8 +59552,81 @@
59531
59552
  }
59532
59553
  }
59533
59554
  }
59555
+ const colKey = [];
59556
+ const rowKey = [];
59557
+ let isToTalRecord = false;
59558
+ for (let l = 0, len1 = this.rows.length; l < len1; l++) {
59559
+ const rowAttr = this.rows[l];
59560
+ if (rowAttr in record) {
59561
+ rowKey.push(record[rowAttr]);
59562
+ }
59563
+ else {
59564
+ if (this.dataConfig?.totals?.row?.showGrandTotals &&
59565
+ l === 0 &&
59566
+ !this.rows.find((rk) => {
59567
+ return rk in record;
59568
+ })) {
59569
+ rowKey.push(this.rowGrandTotalLabel);
59570
+ isToTalRecord = true;
59571
+ break;
59572
+ }
59573
+ else if (this.dataConfig?.totals?.row?.showSubTotals &&
59574
+ this.dataConfig?.totals?.row?.subTotalsDimensions.indexOf(this.rows[l - 1]) >= 0) {
59575
+ if (this.rowHierarchyType === 'grid') {
59576
+ rowKey.push(this.rowSubTotalLabel);
59577
+ }
59578
+ isToTalRecord = true;
59579
+ break;
59580
+ }
59581
+ }
59582
+ }
59583
+ for (let n = 0, len2 = this.columns.length; n < len2; n++) {
59584
+ const colAttr = this.columns[n];
59585
+ if (colAttr in record) {
59586
+ colKey.push(record[colAttr]);
59587
+ }
59588
+ else {
59589
+ if (this.dataConfig?.totals?.column?.showGrandTotals &&
59590
+ n === 0 &&
59591
+ !this.columns.find((ck) => {
59592
+ return ck in record;
59593
+ })) {
59594
+ colKey.push(this.colGrandTotalLabel);
59595
+ isToTalRecord = true;
59596
+ break;
59597
+ }
59598
+ else if (this.dataConfig?.totals?.column?.showSubTotals &&
59599
+ this.dataConfig?.totals?.column?.subTotalsDimensions.indexOf(this.columns[n - 1]) >= 0) {
59600
+ colKey.push(this.colSubTotalLabel);
59601
+ isToTalRecord = true;
59602
+ break;
59603
+ }
59604
+ }
59605
+ }
59534
59606
  const flatRowKey = rowKey.join(this.stringJoinChar);
59535
59607
  const flatColKey = colKey.join(this.stringJoinChar);
59608
+ if (isToTalRecord) {
59609
+ if (!this.totalRecordsTree[flatRowKey]) {
59610
+ this.totalRecordsTree[flatRowKey] = {};
59611
+ }
59612
+ if (!this.totalRecordsTree[flatRowKey][flatColKey]) {
59613
+ this.totalRecordsTree[flatRowKey][flatColKey] = [];
59614
+ }
59615
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
59616
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
59617
+ if (!this.totalRecordsTree[flatRowKey]?.[flatColKey]?.[i]) {
59618
+ this.totalRecordsTree[flatRowKey][flatColKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM](aggRule?.field ?? this.indicatorKeys[i], aggRule?.formatFun ??
59619
+ this.indicators?.find((indicator) => {
59620
+ if (typeof indicator !== 'string') {
59621
+ return indicator.indicatorKey === this.indicatorKeys[i];
59622
+ }
59623
+ return false;
59624
+ })?.format);
59625
+ }
59626
+ this.indicatorKeys[i] in record && this.totalRecordsTree[flatRowKey]?.[flatColKey]?.[i].push(record);
59627
+ }
59628
+ return;
59629
+ }
59536
59630
  if (rowKey.length !== 0) {
59537
59631
  if (!this.rowFlatKeys[flatRowKey]) {
59538
59632
  this.rowKeys.push(rowKey);
@@ -59805,16 +59899,22 @@
59805
59899
  that?.totals?.row?.showGrandTotals) {
59806
59900
  const rowTotalKeys = [];
59807
59901
  const colCompute = (flatRowKey, flatColKey) => {
59902
+ if (this.totalRecordsTree?.[flatRowKey]?.[flatColKey]) {
59903
+ this.tree[flatRowKey][flatColKey] = this.totalRecordsTree?.[flatRowKey]?.[flatColKey];
59904
+ return;
59905
+ }
59808
59906
  const colKey = flatColKey.split(this.stringJoinChar);
59809
59907
  for (let i = 0, len = that.totals?.column?.subTotalsDimensions?.length; i < len; i++) {
59810
59908
  const dimension = that.totals.column.subTotalsDimensions[i];
59811
59909
  const dimensionIndex = that.columns.indexOf(dimension);
59812
59910
  if (dimensionIndex >= 0) {
59813
59911
  const colTotalKey = colKey.slice(0, dimensionIndex + 1);
59814
- if (this.rowHierarchyType === 'grid') {
59815
- colTotalKey.push(that.totals?.column?.subTotalLabel ?? '小计');
59816
- }
59912
+ colTotalKey.push(that.totals?.column?.subTotalLabel ?? '小计');
59817
59913
  const flatColTotalKey = colTotalKey.join(this.stringJoinChar);
59914
+ if (this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey]) {
59915
+ this.tree[flatRowKey][flatColTotalKey] = this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey];
59916
+ return;
59917
+ }
59818
59918
  if (!this.tree[flatRowKey][flatColTotalKey]) {
59819
59919
  this.tree[flatRowKey][flatColTotalKey] = [];
59820
59920
  }
@@ -59835,6 +59935,10 @@
59835
59935
  }
59836
59936
  if (that.totals?.column?.showGrandTotals || this.rows.length === 0) {
59837
59937
  const flatColTotalKey = that.colGrandTotalLabel;
59938
+ if (this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey]) {
59939
+ this.tree[flatRowKey][flatColTotalKey] = this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey];
59940
+ return;
59941
+ }
59838
59942
  if (!this.tree[flatRowKey][flatColTotalKey]) {
59839
59943
  this.tree[flatRowKey][flatColTotalKey] = [];
59840
59944
  }
@@ -59859,7 +59963,7 @@
59859
59963
  for (let i = 0, len = that.totals?.row?.subTotalsDimensions?.length; i < len; i++) {
59860
59964
  const dimension = that.totals.row.subTotalsDimensions[i];
59861
59965
  const dimensionIndex = that.rows.indexOf(dimension);
59862
- if (dimensionIndex >= 0) {
59966
+ if (dimensionIndex >= 0 && dimensionIndex < that.rows.length - 1) {
59863
59967
  const rowTotalKey = rowKey.slice(0, dimensionIndex + 1);
59864
59968
  if (this.rowHierarchyType === 'grid') {
59865
59969
  rowTotalKey.push(that.totals?.row?.subTotalLabel ?? '小计');
@@ -59871,19 +59975,19 @@
59871
59975
  }
59872
59976
  if (!this.tree[flatRowTotalKey][flatColKey]) {
59873
59977
  this.tree[flatRowTotalKey][flatColKey] = [];
59874
- for (let i = 0; i < this.indicatorKeys.length; i++) {
59875
- if (!this.tree[flatRowTotalKey][flatColKey][i]) {
59876
- const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
59877
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM](aggRule?.field ?? this.indicatorKeys[i], aggRule?.formatFun ??
59878
- this.indicators?.find((indicator) => {
59879
- if (typeof indicator !== 'string') {
59880
- return indicator.indicatorKey === this.indicatorKeys[i];
59881
- }
59882
- return false;
59883
- })?.format);
59884
- }
59885
- this.tree[flatRowTotalKey][flatColKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
59978
+ }
59979
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
59980
+ if (!this.tree[flatRowTotalKey][flatColKey][i]) {
59981
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
59982
+ this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM](aggRule?.field ?? this.indicatorKeys[i], aggRule?.formatFun ??
59983
+ this.indicators?.find((indicator) => {
59984
+ if (typeof indicator !== 'string') {
59985
+ return indicator.indicatorKey === this.indicatorKeys[i];
59986
+ }
59987
+ return false;
59988
+ })?.format);
59886
59989
  }
59990
+ this.tree[flatRowTotalKey][flatColKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
59887
59991
  }
59888
59992
  }
59889
59993
  }
@@ -59920,7 +60024,7 @@
59920
60024
  });
59921
60025
  }
59922
60026
  }
59923
- ArrToTree1(arr, rows, indicators) {
60027
+ ArrToTree1(arr, rows, indicators, isGrandTotal, grandTotalLabel) {
59924
60028
  const result = [];
59925
60029
  const concatStr = this.stringJoinChar;
59926
60030
  const map = new Map();
@@ -59962,6 +60066,9 @@
59962
60066
  });
59963
60067
  }
59964
60068
  arr.forEach(item => addList(item));
60069
+ if (isGrandTotal) {
60070
+ addList([grandTotalLabel]);
60071
+ }
59965
60072
  return result;
59966
60073
  }
59967
60074
  ArrToTree(arr, rows, indicators, subTotalFlags, isGrandTotal, grandTotalLabel, subTotalLabel) {
@@ -62314,7 +62421,7 @@
62314
62421
  return new Tag(params ? params.attribute : {});
62315
62422
  }
62316
62423
 
62317
- const version = "0.12.1-alpha.0";
62424
+ const version = "0.12.1";
62318
62425
  function getIcons() {
62319
62426
  return get$1();
62320
62427
  }