@visactor/vtable 0.18.0-alpha.2 → 0.18.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 (127) hide show
  1. package/cjs/ListTable.d.ts +1 -0
  2. package/cjs/ListTable.js +50 -2
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotChart.js +102 -83
  5. package/cjs/PivotChart.js.map +1 -1
  6. package/cjs/core/BaseTable.js +4 -4
  7. package/cjs/core/BaseTable.js.map +1 -1
  8. package/cjs/data/DataSource.d.ts +3 -1
  9. package/cjs/data/DataSource.js +27 -7
  10. package/cjs/data/DataSource.js.map +1 -1
  11. package/cjs/event/pivot-chart/axis-click.js +2 -2
  12. package/cjs/event/pivot-chart/axis-click.js.map +1 -1
  13. package/cjs/index.d.ts +1 -1
  14. package/cjs/index.js +1 -1
  15. package/cjs/index.js.map +1 -1
  16. package/cjs/layout/chart-helper/get-axis-config.js +5 -5
  17. package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
  18. package/cjs/layout/chart-helper/get-chart-spec.d.ts +3 -0
  19. package/cjs/layout/chart-helper/get-chart-spec.js +43 -7
  20. package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
  21. package/cjs/layout/pivot-header-layout.d.ts +4 -3
  22. package/cjs/layout/pivot-header-layout.js +43 -23
  23. package/cjs/layout/pivot-header-layout.js.map +1 -1
  24. package/cjs/scenegraph/component/custom.d.ts +5 -0
  25. package/cjs/scenegraph/component/custom.js +20 -3
  26. package/cjs/scenegraph/component/custom.js.map +1 -1
  27. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +1 -1
  28. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  29. package/cjs/scenegraph/group-creater/cell-helper.d.ts +6 -3
  30. package/cjs/scenegraph/group-creater/cell-helper.js +38 -36
  31. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  32. package/cjs/scenegraph/group-creater/cell-type/text-cell.d.ts +2 -1
  33. package/cjs/scenegraph/group-creater/cell-type/text-cell.js +6 -2
  34. package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  35. package/cjs/scenegraph/group-creater/column-helper.js +11 -7
  36. package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
  37. package/cjs/scenegraph/group-creater/progress/update-position/sort-horizontal.js +12 -5
  38. package/cjs/scenegraph/group-creater/progress/update-position/sort-horizontal.js.map +1 -1
  39. package/cjs/scenegraph/group-creater/progress/update-position/sort-vertical.js +19 -14
  40. package/cjs/scenegraph/group-creater/progress/update-position/sort-vertical.js.map +1 -1
  41. package/cjs/scenegraph/layout/move-cell.d.ts +2 -1
  42. package/cjs/scenegraph/layout/move-cell.js +15 -27
  43. package/cjs/scenegraph/layout/move-cell.js.map +1 -1
  44. package/cjs/scenegraph/layout/update-height.js +21 -17
  45. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  46. package/cjs/scenegraph/layout/update-width.js +40 -17
  47. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  48. package/cjs/scenegraph/scenegraph.d.ts +2 -2
  49. package/cjs/scenegraph/scenegraph.js +10 -7
  50. package/cjs/scenegraph/scenegraph.js.map +1 -1
  51. package/cjs/scenegraph/utils/get-cell-merge.js +4 -0
  52. package/cjs/scenegraph/utils/get-cell-merge.js.map +1 -1
  53. package/cjs/scenegraph/utils/text-icon-layout.d.ts +3 -3
  54. package/cjs/scenegraph/utils/text-icon-layout.js +12 -10
  55. package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
  56. package/cjs/state/cell-move/index.js +4 -2
  57. package/cjs/state/cell-move/index.js.map +1 -1
  58. package/cjs/state/state.js +1 -1
  59. package/cjs/state/state.js.map +1 -1
  60. package/cjs/ts-types/table-engine.d.ts +5 -1
  61. package/cjs/ts-types/table-engine.js.map +1 -1
  62. package/cjs/vrender.js.map +1 -1
  63. package/dist/vtable.js +1565 -1207
  64. package/dist/vtable.min.js +2 -2
  65. package/es/ListTable.d.ts +1 -0
  66. package/es/ListTable.js +49 -2
  67. package/es/ListTable.js.map +1 -1
  68. package/es/PivotChart.js +102 -83
  69. package/es/PivotChart.js.map +1 -1
  70. package/es/core/BaseTable.js +4 -4
  71. package/es/core/BaseTable.js.map +1 -1
  72. package/es/data/DataSource.d.ts +3 -1
  73. package/es/data/DataSource.js +27 -7
  74. package/es/data/DataSource.js.map +1 -1
  75. package/es/event/pivot-chart/axis-click.js +2 -2
  76. package/es/event/pivot-chart/axis-click.js.map +1 -1
  77. package/es/index.d.ts +1 -1
  78. package/es/index.js +1 -1
  79. package/es/index.js.map +1 -1
  80. package/es/layout/chart-helper/get-axis-config.js +5 -5
  81. package/es/layout/chart-helper/get-axis-config.js.map +1 -1
  82. package/es/layout/chart-helper/get-chart-spec.d.ts +3 -0
  83. package/es/layout/chart-helper/get-chart-spec.js +38 -4
  84. package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
  85. package/es/layout/pivot-header-layout.d.ts +4 -3
  86. package/es/layout/pivot-header-layout.js +38 -23
  87. package/es/layout/pivot-header-layout.js.map +1 -1
  88. package/es/scenegraph/component/custom.d.ts +5 -0
  89. package/es/scenegraph/component/custom.js +18 -0
  90. package/es/scenegraph/component/custom.js.map +1 -1
  91. package/es/scenegraph/graphic/contributions/chart-render-helper.js +1 -1
  92. package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  93. package/es/scenegraph/group-creater/cell-helper.d.ts +6 -3
  94. package/es/scenegraph/group-creater/cell-helper.js +36 -35
  95. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  96. package/es/scenegraph/group-creater/cell-type/text-cell.d.ts +2 -1
  97. package/es/scenegraph/group-creater/cell-type/text-cell.js +6 -2
  98. package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  99. package/es/scenegraph/group-creater/column-helper.js +11 -6
  100. package/es/scenegraph/group-creater/column-helper.js.map +1 -1
  101. package/es/scenegraph/group-creater/progress/update-position/sort-horizontal.js +12 -5
  102. package/es/scenegraph/group-creater/progress/update-position/sort-horizontal.js.map +1 -1
  103. package/es/scenegraph/group-creater/progress/update-position/sort-vertical.js +19 -14
  104. package/es/scenegraph/group-creater/progress/update-position/sort-vertical.js.map +1 -1
  105. package/es/scenegraph/layout/move-cell.d.ts +2 -1
  106. package/es/scenegraph/layout/move-cell.js +12 -20
  107. package/es/scenegraph/layout/move-cell.js.map +1 -1
  108. package/es/scenegraph/layout/update-height.js +20 -16
  109. package/es/scenegraph/layout/update-height.js.map +1 -1
  110. package/es/scenegraph/layout/update-width.js +39 -16
  111. package/es/scenegraph/layout/update-width.js.map +1 -1
  112. package/es/scenegraph/scenegraph.d.ts +2 -2
  113. package/es/scenegraph/scenegraph.js +9 -6
  114. package/es/scenegraph/scenegraph.js.map +1 -1
  115. package/es/scenegraph/utils/get-cell-merge.js +4 -0
  116. package/es/scenegraph/utils/get-cell-merge.js.map +1 -1
  117. package/es/scenegraph/utils/text-icon-layout.d.ts +3 -3
  118. package/es/scenegraph/utils/text-icon-layout.js +10 -10
  119. package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
  120. package/es/state/cell-move/index.js +4 -1
  121. package/es/state/cell-move/index.js.map +1 -1
  122. package/es/state/state.js +1 -1
  123. package/es/state/state.js.map +1 -1
  124. package/es/ts-types/table-engine.d.ts +5 -1
  125. package/es/ts-types/table-engine.js.map +1 -1
  126. package/es/vrender.js.map +1 -1
  127. package/package.json +3 -3
package/dist/vtable.js CHANGED
@@ -23996,6 +23996,12 @@
23996
23996
  });
23997
23997
 
23998
23998
  function getCellMergeInfo(table, col, row) {
23999
+ if (table.internalProps.customMergeCell) {
24000
+ const customMerge = table.getCustomMerge(col, row);
24001
+ if (customMerge) {
24002
+ return customMerge.range;
24003
+ }
24004
+ }
23999
24005
  if (!table.isHeader(col, row) && !table.getBodyColumnDefine(col, row)?.mergeCell) {
24000
24006
  return false;
24001
24007
  }
@@ -30867,6 +30873,29 @@
30867
30873
  this.pagination.totalCount = this._sourceLength;
30868
30874
  }
30869
30875
  }
30876
+ deleteRecords(recordIndexs) {
30877
+ const realDeletedRecordIndexs = [];
30878
+ const recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);
30879
+ for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
30880
+ const recordIndex = recordIndexsMaxToMin[index];
30881
+ if (recordIndex >= this._sourceLength || recordIndex < 0) {
30882
+ continue;
30883
+ }
30884
+ realDeletedRecordIndexs.push(recordIndex);
30885
+ this.source.splice(recordIndex, 1);
30886
+ this.currentIndexedData.pop();
30887
+ this._sourceLength -= 1;
30888
+ }
30889
+ if (this.userPagination) {
30890
+ this.updatePagerData();
30891
+ }
30892
+ else {
30893
+ this.pagination.perPageCount = this._sourceLength;
30894
+ this.pagination.totalCount = this._sourceLength;
30895
+ this.updatePagerData();
30896
+ }
30897
+ return realDeletedRecordIndexs;
30898
+ }
30870
30899
  deleteRecordsForSorted(recordIndexs) {
30871
30900
  const recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);
30872
30901
  for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
@@ -30884,29 +30913,35 @@
30884
30913
  this.pagination.totalCount = this._sourceLength;
30885
30914
  }
30886
30915
  }
30887
- deleteRecords(recordIndexs) {
30916
+ updateRecords(records, recordIndexs) {
30888
30917
  const realDeletedRecordIndexs = [];
30889
- const recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);
30890
- for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
30891
- const recordIndex = recordIndexsMaxToMin[index];
30918
+ for (let index = 0; index < recordIndexs.length; index++) {
30919
+ const recordIndex = recordIndexs[index];
30892
30920
  if (recordIndex >= this._sourceLength || recordIndex < 0) {
30893
30921
  continue;
30894
30922
  }
30895
30923
  realDeletedRecordIndexs.push(recordIndex);
30896
- this.source.splice(recordIndex, 1);
30897
- this.currentIndexedData.pop();
30898
- this._sourceLength -= 1;
30924
+ this.source[recordIndex] = records[index];
30899
30925
  }
30900
30926
  if (this.userPagination) {
30901
30927
  this.updatePagerData();
30902
30928
  }
30903
- else {
30904
- this.pagination.perPageCount = this._sourceLength;
30905
- this.pagination.totalCount = this._sourceLength;
30906
- this.updatePagerData();
30907
- }
30908
30929
  return realDeletedRecordIndexs;
30909
30930
  }
30931
+ updateRecordsForSorted(records, recordIndexs) {
30932
+ for (let index = 0; index < recordIndexs.length; index++) {
30933
+ const recordIndex = recordIndexs[index];
30934
+ if (recordIndex >= this._sourceLength || recordIndex < 0) {
30935
+ continue;
30936
+ }
30937
+ const rawIndex = this.currentIndexedData[recordIndex];
30938
+ if (typeof rawIndex !== 'number') {
30939
+ return;
30940
+ }
30941
+ this.source[rawIndex] = records[index];
30942
+ }
30943
+ this.sortedIndexMap.clear();
30944
+ }
30910
30945
  sort(field, order, orderFn = order !== 'desc'
30911
30946
  ? (v1, v2) => (v1 === v2 ? 0 : v1 > v2 ? 1 : -1)
30912
30947
  : (v1, v2) => (v1 === v2 ? 0 : v1 < v2 ? 1 : -1)) {
@@ -31858,356 +31893,456 @@
31858
31893
  }
31859
31894
  };
31860
31895
 
