@visactor/vtable 0.21.2-alpha.0 → 0.21.3-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/body-helper/style/ProgressBarStyle.js +1 -1
- package/cjs/body-helper/style/ProgressBarStyle.js.map +1 -1
- package/cjs/core/BaseTable.js +1 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/event/event.d.ts +5 -0
- package/cjs/event/event.js +5 -3
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +53 -13
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/table-group.js +1 -20
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/listener/touch.js +23 -5
- package/cjs/event/listener/touch.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/scenegraph/graphic/contributions/index.js +4 -2
- package/cjs/scenegraph/graphic/contributions/index.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/text-contribution-render.d.ts +12 -0
- package/cjs/scenegraph/graphic/contributions/text-contribution-render.js +72 -0
- package/cjs/scenegraph/graphic/contributions/text-contribution-render.js.map +1 -0
- package/cjs/scenegraph/group-creater/cell-type/image-cell.d.ts +6 -0
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js +38 -26
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js +2 -6
- package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js +12 -8
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.js +3 -4
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/icon/icon-update.js +3 -2
- package/cjs/scenegraph/icon/icon-update.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/frozen.js +2 -2
- package/cjs/scenegraph/layout/frozen.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.js +3 -3
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +2 -2
- package/cjs/scenegraph/scenegraph.js +17 -14
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/stick-text/index.js +70 -34
- package/cjs/scenegraph/stick-text/index.js.map +1 -1
- package/cjs/scenegraph/utils/text-icon-layout.js +2 -2
- package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/cjs/state/hover/update-cell.js +3 -2
- package/cjs/state/hover/update-cell.js.map +1 -1
- package/cjs/tools/merge-range.js +6 -0
- package/cjs/tools/merge-range.js.map +1 -1
- package/cjs/ts-types/column/style.d.ts +1 -0
- package/cjs/ts-types/column/style.js.map +1 -1
- package/cjs/ts-types/customElement.d.ts +1 -1
- package/cjs/ts-types/customElement.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +554 -287
- package/dist/vtable.min.js +2 -2
- package/es/body-helper/style/ProgressBarStyle.js +1 -1
- package/es/body-helper/style/ProgressBarStyle.js.map +1 -1
- package/es/core/BaseTable.js +1 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/event/event.d.ts +5 -0
- package/es/event/event.js +5 -3
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +54 -12
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/table-group.js +1 -20
- package/es/event/listener/table-group.js.map +1 -1
- package/es/event/listener/touch.js +23 -5
- package/es/event/listener/touch.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/scenegraph/graphic/contributions/index.js +5 -2
- package/es/scenegraph/graphic/contributions/index.js.map +1 -1
- package/es/scenegraph/graphic/contributions/text-contribution-render.d.ts +12 -0
- package/es/scenegraph/graphic/contributions/text-contribution-render.js +69 -0
- package/es/scenegraph/graphic/contributions/text-contribution-render.js.map +1 -0
- package/es/scenegraph/group-creater/cell-type/image-cell.d.ts +6 -0
- package/es/scenegraph/group-creater/cell-type/image-cell.js +35 -24
- package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js +2 -6
- package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/video-cell.js +12 -8
- package/es/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.js +3 -4
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/icon/icon-update.js +1 -1
- package/es/scenegraph/icon/icon-update.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +1 -1
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/frozen.js +2 -2
- package/es/scenegraph/layout/frozen.js.map +1 -1
- package/es/scenegraph/layout/update-width.js +3 -3
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +2 -2
- package/es/scenegraph/scenegraph.js +16 -14
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/stick-text/index.js +70 -34
- package/es/scenegraph/stick-text/index.js.map +1 -1
- package/es/scenegraph/utils/text-icon-layout.js +2 -2
- package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/es/state/hover/update-cell.js +1 -1
- package/es/state/hover/update-cell.js.map +1 -1
- package/es/tools/merge-range.js +6 -0
- package/es/tools/merge-range.js.map +1 -1
- package/es/ts-types/column/style.d.ts +1 -0
- package/es/ts-types/column/style.js.map +1 -1
- package/es/ts-types/customElement.d.ts +1 -1
- package/es/ts-types/customElement.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
package/dist/vtable.js
CHANGED
|
@@ -36047,6 +36047,8 @@
|
|
|
36047
36047
|
});
|
|
36048
36048
|
image.name = 'image';
|
|
36049
36049
|
image.keepAspectRatio = keepAspectRatio;
|
|
36050
|
+
image.textAlign = textAlign;
|
|
36051
|
+
image.textBaseline = textBaseline;
|
|
36050
36052
|
if (keepAspectRatio || imageAutoSizing) {
|
|
36051
36053
|
if (image.resources &&
|
|
36052
36054
|
image.resources.has(image.attribute.image) &&
|
|
@@ -36134,25 +36136,40 @@
|
|
|
36134
36136
|
const textAlign = getProp('textAlign', headerStyle, col, row, table) ?? 'left';
|
|
36135
36137
|
const textBaseline = getProp('textBaseline', headerStyle, col, row, table) ?? 'middle';
|
|
36136
36138
|
const padding = getQuadProps(getProp('padding', headerStyle, col, row, table)) ?? [0, 0, 0, 0];
|
|
36139
|
+
const { width: cellWidth, height: cellHeight, isMerge } = getCellRange(cellGroup, table);
|
|
36140
|
+
const colStart = cellGroup.mergeStartCol ?? cellGroup.col;
|
|
36141
|
+
const rowStart = cellGroup.mergeStartRow ?? cellGroup.row;
|
|
36142
|
+
const colEnd = cellGroup.mergeEndCol ?? cellGroup.col;
|
|
36143
|
+
const rowEnd = cellGroup.mergeEndCol ?? cellGroup.row;
|
|
36137
36144
|
if (image.keepAspectRatio) {
|
|
36138
|
-
const { width: cellWidth, height: cellHeight } = getCellRange(cellGroup, table);
|
|
36139
36145
|
const { width: imageWidth, height: imageHeight } = calcKeepAspectRatioSize(originImage.width || originImage.videoWidth, originImage.height || originImage.videoHeight, cellWidth - (padding[1] + padding[3]), cellHeight - (padding[0] + padding[2]));
|
|
36140
36146
|
const pos = calcStartPosition(0, 0, cellWidth, cellHeight, imageWidth, imageHeight, textAlign, textBaseline, padding);
|
|
36141
|
-
|
|
36142
|
-
|
|
36143
|
-
|
|
36144
|
-
|
|
36145
|
-
|
|
36146
|
-
|
|
36147
|
+
for (let col = colStart; col <= colEnd; col++) {
|
|
36148
|
+
for (let row = rowStart; row <= rowEnd; row++) {
|
|
36149
|
+
const cellGroup = table.scenegraph.getCell(col, row);
|
|
36150
|
+
const image = cellGroup.getChildByName('image');
|
|
36151
|
+
image?.setAttributes({
|
|
36152
|
+
x: pos.x,
|
|
36153
|
+
y: pos.y,
|
|
36154
|
+
width: imageWidth,
|
|
36155
|
+
height: imageHeight
|
|
36156
|
+
});
|
|
36157
|
+
}
|
|
36158
|
+
}
|
|
36147
36159
|
}
|
|
36148
36160
|
else {
|
|
36149
|
-
|
|
36150
|
-
|
|
36151
|
-
|
|
36152
|
-
|
|
36153
|
-
|
|
36154
|
-
|
|
36155
|
-
|
|
36161
|
+
for (let col = colStart; col <= colEnd; col++) {
|
|
36162
|
+
for (let row = rowStart; row <= rowEnd; row++) {
|
|
36163
|
+
const cellGroup = table.scenegraph.getCell(col, row);
|
|
36164
|
+
const image = cellGroup.getChildByName('image');
|
|
36165
|
+
image?.setAttributes({
|
|
36166
|
+
x: padding[3],
|
|
36167
|
+
y: padding[0],
|
|
36168
|
+
width: cellWidth - padding[1] - padding[3],
|
|
36169
|
+
height: cellHeight - padding[0] - padding[2]
|
|
36170
|
+
});
|
|
36171
|
+
}
|
|
36172
|
+
}
|
|
36156
36173
|
}
|
|
36157
36174
|
const playIcon = cellGroup.getChildByName('play-icon');
|
|
36158
36175
|
if (playIcon) {
|
|
@@ -36162,16 +36179,26 @@
|
|
|
36162
36179
|
const iconSize = Math.floor(Math.min(width - padding[1] - padding[3], height - padding[2] - padding[0]) / 2);
|
|
36163
36180
|
const anchorX = left + (width > image.attribute.width ? image.attribute.x - left + image.attribute.width / 2 : width / 2);
|
|
36164
36181
|
const anchorY = top + (height > image.attribute.height ? image.attribute.y - top + image.attribute.height / 2 : height / 2);
|
|
36165
|
-
|
|
36166
|
-
|
|
36167
|
-
|
|
36168
|
-
|
|
36169
|
-
|
|
36170
|
-
|
|
36182
|
+
for (let col = colStart; col <= colEnd; col++) {
|
|
36183
|
+
for (let row = rowStart; row <= rowEnd; row++) {
|
|
36184
|
+
const cellGroup = table.scenegraph.getCell(col, row);
|
|
36185
|
+
const playIcon = cellGroup.getChildByName('play-icon');
|
|
36186
|
+
playIcon.setAttributes({
|
|
36187
|
+
x: anchorX - iconSize / 2,
|
|
36188
|
+
y: anchorY - iconSize / 2,
|
|
36189
|
+
width: iconSize,
|
|
36190
|
+
height: iconSize
|
|
36191
|
+
});
|
|
36192
|
+
}
|
|
36193
|
+
}
|
|
36194
|
+
}
|
|
36195
|
+
if (isMerge) {
|
|
36196
|
+
updateImageDxDy(cellGroup.mergeStartCol, cellGroup.mergeEndCol, cellGroup.mergeStartRow, cellGroup.mergeEndRow, table);
|
|
36171
36197
|
}
|
|
36172
36198
|
}
|
|
36173
36199
|
function getCellRange(cellGroup, table) {
|
|
36174
|
-
if (
|
|
36200
|
+
if (cellGroup.role === 'cell' &&
|
|
36201
|
+
isValid$3(cellGroup.mergeStartCol) &&
|
|
36175
36202
|
isValid$3(cellGroup.mergeEndCol) &&
|
|
36176
36203
|
isValid$3(cellGroup.mergeStartRow) &&
|
|
36177
36204
|
isValid$3(cellGroup.mergeEndRow)) {
|
|
@@ -36199,6 +36226,13 @@
|
|
|
36199
36226
|
dy: -table.getRowsHeight(cellGroup.mergeStartRow, row - 1)
|
|
36200
36227
|
});
|
|
36201
36228
|
}
|
|
36229
|
+
const playIcon = cellGroup.getChildByName('play-icon');
|
|
36230
|
+
if (playIcon) {
|
|
36231
|
+
playIcon.setAttributes({
|
|
36232
|
+
dx: -table.getColsWidth(cellGroup.mergeStartCol, col - 1),
|
|
36233
|
+
dy: -table.getRowsHeight(cellGroup.mergeStartRow, row - 1)
|
|
36234
|
+
});
|
|
36235
|
+
}
|
|
36202
36236
|
}
|
|
36203
36237
|
}
|
|
36204
36238
|
}
|
|
@@ -36268,18 +36302,12 @@
|
|
|
36268
36302
|
return Number(v);
|
|
36269
36303
|
});
|
|
36270
36304
|
const borderWidth = getQuadProps(getProp('borderLineWidth', style, col, row, table));
|
|
36271
|
-
|
|
36272
|
-
const barPaddingRight = Math.max(barPadding[1], borderWidth[1]);
|
|
36273
|
-
const barPaddingBottom = Math.max(barPadding[2], borderWidth[2]);
|
|
36274
|
-
|
|
36305
|
+
const barPaddingTop = Math.max(barPadding[0], Math.ceil(borderWidth[0] / 2));
|
|
36306
|
+
const barPaddingRight = Math.max(barPadding[1], Math.floor(borderWidth[1] / 2));
|
|
36307
|
+
const barPaddingBottom = Math.max(barPadding[2], Math.floor(borderWidth[2] / 2));
|
|
36308
|
+
const barPaddingLeft = Math.max(barPadding[3], Math.ceil(borderWidth[3] / 2));
|
|
36275
36309
|
contentWidth -= barPaddingRight + barPaddingLeft;
|
|
36276
36310
|
contentHeight -= barPaddingBottom + barPaddingTop;
|
|
36277
|
-
if (barPaddingTop & 1) {
|
|
36278
|
-
barPaddingTop += 0.5;
|
|
36279
|
-
}
|
|
36280
|
-
if (barPaddingLeft & 1) {
|
|
36281
|
-
barPaddingLeft += 0.5;
|
|
36282
|
-
}
|
|
36283
36311
|
const top = barPaddingTop;
|
|
36284
36312
|
const left = barPaddingLeft;
|
|
36285
36313
|
const right = contentWidth;
|
|
@@ -37337,6 +37365,7 @@
|
|
|
37337
37365
|
};
|
|
37338
37366
|
const wrapText = new Text$1(cellTheme.text ? Object.assign({}, cellTheme.text, attribute) : attribute);
|
|
37339
37367
|
wrapText.name = 'text';
|
|
37368
|
+
wrapText.textBaseline = textBaseline;
|
|
37340
37369
|
cellGroup.appendChild(wrapText);
|
|
37341
37370
|
contentWidth = wrapText.AABBBounds.width();
|
|
37342
37371
|
wrapText.AABBBounds.height();
|
|
@@ -37909,28 +37938,33 @@
|
|
|
37909
37938
|
if (imageAutoSizing) {
|
|
37910
37939
|
_adjustWidthHeight(col, row, video.videoWidth, video.videoHeight, table.scenegraph, padding, cellGroup);
|
|
37911
37940
|
}
|
|
37912
|
-
const width = cellGroup
|
|
37913
|
-
const height = cellGroup.attribute.height;
|
|
37941
|
+
const { width: cellWidth, height: cellHeight, isMerge } = getCellRange(cellGroup, table);
|
|
37914
37942
|
if (keepAspectRatio) {
|
|
37915
|
-
const { width: videoWidth, height: videoHeight } = calcKeepAspectRatioSize(video.videoWidth, video.videoHeight,
|
|
37916
|
-
const pos = calcStartPosition(0, 0,
|
|
37943
|
+
const { width: videoWidth, height: videoHeight } = calcKeepAspectRatioSize(video.videoWidth, video.videoHeight, cellWidth - padding[1] - padding[3], cellHeight - padding[0] - padding[2]);
|
|
37944
|
+
const pos = calcStartPosition(0, 0, cellWidth, cellHeight, videoWidth, videoHeight, textAlign, textBaseline, padding);
|
|
37917
37945
|
image.setAttributes({
|
|
37918
37946
|
width: videoWidth,
|
|
37919
37947
|
height: videoHeight,
|
|
37920
37948
|
x: pos.x,
|
|
37921
|
-
y: pos.y
|
|
37949
|
+
y: pos.y,
|
|
37950
|
+
dx: 0
|
|
37922
37951
|
});
|
|
37923
37952
|
}
|
|
37924
37953
|
else {
|
|
37925
37954
|
image.setAttributes({
|
|
37926
37955
|
x: padding[3],
|
|
37927
37956
|
y: padding[0],
|
|
37928
|
-
width:
|
|
37929
|
-
height:
|
|
37957
|
+
width: cellWidth - padding[1] - padding[3],
|
|
37958
|
+
height: cellHeight - padding[2] - padding[0],
|
|
37959
|
+
dy: 0
|
|
37930
37960
|
});
|
|
37931
37961
|
}
|
|
37962
|
+
if (isMerge) {
|
|
37963
|
+
updateImageDxDy(cellGroup.mergeStartCol, cellGroup.mergeEndCol, cellGroup.mergeStartRow, cellGroup.mergeEndRow, table);
|
|
37964
|
+
}
|
|
37932
37965
|
const left = 0;
|
|
37933
37966
|
const top = 0;
|
|
37967
|
+
const { width, height } = getCellRange(cellGroup, table);
|
|
37934
37968
|
const iconSize = Math.floor(Math.min(width - padding[1] - padding[3], height - padding[2] - padding[0]) / 2);
|
|
37935
37969
|
const anchorX = left + (width > image.attribute.width ? image.attribute.x - left + image.attribute.width / 2 : width / 2);
|
|
37936
37970
|
const anchorY = top + (height > image.attribute.height ? image.attribute.y - top + image.attribute.height / 2 : height / 2);
|
|
@@ -37960,6 +37994,9 @@
|
|
|
37960
37994
|
cursor: 'pointer'
|
|
37961
37995
|
});
|
|
37962
37996
|
image.name = 'image';
|
|
37997
|
+
image.keepAspectRatio = keepAspectRatio;
|
|
37998
|
+
image.textAlign = textAlign;
|
|
37999
|
+
image.textBaseline = textBaseline;
|
|
37963
38000
|
cellGroup.appendChild(image);
|
|
37964
38001
|
return cellGroup;
|
|
37965
38002
|
}
|
|
@@ -40066,6 +40103,14 @@
|
|
|
40066
40103
|
}
|
|
40067
40104
|
|
|
40068
40105
|
function getCellMergeRange(cellGroup, scene) {
|
|
40106
|
+
if (!scene || !scene.proxy) {
|
|
40107
|
+
return {
|
|
40108
|
+
colStart: 0,
|
|
40109
|
+
colEnd: 0,
|
|
40110
|
+
rowStart: 0,
|
|
40111
|
+
rowEnd: 0
|
|
40112
|
+
};
|
|
40113
|
+
}
|
|
40069
40114
|
const { mergeStartCol, mergeEndCol, mergeStartRow, mergeEndRow, col, row } = cellGroup;
|
|
40070
40115
|
const { colStart, colEnd, rowStart, rowEnd, bodyLeftCol, bodyRightCol, bodyTopRow, bodyBottomRow } = scene.proxy;
|
|
40071
40116
|
let cellRangeColStart = mergeStartCol;
|
|
@@ -40333,7 +40378,7 @@
|
|
|
40333
40378
|
const oldColumnWidth = columnGroup?.attribute.width ?? 0;
|
|
40334
40379
|
columnGroup?.setAttribute('width', oldColumnWidth + detaX);
|
|
40335
40380
|
columnGroup?.forEachChildren((cell, index) => {
|
|
40336
|
-
const isHeightChange = updateCellWidth(scene, cell, cell.col, cell.row, oldColumnWidth, oldColumnWidth + detaX, detaX, mode === 'row-body' ? cell.col < scene.table.rowHeaderLevelCount : true, autoRowHeight);
|
|
40381
|
+
const isHeightChange = updateCellWidth(scene, cell, cell.col, cell.row, oldColumnWidth, oldColumnWidth + detaX, detaX, mode === 'row-body' ? cell.col < scene.table.rowHeaderLevelCount : true, autoRowHeight, scene.table.internalProps.autoWrapText);
|
|
40337
40382
|
if (isHeightChange) {
|
|
40338
40383
|
const mergeInfo = getCellMergeInfo(scene.table, cell.col, cell.row);
|
|
40339
40384
|
if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {
|
|
@@ -40420,7 +40465,7 @@
|
|
|
40420
40465
|
}
|
|
40421
40466
|
}
|
|
40422
40467
|
}
|
|
40423
|
-
function updateCellWidth(scene, cell, col, row, oldWidth, distWidth, detaX, isHeader, autoRowHeight) {
|
|
40468
|
+
function updateCellWidth(scene, cell, col, row, oldWidth, distWidth, detaX, isHeader, autoRowHeight, autoWrapText) {
|
|
40424
40469
|
if (cell.attribute.width === distWidth && !cell.needUpdateWidth) {
|
|
40425
40470
|
return false;
|
|
40426
40471
|
}
|
|
@@ -40512,7 +40557,7 @@
|
|
|
40512
40557
|
isHeightChange = updateMergeCellContentWidth(cellGroup, distWidth, detaX, autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline, scene.table);
|
|
40513
40558
|
}
|
|
40514
40559
|
}
|
|
40515
|
-
return autoRowHeight ? isHeightChange : false;
|
|
40560
|
+
return autoRowHeight && autoWrapText ? isHeightChange : false;
|
|
40516
40561
|
}
|
|
40517
40562
|
function updateMergeCellContentWidth(cellGroup, distWidth, detaX, autoRowHeight, padding, textAlign, textBaseline, table) {
|
|
40518
40563
|
if (isMergeCellGroup(cellGroup)) {
|
|
@@ -42829,6 +42874,248 @@
|
|
|
42829
42874
|
}
|
|
42830
42875
|
}
|
|
42831
42876
|
|
|
42877
|
+
let customAlphabetCharSet = '';
|
|
42878
|
+
const textMeasureModule = new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
42879
|
+
if (isBound(TextMeasureContribution)) {
|
|
42880
|
+
rebind(TextMeasureContribution).to(FastTextMeasureContribution).inSingletonScope();
|
|
42881
|
+
}
|
|
42882
|
+
else {
|
|
42883
|
+
bind(TextMeasureContribution).to(FastTextMeasureContribution).inSingletonScope();
|
|
42884
|
+
}
|
|
42885
|
+
});
|
|
42886
|
+
const restoreTextMeasureModule = new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
42887
|
+
if (isBound(TextMeasureContribution)) {
|
|
42888
|
+
rebind(TextMeasureContribution).to(DefaultTextMeasureContribution).inSingletonScope();
|
|
42889
|
+
}
|
|
42890
|
+
else {
|
|
42891
|
+
bind(TextMeasureContribution).to(DefaultTextMeasureContribution).inSingletonScope();
|
|
42892
|
+
}
|
|
42893
|
+
});
|
|
42894
|
+
const initTextMeasure = (textSpec, option, useNaiveCanvas) => {
|
|
42895
|
+
return new TextMeasure$1({
|
|
42896
|
+
defaultFontParams: {
|
|
42897
|
+
fontFamily: DefaultTextStyle.fontFamily,
|
|
42898
|
+
fontSize: DefaultTextStyle.fontSize
|
|
42899
|
+
},
|
|
42900
|
+
getTextBounds: useNaiveCanvas ? undefined : getTextBounds$1,
|
|
42901
|
+
specialCharSet: `{}()//&-/: .,@%'"~…=${TextMeasure$1.ALPHABET_CHAR_SET}${TextMeasure$1.ALPHABET_CHAR_SET.toUpperCase()}0123456789${customAlphabetCharSet}`,
|
|
42902
|
+
...(option ?? {})
|
|
42903
|
+
}, textSpec);
|
|
42904
|
+
};
|
|
42905
|
+
const fastTextMeasureCache = new Map();
|
|
42906
|
+
function getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle = 'normal') {
|
|
42907
|
+
const key = `${fontSize}-${fontWeight}-${fontFamily}-${fontStyle}`;
|
|
42908
|
+
const cache = fastTextMeasureCache.get(key);
|
|
42909
|
+
if (cache) {
|
|
42910
|
+
return cache;
|
|
42911
|
+
}
|
|
42912
|
+
const fastTextMeasure = initTextMeasure({
|
|
42913
|
+
fontSize,
|
|
42914
|
+
fontFamily,
|
|
42915
|
+
fontWeight,
|
|
42916
|
+
fontStyle
|
|
42917
|
+
});
|
|
42918
|
+
fastTextMeasureCache.set(key, fastTextMeasure);
|
|
42919
|
+
return fastTextMeasure;
|
|
42920
|
+
}
|
|
42921
|
+
class FastTextMeasureContribution extends DefaultTextMeasureContribution {
|
|
42922
|
+
measureTextWidth(text, options) {
|
|
42923
|
+
const { fontSize, fontFamily = 'Arial,sans-serif', fontWeight = 'normal', fontStyle = 'normal' } = options;
|
|
42924
|
+
const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle);
|
|
42925
|
+
const textMeasure = fastTextMeasure.measure(text);
|
|
42926
|
+
return textMeasure.width;
|
|
42927
|
+
}
|
|
42928
|
+
measureText(text, options) {
|
|
42929
|
+
const { fontSize, fontFamily = 'Arial,sans-serif', fontWeight = 'normal', fontStyle = 'normal' } = options;
|
|
42930
|
+
const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle);
|
|
42931
|
+
const textMeasure = fastTextMeasure.measure(text);
|
|
42932
|
+
return textMeasure;
|
|
42933
|
+
}
|
|
42934
|
+
}
|
|
42935
|
+
class TextMeasureTool {
|
|
42936
|
+
measureText(text, options) {
|
|
42937
|
+
const { fontSize, fontFamily = 'Arial,sans-serif', fontWeight = 'normal', fontStyle = 'normal' } = options;
|
|
42938
|
+
const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle);
|
|
42939
|
+
const textMeasure = fastTextMeasure.measure(text);
|
|
42940
|
+
return textMeasure;
|
|
42941
|
+
}
|
|
42942
|
+
measureTextWidth(text, options) {
|
|
42943
|
+
const { fontSize, fontFamily = 'Arial,sans-serif', fontWeight = 'normal', fontStyle = 'normal' } = options;
|
|
42944
|
+
const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle);
|
|
42945
|
+
const textMeasure = fastTextMeasure.measure(text);
|
|
42946
|
+
return textMeasure.width;
|
|
42947
|
+
}
|
|
42948
|
+
clipText(text, options, width) {
|
|
42949
|
+
if (text.length === 0) {
|
|
42950
|
+
return { str: '', width: 0 };
|
|
42951
|
+
}
|
|
42952
|
+
let length = this.measureTextWidth(text, options);
|
|
42953
|
+
if (length <= width) {
|
|
42954
|
+
return { str: text, width: length };
|
|
42955
|
+
}
|
|
42956
|
+
length = this.measureTextWidth(text[0], options);
|
|
42957
|
+
if (length > width) {
|
|
42958
|
+
return { str: '', width: 0 };
|
|
42959
|
+
}
|
|
42960
|
+
return this._clipText(text, options, width, 0, text.length - 1);
|
|
42961
|
+
}
|
|
42962
|
+
_clipText(text, options, width, leftIdx, rightIdx) {
|
|
42963
|
+
const middleIdx = Math.floor((leftIdx + rightIdx) / 2);
|
|
42964
|
+
const subText = text.substring(0, middleIdx + 1);
|
|
42965
|
+
const strWidth = this.measureTextWidth(subText, options);
|
|
42966
|
+
let length;
|
|
42967
|
+
if (strWidth > width) {
|
|
42968
|
+
if (subText.length <= 1) {
|
|
42969
|
+
return { str: '', width: 0 };
|
|
42970
|
+
}
|
|
42971
|
+
const str = text.substring(0, middleIdx);
|
|
42972
|
+
length = this.measureTextWidth(str, options);
|
|
42973
|
+
if (length <= width) {
|
|
42974
|
+
return { str, width: length };
|
|
42975
|
+
}
|
|
42976
|
+
return this._clipText(text, options, width, leftIdx, middleIdx);
|
|
42977
|
+
}
|
|
42978
|
+
else if (strWidth < width) {
|
|
42979
|
+
if (middleIdx >= text.length - 1) {
|
|
42980
|
+
return { str: text, width: this.measureTextWidth(text, options) };
|
|
42981
|
+
}
|
|
42982
|
+
const str = text.substring(0, middleIdx + 2);
|
|
42983
|
+
length = this.measureTextWidth(str, options);
|
|
42984
|
+
if (length >= width) {
|
|
42985
|
+
return { str: subText, width: strWidth };
|
|
42986
|
+
}
|
|
42987
|
+
return this._clipText(text, options, width, middleIdx, rightIdx);
|
|
42988
|
+
}
|
|
42989
|
+
return { str: subText, width: strWidth };
|
|
42990
|
+
}
|
|
42991
|
+
clipTextWithSuffix(text, options, width, suffix) {
|
|
42992
|
+
if (suffix === '') {
|
|
42993
|
+
return this.clipText(text, options, width);
|
|
42994
|
+
}
|
|
42995
|
+
if (text.length === 0) {
|
|
42996
|
+
return { str: '', width: 0 };
|
|
42997
|
+
}
|
|
42998
|
+
const length = this.measureTextWidth(text, options);
|
|
42999
|
+
if (length <= width) {
|
|
43000
|
+
return { str: text, width: length };
|
|
43001
|
+
}
|
|
43002
|
+
const suffixWidth = this.measureTextWidth(suffix, options);
|
|
43003
|
+
if (suffixWidth > width) {
|
|
43004
|
+
return { str: '', width: 0 };
|
|
43005
|
+
}
|
|
43006
|
+
width -= suffixWidth;
|
|
43007
|
+
const data = this._clipText(text, options, width, 0, text.length - 1);
|
|
43008
|
+
data.str += suffix;
|
|
43009
|
+
data.width += suffixWidth;
|
|
43010
|
+
return data;
|
|
43011
|
+
}
|
|
43012
|
+
}
|
|
43013
|
+
const textMeasure = new TextMeasureTool();
|
|
43014
|
+
function setCustomAlphabetCharSet(str) {
|
|
43015
|
+
customAlphabetCharSet = str;
|
|
43016
|
+
fastTextMeasureCache.clear();
|
|
43017
|
+
}
|
|
43018
|
+
function restoreMeasureText() {
|
|
43019
|
+
container.load(restoreTextMeasureModule);
|
|
43020
|
+
}
|
|
43021
|
+
|
|
43022
|
+
let SuffixTextBeforeRenderContribution = class SuffixTextBeforeRenderContribution {
|
|
43023
|
+
time = BaseRenderContributionTime.afterFillStroke;
|
|
43024
|
+
useStyle = true;
|
|
43025
|
+
order = 0;
|
|
43026
|
+
drawShape(text, context, x, y, doFill, doStroke, fVisible, sVisible, textAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) {
|
|
43027
|
+
const { text: str, underline = textAttribute.underline, lineThrough = textAttribute.lineThrough, direction = textAttribute.direction, whiteSpace = textAttribute.whiteSpace, fontSize = textAttribute.fontSize, verticalMode = textAttribute.verticalMode, ellipsis = textAttribute.ellipsis, textAlign = textAttribute.textAlign, textBaseline = textAttribute.textBaseline, x: originX = textAttribute.x, y: originY = textAttribute.y } = text.attribute;
|
|
43028
|
+
let isEmpty = false;
|
|
43029
|
+
if (Array.isArray(text)) {
|
|
43030
|
+
const layoutData = text.cache?.layoutData;
|
|
43031
|
+
if (ellipsis && layoutData && layoutData.lines.every(line => line.str === '')) {
|
|
43032
|
+
isEmpty = true;
|
|
43033
|
+
}
|
|
43034
|
+
}
|
|
43035
|
+
else {
|
|
43036
|
+
const { cache } = text;
|
|
43037
|
+
if (ellipsis && cache && cache.clipedText === '' && cache.clipedWidth === 0) {
|
|
43038
|
+
isEmpty = true;
|
|
43039
|
+
}
|
|
43040
|
+
}
|
|
43041
|
+
if (!isEmpty) {
|
|
43042
|
+
return;
|
|
43043
|
+
}
|
|
43044
|
+
const textStr = isString$4(ellipsis) ? ellipsis : '...';
|
|
43045
|
+
const lineHeight = calculateLineHeight(text.attribute.lineHeight, fontSize) ?? fontSize;
|
|
43046
|
+
let dy = 0;
|
|
43047
|
+
if (lineHeight !== fontSize) {
|
|
43048
|
+
if (textBaseline === 'top') {
|
|
43049
|
+
dy = (lineHeight - fontSize) / 2;
|
|
43050
|
+
}
|
|
43051
|
+
else if (textBaseline === 'middle') ;
|
|
43052
|
+
else if (textBaseline === 'bottom') {
|
|
43053
|
+
dy = -(lineHeight - fontSize) / 2;
|
|
43054
|
+
}
|
|
43055
|
+
else ;
|
|
43056
|
+
}
|
|
43057
|
+
if (doStroke) {
|
|
43058
|
+
if (strokeCb) {
|
|
43059
|
+
strokeCb(context, text.attribute, textAttribute);
|
|
43060
|
+
}
|
|
43061
|
+
else if (sVisible) {
|
|
43062
|
+
context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute);
|
|
43063
|
+
context.strokeText(textStr, originX, originY + dy);
|
|
43064
|
+
}
|
|
43065
|
+
}
|
|
43066
|
+
if (doFill) {
|
|
43067
|
+
if (fillCb) {
|
|
43068
|
+
fillCb(context, text.attribute, textAttribute);
|
|
43069
|
+
}
|
|
43070
|
+
else if (fVisible) {
|
|
43071
|
+
context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute);
|
|
43072
|
+
context.fillText(textStr, originX, originY + dy);
|
|
43073
|
+
this.drawUnderLine(underline, lineThrough, text, originX, originY + dy, 0, textAttribute, context, textStr);
|
|
43074
|
+
}
|
|
43075
|
+
}
|
|
43076
|
+
}
|
|
43077
|
+
drawUnderLine(underline, lineThrough, text, x, y, z, textAttribute, context, textStr) {
|
|
43078
|
+
if (lineThrough + underline <= 0) {
|
|
43079
|
+
return;
|
|
43080
|
+
}
|
|
43081
|
+
const { textAlign = textAttribute.textAlign, textBaseline = textAttribute.textBaseline, fontSize = textAttribute.fontSize, fontFamily = textAttribute.fontFamily, fontWeight = textAttribute.fontWeight, fontStyle = textAttribute.fontStyle, fill = textAttribute.fill, opacity = textAttribute.opacity, underlineOffset = textAttribute.underlineOffset, underlineDash = textAttribute.underlineDash, fillOpacity = textAttribute.fillOpacity } = text.attribute;
|
|
43082
|
+
if (!underline && !lineThrough) {
|
|
43083
|
+
return;
|
|
43084
|
+
}
|
|
43085
|
+
const w = textMeasure.measureTextWidth(textStr, {
|
|
43086
|
+
fontSize,
|
|
43087
|
+
fontFamily,
|
|
43088
|
+
fontWeight,
|
|
43089
|
+
fontStyle
|
|
43090
|
+
});
|
|
43091
|
+
const offsetX = textDrawOffsetX(textAlign, w);
|
|
43092
|
+
const offsetY = textLayoutOffsetY(textBaseline, fontSize, fontSize);
|
|
43093
|
+
const attribute = { lineWidth: 0, stroke: fill, opacity, strokeOpacity: fillOpacity };
|
|
43094
|
+
if (underline) {
|
|
43095
|
+
attribute.lineWidth = underline;
|
|
43096
|
+
context.setStrokeStyle(text, attribute, x, y, textAttribute);
|
|
43097
|
+
context.setLineDash(underlineDash);
|
|
43098
|
+
context.beginPath();
|
|
43099
|
+
const dy = y + offsetY + fontSize + underlineOffset;
|
|
43100
|
+
context.moveTo(x + offsetX, dy, z);
|
|
43101
|
+
context.lineTo(x + offsetX + w, dy, z);
|
|
43102
|
+
context.stroke();
|
|
43103
|
+
}
|
|
43104
|
+
if (lineThrough) {
|
|
43105
|
+
attribute.lineWidth = lineThrough;
|
|
43106
|
+
context.setStrokeStyle(text, attribute, x, y, textAttribute);
|
|
43107
|
+
context.beginPath();
|
|
43108
|
+
const dy = y + offsetY + fontSize / 2;
|
|
43109
|
+
context.moveTo(x + offsetX, dy, z);
|
|
43110
|
+
context.lineTo(x + offsetX + w, dy, z);
|
|
43111
|
+
context.stroke();
|
|
43112
|
+
}
|
|
43113
|
+
}
|
|
43114
|
+
};
|
|
43115
|
+
SuffixTextBeforeRenderContribution = __decorate([
|
|
43116
|
+
injectable()
|
|
43117
|
+
], SuffixTextBeforeRenderContribution);
|
|
43118
|
+
|
|
42832
43119
|
var splitModule = new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
42833
43120
|
if (isBound(SplitRectBeforeRenderContribution$1)) {
|
|
42834
43121
|
rebind(SplitRectBeforeRenderContribution$1).to(SplitRectBeforeRenderContribution).inSingletonScope();
|
|
@@ -42873,6 +43160,8 @@
|
|
|
42873
43160
|
bind(GroupRenderContribution).toService(ClipBodyGroupAfterRenderContribution);
|
|
42874
43161
|
bind(VTableDrawItemInterceptorContribution).toSelf().inSingletonScope();
|
|
42875
43162
|
bind(DrawItemInterceptor).toService(VTableDrawItemInterceptorContribution);
|
|
43163
|
+
bind(SuffixTextBeforeRenderContribution).toSelf().inSingletonScope();
|
|
43164
|
+
bind(TextRenderContribution).toService(SuffixTextBeforeRenderContribution);
|
|
42876
43165
|
});
|
|
42877
43166
|
|
|
42878
43167
|
function computeColsWidth(table, colStart, colEnd, update) {
|
|
@@ -42966,7 +43255,7 @@
|
|
|
42966
43255
|
table.scenegraph.updateColWidth(col, newColWidth - oldColWidths[col], true, true);
|
|
42967
43256
|
}
|
|
42968
43257
|
}
|
|
42969
|
-
table.scenegraph.updateContainer();
|
|
43258
|
+
table.scenegraph.updateContainer(true);
|
|
42970
43259
|
}
|
|
42971
43260
|
}
|
|
42972
43261
|
function computeColWidth(col, startRow, endRow, table, forceCompute = false) {
|
|
@@ -44370,7 +44659,6 @@
|
|
|
44370
44659
|
this.currentRow = endRow;
|
|
44371
44660
|
this.rowEnd = endRow;
|
|
44372
44661
|
this.rowUpdatePos = this.rowEnd;
|
|
44373
|
-
this.referenceRow = this.rowStart + Math.floor((endRow - this.rowStart) / 2);
|
|
44374
44662
|
this.table.scenegraph.updateContainer();
|
|
44375
44663
|
this.table.scenegraph.updateBorderSizeAndPosition();
|
|
44376
44664
|
}
|
|
@@ -44416,7 +44704,6 @@
|
|
|
44416
44704
|
this.currentCol = endCol;
|
|
44417
44705
|
this.colEnd = endCol;
|
|
44418
44706
|
this.colUpdatePos = this.colEnd;
|
|
44419
|
-
this.referenceCol = this.colStart + Math.floor((endCol - this.colStart) / 2);
|
|
44420
44707
|
this.table.scenegraph.updateContainer();
|
|
44421
44708
|
this.table.scenegraph.updateBorderSizeAndPosition();
|
|
44422
44709
|
}
|
|
@@ -45580,9 +45867,10 @@
|
|
|
45580
45867
|
break;
|
|
45581
45868
|
}
|
|
45582
45869
|
[colStart, colEnd].forEach((col) => {
|
|
45583
|
-
|
|
45870
|
+
const style = table._getCellStyle(col, row);
|
|
45871
|
+
if (style?.textStick) {
|
|
45584
45872
|
const cellGroup = table.scenegraph.getCell(col, row);
|
|
45585
|
-
adjustCellContentHorizontalLayout(cellGroup, frozenColsWidth + table.tableX, table.tableNoFrameWidth - table.getRightFrozenColsWidth() + table.tableX, changedCells, table);
|
|
45873
|
+
adjustCellContentHorizontalLayout(cellGroup, frozenColsWidth + table.tableX, table.tableNoFrameWidth - table.getRightFrozenColsWidth() + table.tableX, changedCells, style?.textStickBaseOnAlign, table);
|
|
45586
45874
|
}
|
|
45587
45875
|
});
|
|
45588
45876
|
}
|
|
@@ -45591,10 +45879,10 @@
|
|
|
45591
45879
|
break;
|
|
45592
45880
|
}
|
|
45593
45881
|
[rowStart, rowEnd].forEach((row) => {
|
|
45594
|
-
|
|
45595
|
-
|
|
45882
|
+
const style = table._getCellStyle(col, row);
|
|
45883
|
+
if (style?.textStick && table.internalProps.layoutMap.rowHierarchyType !== 'tree') {
|
|
45596
45884
|
const cellGroup = table.scenegraph.getCell(col, row);
|
|
45597
|
-
adjustCellContentVerticalLayout(cellGroup, frozenRowsHeight + table.tableY, table.tableNoFrameHeight - table.getBottomFrozenRowsHeight() + table.tableY, changedCells, table);
|
|
45885
|
+
adjustCellContentVerticalLayout(cellGroup, frozenRowsHeight + table.tableY, table.tableNoFrameHeight - table.getBottomFrozenRowsHeight() + table.tableY, changedCells, style?.textStickBaseOnAlign, table);
|
|
45598
45886
|
}
|
|
45599
45887
|
});
|
|
45600
45888
|
}
|
|
@@ -45603,9 +45891,10 @@
|
|
|
45603
45891
|
break;
|
|
45604
45892
|
}
|
|
45605
45893
|
[rowStart, rowEnd].forEach((row) => {
|
|
45606
|
-
|
|
45894
|
+
const style = table._getCellStyle(col, row);
|
|
45895
|
+
if (style?.textStick) {
|
|
45607
45896
|
const cellGroup = table.scenegraph.getCell(col, row);
|
|
45608
|
-
adjustCellContentVerticalLayout(cellGroup, frozenRowsHeight + table.tableY, table.tableNoFrameHeight - table.getBottomFrozenRowsHeight() + table.tableY, changedCells, table);
|
|
45897
|
+
adjustCellContentVerticalLayout(cellGroup, frozenRowsHeight + table.tableY, table.tableNoFrameHeight - table.getBottomFrozenRowsHeight() + table.tableY, changedCells, style?.textStickBaseOnAlign, table);
|
|
45609
45898
|
}
|
|
45610
45899
|
});
|
|
45611
45900
|
}
|
|
@@ -45614,14 +45903,15 @@
|
|
|
45614
45903
|
break;
|
|
45615
45904
|
}
|
|
45616
45905
|
[colStart, colEnd].forEach((col) => {
|
|
45906
|
+
const style = table._getCellStyle(col, row);
|
|
45617
45907
|
if (table._getCellStyle(col, row)?.textStick) {
|
|
45618
45908
|
const cellGroup = table.scenegraph.getCell(col, row);
|
|
45619
|
-
adjustCellContentHorizontalLayout(cellGroup, frozenColsWidth + table.tableX, table.tableNoFrameWidth - table.getRightFrozenColsWidth() + table.tableX, changedCells, table);
|
|
45909
|
+
adjustCellContentHorizontalLayout(cellGroup, frozenColsWidth + table.tableX, table.tableNoFrameWidth - table.getRightFrozenColsWidth() + table.tableX, changedCells, style?.textStickBaseOnAlign, table);
|
|
45620
45910
|
}
|
|
45621
45911
|
});
|
|
45622
45912
|
}
|
|
45623
45913
|
}
|
|
45624
|
-
function adjustCellContentVerticalLayout(cellGroup, minTop, maxTop, changedCells, table) {
|
|
45914
|
+
function adjustCellContentVerticalLayout(cellGroup, minTop, maxTop, changedCells, textStickBaseOnAlign, table) {
|
|
45625
45915
|
if (isNumber$4(cellGroup.mergeStartCol) &&
|
|
45626
45916
|
isNumber$4(cellGroup.mergeStartRow) &&
|
|
45627
45917
|
isNumber$4(cellGroup.mergeEndCol) &&
|
|
@@ -45630,15 +45920,15 @@
|
|
|
45630
45920
|
for (let col = colStart; col <= colEnd; col++) {
|
|
45631
45921
|
for (let row = rowStart; row <= rowEnd; row++) {
|
|
45632
45922
|
const singleCellGroup = table.scenegraph.getCell(col, row);
|
|
45633
|
-
dealVertical(singleCellGroup, minTop, maxTop, changedCells);
|
|
45923
|
+
dealVertical(singleCellGroup, minTop, maxTop, changedCells, textStickBaseOnAlign);
|
|
45634
45924
|
}
|
|
45635
45925
|
}
|
|
45636
45926
|
}
|
|
45637
45927
|
else {
|
|
45638
|
-
dealVertical(cellGroup, minTop, maxTop, changedCells);
|
|
45928
|
+
dealVertical(cellGroup, minTop, maxTop, changedCells, textStickBaseOnAlign);
|
|
45639
45929
|
}
|
|
45640
45930
|
}
|
|
45641
|
-
function dealVertical(cellGroup, minTop, maxTop, changedCells) {
|
|
45931
|
+
function dealVertical(cellGroup, minTop, maxTop, changedCells, textStickBaseOnAlign) {
|
|
45642
45932
|
const graphic = cellGroup.getChildByName('text', true) || cellGroup.getChildByName('image', true);
|
|
45643
45933
|
if (!graphic) {
|
|
45644
45934
|
return;
|
|
@@ -45653,10 +45943,30 @@
|
|
|
45653
45943
|
return;
|
|
45654
45944
|
}
|
|
45655
45945
|
}
|
|
45946
|
+
const textBaseline = graphic.textBaseline ?? 'top';
|
|
45656
45947
|
graphic.AABBBounds.width();
|
|
45657
45948
|
const textTop = graphic.globalAABBBounds.y1;
|
|
45658
45949
|
const textBottom = graphic.globalAABBBounds.y2;
|
|
45659
|
-
if (
|
|
45950
|
+
if (textBaseline === 'middle' && textStickBaseOnAlign) {
|
|
45951
|
+
const cellTop = cellGroup.globalAABBBounds.y1 + (cellGroup.firstChild?.attribute.dy ?? 0);
|
|
45952
|
+
const cellBottom = cellTop + (cellGroup.contentHeight ?? cellGroup.attribute.height ?? 0);
|
|
45953
|
+
if (cellTop < minTop || cellBottom > maxTop) {
|
|
45954
|
+
const visibleCellTop = Math.max(cellTop, minTop);
|
|
45955
|
+
const visibleCellBottom = Math.min(cellBottom, maxTop);
|
|
45956
|
+
const delta = graphic.globalTransMatrix.f - (visibleCellBottom + visibleCellTop) / 2;
|
|
45957
|
+
!changedCells.has(`${cellGroup.col}-${cellGroup.row}`) &&
|
|
45958
|
+
changedCells.set(`${cellGroup.col}-${cellGroup.row}`, {
|
|
45959
|
+
col: cellGroup.col,
|
|
45960
|
+
row: cellGroup.row,
|
|
45961
|
+
dx: cellGroup.firstChild?.attribute.dx ?? 0,
|
|
45962
|
+
dy: cellGroup.firstChild?.attribute.dy ?? 0
|
|
45963
|
+
});
|
|
45964
|
+
cellGroup.forEachChildren((child) => {
|
|
45965
|
+
child.setAttribute('dy', (child.attribute.dy ?? 0) - delta + 2);
|
|
45966
|
+
});
|
|
45967
|
+
}
|
|
45968
|
+
}
|
|
45969
|
+
else if (textTop < minTop) {
|
|
45660
45970
|
const deltaHeight = textTop - minTop;
|
|
45661
45971
|
!changedCells.has(`${cellGroup.col}-${cellGroup.row}`) &&
|
|
45662
45972
|
changedCells.set(`${cellGroup.col}-${cellGroup.row}`, {
|
|
@@ -45683,7 +45993,7 @@
|
|
|
45683
45993
|
});
|
|
45684
45994
|
}
|
|
45685
45995
|
}
|
|
45686
|
-
function adjustCellContentHorizontalLayout(cellGroup, minLeft, maxLeft, changedCells, table) {
|
|
45996
|
+
function adjustCellContentHorizontalLayout(cellGroup, minLeft, maxLeft, changedCells, textStickBaseOnAlign, table) {
|
|
45687
45997
|
if (isNumber$4(cellGroup.mergeStartCol) &&
|
|
45688
45998
|
isNumber$4(cellGroup.mergeStartRow) &&
|
|
45689
45999
|
isNumber$4(cellGroup.mergeEndCol) &&
|
|
@@ -45692,23 +46002,53 @@
|
|
|
45692
46002
|
for (let col = colStart; col <= colEnd; col++) {
|
|
45693
46003
|
for (let row = rowStart; row <= rowEnd; row++) {
|
|
45694
46004
|
const singleCellGroup = table.scenegraph.getCell(col, row);
|
|
45695
|
-
dealHorizontal(singleCellGroup, minLeft, maxLeft, changedCells);
|
|
46005
|
+
dealHorizontal(singleCellGroup, minLeft, maxLeft, changedCells, textStickBaseOnAlign);
|
|
45696
46006
|
}
|
|
45697
46007
|
}
|
|
45698
46008
|
}
|
|
45699
46009
|
else {
|
|
45700
|
-
dealHorizontal(cellGroup, minLeft, maxLeft, changedCells);
|
|
46010
|
+
dealHorizontal(cellGroup, minLeft, maxLeft, changedCells, textStickBaseOnAlign);
|
|
45701
46011
|
}
|
|
45702
46012
|
}
|
|
45703
|
-
function dealHorizontal(cellGroup, minLeft, maxLeft, changedCells) {
|
|
45704
|
-
const
|
|
45705
|
-
if (!
|
|
46013
|
+
function dealHorizontal(cellGroup, minLeft, maxLeft, changedCells, textStickBaseOnAlign) {
|
|
46014
|
+
const graphic = cellGroup.getChildByName('text', true) || cellGroup.getChildByName('image', true);
|
|
46015
|
+
if (!graphic) {
|
|
45706
46016
|
return;
|
|
45707
46017
|
}
|
|
45708
|
-
|
|
45709
|
-
|
|
45710
|
-
|
|
45711
|
-
|
|
46018
|
+
if (graphic.type === 'image') {
|
|
46019
|
+
const { image: url } = graphic.attribute;
|
|
46020
|
+
if (!url || !graphic.resources) {
|
|
46021
|
+
return;
|
|
46022
|
+
}
|
|
46023
|
+
const res = graphic.resources.get(url);
|
|
46024
|
+
if (res.state !== 'success') {
|
|
46025
|
+
return;
|
|
46026
|
+
}
|
|
46027
|
+
}
|
|
46028
|
+
const textAlign = graphic.attribute.textAlign ?? graphic.textAlign ?? 'left';
|
|
46029
|
+
graphic.AABBBounds.width();
|
|
46030
|
+
const textLeft = graphic.globalAABBBounds.x1;
|
|
46031
|
+
const textRight = graphic.globalAABBBounds.x2;
|
|
46032
|
+
if (textAlign === 'center' && textStickBaseOnAlign) {
|
|
46033
|
+
const cellLeft = cellGroup.globalAABBBounds.x1 + (cellGroup.firstChild?.attribute.dx ?? 0);
|
|
46034
|
+
const cellRight = cellLeft + (cellGroup.contentWidth ?? cellGroup.attribute.width ?? 0);
|
|
46035
|
+
if (cellLeft < minLeft || cellRight > maxLeft) {
|
|
46036
|
+
const visibleCellLeft = Math.max(cellLeft, minLeft);
|
|
46037
|
+
const visibleCellRight = Math.min(cellRight, maxLeft);
|
|
46038
|
+
const delta = graphic.globalTransMatrix.e - (visibleCellRight + visibleCellLeft) / 2;
|
|
46039
|
+
!changedCells.has(`${cellGroup.col}-${cellGroup.row}`) &&
|
|
46040
|
+
changedCells.set(`${cellGroup.col}-${cellGroup.row}`, {
|
|
46041
|
+
col: cellGroup.col,
|
|
46042
|
+
row: cellGroup.row,
|
|
46043
|
+
dx: cellGroup.firstChild?.attribute.dx ?? 0,
|
|
46044
|
+
dy: cellGroup.firstChild?.attribute.dy ?? 0
|
|
46045
|
+
});
|
|
46046
|
+
cellGroup.forEachChildren((child) => {
|
|
46047
|
+
child.setAttribute('dx', (child.attribute.dx ?? 0) - delta + 2);
|
|
46048
|
+
});
|
|
46049
|
+
}
|
|
46050
|
+
}
|
|
46051
|
+
else if (textLeft < minLeft) {
|
|
45712
46052
|
const deltaWidth = textLeft - minLeft;
|
|
45713
46053
|
!changedCells.has(`${cellGroup.col}-${cellGroup.row}`) &&
|
|
45714
46054
|
changedCells.set(`${cellGroup.col}-${cellGroup.row}`, {
|
|
@@ -45775,7 +46115,7 @@
|
|
|
45775
46115
|
scene.colHeaderGroup.setAttribute('x', scene.cornerHeaderGroup.attribute.width);
|
|
45776
46116
|
scene.updateContainer();
|
|
45777
46117
|
scene.updateBorderSizeAndPosition();
|
|
45778
|
-
if (!scene.isPivot && !scene.transpose) {
|
|
46118
|
+
if (!scene.isPivot && !scene.table.transpose) {
|
|
45779
46119
|
scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1);
|
|
45780
46120
|
}
|
|
45781
46121
|
scene.hasFrozen = true;
|
|
@@ -45811,7 +46151,7 @@
|
|
|
45811
46151
|
scene.colHeaderGroup.setAttribute('x', scene.cornerHeaderGroup.attribute.width);
|
|
45812
46152
|
scene.updateContainer();
|
|
45813
46153
|
scene.updateBorderSizeAndPosition();
|
|
45814
|
-
if (!scene.isPivot && !scene.transpose) {
|
|
46154
|
+
if (!scene.isPivot && !scene.table.transpose) {
|
|
45815
46155
|
scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1);
|
|
45816
46156
|
}
|
|
45817
46157
|
scene.hasFrozen = true;
|
|
@@ -46270,151 +46610,6 @@
|
|
|
46270
46610
|
return x;
|
|
46271
46611
|
}
|
|
46272
46612
|
|
|
46273
|
-
let customAlphabetCharSet = '';
|
|
46274
|
-
const textMeasureModule = new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
46275
|
-
if (isBound(TextMeasureContribution)) {
|
|
46276
|
-
rebind(TextMeasureContribution).to(FastTextMeasureContribution).inSingletonScope();
|
|
46277
|
-
}
|
|
46278
|
-
else {
|
|
46279
|
-
bind(TextMeasureContribution).to(FastTextMeasureContribution).inSingletonScope();
|
|
46280
|
-
}
|
|
46281
|
-
});
|
|
46282
|
-
const restoreTextMeasureModule = new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
46283
|
-
if (isBound(TextMeasureContribution)) {
|
|
46284
|
-
rebind(TextMeasureContribution).to(DefaultTextMeasureContribution).inSingletonScope();
|
|
46285
|
-
}
|
|
46286
|
-
else {
|
|
46287
|
-
bind(TextMeasureContribution).to(DefaultTextMeasureContribution).inSingletonScope();
|
|
46288
|
-
}
|
|
46289
|
-
});
|
|
46290
|
-
const initTextMeasure = (textSpec, option, useNaiveCanvas) => {
|
|
46291
|
-
return new TextMeasure$1({
|
|
46292
|
-
defaultFontParams: {
|
|
46293
|
-
fontFamily: DefaultTextStyle.fontFamily,
|
|
46294
|
-
fontSize: DefaultTextStyle.fontSize
|
|
46295
|
-
},
|
|
46296
|
-
getTextBounds: useNaiveCanvas ? undefined : getTextBounds$1,
|
|
46297
|
-
specialCharSet: `{}()//&-/: .,@%'"~…=${TextMeasure$1.ALPHABET_CHAR_SET}${TextMeasure$1.ALPHABET_CHAR_SET.toUpperCase()}0123456789${customAlphabetCharSet}`,
|
|
46298
|
-
...(option ?? {})
|
|
46299
|
-
}, textSpec);
|
|
46300
|
-
};
|
|
46301
|
-
const fastTextMeasureCache = new Map();
|
|
46302
|
-
function getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle = 'normal') {
|
|
46303
|
-
const key = `${fontSize}-${fontWeight}-${fontFamily}-${fontStyle}`;
|
|
46304
|
-
const cache = fastTextMeasureCache.get(key);
|
|
46305
|
-
if (cache) {
|
|
46306
|
-
return cache;
|
|
46307
|
-
}
|
|
46308
|
-
const fastTextMeasure = initTextMeasure({
|
|
46309
|
-
fontSize,
|
|
46310
|
-
fontFamily,
|
|
46311
|
-
fontWeight,
|
|
46312
|
-
fontStyle
|
|
46313
|
-
});
|
|
46314
|
-
fastTextMeasureCache.set(key, fastTextMeasure);
|
|
46315
|
-
return fastTextMeasure;
|
|
46316
|
-
}
|
|
46317
|
-
class FastTextMeasureContribution extends DefaultTextMeasureContribution {
|
|
46318
|
-
measureTextWidth(text, options) {
|
|
46319
|
-
const { fontSize, fontFamily = 'Arial,sans-serif', fontWeight = 'normal', fontStyle = 'normal' } = options;
|
|
46320
|
-
const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle);
|
|
46321
|
-
const textMeasure = fastTextMeasure.measure(text);
|
|
46322
|
-
return textMeasure.width;
|
|
46323
|
-
}
|
|
46324
|
-
measureText(text, options) {
|
|
46325
|
-
const { fontSize, fontFamily = 'Arial,sans-serif', fontWeight = 'normal', fontStyle = 'normal' } = options;
|
|
46326
|
-
const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle);
|
|
46327
|
-
const textMeasure = fastTextMeasure.measure(text);
|
|
46328
|
-
return textMeasure;
|
|
46329
|
-
}
|
|
46330
|
-
}
|
|
46331
|
-
class TextMeasureTool {
|
|
46332
|
-
measureText(text, options) {
|
|
46333
|
-
const { fontSize, fontFamily = 'Arial,sans-serif', fontWeight = 'normal', fontStyle = 'normal' } = options;
|
|
46334
|
-
const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle);
|
|
46335
|
-
const textMeasure = fastTextMeasure.measure(text);
|
|
46336
|
-
return textMeasure;
|
|
46337
|
-
}
|
|
46338
|
-
measureTextWidth(text, options) {
|
|
46339
|
-
const { fontSize, fontFamily = 'Arial,sans-serif', fontWeight = 'normal', fontStyle = 'normal' } = options;
|
|
46340
|
-
const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle);
|
|
46341
|
-
const textMeasure = fastTextMeasure.measure(text);
|
|
46342
|
-
return textMeasure.width;
|
|
46343
|
-
}
|
|
46344
|
-
clipText(text, options, width) {
|
|
46345
|
-
if (text.length === 0) {
|
|
46346
|
-
return { str: '', width: 0 };
|
|
46347
|
-
}
|
|
46348
|
-
let length = this.measureTextWidth(text, options);
|
|
46349
|
-
if (length <= width) {
|
|
46350
|
-
return { str: text, width: length };
|
|
46351
|
-
}
|
|
46352
|
-
length = this.measureTextWidth(text[0], options);
|
|
46353
|
-
if (length > width) {
|
|
46354
|
-
return { str: '', width: 0 };
|
|
46355
|
-
}
|
|
46356
|
-
return this._clipText(text, options, width, 0, text.length - 1);
|
|
46357
|
-
}
|
|
46358
|
-
_clipText(text, options, width, leftIdx, rightIdx) {
|
|
46359
|
-
const middleIdx = Math.floor((leftIdx + rightIdx) / 2);
|
|
46360
|
-
const subText = text.substring(0, middleIdx + 1);
|
|
46361
|
-
const strWidth = this.measureTextWidth(subText, options);
|
|
46362
|
-
let length;
|
|
46363
|
-
if (strWidth > width) {
|
|
46364
|
-
if (subText.length <= 1) {
|
|
46365
|
-
return { str: '', width: 0 };
|
|
46366
|
-
}
|
|
46367
|
-
const str = text.substring(0, middleIdx);
|
|
46368
|
-
length = this.measureTextWidth(str, options);
|
|
46369
|
-
if (length <= width) {
|
|
46370
|
-
return { str, width: length };
|
|
46371
|
-
}
|
|
46372
|
-
return this._clipText(text, options, width, leftIdx, middleIdx);
|
|
46373
|
-
}
|
|
46374
|
-
else if (strWidth < width) {
|
|
46375
|
-
if (middleIdx >= text.length - 1) {
|
|
46376
|
-
return { str: text, width: this.measureTextWidth(text, options) };
|
|
46377
|
-
}
|
|
46378
|
-
const str = text.substring(0, middleIdx + 2);
|
|
46379
|
-
length = this.measureTextWidth(str, options);
|
|
46380
|
-
if (length >= width) {
|
|
46381
|
-
return { str: subText, width: strWidth };
|
|
46382
|
-
}
|
|
46383
|
-
return this._clipText(text, options, width, middleIdx, rightIdx);
|
|
46384
|
-
}
|
|
46385
|
-
return { str: subText, width: strWidth };
|
|
46386
|
-
}
|
|
46387
|
-
clipTextWithSuffix(text, options, width, suffix) {
|
|
46388
|
-
if (suffix === '') {
|
|
46389
|
-
return this.clipText(text, options, width);
|
|
46390
|
-
}
|
|
46391
|
-
if (text.length === 0) {
|
|
46392
|
-
return { str: '', width: 0 };
|
|
46393
|
-
}
|
|
46394
|
-
const length = this.measureTextWidth(text, options);
|
|
46395
|
-
if (length <= width) {
|
|
46396
|
-
return { str: text, width: length };
|
|
46397
|
-
}
|
|
46398
|
-
const suffixWidth = this.measureTextWidth(suffix, options);
|
|
46399
|
-
if (suffixWidth > width) {
|
|
46400
|
-
return { str: '', width: 0 };
|
|
46401
|
-
}
|
|
46402
|
-
width -= suffixWidth;
|
|
46403
|
-
const data = this._clipText(text, options, width, 0, text.length - 1);
|
|
46404
|
-
data.str += suffix;
|
|
46405
|
-
data.width += suffixWidth;
|
|
46406
|
-
return data;
|
|
46407
|
-
}
|
|
46408
|
-
}
|
|
46409
|
-
const textMeasure = new TextMeasureTool();
|
|
46410
|
-
function setCustomAlphabetCharSet(str) {
|
|
46411
|
-
customAlphabetCharSet = str;
|
|
46412
|
-
fastTextMeasureCache.clear();
|
|
46413
|
-
}
|
|
46414
|
-
function restoreMeasureText() {
|
|
46415
|
-
container.load(restoreTextMeasureModule);
|
|
46416
|
-
}
|
|
46417
|
-
|
|
46418
46613
|
function hideHoverIcon(col, row, scene) {
|
|
46419
46614
|
if (col === -1 || row === -1) {
|
|
46420
46615
|
return;
|
|
@@ -46648,7 +46843,8 @@
|
|
|
46648
46843
|
}
|
|
46649
46844
|
function updateCellRangeIcon(col, row, filter, dealer, scene) {
|
|
46650
46845
|
const cellGroup = scene.getCell(col, row);
|
|
46651
|
-
if (
|
|
46846
|
+
if (cellGroup.role === 'cell' &&
|
|
46847
|
+
isValid$3(cellGroup.mergeStartCol) &&
|
|
46652
46848
|
isValid$3(cellGroup.mergeStartRow) &&
|
|
46653
46849
|
isValid$3(cellGroup.mergeEndCol) &&
|
|
46654
46850
|
isValid$3(cellGroup.mergeEndRow)) {
|
|
@@ -47064,13 +47260,13 @@
|
|
|
47064
47260
|
stage;
|
|
47065
47261
|
table;
|
|
47066
47262
|
isPivot;
|
|
47067
|
-
transpose;
|
|
47068
47263
|
hasFrozen;
|
|
47069
47264
|
frozenColCount;
|
|
47070
47265
|
frozenRowCount;
|
|
47071
47266
|
clear;
|
|
47072
47267
|
mergeMap;
|
|
47073
47268
|
_dealAutoFillHeightOriginRowsHeight;
|
|
47269
|
+
_needUpdateContainer = false;
|
|
47074
47270
|
constructor(table) {
|
|
47075
47271
|
this.table = table;
|
|
47076
47272
|
this.hasFrozen = false;
|
|
@@ -47142,7 +47338,6 @@
|
|
|
47142
47338
|
}
|
|
47143
47339
|
initSceneGraph() {
|
|
47144
47340
|
this.isPivot = this.table.isPivotTable();
|
|
47145
|
-
this.transpose = this.table.options.transpose;
|
|
47146
47341
|
initSceneGraph(this);
|
|
47147
47342
|
}
|
|
47148
47343
|
clearCells() {
|
|
@@ -47460,7 +47655,7 @@
|
|
|
47460
47655
|
updateColWidth(col, detaX, skipUpdateContainer, skipTableWidthMap) {
|
|
47461
47656
|
updateColWidth(this, col, Math.round(detaX), skipTableWidthMap);
|
|
47462
47657
|
if (!skipUpdateContainer) {
|
|
47463
|
-
this.updateContainer();
|
|
47658
|
+
this.updateContainer(true);
|
|
47464
47659
|
}
|
|
47465
47660
|
}
|
|
47466
47661
|
updateChartSize(col) {
|
|
@@ -47470,7 +47665,7 @@
|
|
|
47470
47665
|
this.table.isPivotChart() && updateChartState(this, datum);
|
|
47471
47666
|
}
|
|
47472
47667
|
updateCheckboxCellState(col, row, checked) {
|
|
47473
|
-
if (this.transpose) {
|
|
47668
|
+
if (this.table.transpose) {
|
|
47474
47669
|
this.bodyGroup.children?.forEach((columnGroup) => {
|
|
47475
47670
|
columnGroup
|
|
47476
47671
|
.getChildAt(row)
|
|
@@ -47494,7 +47689,7 @@
|
|
|
47494
47689
|
}
|
|
47495
47690
|
}
|
|
47496
47691
|
updateHeaderCheckboxCellState(col, row, checked) {
|
|
47497
|
-
if (this.transpose) {
|
|
47692
|
+
if (this.table.transpose) {
|
|
47498
47693
|
this.rowHeaderGroup.children?.forEach((columnGroup) => {
|
|
47499
47694
|
columnGroup
|
|
47500
47695
|
.getChildAt(row)
|
|
@@ -47805,7 +48000,7 @@
|
|
|
47805
48000
|
this.updateNextFrame();
|
|
47806
48001
|
}
|
|
47807
48002
|
afterScenegraphCreated() {
|
|
47808
|
-
if (!this.isPivot && !this.transpose) {
|
|
48003
|
+
if (!this.isPivot && !this.table.transpose) {
|
|
47809
48004
|
this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
|
|
47810
48005
|
}
|
|
47811
48006
|
this.table.stateManager.checkFrozen();
|
|
@@ -48021,11 +48216,26 @@
|
|
|
48021
48216
|
this.bottomFrozenGroup.setAttribute('x', this.table.getFrozenColsWidth());
|
|
48022
48217
|
this.bodyGroup.setAttribute('x', this.rowHeaderGroup.attribute.width);
|
|
48023
48218
|
}
|
|
48024
|
-
updateContainer() {
|
|
48025
|
-
|
|
48026
|
-
|
|
48027
|
-
|
|
48028
|
-
|
|
48219
|
+
updateContainer(async = false) {
|
|
48220
|
+
if (async) {
|
|
48221
|
+
if (!this._needUpdateContainer) {
|
|
48222
|
+
this._needUpdateContainer = true;
|
|
48223
|
+
setTimeout(() => {
|
|
48224
|
+
this.updateContainerAttrWidthAndX();
|
|
48225
|
+
this.updateTableSize();
|
|
48226
|
+
this.component.updateScrollBar();
|
|
48227
|
+
this.updateNextFrame();
|
|
48228
|
+
this._needUpdateContainer = false;
|
|
48229
|
+
}, 0);
|
|
48230
|
+
}
|
|
48231
|
+
}
|
|
48232
|
+
else {
|
|
48233
|
+
this.updateContainerAttrWidthAndX();
|
|
48234
|
+
this.updateTableSize();
|
|
48235
|
+
this.component.updateScrollBar();
|
|
48236
|
+
this.updateNextFrame();
|
|
48237
|
+
this._needUpdateContainer = false;
|
|
48238
|
+
}
|
|
48029
48239
|
}
|
|
48030
48240
|
updateCellContentWhileResize(col, row) {
|
|
48031
48241
|
const type = this.table.getBodyColumnType(col, row);
|
|
@@ -48127,7 +48337,7 @@
|
|
|
48127
48337
|
}
|
|
48128
48338
|
sortCell() {
|
|
48129
48339
|
if (this.isPivot) ;
|
|
48130
|
-
else if (this.transpose) {
|
|
48340
|
+
else if (this.table.transpose) {
|
|
48131
48341
|
this.proxy.sortCellHorizontal();
|
|
48132
48342
|
}
|
|
48133
48343
|
else {
|
|
@@ -48206,7 +48416,7 @@
|
|
|
48206
48416
|
}
|
|
48207
48417
|
}
|
|
48208
48418
|
this.table.stateManager.checkFrozen();
|
|
48209
|
-
if (!this.isPivot && !this.transpose) {
|
|
48419
|
+
if (!this.isPivot && !this.table.transpose) {
|
|
48210
48420
|
this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
|
|
48211
48421
|
}
|
|
48212
48422
|
this.component.updateScrollBar();
|
|
@@ -48217,7 +48427,7 @@
|
|
|
48217
48427
|
this.recalculateColWidths();
|
|
48218
48428
|
this.recalculateRowHeights();
|
|
48219
48429
|
this.table.stateManager.checkFrozen();
|
|
48220
|
-
if (!this.isPivot && !this.transpose) {
|
|
48430
|
+
if (!this.isPivot && !this.table.transpose) {
|
|
48221
48431
|
this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
|
|
48222
48432
|
}
|
|
48223
48433
|
this.component.updateScrollBar();
|
|
@@ -48284,7 +48494,8 @@
|
|
|
48284
48494
|
|
|
48285
48495
|
function updateCell(scenegraph, col, row) {
|
|
48286
48496
|
const cellGroup = scenegraph.highPerformanceGetCell(col, row);
|
|
48287
|
-
if (
|
|
48497
|
+
if (cellGroup.role === 'cell' &&
|
|
48498
|
+
isValid$3(cellGroup.mergeStartCol) &&
|
|
48288
48499
|
isValid$3(cellGroup.mergeStartRow) &&
|
|
48289
48500
|
isValid$3(cellGroup.mergeEndCol) &&
|
|
48290
48501
|
isValid$3(cellGroup.mergeEndRow)) {
|
|
@@ -50241,39 +50452,6 @@
|
|
|
50241
50452
|
function bindTableGroupListener(eventManager) {
|
|
50242
50453
|
const table = eventManager.table;
|
|
50243
50454
|
const stateManager = table.stateManager;
|
|
50244
|
-
document.body.addEventListener('pointerdown', e => {
|
|
50245
|
-
table.eventManager.LastBodyPointerXY = { x: e.x, y: e.y };
|
|
50246
|
-
table.eventManager.isDown = true;
|
|
50247
|
-
});
|
|
50248
|
-
document.addEventListener('pointerup', e => {
|
|
50249
|
-
table.eventManager.LastBodyPointerXY = null;
|
|
50250
|
-
table.eventManager.isDown = false;
|
|
50251
|
-
table.eventManager.isDraging = false;
|
|
50252
|
-
});
|
|
50253
|
-
document.body.addEventListener('pointermove', (e) => {
|
|
50254
|
-
if (table.eventManager.isDown && table.eventManager.LastBodyPointerXY) {
|
|
50255
|
-
const lastX = table.eventManager.LastBodyPointerXY?.x ?? e.x;
|
|
50256
|
-
const lastY = table.eventManager.LastBodyPointerXY?.y ?? e.y;
|
|
50257
|
-
if (Math.abs(lastX - e.x) > 1 || Math.abs(lastY - e.y) > 1) {
|
|
50258
|
-
table.eventManager.isDraging = true;
|
|
50259
|
-
}
|
|
50260
|
-
}
|
|
50261
|
-
const { x, y } = table._getMouseAbstractPoint(e, false);
|
|
50262
|
-
if (stateManager.interactionState === InteractionState.scrolling) {
|
|
50263
|
-
return;
|
|
50264
|
-
}
|
|
50265
|
-
if (stateManager.interactionState === InteractionState.grabing) {
|
|
50266
|
-
if (stateManager.isResizeCol()) {
|
|
50267
|
-
eventManager.dealColumnResize(x, y);
|
|
50268
|
-
if (table.hasListeners(TABLE_EVENT_TYPE.RESIZE_COLUMN)) {
|
|
50269
|
-
table.fireListeners(TABLE_EVENT_TYPE.RESIZE_COLUMN, {
|
|
50270
|
-
col: table.stateManager.columnResize.col,
|
|
50271
|
-
colWidth: table.getColWidth(table.stateManager.columnResize.col)
|
|
50272
|
-
});
|
|
50273
|
-
}
|
|
50274
|
-
}
|
|
50275
|
-
}
|
|
50276
|
-
});
|
|
50277
50455
|
table.scenegraph.tableGroup.addEventListener('pointermove', (e) => {
|
|
50278
50456
|
const lastX = table.eventManager.LastPointerXY?.x ?? e.x;
|
|
50279
50457
|
const lastY = table.eventManager.LastPointerXY?.y ?? e.y;
|
|
@@ -51184,12 +51362,12 @@
|
|
|
51184
51362
|
const ranges = table.stateManager.select.ranges;
|
|
51185
51363
|
const col = Math.min(ranges[0].start.col, ranges[0].end.col);
|
|
51186
51364
|
const row = Math.min(ranges[0].start.row, ranges[0].end.row);
|
|
51365
|
+
const values = [];
|
|
51187
51366
|
navigator.clipboard.read().then(clipboardItems => {
|
|
51188
51367
|
for (const item of clipboardItems) {
|
|
51189
51368
|
if (item.types.includes('text/html')) {
|
|
51190
51369
|
item.getType('text/html').then(blob => {
|
|
51191
51370
|
blob.text().then(pastedData => {
|
|
51192
|
-
const values = [];
|
|
51193
51371
|
if (pastedData && /(<table)|(<TABLE)/g.test(pastedData)) {
|
|
51194
51372
|
const regex = /<tr[^>]*>(.*?)<\/tr>/gs;
|
|
51195
51373
|
const matches = Array.from(pastedData.matchAll(regex));
|
|
@@ -51209,22 +51387,33 @@
|
|
|
51209
51387
|
});
|
|
51210
51388
|
values.push(rowValues);
|
|
51211
51389
|
}
|
|
51390
|
+
table.changeCellValues(col, row, values, true);
|
|
51212
51391
|
}
|
|
51213
51392
|
else {
|
|
51214
|
-
|
|
51215
|
-
|
|
51216
|
-
|
|
51217
|
-
|
|
51218
|
-
|
|
51219
|
-
|
|
51220
|
-
|
|
51221
|
-
|
|
51393
|
+
navigator.clipboard.read().then(clipboardItems => {
|
|
51394
|
+
for (const item of clipboardItems) {
|
|
51395
|
+
if (item.types.includes('text/plain')) {
|
|
51396
|
+
item.getType('text/plain').then(blob => {
|
|
51397
|
+
blob.text().then(pastedData => {
|
|
51398
|
+
const rows = pastedData.split('\n');
|
|
51399
|
+
rows.forEach(function (rowCells, rowIndex) {
|
|
51400
|
+
const cells = rowCells.split('\t');
|
|
51401
|
+
const rowValues = [];
|
|
51402
|
+
values.push(rowValues);
|
|
51403
|
+
cells.forEach(function (cell, cellIndex) {
|
|
51404
|
+
if (cellIndex === cells.length - 1) {
|
|
51405
|
+
cell = cell.trim();
|
|
51406
|
+
}
|
|
51407
|
+
rowValues.push(cell);
|
|
51408
|
+
});
|
|
51409
|
+
});
|
|
51410
|
+
table.changeCellValues(col, row, values, true);
|
|
51411
|
+
});
|
|
51412
|
+
});
|
|
51222
51413
|
}
|
|
51223
|
-
|
|
51224
|
-
});
|
|
51414
|
+
}
|
|
51225
51415
|
});
|
|
51226
51416
|
}
|
|
51227
|
-
table.changeCellValues(col, row, values, true);
|
|
51228
51417
|
});
|
|
51229
51418
|
});
|
|
51230
51419
|
}
|
|
@@ -51232,26 +51421,22 @@
|
|
|
51232
51421
|
item.getType('text/plain').then(blob => {
|
|
51233
51422
|
blob.text().then(pastedData => {
|
|
51234
51423
|
const rows = pastedData.replace(/\r(?!\n)/g, '\r\n').split('\r\n');
|
|
51235
|
-
const values = [];
|
|
51236
51424
|
if (rows.length > 1 && rows[rows.length - 1] === '') {
|
|
51237
51425
|
rows.pop();
|
|
51238
51426
|
}
|
|
51239
51427
|
rows.forEach(function (rowCells, rowIndex) {
|
|
51240
51428
|
const cells = rowCells.split('\t');
|
|
51241
|
-
const rowValues = [];
|
|
51242
|
-
values.push(rowValues);
|
|
51243
51429
|
cells.forEach(function (cell, cellIndex) {
|
|
51244
51430
|
if (cell.includes('\n')) {
|
|
51245
51431
|
cell = cell
|
|
51246
51432
|
.replace(/^"(.*)"$/, '$1')
|
|
51247
51433
|
.replace(/["]*/g, match => new Array(Math.floor(match.length / 2)).fill('"').join(''));
|
|
51248
51434
|
}
|
|
51249
|
-
rowValues.push(cell);
|
|
51250
51435
|
});
|
|
51251
51436
|
});
|
|
51252
|
-
table.changeCellValues(col, row, values, true);
|
|
51253
51437
|
});
|
|
51254
51438
|
});
|
|
51439
|
+
table.changeCellValues(col, row, values, true);
|
|
51255
51440
|
}
|
|
51256
51441
|
else ;
|
|
51257
51442
|
}
|
|
@@ -51270,6 +51455,57 @@
|
|
|
51270
51455
|
}
|
|
51271
51456
|
table.resize();
|
|
51272
51457
|
});
|
|
51458
|
+
const globalPointerdownCallback = (e) => {
|
|
51459
|
+
table.eventManager.LastBodyPointerXY = { x: e.x, y: e.y };
|
|
51460
|
+
table.eventManager.isDown = true;
|
|
51461
|
+
};
|
|
51462
|
+
eventManager.globalEventListeners.push({
|
|
51463
|
+
name: 'pointerdown',
|
|
51464
|
+
env: 'body',
|
|
51465
|
+
callback: globalPointerdownCallback
|
|
51466
|
+
});
|
|
51467
|
+
document.body.addEventListener('pointerdown', globalPointerdownCallback);
|
|
51468
|
+
const globalPointerupCallback = (e) => {
|
|
51469
|
+
table.eventManager.LastBodyPointerXY = null;
|
|
51470
|
+
table.eventManager.isDown = false;
|
|
51471
|
+
table.eventManager.isDraging = false;
|
|
51472
|
+
};
|
|
51473
|
+
eventManager.globalEventListeners.push({
|
|
51474
|
+
name: 'pointerup',
|
|
51475
|
+
env: 'document',
|
|
51476
|
+
callback: globalPointerupCallback
|
|
51477
|
+
});
|
|
51478
|
+
document.addEventListener('pointerup', globalPointerupCallback);
|
|
51479
|
+
const globalPointermoveCallback = (e) => {
|
|
51480
|
+
if (table.eventManager.isDown && table.eventManager.LastBodyPointerXY) {
|
|
51481
|
+
const lastX = table.eventManager.LastBodyPointerXY?.x ?? e.x;
|
|
51482
|
+
const lastY = table.eventManager.LastBodyPointerXY?.y ?? e.y;
|
|
51483
|
+
if (Math.abs(lastX - e.x) > 1 || Math.abs(lastY - e.y) > 1) {
|
|
51484
|
+
table.eventManager.isDraging = true;
|
|
51485
|
+
}
|
|
51486
|
+
}
|
|
51487
|
+
const { x, y } = table._getMouseAbstractPoint(e, false);
|
|
51488
|
+
if (stateManager.interactionState === InteractionState.scrolling) {
|
|
51489
|
+
return;
|
|
51490
|
+
}
|
|
51491
|
+
if (stateManager.interactionState === InteractionState.grabing) {
|
|
51492
|
+
if (stateManager.isResizeCol()) {
|
|
51493
|
+
eventManager.dealColumnResize(x, y);
|
|
51494
|
+
if (table.hasListeners(TABLE_EVENT_TYPE.RESIZE_COLUMN)) {
|
|
51495
|
+
table.fireListeners(TABLE_EVENT_TYPE.RESIZE_COLUMN, {
|
|
51496
|
+
col: table.stateManager.columnResize.col,
|
|
51497
|
+
colWidth: table.getColWidth(table.stateManager.columnResize.col)
|
|
51498
|
+
});
|
|
51499
|
+
}
|
|
51500
|
+
}
|
|
51501
|
+
}
|
|
51502
|
+
};
|
|
51503
|
+
eventManager.globalEventListeners.push({
|
|
51504
|
+
name: 'pointermove',
|
|
51505
|
+
env: 'body',
|
|
51506
|
+
callback: globalPointermoveCallback
|
|
51507
|
+
});
|
|
51508
|
+
document.body.addEventListener('pointermove', globalPointermoveCallback);
|
|
51273
51509
|
}
|
|
51274
51510
|
|
|
51275
51511
|
function bindTouchListener(eventManager) {
|
|
@@ -51288,7 +51524,7 @@
|
|
|
51288
51524
|
timestamp: Date.now()
|
|
51289
51525
|
});
|
|
51290
51526
|
});
|
|
51291
|
-
|
|
51527
|
+
const globalTouchMoveCallback = (e) => {
|
|
51292
51528
|
if (eventManager.touchMove) {
|
|
51293
51529
|
e.preventDefault();
|
|
51294
51530
|
}
|
|
@@ -51314,8 +51550,14 @@
|
|
|
51314
51550
|
(Math.abs(deltaY) <= Math.abs(deltaX) && deltaX !== 0 && isHorizontalScrollable(deltaX, stateManager)))) {
|
|
51315
51551
|
e.preventDefault();
|
|
51316
51552
|
}
|
|
51317
|
-
}
|
|
51318
|
-
window.addEventListener('
|
|
51553
|
+
};
|
|
51554
|
+
window.addEventListener('touchmove', globalTouchMoveCallback, { passive: false });
|
|
51555
|
+
eventManager.globalEventListeners.push({
|
|
51556
|
+
name: 'touchmove',
|
|
51557
|
+
env: 'window',
|
|
51558
|
+
callback: globalTouchMoveCallback
|
|
51559
|
+
});
|
|
51560
|
+
const globalTouchEndCallback = (e) => {
|
|
51319
51561
|
eventManager.touchEnd = true;
|
|
51320
51562
|
eventManager.touchMove = false;
|
|
51321
51563
|
if (!eventManager.isTouchdown || !isTouchEvent$1(e)) {
|
|
@@ -51338,8 +51580,14 @@
|
|
|
51338
51580
|
}
|
|
51339
51581
|
eventManager.isTouchdown = false;
|
|
51340
51582
|
eventManager.touchMovePoints = [];
|
|
51583
|
+
};
|
|
51584
|
+
window.addEventListener('touchend', globalTouchEndCallback);
|
|
51585
|
+
eventManager.globalEventListeners.push({
|
|
51586
|
+
name: 'touchend',
|
|
51587
|
+
env: 'window',
|
|
51588
|
+
callback: globalTouchEndCallback
|
|
51341
51589
|
});
|
|
51342
|
-
|
|
51590
|
+
const globalTouchCancelCallback = (e) => {
|
|
51343
51591
|
eventManager.touchEnd = true;
|
|
51344
51592
|
eventManager.touchMove = false;
|
|
51345
51593
|
if (!eventManager.isTouchdown) {
|
|
@@ -51347,6 +51595,12 @@
|
|
|
51347
51595
|
}
|
|
51348
51596
|
eventManager.isTouchdown = false;
|
|
51349
51597
|
eventManager.touchMovePoints = [];
|
|
51598
|
+
};
|
|
51599
|
+
window.addEventListener('touchcancel', globalTouchCancelCallback);
|
|
51600
|
+
eventManager.globalEventListeners.push({
|
|
51601
|
+
name: 'touchcancel',
|
|
51602
|
+
env: 'window',
|
|
51603
|
+
callback: globalTouchCancelCallback
|
|
51350
51604
|
});
|
|
51351
51605
|
}
|
|
51352
51606
|
function isTouchEvent$1(e) {
|
|
@@ -51522,6 +51776,7 @@
|
|
|
51522
51776
|
LastBodyPointerXY;
|
|
51523
51777
|
isDown = false;
|
|
51524
51778
|
isDraging = false;
|
|
51779
|
+
globalEventListeners = [];
|
|
51525
51780
|
constructor(table) {
|
|
51526
51781
|
this.table = table;
|
|
51527
51782
|
if (Env.mode === 'node') {
|
|
@@ -51748,6 +52003,18 @@
|
|
|
51748
52003
|
}
|
|
51749
52004
|
release() {
|
|
51750
52005
|
this.gesture.release();
|
|
52006
|
+
this.globalEventListeners.forEach(item => {
|
|
52007
|
+
if (item.env === 'document') {
|
|
52008
|
+
document.removeEventListener(item.name, item.callback);
|
|
52009
|
+
}
|
|
52010
|
+
else if (item.env === 'body') {
|
|
52011
|
+
document.body.removeEventListener(item.name, item.callback);
|
|
52012
|
+
}
|
|
52013
|
+
else if (item.env === 'window') {
|
|
52014
|
+
window.removeEventListener(item.name, item.callback);
|
|
52015
|
+
}
|
|
52016
|
+
});
|
|
52017
|
+
this.globalEventListeners = [];
|
|
51751
52018
|
}
|
|
51752
52019
|
}
|
|
51753
52020
|
|
|
@@ -51795,7 +52062,7 @@
|
|
|
51795
52062
|
this._barHeight = style.barHeight ?? 3;
|
|
51796
52063
|
this._barHeight = style.barHeight ?? 3;
|
|
51797
52064
|
this._barBottom = style.barBottom ?? 0;
|
|
51798
|
-
this._barPadding = style.barPadding ?? [
|
|
52065
|
+
this._barPadding = style.barPadding ?? [0, 0, 0, 0];
|
|
51799
52066
|
this._showBarMark = style.showBarMark ?? false;
|
|
51800
52067
|
this._barMarkPositiveColor = style.barMarkPositiveColor ?? '#4dbd74';
|
|
51801
52068
|
this._barMarkNegativeColor = style.barMarkNegativeColor ?? '#f86c6b';
|
|
@@ -54949,7 +55216,7 @@
|
|
|
54949
55216
|
return TABLE_EVENT_TYPE;
|
|
54950
55217
|
}
|
|
54951
55218
|
options;
|
|
54952
|
-
version = "0.21.
|
|
55219
|
+
version = "0.21.3-alpha.0";
|
|
54953
55220
|
pagination;
|
|
54954
55221
|
id = `VTable${Date.now()}`;
|
|
54955
55222
|
headerStyleCache;
|
|
@@ -66537,7 +66804,7 @@
|
|
|
66537
66804
|
}
|
|
66538
66805
|
|
|
66539
66806
|
registerForVrender();
|
|
66540
|
-
const version = "0.21.
|
|
66807
|
+
const version = "0.21.3-alpha.0";
|
|
66541
66808
|
function getIcons() {
|
|
66542
66809
|
return get$2();
|
|
66543
66810
|
}
|