@visactor/vtable 0.9.1 → 0.9.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/core/BaseTable.d.ts +1 -1
- package/cjs/core/BaseTable.js +10 -8
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/event/event.js +1 -1
- package/cjs/event/event.js.map +1 -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 +2 -0
- package/cjs/layout/pivot-header-layout.js +26 -0
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/pivot-layout.d.ts +2 -0
- package/cjs/layout/pivot-layout.js +26 -0
- package/cjs/layout/pivot-layout.js.map +1 -1
- package/cjs/layout/simple-header-layout.d.ts +2 -0
- package/cjs/layout/simple-header-layout.js +6 -0
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/render/layout/container.js +13 -0
- package/cjs/render/layout/container.js.map +1 -1
- package/cjs/scenegraph/graphic/text.js +5 -5
- package/cjs/scenegraph/graphic/text.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.d.ts +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +14 -10
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.d.ts +2 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +4 -4
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/image-cell.d.ts +1 -1
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js +1 -2
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.d.ts +2 -1
- package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js +2 -3
- package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -2
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js +6 -18
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/video-cell.d.ts +1 -1
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js +1 -2
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/column-helper.js +9 -30
- package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.d.ts +31 -12
- package/cjs/scenegraph/group-creater/progress/proxy.js +118 -123
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.d.ts +2 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +112 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.d.ts +2 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +109 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -0
- package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.d.ts +2 -0
- package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js +24 -0
- package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -0
- package/cjs/scenegraph/layout/compute-col-width.d.ts +9 -1
- package/cjs/scenegraph/layout/compute-col-width.js +11 -9
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.d.ts +3 -0
- package/cjs/scenegraph/layout/compute-row-height.js +162 -0
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -0
- package/cjs/scenegraph/layout/update-height.js +3 -2
- package/cjs/scenegraph/layout/update-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.js +3 -2
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +4 -5
- package/cjs/scenegraph/scenegraph.js +23 -42
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/stick-text/index.d.ts +1 -0
- package/cjs/scenegraph/stick-text/index.js +16 -2
- package/cjs/scenegraph/stick-text/index.js.map +1 -1
- package/cjs/scenegraph/utils/text-icon-layout.d.ts +2 -1
- package/cjs/scenegraph/utils/text-icon-layout.js +6 -5
- package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/cjs/state/hover/col.js +4 -4
- package/cjs/state/hover/col.js.map +1 -1
- package/cjs/tools/NumberMap.d.ts +1 -0
- package/cjs/tools/NumberMap.js +3 -0
- package/cjs/tools/NumberMap.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +12 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/list-table/layout-map/api.d.ts +2 -0
- package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
- package/dist/vtable.js +7621 -7036
- package/dist/vtable.min.js +2 -2
- package/es/core/BaseTable.d.ts +1 -1
- package/es/core/BaseTable.js +10 -8
- package/es/core/BaseTable.js.map +1 -1
- package/es/event/event.js +2 -2
- package/es/event/event.js.map +1 -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 +2 -0
- package/es/layout/pivot-header-layout.js +26 -0
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/pivot-layout.d.ts +2 -0
- package/es/layout/pivot-layout.js +26 -0
- package/es/layout/pivot-layout.js.map +1 -1
- package/es/layout/simple-header-layout.d.ts +2 -0
- package/es/layout/simple-header-layout.js +6 -0
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/render/layout/container.js +13 -0
- package/es/render/layout/container.js.map +1 -1
- package/es/scenegraph/graphic/text.js +5 -5
- package/es/scenegraph/graphic/text.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.d.ts +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +14 -9
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.d.ts +2 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.js +3 -5
- package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/image-cell.d.ts +1 -1
- package/es/scenegraph/group-creater/cell-type/image-cell.js +0 -3
- package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/spark-line-cell.d.ts +2 -1
- package/es/scenegraph/group-creater/cell-type/spark-line-cell.js +1 -4
- package/es/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -2
- package/es/scenegraph/group-creater/cell-type/text-cell.js +3 -17
- package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/video-cell.d.ts +1 -1
- package/es/scenegraph/group-creater/cell-type/video-cell.js +0 -3
- package/es/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/es/scenegraph/group-creater/column-helper.js +8 -29
- package/es/scenegraph/group-creater/column-helper.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.d.ts +31 -12
- package/es/scenegraph/group-creater/progress/proxy.js +124 -123
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.d.ts +2 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +104 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.d.ts +2 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +102 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -0
- package/es/scenegraph/group-creater/progress/update-position/update-auto-row.d.ts +2 -0
- package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js +18 -0
- package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -0
- package/es/scenegraph/layout/compute-col-width.d.ts +9 -1
- package/es/scenegraph/layout/compute-col-width.js +9 -8
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.d.ts +3 -0
- package/es/scenegraph/layout/compute-row-height.js +164 -0
- package/es/scenegraph/layout/compute-row-height.js.map +1 -0
- package/es/scenegraph/layout/update-height.js +3 -1
- package/es/scenegraph/layout/update-height.js.map +1 -1
- package/es/scenegraph/layout/update-width.js +3 -1
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +4 -5
- package/es/scenegraph/scenegraph.js +24 -44
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/stick-text/index.d.ts +1 -0
- package/es/scenegraph/stick-text/index.js +14 -0
- package/es/scenegraph/stick-text/index.js.map +1 -1
- package/es/scenegraph/utils/text-icon-layout.d.ts +2 -1
- package/es/scenegraph/utils/text-icon-layout.js +4 -4
- package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/es/state/hover/col.js +4 -4
- package/es/state/hover/col.js.map +1 -1
- package/es/tools/NumberMap.d.ts +1 -0
- package/es/tools/NumberMap.js +3 -0
- package/es/tools/NumberMap.js.map +1 -1
- package/es/ts-types/base-table.d.ts +12 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/list-table/layout-map/api.d.ts +2 -0
- package/es/ts-types/list-table/layout-map/api.js.map +1 -1
- package/package.json +4 -4
- package/dist/vtable.es5.js +0 -53155
- package/dist/vtable.es5.min.js +0 -3
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { RichText } from "@visactor/vrender";
|
|
2
|
+
|
|
3
|
+
import { validToString } from "../../tools/util";
|
|
4
|
+
|
|
5
|
+
import { IconPosition } from "../../ts-types";
|
|
6
|
+
|
|
7
|
+
import { WrapText } from "../graphic/text";
|
|
8
|
+
|
|
9
|
+
import { getProp } from "../utils/get-prop";
|
|
10
|
+
|
|
11
|
+
import { getQuadProps } from "../utils/padding";
|
|
12
|
+
|
|
13
|
+
import { getCellRect } from "./compute-col-width";
|
|
14
|
+
|
|
15
|
+
import { dealWithRichTextIcon } from "../utils/text-icon-layout";
|
|
16
|
+
|
|
17
|
+
const utilTextMark = new WrapText({
|
|
18
|
+
autoWrapText: !0
|
|
19
|
+
}), utilRichTextMark = new RichText({
|
|
20
|
+
width: 0,
|
|
21
|
+
height: 0,
|
|
22
|
+
textConfig: []
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export function computeRowsHeight(table, rowStart, rowEnd) {
|
|
26
|
+
if (!table.internalProps.autoRowHeight) return;
|
|
27
|
+
rowStart = null != rowStart ? rowStart : 0, rowEnd = null != rowEnd ? rowEnd : table.rowCount - 1;
|
|
28
|
+
const time = "undefined" != typeof window ? window.performance.now() : 0;
|
|
29
|
+
if (0 === rowStart && rowEnd === table.rowCount - 1) table._clearRowRangeHeightsMap(); else for (let row = rowStart; row <= rowEnd; row++) table._clearRowRangeHeightsMap(row);
|
|
30
|
+
for (let row = rowStart; row < table.columnHeaderLevelCount; row++) {
|
|
31
|
+
const height = computeRowHeight(row, 0, table.colCount - 1, table);
|
|
32
|
+
table.setRowHeight(row, height);
|
|
33
|
+
}
|
|
34
|
+
if (!(rowEnd < table.columnHeaderLevelCount)) {
|
|
35
|
+
if (table.internalProps.transpose || table.isPivotTable() && table.internalProps.layoutMap.indicatorsAsCol || !checkFixedStyleAndNoWrap(table)) if ((table.internalProps.transpose || table.isPivotTable() && !table.internalProps.layoutMap.indicatorsAsCol) && checkFixedStyleAndNoWrap(table)) for (let row = Math.max(rowStart, table.columnHeaderLevelCount); row <= rowEnd; row++) {
|
|
36
|
+
table._clearRowRangeHeightsMap(row);
|
|
37
|
+
const height = computeRowHeight(row, 0, table.rowHeaderLevelCount, table);
|
|
38
|
+
table.setRowHeight(row, height);
|
|
39
|
+
} else for (let row = Math.max(rowStart, table.columnHeaderLevelCount); row <= rowEnd; row++) {
|
|
40
|
+
table._clearRowRangeHeightsMap(row);
|
|
41
|
+
const height = computeRowHeight(row, 0, table.colCount - 1, table);
|
|
42
|
+
table.setRowHeight(row, height);
|
|
43
|
+
} else {
|
|
44
|
+
fillRowsHeight(computeRowHeight(table.columnHeaderLevelCount, 0, table.colCount - 1, table), table.columnHeaderLevelCount, table.rowCount - 1, table);
|
|
45
|
+
}
|
|
46
|
+
console.log("computeRowsHeight time:", ("undefined" != typeof window ? window.performance.now() : 0) - time);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function computeRowHeight(row, startCol, endCol, table) {
|
|
51
|
+
let maxHeight = 0;
|
|
52
|
+
for (let col = startCol; col <= endCol; col++) {
|
|
53
|
+
const customHeight = computeCustomRenderHeight(col, row, table);
|
|
54
|
+
if ("number" == typeof customHeight) {
|
|
55
|
+
maxHeight = Math.max(customHeight, maxHeight);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const textHeight = computeTextHeight(col, row, table);
|
|
59
|
+
maxHeight = Math.max(textHeight, maxHeight);
|
|
60
|
+
}
|
|
61
|
+
return maxHeight;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function checkFixedStyleAndNoWrap(table) {
|
|
65
|
+
var _a, _b, _c, _d;
|
|
66
|
+
const {layoutMap: layoutMap} = table.internalProps, row = table.columnHeaderLevelCount;
|
|
67
|
+
for (let col = 0; col < table.colCount; col++) {
|
|
68
|
+
const isHeader = layoutMap.isHeader(col, row), cellDefine = isHeader ? layoutMap.getHeader(col, row) : layoutMap.getBody(col, row);
|
|
69
|
+
if ("function" == typeof cellDefine.style || "function" == typeof cellDefine.icon || "function" == typeof cellDefine.headerIcon || (isHeader ? null === (_a = cellDefine.define) || void 0 === _a ? void 0 : _a.headerCustomRender : null === (_b = cellDefine.define) || void 0 === _b ? void 0 : _b.customRender) || (isHeader ? "function" == typeof (null === (_c = cellDefine.define) || void 0 === _c ? void 0 : _c.headerIcon) : "function" == typeof (null === (_d = cellDefine.define) || void 0 === _d ? void 0 : _d.icon))) return !1;
|
|
70
|
+
const cellStyle = table._getCellStyle(col, row);
|
|
71
|
+
if ("function" == typeof cellStyle.padding || "function" == typeof cellStyle.fontSize || "function" == typeof cellStyle.lineHeight || !0 === cellStyle.autoWrapText) return !1;
|
|
72
|
+
}
|
|
73
|
+
return !0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function fillRowsHeight(height, startRow, endRow, table) {
|
|
77
|
+
for (let row = startRow; row <= endRow; row++) table.setRowHeight(row, height);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function computeCustomRenderHeight(col, row, table) {
|
|
81
|
+
var _a, _b, _c;
|
|
82
|
+
const customRender = table.getCustomRender(col, row), customLayout = table.getCustomLayout(col, row);
|
|
83
|
+
if (customRender || customLayout) {
|
|
84
|
+
let spanCol = 1, height = 0;
|
|
85
|
+
if (table.isHeader(col, row) || table.getBodyColumnDefine(col, row).mergeCell) {
|
|
86
|
+
const cellRange = table.getCellRange(col, row);
|
|
87
|
+
spanCol = cellRange.end.col - cellRange.start.col + 1;
|
|
88
|
+
}
|
|
89
|
+
const arg = {
|
|
90
|
+
col: col,
|
|
91
|
+
row: row,
|
|
92
|
+
dataValue: table.getCellOriginValue(col, row),
|
|
93
|
+
value: table.getCellValue(col, row) || "",
|
|
94
|
+
rect: getCellRect(col, row, table),
|
|
95
|
+
table: table
|
|
96
|
+
};
|
|
97
|
+
if (customLayout) {
|
|
98
|
+
const customLayoutObj = customLayout(arg);
|
|
99
|
+
customLayoutObj.rootContainer.isRoot = !0;
|
|
100
|
+
height = null !== (_a = customLayoutObj.rootContainer.getContentSize().height) && void 0 !== _a ? _a : 0;
|
|
101
|
+
} else if ("function" == typeof customRender) {
|
|
102
|
+
const customRenderObj = customRender(arg);
|
|
103
|
+
height = null !== (_b = null == customRenderObj ? void 0 : customRenderObj.expectedHeight) && void 0 !== _b ? _b : 0;
|
|
104
|
+
} else height = null !== (_c = null == customRender ? void 0 : customRender.expectedHeight) && void 0 !== _c ? _c : 0;
|
|
105
|
+
return height / spanCol;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function computeTextHeight(col, row, table) {
|
|
110
|
+
var _a;
|
|
111
|
+
let maxHeight = 0;
|
|
112
|
+
const cellValue = table.getCellValue(col, row), actStyle = table._getCellStyle(col, row);
|
|
113
|
+
let iconHeight = 0, iconWidth = 0;
|
|
114
|
+
const iconInlineFront = [];
|
|
115
|
+
let iconInlineFrontHeight = 0;
|
|
116
|
+
const iconInlineEnd = [];
|
|
117
|
+
let iconInlineEndHeight = 0;
|
|
118
|
+
const define = table.getBodyColumnDefine(col, row);
|
|
119
|
+
if ("body" !== table.getCellType(col, row) || (!!(null == define ? void 0 : define.icon) || !!(null == define ? void 0 : define.tree))) {
|
|
120
|
+
const icons = table.getCellIcons(col, row);
|
|
121
|
+
null == icons || icons.forEach((icon => {
|
|
122
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
123
|
+
icon.positionType !== IconPosition.absoluteRight && icon.positionType !== IconPosition.inlineFront && icon.positionType !== IconPosition.inlineEnd ? (iconWidth += (null !== (_a = icon.width) && void 0 !== _a ? _a : 0) + (null !== (_b = icon.marginLeft) && void 0 !== _b ? _b : 0) + (null !== (_c = icon.marginRight) && void 0 !== _c ? _c : 0),
|
|
124
|
+
iconHeight = Math.max(iconHeight, null !== (_d = icon.height) && void 0 !== _d ? _d : 0)) : icon.positionType === IconPosition.inlineFront ? (iconInlineFront.push(icon),
|
|
125
|
+
iconInlineFrontHeight = Math.max(iconInlineFrontHeight, (null !== (_e = icon.height) && void 0 !== _e ? _e : 0) + (null !== (_f = icon.marginLeft) && void 0 !== _f ? _f : 0) + (null !== (_g = icon.marginRight) && void 0 !== _g ? _g : 0))) : icon.positionType === IconPosition.inlineEnd && (iconInlineEnd.push(icon),
|
|
126
|
+
iconInlineEndHeight = Math.max(iconInlineEndHeight, (null !== (_h = icon.height) && void 0 !== _h ? _h : 0) + (null !== (_j = icon.marginLeft) && void 0 !== _j ? _j : 0) + (null !== (_k = icon.marginRight) && void 0 !== _k ? _k : 0)));
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
let spanRow = 1;
|
|
130
|
+
if (table.isHeader(col, row) || table.getBodyColumnDefine(col, row).mergeCell) {
|
|
131
|
+
const cellRange = table.getCellRange(col, row);
|
|
132
|
+
spanRow = cellRange.end.row - cellRange.start.row + 1;
|
|
133
|
+
}
|
|
134
|
+
const padding = getQuadProps(getProp("padding", actStyle, col, row, table)), fontSize = getProp("fontSize", actStyle, col, row, table), fontStyle = getProp("fontStyle", actStyle, col, row, table), fontWeight = getProp("fontWeight", actStyle, col, row, table), lineHeight = null !== (_a = getProp("lineHeight", actStyle, col, row, table)) && void 0 !== _a ? _a : fontSize, fontFamily = getProp("fontFamily", actStyle, col, row, table), autoWrapText = getProp("autoWrapText", actStyle, col, row, table), lines = validToString(cellValue).split("\n") || [];
|
|
135
|
+
if (iconInlineFront.length || iconInlineEnd.length) {
|
|
136
|
+
const textOption = Object.assign({
|
|
137
|
+
text: null == cellValue ? void 0 : cellValue.toString(),
|
|
138
|
+
fontFamily: fontFamily,
|
|
139
|
+
fontSize: fontSize,
|
|
140
|
+
fontStyle: fontStyle,
|
|
141
|
+
fontWeight: fontWeight,
|
|
142
|
+
lineHeight: lineHeight
|
|
143
|
+
});
|
|
144
|
+
textOption.textBaseline = "middle";
|
|
145
|
+
const textConfig = [ ...iconInlineFront.map((icon => dealWithRichTextIcon(icon))), textOption, ...iconInlineEnd.map((icon => dealWithRichTextIcon(icon))) ];
|
|
146
|
+
utilRichTextMark.setAttributes({
|
|
147
|
+
width: table.getColWidth(col) - (padding[1] + padding[3]) - iconWidth,
|
|
148
|
+
height: 0,
|
|
149
|
+
textConfig: textConfig
|
|
150
|
+
}), maxHeight = utilRichTextMark.AABBBounds.height();
|
|
151
|
+
} else if (autoWrapText) {
|
|
152
|
+
const maxLineWidth = table.getColWidth(col) - (padding[1] + padding[3]) - iconWidth;
|
|
153
|
+
utilTextMark.setAttributes({
|
|
154
|
+
maxLineWidth: maxLineWidth,
|
|
155
|
+
text: lines,
|
|
156
|
+
fontSize: fontSize,
|
|
157
|
+
fontStyle: fontStyle,
|
|
158
|
+
fontWeight: fontWeight,
|
|
159
|
+
fontFamily: fontFamily
|
|
160
|
+
}), maxHeight = utilTextMark.AABBBounds.height();
|
|
161
|
+
} else maxHeight = lines.length * lineHeight;
|
|
162
|
+
return (Math.max(maxHeight, iconHeight) + padding[0] + padding[2]) / spanRow;
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=compute-row-height.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["scenegraph/layout/compute-row-height.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,YAAY,GAAG,IAAI,QAAQ,CAAC;IAChC,YAAY,EAAE,IAAI;CACnB,CAAC,CAAC;AACH,MAAM,gBAAgB,GAAG,IAAI,QAAQ,CAAC;IACpC,KAAK,EAAE,CAAC;IACR,MAAM,E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;KACvC;IAED,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;AAC/E,CAAC","file":"compute-row-height.js","sourcesContent":["import { RichText } from '@visactor/vrender';\nimport type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport { validToString } from '../../tools/util';\nimport type { ColumnIconOption } from '../../ts-types';\nimport { IconPosition } from '../../ts-types';\nimport type { BaseTableAPI, HeaderData } from '../../ts-types/base-table';\nimport type { ColumnData, TextColumnDefine } from '../../ts-types/list-table/layout-map/api';\nimport { WrapText } from '../graphic/text';\nimport { getProp } from '../utils/get-prop';\nimport { getQuadProps } from '../utils/padding';\nimport { getCellRect } from './compute-col-width';\nimport { dealWithRichTextIcon } from '../utils/text-icon-layout';\n\nconst utilTextMark = new WrapText({\n autoWrapText: true\n});\nconst utilRichTextMark = new RichText({\n width: 0,\n height: 0,\n textConfig: []\n});\n\nexport function computeRowsHeight(table: BaseTableAPI, rowStart?: number, rowEnd?: number): void {\n if (!table.internalProps.autoRowHeight) {\n // autoRowHeight false use default height\n return;\n }\n rowStart = rowStart ?? 0;\n rowEnd = rowEnd ?? table.rowCount - 1;\n const time = typeof window !== 'undefined' ? window.performance.now() : 0;\n\n // clear rowRangeHeightsMap\n if (rowStart === 0 && rowEnd === table.rowCount - 1) {\n table._clearRowRangeHeightsMap();\n } else {\n for (let row = rowStart; row <= rowEnd; row++) {\n table._clearRowRangeHeightsMap(row);\n }\n }\n\n // compute header row in column header row\n for (let row = rowStart; row < table.columnHeaderLevelCount; row++) {\n const height = computeRowHeight(row, 0, table.colCount - 1, table);\n table.setRowHeight(row, height);\n }\n\n if (rowEnd < table.columnHeaderLevelCount) {\n return;\n }\n\n // compute body row\n if (\n !table.internalProps.transpose &&\n !(table.isPivotTable() && (table.internalProps.layoutMap as PivotHeaderLayoutMap).indicatorsAsCol) &&\n checkFixedStyleAndNoWrap(table)\n ) {\n // check fixed style and no wrap situation, fill all row width single compute\n // traspose table and row indicator pivot table cannot use single row height\n const height = computeRowHeight(table.columnHeaderLevelCount, 0, table.colCount - 1, table);\n fillRowsHeight(height, table.columnHeaderLevelCount, table.rowCount - 1, table);\n } else if (\n (table.internalProps.transpose ||\n (table.isPivotTable() && !(table.internalProps.layoutMap as PivotHeaderLayoutMap).indicatorsAsCol)) &&\n checkFixedStyleAndNoWrap(table)\n ) {\n // check fixed style and no wrap situation, just compute 0-table.rowHeaderLevelCount column(the column after row header) in ervey row\n // in traspose table and row indicator pivot table\n for (let row = Math.max(rowStart, table.columnHeaderLevelCount); row <= rowEnd; row++) {\n table._clearRowRangeHeightsMap(row);\n const height = computeRowHeight(row, 0, table.rowHeaderLevelCount, table);\n table.setRowHeight(row, height);\n }\n } else {\n for (let row = Math.max(rowStart, table.columnHeaderLevelCount); row <= rowEnd; row++) {\n table._clearRowRangeHeightsMap(row);\n const height = computeRowHeight(row, 0, table.colCount - 1, table);\n table.setRowHeight(row, height);\n }\n }\n\n console.log('computeRowsHeight time:', (typeof window !== 'undefined' ? window.performance.now() : 0) - time);\n}\n\nexport function computeRowHeight(row: number, startCol: number, endCol: number, table: BaseTableAPI): number {\n let maxHeight = 0;\n for (let col = startCol; col <= endCol; col++) {\n // CustomRender height calculation\n const customHeight = computeCustomRenderHeight(col, row, table);\n if (typeof customHeight === 'number') {\n maxHeight = Math.max(customHeight, maxHeight);\n continue;\n }\n\n // text height calculation\n const textHeight = computeTextHeight(col, row, table);\n maxHeight = Math.max(textHeight, maxHeight);\n }\n return maxHeight;\n}\n\nfunction checkFixedStyleAndNoWrap(table: BaseTableAPI): boolean {\n const { layoutMap } = table.internalProps;\n const row = table.columnHeaderLevelCount;\n for (let col = 0; col < table.colCount; col++) {\n const isHeader = layoutMap.isHeader(col, row);\n const cellDefine = isHeader ? layoutMap.getHeader(col, row) : layoutMap.getBody(col, row);\n if (\n typeof cellDefine.style === 'function' ||\n typeof (cellDefine as ColumnData).icon === 'function' ||\n typeof (cellDefine as HeaderData).headerIcon === 'function' ||\n (isHeader ? cellDefine.define?.headerCustomRender : cellDefine.define?.customRender) ||\n (isHeader ? typeof cellDefine.define?.headerIcon === 'function' : typeof cellDefine.define?.icon === 'function')\n ) {\n return false;\n }\n const cellStyle = table._getCellStyle(col, row);\n if (\n typeof cellStyle.padding === 'function' ||\n typeof cellStyle.fontSize === 'function' ||\n typeof cellStyle.lineHeight === 'function' ||\n cellStyle.autoWrapText === true\n ) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction fillRowsHeight(height: number, startRow: number, endRow: number, table: BaseTableAPI) {\n for (let row = startRow; row <= endRow; row++) {\n table.setRowHeight(row, height);\n }\n}\n\n/**\n * @description: compute customRender height\n * @param {number} col\n * @param {number} row\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeCustomRenderHeight(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 height = 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 height = size.height ?? 0;\n } else if (typeof customRender === 'function') {\n // 处理customRender\n const customRenderObj = customRender(arg);\n height = customRenderObj?.expectedHeight ?? 0;\n } else {\n height = customRender?.expectedHeight ?? 0;\n }\n return height / spanCol;\n }\n return undefined;\n}\n\n/**\n * @description: compute text height\n * @param {number} col\n * @param {number} row\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeTextHeight(col: number, row: number, table: BaseTableAPI): number {\n let maxHeight = 0;\n const cellValue = table.getCellValue(col, row);\n // const dataValue = table.getCellOriginValue(col, row);\n const actStyle = table._getCellStyle(col, row);\n let iconHeight = 0;\n let iconWidth = 0;\n const iconInlineFront: ColumnIconOption[] = [];\n let iconInlineFrontHeight = 0;\n const iconInlineEnd: ColumnIconOption[] = [];\n let iconInlineEndHeight = 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 (\n icon.positionType !== IconPosition.absoluteRight &&\n icon.positionType !== IconPosition.inlineFront &&\n icon.positionType !== IconPosition.inlineEnd\n ) {\n iconWidth += (icon.width ?? 0) + (icon.marginLeft ?? 0) + (icon.marginRight ?? 0);\n iconHeight = Math.max(iconHeight, icon.height ?? 0);\n } else if (icon.positionType === IconPosition.inlineFront) {\n iconInlineFront.push(icon);\n iconInlineFrontHeight = Math.max(\n iconInlineFrontHeight,\n (icon.height ?? 0) + (icon.marginLeft ?? 0) + (icon.marginRight ?? 0)\n );\n } else if (icon.positionType === IconPosition.inlineEnd) {\n iconInlineEnd.push(icon);\n iconInlineEndHeight = Math.max(\n iconInlineEndHeight,\n (icon.height ?? 0) + (icon.marginLeft ?? 0) + (icon.marginRight ?? 0)\n );\n }\n });\n }\n let spanRow = 1;\n if (table.isHeader(col, row) || (table.getBodyColumnDefine(col, row) as TextColumnDefine).mergeCell) {\n const cellRange = table.getCellRange(col, row);\n spanRow = cellRange.end.row - cellRange.start.row + 1;\n }\n\n const padding = getQuadProps(getProp('padding', actStyle, col, row, table));\n const fontSize = getProp('fontSize', actStyle, col, row, table);\n const fontStyle = getProp('fontStyle', actStyle, col, row, table);\n const fontWeight = getProp('fontWeight', actStyle, col, row, table);\n const lineHeight = getProp('lineHeight', actStyle, col, row, table) ?? fontSize;\n const fontFamily = getProp('fontFamily', actStyle, col, row, table);\n const autoWrapText = getProp('autoWrapText', actStyle, col, row, table);\n const lines = validToString(cellValue).split('\\n') || [];\n\n if (iconInlineFront.length || iconInlineEnd.length) {\n // if (autoWrapText) {\n const textOption = Object.assign({\n text: cellValue?.toString(),\n fontFamily,\n fontSize,\n fontStyle,\n fontWeight,\n lineHeight\n });\n textOption.textBaseline = 'middle';\n const textConfig = [\n ...iconInlineFront.map(icon => dealWithRichTextIcon(icon)),\n textOption,\n ...iconInlineEnd.map(icon => dealWithRichTextIcon(icon))\n ];\n utilRichTextMark.setAttributes({\n width: table.getColWidth(col) - (padding[1] + padding[3]) - iconWidth,\n height: 0,\n textConfig\n });\n maxHeight = utilRichTextMark.AABBBounds.height();\n // } else {\n // maxHeight = 0;\n // lines.forEach((line: string, index: number) => {\n // if (index === 0 && iconInlineFront.length) {\n // maxHeight += Math.max(lineHeight, iconInlineFrontHeight);\n // } else if (index === lines.length - 1 && iconInlineEnd.length) {\n // maxHeight += Math.max(lineHeight, iconInlineEndHeight);\n // } else {\n // maxHeight += lineHeight;\n // }\n // });\n // }\n } else if (autoWrapText) {\n const maxLineWidth = table.getColWidth(col) - (padding[1] + padding[3]) - iconWidth;\n utilTextMark.setAttributes({\n maxLineWidth,\n text: lines,\n fontSize,\n fontStyle,\n fontWeight,\n fontFamily\n });\n maxHeight = utilTextMark.AABBBounds.height();\n } else {\n // autoWrapText = false\n maxHeight = lines.length * lineHeight;\n }\n\n return (Math.max(maxHeight, iconHeight) + padding[0] + padding[2]) / spanRow;\n}\n"]}
|
|
@@ -14,6 +14,8 @@ import { dealWithCustom } from "../component/custom";
|
|
|
14
14
|
|
|
15
15
|
import { updateImageCellContentWhileResize } from "../group-creater/cell-type/image-cell";
|
|
16
16
|
|
|
17
|
+
import { getStyleTheme } from "../../core/tableHelper";
|
|
18
|
+
|
|
17
19
|
export function updateRowHeight(scene, row, detaY) {
|
|
18
20
|
for (let col = 0; col < scene.table.colCount; col++) {
|
|
19
21
|
const cell = scene.getCell(col, row), mergeInfo = getCellMergeInfo(scene.table, col, row);
|
|
@@ -67,7 +69,7 @@ export function updateCellHeight(scene, cell, col, row, distHeight, detaY, isHea
|
|
|
67
69
|
} else if ("sparkline" === type) {
|
|
68
70
|
cell.removeAllChild();
|
|
69
71
|
const headerStyle = scene.table._getCellStyle(col, row), padding = getQuadProps(getProp("padding", headerStyle, col, row, scene.table));
|
|
70
|
-
createSparkLineCellGroup(cell, cell.parent, cell.attribute.x, cell.attribute.y, col, row, cell.attribute.width, cell.attribute.height, padding, scene.table);
|
|
72
|
+
createSparkLineCellGroup(cell, cell.parent, cell.attribute.x, cell.attribute.y, col, row, cell.attribute.width, cell.attribute.height, padding, scene.table, getStyleTheme(headerStyle, scene.table, col, row, getProp).theme);
|
|
71
73
|
} else if ("image" === type || "video" === type) updateImageCellContentWhileResize(cell, col, row, scene.table); else {
|
|
72
74
|
const style = scene.table._getCellStyle(col, row);
|
|
73
75
|
updateCellContentHeight(cell, distHeight, detaY, scene.table.internalProps.autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["scenegraph/layout/update-height.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,iCAAiC,EAAE,MAAM,uCAAuC,CAAC;AAE1F,MAAM,UAAU,eAAe,CAAC,KAAiB,E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ACjB,IAAI,YAAY,CAAC;YACjB,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YACnD,IAAI,QAAQ,KAAK,MAAM,EAAE;gBACvB,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBACrD,YAAY,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,kBAAkB,CAAC;gBAC1C,YAAY,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,kBAAkB,CAAC;aAC3C;iBAAM;gBACL,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBACzD,YAAY,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,KAAI,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC;gBAChE,YAAY,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,CAAC;aACrC;YACD,MAAM,YAAY,GAAG,cAAc,CACjC,YAAY,EACZ,YAAY,EACZ,GAAG,EACH,GAAG,EACH,IAAI,CAAC,SAAS,CAAC,KAAK,EACpB,IAAI,CAAC,SAAS,CAAC,MAAM,EACrB,KAAK,EACL,KAAK,EACL,KAAK,CAAC,KAAK,CACZ,CAAC;YACF,IAAI,IAAI,CAAC,aAAa,GAAG,CAAC,EAAE;gBAC1B,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;aAChE;iBAAM;gBACL,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;aAC9C;SACF;KACF;AACH,CAAC","file":"update-height.js","sourcesContent":["import type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport type { Group } from '../graphic/group';\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 { updateCellContentHeight } from '../utils/text-icon-layout';\nimport type { IProgressbarColumnBodyDefine } from '../../ts-types/list-table/define/progressbar-define';\nimport { dealWithCustom } from '../component/custom';\nimport { updateImageCellContentWhileResize } from '../group-creater/cell-type/image-cell';\n\nexport function updateRowHeight(scene: Scenegraph, row: number, detaY: number) {\n for (let col = 0; col < scene.table.colCount; col++) {\n const cell = scene.getCell(col, row);\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.start.col !== col) {\n continue;\n }\n const height = cell.attribute.height;\n // cell.setAttribute('height', height);\n // (cell.firstChild as Rect).setAttribute('height', cell.attribute.height);\n updateCellHeightForRow(scene, cell, col, row, height, detaY, scene.table.isHeader(col, row));\n\n scene.updateCellContentWhileResize(col, row);\n }\n\n let rowStart = 0;\n let rowEnd = 0;\n // 更新header 高度\n if (row < scene.table.columnHeaderLevelCount) {\n scene.colHeaderGroup.setAttribute('height', scene.colHeaderGroup.attribute.height + detaY);\n scene.rowHeaderGroup.setAttribute('y', scene.colHeaderGroup.attribute.y + detaY);\n scene.bodyGroup.setAttribute('y', scene.bodyGroup.attribute.y + detaY);\n\n rowStart = row + 1;\n rowEnd = scene.table.columnHeaderLevelCount - 1;\n } else {\n rowStart = row + 1;\n // rowEnd = scene.table.rowCount - 1;\n rowEnd = scene.bodyRowEnd;\n }\n\n // 更新以下行位置\n for (let rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) {\n // if (rowIndex === 2) debugger;\n for (let colIndex = 0; colIndex < scene.table.colCount; colIndex++) {\n const cellGroup = scene.getCell(colIndex, rowIndex);\n const mergeInfo = getCellMergeInfo(scene.table, colIndex, rowIndex);\n if (mergeInfo && (mergeInfo.start.col !== colIndex || mergeInfo.start.row !== rowIndex)) {\n continue;\n }\n\n cellGroup.setAttribute('y', cellGroup.attribute.y + detaY);\n }\n }\n\n // 更新table行高存储\n scene.table.setRowHeight(row, scene.table.getRowHeight(row) + detaY, true);\n}\n\n/**\n * @description: 更新单个单元格高度\n * @return {*}\n */\nexport function updateCellHeightForRow(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n // autoRowHeight: boolean\n) {\n let cellGroup;\n let distHeight;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n // TO BE FIXED 这里使用横向和纵向来判断单元格merge情况,目前没有横纵都merge的情况,\n // 如果有这里的逻辑要修改\n if (mergeInfo && mergeInfo.end.col - mergeInfo.start.col && mergeInfo.start.col === col) {\n // 更新横向merge cell height,只更新一次\n const mergeCell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n const mergeCellheight = mergeCell.attribute.height;\n mergeCell.setAttribute('height', mergeCellheight + detaY);\n\n cellGroup = mergeCell;\n distHeight = mergeCell.attribute.height;\n } else if (mergeInfo) {\n // 更新纵向merge cell width\n cell.setAttribute('height', height + detaY);\n\n cellGroup = cell;\n distHeight = height + detaY;\n } else if (!mergeInfo) {\n cell.setAttribute('height', height + detaY);\n cellGroup = cell;\n distHeight = height + detaY;\n // cell.setTheme({\n // rect: {\n // height: cell.attribute.height,\n // },\n // });\n }\n\n if (!cellGroup) {\n // 合并单元格非主单元格,不处理\n return;\n }\n\n updateCellHeight(scene, cellGroup, col, row, distHeight, detaY, isHeader);\n}\n\nexport function updateCellHeightForColumn(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n) {\n let cellGroup;\n // let distHeight;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {\n cell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n if (row === mergeInfo.start.row) {\n // 初始化高度\n (cell as any)._tempHeight = height;\n return;\n } else if (row === mergeInfo.end.row) {\n cell.setAttribute('height', (cell as any)._tempHeight + height);\n cellGroup = cell;\n height = cell.attribute.height;\n // updateCellHeight(scene, cellGroup, col, row, cell.attribute.height, 0, isHeader);\n } else {\n // 累加高度\n (cell as any)._tempHeight += height;\n return;\n }\n } else if (mergeInfo) {\n cell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n cell.setAttribute('height', height);\n cellGroup = cell;\n\n // const rect = cell.firstChild as Rect;\n // rect.setAttribute('height', cell.attribute.height);\n } else {\n cell.setAttribute('height', height);\n cellGroup = cell;\n }\n updateCellHeight(scene, cellGroup, col, row, height, 0, isHeader);\n}\n\nexport function updateCellHeight(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n distHeight: number,\n detaY: number,\n isHeader: boolean\n) {\n // 更新单元格布局\n const type = scene.table.isHeader(col, row)\n ? scene.table._getHeaderLayoutMap(col, row).headerType\n : scene.table.getBodyColumnType(col, row);\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 cell.attribute.width,\n // cell.attribute.height,\n value,\n dataValue,\n col,\n row,\n padding,\n scene.table\n );\n\n const oldBarCell = cell.getChildByName('progress-bar') as Group;\n // cell.replaceChild(newBarCell, oldBarCell);\n cell.insertBefore(newBarCell, oldBarCell);\n cell.removeChild(oldBarCell);\n oldBarCell.removeAllChild();\n oldBarCell.release();\n } else if (type === 'sparkline') {\n // 目前先采用重新生成节点的方案\n cell.removeAllChild();\n const headerStyle = scene.table._getCellStyle(col, row);\n const padding = getQuadProps(getProp('padding', headerStyle, col, row, scene.table));\n createSparkLineCellGroup(\n cell,\n cell.parent,\n cell.attribute.x,\n cell.attribute.y,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n padding,\n scene.table\n );\n } else if (type === 'image' || type === 'video') {\n updateImageCellContentWhileResize(cell, col, row, scene.table);\n } else {\n // 处理文字\n const style = scene.table._getCellStyle(col, row);\n updateCellContentHeight(\n cell,\n distHeight,\n detaY,\n scene.table.internalProps.autoRowHeight,\n getQuadProps(style.padding as number),\n style.textAlign,\n style.textBaseline\n );\n\n // 处理自定义渲染\n const customContainer = cell.getChildByName('custom-container') as Group;\n if (customContainer) {\n customContainer.clear();\n cell.removeChild(customContainer);\n\n let customRender;\n let customLayout;\n const cellType = scene.table.getCellType(col, row);\n if (cellType !== 'body') {\n const define = scene.table.getHeaderDefine(col, row);\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n const define = scene.table.getBodyColumnDefine(col, row);\n customRender = define?.customRender || scene.table.customRender;\n customLayout = define?.customLayout;\n }\n const customResult = dealWithCustom(\n customLayout,\n customRender,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n false,\n false,\n scene.table\n );\n if (cell.childrenCount > 0) {\n cell.insertBefore(customResult.elementsGroup, cell.firstChild);\n } else {\n cell.appendChild(customResult.elementsGroup);\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["scenegraph/layout/update-height.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,MAA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AAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;aAChE;iBAAM;gBACL,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;aAC9C;SACF;KACF;AACH,CAAC","file":"update-height.js","sourcesContent":["import type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport type { Group } from '../graphic/group';\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 { updateCellContentHeight } from '../utils/text-icon-layout';\nimport type { IProgressbarColumnBodyDefine } from '../../ts-types/list-table/define/progressbar-define';\nimport { dealWithCustom } from '../component/custom';\nimport { updateImageCellContentWhileResize } from '../group-creater/cell-type/image-cell';\nimport { getStyleTheme } from '../../core/tableHelper';\n\nexport function updateRowHeight(scene: Scenegraph, row: number, detaY: number) {\n for (let col = 0; col < scene.table.colCount; col++) {\n const cell = scene.getCell(col, row);\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.start.col !== col) {\n continue;\n }\n const height = cell.attribute.height;\n // cell.setAttribute('height', height);\n // (cell.firstChild as Rect).setAttribute('height', cell.attribute.height);\n updateCellHeightForRow(scene, cell, col, row, height, detaY, scene.table.isHeader(col, row));\n\n scene.updateCellContentWhileResize(col, row);\n }\n\n let rowStart = 0;\n let rowEnd = 0;\n // 更新header 高度\n if (row < scene.table.columnHeaderLevelCount) {\n scene.colHeaderGroup.setAttribute('height', scene.colHeaderGroup.attribute.height + detaY);\n scene.rowHeaderGroup.setAttribute('y', scene.colHeaderGroup.attribute.y + detaY);\n scene.bodyGroup.setAttribute('y', scene.bodyGroup.attribute.y + detaY);\n\n rowStart = row + 1;\n rowEnd = scene.table.columnHeaderLevelCount - 1;\n } else {\n rowStart = row + 1;\n // rowEnd = scene.table.rowCount - 1;\n rowEnd = scene.bodyRowEnd;\n }\n\n // 更新以下行位置\n for (let rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) {\n // if (rowIndex === 2) debugger;\n for (let colIndex = 0; colIndex < scene.table.colCount; colIndex++) {\n const cellGroup = scene.getCell(colIndex, rowIndex);\n const mergeInfo = getCellMergeInfo(scene.table, colIndex, rowIndex);\n if (mergeInfo && (mergeInfo.start.col !== colIndex || mergeInfo.start.row !== rowIndex)) {\n continue;\n }\n\n cellGroup.setAttribute('y', cellGroup.attribute.y + detaY);\n }\n }\n\n // 更新table行高存储\n scene.table.setRowHeight(row, scene.table.getRowHeight(row) + detaY, true);\n}\n\n/**\n * @description: 更新单个单元格高度\n * @return {*}\n */\nexport function updateCellHeightForRow(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n // autoRowHeight: boolean\n) {\n let cellGroup;\n let distHeight;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n // TO BE FIXED 这里使用横向和纵向来判断单元格merge情况,目前没有横纵都merge的情况,\n // 如果有这里的逻辑要修改\n if (mergeInfo && mergeInfo.end.col - mergeInfo.start.col && mergeInfo.start.col === col) {\n // 更新横向merge cell height,只更新一次\n const mergeCell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n const mergeCellheight = mergeCell.attribute.height;\n mergeCell.setAttribute('height', mergeCellheight + detaY);\n\n cellGroup = mergeCell;\n distHeight = mergeCell.attribute.height;\n } else if (mergeInfo) {\n // 更新纵向merge cell width\n cell.setAttribute('height', height + detaY);\n\n cellGroup = cell;\n distHeight = height + detaY;\n } else if (!mergeInfo) {\n cell.setAttribute('height', height + detaY);\n cellGroup = cell;\n distHeight = height + detaY;\n // cell.setTheme({\n // rect: {\n // height: cell.attribute.height,\n // },\n // });\n }\n\n if (!cellGroup) {\n // 合并单元格非主单元格,不处理\n return;\n }\n\n updateCellHeight(scene, cellGroup, col, row, distHeight, detaY, isHeader);\n}\n\nexport function updateCellHeightForColumn(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n) {\n let cellGroup;\n // let distHeight;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {\n cell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n if (row === mergeInfo.start.row) {\n // 初始化高度\n (cell as any)._tempHeight = height;\n return;\n } else if (row === mergeInfo.end.row) {\n cell.setAttribute('height', (cell as any)._tempHeight + height);\n cellGroup = cell;\n height = cell.attribute.height;\n // updateCellHeight(scene, cellGroup, col, row, cell.attribute.height, 0, isHeader);\n } else {\n // 累加高度\n (cell as any)._tempHeight += height;\n return;\n }\n } else if (mergeInfo) {\n cell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n cell.setAttribute('height', height);\n cellGroup = cell;\n\n // const rect = cell.firstChild as Rect;\n // rect.setAttribute('height', cell.attribute.height);\n } else {\n cell.setAttribute('height', height);\n cellGroup = cell;\n }\n updateCellHeight(scene, cellGroup, col, row, height, 0, isHeader);\n}\n\nexport function updateCellHeight(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n distHeight: number,\n detaY: number,\n isHeader: boolean\n) {\n // 更新单元格布局\n const type = scene.table.isHeader(col, row)\n ? scene.table._getHeaderLayoutMap(col, row).headerType\n : scene.table.getBodyColumnType(col, row);\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 cell.attribute.width,\n // cell.attribute.height,\n value,\n dataValue,\n col,\n row,\n padding,\n scene.table\n );\n\n const oldBarCell = cell.getChildByName('progress-bar') as Group;\n // cell.replaceChild(newBarCell, oldBarCell);\n cell.insertBefore(newBarCell, oldBarCell);\n cell.removeChild(oldBarCell);\n oldBarCell.removeAllChild();\n oldBarCell.release();\n } else if (type === 'sparkline') {\n // 目前先采用重新生成节点的方案\n cell.removeAllChild();\n const headerStyle = scene.table._getCellStyle(col, row);\n const padding = getQuadProps(getProp('padding', headerStyle, col, row, scene.table));\n createSparkLineCellGroup(\n cell,\n cell.parent,\n cell.attribute.x,\n cell.attribute.y,\n col,\n row,\n cell.attribute.width,\n cell.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 updateImageCellContentWhileResize(cell, col, row, scene.table);\n } else {\n // 处理文字\n const style = scene.table._getCellStyle(col, row);\n updateCellContentHeight(\n cell,\n distHeight,\n detaY,\n scene.table.internalProps.autoRowHeight,\n getQuadProps(style.padding as number),\n style.textAlign,\n style.textBaseline\n );\n\n // 处理自定义渲染\n const customContainer = cell.getChildByName('custom-container') as Group;\n if (customContainer) {\n customContainer.clear();\n cell.removeChild(customContainer);\n\n let customRender;\n let customLayout;\n const cellType = scene.table.getCellType(col, row);\n if (cellType !== 'body') {\n const define = scene.table.getHeaderDefine(col, row);\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n const define = scene.table.getBodyColumnDefine(col, row);\n customRender = define?.customRender || scene.table.customRender;\n customLayout = define?.customLayout;\n }\n const customResult = dealWithCustom(\n customLayout,\n customRender,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n false,\n false,\n scene.table\n );\n if (cell.childrenCount > 0) {\n cell.insertBefore(customResult.elementsGroup, cell.firstChild);\n } else {\n cell.appendChild(customResult.elementsGroup);\n }\n }\n }\n}\n"]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getStyleTheme } from "../../core/tableHelper";
|
|
2
|
+
|
|
1
3
|
import { updateImageCellContentWhileResize } from "../group-creater/cell-type/image-cell";
|
|
2
4
|
|
|
3
5
|
import { createProgressBarCell } from "../group-creater/cell-type/progress-bar-cell";
|
|
@@ -87,7 +89,7 @@ function updateCellWidth(scene, cell, col, row, width, detaX, isHeader, autoRowH
|
|
|
87
89
|
} else if ("sparkline" === type) {
|
|
88
90
|
cellGroup.removeAllChild();
|
|
89
91
|
const headerStyle = scene.table._getCellStyle(col, row), padding = getQuadProps(getProp("padding", headerStyle, col, row, scene.table));
|
|
90
|
-
createSparkLineCellGroup(cellGroup, cellGroup.parent, cellGroup.attribute.x, cellGroup.attribute.y, col, row, cellGroup.attribute.width, cellGroup.attribute.height, padding, scene.table);
|
|
92
|
+
createSparkLineCellGroup(cellGroup, cellGroup.parent, cellGroup.attribute.x, cellGroup.attribute.y, col, row, cellGroup.attribute.width, cellGroup.attribute.height, padding, scene.table, getStyleTheme(headerStyle, scene.table, col, row, getProp).theme);
|
|
91
93
|
} else if ("image" === type || "video" === type) updateImageCellContentWhileResize(cellGroup, col, row, scene.table); else {
|
|
92
94
|
const style = scene.table._getCellStyle(col, row);
|
|
93
95
|
isHeightChange = updateCellContentWidth(cellGroup, distWidth, detaX, autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline, scene);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["scenegraph/layout/update-width.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iCAAiC,EAAE,MAAM,uCAAuC,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,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AAO,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 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 // getColWidth会进行Math.round,所以先从colWidthsMap获取:\n // 如果是数值,直接使用;如果不是,则通过getColWidth获取像素值\n // const widthCache = (scene.table as any).colWidthsMap.get(col);\n // let width = 0;\n // if (typeof widthCache === 'number') {\n // width = widthCache;\n // } else {\n // width = scene.table.getColWidth(col);\n // }\n\n const { autoRowHeight } = scene.table.internalProps;\n let needRerangeRow = false;\n const colOrCornerHeaderColumn = scene.getColGroup(col, true) as Group;\n const oldColOrCornerHeaderColumnWidth = colOrCornerHeaderColumn?.attribute.width;\n colOrCornerHeaderColumn?.setAttribute('width', oldColOrCornerHeaderColumnWidth + detaX);\n // 更新单元格宽度\n colOrCornerHeaderColumn?.forEachChildren((cell: Group, index: number) => {\n const isHeightChange = updateCellWidth(\n scene,\n cell,\n col,\n // index,\n cell.row,\n oldColOrCornerHeaderColumnWidth,\n detaX,\n // true\n index < scene.table.columnHeaderLevelCount,\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 for (let col = 0; col < scene.table.colCount; col++) {\n const colGroup = scene.getColGroup(col, true);\n let y = 0;\n colGroup.forEachChildren((cellGroup: Group) => {\n if (cellGroup.role !== 'cell') {\n return;\n }\n cellGroup.setAttribute('y', y);\n y += cellGroup.attribute.height;\n });\n newTotalHeight = y;\n }\n scene.updateContainerHeight(0, newTotalHeight - scene.colHeaderGroup.attribute.height);\n }\n\n needRerangeRow = false;\n const rowHeaderOrBodyColumn = scene.getColGroup(col) as Group;\n const oldRowHeaderOrBodyColumn = rowHeaderOrBodyColumn.attribute.width;\n rowHeaderOrBodyColumn?.setAttribute('width', oldRowHeaderOrBodyColumn + detaX);\n rowHeaderOrBodyColumn?.forEachChildren((cell: Group, index: number) => {\n const isHeightChange = updateCellWidth(\n scene,\n cell,\n // col + (!isRowHeader ? scene.table.frozenColCount : 0),\n cell.col,\n // index + scene.table.frozenRowCount,\n cell.row,\n oldRowHeaderOrBodyColumn,\n detaX,\n // isRowHeader\n col < scene.table.rowHeaderLevelCount,\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 for (let col = 0; col < scene.table.colCount; col++) {\n const colGroup = scene.getColGroup(col, false);\n let y = 0;\n colGroup.forEachChildren((cellGroup: Group) => {\n if (cellGroup.role !== 'cell') {\n return;\n }\n cellGroup.setAttribute('y', y);\n y += cellGroup.attribute.height;\n });\n newTotalHeight = y;\n }\n scene.updateContainerHeight(scene.table.frozenRowCount, newTotalHeight - scene.bodyGroup.attribute.height);\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 scene.table.setColWidth(col, rowHeaderOrBodyColumn.attribute.width, true);\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 );\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 {\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 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 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] +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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,YAAY,CAAC,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 { 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 // getColWidth会进行Math.round,所以先从colWidthsMap获取:\n // 如果是数值,直接使用;如果不是,则通过getColWidth获取像素值\n // const widthCache = (scene.table as any).colWidthsMap.get(col);\n // let width = 0;\n // if (typeof widthCache === 'number') {\n // width = widthCache;\n // } else {\n // width = scene.table.getColWidth(col);\n // }\n\n const { autoRowHeight } = scene.table.internalProps;\n let needRerangeRow = false;\n const colOrCornerHeaderColumn = scene.getColGroup(col, true) as Group;\n const oldColOrCornerHeaderColumnWidth = colOrCornerHeaderColumn?.attribute.width;\n colOrCornerHeaderColumn?.setAttribute('width', oldColOrCornerHeaderColumnWidth + detaX);\n // 更新单元格宽度\n colOrCornerHeaderColumn?.forEachChildren((cell: Group, index: number) => {\n const isHeightChange = updateCellWidth(\n scene,\n cell,\n col,\n // index,\n cell.row,\n oldColOrCornerHeaderColumnWidth,\n detaX,\n // true\n index < scene.table.columnHeaderLevelCount,\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 for (let col = 0; col < scene.table.colCount; col++) {\n const colGroup = scene.getColGroup(col, true);\n let y = 0;\n colGroup.forEachChildren((cellGroup: Group) => {\n if (cellGroup.role !== 'cell') {\n return;\n }\n cellGroup.setAttribute('y', y);\n y += cellGroup.attribute.height;\n });\n newTotalHeight = y;\n }\n scene.updateContainerHeight(0, newTotalHeight - scene.colHeaderGroup.attribute.height);\n }\n\n needRerangeRow = false;\n const rowHeaderOrBodyColumn = scene.getColGroup(col) as Group;\n const oldRowHeaderOrBodyColumn = rowHeaderOrBodyColumn.attribute.width;\n rowHeaderOrBodyColumn?.setAttribute('width', oldRowHeaderOrBodyColumn + detaX);\n rowHeaderOrBodyColumn?.forEachChildren((cell: Group, index: number) => {\n const isHeightChange = updateCellWidth(\n scene,\n cell,\n // col + (!isRowHeader ? scene.table.frozenColCount : 0),\n cell.col,\n // index + scene.table.frozenRowCount,\n cell.row,\n oldRowHeaderOrBodyColumn,\n detaX,\n // isRowHeader\n col < scene.table.rowHeaderLevelCount,\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 for (let col = 0; col < scene.table.colCount; col++) {\n const colGroup = scene.getColGroup(col, false);\n let y = 0;\n colGroup.forEachChildren((cellGroup: Group) => {\n if (cellGroup.role !== 'cell') {\n return;\n }\n cellGroup.setAttribute('y', y);\n y += cellGroup.attribute.height;\n });\n newTotalHeight = y;\n }\n scene.updateContainerHeight(scene.table.frozenRowCount, newTotalHeight - scene.bodyGroup.attribute.height);\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 scene.table.setColWidth(col, rowHeaderOrBodyColumn.attribute.width, true);\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 {\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 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 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"]}
|
|
@@ -49,14 +49,11 @@ export declare class Scenegraph {
|
|
|
49
49
|
clearCells(): void;
|
|
50
50
|
createComponent(): void;
|
|
51
51
|
createSceneGraph(): void;
|
|
52
|
-
createHeaderSceneGraph(): void;
|
|
53
|
-
createBodySceneGraph(): void;
|
|
54
|
-
createBodySceneGraphForFirstScreen(): void;
|
|
55
52
|
renderSceneGraph(): void;
|
|
56
53
|
getCellOld(col: number, row: number): Group;
|
|
57
54
|
getColGroupOld(col: number, isHeader?: boolean): Group;
|
|
58
55
|
getCell(col: number, row: number, getShadow?: boolean): Group;
|
|
59
|
-
highPerformanceGetCell(col: number, row: number): Group;
|
|
56
|
+
highPerformanceGetCell(col: number, row: number, getShadow?: boolean): Group;
|
|
60
57
|
getColGroup(col: number, isCornerOrColHeader?: boolean): Group;
|
|
61
58
|
getCellSize(col: number, row: number): {
|
|
62
59
|
width: number;
|
|
@@ -83,6 +80,7 @@ export declare class Scenegraph {
|
|
|
83
80
|
updateChartSize(col: number): void;
|
|
84
81
|
updateAutoColWidth(col: number): void;
|
|
85
82
|
recalculateColWidths(): void;
|
|
83
|
+
recalculateRowHeights(): void;
|
|
86
84
|
resize(): void;
|
|
87
85
|
updateTableSize(): void;
|
|
88
86
|
updateRowHeight(row: number, detaY: number): void;
|
|
@@ -93,6 +91,7 @@ export declare class Scenegraph {
|
|
|
93
91
|
setX(x: number): void;
|
|
94
92
|
setY(y: number): void;
|
|
95
93
|
setBodyAndRowHeaderY(y: number): void;
|
|
94
|
+
setBodyAndColHeaderX(x: number): void;
|
|
96
95
|
afterScenegraphCreated(): void;
|
|
97
96
|
dealWidthMode(): void;
|
|
98
97
|
dealFrozen(): void;
|
|
@@ -115,7 +114,7 @@ export declare class Scenegraph {
|
|
|
115
114
|
sortCell(): void;
|
|
116
115
|
getCellOverflowText(col: number, row: number): string | null;
|
|
117
116
|
updateDrill(visible: boolean, x: number, y: number, drillDown: boolean, drillUp: boolean): void;
|
|
118
|
-
updateCellContent(col: number, row: number):
|
|
117
|
+
updateCellContent(col: number, row: number): Group;
|
|
119
118
|
setPixelRatio(pixelRatio: number): void;
|
|
120
119
|
updateHierarchyIcon(col: number, row: number): void;
|
|
121
120
|
updateRow(removeCells: CellAddress[], addCells: CellAddress[]): void;
|
|
@@ -6,10 +6,6 @@ import { isArray, isString } from "@visactor/vutils";
|
|
|
6
6
|
|
|
7
7
|
import { Group } from "./graphic/group";
|
|
8
8
|
|
|
9
|
-
import { createBodyColGroup, createColHeaderColGroup, createCornerHeaderColGroup, createRowHeaderColGroup } from "./group-creater/column";
|
|
10
|
-
|
|
11
|
-
import { updateAutoRowHeight } from "./layout/auto-height";
|
|
12
|
-
|
|
13
9
|
import { getCellMergeInfo } from "./utils/get-cell-merge";
|
|
14
10
|
|
|
15
11
|
import { updateColWidth } from "./layout/update-width";
|
|
@@ -52,6 +48,8 @@ import { updateRow } from "./layout/update-row";
|
|
|
52
48
|
|
|
53
49
|
import { handleTextStick } from "./stick-text";
|
|
54
50
|
|
|
51
|
+
import { computeRowsHeight } from "./layout/compute-row-height";
|
|
52
|
+
|
|
55
53
|
import { emptyGroup } from "./utils/empty-group";
|
|
56
54
|
|
|
57
55
|
import { updateChartSize } from "./refresh-node/update-chart";
|
|
@@ -199,28 +197,10 @@ export class Scenegraph {
|
|
|
199
197
|
this.selectedRangeComponents = new Map, this.selectingRangeComponents = new Map;
|
|
200
198
|
}
|
|
201
199
|
createSceneGraph() {
|
|
202
|
-
this.clear = !1,
|
|
203
|
-
this.
|
|
204
|
-
|
|
205
|
-
this.
|
|
206
|
-
}
|
|
207
|
-
createHeaderSceneGraph() {
|
|
208
|
-
createCornerHeaderColGroup(this.cornerHeaderGroup, 0, 0, this.table), this.colHeaderGroup.setAttribute("x", this.cornerHeaderGroup.attribute.width),
|
|
209
|
-
createColHeaderColGroup(this.colHeaderGroup, 0, 0, this.table);
|
|
210
|
-
}
|
|
211
|
-
createBodySceneGraph() {
|
|
212
|
-
this.rowHeaderGroup.setAttribute("y", this.colHeaderGroup.attribute.height), createRowHeaderColGroup(this.rowHeaderGroup, 0, 0, this.table),
|
|
213
|
-
this.bodyGroup.setAttributes({
|
|
214
|
-
y: this.colHeaderGroup.attribute.height,
|
|
215
|
-
x: this.rowHeaderGroup.attribute.width
|
|
216
|
-
}), createBodyColGroup(this.bodyGroup, 0, 0, this.table), this.afterScenegraphCreated();
|
|
217
|
-
}
|
|
218
|
-
createBodySceneGraphForFirstScreen() {
|
|
219
|
-
this.rowHeaderGroup.setAttribute("y", this.colHeaderGroup.attribute.height), this.bodyGroup.setAttributes({
|
|
220
|
-
y: this.colHeaderGroup.attribute.height,
|
|
221
|
-
x: this.rowHeaderGroup.attribute.width
|
|
222
|
-
}), console.log("before-createBodyColGroupForFirstScreen"), this.proxy.createColGroupForFirstScreen(this.rowHeaderGroup, this.bodyGroup, 0, 0, this.table),
|
|
223
|
-
console.log("after-createBodyColGroupForFirstScreen"), this.afterScenegraphCreated();
|
|
200
|
+
this.clear = !1, this.frozenColCount = this.table.rowHeaderLevelCount, this.frozenRowCount = this.table.columnHeaderLevelCount,
|
|
201
|
+
this.proxy = new SceneProxy(this.table), createFrameBorder(this.tableGroup, this.table.theme.frameStyle, this.tableGroup.role, void 0, !0),
|
|
202
|
+
this.proxy.createGroupForFirstScreen(this.cornerHeaderGroup, this.colHeaderGroup, this.rowHeaderGroup, this.bodyGroup, 0, 0),
|
|
203
|
+
this.afterScenegraphCreated();
|
|
224
204
|
}
|
|
225
205
|
renderSceneGraph() {
|
|
226
206
|
this.stage.render();
|
|
@@ -249,8 +229,8 @@ export class Scenegraph {
|
|
|
249
229
|
}
|
|
250
230
|
return cell || emptyGroup;
|
|
251
231
|
}
|
|
252
|
-
highPerformanceGetCell(col, row) {
|
|
253
|
-
return this.
|
|
232
|
+
highPerformanceGetCell(col, row, getShadow) {
|
|
233
|
+
return this.table.isHeader(col, row) ? this.getCell(col, row, getShadow) : this.proxy.highPerformanceGetCell(col, row, 0, this.table.rowCount - 1, getShadow);
|
|
254
234
|
}
|
|
255
235
|
getColGroup(col, isCornerOrColHeader = !1) {
|
|
256
236
|
let element;
|
|
@@ -384,10 +364,13 @@ export class Scenegraph {
|
|
|
384
364
|
newWidth !== oldWidth && this.updateColWidth(col, newWidth - oldWidth);
|
|
385
365
|
}
|
|
386
366
|
recalculateColWidths() {
|
|
387
|
-
computeColsWidth(this.table, !0);
|
|
367
|
+
computeColsWidth(this.table, 0, this.table.colCount - 1, !0);
|
|
368
|
+
}
|
|
369
|
+
recalculateRowHeights() {
|
|
370
|
+
computeRowsHeight(this.table, 0, this.table.rowCount - 1);
|
|
388
371
|
}
|
|
389
372
|
resize() {
|
|
390
|
-
this.recalculateColWidths(), this.table.internalProps.autoRowHeight &&
|
|
373
|
+
this.recalculateColWidths(), this.table.internalProps.autoRowHeight && this.recalculateRowHeights(),
|
|
391
374
|
this.dealWidthMode(), this.dealFrozen(), this.updateTableSize(), this.updateBorderSizeAndPosition(),
|
|
392
375
|
this.component.updateScrollBar(), this.updateNextFrame();
|
|
393
376
|
}
|
|
@@ -425,27 +408,24 @@ export class Scenegraph {
|
|
|
425
408
|
this.updateRowHeight(row, height - oldHeight);
|
|
426
409
|
}
|
|
427
410
|
setX(x) {
|
|
428
|
-
this.
|
|
429
|
-
this.colHeaderGroup.setAttribute("x", this.rowHeaderGroup.attribute.width + x),
|
|
430
|
-
this.updateNextFrame());
|
|
411
|
+
this.table.scenegraph.proxy.setX(-x);
|
|
431
412
|
}
|
|
432
413
|
setY(y) {
|
|
433
|
-
|
|
434
|
-
if (this.colHeaderGroup.attribute.height + y === this.bodyGroup.attribute.y) return;
|
|
435
|
-
this.bodyGroup.setAttribute("y", this.colHeaderGroup.attribute.height + y), this.rowHeaderGroup.setAttribute("y", this.colHeaderGroup.attribute.height + y),
|
|
436
|
-
this.updateNextFrame();
|
|
437
|
-
} else this.table.scenegraph.proxy && this.table.scenegraph.proxy.setY(-y);
|
|
414
|
+
this.table.scenegraph.proxy.setY(-y);
|
|
438
415
|
}
|
|
439
416
|
setBodyAndRowHeaderY(y) {
|
|
440
417
|
this.colHeaderGroup.attribute.height + y !== this.bodyGroup.attribute.y && (this.bodyGroup.setAttribute("y", this.colHeaderGroup.attribute.height + y),
|
|
441
418
|
this.rowHeaderGroup.setAttribute("y", this.colHeaderGroup.attribute.height + y),
|
|
442
419
|
this.updateNextFrame());
|
|
443
420
|
}
|
|
421
|
+
setBodyAndColHeaderX(x) {
|
|
422
|
+
this.rowHeaderGroup.attribute.width + x !== this.bodyGroup.attribute.x && (this.bodyGroup.setAttribute("x", this.rowHeaderGroup.attribute.width + x),
|
|
423
|
+
this.colHeaderGroup.setAttribute("x", this.rowHeaderGroup.attribute.width + x),
|
|
424
|
+
this.updateNextFrame());
|
|
425
|
+
}
|
|
444
426
|
afterScenegraphCreated() {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
this.createFrameBorder(), this.updateBorderSizeAndPosition(), this.component.updateScrollBar(),
|
|
448
|
-
handleTextStick(this.table), this.updateNextFrame();
|
|
427
|
+
this.dealWidthMode(), this.dealFrozen(), this.createFrameBorder(), this.updateBorderSizeAndPosition(),
|
|
428
|
+
this.component.updateScrollBar(), handleTextStick(this.table), this.updateNextFrame();
|
|
449
429
|
}
|
|
450
430
|
dealWidthMode() {
|
|
451
431
|
const table = this.table;
|
|
@@ -643,7 +623,7 @@ export class Scenegraph {
|
|
|
643
623
|
this.component.drillIcon.update(visible, x, y, drillDown, drillUp, this);
|
|
644
624
|
}
|
|
645
625
|
updateCellContent(col, row) {
|
|
646
|
-
this.clear
|
|
626
|
+
if (!this.clear) return updateCell(col, row, this.table);
|
|
647
627
|
}
|
|
648
628
|
setPixelRatio(pixelRatio) {
|
|
649
629
|
this.stage.disableDirtyBounds(), this.stage.window.setDpr(pixelRatio), this.stage.render(),
|
|
@@ -656,7 +636,7 @@ export class Scenegraph {
|
|
|
656
636
|
this.findAndUpdateIcon(cellGroup, [ IconFuncTypeEnum.collapse, IconFuncTypeEnum.expand ], iconConfig);
|
|
657
637
|
}
|
|
658
638
|
updateRow(removeCells, addCells) {
|
|
659
|
-
updateRow(removeCells, addCells, this.table), this.recalculateColWidths(), this.table.internalProps.autoRowHeight &&
|
|
639
|
+
updateRow(removeCells, addCells, this.table), this.recalculateColWidths(), this.table.internalProps.autoRowHeight && this.recalculateRowHeights(),
|
|
660
640
|
this.table.stateManeger.checkFrozen(), this.updateNextFrame();
|
|
661
641
|
}
|
|
662
642
|
findAndUpdateIcon(group, funcTypeArr, iconConfig) {
|