@visactor/vtable 0.10.0 → 0.10.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/cjs/ListTable.d.ts +1 -2
  2. package/cjs/ListTable.js +2 -5
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotChart.js +10 -8
  5. package/cjs/PivotChart.js.map +1 -1
  6. package/cjs/PivotTable.js +8 -5
  7. package/cjs/PivotTable.js.map +1 -1
  8. package/cjs/components/axis/get-axis-attributes.d.ts +2 -0
  9. package/cjs/components/axis/get-axis-attributes.js +3 -1
  10. package/cjs/components/axis/get-axis-attributes.js.map +1 -1
  11. package/cjs/components/axis/get-axis-component-size.js +65 -33
  12. package/cjs/components/axis/get-axis-component-size.js.map +1 -1
  13. package/cjs/components/tooltip/TooltipHandler.js +2 -0
  14. package/cjs/components/tooltip/TooltipHandler.js.map +1 -1
  15. package/cjs/core/BaseTable.d.ts +4 -2
  16. package/cjs/core/BaseTable.js +29 -30
  17. package/cjs/core/BaseTable.js.map +1 -1
  18. package/cjs/event/drill.js +2 -0
  19. package/cjs/event/drill.js.map +1 -1
  20. package/cjs/event/event.js +1 -1
  21. package/cjs/event/event.js.map +1 -1
  22. package/cjs/event/listener/table-group.js +19 -9
  23. package/cjs/event/listener/table-group.js.map +1 -1
  24. package/cjs/index.d.ts +1 -1
  25. package/cjs/index.js +1 -1
  26. package/cjs/index.js.map +1 -1
  27. package/cjs/layout/pivot-header-layout.d.ts +1 -0
  28. package/cjs/layout/pivot-header-layout.js +28 -4
  29. package/cjs/layout/pivot-header-layout.js.map +1 -1
  30. package/cjs/layout/simple-header-layout.js +22 -10
  31. package/cjs/layout/simple-header-layout.js.map +1 -1
  32. package/cjs/scenegraph/component/table-component.d.ts +3 -3
  33. package/cjs/scenegraph/component/table-component.js +6 -6
  34. package/cjs/scenegraph/component/table-component.js.map +1 -1
  35. package/cjs/scenegraph/component/util.d.ts +1 -1
  36. package/cjs/scenegraph/component/util.js +2 -1
  37. package/cjs/scenegraph/component/util.js.map +1 -1
  38. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -3
  39. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  40. package/cjs/scenegraph/layout/compute-col-width.js +7 -21
  41. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  42. package/cjs/scenegraph/layout/update-width.js +9 -4
  43. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  44. package/cjs/scenegraph/scenegraph.d.ts +1 -0
  45. package/cjs/scenegraph/scenegraph.js +20 -21
  46. package/cjs/scenegraph/scenegraph.js.map +1 -1
  47. package/cjs/scenegraph/utils/update-container.d.ts +2 -0
  48. package/cjs/scenegraph/utils/update-container.js +13 -0
  49. package/cjs/scenegraph/utils/update-container.js.map +1 -0
  50. package/cjs/state/resize/update-resize-column.d.ts +2 -0
  51. package/cjs/state/resize/update-resize-column.js +74 -0
  52. package/cjs/state/resize/update-resize-column.js.map +1 -0
  53. package/cjs/state/sort/index.js +4 -2
  54. package/cjs/state/sort/index.js.map +1 -1
  55. package/cjs/state/state.d.ts +2 -1
  56. package/cjs/state/state.js +5 -24
  57. package/cjs/state/state.js.map +1 -1
  58. package/cjs/ts-types/base-table.d.ts +3 -1
  59. package/cjs/ts-types/base-table.js.map +1 -1
  60. package/cjs/ts-types/events.d.ts +1 -1
  61. package/cjs/ts-types/events.js.map +1 -1
  62. package/dist/vtable.js +1936 -726
  63. package/dist/vtable.min.js +3 -3
  64. package/es/ListTable.d.ts +1 -2
  65. package/es/ListTable.js +2 -5
  66. package/es/ListTable.js.map +1 -1
  67. package/es/PivotChart.js +10 -8
  68. package/es/PivotChart.js.map +1 -1
  69. package/es/PivotTable.js +8 -5
  70. package/es/PivotTable.js.map +1 -1
  71. package/es/components/axis/get-axis-attributes.d.ts +2 -0
  72. package/es/components/axis/get-axis-attributes.js +3 -1
  73. package/es/components/axis/get-axis-attributes.js.map +1 -1
  74. package/es/components/axis/get-axis-component-size.js +65 -33
  75. package/es/components/axis/get-axis-component-size.js.map +1 -1
  76. package/es/components/tooltip/TooltipHandler.js +2 -0
  77. package/es/components/tooltip/TooltipHandler.js.map +1 -1
  78. package/es/core/BaseTable.d.ts +4 -2
  79. package/es/core/BaseTable.js +28 -28
  80. package/es/core/BaseTable.js.map +1 -1
  81. package/es/event/drill.js +2 -0
  82. package/es/event/drill.js.map +1 -1
  83. package/es/event/event.js +1 -1
  84. package/es/event/event.js.map +1 -1
  85. package/es/event/listener/table-group.js +19 -9
  86. package/es/event/listener/table-group.js.map +1 -1
  87. package/es/index.d.ts +1 -1
  88. package/es/index.js +1 -1
  89. package/es/index.js.map +1 -1
  90. package/es/layout/pivot-header-layout.d.ts +1 -0
  91. package/es/layout/pivot-header-layout.js +26 -4
  92. package/es/layout/pivot-header-layout.js.map +1 -1
  93. package/es/layout/simple-header-layout.js +22 -10
  94. package/es/layout/simple-header-layout.js.map +1 -1
  95. package/es/scenegraph/component/table-component.d.ts +3 -3
  96. package/es/scenegraph/component/table-component.js +6 -6
  97. package/es/scenegraph/component/table-component.js.map +1 -1
  98. package/es/scenegraph/component/util.d.ts +1 -1
  99. package/es/scenegraph/component/util.js +2 -1
  100. package/es/scenegraph/component/util.js.map +1 -1
  101. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -3
  102. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  103. package/es/scenegraph/layout/compute-col-width.js +7 -21
  104. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  105. package/es/scenegraph/layout/update-width.js +9 -4
  106. package/es/scenegraph/layout/update-width.js.map +1 -1
  107. package/es/scenegraph/scenegraph.d.ts +1 -0
  108. package/es/scenegraph/scenegraph.js +18 -20
  109. package/es/scenegraph/scenegraph.js.map +1 -1
  110. package/es/scenegraph/utils/update-container.d.ts +2 -0
  111. package/es/scenegraph/utils/update-container.js +7 -0
  112. package/es/scenegraph/utils/update-container.js.map +1 -0
  113. package/es/state/resize/update-resize-column.d.ts +2 -0
  114. package/es/state/resize/update-resize-column.js +68 -0
  115. package/es/state/resize/update-resize-column.js.map +1 -0
  116. package/es/state/sort/index.js +4 -2
  117. package/es/state/sort/index.js.map +1 -1
  118. package/es/state/state.d.ts +2 -1
  119. package/es/state/state.js +6 -23
  120. package/es/state/state.js.map +1 -1
  121. package/es/ts-types/base-table.d.ts +3 -1
  122. package/es/ts-types/base-table.js.map +1 -1
  123. package/es/ts-types/events.d.ts +1 -1
  124. package/es/ts-types/events.js.map +1 -1
  125. package/package.json +7 -7
@@ -80,27 +80,8 @@ function computeColsWidth(table, colStart, colEnd, update) {
80
80
  }
81
81
 
82
82
  function computeColWidth(col, startRow, endRow, table, forceCompute) {
83
- var _a, _b;
84
- const {layoutMap: layoutMap, transpose: transpose} = table.internalProps;
85
- let {width: width} = null !== (_a = null == layoutMap ? void 0 : layoutMap.getColumnWidthDefined(col)) && void 0 !== _a ? _a : {};
86
- if (transpose) {
87
- if ("standard" === table.widthMode) {
88
- if (table.isRowHeader(col, 0) || table.isCornerHeader(col, 0)) {
89
- const defaultWidth = Array.isArray(table.defaultHeaderColWidth) ? null !== (_b = table.defaultHeaderColWidth[col]) && void 0 !== _b ? _b : table.defaultColWidth : table.defaultHeaderColWidth;
90
- if ("auto" !== defaultWidth) return defaultWidth;
91
- width = "auto";
92
- }
93
- if ("auto" !== width) return "string" == typeof width ? calc.toPx(width, table.internalProps.calcWidthContext) : width || table.defaultColWidth;
94
- } else if ("adaptive" === table.widthMode && 0 === col && "auto" !== width && (null == layoutMap ? void 0 : layoutMap.showHeader)) {
95
- if ("string" == typeof width) return calc.toPx(width, table.internalProps.calcWidthContext);
96
- if (width) return width;
97
- }
98
- } else if ("auto" !== width && "autoWidth" !== table.widthMode && !forceCompute) {
99
- if ("string" == typeof width) return calc.toPx(width, table.internalProps.calcWidthContext);
100
- if (width) return width;
101
- if ("auto" !== table.getColWidthDefine(col)) return table.getColWidth(col);
102
- }
103
- return computeAutoColWidth(width, col, startRow, endRow, forceCompute, table);
83
+ const width = getColWidthDefinedWidthResizedWidth(col, table);
84
+ return "number" == typeof width ? width : "auto" !== width && "string" == typeof width ? calc.toPx(width, table.internalProps.calcWidthContext) : computeAutoColWidth(width, col, startRow, endRow, forceCompute, table);
104
85
  }
105
86
 
106
87
  function computeAutoColWidth(widthDeifne, col, startRow, endRow, forceCompute, table) {
@@ -241,6 +222,11 @@ function getCellRect(col, row, table) {
241
222
  };
242
223
  }
243
224
 
225
+ function getColWidthDefinedWidthResizedWidth(col, table) {
226
+ const widthDefined = table.getColWidthDefined(col);
227
+ return table.internalProps._widthResizedColMap.has(col) ? table.getColWidth(col) : widthDefined;
228
+ }
229
+
244
230
  exports.computeColsWidth = computeColsWidth, exports.computeColWidth = computeColWidth,
245
231
  exports.getCellRect = getCellRect;