31861
- function dealWithCustom(customLayout, customRender, col, row, width, height, autoWidth, autoHeight, padding, table) {
31862
- let renderDefault = true;
31863
- let enableCellPadding = false;
31864
- let expectedWidth;
31865
- let expectedHeight;
31866
- let customElements;
31867
- let elementsGroup;
31868
- if (typeof customLayout === 'function') {
31896
+ function getProp(name, cellStyle, col, row, _table) {
31897
+ const prop = cellStyle && isValid$1(cellStyle[name]) ? cellStyle[name] : null;
31898
+ if (typeof prop === 'function') {
31869
31899
  const arg = {
31870
31900
  col,
31871
31901
  row,
31872
- dataValue: table.getCellOriginValue(col, row),
31873
- value: table.getCellValue(col, row) || '',
31874
- rect: {
31875
- left: 0,
31876
- top: 0,
31877
- right: width,
31878
- bottom: height,
31879
- width,
31880
- height
31881
- },
31882
- table
31902
+ table: _table,
31903
+ value: _table.getCellValue(col, row),
31904
+ dataValue: _table.getCellOriginValue(col, row),
31905
+ cellHeaderPaths: _table.getCellHeaderPaths(col, row)
31883
31906
  };
31884
- const customRenderObj = customLayout(arg);
31885
- if (customRenderObj.rootContainer) {
31886
- customRenderObj.rootContainer = decodeReactDom(customRenderObj.rootContainer);
31887
- }
31888
- if (customRenderObj.rootContainer instanceof Group$2) {
31889
- elementsGroup = customRenderObj.rootContainer;
31890
- elementsGroup.name = 'custom-container';
31891
- }
31892
- renderDefault = customRenderObj.renderDefault;
31893
- enableCellPadding = customRenderObj.enableCellPadding;
31907
+ return prop(arg);
31894
31908
  }
31895
- else if (typeof customRender === 'function') {
31909
+ return prop;
31910
+ }
31911
+ function getFunctionalProp(name, cellStyle, col, row, _table) {
31912
+ const prop = cellStyle && isValid$1(cellStyle[name]) ? cellStyle[name] : null;
31913
+ if (typeof prop === 'function') {
31896
31914
  const arg = {
31897
31915
  col,
31898
31916
  row,
31899
- dataValue: table.getCellOriginValue(col, row),
31900
- value: table.getCellValue(col, row) || '',
31901
- rect: {
31902
- left: 0,
31903
- top: 0,
31904
- right: width,
31905
- bottom: height,
31906
- width,
31907
- height
31908
- },
31909
- table
31917
+ table: _table,
31918
+ value: _table.getCellValue(col, row),
31919
+ dataValue: _table.getCellOriginValue(col, row),
31920
+ cellHeaderPaths: _table.getCellHeaderPaths(col, row)
31910
31921
  };
31911
- const customRenderObj = customRender(arg);
31912
- if (customRenderObj) {
31913
- customElements = customRenderObj.elements;
31914
- renderDefault = customRenderObj.renderDefault;
31915
- expectedWidth = customRenderObj.expectedWidth;
31916
- expectedHeight = customRenderObj.expectedHeight;
31917
- }
31918
- }
31919
- else if (customRender) {
31920
- expectedWidth = customRender.expectedWidth;
31921
- expectedHeight = customRender.expectedHeight;
31922
- customElements = customRender.elements;
31923
- renderDefault = customRender.renderDefault;
31922
+ return prop(arg);
31924
31923
  }
31925
- if (customElements) {
31926
- const value = table.getCellValue(col, row);
31927
- elementsGroup = adjustElementToGroup(customElements, autoWidth ? expectedWidth : width, autoHeight ? expectedHeight : height, value);
31924
+ return undefined;
31925
+ }
31926
+
31927
+ let Group$1 = class Group extends Group$2 {
31928
+ role;
31929
+ col;
31930
+ row;
31931
+ mergeStartCol;
31932
+ mergeStartRow;
31933
+ mergeEndCol;
31934
+ mergeEndRow;
31935
+ contentWidth;
31936
+ contentHeight;
31937
+ rowNumber;
31938
+ colHeight;
31939
+ border;
31940
+ needUpdate;
31941
+ needUpdateWidth;
31942
+ needUpdateHeight;
31943
+ clear() {
31944
+ this.removeAllChild();
31928
31945
  }
31929
- if (enableCellPadding) {
31930
- elementsGroup.setAttributes({
31931
- x: padding[3],
31932
- y: padding[0],
31933
- width: width - padding[1] - padding[3],
31934
- height: height - padding[0] - padding[2]
31946
+ getChildByName(name, deep) {
31947
+ let result = null;
31948
+ this.forEachChildren((child) => {
31949
+ if (child.name === name) {
31950
+ result = child;
31951
+ return true;
31952
+ }
31953
+ return false;
31935
31954
  });
31936
- }
31937
- dealPercentCalc(elementsGroup, width, height);
31938
- return {
31939
- elementsGroup,
31940
- renderDefault
31941
- };
31942
- }
31943
- function adjustElementToGroup(elements, width, height, value) {
31944
- const customGroup = new Group$2({
31945
- x: 0,
31946
- y: 0,
31947
- width,
31948
- height,
31949
- fill: false,
31950
- stroke: false,
31951
- pickable: false
31952
- });
31953
- customGroup.name = 'custom-container';
31954
- const elementsAdjusted = adjustElementsPos(elements, width, height, value);
31955
- elementsAdjusted.forEach(element => {
31956
- if (element.clickable) {
31957
- element.pickable = element.clickable;
31958
- }
31959
- switch (element.type) {
31960
- case 'arc':
31961
- const arc = createArc({
31962
- x: element.x,
31963
- y: element.y,
31964
- dx: (element.dx ?? 0),
31965
- dy: (element.dy ?? 0),
31966
- fill: element.fill,
31967
- stroke: element.stroke,
31968
- outerRadius: element.radius,
31969
- startAngle: element.startAngle,
31970
- endAngle: element.endAngle,
31971
- pickable: !!element.pickable,
31972
- cursor: element.cursor
31973
- });
31974
- customGroup.appendChild(arc);
31975
- break;
31976
- case 'text':
31977
- if (element.background) {
31978
- const expandX = element.background?.expandX ?? 0;
31979
- const expandY = element.background?.expandY ?? 0;
31980
- const textBackRect = createRect({
31981
- x: element.x - expandX,
31982
- y: element.y - expandY,
31983
- dx: (element.dx ?? 0),
31984
- dy: (element.dy ?? 0),
31985
- width: element.width + expandX * 2,
31986
- height: element.height + expandY * 2,
31987
- cornerRadius: element.background?.cornerRadius ?? 0,
31988
- fill: element.background?.fill ?? '#888'
31989
- });
31990
- customGroup.appendChild(textBackRect);
31955
+ if (deep) {
31956
+ this.forEachChildren((child) => {
31957
+ if (child.getChildByName) {
31958
+ const target = child.getChildByName(name, true);
31959
+ if (target) {
31960
+ result = target;
31961
+ return true;
31962
+ }
31991
31963
  }
31992
- const text = new Text$1(Object.assign({
31993
- pickable: !!element.pickable,
31994
- fill: element.color ?? element.fill
31995
- }, element));
31996
- customGroup.appendChild(text);
31997
- break;
31998
- case 'rect':
31999
- const rect = createRect({
32000
- x: element.x,
32001
- y: element.y,
32002
- dx: (element.dx ?? 0),
32003
- dy: (element.dy ?? 0),
32004
- width: element.width,
32005
- height: element.height,
32006
- cornerRadius: element.radius,
32007
- fill: element.fill,
32008
- stroke: element.stroke,
32009
- pickable: !!element.pickable,
32010
- cursor: element.cursor
32011
- });
32012
- customGroup.appendChild(rect);
32013
- break;
32014
- case 'circle':
32015
- const circle = createCircle({
32016
- x: element.x,
32017
- y: element.y,
32018
- dx: (element.dx ?? 0),
32019
- dy: (element.dy ?? 0),
32020
- radius: element.radius,
32021
- fill: element.fill,
32022
- stroke: element.stroke,
32023
- pickable: !!element.pickable,
32024
- cursor: element.cursor
32025
- });
32026
- customGroup.appendChild(circle);
32027
- break;
32028
- case 'icon':
32029
- const icon = new Icon$1({
32030
- x: element.x,
32031
- y: element.y,
32032
- dx: (element.dx ?? 0),
32033
- dy: (element.dy ?? 0),
32034
- width: element.width,
32035
- height: element.height,
32036
- image: element.svg,
32037
- backgroundWidth: element.hover ? (element.hover.width ?? element.width) : undefined,
32038
- backgroundHeight: element.hover ? (element.hover.width ?? element.width) : undefined,
32039
- backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,
32040
- pickable: !!element.pickable,
32041
- cursor: element.cursor
32042
- });
32043
- icon.role = 'icon-custom';
32044
- customGroup.appendChild(icon);
32045
- break;
32046
- case 'image':
32047
- const image = new Icon$1({
32048
- x: element.x,
32049
- y: element.y,
32050
- dx: (element.dx ?? 0),
32051
- dy: (element.dy ?? 0),
32052
- width: element.width,
32053
- height: element.height,
32054
- image: element.src,
32055
- backgroundWidth: element.hover ? (element.hover.width ?? element.width) : undefined,
32056
- backgroundHeight: element.hover ? (element.hover.width ?? element.width) : undefined,
32057
- backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,
32058
- pickable: !!element.pickable,
32059
- cursor: element.cursor,
32060
- shape: element.shape
32061
- });
32062
- image.role = 'image-custom';
32063
- customGroup.appendChild(image);
32064
- break;
32065
- case 'line':
32066
- const line = createLine({
32067
- points: element.points,
32068
- stroke: element.stroke,
32069
- pickable: !!element.pickable,
32070
- cursor: element.cursor
32071
- });
32072
- customGroup.appendChild(line);
32073
- break;
32074
- }
32075
- });
32076
- return customGroup;
32077
- }
32078
- function adjustElementsPos(originalElements, width, height, value) {
32079
- const result = [];
32080
- const left = 0;
32081
- const top = 0;
32082
- const borderLineWidths = [0, 0, 0, 0];
32083
- for (let i = 0; i < originalElements.length; i++) {
32084
- const originalElement = originalElements[i];
32085
- const element = Object.assign({}, originalElement);
32086
- for (const name in element) {
32087
- if (element.hasOwnProperty(name) && isFunction$1(element[name])) {
32088
- element[name] = element[name](value);
32089
- }
31964
+ return false;
31965
+ });
32090
31966
  }
32091
- const rect = element;
32092
- if (isValid$1(rect.x)) {
32093
- rect.x = isString$2(rect.x)
32094
- ? transformString(rect.x, width - borderLineWidths[1])
32095
- : Number(rect.x);
31967
+ return result;
31968
+ }
31969
+ get width() {
31970
+ let width = this.AABBBounds.width();
31971
+ if (width === Infinity || width === -Infinity) {
31972
+ width = 0;
32096
31973
  }
32097
- if (isValid$1(rect.y)) {
32098
- rect.y = isString$2(rect.y)
32099
- ? transformString(rect.y, height - borderLineWidths[2])
32100
- : Number(rect.y);
31974
+ return Math.max(width, this.attribute.width ?? 0);
31975
+ }
31976
+ get height() {
31977
+ let height = this.AABBBounds.height();
31978
+ if (height === Infinity || height === -Infinity) {
31979
+ height = 0;
32101
31980
  }
32102
- if ('width' in element) {
32103
- element.width = isString$2(element.width)
32104
- ? transformString(element.width, width - borderLineWidths[1])
32105
- : Number(element.width);
31981
+ return Math.max(height, this.attribute.height ?? 0);
31982
+ }
31983
+ setDeltaWidth(deltaX) {
31984
+ if (deltaX === 0) {
31985
+ return;
32106
31986
  }
32107
- if ('height' in element) {
32108
- element.height = isString$2(element.height)
32109
- ? transformString(element.height, height - borderLineWidths[2])
32110
- : Number(element.height);
31987
+ this.setAttribute('width', (this.attribute.width ?? 0) + deltaX);
31988
+ if (this.border) {
31989
+ this.border.setAttribute('width', this.border.attribute.width + deltaX);
31990
+ if (this.border.type === 'group') {
31991
+ this.border.firstChild.setAttribute('width', this.border.firstChild.attribute.width + deltaX);
31992
+ }
32111
31993
  }
32112
- if ('radius' in element) {
32113
- element.radius = isString$2(element.radius)
32114
- ? transformString(element.radius, Math.min(width - borderLineWidths[1], height - borderLineWidths[2]))
32115
- : Number(element.radius);
31994
+ }
31995
+ setDeltaHeight(deltaY) {
31996
+ if (deltaY === 0) {
31997
+ return;
32116
31998
  }
32117
- if ('hover' in element) {
32118
- element.hover.x = isString$2(element.hover.x)
32119
- ? transformString(element.hover.x, width - borderLineWidths[1])
32120
- : Number(element.hover.x);
32121
- element.hover.y = isString$2(element.hover.y)
32122
- ? transformString(element.hover.y, height - borderLineWidths[2])
32123
- : Number(element.hover.y);
32124
- element.hover.width = isString$2(element.hover.width)
32125
- ? transformString(element.hover.width, width - borderLineWidths[1])
32126
- : Number(element.hover.width);
32127
- element.hover.height = isString$2(element.hover.height)
32128
- ? transformString(element.hover.height, height - borderLineWidths[2])
32129
- : Number(element.hover.height);
32130
- element.hover.x += left;
32131
- element.hover.y += top;
31999
+ this.setAttribute('height', (this.attribute.height ?? 0) + deltaY);
32000
+ if (this.border) {
32001
+ this.border.setAttribute('height', this.border.attribute.height + deltaY);
32002
+ if (this.border.type === 'group') {
32003
+ this.border.firstChild.setAttribute('width', this.border.firstChild.attribute.height + deltaY);
32004
+ }
32132
32005
  }
32133
- rect.x = rect.x + left;
32134
- rect.y = rect.y + top;
32135
- result.push(element);
32136
32006
  }
32137
- return result;
32138
- }
32139
- function transformString(str, size) {
32140
- if (str.endsWith('px')) {
32141
- return parseInt(str, 10);
32007
+ setDeltaX(deltaX) {
32008
+ if (deltaX === 0) {
32009
+ return;
32010
+ }
32011
+ this.setAttribute('x', this.attribute.x + deltaX);
32142
32012
  }
32143
- else if (str.endsWith('%') && size) {
32144
- return (parseInt(str, 10) / 100) * size;
32013
+ setDeltaY(deltaY) {
32014
+ if (deltaY === 0) {
32015
+ return;
32016
+ }
32017
+ this.setAttribute('y', this.attribute.y + deltaY);
32145
32018
  }
32146
- return parseInt(str, 10);
32147
- }
32148
- function dealPercentCalc(group, parentWidth, parentHeight) {
32149
- if (!group) {
32150
- return;
32019
+ forEachChildrenSkipChild(cb, skipChildName = 'border-rect', reverse = false) {
32020
+ if (reverse) {
32021
+ let child = this._lastChild;
32022
+ let i = 0;
32023
+ while (child) {
32024
+ if (child.name !== skipChildName) {
32025
+ const breakTag = cb(child, i++);
32026
+ if (breakTag) {
32027
+ return;
32028
+ }
32029
+ }
32030
+ child = child._prev;
32031
+ }
32032
+ }
32033
+ else {
32034
+ let child = this._firstChild;
32035
+ let i = 0;
32036
+ while (child) {
32037
+ if (child.name !== skipChildName) {
32038
+ const breakTag = cb(child, i++);
32039
+ if (breakTag) {
32040
+ return;
32041
+ }
32042
+ }
32043
+ child = child._next;
32044
+ }
32045
+ }
32151
32046
  }
32152
- group.forEachChildren((child) => {
32153
- if (!child) {
32154
- return;
32047
+ getColGroup(col) {
32048
+ let c = this._firstChild;
32049
+ if (!c) {
32050
+ return null;
32155
32051
  }
32156
- if (isObject$4(child.attribute.width) && child.attribute.width.percent) {
32157
- child.setAttribute('width', (child.attribute.width.percent / 100) * parentWidth +
32158
- (child.attribute.width.delta ?? 0));
32052
+ for (let i = 0; i < this.childrenCount; i++) {
32053
+ if (c.col === col) {
32054
+ return c;
32055
+ }
32056
+ c = c._next;
32159
32057
  }
32160
- if (isObject$4(child.attribute.height) && child.attribute.height.percent) {
32161
- child.setAttribute('height', (child.attribute.height.percent / 100) * parentHeight +
32162
- (child.attribute.height.delta ?? 0));
32058
+ return null;
32059
+ }
32060
+ getRowGroup(row) {
32061
+ let c = this._firstChild;
32062
+ if (!c) {
32063
+ return null;
32163
32064
  }
32164
- if (child.type === 'group') {
32165
- dealPercentCalc(child, child.attribute.width, child.attribute.height);
32065
+ for (let i = 0; i < this.childrenCount; i++) {
32066
+ if (c.row === row) {
32067
+ return c;
32068
+ }
32069
+ c = c._next;
32166
32070
  }
32167
- });
32168
- }
32169
- function decodeReactDom(dom) {
32170
- if (!dom || !dom.$$typeof) {
32171
- return dom;
32071
+ return null;
32172
32072
  }
32173
- const type = dom.type;
32174
- const { attribute, children, stateProxy } = dom.props;
32175
- const g = type({ attribute });
32176
- parseToGraphic(g, dom.props);
32177
- if (stateProxy) {
32178
- g.stateProxy = stateProxy;
32073
+ getChildAt(index) {
32074
+ const child = super.getChildAt(index);
32075
+ if (child && child.name === 'border-rect') {
32076
+ return child._next;
32077
+ }
32078
+ return child;
32179
32079
  }
32180
- g.id = attribute.id;
32181
- g.name = attribute.name;
32182
- if (isArray$1(children)) {
32183
- children.forEach((item) => {
32184
- const c = decodeReactDom(item);
32185
- c && c.type && g.add(c);
32186
- });
32080
+ tryUpdateAABBBounds() {
32081
+ if (this.role === 'cell') {
32082
+ if (!this.shouldUpdateAABBBounds()) {
32083
+ return this._AABBBounds;
32084
+ }
32085
+ const selfChange = this.shouldSelfChangeUpdateAABBBounds();
32086
+ const bounds = this.doUpdateAABBBounds();
32087
+ this.addUpdateLayoutTag();
32088
+ after(this, selfChange);
32089
+ return bounds;
32090
+ }
32091
+ return super.tryUpdateAABBBounds();
32187
32092
  }
32188
- else if (children) {
32189
- g.add(decodeReactDom(children));
32093
+ doUpdateAABBBounds() {
32094
+ if (this.role === 'cell') {
32095
+ const attribute = this.attribute;
32096
+ const { x, y, width, height } = attribute;
32097
+ this._AABBBounds.setValue(x, y, x + width, y + height);
32098
+ this.parent && this.parent.addChildUpdateBoundTag();
32099
+ this.clearUpdateBoundTag();
32100
+ return this._AABBBounds;
32101
+ }
32102
+ else if (this.role === 'body' ||
32103
+ this.role === 'row-header' ||
32104
+ this.role === 'col-header' ||
32105
+ this.role === 'right-frozen' ||
32106
+ this.role === 'bottom-frozen' ||
32107
+ this.role === 'corner-header' ||
32108
+ this.role === 'corner-right-top-header' ||
32109
+ this.role === 'corner-right-bottom-header' ||
32110
+ this.role === 'corner-left-bottom-header') {
32111
+ this._AABBBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);
32112
+ this.parent && this.parent.addChildUpdateBoundTag();
32113
+ this.clearUpdateBoundTag();
32114
+ return this._AABBBounds;
32115
+ }
32116
+ return super.doUpdateAABBBounds();
32190
32117
  }
32191
- return g;
32118
+ updateColumnRowNumber(row) {
32119
+ if (!this.rowNumber) {
32120
+ this.rowNumber = row;
32121
+ }
32122
+ else {
32123
+ this.rowNumber = Math.max(this.rowNumber, row);
32124
+ }
32125
+ }
32126
+ updateColumnHeight(cellHeight) {
32127
+ if (!this.colHeight) {
32128
+ this.colHeight = cellHeight;
32129
+ }
32130
+ else {
32131
+ this.colHeight += cellHeight;
32132
+ }
32133
+ }
32134
+ };
32135
+ function after(group, selfChange) {
32136
+ if (!group.stage.dirtyBounds) {
32137
+ return;
32138
+ }
32139
+ if (!(group.stage && group.stage.renderCount)) {
32140
+ return;
32141
+ }
32142
+ if (group.isContainer && !selfChange) {
32143
+ return;
32144
+ }
32145
+ group.stage.dirty(group.globalAABBBounds);
32192
32146
  }
32193
- function parseToGraphic(g, props) {
32194
- let isGraphic = false;
32195
- switch (g.type) {
32196
- case 'richtext':
32197
- break;
32198
- case 'rich/image':
32199
- break;
32200
- default:
32201
- isGraphic = true;
32147
+
32148
+ const CHART_NUMBER_TYPE = genNumberType();
32149
+ class Chart extends Group$2 {
32150
+ type = 'chart';
32151
+ chartInstance;
32152
+ activeChartInstance;
32153
+ active;
32154
+ cacheCanvas;
32155
+ constructor(params) {
32156
+ super(params);
32157
+ this.numberType = CHART_NUMBER_TYPE;
32158
+ if (!params.chartInstance) {
32159
+ params.chartInstance = this.chartInstance = new params.ClassType(params.spec, {
32160
+ renderCanvas: params.canvas,
32161
+ mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',
32162
+ modeParams: this.attribute.modeParams,
32163
+ canvasControled: false,
32164
+ viewBox: { x1: 0, x2: 0, y1: 0, y2: 0 },
32165
+ dpr: params.dpr,
32166
+ interactive: false,
32167
+ animation: false,
32168
+ autoFit: false
32169
+ });
32170
+ this.chartInstance.renderSync();
32171
+ }
32172
+ else {
32173
+ this.chartInstance = params.chartInstance;
32174
+ }
32202
32175
  }
32203
- if (isGraphic) {
32204
- Object.keys(props).forEach(k => {
32205
- const en = REACT_TO_CANOPUS_EVENTS[k];
32206
- if (en) {
32207
- g.on(en, props[k]);
32176
+ activate(table) {
32177
+ this.active = true;
32178
+ const { col, row } = this.parent;
32179
+ const { x1, y1, x2, y2 } = this.getViewBox();
32180
+ const tableBound = getTableBounds(col, row, table);
32181
+ const clipBound = tableBound.intersect({
32182
+ x1: x1 - table.scrollLeft,
32183
+ x2: x2 - table.scrollLeft,
32184
+ y1: y1 - table.scrollTop,
32185
+ y2: y2 - table.scrollTop
32186
+ });
32187
+ this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {
32188
+ renderCanvas: this.attribute.canvas,
32189
+ mode: 'desktop-browser',
32190
+ canvasControled: false,
32191
+ viewBox: {
32192
+ x1: x1 - table.scrollLeft,
32193
+ x2: x2 - table.scrollLeft,
32194
+ y1: y1 - table.scrollTop,
32195
+ y2: y2 - table.scrollTop
32196
+ },
32197
+ dpr: table.internalProps.pixelRatio,
32198
+ animation: false,
32199
+ interactive: true,
32200
+ autoFit: false,
32201
+ beforeRender: (stage) => {
32202
+ const ctx = stage.window.getContext();
32203
+ ctx.inuse = true;
32204
+ ctx.clearMatrix();
32205
+ ctx.setTransformForCurrent(true);
32206
+ ctx.beginPath();
32207
+ ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);
32208
+ ctx.clip();
32209
+ },
32210
+ afterRender(stage) {
32211
+ const ctx = stage.window.getContext();
32212
+ ctx.inuse = false;
32213
+ }
32214
+ });
32215
+ this.activeChartInstance.renderSync();
32216
+ table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);
32217
+ this.activeChartInstance.on('click', (params) => {
32218
+ if (Chart.temp) {
32219
+ table.scenegraph.updateChartState(params?.datum);
32208
32220
  }
32209
32221
  });
32222
+ this.activeChartInstance.on('brushEnd', (params) => {
32223
+ table.scenegraph.updateChartState(params?.value?.inBrushData);
32224
+ Chart.temp = 0;
32225
+ setTimeout(() => {
32226
+ Chart.temp = 1;
32227
+ }, 0);
32228
+ });
32229
+ table._bindChartEvent?.(this.activeChartInstance);
32230
+ }
32231
+ static temp = 1;
32232
+ deactivate() {
32233
+ this.active = false;
32234
+ this.activeChartInstance?.updateViewBox({
32235
+ x1: -1000,
32236
+ x2: -800,
32237
+ y1: -1000,
32238
+ y2: -800
32239
+ }, false, false);
32240
+ this.activeChartInstance?.release();
32241
+ this.activeChartInstance = null;
32242
+ }
32243
+ updateData(data) {
32244
+ this.attribute.data = data;
32245
+ }
32246
+ getViewBox() {
32247
+ const cellGroup = this.parent;
32248
+ const padding = this.attribute.cellPadding;
32249
+ const table = this.stage.table;
32250
+ return {
32251
+ x1: Math.ceil(cellGroup.globalAABBBounds.x1 + padding[3] + table.scrollLeft),
32252
+ x2: Math.ceil(cellGroup.globalAABBBounds.x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft),
32253
+ y1: Math.ceil(cellGroup.globalAABBBounds.y1 + padding[0] + table.scrollTop),
32254
+ y2: Math.ceil(cellGroup.globalAABBBounds.y1 + cellGroup.attribute.height - padding[2] + table.scrollTop)
32255
+ };
32256
+ }
32257
+ }
32258
+ function getTableBounds(col, row, table) {
32259
+ const { layoutMap } = table.internalProps;
32260
+ const bodyBound = new Bounds();
32261
+ const tableBound = table.scenegraph.tableGroup.globalAABBBounds;
32262
+ bodyBound.x1 = tableBound.x1;
32263
+ bodyBound.x2 = tableBound.x2;
32264
+ bodyBound.y1 = tableBound.y1;
32265
+ bodyBound.y2 = tableBound.y2;
32266
+ if (!layoutMap.isFrozenColumn(col, row) && !layoutMap.isRightFrozenColumn(col, row)) {
32267
+ bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
32268
+ bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
32269
+ bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
32270
+ bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
32271
+ }
32272
+ else if (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightTopCorner(col, row)) ;
32273
+ else if (layoutMap.isFrozenColumn(col, row)) {
32274
+ bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
32275
+ bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
32276
+ }
32277
+ else if (layoutMap.isRightFrozenColumn(col, row)) {
32278
+ bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
32279
+ bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
32280
+ }
32281
+ else if (layoutMap.isBottomFrozenRow(col, row)) {
32282
+ bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
32283
+ bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
32284
+ }
32285
+ return bodyBound;
32286
+ }
32287
+
32288
+ const chartTypes = {};
32289
+
32290
+ const builtin = {};
32291
+ function get$2() {
32292
+ return extend(builtin, chartTypes);
32293
+ }
32294
+
32295
+ function createChartCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, width, height, padding, dataValue, chartModule, chartSpec, chartInstance, dataId, table, cellTheme) {
32296
+ const registerCharts = get$2();
32297
+ const ClassType = registerCharts[chartModule];
32298
+ const headerStyle = table._getCellStyle(col, row);
32299
+ const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
32300
+ if (isValid$1(functionalPadding)) {
32301
+ padding = functionalPadding;
32302
+ }
32303
+ if (!cellGroup) {
32304
+ cellGroup = new Group$1({
32305
+ x: xOrigin,
32306
+ y: yOrigin,
32307
+ width,
32308
+ height,
32309
+ lineWidth: cellTheme?.group?.lineWidth ?? undefined,
32310
+ fill: cellTheme?.group?.fill ?? undefined,
32311
+ stroke: cellTheme?.group?.stroke ?? undefined,
32312
+ strokeArrayWidth: cellTheme?.group?.strokeArrayWidth ?? undefined,
32313
+ strokeArrayColor: cellTheme?.group?.strokeArrayColor ?? undefined,
32314
+ cursor: cellTheme?.group?.cursor ?? undefined,
32315
+ lineCap: 'square',
32316
+ clip: true,
32317
+ cornerRadius: cellTheme.group.cornerRadius
32318
+ });
32319
+ cellGroup.role = 'cell';
32320
+ cellGroup.col = col;
32321
+ cellGroup.row = row;
32322
+ columnGroup?.addChild(cellGroup);
32210
32323
  }
32324
+ cellGroup.AABBBounds.width();
32325
+ const chartGroup = new Chart({
32326
+ stroke: false,
32327
+ x: padding[3],
32328
+ y: padding[0],
32329
+ canvas: table.canvas ?? table.scenegraph.stage.window.getContext().canvas,
32330
+ mode: table.options.mode,
32331
+ modeParams: table.options.modeParams,
32332
+ spec: chartSpec,
32333
+ ClassType,
32334
+ width: width - padding[3] - padding[1],
32335
+ height: height - padding[2] - padding[0],
32336
+ chartInstance,
32337
+ dataId,
32338
+ data: table.getCellValue(col, row),
32339
+ cellPadding: padding,
32340
+ dpr: table.internalProps.pixelRatio,
32341
+ axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : []
32342
+ });
32343
+ cellGroup.appendChild(chartGroup);
32344
+ table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance);
32345
+ return cellGroup;
32211
32346
  }
32212
32347
 
32213
32348
  const icons = {};
@@ -32487,231 +32622,10 @@
32487
32622
  };
32488
32623
  }
32489
32624
  };
32490
- function get$2() {
32625
+ function get$1() {
32491
32626
  return extend(builtins, icons);
32492
32627
  }
32493
32628
 
32494
- let Group$1 = class Group extends Group$2 {
32495
- role;
32496
- col;
32497
- row;
32498
- mergeStartCol;
32499
- mergeStartRow;
32500
- mergeEndCol;
32501
- mergeEndRow;
32502
- contentWidth;
32503
- contentHeight;
32504
- rowNumber;
32505
- colHeight;
32506
- border;
32507
- needUpdate;
32508
- needUpdateWidth;
32509
- needUpdateHeight;
32510
- clear() {
32511
- this.removeAllChild();
32512
- }
32513
- getChildByName(name, deep) {
32514
- let result = null;
32515
- this.forEachChildren((child) => {
32516
- if (child.name === name) {
32517
- result = child;
32518
- return true;
32519
- }
32520
- return false;
32521
- });
32522
- if (deep) {
32523
- this.forEachChildren((child) => {
32524
- if (child.getChildByName) {
32525
- const target = child.getChildByName(name, true);
32526
- if (target) {
32527
- result = target;
32528
- return true;
32529
- }
32530
- }
32531
- return false;
32532
- });
32533
- }
32534
- return result;
32535
- }
32536
- get width() {
32537
- let width = this.AABBBounds.width();
32538
- if (width === Infinity || width === -Infinity) {
32539
- width = 0;
32540
- }
32541
- return Math.max(width, this.attribute.width ?? 0);
32542
- }
32543
- get height() {
32544
- let height = this.AABBBounds.height();
32545
- if (height === Infinity || height === -Infinity) {
32546
- height = 0;
32547
- }
32548
- return Math.max(height, this.attribute.height ?? 0);
32549
- }
32550
- setDeltaWidth(deltaX) {
32551
- if (deltaX === 0) {
32552
- return;
32553
- }
32554
- this.setAttribute('width', (this.attribute.width ?? 0) + deltaX);
32555
- if (this.border) {
32556
- this.border.setAttribute('width', this.border.attribute.width + deltaX);
32557
- if (this.border.type === 'group') {
32558
- this.border.firstChild.setAttribute('width', this.border.firstChild.attribute.width + deltaX);
32559
- }
32560
- }
32561
- }
32562
- setDeltaHeight(deltaY) {
32563
- if (deltaY === 0) {
32564
- return;
32565
- }
32566
- this.setAttribute('height', (this.attribute.height ?? 0) + deltaY);
32567
- if (this.border) {
32568
- this.border.setAttribute('height', this.border.attribute.height + deltaY);
32569
- if (this.border.type === 'group') {
32570
- this.border.firstChild.setAttribute('width', this.border.firstChild.attribute.height + deltaY);
32571
- }
32572
- }
32573
- }
32574
- setDeltaX(deltaX) {
32575
- if (deltaX === 0) {
32576
- return;
32577
- }
32578
- this.setAttribute('x', this.attribute.x + deltaX);
32579
- }
32580
- setDeltaY(deltaY) {
32581
- if (deltaY === 0) {
32582
- return;
32583
- }
32584
- this.setAttribute('y', this.attribute.y + deltaY);
32585
- }
32586
- forEachChildrenSkipChild(cb, skipChildName = 'border-rect', reverse = false) {
32587
- if (reverse) {
32588
- let child = this._lastChild;
32589
- let i = 0;
32590
- while (child) {
32591
- if (child.name !== skipChildName) {
32592
- const breakTag = cb(child, i++);
32593
- if (breakTag) {
32594
- return;
32595
- }
32596
- }
32597
- child = child._prev;
32598
- }
32599
- }
32600
- else {
32601
- let child = this._firstChild;
32602
- let i = 0;
32603
- while (child) {
32604
- if (child.name !== skipChildName) {
32605
- const breakTag = cb(child, i++);
32606
- if (breakTag) {
32607
- return;
32608
- }
32609
- }
32610
- child = child._next;
32611
- }
32612
- }
32613
- }
32614
- getColGroup(col) {
32615
- let c = this._firstChild;
32616
- if (!c) {
32617
- return null;
32618
- }
32619
- for (let i = 0; i < this.childrenCount; i++) {
32620
- if (c.col === col) {
32621
- return c;
32622
- }
32623
- c = c._next;
32624
- }
32625
- return null;
32626
- }
32627
- getRowGroup(row) {
32628
- let c = this._firstChild;
32629
- if (!c) {
32630
- return null;
32631
- }
32632
- for (let i = 0; i < this.childrenCount; i++) {
32633
- if (c.row === row) {
32634
- return c;
32635
- }
32636
- c = c._next;
32637
- }
32638
- return null;
32639
- }
32640
- getChildAt(index) {
32641
- const child = super.getChildAt(index);
32642
- if (child && child.name === 'border-rect') {
32643
- return child._next;
32644
- }
32645
- return child;
32646
- }
32647
- tryUpdateAABBBounds() {
32648
- if (this.role === 'cell') {
32649
- if (!this.shouldUpdateAABBBounds()) {
32650
- return this._AABBBounds;
32651
- }
32652
- const selfChange = this.shouldSelfChangeUpdateAABBBounds();
32653
- const bounds = this.doUpdateAABBBounds();
32654
- this.addUpdateLayoutTag();
32655
- after(this, selfChange);
32656
- return bounds;
32657
- }
32658
- return super.tryUpdateAABBBounds();
32659
- }
32660
- doUpdateAABBBounds() {
32661
- if (this.role === 'cell') {
32662
- const attribute = this.attribute;
32663
- const { x, y, width, height } = attribute;
32664
- this._AABBBounds.setValue(x, y, x + width, y + height);
32665
- this.parent && this.parent.addChildUpdateBoundTag();
32666
- this.clearUpdateBoundTag();
32667
- return this._AABBBounds;
32668
- }
32669
- else if (this.role === 'body' ||
32670
- this.role === 'row-header' ||
32671
- this.role === 'col-header' ||
32672
- this.role === 'right-frozen' ||
32673
- this.role === 'bottom-frozen' ||
32674
- this.role === 'corner-header' ||
32675
- this.role === 'corner-right-top-header' ||
32676
- this.role === 'corner-right-bottom-header' ||
32677
- this.role === 'corner-left-bottom-header') {
32678
- this._AABBBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);
32679
- this.parent && this.parent.addChildUpdateBoundTag();
32680
- this.clearUpdateBoundTag();
32681
- return this._AABBBounds;
32682
- }
32683
- return super.doUpdateAABBBounds();
32684
- }
32685
- updateColumnRowNumber(row) {
32686
- if (!this.rowNumber) {
32687
- this.rowNumber = row;
32688
- }
32689
- else {
32690
- this.rowNumber = Math.max(this.rowNumber, row);
32691
- }
32692
- }
32693
- updateColumnHeight(cellHeight) {
32694
- if (!this.colHeight) {
32695
- this.colHeight = cellHeight;
32696
- }
32697
- else {
32698
- this.colHeight += cellHeight;
32699
- }
32700
- }
32701
- };
32702
- function after(group, selfChange) {
32703
- if (!group.stage.dirtyBounds) {
32704
- return;
32705
- }
32706
- if (!(group.stage && group.stage.renderCount)) {
32707
- return;
32708
- }
32709
- if (group.isContainer && !selfChange) {
32710
- return;
32711
- }
32712
- group.stage.dirty(group.globalAABBBounds);
32713
- }
32714
-
32715
32629
  function calcKeepAspectRatioSize(width, height, maxWidth, maxHeight) {
32716
32630
  let newWidth = width;
32717
32631
  let newHeight = height;
@@ -32749,43 +32663,12 @@
32749
32663
  return { x, y };
32750
32664
  }
32751
32665
 
32752
- function getProp(name, cellStyle, col, row, _table) {
32753
- const prop = cellStyle && isValid$1(cellStyle[name]) ? cellStyle[name] : null;
32754
- if (typeof prop === 'function') {
32755
- const arg = {
32756
- col,
32757
- row,
32758
- table: _table,
32759
- value: _table.getCellValue(col, row),
32760
- dataValue: _table.getCellOriginValue(col, row),
32761
- cellHeaderPaths: _table.getCellHeaderPaths(col, row)
32762
- };
32763
- return prop(arg);
32764
- }
32765
- return prop;
32766
- }
32767
- function getFunctionalProp(name, cellStyle, col, row, _table) {
32768
- const prop = cellStyle && isValid$1(cellStyle[name]) ? cellStyle[name] : null;
32769
- if (typeof prop === 'function') {
32770
- const arg = {
32771
- col,
32772
- row,
32773
- table: _table,
32774
- value: _table.getCellValue(col, row),
32775
- dataValue: _table.getCellOriginValue(col, row),
32776
- cellHeaderPaths: _table.getCellHeaderPaths(col, row)
32777
- };
32778
- return prop(arg);
32779
- }
32780
- return undefined;
32781
- }
32782
-
32783
- get$2();
32784
- function createImageCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, table, cellTheme) {
32785
- const headerStyle = table._getCellStyle(col, row);
32786
- const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
32787
- if (isValid$1(functionalPadding)) {
32788
- padding = functionalPadding;
32666
+ get$1();
32667
+ function createImageCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, table, cellTheme) {
32668
+ const headerStyle = table._getCellStyle(col, row);
32669
+ const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
32670
+ if (isValid$1(functionalPadding)) {
32671
+ padding = functionalPadding;
32789
32672
  }
32790
32673
  if (cellTheme?.text?.textAlign) {
32791
32674
  textAlign = cellTheme?.text?.textAlign;
@@ -32851,7 +32734,7 @@
32851
32734
  };
32852
32735
  }
32853
32736
  image.failCallback = () => {
32854
- const regedIcons = get$2();
32737
+ const regedIcons = get$1();
32855
32738
  image.image = regedIcons.damage_pic.svg;
32856
32739
  };
32857
32740
  cellGroup.appendChild(image);
@@ -33625,206 +33508,6 @@
33625
33508
  return group;
33626
33509
  }
33627
33510
 
33628
- const CHART_NUMBER_TYPE = genNumberType();
33629
- class Chart extends Group$2 {
33630
- type = 'chart';
33631
- chartInstance;
33632
- activeChartInstance;
33633
- active;
33634
- cacheCanvas;
33635
- constructor(params) {
33636
- super(params);
33637
- this.numberType = CHART_NUMBER_TYPE;
33638
- if (!params.chartInstance) {
33639
- params.chartInstance = this.chartInstance = new params.ClassType(params.spec, {
33640
- renderCanvas: params.canvas,
33641
- mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',
33642
- modeParams: this.attribute.modeParams,
33643
- canvasControled: false,
33644
- viewBox: { x1: 0, x2: 0, y1: 0, y2: 0 },
33645
- dpr: params.dpr,
33646
- interactive: false,
33647
- animation: false,
33648
- autoFit: false
33649
- });
33650
- this.chartInstance.renderSync();
33651
- }
33652
- else {
33653
- this.chartInstance = params.chartInstance;
33654
- }
33655
- }
33656
- activate(table) {
33657
- this.active = true;
33658
- const { col, row } = this.parent;
33659
- const { x1, y1, x2, y2 } = this.getViewBox();
33660
- const tableBound = getTableBounds(col, row, table);
33661
- const clipBound = tableBound.intersect({
33662
- x1: x1 - table.scrollLeft,
33663
- x2: x2 - table.scrollLeft,
33664
- y1: y1 - table.scrollTop,
33665
- y2: y2 - table.scrollTop
33666
- });
33667
- this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {
33668
- renderCanvas: this.attribute.canvas,
33669
- mode: 'desktop-browser',
33670
- canvasControled: false,
33671
- viewBox: {
33672
- x1: x1 - table.scrollLeft,
33673
- x2: x2 - table.scrollLeft,
33674
- y1: y1 - table.scrollTop,
33675
- y2: y2 - table.scrollTop
33676
- },
33677
- dpr: table.internalProps.pixelRatio,
33678
- animation: false,
33679
- interactive: true,
33680
- autoFit: false,
33681
- beforeRender: (stage) => {
33682
- const ctx = stage.window.getContext();
33683
- ctx.inuse = true;
33684
- ctx.clearMatrix();
33685
- ctx.setTransformForCurrent(true);
33686
- ctx.beginPath();
33687
- ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);
33688
- ctx.clip();
33689
- },
33690
- afterRender(stage) {
33691
- const ctx = stage.window.getContext();
33692
- ctx.inuse = false;
33693
- }
33694
- });
33695
- this.activeChartInstance.renderSync();
33696
- table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);
33697
- this.activeChartInstance.on('click', (params) => {
33698
- if (Chart.temp) {
33699
- table.scenegraph.updateChartState(params?.datum);
33700
- }
33701
- });
33702
- this.activeChartInstance.on('brushEnd', (params) => {
33703
- table.scenegraph.updateChartState(params?.value?.inBrushData);
33704
- Chart.temp = 0;
33705
- setTimeout(() => {
33706
- Chart.temp = 1;
33707
- }, 0);
33708
- });
33709
- table._bindChartEvent?.(this.activeChartInstance);
33710
- }
33711
- static temp = 1;
33712
- deactivate() {
33713
- this.active = false;
33714
- this.activeChartInstance?.updateViewBox({
33715
- x1: -1000,
33716
- x2: -800,
33717
- y1: -1000,
33718
- y2: -800
33719
- }, false, false);
33720
- this.activeChartInstance?.release();
33721
- this.activeChartInstance = null;
33722
- }
33723
- updateData(data) {
33724
- this.attribute.data = data;
33725
- }
33726
- getViewBox() {
33727
- const cellGroup = this.parent;
33728
- const padding = this.attribute.cellPadding;
33729
- const table = this.stage.table;
33730
- return {
33731
- x1: Math.ceil(cellGroup.globalAABBBounds.x1 + padding[3] + table.scrollLeft),
33732
- x2: Math.ceil(cellGroup.globalAABBBounds.x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft),
33733
- y1: Math.ceil(cellGroup.globalAABBBounds.y1 + padding[0] + table.scrollTop),
33734
- y2: Math.ceil(cellGroup.globalAABBBounds.y1 + cellGroup.attribute.height - padding[2] + table.scrollTop)
33735
- };
33736
- }
33737
- }
33738
- function getTableBounds(col, row, table) {
33739
- const { layoutMap } = table.internalProps;
33740
- const bodyBound = new Bounds();
33741
- const tableBound = table.scenegraph.tableGroup.globalAABBBounds;
33742
- bodyBound.x1 = tableBound.x1;
33743
- bodyBound.x2 = tableBound.x2;
33744
- bodyBound.y1 = tableBound.y1;
33745
- bodyBound.y2 = tableBound.y2;
33746
- if (!layoutMap.isFrozenColumn(col, row) && !layoutMap.isRightFrozenColumn(col, row)) {
33747
- bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
33748
- bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
33749
- bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
33750
- bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
33751
- }
33752
- else if (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightTopCorner(col, row)) ;
33753
- else if (layoutMap.isFrozenColumn(col, row)) {
33754
- bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
33755
- bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
33756
- }
33757
- else if (layoutMap.isRightFrozenColumn(col, row)) {
33758
- bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
33759
- bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
33760
- }
33761
- else if (layoutMap.isBottomFrozenRow(col, row)) {
33762
- bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
33763
- bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
33764
- }
33765
- return bodyBound;
33766
- }
33767
-
33768
- const chartTypes = {};
33769
-
33770
- const builtin = {};
33771
- function get$1() {
33772
- return extend(builtin, chartTypes);
33773
- }
33774
-
33775
- function createChartCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, width, height, padding, dataValue, chartModule, chartSpec, chartInstance, dataId, table, cellTheme) {
33776
- const registerCharts = get$1();
33777
- const ClassType = registerCharts[chartModule];
33778
- const headerStyle = table._getCellStyle(col, row);
33779
- const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
33780
- if (isValid$1(functionalPadding)) {
33781
- padding = functionalPadding;
33782
- }
33783
- if (!cellGroup) {
33784
- cellGroup = new Group$1({
33785
- x: xOrigin,
33786
- y: yOrigin,
33787
- width,
33788
- height,
33789
- lineWidth: cellTheme?.group?.lineWidth ?? undefined,
33790
- fill: cellTheme?.group?.fill ?? undefined,
33791
- stroke: cellTheme?.group?.stroke ?? undefined,
33792
- strokeArrayWidth: cellTheme?.group?.strokeArrayWidth ?? undefined,
33793
- strokeArrayColor: cellTheme?.group?.strokeArrayColor ?? undefined,
33794
- cursor: cellTheme?.group?.cursor ?? undefined,
33795
- lineCap: 'square',
33796
- clip: true,
33797
- cornerRadius: cellTheme.group.cornerRadius
33798
- });
33799
- cellGroup.role = 'cell';
33800
- cellGroup.col = col;
33801
- cellGroup.row = row;
33802
- columnGroup?.addChild(cellGroup);
33803
- }
33804
- cellGroup.AABBBounds.width();
33805
- const chartGroup = new Chart({
33806
- stroke: false,
33807
- x: padding[3],
33808
- y: padding[0],
33809
- canvas: table.canvas ?? table.scenegraph.stage.window.getContext().canvas,
33810
- mode: table.options.mode,
33811
- modeParams: table.options.modeParams,
33812
- spec: chartSpec,
33813
- ClassType,
33814
- width: width - padding[3] - padding[1],
33815
- height: height - padding[2] - padding[0],
33816
- chartInstance,
33817
- dataId,
33818
- data: table.getCellValue(col, row),
33819
- cellPadding: padding,
33820
- dpr: table.internalProps.pixelRatio,
33821
- axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : []
33822
- });
33823
- cellGroup.appendChild(chartGroup);
33824
- table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance);
33825
- return cellGroup;
33826
- }
33827
-
33828
33511
  class CellContent extends Group$1 {
33829
33512
  _leftGroup;
33830
33513
  _rightGroup;
@@ -34018,7 +33701,7 @@
34018
33701
  return cellHierarchyIndent;
34019
33702
  }
34020
33703
 
34021
- function createCellContent(cellGroup, icons, textStr, padding, autoColWidth, autoRowHeight, autoWrapText, lineClamp, cellWidth, cellHeight, textAlign, textBaseline, table, cellTheme) {
33704
+ function createCellContent(cellGroup, icons, textStr, padding, autoColWidth, autoRowHeight, autoWrapText, lineClamp, cellWidth, cellHeight, textAlign, textBaseline, table, cellTheme, range) {
34022
33705
  const leftIcons = [];
34023
33706
  const rightIcons = [];
34024
33707
  const contentLeftIcons = [];
@@ -34037,7 +33720,9 @@
34037
33720
  if (!Array.isArray(icons) || icons.length === 0) {
34038
33721
  if (isValid$1(textStr)) {
34039
33722
  const text = convertInternal(textStr).replace(/\r?\n/g, '\n').replace(/\r/g, '\n').split('\n');
34040
- const hierarchyOffset = getHierarchyOffset(cellGroup.col, cellGroup.row, table);
33723
+ const hierarchyOffset = range
33724
+ ? getHierarchyOffset(range.start.col, range.start.row, table)
33725
+ : getHierarchyOffset(cellGroup.col, cellGroup.row, table);
34041
33726
  const attribute = {
34042
33727
  text: text.length === 1 ? text[0] : text,
34043
33728
  maxLineWidth: autoColWidth ? Infinity : cellWidth - (padding[1] + padding[3] + hierarchyOffset),
@@ -34084,7 +33769,7 @@
34084
33769
  }
34085
33770
  });
34086
33771
  leftIcons.forEach(icon => {
34087
- const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, table);
33772
+ const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, range, table);
34088
33773
  iconMark.role = 'icon-left';
34089
33774
  iconMark.name = icon.name;
34090
33775
  iconMark.setAttribute('x', leftIconWidth + (iconMark.attribute.marginLeft ?? 0));
@@ -34094,7 +33779,7 @@
34094
33779
  cellGroup.appendChild(iconMark);
34095
33780
  });
34096
33781
  rightIcons.forEach(icon => {
34097
- const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, table);
33782
+ const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, range, table);
34098
33783
  iconMark.role = 'icon-right';
34099
33784
  iconMark.name = icon.name;
34100
33785
  iconMark.setAttribute('x', rightIconWidth + (iconMark.attribute.marginLeft ?? 0));
@@ -34104,7 +33789,7 @@
34104
33789
  cellGroup.appendChild(iconMark);
34105
33790
  });
34106
33791
  absoluteLeftIcons.forEach(icon => {
34107
- const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, table);
33792
+ const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, range, table);
34108
33793
  iconMark.role = 'icon-absolute-left';
34109
33794
  iconMark.name = icon.name;
34110
33795
  iconMark.setAttribute('x', absoluteLeftIconWidth + (iconMark.attribute.marginLeft ?? 0));
@@ -34113,7 +33798,7 @@
34113
33798
  cellGroup.appendChild(iconMark);
34114
33799
  });
34115
33800
  absoluteRightIcons.forEach(icon => {
34116
- const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, table);
33801
+ const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, range, table);
34117
33802
  iconMark.role = 'icon-absolute-right';
34118
33803
  iconMark.name = icon.name;
34119
33804
  iconMark.setAttribute('x', absoluteRightIconWidth + (iconMark.attribute.marginLeft ?? 0));
@@ -34181,13 +33866,13 @@
34181
33866
  baseline: textBaseline
34182
33867
  });
34183
33868
  contentLeftIcons.forEach(icon => {
34184
- const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, table);
33869
+ const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, range, table);
34185
33870
  iconMark.role = 'icon-content-left';
34186
33871
  iconMark.name = icon.name;
34187
33872
  cellContent.addLeftOccupyingIcon(iconMark);
34188
33873
  });
34189
33874
  contentRightIcons.forEach(icon => {
34190
- const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, table);
33875
+ const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, range, table);
34191
33876
  iconMark.role = 'icon-content-right';
34192
33877
  iconMark.name = icon.name;
34193
33878
  cellContent.addRightOccupyingIcon(iconMark);
@@ -34251,7 +33936,7 @@
34251
33936
  height: height + padding[0] + padding[2]
34252
33937
  });
34253
33938
  }
34254
- function dealWithIcon(icon, mark, col, row, table) {
33939
+ function dealWithIcon(icon, mark, col, row, range, table) {
34255
33940
  const iconAttribute = {};
34256
33941
  if (icon.type === 'image') {
34257
33942
  iconAttribute.image = icon.src;
@@ -34269,7 +33954,9 @@
34269
33954
  isNumber$3(row) &&
34270
33955
  table &&
34271
33956
  (icon.funcType === IconFuncTypeEnum.collapse || icon.funcType === IconFuncTypeEnum.expand)) {
34272
- hierarchyOffset = getHierarchyOffset(col, row, table);
33957
+ hierarchyOffset = range
33958
+ ? getHierarchyOffset(range.start.col, range.start.row, table)
33959
+ : getHierarchyOffset(col, row, table);
34273
33960
  }
34274
33961
  iconAttribute.marginLeft = (icon.marginLeft ?? 0) + hierarchyOffset;
34275
33962
  iconAttribute.marginRight = icon.marginRight ?? 0;
@@ -34491,7 +34178,7 @@
34491
34178
  return false;
34492
34179
  }
34493
34180
 
34494
- function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme) {
34181
+ function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range) {
34495
34182
  const headerStyle = table._getCellStyle(col, row);
34496
34183
  const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
34497
34184
  if (isValid$1(functionalPadding)) {
@@ -34533,9 +34220,15 @@
34533
34220
  const textStr = value;
34534
34221
  let icons;
34535
34222
  if (mayHaveIcon) {
34536
- icons = table.getCellIcons(col, row);
34223
+ let iconCol = col;
34224
+ let iconRow = row;
34225
+ if (range) {
34226
+ iconCol = range.start.col;
34227
+ iconRow = range.start.row;
34228
+ }
34229
+ icons = table.getCellIcons(iconCol, iconRow);
34537
34230
  }
34538
- createCellContent(cellGroup, icons, textStr, padding, autoColWidth, autoRowHeight, autoWrapText, typeof lineClamp === 'number' ? lineClamp : undefined, cellWidth, cellHeight, textAlign, textBaseline, table, cellTheme);
34231
+ createCellContent(cellGroup, icons, textStr, padding, autoColWidth, autoRowHeight, autoWrapText, typeof lineClamp === 'number' ? lineClamp : undefined, cellWidth, cellHeight, textAlign, textBaseline, table, cellTheme, range);
34539
34232
  if (cellTheme?._vtable?.marked) {
34540
34233
  const mark = createArc({
34541
34234
  x: cellGroup.attribute.width,
@@ -34559,7 +34252,7 @@
34559
34252
  return cellGroup;
34560
34253
  }
34561
34254
 
34562
- const regedIcons$1 = get$2();
34255
+ const regedIcons$1 = get$1();
34563
34256
  function createVideoCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, table, cellTheme) {
34564
34257
  const headerStyle = table._getCellStyle(col, row);
34565
34258
  const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
@@ -34814,7 +34507,7 @@
34814
34507
  return checkbox;
34815
34508
  }
34816
34509
 
34817
- function createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme) {
34510
+ function createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult) {
34818
34511
  if (isPromise(value)) {
34819
34512
  value = table.getCellValue(col, row);
34820
34513
  }
@@ -34871,23 +34564,29 @@
34871
34564
  }
34872
34565
  let customElementsGroup;
34873
34566
  let renderDefault = true;
34874
- let customRender;
34875
- let customLayout;
34876
- const cellLocation = table.getCellLocation(col, row);
34877
- if (cellLocation !== 'body') {
34878
- customRender = define?.headerCustomRender;
34879
- customLayout = define?.headerCustomLayout;
34880
- }
34881
- else {
34882
- customRender = define?.customRender || table.customRender;
34883
- customLayout = define?.customLayout;
34884
- }
34885
- if (customLayout || customRender) {
34886
- const customResult = dealWithCustom(customLayout, customRender, col, row, cellWidth, cellHeight, false, table.heightMode === 'autoHeight', padding, table);
34567
+ if (customResult) {
34887
34568
  customElementsGroup = customResult.elementsGroup;
34888
34569
  renderDefault = customResult.renderDefault;
34889
34570
  }
34890
- cellGroup = createCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme);
34571
+ else {
34572
+ let customRender;
34573
+ let customLayout;
34574
+ const cellLocation = table.getCellLocation(col, row);
34575
+ if (cellLocation !== 'body') {
34576
+ customRender = define?.headerCustomRender;
34577
+ customLayout = define?.headerCustomLayout;
34578
+ }
34579
+ else {
34580
+ customRender = define?.customRender || table.customRender;
34581
+ customLayout = define?.customLayout;
34582
+ }
34583
+ if (customLayout || customRender) {
34584
+ const customResult = dealWithCustom(customLayout, customRender, col, row, cellWidth, cellHeight, false, table.heightMode === 'autoHeight', padding, table);
34585
+ customElementsGroup = customResult.elementsGroup;
34586
+ renderDefault = customResult.renderDefault;
34587
+ }
34588
+ }
34589
+ cellGroup = createCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range);
34891
34590
  const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(col, row);
34892
34591
  if (axisConfig) {
34893
34592
  const axis = new CartesianAxis(axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, padding, table);
@@ -34921,7 +34620,7 @@
34921
34620
  else if (type === 'progressbar') {
34922
34621
  const style = table._getCellStyle(col, row);
34923
34622
  const dataValue = table.getCellOriginValue(col, row);
34924
- cellGroup = createCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, false, null, true, cellTheme);
34623
+ cellGroup = createCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, false, null, true, cellTheme, range);
34925
34624
  const progressBarGroup = createProgressBarCell(define, style, colWidth, value, dataValue, col, row, padding, table);
34926
34625
  if (cellGroup.firstChild) {
34927
34626
  cellGroup.insertBefore(progressBarGroup, cellGroup.firstChild);
@@ -34943,14 +34642,45 @@
34943
34642
  const cellStyle = table._getCellStyle(col, row);
34944
34643
  const autoWrapText = cellStyle.autoWrapText ?? table.internalProps.autoWrapText;
34945
34644
  const cellLocation = table.getCellLocation(col, row);
34946
- const define = cellLocation !== 'body' ? table.getHeaderDefine(col, row) : table.getBodyColumnDefine(col, row);
34645
+ let value = table.getCellValue(col, row);
34947
34646
  let isMerge;
34948
34647
  let range;
34949
- if (cellLocation !== 'body' || define?.mergeCell || table.internalProps.customMergeCell) {
34648
+ let cellTheme;
34649
+ let customStyle;
34650
+ let customResult;
34651
+ if (table.internalProps.customMergeCell) {
34652
+ const customMerge = table.getCustomMerge(col, row);
34653
+ if (customMerge) {
34654
+ const { range: customMergeRange, text: customMergeText, style: customMergeStyle, customLayout, customRender } = customMerge;
34655
+ range = customMergeRange;
34656
+ isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
34657
+ value = customMergeText;
34658
+ customStyle = customMergeStyle;
34659
+ if (customStyle) {
34660
+ cellTheme = getStyleTheme(customStyle, table, range.start.col, range.start.row, getProp).theme;
34661
+ cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table);
34662
+ }
34663
+ if (customLayout || customRender) {
34664
+ customResult = dealWithCustom(customLayout, customRender, customMergeRange.start.col, customMergeRange.start.row, table.getColsWidth(customMergeRange.start.col, customMergeRange.end.col), table.getRowsHeight(customMergeRange.start.row, customMergeRange.end.row), false, table.heightMode === 'autoHeight', [0, 0, 0, 0], table);
34665
+ }
34666
+ }
34667
+ }
34668
+ let colForDefine = col;
34669
+ let rowForDefine = row;
34670
+ if (range) {
34671
+ colForDefine = range.start.col;
34672
+ rowForDefine = range.start.row;
34673
+ }
34674
+ const define = cellLocation !== 'body'
34675
+ ? table.getHeaderDefine(colForDefine, rowForDefine)
34676
+ : table.getBodyColumnDefine(colForDefine, rowForDefine);
34677
+ if (!range && (cellLocation !== 'body' || define?.mergeCell)) {
34950
34678
  range = table.getCellRange(col, row);
34951
34679
  isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
34952
34680
  }
34953
- let cellTheme = getStyleTheme(cellStyle, table, isMerge ? range.start.col : col, isMerge ? range.start.row : row, getProp).theme;
34681
+ if (!cellTheme) {
34682
+ cellTheme = getStyleTheme(cellStyle, table, isMerge ? range.start.col : col, isMerge ? range.start.row : row, getProp).theme;
34683
+ }
34954
34684
  cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table);
34955
34685
  if (!addNew && !isMerge && canUseFastUpdate(col, row, oldCellGroup, autoWrapText, table)) {
34956
34686
  const cellWidth = table.getColWidth(col);
@@ -35025,274 +34755,641 @@
35025
34755
  const type = table.isHeader(col, row)
35026
34756
  ? table._getHeaderLayoutMap(col, row).headerType
35027
34757
  : table.getBodyColumnType(col, row);
35028
- let value = table.getCellValue(col, row);
35029
- let customStyle;
35030
- if (table.internalProps.customMergeCell) {
35031
- const customMerge = table.getCustomMerge(col, row);
35032
- if (customMerge) {
35033
- const { range: customMergeRange, text: customMergeText, style: customMergeStyle } = customMerge;
35034
- range = customMergeRange;
34758
+ const mayHaveIcon = cellLocation !== 'body' ? true : !!define?.icon || !!define?.tree;
34759
+ const padding = cellTheme._vtable.padding;
34760
+ const textAlign = cellTheme._vtable.textAlign;
34761
+ const textBaseline = cellTheme._vtable.textBaseline;
34762
+ let newCellGroup;
34763
+ let bgColorFunc;
34764
+ if (table.internalProps?.dataConfig?.mappingRules && !table.isHeader(col, row)) {
34765
+ table.internalProps?.dataConfig?.mappingRules?.forEach((mappingRule, i) => {
34766
+ if (mappingRule.bgColor &&
34767
+ table.internalProps.layoutMap.getIndicatorKey(col, row) ===
34768
+ mappingRule.bgColor.indicatorKey) {
34769
+ bgColorFunc = mappingRule.bgColor.mapping;
34770
+ }
34771
+ });
34772
+ }
34773
+ let cellWidth;
34774
+ let cellHeight;
34775
+ if (range) {
34776
+ cellWidth = table.getColsWidth(range.start.col, range.end.col);
34777
+ cellHeight = table.getRowsHeight(range.start.row, range.end.row);
34778
+ }
34779
+ else {
34780
+ cellWidth = table.getColWidth(col);
34781
+ cellHeight = table.getRowHeight(row);
34782
+ }
34783
+ if (isPromise(value)) {
34784
+ oldCellGroup.removeAllChild();
34785
+ dealPromiseData(value, table, updateCellContent.bind(null, type, value, define, table, col, row, bgColorFunc, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme, range, customResult));
34786
+ }
34787
+ else {
34788
+ newCellGroup = updateCellContent(type, value, define, table, col, row, bgColorFunc, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme, range, customResult);
34789
+ }
34790
+ if (isMerge) {
34791
+ const rangeHeight = table.getRowHeight(row);
34792
+ const rangeWidth = table.getColWidth(col);
34793
+ const { width: contentWidth } = newCellGroup.attribute;
34794
+ const { height: contentHeight } = newCellGroup.attribute;
34795
+ newCellGroup.contentWidth = contentWidth;
34796
+ newCellGroup.contentHeight = contentHeight;
34797
+ resizeCellGroup(newCellGroup, rangeWidth, rangeHeight, range, table);
34798
+ }
34799
+ return newCellGroup;
34800
+ }
34801
+ function updateCellContent(type, value, define, table, col, row, bgColorFunc, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme, range, customResult) {
34802
+ if (isPromise(value)) {
34803
+ value = table.getCellValue(col, row);
34804
+ }
34805
+ if (!addNew && (oldCellGroup.row !== row || oldCellGroup.col !== col)) {
34806
+ return null;
34807
+ }
34808
+ const newCellGroup = createCell(type, value, define, table, col, row, table.getColWidth(col), cellWidth, cellHeight, addNew ? table.scenegraph.getColGroup(col) : oldCellGroup.parent, addNew ? 0 : table.scenegraph.getCellGroupY(row), padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult);
34809
+ if (!addNew && oldCellGroup.parent) {
34810
+ oldCellGroup.parent.insertAfter(newCellGroup, oldCellGroup);
34811
+ oldCellGroup.parent.removeChild(oldCellGroup);
34812
+ if (table.scenegraph?.proxy.cellCache.get(col)) {
34813
+ table.scenegraph?.proxy.cellCache.set(col, newCellGroup);
34814
+ }
34815
+ }
34816
+ return newCellGroup;
34817
+ }
34818
+ function canUseFastUpdate(col, row, oldCellGroup, autoWrapText, table) {
34819
+ const define = table.getBodyColumnDefine(col, row);
34820
+ const mayHaveIcon = !!define?.icon || !!define?.tree;
34821
+ const cellType = table.getBodyColumnType(col, row);
34822
+ const autoRowHeight = table.heightMode === 'autoHeight';
34823
+ const value = table.getCellValue(col, row);
34824
+ if (!table.isHeader(col, row) &&
34825
+ oldCellGroup.role === 'cell' &&
34826
+ cellType === 'text' &&
34827
+ !autoWrapText &&
34828
+ !autoRowHeight &&
34829
+ !mayHaveIcon &&
34830
+ oldCellGroup.firstChild?.type === 'text' &&
34831
+ !isPromise(value)) {
34832
+ return true;
34833
+ }
34834
+ return false;
34835
+ }
34836
+
34837
+ function createComplexColumn(columnGroup, col, colWidth, rowStart, rowEnd, mergeMap, defaultRowHeight, table, cellLocation, rowLimit) {
34838
+ let padding;
34839
+ let textAlign;
34840
+ let textBaseline;
34841
+ let y = 0;
34842
+ if (columnGroup.lastChild && columnGroup.lastChild.row === rowStart - 1) {
34843
+ y = columnGroup.lastChild.attribute.y + columnGroup.lastChild.attribute.height;
34844
+ }
34845
+ else if (columnGroup.colHeight) {
34846
+ y = columnGroup.colHeight;
34847
+ }
34848
+ for (let j = rowStart; j <= rowEnd; j++) {
34849
+ const row = j;
34850
+ let value = table.getCellValue(col, row);
34851
+ let cellWidth = colWidth;
34852
+ let cellHeight = table.getRowHeight(row);
34853
+ let range;
34854
+ let isMerge;
34855
+ let customStyle;
34856
+ let customResult;
34857
+ if (table.internalProps.customMergeCell) {
34858
+ const customMerge = table.getCustomMerge(col, row);
34859
+ if (customMerge) {
34860
+ const { range: customMergeRange, text: customMergeText, style: customMergeStyle, customLayout, customRender } = customMerge;
34861
+ range = customMergeRange;
34862
+ isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
34863
+ if (isMerge) {
34864
+ const mergeSize = dealMerge(range, mergeMap, table);
34865
+ cellWidth = mergeSize.cellWidth;
34866
+ cellHeight = mergeSize.cellHeight;
34867
+ }
34868
+ value = customMergeText;
34869
+ customStyle = customMergeStyle;
34870
+ if (customLayout || customRender) {
34871
+ customResult = dealWithCustom(customLayout, customRender, customMergeRange.start.col, customMergeRange.start.row, table.getColsWidth(customMergeRange.start.col, customMergeRange.end.col), table.getRowsHeight(customMergeRange.start.row, customMergeRange.end.row), false, table.heightMode === 'autoHeight', [0, 0, 0, 0], table);
34872
+ }
34873
+ }
34874
+ }
34875
+ let colForDefine = col;
34876
+ let rowForDefine = row;
34877
+ if (range) {
34878
+ colForDefine = range.start.col;
34879
+ rowForDefine = range.start.row;
34880
+ }
34881
+ const define = cellLocation !== 'body'
34882
+ ? table.getHeaderDefine(colForDefine, rowForDefine)
34883
+ : table.getBodyColumnDefine(colForDefine, rowForDefine);
34884
+ const mayHaveIcon = cellLocation !== 'body' ? true : !!define?.icon || !!define?.tree;
34885
+ if (!range && (cellLocation !== 'body' || define?.mergeCell)) {
34886
+ range = table.getCellRange(col, row);
35035
34887
  isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
35036
- value = customMergeText;
35037
- customStyle = customMergeStyle;
35038
- if (customStyle) {
35039
- cellTheme = getStyleTheme(customStyle, table, range.start.col, range.start.row, getProp).theme;
35040
- cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table);
34888
+ if (isMerge) {
34889
+ const mergeSize = dealMerge(range, mergeMap, table);
34890
+ cellWidth = mergeSize.cellWidth;
34891
+ cellHeight = mergeSize.cellHeight;
35041
34892
  }
35042
34893
  }
34894
+ const cellStyle = customStyle || table._getCellStyle(col, row);
34895
+ const cellTheme = getStyleTheme(cellStyle, table, range ? range.start.col : col, range ? range.start.row : row, getProp).theme;
34896
+ cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table);
34897
+ cellTheme.group.width = colWidth;
34898
+ cellTheme.group.height = Array.isArray(defaultRowHeight) ? defaultRowHeight[row] : defaultRowHeight;
34899
+ if (cellTheme._vtable.padding) {
34900
+ padding = cellTheme._vtable.padding;
34901
+ }
34902
+ if (cellTheme.text.textAlign) {
34903
+ textAlign = cellTheme.text.textAlign;
34904
+ }
34905
+ if (cellTheme.text.textBaseline) {
34906
+ textBaseline = cellTheme.text.textBaseline;
34907
+ }
34908
+ if (cellLocation !== 'body' && !cellTheme.group.fill) {
34909
+ cellTheme.group.fill = '#fff';
34910
+ }
34911
+ const type = (table.isHeader(col, row) ? table._getHeaderLayoutMap(col, row).headerType : table.getBodyColumnType(col, row)) ||
34912
+ 'text';
34913
+ if (isPromise(value)) {
34914
+ dealPromiseData(value, table, createCell.bind(null, type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult));
34915
+ columnGroup.updateColumnRowNumber(row);
34916
+ const height = table.getRowHeight(row);
34917
+ columnGroup.updateColumnHeight(height);
34918
+ y += height;
34919
+ }
34920
+ else {
34921
+ const cellGroup = createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult);
34922
+ columnGroup.updateColumnRowNumber(row);
34923
+ if (isMerge) {
34924
+ const rangeHeight = table.getRowHeight(row);
34925
+ const rangeWidth = table.getColWidth(col);
34926
+ const { width: contentWidth } = cellGroup.attribute;
34927
+ const { height: contentHeight } = cellGroup.attribute;
34928
+ cellGroup.contentWidth = contentWidth;
34929
+ cellGroup.contentHeight = contentHeight;
34930
+ resizeCellGroup(cellGroup, rangeWidth, rangeHeight, range, table);
34931
+ columnGroup.updateColumnHeight(rangeHeight);
34932
+ y += rangeHeight;
34933
+ }
34934
+ else {
34935
+ columnGroup.updateColumnHeight(cellGroup.attribute.height);
34936
+ y += cellGroup.attribute.height;
34937
+ }
34938
+ }
34939
+ if (rowLimit && row > rowLimit) {
34940
+ break;
34941
+ }
34942
+ }
34943
+ columnGroup.setAttribute('width', colWidth);
34944
+ return {
34945
+ width: colWidth,
34946
+ height: y
34947
+ };
34948
+ }
34949
+ function resizeCellGroup(cellGroup, rangeWidth, rangeHeight, range, table) {
34950
+ const { col, row } = cellGroup;
34951
+ const dx = -table.getColsWidth(range.start.col, col - 1);
34952
+ const dy = -table.getRowsHeight(range.start.row, row - 1);
34953
+ cellGroup.forEachChildren((child) => {
34954
+ child.setAttributes({
34955
+ dx: (child.attribute.dx ?? 0) + dx,
34956
+ dy: (child.attribute.dy ?? 0) + dy
34957
+ });
34958
+ });
34959
+ const lineWidth = cellGroup.attribute.lineWidth;
34960
+ const isLineWidthArray = isArray$1(lineWidth);
34961
+ const newLineWidth = [0, 0, 0, 0];
34962
+ if (col === range.start.col) {
34963
+ newLineWidth[3] = isLineWidthArray ? lineWidth[3] : lineWidth;
34964
+ }
34965
+ if (row === range.start.row) {
34966
+ newLineWidth[0] = isLineWidthArray ? lineWidth[0] : lineWidth;
34967
+ }
34968
+ if (col === range.end.col) {
34969
+ newLineWidth[1] = isLineWidthArray ? lineWidth[1] : lineWidth;
34970
+ }
34971
+ if (row === range.end.row) {
34972
+ newLineWidth[2] = isLineWidthArray ? lineWidth[2] : lineWidth;
34973
+ }
34974
+ const widthChange = rangeWidth !== cellGroup.attribute.width;
34975
+ const heightChange = rangeHeight !== cellGroup.attribute.height;
34976
+ cellGroup.setAttributes({
34977
+ width: rangeWidth,
34978
+ height: rangeHeight,
34979
+ strokeArrayWidth: newLineWidth
34980
+ });
34981
+ cellGroup.mergeStartCol = range.start.col;
34982
+ cellGroup.mergeStartRow = range.start.row;
34983
+ cellGroup.mergeEndCol = range.end.col;
34984
+ cellGroup.mergeEndRow = range.end.row;
34985
+ return {
34986
+ widthChange,
34987
+ heightChange
34988
+ };
34989
+ }
34990
+ function dealMerge(range, mergeMap, table) {
34991
+ let cellWidth = 0;
34992
+ let cellHeight = 0;
34993
+ const mergeResult = mergeMap.get(`${range.start.col},${range.start.row};${range.end.col},${range.end.row}`);
34994
+ if (!mergeResult) {
34995
+ for (let col = range.start.col; col <= range.end.col; col++) {
34996
+ cellWidth += table.getColWidth(col);
34997
+ }
34998
+ for (let i = range.start.row; i <= range.end.row; i++) {
34999
+ cellHeight += table.getRowHeight(i);
35000
+ }
35001
+ mergeMap.set(`${range.start.col},${range.start.row};${range.end.col},${range.end.row}`, {
35002
+ cellWidth,
35003
+ cellHeight
35004
+ });
35005
+ }
35006
+ else {
35007
+ cellWidth = mergeResult.cellWidth;
35008
+ cellHeight = mergeResult.cellHeight;
35009
+ }
35010
+ return {
35011
+ cellWidth,
35012
+ cellHeight
35013
+ };
35014
+ }
35015
+
35016
+ function dealWithCustom(customLayout, customRender, col, row, width, height, autoWidth, autoHeight, padding, table) {
35017
+ let renderDefault = true;
35018
+ let enableCellPadding = false;
35019
+ let expectedWidth;
35020
+ let expectedHeight;
35021
+ let customElements;
35022
+ let elementsGroup;
35023
+ if (typeof customLayout === 'function') {
35024
+ const arg = {
35025
+ col,
35026
+ row,
35027
+ dataValue: table.getCellOriginValue(col, row),
35028
+ value: table.getCellValue(col, row) || '',
35029
+ rect: {
35030
+ left: 0,
35031
+ top: 0,
35032
+ right: width,
35033
+ bottom: height,
35034
+ width,
35035
+ height
35036
+ },
35037
+ table
35038
+ };
35039
+ const customRenderObj = customLayout(arg);
35040
+ if (customRenderObj.rootContainer) {
35041
+ customRenderObj.rootContainer = decodeReactDom(customRenderObj.rootContainer);
35042
+ }
35043
+ if (customRenderObj.rootContainer instanceof Group$2) {
35044
+ elementsGroup = customRenderObj.rootContainer;
35045
+ elementsGroup.name = 'custom-container';
35046
+ }
35047
+ renderDefault = customRenderObj.renderDefault;
35048
+ enableCellPadding = customRenderObj.enableCellPadding;
35049
+ }
35050
+ else if (typeof customRender === 'function') {
35051
+ const arg = {
35052
+ col,
35053
+ row,
35054
+ dataValue: table.getCellOriginValue(col, row),
35055
+ value: table.getCellValue(col, row) || '',
35056
+ rect: {
35057
+ left: 0,
35058
+ top: 0,
35059
+ right: width,
35060
+ bottom: height,
35061
+ width,
35062
+ height
35063
+ },
35064
+ table
35065
+ };
35066
+ const customRenderObj = customRender(arg);
35067
+ if (customRenderObj) {
35068
+ customElements = customRenderObj.elements;
35069
+ renderDefault = customRenderObj.renderDefault;
35070
+ expectedWidth = customRenderObj.expectedWidth;
35071
+ expectedHeight = customRenderObj.expectedHeight;
35072
+ }
35073
+ }
35074
+ else if (customRender) {
35075
+ expectedWidth = customRender.expectedWidth;
35076
+ expectedHeight = customRender.expectedHeight;
35077
+ customElements = customRender.elements;
35078
+ renderDefault = customRender.renderDefault;
35079
+ }
35080
+ if (customElements) {
35081
+ const value = table.getCellValue(col, row);
35082
+ elementsGroup = adjustElementToGroup(customElements, autoWidth ? expectedWidth : width, autoHeight ? expectedHeight : height, value);
35083
+ }
35084
+ if (enableCellPadding) {
35085
+ elementsGroup.setAttributes({
35086
+ x: padding[3],
35087
+ y: padding[0],
35088
+ width: width - padding[1] - padding[3],
35089
+ height: height - padding[0] - padding[2]
35090
+ });
35091
+ }
35092
+ dealPercentCalc(elementsGroup, width, height);
35093
+ return {
35094
+ elementsGroup,
35095
+ renderDefault
35096
+ };
35097
+ }
35098
+ function adjustElementToGroup(elements, width, height, value) {
35099
+ const customGroup = new Group$2({
35100
+ x: 0,
35101
+ y: 0,
35102
+ width,
35103
+ height,
35104
+ fill: false,
35105
+ stroke: false,
35106
+ pickable: false
35107
+ });
35108
+ customGroup.name = 'custom-container';
35109
+ const elementsAdjusted = adjustElementsPos(elements, width, height, value);
35110
+ elementsAdjusted.forEach(element => {
35111
+ if (element.clickable) {
35112
+ element.pickable = element.clickable;
35113
+ }
35114
+ switch (element.type) {
35115
+ case 'arc':
35116
+ const arc = createArc({
35117
+ x: element.x,
35118
+ y: element.y,
35119
+ dx: (element.dx ?? 0),
35120
+ dy: (element.dy ?? 0),
35121
+ fill: element.fill,
35122
+ stroke: element.stroke,
35123
+ outerRadius: element.radius,
35124
+ startAngle: element.startAngle,
35125
+ endAngle: element.endAngle,
35126
+ pickable: !!element.pickable,
35127
+ cursor: element.cursor
35128
+ });
35129
+ customGroup.appendChild(arc);
35130
+ break;
35131
+ case 'text':
35132
+ if (element.background) {
35133
+ const expandX = element.background?.expandX ?? 0;
35134
+ const expandY = element.background?.expandY ?? 0;
35135
+ const textBackRect = createRect({
35136
+ x: element.x - expandX,
35137
+ y: element.y - expandY,
35138
+ dx: (element.dx ?? 0),
35139
+ dy: (element.dy ?? 0),
35140
+ width: element.width + expandX * 2,
35141
+ height: element.height + expandY * 2,
35142
+ cornerRadius: element.background?.cornerRadius ?? 0,
35143
+ fill: element.background?.fill ?? '#888'
35144
+ });
35145
+ customGroup.appendChild(textBackRect);
35146
+ }
35147
+ const text = new Text$1(Object.assign({
35148
+ pickable: !!element.pickable,
35149
+ fill: element.color ?? element.fill
35150
+ }, element));
35151
+ customGroup.appendChild(text);
35152
+ break;
35153
+ case 'rect':
35154
+ const rect = createRect({
35155
+ x: element.x,
35156
+ y: element.y,
35157
+ dx: (element.dx ?? 0),
35158
+ dy: (element.dy ?? 0),
35159
+ width: element.width,
35160
+ height: element.height,
35161
+ cornerRadius: element.radius,
35162
+ fill: element.fill,
35163
+ stroke: element.stroke,
35164
+ pickable: !!element.pickable,
35165
+ cursor: element.cursor
35166
+ });
35167
+ customGroup.appendChild(rect);
35168
+ break;
35169
+ case 'circle':
35170
+ const circle = createCircle({
35171
+ x: element.x,
35172
+ y: element.y,
35173
+ dx: (element.dx ?? 0),
35174
+ dy: (element.dy ?? 0),
35175
+ radius: element.radius,
35176
+ fill: element.fill,
35177
+ stroke: element.stroke,
35178
+ pickable: !!element.pickable,
35179
+ cursor: element.cursor
35180
+ });
35181
+ customGroup.appendChild(circle);
35182
+ break;
35183
+ case 'icon':
35184
+ const icon = new Icon$1({
35185
+ x: element.x,
35186
+ y: element.y,
35187
+ dx: (element.dx ?? 0),
35188
+ dy: (element.dy ?? 0),
35189
+ width: element.width,
35190
+ height: element.height,
35191
+ image: element.svg,
35192
+ backgroundWidth: element.hover ? (element.hover.width ?? element.width) : undefined,
35193
+ backgroundHeight: element.hover ? (element.hover.width ?? element.width) : undefined,
35194
+ backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,
35195
+ pickable: !!element.pickable,
35196
+ cursor: element.cursor
35197
+ });
35198
+ icon.role = 'icon-custom';
35199
+ customGroup.appendChild(icon);
35200
+ break;
35201
+ case 'image':
35202
+ const image = new Icon$1({
35203
+ x: element.x,
35204
+ y: element.y,
35205
+ dx: (element.dx ?? 0),
35206
+ dy: (element.dy ?? 0),
35207
+ width: element.width,
35208
+ height: element.height,
35209
+ image: element.src,
35210
+ backgroundWidth: element.hover ? (element.hover.width ?? element.width) : undefined,
35211
+ backgroundHeight: element.hover ? (element.hover.width ?? element.width) : undefined,
35212
+ backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,
35213
+ pickable: !!element.pickable,
35214
+ cursor: element.cursor,
35215
+ shape: element.shape
35216
+ });
35217
+ image.role = 'image-custom';
35218
+ customGroup.appendChild(image);
35219
+ break;
35220
+ case 'line':
35221
+ const line = createLine({
35222
+ points: element.points,
35223
+ stroke: element.stroke,
35224
+ pickable: !!element.pickable,
35225
+ cursor: element.cursor
35226
+ });
35227
+ customGroup.appendChild(line);
35228
+ break;
35229
+ }
35230
+ });
35231
+ return customGroup;
35232
+ }
35233
+ function adjustElementsPos(originalElements, width, height, value) {
35234
+ const result = [];
35235
+ const left = 0;
35236
+ const top = 0;
35237
+ const borderLineWidths = [0, 0, 0, 0];
35238
+ for (let i = 0; i < originalElements.length; i++) {
35239
+ const originalElement = originalElements[i];
35240
+ const element = Object.assign({}, originalElement);
35241
+ for (const name in element) {
35242
+ if (element.hasOwnProperty(name) && isFunction$1(element[name])) {
35243
+ element[name] = element[name](value);
35244
+ }
35245
+ }
35246
+ const rect = element;
35247
+ if (isValid$1(rect.x)) {
35248
+ rect.x = isString$2(rect.x)
35249
+ ? transformString(rect.x, width - borderLineWidths[1])
35250
+ : Number(rect.x);
35251
+ }
35252
+ if (isValid$1(rect.y)) {
35253
+ rect.y = isString$2(rect.y)
35254
+ ? transformString(rect.y, height - borderLineWidths[2])
35255
+ : Number(rect.y);
35256
+ }
35257
+ if ('width' in element) {
35258
+ element.width = isString$2(element.width)
35259
+ ? transformString(element.width, width - borderLineWidths[1])
35260
+ : Number(element.width);
35261
+ }
35262
+ if ('height' in element) {
35263
+ element.height = isString$2(element.height)
35264
+ ? transformString(element.height, height - borderLineWidths[2])
35265
+ : Number(element.height);
35266
+ }
35267
+ if ('radius' in element) {
35268
+ element.radius = isString$2(element.radius)
35269
+ ? transformString(element.radius, Math.min(width - borderLineWidths[1], height - borderLineWidths[2]))
35270
+ : Number(element.radius);
35271
+ }
35272
+ if ('hover' in element) {
35273
+ element.hover.x = isString$2(element.hover.x)
35274
+ ? transformString(element.hover.x, width - borderLineWidths[1])
35275
+ : Number(element.hover.x);
35276
+ element.hover.y = isString$2(element.hover.y)
35277
+ ? transformString(element.hover.y, height - borderLineWidths[2])
35278
+ : Number(element.hover.y);
35279
+ element.hover.width = isString$2(element.hover.width)
35280
+ ? transformString(element.hover.width, width - borderLineWidths[1])
35281
+ : Number(element.hover.width);
35282
+ element.hover.height = isString$2(element.hover.height)
35283
+ ? transformString(element.hover.height, height - borderLineWidths[2])
35284
+ : Number(element.hover.height);
35285
+ element.hover.x += left;
35286
+ element.hover.y += top;
35287
+ }
35288
+ rect.x = rect.x + left;
35289
+ rect.y = rect.y + top;
35290
+ result.push(element);
35043
35291
  }
35044
- let newCellGroup;
35045
- const mayHaveIcon = cellLocation !== 'body' ? true : !!define?.icon || !!define?.tree;
35046
- const padding = cellTheme._vtable.padding;
35047
- const textAlign = cellTheme._vtable.textAlign;
35048
- const textBaseline = cellTheme._vtable.textBaseline;
35049
- let bgColorFunc;
35050
- if (table.internalProps?.dataConfig?.mappingRules && !table.isHeader(col, row)) {
35051
- table.internalProps?.dataConfig?.mappingRules?.forEach((mappingRule, i) => {
35052
- if (mappingRule.bgColor &&
35053
- table.internalProps.layoutMap.getIndicatorKey(col, row) ===
35054
- mappingRule.bgColor.indicatorKey) {
35055
- bgColorFunc = mappingRule.bgColor.mapping;
35056
- }
35057
- });
35058
- }
35059
- if (cellLocation !== 'body') {
35060
- define?.headerCustomRender;
35061
- define?.headerCustomLayout;
35062
- }
35063
- else {
35064
- define?.customRender || table.customRender;
35065
- define?.customLayout;
35066
- }
35067
- let cellWidth;
35068
- let cellHeight;
35069
- if (range) {
35070
- cellWidth = table.getColsWidth(range.start.col, range.end.col);
35071
- cellHeight = table.getRowsHeight(range.start.row, range.end.row);
35072
- }
35073
- else {
35074
- cellWidth = table.getColWidth(col);
35075
- cellHeight = table.getRowHeight(row);
35076
- }
35077
- if (isPromise(value)) {
35078
- oldCellGroup.removeAllChild();
35079
- dealPromiseData(value, table, updateCellContent.bind(null, type, value, define, table, col, row, bgColorFunc, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme));
35292
+ return result;
35293
+ }
35294
+ function transformString(str, size) {
35295
+ if (str.endsWith('px')) {
35296
+ return parseInt(str, 10);
35080
35297
  }
35081
- else {
35082
- newCellGroup = updateCellContent(type, value, define, table, col, row, bgColorFunc, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme);
35298
+ else if (str.endsWith('%') && size) {
35299
+ return (parseInt(str, 10) / 100) * size;
35083
35300
  }
35084
- if (isMerge) {
35085
- const rangeHeight = table.getRowHeight(row);
35086
- const rangeWidth = table.getColWidth(col);
35087
- const { width: contentWidth } = newCellGroup.attribute;
35088
- const { height: contentHeight } = newCellGroup.attribute;
35089
- newCellGroup.contentWidth = contentWidth;
35090
- newCellGroup.contentHeight = contentHeight;
35091
- resizeCellGroup(newCellGroup, rangeWidth, rangeHeight, range, table);
35301
+ return parseInt(str, 10);
35302
+ }
35303
+ function dealPercentCalc(group, parentWidth, parentHeight) {
35304
+ if (!group) {
35305
+ return;
35092
35306
  }
35093
- return newCellGroup;
35307
+ group.forEachChildren((child) => {
35308
+ if (!child) {
35309
+ return;
35310
+ }
35311
+ if (isObject$4(child.attribute.width) && child.attribute.width.percent) {
35312
+ child.setAttribute('width', (child.attribute.width.percent / 100) * parentWidth +
35313
+ (child.attribute.width.delta ?? 0));
35314
+ }
35315
+ if (isObject$4(child.attribute.height) && child.attribute.height.percent) {
35316
+ child.setAttribute('height', (child.attribute.height.percent / 100) * parentHeight +
35317
+ (child.attribute.height.delta ?? 0));
35318
+ }
35319
+ if (child.type === 'group') {
35320
+ dealPercentCalc(child, child.attribute.width, child.attribute.height);
35321
+ }
35322
+ });
35094
35323
  }
35095
- function updateCellContent(type, value, define, table, col, row, bgColorFunc, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme) {
35096
- if (isPromise(value)) {
35097
- value = table.getCellValue(col, row);
35324
+ function decodeReactDom(dom) {
35325
+ if (!dom || !dom.$$typeof) {
35326
+ return dom;
35098
35327
  }
35099
- if (!addNew && (oldCellGroup.row !== row || oldCellGroup.col !== col)) {
35100
- return null;
35328
+ const type = dom.type;
35329
+ const { attribute, children, stateProxy } = dom.props;
35330
+ const g = type({ attribute });
35331
+ parseToGraphic(g, dom.props);
35332
+ if (stateProxy) {
35333
+ g.stateProxy = stateProxy;
35101
35334
  }
35102
- const newCellGroup = createCell(type, value, define, table, col, row, table.getColWidth(col), cellWidth, cellHeight, addNew ? table.scenegraph.getColGroup(col) : oldCellGroup.parent, addNew ? 0 : table.scenegraph.getCellGroupY(row), padding, textAlign, textBaseline, mayHaveIcon, cellTheme);
35103
- if (!addNew && oldCellGroup.parent) {
35104
- oldCellGroup.parent.insertAfter(newCellGroup, oldCellGroup);
35105
- oldCellGroup.parent.removeChild(oldCellGroup);
35106
- if (table.scenegraph?.proxy.cellCache.get(col)) {
35107
- table.scenegraph?.proxy.cellCache.set(col, newCellGroup);
35108
- }
35335
+ g.id = attribute.id;
35336
+ g.name = attribute.name;
35337
+ if (isArray$1(children)) {
35338
+ children.forEach((item) => {
35339
+ const c = decodeReactDom(item);
35340
+ c && c.type && g.add(c);
35341
+ });
35109
35342
  }
35110
- return newCellGroup;
35111
- }
35112
- function canUseFastUpdate(col, row, oldCellGroup, autoWrapText, table) {
35113
- const define = table.getBodyColumnDefine(col, row);
35114
- const mayHaveIcon = !!define?.icon || !!define?.tree;
35115
- const cellType = table.getBodyColumnType(col, row);
35116
- const autoRowHeight = table.heightMode === 'autoHeight';
35117
- const value = table.getCellValue(col, row);
35118
- if (!table.isHeader(col, row) &&
35119
- oldCellGroup.role === 'cell' &&
35120
- cellType === 'text' &&
35121
- !autoWrapText &&
35122
- !autoRowHeight &&
35123
- !mayHaveIcon &&
35124
- oldCellGroup.firstChild?.type === 'text' &&
35125
- !isPromise(value)) {
35126
- return true;
35343
+ else if (children) {
35344
+ g.add(decodeReactDom(children));
35127
35345
  }
35128
- return false;
35346
+ return g;
35129
35347
  }
35130
-
35131
- function createComplexColumn(columnGroup, col, colWidth, rowStart, rowEnd, mergeMap, defaultRowHeight, table, cellLocation, rowLimit) {
35132
- let padding;
35133
- let textAlign;
35134
- let textBaseline;
35135
- let y = 0;
35136
- if (columnGroup.lastChild && columnGroup.lastChild.row === rowStart - 1) {
35137
- y = columnGroup.lastChild.attribute.y + columnGroup.lastChild.attribute.height;
35348
+ function parseToGraphic(g, props) {
35349
+ let isGraphic = false;
35350
+ switch (g.type) {
35351
+ case 'richtext':
35352
+ break;
35353
+ case 'rich/image':
35354
+ break;
35355
+ default:
35356
+ isGraphic = true;
35138
35357
  }
35139
- else if (columnGroup.colHeight) {
35140
- y = columnGroup.colHeight;
35358
+ if (isGraphic) {
35359
+ Object.keys(props).forEach(k => {
35360
+ const en = REACT_TO_CANOPUS_EVENTS[k];
35361
+ if (en) {
35362
+ g.on(en, props[k]);
35363
+ }
35364
+ });
35141
35365
  }
35142
- for (let j = rowStart; j <= rowEnd; j++) {
35143
- const row = j;
35144
- const define = cellLocation !== 'body' ? table.getHeaderDefine(col, row) : table.getBodyColumnDefine(col, row);
35145
- const mayHaveIcon = cellLocation !== 'body' ? true : !!define?.icon || !!define?.tree;
35146
- let value = table.getCellValue(col, row);
35147
- let cellWidth = colWidth;
35148
- let cellHeight = table.getRowHeight(row);
35149
- let range;
35150
- let isMerge;
35151
- let customStyle;
35152
- if (table.internalProps.customMergeCell) {
35153
- const customMerge = table.getCustomMerge(col, row);
35154
- if (customMerge) {
35155
- const { range: customMergeRange, text: customMergeText, style: customMergeStyle } = customMerge;
35156
- range = customMergeRange;
35157
- isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
35158
- if (isMerge) {
35159
- const mergeSize = dealMerge(range, mergeMap, table);
35160
- cellWidth = mergeSize.cellWidth;
35161
- cellHeight = mergeSize.cellHeight;
35366
+ }
35367
+ function getCustomCellMergeCustom(col, row, cellGroup, table) {
35368
+ if (table.internalProps.customMergeCell) {
35369
+ const customMerge = table.getCustomMerge(col, row);
35370
+ if (customMerge) {
35371
+ const { range: customMergeRange, text: customMergeText, style: customMergeStyle, customLayout: customMergeLayout, customRender: customMergeRender } = customMerge;
35372
+ if (customMergeLayout || customMergeRender) {
35373
+ const customResult = dealWithCustom(customMergeLayout, customMergeRender, customMergeRange.start.col, customMergeRange.start.row, table.getColsWidth(customMergeRange.start.col, customMergeRange.end.col), table.getRowsHeight(customMergeRange.start.row, customMergeRange.end.row), false, table.heightMode === 'autoHeight', [0, 0, 0, 0], table);
35374
+ const customElementsGroup = customResult.elementsGroup;
35375
+ if (cellGroup.childrenCount > 0 && customElementsGroup) {
35376
+ cellGroup.insertBefore(customElementsGroup, cellGroup.firstChild);
35377
+ }
35378
+ else if (customElementsGroup) {
35379
+ cellGroup.appendChild(customElementsGroup);
35162
35380
  }
35163
- value = customMergeText;
35164
- customStyle = customMergeStyle;
35165
- }
35166
- }
35167
- if (!range && (cellLocation !== 'body' || define?.mergeCell)) {
35168
- range = table.getCellRange(col, row);
35169
- isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
35170
- if (isMerge) {
35171
- const mergeSize = dealMerge(range, mergeMap, table);
35172
- cellWidth = mergeSize.cellWidth;
35173
- cellHeight = mergeSize.cellHeight;
35174
- }
35175
- }
35176
- const cellStyle = customStyle || table._getCellStyle(col, row);
35177
- const cellTheme = getStyleTheme(cellStyle, table, range ? range.start.col : col, range ? range.start.row : row, getProp).theme;
35178
- cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table);
35179
- cellTheme.group.width = colWidth;
35180
- cellTheme.group.height = Array.isArray(defaultRowHeight) ? defaultRowHeight[row] : defaultRowHeight;
35181
- if (cellTheme._vtable.padding) {
35182
- padding = cellTheme._vtable.padding;
35183
- }
35184
- if (cellTheme.text.textAlign) {
35185
- textAlign = cellTheme.text.textAlign;
35186
- }
35187
- if (cellTheme.text.textBaseline) {
35188
- textBaseline = cellTheme.text.textBaseline;
35189
- }
35190
- if (cellLocation !== 'body' && !cellTheme.group.fill) {
35191
- cellTheme.group.fill = '#fff';
35192
- }
35193
- const type = (table.isHeader(col, row) ? table._getHeaderLayoutMap(col, row).headerType : table.getBodyColumnType(col, row)) ||
35194
- 'text';
35195
- if (isPromise(value)) {
35196
- dealPromiseData(value, table, createCell.bind(null, type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme));
35197
- columnGroup.updateColumnRowNumber(row);
35198
- const height = table.getRowHeight(row);
35199
- columnGroup.updateColumnHeight(height);
35200
- y += height;
35201
- }
35202
- else {
35203
- const cellGroup = createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme);
35204
- columnGroup.updateColumnRowNumber(row);
35205
- if (isMerge) {
35206
35381
  const rangeHeight = table.getRowHeight(row);
35207
35382
  const rangeWidth = table.getColWidth(col);
35208
35383
  const { width: contentWidth } = cellGroup.attribute;
35209
35384
  const { height: contentHeight } = cellGroup.attribute;
35210
35385
  cellGroup.contentWidth = contentWidth;
35211
35386
  cellGroup.contentHeight = contentHeight;
35212
- resizeCellGroup(cellGroup, rangeWidth, rangeHeight, range, table);
35213
- columnGroup.updateColumnHeight(rangeHeight);
35214
- y += rangeHeight;
35215
- }
35216
- else {
35217
- columnGroup.updateColumnHeight(cellGroup.attribute.height);
35218
- y += cellGroup.attribute.height;
35387
+ resizeCellGroup(cellGroup, rangeWidth, rangeHeight, customMergeRange, table);
35388
+ return customResult;
35219
35389
  }
35220
35390
  }
35221
- if (rowLimit && row > rowLimit) {
35222
- break;
35223
- }
35224
- }
35225
- columnGroup.setAttribute('width', colWidth);
35226
- return {
35227
- width: colWidth,
35228
- height: y
35229
- };
35230
- }
35231
- function resizeCellGroup(cellGroup, rangeWidth, rangeHeight, range, table) {
35232
- const { col, row } = cellGroup;
35233
- const dx = -table.getColsWidth(range.start.col, col - 1);
35234
- const dy = -table.getRowsHeight(range.start.row, row - 1);
35235
- cellGroup.forEachChildren((child) => {
35236
- child.setAttributes({
35237
- dx: (child.attribute.dx ?? 0) + dx,
35238
- dy: (child.attribute.dy ?? 0) + dy
35239
- });
35240
- });
35241
- const lineWidth = cellGroup.attribute.lineWidth;
35242
- const isLineWidthArray = isArray$1(lineWidth);
35243
- const newLineWidth = [0, 0, 0, 0];
35244
- if (col === range.start.col) {
35245
- newLineWidth[3] = isLineWidthArray ? lineWidth[3] : lineWidth;
35246
- }
35247
- if (row === range.start.row) {
35248
- newLineWidth[0] = isLineWidthArray ? lineWidth[0] : lineWidth;
35249
- }
35250
- if (col === range.end.col) {
35251
- newLineWidth[1] = isLineWidthArray ? lineWidth[1] : lineWidth;
35252
- }
35253
- if (row === range.end.row) {
35254
- newLineWidth[2] = isLineWidthArray ? lineWidth[2] : lineWidth;
35255
- }
35256
- const widthChange = rangeWidth !== cellGroup.attribute.width;
35257
- const heightChange = rangeHeight !== cellGroup.attribute.height;
35258
- cellGroup.setAttributes({
35259
- width: rangeWidth,
35260
- height: rangeHeight,
35261
- strokeArrayWidth: newLineWidth
35262
- });
35263
- cellGroup.mergeStartCol = range.start.col;
35264
- cellGroup.mergeStartRow = range.start.row;
35265
- cellGroup.mergeEndCol = range.end.col;
35266
- cellGroup.mergeEndRow = range.end.row;
35267
- return {
35268
- widthChange,
35269
- heightChange
35270
- };
35271
- }
35272
- function dealMerge(range, mergeMap, table) {
35273
- let cellWidth = 0;
35274
- let cellHeight = 0;
35275
- const mergeResult = mergeMap.get(`${range.start.col},${range.start.row};${range.end.col},${range.end.row}`);
35276
- if (!mergeResult) {
35277
- for (let col = range.start.col; col <= range.end.col; col++) {
35278
- cellWidth += table.getColWidth(col);
35279
- }
35280
- for (let i = range.start.row; i <= range.end.row; i++) {
35281
- cellHeight += table.getRowHeight(i);
35282
- }
35283
- mergeMap.set(`${range.start.col},${range.start.row};${range.end.col},${range.end.row}`, {
35284
- cellWidth,
35285
- cellHeight
35286
- });
35287
- }
35288
- else {
35289
- cellWidth = mergeResult.cellWidth;
35290
- cellHeight = mergeResult.cellHeight;
35291
35391
  }
35292
- return {
35293
- cellWidth,
35294
- cellHeight
35295
- };
35392
+ return undefined;
35296
35393
  }
35297
35394
 
35298
35395
  function isMergeCellGroup(cellGroup) {
@@ -35684,7 +35781,7 @@
35684
35781
  else if (col === layout.rowHeaderLevelCount - 1 &&
35685
35782
  row >= layout.columnHeaderLevelCount &&
35686
35783
  row < layout.rowCount - layout.bottomFrozenRowCount) {
35687
- let rowDimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, row)?.[0];
35784
+ let rowDimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, row);
35688
35785
  if (isArray$1(rowDimensionKey)) {
35689
35786
  rowDimensionKey = rowDimensionKey[0];
35690
35787
  }
@@ -35813,7 +35910,7 @@
35813
35910
  else if (row === layout.rowCount - layout.bottomFrozenRowCount &&
35814
35911
  col >= layout.rowHeaderLevelCount &&
35815
35912
  col < layout.colCount - layout.rightFrozenColCount) {
35816
- let columnDimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount)?.[0];
35913
+ let columnDimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount);
35817
35914
  if (isArray$1(columnDimensionKey)) {
35818
35915
  columnDimensionKey = columnDimensionKey[0];
35819
35916
  }
@@ -36778,6 +36875,9 @@
36778
36875
  }
36779
36876
  for (let col = 0; col < scene.table.colCount; col++) {
36780
36877
  const cell = scene.getCell(col, row);
36878
+ if (cell.role === 'empty') {
36879
+ continue;
36880
+ }
36781
36881
  const mergeInfo = getCellMergeInfo(scene.table, col, row);
36782
36882
  if (mergeInfo && mergeInfo.start.col !== col) {
36783
36883
  continue;
@@ -36854,31 +36954,33 @@
36854
36954
  let customElementsGroup;
36855
36955
  customContainer.removeAllChild();
36856
36956
  cell.removeChild(customContainer);
36857
- let customRender;
36858
- let customLayout;
36859
- const cellLocation = scene.table.getCellLocation(col, row);
36860
- if (cellLocation !== 'body') {
36861
- const define = scene.table.getHeaderDefine(col, row);
36862
- customRender = define?.headerCustomRender;
36863
- customLayout = define?.headerCustomLayout;
36864
- }
36865
- else {
36866
- const define = scene.table.getBodyColumnDefine(col, row);
36867
- customRender = define?.customRender || scene.table.customRender;
36868
- customLayout = define?.customLayout;
36869
- }
36870
- if (customLayout || customRender) {
36871
- const style = scene.table._getCellStyle(col, row);
36872
- const padding = getQuadProps(getProp('padding', style, col, row, scene.table));
36873
- const customResult = dealWithCustom(customLayout, customRender, col, row, cell.attribute.width, cell.attribute.height, false, scene.table.heightMode === 'autoHeight', padding, scene.table);
36874
- customElementsGroup = customResult.elementsGroup;
36875
- renderDefault = customResult.renderDefault;
36876
- }
36877
- if (cell.childrenCount > 0) {
36878
- cell.insertBefore(customElementsGroup, cell.firstChild);
36879
- }
36880
- else {
36881
- cell.appendChild(customElementsGroup);
36957
+ if (!getCustomCellMergeCustom(col, row, cell, scene.table)) {
36958
+ let customRender;
36959
+ let customLayout;
36960
+ const cellLocation = scene.table.getCellLocation(col, row);
36961
+ if (cellLocation !== 'body') {
36962
+ const define = scene.table.getHeaderDefine(col, row);
36963
+ customRender = define?.headerCustomRender;
36964
+ customLayout = define?.headerCustomLayout;
36965
+ }
36966
+ else {
36967
+ const define = scene.table.getBodyColumnDefine(col, row);
36968
+ customRender = define?.customRender || scene.table.customRender;
36969
+ customLayout = define?.customLayout;
36970
+ }
36971
+ if (customLayout || customRender) {
36972
+ const style = scene.table._getCellStyle(col, row);
36973
+ const padding = getQuadProps(getProp('padding', style, col, row, scene.table));
36974
+ const customResult = dealWithCustom(customLayout, customRender, col, row, cell.attribute.width, cell.attribute.height, false, scene.table.heightMode === 'autoHeight', padding, scene.table);
36975
+ customElementsGroup = customResult.elementsGroup;
36976
+ renderDefault = customResult.renderDefault;
36977
+ }
36978
+ if (cell.childrenCount > 0 && customElementsGroup) {
36979
+ cell.insertBefore(customElementsGroup, cell.firstChild);
36980
+ }
36981
+ else if (customElementsGroup) {
36982
+ cell.appendChild(customElementsGroup);
36983
+ }
36882
36984
  }
36883
36985
  }
36884
36986
  if (renderDefault) {
@@ -37068,6 +37170,30 @@
37068
37170
  newTotalHeight = y;
37069
37171
  }
37070
37172
  scene.updateContainerHeight(row, newTotalHeight - oldContainerHeight);
37173
+ for (let col = 0; col < scene.table.frozenColCount; col++) {
37174
+ const leftBottomFrozenColumnGroup = scene.getColGroupInLeftBottomCorner(col);
37175
+ let y = 0;
37176
+ leftBottomFrozenColumnGroup.forEachChildren((cellGroup) => {
37177
+ cellGroup.setAttribute('y', y);
37178
+ y += scene.table.getRowHeight(cellGroup.row);
37179
+ });
37180
+ }
37181
+ for (let col = scene.table.colCount - scene.table.rightFrozenColCount; col < scene.table.colCount; col++) {
37182
+ const rightBottomFrozenColumnGroup = scene.getColGroupInRightBottomCorner(col);
37183
+ let y = 0;
37184
+ rightBottomFrozenColumnGroup.forEachChildren((cellGroup) => {
37185
+ cellGroup.setAttribute('y', y);
37186
+ y += scene.table.getRowHeight(cellGroup.row);
37187
+ });
37188
+ }
37189
+ for (let col = scene.table.frozenColCount; col < scene.table.colCount - scene.table.rightFrozenColCount; col++) {
37190
+ const rightBottomFrozenColumnGroup = scene.getColGroupInBottom(col);
37191
+ let y = 0;
37192
+ rightBottomFrozenColumnGroup.forEachChildren((cellGroup) => {
37193
+ cellGroup.setAttribute('y', y);
37194
+ y += scene.table.getRowHeight(cellGroup.row);
37195
+ });
37196
+ }
37071
37197
  }
37072
37198
  }
37073
37199
  function updateCellWidth(scene, cell, col, row, oldWidth, distWidth, detaX, isHeader, autoRowHeight) {
@@ -37127,32 +37253,34 @@
37127
37253
  let customElementsGroup;
37128
37254
  customContainer.removeAllChild();
37129
37255
  cell.removeChild(customContainer);
37130
- let customRender;
37131
- let customLayout;
37132
- const cellType = scene.table.getCellLocation(col, row);
37133
- if (cellType !== 'body') {
37134
- const define = scene.table.getHeaderDefine(col, row);
37135
- customRender = define?.headerCustomRender;
37136
- customLayout = define?.headerCustomLayout;
37137
- }
37138
- else {
37139
- const define = scene.table.getBodyColumnDefine(col, row);
37140
- customRender = define?.customRender || scene.table.customRender;
37141
- customLayout = define?.customLayout;
37142
- }
37143
- if (customLayout || customRender) {
37144
- const style = scene.table._getCellStyle(col, row);
37145
- const padding = getQuadProps(getProp('padding', style, col, row, scene.table));
37146
- const customResult = dealWithCustom(customLayout, customRender, col, row, cellGroup.attribute.width, cellGroup.attribute.height, false, scene.table.heightMode === 'autoHeight', padding, scene.table);
37147
- customElementsGroup = customResult.elementsGroup;
37148
- renderDefault = customResult.renderDefault;
37149
- isHeightChange = true;
37150
- }
37151
- if (cell.childrenCount > 0) {
37152
- cell.insertBefore(customElementsGroup, cell.firstChild);
37153
- }
37154
- else {
37155
- cell.appendChild(customElementsGroup);
37256
+ if (!getCustomCellMergeCustom(col, row, cell, scene.table)) {
37257
+ let customRender;
37258
+ let customLayout;
37259
+ const cellType = scene.table.getCellLocation(col, row);
37260
+ if (cellType !== 'body') {
37261
+ const define = scene.table.getHeaderDefine(col, row);
37262
+ customRender = define?.headerCustomRender;
37263
+ customLayout = define?.headerCustomLayout;
37264
+ }
37265
+ else {
37266
+ const define = scene.table.getBodyColumnDefine(col, row);
37267
+ customRender = define?.customRender || scene.table.customRender;
37268
+ customLayout = define?.customLayout;
37269
+ }
37270
+ if (customLayout || customRender) {
37271
+ const style = scene.table._getCellStyle(col, row);
37272
+ const padding = getQuadProps(getProp('padding', style, col, row, scene.table));
37273
+ const customResult = dealWithCustom(customLayout, customRender, col, row, cellGroup.attribute.width, cellGroup.attribute.height, false, scene.table.heightMode === 'autoHeight', padding, scene.table);
37274
+ customElementsGroup = customResult.elementsGroup;
37275
+ renderDefault = customResult.renderDefault;
37276
+ isHeightChange = true;
37277
+ }
37278
+ if (cell.childrenCount > 0 && customElementsGroup) {
37279
+ cell.insertBefore(customElementsGroup, cell.firstChild);
37280
+ }
37281
+ else if (customElementsGroup) {
37282
+ cell.appendChild(customElementsGroup);
37283
+ }
37156
37284
  }
37157
37285
  }
37158
37286
  if (renderDefault) {
@@ -37505,7 +37633,7 @@
37505
37633
  }
37506
37634
  };
37507
37635
 
37508
- const regedIcons = get$2();
37636
+ const regedIcons = get$1();
37509
37637
  class DrillIcon {
37510
37638
  icon;
37511
37639
  constructor() {
@@ -38348,7 +38476,7 @@
38348
38476
  if (viewBox.y2 <= viewBox.y1) {
38349
38477
  viewBox.y2 = viewBox.y1 + 1;
38350
38478
  }
38351
- axes.forEach((axis, index) => {
38479
+ axes?.forEach((axis, index) => {
38352
38480
  if (axis.type === 'band') {
38353
38481
  chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
38354
38482
  }
@@ -40273,23 +40401,40 @@
40273
40401
  }
40274
40402
 
40275
40403
  async function sortVertical(proxy) {
40276
- for (let col = 0; col < proxy.table.frozenColCount; col++) {
40277
- const colGroup = proxy.table.scenegraph.getColGroup(col);
40278
- colGroup?.forEachChildren((cellGroup, index) => {
40279
- cellGroup.needUpdate = true;
40280
- });
40404
+ proxy.table.scenegraph.bodyGroup.forEachChildren((colGroup, index) => {
40405
+ if (colGroup.type === 'group') {
40406
+ colGroup.needUpdate = true;
40407
+ colGroup?.forEachChildren((cellGroup) => {
40408
+ cellGroup.needUpdate = true;
40409
+ });
40410
+ }
40411
+ });
40412
+ for (let col = 0; col < proxy.table.frozenColCount ?? 0; col++) {
40413
+ const columnGroup = proxy.table.scenegraph.getColGroup(col);
40414
+ columnGroup?.setAttribute('chartInstance', undefined);
40415
+ for (let row = proxy.rowStart; row <= proxy.rowEnd; row++) {
40416
+ proxy.table.scenegraph.updateCellContent(col, row);
40417
+ }
40418
+ for (let row = proxy.table.rowCount - proxy.table.bottomFrozenRowCount; row < proxy.table.rowCount; row++) {
40419
+ proxy.table.scenegraph.updateCellContent(col, row);
40420
+ }
40281
40421
  }
40282
- for (let col = proxy.table.colCount - proxy.table.rightFrozenColCount; col < proxy.table.colCount; col++) {
40283
- const colGroup = proxy.table.scenegraph.getColGroup(col);
40284
- colGroup?.forEachChildren((cellGroup, index) => {
40285
- cellGroup.needUpdate = true;
40286
- });
40422
+ for (let col = proxy.colStart; col <= proxy.colEnd; col++) {
40423
+ const columnGroup = proxy.table.scenegraph.getColGroup(col);
40424
+ columnGroup?.setAttribute('chartInstance', undefined);
40425
+ for (let row = proxy.table.rowCount - proxy.table.bottomFrozenRowCount; row < proxy.table.rowCount; row++) {
40426
+ proxy.table.scenegraph.updateCellContent(col, row);
40427
+ }
40287
40428
  }
40288
- for (let col = proxy.bodyLeftCol; col <= proxy.bodyRightCol; col++) {
40289
- const colGroup = proxy.table.scenegraph.getColGroup(col);
40290
- colGroup?.forEachChildren((cellGroup, index) => {
40291
- cellGroup.needUpdate = true;
40292
- });
40429
+ for (let col = proxy.table.colCount - proxy.table.rightFrozenColCount; col < proxy.table.colCount; col++) {
40430
+ const columnGroup = proxy.table.scenegraph.getColGroup(col);
40431
+ columnGroup?.setAttribute('chartInstance', undefined);
40432
+ for (let row = proxy.rowStart; row <= proxy.rowEnd; row++) {
40433
+ proxy.table.scenegraph.updateCellContent(col, row);
40434
+ }
40435
+ for (let row = proxy.table.rowCount - proxy.table.bottomFrozenRowCount; row < proxy.table.rowCount; row++) {
40436
+ proxy.table.scenegraph.updateCellContent(col, row);
40437
+ }
40293
40438
  }
40294
40439
  let syncTopRow;
40295
40440
  let syncBottomRow;
@@ -40315,14 +40460,6 @@
40315
40460
  }
40316
40461
 
40317
40462
  async function sortHorizontal(proxy) {
40318
- proxy.table.scenegraph.bottomFrozenGroup.forEachChildren((colGroup, index) => {
40319
- if (colGroup.type === 'group') {
40320
- colGroup.needUpdate = true;
40321
- colGroup?.forEachChildren((cellGroup) => {
40322
- cellGroup.needUpdate = true;
40323
- });
40324
- }
40325
- });
40326
40463
  proxy.table.scenegraph.bodyGroup.forEachChildren((colGroup, index) => {
40327
40464
  if (colGroup.type === 'group') {
40328
40465
  colGroup.needUpdate = true;
@@ -40331,6 +40468,23 @@
40331
40468
  });
40332
40469
  }
40333
40470
  });
40471
+ for (let col = proxy.colStart; col <= proxy.colEnd; col++) {
40472
+ const columnGroup = proxy.table.scenegraph.getColGroup(col);
40473
+ columnGroup?.setAttribute('chartInstance', undefined);
40474
+ for (let row = proxy.table.rowCount - proxy.table.bottomFrozenRowCount; row < proxy.table.rowCount; row++) {
40475
+ proxy.table.scenegraph.updateCellContent(col, row);
40476
+ }
40477
+ }
40478
+ for (let col = proxy.table.colCount - proxy.table.rightFrozenColCount; col < proxy.table.colCount; col++) {
40479
+ const columnGroup = proxy.table.scenegraph.getColGroup(col);
40480
+ columnGroup?.setAttribute('chartInstance', undefined);
40481
+ for (let row = proxy.rowStart; row <= proxy.rowEnd; row++) {
40482
+ proxy.table.scenegraph.updateCellContent(col, row);
40483
+ }
40484
+ for (let row = proxy.table.rowCount - proxy.table.bottomFrozenRowCount; row < proxy.table.rowCount; row++) {
40485
+ proxy.table.scenegraph.updateCellContent(col, row);
40486
+ }
40487
+ }
40334
40488
  const syncLeftCol = Math.max(proxy.bodyLeftCol, proxy.screenLeftCol - proxy.screenColCount * 1);
40335
40489
  const syncRightCol = Math.min(proxy.bodyRightCol, proxy.screenLeftCol + proxy.screenColCount * 2);
40336
40490
  computeColsWidth(proxy.table, syncLeftCol, syncRightCol);
@@ -40749,7 +40903,7 @@
40749
40903
  return getCellByCache(cacheCellGroup._next, row);
40750
40904
  }
40751
40905
 
40752
- function moveHeaderPosition(colSource, rowSource, colTarget, rowTarget, table) {
40906
+ function moveHeaderPosition(colSource, rowSource, colTarget, rowTarget, sourceMergeInfo, targetMergeInfo, table) {
40753
40907
  const scene = table.scenegraph;
40754
40908
  const cellLocation = table.getCellLocation(colTarget, rowTarget);
40755
40909
  const direction = cellLocation === 'columnHeader' ? 'column' : cellLocation === 'rowHeader' ? 'row' : undefined;
@@ -40762,8 +40916,6 @@
40762
40916
  let targetColEnd = 0;
40763
40917
  let targetRowEnd = 0;
40764
40918
  if (direction === 'column') {
40765
- const sourceMergeInfo = getCellMergeInfo(table, colSource, rowSource);
40766
- const targetMergeInfo = getCellMergeInfo(table, colTarget, rowTarget);
40767
40919
  if (sourceMergeInfo && targetMergeInfo) {
40768
40920
  sourceColStart = sourceMergeInfo.start.col;
40769
40921
  sourceColEnd = sourceMergeInfo.end.col;
@@ -40784,8 +40936,6 @@
40784
40936
  targetRowEnd = table.rowCount - 1;
40785
40937
  }
40786
40938
  else if (direction === 'row') {
40787
- const sourceMergeInfo = getCellMergeInfo(table, colSource, rowSource);
40788
- const targetMergeInfo = getCellMergeInfo(table, colTarget, rowTarget);
40789
40939
  if (sourceMergeInfo && targetMergeInfo) {
40790
40940
  sourceRowStart = sourceMergeInfo.start.row;
40791
40941
  sourceRowEnd = sourceMergeInfo.end.row;
@@ -43761,16 +43911,20 @@
43761
43911
  }
43762
43912
  }
43763
43913
  updateRowHeight(row, detaY, skipTableHeightMap) {
43764
- detaY = Math.round(detaY);
43765
- updateRowHeight(this, row, detaY, skipTableHeightMap);
43766
- this.updateContainerHeight(row, detaY);
43914
+ if (row >= this.proxy.rowStart && row <= this.proxy.rowEnd) {
43915
+ detaY = Math.round(detaY);
43916
+ updateRowHeight(this, row, detaY, skipTableHeightMap);
43917
+ this.updateContainerHeight(row, detaY);
43918
+ }
43767
43919
  }
43768
43920
  updateRowsHeight(rows, detaYs, skipTableHeightMap) {
43769
43921
  for (let i = 0; i < rows.length; i++) {
43770
43922
  const row = rows[i];
43771
- const detaY = detaYs[i];
43772
- updateRowHeight(this, row, Math.round(detaY), skipTableHeightMap);
43773
- this._updateContainerHeight(row, detaY);
43923
+ if (row >= this.proxy.rowStart && row <= this.proxy.rowEnd) {
43924
+ const detaY = detaYs[i];
43925
+ updateRowHeight(this, row, Math.round(detaY), skipTableHeightMap);
43926
+ this._updateContainerHeight(row, detaY);
43927
+ }
43774
43928
  }
43775
43929
  this.updateTableSize();
43776
43930
  this.component.updateScrollBar();
@@ -44039,8 +44193,8 @@
44039
44193
  });
44040
44194
  return isUpdate;
44041
44195
  }
44042
- updateHeaderPosition(colSource, rowSource, colTarget, rowTarget) {
44043
- moveHeaderPosition(colSource, rowSource, colTarget, rowTarget, this.table);
44196
+ updateHeaderPosition(colSource, rowSource, colTarget, rowTarget, sourceMergeInfo, targetMergeInfo) {
44197
+ moveHeaderPosition(colSource, rowSource, colTarget, rowTarget, sourceMergeInfo, targetMergeInfo, this.table);
44044
44198
  }
44045
44199
  updateContainerAttrWidthAndX() {
44046
44200
  const cornerX = updateContainerChildrenX(this.cornerHeaderGroup, 0);
@@ -44927,11 +45081,13 @@
44927
45081
  state.columnMove.rowSource >= 0 &&
44928
45082
  state.columnMove.colTarget >= 0 &&
44929
45083
  state.columnMove.rowTarget >= 0) {
45084
+ const sourceMergeInfo = getCellMergeInfo(state.table, state.columnMove.colSource, state.columnMove.rowSource);
45085
+ const targetMergeInfo = getCellMergeInfo(state.table, state.columnMove.colTarget, state.columnMove.rowTarget);
44930
45086
  const moveSuccess = state.table.moveHeaderPosition({ col: state.columnMove.colSource, row: state.columnMove.rowSource }, { col: state.columnMove.colTarget, row: state.columnMove.rowTarget });
44931
45087
  if (moveSuccess) {
44932
45088
  clearWidthsAndHeightsCache(state.columnMove.colSource, state.columnMove.rowSource, state.columnMove.colTarget, state.columnMove.rowTarget, state.table);
44933
45089
  state.table.clearCellStyleCache();
44934
- state.table.scenegraph.updateHeaderPosition(state.columnMove.colSource, state.columnMove.rowSource, state.columnMove.colTarget, state.columnMove.rowTarget);
45090
+ state.table.scenegraph.updateHeaderPosition(state.columnMove.colSource, state.columnMove.rowSource, state.columnMove.colTarget, state.columnMove.rowTarget, sourceMergeInfo, targetMergeInfo);
44935
45091
  }
44936
45092
  state.updateCursor();
44937
45093
  }
@@ -45583,7 +45739,7 @@
45583
45739
  const totalHeight = this.table.getAllRowsHeight();
45584
45740
  top = Math.max(0, Math.min(top, totalHeight - this.table.scenegraph.height));
45585
45741
  top = Math.ceil(top);
45586
- if (top !== this.scroll.verticalBarPos) {
45742
+ if (top !== this.scroll.verticalBarPos || this.table.isPivotChart()) {
45587
45743
  this.table.stateManager.updateHoverPos(-1, -1);
45588
45744
  }
45589
45745
  this.scroll.verticalBarPos = top;
@@ -47268,11 +47424,11 @@
47268
47424
  let dimensionKey;
47269
47425
  let dimensions;
47270
47426
  if (layout.indicatorsAsCol) {
47271
- dimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, row)[0];
47427
+ dimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, row);
47272
47428
  dimensions = layout.getCellHeaderPaths(layout.rowHeaderLevelCount - 2, row).rowHeaderPaths;
47273
47429
  }
47274
47430
  else {
47275
- dimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount)[0];
47431
+ dimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount);
47276
47432
  dimensions = layout.getCellHeaderPaths(col, layout.columnHeaderLevelCount - 1).colHeaderPaths;
47277
47433
  }
47278
47434
  const filter = dimensions
@@ -47821,7 +47977,7 @@
47821
47977
  _table;
47822
47978
  constructor(_table) {
47823
47979
  this._table = _table;
47824
- const regedIcons = get$2();
47980
+ const regedIcons = get$1();
47825
47981
  this.expandIcon = regedIcons[InternalIconName.expandIconName];
47826
47982
  this.collapseIcon = regedIcons[InternalIconName.collapseIconName];
47827
47983
  }
@@ -47843,7 +47999,7 @@
47843
47999
  else {
47844
48000
  iconResults = iconDefine;
47845
48001
  }
47846
- const regedIcons = get$2();
48002
+ const regedIcons = get$1();
47847
48003
  const addIcon = (columnIcon) => {
47848
48004
  let icon;
47849
48005
  if (typeof columnIcon === 'string') {
@@ -48588,7 +48744,7 @@
48588
48744
  _table;
48589
48745
  constructor(_table) {
48590
48746
  this._table = _table;
48591
- const regedIcons = get$2();
48747
+ const regedIcons = get$1();
48592
48748
  this.freezeIcon = regedIcons[InternalIconName.freezeIconName];
48593
48749
  this.frozenIcon = regedIcons[InternalIconName.frozenIconName];
48594
48750
  this.frozenCurrentIcon = regedIcons[InternalIconName.frozenCurrentIconName];
@@ -48673,7 +48829,7 @@
48673
48829
  else {
48674
48830
  headerIconStrs = headerIcon;
48675
48831
  }
48676
- const regedIcons = get$2();
48832
+ const regedIcons = get$1();
48677
48833
  const addIcon = (headerIcon) => {
48678
48834
  let icon;
48679
48835
  if (typeof headerIcon === 'string') {
@@ -50467,7 +50623,7 @@
50467
50623
  return TABLE_EVENT_TYPE;
50468
50624
  }
50469
50625
  options;
50470
- version = "0.18.0-alpha.2";
50626
+ version = "0.18.0";
50471
50627
  pagination;
50472
50628
  id = `VTable${Date.now()}`;
50473
50629
  headerStyleCache;
@@ -51997,7 +52153,7 @@
51997
52153
  getCustomMerge(col, row) {
51998
52154
  if (this.internalProps.customMergeCell) {
51999
52155
  const customMerge = this.internalProps.customMergeCell(col, row, this);
52000
- if (customMerge && customMerge.range && customMerge.text) {
52156
+ if (customMerge && customMerge.range && (customMerge.text || customMerge.customLayout || this.customRender)) {
52001
52157
  if (customMerge.style) {
52002
52158
  const styleClass = this.internalProps.bodyHelper.getStyleClass('text');
52003
52159
  const style = customMerge.style;
@@ -52126,12 +52282,16 @@
52126
52282
  }
52127
52283
  const hd = layoutMap.getHeader(col, row);
52128
52284
  let paddingForAxis;
52129
- if (this.isPivotChart() && isTopOrBottomAxis(col, row, layoutMap)) {
52285
+ if (this.isPivotChart() &&
52286
+ isTopOrBottomAxis(col, row, layoutMap) &&
52287
+ layoutMap.isAxisCell(col, row)) {
52130
52288
  const chartColumn = layoutMap.getBody(col, this.rowHeaderLevelCount);
52131
52289
  const padding = chartColumn.style?.padding ?? this.theme.bodyStyle.padding;
52132
52290
  paddingForAxis = padding;
52133
52291
  }
52134
- else if (this.isPivotChart() && isLeftOrRightAxis(col, row, layoutMap)) {
52292
+ else if (this.isPivotChart() &&
52293
+ isLeftOrRightAxis(col, row, layoutMap) &&
52294
+ layoutMap.isAxisCell(col, row)) {
52135
52295
  const chartColumn = layoutMap.getBody(this.columnHeaderLevelCount, row);
52136
52296
  const padding = chartColumn.style?.padding ?? this.theme.bodyStyle.padding;
52137
52297
  paddingForAxis = padding;
@@ -52937,6 +53097,62 @@
52937
53097
  const chartSpec = indicatorObj?.chartSpec;
52938
53098
  return chartSpec;
52939
53099
  }
53100
+ function checkHasCartesianChart(layout) {
53101
+ let isHasCartesianChart = false;
53102
+ for (let i = 0; i < layout.indicatorsDefine.length; i++) {
53103
+ const columnObj = layout.indicatorsDefine[i];
53104
+ if (columnObj.chartSpec) {
53105
+ if (columnObj.chartSpec.type !== 'pie' &&
53106
+ columnObj.chartSpec.type !== 'funnel' &&
53107
+ columnObj.chartSpec.type !== 'rose') {
53108
+ isHasCartesianChart = true;
53109
+ break;
53110
+ }
53111
+ }
53112
+ }
53113
+ return isHasCartesianChart;
53114
+ }
53115
+ function isCartesianChart(col, row, layout) {
53116
+ let isHasCartesianChart = true;
53117
+ const chartSpec = layout.getRawChartSpec(col, row);
53118
+ if (chartSpec) {
53119
+ if (chartSpec.type === 'pie' || chartSpec.type === 'funnel' || chartSpec.type === 'rose') {
53120
+ isHasCartesianChart = false;
53121
+ }
53122
+ }
53123
+ else {
53124
+ isHasCartesianChart = false;
53125
+ }
53126
+ return isHasCartesianChart;
53127
+ }
53128
+ function isHasCartesianChartInline(col, row, checkDirection, layout) {
53129
+ let isHasCartesianChart = false;
53130
+ if ((layout.indicatorsAsCol && checkDirection === 'row') || (!layout.indicatorsAsCol && checkDirection === 'col')) {
53131
+ for (let i = 0; i < layout.indicatorsDefine.length; i++) {
53132
+ const columnObj = layout.indicatorsDefine[i];
53133
+ if (columnObj.chartSpec) {
53134
+ if (columnObj.chartSpec.type !== 'pie' &&
53135
+ columnObj.chartSpec.type !== 'funnel' &&
53136
+ columnObj.chartSpec.type !== 'rose') {
53137
+ isHasCartesianChart = true;
53138
+ break;
53139
+ }
53140
+ }
53141
+ }
53142
+ }
53143
+ else {
53144
+ const chartSpec = layout.getRawChartSpec(col, row);
53145
+ if (chartSpec) {
53146
+ if (chartSpec.type !== 'pie' && chartSpec.type !== 'funnel' && chartSpec.type !== 'rose') {
53147
+ isHasCartesianChart = true;
53148
+ }
53149
+ }
53150
+ else {
53151
+ isHasCartesianChart = false;
53152
+ }
53153
+ }
53154
+ return isHasCartesianChart;
53155
+ }
52940
53156
  function getChartSpec(col, row, layout) {
52941
53157
  let chartSpec = layout.getRawChartSpec(col, row);
52942
53158
  if (chartSpec) {
@@ -52990,7 +53206,7 @@
52990
53206
  sync: { axisId: NO_AXISID_FRO_VTABLE }
52991
53207
  }));
52992
53208
  });
52993
- let rowDimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, row)?.[0];
53209
+ let rowDimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, row);
52994
53210
  if (isArray$1(rowDimensionKey)) {
52995
53211
  rowDimensionKey = rowDimensionKey[0];
52996
53212
  }
@@ -53046,7 +53262,7 @@
53046
53262
  sync: { axisId: NO_AXISID_FRO_VTABLE }
53047
53263
  }));
53048
53264
  });
53049
- let columnDimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount)[0];
53265
+ let columnDimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount);
53050
53266
  if (isArray$1(columnDimensionKey)) {
53051
53267
  columnDimensionKey = columnDimensionKey[0];
53052
53268
  }
@@ -54964,6 +55180,11 @@
54964
55180
  this.dataSource.addRecord(record, recordIndex);
54965
55181
  const oldRowCount = this.rowCount;
54966
55182
  this.refreshRowColCount();
55183
+ if (this.scenegraph.proxy.totalActualBodyRowCount === 0) {
55184
+ this.scenegraph.clearCells();
55185
+ this.scenegraph.createSceneGraph();
55186
+ return;
55187
+ }
54967
55188
  const newRowCount = this.transpose ? this.colCount : this.rowCount;
54968
55189
  if (this.pagination) {
54969
55190
  const { perPageCount, currentPage } = this.pagination;
@@ -55038,6 +55259,11 @@
55038
55259
  this.dataSource.addRecords(records, recordIndex);
55039
55260
  const oldRowCount = this.transpose ? this.colCount : this.rowCount;
55040
55261
  this.refreshRowColCount();
55262
+ if (this.scenegraph.proxy.totalActualBodyRowCount === 0) {
55263
+ this.scenegraph.clearCells();
55264
+ this.scenegraph.createSceneGraph();
55265
+ return;
55266
+ }
55041
55267
  const newRowCount = this.transpose ? this.colCount : this.rowCount;
55042
55268
  if (this.pagination) {
55043
55269
  const { perPageCount, currentPage } = this.pagination;
@@ -55168,6 +55394,70 @@
55168
55394
  }
55169
55395
  }
55170
55396
  }
55397
+ updateRecords(records, recordIndexs) {
55398
+ if (recordIndexs?.length > 0) {
55399
+ if (this.sortState) {
55400
+ this.dataSource.updateRecordsForSorted(records, recordIndexs);
55401
+ sortRecords(this);
55402
+ this.refreshRowColCount();
55403
+ this.scenegraph.clearCells();
55404
+ this.scenegraph.createSceneGraph();
55405
+ }
55406
+ else {
55407
+ const updateRecordIndexs = this.dataSource.updateRecords(records, recordIndexs);
55408
+ if (updateRecordIndexs.length === 0) {
55409
+ return;
55410
+ }
55411
+ const recordIndexsMinToMax = updateRecordIndexs.sort((a, b) => a - b);
55412
+ if (this.pagination) {
55413
+ const { perPageCount, currentPage } = this.pagination;
55414
+ const startIndex = perPageCount * (currentPage || 0);
55415
+ const endIndex = startIndex + perPageCount;
55416
+ const updateRows = [];
55417
+ for (let index = 0; index < recordIndexsMinToMax.length; index++) {
55418
+ const recordIndex = recordIndexsMinToMax[index];
55419
+ if (recordIndex < endIndex && recordIndex >= endIndex - perPageCount) {
55420
+ const rowNum = recordIndex -
55421
+ (endIndex - perPageCount) +
55422
+ (this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount);
55423
+ updateRows.push(rowNum);
55424
+ }
55425
+ }
55426
+ if (updateRows.length >= 1) {
55427
+ const updateRowCells = [];
55428
+ for (let index = 0; index < updateRows.length; index++) {
55429
+ const updateRow = updateRows[index];
55430
+ if (this.transpose) {
55431
+ updateRowCells.push({ col: updateRow, row: 0 });
55432
+ }
55433
+ else {
55434
+ updateRowCells.push({ col: 0, row: updateRow });
55435
+ }
55436
+ }
55437
+ this.transpose
55438
+ ? this.scenegraph.updateCol([], [], updateRowCells)
55439
+ : this.scenegraph.updateRow([], [], updateRowCells);
55440
+ }
55441
+ }
55442
+ else {
55443
+ const updateRows = [];
55444
+ for (let index = 0; index < recordIndexsMinToMax.length; index++) {
55445
+ const recordIndex = recordIndexsMinToMax[index];
55446
+ const rowNum = recordIndex + (this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount);
55447
+ if (this.transpose) {
55448
+ updateRows.push({ col: rowNum, row: 0 });
55449
+ }
55450
+ else {
55451
+ updateRows.push({ col: 0, row: rowNum });
55452
+ }
55453
+ }
55454
+ this.transpose
55455
+ ? this.scenegraph.updateCol([], [], updateRows)
55456
+ : this.scenegraph.updateRow([], [], updateRows);
55457
+ }
55458
+ }
55459
+ }
55460
+ }
55171
55461
  hasCustomRenderOrLayout() {
55172
55462
  const { headerObjects } = this.internalProps.layoutMap;
55173
55463
  if (this.options.customRender) {
@@ -55667,7 +55957,7 @@
55667
55957
  if (dataset) {
55668
55958
  this.rowTree = dataset.rowHeaderTree;
55669
55959
  this.columnTree = dataset.colHeaderTree;
55670
- if (this.indicatorsAsCol && this._table.isPivotChart()) {
55960
+ if (this.indicatorsAsCol && this._table.isPivotChart() && checkHasCartesianChart(this)) {
55671
55961
  const supplyAxisNode = (nodes) => {
55672
55962
  nodes.forEach((node) => {
55673
55963
  if (node.children?.length) {
@@ -55847,7 +56137,7 @@
55847
56137
  if (indicatorObject?.style?.padding) {
55848
56138
  this._chartPadding = indicatorObject.style.padding;
55849
56139
  }
55850
- if (indicatorObject.chartSpec?.barWidth) {
56140
+ if (indicatorObject.chartSpec?.barWidth && typeof indicatorObject.chartSpec.barWidth === 'number') {
55851
56141
  this._chartItemSpanSize = indicatorObject.chartSpec?.barWidth;
55852
56142
  }
55853
56143
  const bandAxisConfig = indicatorObject.chartSpec?.axes?.find((axis) => {
@@ -55864,7 +56154,7 @@
55864
56154
  return true;
55865
56155
  }
55866
56156
  indicatorObject.chartSpec.series?.find((seriesObject) => {
55867
- if (seriesObject.barWidth) {
56157
+ if (seriesObject.barWidth && typeof seriesObject.barWidth === 'number') {
55868
56158
  this._chartItemSpanSize = seriesObject.barWidth;
55869
56159
  }
55870
56160
  if (this._chartItemSpanSize > 0) {
@@ -56199,6 +56489,9 @@
56199
56489
  }
56200
56490
  return false;
56201
56491
  }
56492
+ isFrozen(col, row) {
56493
+ return (this.isFrozenColumn(col) || this.isRightFrozenColumn(col) || this.isBottomFrozenRow(row) || this.isFrozenRow(row));
56494
+ }
56202
56495
  isFrozenColumn(col, row) {
56203
56496
  if (isValid$1(row)) {
56204
56497
  if (col >= 0 &&
@@ -56347,7 +56640,10 @@
56347
56640
  if (this.columnHeaderTitle) {
56348
56641
  count += 1;
56349
56642
  }
56350
- if (this._table.isPivotChart() && this.indicatorsAsCol && !this.hasTwoIndicatorAxes) {
56643
+ if (this._table.isPivotChart() &&
56644
+ this.indicatorsAsCol &&
56645
+ !this.hasTwoIndicatorAxes &&
56646
+ checkHasCartesianChart(this)) {
56351
56647
  count -= 1;
56352
56648
  }
56353
56649
  this.columnHeaderLevelCount = count;
@@ -56420,7 +56716,7 @@
56420
56716
  }
56421
56717
  return 0;
56422
56718
  }
56423
- if (this.indicatorKeys.length >= 1) {
56719
+ if (this.indicatorKeys.length >= 1 && checkHasCartesianChart(this)) {
56424
56720
  const axisOption = this._table.pivotChartAxes.find(axisOption => {
56425
56721
  return axisOption.orient === 'bottom';
56426
56722
  });
@@ -57269,7 +57565,13 @@
57269
57565
  }
57270
57566
  }
57271
57567
  getAxisConfigInPivotChart(col, row) {
57272
- return getAxisConfigInPivotChart(col, row, this);
57568
+ if (((this.isFrozenColumn(col, row) || this.isRightFrozenColumn(col, row)) &&
57569
+ isHasCartesianChartInline(col, row, 'row', this)) ||
57570
+ ((this.isFrozenRow(col, row) || this.isBottomFrozenRow(col, row)) &&
57571
+ isHasCartesianChartInline(col, row, 'col', this))) {
57572
+ return getAxisConfigInPivotChart(col, row, this);
57573
+ }
57574
+ return undefined;
57273
57575
  }
57274
57576
  isEmpty(col, row) {
57275
57577
  if (!this._table.isPivotChart()) {
@@ -57290,21 +57592,30 @@
57290
57592
  if (!this._table.isPivotChart()) {
57291
57593
  return false;
57292
57594
  }
57293
- if (this.indicatorKeys.length >= 1) {
57294
- if (this.isBottomFrozenRow(col, row) || this.isRightFrozenColumn(col, row)) {
57595
+ if (this.indicatorKeys.length >= 1 && checkHasCartesianChart(this)) {
57596
+ if ((this.isBottomFrozenRow(col, row) && isHasCartesianChartInline(col, row, 'col', this)) ||
57597
+ (this.isRightFrozenColumn(col, row) && isHasCartesianChartInline(col, row, 'row', this))) {
57295
57598
  return true;
57296
57599
  }
57297
- if (this.isRowHeader(col, row) && col === this.rowHeaderLevelCount - 1) {
57600
+ if (this.isRowHeader(col, row) &&
57601
+ col === this.rowHeaderLevelCount - 1 &&
57602
+ isHasCartesianChartInline(col, row, 'row', this)) {
57298
57603
  return true;
57299
57604
  }
57300
- if (this.hasTwoIndicatorAxes && this.indicatorsAsCol && row === this.columnHeaderLevelCount - 1) {
57605
+ if (this.hasTwoIndicatorAxes &&
57606
+ this.indicatorsAsCol &&
57607
+ row === this.columnHeaderLevelCount - 1 &&
57608
+ isHasCartesianChartInline(col, row, 'col', this)) {
57301
57609
  return true;
57302
57610
  }
57303
57611
  }
57304
57612
  return false;
57305
57613
  }
57306
57614
  getChartAxes(col, row) {
57307
- return getChartAxes(col, row, this);
57615
+ if (isCartesianChart(col, row, this) || this.isAxisCell(col, row)) {
57616
+ return getChartAxes(col, row, this);
57617
+ }
57618
+ return undefined;
57308
57619
  }
57309
57620
  getRawChartSpec(col, row) {
57310
57621
  return getRawChartSpec(col, row, this);
@@ -57394,16 +57705,28 @@
57394
57705
  this._CellHeaderPathMap = new Map();
57395
57706
  }
57396
57707
  getDimensionKeyInChartSpec(_col, _row) {
57397
- const chartSpec = this.getRawChartSpec(_col, _row);
57398
- const dimensionKeys = [];
57399
- if (chartSpec) {
57400
- if (this.indicatorsAsCol === false) {
57401
- dimensionKeys.push(chartSpec.xField ?? chartSpec?.series[0]?.xField);
57708
+ let dimensionKey;
57709
+ if (this.indicatorsAsCol === false) {
57710
+ for (let i = 0; i < this.indicatorsDefine.length; i++) {
57711
+ const chartSpec = this.indicatorsDefine[i].chartSpec;
57712
+ if (chartSpec) {
57713
+ dimensionKey = chartSpec.xField ?? chartSpec?.series?.[0]?.xField;
57714
+ if (dimensionKey) {
57715
+ return dimensionKey;
57716
+ }
57717
+ }
57402
57718
  }
57403
- else {
57404
- dimensionKeys.push(chartSpec.yField ?? chartSpec?.series[0]?.yField);
57719
+ }
57720
+ else {
57721
+ for (let i = 0; i < this.indicatorsDefine.length; i++) {
57722
+ const chartSpec = this.indicatorsDefine[i].chartSpec;
57723
+ if (chartSpec) {
57724
+ dimensionKey = chartSpec.yField ?? chartSpec?.series?.[0]?.yField;
57725
+ if (dimensionKey) {
57726
+ return dimensionKey;
57727
+ }
57728
+ }
57405
57729
  }
57406
- return dimensionKeys;
57407
57730
  }
57408
57731
  return null;
57409
57732
  }
@@ -57487,29 +57810,37 @@
57487
57810
  const chartSpec = this.getRawChartSpec(_col, _row);
57488
57811
  const indicatorKeys = [];
57489
57812
  if (chartSpec) {
57490
- if (this.indicatorsAsCol === false) {
57491
- if (chartSpec.series) {
57492
- chartSpec.series.forEach((chartSeries) => {
57493
- const yField = chartSeries.yField;
57494
- indicatorKeys.push(yField);
57495
- });
57813
+ if (chartSpec.series || chartSpec.xField || chartSpec.yField) {
57814
+ if (this.indicatorsAsCol === false) {
57815
+ if (chartSpec.series) {
57816
+ chartSpec.series.forEach((chartSeries) => {
57817
+ const yField = chartSeries.yField;
57818
+ indicatorKeys.push(yField);
57819
+ });
57820
+ }
57821
+ else {
57822
+ indicatorKeys.push(chartSpec.yField);
57823
+ }
57496
57824
  }
57497
57825
  else {
57498
- indicatorKeys.push(chartSpec.yField);
57826
+ if (chartSpec.series) {
57827
+ chartSpec.series.forEach((chartSeries) => {
57828
+ const xField = chartSeries.xField;
57829
+ indicatorKeys.push(xField);
57830
+ });
57831
+ }
57832
+ else {
57833
+ indicatorKeys.push(chartSpec.xField);
57834
+ }
57499
57835
  }
57836
+ return indicatorKeys;
57500
57837
  }
57501
- else {
57502
- if (chartSpec.series) {
57503
- chartSpec.series.forEach((chartSeries) => {
57504
- const xField = chartSeries.xField;
57505
- indicatorKeys.push(xField);
57506
- });
57507
- }
57508
- else {
57509
- indicatorKeys.push(chartSpec.xField);
57510
- }
57838
+ else if (chartSpec.valueField) {
57839
+ indicatorKeys.push(chartSpec.valueField);
57840
+ }
57841
+ if (indicatorKeys.length >= 1) {
57842
+ return indicatorKeys;
57511
57843
  }
57512
- return indicatorKeys;
57513
57844
  }
57514
57845
  return null;
57515
57846
  }
@@ -60392,6 +60723,18 @@
60392
60723
  return customMergeText;
60393
60724
  }
60394
60725
  if (this.internalProps.layoutMap.isHeader(col, row)) {
60726
+ if (this.internalProps.layoutMap.isBottomFrozenRow(col, row) ||
60727
+ this.internalProps.layoutMap.isRightFrozenColumn(col, row)) {
60728
+ const indicatorKeys = this.internalProps.layoutMap.getIndicatorKeyInChartSpec(col, row);
60729
+ let indicatorInfo;
60730
+ indicatorKeys?.forEach(key => {
60731
+ const info = this.internalProps.layoutMap.getIndicatorInfo(key);
60732
+ if (info) {
60733
+ indicatorInfo = info;
60734
+ }
60735
+ });
60736
+ return indicatorInfo?.title ?? indicatorInfo?.indicatorKey ?? '';
60737
+ }
60395
60738
  const { title, fieldFormat } = this.internalProps.layoutMap.getHeader(col, row);
60396
60739
  return typeof fieldFormat === 'function' ? fieldFormat(title, col, row, this) : title;
60397
60740
  }
@@ -60419,6 +60762,18 @@
60419
60762
  getCellOriginValue(col, row) {
60420
60763
  const table = this;
60421
60764
  if (table.internalProps.layoutMap.isHeader(col, row)) {
60765
+ if (this.internalProps.layoutMap.isBottomFrozenRow(col, row) ||
60766
+ this.internalProps.layoutMap.isRightFrozenColumn(col, row)) {
60767
+ const indicatorKeys = this.internalProps.layoutMap.getIndicatorKeyInChartSpec(col, row);
60768
+ let indicatorInfo;
60769
+ indicatorKeys?.forEach(key => {
60770
+ const info = this.internalProps.layoutMap.getIndicatorInfo(key);
60771
+ if (info) {
60772
+ indicatorInfo = info;
60773
+ }
60774
+ });
60775
+ return indicatorInfo?.title ?? indicatorInfo?.indicatorKey ?? '';
60776
+ }
60422
60777
  const { title } = table.internalProps.layoutMap.getHeader(col, row);
60423
60778
  return typeof title === 'function' ? title() : title;
60424
60779
  }
@@ -60590,6 +60945,9 @@
60590
60945
  const collectValuesBy = {};
60591
60946
  for (let i = 0, len = indicators?.length; i < len; i++) {
60592
60947
  if (typeof indicators[i] !== 'string' && indicators[i].chartSpec) {
60948
+ if (indicators[i].chartSpec?.type === 'pie') {
60949
+ continue;
60950
+ }
60593
60951
  if (this.options.indicatorsAsCol === false) {
60594
60952
  const indicatorDefine = indicators[i];
60595
60953
  indicatorDefine.chartSpec?.stack !== false &&
@@ -60889,7 +61247,7 @@
60889
61247
  chartInstance = chartNode.attribute.chartInstance;
60890
61248
  const { dataId, data, axes, spec } = chartNode.attribute;
60891
61249
  const viewBox = chartNode.getViewBox();
60892
- axes.forEach((axis, index) => {
61250
+ axes?.forEach((axis, index) => {
60893
61251
  if (axis.type === 'linear') {
60894
61252
  chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
60895
61253
  }
@@ -61086,7 +61444,7 @@
61086
61444
  constructor(options) {
61087
61445
  let cache;
61088
61446
  if (isString$2(options.iconName)) {
61089
- const regedIcons = get$2();
61447
+ const regedIcons = get$1();
61090
61448
  cache = regedIcons[options.iconName];
61091
61449
  if (cache) {
61092
61450
  options.width = options.width ?? cache.width;
@@ -61511,9 +61869,9 @@
61511
61869
  }
61512
61870
 
61513
61871
  registerForVrender();
61514
- const version = "0.18.0-alpha.2";
61872
+ const version = "0.18.0";
61515
61873
  function getIcons() {
61516
- return get$2();
61874
+ return get$1();
61517
61875
  }
61518
61876
  function clearGlobal() {
61519
61877
  clearAll();