@visactor/vtable 0.17.10-alpha.5 → 0.17.10-alpha.7

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 (49) hide show
  1. package/cjs/core/BaseTable.js +1 -1
  2. package/cjs/core/BaseTable.js.map +1 -1
  3. package/cjs/index.d.ts +1 -1
  4. package/cjs/index.js +1 -1
  5. package/cjs/index.js.map +1 -1
  6. package/cjs/scenegraph/component/custom.d.ts +5 -0
  7. package/cjs/scenegraph/component/custom.js +20 -3
  8. package/cjs/scenegraph/component/custom.js.map +1 -1
  9. package/cjs/scenegraph/group-creater/cell-helper.js +22 -21
  10. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  11. package/cjs/scenegraph/group-creater/cell-type/text-cell.js +1 -1
  12. package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  13. package/cjs/scenegraph/group-creater/column-helper.js +1 -1
  14. package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
  15. package/cjs/scenegraph/layout/update-height.js +18 -16
  16. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  17. package/cjs/scenegraph/layout/update-width.js +19 -17
  18. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  19. package/cjs/scenegraph/utils/get-cell-merge.js +4 -0
  20. package/cjs/scenegraph/utils/get-cell-merge.js.map +1 -1
  21. package/cjs/scenegraph/utils/text-icon-layout.d.ts +3 -3
  22. package/cjs/scenegraph/utils/text-icon-layout.js +12 -10
  23. package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
  24. package/dist/vtable.js +912 -860
  25. package/dist/vtable.min.js +2 -2
  26. package/es/core/BaseTable.js +1 -1
  27. package/es/core/BaseTable.js.map +1 -1
  28. package/es/index.d.ts +1 -1
  29. package/es/index.js +1 -1
  30. package/es/index.js.map +1 -1
  31. package/es/scenegraph/component/custom.d.ts +5 -0
  32. package/es/scenegraph/component/custom.js +18 -0
  33. package/es/scenegraph/component/custom.js.map +1 -1
  34. package/es/scenegraph/group-creater/cell-helper.js +20 -19
  35. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  36. package/es/scenegraph/group-creater/cell-type/text-cell.js +1 -1
  37. package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  38. package/es/scenegraph/group-creater/column-helper.js +1 -1
  39. package/es/scenegraph/group-creater/column-helper.js.map +1 -1
  40. package/es/scenegraph/layout/update-height.js +17 -15
  41. package/es/scenegraph/layout/update-height.js.map +1 -1
  42. package/es/scenegraph/layout/update-width.js +18 -16
  43. package/es/scenegraph/layout/update-width.js.map +1 -1
  44. package/es/scenegraph/utils/get-cell-merge.js +4 -0
  45. package/es/scenegraph/utils/get-cell-merge.js.map +1 -1
  46. package/es/scenegraph/utils/text-icon-layout.d.ts +3 -3
  47. package/es/scenegraph/utils/text-icon-layout.js +10 -10
  48. package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
  49. package/package.json +2 -2
package/dist/vtable.js CHANGED
@@ -23928,6 +23928,12 @@
23928
23928
  });
23929
23929
 
23930
23930
  function getCellMergeInfo(table, col, row) {
23931
+ if (table.internalProps.customMergeCell) {
23932
+ const customMerge = table.getCustomMerge(col, row);
23933
+ if (customMerge) {
23934
+ return customMerge.range;
23935
+ }
23936
+ }
23931
23937
  if (!table.isHeader(col, row) && !table.getBodyColumnDefine(col, row)?.mergeCell) {
23932
23938
  return false;
23933
23939
  }
@@ -31806,356 +31812,456 @@
31806
31812
  }
31807
31813
  };
31808
31814
 
