@visactor/vtable 1.5.2-alpha.1 → 1.5.2

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 (115) hide show
  1. package/cjs/PivotChart.js +8 -8
  2. package/cjs/PivotChart.js.map +1 -1
  3. package/cjs/components/react/react-custom-layout.d.ts +8 -8
  4. package/cjs/components/react/react-custom-layout.js +123 -12
  5. package/cjs/components/react/react-custom-layout.js.map +1 -1
  6. package/cjs/core/BaseTable.js +1 -1
  7. package/cjs/core/BaseTable.js.map +1 -1
  8. package/cjs/core/utils/get-cell-position.js.map +1 -1
  9. package/cjs/data/DataSource.js +4 -2
  10. package/cjs/data/DataSource.js.map +1 -1
  11. package/cjs/dataset/dataset.js +3 -3
  12. package/cjs/dataset/dataset.js.map +1 -1
  13. package/cjs/edit/edit-manager.d.ts +2 -1
  14. package/cjs/edit/edit-manager.js +27 -15
  15. package/cjs/edit/edit-manager.js.map +1 -1
  16. package/cjs/event/event.js +1 -2
  17. package/cjs/event/listener/table-group.js +53 -41
  18. package/cjs/event/listener/table-group.js.map +1 -1
  19. package/cjs/index.d.ts +1 -1
  20. package/cjs/index.js +1 -1
  21. package/cjs/index.js.map +1 -1
  22. package/cjs/layout/chart-helper/get-axis-config.d.ts +1 -0
  23. package/cjs/layout/chart-helper/get-axis-config.js +27 -8
  24. package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
  25. package/cjs/layout/chart-helper/get-chart-spec.js +6 -6
  26. package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
  27. package/cjs/layout/pivot-header-layout.d.ts +15 -3
  28. package/cjs/layout/pivot-header-layout.js +66 -28
  29. package/cjs/layout/pivot-header-layout.js.map +1 -1
  30. package/cjs/layout/tree-helper.js +2 -2
  31. package/cjs/layout/tree-helper.js.map +1 -1
  32. package/cjs/scenegraph/component/custom.js +3 -1
  33. package/cjs/scenegraph/component/custom.js.map +1 -1
  34. package/cjs/scenegraph/group-creater/cell-helper.js +6 -3
  35. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  36. package/cjs/scenegraph/layout/compute-col-width.js +17 -11
  37. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  38. package/cjs/scenegraph/layout/compute-row-height.js +13 -10
  39. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  40. package/cjs/scenegraph/layout/update-height.js +1 -0
  41. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  42. package/cjs/scenegraph/layout/update-width.js +1 -0
  43. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  44. package/cjs/scenegraph/scenegraph.js +12 -2
  45. package/cjs/scenegraph/scenegraph.js.map +1 -1
  46. package/cjs/scenegraph/utils/break-string.js +2 -1
  47. package/cjs/scenegraph/utils/break-string.js.map +1 -1
  48. package/cjs/tools/helper.d.ts +1 -0
  49. package/cjs/tools/helper.js +10 -3
  50. package/cjs/tools/helper.js.map +1 -1
  51. package/cjs/tools/join.d.ts +1 -0
  52. package/cjs/tools/join.js +12 -0
  53. package/cjs/tools/join.js.map +1 -0
  54. package/cjs/ts-types/base-table.d.ts +4 -0
  55. package/cjs/ts-types/base-table.js.map +1 -1
  56. package/cjs/vrender.js.map +1 -1
  57. package/dist/vtable.js +559 -194
  58. package/dist/vtable.min.js +2 -2
  59. package/es/PivotChart.js +9 -7
  60. package/es/PivotChart.js.map +1 -1
  61. package/es/components/react/react-custom-layout.d.ts +8 -8
  62. package/es/components/react/react-custom-layout.js +123 -12
  63. package/es/components/react/react-custom-layout.js.map +1 -1
  64. package/es/core/BaseTable.js +1 -1
  65. package/es/core/BaseTable.js.map +1 -1
  66. package/es/core/utils/get-cell-position.js.map +1 -1
  67. package/es/data/DataSource.js +4 -2
  68. package/es/data/DataSource.js.map +1 -1
  69. package/es/dataset/dataset.js +4 -2
  70. package/es/dataset/dataset.js.map +1 -1
  71. package/es/edit/edit-manager.d.ts +2 -1
  72. package/es/edit/edit-manager.js +28 -14
  73. package/es/edit/edit-manager.js.map +1 -1
  74. package/es/event/event.js +1 -2
  75. package/es/event/listener/table-group.js +54 -42
  76. package/es/event/listener/table-group.js.map +1 -1
  77. package/es/index.d.ts +1 -1
  78. package/es/index.js +1 -1
  79. package/es/index.js.map +1 -1
  80. package/es/layout/chart-helper/get-axis-config.d.ts +1 -0
  81. package/es/layout/chart-helper/get-axis-config.js +25 -6
  82. package/es/layout/chart-helper/get-axis-config.js.map +1 -1
  83. package/es/layout/chart-helper/get-chart-spec.js +6 -6
  84. package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
  85. package/es/layout/pivot-header-layout.d.ts +15 -3
  86. package/es/layout/pivot-header-layout.js +64 -28
  87. package/es/layout/pivot-header-layout.js.map +1 -1
  88. package/es/layout/tree-helper.js +2 -2
  89. package/es/layout/tree-helper.js.map +1 -1
  90. package/es/scenegraph/component/custom.js +3 -1
  91. package/es/scenegraph/component/custom.js.map +1 -1
  92. package/es/scenegraph/group-creater/cell-helper.js +6 -3
  93. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  94. package/es/scenegraph/layout/compute-col-width.js +17 -11
  95. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  96. package/es/scenegraph/layout/compute-row-height.js +13 -10
  97. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  98. package/es/scenegraph/layout/update-height.js +1 -0
  99. package/es/scenegraph/layout/update-height.js.map +1 -1
  100. package/es/scenegraph/layout/update-width.js +1 -0
  101. package/es/scenegraph/layout/update-width.js.map +1 -1
  102. package/es/scenegraph/scenegraph.js +9 -2
  103. package/es/scenegraph/scenegraph.js.map +1 -1
  104. package/es/scenegraph/utils/break-string.js +2 -1
  105. package/es/scenegraph/utils/break-string.js.map +1 -1
  106. package/es/tools/helper.d.ts +1 -0
  107. package/es/tools/helper.js +6 -0
  108. package/es/tools/helper.js.map +1 -1
  109. package/es/tools/join.d.ts +1 -0
  110. package/es/tools/join.js +6 -0
  111. package/es/tools/join.js.map +1 -0
  112. package/es/ts-types/base-table.d.ts +4 -0
  113. package/es/ts-types/base-table.js.map +1 -1
  114. package/es/vrender.js.map +1 -1
  115. package/package.json +5 -5
package/dist/vtable.js CHANGED
@@ -44370,6 +44370,17 @@
44370
44370
  function isPromise(data) {
44371
44371
  return Boolean(data && typeof data.then === 'function');
44372
44372
  }
44373
+ function getPromiseValue(value, callback) {
44374
+ if (isPromise(value)) {
44375
+ value.then(result => {
44376
+ callback(result);
44377
+ }).catch((err) => {
44378
+ });
44379
+ }
44380
+ else {
44381
+ callback(value);
44382
+ }
44383
+ }
44373
44384
  function isTouchEvent$2(e) {
44374
44385
  return !!e.changedTouches;
44375
44386
  }
@@ -47394,7 +47405,7 @@
47394
47405
  const dataIndex = this.getIndexKey(index);
47395
47406
  if (!this.beforeChangedRecordsMap[dataIndex]) {
47396
47407
  const originRecord = this.getOriginalRecord(dataIndex);
47397
- this.beforeChangedRecordsMap[dataIndex] = cloneDeep(originRecord);
47408
+ this.beforeChangedRecordsMap[dataIndex] = cloneDeep(originRecord) ?? {};
47398
47409
  }
47399
47410
  if (typeof field === 'string' || typeof field === 'number') {
47400
47411
  const beforeChangedValue = this.beforeChangedRecordsMap[dataIndex][field];
@@ -47412,7 +47423,13 @@
47412
47423
  });
47413
47424
  }
47414
47425
  else {
47415
- record[field] = formatValue;
47426
+ if (record) {
47427
+ record[field] = formatValue;
47428
+ }
47429
+ else {
47430
+ this.records[dataIndex] = {};
47431
+ this.records[dataIndex][field] = formatValue;
47432
+ }
47416
47433
  }
47417
47434
  }
47418
47435
  }
@@ -48902,60 +48919,188 @@
48902
48919
  this.headerCustomLayoutFuncCache = new Map();
48903
48920
  this.headerReactRemoveGraphicCache = new Map();
48904
48921
  }
