@visactor/vtable 0.15.0-alpha.3 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/ListTable.d.ts +12 -0
- package/cjs/ListTable.js +127 -13
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.d.ts +1 -0
- package/cjs/PivotChart.js +36 -26
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +5 -1
- package/cjs/PivotTable.js +109 -63
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +1 -2
- package/cjs/core/BaseTable.js +72 -92
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/TABLE_EVENT_TYPE.d.ts +2 -0
- package/cjs/core/TABLE_EVENT_TYPE.js +3 -1
- package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/cjs/data/DataSource.d.ts +7 -1
- package/cjs/data/DataSource.js +43 -8
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/dataset/dataset.d.ts +3 -1
- package/cjs/dataset/dataset.js +20 -15
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/edit/edit-manager.d.ts +14 -0
- package/cjs/edit/edit-manager.js +72 -0
- package/cjs/edit/edit-manager.js.map +1 -0
- package/cjs/edit/editors.d.ts +5 -0
- package/cjs/edit/editors.js +10 -0
- package/cjs/edit/editors.js.map +1 -0
- package/cjs/event/event.d.ts +3 -1
- package/cjs/event/event.js +5 -1
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +5 -1
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/table-group.d.ts +1 -0
- package/cjs/event/listener/table-group.js +41 -27
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/media-click.js +1 -2
- package/cjs/event/sparkline-event.js +2 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/pivot-header-layout.d.ts +8 -1
- package/cjs/layout/pivot-header-layout.js +47 -22
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/pivot-layout-helper.d.ts +11 -0
- package/cjs/layout/pivot-layout-helper.js +24 -2
- package/cjs/layout/pivot-layout-helper.js.map +1 -1
- package/cjs/layout/simple-header-layout.d.ts +3 -1
- package/cjs/layout/simple-header-layout.js +11 -9
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/register.d.ts +2 -0
- package/cjs/register.js +8 -3
- package/cjs/register.js.map +1 -1
- package/cjs/scenegraph/component/menu.d.ts +41 -0
- package/cjs/scenegraph/graphic/icon.js +5 -5
- package/cjs/scenegraph/graphic/icon.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.d.ts +1 -1
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +30 -58
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.d.ts +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.js +1 -3
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/icon/icon-update.js +4 -4
- package/cjs/scenegraph/icon/icon-update.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.d.ts +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +10 -8
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +1 -0
- package/cjs/scenegraph/scenegraph.js +19 -12
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/select/update-select-border.js +5 -5
- package/cjs/scenegraph/select/update-select-border.js.map +1 -1
- package/cjs/state/resize/update-resize-column.js +15 -6
- package/cjs/state/resize/update-resize-column.js.map +1 -1
- package/cjs/state/state.js +5 -4
- package/cjs/state/state.js.map +1 -1
- package/cjs/themes/ARCO.js +1 -1
- package/cjs/themes/BRIGHT.js +1 -2
- package/cjs/themes/DARK.js +1 -1
- package/cjs/themes/DEFAULT.js +1 -1
- package/cjs/themes/SIMPLIFY.js +1 -1
- package/cjs/themes/theme.js +1 -1
- package/cjs/tools/LimitPromiseQueue.js +1 -1
- package/cjs/tools/NumberMap.js +1 -1
- package/cjs/tools/Rect.js +2 -1
- package/cjs/tools/calc.js +1 -1
- package/cjs/tools/debounce.js +1 -1
- package/cjs/tools/diff-cell.js +2 -2
- package/cjs/tools/dom.js +1 -1
- package/cjs/tools/env.js +1 -1
- package/cjs/tools/global.js +1 -1
- package/cjs/tools/helper.js +1 -1
- package/cjs/ts-types/base-table.d.ts +2 -2
- package/cjs/ts-types/base-table.js +1 -1
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/common.d.ts +6 -0
- package/cjs/ts-types/common.js +1 -1
- package/cjs/ts-types/common.js.map +1 -1
- package/cjs/ts-types/component/title.d.ts +3 -3
- package/cjs/ts-types/component/title.js.map +1 -1
- package/cjs/ts-types/events.d.ts +12 -2
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/list-table/define/basic-define.d.ts +5 -1
- package/cjs/ts-types/list-table/define/basic-define.js.map +1 -1
- package/cjs/ts-types/list-table/layout-map/api.d.ts +1 -1
- package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +13 -1
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/dist/vtable.js +9136 -25006
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +12 -0
- package/es/ListTable.js +111 -12
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +1 -0
- package/es/PivotChart.js +36 -27
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +5 -1
- package/es/PivotTable.js +104 -61
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.d.ts +1 -2
- package/es/core/BaseTable.js +74 -94
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/TABLE_EVENT_TYPE.d.ts +2 -0
- package/es/core/TABLE_EVENT_TYPE.js +3 -1
- package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/es/data/DataSource.d.ts +7 -1
- package/es/data/DataSource.js +44 -9
- package/es/data/DataSource.js.map +1 -1
- package/es/dataset/dataset.d.ts +3 -1
- package/es/dataset/dataset.js +20 -15
- package/es/dataset/dataset.js.map +1 -1
- package/es/edit/edit-manager.d.ts +14 -0
- package/es/edit/edit-manager.js +66 -0
- package/es/edit/edit-manager.js.map +1 -0
- package/es/edit/editors.d.ts +5 -0
- package/es/edit/editors.js +6 -0
- package/es/edit/editors.js.map +1 -0
- package/es/event/event.d.ts +3 -1
- package/es/event/event.js +5 -2
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +5 -1
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/table-group.d.ts +1 -0
- package/es/event/listener/table-group.js +40 -24
- package/es/event/listener/table-group.js.map +1 -1
- package/es/event/media-click.js +1 -2
- package/es/event/sparkline-event.js +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/pivot-header-layout.d.ts +8 -1
- package/es/layout/pivot-header-layout.js +48 -23
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/pivot-layout-helper.d.ts +11 -0
- package/es/layout/pivot-layout-helper.js +21 -0
- package/es/layout/pivot-layout-helper.js.map +1 -1
- package/es/layout/simple-header-layout.d.ts +3 -1
- package/es/layout/simple-header-layout.js +11 -9
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/register.d.ts +2 -0
- package/es/register.js +6 -0
- package/es/register.js.map +1 -1
- package/es/scenegraph/component/menu.d.ts +41 -0
- package/es/scenegraph/graphic/icon.js +5 -5
- package/es/scenegraph/graphic/icon.js.map +1 -1
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.d.ts +1 -1
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +29 -57
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.d.ts +1 -1
- package/es/scenegraph/group-creater/progress/proxy.js +1 -3
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/icon/icon-update.js +4 -4
- package/es/scenegraph/icon/icon-update.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.d.ts +1 -1
- package/es/scenegraph/layout/compute-col-width.js +10 -8
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +1 -0
- package/es/scenegraph/scenegraph.js +19 -12
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/select/update-select-border.js +5 -5
- package/es/scenegraph/select/update-select-border.js.map +1 -1
- package/es/state/resize/update-resize-column.js +15 -6
- package/es/state/resize/update-resize-column.js.map +1 -1
- package/es/state/state.js +5 -4
- package/es/state/state.js.map +1 -1
- package/es/themes/ARCO.js +1 -1
- package/es/themes/BRIGHT.js +1 -2
- package/es/themes/DARK.js +1 -1
- package/es/themes/DEFAULT.js +1 -1
- package/es/themes/SIMPLIFY.js +1 -1
- package/es/themes/theme.js +1 -1
- package/es/tools/LimitPromiseQueue.js +1 -1
- package/es/tools/NumberMap.js +1 -1
- package/es/tools/Rect.js +2 -1
- package/es/tools/calc.js +1 -1
- package/es/tools/debounce.js +1 -1
- package/es/tools/diff-cell.js +1 -1
- package/es/tools/dom.js +1 -1
- package/es/tools/env.js +1 -1
- package/es/tools/global.js +1 -1
- package/es/tools/helper.js +1 -1
- package/es/ts-types/base-table.d.ts +2 -2
- package/es/ts-types/base-table.js +1 -1
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/common.d.ts +6 -0
- package/es/ts-types/common.js +1 -1
- package/es/ts-types/common.js.map +1 -1
- package/es/ts-types/component/title.d.ts +3 -3
- package/es/ts-types/component/title.js.map +1 -1
- package/es/ts-types/events.d.ts +12 -2
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/list-table/define/basic-define.d.ts +5 -1
- package/es/ts-types/list-table/define/basic-define.js.map +1 -1
- package/es/ts-types/list-table/layout-map/api.d.ts +1 -1
- package/es/ts-types/list-table/layout-map/api.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +13 -1
- package/es/ts-types/table-engine.js.map +1 -1
- package/package.json +11 -7
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { BaseTableAPI } from '../../ts-types/base-table';
|
|
2
2
|
export declare function computeColsWidth(table: BaseTableAPI, colStart?: number, colEnd?: number, update?: boolean): void;
|
|
3
|
-
export declare function computeColWidth(col: number, startRow: number, endRow: number, table: BaseTableAPI, forceCompute
|
|
3
|
+
export declare function computeColWidth(col: number, startRow: number, endRow: number, table: BaseTableAPI, forceCompute?: boolean): number;
|
|
@@ -42,9 +42,9 @@ function computeColsWidth(table, colStart, colEnd, update) {
|
|
|
42
42
|
let maxWidth;
|
|
43
43
|
if (!table.internalProps.transpose && "only-header" === (null === (_b = null === (_a = table.internalProps.layoutMap.columnWidths) || void 0 === _a ? void 0 : _a[col]) || void 0 === _b ? void 0 : _b.columnWidthComputeMode) && "showHeader" in table.internalProps.layoutMap) {
|
|
44
44
|
const temp = table.internalProps.layoutMap.showHeader;
|
|
45
|
-
table.internalProps.layoutMap.showHeader = !0, maxWidth = computeColWidth(col, 0, table.internalProps.layoutMap.headerLevelCount, table
|
|
45
|
+
table.internalProps.layoutMap.showHeader = !0, maxWidth = computeColWidth(col, 0, table.internalProps.layoutMap.headerLevelCount, table),
|
|
46
46
|
table.internalProps.layoutMap.showHeader = temp;
|
|
47
|
-
} else maxWidth = table.internalProps.transpose || "only-body" !== (null === (_d = null === (_c = table.internalProps.layoutMap.columnWidths) || void 0 === _c ? void 0 : _c[col]) || void 0 === _d ? void 0 : _d.columnWidthComputeMode) ? computeColWidth(col, 0, table.rowCount - 1, table
|
|
47
|
+
} else maxWidth = table.internalProps.transpose || "only-body" !== (null === (_d = null === (_c = table.internalProps.layoutMap.columnWidths) || void 0 === _c ? void 0 : _c[col]) || void 0 === _d ? void 0 : _d.columnWidthComputeMode) ? computeColWidth(col, 0, table.rowCount - 1, table) : computeColWidth(col, table.internalProps.layoutMap.getBodyRange().start.row, table.internalProps.layoutMap.getBodyRange().end.row, table);
|
|
48
48
|
table._setColContentWidth(col, maxWidth);
|
|
49
49
|
table.getColWidth(col) !== maxWidth && table._clearColRangeWidthsMap(col), update ? newWidths[col] = maxWidth : table.setColWidth(col, maxWidth, !1, !0);
|
|
50
50
|
}
|
|
@@ -82,15 +82,15 @@ function computeColsWidth(table, colStart, colEnd, update) {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
function computeColWidth(col, startRow, endRow, table, forceCompute) {
|
|
85
|
+
function computeColWidth(col, startRow, endRow, table, forceCompute = !1) {
|
|
86
86
|
const width = getColWidthDefinedWidthResizedWidth(col, table);
|
|
87
|
-
return "number" == typeof width ? width : "auto" !== width && "string" == typeof width ? table._adjustColWidth(col, table._colWidthDefineToPxWidth(width)) : computeAutoColWidth(width, col, startRow, endRow, forceCompute, table);
|
|
87
|
+
return forceCompute && !table.internalProps.transpose ? computeAutoColWidth(width, col, startRow, endRow, forceCompute, table) : "number" == typeof width ? width : "auto" !== width && "string" == typeof width ? table._adjustColWidth(col, table._colWidthDefineToPxWidth(width)) : computeAutoColWidth(width, col, startRow, endRow, forceCompute, table);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
function computeAutoColWidth(widthDeifne, col, startRow, endRow, forceCompute, table) {
|
|
91
91
|
var _a, _b, _c, _d, _e;
|
|
92
|
-
let maxWidth = 0, deltaRow = 1;
|
|
93
|
-
if (endRow - startRow > 5e3 && (
|
|
92
|
+
let maxWidth = 0, deltaRow = 1, prepareDeltaRow = 1;
|
|
93
|
+
if (endRow - startRow > 5e3 && (prepareDeltaRow = Math.ceil((endRow - startRow) / 5e3)),
|
|
94
94
|
table.isPivotChart() && col >= table.rowHeaderLevelCount && col < table.colCount - table.rightFrozenColCount) {
|
|
95
95
|
if (table.internalProps.layoutMap.indicatorsAsCol) return table.defaultColWidth;
|
|
96
96
|
{
|
|
@@ -115,7 +115,7 @@ function computeAutoColWidth(widthDeifne, col, startRow, endRow, forceCompute, t
|
|
|
115
115
|
continue;
|
|
116
116
|
}
|
|
117
117
|
const indicatorWidth = widthDeifne;
|
|
118
|
-
if ("number" == typeof indicatorWidth && "standard" === table.widthMode) {
|
|
118
|
+
if ("number" == typeof indicatorWidth && "standard" === table.widthMode && !forceCompute) {
|
|
119
119
|
maxWidth = Math.max(indicatorWidth, maxWidth);
|
|
120
120
|
continue;
|
|
121
121
|
}
|
|
@@ -131,6 +131,7 @@ function computeAutoColWidth(widthDeifne, col, startRow, endRow, forceCompute, t
|
|
|
131
131
|
if ("only-body" === (null === (_b = null == hd ? void 0 : hd.define) || void 0 === _b ? void 0 : _b.columnWidthComputeMode)) continue;
|
|
132
132
|
(null == hd ? void 0 : hd.hierarchyLevel) && (cellHierarchyIndent = (null !== (_c = hd.hierarchyLevel) && void 0 !== _c ? _c : 0) * (null !== (_d = layoutMap.rowHierarchyIndent) && void 0 !== _d ? _d : 0));
|
|
133
133
|
} else {
|
|
134
|
+
deltaRow = prepareDeltaRow;
|
|
134
135
|
const define = table.getBodyColumnDefine(col, row);
|
|
135
136
|
if (null == define ? void 0 : define.tree) {
|
|
136
137
|
const indexArr = table.dataSource.getIndexKey(table.getRecordIndexByCell(col, row));
|
|
@@ -138,7 +139,8 @@ function computeAutoColWidth(widthDeifne, col, startRow, endRow, forceCompute, t
|
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
const textWidth = computeTextWidth(col, row, cellType, table);
|
|
141
|
-
maxWidth = Math.max(textWidth + cellHierarchyIndent, maxWidth)
|
|
142
|
+
maxWidth = Math.max(textWidth + cellHierarchyIndent, maxWidth), deltaRow > 1 && table.bottomFrozenRowCount > 0 && row < table.rowCount - table.bottomFrozenRowCount && row + deltaRow >= table.rowCount - table.bottomFrozenRowCount && (row = table.rowCount - table.bottomFrozenRowCount - deltaRow,
|
|
143
|
+
deltaRow = 1, prepareDeltaRow = 1);
|
|
142
144
|
}
|
|
143
145
|
const colMinWidth = table.getMinColWidth(col), colMaxWidth = table.getMaxColWidth(col);
|
|
144
146
|
return maxWidth < colMinWidth ? colMinWidth : maxWidth > colMaxWidth ? colMaxWidth : maxWidth;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/layout/compute-col-width.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,6CAA8D;AAC9D,uDAAyC;AACzC,2CAAiD;AACjD,8CAAgD;AAChD,gDAA4C;AAG5C,+EAAsF;AACtF,2FAA0F;AAC1F,+CAAoD;AACpD,6CAA4C;AAC5C,gDAAsE;AAEtE,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,GAAa,EAAE,CAAC;IAClC,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,IAAI,MAAM,EAAE;QACV,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE;YAC7C,YAAY,CAAC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E,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,CAAC;QACR,MAAM,EAAE,CAAC;KACV,CAAC;AACJ,CAAC;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 { ColumnTypeOption, 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 { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport { getAxisConfigInPivotChart } from '../../layout/chart-helper/get-axis-config';\nimport { computeAxisComponentWidth } from '../../components/axis/get-axis-component-size';\nimport { Group as VGroup } from '@visactor/vrender';\nimport { isObject } from '@visactor/vutils';\nimport { decodeReactDom, dealPercentCalc } from '../component/custom';\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: number[] = [];\n const newWidths: number[] = [];\n if (update) {\n for (let col = 0; col < table.colCount; col++) {\n oldColWidths[col] = 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, update);\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 update\n );\n } else {\n maxWidth = computeColWidth(col, 0, table.rowCount - 1, table, update);\n }\n\n table._setColContentWidth(col, maxWidth);\n\n const oldWidth = table.getColWidth(col);\n if (oldWidth !== maxWidth) {\n table._clearColRangeWidthsMap(col);\n }\n if (update) {\n newWidths[col] = maxWidth;\n } else {\n table.setColWidth(col, maxWidth, false, true);\n }\n }\n\n // 处理adaptive宽度\n if (table.widthMode === 'adaptive') {\n table._clearColRangeWidthsMap();\n // const canvasWidth = table.internalProps.canvas.width;\n const rowHeaderWidth = table.getColsWidth(0, table.rowHeaderLevelCount - 1);\n const rightHeaderWidth = table.isPivotChart() ? table.getRightFrozenColsWidth() : 0;\n const totalDrawWidth = table.tableNoFrameWidth - rowHeaderWidth - rightHeaderWidth;\n const startCol = table.rowHeaderLevelCount;\n const endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount;\n let actualWidth = 0;\n for (let col = startCol; col < endCol; col++) {\n actualWidth += update ? newWidths[col] : table.getColWidth(col);\n }\n const factor = totalDrawWidth / actualWidth;\n for (let col = startCol; col < endCol; col++) {\n let colWidth;\n if (col === endCol - 1) {\n colWidth =\n totalDrawWidth -\n (update\n ? newWidths.reduce((acr, cur, index) => {\n if (index >= startCol && index <= endCol - 2) {\n return acr + cur;\n }\n return acr;\n }, 0)\n : table.getColsWidth(startCol, endCol - 2));\n } else {\n colWidth = Math.round((update ? newWidths[col] : table.getColWidth(col)) * factor);\n }\n if (update) {\n newWidths[col] = colWidth;\n } else {\n table.setColWidth(col, colWidth, false, true);\n }\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 = update ? newWidths[col] : 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 if (update) {\n newWidths[col] = newWidths[col] * factor;\n } else {\n table.setColWidth(col, table.getColWidth(col) * factor, false, true);\n }\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 // newColWidth could not be in column min max range possibly\n // const newColWidth = table._adjustColWidth(col, newWidths[col]) ?? table.getColWidth(col);\n const newColWidth = newWidths[col] ?? table.getColWidth(col);\n if (newColWidth !== oldColWidths[col]) {\n // update the column width in scenegraph\n table.scenegraph.updateColWidth(col, newColWidth - oldColWidths[col], true);\n }\n }\n table.scenegraph.updateContainer();\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 return table._adjustColWidth(col, table._colWidthDefineToPxWidth(width));\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 && col < table.colCount - table.rightFrozenColCount) {\n if (!(table.internalProps.layoutMap as PivotHeaderLayoutMap).indicatorsAsCol) {\n //并且指标是以行展示 计算列宽需要根据x轴的值域范围\n const optimunWidth = (table.internalProps.layoutMap as PivotHeaderLayoutMap).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 PivotHeaderLayoutMap;\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' && cellType !== 'checkbox') {\n // text&link&progressbar测量文字宽度\n // image&video&sparkline使用默认宽度\n maxWidth = Math.max(maxWidth, table.getColWidthDefinedNumber(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.getRecordIndexByCell(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, cellType, 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 if (customLayoutObj.rootContainer instanceof VGroup) {\n customLayoutObj.rootContainer = decodeReactDom(customLayoutObj.rootContainer);\n dealPercentCalc(customLayoutObj.rootContainer, 0, table.getRowHeight(row));\n customLayoutObj.rootContainer.setStage(table.scenegraph.stage);\n width = (customLayoutObj.rootContainer as VGroup).AABBBounds.width() ?? 0;\n // width = (customLayoutObj.rootContainer as VGroup).attribute.width ?? 0;\n // } else if (customLayoutObj.rootContainer) {\n // customLayoutObj.rootContainer.isRoot = true;\n // const size = customLayoutObj.rootContainer.getContentSize();\n // width = size.width ?? 0;\n } else {\n width = 0;\n }\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, cellType: ColumnTypeOption, 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.getCellLocation(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 let text;\n if (cellType === 'checkbox') {\n text = isObject(cellValue) ? (cellValue as any).text : cellValue;\n } else {\n text = cellValue;\n }\n const lines = validToString(text).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 if (cellType === 'checkbox') {\n const size = getProp('size', actStyle, col, row, table);\n maxWidth += size;\n\n if (text) {\n const spaceBetweenTextAndIcon = getProp('spaceBetweenTextAndIcon', actStyle, col, row, table);\n maxWidth += spaceBetweenTextAndIcon;\n }\n }\n\n return maxWidth;\n}\n\nfunction 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: 0,\n height: 0\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 }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GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QACxD,QAAQ,IAAI,IAAI,CAAC;QAEjB,IAAI,IAAI,EAAE;YACR,MAAM,uBAAuB,GAAG,IAAA,kBAAO,EAAC,yBAAyB,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;YAC9F,QAAQ,IAAI,uBAAuB,CAAC;SACrC;KACF;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,WAAW,CAAC,GAAW,EAAE,GAAW,EAAE,KAAmB;IAChE,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,CAAC;QACR,MAAM,EAAE,CAAC;KACV,CAAC;AACJ,CAAC;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 { ColumnTypeOption, 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 { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport { getAxisConfigInPivotChart } from '../../layout/chart-helper/get-axis-config';\nimport { computeAxisComponentWidth } from '../../components/axis/get-axis-component-size';\nimport { Group as VGroup } from '@visactor/vrender';\nimport { isObject } from '@visactor/vutils';\nimport { decodeReactDom, dealPercentCalc } from '../component/custom';\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: number[] = [];\n const newWidths: number[] = [];\n if (update) {\n for (let col = 0; col < table.colCount; col++) {\n oldColWidths[col] = 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);\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 );\n } else {\n maxWidth = computeColWidth(col, 0, table.rowCount - 1, table);\n }\n\n table._setColContentWidth(col, maxWidth);\n\n const oldWidth = table.getColWidth(col);\n if (oldWidth !== maxWidth) {\n table._clearColRangeWidthsMap(col);\n }\n if (update) {\n newWidths[col] = maxWidth;\n } else {\n table.setColWidth(col, maxWidth, false, true);\n }\n }\n\n // 处理adaptive宽度\n if (table.widthMode === 'adaptive') {\n table._clearColRangeWidthsMap();\n // const canvasWidth = table.internalProps.canvas.width;\n const rowHeaderWidth = table.getColsWidth(0, table.rowHeaderLevelCount - 1);\n const rightHeaderWidth = table.isPivotChart() ? table.getRightFrozenColsWidth() : 0;\n const totalDrawWidth = table.tableNoFrameWidth - rowHeaderWidth - rightHeaderWidth;\n const startCol = table.rowHeaderLevelCount;\n const endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount;\n let actualWidth = 0;\n for (let col = startCol; col < endCol; col++) {\n actualWidth += update ? newWidths[col] : table.getColWidth(col);\n }\n const factor = totalDrawWidth / actualWidth;\n for (let col = startCol; col < endCol; col++) {\n let colWidth;\n if (col === endCol - 1) {\n colWidth =\n totalDrawWidth -\n (update\n ? newWidths.reduce((acr, cur, index) => {\n if (index >= startCol && index <= endCol - 2) {\n return acr + cur;\n }\n return acr;\n }, 0)\n : table.getColsWidth(startCol, endCol - 2));\n } else {\n colWidth = Math.round((update ? newWidths[col] : table.getColWidth(col)) * factor);\n }\n if (update) {\n newWidths[col] = colWidth;\n } else {\n table.setColWidth(col, colWidth, false, true);\n }\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 = update ? newWidths[col] : 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 if (update) {\n newWidths[col] = newWidths[col] * factor;\n } else {\n table.setColWidth(col, table.getColWidth(col) * factor, false, true);\n }\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 // newColWidth could not be in column min max range possibly\n // const newColWidth = table._adjustColWidth(col, newWidths[col]) ?? table.getColWidth(col);\n const newColWidth = newWidths[col] ?? table.getColWidth(col);\n if (newColWidth !== oldColWidths[col]) {\n // update the column width in scenegraph\n table.scenegraph.updateColWidth(col, newColWidth - oldColWidths[col], true);\n }\n }\n table.scenegraph.updateContainer();\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 = false //forceCompute如果设置为true 即便不是自动列宽的列也会按内容计算列宽\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 (forceCompute && !table.internalProps.transpose) {\n return computeAutoColWidth(width, col, startRow, endRow, forceCompute, table);\n } else if (typeof width === 'number') {\n return width;\n } else if (width !== 'auto' && typeof width === 'string') {\n // return calc.toPx(width, table.internalProps.calcWidthContext);\n return table._adjustColWidth(col, table._colWidthDefineToPxWidth(width));\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 let prepareDeltaRow = 1; // 当计算完表头单元格的宽度后再采用采用逻辑,prepareDeltaRow这个值为期body部分做准备\n if (endRow - startRow > 5000) {\n // 超过5000行启动列宽自动计算采样\n prepareDeltaRow = Math.ceil((endRow - startRow) / 5000);\n }\n // 如果是透视图\n if (table.isPivotChart() && col >= table.rowHeaderLevelCount && col < table.colCount - table.rightFrozenColCount) {\n if (!(table.internalProps.layoutMap as PivotHeaderLayoutMap).indicatorsAsCol) {\n //并且指标是以行展示 计算列宽需要根据x轴的值域范围\n const optimunWidth = (table.internalProps.layoutMap as PivotHeaderLayoutMap).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 PivotHeaderLayoutMap;\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' && !forceCompute) {\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' && cellType !== 'checkbox') {\n // text&link&progressbar测量文字宽度\n // image&video&sparkline使用默认宽度\n maxWidth = Math.max(maxWidth, table.getColWidthDefinedNumber(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 deltaRow = prepareDeltaRow;\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.getRecordIndexByCell(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, cellType, table);\n maxWidth = Math.max(textWidth + cellHierarchyIndent, maxWidth);\n //在前面设置了采用规则的情况下,为了确保底部冻结的每一行都测到\n if (\n deltaRow > 1 &&\n table.bottomFrozenRowCount > 0 &&\n row < table.rowCount - table.bottomFrozenRowCount &&\n row + deltaRow >= table.rowCount - table.bottomFrozenRowCount\n ) {\n row = table.rowCount - table.bottomFrozenRowCount - deltaRow;\n deltaRow = 1;\n prepareDeltaRow = 1;\n }\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 if (customLayoutObj.rootContainer instanceof VGroup) {\n customLayoutObj.rootContainer = decodeReactDom(customLayoutObj.rootContainer);\n dealPercentCalc(customLayoutObj.rootContainer, 0, table.getRowHeight(row));\n customLayoutObj.rootContainer.setStage(table.scenegraph.stage);\n width = (customLayoutObj.rootContainer as VGroup).AABBBounds.width() ?? 0;\n // width = (customLayoutObj.rootContainer as VGroup).attribute.width ?? 0;\n // } else if (customLayoutObj.rootContainer) {\n // customLayoutObj.rootContainer.isRoot = true;\n // const size = customLayoutObj.rootContainer.getContentSize();\n // width = size.width ?? 0;\n } else {\n width = 0;\n }\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, cellType: ColumnTypeOption, 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.getCellLocation(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 let text;\n if (cellType === 'checkbox') {\n text = isObject(cellValue) ? (cellValue as any).text : cellValue;\n } else {\n text = cellValue;\n }\n const lines = validToString(text).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 if (cellType === 'checkbox') {\n const size = getProp('size', actStyle, col, row, table);\n maxWidth += size;\n\n if (text) {\n const spaceBetweenTextAndIcon = getProp('spaceBetweenTextAndIcon', actStyle, col, row, table);\n maxWidth += spaceBetweenTextAndIcon;\n }\n }\n\n return maxWidth;\n}\n\nfunction 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: 0,\n height: 0\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"]}
|
|
@@ -133,4 +133,5 @@ export declare class Scenegraph {
|
|
|
133
133
|
updateRow(removeCells: CellAddress[], addCells: CellAddress[], updateCells?: CellAddress[]): void;
|
|
134
134
|
getColumnGroupX(col: number): number;
|
|
135
135
|
getCellGroupY(row: number): number;
|
|
136
|
+
updateCellValue(col: number, row: number, value: string | number): void;
|
|
136
137
|
}
|
|
@@ -365,16 +365,16 @@ class Scenegraph {
|
|
|
365
365
|
visible: !0,
|
|
366
366
|
y: this.tableGroup.attribute.height - this.bottomFrozenGroup.attribute.height,
|
|
367
367
|
height: this.bottomFrozenGroup.attribute.height
|
|
368
|
-
})), this.table.rightFrozenColCount > 0 && (this.rightFrozenGroup.setAttribute("x", this.tableGroup.attribute.width - this.
|
|
368
|
+
})), this.table.rightFrozenColCount > 0 && (this.rightFrozenGroup.setAttribute("x", this.tableGroup.attribute.width - this.table.getRightFrozenColsWidth()),
|
|
369
369
|
this.rightTopCornerGroup.setAttributes({
|
|
370
370
|
visible: !0,
|
|
371
|
-
x: this.tableGroup.attribute.width - this.
|
|
372
|
-
width: this.
|
|
371
|
+
x: this.tableGroup.attribute.width - this.table.getRightFrozenColsWidth(),
|
|
372
|
+
width: this.table.getRightFrozenColsWidth(),
|
|
373
373
|
height: this.table.getFrozenRowsHeight()
|
|
374
374
|
}), this.rightBottomCornerGroup.setAttributes({
|
|
375
375
|
visible: !0,
|
|
376
|
-
x: this.tableGroup.attribute.width - this.
|
|
377
|
-
width: this.
|
|
376
|
+
x: this.tableGroup.attribute.width - this.table.getRightFrozenColsWidth(),
|
|
377
|
+
width: this.table.getRightFrozenColsWidth()
|
|
378
378
|
}));
|
|
379
379
|
}
|
|
380
380
|
updateRowHeight(row, detaY) {
|
|
@@ -415,9 +415,8 @@ class Scenegraph {
|
|
|
415
415
|
this.updateNextFrame());
|
|
416
416
|
}
|
|
417
417
|
setBodyAndColHeaderX(x) {
|
|
418
|
-
this.
|
|
419
|
-
this.colHeaderGroup.setAttribute("x", this.
|
|
420
|
-
this.table.bottomFrozenRowCount > 0 && this.bottomFrozenGroup.setAttribute("x", this.rowHeaderGroup.attribute.width + x),
|
|
418
|
+
this.table.getFrozenColsWidth() + x !== this.bodyGroup.attribute.x && (this.bodyGroup.setAttribute("x", this.table.getFrozenColsWidth() + x),
|
|
419
|
+
this.colHeaderGroup.setAttribute("x", this.table.getFrozenColsWidth() + x), this.table.bottomFrozenRowCount > 0 && this.bottomFrozenGroup.setAttribute("x", this.table.getFrozenColsWidth() + x),
|
|
421
420
|
this.updateNextFrame());
|
|
422
421
|
}
|
|
423
422
|
afterScenegraphCreated() {
|
|
@@ -543,14 +542,14 @@ class Scenegraph {
|
|
|
543
542
|
update_container_1.updateContainerChildrenX)(this.rightBottomCornerGroup, 0), this.cornerHeaderGroup.setDeltaWidth(cornerX - this.cornerHeaderGroup.attribute.width),
|
|
544
543
|
this.leftBottomCornerGroup.setDeltaWidth(cornerX - this.leftBottomCornerGroup.attribute.width),
|
|
545
544
|
this.colHeaderGroup.setDeltaWidth(colHeaderX - this.colHeaderGroup.attribute.width),
|
|
546
|
-
this.rightFrozenGroup.setDeltaWidth(colHeaderX - this.
|
|
545
|
+
this.rightFrozenGroup.setDeltaWidth(colHeaderX - this.table.getRightFrozenColsWidth()),
|
|
547
546
|
this.rowHeaderGroup.setDeltaWidth(rowHeaderX - this.rowHeaderGroup.attribute.width),
|
|
548
547
|
this.bottomFrozenGroup.setDeltaWidth(rowHeaderX - this.bottomFrozenGroup.attribute.width),
|
|
549
|
-
this.rightFrozenGroup.setDeltaWidth(rightX - this.
|
|
548
|
+
this.rightFrozenGroup.setDeltaWidth(rightX - this.table.getRightFrozenColsWidth()),
|
|
550
549
|
this.rightTopCornerGroup.setDeltaWidth(rightX - this.rightTopCornerGroup.attribute.width),
|
|
551
550
|
this.rightBottomCornerGroup.setDeltaWidth(rightX - this.rightBottomCornerGroup.attribute.width),
|
|
552
551
|
this.bodyGroup.setDeltaWidth(bodyX - this.bodyGroup.attribute.width), this.colHeaderGroup.setAttribute("x", this.cornerHeaderGroup.attribute.width),
|
|
553
|
-
this.bottomFrozenGroup.setAttribute("x", this.
|
|
552
|
+
this.bottomFrozenGroup.setAttribute("x", this.table.getFrozenColsWidth()), this.bodyGroup.setAttribute("x", this.rowHeaderGroup.attribute.width);
|
|
554
553
|
}
|
|
555
554
|
updateContainer() {
|
|
556
555
|
this.updateContainerAttrWidthAndX(), this.updateTableSize();
|
|
@@ -618,11 +617,12 @@ class Scenegraph {
|
|
|
618
617
|
this.isPivot || (this.transpose ? this.proxy.sortCellHorizontal() : this.proxy.sortCellVertical());
|
|
619
618
|
}
|
|
620
619
|
getCellOverflowText(col, row) {
|
|
620
|
+
var _a, _b;
|
|
621
621
|
const text = this.getCell(col, row).getChildByName("text", !0);
|
|
622
622
|
if (text) {
|
|
623
623
|
const textAttributeStr = (0, vutils_1.isArray)(text.attribute.text) ? text.attribute.text.join("") : text.attribute.text;
|
|
624
624
|
let cacheStr = "";
|
|
625
|
-
if ((0, vutils_1.isString)(text.cache.clipedText) ? cacheStr = text.cache.clipedText : text.cache.layoutData.lines.forEach((line => {
|
|
625
|
+
if ((0, vutils_1.isString)(text.cache.clipedText) ? cacheStr = text.cache.clipedText : null === (_b = null === (_a = text.cache.layoutData) || void 0 === _a ? void 0 : _a.lines) || void 0 === _b || _b.forEach((line => {
|
|
626
626
|
cacheStr += line.str;
|
|
627
627
|
})), cacheStr !== textAttributeStr) return textAttributeStr;
|
|
628
628
|
}
|
|
@@ -649,6 +649,13 @@ class Scenegraph {
|
|
|
649
649
|
getCellGroupY(row) {
|
|
650
650
|
return row < this.table.columnHeaderLevelCount ? this.table.getRowsHeight(0, row - 1) : row < this.table.rowCount - this.table.bottomFrozenRowCount ? this.table.getRowsHeight(this.table.columnHeaderLevelCount, row - 1) : row < this.table.rowCount ? this.table.getRowsHeight(this.table.rowCount - this.table.bottomFrozenRowCount, row - 1) : 0;
|
|
651
651
|
}
|
|
652
|
+
updateCellValue(col, row, value) {
|
|
653
|
+
const text = this.getCell(col, row).getChildByName("text", !0);
|
|
654
|
+
if (text) {
|
|
655
|
+
const textAttributeStr = (0, vutils_1.isArray)(text.attribute.text) ? [ value ] : value;
|
|
656
|
+
text.setAttribute("text", textAttributeStr);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
652
659
|
}
|
|
653
660
|
|
|
654
661
|
exports.Scenegraph = Scenegraph;
|