@visactor/vtable 0.20.0 → 0.20.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/cjs/ListTable.d.ts +2 -1
  2. package/cjs/ListTable.js +5 -1
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/core/BaseTable.js +1 -1
  5. package/cjs/core/BaseTable.js.map +1 -1
  6. package/cjs/core/tableHelper.js +1 -1
  7. package/cjs/core/tableHelper.js.map +1 -1
  8. package/cjs/data/DataSource.d.ts +3 -2
  9. package/cjs/data/DataSource.js +22 -13
  10. package/cjs/data/DataSource.js.map +1 -1
  11. package/cjs/index.d.ts +1 -1
  12. package/cjs/index.js +1 -1
  13. package/cjs/index.js.map +1 -1
  14. package/cjs/layout/pivot-header-layout.d.ts +1 -1
  15. package/cjs/layout/pivot-header-layout.js +1 -1
  16. package/cjs/layout/pivot-header-layout.js.map +1 -1
  17. package/cjs/layout/simple-header-layout.d.ts +1 -1
  18. package/cjs/layout/simple-header-layout.js +1 -1
  19. package/cjs/layout/simple-header-layout.js.map +1 -1
  20. package/cjs/scenegraph/component/custom.d.ts +0 -5
  21. package/cjs/scenegraph/component/custom.js +3 -20
  22. package/cjs/scenegraph/component/custom.js.map +1 -1
  23. package/cjs/scenegraph/group-creater/cell-helper.d.ts +8 -0
  24. package/cjs/scenegraph/group-creater/cell-helper.js +48 -5
  25. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  26. package/cjs/scenegraph/group-creater/column-helper.d.ts +1 -5
  27. package/cjs/scenegraph/group-creater/column-helper.js +5 -32
  28. package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
  29. package/cjs/scenegraph/layout/update-height.js +3 -3
  30. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  31. package/cjs/scenegraph/layout/update-width.js +3 -3
  32. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  33. package/cjs/ts-types/list-table/layout-map/api.d.ts +1 -1
  34. package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
  35. package/cjs/ts-types/table-engine.d.ts +1 -1
  36. package/cjs/ts-types/table-engine.js.map +1 -1
  37. package/cjs/vrender.js.map +1 -1
  38. package/dist/vtable.js +1059 -1047
  39. package/dist/vtable.min.js +2 -2
  40. package/es/ListTable.d.ts +2 -1
  41. package/es/ListTable.js +5 -1
  42. package/es/ListTable.js.map +1 -1
  43. package/es/core/BaseTable.js +1 -1
  44. package/es/core/BaseTable.js.map +1 -1
  45. package/es/core/tableHelper.js +1 -1
  46. package/es/core/tableHelper.js.map +1 -1
  47. package/es/data/DataSource.d.ts +3 -2
  48. package/es/data/DataSource.js +22 -14
  49. package/es/data/DataSource.js.map +1 -1
  50. package/es/index.d.ts +1 -1
  51. package/es/index.js +1 -1
  52. package/es/index.js.map +1 -1
  53. package/es/layout/pivot-header-layout.d.ts +1 -1
  54. package/es/layout/pivot-header-layout.js +1 -1
  55. package/es/layout/pivot-header-layout.js.map +1 -1
  56. package/es/layout/simple-header-layout.d.ts +1 -1
  57. package/es/layout/simple-header-layout.js +1 -1
  58. package/es/layout/simple-header-layout.js.map +1 -1
  59. package/es/scenegraph/component/custom.d.ts +0 -5
  60. package/es/scenegraph/component/custom.js +0 -18
  61. package/es/scenegraph/component/custom.js.map +1 -1
  62. package/es/scenegraph/group-creater/cell-helper.d.ts +8 -0
  63. package/es/scenegraph/group-creater/cell-helper.js +46 -4
  64. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  65. package/es/scenegraph/group-creater/column-helper.d.ts +1 -5
  66. package/es/scenegraph/group-creater/column-helper.js +1 -29
  67. package/es/scenegraph/group-creater/column-helper.js.map +1 -1
  68. package/es/scenegraph/layout/update-height.js +2 -2
  69. package/es/scenegraph/layout/update-height.js.map +1 -1
  70. package/es/scenegraph/layout/update-width.js +2 -2
  71. package/es/scenegraph/layout/update-width.js.map +1 -1
  72. package/es/ts-types/list-table/layout-map/api.d.ts +1 -1
  73. package/es/ts-types/list-table/layout-map/api.js.map +1 -1
  74. package/es/ts-types/table-engine.d.ts +1 -1
  75. package/es/ts-types/table-engine.js.map +1 -1
  76. package/es/vrender.js.map +1 -1
  77. package/package.json +3 -3
package/dist/vtable.js CHANGED
@@ -31520,7 +31520,7 @@
31520
31520
  userPagination;
31521
31521
  pagination;
31522
31522
  _currentPagerIndexedData;
31523
- enableHierarchyState = false;
31523
+ hierarchyExpandLevel = 0;
31524
31524
  static get EVENT_TYPE() {
31525
31525
  return EVENT_TYPE;
31526
31526
  }
@@ -31547,29 +31547,32 @@
31547
31547
  currentPage: 0
31548
31548
  };
31549
31549
  if (hierarchyExpandLevel >= 1) {
31550
- this.enableHierarchyState = true;
31550
+ this.hierarchyExpandLevel = hierarchyExpandLevel;
31551
31551
  }
31552
31552
  this.currentIndexedData = Array.from({ length: this._sourceLength }, (_, i) => i);
31553
- if (this.enableHierarchyState) {
31553
+ this.initTreeHierarchyState();
31554
+ this.updatePagerData();
31555
+ }
31556
+ initTreeHierarchyState() {
31557
+ if (this.hierarchyExpandLevel) {
31558
+ this.treeDataHierarchyState = new Map();
31554
31559
  for (let i = 0; i < this._sourceLength; i++) {
31555
31560
  const nodeData = this.getOriginalRecord(i);
31556
31561
  nodeData.children && this.treeDataHierarchyState.set(i, HierarchyState.collapse);
31557
31562
  }
31558
- }
31559
- if (hierarchyExpandLevel > 1) {
31563
+ this.currentIndexedData = Array.from({ length: this._sourceLength }, (_, i) => i);
31560
31564
  let nodeLength = this._sourceLength;
31561
31565
  for (let i = 0; i < nodeLength; i++) {
31562
31566
  const indexKey = this.currentIndexedData[i];
31563
31567
  const nodeData = this.getOriginalRecord(indexKey);
31564
31568
  if (nodeData.children?.length > 0) {
31565
31569
  this.treeDataHierarchyState.set(Array.isArray(indexKey) ? indexKey.join(',') : indexKey, HierarchyState.expand);
31566
- const childrenLength = this.initChildrenNodeHierarchy(indexKey, hierarchyExpandLevel, 2, nodeData);
31570
+ const childrenLength = this.initChildrenNodeHierarchy(indexKey, this.hierarchyExpandLevel, 2, nodeData);
31567
31571
  i += childrenLength;
31568
31572
  nodeLength += childrenLength;
31569
31573
  }
31570
31574
  }
31571
31575
  }
31572
- this.updatePagerData();
31573
31576
  }
31574
31577
  registerAggregator(type, aggregator) {
31575
31578
  this.registedAggregators[type] = aggregator;
@@ -31710,6 +31713,9 @@
31710
31713
  return _getIndex(this.currentPagerIndexedData, index);
31711
31714
  }
31712
31715
  getTableIndex(colOrRow) {
31716
+ if (Array.isArray(colOrRow)) {
31717
+ return this.currentPagerIndexedData.findIndex(value => arrayEqual(value, colOrRow));
31718
+ }
31713
31719
  return this.currentPagerIndexedData.findIndex(value => value === colOrRow);
31714
31720
  }
31715
31721
  getField(index, field, col, row, table) {
@@ -31825,6 +31831,7 @@
31825
31831
  this.source.splice(index, 0, record);
31826
31832
  this.currentIndexedData.push(this.currentIndexedData.length);
31827
31833
  this._sourceLength += 1;
31834
+ this.initTreeHierarchyState();
31828
31835
  if (this.userPagination) {
31829
31836
  this.pagination.totalCount = this._sourceLength;
31830
31837
  const { perPageCount, currentPage } = this.pagination;
@@ -31985,7 +31992,7 @@
31985
31992
  }, this._sourceLength, orderFn, order, index => this.getOriginalField(index, field));
31986
31993
  }
31987
31994
  this.currentIndexedData = sortedIndexArray;