48905
- hasReactCreateGraphic(componentIndex, isHeaderCustomLayout) {
48922
+ hasReactCreateGraphic(componentId, isHeaderCustomLayout) {
48906
48923
  if (isHeaderCustomLayout) {
48907
- return this.headerCustomLayoutFuncCache.has(componentIndex);
48924
+ return this.headerCustomLayoutFuncCache.has(componentId);
48908
48925
  }
48909
- return this.customLayoutFuncCache.has(componentIndex);
48926
+ return this.customLayoutFuncCache.has(componentId);
48910
48927
  }
48911
- setReactCreateGraphic(componentIndex, createGraphic, isHeaderCustomLayout) {
48928
+ setReactCreateGraphic(componentId, createGraphic, isHeaderCustomLayout) {
48912
48929
  if (isHeaderCustomLayout) {
48913
- this.headerCustomLayoutFuncCache.set(componentIndex, createGraphic);
48930
+ this.headerCustomLayoutFuncCache.set(componentId, createGraphic);
48914
48931
  }
48915
48932
  else {
48916
- this.customLayoutFuncCache.set(componentIndex, createGraphic);
48933
+ this.customLayoutFuncCache.set(componentId, createGraphic);
48917
48934
  }
48918
48935
  }
48919
- setReactRemoveGraphic(componentIndex, removeGraphic, isHeaderCustomLayout) {
48936
+ setReactRemoveGraphic(componentId, removeGraphic, isHeaderCustomLayout) {
48920
48937
  if (isHeaderCustomLayout) {
48921
- this.headerReactRemoveGraphicCache.set(componentIndex, removeGraphic);
48938
+ this.headerReactRemoveGraphicCache.set(componentId, removeGraphic);
48922
48939
  }
48923
48940
  else {
48924
- this.reactRemoveGraphicCache.set(componentIndex, removeGraphic);
48941
+ this.reactRemoveGraphicCache.set(componentId, removeGraphic);
48925
48942
  }
48926
48943
  }
48927
- updateCustomCell(componentIndex, isHeaderCustomLayout) {
48944
+ updateCustomCell(componentId, isHeaderCustomLayout) {
48928
48945
  const table = this.table;
48929
- const col = componentIndex;
48930
- if (isHeaderCustomLayout) {
48931
- for (let row = 0; row < table.columnHeaderLevelCount; row++) {
48932
- table.scenegraph.updateCellContent(col, row);
48946
+ if (table.isPivotTable()) {
48947
+ const ranges = getUpdateCustomCellRangeInPivotTable(componentId, table, isHeaderCustomLayout);
48948
+ for (let i = 0; i < ranges.length; i++) {
48949
+ const range = ranges[i];
48950
+ for (let col = range.start.col; col <= range.end.col; col++) {
48951
+ for (let row = range.start.row; row <= range.end.row; row++) {
48952
+ table.scenegraph.updateCellContent(col, row);
48953
+ }
48954
+ }
48933
48955
  }
48934
48956
  }
48935
48957
  else {
48936
- for (let row = table.columnHeaderLevelCount; row < table.rowCount; row++) {
48937
- table.scenegraph.updateCellContent(col, row);
48958
+ const range = getUpdateCustomCellRangeInListTable(componentId, table, isHeaderCustomLayout);
48959
+ for (let col = range.start.col; col <= range.end.col; col++) {
48960
+ for (let row = range.start.row; row <= range.end.row; row++) {
48961
+ table.scenegraph.updateCellContent(col, row);
48962
+ }
48938
48963
  }
48939
48964
  }
48940
48965
  table.scenegraph.renderSceneGraph();
48941
48966
  }
48942
48967
  getCustomLayoutFunc(col, row) {
48943
- const { startInTotal } = this.table.getBodyColumnDefine(col, row);
48944
48968
  const isHeader = this.table.isHeader(col, row);
48945
- return ((isHeader ? this.headerCustomLayoutFuncCache.get(startInTotal) : this.customLayoutFuncCache.get(startInTotal)) ||
48946
- emptyCustomLayout);
48969
+ if (isHeader) {
48970
+ const { componentId } = this.table.getHeaderDefine(col, row);
48971
+ return this.headerCustomLayoutFuncCache.get(componentId) ?? emptyCustomLayout;
48972
+ }
48973
+ const { componentId } = this.table.getBodyColumnDefine(col, row);
48974
+ return this.customLayoutFuncCache.get(componentId) || emptyCustomLayout;
48947
48975
  }
48948
48976
  removeCustomCell(col, row) {
48949
- const { startInTotal } = this.table.getBodyColumnDefine(col, row);
48950
48977
  const isHeader = this.table.isHeader(col, row);
48951
- const removeFun = isHeader
48952
- ? this.headerReactRemoveGraphicCache.get(startInTotal)
48953
- : this.reactRemoveGraphicCache.get(startInTotal);
48978
+ let removeFun;
48979
+ if (isHeader) {
48980
+ const define = this.table.getHeaderDefine(col, row);
48981
+ const { componentId } = define;
48982
+ removeFun = this.headerReactRemoveGraphicCache.get(componentId);
48983
+ }
48984
+ else {
48985
+ const define = this.table.getBodyColumnDefine(col, row);
48986
+ const { componentId } = define;
48987
+ removeFun = this.reactRemoveGraphicCache.get(componentId);
48988
+ }
48954
48989
  if (removeFun) {
48955
48990
  removeFun(col, row);
48956
48991
  }
48957
48992
  }
48958
48993
  }
48994
+ function getUpdateCustomCellRangeInListTable(componentId, table, isHeaderCustomLayout) {
48995
+ const rowSeriesNumber = table.internalProps.rowSeriesNumber ? 1 : 0;
48996
+ if (isHeaderCustomLayout) {
48997
+ const layoutMap = table.internalProps.layoutMap;
48998
+ const { headerObjects } = table.internalProps.layoutMap;
48999
+ let headerId;
49000
+ for (let i = 0; i < headerObjects.length; i++) {
49001
+ const headerObject = headerObjects[i];
49002
+ if (headerObject.define.componentId === componentId) {
49003
+ headerId = headerObject.id;
49004
+ break;
49005
+ }
49006
+ }
49007
+ const startCell = layoutMap.getHeaderCellAdressById(headerId);
49008
+ const range = layoutMap.getCellRange(startCell.col, startCell.row);
49009
+ return range;
49010
+ }
49011
+ const { columnObjects } = table.internalProps.layoutMap;
49012
+ for (let i = 0; i < columnObjects.length; i++) {
49013
+ const columnObject = columnObjects[i];
49014
+ if (columnObject.define.componentId === componentId) {
49015
+ return {
49016
+ start: {
49017
+ col: rowSeriesNumber + i,
49018
+ row: table.columnHeaderLevelCount
49019
+ },
49020
+ end: {
49021
+ col: rowSeriesNumber + i,
49022
+ row: table.rowCount - 1
49023
+ }
49024
+ };
49025
+ }
49026
+ }
49027
+ return {
49028
+ start: {
49029
+ col: 0,
49030
+ row: 0
49031
+ },
49032
+ end: {
49033
+ col: table.colCount - 1,
49034
+ row: table.rowCount - 1
49035
+ }
49036
+ };
49037
+ }
49038
+ function getUpdateCustomCellRangeInPivotTable(componentId, table, isHeaderCustomLayout) {
49039
+ const rowSeriesNumber = table.internalProps.rowSeriesNumber ? 1 : 0;
49040
+ const ranges = [];
49041
+ const layoutMap = table.internalProps.layoutMap;
49042
+ if (isHeaderCustomLayout) {
49043
+ const { headerObjects } = layoutMap;
49044
+ const headerIds = [];
49045
+ for (let i = 0; i < headerObjects.length; i++) {
49046
+ const headerObject = headerObjects[i];
49047
+ if (!headerObject) {
49048
+ continue;
49049
+ }
49050
+ if (headerObject.define.componentId === componentId) {
49051
+ headerIds.push(headerObject.id);
49052
+ }
49053
+ }
49054
+ for (let i = 0; i < headerIds.length; i++) {
49055
+ const headerId = headerIds[i];
49056
+ const startCell = layoutMap.getHeaderCellAdressById(headerId);
49057
+ const range = layoutMap.getCellRange(startCell.col, startCell.row);
49058
+ ranges.push(range);
49059
+ }
49060
+ }
49061
+ else {
49062
+ let columnIndex;
49063
+ const { columnObjects, indicatorsAsCol } = layoutMap;
49064
+ for (let i = 0; i < columnObjects.length; i++) {
49065
+ const columnObject = columnObjects[i];
49066
+ if (columnObject.define.componentId === componentId) {
49067
+ columnIndex = i;
49068
+ break;
49069
+ }
49070
+ }
49071
+ if (indicatorsAsCol) {
49072
+ for (let column = layoutMap.rowHeaderLevelCount + columnIndex; column < layoutMap.colCount; column += columnObjects.length) {
49073
+ const range = {
49074
+ start: {
49075
+ col: column + rowSeriesNumber,
49076
+ row: layoutMap.columnHeaderLevelCount
49077
+ },
49078
+ end: {
49079
+ col: column + rowSeriesNumber,
49080
+ row: layoutMap.rowCount - 1
49081
+ }
49082
+ };
49083
+ ranges.push(range);
49084
+ }
49085
+ }
49086
+ else {
49087
+ for (let row = layoutMap.columnHeaderLevelCount + columnIndex; row < layoutMap.rowCount; row += columnObjects.length) {
49088
+ const range = {
49089
+ start: {
49090
+ col: layoutMap.rowHeaderLevelCount + rowSeriesNumber,
49091
+ row: row
49092
+ },
49093
+ end: {
49094
+ col: layoutMap.colCount - 1,
49095
+ row: row
49096
+ }
49097
+ };
49098
+ ranges.push(range);
49099
+ }
49100
+ }
49101
+ }
49102
+ return ranges;
49103
+ }
48959
49104
 
48960
49105
  function getCellEventArgsSet(e) {
48961
49106
  const tableEvent = {
@@ -49398,6 +49543,9 @@
49398
49543
  return;
49399
49544
  }
49400
49545
  const cellGroup = getTargetCell(graphic);
49546
+ if (!cellGroup || cellGroup.stage) {
49547
+ return;
49548
+ }
49401
49549
  const table = cellGroup.stage.table;
49402
49550
  graphic.skipAttributeUpdate = true;
49403
49551
  const { mergeStartCol, mergeEndCol, mergeStartRow, mergeEndRow } = cellGroup;
@@ -50305,6 +50453,11 @@
50305
50453
  while (text.length && text.length > 1 && !text[text.length - 1]) {
50306
50454
  text.pop();
50307
50455
  }
50456
+ if (table.options.customConfig?.multilinesForXTable && !table.internalProps.autoWrapText) {
50457
+ while (text.length && text.length > 1 && !text[0]) {
50458
+ text.shift();
50459
+ }
50460
+ }
50308
50461
  return {
50309
50462
  text,
50310
50463
  moreThanMaxCharacters
@@ -51382,9 +51535,9 @@
51382
51535
  colForDefine = range.start.col;
51383
51536
  rowForDefine = range.start.row;
51384
51537
  }
51385
- const define = cellLocation !== 'body'
51538
+ const define = (cellLocation !== 'body'
51386
51539
  ? table.getHeaderDefine(colForDefine, rowForDefine)
51387
- : table.getBodyColumnDefine(colForDefine, rowForDefine);
51540
+ : table.getBodyColumnDefine(colForDefine, rowForDefine));
51388
51541
  if (!range && (cellLocation !== 'body' || define?.mergeCell)) {
51389
51542
  range = table.getCellRange(col, row);
51390
51543
  isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
@@ -51393,7 +51546,10 @@
51393
51546
  cellTheme = getStyleTheme(cellStyle, table, isMerge ? range.start.col : col, isMerge ? range.start.row : row, getProp).theme;
51394
51547
  }
51395
51548
  cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table);
51396
- if (!addNew && !isMerge && canUseFastUpdate(col, row, oldCellGroup, autoWrapText, table)) {
51549
+ if (!addNew &&
51550
+ !isMerge &&
51551
+ !(define.customLayout || define.customRender || define.headerCustomLayout || define.headerCustomRender) &&
51552
+ canUseFastUpdate(col, row, oldCellGroup, autoWrapText, table)) {
51397
51553
  const cellWidth = table.getColWidth(col);
51398
51554
  const cellHeight = table.getRowHeight(row);
51399
51555
  oldCellGroup.setAttributes({
@@ -51515,8 +51671,10 @@
51515
51671
  if (!addNew && oldCellGroup.parent) {
51516
51672
  if (table.reactCustomLayout) {
51517
51673
  const reactGroup = oldCellGroup.getChildByName('custom-container');
51518
- const { col, row } = reactGroup;
51519
- table.reactCustomLayout.removeCustomCell(col, row);
51674
+ if (reactGroup) {
51675
+ const { col, row } = reactGroup;
51676
+ table.reactCustomLayout.removeCustomCell(col, row);
51677
+ }
51520
51678
  }
51521
51679
  }
51522
51680
  const newCellGroup = createCell(type, value, define, table, col, row, table.getColWidth(col), cellWidth, cellHeight, addNew ? table.scenegraph.getColGroup(col) : oldCellGroup.parent, addNew ? 0 : table.scenegraph.getCellGroupY(row), padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult);
@@ -51953,6 +52111,11 @@
51953
52111
  oldRowHeights[row] = table.getRowHeight(row);
51954
52112
  }
51955
52113
  }
52114
+ const layoutMap = table.internalProps.layoutMap;
52115
+ if (table.isPivotTable()) {
52116
+ layoutMap.enableUseGetBodyCache();
52117
+ layoutMap.enableUseHeaderPathCache();
52118
+ }
51956
52119
  table.defaultHeaderRowHeight;
51957
52120
  table.defaultHeaderColWidth;
51958
52121
  const isDefaultHeaderHasAuto = table.defaultHeaderRowHeight === 'auto' ||
@@ -52066,7 +52229,7 @@
52066
52229
  }
52067
52230
  let actualHeight = 0;
52068
52231
  for (let row = startRow; row < endRow; row++) {
52069
- actualHeight += update ? newHeights[row] : table.getRowHeight(row);
52232
+ actualHeight += update ? newHeights[row] ?? table.getRowHeight(row) : table.getRowHeight(row);
52070
52233
  }
52071
52234
  const factor = totalDrawHeight / actualHeight;
52072
52235
  for (let row = startRow; row < endRow; row++) {
@@ -52084,7 +52247,7 @@
52084
52247
  : table.getRowsHeight(startRow, endRow - 2));
52085
52248
  }
52086
52249
  else {
52087
- rowHeight = Math.round((update ? newHeights[row] : table.getRowHeight(row)) * factor);
52250
+ rowHeight = Math.round((update ? newHeights[row] ?? table.getRowHeight(row) : table.getRowHeight(row)) * factor);
52088
52251
  }
52089
52252
  if (update) {
52090
52253
  newHeights[row] = rowHeight;
@@ -52128,7 +52291,7 @@
52128
52291
  : table.getRowsHeight(startRow, endRow - 2));
52129
52292
  }
52130
52293
  else {
52131
- rowHeight = Math.round((update ? newHeights[row] : table.getRowHeight(row)) * factor);
52294
+ rowHeight = Math.round((update ? newHeights[row] ?? table.getRowHeight(row) : table.getRowHeight(row)) * factor);
52132
52295
  }
52133
52296
  if (update) {
52134
52297
  newHeights[row] = rowHeight;
@@ -52142,7 +52305,7 @@
52142
52305
  if (update) {
52143
52306
  for (let row = rowStart; row <= rowEnd; row++) {
52144
52307
  const newRowHeight = newHeights[row] ?? table.getRowHeight(row);
52145
- if (newRowHeight !== oldRowHeights[row]) {
52308
+ if (newRowHeight !== (oldRowHeights[row] ?? table.getRowHeight(row))) {
52146
52309
  table._setRowHeight(row, newRowHeight);
52147
52310
  }
52148
52311
  }
@@ -52150,24 +52313,28 @@
52150
52313
  (table.autoFillHeight && table.getAllRowsHeight() <= table.tableNoFrameHeight)) {
52151
52314
  for (let row = 0; row <= table.columnHeaderLevelCount - 1; row++) {
52152
52315
  const newRowHeight = table.getRowHeight(row);
52153
- if (newRowHeight !== oldRowHeights[row]) {
52154
- table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true);
52316
+ if (newRowHeight !== (oldRowHeights[row] ?? table.getRowHeight(row))) {
52317
+ table.scenegraph.updateRowHeight(row, newRowHeight - (oldRowHeights[row] ?? table.getRowHeight(row)), true);
52155
52318
  }
52156
52319
  }
52157
52320
  for (let row = table.rowCount - table.bottomFrozenRowCount; row <= table.rowCount - 1; row++) {
52158
52321
  const newRowHeight = table.getRowHeight(row);
52159
- if (newRowHeight !== oldRowHeights[row]) {
52160
- table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true);
52322
+ if (newRowHeight !== (oldRowHeights[row] ?? table.getRowHeight(row))) {
52323
+ table.scenegraph.updateRowHeight(row, newRowHeight - (oldRowHeights[row] ?? table.getRowHeight(row)), true);
52161
52324
  }
52162
52325
  }
52163
52326
  }
52164
52327
  for (let row = table.scenegraph.proxy.rowStart; row <= table.scenegraph.proxy.rowEnd; row++) {
52165
52328
  const newRowHeight = table.getRowHeight(row);
52166
- if (newRowHeight !== oldRowHeights[row]) {
52167
- table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true);
52329
+ if (newRowHeight !== (oldRowHeights[row] ?? table.getRowHeight(row))) {
52330
+ table.scenegraph.updateRowHeight(row, newRowHeight - (oldRowHeights[row] ?? table.getRowHeight(row)), true);
52168
52331
  }
52169
52332
  }
52170
52333
  }
52334
+ if (table.isPivotTable()) {
52335
+ layoutMap.disableUseGetBodyCache();
52336
+ layoutMap.disableUseHeaderPathCache();
52337
+ }
52171
52338
  }
52172
52339
  function computeRowHeight(row, startCol, endCol, table) {
52173
52340
  let maxHeight;
@@ -52645,6 +52812,9 @@
52645
52812
  const customContainer = cell.getChildByName(CUSTOM_CONTAINER_NAME) ||
52646
52813
  cell.getChildByName(CUSTOM_MERGE_CONTAINER_NAME);
52647
52814
  if (customContainer) {
52815
+ if (scene.table.reactCustomLayout) {
52816
+ scene.table.reactCustomLayout.removeCustomCell(col, row);
52817
+ }
52648
52818
  let customElementsGroup;
52649
52819
  customContainer.removeAllChild();
52650
52820
  cell.removeChild(customContainer);
@@ -52975,6 +53145,9 @@
52975
53145
  const customContainer = cell.getChildByName(CUSTOM_CONTAINER_NAME) ||
52976
53146
  cell.getChildByName(CUSTOM_MERGE_CONTAINER_NAME);
52977
53147
  if (customContainer) {
53148
+ if (scene.table.reactCustomLayout) {
53149
+ scene.table.reactCustomLayout.removeCustomCell(col, row);
53150
+ }
52978
53151
  let customElementsGroup;
52979
53152
  customContainer.removeAllChild();
52980
53153
  cell.removeChild(customContainer);
@@ -56052,6 +56225,11 @@
56052
56225
  if (colStart === 0 && colEnd === table.colCount - 1) {
56053
56226
  table._clearColRangeWidthsMap();
56054
56227
  }
56228
+ const layoutMap = table.internalProps.layoutMap;
56229
+ if (table.isPivotTable()) {
56230
+ layoutMap.enableUseGetBodyCache();
56231
+ layoutMap.enableUseHeaderPathCache();
56232
+ }
56055
56233
  const oldColWidths = [];
56056
56234
  const newWidths = [];
56057
56235
  if (update) {
@@ -56098,7 +56276,7 @@
56098
56276
  let endCol = table.colCount;
56099
56277
  if (table.widthAdaptiveMode === 'only-body') {
56100
56278
  for (let col = 0; col < table.colCount; col++) {
56101
- const colWidth = update ? newWidths[col] : table.getColWidth(col);
56279
+ const colWidth = update ? newWidths[col] ?? table.getColWidth(col) : table.getColWidth(col);
56102
56280
  if (col < table.rowHeaderLevelCount ||
56103
56281
  (table.isPivotChart() && col >= table.colCount - table.rightFrozenColCount)) {
56104
56282
  actualHeaderWidth += colWidth;
@@ -56115,7 +56293,7 @@
56115
56293
  let actualHeaderWidth = 0;
56116
56294
  let actualWidth = 0;
56117
56295
  for (let col = 0; col < table.colCount; col++) {
56118
- const colWidth = update ? newWidths[col] : table.getColWidth(col);
56296
+ const colWidth = update ? newWidths[col] ?? table.getColWidth(col) : table.getColWidth(col);
56119
56297
  if (col < table.rowHeaderLevelCount ||
56120
56298
  (table.isPivotChart() && col >= table.colCount - table.rightFrozenColCount)) {
56121
56299
  actualHeaderWidth += colWidth;
@@ -56130,7 +56308,7 @@
56130
56308
  }
56131
56309
  if (update) {
56132
56310
  for (let col = 0; col < table.colCount; col++) {
56133
- const newColWidth = newWidths[col] ?? table.getColWidth(col);
56311
+ const newColWidth = newWidths[col] ?? table.getColWidth(col) ?? table.getColWidth(col);
56134
56312
  if (newColWidth !== oldColWidths[col]) {
56135
56313
  table._setColWidth(col, newColWidth, false, true);
56136
56314
  }
@@ -56144,6 +56322,10 @@
56144
56322
  }
56145
56323
  table.scenegraph.updateContainer(true);
56146
56324
  }
56325
+ if (table.isPivotTable()) {
56326
+ layoutMap.disableUseGetBodyCache();
56327
+ layoutMap.disableUseHeaderPathCache();
56328
+ }
56147
56329
  }
56148
56330
  function computeColWidth(col, startRow, endRow, table, forceCompute = false) {
56149
56331
  let width = getColWidthDefinedWidthResizedWidth(col, table);
@@ -56240,7 +56422,7 @@
56240
56422
  }
56241
56423
  }
56242
56424
  }
56243
- else {
56425
+ else if (table.isListTable()) {
56244
56426
  deltaRow = prepareDeltaRow;
56245
56427
  const define = table.getBodyColumnDefine(col, row);
56246
56428
  if (define?.tree) {
@@ -56401,7 +56583,7 @@
56401
56583
  text = cellValue;
56402
56584
  }
56403
56585
  const lines = breakString(text, table).text;
56404
- if (lines.length >= 1) {
56586
+ if (lines.length >= 1 && !(lines.length === 1 && lines[0] === '')) {
56405
56587
  lines.forEach((line) => {
56406
56588
  const width = table.measureText(line, {
56407
56589
  fontSize,
@@ -56475,7 +56657,7 @@
56475
56657
  const sparklineColumns = [];
56476
56658
  let totalSparklineAbleWidth = 0;
56477
56659
  for (let col = startCol; col < endColPlus1; col++) {
56478
- const width = update ? newWidths[col] : table.getColWidth(col);
56660
+ const width = update ? newWidths[col] ?? table.getColWidth(col) : table.getColWidth(col);
56479
56661
  const maxWidth = table.getMaxColWidth(col);
56480
56662
  const minWidth = table.getMinColWidth(col);
56481
56663
  if (width !== maxWidth && width !== minWidth) {
@@ -56521,13 +56703,13 @@
56521
56703
  totalDrawWidth -
56522
56704
  adaptiveColumns.reduce((acr, cur, index) => {
56523
56705
  if (cur !== col) {
56524
- return acr + (update ? newWidths[cur] : table.getColWidth(cur));
56706
+ return acr + (update ? newWidths[cur] ?? table.getColWidth(col) : table.getColWidth(cur));
56525
56707
  }
56526
56708
  return acr;
56527
56709
  }, 0);
56528
56710
  }
56529
56711
  else {
56530
- colWidth = Math.round((update ? newWidths[col] : table.getColWidth(col)) * factor);
56712
+ colWidth = Math.round((update ? newWidths[col] ?? table.getColWidth(col) : table.getColWidth(col)) * factor);
56531
56713
  }
56532
56714
  if (update) {
56533
56715
  newWidths[col] = table._adjustColWidth(col, colWidth);
@@ -61107,11 +61289,36 @@
61107
61289
  }
61108
61290
  }
61109
61291
  recalculateColWidths() {
61110
- computeColsWidth(this.table, 0, this.table.colCount - 1, true);
61292
+ const table = this.table;
61293
+ if (table.widthMode === 'adaptive' || table.autoFillWidth || table.internalProps.transpose) {
61294
+ computeColsWidth(this.table, 0, this.table.colCount - 1, true);
61295
+ }
61296
+ else {
61297
+ table._clearColRangeWidthsMap();
61298
+ if (table.frozenColCount > 0) {
61299
+ computeColsWidth(this.table, 0, table.frozenColCount - 1, true);
61300
+ }
61301
+ if (table.rightFrozenColCount > 0) {
61302
+ computeColsWidth(this.table, table.rightFrozenColCount, table.colCount - 1, true);
61303
+ }
61304
+ computeColsWidth(table, this.proxy.colStart, this.proxy.colEnd, true);
61305
+ }
61111
61306
  }
61112
61307
  recalculateRowHeights() {
61113
- this.table.internalProps.useOneRowHeightFillAll = false;
61114
- computeRowsHeight(this.table, 0, this.table.rowCount - 1, true, true);
61308
+ const table = this.table;
61309
+ table.internalProps.useOneRowHeightFillAll = false;
61310
+ if (table.heightMode === 'adaptive' || table.autoFillHeight) {
61311
+ computeRowsHeight(this.table, 0, this.table.rowCount - 1, true, true);
61312
+ }
61313
+ else {
61314
+ if (table.frozenRowCount > 0) {
61315
+ computeRowsHeight(this.table, 0, table.frozenRowCount - 1, true, true);
61316
+ }
61317
+ if (table.bottomFrozenRowCount > 0) {
61318
+ computeRowsHeight(this.table, table.bottomFrozenRowCount, table.rowCount - 1, true, true);
61319
+ }
61320
+ computeRowsHeight(table, this.proxy.rowStart, this.proxy.rowEnd, true, true);
61321
+ }
61115
61322
  }
61116
61323
  resize() {
61117
61324
  this.proxy.resize();
@@ -64826,16 +65033,18 @@
64826
65033
  }
64827
65034
  }
64828
65035
  const isCompleteEdit = table.editorManager?.completeEdit(e.nativeEvent);
64829
- if (isCompleteEdit === false) {
64830
- return;
64831
- }
64832
- stateManager.updateInteractionState(InteractionState.default);
64833
- eventManager.dealTableHover();
64834
- if (table.options.select?.outsideClickDeselect) {
64835
- const isHasSelected = !!stateManager.select.ranges?.length;
64836
- eventManager.dealTableSelect();
64837
- stateManager.endSelectCells(true, isHasSelected);
64838
- }
65036
+ getPromiseValue(isCompleteEdit, (isCompleteEdit) => {
65037
+ if (isCompleteEdit === false) {
65038
+ return;
65039
+ }
65040
+ stateManager.updateInteractionState(InteractionState.default);
65041
+ eventManager.dealTableHover();
65042
+ if (table.options.select?.outsideClickDeselect) {
65043
+ const isHasSelected = !!stateManager.select.ranges?.length;
65044
+ eventManager.dealTableSelect();
65045
+ stateManager.endSelectCells(true, isHasSelected);
65046
+ }
65047
+ });
64839
65048
  });
64840
65049
  table.scenegraph.tableGroup.addEventListener('pointerdown', (e) => {
64841
65050
  if (table.hasListeners(TABLE_EVENT_TYPE.MOUSEDOWN_TABLE)) {
@@ -64861,72 +65070,74 @@
64861
65070
  stateManager.hideMenu();
64862
65071
  }
64863
65072
  const isCompleteEdit = table.editorManager?.completeEdit(e.nativeEvent);
64864
- if (isCompleteEdit === false) {
64865
- return;
64866
- }
64867
- const hitIcon = eventArgsSet?.eventArgs?.target?.role?.startsWith('icon')
64868
- ? eventArgsSet.eventArgs.target
64869
- : e.target.role?.startsWith('icon')
64870
- ? e.target
64871
- : undefined;
64872
- eventManager.downIcon = hitIcon;
64873
- if (!hitIcon || hitIcon.attribute.interactive === false) {
64874
- if (e.pointerType === 'touch') {
64875
- eventManager.touchEnd = false;
64876
- eventManager.touchSetTimeout = setTimeout(() => {
64877
- eventManager.isTouchdown = false;
64878
- eventManager.touchMove = true;
64879
- if (!eventManager.touchEnd &&
65073
+ getPromiseValue(isCompleteEdit, (isCompleteEdit) => {
65074
+ if (isCompleteEdit === false) {
65075
+ return;
65076
+ }
65077
+ const hitIcon = eventArgsSet?.eventArgs?.target?.role?.startsWith('icon')
65078
+ ? eventArgsSet.eventArgs.target
65079
+ : e.target.role?.startsWith('icon')
65080
+ ? e.target
65081
+ : undefined;
65082
+ eventManager.downIcon = hitIcon;
65083
+ if (!hitIcon || hitIcon.attribute.interactive === false) {
65084
+ if (e.pointerType === 'touch') {
65085
+ eventManager.touchEnd = false;
65086
+ eventManager.touchSetTimeout = setTimeout(() => {
65087
+ eventManager.isTouchdown = false;
65088
+ eventManager.touchMove = true;
65089
+ if (!eventManager.touchEnd &&
65090
+ (eventManager.checkColumnResize(eventArgsSet, true) || eventManager.checkRowResize(eventArgsSet, true))) {
65091
+ stateManager.updateInteractionState(InteractionState.grabing);
65092
+ return;
65093
+ }
65094
+ if (!eventManager.touchEnd && eventManager.chechColumnMover(eventArgsSet)) {
65095
+ stateManager.updateInteractionState(InteractionState.grabing);
65096
+ return;
65097
+ }
65098
+ if (eventManager.dealTableSelect(eventArgsSet) && !eventManager.touchEnd) {
65099
+ stateManager.updateInteractionState(InteractionState.grabing);
65100
+ }
65101
+ }, 500);
65102
+ eventManager.dealTableHover(eventArgsSet);
65103
+ }
65104
+ else {
65105
+ if (!eventManager.checkCellFillhandle(eventArgsSet) &&
64880
65106
  (eventManager.checkColumnResize(eventArgsSet, true) || eventManager.checkRowResize(eventArgsSet, true))) {
65107
+ table.scenegraph.updateChartState(null);
64881
65108
  stateManager.updateInteractionState(InteractionState.grabing);
64882
65109
  return;
64883
65110
  }
64884
- if (!eventManager.touchEnd && eventManager.chechColumnMover(eventArgsSet)) {
65111
+ if (eventManager.chechColumnMover(eventArgsSet)) {
64885
65112
  stateManager.updateInteractionState(InteractionState.grabing);
64886
65113
  return;
64887
65114
  }
64888
- if (eventManager.dealTableSelect(eventArgsSet) && !eventManager.touchEnd) {
65115
+ if (eventManager.checkCellFillhandle(eventArgsSet, true) && eventManager.dealFillSelect(eventArgsSet)) {
65116
+ stateManager.updateInteractionState(InteractionState.grabing);
65117
+ return;
65118
+ }
65119
+ if (eventManager.dealTableSelect(eventArgsSet)) {
64889
65120
  stateManager.updateInteractionState(InteractionState.grabing);
64890
65121
  }
64891
- }, 500);
64892
- eventManager.dealTableHover(eventArgsSet);
64893
- }
64894
- else {
64895
- if (!eventManager.checkCellFillhandle(eventArgsSet) &&
64896
- (eventManager.checkColumnResize(eventArgsSet, true) || eventManager.checkRowResize(eventArgsSet, true))) {
64897
- table.scenegraph.updateChartState(null);
64898
- stateManager.updateInteractionState(InteractionState.grabing);
64899
- return;
64900
- }
64901
- if (eventManager.chechColumnMover(eventArgsSet)) {
64902
- stateManager.updateInteractionState(InteractionState.grabing);
64903
- return;
64904
- }
64905
- if (eventManager.checkCellFillhandle(eventArgsSet, true) && eventManager.dealFillSelect(eventArgsSet)) {
64906
- stateManager.updateInteractionState(InteractionState.grabing);
64907
- return;
64908
- }
64909
- if (eventManager.dealTableSelect(eventArgsSet)) {
64910
- stateManager.updateInteractionState(InteractionState.grabing);
64911
65122
  }
64912
65123
  }
64913
- }
64914
- else if (hitIcon.attribute.funcType === IconFuncTypeEnum.dragReorder) {
64915
- stateManager.startMoveCol(eventArgsSet.eventArgs.col, eventArgsSet.eventArgs.row, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y);
64916
- stateManager.updateInteractionState(InteractionState.grabing);
64917
- }
64918
- if (table.hasListeners(TABLE_EVENT_TYPE.MOUSEDOWN_CELL)) {
64919
- const eventArgsSet = getCellEventArgsSet(e);
64920
- if (eventArgsSet.eventArgs) {
64921
- table.fireListeners(TABLE_EVENT_TYPE.MOUSEDOWN_CELL, {
64922
- col: eventArgsSet.eventArgs.col,
64923
- row: eventArgsSet.eventArgs.row,
64924
- event: e.nativeEvent,
64925
- target: eventArgsSet?.eventArgs?.target,
64926
- mergeCellInfo: eventArgsSet.eventArgs.mergeInfo
64927
- });
65124
+ else if (hitIcon.attribute.funcType === IconFuncTypeEnum.dragReorder) {
65125
+ stateManager.startMoveCol(eventArgsSet.eventArgs.col, eventArgsSet.eventArgs.row, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y);
65126
+ stateManager.updateInteractionState(InteractionState.grabing);
64928
65127
  }
64929
- }
65128
+ if (table.hasListeners(TABLE_EVENT_TYPE.MOUSEDOWN_CELL)) {
65129
+ const eventArgsSet = getCellEventArgsSet(e);
65130
+ if (eventArgsSet.eventArgs) {
65131
+ table.fireListeners(TABLE_EVENT_TYPE.MOUSEDOWN_CELL, {
65132
+ col: eventArgsSet.eventArgs.col,
65133
+ row: eventArgsSet.eventArgs.row,
65134
+ event: e.nativeEvent,
65135
+ target: eventArgsSet?.eventArgs?.target,
65136
+ mergeCellInfo: eventArgsSet.eventArgs.mergeInfo
65137
+ });
65138
+ }
65139
+ }
65140
+ });
64930
65141
  });
64931
65142
  table.scenegraph.tableGroup.addEventListener('pointerup', (e) => {
64932
65143
  if (e.button !== 0) {
@@ -65089,30 +65300,32 @@
65089
65300
  stateManager.hideMenu();
65090
65301
  }
65091
65302
  const isCompleteEdit = table.editorManager?.completeEdit(e.nativeEvent);
65092
- if (isCompleteEdit === false) {
65093
- return;
65094
- }
65095
- const hitIcon = e.target.role?.startsWith('icon') ? e.target : undefined;
65096
- eventManager.downIcon = hitIcon;
65097
- if (!hitIcon &&
65098
- !eventManager.checkCellFillhandle(eventArgsSet) &&
65099
- !stateManager.columnResize.resizing &&
65100
- eventManager.checkColumnResize(eventArgsSet, true)) {
65101
- table.scenegraph.updateChartState(null);
65102
- stateManager.updateInteractionState(InteractionState.grabing);
65103
- const { eventArgs } = eventArgsSet;
65104
- if (!eventArgs?.targetCell) {
65105
- const cell = table.getCellAt(eventArgsSet.abstractPos.x - ResizeColumnHotSpotSize / 2, eventArgsSet.abstractPos.y);
65106
- if (cell) {
65107
- if (table.hasListeners(TABLE_EVENT_TYPE.MOUSEDOWN_TABLE)) {
65108
- table.fireListeners(TABLE_EVENT_TYPE.MOUSEDOWN_TABLE, {
65109
- event: e.nativeEvent
65110
- });
65303
+ getPromiseValue(isCompleteEdit, (isCompleteEdit) => {
65304
+ if (isCompleteEdit === false) {
65305
+ return;
65306
+ }
65307
+ const hitIcon = e.target.role?.startsWith('icon') ? e.target : undefined;
65308
+ eventManager.downIcon = hitIcon;
65309
+ if (!hitIcon &&
65310
+ !eventManager.checkCellFillhandle(eventArgsSet) &&
65311
+ !stateManager.columnResize.resizing &&
65312
+ eventManager.checkColumnResize(eventArgsSet, true)) {
65313
+ table.scenegraph.updateChartState(null);
65314
+ stateManager.updateInteractionState(InteractionState.grabing);
65315
+ const { eventArgs } = eventArgsSet;
65316
+ if (!eventArgs?.targetCell) {
65317
+ const cell = table.getCellAt(eventArgsSet.abstractPos.x - ResizeColumnHotSpotSize / 2, eventArgsSet.abstractPos.y);
65318
+ if (cell) {
65319
+ if (table.hasListeners(TABLE_EVENT_TYPE.MOUSEDOWN_TABLE)) {
65320
+ table.fireListeners(TABLE_EVENT_TYPE.MOUSEDOWN_TABLE, {
65321
+ event: e.nativeEvent
65322
+ });
65323
+ }
65111
65324
  }
65112
65325
  }
65326
+ return;
65113
65327
  }
65114
- return;
65115
- }
65328
+ });
65116
65329
  });
65117
65330
  table.scenegraph.stage.addEventListener('pointerup', (e) => {
65118
65331
  if (stateManager.interactionState === 'grabing') {
@@ -68434,14 +68647,14 @@
68434
68647
  }
68435
68648
  const spec = layout.getRawChartSpec(col + 1, row);
68436
68649
  return merge({
68437
- domain: chartType === 'scatter' ? undefined : Array.from(domain),
68438
- range: chartType === 'scatter' ? domain : undefined,
68650
+ domain: axisOption?.type === 'linear' ? undefined : Array.from(domain),
68651
+ range: axisOption?.type === 'linear' ? domain : undefined,
68439
68652
  title: {
68440
68653
  autoRotate: true
68441
68654
  }
68442
68655
  }, axisOption, {
68443
68656
  orient: 'left',
68444
- type: chartType === 'scatter' ? axisOption?.type ?? 'linear' : 'band',
68657
+ type: axisOption?.type ?? 'band',
68445
68658
  __vtableChartTheme: theme,
68446
68659
  inverse: transformInverse(axisOption, (spec?.direction ?? (chartType === 'scatter' ? 'vertical' : 'horizontal')) === "horizontal")
68447
68660
  });
@@ -68565,11 +68778,11 @@
68565
68778
  return;
68566
68779
  }
68567
68780
  return merge({
68568
- domain: chartType === 'scatter' ? undefined : Array.from(domain),
68569
- range: chartType === 'scatter' ? domain : undefined
68781
+ domain: axisOption?.type === 'linear' ? undefined : Array.from(domain),
68782
+ range: axisOption?.type === 'linear' ? domain : undefined
68570
68783
  }, axisOption, {
68571
68784
  orient: 'bottom',
68572
- type: chartType === 'scatter' ? axisOption?.type ?? 'linear' : 'band',
68785
+ type: axisOption?.type ?? 'band',
68573
68786
  __vtableChartTheme: theme
68574
68787
  });
68575
68788
  }
@@ -68816,6 +69029,44 @@
68816
69029
  function isXAxis$1(orient) {
68817
69030
  return orient === 'bottom' || orient === 'top';
68818
69031
  }
69032
+ function hasLinearAxis(spec, tableAxesConfig, isHorizontal, isThisXAxis) {
69033
+ if (!isArray$1(spec.axes) || spec.axes.length === 0) {
69034
+ return (isHorizontal && isThisXAxis) || (!isHorizontal && !isThisXAxis);
69035
+ }
69036
+ for (let i = 0; i < spec.axes.length; i++) {
69037
+ const axisSpec = spec.axes[i];
69038
+ if (!isHorizontal && isThisXAxis && axisSpec.orient === 'bottom' && axisSpec.type === 'linear') {
69039
+ return true;
69040
+ }
69041
+ if (isHorizontal && isThisXAxis && axisSpec.orient === 'bottom' && axisSpec.type !== 'linear') {
69042
+ return true;
69043
+ }
69044
+ if (!isHorizontal && !isThisXAxis && axisSpec.orient === 'left' && axisSpec.type !== 'linear') {
69045
+ return true;
69046
+ }
69047
+ if (isHorizontal && !isThisXAxis && axisSpec.orient === 'left' && axisSpec.type === 'linear') {
69048
+ return true;
69049
+ }
69050
+ }
69051
+ if (isArray$1(tableAxesConfig) && tableAxesConfig.length > 0) {
69052
+ for (let i = 0; i < tableAxesConfig.length; i++) {
69053
+ const axisSpec = tableAxesConfig[i];
69054
+ if (!isHorizontal && isThisXAxis && axisSpec.orient === 'bottom' && axisSpec.type === 'linear') {
69055
+ return true;
69056
+ }
69057
+ if (isHorizontal && isThisXAxis && axisSpec.orient === 'bottom' && axisSpec.type !== 'linear') {
69058
+ return true;
69059
+ }
69060
+ if (!isHorizontal && !isThisXAxis && axisSpec.orient === 'left' && axisSpec.type !== 'linear') {
69061
+ return true;
69062
+ }
69063
+ if (isHorizontal && !isThisXAxis && axisSpec.orient === 'left' && axisSpec.type === 'linear') {
69064
+ return true;
69065
+ }
69066
+ }
69067
+ }
69068
+ return (isHorizontal && isThisXAxis) || (!isHorizontal && !isThisXAxis);
69069
+ }
68819
69070
 
68820
69071
  class NumberRangeMap {
68821
69072
  data;
@@ -69585,10 +69836,10 @@
69585
69836
  }
69586
69837
  results[id] = cell;
69587
69838
  layoutMap._headerObjects[id] = cell;
69588
- _headerCellIds[row][layoutMap.colIndex] = id;
69589
69839
  for (let r = row - 1; r >= 0; r--) {
69590
69840
  _headerCellIds[r][layoutMap.colIndex] = roots[r];
69591
69841
  }
69842
+ _headerCellIds[row][layoutMap.colIndex] = id;
69592
69843
  if (hd.levelSpan > 1) {
69593
69844
  for (let i = 1; i < hd.levelSpan; i++) {
69594
69845
  if (!_headerCellIds[row + i]) {
@@ -70221,7 +70472,7 @@
70221
70472
  return TABLE_EVENT_TYPE;
70222
70473
  }
70223
70474
  options;
70224
- version = "1.5.2-alpha.1";
70475
+ version = "1.5.2";
70225
70476
  pagination;
70226
70477
  id = `VTable${Date.now()}`;
70227
70478
  headerStyleCache;
@@ -73823,11 +74074,11 @@
73823
74074
  const domain = data[rowPath ?? ''];
73824
74075
  const { axisOption, isPercent, chartType } = getAxisOption(col, row, 'left', layout);
73825
74076
  axes.push(merge({
73826
- domain: chartType === 'scatter' && !Array.isArray(domain) ? undefined : Array.from(domain ?? []),
73827
- range: chartType === 'scatter' && !Array.isArray(domain) ? domain : undefined,
74077
+ domain: axisOption?.type === 'linear' && !Array.isArray(domain) ? undefined : Array.from(domain ?? []),
74078
+ range: axisOption?.type === 'linear' && !Array.isArray(domain) ? domain : undefined,
73828
74079
  label: { style: { fontSize: DEFAULT_TEXT_FONT_SIZE } }
73829
74080
  }, axisOption, {
73830
- type: chartType === 'scatter' && !Array.isArray(domain) ? axisOption?.type ?? 'linear' : 'band',
74081
+ type: axisOption?.type ?? 'band',
73831
74082
  orient: 'left',
73832
74083
  label: { visible: false },
73833
74084
  domainLine: { visible: false },
@@ -73882,11 +74133,11 @@
73882
74133
  const domain = data?.[colPath ?? ''] ?? [];
73883
74134
  const { axisOption, isPercent, chartType } = getAxisOption(col, row, 'bottom', layout);
73884
74135
  axes.push(merge({
73885
- domain: chartType === 'scatter' && !Array.isArray(domain) ? undefined : Array.from(domain ?? []),
73886
- range: chartType === 'scatter' && !Array.isArray(domain) ? domain : undefined,
74136
+ domain: axisOption?.type === 'linear' && !Array.isArray(domain) ? undefined : Array.from(domain ?? []),
74137
+ range: axisOption?.type === 'linear' && !Array.isArray(domain) ? domain : undefined,
73887
74138
  label: { style: { fontSize: DEFAULT_TEXT_FONT_SIZE } }
73888
74139
  }, axisOption, {
73889
- type: chartType === 'scatter' && !Array.isArray(domain) ? axisOption?.type ?? 'linear' : 'band',
74140
+ type: axisOption?.type ?? 'band',
73890
74141
  orient: 'bottom',
73891
74142
  visible: true,
73892
74143
  label: { visible: false },
@@ -75367,25 +75618,50 @@
75367
75618
  }
75368
75619
  }
75369
75620
  if (!this.editingEditor.getValue) ;
75370
- if (!this.editingEditor.validateValue || this.editingEditor.validateValue?.()) {
75371
- const changedValue = this.editingEditor.getValue?.();
75372
- const range = this.table.getCellRange(this.editCell.col, this.editCell.row);
75373
- const changedValues = [];
75374
- for (let row = range.start.row; row <= range.end.row; row++) {
75375
- const rowChangedValues = [];
75376
- for (let col = range.start.col; col <= range.end.col; col++) {
75377
- rowChangedValues.push(changedValue);
75378
- }
75379
- changedValues.push(rowChangedValues);
75621
+ if (this.editingEditor.validateValue) {
75622
+ const maybePromiseOrValue = this.editingEditor.validateValue?.();
75623
+ if (isPromise(maybePromiseOrValue)) {
75624
+ return new Promise((resolve, reject) => {
75625
+ maybePromiseOrValue
75626
+ .then(result => {
75627
+ if (result) {
75628
+ this.doExit();
75629
+ resolve(true);
75630
+ }
75631
+ else {
75632
+ resolve(false);
75633
+ }
75634
+ })
75635
+ .catch((err) => {
75636
+ reject(err);
75637
+ });
75638
+ });
75380
75639
  }
75381
- this.table.changeCellValues(range.start.col, range.start.row, changedValues);
75382
- this.editingEditor.exit && (void 0);
75383
- this.editingEditor.exit?.();
75384
- this.editingEditor.onEnd?.();
75385
- this.editingEditor = null;
75386
- return true;
75640
+ else if (maybePromiseOrValue) {
75641
+ this.doExit();
75642
+ return true;
75643
+ }
75644
+ return false;
75387
75645
  }
75388
- return false;
75646
+ this.doExit();
75647
+ return true;
75648
+ }
75649
+ doExit() {
75650
+ const changedValue = this.editingEditor.getValue?.();
75651
+ const range = this.table.getCellRange(this.editCell.col, this.editCell.row);
75652
+ const changedValues = [];
75653
+ for (let row = range.start.row; row <= range.end.row; row++) {
75654
+ const rowChangedValues = [];
75655
+ for (let col = range.start.col; col <= range.end.col; col++) {
75656
+ rowChangedValues.push(changedValue);
75657
+ }
75658
+ changedValues.push(rowChangedValues);
75659
+ }
75660
+ this.table.changeCellValues(range.start.col, range.start.row, changedValues);
75661
+ this.editingEditor.exit && (void 0);
75662
+ this.editingEditor.exit?.();
75663
+ this.editingEditor.onEnd?.();
75664
+ this.editingEditor = null;
75389
75665
  }
75390
75666
  cancelEdit() {
75391
75667
  if (this.editingEditor) {
@@ -81179,14 +81455,16 @@
81179
81455
  _chartPaddingOuter;
81180
81456
  _chartItemBandSize;
81181
81457
  _chartPadding;
81182
- _lastCellCol;
81183
- _lastCellRow;
81184
- _lastCellHeaderPath;
81185
81458
  rowSeriesNumberColumn;
81186
81459
  leftRowSeriesNumberColumn;
81187
81460
  leftRowSeriesNumberColumnCount = 0;
81188
81461
  rightRowSeriesNumberColumn;
81189
81462
  rightRowSeriesNumberColumnCount = 0;
81463
+ _useGetBodyCache = false;
81464
+ _getBodyCache = new Map();
81465
+ _useHeaderPathCache = false;
81466
+ _colHeaderPathCache = new Map();
81467
+ _rowHeaderPathCache = new Map();
81190
81468
  constructor(table, dataset, columnDimensionTree, rowDimensionTree) {
81191
81469
  this.sharedVar = table.layoutNodeId;
81192
81470
  this._table = table;
@@ -82437,13 +82715,19 @@
82437
82715
  return this.getHeaderCellAdressById(hd.id);
82438
82716
  }
82439
82717
  getBody(_col, _row) {
82718
+ const cache = this.getBodyWidthCache(_col, _row);
82719
+ if (cache) {
82720
+ return cache;
82721
+ }
82440
82722
  if (this.isSeriesNumber(_col, _row)) {
82441
- return this.getSeriesNumberBody(_col, _row);
82723
+ const body = this.getSeriesNumberBody(_col, _row);
82724
+ this.setBodyWidthCache(_col, _row, body);
82725
+ return body;
82442
82726
  }
82443
82727
  const paths = this.getCellHeaderPaths(_col, _row);
82444
82728
  if (this.indicatorsAsCol) {
82445
82729
  const indicatorKey = paths.colHeaderPaths?.find(colPath => colPath.indicatorKey)?.indicatorKey;
82446
- return isValid$1(indicatorKey)
82730
+ const body = isValid$1(indicatorKey)
82447
82731
  ? this._indicators?.find(indicator => indicator.indicatorKey === indicatorKey) ??
82448
82732
  this._indicators[0] ?? {
82449
82733
  id: '',
@@ -82459,9 +82743,11 @@
82459
82743
  cellType: 'text',
82460
82744
  define: undefined
82461
82745
  };
82746
+ this.setBodyWidthCache(_col, _row, body);
82747
+ return body;
82462
82748
  }
82463
82749
  const indicatorKey = paths.rowHeaderPaths?.find(rowPath => rowPath.indicatorKey)?.indicatorKey;
82464
- return isValid$1(indicatorKey)
82750
+ const body = isValid$1(indicatorKey)
82465
82751
  ? this._indicators?.find(indicator => indicator.indicatorKey === indicatorKey) ??
82466
82752
  this._indicators[0] ?? {
82467
82753
  id: '',
@@ -82477,6 +82763,8 @@
82477
82763
  cellType: 'text',
82478
82764
  define: undefined
82479
82765
  };
82766
+ this.setBodyWidthCache(_col, _row, body);
82767
+ return body;
82480
82768
  }
82481
82769
  getCellRange(col, row) {
82482
82770
  const result = { start: { col, row }, end: { col, row } };
@@ -82608,25 +82896,24 @@
82608
82896
  return undefined;
82609
82897
  }
82610
82898
  getCellHeaderPathsWithTreeNode(col, row) {
82611
- if (col === this._lastCellCol && row === this._lastCellRow) {
82612
- return this._lastCellHeaderPath;
82613
- }
82614
82899
  for (let i = 0; i < this._largeCellRangeCache.length; i++) {
82615
82900
  const range = this._largeCellRangeCache[i];
82616
82901
  if (col >= range.start.col && col <= range.end.col && row >= range.start.row && row <= range.end.row) {
82617
82902
  break;
82618
82903
  }
82619
82904
  }
82905
+ let colPath = this.getColHeaderPathCache(col, row);
82906
+ let rowPath = this.getRowHeaderPathCache(col, row);
82620
82907
  const recordCol = this.getBodyIndexByCol(col);
82621
82908
  const recordRow = this.getBodyIndexByRow(row) + this.currentPageStartIndex;
82622
- let colPath = [];
82623
- let rowPath = [];
82624
- if (row >= 0 && recordCol >= 0) {
82909
+ if (!colPath && row >= 0 && recordCol >= 0) {
82625
82910
  colPath = this.columnDimensionTree.getTreePath(recordCol, this.showHeader && this.showColumnHeader
82626
82911
  ? row - (this.columnHeaderTitle ? 1 : 0)
82627
82912
  : this.columnDimensionTree.totalLevel);
82913
+ this.setColHeaderPathCache(col, row, colPath);
82628
82914
  }
82629
- if (col >= 0 && recordRow >= 0) {
82915
+ if (!rowPath && col >= 0 && recordRow >= 0) {
82916
+ rowPath = [];
82630
82917
  if (this.rowHierarchyType === 'tree') {
82631
82918
  const row_pathIds = this._rowHeaderCellFullPathIds[recordRow];
82632
82919
  let findTree = this.rowDimensionTree;
@@ -82646,7 +82933,7 @@
82646
82933
  }
82647
82934
  }
82648
82935
  const findedRowPath = findTree.getTreePathByCellIds(pathIds);
82649
- rowPath = rowPath.concat(findedRowPath);
82936
+ rowPath.push(...findedRowPath);
82650
82937
  findTree = this._rowHeaderExtensionTree[row_pathIds[level]];
82651
82938
  level++;
82652
82939
  }
@@ -82656,11 +82943,9 @@
82656
82943
  ? col - (this.rowHeaderTitle ? 1 : 0) - this.leftRowSeriesNumberColumnCount
82657
82944
  : this.rowDimensionTree.totalLevel);
82658
82945
  }
82946
+ this.setRowHeaderPathCache(col, row, rowPath);
82659
82947
  }
82660
82948
  const p = { colHeaderPaths: colPath, rowHeaderPaths: rowPath, cellLocation: this.getCellLocation(col, row) };
82661
- this._lastCellHeaderPath = p;
82662
- this._lastCellCol = col;
82663
- this._lastCellRow = row;
82664
82949
  return p;
82665
82950
  }
82666
82951
  getCellHeaderPaths(col, row) {
@@ -83943,6 +84228,75 @@
83943
84228
  }
83944
84229
  }
83945
84230
  }
84231
+ enableUseGetBodyCache() {
84232
+ this._useGetBodyCache = true;
84233
+ this._getBodyCache.clear();
84234
+ }
84235
+ disableUseGetBodyCache() {
84236
+ this._useGetBodyCache = false;
84237
+ this._getBodyCache.clear();
84238
+ }
84239
+ enableUseHeaderPathCache() {
84240
+ this._useHeaderPathCache = true;
84241
+ this._colHeaderPathCache.clear();
84242
+ this._rowHeaderPathCache.clear();
84243
+ }
84244
+ disableUseHeaderPathCache() {
84245
+ this._useHeaderPathCache = false;
84246
+ this._colHeaderPathCache.clear();
84247
+ this._rowHeaderPathCache.clear();
84248
+ }
84249
+ getBodyWidthCache(col, row) {
84250
+ if (!this._useGetBodyCache || this.isHeader(col, row) || this.isSeriesNumber(col, row)) {
84251
+ return undefined;
84252
+ }
84253
+ if (this.indicatorsAsCol && this._getBodyCache.has(col)) {
84254
+ return this._getBodyCache.get(col);
84255
+ }
84256
+ else if (!this.indicatorsAsCol && this._getBodyCache.has(row)) {
84257
+ return this._getBodyCache.get(row);
84258
+ }
84259
+ return undefined;
84260
+ }
84261
+ setBodyWidthCache(col, row, cache) {
84262
+ if (!this._useGetBodyCache || this.isHeader(col, row) || this.isSeriesNumber(col, row)) {
84263
+ return;
84264
+ }
84265
+ if (this.indicatorsAsCol) {
84266
+ this._getBodyCache.set(col, cache);
84267
+ }
84268
+ else {
84269
+ this._getBodyCache.set(row, cache);
84270
+ }
84271
+ }
84272
+ getColHeaderPathCache(col, row) {
84273
+ if (this._useHeaderPathCache &&
84274
+ !this.isHeader(col, row) &&
84275
+ !this.isSeriesNumber(col, row) &&
84276
+ this._colHeaderPathCache.has(col)) {
84277
+ return this._colHeaderPathCache.get(col);
84278
+ }
84279
+ return undefined;
84280
+ }
84281
+ setColHeaderPathCache(col, row, cache) {
84282
+ if (this._useHeaderPathCache && !this.isHeader(col, row) && !this.isSeriesNumber(col, row)) {
84283
+ this._colHeaderPathCache.set(col, cache);
84284
+ }
84285
+ }
84286
+ getRowHeaderPathCache(col, row) {
84287
+ if (this._useHeaderPathCache &&
84288
+ !this.isHeader(col, row) &&
84289
+ !this.isSeriesNumber(col, row) &&
84290
+ this._rowHeaderPathCache.has(row)) {
84291
+ return this._rowHeaderPathCache.get(row);
84292
+ }
84293
+ return undefined;
84294
+ }
84295
+ setRowHeaderPathCache(col, row, cache) {
84296
+ if (this._useHeaderPathCache && !this.isHeader(col, row) && !this.isSeriesNumber(col, row)) {
84297
+ this._rowHeaderPathCache.set(row, cache);
84298
+ }
84299
+ }
83946
84300
  }
83947
84301
  function scaleWholeRangeSize(count, bandwidth, paddingInner, paddingOuter) {
83948
84302
  if (paddingInner === 1) {
@@ -84196,6 +84550,17 @@
84196
84550
  }
84197
84551
  }
84198
84552
 
84553
+ function join(strArr, joinChar) {
84554
+ let str = '';
84555
+ for (let i = 0; i < strArr.length; i++) {
84556
+ str += strArr[i];
84557
+ if (i !== strArr.length - 1) {
84558
+ str += joinChar;
84559
+ }
84560
+ }
84561
+ return str;
84562
+ }
84563
+
84199
84564
  class Dataset {
84200
84565
  dataConfig;
84201
84566
  records;
@@ -84828,7 +85193,7 @@
84828
85193
  }
84829
85194
  });
84830
85195
  }
84831
- flatRowKey = rowKey.join(this.stringJoinChar);
85196
+ flatRowKey = join(rowKey, this.stringJoinChar);
84832
85197
  }
84833
85198
  if (typeof colKey === 'string') {
84834
85199
  flatColKey = colKey;
@@ -84841,7 +85206,7 @@
84841
85206
  }
84842
85207
  });
84843
85208
  }
84844
- flatColKey = colKey.join(this.stringJoinChar);
85209
+ flatColKey = join(colKey, this.stringJoinChar);
84845
85210
  }
84846
85211
  const agg = this.tree[flatRowKey]?.[flatColKey]?.[indicatorIndex];
84847
85212
  if (considerChangedValue && isValid$1(this.changedTree[flatRowKey]?.[flatColKey]?.[indicatorIndex])) {
@@ -87613,7 +87978,7 @@
87613
87978
  collectValuesBy[xField] = {
87614
87979
  by: columnKeys,
87615
87980
  type: chartSeries.direction !== 'horizontal' ? 'xField' : undefined,
87616
- range: chartSeries.type === 'scatter' ? true : chartSeries.direction === 'horizontal',
87981
+ range: hasLinearAxis(chartSeries, this._axes, chartSeries.direction === 'horizontal', true),
87617
87982
  sortBy: chartSeries.direction !== 'horizontal'
87618
87983
  ? chartSeries?.data?.fields?.[xField]?.domain ?? indicatorSpec?.data?.fields?.[xField]?.domain
87619
87984
  : undefined
@@ -87624,7 +87989,7 @@
87624
87989
  (chartSeries.stack = true);
87625
87990
  collectValuesBy[yField] = {
87626
87991
  by: rowKeys,
87627
- range: chartSeries.type === 'scatter' ? true : chartSeries.direction !== 'horizontal',
87992
+ range: hasLinearAxis(chartSeries, this._axes, chartSeries.direction === 'horizontal', false),
87628
87993
  sumBy: chartSeries.stack && columnKeys.concat(chartSeries?.xField),
87629
87994
  sortBy: chartSeries.direction === 'horizontal'
87630
87995
  ? chartSeries?.data?.fields?.[yField]?.domain ?? indicatorSpec?.data?.fields?.[yField]?.domain
@@ -87638,7 +88003,7 @@
87638
88003
  collectValuesBy[xField] = {
87639
88004
  by: columnKeys,
87640
88005
  type: indicatorSpec.direction !== 'horizontal' ? 'xField' : undefined,
87641
- range: indicatorSpec.type === 'scatter' ? true : indicatorSpec.direction === 'horizontal',
88006
+ range: hasLinearAxis(indicatorSpec, this._axes, indicatorSpec.direction === 'horizontal', true),
87642
88007
  sortBy: indicatorSpec.direction !== 'horizontal' ? indicatorSpec?.data?.fields?.[xField]?.domain : undefined
87643
88008
  };
87644
88009
  indicatorSpec?.stack !== false &&
@@ -87670,7 +88035,7 @@
87670
88035
  collectValuesBy[yField] = {
87671
88036
  by: rowKeys,
87672
88037
  type: chartSeries.direction === 'horizontal' ? 'yField' : undefined,
87673
- range: chartSeries.type === 'scatter' ? true : chartSeries.direction !== 'horizontal',
88038
+ range: hasLinearAxis(chartSeries, this._axes, chartSeries.direction === 'horizontal', false),
87674
88039
  sortBy: chartSeries.direction === 'horizontal'
87675
88040
  ? chartSeries?.data?.fields?.[yField]?.domain ?? indicatorSpec?.data?.fields?.[yField]?.domain
87676
88041
  : undefined
@@ -87681,7 +88046,7 @@
87681
88046
  (chartSeries.stack = true);
87682
88047
  collectValuesBy[xField] = {
87683
88048
  by: columnKeys,
87684
- range: chartSeries.type === 'scatter' ? true : chartSeries.direction === 'horizontal',
88049
+ range: hasLinearAxis(chartSeries, this._axes, chartSeries.direction === 'horizontal', true),
87685
88050
  sumBy: chartSeries.stack && rowKeys.concat(chartSeries?.yField),
87686
88051
  sortBy: chartSeries.direction !== 'horizontal'
87687
88052
  ? chartSeries?.data?.fields?.[xField]?.domain ?? indicatorSpec?.data?.fields?.[xField]?.domain
@@ -87695,7 +88060,7 @@
87695
88060
  collectValuesBy[yField] = {
87696
88061
  by: rowKeys,
87697
88062
  type: indicatorSpec.direction === 'horizontal' ? 'yField' : undefined,
87698
- range: indicatorSpec.type === 'scatter' ? true : indicatorSpec.direction !== 'horizontal',
88063
+ range: hasLinearAxis(indicatorSpec, this._axes, indicatorSpec.direction === 'horizontal', false),
87699
88064
  sortBy: indicatorSpec.direction === 'horizontal' ? indicatorSpec?.data?.fields?.[yField]?.domain : undefined
87700
88065
  };
87701
88066
  indicatorSpec?.stack !== false &&
@@ -87704,7 +88069,7 @@
87704
88069
  const xField = indicatorSpec.xField;
87705
88070
  collectValuesBy[xField] = {
87706
88071
  by: columnKeys,
87707
- range: indicatorSpec.type === 'scatter' ? true : indicatorSpec.direction === 'horizontal',
88072
+ range: hasLinearAxis(indicatorSpec, this._axes, indicatorSpec.direction === 'horizontal', true),
87708
88073
  sumBy: indicatorSpec.stack && rowKeys.concat(indicatorSpec?.yField),
87709
88074
  sortBy: indicatorSpec.direction !== 'horizontal' ? indicatorSpec?.data?.fields?.[xField]?.domain : undefined,
87710
88075
  extendRange: parseMarkLineGetExtendRange(indicatorSpec.markLine)
@@ -88595,7 +88960,7 @@
88595
88960
  }
88596
88961
 
88597
88962
  registerForVrender();
88598
- const version = "1.5.2-alpha.1";
88963
+ const version = "1.5.2";
88599
88964
  function getIcons() {
88600
88965
  return get$2();
88601
88966
  }