246
232
  //# sourceMappingURL=compute-col-width.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["scenegraph/layout/compute-col-width.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,6CAA8D;AAC9D,uDAAyC;AACzC,2CAAiD;AACjD,8CAAgD;AAChD,gDAA4C;AAG5C,+EAAsF;AACtF,2FAA0F;AAE1F,SAAgB,gBAAgB,CAAC,KAAmB,EAAE,QAAiB,EAAE,MAAe,EAAE,MAAgB;;IACxG,MAAM,IAAI,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,QAAQ,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,CAAC,CAAC;IACzB,MAAM,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC;IAGtC,IAAI,QAAQ,KAAK,CAAC,IAAI,MAAM,KAAK,KAAK,CAAC,QAAQ,GAAG,CAAC,EAAE;Q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CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,mBAAmB,IAAI,GAAG,CAAC,EAAE;gBACvF,QAAQ;gBACR,UAAU;gBACV,UAAU;aACX,CAAC,CAAC,KAAK,CAAC;YACT,QAAQ,GAAG,IAAI,CAAC,GAAG,CAEjB,CAAC,KAAK,GAAG,YAAY,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,OAAO,EAChD,QAAQ,CACT,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,QAAQ,GAAG,IAAI,CAAC,GAAG,CAEjB,CAAC,YAAY,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,OAAO,EACxC,QAAQ,CACT,CAAC;KACH;IAED,IAAI,KAAK,CAAC,aAAa,CAAC,iBAAiB,KAAK,KAAK,EAAE;QACnD,QAAQ,GAAG,IAAI,CAAC,GAAG,CACjB,OAAO,KAAK,CAAC,aAAa,CAAC,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,EACvG,QAAQ,CACT,CAAC;KACH;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAgB,WAAW,CAAC,GAAW,EAAE,GAAW,EAAE,KAAmB;IACvE,OAAO;QACL,IAAI,EAAE,CAAC;QACP,GAAG,EAAE,CAAC;QACN,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC;QAC7B,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC;QAC/B,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC;QAC7B,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC;KAChC,CAAC;AACJ,CAAC;AATD,kCASC","file":"compute-col-width.js","sourcesContent":["import type { SimpleHeaderLayoutMap } from '../../layout';\nimport type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport type { TextColumnDefine } from '../../ts-types';\nimport { HierarchyState, IconPosition } from '../../ts-types';\nimport * as calc from '../../tools/calc';\nimport { validToString } from '../../tools/util';\nimport { getQuadProps } from '../utils/padding';\nimport { getProp } from '../utils/get-prop';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { PivotLayoutMap } from '../../layout/pivot-layout';\nimport { getAxisConfigInPivotChart } from '../../layout/chart-helper/get-axis-config';\nimport { computeAxisComponentWidth } from '../../components/axis/get-axis-component-size';\n\nexport function computeColsWidth(table: BaseTableAPI, colStart?: number, colEnd?: number, update?: boolean): void {\n const time = typeof window !== 'undefined' ? window.performance.now() : 0;\n colStart = colStart ?? 0;\n colEnd = colEnd ?? table.colCount - 1;\n // table._clearColRangeWidthsMap();\n // clear colRangeWidthsMap\n if (colStart === 0 && colEnd === table.colCount - 1) {\n table._clearColRangeWidthsMap();\n // } else {\n // for (let col = colStart; col <= colEnd; col++) {\n // table._clearColRangeWidthsMap(col);\n // }\n }\n\n const oldColWidths = [];\n if (update) {\n for (let col = 0; col < table.colCount; col++) {\n oldColWidths.push(table.getColWidth(col));\n }\n }\n for (let col = colStart; col <= colEnd; col++) {\n let maxWidth;\n if (\n !table.internalProps.transpose &&\n table.internalProps.layoutMap.columnWidths?.[col]?.columnWidthComputeMode === 'only-header' &&\n 'showHeader' in table.internalProps.layoutMap\n ) {\n const temp = table.internalProps.layoutMap.showHeader;\n table.internalProps.layoutMap.showHeader = true;\n maxWidth = computeColWidth(col, 0, table.internalProps.layoutMap.headerLevelCount, table, false);\n table.internalProps.layoutMap.showHeader = temp;\n } else if (\n !table.internalProps.transpose &&\n table.internalProps.layoutMap.columnWidths?.[col]?.columnWidthComputeMode === 'only-body'\n ) {\n maxWidth = computeColWidth(\n col,\n table.internalProps.layoutMap.getBodyRange().start.row,\n table.internalProps.layoutMap.getBodyRange().end.row,\n table,\n false\n );\n } else {\n maxWidth = computeColWidth(col, 0, table.rowCount - 1, table, false);\n }\n\n table._setColContentWidth(col, maxWidth);\n\n const oldWidth = table.getColWidth(col);\n if (oldWidth !== maxWidth) {\n table._clearColRangeWidthsMap(col);\n }\n table.setColWidth(col, maxWidth, false, true);\n }\n // 处理adaptive宽度\n if (table.widthMode === 'adaptive') {\n table._clearColRangeWidthsMap();\n // const canvasWidth = table.internalProps.canvas.width;\n const totalDrawWidth = table.tableNoFrameWidth - table.getFrozenColsWidth() - table.getRightFrozenColsWidth();\n let actualWidth = 0;\n for (let col = table.frozenColCount; col < table.colCount - table.rightFrozenColCount; col++) {\n actualWidth += table.getColWidth(col);\n }\n const factor = totalDrawWidth / actualWidth;\n for (let col = table.frozenColCount; col < table.colCount - table.rightFrozenColCount; col++) {\n let colWidth;\n if (col === table.colCount - table.rightFrozenColCount - 1) {\n colWidth =\n totalDrawWidth - table.getColsWidth(table.frozenColCount, table.colCount - table.rightFrozenColCount - 2);\n } else {\n colWidth = Math.round(table.getColWidth(col) * factor);\n }\n table.setColWidth(col, colWidth, false, true);\n }\n } else if (table.autoFillWidth) {\n // 处理风神列宽特殊逻辑\n table._clearColRangeWidthsMap();\n const canvasWidth = table.tableNoFrameWidth;\n let actualWidth = 0;\n let actualHeaderWidth = 0;\n for (let col = 0; col < table.colCount; col++) {\n const colWidth = table.getColWidth(col);\n if (col < table.frozenColCount || col >= table.colCount - table.rightFrozenColCount) {\n actualHeaderWidth += colWidth;\n }\n\n actualWidth += colWidth;\n }\n\n // 如果内容宽度小于canvas宽度,执行adaptive放大\n if (actualWidth < canvasWidth && actualWidth - actualHeaderWidth > 0) {\n const factor = (canvasWidth - actualHeaderWidth) / (actualWidth - actualHeaderWidth);\n for (let col = table.frozenColCount; col < table.colCount - table.rightFrozenColCount; col++) {\n table.setColWidth(col, table.getColWidth(col) * factor, false, true);\n }\n }\n }\n // console.log('computeColsWidth time:', (typeof window !== 'undefined' ? window.performance.now() : 0) - time);\n\n if (update) {\n for (let col = 0; col < table.colCount; col++) {\n const newColWidth = table.getColWidth(col);\n if (newColWidth !== oldColWidths[col]) {\n // update the column width in scenegraph\n table.scenegraph.updateColWidth(col, newColWidth - oldColWidths[col]);\n }\n }\n }\n // console.log('computeColsWidth time:', (typeof window !== 'undefined' ? window.performance.now() : 0) - time, colStart, colEnd);\n}\n\n/**\n * @description: 计算列宽\n * @param {number} col\n * @param {number} startRow\n * @param {number} endRow\n * @param {BaseTableAPI} table\n * @param {boolean} forceCompute\n * @return {*}\n */\nexport function computeColWidth(\n col: number,\n startRow: number,\n endRow: number,\n table: BaseTableAPI,\n forceCompute: boolean\n): number {\n const { layoutMap, transpose } = table.internalProps;\n // const ctx = _getInitContext.call(table);\n let { width } = layoutMap?.getColumnWidthDefined(col) ?? {};\n\n if (transpose) {\n // 转置模式\n if (table.widthMode === 'standard') {\n // return table.getColWidth(col);\n // standard模式使用默认值\n if (table.isRowHeader(col, 0) || table.isCornerHeader(col, 0)) {\n const defaultWidth = Array.isArray(table.defaultHeaderColWidth)\n ? table.defaultHeaderColWidth[col] ?? table.defaultColWidth\n : table.defaultHeaderColWidth;\n if (defaultWidth === 'auto') {\n width = 'auto';\n } else {\n return defaultWidth;\n }\n }\n\n if (width !== 'auto') {\n // if (width && (typeof width === 'string' || width > 0)) return width;\n if (typeof width === 'string') {\n return calc.toPx(width, table.internalProps.calcWidthContext);\n } else if (width) {\n return width;\n }\n return table.defaultColWidth;\n }\n } else if (\n table.widthMode === 'adaptive' &&\n col === 0 &&\n width !== 'auto' &&\n (layoutMap as SimpleHeaderLayoutMap)?.showHeader\n ) {\n // ToBeFixed hack逻辑,转置第一列列宽为header[0]\n if (typeof width === 'string') {\n return calc.toPx(width, table.internalProps.calcWidthContext);\n } else if (width) {\n return width;\n }\n }\n // autoWidth adaptive 需要计算内容宽度\n // do nothing\n } else if (width !== 'auto' && table.widthMode !== 'autoWidth' && !forceCompute) {\n // if (width && (typeof width === 'string' || width > 0)) return width;\n if (typeof width === 'string') {\n return calc.toPx(width, table.internalProps.calcWidthContext);\n } else if (width) {\n return width;\n }\n //是透视表的行表头部分 则宽度按defaultHeaderColWidth设置\n const defaultWidth = table.getColWidthDefine(col);\n if (defaultWidth !== 'auto') {\n return table.getColWidth(col);\n }\n }\n\n return computeAutoColWidth(width, col, startRow, endRow, forceCompute, table);\n}\n\n/**\n * @description: 计算width: auto情况下的列宽\n * @param {number} col\n * @param {number} startRow\n * @param {number} endRow\n * @param {boolean} forceCompute\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeAutoColWidth(\n widthDeifne: string | number,\n col: number,\n startRow: number,\n endRow: number,\n forceCompute: boolean,\n table: BaseTableAPI\n): number {\n // 处理 auto width\n let maxWidth = 0;\n let deltaRow = 1;\n if (endRow - startRow > 5000) {\n // 超过5000行启动列宽自动计算采样\n deltaRow = Math.ceil((endRow - startRow) / 5000);\n }\n // 如果是透视图\n if (table.isPivotChart() && col >= table.rowHeaderLevelCount) {\n if (!(table.internalProps.layoutMap as PivotLayoutMap).indicatorsAsCol) {\n //并且指标是以行展示 计算列宽需要根据x轴的值域范围\n const optimunWidth = (table.internalProps.layoutMap as PivotLayoutMap).getOptimunWidthForChart(col);\n if (optimunWidth > 0) {\n return optimunWidth;\n }\n } else {\n //直接拿表头的默认列宽\n return table.defaultColWidth;\n }\n }\n\n for (let row = startRow; row <= endRow; row += deltaRow) {\n // 判断透视图轴组件\n if (table.isPivotChart()) {\n const layout = table.internalProps.layoutMap as PivotLayoutMap;\n const axisConfig = getAxisConfigInPivotChart(col, row, layout);\n if (axisConfig) {\n const axisWidth = computeAxisComponentWidth(axisConfig, table);\n if (typeof axisWidth === 'number') {\n maxWidth = Math.max(axisWidth, maxWidth);\n continue;\n }\n } else if (\n layout.isLeftBottomCorner(col, row) ||\n layout.isRightTopCorner(col, row) ||\n layout.isRightBottomCorner(col, row)\n ) {\n // 透视图三角为无效单元格,不参与宽度计算\n continue;\n }\n }\n\n // 判断CustomRender\n const customWidth = computeCustomRenderWidth(col, row, table);\n if (typeof customWidth === 'number') {\n maxWidth = Math.max(customWidth, maxWidth);\n continue;\n }\n\n // 判断透视表如果在指标\n // const indicatorWidth = computeIndicatorWidth(col, row, forceCompute, table);\n // const indicatorWidth = table.internalProps.layoutMap.getColumnWidthDefined(col);\n const indicatorWidth = widthDeifne;\n if (typeof indicatorWidth === 'number' && table.widthMode === 'standard') {\n maxWidth = Math.max(indicatorWidth, maxWidth);\n continue;\n }\n\n const cellType = table.isHeader(col, row)\n ? table._getHeaderLayoutMap(col, row)?.headerType\n : table.getBodyColumnType(col, row);\n if (cellType !== 'text' && cellType !== 'link' && cellType !== 'progressbar') {\n // text&link&progressbar测量文字宽度\n // image&video&sparkline使用默认宽度\n maxWidth = Math.max(maxWidth, table.getColWidth(col) || 0);\n continue;\n }\n\n // 处理树形展开\n let cellHierarchyIndent = 0;\n const layoutMap = table.internalProps.layoutMap;\n //判断是否为表头\n if (layoutMap.isHeader(col, row)) {\n const hd = layoutMap.getHeader(col, row);\n // 如果某级表头设置了only-body,在计算表头内容宽度时跳过改级表头\n if (hd?.define?.columnWidthComputeMode === 'only-body') {\n continue;\n }\n if (hd?.hierarchyLevel) {\n cellHierarchyIndent = (hd.hierarchyLevel ?? 0) * ((layoutMap as PivotHeaderLayoutMap).rowHierarchyIndent ?? 0);\n }\n } else {\n // 基本表格表身body单元格 如果是树形展开 需要考虑缩进值\n // const cellHierarchyState = table.getHierarchyState(col, row);\n // if (cellHierarchyState === HierarchyState.expand || cellHierarchyState === HierarchyState.collapse) {\n const define = table.getBodyColumnDefine(col, row);\n if (define?.tree) {\n const indexArr = table.dataSource.getIndexKey(table.getRecordIndexByRow(col, row));\n cellHierarchyIndent =\n Array.isArray(indexArr) && table.getHierarchyState(col, row) !== HierarchyState.none\n ? (indexArr.length - 1) * ((layoutMap as SimpleHeaderLayoutMap).hierarchyIndent ?? 0)\n : 0;\n }\n }\n\n // 测量文字宽度\n const textWidth = computeTextWidth(col, row, table);\n maxWidth = Math.max(textWidth + cellHierarchyIndent, maxWidth);\n }\n\n // 处理宽度限制\n const colMinWidth = table.getMinColWidth(col);\n const colMaxWidth = table.getMaxColWidth(col);\n if (maxWidth < colMinWidth) {\n return colMinWidth;\n } else if (maxWidth > colMaxWidth) {\n return colMaxWidth;\n }\n return maxWidth;\n}\n\n/**\n * @description: 计算customRender相关列宽\n * @param {number} col\n * @param {number} row\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeCustomRenderWidth(col: number, row: number, table: BaseTableAPI): number | undefined {\n const customRender = table.getCustomRender(col, row);\n const customLayout = table.getCustomLayout(col, row);\n if (customRender || customLayout) {\n let spanCol = 1;\n let width = 0;\n if (table.isHeader(col, row) || (table.getBodyColumnDefine(col, row) as TextColumnDefine).mergeCell) {\n const cellRange = table.getCellRange(col, row);\n spanCol = cellRange.end.col - cellRange.start.col + 1;\n }\n const arg = {\n col,\n row,\n dataValue: table.getCellOriginValue(col, row),\n value: table.getCellValue(col, row) || '',\n rect: getCellRect(col, row, table),\n table\n };\n if (customLayout) {\n // 处理customLayout\n const customLayoutObj = customLayout(arg);\n customLayoutObj.rootContainer.isRoot = true;\n const size = customLayoutObj.rootContainer.getContentSize();\n width = size.width ?? 0;\n } else if (typeof customRender === 'function') {\n // 处理customRender\n const customRenderObj = customRender(arg);\n width = customRenderObj?.expectedWidth ?? 0;\n } else {\n width = customRender?.expectedWidth ?? 0;\n }\n return width / spanCol;\n }\n return undefined;\n}\n\n/**\n * @description: 计算指标相关列宽\n * @param {number} col\n * @param {number} row\n * @param {boolean} forceCompute\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeIndicatorWidth(\n col: number,\n row: number,\n forceCompute: boolean,\n table: BaseTableAPI\n): number | undefined {\n const { layoutMap } = table.internalProps;\n if (table.isPivotTable() && (layoutMap as PivotHeaderLayoutMap).isColumnIndicatorHeader(col, row)) {\n // 透视表如果在指标中配置了宽度,使用该宽度作为指标单元格及下面内容单元格的列宽\n const body = layoutMap.getBody(col, row);\n if (body && body.width && body.width !== 'auto' && !forceCompute) {\n const width = Math.round(calc.toPx(body.width, table.internalProps.calcWidthContext));\n return width;\n }\n }\n return undefined;\n}\n\n/**\n * @description: 计算文字宽度\n * @param {number} col\n * @param {number} row\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeTextWidth(col: number, row: number, table: BaseTableAPI): number {\n let maxWidth = 0;\n const cellValue = table.getCellValue(col, row);\n // const dataValue = table.getCellOriginValue(col, row);\n const actStyle = table._getCellStyle(col, row);\n let iconWidth = 0;\n const define = table.getBodyColumnDefine(col, row);\n const mayHaveIcon = table.getCellType(col, row) !== 'body' ? true : !!define?.icon || !!define?.tree;\n if (mayHaveIcon) {\n const icons = table.getCellIcons(col, row);\n icons?.forEach(icon => {\n if (icon.positionType !== IconPosition.absoluteRight) {\n iconWidth += (icon.width ?? 0) + (icon.marginLeft ?? 0) + (icon.marginRight ?? 0);\n }\n });\n }\n let spanCol = 1;\n if (table.isHeader(col, row) || (table.getBodyColumnDefine(col, row) as TextColumnDefine).mergeCell) {\n const cellRange = table.getCellRange(col, row);\n spanCol = cellRange.end.col - cellRange.start.col + 1;\n }\n\n const padding = getQuadProps(getProp('padding', actStyle, col, row, table));\n const paddingWidth = padding[1] + padding[3]; // + cellHierarchyIndent\n\n const fontSize = getProp('fontSize', actStyle, col, row, table);\n const fontFamily = getProp('fontFamily', actStyle, col, row, table);\n const fontWeight = getProp('fontWeight', actStyle, col, row, table);\n const lines = validToString(cellValue).split('\\n') || [];\n if (lines.length >= 1) {\n // eslint-disable-next-line no-loop-func\n lines.forEach((line: string) => {\n const width = table.measureText(line.slice(0, table.options.maxCharactersNumber || 200), {\n fontSize,\n fontFamily,\n fontWeight\n }).width;\n maxWidth = Math.max(\n // 最大字符上限控制测量的字符\n (width + paddingWidth + 4 + iconWidth) / spanCol, // 这里+4为列宽测量结果的buffer\n maxWidth\n );\n });\n } else {\n maxWidth = Math.max(\n // 最大字符上限控制测量的字符\n (paddingWidth + 4 + iconWidth) / spanCol,\n maxWidth\n );\n }\n // 判断是否需要限制最大宽度 之前写死的450 需要使用配置来判断\n if (table.internalProps.limitMaxAutoWidth !== false) {\n maxWidth = Math.min(\n typeof table.internalProps.limitMaxAutoWidth === 'number' ? table.internalProps.limitMaxAutoWidth : 450,\n maxWidth\n );\n }\n\n return maxWidth;\n}\n\nexport function getCellRect(col: number, row: number, table: BaseTableAPI) {\n return {\n left: 0,\n top: 0,\n right: table.getColWidth(col),\n bottom: table.getRowHeight(row),\n width: table.getColWidth(col),\n height: table.getRowHeight(row)\n };\n}\n"]}