31988
- if (this.enableHierarchyState) {
31995
+ if (this.hierarchyExpandLevel) {
31989
31996
  let nodeLength = sortedIndexArray.length;
31990
31997
  window.performance.now();
31991
31998
  for (let i = 0; i < nodeLength; i++) {
@@ -32691,7 +32698,7 @@
32691
32698
  fn(table);
32692
32699
  table.internalProps.dataSourceEventIds = [
32693
32700
  table.internalProps.handler.on(table.internalProps.dataSource, DataSource.EVENT_TYPE.CHANGE_ORDER, () => {
32694
- if (table.dataSource.enableHierarchyState) {
32701
+ if (table.dataSource.hierarchyExpandLevel) {
32695
32702
  table.refreshRowColCount();
32696
32703
  }
32697
32704
  table.render();
@@ -32946,476 +32953,363 @@
32946
32953
  }
32947
32954
  };
32948
32955
 
32949
- function getProp(name, cellStyle, col, row, _table) {
32950
- const prop = cellStyle && isValid$1(cellStyle[name]) ? cellStyle[name] : null;
32951
- if (typeof prop === 'function') {
32956
+ function dealWithCustom(customLayout, customRender, col, row, width, height, autoWidth, autoHeight, padding, table) {
32957
+ let renderDefault = true;
32958
+ let enableCellPadding = false;
32959
+ let expectedWidth;
32960
+ let expectedHeight;
32961
+ let customElements;
32962
+ let elementsGroup;
32963
+ if (typeof customLayout === 'function') {
32952
32964
  const arg = {
32953
32965
  col,
32954
32966
  row,
32955
- table: _table,
32956
- value: _table.getCellValue(col, row),
32957
- dataValue: _table.getCellOriginValue(col, row),
32958
- cellHeaderPaths: _table.getCellHeaderPaths(col, row)
32967
+ dataValue: table.getCellOriginValue(col, row),
32968
+ value: table.getCellValue(col, row) || '',
32969
+ rect: {
32970
+ left: 0,
32971
+ top: 0,
32972
+ right: width,
32973
+ bottom: height,
32974
+ width,
32975
+ height
32976
+ },
32977
+ table
32959
32978
  };
32960
- return prop(arg);
32979
+ const customRenderObj = customLayout(arg);
32980
+ if (customRenderObj.rootContainer) {
32981
+ customRenderObj.rootContainer = decodeReactDom(customRenderObj.rootContainer);
32982
+ }
32983
+ if (customRenderObj.rootContainer instanceof Group$2) {
32984
+ elementsGroup = customRenderObj.rootContainer;
32985
+ elementsGroup.name = 'custom-container';
32986
+ }
32987
+ renderDefault = customRenderObj.renderDefault;
32988
+ enableCellPadding = customRenderObj.enableCellPadding;
32961
32989
  }
32962
- return prop;
32963
- }
32964
- function getFunctionalProp(name, cellStyle, col, row, _table) {
32965
- const prop = cellStyle && isValid$1(cellStyle[name]) ? cellStyle[name] : null;
32966
- if (typeof prop === 'function') {
32990
+ else if (typeof customRender === 'function') {
32967
32991
  const arg = {
32968
32992
  col,
32969
32993
  row,
32970
- table: _table,
32971
- value: _table.getCellValue(col, row),
32972
- dataValue: _table.getCellOriginValue(col, row),
32973
- cellHeaderPaths: _table.getCellHeaderPaths(col, row)
32994
+ dataValue: table.getCellOriginValue(col, row),
32995
+ value: table.getCellValue(col, row) || '',
32996
+ rect: {
32997
+ left: 0,
32998
+ top: 0,
32999
+ right: width,
33000
+ bottom: height,
33001
+ width,
33002
+ height
33003
+ },
33004
+ table
32974
33005
  };
32975
- return prop(arg);
32976
- }
32977
- return undefined;
32978
- }
32979
-
32980
- let Group$1 = class Group extends Group$2 {
32981
- role;
32982
- col;
32983
- row;
32984
- mergeStartCol;
32985
- mergeStartRow;
32986
- mergeEndCol;
32987
- mergeEndRow;
32988
- contentWidth;
32989
- contentHeight;
32990
- rowNumber;
32991
- colHeight;
32992
- border;
32993
- needUpdate;
32994
- needUpdateWidth;
32995
- needUpdateHeight;
32996
- clear() {
32997
- this.removeAllChild();
32998
- }
32999
- getChildByName(name, deep) {
33000
- let result = null;
33001
- this.forEachChildren((child) => {
33002
- if (child.name === name) {
33003
- result = child;
33004
- return true;
33005
- }
33006
- return false;
33007
- });
33008
- if (deep) {
33009
- this.forEachChildren((child) => {
33010
- if (child.getChildByName) {
33011
- const target = child.getChildByName(name, true);
33012
- if (target) {
33013
- result = target;
33014
- return true;
33015
- }
33016
- }
33017
- return false;
33018
- });
33019
- }
33020
- return result;
33021
- }
33022
- get width() {
33023
- let width = this.AABBBounds.width();
33024
- if (width === Infinity || width === -Infinity) {
33025
- width = 0;
33026
- }
33027
- return Math.max(width, this.attribute.width ?? 0);
33028
- }
33029
- get height() {
33030
- let height = this.AABBBounds.height();
33031
- if (height === Infinity || height === -Infinity) {
33032
- height = 0;
33033
- }
33034
- return Math.max(height, this.attribute.height ?? 0);
33035
- }
33036
- setDeltaWidth(deltaX) {
33037
- if (deltaX === 0) {
33038
- return;
33039
- }
33040
- this.setAttribute('width', (this.attribute.width ?? 0) + deltaX);
33041
- if (this.border) {
33042
- this.border.setAttribute('width', this.border.attribute.width + deltaX);
33043
- if (this.border.type === 'group') {
33044
- this.border.firstChild.setAttribute('width', this.border.firstChild.attribute.width + deltaX);
33045
- }
33006
+ const customRenderObj = customRender(arg);
33007
+ if (customRenderObj) {
33008
+ customElements = customRenderObj.elements;
33009
+ renderDefault = customRenderObj.renderDefault;
33010
+ expectedWidth = customRenderObj.expectedWidth;
33011
+ expectedHeight = customRenderObj.expectedHeight;
33046
33012
  }
33047
33013
  }
33048
- setDeltaHeight(deltaY) {
33049
- if (deltaY === 0) {
33050
- return;
33051
- }
33052
- this.setAttribute('height', (this.attribute.height ?? 0) + deltaY);
33053
- if (this.border) {
33054
- this.border.setAttribute('height', this.border.attribute.height + deltaY);
33055
- if (this.border.type === 'group') {
33056
- this.border.firstChild.setAttribute('width', this.border.firstChild.attribute.height + deltaY);
33057
- }
33058
- }
33014
+ else if (customRender) {
33015
+ expectedWidth = customRender.expectedWidth;
33016
+ expectedHeight = customRender.expectedHeight;
33017
+ customElements = customRender.elements;
33018
+ renderDefault = customRender.renderDefault;
33059
33019
  }
33060
- setDeltaX(deltaX) {
33061
- if (deltaX === 0) {
33062
- return;
33063
- }
33064
- this.setAttribute('x', this.attribute.x + deltaX);
33020
+ if (customElements) {
33021
+ const value = table.getCellValue(col, row);
33022
+ elementsGroup = adjustElementToGroup(customElements, autoWidth ? expectedWidth : width, autoHeight ? expectedHeight : height, value);
33065
33023
  }
33066
- setDeltaY(deltaY) {
33067
- if (deltaY === 0) {
33068
- return;
33069
- }
33070
- this.setAttribute('y', this.attribute.y + deltaY);
33024
+ if (enableCellPadding) {
33025
+ elementsGroup.setAttributes({
33026
+ x: padding[3],
33027
+ y: padding[0],
33028
+ width: width - padding[1] - padding[3],
33029
+ height: height - padding[0] - padding[2]
33030
+ });
33071
33031
  }
33072
- forEachChildrenSkipChild(cb, skipChildName = 'border-rect', reverse = false) {
33073
- if (reverse) {
33074
- let child = this._lastChild;
33075
- let i = 0;
33076
- while (child) {
33077
- if (child.name !== skipChildName) {
33078
- const breakTag = cb(child, i++);
33079
- if (breakTag) {
33080
- return;
33081
- }
33082
- }
33083
- child = child._prev;
33084
- }
33032
+ dealPercentCalc(elementsGroup, width, height);
33033
+ return {
33034
+ elementsGroup,
33035
+ renderDefault
33036
+ };
33037
+ }
33038
+ function adjustElementToGroup(elements, width, height, value) {
33039
+ const customGroup = new Group$2({
33040
+ x: 0,
33041
+ y: 0,
33042
+ width,
33043
+ height,
33044
+ fill: false,
33045
+ stroke: false,
33046
+ pickable: false
33047
+ });
33048
+ customGroup.name = 'custom-container';
33049
+ const elementsAdjusted = adjustElementsPos(elements, width, height, value);
33050
+ elementsAdjusted.forEach(element => {
33051
+ if (element.clickable) {
33052
+ element.pickable = element.clickable;
33085
33053
  }
33086
- else {
33087
- let child = this._firstChild;
33088
- let i = 0;
33089
- while (child) {
33090
- if (child.name !== skipChildName) {
33091
- const breakTag = cb(child, i++);
33092
- if (breakTag) {
33093
- return;
33094
- }
33054
+ switch (element.type) {
33055
+ case 'arc':
33056
+ const arc = createArc({
33057
+ x: element.x,
33058
+ y: element.y,
33059
+ dx: (element.dx ?? 0),
33060
+ dy: (element.dy ?? 0),
33061
+ fill: element.fill,
33062
+ stroke: element.stroke,
33063
+ outerRadius: element.radius,
33064
+ startAngle: element.startAngle,
33065
+ endAngle: element.endAngle,
33066
+ pickable: !!element.pickable,
33067
+ cursor: element.cursor
33068
+ });
33069
+ arc.name = element.name;
33070
+ customGroup.appendChild(arc);
33071
+ break;
33072
+ case 'text':
33073
+ if (element.background) {
33074
+ const expandX = element.background?.expandX ?? 0;
33075
+ const expandY = element.background?.expandY ?? 0;
33076
+ const textBackRect = createRect({
33077
+ x: element.x - expandX,
33078
+ y: element.y - expandY,
33079
+ dx: (element.dx ?? 0),
33080
+ dy: (element.dy ?? 0),
33081
+ width: element.width + expandX * 2,
33082
+ height: element.height + expandY * 2,
33083
+ cornerRadius: element.background?.cornerRadius ?? 0,
33084
+ fill: element.background?.fill ?? '#888'
33085
+ });
33086
+ customGroup.appendChild(textBackRect);
33095
33087
  }
33096
- child = child._next;
33097
- }
33098
- }
33099
- }
33100
- getColGroup(col) {
33101
- let c = this._firstChild;
33102
- if (!c) {
33103
- return null;
33088
+ const text = new Text$1(Object.assign({
33089
+ pickable: !!element.pickable,
33090
+ fill: element.color ?? element.fill
33091
+ }, element));
33092
+ text.name = element.name;
33093
+ customGroup.appendChild(text);
33094
+ break;
33095
+ case 'rect':
33096
+ const rect = createRect({
33097
+ x: element.x,
33098
+ y: element.y,
33099
+ dx: (element.dx ?? 0),
33100
+ dy: (element.dy ?? 0),
33101
+ width: element.width,
33102
+ height: element.height,
33103
+ cornerRadius: element.radius,
33104
+ fill: element.fill,
33105
+ stroke: element.stroke,
33106
+ pickable: !!element.pickable,
33107
+ cursor: element.cursor
33108
+ });
33109
+ rect.name = element.name;
33110
+ customGroup.appendChild(rect);
33111
+ break;
33112
+ case 'circle':
33113
+ const circle = createCircle({
33114
+ x: element.x,
33115
+ y: element.y,
33116
+ dx: (element.dx ?? 0),
33117
+ dy: (element.dy ?? 0),
33118
+ radius: element.radius,
33119
+ fill: element.fill,
33120
+ stroke: element.stroke,
33121
+ pickable: !!element.pickable,
33122
+ cursor: element.cursor
33123
+ });
33124
+ circle.name = element.name;
33125
+ customGroup.appendChild(circle);
33126
+ break;
33127
+ case 'icon':
33128
+ const icon = new Icon$1({
33129
+ x: element.x,
33130
+ y: element.y,
33131
+ dx: (element.dx ?? 0),
33132
+ dy: (element.dy ?? 0),
33133
+ width: element.width,
33134
+ height: element.height,
33135
+ image: element.svg,
33136
+ backgroundWidth: element.hover ? (element.hover.width ?? element.width) : undefined,
33137
+ backgroundHeight: element.hover ? (element.hover.width ?? element.width) : undefined,
33138
+ backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,
33139
+ pickable: !!element.pickable,
33140
+ cursor: element.cursor
33141
+ });
33142
+ icon.name = element.name;
33143
+ icon.role = 'icon-custom';
33144
+ customGroup.appendChild(icon);
33145
+ break;
33146
+ case 'image':
33147
+ const image = new Icon$1({
33148
+ x: element.x,
33149
+ y: element.y,
33150
+ dx: (element.dx ?? 0),
33151
+ dy: (element.dy ?? 0),
33152
+ width: element.width,
33153
+ height: element.height,
33154
+ image: element.src,
33155
+ backgroundWidth: element.hover ? (element.hover.width ?? element.width) : undefined,
33156
+ backgroundHeight: element.hover ? (element.hover.width ?? element.width) : undefined,
33157
+ backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,
33158
+ pickable: !!element.pickable,
33159
+ cursor: element.cursor,
33160
+ shape: element.shape
33161
+ });
33162
+ image.name = element.name;
33163
+ image.role = 'image-custom';
33164
+ customGroup.appendChild(image);
33165
+ break;
33166
+ case 'line':
33167
+ const line = createLine({
33168
+ points: element.points,
33169
+ stroke: element.stroke,
33170
+ pickable: !!element.pickable,
33171
+ cursor: element.cursor
33172
+ });
33173
+ line.name = element.name;
33174
+ customGroup.appendChild(line);
33175
+ break;
33104
33176
  }
33105
- for (let i = 0; i < this.childrenCount; i++) {
33106
- if (c.col === col) {
33107
- return c;
33177
+ });
33178
+ return customGroup;
33179
+ }
33180
+ function adjustElementsPos(originalElements, width, height, value) {
33181
+ const result = [];
33182
+ const left = 0;
33183
+ const top = 0;
33184
+ const borderLineWidths = [0, 0, 0, 0];
33185
+ for (let i = 0; i < originalElements.length; i++) {
33186
+ const originalElement = originalElements[i];
33187
+ const element = Object.assign({}, originalElement);
33188
+ for (const name in element) {
33189
+ if (element.hasOwnProperty(name) && isFunction$1(element[name])) {
33190
+ element[name] = element[name](value);
33108
33191
  }
33109
- c = c._next;
33110
33192
  }
33111
- return null;
33112
- }
33113
- getRowGroup(row) {
33114
- let c = this._firstChild;
33115
- if (!c) {
33116
- return null;
33193
+ const rect = element;
33194
+ if (isValid$1(rect.x)) {
33195
+ rect.x = isString$2(rect.x)
33196
+ ? transformString(rect.x, width - borderLineWidths[1])
33197
+ : Number(rect.x);
33117
33198
  }
33118
- for (let i = 0; i < this.childrenCount; i++) {
33119
- if (c.row === row) {
33120
- return c;
33121
- }
33122
- c = c._next;
33199
+ if (isValid$1(rect.y)) {
33200
+ rect.y = isString$2(rect.y)
33201
+ ? transformString(rect.y, height - borderLineWidths[2])
33202
+ : Number(rect.y);
33123
33203
  }
33124
- return null;
33125
- }
33126
- addCellGroup(cellGroup) {
33127
- if (this.childrenCount === 0 || this.lastChild.row === cellGroup.row - 1) {
33128
- this.addChild(cellGroup);
33204
+ if ('width' in element) {
33205
+ element.width = isString$2(element.width)
33206
+ ? transformString(element.width, width - borderLineWidths[1])
33207
+ : Number(element.width);
33129
33208
  }
33130
- else {
33131
- let c = this._firstChild;
33132
- for (let i = 0; i < this.childrenCount; i++) {
33133
- if (c.row === cellGroup.row - 1) {
33134
- this.insertAfter(cellGroup, c);
33135
- return;
33136
- }
33137
- c = c._next;
33138
- }
33139
- this.addChild(cellGroup);
33209
+ if ('height' in element) {
33210
+ element.height = isString$2(element.height)
33211
+ ? transformString(element.height, height - borderLineWidths[2])
33212
+ : Number(element.height);
33140
33213
  }
33141
- }
33142
- getChildAt(index) {
33143
- const child = super.getChildAt(index);
33144
- if (child && child.name === 'border-rect') {
33145
- return child._next;
33214
+ if ('radius' in element) {
33215
+ element.radius = isString$2(element.radius)
33216
+ ? transformString(element.radius, Math.min(width - borderLineWidths[1], height - borderLineWidths[2]))
33217
+ : Number(element.radius);
33146
33218
  }
33147
- return child;
33148
- }
33149
- tryUpdateAABBBounds() {
33150
- if (this.role === 'cell') {
33151
- if (!this.shouldUpdateAABBBounds()) {
33152
- return this._AABBBounds;
33153
- }
33154
- const selfChange = this.shouldSelfChangeUpdateAABBBounds();
33155
- const bounds = this.doUpdateAABBBounds();
33156
- this.addUpdateLayoutTag();
33157
- after(this, selfChange);
33158
- return bounds;
33219
+ if ('hover' in element) {
33220
+ element.hover.x = isString$2(element.hover.x)
33221
+ ? transformString(element.hover.x, width - borderLineWidths[1])
33222
+ : Number(element.hover.x);
33223
+ element.hover.y = isString$2(element.hover.y)
33224
+ ? transformString(element.hover.y, height - borderLineWidths[2])
33225
+ : Number(element.hover.y);
33226
+ element.hover.width = isString$2(element.hover.width)
33227
+ ? transformString(element.hover.width, width - borderLineWidths[1])
33228
+ : Number(element.hover.width);
33229
+ element.hover.height = isString$2(element.hover.height)
33230
+ ? transformString(element.hover.height, height - borderLineWidths[2])
33231
+ : Number(element.hover.height);
33232
+ element.hover.x += left;
33233
+ element.hover.y += top;
33159
33234
  }
33160
- return super.tryUpdateAABBBounds();
33235
+ rect.x = rect.x + left;
33236
+ rect.y = rect.y + top;
33237
+ result.push(element);
33161
33238
  }
33162
- doUpdateAABBBounds() {
33163
- if (this.role === 'cell') {
33164
- const attribute = this.attribute;
33165
- const { x, y, width, height } = attribute;
33166
- this._AABBBounds.setValue(x, y, x + width, y + height);
33167
- this.parent && this.parent.addChildUpdateBoundTag();
33168
- this.clearUpdateBoundTag();
33169
- return this._AABBBounds;
33170
- }
33171
- else if (this.role === 'body' ||
33172
- this.role === 'row-header' ||
33173
- this.role === 'col-header' ||
33174
- this.role === 'right-frozen' ||
33175
- this.role === 'bottom-frozen' ||
33176
- this.role === 'corner-header' ||
33177
- this.role === 'corner-right-top-header' ||
33178
- this.role === 'corner-right-bottom-header' ||
33179
- this.role === 'corner-left-bottom-header') {
33180
- this._AABBBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);
33181
- this.parent && this.parent.addChildUpdateBoundTag();
33182
- this.clearUpdateBoundTag();
33183
- return this._AABBBounds;
33184
- }
33185
- return super.doUpdateAABBBounds();
33239
+ return result;
33240
+ }
33241
+ function transformString(str, size) {
33242
+ if (str.endsWith('px')) {
33243
+ return parseInt(str, 10);
33186
33244
  }
33187
- updateColumnRowNumber(row) {
33188
- if (!this.rowNumber) {
33189
- this.rowNumber = row;
33245
+ else if (str.endsWith('%') && size) {
33246
+ return (parseInt(str, 10) / 100) * size;
33247
+ }
33248
+ return parseInt(str, 10);
33249
+ }
33250
+ function dealPercentCalc(group, parentWidth, parentHeight) {
33251
+ if (!group) {
33252
+ return;
33253
+ }
33254
+ group.forEachChildren((child) => {
33255
+ if (!child) {
33256
+ return;
33190
33257
  }
33191
- else {
33192
- this.rowNumber = Math.max(this.rowNumber, row);
33258
+ if (isObject$4(child.attribute.width) && child.attribute.width.percent) {
33259
+ child.setAttribute('width', (child.attribute.width.percent / 100) * parentWidth +
33260
+ (child.attribute.width.delta ?? 0));
33193
33261
  }
33194
- }
33195
- updateColumnHeight(cellHeight) {
33196
- if (!this.colHeight) {
33197
- this.colHeight = cellHeight;
33262
+ if (isObject$4(child.attribute.height) && child.attribute.height.percent) {
33263
+ child.setAttribute('height', (child.attribute.height.percent / 100) * parentHeight +
33264
+ (child.attribute.height.delta ?? 0));
33198
33265
  }
33199
- else {
33200
- this.colHeight += cellHeight;
33266
+ if (child.type === 'group') {
33267
+ dealPercentCalc(child, child.attribute.width, child.attribute.height);
33201
33268
  }
33202
- }
33203
- };
33204
- function after(group, selfChange) {
33205
- if (!group.stage.dirtyBounds) {
33206
- return;
33207
- }
33208
- if (!(group.stage && group.stage.renderCount)) {
33209
- return;
33210
- }
33211
- if (group.isContainer && !selfChange) {
33212
- return;
33213
- }
33214
- group.stage.dirty(group.globalAABBBounds);
33215
- }
33216
-
33217
- const CHART_NUMBER_TYPE = genNumberType();
33218
- class Chart extends Group$2 {
33219
- type = 'chart';
33220
- chartInstance;
33221
- activeChartInstance;
33222
- active;
33223
- cacheCanvas;
33224
- isShareChartSpec;
33225
- constructor(isShareChartSpec, params) {
33226
- super(params);
33227
- this.numberType = CHART_NUMBER_TYPE;
33228
- this.isShareChartSpec = isShareChartSpec;
33229
- if (!params.chartInstance) {
33230
- const chartInstance = new params.ClassType(params.spec, {
33231
- renderCanvas: params.canvas,
33232
- mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',
33233
- modeParams: this.attribute.modeParams,
33234
- canvasControled: false,
33235
- viewBox: { x1: 0, x2: 0, y1: 0, y2: 0 },
33236
- dpr: params.dpr,
33237
- interactive: false,
33238
- animation: false,
33239
- autoFit: false
33240
- });
33241
- chartInstance.renderSync();
33242
- params.chartInstance = this.chartInstance = chartInstance;
33243
- }
33244
- else {
33245
- this.chartInstance = params.chartInstance;
33246
- }
33247
- }
33248
- activate(table) {
33249
- this.active = true;
33250
- const { col, row } = this.parent;
33251
- const { x1, y1, x2, y2 } = this.getViewBox();
33252
- const tableBound = getTableBounds(col, row, table);
33253
- const clipBound = tableBound.intersect({
33254
- x1: x1 - table.scrollLeft,
33255
- x2: x2 - table.scrollLeft,
33256
- y1: y1 - table.scrollTop,
33257
- y2: y2 - table.scrollTop
33258
- });
33259
- this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {
33260
- renderCanvas: this.attribute.canvas,
33261
- mode: 'desktop-browser',
33262
- canvasControled: false,
33263
- viewBox: {
33264
- x1: x1 - table.scrollLeft,
33265
- x2: x2 - table.scrollLeft,
33266
- y1: y1 - table.scrollTop,
33267
- y2: y2 - table.scrollTop
33268
- },
33269
- dpr: table.internalProps.pixelRatio,
33270
- animation: false,
33271
- interactive: true,
33272
- autoFit: false,
33273
- beforeRender: (stage) => {
33274
- const ctx = stage.window.getContext();
33275
- ctx.inuse = true;
33276
- ctx.clearMatrix();
33277
- ctx.setTransformForCurrent(true);
33278
- ctx.beginPath();
33279
- ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);
33280
- ctx.clip();
33281
- },
33282
- afterRender(stage) {
33283
- const ctx = stage.window.getContext();
33284
- ctx.inuse = false;
33285
- }
33286
- });
33287
- this.activeChartInstance.renderSync();
33288
- table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);
33289
- this.activeChartInstance.on('click', (params) => {
33290
- if (Chart.temp) {
33291
- table.scenegraph.updateChartState(params?.datum);
33292
- }
33293
- });
33294
- this.activeChartInstance.on('brushEnd', (params) => {
33295
- table.scenegraph.updateChartState(params?.value?.inBrushData);
33296
- Chart.temp = 0;
33297
- setTimeout(() => {
33298
- Chart.temp = 1;
33299
- }, 0);
33300
- });
33301
- table._bindChartEvent?.(this.activeChartInstance);
33302
- }
33303
- static temp = 1;
33304
- deactivate() {
33305
- this.active = false;
33306
- this.activeChartInstance?.updateViewBox({
33307
- x1: -1000,
33308
- x2: -800,
33309
- y1: -1000,
33310
- y2: -800
33311
- }, false, false);
33312
- this.activeChartInstance?.release();
33313
- this.activeChartInstance = null;
33314
- }
33315
- updateData(data) {
33316
- this.attribute.data = data;
33317
- }
33318
- getViewBox() {
33319
- const cellGroup = this.parent;
33320
- const padding = this.attribute.cellPadding;
33321
- const table = this.stage.table;
33322
- return {
33323
- x1: Math.ceil(cellGroup.globalAABBBounds.x1 + padding[3] + table.scrollLeft),
33324
- x2: Math.ceil(cellGroup.globalAABBBounds.x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft),
33325
- y1: Math.ceil(cellGroup.globalAABBBounds.y1 + padding[0] + table.scrollTop),
33326
- y2: Math.ceil(cellGroup.globalAABBBounds.y1 + cellGroup.attribute.height - padding[2] + table.scrollTop)
33327
- };
33328
- }
33269
+ });
33329
33270
  }
33330
- function getTableBounds(col, row, table) {
33331
- const { layoutMap } = table.internalProps;
33332
- const bodyBound = new Bounds();
33333
- const tableBound = table.scenegraph.tableGroup.globalAABBBounds;
33334
- bodyBound.x1 = tableBound.x1;
33335
- bodyBound.x2 = tableBound.x2;
33336
- bodyBound.y1 = tableBound.y1;
33337
- bodyBound.y2 = tableBound.y2;
33338
- if (!layoutMap.isFrozenColumn(col, row) && !layoutMap.isRightFrozenColumn(col, row)) {
33339
- bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
33340
- bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
33341
- bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
33342
- bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
33271
+ function decodeReactDom(dom) {
33272
+ if (!dom || !dom.$$typeof) {
33273
+ return dom;
33343
33274
  }
33344
- else if (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightTopCorner(col, row)) ;
33345
- else if (layoutMap.isFrozenColumn(col, row)) {
33346
- bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
33347
- bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
33275
+ const type = dom.type;
33276
+ const { attribute, children, stateProxy } = dom.props;
33277
+ const g = type({ attribute });
33278
+ parseToGraphic(g, dom.props);
33279
+ if (stateProxy) {
33280
+ g.stateProxy = stateProxy;
33348
33281
  }
33349
- else if (layoutMap.isRightFrozenColumn(col, row)) {
33350
- bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
33351
- bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
33282
+ g.id = attribute.id;
33283
+ g.name = attribute.name;
33284
+ if (isArray$1(children)) {
33285
+ children.forEach((item) => {
33286
+ const c = decodeReactDom(item);
33287
+ c && c.type && g.add(c);
33288
+ });
33352
33289
  }
33353
- else if (layoutMap.isBottomFrozenRow(col, row)) {
33354
- bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
33355
- bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
33290
+ else if (children) {
33291
+ g.add(decodeReactDom(children));
33356
33292
  }
33357
- return bodyBound;
33358
- }
33359
-
33360
- const chartTypes = {};
33361
-
33362
- const builtin = {};
33363
- function get$2() {
33364
- return extend(builtin, chartTypes);
33293
+ return g;
33365
33294
  }
33366
-
33367
- function createChartCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, width, height, padding, dataValue, chartModule, chartSpec, chartInstance, dataId, table, cellTheme, isShareChartSpec) {
33368
- const registerCharts = get$2();
33369
- const ClassType = registerCharts[chartModule];
33370
- const headerStyle = table._getCellStyle(col, row);
33371
- const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
33372
- if (isValid$1(functionalPadding)) {
33373
- padding = functionalPadding;
33295
+ function parseToGraphic(g, props) {
33296
+ let isGraphic = false;
33297
+ switch (g.type) {
33298
+ case 'richtext':
33299
+ break;
33300
+ case 'rich/image':
33301
+ break;
33302
+ default:
33303
+ isGraphic = true;
33374
33304
  }
33375
- if (!cellGroup) {
33376
- cellGroup = new Group$1({
33377
- x: xOrigin,
33378
- y: yOrigin,
33379
- width,
33380
- height,
33381
- lineWidth: cellTheme?.group?.lineWidth ?? undefined,
33382
- fill: cellTheme?.group?.fill ?? undefined,
33383
- stroke: cellTheme?.group?.stroke ?? undefined,
33384
- strokeArrayWidth: cellTheme?.group?.strokeArrayWidth ?? undefined,
33385
- strokeArrayColor: cellTheme?.group?.strokeArrayColor ?? undefined,
33386
- cursor: cellTheme?.group?.cursor ?? undefined,
33387
- lineDash: cellTheme?.group?.lineDash ?? undefined,
33388
- lineCap: 'square',
33389
- clip: true,
33390
- cornerRadius: cellTheme.group.cornerRadius
33305
+ if (isGraphic) {
33306
+ Object.keys(props).forEach(k => {
33307
+ const en = REACT_TO_CANOPUS_EVENTS[k];
33308
+ if (en) {
33309
+ g.on(en, props[k]);
33310
+ }
33391
33311
  });
33392
- cellGroup.role = 'cell';
33393
- cellGroup.col = col;
33394
- cellGroup.row = row;
33395
- columnGroup?.addCellGroup(cellGroup);
33396
33312
  }
33397
- cellGroup.AABBBounds.width();
33398
- const chartGroup = new Chart(isShareChartSpec, {
33399
- stroke: false,
33400
- x: padding[3],
33401
- y: padding[0],
33402
- canvas: table.canvas ?? table.scenegraph.stage.window.getContext().canvas,
33403
- mode: table.options.mode,
33404
- modeParams: table.options.modeParams,
33405
- spec: chartSpec,
33406
- ClassType,
33407
- width: width - padding[3] - padding[1],
33408
- height: height - padding[2] - padding[0],
33409
- chartInstance,
33410
- dataId,
33411
- data: table.getCellValue(col, row),
33412
- cellPadding: padding,
33413
- dpr: table.internalProps.pixelRatio,
33414
- axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : []
33415
- });
33416
- cellGroup.appendChild(chartGroup);
33417
- table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance);
33418
- return cellGroup;
33419
33313
  }
33420
33314
 
33421
33315
  const icons = {};
@@ -33705,25 +33599,262 @@
33705
33599
  };
33706
33600
  }
33707
33601
  };
33708
- function get$1() {
33602
+ function get$2() {
33709
33603
  return extend(builtins, icons);
33710
33604
  }
33711
33605
 
33712
- function calcKeepAspectRatioSize(width, height, maxWidth, maxHeight) {
33713
- const rectWidth = width;
33714
- const rectHeight = height;
33715
- const containerWidth = maxWidth;
33716
- const containerHeight = maxHeight;
33717
- const containerRatio = containerWidth / containerHeight;
33718
- const rectRatio = rectWidth / rectHeight;
33719
- let newWidth;
33720
- let newHeight;
33721
- if (rectRatio > containerRatio) {
33722
- newWidth = containerWidth;
33723
- newHeight = newWidth / rectRatio;
33724
- }
33725
- else {
33726
- newHeight = containerHeight;
33606
+ let Group$1 = class Group extends Group$2 {
33607
+ role;
33608
+ col;
33609
+ row;
33610
+ mergeStartCol;
33611
+ mergeStartRow;
33612
+ mergeEndCol;
33613
+ mergeEndRow;
33614
+ contentWidth;
33615
+ contentHeight;
33616
+ rowNumber;
33617
+ colHeight;
33618
+ border;
33619
+ needUpdate;
33620
+ needUpdateWidth;
33621
+ needUpdateHeight;
33622
+ clear() {
33623
+ this.removeAllChild();
33624
+ }
33625
+ getChildByName(name, deep) {
33626
+ let result = null;
33627
+ this.forEachChildren((child) => {
33628
+ if (child.name === name) {
33629
+ result = child;
33630
+ return true;
33631
+ }
33632
+ return false;
33633
+ });
33634
+ if (deep) {
33635
+ this.forEachChildren((child) => {
33636
+ if (child.getChildByName) {
33637
+ const target = child.getChildByName(name, true);
33638
+ if (target) {
33639
+ result = target;
33640
+ return true;
33641
+ }
33642
+ }
33643
+ return false;
33644
+ });
33645
+ }
33646
+ return result;
33647
+ }
33648
+ get width() {
33649
+ let width = this.AABBBounds.width();
33650
+ if (width === Infinity || width === -Infinity) {
33651
+ width = 0;
33652
+ }
33653
+ return Math.max(width, this.attribute.width ?? 0);
33654
+ }
33655
+ get height() {
33656
+ let height = this.AABBBounds.height();
33657
+ if (height === Infinity || height === -Infinity) {
33658
+ height = 0;
33659
+ }
33660
+ return Math.max(height, this.attribute.height ?? 0);
33661
+ }
33662
+ setDeltaWidth(deltaX) {
33663
+ if (deltaX === 0) {
33664
+ return;
33665
+ }
33666
+ this.setAttribute('width', (this.attribute.width ?? 0) + deltaX);
33667
+ if (this.border) {
33668
+ this.border.setAttribute('width', this.border.attribute.width + deltaX);
33669
+ if (this.border.type === 'group') {
33670
+ this.border.firstChild.setAttribute('width', this.border.firstChild.attribute.width + deltaX);
33671
+ }
33672
+ }
33673
+ }
33674
+ setDeltaHeight(deltaY) {
33675
+ if (deltaY === 0) {
33676
+ return;
33677
+ }
33678
+ this.setAttribute('height', (this.attribute.height ?? 0) + deltaY);
33679
+ if (this.border) {
33680
+ this.border.setAttribute('height', this.border.attribute.height + deltaY);
33681
+ if (this.border.type === 'group') {
33682
+ this.border.firstChild.setAttribute('width', this.border.firstChild.attribute.height + deltaY);
33683
+ }
33684
+ }
33685
+ }
33686
+ setDeltaX(deltaX) {
33687
+ if (deltaX === 0) {
33688
+ return;
33689
+ }
33690
+ this.setAttribute('x', this.attribute.x + deltaX);
33691
+ }
33692
+ setDeltaY(deltaY) {
33693
+ if (deltaY === 0) {
33694
+ return;
33695
+ }
33696
+ this.setAttribute('y', this.attribute.y + deltaY);
33697
+ }
33698
+ forEachChildrenSkipChild(cb, skipChildName = 'border-rect', reverse = false) {
33699
+ if (reverse) {
33700
+ let child = this._lastChild;
33701
+ let i = 0;
33702
+ while (child) {
33703
+ if (child.name !== skipChildName) {
33704
+ const breakTag = cb(child, i++);
33705
+ if (breakTag) {
33706
+ return;
33707
+ }
33708
+ }
33709
+ child = child._prev;
33710
+ }
33711
+ }
33712
+ else {
33713
+ let child = this._firstChild;
33714
+ let i = 0;
33715
+ while (child) {
33716
+ if (child.name !== skipChildName) {
33717
+ const breakTag = cb(child, i++);
33718
+ if (breakTag) {
33719
+ return;
33720
+ }
33721
+ }
33722
+ child = child._next;
33723
+ }
33724
+ }
33725
+ }
33726
+ getColGroup(col) {
33727
+ let c = this._firstChild;
33728
+ if (!c) {
33729
+ return null;
33730
+ }
33731
+ for (let i = 0; i < this.childrenCount; i++) {
33732
+ if (c.col === col) {
33733
+ return c;
33734
+ }
33735
+ c = c._next;
33736
+ }
33737
+ return null;
33738
+ }
33739
+ getRowGroup(row) {
33740
+ let c = this._firstChild;
33741
+ if (!c) {
33742
+ return null;
33743
+ }
33744
+ for (let i = 0; i < this.childrenCount; i++) {
33745
+ if (c.row === row) {
33746
+ return c;
33747
+ }
33748
+ c = c._next;
33749
+ }
33750
+ return null;
33751
+ }
33752
+ addCellGroup(cellGroup) {
33753
+ if (this.childrenCount === 0 || this.lastChild.row === cellGroup.row - 1) {
33754
+ this.addChild(cellGroup);
33755
+ }
33756
+ else {
33757
+ let c = this._firstChild;
33758
+ for (let i = 0; i < this.childrenCount; i++) {
33759
+ if (c.row === cellGroup.row - 1) {
33760
+ this.insertAfter(cellGroup, c);
33761
+ return;
33762
+ }
33763
+ c = c._next;
33764
+ }
33765
+ this.addChild(cellGroup);
33766
+ }
33767
+ }
33768
+ getChildAt(index) {
33769
+ const child = super.getChildAt(index);
33770
+ if (child && child.name === 'border-rect') {
33771
+ return child._next;
33772
+ }
33773
+ return child;
33774
+ }
33775
+ tryUpdateAABBBounds() {
33776
+ if (this.role === 'cell') {
33777
+ if (!this.shouldUpdateAABBBounds()) {
33778
+ return this._AABBBounds;
33779
+ }
33780
+ const selfChange = this.shouldSelfChangeUpdateAABBBounds();
33781
+ const bounds = this.doUpdateAABBBounds();
33782
+ this.addUpdateLayoutTag();
33783
+ after(this, selfChange);
33784
+ return bounds;
33785
+ }
33786
+ return super.tryUpdateAABBBounds();
33787
+ }
33788
+ doUpdateAABBBounds() {
33789
+ if (this.role === 'cell') {
33790
+ const attribute = this.attribute;
33791
+ const { x, y, width, height } = attribute;
33792
+ this._AABBBounds.setValue(x, y, x + width, y + height);
33793
+ this.parent && this.parent.addChildUpdateBoundTag();
33794
+ this.clearUpdateBoundTag();
33795
+ return this._AABBBounds;
33796
+ }
33797
+ else if (this.role === 'body' ||
33798
+ this.role === 'row-header' ||
33799
+ this.role === 'col-header' ||
33800
+ this.role === 'right-frozen' ||
33801
+ this.role === 'bottom-frozen' ||
33802
+ this.role === 'corner-header' ||
33803
+ this.role === 'corner-right-top-header' ||
33804
+ this.role === 'corner-right-bottom-header' ||
33805
+ this.role === 'corner-left-bottom-header') {
33806
+ this._AABBBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);
33807
+ this.parent && this.parent.addChildUpdateBoundTag();
33808
+ this.clearUpdateBoundTag();
33809
+ return this._AABBBounds;
33810
+ }
33811
+ return super.doUpdateAABBBounds();
33812
+ }
33813
+ updateColumnRowNumber(row) {
33814
+ if (!this.rowNumber) {
33815
+ this.rowNumber = row;
33816
+ }
33817
+ else {
33818
+ this.rowNumber = Math.max(this.rowNumber, row);
33819
+ }
33820
+ }
33821
+ updateColumnHeight(cellHeight) {
33822
+ if (!this.colHeight) {
33823
+ this.colHeight = cellHeight;
33824
+ }
33825
+ else {
33826
+ this.colHeight += cellHeight;
33827
+ }
33828
+ }
33829
+ };
33830
+ function after(group, selfChange) {
33831
+ if (!group.stage.dirtyBounds) {
33832
+ return;
33833
+ }
33834
+ if (!(group.stage && group.stage.renderCount)) {
33835
+ return;
33836
+ }
33837
+ if (group.isContainer && !selfChange) {
33838
+ return;
33839
+ }
33840
+ group.stage.dirty(group.globalAABBBounds);
33841
+ }
33842
+
33843
+ function calcKeepAspectRatioSize(width, height, maxWidth, maxHeight) {
33844
+ const rectWidth = width;
33845
+ const rectHeight = height;
33846
+ const containerWidth = maxWidth;
33847
+ const containerHeight = maxHeight;
33848
+ const containerRatio = containerWidth / containerHeight;
33849
+ const rectRatio = rectWidth / rectHeight;
33850
+ let newWidth;
33851
+ let newHeight;
33852
+ if (rectRatio > containerRatio) {
33853
+ newWidth = containerWidth;
33854
+ newHeight = newWidth / rectRatio;
33855
+ }
33856
+ else {
33857
+ newHeight = containerHeight;
33727
33858
  newWidth = newHeight * rectRatio;
33728
33859
  }
33729
33860
  return {
@@ -33752,10 +33883,41 @@
33752
33883
  return { x, y };
33753
33884
  }
33754
33885
 
33755
- function createImageCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, table, cellTheme) {
33756
- const headerStyle = table._getCellStyle(col, row);
33757
- const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
33758
- if (isValid$1(functionalPadding)) {
33886
+ function getProp(name, cellStyle, col, row, _table) {
33887
+ const prop = cellStyle && isValid$1(cellStyle[name]) ? cellStyle[name] : null;
33888
+ if (typeof prop === 'function') {
33889
+ const arg = {
33890
+ col,
33891
+ row,
33892
+ table: _table,
33893
+ value: _table.getCellValue(col, row),
33894
+ dataValue: _table.getCellOriginValue(col, row),
33895
+ cellHeaderPaths: _table.getCellHeaderPaths(col, row)
33896
+ };
33897
+ return prop(arg);
33898
+ }
33899
+ return prop;
33900
+ }
33901
+ function getFunctionalProp(name, cellStyle, col, row, _table) {
33902
+ const prop = cellStyle && isValid$1(cellStyle[name]) ? cellStyle[name] : null;
33903
+ if (typeof prop === 'function') {
33904
+ const arg = {
33905
+ col,
33906
+ row,
33907
+ table: _table,
33908
+ value: _table.getCellValue(col, row),
33909
+ dataValue: _table.getCellOriginValue(col, row),
33910
+ cellHeaderPaths: _table.getCellHeaderPaths(col, row)
33911
+ };
33912
+ return prop(arg);
33913
+ }
33914
+ return undefined;
33915
+ }
33916
+
33917
+ function createImageCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, table, cellTheme) {
33918
+ const headerStyle = table._getCellStyle(col, row);
33919
+ const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
33920
+ if (isValid$1(functionalPadding)) {
33759
33921
  padding = functionalPadding;
33760
33922
  }
33761
33923
  if (cellTheme?.text?.textAlign) {
@@ -33823,7 +33985,7 @@
33823
33985
  }
33824
33986
  }
33825
33987
  image.failCallback = () => {
33826
- const regedIcons = get$1();
33988
+ const regedIcons = get$2();
33827
33989
  image.image = regedIcons.damage_pic.svg;
33828
33990
  };
33829
33991
  cellGroup.appendChild(image);
@@ -33973,7 +34135,7 @@
33973
34135
  }
33974
34136
  }
33975
34137
  function isDamagePic(image) {
33976
- const regedIcons = get$1();
34138
+ const regedIcons = get$2();
33977
34139
  return image.attribute.image === regedIcons.damage_pic.svg;
33978
34140
  }
33979
34141
 
@@ -34641,6 +34803,210 @@
34641
34803
  return group;
34642
34804
  }
34643
34805
 
34806
+ const CHART_NUMBER_TYPE = genNumberType();
34807
+ class Chart extends Group$2 {
34808
+ type = 'chart';
34809
+ chartInstance;
34810
+ activeChartInstance;
34811
+ active;
34812
+ cacheCanvas;
34813
+ isShareChartSpec;
34814
+ constructor(isShareChartSpec, params) {
34815
+ super(params);
34816
+ this.numberType = CHART_NUMBER_TYPE;
34817
+ this.isShareChartSpec = isShareChartSpec;
34818
+ if (!params.chartInstance) {
34819
+ const chartInstance = new params.ClassType(params.spec, {
34820
+ renderCanvas: params.canvas,
34821
+ mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',
34822
+ modeParams: this.attribute.modeParams,
34823
+ canvasControled: false,
34824
+ viewBox: { x1: 0, x2: 0, y1: 0, y2: 0 },
34825
+ dpr: params.dpr,
34826
+ interactive: false,
34827
+ animation: false,
34828
+ autoFit: false
34829
+ });
34830
+ chartInstance.renderSync();
34831
+ params.chartInstance = this.chartInstance = chartInstance;
34832
+ }
34833
+ else {
34834
+ this.chartInstance = params.chartInstance;
34835
+ }
34836
+ }
34837
+ activate(table) {
34838
+ this.active = true;
34839
+ const { col, row } = this.parent;
34840
+ const { x1, y1, x2, y2 } = this.getViewBox();
34841
+ const tableBound = getTableBounds(col, row, table);
34842
+ const clipBound = tableBound.intersect({
34843
+ x1: x1 - table.scrollLeft,
34844
+ x2: x2 - table.scrollLeft,
34845
+ y1: y1 - table.scrollTop,
34846
+ y2: y2 - table.scrollTop
34847
+ });
34848
+ this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {
34849
+ renderCanvas: this.attribute.canvas,
34850
+ mode: 'desktop-browser',
34851
+ canvasControled: false,
34852
+ viewBox: {
34853
+ x1: x1 - table.scrollLeft,
34854
+ x2: x2 - table.scrollLeft,
34855
+ y1: y1 - table.scrollTop,
34856
+ y2: y2 - table.scrollTop
34857
+ },
34858
+ dpr: table.internalProps.pixelRatio,
34859
+ animation: false,
34860
+ interactive: true,
34861
+ autoFit: false,
34862
+ beforeRender: (stage) => {
34863
+ const ctx = stage.window.getContext();
34864
+ ctx.inuse = true;
34865
+ ctx.clearMatrix();
34866
+ ctx.setTransformForCurrent(true);
34867
+ ctx.beginPath();
34868
+ ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);
34869
+ ctx.clip();
34870
+ },
34871
+ afterRender(stage) {
34872
+ const ctx = stage.window.getContext();
34873
+ ctx.inuse = false;
34874
+ }
34875
+ });
34876
+ this.activeChartInstance.renderSync();
34877
+ table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);
34878
+ this.activeChartInstance.on('click', (params) => {
34879
+ if (Chart.temp) {
34880
+ table.scenegraph.updateChartState(params?.datum);
34881
+ }
34882
+ });
34883
+ this.activeChartInstance.on('brushEnd', (params) => {
34884
+ table.scenegraph.updateChartState(params?.value?.inBrushData);
34885
+ Chart.temp = 0;
34886
+ setTimeout(() => {
34887
+ Chart.temp = 1;
34888
+ }, 0);
34889
+ });
34890
+ table._bindChartEvent?.(this.activeChartInstance);
34891
+ }
34892
+ static temp = 1;
34893
+ deactivate() {
34894
+ this.active = false;
34895
+ this.activeChartInstance?.updateViewBox({
34896
+ x1: -1000,
34897
+ x2: -800,
34898
+ y1: -1000,
34899
+ y2: -800
34900
+ }, false, false);
34901
+ this.activeChartInstance?.release();
34902
+ this.activeChartInstance = null;
34903
+ }
34904
+ updateData(data) {
34905
+ this.attribute.data = data;
34906
+ }
34907
+ getViewBox() {
34908
+ const cellGroup = this.parent;
34909
+ const padding = this.attribute.cellPadding;
34910
+ const table = this.stage.table;
34911
+ return {
34912
+ x1: Math.ceil(cellGroup.globalAABBBounds.x1 + padding[3] + table.scrollLeft),
34913
+ x2: Math.ceil(cellGroup.globalAABBBounds.x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft),
34914
+ y1: Math.ceil(cellGroup.globalAABBBounds.y1 + padding[0] + table.scrollTop),
34915
+ y2: Math.ceil(cellGroup.globalAABBBounds.y1 + cellGroup.attribute.height - padding[2] + table.scrollTop)
34916
+ };
34917
+ }
34918
+ }
34919
+ function getTableBounds(col, row, table) {
34920
+ const { layoutMap } = table.internalProps;
34921
+ const bodyBound = new Bounds();
34922
+ const tableBound = table.scenegraph.tableGroup.globalAABBBounds;
34923
+ bodyBound.x1 = tableBound.x1;
34924
+ bodyBound.x2 = tableBound.x2;
34925
+ bodyBound.y1 = tableBound.y1;
34926
+ bodyBound.y2 = tableBound.y2;
34927
+ if (!layoutMap.isFrozenColumn(col, row) && !layoutMap.isRightFrozenColumn(col, row)) {
34928
+ bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
34929
+ bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
34930
+ bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
34931
+ bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
34932
+ }
34933
+ else if (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightTopCorner(col, row)) ;
34934
+ else if (layoutMap.isFrozenColumn(col, row)) {
34935
+ bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
34936
+ bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
34937
+ }
34938
+ else if (layoutMap.isRightFrozenColumn(col, row)) {
34939
+ bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
34940
+ bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
34941
+ }
34942
+ else if (layoutMap.isBottomFrozenRow(col, row)) {
34943
+ bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
34944
+ bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
34945
+ }
34946
+ return bodyBound;
34947
+ }
34948
+
34949
+ const chartTypes = {};
34950
+
34951
+ const builtin = {};
34952
+ function get$1() {
34953
+ return extend(builtin, chartTypes);
34954
+ }
34955
+
34956
+ function createChartCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, width, height, padding, dataValue, chartModule, chartSpec, chartInstance, dataId, table, cellTheme, isShareChartSpec) {
34957
+ const registerCharts = get$1();
34958
+ const ClassType = registerCharts[chartModule];
34959
+ const headerStyle = table._getCellStyle(col, row);
34960
+ const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
34961
+ if (isValid$1(functionalPadding)) {
34962
+ padding = functionalPadding;
34963
+ }
34964
+ if (!cellGroup) {
34965
+ cellGroup = new Group$1({
34966
+ x: xOrigin,
34967
+ y: yOrigin,
34968
+ width,
34969
+ height,
34970
+ lineWidth: cellTheme?.group?.lineWidth ?? undefined,
34971
+ fill: cellTheme?.group?.fill ?? undefined,
34972
+ stroke: cellTheme?.group?.stroke ?? undefined,
34973
+ strokeArrayWidth: cellTheme?.group?.strokeArrayWidth ?? undefined,
34974
+ strokeArrayColor: cellTheme?.group?.strokeArrayColor ?? undefined,
34975
+ cursor: cellTheme?.group?.cursor ?? undefined,
34976
+ lineDash: cellTheme?.group?.lineDash ?? undefined,
34977
+ lineCap: 'square',
34978
+ clip: true,
34979
+ cornerRadius: cellTheme.group.cornerRadius
34980
+ });
34981
+ cellGroup.role = 'cell';
34982
+ cellGroup.col = col;
34983
+ cellGroup.row = row;
34984
+ columnGroup?.addCellGroup(cellGroup);
34985
+ }
34986
+ cellGroup.AABBBounds.width();
34987
+ const chartGroup = new Chart(isShareChartSpec, {
34988
+ stroke: false,
34989
+ x: padding[3],
34990
+ y: padding[0],
34991
+ canvas: table.canvas ?? table.scenegraph.stage.window.getContext().canvas,
34992
+ mode: table.options.mode,
34993
+ modeParams: table.options.modeParams,
34994
+ spec: chartSpec,
34995
+ ClassType,
34996
+ width: width - padding[3] - padding[1],
34997
+ height: height - padding[2] - padding[0],
34998
+ chartInstance,
34999
+ dataId,
35000
+ data: table.getCellValue(col, row),
35001
+ cellPadding: padding,
35002
+ dpr: table.internalProps.pixelRatio,
35003
+ axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : []
35004
+ });
35005
+ cellGroup.appendChild(chartGroup);
35006
+ table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance);
35007
+ return cellGroup;
35008
+ }
35009
+
34644
35010
  class CellContent extends Group$1 {
34645
35011
  _leftGroup;
34646
35012
  _rightGroup;
@@ -35386,7 +35752,7 @@
35386
35752
  return cellGroup;
35387
35753
  }
35388
35754
 
35389
- const regedIcons$1 = get$1();
35755
+ const regedIcons$1 = get$2();
35390
35756
  function createVideoCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, table, cellTheme) {
35391
35757
  const headerStyle = table._getCellStyle(col, row);
35392
35758
  const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
@@ -35946,587 +36312,88 @@
35946
36312
  if (!addNew && oldCellGroup.parent) {
35947
36313
  oldCellGroup.parent.insertAfter(newCellGroup, oldCellGroup);
35948
36314
  oldCellGroup.parent.removeChild(oldCellGroup);
35949
- if (table.scenegraph?.proxy.cellCache.get(col)) {
35950
- table.scenegraph?.proxy.cellCache.set(col, newCellGroup);
35951
- }
35952
- }
35953
- return newCellGroup;
35954
- }
35955
- function canUseFastUpdate(col, row, oldCellGroup, autoWrapText, table) {
35956
- const define = table.getBodyColumnDefine(col, row);
35957
- const mayHaveIcon = !!define?.icon || !!define?.tree;
35958
- const cellType = table.getBodyColumnType(col, row);
35959
- const autoRowHeight = table.heightMode === 'autoHeight';
35960
- const value = table.getCellValue(col, row);
35961
- if (!table.isHeader(col, row) &&
35962
- oldCellGroup.role === 'cell' &&
35963
- cellType === 'text' &&
35964
- !autoWrapText &&
35965
- !autoRowHeight &&
35966
- !mayHaveIcon &&
35967
- oldCellGroup.firstChild?.type === 'text' &&
35968
- !isPromise(value)) {
35969
- return true;
35970
- }
35971
- return false;
35972
- }
35973
- function dealWithMergeCellSize(range, cellWidth, cellHeight, padding, textAlign, textBaseline, table) {
35974
- for (let col = range.start.col; col <= range.end.col; col++) {
35975
- for (let row = range.start.row; row <= range.end.row; row++) {
35976
- const cellGroup = table.scenegraph.getCell(col, row, true);
35977
- if (range.start.row !== range.end.row) {
35978
- updateCellContentHeight(cellGroup, cellHeight, cellHeight, table.heightMode === 'autoHeight', padding, textAlign, textBaseline);
35979
- }
35980
- if (range.start.col !== range.end.col) {
35981
- updateCellContentWidth(cellGroup, cellWidth, cellHeight, 0, table.heightMode === 'autoHeight', padding, textAlign, textBaseline, table.scenegraph);
35982
- }
35983
- cellGroup.contentWidth = cellWidth;
35984
- cellGroup.contentHeight = cellHeight;
35985
- const rangeHeight = table.getRowHeight(row);
35986
- const rangeWidth = table.getColWidth(col);
35987
- resizeCellGroup(cellGroup, rangeWidth, rangeHeight, range, table);
35988
- }
35989
- }
35990
- }
35991
-
35992
- function createComplexColumn(columnGroup, col, colWidth, rowStart, rowEnd, mergeMap, defaultRowHeight, table, cellLocation, rowLimit) {
35993
- let padding;
35994
- let textAlign;
35995
- let textBaseline;
35996
- let y = 0;
35997
- if (columnGroup.lastChild && columnGroup.lastChild.row === rowStart - 1) {
35998
- y = columnGroup.lastChild.attribute.y + columnGroup.lastChild.attribute.height;
35999
- }
36000
- else if (columnGroup.colHeight) {
36001
- y = columnGroup.colHeight;
36002
- }
36003
- for (let j = rowStart; j <= rowEnd; j++) {
36004
- const row = j;
36005
- let value = table.getCellValue(col, row);
36006
- let cellWidth = colWidth;
36007
- let cellHeight = table.getRowHeight(row);
36008
- let range;
36009
- let isMerge;
36010
- let customStyle;
36011
- let customResult;
36012
- if (table.internalProps.customMergeCell) {
36013
- const customMerge = table.getCustomMerge(col, row);
36014
- if (customMerge) {
36015
- const { range: customMergeRange, text: customMergeText, style: customMergeStyle, customLayout, customRender } = customMerge;
36016
- range = customMergeRange;
36017
- isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
36018
- if (isMerge) {
36019
- const needUpdateRange = rowStart > range.start.row;
36020
- const mergeSize = dealMerge(range, mergeMap, table, needUpdateRange);
36021
- cellWidth = mergeSize.cellWidth;
36022
- cellHeight = mergeSize.cellHeight;
36023
- }
36024
- value = customMergeText;
36025
- customStyle = customMergeStyle;
36026
- if (customLayout || customRender) {
36027
- 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);
36028
- }
36029
- }
36030
- }
36031
- let colForDefine = col;
36032
- let rowForDefine = row;
36033
- if (range) {
36034
- colForDefine = range.start.col;
36035
- rowForDefine = range.start.row;
36036
- }
36037
- const define = cellLocation !== 'body'
36038
- ? table.getHeaderDefine(colForDefine, rowForDefine)
36039
- : table.getBodyColumnDefine(colForDefine, rowForDefine);
36040
- const mayHaveIcon = cellLocation !== 'body' ? true : !!define?.icon || !!define?.tree;
36041
- if (!range && (cellLocation !== 'body' || define?.mergeCell)) {
36042
- range = table.getCellRange(col, row);
36043
- isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
36044
- if (isMerge) {
36045
- const needUpdateRange = rowStart > range.start.row;
36046
- const mergeSize = dealMerge(range, mergeMap, table, needUpdateRange);
36047
- cellWidth = mergeSize.cellWidth;
36048
- cellHeight = mergeSize.cellHeight;
36049
- }
36050
- }
36051
- const cellStyle = customStyle || table._getCellStyle(col, row);
36052
- const cellTheme = getStyleTheme(cellStyle, table, range ? range.start.col : col, range ? range.start.row : row, getProp).theme;
36053
- cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table);
36054
- cellTheme.group.width = colWidth;
36055
- cellTheme.group.height = Array.isArray(defaultRowHeight) ? defaultRowHeight[row] : defaultRowHeight;
36056
- if (cellTheme._vtable.padding) {
36057
- padding = cellTheme._vtable.padding;
36058
- }
36059
- if (cellTheme.text.textAlign) {
36060
- textAlign = cellTheme.text.textAlign;
36061
- }
36062
- if (cellTheme.text.textBaseline) {
36063
- textBaseline = cellTheme.text.textBaseline;
36064
- }
36065
- if (cellLocation !== 'body' && !cellTheme.group.fill) {
36066
- cellTheme.group.fill = '#fff';
36067
- }
36068
- const type = (table.isHeader(col, row) ? table._getHeaderLayoutMap(col, row).headerType : table.getBodyColumnType(col, row)) ||
36069
- 'text';
36070
- if (isPromise(value)) {
36071
- dealPromiseData(value, table, createCell.bind(null, type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult));
36072
- columnGroup.updateColumnRowNumber(row);
36073
- const height = table.getRowHeight(row);
36074
- columnGroup.updateColumnHeight(height);
36075
- y += height;
36076
- }
36077
- else {
36078
- const cellGroup = createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult);
36079
- columnGroup.updateColumnRowNumber(row);
36080
- if (isMerge) {
36081
- const rangeHeight = table.getRowHeight(row);
36082
- const rangeWidth = table.getColWidth(col);
36083
- const { width: contentWidth } = cellGroup.attribute;
36084
- const { height: contentHeight } = cellGroup.attribute;
36085
- cellGroup.contentWidth = contentWidth;
36086
- cellGroup.contentHeight = contentHeight;
36087
- resizeCellGroup(cellGroup, rangeWidth, rangeHeight, range, table);
36088
- columnGroup.updateColumnHeight(rangeHeight);
36089
- y += rangeHeight;
36090
- }
36091
- else {
36092
- columnGroup.updateColumnHeight(cellGroup.attribute.height);
36093
- y += cellGroup.attribute.height;
36094
- }
36095
- }
36096
- if (rowLimit && row > rowLimit) {
36097
- break;
36098
- }
36099
- }
36100
- columnGroup.setAttribute('width', colWidth);
36101
- return {
36102
- width: colWidth,
36103
- height: y
36104
- };
36105
- }
36106
- function resizeCellGroup(cellGroup, rangeWidth, rangeHeight, range, table) {
36107
- const { col, row } = cellGroup;
36108
- const dx = -table.getColsWidth(range.start.col, col - 1);
36109
- const dy = -table.getRowsHeight(range.start.row, row - 1);
36110
- cellGroup.forEachChildren((child) => {
36111
- child.setAttributes({
36112
- dx: (child.attribute.dx ?? 0) + dx,
36113
- dy: (child.attribute.dy ?? 0) + dy
36114
- });
36115
- });
36116
- const lineWidth = cellGroup.attribute.lineWidth;
36117
- const isLineWidthArray = isArray$1(lineWidth);
36118
- const newLineWidth = [0, 0, 0, 0];
36119
- if (col === range.start.col) {
36120
- newLineWidth[3] = isLineWidthArray ? lineWidth[3] : lineWidth;
36121
- }
36122
- if (row === range.start.row) {
36123
- newLineWidth[0] = isLineWidthArray ? lineWidth[0] : lineWidth;
36124
- }
36125
- if (col === range.end.col) {
36126
- newLineWidth[1] = isLineWidthArray ? lineWidth[1] : lineWidth;
36127
- }
36128
- if (row === range.end.row) {
36129
- newLineWidth[2] = isLineWidthArray ? lineWidth[2] : lineWidth;
36130
- }
36131
- const widthChange = rangeWidth !== cellGroup.attribute.width;
36132
- const heightChange = rangeHeight !== cellGroup.attribute.height;
36133
- cellGroup.setAttributes({
36134
- width: rangeWidth,
36135
- height: rangeHeight,
36136
- strokeArrayWidth: newLineWidth
36137
- });
36138
- cellGroup.mergeStartCol = range.start.col;
36139
- cellGroup.mergeStartRow = range.start.row;
36140
- cellGroup.mergeEndCol = range.end.col;
36141
- cellGroup.mergeEndRow = range.end.row;
36142
- return {
36143
- widthChange,
36144
- heightChange
36145
- };
36146
- }
36147
- function dealMerge(range, mergeMap, table, forceUpdate) {
36148
- let cellWidth = 0;
36149
- let cellHeight = 0;
36150
- const mergeResult = mergeMap.get(`${range.start.col},${range.start.row};${range.end.col},${range.end.row}`);
36151
- if (!mergeResult || forceUpdate) {
36152
- for (let col = range.start.col; col <= range.end.col; col++) {
36153
- cellWidth += table.getColWidth(col);
36154
- }
36155
- for (let i = range.start.row; i <= range.end.row; i++) {
36156
- cellHeight += table.getRowHeight(i);
36157
- }
36158
- mergeMap.set(`${range.start.col},${range.start.row};${range.end.col},${range.end.row}`, {
36159
- cellWidth,
36160
- cellHeight
36161
- });
36162
- }
36163
- else {
36164
- cellWidth = mergeResult.cellWidth;
36165
- cellHeight = mergeResult.cellHeight;
36166
- }
36167
- return {
36168
- cellWidth,
36169
- cellHeight
36170
- };
36171
- }
36172
-
36173
- function dealWithCustom(customLayout, customRender, col, row, width, height, autoWidth, autoHeight, padding, table) {
36174
- let renderDefault = true;
36175
- let enableCellPadding = false;
36176
- let expectedWidth;
36177
- let expectedHeight;
36178
- let customElements;
36179
- let elementsGroup;
36180
- if (typeof customLayout === 'function') {
36181
- const arg = {
36182
- col,
36183
- row,
36184
- dataValue: table.getCellOriginValue(col, row),
36185
- value: table.getCellValue(col, row) || '',
36186
- rect: {
36187
- left: 0,
36188
- top: 0,
36189
- right: width,
36190
- bottom: height,
36191
- width,
36192
- height
36193
- },
36194
- table
36195
- };
36196
- const customRenderObj = customLayout(arg);
36197
- if (customRenderObj.rootContainer) {
36198
- customRenderObj.rootContainer = decodeReactDom(customRenderObj.rootContainer);
36199
- }
36200
- if (customRenderObj.rootContainer instanceof Group$2) {
36201
- elementsGroup = customRenderObj.rootContainer;
36202
- elementsGroup.name = 'custom-container';
36203
- }
36204
- renderDefault = customRenderObj.renderDefault;
36205
- enableCellPadding = customRenderObj.enableCellPadding;
36206
- }
36207
- else if (typeof customRender === 'function') {
36208
- const arg = {
36209
- col,
36210
- row,
36211
- dataValue: table.getCellOriginValue(col, row),
36212
- value: table.getCellValue(col, row) || '',
36213
- rect: {
36214
- left: 0,
36215
- top: 0,
36216
- right: width,
36217
- bottom: height,
36218
- width,
36219
- height
36220
- },
36221
- table
36222
- };
36223
- const customRenderObj = customRender(arg);
36224
- if (customRenderObj) {
36225
- customElements = customRenderObj.elements;
36226
- renderDefault = customRenderObj.renderDefault;
36227
- expectedWidth = customRenderObj.expectedWidth;
36228
- expectedHeight = customRenderObj.expectedHeight;
36229
- }
36230
- }
36231
- else if (customRender) {
36232
- expectedWidth = customRender.expectedWidth;
36233
- expectedHeight = customRender.expectedHeight;
36234
- customElements = customRender.elements;
36235
- renderDefault = customRender.renderDefault;
36236
- }
36237
- if (customElements) {
36238
- const value = table.getCellValue(col, row);
36239
- elementsGroup = adjustElementToGroup(customElements, autoWidth ? expectedWidth : width, autoHeight ? expectedHeight : height, value);
36240
- }
36241
- if (enableCellPadding) {
36242
- elementsGroup.setAttributes({
36243
- x: padding[3],
36244
- y: padding[0],
36245
- width: width - padding[1] - padding[3],
36246
- height: height - padding[0] - padding[2]
36247
- });
36248
- }
36249
- dealPercentCalc(elementsGroup, width, height);
36250
- return {
36251
- elementsGroup,
36252
- renderDefault
36253
- };
36254
- }
36255
- function adjustElementToGroup(elements, width, height, value) {
36256
- const customGroup = new Group$2({
36257
- x: 0,
36258
- y: 0,
36259
- width,
36260
- height,
36261
- fill: false,
36262
- stroke: false,
36263
- pickable: false
36264
- });
36265
- customGroup.name = 'custom-container';
36266
- const elementsAdjusted = adjustElementsPos(elements, width, height, value);
36267
- elementsAdjusted.forEach(element => {
36268
- if (element.clickable) {
36269
- element.pickable = element.clickable;
36270
- }
36271
- switch (element.type) {
36272
- case 'arc':
36273
- const arc = createArc({
36274
- x: element.x,
36275
- y: element.y,
36276
- dx: (element.dx ?? 0),
36277
- dy: (element.dy ?? 0),
36278
- fill: element.fill,
36279
- stroke: element.stroke,
36280
- outerRadius: element.radius,
36281
- startAngle: element.startAngle,
36282
- endAngle: element.endAngle,
36283
- pickable: !!element.pickable,
36284
- cursor: element.cursor
36285
- });
36286
- arc.name = element.name;
36287
- customGroup.appendChild(arc);
36288
- break;
36289
- case 'text':
36290
- if (element.background) {
36291
- const expandX = element.background?.expandX ?? 0;
36292
- const expandY = element.background?.expandY ?? 0;
36293
- const textBackRect = createRect({
36294
- x: element.x - expandX,
36295
- y: element.y - expandY,
36296
- dx: (element.dx ?? 0),
36297
- dy: (element.dy ?? 0),
36298
- width: element.width + expandX * 2,
36299
- height: element.height + expandY * 2,
36300
- cornerRadius: element.background?.cornerRadius ?? 0,
36301
- fill: element.background?.fill ?? '#888'
36302
- });
36303
- customGroup.appendChild(textBackRect);
36304
- }
36305
- const text = new Text$1(Object.assign({
36306
- pickable: !!element.pickable,
36307
- fill: element.color ?? element.fill
36308
- }, element));
36309
- text.name = element.name;
36310
- customGroup.appendChild(text);
36311
- break;
36312
- case 'rect':
36313
- const rect = createRect({
36314
- x: element.x,
36315
- y: element.y,
36316
- dx: (element.dx ?? 0),
36317
- dy: (element.dy ?? 0),
36318
- width: element.width,
36319
- height: element.height,
36320
- cornerRadius: element.radius,
36321
- fill: element.fill,
36322
- stroke: element.stroke,
36323
- pickable: !!element.pickable,
36324
- cursor: element.cursor
36325
- });
36326
- rect.name = element.name;
36327
- customGroup.appendChild(rect);
36328
- break;
36329
- case 'circle':
36330
- const circle = createCircle({
36331
- x: element.x,
36332
- y: element.y,
36333
- dx: (element.dx ?? 0),
36334
- dy: (element.dy ?? 0),
36335
- radius: element.radius,
36336
- fill: element.fill,
36337
- stroke: element.stroke,
36338
- pickable: !!element.pickable,
36339
- cursor: element.cursor
36340
- });
36341
- circle.name = element.name;
36342
- customGroup.appendChild(circle);
36343
- break;
36344
- case 'icon':
36345
- const icon = new Icon$1({
36346
- x: element.x,
36347
- y: element.y,
36348
- dx: (element.dx ?? 0),
36349
- dy: (element.dy ?? 0),
36350
- width: element.width,
36351
- height: element.height,
36352
- image: element.svg,
36353
- backgroundWidth: element.hover ? (element.hover.width ?? element.width) : undefined,
36354
- backgroundHeight: element.hover ? (element.hover.width ?? element.width) : undefined,
36355
- backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,
36356
- pickable: !!element.pickable,
36357
- cursor: element.cursor
36358
- });
36359
- icon.name = element.name;
36360
- icon.role = 'icon-custom';
36361
- customGroup.appendChild(icon);
36362
- break;
36363
- case 'image':
36364
- const image = new Icon$1({
36365
- x: element.x,
36366
- y: element.y,
36367
- dx: (element.dx ?? 0),
36368
- dy: (element.dy ?? 0),
36369
- width: element.width,
36370
- height: element.height,
36371
- image: element.src,
36372
- backgroundWidth: element.hover ? (element.hover.width ?? element.width) : undefined,
36373
- backgroundHeight: element.hover ? (element.hover.width ?? element.width) : undefined,
36374
- backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,
36375
- pickable: !!element.pickable,
36376
- cursor: element.cursor,
36377
- shape: element.shape
36378
- });
36379
- image.name = element.name;
36380
- image.role = 'image-custom';
36381
- customGroup.appendChild(image);
36382
- break;
36383
- case 'line':
36384
- const line = createLine({
36385
- points: element.points,
36386
- stroke: element.stroke,
36387
- pickable: !!element.pickable,
36388
- cursor: element.cursor
36389
- });
36390
- line.name = element.name;
36391
- customGroup.appendChild(line);
36392
- break;
36393
- }
36394
- });
36395
- return customGroup;
36396
- }
36397
- function adjustElementsPos(originalElements, width, height, value) {
36398
- const result = [];
36399
- const left = 0;
36400
- const top = 0;
36401
- const borderLineWidths = [0, 0, 0, 0];
36402
- for (let i = 0; i < originalElements.length; i++) {
36403
- const originalElement = originalElements[i];
36404
- const element = Object.assign({}, originalElement);
36405
- for (const name in element) {
36406
- if (element.hasOwnProperty(name) && isFunction$1(element[name])) {
36407
- element[name] = element[name](value);
36408
- }
36409
- }
36410
- const rect = element;
36411
- if (isValid$1(rect.x)) {
36412
- rect.x = isString$2(rect.x)
36413
- ? transformString(rect.x, width - borderLineWidths[1])
36414
- : Number(rect.x);
36415
- }
36416
- if (isValid$1(rect.y)) {
36417
- rect.y = isString$2(rect.y)
36418
- ? transformString(rect.y, height - borderLineWidths[2])
36419
- : Number(rect.y);
36420
- }
36421
- if ('width' in element) {
36422
- element.width = isString$2(element.width)
36423
- ? transformString(element.width, width - borderLineWidths[1])
36424
- : Number(element.width);
36425
- }
36426
- if ('height' in element) {
36427
- element.height = isString$2(element.height)
36428
- ? transformString(element.height, height - borderLineWidths[2])
36429
- : Number(element.height);
36430
- }
36431
- if ('radius' in element) {
36432
- element.radius = isString$2(element.radius)
36433
- ? transformString(element.radius, Math.min(width - borderLineWidths[1], height - borderLineWidths[2]))
36434
- : Number(element.radius);
36435
- }
36436
- if ('hover' in element) {
36437
- element.hover.x = isString$2(element.hover.x)
36438
- ? transformString(element.hover.x, width - borderLineWidths[1])
36439
- : Number(element.hover.x);
36440
- element.hover.y = isString$2(element.hover.y)
36441
- ? transformString(element.hover.y, height - borderLineWidths[2])
36442
- : Number(element.hover.y);
36443
- element.hover.width = isString$2(element.hover.width)
36444
- ? transformString(element.hover.width, width - borderLineWidths[1])
36445
- : Number(element.hover.width);
36446
- element.hover.height = isString$2(element.hover.height)
36447
- ? transformString(element.hover.height, height - borderLineWidths[2])
36448
- : Number(element.hover.height);
36449
- element.hover.x += left;
36450
- element.hover.y += top;
36451
- }
36452
- rect.x = rect.x + left;
36453
- rect.y = rect.y + top;
36454
- result.push(element);
36455
- }
36456
- return result;
36457
- }
36458
- function transformString(str, size) {
36459
- if (str.endsWith('px')) {
36460
- return parseInt(str, 10);
36461
- }
36462
- else if (str.endsWith('%') && size) {
36463
- return (parseInt(str, 10) / 100) * size;
36464
- }
36465
- return parseInt(str, 10);
36466
- }
36467
- function dealPercentCalc(group, parentWidth, parentHeight) {
36468
- if (!group) {
36469
- return;
36470
- }
36471
- group.forEachChildren((child) => {
36472
- if (!child) {
36473
- return;
36474
- }
36475
- if (isObject$4(child.attribute.width) && child.attribute.width.percent) {
36476
- child.setAttribute('width', (child.attribute.width.percent / 100) * parentWidth +
36477
- (child.attribute.width.delta ?? 0));
36478
- }
36479
- if (isObject$4(child.attribute.height) && child.attribute.height.percent) {
36480
- child.setAttribute('height', (child.attribute.height.percent / 100) * parentHeight +
36481
- (child.attribute.height.delta ?? 0));
36482
- }
36483
- if (child.type === 'group') {
36484
- dealPercentCalc(child, child.attribute.width, child.attribute.height);
36315
+ if (table.scenegraph?.proxy.cellCache.get(col)) {
36316
+ table.scenegraph?.proxy.cellCache.set(col, newCellGroup);
36485
36317
  }
36486
- });
36318
+ }
36319
+ return newCellGroup;
36487
36320
  }
36488
- function decodeReactDom(dom) {
36489
- if (!dom || !dom.$$typeof) {
36490
- return dom;
36321
+ function canUseFastUpdate(col, row, oldCellGroup, autoWrapText, table) {
36322
+ const define = table.getBodyColumnDefine(col, row);
36323
+ const mayHaveIcon = !!define?.icon || !!define?.tree;
36324
+ const cellType = table.getBodyColumnType(col, row);
36325
+ const autoRowHeight = table.heightMode === 'autoHeight';
36326
+ const value = table.getCellValue(col, row);
36327
+ if (!table.isHeader(col, row) &&
36328
+ oldCellGroup.role === 'cell' &&
36329
+ cellType === 'text' &&
36330
+ !autoWrapText &&
36331
+ !autoRowHeight &&
36332
+ !mayHaveIcon &&
36333
+ oldCellGroup.firstChild?.type === 'text' &&
36334
+ !isPromise(value)) {
36335
+ return true;
36491
36336
  }
36492
- const type = dom.type;
36493
- const { attribute, children, stateProxy } = dom.props;
36494
- const g = type({ attribute });
36495
- parseToGraphic(g, dom.props);
36496
- if (stateProxy) {
36497
- g.stateProxy = stateProxy;
36337
+ return false;
36338
+ }
36339
+ function dealWithMergeCellSize(range, cellWidth, cellHeight, padding, textAlign, textBaseline, table) {
36340
+ for (let col = range.start.col; col <= range.end.col; col++) {
36341
+ for (let row = range.start.row; row <= range.end.row; row++) {
36342
+ const cellGroup = table.scenegraph.getCell(col, row, true);
36343
+ if (range.start.row !== range.end.row) {
36344
+ updateCellContentHeight(cellGroup, cellHeight, cellHeight, table.heightMode === 'autoHeight', padding, textAlign, textBaseline);
36345
+ }
36346
+ if (range.start.col !== range.end.col) {
36347
+ updateCellContentWidth(cellGroup, cellWidth, cellHeight, 0, table.heightMode === 'autoHeight', padding, textAlign, textBaseline, table.scenegraph);
36348
+ }
36349
+ cellGroup.contentWidth = cellWidth;
36350
+ cellGroup.contentHeight = cellHeight;
36351
+ const rangeHeight = table.getRowHeight(row);
36352
+ const rangeWidth = table.getColWidth(col);
36353
+ resizeCellGroup(cellGroup, rangeWidth, rangeHeight, range, table);
36354
+ }
36498
36355
  }
36499
- g.id = attribute.id;
36500
- g.name = attribute.name;
36501
- if (isArray$1(children)) {
36502
- children.forEach((item) => {
36503
- const c = decodeReactDom(item);
36504
- c && c.type && g.add(c);
36356
+ }
36357
+ function resizeCellGroup(cellGroup, rangeWidth, rangeHeight, range, table) {
36358
+ const { col, row } = cellGroup;
36359
+ const dx = -table.getColsWidth(range.start.col, col - 1);
36360
+ const dy = -table.getRowsHeight(range.start.row, row - 1);
36361
+ cellGroup.forEachChildren((child) => {
36362
+ child.setAttributes({
36363
+ dx: (child.attribute.dx ?? 0) + dx,
36364
+ dy: (child.attribute.dy ?? 0) + dy
36505
36365
  });
36366
+ });
36367
+ const lineWidth = cellGroup.attribute.lineWidth;
36368
+ const isLineWidthArray = isArray$1(lineWidth);
36369
+ const newLineWidth = [0, 0, 0, 0];
36370
+ if (col === range.start.col) {
36371
+ newLineWidth[3] = isLineWidthArray ? lineWidth[3] : lineWidth;
36506
36372
  }
36507
- else if (children) {
36508
- g.add(decodeReactDom(children));
36373
+ if (row === range.start.row) {
36374
+ newLineWidth[0] = isLineWidthArray ? lineWidth[0] : lineWidth;
36509
36375
  }
36510
- return g;
36511
- }
36512
- function parseToGraphic(g, props) {
36513
- let isGraphic = false;
36514
- switch (g.type) {
36515
- case 'richtext':
36516
- break;
36517
- case 'rich/image':
36518
- break;
36519
- default:
36520
- isGraphic = true;
36376
+ if (col === range.end.col) {
36377
+ newLineWidth[1] = isLineWidthArray ? lineWidth[1] : lineWidth;
36521
36378
  }
36522
- if (isGraphic) {
36523
- Object.keys(props).forEach(k => {
36524
- const en = REACT_TO_CANOPUS_EVENTS[k];
36525
- if (en) {
36526
- g.on(en, props[k]);
36527
- }
36528
- });
36379
+ if (row === range.end.row) {
36380
+ newLineWidth[2] = isLineWidthArray ? lineWidth[2] : lineWidth;
36529
36381
  }
36382
+ const widthChange = rangeWidth !== cellGroup.attribute.width;
36383
+ const heightChange = rangeHeight !== cellGroup.attribute.height;
36384
+ cellGroup.setAttributes({
36385
+ width: rangeWidth,
36386
+ height: rangeHeight,
36387
+ strokeArrayWidth: newLineWidth
36388
+ });
36389
+ cellGroup.mergeStartCol = range.start.col;
36390
+ cellGroup.mergeStartRow = range.start.row;
36391
+ cellGroup.mergeEndCol = range.end.col;
36392
+ cellGroup.mergeEndRow = range.end.row;
36393
+ return {
36394
+ widthChange,
36395
+ heightChange
36396
+ };
36530
36397
  }
36531
36398
  function getCustomCellMergeCustom(col, row, cellGroup, table) {
36532
36399
  if (table.internalProps.customMergeCell) {
@@ -38850,7 +38717,7 @@
38850
38717
  }
38851
38718
  };
38852
38719
 
38853
- const regedIcons = get$1();
38720
+ const regedIcons = get$2();
38854
38721
  class DrillIcon {
38855
38722
  icon;
38856
38723
  constructor() {
@@ -40725,7 +40592,7 @@
40725
40592
  return false;
40726
40593
  }
40727
40594
  if (!loadingImage) {
40728
- const regedIcons = get$1();
40595
+ const regedIcons = get$2();
40729
40596
  const svg = regedIcons.loading_pic.svg;
40730
40597
  const width = regedIcons.loading_pic.width;
40731
40598
  const height = regedIcons.loading_pic.height;
@@ -41195,6 +41062,146 @@
41195
41062
  const emptyGroup = new Group$1({});
41196
41063
  emptyGroup.role = 'empty';
41197
41064
 
41065
+ function createComplexColumn(columnGroup, col, colWidth, rowStart, rowEnd, mergeMap, defaultRowHeight, table, cellLocation, rowLimit) {
41066
+ let padding;
41067
+ let textAlign;
41068
+ let textBaseline;
41069
+ let y = 0;
41070
+ if (columnGroup.lastChild && columnGroup.lastChild.row === rowStart - 1) {
41071
+ y = columnGroup.lastChild.attribute.y + columnGroup.lastChild.attribute.height;
41072
+ }
41073
+ else if (columnGroup.colHeight) {
41074
+ y = columnGroup.colHeight;
41075
+ }
41076
+ for (let j = rowStart; j <= rowEnd; j++) {
41077
+ const row = j;
41078
+ let value = table.getCellValue(col, row);
41079
+ let cellWidth = colWidth;
41080
+ let cellHeight = table.getRowHeight(row);
41081
+ let range;
41082
+ let isMerge;
41083
+ let customStyle;
41084
+ let customResult;
41085
+ if (table.internalProps.customMergeCell) {
41086
+ const customMerge = table.getCustomMerge(col, row);
41087
+ if (customMerge) {
41088
+ const { range: customMergeRange, text: customMergeText, style: customMergeStyle, customLayout, customRender } = customMerge;
41089
+ range = customMergeRange;
41090
+ isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
41091
+ if (isMerge) {
41092
+ const needUpdateRange = rowStart > range.start.row;
41093
+ const mergeSize = dealMerge(range, mergeMap, table, needUpdateRange);
41094
+ cellWidth = mergeSize.cellWidth;
41095
+ cellHeight = mergeSize.cellHeight;
41096
+ }
41097
+ value = customMergeText;
41098
+ customStyle = customMergeStyle;
41099
+ if (customLayout || customRender) {
41100
+ 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);
41101
+ }
41102
+ }
41103
+ }
41104
+ let colForDefine = col;
41105
+ let rowForDefine = row;
41106
+ if (range) {
41107
+ colForDefine = range.start.col;
41108
+ rowForDefine = range.start.row;
41109
+ }
41110
+ const define = cellLocation !== 'body'
41111
+ ? table.getHeaderDefine(colForDefine, rowForDefine)
41112
+ : table.getBodyColumnDefine(colForDefine, rowForDefine);
41113
+ const mayHaveIcon = cellLocation !== 'body' ? true : !!define?.icon || !!define?.tree;
41114
+ if (!range && (cellLocation !== 'body' || define?.mergeCell)) {
41115
+ range = table.getCellRange(col, row);
41116
+ isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
41117
+ if (isMerge) {
41118
+ const needUpdateRange = rowStart > range.start.row;
41119
+ const mergeSize = dealMerge(range, mergeMap, table, needUpdateRange);
41120
+ cellWidth = mergeSize.cellWidth;
41121
+ cellHeight = mergeSize.cellHeight;
41122
+ }
41123
+ }
41124
+ const cellStyle = customStyle || table._getCellStyle(col, row);
41125
+ const cellTheme = getStyleTheme(cellStyle, table, range ? range.start.col : col, range ? range.start.row : row, getProp).theme;
41126
+ cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table);
41127
+ cellTheme.group.width = colWidth;
41128
+ cellTheme.group.height = Array.isArray(defaultRowHeight) ? defaultRowHeight[row] : defaultRowHeight;
41129
+ if (cellTheme._vtable.padding) {
41130
+ padding = cellTheme._vtable.padding;
41131
+ }
41132
+ if (cellTheme.text.textAlign) {
41133
+ textAlign = cellTheme.text.textAlign;
41134
+ }
41135
+ if (cellTheme.text.textBaseline) {
41136
+ textBaseline = cellTheme.text.textBaseline;
41137
+ }
41138
+ if (cellLocation !== 'body' && !cellTheme.group.fill) {
41139
+ cellTheme.group.fill = '#fff';
41140
+ }
41141
+ const type = (table.isHeader(col, row) ? table._getHeaderLayoutMap(col, row).headerType : table.getBodyColumnType(col, row)) ||
41142
+ 'text';
41143
+ if (isPromise(value)) {
41144
+ dealPromiseData(value, table, createCell.bind(null, type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult));
41145
+ columnGroup.updateColumnRowNumber(row);
41146
+ const height = table.getRowHeight(row);
41147
+ columnGroup.updateColumnHeight(height);
41148
+ y += height;
41149
+ }
41150
+ else {
41151
+ const cellGroup = createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult);
41152
+ columnGroup.updateColumnRowNumber(row);
41153
+ if (isMerge) {
41154
+ const rangeHeight = table.getRowHeight(row);
41155
+ const rangeWidth = table.getColWidth(col);
41156
+ const { width: contentWidth } = cellGroup.attribute;
41157
+ const { height: contentHeight } = cellGroup.attribute;
41158
+ cellGroup.contentWidth = contentWidth;
41159
+ cellGroup.contentHeight = contentHeight;
41160
+ resizeCellGroup(cellGroup, rangeWidth, rangeHeight, range, table);
41161
+ columnGroup.updateColumnHeight(rangeHeight);
41162
+ y += rangeHeight;
41163
+ }
41164
+ else {
41165
+ columnGroup.updateColumnHeight(cellGroup.attribute.height);
41166
+ y += cellGroup.attribute.height;
41167
+ }
41168
+ }
41169
+ if (rowLimit && row > rowLimit) {
41170
+ break;
41171
+ }
41172
+ }
41173
+ columnGroup.setAttribute('width', colWidth);
41174
+ return {
41175
+ width: colWidth,
41176
+ height: y
41177
+ };
41178
+ }
41179
+ function dealMerge(range, mergeMap, table, forceUpdate) {
41180
+ let cellWidth = 0;
41181
+ let cellHeight = 0;
41182
+ const mergeResult = mergeMap.get(`${range.start.col},${range.start.row};${range.end.col},${range.end.row}`);
41183
+ if (!mergeResult || forceUpdate) {
41184
+ for (let col = range.start.col; col <= range.end.col; col++) {
41185
+ cellWidth += table.getColWidth(col);
41186
+ }
41187
+ for (let i = range.start.row; i <= range.end.row; i++) {
41188
+ cellHeight += table.getRowHeight(i);
41189
+ }
41190
+ mergeMap.set(`${range.start.col},${range.start.row};${range.end.col},${range.end.row}`, {
41191
+ cellWidth,
41192
+ cellHeight
41193
+ });
41194
+ }
41195
+ else {
41196
+ cellWidth = mergeResult.cellWidth;
41197
+ cellHeight = mergeResult.cellHeight;
41198
+ }
41199
+ return {
41200
+ cellWidth,
41201
+ cellHeight
41202
+ };
41203
+ }
41204
+
41198
41205
  function createColGroup(containerGroup, xOrigin, yOrigin, colStart, colEnd, rowStart, rowEnd, cellLocation, table, rowLimit) {
41199
41206
  if (colStart > colEnd || rowStart > rowEnd) {
41200
41207
  return;
@@ -49568,7 +49575,7 @@
49568
49575
  _table;
49569
49576
  constructor(_table) {
49570
49577
  this._table = _table;
49571
- const regedIcons = get$1();
49578
+ const regedIcons = get$2();
49572
49579
  this.expandIcon = regedIcons[InternalIconName.expandIconName];
49573
49580
  this.collapseIcon = regedIcons[InternalIconName.collapseIconName];
49574
49581
  }
@@ -49590,7 +49597,7 @@
49590
49597
  else {
49591
49598
  iconResults = iconDefine;
49592
49599
  }
49593
- const regedIcons = get$1();
49600
+ const regedIcons = get$2();
49594
49601
  const addIcon = (columnIcon) => {
49595
49602
  let icon;
49596
49603
  if (typeof columnIcon === 'string') {
@@ -50336,7 +50343,7 @@
50336
50343
  _table;
50337
50344
  constructor(_table) {
50338
50345
  this._table = _table;
50339
- const regedIcons = get$1();
50346
+ const regedIcons = get$2();
50340
50347
  this.freezeIcon = regedIcons[InternalIconName.freezeIconName];
50341
50348
  this.frozenIcon = regedIcons[InternalIconName.frozenIconName];
50342
50349
  this.frozenCurrentIcon = regedIcons[InternalIconName.frozenCurrentIconName];
@@ -50421,7 +50428,7 @@
50421
50428
  else {
50422
50429
  headerIconStrs = headerIcon;
50423
50430
  }
50424
- const regedIcons = get$1();
50431
+ const regedIcons = get$2();
50425
50432
  const addIcon = (headerIcon) => {
50426
50433
  let icon;
50427
50434
  if (typeof headerIcon === 'string') {
@@ -52453,7 +52460,7 @@
52453
52460
  return TABLE_EVENT_TYPE;
52454
52461
  }
52455
52462
  options;
52456
- version = "0.20.0";
52463
+ version = "0.20.1-alpha.0";
52457
52464
  pagination;
52458
52465
  id = `VTable${Date.now()}`;
52459
52466
  headerStyleCache;
@@ -56385,7 +56392,7 @@
56385
56392
  range1.start.row === range2.start.row &&
56386
56393
  range1.end.row === range2.end.row);
56387
56394
  }
56388
- getRecordIndexByCell(col, row) {
56395
+ getRecordShowIndexByCell(col, row) {
56389
56396
  const skipRowCount = this.hasAggregationOnTopCount ? this.headerLevelCount + 1 : this.headerLevelCount;
56390
56397
  if (this.transpose) {
56391
56398
  if (col < skipRowCount) {
@@ -57152,7 +57159,12 @@
57152
57159
  }
57153
57160
  getRecordShowIndexByCell(col, row) {
57154
57161
  const { layoutMap } = this.internalProps;
57155
- return layoutMap.getRecordIndexByCell(col, row);
57162
+ return layoutMap.getRecordShowIndexByCell(col, row);
57163
+ }
57164
+ getRecordIndexByCell(col, row) {
57165
+ const { layoutMap } = this.internalProps;
57166
+ const recordShowIndex = layoutMap.getRecordShowIndexByCell(col, row);
57167
+ return this.dataSource.currentPagerIndexedData[recordShowIndex];
57156
57168
  }
57157
57169
  getTableIndexByRecordIndex(recordIndex) {
57158
57170
  if (this.transpose) {
@@ -59285,7 +59297,7 @@
59285
59297
  getRecordStartRowByRecordIndex(index) {
59286
59298
  return this.columnHeaderLevelCount + index;
59287
59299
  }
59288
- getRecordIndexByCell(col, row) {
59300
+ getRecordShowIndexByCell(col, row) {
59289
59301
  return undefined;
59290
59302
  }
59291
59303
  getCellHeaderPathsWidthTreeNode(col, row) {
@@ -63506,7 +63518,7 @@
63506
63518
  constructor(options) {
63507
63519
  let cache;
63508
63520
  if (isString$2(options.iconName)) {
63509
- const regedIcons = get$1();
63521
+ const regedIcons = get$2();
63510
63522
  cache = regedIcons[options.iconName];
63511
63523
  if (cache) {
63512
63524
  options.width = options.width ?? cache.width;
@@ -63931,9 +63943,9 @@
63931
63943
  }
63932
63944
 
63933
63945
  registerForVrender();
63934
- const version = "0.20.0";
63946
+ const version = "0.20.1-alpha.0";
63935
63947
  function getIcons() {
63936
- return get$1();
63948
+ return get$2();
63937
63949
  }
63938
63950
  function clearGlobal() {
63939
63951
  clearAll();