31809
- function dealWithCustom(customLayout, customRender, col, row, width, height, autoWidth, autoHeight, padding, table) {
31810
- let renderDefault = true;
31811
- let enableCellPadding = false;
31812
- let expectedWidth;
31813
- let expectedHeight;
31814
- let customElements;
31815
- let elementsGroup;
31816
- if (typeof customLayout === 'function') {
31815
+ function getProp(name, cellStyle, col, row, _table) {
31816
+ const prop = cellStyle && isValid$1(cellStyle[name]) ? cellStyle[name] : null;
31817
+ if (typeof prop === 'function') {
31817
31818
  const arg = {
31818
31819
  col,
31819
31820
  row,
31820
- dataValue: table.getCellOriginValue(col, row),
31821
- value: table.getCellValue(col, row) || '',
31822
- rect: {
31823
- left: 0,
31824
- top: 0,
31825
- right: width,
31826
- bottom: height,
31827
- width,
31828
- height
31829
- },
31830
- table
31821
+ table: _table,
31822
+ value: _table.getCellValue(col, row),
31823
+ dataValue: _table.getCellOriginValue(col, row),
31824
+ cellHeaderPaths: _table.getCellHeaderPaths(col, row)
31831
31825
  };
31832
- const customRenderObj = customLayout(arg);
31833
- if (customRenderObj.rootContainer) {
31834
- customRenderObj.rootContainer = decodeReactDom(customRenderObj.rootContainer);
31835
- }
31836
- if (customRenderObj.rootContainer instanceof Group$2) {
31837
- elementsGroup = customRenderObj.rootContainer;
31838
- elementsGroup.name = 'custom-container';
31839
- }
31840
- renderDefault = customRenderObj.renderDefault;
31841
- enableCellPadding = customRenderObj.enableCellPadding;
31826
+ return prop(arg);
31842
31827
  }
31843
- else if (typeof customRender === 'function') {
31828
+ return prop;
31829
+ }
31830
+ function getFunctionalProp(name, cellStyle, col, row, _table) {
31831
+ const prop = cellStyle && isValid$1(cellStyle[name]) ? cellStyle[name] : null;
31832
+ if (typeof prop === 'function') {
31844
31833
  const arg = {
31845
31834
  col,
31846
31835
  row,
31847
- dataValue: table.getCellOriginValue(col, row),
31848
- value: table.getCellValue(col, row) || '',
31849
- rect: {
31850
- left: 0,
31851
- top: 0,
31852
- right: width,
31853
- bottom: height,
31854
- width,
31855
- height
31856
- },
31857
- table
31836
+ table: _table,
31837
+ value: _table.getCellValue(col, row),
31838
+ dataValue: _table.getCellOriginValue(col, row),
31839
+ cellHeaderPaths: _table.getCellHeaderPaths(col, row)
31858
31840
  };
31859
- const customRenderObj = customRender(arg);
31860
- if (customRenderObj) {
31861
- customElements = customRenderObj.elements;
31862
- renderDefault = customRenderObj.renderDefault;
31863
- expectedWidth = customRenderObj.expectedWidth;
31864
- expectedHeight = customRenderObj.expectedHeight;
31841
+ return prop(arg);
31842
+ }
31843
+ return undefined;
31844
+ }
31845
+
31846
+ let Group$1 = class Group extends Group$2 {
31847
+ role;
31848
+ col;
31849
+ row;
31850
+ mergeStartCol;
31851
+ mergeStartRow;
31852
+ mergeEndCol;
31853
+ mergeEndRow;
31854
+ contentWidth;
31855
+ contentHeight;
31856
+ rowNumber;
31857
+ colHeight;
31858
+ border;
31859
+ needUpdate;
31860
+ needUpdateWidth;
31861
+ needUpdateHeight;
31862
+ clear() {
31863
+ this.removeAllChild();
31864
+ }
31865
+ getChildByName(name, deep) {
31866
+ let result = null;
31867
+ this.forEachChildren((child) => {
31868
+ if (child.name === name) {
31869
+ result = child;
31870
+ return true;
31871
+ }
31872
+ return false;
31873
+ });
31874
+ if (deep) {
31875
+ this.forEachChildren((child) => {
31876
+ if (child.getChildByName) {
31877
+ const target = child.getChildByName(name, true);
31878
+ if (target) {
31879
+ result = target;
31880
+ return true;
31881
+ }
31882
+ }
31883
+ return false;
31884
+ });
31865
31885
  }
31886
+ return result;
31866
31887
  }
31867
- else if (customRender) {
31868
- expectedWidth = customRender.expectedWidth;
31869
- expectedHeight = customRender.expectedHeight;
31870
- customElements = customRender.elements;
31871
- renderDefault = customRender.renderDefault;
31888
+ get width() {
31889
+ let width = this.AABBBounds.width();
31890
+ if (width === Infinity || width === -Infinity) {
31891
+ width = 0;
31892
+ }
31893
+ return Math.max(width, this.attribute.width ?? 0);
31872
31894
  }
31873
- if (customElements) {
31874
- const value = table.getCellValue(col, row);
31875
- elementsGroup = adjustElementToGroup(customElements, autoWidth ? expectedWidth : width, autoHeight ? expectedHeight : height, value);
31895
+ get height() {
31896
+ let height = this.AABBBounds.height();
31897
+ if (height === Infinity || height === -Infinity) {
31898
+ height = 0;
31899
+ }
31900
+ return Math.max(height, this.attribute.height ?? 0);
31876
31901
  }
31877
- if (enableCellPadding) {
31878
- elementsGroup.setAttributes({
31879
- x: padding[3],
31880
- y: padding[0],
31881
- width: width - padding[1] - padding[3],
31882
- height: height - padding[0] - padding[2]
31883
- });
31902
+ setDeltaWidth(deltaX) {
31903
+ if (deltaX === 0) {
31904
+ return;
31905
+ }
31906
+ this.setAttribute('width', (this.attribute.width ?? 0) + deltaX);
31907
+ if (this.border) {
31908
+ this.border.setAttribute('width', this.border.attribute.width + deltaX);
31909
+ if (this.border.type === 'group') {
31910
+ this.border.firstChild.setAttribute('width', this.border.firstChild.attribute.width + deltaX);
31911
+ }
31912
+ }
31884
31913
  }
31885
- dealPercentCalc(elementsGroup, width, height);
31886
- return {
31887
- elementsGroup,
31888
- renderDefault
31889
- };
31890
- }
31891
- function adjustElementToGroup(elements, width, height, value) {
31892
- const customGroup = new Group$2({
31893
- x: 0,
31894
- y: 0,
31895
- width,
31896
- height,
31897
- fill: false,
31898
- stroke: false,
31899
- pickable: false
31900
- });
31901
- customGroup.name = 'custom-container';
31902
- const elementsAdjusted = adjustElementsPos(elements, width, height, value);
31903
- elementsAdjusted.forEach(element => {
31904
- if (element.clickable) {
31905
- element.pickable = element.clickable;
31914
+ setDeltaHeight(deltaY) {
31915
+ if (deltaY === 0) {
31916
+ return;
31906
31917
  }
31907
- switch (element.type) {
31908
- case 'arc':
31909
- const arc = createArc({
31910
- x: element.x,
31911
- y: element.y,
31912
- dx: (element.dx ?? 0),
31913
- dy: (element.dy ?? 0),
31914
- fill: element.fill,
31915
- stroke: element.stroke,
31916
- outerRadius: element.radius,
31917
- startAngle: element.startAngle,
31918
- endAngle: element.endAngle,
31919
- pickable: !!element.pickable,
31920
- cursor: element.cursor
31921
- });
31922
- customGroup.appendChild(arc);
31923
- break;
31924
- case 'text':
31925
- if (element.background) {
31926
- const expandX = element.background?.expandX ?? 0;
31927
- const expandY = element.background?.expandY ?? 0;
31928
- const textBackRect = createRect({
31929
- x: element.x - expandX,
31930
- y: element.y - expandY,
31931
- dx: (element.dx ?? 0),
31932
- dy: (element.dy ?? 0),
31933
- width: element.width + expandX * 2,
31934
- height: element.height + expandY * 2,
31935
- cornerRadius: element.background?.cornerRadius ?? 0,
31936
- fill: element.background?.fill ?? '#888'
31937
- });
31938
- customGroup.appendChild(textBackRect);
31939
- }
31940
- const text = new Text$1(Object.assign({
31941
- pickable: !!element.pickable,
31942
- fill: element.color ?? element.fill
31943
- }, element));
31944
- customGroup.appendChild(text);
31945
- break;
31946
- case 'rect':
31947
- const rect = createRect({
31948
- x: element.x,
31949
- y: element.y,
31950
- dx: (element.dx ?? 0),
31951
- dy: (element.dy ?? 0),
31952
- width: element.width,
31953
- height: element.height,
31954
- cornerRadius: element.radius,
31955
- fill: element.fill,
31956
- stroke: element.stroke,
31957
- pickable: !!element.pickable,
31958
- cursor: element.cursor
31959
- });
31960
- customGroup.appendChild(rect);
31961
- break;
31962
- case 'circle':
31963
- const circle = createCircle({
31964
- x: element.x,
31965
- y: element.y,
31966
- dx: (element.dx ?? 0),
31967
- dy: (element.dy ?? 0),
31968
- radius: element.radius,
31969
- fill: element.fill,
31970
- stroke: element.stroke,
31971
- pickable: !!element.pickable,
31972
- cursor: element.cursor
31973
- });
31974
- customGroup.appendChild(circle);
31975
- break;
31976
- case 'icon':
31977
- const icon = new Icon$1({
31978
- x: element.x,
31979
- y: element.y,
31980
- dx: (element.dx ?? 0),
31981
- dy: (element.dy ?? 0),
31982
- width: element.width,
31983
- height: element.height,
31984
- image: element.svg,
31985
- backgroundWidth: element.hover ? (element.hover.width ?? element.width) : undefined,
31986
- backgroundHeight: element.hover ? (element.hover.width ?? element.width) : undefined,
31987
- backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,
31988
- pickable: !!element.pickable,
31989
- cursor: element.cursor
31990
- });
31991
- icon.role = 'icon-custom';
31992
- customGroup.appendChild(icon);
31993
- break;
31994
- case 'image':
31995
- const image = new Icon$1({
31996
- x: element.x,
31997
- y: element.y,
31998
- dx: (element.dx ?? 0),
31999
- dy: (element.dy ?? 0),
32000
- width: element.width,
32001
- height: element.height,
32002
- image: element.src,
32003
- backgroundWidth: element.hover ? (element.hover.width ?? element.width) : undefined,
32004
- backgroundHeight: element.hover ? (element.hover.width ?? element.width) : undefined,
32005
- backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,
32006
- pickable: !!element.pickable,
32007
- cursor: element.cursor,
32008
- shape: element.shape
32009
- });
32010
- image.role = 'image-custom';
32011
- customGroup.appendChild(image);
32012
- break;
32013
- case 'line':
32014
- const line = createLine({
32015
- points: element.points,
32016
- stroke: element.stroke,
32017
- pickable: !!element.pickable,
32018
- cursor: element.cursor
32019
- });
32020
- customGroup.appendChild(line);
32021
- break;
31918
+ this.setAttribute('height', (this.attribute.height ?? 0) + deltaY);
31919
+ if (this.border) {
31920
+ this.border.setAttribute('height', this.border.attribute.height + deltaY);
31921
+ if (this.border.type === 'group') {
31922
+ this.border.firstChild.setAttribute('width', this.border.firstChild.attribute.height + deltaY);
31923
+ }
32022
31924
  }
32023
- });
32024
- return customGroup;
32025
- }
32026
- function adjustElementsPos(originalElements, width, height, value) {
32027
- const result = [];
32028
- const left = 0;
32029
- const top = 0;
32030
- const borderLineWidths = [0, 0, 0, 0];
32031
- for (let i = 0; i < originalElements.length; i++) {
32032
- const originalElement = originalElements[i];
32033
- const element = Object.assign({}, originalElement);
32034
- for (const name in element) {
32035
- if (element.hasOwnProperty(name) && isFunction$1(element[name])) {
32036
- element[name] = element[name](value);
31925
+ }
31926
+ setDeltaX(deltaX) {
31927
+ if (deltaX === 0) {
31928
+ return;
31929
+ }
31930
+ this.setAttribute('x', this.attribute.x + deltaX);
31931
+ }
31932
+ setDeltaY(deltaY) {
31933
+ if (deltaY === 0) {
31934
+ return;
31935
+ }
31936
+ this.setAttribute('y', this.attribute.y + deltaY);
31937
+ }
31938
+ forEachChildrenSkipChild(cb, skipChildName = 'border-rect', reverse = false) {
31939
+ if (reverse) {
31940
+ let child = this._lastChild;
31941
+ let i = 0;
31942
+ while (child) {
31943
+ if (child.name !== skipChildName) {
31944
+ const breakTag = cb(child, i++);
31945
+ if (breakTag) {
31946
+ return;
31947
+ }
31948
+ }
31949
+ child = child._prev;
32037
31950
  }
32038
31951
  }
32039
- const rect = element;
32040
- if (isValid$1(rect.x)) {
32041
- rect.x = isString$2(rect.x)
32042
- ? transformString(rect.x, width - borderLineWidths[1])
32043
- : Number(rect.x);
31952
+ else {
31953
+ let child = this._firstChild;
31954
+ let i = 0;
31955
+ while (child) {
31956
+ if (child.name !== skipChildName) {
31957
+ const breakTag = cb(child, i++);
31958
+ if (breakTag) {
31959
+ return;
31960
+ }
31961
+ }
31962
+ child = child._next;
31963
+ }
32044
31964
  }
32045
- if (isValid$1(rect.y)) {
32046
- rect.y = isString$2(rect.y)
32047
- ? transformString(rect.y, height - borderLineWidths[2])
32048
- : Number(rect.y);
31965
+ }
31966
+ getColGroup(col) {
31967
+ let c = this._firstChild;
31968
+ if (!c) {
31969
+ return null;
32049
31970
  }
32050
- if ('width' in element) {
32051
- element.width = isString$2(element.width)
32052
- ? transformString(element.width, width - borderLineWidths[1])
32053
- : Number(element.width);
31971
+ for (let i = 0; i < this.childrenCount; i++) {
31972
+ if (c.col === col) {
31973
+ return c;
31974
+ }
31975
+ c = c._next;
32054
31976
  }
32055
- if ('height' in element) {
32056
- element.height = isString$2(element.height)
32057
- ? transformString(element.height, height - borderLineWidths[2])
32058
- : Number(element.height);
31977
+ return null;
31978
+ }
31979
+ getRowGroup(row) {
31980
+ let c = this._firstChild;
31981
+ if (!c) {
31982
+ return null;
32059
31983
  }
32060
- if ('radius' in element) {
32061
- element.radius = isString$2(element.radius)
32062
- ? transformString(element.radius, Math.min(width - borderLineWidths[1], height - borderLineWidths[2]))
32063
- : Number(element.radius);
31984
+ for (let i = 0; i < this.childrenCount; i++) {
31985
+ if (c.row === row) {
31986
+ return c;
31987
+ }
31988
+ c = c._next;
32064
31989
  }
32065
- if ('hover' in element) {
32066
- element.hover.x = isString$2(element.hover.x)
32067
- ? transformString(element.hover.x, width - borderLineWidths[1])
32068
- : Number(element.hover.x);
32069
- element.hover.y = isString$2(element.hover.y)
32070
- ? transformString(element.hover.y, height - borderLineWidths[2])
32071
- : Number(element.hover.y);
32072
- element.hover.width = isString$2(element.hover.width)
32073
- ? transformString(element.hover.width, width - borderLineWidths[1])
32074
- : Number(element.hover.width);
32075
- element.hover.height = isString$2(element.hover.height)
32076
- ? transformString(element.hover.height, height - borderLineWidths[2])
32077
- : Number(element.hover.height);
32078
- element.hover.x += left;
32079
- element.hover.y += top;
31990
+ return null;
31991
+ }
31992
+ getChildAt(index) {
31993
+ const child = super.getChildAt(index);
31994
+ if (child && child.name === 'border-rect') {
31995
+ return child._next;
32080
31996
  }
32081
- rect.x = rect.x + left;
32082
- rect.y = rect.y + top;
32083
- result.push(element);
31997
+ return child;
32084
31998
  }
32085
- return result;
32086
- }
32087
- function transformString(str, size) {
32088
- if (str.endsWith('px')) {
32089
- return parseInt(str, 10);
31999
+ tryUpdateAABBBounds() {
32000
+ if (this.role === 'cell') {
32001
+ if (!this.shouldUpdateAABBBounds()) {
32002
+ return this._AABBBounds;
32003
+ }
32004
+ const selfChange = this.shouldSelfChangeUpdateAABBBounds();
32005
+ const bounds = this.doUpdateAABBBounds();
32006
+ this.addUpdateLayoutTag();
32007
+ after(this, selfChange);
32008
+ return bounds;
32009
+ }
32010
+ return super.tryUpdateAABBBounds();
32090
32011
  }
32091
- else if (str.endsWith('%') && size) {
32092
- return (parseInt(str, 10) / 100) * size;
32012
+ doUpdateAABBBounds() {
32013
+ if (this.role === 'cell') {
32014
+ const attribute = this.attribute;
32015
+ const { x, y, width, height } = attribute;
32016
+ this._AABBBounds.setValue(x, y, x + width, y + height);
32017
+ this.parent && this.parent.addChildUpdateBoundTag();
32018
+ this.clearUpdateBoundTag();
32019
+ return this._AABBBounds;
32020
+ }
32021
+ else if (this.role === 'body' ||
32022
+ this.role === 'row-header' ||
32023
+ this.role === 'col-header' ||
32024
+ this.role === 'right-frozen' ||
32025
+ this.role === 'bottom-frozen' ||
32026
+ this.role === 'corner-header' ||
32027
+ this.role === 'corner-right-top-header' ||
32028
+ this.role === 'corner-right-bottom-header' ||
32029
+ this.role === 'corner-left-bottom-header') {
32030
+ this._AABBBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);
32031
+ this.parent && this.parent.addChildUpdateBoundTag();
32032
+ this.clearUpdateBoundTag();
32033
+ return this._AABBBounds;
32034
+ }
32035
+ return super.doUpdateAABBBounds();
32093
32036
  }
32094
- return parseInt(str, 10);
32095
- }
32096
- function dealPercentCalc(group, parentWidth, parentHeight) {
32097
- if (!group) {
32098
- return;
32037
+ updateColumnRowNumber(row) {
32038
+ if (!this.rowNumber) {
32039
+ this.rowNumber = row;
32040
+ }
32041
+ else {
32042
+ this.rowNumber = Math.max(this.rowNumber, row);
32043
+ }
32099
32044
  }
32100
- group.forEachChildren((child) => {
32101
- if (!child) {
32102
- return;
32045
+ updateColumnHeight(cellHeight) {
32046
+ if (!this.colHeight) {
32047
+ this.colHeight = cellHeight;
32103
32048
  }
32104
- if (isObject$4(child.attribute.width) && child.attribute.width.percent) {
32105
- child.setAttribute('width', (child.attribute.width.percent / 100) * parentWidth +
32106
- (child.attribute.width.delta ?? 0));
32049
+ else {
32050
+ this.colHeight += cellHeight;
32107
32051
  }
32108
- if (isObject$4(child.attribute.height) && child.attribute.height.percent) {
32109
- child.setAttribute('height', (child.attribute.height.percent / 100) * parentHeight +
32110
- (child.attribute.height.delta ?? 0));
32052
+ }
32053
+ };
32054
+ function after(group, selfChange) {
32055
+ if (!group.stage.dirtyBounds) {
32056
+ return;
32057
+ }
32058
+ if (!(group.stage && group.stage.renderCount)) {
32059
+ return;
32060
+ }
32061
+ if (group.isContainer && !selfChange) {
32062
+ return;
32063
+ }
32064
+ group.stage.dirty(group.globalAABBBounds);
32065
+ }
32066
+
32067
+ const CHART_NUMBER_TYPE = genNumberType();
32068
+ class Chart extends Group$2 {
32069
+ type = 'chart';
32070
+ chartInstance;
32071
+ activeChartInstance;
32072
+ active;
32073
+ cacheCanvas;
32074
+ constructor(params) {
32075
+ super(params);
32076
+ this.numberType = CHART_NUMBER_TYPE;
32077
+ if (!params.chartInstance) {
32078
+ params.chartInstance = this.chartInstance = new params.ClassType(params.spec, {
32079
+ renderCanvas: params.canvas,
32080
+ mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',
32081
+ modeParams: this.attribute.modeParams,
32082
+ canvasControled: false,
32083
+ viewBox: { x1: 0, x2: 0, y1: 0, y2: 0 },
32084
+ dpr: params.dpr,
32085
+ interactive: false,
32086
+ animation: false,
32087
+ autoFit: false
32088
+ });
32089
+ this.chartInstance.renderSync();
32111
32090
  }
32112
- if (child.type === 'group') {
32113
- dealPercentCalc(child, child.attribute.width, child.attribute.height);
32091
+ else {
32092
+ this.chartInstance = params.chartInstance;
32114
32093
  }
32115
- });
32094
+ }
32095
+ activate(table) {
32096
+ this.active = true;
32097
+ const { col, row } = this.parent;
32098
+ const { x1, y1, x2, y2 } = this.getViewBox();
32099
+ const tableBound = getTableBounds(col, row, table);
32100
+ const clipBound = tableBound.intersect({
32101
+ x1: x1 - table.scrollLeft,
32102
+ x2: x2 - table.scrollLeft,
32103
+ y1: y1 - table.scrollTop,
32104
+ y2: y2 - table.scrollTop
32105
+ });
32106
+ this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {
32107
+ renderCanvas: this.attribute.canvas,
32108
+ mode: 'desktop-browser',
32109
+ canvasControled: false,
32110
+ viewBox: {
32111
+ x1: x1 - table.scrollLeft,
32112
+ x2: x2 - table.scrollLeft,
32113
+ y1: y1 - table.scrollTop,
32114
+ y2: y2 - table.scrollTop
32115
+ },
32116
+ dpr: table.internalProps.pixelRatio,
32117
+ animation: false,
32118
+ interactive: true,
32119
+ autoFit: false,
32120
+ beforeRender: (stage) => {
32121
+ const ctx = stage.window.getContext();
32122
+ ctx.inuse = true;
32123
+ ctx.clearMatrix();
32124
+ ctx.setTransformForCurrent(true);
32125
+ ctx.beginPath();
32126
+ ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);
32127
+ ctx.clip();
32128
+ },
32129
+ afterRender(stage) {
32130
+ const ctx = stage.window.getContext();
32131
+ ctx.inuse = false;
32132
+ }
32133
+ });
32134
+ this.activeChartInstance.renderSync();
32135
+ table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);
32136
+ this.activeChartInstance.on('click', (params) => {
32137
+ if (Chart.temp) {
32138
+ table.scenegraph.updateChartState(params?.datum);
32139
+ }
32140
+ });
32141
+ this.activeChartInstance.on('brushEnd', (params) => {
32142
+ table.scenegraph.updateChartState(params?.value?.inBrushData);
32143
+ Chart.temp = 0;
32144
+ setTimeout(() => {
32145
+ Chart.temp = 1;
32146
+ }, 0);
32147
+ });
32148
+ table._bindChartEvent?.(this.activeChartInstance);
32149
+ }
32150
+ static temp = 1;
32151
+ deactivate() {
32152
+ this.active = false;
32153
+ this.activeChartInstance?.updateViewBox({
32154
+ x1: -1000,
32155
+ x2: -800,
32156
+ y1: -1000,
32157
+ y2: -800
32158
+ }, false, false);
32159
+ this.activeChartInstance?.release();
32160
+ this.activeChartInstance = null;
32161
+ }
32162
+ updateData(data) {
32163
+ this.attribute.data = data;
32164
+ }
32165
+ getViewBox() {
32166
+ const cellGroup = this.parent;
32167
+ const padding = this.attribute.cellPadding;
32168
+ const table = this.stage.table;
32169
+ return {
32170
+ x1: Math.ceil(cellGroup.globalAABBBounds.x1 + padding[3] + table.scrollLeft),
32171
+ x2: Math.ceil(cellGroup.globalAABBBounds.x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft),
32172
+ y1: Math.ceil(cellGroup.globalAABBBounds.y1 + padding[0] + table.scrollTop),
32173
+ y2: Math.ceil(cellGroup.globalAABBBounds.y1 + cellGroup.attribute.height - padding[2] + table.scrollTop)
32174
+ };
32175
+ }
32116
32176
  }
32117
- function decodeReactDom(dom) {
32118
- if (!dom || !dom.$$typeof) {
32119
- return dom;
32177
+ function getTableBounds(col, row, table) {
32178
+ const { layoutMap } = table.internalProps;
32179
+ const bodyBound = new Bounds();
32180
+ const tableBound = table.scenegraph.tableGroup.globalAABBBounds;
32181
+ bodyBound.x1 = tableBound.x1;
32182
+ bodyBound.x2 = tableBound.x2;
32183
+ bodyBound.y1 = tableBound.y1;
32184
+ bodyBound.y2 = tableBound.y2;
32185
+ if (!layoutMap.isFrozenColumn(col, row) && !layoutMap.isRightFrozenColumn(col, row)) {
32186
+ bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
32187
+ bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
32188
+ bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
32189
+ bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
32120
32190
  }
32121
- const type = dom.type;
32122
- const { attribute, children, stateProxy } = dom.props;
32123
- const g = type({ attribute });
32124
- parseToGraphic(g, dom.props);
32125
- if (stateProxy) {
32126
- g.stateProxy = stateProxy;
32191
+ else if (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightTopCorner(col, row)) ;
32192
+ else if (layoutMap.isFrozenColumn(col, row)) {
32193
+ bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
32194
+ bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
32127
32195
  }
32128
- g.id = attribute.id;
32129
- g.name = attribute.name;
32130
- if (isArray$1(children)) {
32131
- children.forEach((item) => {
32132
- const c = decodeReactDom(item);
32133
- g.add(c);
32134
- });
32196
+ else if (layoutMap.isRightFrozenColumn(col, row)) {
32197
+ bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
32198
+ bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
32135
32199
  }
32136
- else if (children) {
32137
- g.add(decodeReactDom(children));
32200
+ else if (layoutMap.isBottomFrozenRow(col, row)) {
32201
+ bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
32202
+ bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
32138
32203
  }
32139
- return g;
32204
+ return bodyBound;
32140
32205
  }
32141
- function parseToGraphic(g, props) {
32142
- let isGraphic = false;
32143
- switch (g.type) {
32144
- case 'richtext':
32145
- break;
32146
- case 'rich/image':
32147
- break;
32148
- default:
32149
- isGraphic = true;
32206
+
32207
+ const chartTypes = {};
32208
+
32209
+ const builtin = {};
32210
+ function get$2() {
32211
+ return extend(builtin, chartTypes);
32212
+ }
32213
+
32214
+ function createChartCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, width, height, padding, dataValue, chartModule, chartSpec, chartInstance, dataId, table, cellTheme) {
32215
+ const registerCharts = get$2();
32216
+ const ClassType = registerCharts[chartModule];
32217
+ const headerStyle = table._getCellStyle(col, row);
32218
+ const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
32219
+ if (isValid$1(functionalPadding)) {
32220
+ padding = functionalPadding;
32150
32221
  }
32151
- if (isGraphic) {
32152
- Object.keys(props).forEach(k => {
32153
- const en = REACT_TO_CANOPUS_EVENTS[k];
32154
- if (en) {
32155
- g.on(en, props[k]);
32156
- }
32222
+ if (!cellGroup) {
32223
+ cellGroup = new Group$1({
32224
+ x: xOrigin,
32225
+ y: yOrigin,
32226
+ width,
32227
+ height,
32228
+ lineWidth: cellTheme?.group?.lineWidth ?? undefined,
32229
+ fill: cellTheme?.group?.fill ?? undefined,
32230
+ stroke: cellTheme?.group?.stroke ?? undefined,
32231
+ strokeArrayWidth: cellTheme?.group?.strokeArrayWidth ?? undefined,
32232
+ strokeArrayColor: cellTheme?.group?.strokeArrayColor ?? undefined,
32233
+ cursor: cellTheme?.group?.cursor ?? undefined,
32234
+ lineCap: 'square',
32235
+ clip: true,
32236
+ cornerRadius: cellTheme.group.cornerRadius
32157
32237
  });
32238
+ cellGroup.role = 'cell';
32239
+ cellGroup.col = col;
32240
+ cellGroup.row = row;
32241
+ columnGroup?.addChild(cellGroup);
32158
32242
  }
32243
+ cellGroup.AABBBounds.width();
32244
+ const chartGroup = new Chart({
32245
+ stroke: false,
32246
+ x: padding[3],
32247
+ y: padding[0],
32248
+ canvas: table.canvas ?? table.scenegraph.stage.window.getContext().canvas,
32249
+ mode: table.options.mode,
32250
+ modeParams: table.options.modeParams,
32251
+ spec: chartSpec,
32252
+ ClassType,
32253
+ width: width - padding[3] - padding[1],
32254
+ height: height - padding[2] - padding[0],
32255
+ chartInstance,
32256
+ dataId,
32257
+ data: table.getCellValue(col, row),
32258
+ cellPadding: padding,
32259
+ dpr: table.internalProps.pixelRatio,
32260
+ axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : []
32261
+ });
32262
+ cellGroup.appendChild(chartGroup);
32263
+ table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance);
32264
+ return cellGroup;
32159
32265
  }
32160
32266
 
32161
32267
  const icons = {};
@@ -32435,231 +32541,10 @@
32435
32541
  };
32436
32542
  }
32437
32543
  };
32438
- function get$2() {
32544
+ function get$1() {
32439
32545
  return extend(builtins, icons);
32440
32546
  }
32441
32547
 
32442
- let Group$1 = class Group extends Group$2 {
32443
- role;
32444
- col;
32445
- row;
32446
- mergeStartCol;
32447
- mergeStartRow;
32448
- mergeEndCol;
32449
- mergeEndRow;
32450
- contentWidth;
32451
- contentHeight;
32452
- rowNumber;
32453
- colHeight;
32454
- border;
32455
- needUpdate;
32456
- needUpdateWidth;
32457
- needUpdateHeight;
32458
- clear() {
32459
- this.removeAllChild();
32460
- }
32461
- getChildByName(name, deep) {
32462
- let result = null;
32463
- this.forEachChildren((child) => {
32464
- if (child.name === name) {
32465
- result = child;
32466
- return true;
32467
- }
32468
- return false;
32469
- });
32470
- if (deep) {
32471
- this.forEachChildren((child) => {
32472
- if (child.getChildByName) {
32473
- const target = child.getChildByName(name, true);
32474
- if (target) {
32475
- result = target;
32476
- return true;
32477
- }
32478
- }
32479
- return false;
32480
- });
32481
- }
32482
- return result;
32483
- }
32484
- get width() {
32485
- let width = this.AABBBounds.width();
32486
- if (width === Infinity || width === -Infinity) {
32487
- width = 0;
32488
- }
32489
- return Math.max(width, this.attribute.width ?? 0);
32490
- }
32491
- get height() {
32492
- let height = this.AABBBounds.height();
32493
- if (height === Infinity || height === -Infinity) {
32494
- height = 0;
32495
- }
32496
- return Math.max(height, this.attribute.height ?? 0);
32497
- }
32498
- setDeltaWidth(deltaX) {
32499
- if (deltaX === 0) {
32500
- return;
32501
- }
32502
- this.setAttribute('width', (this.attribute.width ?? 0) + deltaX);
32503
- if (this.border) {
32504
- this.border.setAttribute('width', this.border.attribute.width + deltaX);
32505
- if (this.border.type === 'group') {
32506
- this.border.firstChild.setAttribute('width', this.border.firstChild.attribute.width + deltaX);
32507
- }
32508
- }
32509
- }
32510
- setDeltaHeight(deltaY) {
32511
- if (deltaY === 0) {
32512
- return;
32513
- }
32514
- this.setAttribute('height', (this.attribute.height ?? 0) + deltaY);
32515
- if (this.border) {
32516
- this.border.setAttribute('height', this.border.attribute.height + deltaY);
32517
- if (this.border.type === 'group') {
32518
- this.border.firstChild.setAttribute('width', this.border.firstChild.attribute.height + deltaY);
32519
- }
32520
- }
32521
- }
32522
- setDeltaX(deltaX) {
32523
- if (deltaX === 0) {
32524
- return;
32525
- }
32526
- this.setAttribute('x', this.attribute.x + deltaX);
32527
- }
32528
- setDeltaY(deltaY) {
32529
- if (deltaY === 0) {
32530
- return;
32531
- }
32532
- this.setAttribute('y', this.attribute.y + deltaY);
32533
- }
32534
- forEachChildrenSkipChild(cb, skipChildName = 'border-rect', reverse = false) {
32535
- if (reverse) {
32536
- let child = this._lastChild;
32537
- let i = 0;
32538
- while (child) {
32539
- if (child.name !== skipChildName) {
32540
- const breakTag = cb(child, i++);
32541
- if (breakTag) {
32542
- return;
32543
- }
32544
- }
32545
- child = child._prev;
32546
- }
32547
- }
32548
- else {
32549
- let child = this._firstChild;
32550
- let i = 0;
32551
- while (child) {
32552
- if (child.name !== skipChildName) {
32553
- const breakTag = cb(child, i++);
32554
- if (breakTag) {
32555
- return;
32556
- }
32557
- }
32558
- child = child._next;
32559
- }
32560
- }
32561
- }
32562
- getColGroup(col) {
32563
- let c = this._firstChild;
32564
- if (!c) {
32565
- return null;
32566
- }
32567
- for (let i = 0; i < this.childrenCount; i++) {
32568
- if (c.col === col) {
32569
- return c;
32570
- }
32571
- c = c._next;
32572
- }
32573
- return null;
32574
- }
32575
- getRowGroup(row) {
32576
- let c = this._firstChild;
32577
- if (!c) {
32578
- return null;
32579
- }
32580
- for (let i = 0; i < this.childrenCount; i++) {
32581
- if (c.row === row) {
32582
- return c;
32583
- }
32584
- c = c._next;
32585
- }
32586
- return null;
32587
- }
32588
- getChildAt(index) {
32589
- const child = super.getChildAt(index);
32590
- if (child && child.name === 'border-rect') {
32591
- return child._next;
32592
- }
32593
- return child;
32594
- }
32595
- tryUpdateAABBBounds() {
32596
- if (this.role === 'cell') {
32597
- if (!this.shouldUpdateAABBBounds()) {
32598
- return this._AABBBounds;
32599
- }
32600
- const selfChange = this.shouldSelfChangeUpdateAABBBounds();
32601
- const bounds = this.doUpdateAABBBounds();
32602
- this.addUpdateLayoutTag();
32603
- after(this, selfChange);
32604
- return bounds;
32605
- }
32606
- return super.tryUpdateAABBBounds();
32607
- }
32608
- doUpdateAABBBounds() {
32609
- if (this.role === 'cell') {
32610
- const attribute = this.attribute;
32611
- const { x, y, width, height } = attribute;
32612
- this._AABBBounds.setValue(x, y, x + width, y + height);
32613
- this.parent && this.parent.addChildUpdateBoundTag();
32614
- this.clearUpdateBoundTag();
32615
- return this._AABBBounds;
32616
- }
32617
- else if (this.role === 'body' ||
32618
- this.role === 'row-header' ||
32619
- this.role === 'col-header' ||
32620
- this.role === 'right-frozen' ||
32621
- this.role === 'bottom-frozen' ||
32622
- this.role === 'corner-header' ||
32623
- this.role === 'corner-right-top-header' ||
32624
- this.role === 'corner-right-bottom-header' ||
32625
- this.role === 'corner-left-bottom-header') {
32626
- this._AABBBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);
32627
- this.parent && this.parent.addChildUpdateBoundTag();
32628
- this.clearUpdateBoundTag();
32629
- return this._AABBBounds;
32630
- }
32631
- return super.doUpdateAABBBounds();
32632
- }
32633
- updateColumnRowNumber(row) {
32634
- if (!this.rowNumber) {
32635
- this.rowNumber = row;
32636
- }
32637
- else {
32638
- this.rowNumber = Math.max(this.rowNumber, row);
32639
- }
32640
- }
32641
- updateColumnHeight(cellHeight) {
32642
- if (!this.colHeight) {
32643
- this.colHeight = cellHeight;
32644
- }
32645
- else {
32646
- this.colHeight += cellHeight;
32647
- }
32648
- }
32649
- };
32650
- function after(group, selfChange) {
32651
- if (!group.stage.dirtyBounds) {
32652
- return;
32653
- }
32654
- if (!(group.stage && group.stage.renderCount)) {
32655
- return;
32656
- }
32657
- if (group.isContainer && !selfChange) {
32658
- return;
32659
- }
32660
- group.stage.dirty(group.globalAABBBounds);
32661
- }
32662
-
32663
32548
  function calcKeepAspectRatioSize(width, height, maxWidth, maxHeight) {
32664
32549
  let newWidth = width;
32665
32550
  let newHeight = height;
@@ -32697,38 +32582,7 @@
32697
32582
  return { x, y };
32698
32583
  }
32699
32584
 
32700
- function getProp(name, cellStyle, col, row, _table) {
32701
- const prop = cellStyle && isValid$1(cellStyle[name]) ? cellStyle[name] : null;
32702
- if (typeof prop === 'function') {
32703
- const arg = {
32704
- col,
32705
- row,
32706
- table: _table,
32707
- value: _table.getCellValue(col, row),
32708
- dataValue: _table.getCellOriginValue(col, row),
32709
- cellHeaderPaths: _table.getCellHeaderPaths(col, row)
32710
- };
32711
- return prop(arg);
32712
- }
32713
- return prop;
32714
- }
32715
- function getFunctionalProp(name, cellStyle, col, row, _table) {
32716
- const prop = cellStyle && isValid$1(cellStyle[name]) ? cellStyle[name] : null;
32717
- if (typeof prop === 'function') {
32718
- const arg = {
32719
- col,
32720
- row,
32721
- table: _table,
32722
- value: _table.getCellValue(col, row),
32723
- dataValue: _table.getCellOriginValue(col, row),
32724
- cellHeaderPaths: _table.getCellHeaderPaths(col, row)
32725
- };
32726
- return prop(arg);
32727
- }
32728
- return undefined;
32729
- }
32730
-
32731
- get$2();
32585
+ get$1();
32732
32586
  function createImageCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, table, cellTheme) {
32733
32587
  const headerStyle = table._getCellStyle(col, row);
32734
32588
  const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
@@ -32796,7 +32650,7 @@
32796
32650
  };
32797
32651
  }
32798
32652
  image.failCallback = () => {
32799
- const regedIcons = get$2();
32653
+ const regedIcons = get$1();
32800
32654
  image.image = regedIcons.damage_pic.svg;
32801
32655
  };
32802
32656
  cellGroup.appendChild(image);
@@ -33536,206 +33390,6 @@
33536
33390
  return group;
33537
33391
  }
33538
33392
 
33539
- const CHART_NUMBER_TYPE = genNumberType();
33540
- class Chart extends Group$2 {
33541
- type = 'chart';
33542
- chartInstance;
33543
- activeChartInstance;
33544
- active;
33545
- cacheCanvas;
33546
- constructor(params) {
33547
- super(params);
33548
- this.numberType = CHART_NUMBER_TYPE;
33549
- if (!params.chartInstance) {
33550
- params.chartInstance = this.chartInstance = new params.ClassType(params.spec, {
33551
- renderCanvas: params.canvas,
33552
- mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',
33553
- modeParams: this.attribute.modeParams,
33554
- canvasControled: false,
33555
- viewBox: { x1: 0, x2: 0, y1: 0, y2: 0 },
33556
- dpr: params.dpr,
33557
- interactive: false,
33558
- animation: false,
33559
- autoFit: false
33560
- });
33561
- this.chartInstance.renderSync();
33562
- }
33563
- else {
33564
- this.chartInstance = params.chartInstance;
33565
- }
33566
- }
33567
- activate(table) {
33568
- this.active = true;
33569
- const { col, row } = this.parent;
33570
- const { x1, y1, x2, y2 } = this.getViewBox();
33571
- const tableBound = getTableBounds(col, row, table);
33572
- const clipBound = tableBound.intersect({
33573
- x1: x1 - table.scrollLeft,
33574
- x2: x2 - table.scrollLeft,
33575
- y1: y1 - table.scrollTop,
33576
- y2: y2 - table.scrollTop
33577
- });
33578
- this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {
33579
- renderCanvas: this.attribute.canvas,
33580
- mode: 'desktop-browser',
33581
- canvasControled: false,
33582
- viewBox: {
33583
- x1: x1 - table.scrollLeft,
33584
- x2: x2 - table.scrollLeft,
33585
- y1: y1 - table.scrollTop,
33586
- y2: y2 - table.scrollTop
33587
- },
33588
- dpr: table.internalProps.pixelRatio,
33589
- animation: false,
33590
- interactive: true,
33591
- autoFit: false,
33592
- beforeRender: (stage) => {
33593
- const ctx = stage.window.getContext();
33594
- ctx.inuse = true;
33595
- ctx.clearMatrix();
33596
- ctx.setTransformForCurrent(true);
33597
- ctx.beginPath();
33598
- ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);
33599
- ctx.clip();
33600
- },
33601
- afterRender(stage) {
33602
- const ctx = stage.window.getContext();
33603
- ctx.inuse = false;
33604
- }
33605
- });
33606
- this.activeChartInstance.renderSync();
33607
- table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);
33608
- this.activeChartInstance.on('click', (params) => {
33609
- if (Chart.temp) {
33610
- table.scenegraph.updateChartState(params?.datum);
33611
- }
33612
- });
33613
- this.activeChartInstance.on('brushEnd', (params) => {
33614
- table.scenegraph.updateChartState(params?.value?.inBrushData);
33615
- Chart.temp = 0;
33616
- setTimeout(() => {
33617
- Chart.temp = 1;
33618
- }, 0);
33619
- });
33620
- table._bindChartEvent?.(this.activeChartInstance);
33621
- }
33622
- static temp = 1;
33623
- deactivate() {
33624
- this.active = false;
33625
- this.activeChartInstance?.updateViewBox({
33626
- x1: -1000,
33627
- x2: -800,
33628
- y1: -1000,
33629
- y2: -800
33630
- }, false, false);
33631
- this.activeChartInstance?.release();
33632
- this.activeChartInstance = null;
33633
- }
33634
- updateData(data) {
33635
- this.attribute.data = data;
33636
- }
33637
- getViewBox() {
33638
- const cellGroup = this.parent;
33639
- const padding = this.attribute.cellPadding;
33640
- const table = this.stage.table;
33641
- return {
33642
- x1: Math.ceil(cellGroup.globalAABBBounds.x1 + padding[3] + table.scrollLeft),
33643
- x2: Math.ceil(cellGroup.globalAABBBounds.x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft),
33644
- y1: Math.ceil(cellGroup.globalAABBBounds.y1 + padding[0] + table.scrollTop),
33645
- y2: Math.ceil(cellGroup.globalAABBBounds.y1 + cellGroup.attribute.height - padding[2] + table.scrollTop)
33646
- };
33647
- }
33648
- }
33649
- function getTableBounds(col, row, table) {
33650
- const { layoutMap } = table.internalProps;
33651
- const bodyBound = new Bounds();
33652
- const tableBound = table.scenegraph.tableGroup.globalAABBBounds;
33653
- bodyBound.x1 = tableBound.x1;
33654
- bodyBound.x2 = tableBound.x2;
33655
- bodyBound.y1 = tableBound.y1;
33656
- bodyBound.y2 = tableBound.y2;
33657
- if (!layoutMap.isFrozenColumn(col, row) && !layoutMap.isRightFrozenColumn(col, row)) {
33658
- bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
33659
- bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
33660
- bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
33661
- bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
33662
- }
33663
- else if (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightTopCorner(col, row)) ;
33664
- else if (layoutMap.isFrozenColumn(col, row)) {
33665
- bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
33666
- bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
33667
- }
33668
- else if (layoutMap.isRightFrozenColumn(col, row)) {
33669
- bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
33670
- bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
33671
- }
33672
- else if (layoutMap.isBottomFrozenRow(col, row)) {
33673
- bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
33674
- bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
33675
- }
33676
- return bodyBound;
33677
- }
33678
-
33679
- const chartTypes = {};
33680
-
33681
- const builtin = {};
33682
- function get$1() {
33683
- return extend(builtin, chartTypes);
33684
- }
33685
-
33686
- function createChartCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, width, height, padding, dataValue, chartModule, chartSpec, chartInstance, dataId, table, cellTheme) {
33687
- const registerCharts = get$1();
33688
- const ClassType = registerCharts[chartModule];
33689
- const headerStyle = table._getCellStyle(col, row);
33690
- const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
33691
- if (isValid$1(functionalPadding)) {
33692
- padding = functionalPadding;
33693
- }
33694
- if (!cellGroup) {
33695
- cellGroup = new Group$1({
33696
- x: xOrigin,
33697
- y: yOrigin,
33698
- width,
33699
- height,
33700
- lineWidth: cellTheme?.group?.lineWidth ?? undefined,
33701
- fill: cellTheme?.group?.fill ?? undefined,
33702
- stroke: cellTheme?.group?.stroke ?? undefined,
33703
- strokeArrayWidth: cellTheme?.group?.strokeArrayWidth ?? undefined,
33704
- strokeArrayColor: cellTheme?.group?.strokeArrayColor ?? undefined,
33705
- cursor: cellTheme?.group?.cursor ?? undefined,
33706
- lineCap: 'square',
33707
- clip: true,
33708
- cornerRadius: cellTheme.group.cornerRadius
33709
- });
33710
- cellGroup.role = 'cell';
33711
- cellGroup.col = col;
33712
- cellGroup.row = row;
33713
- columnGroup?.addChild(cellGroup);
33714
- }
33715
- cellGroup.AABBBounds.width();
33716
- const chartGroup = new Chart({
33717
- stroke: false,
33718
- x: padding[3],
33719
- y: padding[0],
33720
- canvas: table.canvas ?? table.scenegraph.stage.window.getContext().canvas,
33721
- mode: table.options.mode,
33722
- modeParams: table.options.modeParams,
33723
- spec: chartSpec,
33724
- ClassType,
33725
- width: width - padding[3] - padding[1],
33726
- height: height - padding[2] - padding[0],
33727
- chartInstance,
33728
- dataId,
33729
- data: table.getCellValue(col, row),
33730
- cellPadding: padding,
33731
- dpr: table.internalProps.pixelRatio,
33732
- axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : []
33733
- });
33734
- cellGroup.appendChild(chartGroup);
33735
- table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance);
33736
- return cellGroup;
33737
- }
33738
-
33739
33393
  class CellContent extends Group$1 {
33740
33394
  _leftGroup;
33741
33395
  _rightGroup;
@@ -33929,7 +33583,7 @@
33929
33583
  return cellHierarchyIndent;
33930
33584
  }
33931
33585
 
33932
- function createCellContent(cellGroup, icons, textStr, padding, autoColWidth, autoRowHeight, autoWrapText, lineClamp, cellWidth, cellHeight, textAlign, textBaseline, table, cellTheme) {
33586
+ function createCellContent(cellGroup, icons, textStr, padding, autoColWidth, autoRowHeight, autoWrapText, lineClamp, cellWidth, cellHeight, textAlign, textBaseline, table, cellTheme, range) {
33933
33587
  const leftIcons = [];
33934
33588
  const rightIcons = [];
33935
33589
  const contentLeftIcons = [];
@@ -33948,7 +33602,9 @@
33948
33602
  if (!Array.isArray(icons) || icons.length === 0) {
33949
33603
  if (isValid$1(textStr)) {
33950
33604
  const text = convertInternal(textStr).replace(/\r?\n/g, '\n').replace(/\r/g, '\n').split('\n');
33951
- const hierarchyOffset = getHierarchyOffset(cellGroup.col, cellGroup.row, table);
33605
+ const hierarchyOffset = range
33606
+ ? getHierarchyOffset(range.start.col, range.start.row, table)
33607
+ : getHierarchyOffset(cellGroup.col, cellGroup.row, table);
33952
33608
  const attribute = {
33953
33609
  text: text.length === 1 ? text[0] : text,
33954
33610
  maxLineWidth: autoColWidth ? Infinity : cellWidth - (padding[1] + padding[3] + hierarchyOffset),
@@ -33995,7 +33651,7 @@
33995
33651
  }
33996
33652
  });
33997
33653
  leftIcons.forEach(icon => {
33998
- const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, table);
33654
+ const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, range, table);
33999
33655
  iconMark.role = 'icon-left';
34000
33656
  iconMark.name = icon.name;
34001
33657
  iconMark.setAttribute('x', leftIconWidth + (iconMark.attribute.marginLeft ?? 0));
@@ -34005,7 +33661,7 @@
34005
33661
  cellGroup.appendChild(iconMark);
34006
33662
  });
34007
33663
  rightIcons.forEach(icon => {
34008
- const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, table);
33664
+ const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, range, table);
34009
33665
  iconMark.role = 'icon-right';
34010
33666
  iconMark.name = icon.name;
34011
33667
  iconMark.setAttribute('x', rightIconWidth + (iconMark.attribute.marginLeft ?? 0));
@@ -34015,7 +33671,7 @@
34015
33671
  cellGroup.appendChild(iconMark);
34016
33672
  });
34017
33673
  absoluteLeftIcons.forEach(icon => {
34018
- const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, table);
33674
+ const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, range, table);
34019
33675
  iconMark.role = 'icon-absolute-left';
34020
33676
  iconMark.name = icon.name;
34021
33677
  iconMark.setAttribute('x', absoluteLeftIconWidth + (iconMark.attribute.marginLeft ?? 0));
@@ -34024,7 +33680,7 @@
34024
33680
  cellGroup.appendChild(iconMark);
34025
33681
  });
34026
33682
  absoluteRightIcons.forEach(icon => {
34027
- const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, table);
33683
+ const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, range, table);
34028
33684
  iconMark.role = 'icon-absolute-right';
34029
33685
  iconMark.name = icon.name;
34030
33686
  iconMark.setAttribute('x', absoluteRightIconWidth + (iconMark.attribute.marginLeft ?? 0));
@@ -34092,13 +33748,13 @@
34092
33748
  baseline: textBaseline
34093
33749
  });
34094
33750
  contentLeftIcons.forEach(icon => {
34095
- const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, table);
33751
+ const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, range, table);
34096
33752
  iconMark.role = 'icon-content-left';
34097
33753
  iconMark.name = icon.name;
34098
33754
  cellContent.addLeftOccupyingIcon(iconMark);
34099
33755
  });
34100
33756
  contentRightIcons.forEach(icon => {
34101
- const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, table);
33757
+ const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, range, table);
34102
33758
  iconMark.role = 'icon-content-right';
34103
33759
  iconMark.name = icon.name;
34104
33760
  cellContent.addRightOccupyingIcon(iconMark);
@@ -34162,7 +33818,7 @@
34162
33818
  height: height + padding[0] + padding[2]
34163
33819
  });
34164
33820
  }
34165
- function dealWithIcon(icon, mark, col, row, table) {
33821
+ function dealWithIcon(icon, mark, col, row, range, table) {
34166
33822
  const iconAttribute = {};
34167
33823
  if (icon.type === 'image') {
34168
33824
  iconAttribute.image = icon.src;
@@ -34180,7 +33836,9 @@
34180
33836
  isNumber$3(row) &&
34181
33837
  table &&
34182
33838
  (icon.funcType === IconFuncTypeEnum.collapse || icon.funcType === IconFuncTypeEnum.expand)) {
34183
- hierarchyOffset = getHierarchyOffset(col, row, table);
33839
+ hierarchyOffset = range
33840
+ ? getHierarchyOffset(range.start.col, range.start.row, table)
33841
+ : getHierarchyOffset(col, row, table);
34184
33842
  }
34185
33843
  iconAttribute.marginLeft = (icon.marginLeft ?? 0) + hierarchyOffset;
34186
33844
  iconAttribute.marginRight = icon.marginRight ?? 0;
@@ -34452,7 +34110,7 @@
34452
34110
  }
34453
34111
  icons = table.getCellIcons(iconCol, iconRow);
34454
34112
  }
34455
- createCellContent(cellGroup, icons, textStr, padding, autoColWidth, autoRowHeight, autoWrapText, typeof lineClamp === 'number' ? lineClamp : undefined, cellWidth, cellHeight, textAlign, textBaseline, table, cellTheme);
34113
+ createCellContent(cellGroup, icons, textStr, padding, autoColWidth, autoRowHeight, autoWrapText, typeof lineClamp === 'number' ? lineClamp : undefined, cellWidth, cellHeight, textAlign, textBaseline, table, cellTheme, range);
34456
34114
  if (cellTheme?._vtable?.marked) {
34457
34115
  const mark = createArc({
34458
34116
  x: cellGroup.attribute.width,
@@ -34476,7 +34134,7 @@
34476
34134
  return cellGroup;
34477
34135
  }
34478
34136
 
34479
- const regedIcons$1 = get$2();
34137
+ const regedIcons$1 = get$1();
34480
34138
  function createVideoCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, table, cellTheme) {
34481
34139
  const headerStyle = table._getCellStyle(col, row);
34482
34140
  const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
@@ -34866,14 +34524,45 @@
34866
34524
  const cellStyle = table._getCellStyle(col, row);
34867
34525
  const autoWrapText = cellStyle.autoWrapText ?? table.internalProps.autoWrapText;
34868
34526
  const cellLocation = table.getCellLocation(col, row);
34869
- const define = cellLocation !== 'body' ? table.getHeaderDefine(col, row) : table.getBodyColumnDefine(col, row);
34527
+ let value = table.getCellValue(col, row);
34870
34528
  let isMerge;
34871
34529
  let range;
34872
- if (cellLocation !== 'body' || define?.mergeCell || table.internalProps.customMergeCell) {
34530
+ let cellTheme;
34531
+ let customStyle;
34532
+ let customResult;
34533
+ if (table.internalProps.customMergeCell) {
34534
+ const customMerge = table.getCustomMerge(col, row);
34535
+ if (customMerge) {
34536
+ const { range: customMergeRange, text: customMergeText, style: customMergeStyle, customLayout, customRender } = customMerge;
34537
+ range = customMergeRange;
34538
+ isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
34539
+ value = customMergeText;
34540
+ customStyle = customMergeStyle;
34541
+ if (customStyle) {
34542
+ cellTheme = getStyleTheme(customStyle, table, range.start.col, range.start.row, getProp).theme;
34543
+ cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table);
34544
+ }
34545
+ if (customLayout || customRender) {
34546
+ 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);
34547
+ }
34548
+ }
34549
+ }
34550
+ let colForDefine = col;
34551
+ let rowForDefine = row;
34552
+ if (range) {
34553
+ colForDefine = range.start.col;
34554
+ rowForDefine = range.start.row;
34555
+ }
34556
+ const define = cellLocation !== 'body'
34557
+ ? table.getHeaderDefine(colForDefine, rowForDefine)
34558
+ : table.getBodyColumnDefine(colForDefine, rowForDefine);
34559
+ if (!range && (cellLocation !== 'body' || define?.mergeCell)) {
34873
34560
  range = table.getCellRange(col, row);
34874
34561
  isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
34875
34562
  }
34876
- let cellTheme = getStyleTheme(cellStyle, table, isMerge ? range.start.col : col, isMerge ? range.start.row : row, getProp).theme;
34563
+ if (!cellTheme) {
34564
+ cellTheme = getStyleTheme(cellStyle, table, isMerge ? range.start.col : col, isMerge ? range.start.row : row, getProp).theme;
34565
+ }
34877
34566
  cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table);
34878
34567
  if (!addNew && !isMerge && canUseFastUpdate(col, row, oldCellGroup, autoWrapText, table)) {
34879
34568
  const cellWidth = table.getColWidth(col);
@@ -34948,30 +34637,10 @@
34948
34637
  const type = table.isHeader(col, row)
34949
34638
  ? table._getHeaderLayoutMap(col, row).headerType
34950
34639
  : table.getBodyColumnType(col, row);
34951
- let value = table.getCellValue(col, row);
34952
34640
  const mayHaveIcon = cellLocation !== 'body' ? true : !!define?.icon || !!define?.tree;
34953
34641
  const padding = cellTheme._vtable.padding;
34954
34642
  const textAlign = cellTheme._vtable.textAlign;
34955
34643
  const textBaseline = cellTheme._vtable.textBaseline;
34956
- let customStyle;
34957
- let customResult;
34958
- if (table.internalProps.customMergeCell) {
34959
- const customMerge = table.getCustomMerge(col, row);
34960
- if (customMerge) {
34961
- const { range: customMergeRange, text: customMergeText, style: customMergeStyle, customLayout, customRender } = customMerge;
34962
- range = customMergeRange;
34963
- isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
34964
- value = customMergeText;
34965
- customStyle = customMergeStyle;
34966
- if (customStyle) {
34967
- cellTheme = getStyleTheme(customStyle, table, range.start.col, range.start.row, getProp).theme;
34968
- cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table);
34969
- }
34970
- if (customLayout || customRender) {
34971
- 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', padding, table);
34972
- }
34973
- }
34974
- }
34975
34644
  let newCellGroup;
34976
34645
  let bgColorFunc;
34977
34646
  if (table.internalProps?.dataConfig?.mappingRules && !table.isHeader(col, row)) {
@@ -35081,7 +34750,7 @@
35081
34750
  value = customMergeText;
35082
34751
  customStyle = customMergeStyle;
35083
34752
  if (customLayout || customRender) {
35084
- 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', padding, table);
34753
+ 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);
35085
34754
  }
35086
34755
  }
35087
34756
  }
@@ -35226,6 +34895,385 @@
35226
34895
  };
35227
34896
  }
35228
34897
 
34898
+ function dealWithCustom(customLayout, customRender, col, row, width, height, autoWidth, autoHeight, padding, table) {
34899
+ let renderDefault = true;
34900
+ let enableCellPadding = false;
34901
+ let expectedWidth;
34902
+ let expectedHeight;
34903
+ let customElements;
34904
+ let elementsGroup;
34905
+ if (typeof customLayout === 'function') {
34906
+ const arg = {
34907
+ col,
34908
+ row,
34909
+ dataValue: table.getCellOriginValue(col, row),
34910
+ value: table.getCellValue(col, row) || '',
34911
+ rect: {
34912
+ left: 0,
34913
+ top: 0,
34914
+ right: width,
34915
+ bottom: height,
34916
+ width,
34917
+ height
34918
+ },
34919
+ table
34920
+ };
34921
+ const customRenderObj = customLayout(arg);
34922
+ if (customRenderObj.rootContainer) {
34923
+ customRenderObj.rootContainer = decodeReactDom(customRenderObj.rootContainer);
34924
+ }
34925
+ if (customRenderObj.rootContainer instanceof Group$2) {
34926
+ elementsGroup = customRenderObj.rootContainer;
34927
+ elementsGroup.name = 'custom-container';
34928
+ }
34929
+ renderDefault = customRenderObj.renderDefault;
34930
+ enableCellPadding = customRenderObj.enableCellPadding;
34931
+ }
34932
+ else if (typeof customRender === 'function') {
34933
+ const arg = {
34934
+ col,
34935
+ row,
34936
+ dataValue: table.getCellOriginValue(col, row),
34937
+ value: table.getCellValue(col, row) || '',
34938
+ rect: {
34939
+ left: 0,
34940
+ top: 0,
34941
+ right: width,
34942
+ bottom: height,
34943
+ width,
34944
+ height
34945
+ },
34946
+ table
34947
+ };
34948
+ const customRenderObj = customRender(arg);
34949
+ if (customRenderObj) {
34950
+ customElements = customRenderObj.elements;
34951
+ renderDefault = customRenderObj.renderDefault;
34952
+ expectedWidth = customRenderObj.expectedWidth;
34953
+ expectedHeight = customRenderObj.expectedHeight;
34954
+ }
34955
+ }
34956
+ else if (customRender) {
34957
+ expectedWidth = customRender.expectedWidth;
34958
+ expectedHeight = customRender.expectedHeight;
34959
+ customElements = customRender.elements;
34960
+ renderDefault = customRender.renderDefault;
34961
+ }
34962
+ if (customElements) {
34963
+ const value = table.getCellValue(col, row);
34964
+ elementsGroup = adjustElementToGroup(customElements, autoWidth ? expectedWidth : width, autoHeight ? expectedHeight : height, value);
34965
+ }
34966
+ if (enableCellPadding) {
34967
+ elementsGroup.setAttributes({
34968
+ x: padding[3],
34969
+ y: padding[0],
34970
+ width: width - padding[1] - padding[3],
34971
+ height: height - padding[0] - padding[2]
34972
+ });
34973
+ }
34974
+ dealPercentCalc(elementsGroup, width, height);
34975
+ return {
34976
+ elementsGroup,
34977
+ renderDefault
34978
+ };
34979
+ }
34980
+ function adjustElementToGroup(elements, width, height, value) {
34981
+ const customGroup = new Group$2({
34982
+ x: 0,
34983
+ y: 0,
34984
+ width,
34985
+ height,
34986
+ fill: false,
34987
+ stroke: false,
34988
+ pickable: false
34989
+ });
34990
+ customGroup.name = 'custom-container';
34991
+ const elementsAdjusted = adjustElementsPos(elements, width, height, value);
34992
+ elementsAdjusted.forEach(element => {
34993
+ if (element.clickable) {
34994
+ element.pickable = element.clickable;
34995
+ }
34996
+ switch (element.type) {
34997
+ case 'arc':
34998
+ const arc = createArc({
34999
+ x: element.x,
35000
+ y: element.y,
35001
+ dx: (element.dx ?? 0),
35002
+ dy: (element.dy ?? 0),
35003
+ fill: element.fill,
35004
+ stroke: element.stroke,
35005
+ outerRadius: element.radius,
35006
+ startAngle: element.startAngle,
35007
+ endAngle: element.endAngle,
35008
+ pickable: !!element.pickable,
35009
+ cursor: element.cursor
35010
+ });
35011
+ customGroup.appendChild(arc);
35012
+ break;
35013
+ case 'text':
35014
+ if (element.background) {
35015
+ const expandX = element.background?.expandX ?? 0;
35016
+ const expandY = element.background?.expandY ?? 0;
35017
+ const textBackRect = createRect({
35018
+ x: element.x - expandX,
35019
+ y: element.y - expandY,
35020
+ dx: (element.dx ?? 0),
35021
+ dy: (element.dy ?? 0),
35022
+ width: element.width + expandX * 2,
35023
+ height: element.height + expandY * 2,
35024
+ cornerRadius: element.background?.cornerRadius ?? 0,
35025
+ fill: element.background?.fill ?? '#888'
35026
+ });
35027
+ customGroup.appendChild(textBackRect);
35028
+ }
35029
+ const text = new Text$1(Object.assign({
35030
+ pickable: !!element.pickable,
35031
+ fill: element.color ?? element.fill
35032
+ }, element));
35033
+ customGroup.appendChild(text);
35034
+ break;
35035
+ case 'rect':
35036
+ const rect = createRect({
35037
+ x: element.x,
35038
+ y: element.y,
35039
+ dx: (element.dx ?? 0),
35040
+ dy: (element.dy ?? 0),
35041
+ width: element.width,
35042
+ height: element.height,
35043
+ cornerRadius: element.radius,
35044
+ fill: element.fill,
35045
+ stroke: element.stroke,
35046
+ pickable: !!element.pickable,
35047
+ cursor: element.cursor
35048
+ });
35049
+ customGroup.appendChild(rect);
35050
+ break;
35051
+ case 'circle':
35052
+ const circle = createCircle({
35053
+ x: element.x,
35054
+ y: element.y,
35055
+ dx: (element.dx ?? 0),
35056
+ dy: (element.dy ?? 0),
35057
+ radius: element.radius,
35058
+ fill: element.fill,
35059
+ stroke: element.stroke,
35060
+ pickable: !!element.pickable,
35061
+ cursor: element.cursor
35062
+ });
35063
+ customGroup.appendChild(circle);
35064
+ break;
35065
+ case 'icon':
35066
+ const icon = new Icon$1({
35067
+ x: element.x,
35068
+ y: element.y,
35069
+ dx: (element.dx ?? 0),
35070
+ dy: (element.dy ?? 0),
35071
+ width: element.width,
35072
+ height: element.height,
35073
+ image: element.svg,
35074
+ backgroundWidth: element.hover ? (element.hover.width ?? element.width) : undefined,
35075
+ backgroundHeight: element.hover ? (element.hover.width ?? element.width) : undefined,
35076
+ backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,
35077
+ pickable: !!element.pickable,
35078
+ cursor: element.cursor
35079
+ });
35080
+ icon.role = 'icon-custom';
35081
+ customGroup.appendChild(icon);
35082
+ break;
35083
+ case 'image':
35084
+ const image = new Icon$1({
35085
+ x: element.x,
35086
+ y: element.y,
35087
+ dx: (element.dx ?? 0),
35088
+ dy: (element.dy ?? 0),
35089
+ width: element.width,
35090
+ height: element.height,
35091
+ image: element.src,
35092
+ backgroundWidth: element.hover ? (element.hover.width ?? element.width) : undefined,
35093
+ backgroundHeight: element.hover ? (element.hover.width ?? element.width) : undefined,
35094
+ backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,
35095
+ pickable: !!element.pickable,
35096
+ cursor: element.cursor,
35097
+ shape: element.shape
35098
+ });
35099
+ image.role = 'image-custom';
35100
+ customGroup.appendChild(image);
35101
+ break;
35102
+ case 'line':
35103
+ const line = createLine({
35104
+ points: element.points,
35105
+ stroke: element.stroke,
35106
+ pickable: !!element.pickable,
35107
+ cursor: element.cursor
35108
+ });
35109
+ customGroup.appendChild(line);
35110
+ break;
35111
+ }
35112
+ });
35113
+ return customGroup;
35114
+ }
35115
+ function adjustElementsPos(originalElements, width, height, value) {
35116
+ const result = [];
35117
+ const left = 0;
35118
+ const top = 0;
35119
+ const borderLineWidths = [0, 0, 0, 0];
35120
+ for (let i = 0; i < originalElements.length; i++) {
35121
+ const originalElement = originalElements[i];
35122
+ const element = Object.assign({}, originalElement);
35123
+ for (const name in element) {
35124
+ if (element.hasOwnProperty(name) && isFunction$1(element[name])) {
35125
+ element[name] = element[name](value);
35126
+ }
35127
+ }
35128
+ const rect = element;
35129
+ if (isValid$1(rect.x)) {
35130
+ rect.x = isString$2(rect.x)
35131
+ ? transformString(rect.x, width - borderLineWidths[1])
35132
+ : Number(rect.x);
35133
+ }
35134
+ if (isValid$1(rect.y)) {
35135
+ rect.y = isString$2(rect.y)
35136
+ ? transformString(rect.y, height - borderLineWidths[2])
35137
+ : Number(rect.y);
35138
+ }
35139
+ if ('width' in element) {
35140
+ element.width = isString$2(element.width)
35141
+ ? transformString(element.width, width - borderLineWidths[1])
35142
+ : Number(element.width);
35143
+ }
35144
+ if ('height' in element) {
35145
+ element.height = isString$2(element.height)
35146
+ ? transformString(element.height, height - borderLineWidths[2])
35147
+ : Number(element.height);
35148
+ }
35149
+ if ('radius' in element) {
35150
+ element.radius = isString$2(element.radius)
35151
+ ? transformString(element.radius, Math.min(width - borderLineWidths[1], height - borderLineWidths[2]))
35152
+ : Number(element.radius);
35153
+ }
35154
+ if ('hover' in element) {
35155
+ element.hover.x = isString$2(element.hover.x)
35156
+ ? transformString(element.hover.x, width - borderLineWidths[1])
35157
+ : Number(element.hover.x);
35158
+ element.hover.y = isString$2(element.hover.y)
35159
+ ? transformString(element.hover.y, height - borderLineWidths[2])
35160
+ : Number(element.hover.y);
35161
+ element.hover.width = isString$2(element.hover.width)
35162
+ ? transformString(element.hover.width, width - borderLineWidths[1])
35163
+ : Number(element.hover.width);
35164
+ element.hover.height = isString$2(element.hover.height)
35165
+ ? transformString(element.hover.height, height - borderLineWidths[2])
35166
+ : Number(element.hover.height);
35167
+ element.hover.x += left;
35168
+ element.hover.y += top;
35169
+ }
35170
+ rect.x = rect.x + left;
35171
+ rect.y = rect.y + top;
35172
+ result.push(element);
35173
+ }
35174
+ return result;
35175
+ }
35176
+ function transformString(str, size) {
35177
+ if (str.endsWith('px')) {
35178
+ return parseInt(str, 10);
35179
+ }
35180
+ else if (str.endsWith('%') && size) {
35181
+ return (parseInt(str, 10) / 100) * size;
35182
+ }
35183
+ return parseInt(str, 10);
35184
+ }
35185
+ function dealPercentCalc(group, parentWidth, parentHeight) {
35186
+ if (!group) {
35187
+ return;
35188
+ }
35189
+ group.forEachChildren((child) => {
35190
+ if (!child) {
35191
+ return;
35192
+ }
35193
+ if (isObject$4(child.attribute.width) && child.attribute.width.percent) {
35194
+ child.setAttribute('width', (child.attribute.width.percent / 100) * parentWidth +
35195
+ (child.attribute.width.delta ?? 0));
35196
+ }
35197
+ if (isObject$4(child.attribute.height) && child.attribute.height.percent) {
35198
+ child.setAttribute('height', (child.attribute.height.percent / 100) * parentHeight +
35199
+ (child.attribute.height.delta ?? 0));
35200
+ }
35201
+ if (child.type === 'group') {
35202
+ dealPercentCalc(child, child.attribute.width, child.attribute.height);
35203
+ }
35204
+ });
35205
+ }
35206
+ function decodeReactDom(dom) {
35207
+ if (!dom || !dom.$$typeof) {
35208
+ return dom;
35209
+ }
35210
+ const type = dom.type;
35211
+ const { attribute, children, stateProxy } = dom.props;
35212
+ const g = type({ attribute });
35213
+ parseToGraphic(g, dom.props);
35214
+ if (stateProxy) {
35215
+ g.stateProxy = stateProxy;
35216
+ }
35217
+ g.id = attribute.id;
35218
+ g.name = attribute.name;
35219
+ if (isArray$1(children)) {
35220
+ children.forEach((item) => {
35221
+ const c = decodeReactDom(item);
35222
+ g.add(c);
35223
+ });
35224
+ }
35225
+ else if (children) {
35226
+ g.add(decodeReactDom(children));
35227
+ }
35228
+ return g;
35229
+ }
35230
+ function parseToGraphic(g, props) {
35231
+ let isGraphic = false;
35232
+ switch (g.type) {
35233
+ case 'richtext':
35234
+ break;
35235
+ case 'rich/image':
35236
+ break;
35237
+ default:
35238
+ isGraphic = true;
35239
+ }
35240
+ if (isGraphic) {
35241
+ Object.keys(props).forEach(k => {
35242
+ const en = REACT_TO_CANOPUS_EVENTS[k];
35243
+ if (en) {
35244
+ g.on(en, props[k]);
35245
+ }
35246
+ });
35247
+ }
35248
+ }
35249
+ function getCustomCellMergeCustom(col, row, cellGroup, table) {
35250
+ if (table.internalProps.customMergeCell) {
35251
+ const customMerge = table.getCustomMerge(col, row);
35252
+ if (customMerge) {
35253
+ const { range: customMergeRange, text: customMergeText, style: customMergeStyle, customLayout: customMergeLayout, customRender: customMergeRender } = customMerge;
35254
+ if (customMergeLayout || customMergeRender) {
35255
+ const customResult = dealWithCustom(customMergeLayout, customMergeRender, customMergeRange.start.col, customMergeRange.start.row, table.getColsWidth(customMergeRange.start.col, customMergeRange.end.col), table.getRowsHeight(customMergeRange.start.row, customMergeRange.end.row), false, table.heightMode === 'autoHeight', [0, 0, 0, 0], table);
35256
+ const customElementsGroup = customResult.elementsGroup;
35257
+ if (cellGroup.childrenCount > 0 && customElementsGroup) {
35258
+ cellGroup.insertBefore(customElementsGroup, cellGroup.firstChild);
35259
+ }
35260
+ else if (customElementsGroup) {
35261
+ cellGroup.appendChild(customElementsGroup);
35262
+ }
35263
+ const rangeHeight = table.getRowHeight(row);
35264
+ const rangeWidth = table.getColWidth(col);
35265
+ const { width: contentWidth } = cellGroup.attribute;
35266
+ const { height: contentHeight } = cellGroup.attribute;
35267
+ cellGroup.contentWidth = contentWidth;
35268
+ cellGroup.contentHeight = contentHeight;
35269
+ resizeCellGroup(cellGroup, rangeWidth, rangeHeight, customMergeRange, table);
35270
+ return customResult;
35271
+ }
35272
+ }
35273
+ }
35274
+ return undefined;
35275
+ }
35276
+
35229
35277
  function isMergeCellGroup(cellGroup) {
35230
35278
  if (cellGroup.role === 'cell' &&
35231
35279
  isNumber$3(cellGroup.mergeStartCol) &&
@@ -36785,31 +36833,33 @@
36785
36833
  let customElementsGroup;
36786
36834
  customContainer.removeAllChild();
36787
36835
  cell.removeChild(customContainer);
36788
- let customRender;
36789
- let customLayout;
36790
- const cellLocation = scene.table.getCellLocation(col, row);
36791
- if (cellLocation !== 'body') {
36792
- const define = scene.table.getHeaderDefine(col, row);
36793
- customRender = define?.headerCustomRender;
36794
- customLayout = define?.headerCustomLayout;
36795
- }
36796
- else {
36797
- const define = scene.table.getBodyColumnDefine(col, row);
36798
- customRender = define?.customRender || scene.table.customRender;
36799
- customLayout = define?.customLayout;
36800
- }
36801
- if (customLayout || customRender) {
36802
- const style = scene.table._getCellStyle(col, row);
36803
- const padding = getQuadProps(getProp('padding', style, col, row, scene.table));
36804
- const customResult = dealWithCustom(customLayout, customRender, col, row, cell.attribute.width, cell.attribute.height, false, scene.table.heightMode === 'autoHeight', padding, scene.table);
36805
- customElementsGroup = customResult.elementsGroup;
36806
- renderDefault = customResult.renderDefault;
36807
- }
36808
- if (cell.childrenCount > 0) {
36809
- cell.insertBefore(customElementsGroup, cell.firstChild);
36810
- }
36811
- else {
36812
- cell.appendChild(customElementsGroup);
36836
+ if (!getCustomCellMergeCustom(col, row, cell, scene.table)) {
36837
+ let customRender;
36838
+ let customLayout;
36839
+ const cellLocation = scene.table.getCellLocation(col, row);
36840
+ if (cellLocation !== 'body') {
36841
+ const define = scene.table.getHeaderDefine(col, row);
36842
+ customRender = define?.headerCustomRender;
36843
+ customLayout = define?.headerCustomLayout;
36844
+ }
36845
+ else {
36846
+ const define = scene.table.getBodyColumnDefine(col, row);
36847
+ customRender = define?.customRender || scene.table.customRender;
36848
+ customLayout = define?.customLayout;
36849
+ }
36850
+ if (customLayout || customRender) {
36851
+ const style = scene.table._getCellStyle(col, row);
36852
+ const padding = getQuadProps(getProp('padding', style, col, row, scene.table));
36853
+ const customResult = dealWithCustom(customLayout, customRender, col, row, cell.attribute.width, cell.attribute.height, false, scene.table.heightMode === 'autoHeight', padding, scene.table);
36854
+ customElementsGroup = customResult.elementsGroup;
36855
+ renderDefault = customResult.renderDefault;
36856
+ }
36857
+ if (cell.childrenCount > 0 && customElementsGroup) {
36858
+ cell.insertBefore(customElementsGroup, cell.firstChild);
36859
+ }
36860
+ else if (customElementsGroup) {
36861
+ cell.appendChild(customElementsGroup);
36862
+ }
36813
36863
  }
36814
36864
  }
36815
36865
  if (renderDefault) {
@@ -37058,32 +37108,34 @@
37058
37108
  let customElementsGroup;
37059
37109
  customContainer.removeAllChild();
37060
37110
  cell.removeChild(customContainer);
37061
- let customRender;
37062
- let customLayout;
37063
- const cellType = scene.table.getCellLocation(col, row);
37064
- if (cellType !== 'body') {
37065
- const define = scene.table.getHeaderDefine(col, row);
37066
- customRender = define?.headerCustomRender;
37067
- customLayout = define?.headerCustomLayout;
37068
- }
37069
- else {
37070
- const define = scene.table.getBodyColumnDefine(col, row);
37071
- customRender = define?.customRender || scene.table.customRender;
37072
- customLayout = define?.customLayout;
37073
- }
37074
- if (customLayout || customRender) {
37075
- const style = scene.table._getCellStyle(col, row);
37076
- const padding = getQuadProps(getProp('padding', style, col, row, scene.table));
37077
- const customResult = dealWithCustom(customLayout, customRender, col, row, cellGroup.attribute.width, cellGroup.attribute.height, false, scene.table.heightMode === 'autoHeight', padding, scene.table);
37078
- customElementsGroup = customResult.elementsGroup;
37079
- renderDefault = customResult.renderDefault;
37080
- isHeightChange = true;
37081
- }
37082
- if (cell.childrenCount > 0) {
37083
- cell.insertBefore(customElementsGroup, cell.firstChild);
37084
- }
37085
- else {
37086
- cell.appendChild(customElementsGroup);
37111
+ if (!getCustomCellMergeCustom(col, row, cell, scene.table)) {
37112
+ let customRender;
37113
+ let customLayout;
37114
+ const cellType = scene.table.getCellLocation(col, row);
37115
+ if (cellType !== 'body') {
37116
+ const define = scene.table.getHeaderDefine(col, row);
37117
+ customRender = define?.headerCustomRender;
37118
+ customLayout = define?.headerCustomLayout;
37119
+ }
37120
+ else {
37121
+ const define = scene.table.getBodyColumnDefine(col, row);
37122
+ customRender = define?.customRender || scene.table.customRender;
37123
+ customLayout = define?.customLayout;
37124
+ }
37125
+ if (customLayout || customRender) {
37126
+ const style = scene.table._getCellStyle(col, row);
37127
+ const padding = getQuadProps(getProp('padding', style, col, row, scene.table));
37128
+ const customResult = dealWithCustom(customLayout, customRender, col, row, cellGroup.attribute.width, cellGroup.attribute.height, false, scene.table.heightMode === 'autoHeight', padding, scene.table);
37129
+ customElementsGroup = customResult.elementsGroup;
37130
+ renderDefault = customResult.renderDefault;
37131
+ isHeightChange = true;
37132
+ }
37133
+ if (cell.childrenCount > 0 && customElementsGroup) {
37134
+ cell.insertBefore(customElementsGroup, cell.firstChild);
37135
+ }
37136
+ else if (customElementsGroup) {
37137
+ cell.appendChild(customElementsGroup);
37138
+ }
37087
37139
  }
37088
37140
  }
37089
37141
  if (renderDefault) {
@@ -37436,7 +37488,7 @@
37436
37488
  }
37437
37489
  };
37438
37490
 
37439
- const regedIcons = get$2();
37491
+ const regedIcons = get$1();
37440
37492
  class DrillIcon {
37441
37493
  icon;
37442
37494
  constructor() {
@@ -47674,7 +47726,7 @@
47674
47726
  _table;
47675
47727
  constructor(_table) {
47676
47728
  this._table = _table;
47677
- const regedIcons = get$2();
47729
+ const regedIcons = get$1();
47678
47730
  this.expandIcon = regedIcons[InternalIconName.expandIconName];
47679
47731
  this.collapseIcon = regedIcons[InternalIconName.collapseIconName];
47680
47732
  }
@@ -47696,7 +47748,7 @@
47696
47748
  else {
47697
47749
  iconResults = iconDefine;
47698
47750
  }
47699
- const regedIcons = get$2();
47751
+ const regedIcons = get$1();
47700
47752
  const addIcon = (columnIcon) => {
47701
47753
  let icon;
47702
47754
  if (typeof columnIcon === 'string') {
@@ -48441,7 +48493,7 @@
48441
48493
  _table;
48442
48494
  constructor(_table) {
48443
48495
  this._table = _table;
48444
- const regedIcons = get$2();
48496
+ const regedIcons = get$1();
48445
48497
  this.freezeIcon = regedIcons[InternalIconName.freezeIconName];
48446
48498
  this.frozenIcon = regedIcons[InternalIconName.frozenIconName];
48447
48499
  this.frozenCurrentIcon = regedIcons[InternalIconName.frozenCurrentIconName];
@@ -48526,7 +48578,7 @@
48526
48578
  else {
48527
48579
  headerIconStrs = headerIcon;
48528
48580
  }
48529
- const regedIcons = get$2();
48581
+ const regedIcons = get$1();
48530
48582
  const addIcon = (headerIcon) => {
48531
48583
  let icon;
48532
48584
  if (typeof headerIcon === 'string') {
@@ -50320,7 +50372,7 @@
50320
50372
  return TABLE_EVENT_TYPE;
50321
50373
  }
50322
50374
  options;
50323
- version = "0.17.10-alpha.5";
50375
+ version = "0.17.10-alpha.7";
50324
50376
  pagination;
50325
50377
  id = `VTable${Date.now()}`;
50326
50378
  headerStyleCache;
@@ -60869,7 +60921,7 @@
60869
60921
  constructor(options) {
60870
60922
  let cache;
60871
60923
  if (isString$2(options.iconName)) {
60872
- const regedIcons = get$2();
60924
+ const regedIcons = get$1();
60873
60925
  cache = regedIcons[options.iconName];
60874
60926
  if (cache) {
60875
60927
  options.width = options.width ?? cache.width;
@@ -61293,9 +61345,9 @@
61293
61345
  return new Tag$1(params ? params.attribute : {});
61294
61346
  }
61295
61347
 
61296
- const version = "0.17.10-alpha.5";
61348
+ const version = "0.17.10-alpha.7";
61297
61349
  function getIcons() {
61298
- return get$2();
61350
+ return get$1();
61299
61351
  }
61300
61352
  function clearGlobal() {
61301
61353
  clearAll();