1
+ {"version":3,"sources":["scenegraph/layout/compute-col-width.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,6CAA8D;AAC9D,uDAAyC;AACzC,2CAAiD;AACjD,8CAAgD;AAChD,gDAA4C;AAG5C,+EAAsF;AACtF,2FAA0F;AAE1F,SAAgB,gBAAgB,CAAC,KAAmB,EAAE,QAAiB,EAAE,MAAe,EAAE,MAAgB;;IACxG,MAAM,IAAI,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,QAAQ,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,CAAC,CAAC;IACzB,MAAM,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC;IAGtC,IAAI,QAAQ,KAAK,CAAC,IAAI,MAAM,KAAK,KAAK,CAAC,QAAQ,GAAG,CAAC,EAAE;QACnD,KAAK,CAAC,uBAAuB,EAAE,CAAC;KAKjC;IAED,MAAM,YAAY,GAAG,EAAE,CAAC;IACxB,IAAI,MAAM,EAAE;QACV,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE;YAC7C,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;SA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,OAAO,KAAK,CAAC,aAAa,CAAC,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,EACvG,QAAQ,CACT,CAAC;KACH;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAgB,WAAW,CAAC,GAAW,EAAE,GAAW,EAAE,KAAmB;IACvE,OAAO;QACL,IAAI,EAAE,CAAC;QACP,GAAG,EAAE,CAAC;QACN,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC;QAC7B,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC;QAC/B,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC;QAC7B,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC;KAChC,CAAC;AACJ,CAAC;AATD,kCASC;AAED,SAAS,mCAAmC,CAAC,GAAW,EAAE,KAAmB;IAC3E,MAAM,YAAY,GAAG,KAAK,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACnD,IAAI,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;QACpD,OAAO,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;KAC/B;IACD,OAAO,YAAY,CAAC;AACtB,CAAC","file":"compute-col-width.js","sourcesContent":["import type { SimpleHeaderLayoutMap } from '../../layout';\nimport type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport type { TextColumnDefine } from '../../ts-types';\nimport { HierarchyState, IconPosition } from '../../ts-types';\nimport * as calc from '../../tools/calc';\nimport { validToString } from '../../tools/util';\nimport { getQuadProps } from '../utils/padding';\nimport { getProp } from '../utils/get-prop';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { PivotLayoutMap } from '../../layout/pivot-layout';\nimport { getAxisConfigInPivotChart } from '../../layout/chart-helper/get-axis-config';\nimport { computeAxisComponentWidth } from '../../components/axis/get-axis-component-size';\n\nexport function computeColsWidth(table: BaseTableAPI, colStart?: number, colEnd?: number, update?: boolean): void {\n const time = typeof window !== 'undefined' ? window.performance.now() : 0;\n colStart = colStart ?? 0;\n colEnd = colEnd ?? table.colCount - 1;\n // table._clearColRangeWidthsMap();\n // clear colRangeWidthsMap\n if (colStart === 0 && colEnd === table.colCount - 1) {\n table._clearColRangeWidthsMap();\n // } else {\n // for (let col = colStart; col <= colEnd; col++) {\n // table._clearColRangeWidthsMap(col);\n // }\n }\n\n const oldColWidths = [];\n if (update) {\n for (let col = 0; col < table.colCount; col++) {\n oldColWidths.push(table.getColWidth(col));\n }\n }\n for (let col = colStart; col <= colEnd; col++) {\n let maxWidth;\n if (\n !table.internalProps.transpose &&\n table.internalProps.layoutMap.columnWidths?.[col]?.columnWidthComputeMode === 'only-header' &&\n 'showHeader' in table.internalProps.layoutMap\n ) {\n const temp = table.internalProps.layoutMap.showHeader;\n table.internalProps.layoutMap.showHeader = true;\n maxWidth = computeColWidth(col, 0, table.internalProps.layoutMap.headerLevelCount, table, false);\n table.internalProps.layoutMap.showHeader = temp;\n } else if (\n !table.internalProps.transpose &&\n table.internalProps.layoutMap.columnWidths?.[col]?.columnWidthComputeMode === 'only-body'\n ) {\n maxWidth = computeColWidth(\n col,\n table.internalProps.layoutMap.getBodyRange().start.row,\n table.internalProps.layoutMap.getBodyRange().end.row,\n table,\n false\n );\n } else {\n maxWidth = computeColWidth(col, 0, table.rowCount - 1, table, false);\n }\n\n table._setColContentWidth(col, maxWidth);\n\n const oldWidth = table.getColWidth(col);\n if (oldWidth !== maxWidth) {\n table._clearColRangeWidthsMap(col);\n }\n table.setColWidth(col, maxWidth, false, true);\n }\n // 处理adaptive宽度\n if (table.widthMode === 'adaptive') {\n table._clearColRangeWidthsMap();\n // const canvasWidth = table.internalProps.canvas.width;\n const totalDrawWidth = table.tableNoFrameWidth - table.getFrozenColsWidth() - table.getRightFrozenColsWidth();\n let actualWidth = 0;\n for (let col = table.frozenColCount; col < table.colCount - table.rightFrozenColCount; col++) {\n actualWidth += table.getColWidth(col);\n }\n const factor = totalDrawWidth / actualWidth;\n for (let col = table.frozenColCount; col < table.colCount - table.rightFrozenColCount; col++) {\n let colWidth;\n if (col === table.colCount - table.rightFrozenColCount - 1) {\n colWidth =\n totalDrawWidth - table.getColsWidth(table.frozenColCount, table.colCount - table.rightFrozenColCount - 2);\n } else {\n colWidth = Math.round(table.getColWidth(col) * factor);\n }\n table.setColWidth(col, colWidth, false, true);\n }\n } else if (table.autoFillWidth) {\n // 处理风神列宽特殊逻辑\n table._clearColRangeWidthsMap();\n const canvasWidth = table.tableNoFrameWidth;\n let actualWidth = 0;\n let actualHeaderWidth = 0;\n for (let col = 0; col < table.colCount; col++) {\n const colWidth = table.getColWidth(col);\n if (col < table.frozenColCount || col >= table.colCount - table.rightFrozenColCount) {\n actualHeaderWidth += colWidth;\n }\n\n actualWidth += colWidth;\n }\n\n // 如果内容宽度小于canvas宽度,执行adaptive放大\n if (actualWidth < canvasWidth && actualWidth - actualHeaderWidth > 0) {\n const factor = (canvasWidth - actualHeaderWidth) / (actualWidth - actualHeaderWidth);\n for (let col = table.frozenColCount; col < table.colCount - table.rightFrozenColCount; col++) {\n table.setColWidth(col, table.getColWidth(col) * factor, false, true);\n }\n }\n }\n // console.log('computeColsWidth time:', (typeof window !== 'undefined' ? window.performance.now() : 0) - time);\n\n if (update) {\n for (let col = 0; col < table.colCount; col++) {\n const newColWidth = table.getColWidth(col);\n if (newColWidth !== oldColWidths[col]) {\n // update the column width in scenegraph\n table.scenegraph.updateColWidth(col, newColWidth - oldColWidths[col]);\n }\n }\n }\n // console.log('computeColsWidth time:', (typeof window !== 'undefined' ? window.performance.now() : 0) - time, colStart, colEnd);\n}\n\n/**\n * @description: 计算列宽\n * @param {number} col\n * @param {number} startRow\n * @param {number} endRow\n * @param {BaseTableAPI} table\n * @param {boolean} forceCompute\n * @return {*}\n */\nexport function computeColWidth(\n col: number,\n startRow: number,\n endRow: number,\n table: BaseTableAPI,\n forceCompute: boolean\n): number {\n // const { layoutMap, transpose } = table.internalProps;\n // let { width } = layoutMap?.getColumnWidthDefined(col) ?? {};\n\n // if (transpose) {\n // // 转置模式\n // if (table.widthMode === 'standard') {\n // // return table.getColWidth(col);\n // // standard模式使用默认值\n // if (table.isRowHeader(col, 0) || table.isCornerHeader(col, 0)) {\n // const defaultWidth = Array.isArray(table.defaultHeaderColWidth)\n // ? table.defaultHeaderColWidth[col] ?? table.defaultColWidth\n // : table.defaultHeaderColWidth;\n // if (defaultWidth === 'auto') {\n // widthfffff = 'auto';\n // } else {\n // return defaultWidth;\n // }\n // }\n\n // if (widthfffff !== 'auto') {\n // // if (width && (typeof width === 'string' || width > 0)) return width;\n // if (typeof widthfffff === 'string') {\n // return calc.toPx(widthfffff, table.internalProps.calcWidthContext);\n // } else if (widthfffff) {\n // return widthfffff;\n // }\n // return table.defaultColWidth;\n // }\n // } else if (\n // table.widthMode === 'adaptive' &&\n // col === 0 &&\n // widthfffff !== 'auto' &&\n // (layoutMap as SimpleHeaderLayoutMap)?.showHeader\n // ) {\n // // ToBeFixed hack逻辑,转置第一列列宽为header[0]\n // if (typeof widthfffff === 'string') {\n // return calc.toPx(widthfffff, table.internalProps.calcWidthContext);\n // } else if (widthfffff) {\n // return widthfffff;\n // }\n // }\n // // autoWidth adaptive 需要计算内容宽度\n // // do nothing\n // } else if (widthfffff !== 'auto' && table.widthMode !== 'autoWidth' && !forceCompute) {\n // // if (width && (typeof width === 'string' || width > 0)) return width;\n // if (typeof widthfffff === 'string') {\n // return calc.toPx(widthfffff, table.internalProps.calcWidthContext);\n // } else if (widthfffff) {\n // return widthfffff;\n // }\n // //是透视表的行表头部分 则宽度按defaultHeaderColWidth设置\n // const defaultWidth = table.getColWidthDefine(col);\n // if (defaultWidth !== 'auto') {\n // return table.getColWidth(col);\n // }\n // }\n const width = getColWidthDefinedWidthResizedWidth(col, table);\n if (typeof width === 'number') {\n return width;\n } else if (width !== 'auto' && typeof width === 'string') {\n return calc.toPx(width, table.internalProps.calcWidthContext);\n }\n return computeAutoColWidth(width, col, startRow, endRow, forceCompute, table);\n}\n\n/**\n * @description: 计算width: auto情况下的列宽\n * @param {number} col\n * @param {number} startRow\n * @param {number} endRow\n * @param {boolean} forceCompute\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeAutoColWidth(\n widthDeifne: string | number,\n col: number,\n startRow: number,\n endRow: number,\n forceCompute: boolean,\n table: BaseTableAPI\n): number {\n // 处理 auto width\n let maxWidth = 0;\n let deltaRow = 1;\n if (endRow - startRow > 5000) {\n // 超过5000行启动列宽自动计算采样\n deltaRow = Math.ceil((endRow - startRow) / 5000);\n }\n // 如果是透视图\n if (table.isPivotChart() && col >= table.rowHeaderLevelCount) {\n if (!(table.internalProps.layoutMap as PivotLayoutMap).indicatorsAsCol) {\n //并且指标是以行展示 计算列宽需要根据x轴的值域范围\n const optimunWidth = (table.internalProps.layoutMap as PivotLayoutMap).getOptimunWidthForChart(col);\n if (optimunWidth > 0) {\n return optimunWidth;\n }\n } else {\n //直接拿表头的默认列宽\n return table.defaultColWidth;\n }\n }\n\n for (let row = startRow; row <= endRow; row += deltaRow) {\n // 判断透视图轴组件\n if (table.isPivotChart()) {\n const layout = table.internalProps.layoutMap as PivotLayoutMap;\n const axisConfig = getAxisConfigInPivotChart(col, row, layout);\n if (axisConfig) {\n const axisWidth = computeAxisComponentWidth(axisConfig, table);\n if (typeof axisWidth === 'number') {\n maxWidth = Math.max(axisWidth, maxWidth);\n continue;\n }\n } else if (\n layout.isLeftBottomCorner(col, row) ||\n layout.isRightTopCorner(col, row) ||\n layout.isRightBottomCorner(col, row)\n ) {\n // 透视图三角为无效单元格,不参与宽度计算\n continue;\n }\n }\n\n // 判断CustomRender\n const customWidth = computeCustomRenderWidth(col, row, table);\n if (typeof customWidth === 'number') {\n maxWidth = Math.max(customWidth, maxWidth);\n continue;\n }\n\n // 判断透视表如果在指标\n // const indicatorWidth = computeIndicatorWidth(col, row, forceCompute, table);\n // const indicatorWidth = table.internalProps.layoutMap.getColumnWidthDefined(col);\n const indicatorWidth = widthDeifne;\n if (typeof indicatorWidth === 'number' && table.widthMode === 'standard') {\n maxWidth = Math.max(indicatorWidth, maxWidth);\n continue;\n }\n\n const cellType = table.isHeader(col, row)\n ? table._getHeaderLayoutMap(col, row)?.headerType\n : table.getBodyColumnType(col, row);\n if (cellType !== 'text' && cellType !== 'link' && cellType !== 'progressbar') {\n // text&link&progressbar测量文字宽度\n // image&video&sparkline使用默认宽度\n maxWidth = Math.max(maxWidth, table.getColWidth(col) || 0);\n continue;\n }\n\n // 处理树形展开\n let cellHierarchyIndent = 0;\n const layoutMap = table.internalProps.layoutMap;\n //判断是否为表头\n if (layoutMap.isHeader(col, row)) {\n const hd = layoutMap.getHeader(col, row);\n // 如果某级表头设置了only-body,在计算表头内容宽度时跳过改级表头\n if (hd?.define?.columnWidthComputeMode === 'only-body') {\n continue;\n }\n if (hd?.hierarchyLevel) {\n cellHierarchyIndent = (hd.hierarchyLevel ?? 0) * ((layoutMap as PivotHeaderLayoutMap).rowHierarchyIndent ?? 0);\n }\n } else {\n // 基本表格表身body单元格 如果是树形展开 需要考虑缩进值\n // const cellHierarchyState = table.getHierarchyState(col, row);\n // if (cellHierarchyState === HierarchyState.expand || cellHierarchyState === HierarchyState.collapse) {\n const define = table.getBodyColumnDefine(col, row);\n if (define?.tree) {\n const indexArr = table.dataSource.getIndexKey(table.getRecordIndexByRow(col, row));\n cellHierarchyIndent =\n Array.isArray(indexArr) && table.getHierarchyState(col, row) !== HierarchyState.none\n ? (indexArr.length - 1) * ((layoutMap as SimpleHeaderLayoutMap).hierarchyIndent ?? 0)\n : 0;\n }\n }\n\n // 测量文字宽度\n const textWidth = computeTextWidth(col, row, table);\n maxWidth = Math.max(textWidth + cellHierarchyIndent, maxWidth);\n }\n\n // 处理宽度限制\n const colMinWidth = table.getMinColWidth(col);\n const colMaxWidth = table.getMaxColWidth(col);\n if (maxWidth < colMinWidth) {\n return colMinWidth;\n } else if (maxWidth > colMaxWidth) {\n return colMaxWidth;\n }\n return maxWidth;\n}\n\n/**\n * @description: 计算customRender相关列宽\n * @param {number} col\n * @param {number} row\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeCustomRenderWidth(col: number, row: number, table: BaseTableAPI): number | undefined {\n const customRender = table.getCustomRender(col, row);\n const customLayout = table.getCustomLayout(col, row);\n if (customRender || customLayout) {\n let spanCol = 1;\n let width = 0;\n if (table.isHeader(col, row) || (table.getBodyColumnDefine(col, row) as TextColumnDefine).mergeCell) {\n const cellRange = table.getCellRange(col, row);\n spanCol = cellRange.end.col - cellRange.start.col + 1;\n }\n const arg = {\n col,\n row,\n dataValue: table.getCellOriginValue(col, row),\n value: table.getCellValue(col, row) || '',\n rect: getCellRect(col, row, table),\n table\n };\n if (customLayout) {\n // 处理customLayout\n const customLayoutObj = customLayout(arg);\n customLayoutObj.rootContainer.isRoot = true;\n const size = customLayoutObj.rootContainer.getContentSize();\n width = size.width ?? 0;\n } else if (typeof customRender === 'function') {\n // 处理customRender\n const customRenderObj = customRender(arg);\n width = customRenderObj?.expectedWidth ?? 0;\n } else {\n width = customRender?.expectedWidth ?? 0;\n }\n return width / spanCol;\n }\n return undefined;\n}\n\n/**\n * @description: 计算指标相关列宽\n * @param {number} col\n * @param {number} row\n * @param {boolean} forceCompute\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeIndicatorWidth(\n col: number,\n row: number,\n forceCompute: boolean,\n table: BaseTableAPI\n): number | undefined {\n const { layoutMap } = table.internalProps;\n if (table.isPivotTable() && (layoutMap as PivotHeaderLayoutMap).isColumnIndicatorHeader(col, row)) {\n // 透视表如果在指标中配置了宽度,使用该宽度作为指标单元格及下面内容单元格的列宽\n const body = layoutMap.getBody(col, row);\n if (body && body.width && body.width !== 'auto' && !forceCompute) {\n const width = Math.round(calc.toPx(body.width, table.internalProps.calcWidthContext));\n return width;\n }\n }\n return undefined;\n}\n\n/**\n * @description: 计算文字宽度\n * @param {number} col\n * @param {number} row\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeTextWidth(col: number, row: number, table: BaseTableAPI): number {\n let maxWidth = 0;\n const cellValue = table.getCellValue(col, row);\n // const dataValue = table.getCellOriginValue(col, row);\n const actStyle = table._getCellStyle(col, row);\n let iconWidth = 0;\n const define = table.getBodyColumnDefine(col, row);\n const mayHaveIcon = table.getCellType(col, row) !== 'body' ? true : !!define?.icon || !!define?.tree;\n if (mayHaveIcon) {\n const icons = table.getCellIcons(col, row);\n icons?.forEach(icon => {\n if (icon.positionType !== IconPosition.absoluteRight) {\n iconWidth += (icon.width ?? 0) + (icon.marginLeft ?? 0) + (icon.marginRight ?? 0);\n }\n });\n }\n let spanCol = 1;\n if (table.isHeader(col, row) || (table.getBodyColumnDefine(col, row) as TextColumnDefine).mergeCell) {\n const cellRange = table.getCellRange(col, row);\n spanCol = cellRange.end.col - cellRange.start.col + 1;\n }\n\n const padding = getQuadProps(getProp('padding', actStyle, col, row, table));\n const paddingWidth = padding[1] + padding[3]; // + cellHierarchyIndent\n\n const fontSize = getProp('fontSize', actStyle, col, row, table);\n const fontFamily = getProp('fontFamily', actStyle, col, row, table);\n const fontWeight = getProp('fontWeight', actStyle, col, row, table);\n const lines = validToString(cellValue).split('\\n') || [];\n if (lines.length >= 1) {\n // eslint-disable-next-line no-loop-func\n lines.forEach((line: string) => {\n const width = table.measureText(line.slice(0, table.options.maxCharactersNumber || 200), {\n fontSize,\n fontFamily,\n fontWeight\n }).width;\n maxWidth = Math.max(\n // 最大字符上限控制测量的字符\n (width + paddingWidth + 4 + iconWidth) / spanCol, // 这里+4为列宽测量结果的buffer\n maxWidth\n );\n });\n } else {\n maxWidth = Math.max(\n // 最大字符上限控制测量的字符\n (paddingWidth + 4 + iconWidth) / spanCol,\n maxWidth\n );\n }\n // 判断是否需要限制最大宽度 之前写死的450 需要使用配置来判断\n if (table.internalProps.limitMaxAutoWidth !== false) {\n maxWidth = Math.min(\n typeof table.internalProps.limitMaxAutoWidth === 'number' ? table.internalProps.limitMaxAutoWidth : 450,\n maxWidth\n );\n }\n\n return maxWidth;\n}\n\nexport function getCellRect(col: number, row: number, table: BaseTableAPI) {\n return {\n left: 0,\n top: 0,\n right: table.getColWidth(col),\n bottom: table.getRowHeight(row),\n width: table.getColWidth(col),\n height: table.getRowHeight(row)\n };\n}\n\nfunction getColWidthDefinedWidthResizedWidth(col: number, table: BaseTableAPI) {\n const widthDefined = table.getColWidthDefined(col);\n if (table.internalProps._widthResizedColMap.has(col)) {\n return table.getColWidth(col);\n }\n return widthDefined;\n}\n"]}
@@ -14,7 +14,9 @@ function updateColWidth(scene, col, detaX) {
14
14
  const leftBottomColumn = scene.getColGroupInLeftBottomCorner(col);
15
15
  leftBottomColumn && updateColunmWidth(leftBottomColumn, detaX, autoRowHeight, "left-bottom", scene);
16
16
  const bottomColumn = scene.getColGroupInBottom(col);
17
- bottomColumn && updateColunmWidth(bottomColumn, detaX, autoRowHeight, "bottom", scene),
17
+ bottomColumn && updateColunmWidth(bottomColumn, detaX, autoRowHeight, "bottom", scene);
18
+ const rightBottomColumn = scene.getColGroupInRightBottomCorner(col);
19
+ rightBottomColumn && updateColunmWidth(bottomColumn, detaX, autoRowHeight, "right-bottom", scene),
18
20
  col < scene.frozenColCount ? (scene.cornerHeaderGroup.forEachChildrenSkipChild(((column, index) => {
19
21
  column.col > col && column.setAttribute("x", column.attribute.x + detaX);
20
22
  })), scene.rowHeaderGroup.forEachChildrenSkipChild(((column, index) => {
@@ -27,11 +29,13 @@ function updateColWidth(scene, col, detaX) {
27
29
  column.col > col && column.setAttribute("x", column.attribute.x + detaX);
28
30
  })), bottomColumn && scene.bottomFrozenGroup.forEachChildrenSkipChild(((column, index) => {
29
31
  column.col > col && column.setAttribute("x", column.attribute.x + detaX);
32
+ })), rightBottomColumn && scene.rightBottomCornerGroup.forEachChildrenSkipChild(((column, index) => {
33
+ column.col > col && column.setAttribute("x", column.attribute.x + detaX);
30
34
  })), scene.table.setColWidth(col, rowHeaderOrBodyColumn.attribute.width, !0);
31
35
  }
32
36
 
33
37
  function updateColunmWidth(columnGroup, detaX, autoRowHeight, mode, scene) {
34
- var _a, _b, _c, _d, _e;
38
+ var _a, _b, _c, _d, _e, _f;
35
39
  let needRerangeRow = !1;
36
40
  const oldColumnWidth = null !== (_a = null == columnGroup ? void 0 : columnGroup.attribute.width) && void 0 !== _a ? _a : 0;
37
41
  if (null == columnGroup || columnGroup.setAttribute("width", oldColumnWidth + detaX),
@@ -46,8 +50,9 @@ function updateColunmWidth(columnGroup, detaX, autoRowHeight, mode, scene) {
46
50
  for (let col = 0; col < scene.table.colCount; col++) {
47
51
  "col-corner" === mode ? (row = 0, colGroup = scene.getColGroup(col, !0), oldContainerHeight = null !== (_b = scene.colHeaderGroup.attribute.height) && void 0 !== _b ? _b : 0) : "row-body" === mode ? (row = scene.table.frozenRowCount,
48
52
  colGroup = scene.getColGroup(col, !1), oldContainerHeight = null !== (_c = scene.bodyGroup.attribute.height) && void 0 !== _c ? _c : 0) : "bottom" === mode ? (row = scene.table.rowCount - scene.table.bottomFrozenRowCount,
49
- colGroup = scene.getColGroupInBottom(col), oldContainerHeight = null !== (_d = scene.bottomFrozenGroup.attribute.height) && void 0 !== _d ? _d : 0) : "left-bottom" === mode && (row = scene.table.rowCount - scene.table.bottomFrozenRowCount,
50
- colGroup = scene.getColGroupInLeftBottomCorner(col), oldContainerHeight = null !== (_e = scene.leftBottomCornerGroup.attribute.height) && void 0 !== _e ? _e : 0);
53
+ colGroup = scene.getColGroupInBottom(col), oldContainerHeight = null !== (_d = scene.bottomFrozenGroup.attribute.height) && void 0 !== _d ? _d : 0) : "left-bottom" === mode ? (row = scene.table.rowCount - scene.table.bottomFrozenRowCount,
54
+ colGroup = scene.getColGroupInLeftBottomCorner(col), oldContainerHeight = null !== (_e = scene.leftBottomCornerGroup.attribute.height) && void 0 !== _e ? _e : 0) : "right-bottom" === mode && (row = scene.table.rowCount - scene.table.bottomFrozenRowCount,
55
+ colGroup = scene.getColGroupInRightBottomCorner(col), oldContainerHeight = null !== (_f = scene.rightBottomCornerGroup.attribute.height) && void 0 !== _f ? _f : 0);
51
56
  let y = 0;
52
57
  colGroup.forEachChildren((cellGroup => {
53
58
  var _a;
@@ -1 +1 @@
1
- {"version":3,"sources":["scenegraph/layout/update-width.ts"],"names":[],"mappings":";;;AACA,qDAA2D;AAC3D,wDAAuD;AAIvD,sEAA0F;AAC1F,oFAAqF;AACrF,gFAAsF;AAEtF,4DAA2D;AAC3D,gDAA4C;AAC5C,8CAAgD;AAChD,gEAAmE;AACnE,mDAAyD;AAUzD,SAAgB,cAAc,CAAC,KAAiB,EAAE,GAAW,EAAE,KAAa;IAC1E,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,UAAU,KAAK,YAAY,CAAC;IAE9D,MAAM,uBAAuB,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAU,CAAC;IACtE,IAAI,uBAAuB,EAAE;QAC3B,iBAAiB,CAAC,uBAAuB,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;KACvF;IAED,MAAM,qBAAqB,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,CAAU,CAAC;IAC9D,IAAI,qBAAqB,EAAE;QACzB,iBAAiB,CAAC,qBAAqB,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;KACnF;IAED,MAAM,gBAAgB,GAAG,KAAK,CAAC,6BAA6B,CAAC,GAAG,CAAC,CAAC;IAElE,IAAI,gBAAgB,EAAE;QACpB,iBAAiB,CAAC,gBAAgB,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;KACjF;IAED,MAAM,YAAY,GAAG,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACpD,IAAI,YAAY,EAAE;QAChB,iBAAiB,CAAC,YA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C,CAAC;iBAClD;aACF;SACF;QACD,IAAA,sCAAsB,EAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;KAC9F;IAGD,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAW,EAAE,KAAiB;IACxD,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,CAAC,eAAe,CAAC,CAAC,KAAW,EAAE,EAAE;QACnC,IACE,KAAK,CAAC,IAAI,KAAK,WAAW;YAC1B,KAAK,CAAC,IAAI,KAAK,YAAY;YAC3B,KAAK,CAAC,IAAI,KAAK,MAAM;YACrB,KAAK,CAAC,IAAI,KAAK,SAAS,EACxB;YACA,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;SAC5D;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,IAAA,sBAAY,EAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,OAAiB,CAAC,CAAC;IAC9F,OAAO,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC","file":"update-width.js","sourcesContent":["import type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport { CartesianAxis } from '../../components/axis/axis';\nimport { getStyleTheme } from '../../core/tableHelper';\nimport type { IProgressbarColumnBodyDefine } from '../../ts-types/list-table/define/progressbar-define';\nimport type { Group } from '../graphic/group';\nimport type { Icon } from '../graphic/icon';\nimport { updateImageCellContentWhileResize } from '../group-creater/cell-type/image-cell';\nimport { createProgressBarCell } from '../group-creater/cell-type/progress-bar-cell';\nimport { createSparkLineCellGroup } from '../group-creater/cell-type/spark-line-cell';\nimport type { Scenegraph } from '../scenegraph';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport { getProp } from '../utils/get-prop';\nimport { getQuadProps } from '../utils/padding';\nimport { updateCellContentWidth } from '../utils/text-icon-layout';\nimport { updateCellHeightForRow } from './update-height';\n// import { updateAutoRowHeight } from './auto-height';\n\n/**\n * @description: 更新指定列列宽,在拖拽调整列宽中使用\n * @param {Scenegraph} scene\n * @param {number} col\n * @param {number} detaX\n * @return {*}\n */\nexport function updateColWidth(scene: Scenegraph, col: number, detaX: number) {\n const autoRowHeight = scene.table.heightMode === 'autoHeight';\n // deal width corner header or column header\n const colOrCornerHeaderColumn = scene.getColGroup(col, true) as Group;\n if (colOrCornerHeaderColumn) {\n updateColunmWidth(colOrCornerHeaderColumn, detaX, autoRowHeight, 'col-corner', scene);\n }\n // deal width row header or body or right frozen cells\n const rowHeaderOrBodyColumn = scene.getColGroup(col) as Group;\n if (rowHeaderOrBodyColumn) {\n updateColunmWidth(rowHeaderOrBodyColumn, detaX, autoRowHeight, 'row-body', scene);\n }\n\n const leftBottomColumn = scene.getColGroupInLeftBottomCorner(col);\n // deal width left bottom frozen cells\n if (leftBottomColumn) {\n updateColunmWidth(leftBottomColumn, detaX, autoRowHeight, 'left-bottom', scene);\n }\n // deal width bottom frozen cells\n const bottomColumn = scene.getColGroupInBottom(col);\n if (bottomColumn) {\n updateColunmWidth(bottomColumn, detaX, autoRowHeight, 'bottom', scene);\n }\n\n // 更新剩余列位置\n if (col < scene.frozenColCount) {\n scene.cornerHeaderGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n scene.rowHeaderGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n } else {\n scene.colHeaderGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n scene.bodyGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n }\n\n if (leftBottomColumn) {\n scene.leftBottomCornerGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n }\n if (bottomColumn) {\n scene.bottomFrozenGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n }\n\n scene.table.setColWidth(col, rowHeaderOrBodyColumn.attribute.width, true);\n}\n\nfunction updateColunmWidth(\n columnGroup: Group,\n detaX: number,\n autoRowHeight: boolean,\n mode: 'col-corner' | 'row-body' | 'bottom' | 'left-bottom',\n scene: Scenegraph\n) {\n let needRerangeRow = false;\n // const colOrCornerHeaderColumn = scene.getColGroup(col, true) as Group;\n const oldColumnWidth = columnGroup?.attribute.width ?? 0;\n columnGroup?.setAttribute('width', oldColumnWidth + detaX);\n // 更新单元格宽度\n columnGroup?.forEachChildren((cell: Group, index: number) => {\n const isHeightChange = updateCellWidth(\n scene,\n cell,\n cell.col,\n cell.row,\n oldColumnWidth,\n detaX,\n mode === 'row-body' ? cell.col < scene.table.rowHeaderLevelCount : true,\n autoRowHeight\n );\n if (isHeightChange) {\n const mergeInfo = getCellMergeInfo(scene.table, cell.col, cell.row);\n if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {\n for (let row = mergeInfo.start.row; row <= mergeInfo.end.row; row++) {\n resetRowHeight(scene, row);\n }\n } else {\n resetRowHeight(scene, cell.row);\n }\n needRerangeRow = true;\n }\n });\n\n if (needRerangeRow) {\n let newTotalHeight = 0;\n let colGroup;\n let oldContainerHeight;\n let row;\n for (let col = 0; col < scene.table.colCount; col++) {\n // const colGroup = scene.getColGroup(col, true);\n if (mode === 'col-corner') {\n row = 0;\n colGroup = scene.getColGroup(col, true);\n oldContainerHeight = scene.colHeaderGroup.attribute.height ?? 0;\n } else if (mode === 'row-body') {\n row = scene.table.frozenRowCount;\n colGroup = scene.getColGroup(col, false);\n oldContainerHeight = scene.bodyGroup.attribute.height ?? 0;\n } else if (mode === 'bottom') {\n row = scene.table.rowCount - scene.table.bottomFrozenRowCount;\n colGroup = scene.getColGroupInBottom(col);\n oldContainerHeight = scene.bottomFrozenGroup.attribute.height ?? 0;\n } else if (mode === 'left-bottom') {\n row = scene.table.rowCount - scene.table.bottomFrozenRowCount;\n colGroup = scene.getColGroupInLeftBottomCorner(col);\n oldContainerHeight = scene.leftBottomCornerGroup.attribute.height ?? 0;\n }\n let y = 0;\n colGroup.forEachChildren((cellGroup: Group) => {\n if (cellGroup.role !== 'cell') {\n cellGroup.setAttribute('y', y);\n return;\n }\n cellGroup.setAttribute('y', y);\n y += cellGroup.attribute.height ?? 0;\n });\n newTotalHeight = y;\n }\n scene.updateContainerHeight(row, newTotalHeight - oldContainerHeight);\n }\n}\n\n/**\n * @description: 更新单个单元格宽度\n * @return {*}\n */\nfunction updateCellWidth(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n width: number, // old width, not dist\n detaX: number,\n isHeader: boolean,\n // autoColWidth: boolean,\n autoRowHeight: boolean\n): boolean {\n let cellGroup;\n let distWidth;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n // TO BE FIXED 这里使用横向和纵向来判断单元格merge情况,目前没有横纵都merge的情况,\n // 如果有这里的逻辑要修改\n if (mergeInfo && mergeInfo.end.col - mergeInfo.start.col) {\n // 更新横向merge cell width\n const mergeCell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n const mergeCellWidth = mergeCell.attribute.width;\n mergeCell.setAttribute('width', mergeCellWidth + detaX);\n\n cellGroup = mergeCell;\n distWidth = mergeCell.attribute.width;\n col = cellGroup.col;\n row = cellGroup.row;\n } else if (mergeInfo && mergeInfo.start.row === row) {\n // 更新纵向merge cell width,只更新一次\n cell.setAttribute('width', width + detaX);\n\n cellGroup = cell;\n distWidth = width + detaX;\n col = cellGroup.col;\n row = cellGroup.row;\n } else if (!mergeInfo) {\n cell.setAttribute('width', width + detaX);\n cellGroup = cell;\n distWidth = width + detaX;\n }\n\n if (!cellGroup) {\n // 合并单元格非主单元格,不处理\n return false;\n }\n\n // 更新单元格布局\n const type = scene.table.isHeader(col, row)\n ? scene.table._getHeaderLayoutMap(col, row).headerType\n : scene.table.getBodyColumnType(col, row);\n let isHeightChange = false;\n if (type === 'progressbar') {\n // 目前先采用重新生成节点的方案\n const columnDefine = scene.table.getBodyColumnDefine(col, row) as IProgressbarColumnBodyDefine;\n const style = scene.table._getCellStyle(col, row) as ProgressBarStyle;\n const value = scene.table.getCellValue(col, row);\n const dataValue = scene.table.getCellOriginValue(col, row);\n const padding = getQuadProps(getProp('padding', style, col, row, scene.table));\n\n const newBarCell = createProgressBarCell(\n columnDefine,\n style,\n cellGroup.attribute.width,\n // cellGroup.attribute.height,\n value,\n dataValue,\n col,\n row,\n padding,\n scene.table\n );\n\n const oldBarCell = cellGroup.getChildByName('progress-bar') as Group;\n // cell.replaceChild(newBarCell, oldBarCell);\n cellGroup.insertBefore(newBarCell, oldBarCell);\n cellGroup.removeChild(oldBarCell);\n oldBarCell.removeAllChild();\n oldBarCell.release();\n } else if (type === 'sparkline') {\n // 目前先采用重新生成节点的方案\n cellGroup.removeAllChild();\n const headerStyle = scene.table._getCellStyle(col, row);\n const padding = getQuadProps(getProp('padding', headerStyle, col, row, scene.table));\n createSparkLineCellGroup(\n cellGroup,\n cellGroup.parent,\n cellGroup.attribute.x,\n cellGroup.attribute.y,\n col,\n row,\n cellGroup.attribute.width,\n cellGroup.attribute.height,\n padding,\n scene.table,\n getStyleTheme(headerStyle, scene.table, col, row, getProp).theme\n );\n } else if (type === 'image' || type === 'video') {\n // // 只更新背景边框\n // const rect = cell.firstChild as Rect;\n // rect.setAttribute('width', cell.attribute.width);\n updateImageCellContentWhileResize(cellGroup, col, row, scene.table);\n } else if (cellGroup.firstChild?.name === 'axis') {\n // recreate axis component\n const axisConfig = scene.table.internalProps.layoutMap.getAxisConfigInPivotChart(col, row);\n if (axisConfig) {\n const axis = new CartesianAxis(axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, scene.table);\n cellGroup.clear();\n cellGroup.appendChild(axis.component);\n axis.overlap();\n }\n } else if (cell.firstChild?.name === 'axis') {\n (cell.firstChild as any)?.originAxis.resize(cell.attribute.width, cell.attribute.height);\n } else {\n // 处理文字\n const style = scene.table._getCellStyle(col, row);\n isHeightChange = updateCellContentWidth(\n cellGroup,\n distWidth,\n detaX,\n autoRowHeight,\n getQuadProps(style.padding as number),\n style.textAlign,\n style.textBaseline,\n scene\n );\n }\n\n return isHeightChange;\n}\n\n/**\n * @description: 重置指定行行高\n * @param {Scenegraph} scene\n * @param {number} row\n * @return {*}\n */\nfunction resetRowHeight(scene: Scenegraph, row: number) {\n let maxHeight = 0;\n // 获取高度\n for (let col = 0; col < scene.table.colCount; col++) {\n const cell = scene.highPerformanceGetCell(col, row);\n if (cell.role === 'empty') {\n return;\n }\n let cellHeight = getCleanCellHeight(cell, scene);\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {\n cellHeight = cellHeight / (mergeInfo.end.row - mergeInfo.start.row + 1);\n }\n maxHeight = Math.max(maxHeight, cellHeight);\n }\n\n // 更新高度\n for (let col = 0; col < scene.table.colCount; col++) {\n let distHeight = maxHeight;\n const cell = scene.highPerformanceGetCell(col, row);\n if (cell.role === 'empty') {\n return;\n }\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {\n for (let rowIndex = mergeInfo.start.row; rowIndex <= mergeInfo.end.row; rowIndex++) {\n if (rowIndex !== row) {\n distHeight += scene.table.getRowHeight(rowIndex);\n }\n }\n }\n updateCellHeightForRow(scene, cell, col, row, distHeight, 0, scene.table.isHeader(col, row));\n }\n\n // 更新table行高存储\n scene.table.setRowHeight(row, maxHeight, true);\n}\n\nfunction getCleanCellHeight(cell: Group, scene: Scenegraph) {\n let maxHeight = 0;\n cell.forEachChildren((child: Icon) => {\n if (\n child.role === 'icon-left' ||\n child.role === 'icon-right' ||\n child.name === 'text' ||\n child.name === 'content'\n ) {\n maxHeight = Math.max(maxHeight, child.AABBBounds.height());\n }\n });\n\n const padding = getQuadProps(scene.table._getCellStyle(cell.col, cell.row).padding as number);\n return maxHeight + padding[0] + padding[2];\n}\n"]}
1
+ {"version":3,"sources":["scenegraph/layout/update-width.ts"],"names":[],"mappings":";;;AACA,qDAA2D;AAC3D,wDAAuD;AAIvD,sEAA0F;AAC1F,oFAAqF;AACrF,gFAAsF;AAEtF,4DAA2D;AAC3D,gDAA4C;AAC5C,8CAAgD;AAChD,gEAAmE;AACnE,mDAAyD;AAUzD,SAAgB,cAAc,CAAC,KAAiB,EAAE,GAAW,EAAE,KAAa;IAC1E,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,UAAU,KAAK,YAAY,CAAC;IAE9D,MAAM,uBAAuB,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAU,CAAC;IACtE,IAAI,uBAAuB,EAAE;QAC3B,iBAAiB,CAAC,uBAAuB,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;KACvF;IAED,MAAM,qBAAqB,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,CAAU,CAAC;IAC9D,IAAI,qBAAqB,EAAE;QACzB,iBAAiB,CAAC,qBAAqB,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;KACnF;IAED,MAAM,gBAAgB,GAAG,KAAK,CAAC,6BAA6B,CAAC,GAAG,CAAC,CAAC;IAElE,IAAI,gBAAgB,EAAE;QACpB,iBAAiB,CAAC,gBAAgB,E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CAAC,CAAC;AACjD,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAW,EAAE,KAAiB;IACxD,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,CAAC,eAAe,CAAC,CAAC,KAAW,EAAE,EAAE;QACnC,IACE,KAAK,CAAC,IAAI,KAAK,WAAW;YAC1B,KAAK,CAAC,IAAI,KAAK,YAAY;YAC3B,KAAK,CAAC,IAAI,KAAK,MAAM;YACrB,KAAK,CAAC,IAAI,KAAK,SAAS,EACxB;YACA,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;SAC5D;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,IAAA,sBAAY,EAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,OAAiB,CAAC,CAAC;IAC9F,OAAO,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC","file":"update-width.js","sourcesContent":["import type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport { CartesianAxis } from '../../components/axis/axis';\nimport { getStyleTheme } from '../../core/tableHelper';\nimport type { IProgressbarColumnBodyDefine } from '../../ts-types/list-table/define/progressbar-define';\nimport type { Group } from '../graphic/group';\nimport type { Icon } from '../graphic/icon';\nimport { updateImageCellContentWhileResize } from '../group-creater/cell-type/image-cell';\nimport { createProgressBarCell } from '../group-creater/cell-type/progress-bar-cell';\nimport { createSparkLineCellGroup } from '../group-creater/cell-type/spark-line-cell';\nimport type { Scenegraph } from '../scenegraph';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport { getProp } from '../utils/get-prop';\nimport { getQuadProps } from '../utils/padding';\nimport { updateCellContentWidth } from '../utils/text-icon-layout';\nimport { updateCellHeightForRow } from './update-height';\n// import { updateAutoRowHeight } from './auto-height';\n\n/**\n * @description: 更新指定列列宽,在拖拽调整列宽中使用\n * @param {Scenegraph} scene\n * @param {number} col\n * @param {number} detaX\n * @return {*}\n */\nexport function updateColWidth(scene: Scenegraph, col: number, detaX: number) {\n const autoRowHeight = scene.table.heightMode === 'autoHeight';\n // deal with corner header or column header\n const colOrCornerHeaderColumn = scene.getColGroup(col, true) as Group;\n if (colOrCornerHeaderColumn) {\n updateColunmWidth(colOrCornerHeaderColumn, detaX, autoRowHeight, 'col-corner', scene);\n }\n // deal with row header or body or right frozen cells\n const rowHeaderOrBodyColumn = scene.getColGroup(col) as Group;\n if (rowHeaderOrBodyColumn) {\n updateColunmWidth(rowHeaderOrBodyColumn, detaX, autoRowHeight, 'row-body', scene);\n }\n\n const leftBottomColumn = scene.getColGroupInLeftBottomCorner(col);\n // deal with left bottom frozen cells\n if (leftBottomColumn) {\n updateColunmWidth(leftBottomColumn, detaX, autoRowHeight, 'left-bottom', scene);\n }\n // deal with bottom frozen cells\n const bottomColumn = scene.getColGroupInBottom(col);\n if (bottomColumn) {\n updateColunmWidth(bottomColumn, detaX, autoRowHeight, 'bottom', scene);\n }\n // deal with right bottom frozen cells\n const rightBottomColumn = scene.getColGroupInRightBottomCorner(col);\n if (rightBottomColumn) {\n updateColunmWidth(bottomColumn, detaX, autoRowHeight, 'right-bottom', scene);\n }\n\n // 更新剩余列位置\n if (col < scene.frozenColCount) {\n scene.cornerHeaderGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n scene.rowHeaderGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n } else {\n scene.colHeaderGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n scene.bodyGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n }\n\n if (leftBottomColumn) {\n scene.leftBottomCornerGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n }\n if (bottomColumn) {\n scene.bottomFrozenGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n }\n if (rightBottomColumn) {\n scene.rightBottomCornerGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n }\n\n scene.table.setColWidth(col, rowHeaderOrBodyColumn.attribute.width, true);\n}\n\nfunction updateColunmWidth(\n columnGroup: Group,\n detaX: number,\n autoRowHeight: boolean,\n mode: 'col-corner' | 'row-body' | 'bottom' | 'left-bottom' | 'right-bottom',\n scene: Scenegraph\n) {\n let needRerangeRow = false;\n // const colOrCornerHeaderColumn = scene.getColGroup(col, true) as Group;\n const oldColumnWidth = columnGroup?.attribute.width ?? 0;\n columnGroup?.setAttribute('width', oldColumnWidth + detaX);\n // 更新单元格宽度\n columnGroup?.forEachChildren((cell: Group, index: number) => {\n const isHeightChange = updateCellWidth(\n scene,\n cell,\n cell.col,\n cell.row,\n oldColumnWidth,\n detaX,\n mode === 'row-body' ? cell.col < scene.table.rowHeaderLevelCount : true,\n autoRowHeight\n );\n if (isHeightChange) {\n const mergeInfo = getCellMergeInfo(scene.table, cell.col, cell.row);\n if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {\n for (let row = mergeInfo.start.row; row <= mergeInfo.end.row; row++) {\n resetRowHeight(scene, row);\n }\n } else {\n resetRowHeight(scene, cell.row);\n }\n needRerangeRow = true;\n }\n });\n\n if (needRerangeRow) {\n let newTotalHeight = 0;\n let colGroup;\n let oldContainerHeight;\n let row;\n for (let col = 0; col < scene.table.colCount; col++) {\n // const colGroup = scene.getColGroup(col, true);\n if (mode === 'col-corner') {\n row = 0;\n colGroup = scene.getColGroup(col, true);\n oldContainerHeight = scene.colHeaderGroup.attribute.height ?? 0;\n } else if (mode === 'row-body') {\n row = scene.table.frozenRowCount;\n colGroup = scene.getColGroup(col, false);\n oldContainerHeight = scene.bodyGroup.attribute.height ?? 0;\n } else if (mode === 'bottom') {\n row = scene.table.rowCount - scene.table.bottomFrozenRowCount;\n colGroup = scene.getColGroupInBottom(col);\n oldContainerHeight = scene.bottomFrozenGroup.attribute.height ?? 0;\n } else if (mode === 'left-bottom') {\n row = scene.table.rowCount - scene.table.bottomFrozenRowCount;\n colGroup = scene.getColGroupInLeftBottomCorner(col);\n oldContainerHeight = scene.leftBottomCornerGroup.attribute.height ?? 0;\n } else if (mode === 'right-bottom') {\n row = scene.table.rowCount - scene.table.bottomFrozenRowCount;\n colGroup = scene.getColGroupInRightBottomCorner(col);\n oldContainerHeight = scene.rightBottomCornerGroup.attribute.height ?? 0;\n }\n let y = 0;\n colGroup.forEachChildren((cellGroup: Group) => {\n if (cellGroup.role !== 'cell') {\n cellGroup.setAttribute('y', y);\n return;\n }\n cellGroup.setAttribute('y', y);\n y += cellGroup.attribute.height ?? 0;\n });\n newTotalHeight = y;\n }\n scene.updateContainerHeight(row, newTotalHeight - oldContainerHeight);\n }\n}\n\n/**\n * @description: 更新单个单元格宽度\n * @return {*}\n */\nfunction updateCellWidth(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n width: number, // old width, not dist\n detaX: number,\n isHeader: boolean,\n // autoColWidth: boolean,\n autoRowHeight: boolean\n): boolean {\n let cellGroup;\n let distWidth;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n // TO BE FIXED 这里使用横向和纵向来判断单元格merge情况,目前没有横纵都merge的情况,\n // 如果有这里的逻辑要修改\n if (mergeInfo && mergeInfo.end.col - mergeInfo.start.col) {\n // 更新横向merge cell width\n const mergeCell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n const mergeCellWidth = mergeCell.attribute.width;\n mergeCell.setAttribute('width', mergeCellWidth + detaX);\n\n cellGroup = mergeCell;\n distWidth = mergeCell.attribute.width;\n col = cellGroup.col;\n row = cellGroup.row;\n } else if (mergeInfo && mergeInfo.start.row === row) {\n // 更新纵向merge cell width,只更新一次\n cell.setAttribute('width', width + detaX);\n\n cellGroup = cell;\n distWidth = width + detaX;\n col = cellGroup.col;\n row = cellGroup.row;\n } else if (!mergeInfo) {\n cell.setAttribute('width', width + detaX);\n cellGroup = cell;\n distWidth = width + detaX;\n }\n\n if (!cellGroup) {\n // 合并单元格非主单元格,不处理\n return false;\n }\n\n // 更新单元格布局\n const type = scene.table.isHeader(col, row)\n ? scene.table._getHeaderLayoutMap(col, row).headerType\n : scene.table.getBodyColumnType(col, row);\n let isHeightChange = false;\n if (type === 'progressbar') {\n // 目前先采用重新生成节点的方案\n const columnDefine = scene.table.getBodyColumnDefine(col, row) as IProgressbarColumnBodyDefine;\n const style = scene.table._getCellStyle(col, row) as ProgressBarStyle;\n const value = scene.table.getCellValue(col, row);\n const dataValue = scene.table.getCellOriginValue(col, row);\n const padding = getQuadProps(getProp('padding', style, col, row, scene.table));\n\n const newBarCell = createProgressBarCell(\n columnDefine,\n style,\n cellGroup.attribute.width,\n // cellGroup.attribute.height,\n value,\n dataValue,\n col,\n row,\n padding,\n scene.table\n );\n\n const oldBarCell = cellGroup.getChildByName('progress-bar') as Group;\n // cell.replaceChild(newBarCell, oldBarCell);\n cellGroup.insertBefore(newBarCell, oldBarCell);\n cellGroup.removeChild(oldBarCell);\n oldBarCell.removeAllChild();\n oldBarCell.release();\n } else if (type === 'sparkline') {\n // 目前先采用重新生成节点的方案\n cellGroup.removeAllChild();\n const headerStyle = scene.table._getCellStyle(col, row);\n const padding = getQuadProps(getProp('padding', headerStyle, col, row, scene.table));\n createSparkLineCellGroup(\n cellGroup,\n cellGroup.parent,\n cellGroup.attribute.x,\n cellGroup.attribute.y,\n col,\n row,\n cellGroup.attribute.width,\n cellGroup.attribute.height,\n padding,\n scene.table,\n getStyleTheme(headerStyle, scene.table, col, row, getProp).theme\n );\n } else if (type === 'image' || type === 'video') {\n // // 只更新背景边框\n // const rect = cell.firstChild as Rect;\n // rect.setAttribute('width', cell.attribute.width);\n updateImageCellContentWhileResize(cellGroup, col, row, scene.table);\n } else if (cellGroup.firstChild?.name === 'axis') {\n // recreate axis component\n const axisConfig = scene.table.internalProps.layoutMap.getAxisConfigInPivotChart(col, row);\n if (axisConfig) {\n const axis = new CartesianAxis(axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, scene.table);\n cellGroup.clear();\n cellGroup.appendChild(axis.component);\n axis.overlap();\n }\n } else if (cell.firstChild?.name === 'axis') {\n (cell.firstChild as any)?.originAxis.resize(cell.attribute.width, cell.attribute.height);\n } else {\n // 处理文字\n const style = scene.table._getCellStyle(col, row);\n isHeightChange = updateCellContentWidth(\n cellGroup,\n distWidth,\n detaX,\n autoRowHeight,\n getQuadProps(style.padding as number),\n style.textAlign,\n style.textBaseline,\n scene\n );\n }\n\n return isHeightChange;\n}\n\n/**\n * @description: 重置指定行行高\n * @param {Scenegraph} scene\n * @param {number} row\n * @return {*}\n */\nfunction resetRowHeight(scene: Scenegraph, row: number) {\n let maxHeight = 0;\n // 获取高度\n for (let col = 0; col < scene.table.colCount; col++) {\n const cell = scene.highPerformanceGetCell(col, row);\n if (cell.role === 'empty') {\n return;\n }\n let cellHeight = getCleanCellHeight(cell, scene);\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {\n cellHeight = cellHeight / (mergeInfo.end.row - mergeInfo.start.row + 1);\n }\n maxHeight = Math.max(maxHeight, cellHeight);\n }\n\n // 更新高度\n for (let col = 0; col < scene.table.colCount; col++) {\n let distHeight = maxHeight;\n const cell = scene.highPerformanceGetCell(col, row);\n if (cell.role === 'empty') {\n return;\n }\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {\n for (let rowIndex = mergeInfo.start.row; rowIndex <= mergeInfo.end.row; rowIndex++) {\n if (rowIndex !== row) {\n distHeight += scene.table.getRowHeight(rowIndex);\n }\n }\n }\n updateCellHeightForRow(scene, cell, col, row, distHeight, 0, scene.table.isHeader(col, row));\n }\n\n // 更新table行高存储\n scene.table.setRowHeight(row, maxHeight, true);\n}\n\nfunction getCleanCellHeight(cell: Group, scene: Scenegraph) {\n let maxHeight = 0;\n cell.forEachChildren((child: Icon) => {\n if (\n child.role === 'icon-left' ||\n child.role === 'icon-right' ||\n child.name === 'text' ||\n child.name === 'content'\n ) {\n maxHeight = Math.max(maxHeight, child.AABBBounds.height());\n }\n });\n\n const padding = getQuadProps(scene.table._getCellStyle(cell.col, cell.row).padding as number);\n return maxHeight + padding[0] + padding[2];\n}\n"]}
@@ -116,6 +116,7 @@ export declare class Scenegraph {
116
116
  col: number;
117
117
  row: number;
118
118
  x?: number;
119
+ rightFrozen?: boolean;
119
120
  };
120
121
  updateIcon(icon: Icon, iconConfig: ColumnIconOption): void;
121
122
  updateFrozen(): void;
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", {
10
10
  value: !0
11
11
  }), exports.Scenegraph = void 0;
12
12
 
13
- const vrender_1 = require("@visactor/vrender"), ts_types_1 = require("../ts-types"), vutils_1 = require("@visactor/vutils"), get_cell_merge_1 = require("./utils/get-cell-merge"), update_width_1 = require("./layout/update-width"), table_component_1 = require("./component/table-component"), update_height_1 = require("./layout/update-height"), image_cell_1 = require("./group-creater/cell-type/image-cell"), padding_1 = require("./utils/padding"), frame_border_1 = require("./style/frame-border"), global_1 = require("../tools/global"), contributions_1 = __importDefault(require("./graphic/contributions")), get_prop_1 = require("./utils/get-prop"), text_icon_layout_1 = require("./utils/text-icon-layout"), proxy_1 = require("./group-creater/progress/proxy"), compute_col_width_1 = require("./layout/compute-col-width"), move_cell_1 = require("./layout/move-cell"), cell_helper_1 = require("./group-creater/cell-helper"), update_select_border_1 = require("./select/update-select-border"), create_select_border_1 = require("./select/create-select-border"), move_select_border_1 = require("./select/move-select-border"), delete_select_border_1 = require("./select/delete-select-border"), update_row_1 = require("./layout/update-row"), stick_text_1 = require("./stick-text"), compute_row_height_1 = require("./layout/compute-row-height"), empty_group_1 = require("./utils/empty-group"), frozen_1 = require("./layout/frozen"), update_chart_1 = require("./refresh-node/update-chart"), init_scenegraph_1 = require("./group-creater/init-scenegraph");
13
+ const vrender_1 = require("@visactor/vrender"), ts_types_1 = require("../ts-types"), vutils_1 = require("@visactor/vutils"), get_cell_merge_1 = require("./utils/get-cell-merge"), update_width_1 = require("./layout/update-width"), table_component_1 = require("./component/table-component"), update_height_1 = require("./layout/update-height"), image_cell_1 = require("./group-creater/cell-type/image-cell"), padding_1 = require("./utils/padding"), frame_border_1 = require("./style/frame-border"), global_1 = require("../tools/global"), contributions_1 = __importDefault(require("./graphic/contributions")), get_prop_1 = require("./utils/get-prop"), text_icon_layout_1 = require("./utils/text-icon-layout"), proxy_1 = require("./group-creater/progress/proxy"), compute_col_width_1 = require("./layout/compute-col-width"), move_cell_1 = require("./layout/move-cell"), cell_helper_1 = require("./group-creater/cell-helper"), update_select_border_1 = require("./select/update-select-border"), create_select_border_1 = require("./select/create-select-border"), move_select_border_1 = require("./select/move-select-border"), delete_select_border_1 = require("./select/delete-select-border"), update_row_1 = require("./layout/update-row"), stick_text_1 = require("./stick-text"), compute_row_height_1 = require("./layout/compute-row-height"), empty_group_1 = require("./utils/empty-group"), frozen_1 = require("./layout/frozen"), update_chart_1 = require("./refresh-node/update-chart"), init_scenegraph_1 = require("./group-creater/init-scenegraph"), update_container_1 = require("./utils/update-container");
14
14
 
15
15
  vrender_1.container.load(contributions_1.default);
16
16
 
@@ -305,6 +305,7 @@ class Scenegraph {
305
305
  this.table.isPivotChart() && (0, update_chart_1.updateChartState)(this, datum);
306
306
  }
307
307
  updateAutoColWidth(col) {
308
+ this.table.internalProps._widthResizedColMap.delete(col);
308
309
  const oldWidth = this.table.getColWidth(col), newWidth = (0, compute_col_width_1.computeColWidth)(col, 0, this.table.rowCount - 1, this.table, !0);
309
310
  newWidth !== oldWidth && this.updateColWidth(col, newWidth - oldWidth);
310
311
  }
@@ -489,24 +490,21 @@ class Scenegraph {
489
490
  (0, move_cell_1.moveHeaderPosition)(colSource, rowSource, colTarget, rowTarget, this.table);
490
491
  }
491
492
  updateContainer() {
492
- let cornerX = 0;
493
- this.cornerHeaderGroup.forEachChildrenSkipChild(((column, index) => {
494
- column.setAttribute("x", cornerX), cornerX += column.attribute.width;
495
- }));
496
- let rowHeaderX = 0;
497
- this.rowHeaderGroup.forEachChildrenSkipChild(((column, index) => {
498
- column.setAttribute("x", rowHeaderX), rowHeaderX += column.attribute.width;
499
- }));
500
- let colHeaderX = 0;
501
- this.colHeaderGroup.forEachChildrenSkipChild(((column, index) => {
502
- column.setAttribute("x", colHeaderX), colHeaderX += column.attribute.width;
503
- }));
504
- let bodyX = 0;
505
- this.bodyGroup.forEachChildrenSkipChild(((column, index) => {
506
- column.setAttribute("x", bodyX), bodyX += column.attribute.width;
507
- })), this.cornerHeaderGroup.setDeltaWidth(cornerX - this.cornerHeaderGroup.attribute.width),
493
+ const cornerX = (0, update_container_1.updateContainerChildrenX)(this.cornerHeaderGroup), rowHeaderX = (0,
494
+ update_container_1.updateContainerChildrenX)(this.rowHeaderGroup), colHeaderX = (0,
495
+ update_container_1.updateContainerChildrenX)(this.colHeaderGroup), bodyX = (0, update_container_1.updateContainerChildrenX)(this.bodyGroup), rightX = (0,
496
+ update_container_1.updateContainerChildrenX)(this.rightFrozenGroup);
497
+ (0, update_container_1.updateContainerChildrenX)(this.bottomFrozenGroup), (0, update_container_1.updateContainerChildrenX)(this.leftBottomCornerGroup),
498
+ (0, update_container_1.updateContainerChildrenX)(this.rightTopCornerGroup), (0,
499
+ update_container_1.updateContainerChildrenX)(this.rightBottomCornerGroup), this.cornerHeaderGroup.setDeltaWidth(cornerX - this.cornerHeaderGroup.attribute.width),
500
+ this.leftBottomCornerGroup.setDeltaWidth(cornerX - this.leftBottomCornerGroup.attribute.width),
508
501
  this.colHeaderGroup.setDeltaWidth(colHeaderX - this.colHeaderGroup.attribute.width),
502
+ this.rightFrozenGroup.setDeltaWidth(colHeaderX - this.rightFrozenGroup.attribute.width),
509
503
  this.rowHeaderGroup.setDeltaWidth(rowHeaderX - this.rowHeaderGroup.attribute.width),
504
+ this.bottomFrozenGroup.setDeltaWidth(rowHeaderX - this.bottomFrozenGroup.attribute.width),
505
+ this.rightFrozenGroup.setDeltaWidth(rightX - this.rightFrozenGroup.attribute.width),
506
+ this.rightTopCornerGroup.setDeltaWidth(rightX - this.rightTopCornerGroup.attribute.width),
507
+ this.rightBottomCornerGroup.setDeltaWidth(rightX - this.rightBottomCornerGroup.attribute.width),
510
508
  this.bodyGroup.setDeltaWidth(bodyX - this.bodyGroup.attribute.width), this.colHeaderGroup.setAttribute("x", this.cornerHeaderGroup.attribute.width),
511
509
  this.bottomFrozenGroup.setAttribute("x", this.rowHeaderGroup.attribute.width), this.bodyGroup.setAttribute("x", this.rowHeaderGroup.attribute.width),
512
510
  this.updateTableSize();
@@ -529,16 +527,17 @@ class Scenegraph {
529
527
  }
530
528
  getResizeColAt(abstractX, abstractY, cellGroup, offset = global_1.ResizeColumnHotSpotSize / 2) {
531
529
  if (cellGroup) {
532
- if (abstractX < cellGroup.globalAABBBounds.x1 + offset) return {
530
+ let cell;
531
+ if (abstractX < cellGroup.globalAABBBounds.x1 + offset ? cell = {
533
532
  col: cellGroup.col - 1,
534
533
  row: cellGroup.row,
535
534
  x: cellGroup.globalAABBBounds.x1
536
- };
537
- if (cellGroup.globalAABBBounds.x2 - offset < abstractX) return {
535
+ } : cellGroup.globalAABBBounds.x2 - offset < abstractX && (cell = {
538
536
  col: cellGroup.col,
539
537
  row: cellGroup.row,
540
538
  x: cellGroup.globalAABBBounds.x2
541
- };
539
+ }), cell && this.table.rightFrozenColCount > 0 && cell.col === this.table.colCount - this.table.rightFrozenColCount - 1 && this.table.tableNoFrameWidth - this.table.getFrozenColsWidth() - this.table.getRightFrozenColsWidth() + this.table.scrollLeft < this.bodyGroup.attribute.width && (cell.col = cell.col + 1,
540
+ cell.rightFrozen = !0), cell) return cell;
542
541
  } else ;
543
542
  return {
544
543
  col: -1,