@visactor/vtable 0.21.2-alpha.0 → 0.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +35 -24
- 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/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/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 +540 -282
- 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 +34 -23
- 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/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/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 +3 -3
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,12 +36179,21 @@
|
|
|
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) {
|
|
@@ -36199,6 +36225,13 @@
|
|
|
36199
36225
|
dy: -table.getRowsHeight(cellGroup.mergeStartRow, row - 1)
|
|
36200
36226
|
});
|
|
36201
36227
|
}
|
|
36228
|
+
const playIcon = cellGroup.getChildByName('play-icon');
|
|
36229
|
+
if (playIcon) {
|
|
36230
|
+
playIcon.setAttributes({
|
|
36231
|
+
dx: -table.getColsWidth(cellGroup.mergeStartCol, col - 1),
|
|
36232
|
+
dy: -table.getRowsHeight(cellGroup.mergeStartRow, row - 1)
|
|
36233
|
+
});
|
|
36234
|
+
}
|
|
36202
36235
|
}
|
|
36203
36236
|
}
|
|
36204
36237
|
}
|
|
@@ -36268,18 +36301,12 @@
|
|
|
36268
36301
|
return Number(v);
|
|
36269
36302
|
});
|
|
36270
36303
|
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
|
-
|
|
36304
|
+
const barPaddingTop = Math.max(barPadding[0], Math.ceil(borderWidth[0] / 2));
|
|
36305
|
+
const barPaddingRight = Math.max(barPadding[1], Math.floor(borderWidth[1] / 2));
|
|
36306
|
+
const barPaddingBottom = Math.max(barPadding[2], Math.floor(borderWidth[2] / 2));
|
|
36307
|
+
const barPaddingLeft = Math.max(barPadding[3], Math.ceil(borderWidth[3] / 2));
|
|
36275
36308
|
contentWidth -= barPaddingRight + barPaddingLeft;
|
|
36276
36309
|
contentHeight -= barPaddingBottom + barPaddingTop;
|
|
36277
|
-
if (barPaddingTop & 1) {
|
|
36278
|
-
barPaddingTop += 0.5;
|
|
36279
|
-
}
|
|
36280
|
-
if (barPaddingLeft & 1) {
|
|
36281
|
-
barPaddingLeft += 0.5;
|
|
36282
|
-
}
|
|
36283
36310
|
const top = barPaddingTop;
|
|
36284
36311
|
const left = barPaddingLeft;
|
|
36285
36312
|
const right = contentWidth;
|
|
@@ -37337,6 +37364,7 @@
|
|
|
37337
37364
|
};
|
|
37338
37365
|
const wrapText = new Text$1(cellTheme.text ? Object.assign({}, cellTheme.text, attribute) : attribute);
|
|
37339
37366
|
wrapText.name = 'text';
|
|
37367
|
+
wrapText.textBaseline = textBaseline;
|
|
37340
37368
|
cellGroup.appendChild(wrapText);
|
|
37341
37369
|
contentWidth = wrapText.AABBBounds.width();
|
|
37342
37370
|
wrapText.AABBBounds.height();
|
|
@@ -37909,28 +37937,33 @@
|
|
|
37909
37937
|
if (imageAutoSizing) {
|
|
37910
37938
|
_adjustWidthHeight(col, row, video.videoWidth, video.videoHeight, table.scenegraph, padding, cellGroup);
|
|
37911
37939
|
}
|
|
37912
|
-
const width = cellGroup
|
|
37913
|
-
const height = cellGroup.attribute.height;
|
|
37940
|
+
const { width: cellWidth, height: cellHeight, isMerge } = getCellRange(cellGroup, table);
|
|
37914
37941
|
if (keepAspectRatio) {
|
|
37915
|
-
const { width: videoWidth, height: videoHeight } = calcKeepAspectRatioSize(video.videoWidth, video.videoHeight,
|
|
37916
|
-
const pos = calcStartPosition(0, 0,
|
|
37942
|
+
const { width: videoWidth, height: videoHeight } = calcKeepAspectRatioSize(video.videoWidth, video.videoHeight, cellWidth - padding[1] - padding[3], cellHeight - padding[0] - padding[2]);
|
|
37943
|
+
const pos = calcStartPosition(0, 0, cellWidth, cellHeight, videoWidth, videoHeight, textAlign, textBaseline, padding);
|
|
37917
37944
|
image.setAttributes({
|
|
37918
37945
|
width: videoWidth,
|
|
37919
37946
|
height: videoHeight,
|
|
37920
37947
|
x: pos.x,
|
|
37921
|
-
y: pos.y
|
|
37948
|
+
y: pos.y,
|
|
37949
|
+
dx: 0
|
|
37922
37950
|
});
|
|
37923
37951
|
}
|
|
37924
37952
|
else {
|
|
37925
37953
|
image.setAttributes({
|
|
37926
37954
|
x: padding[3],
|
|
37927
37955
|
y: padding[0],
|
|
37928
|
-
width:
|
|
37929
|
-
height:
|
|
37956
|
+
width: cellWidth - padding[1] - padding[3],
|
|
37957
|
+
height: cellHeight - padding[2] - padding[0],
|
|
37958
|
+
dy: 0
|
|
37930
37959
|
});
|
|
37931
37960
|
}
|
|
37961
|
+
if (isMerge) {
|
|
37962
|
+
updateImageDxDy(cellGroup.mergeStartCol, cellGroup.mergeEndCol, cellGroup.mergeStartRow, cellGroup.mergeEndRow, table);
|
|
37963
|
+
}
|
|
37932
37964
|
const left = 0;
|
|
37933
37965
|
const top = 0;
|
|
37966
|
+
const { width, height } = getCellRange(cellGroup, table);
|
|
37934
37967
|
const iconSize = Math.floor(Math.min(width - padding[1] - padding[3], height - padding[2] - padding[0]) / 2);
|
|
37935
37968
|
const anchorX = left + (width > image.attribute.width ? image.attribute.x - left + image.attribute.width / 2 : width / 2);
|
|
37936
37969
|
const anchorY = top + (height > image.attribute.height ? image.attribute.y - top + image.attribute.height / 2 : height / 2);
|
|
@@ -37960,6 +37993,9 @@
|
|
|
37960
37993
|
cursor: 'pointer'
|
|
37961
37994
|
});
|
|
37962
37995
|
image.name = 'image';
|
|
37996
|
+
image.keepAspectRatio = keepAspectRatio;
|
|
37997
|
+
image.textAlign = textAlign;
|
|
37998
|
+
image.textBaseline = textBaseline;
|
|
37963
37999
|
cellGroup.appendChild(image);
|
|
37964
38000
|
return cellGroup;
|
|
37965
38001
|
}
|
|
@@ -40333,7 +40369,7 @@
|
|
|
40333
40369
|
const oldColumnWidth = columnGroup?.attribute.width ?? 0;
|
|
40334
40370
|
columnGroup?.setAttribute('width', oldColumnWidth + detaX);
|
|
40335
40371
|
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);
|
|
40372
|
+
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
40373
|
if (isHeightChange) {
|
|
40338
40374
|
const mergeInfo = getCellMergeInfo(scene.table, cell.col, cell.row);
|
|
40339
40375
|
if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {
|
|
@@ -40420,7 +40456,7 @@
|
|
|
40420
40456
|
}
|
|
40421
40457
|
}
|
|
40422
40458
|
}
|
|
40423
|
-
function updateCellWidth(scene, cell, col, row, oldWidth, distWidth, detaX, isHeader, autoRowHeight) {
|
|
40459
|
+
function updateCellWidth(scene, cell, col, row, oldWidth, distWidth, detaX, isHeader, autoRowHeight, autoWrapText) {
|
|
40424
40460
|
if (cell.attribute.width === distWidth && !cell.needUpdateWidth) {
|
|
40425
40461
|
return false;
|
|
40426
40462
|
}
|
|
@@ -40512,7 +40548,7 @@
|
|
|
40512
40548
|
isHeightChange = updateMergeCellContentWidth(cellGroup, distWidth, detaX, autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline, scene.table);
|
|
40513
40549
|
}
|
|
40514
40550
|
}
|
|
40515
|
-
return autoRowHeight ? isHeightChange : false;
|
|
40551
|
+
return autoRowHeight && autoWrapText ? isHeightChange : false;
|
|
40516
40552
|
}
|
|
40517
40553
|
function updateMergeCellContentWidth(cellGroup, distWidth, detaX, autoRowHeight, padding, textAlign, textBaseline, table) {
|
|
40518
40554
|
if (isMergeCellGroup(cellGroup)) {
|
|
@@ -42829,6 +42865,248 @@
|
|
|
42829
42865
|
}
|
|
42830
42866
|
}
|
|
42831
42867
|
|
|
42868
|
+
let customAlphabetCharSet = '';
|
|
42869
|
+
const textMeasureModule = new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
42870
|
+
if (isBound(TextMeasureContribution)) {
|
|
42871
|
+
rebind(TextMeasureContribution).to(FastTextMeasureContribution).inSingletonScope();
|
|
42872
|
+
}
|
|
42873
|
+
else {
|
|
42874
|
+
bind(TextMeasureContribution).to(FastTextMeasureContribution).inSingletonScope();
|
|
42875
|
+
}
|
|
42876
|
+
});
|
|
42877
|
+
const restoreTextMeasureModule = new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
42878
|
+
if (isBound(TextMeasureContribution)) {
|
|
42879
|
+
rebind(TextMeasureContribution).to(DefaultTextMeasureContribution).inSingletonScope();
|
|
42880
|
+
}
|
|
42881
|
+
else {
|
|
42882
|
+
bind(TextMeasureContribution).to(DefaultTextMeasureContribution).inSingletonScope();
|
|
42883
|
+
}
|
|
42884
|
+
});
|
|
42885
|
+
const initTextMeasure = (textSpec, option, useNaiveCanvas) => {
|
|
42886
|
+
return new TextMeasure$1({
|
|
42887
|
+
defaultFontParams: {
|
|
42888
|
+
fontFamily: DefaultTextStyle.fontFamily,
|
|
42889
|
+
fontSize: DefaultTextStyle.fontSize
|
|
42890
|
+
},
|
|
42891
|
+
getTextBounds: useNaiveCanvas ? undefined : getTextBounds$1,
|
|
42892
|
+
specialCharSet: `{}()//&-/: .,@%'"~…=${TextMeasure$1.ALPHABET_CHAR_SET}${TextMeasure$1.ALPHABET_CHAR_SET.toUpperCase()}0123456789${customAlphabetCharSet}`,
|
|
42893
|
+
...(option ?? {})
|
|
42894
|
+
}, textSpec);
|
|
42895
|
+
};
|
|
42896
|
+
const fastTextMeasureCache = new Map();
|
|
42897
|
+
function getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle = 'normal') {
|
|
42898
|
+
const key = `${fontSize}-${fontWeight}-${fontFamily}-${fontStyle}`;
|
|
42899
|
+
const cache = fastTextMeasureCache.get(key);
|
|
42900
|
+
if (cache) {
|
|
42901
|
+
return cache;
|
|
42902
|
+
}
|
|
42903
|
+
const fastTextMeasure = initTextMeasure({
|
|
42904
|
+
fontSize,
|
|
42905
|
+
fontFamily,
|
|
42906
|
+
fontWeight,
|
|
42907
|
+
fontStyle
|
|
42908
|
+
});
|
|
42909
|
+
fastTextMeasureCache.set(key, fastTextMeasure);
|
|
42910
|
+
return fastTextMeasure;
|
|
42911
|
+
}
|
|
42912
|
+
class FastTextMeasureContribution extends DefaultTextMeasureContribution {
|
|
42913
|
+
measureTextWidth(text, options) {
|
|
42914
|
+
const { fontSize, fontFamily = 'Arial,sans-serif', fontWeight = 'normal', fontStyle = 'normal' } = options;
|
|
42915
|
+
const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle);
|
|
42916
|
+
const textMeasure = fastTextMeasure.measure(text);
|
|
42917
|
+
return textMeasure.width;
|
|
42918
|
+
}
|
|
42919
|
+
measureText(text, options) {
|
|
42920
|
+
const { fontSize, fontFamily = 'Arial,sans-serif', fontWeight = 'normal', fontStyle = 'normal' } = options;
|
|
42921
|
+
const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle);
|
|
42922
|
+
const textMeasure = fastTextMeasure.measure(text);
|
|
42923
|
+
return textMeasure;
|
|
42924
|
+
}
|
|
42925
|
+
}
|
|
42926
|
+
class TextMeasureTool {
|
|
42927
|
+
measureText(text, options) {
|
|
42928
|
+
const { fontSize, fontFamily = 'Arial,sans-serif', fontWeight = 'normal', fontStyle = 'normal' } = options;
|
|
42929
|
+
const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle);
|
|
42930
|
+
const textMeasure = fastTextMeasure.measure(text);
|
|
42931
|
+
return textMeasure;
|
|
42932
|
+
}
|
|
42933
|
+
measureTextWidth(text, options) {
|
|
42934
|
+
const { fontSize, fontFamily = 'Arial,sans-serif', fontWeight = 'normal', fontStyle = 'normal' } = options;
|
|
42935
|
+
const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle);
|
|
42936
|
+
const textMeasure = fastTextMeasure.measure(text);
|
|
42937
|
+
return textMeasure.width;
|
|
42938
|
+
}
|
|
42939
|
+
clipText(text, options, width) {
|
|
42940
|
+
if (text.length === 0) {
|
|
42941
|
+
return { str: '', width: 0 };
|
|
42942
|
+
}
|
|
42943
|
+
let length = this.measureTextWidth(text, options);
|
|
42944
|
+
if (length <= width) {
|
|
42945
|
+
return { str: text, width: length };
|
|
42946
|
+
}
|
|
42947
|
+
length = this.measureTextWidth(text[0], options);
|
|
42948
|
+
if (length > width) {
|
|
42949
|
+
return { str: '', width: 0 };
|
|
42950
|
+
}
|
|
42951
|
+
return this._clipText(text, options, width, 0, text.length - 1);
|
|
42952
|
+
}
|
|
42953
|
+
_clipText(text, options, width, leftIdx, rightIdx) {
|
|
42954
|
+
const middleIdx = Math.floor((leftIdx + rightIdx) / 2);
|
|
42955
|
+
const subText = text.substring(0, middleIdx + 1);
|
|
42956
|
+
const strWidth = this.measureTextWidth(subText, options);
|
|
42957
|
+
let length;
|
|
42958
|
+
if (strWidth > width) {
|
|
42959
|
+
if (subText.length <= 1) {
|
|
42960
|
+
return { str: '', width: 0 };
|
|
42961
|
+
}
|
|
42962
|
+
const str = text.substring(0, middleIdx);
|
|
42963
|
+
length = this.measureTextWidth(str, options);
|
|
42964
|
+
if (length <= width) {
|
|
42965
|
+
return { str, width: length };
|
|
42966
|
+
}
|
|
42967
|
+
return this._clipText(text, options, width, leftIdx, middleIdx);
|
|
42968
|
+
}
|
|
42969
|
+
else if (strWidth < width) {
|
|
42970
|
+
if (middleIdx >= text.length - 1) {
|
|
42971
|
+
return { str: text, width: this.measureTextWidth(text, options) };
|
|
42972
|
+
}
|
|
42973
|
+
const str = text.substring(0, middleIdx + 2);
|
|
42974
|
+
length = this.measureTextWidth(str, options);
|
|
42975
|
+
if (length >= width) {
|
|
42976
|
+
return { str: subText, width: strWidth };
|
|
42977
|
+
}
|
|
42978
|
+
return this._clipText(text, options, width, middleIdx, rightIdx);
|
|
42979
|
+
}
|
|
42980
|
+
return { str: subText, width: strWidth };
|
|
42981
|
+
}
|
|
42982
|
+
clipTextWithSuffix(text, options, width, suffix) {
|
|
42983
|
+
if (suffix === '') {
|
|
42984
|
+
return this.clipText(text, options, width);
|
|
42985
|
+
}
|
|
42986
|
+
if (text.length === 0) {
|
|
42987
|
+
return { str: '', width: 0 };
|
|
42988
|
+
}
|
|
42989
|
+
const length = this.measureTextWidth(text, options);
|
|
42990
|
+
if (length <= width) {
|
|
42991
|
+
return { str: text, width: length };
|
|
42992
|
+
}
|
|
42993
|
+
const suffixWidth = this.measureTextWidth(suffix, options);
|
|
42994
|
+
if (suffixWidth > width) {
|
|
42995
|
+
return { str: '', width: 0 };
|
|
42996
|
+
}
|
|
42997
|
+
width -= suffixWidth;
|
|
42998
|
+
const data = this._clipText(text, options, width, 0, text.length - 1);
|
|
42999
|
+
data.str += suffix;
|
|
43000
|
+
data.width += suffixWidth;
|
|
43001
|
+
return data;
|
|
43002
|
+
}
|
|
43003
|
+
}
|
|
43004
|
+
const textMeasure = new TextMeasureTool();
|
|
43005
|
+
function setCustomAlphabetCharSet(str) {
|
|
43006
|
+
customAlphabetCharSet = str;
|
|
43007
|
+
fastTextMeasureCache.clear();
|
|
43008
|
+
}
|
|
43009
|
+
function restoreMeasureText() {
|
|
43010
|
+
container.load(restoreTextMeasureModule);
|
|
43011
|
+
}
|
|
43012
|
+
|
|
43013
|
+
let SuffixTextBeforeRenderContribution = class SuffixTextBeforeRenderContribution {
|
|
43014
|
+
time = BaseRenderContributionTime.afterFillStroke;
|
|
43015
|
+
useStyle = true;
|
|
43016
|
+
order = 0;
|
|
43017
|
+
drawShape(text, context, x, y, doFill, doStroke, fVisible, sVisible, textAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) {
|
|
43018
|
+
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;
|
|
43019
|
+
let isEmpty = false;
|
|
43020
|
+
if (Array.isArray(text)) {
|
|
43021
|
+
const layoutData = text.cache?.layoutData;
|
|
43022
|
+
if (ellipsis && layoutData && layoutData.lines.every(line => line.str === '')) {
|
|
43023
|
+
isEmpty = true;
|
|
43024
|
+
}
|
|
43025
|
+
}
|
|
43026
|
+
else {
|
|
43027
|
+
const { cache } = text;
|
|
43028
|
+
if (ellipsis && cache && cache.clipedText === '' && cache.clipedWidth === 0) {
|
|
43029
|
+
isEmpty = true;
|
|
43030
|
+
}
|
|
43031
|
+
}
|
|
43032
|
+
if (!isEmpty) {
|
|
43033
|
+
return;
|
|
43034
|
+
}
|
|
43035
|
+
const textStr = isString$4(ellipsis) ? ellipsis : '...';
|
|
43036
|
+
const lineHeight = calculateLineHeight(text.attribute.lineHeight, fontSize) ?? fontSize;
|
|
43037
|
+
let dy = 0;
|
|
43038
|
+
if (lineHeight !== fontSize) {
|
|
43039
|
+
if (textBaseline === 'top') {
|
|
43040
|
+
dy = (lineHeight - fontSize) / 2;
|
|
43041
|
+
}
|
|
43042
|
+
else if (textBaseline === 'middle') ;
|
|
43043
|
+
else if (textBaseline === 'bottom') {
|
|
43044
|
+
dy = -(lineHeight - fontSize) / 2;
|
|
43045
|
+
}
|
|
43046
|
+
else ;
|
|
43047
|
+
}
|
|
43048
|
+
if (doStroke) {
|
|
43049
|
+
if (strokeCb) {
|
|
43050
|
+
strokeCb(context, text.attribute, textAttribute);
|
|
43051
|
+
}
|
|
43052
|
+
else if (sVisible) {
|
|
43053
|
+
context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute);
|
|
43054
|
+
context.strokeText(textStr, originX, originY + dy);
|
|
43055
|
+
}
|
|
43056
|
+
}
|
|
43057
|
+
if (doFill) {
|
|
43058
|
+
if (fillCb) {
|
|
43059
|
+
fillCb(context, text.attribute, textAttribute);
|
|
43060
|
+
}
|
|
43061
|
+
else if (fVisible) {
|
|
43062
|
+
context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute);
|
|
43063
|
+
context.fillText(textStr, originX, originY + dy);
|
|
43064
|
+
this.drawUnderLine(underline, lineThrough, text, originX, originY + dy, 0, textAttribute, context, textStr);
|
|
43065
|
+
}
|
|
43066
|
+
}
|
|
43067
|
+
}
|
|
43068
|
+
drawUnderLine(underline, lineThrough, text, x, y, z, textAttribute, context, textStr) {
|
|
43069
|
+
if (lineThrough + underline <= 0) {
|
|
43070
|
+
return;
|
|
43071
|
+
}
|
|
43072
|
+
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;
|
|
43073
|
+
if (!underline && !lineThrough) {
|
|
43074
|
+
return;
|
|
43075
|
+
}
|
|
43076
|
+
const w = textMeasure.measureTextWidth(textStr, {
|
|
43077
|
+
fontSize,
|
|
43078
|
+
fontFamily,
|
|
43079
|
+
fontWeight,
|
|
43080
|
+
fontStyle
|
|
43081
|
+
});
|
|
43082
|
+
const offsetX = textDrawOffsetX(textAlign, w);
|
|
43083
|
+
const offsetY = textLayoutOffsetY(textBaseline, fontSize, fontSize);
|
|
43084
|
+
const attribute = { lineWidth: 0, stroke: fill, opacity, strokeOpacity: fillOpacity };
|
|
43085
|
+
if (underline) {
|
|
43086
|
+
attribute.lineWidth = underline;
|
|
43087
|
+
context.setStrokeStyle(text, attribute, x, y, textAttribute);
|
|
43088
|
+
context.setLineDash(underlineDash);
|
|
43089
|
+
context.beginPath();
|
|
43090
|
+
const dy = y + offsetY + fontSize + underlineOffset;
|
|
43091
|
+
context.moveTo(x + offsetX, dy, z);
|
|
43092
|
+
context.lineTo(x + offsetX + w, dy, z);
|
|
43093
|
+
context.stroke();
|
|
43094
|
+
}
|
|
43095
|
+
if (lineThrough) {
|
|
43096
|
+
attribute.lineWidth = lineThrough;
|
|
43097
|
+
context.setStrokeStyle(text, attribute, x, y, textAttribute);
|
|
43098
|
+
context.beginPath();
|
|
43099
|
+
const dy = y + offsetY + fontSize / 2;
|
|
43100
|
+
context.moveTo(x + offsetX, dy, z);
|
|
43101
|
+
context.lineTo(x + offsetX + w, dy, z);
|
|
43102
|
+
context.stroke();
|
|
43103
|
+
}
|
|
43104
|
+
}
|
|
43105
|
+
};
|
|
43106
|
+
SuffixTextBeforeRenderContribution = __decorate([
|
|
43107
|
+
injectable()
|
|
43108
|
+
], SuffixTextBeforeRenderContribution);
|
|
43109
|
+
|
|
42832
43110
|
var splitModule = new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
42833
43111
|
if (isBound(SplitRectBeforeRenderContribution$1)) {
|
|
42834
43112
|
rebind(SplitRectBeforeRenderContribution$1).to(SplitRectBeforeRenderContribution).inSingletonScope();
|
|
@@ -42873,6 +43151,8 @@
|
|
|
42873
43151
|
bind(GroupRenderContribution).toService(ClipBodyGroupAfterRenderContribution);
|
|
42874
43152
|
bind(VTableDrawItemInterceptorContribution).toSelf().inSingletonScope();
|
|
42875
43153
|
bind(DrawItemInterceptor).toService(VTableDrawItemInterceptorContribution);
|
|
43154
|
+
bind(SuffixTextBeforeRenderContribution).toSelf().inSingletonScope();
|
|
43155
|
+
bind(TextRenderContribution).toService(SuffixTextBeforeRenderContribution);
|
|
42876
43156
|
});
|
|
42877
43157
|
|
|
42878
43158
|
function computeColsWidth(table, colStart, colEnd, update) {
|
|
@@ -42966,7 +43246,7 @@
|
|
|
42966
43246
|
table.scenegraph.updateColWidth(col, newColWidth - oldColWidths[col], true, true);
|
|
42967
43247
|
}
|
|
42968
43248
|
}
|
|
42969
|
-
table.scenegraph.updateContainer();
|
|
43249
|
+
table.scenegraph.updateContainer(true);
|
|
42970
43250
|
}
|
|
42971
43251
|
}
|
|
42972
43252
|
function computeColWidth(col, startRow, endRow, table, forceCompute = false) {
|
|
@@ -45580,9 +45860,10 @@
|
|
|
45580
45860
|
break;
|
|
45581
45861
|
}
|
|
45582
45862
|
[colStart, colEnd].forEach((col) => {
|
|
45583
|
-
|
|
45863
|
+
const style = table._getCellStyle(col, row);
|
|
45864
|
+
if (style?.textStick) {
|
|
45584
45865
|
const cellGroup = table.scenegraph.getCell(col, row);
|
|
45585
|
-
adjustCellContentHorizontalLayout(cellGroup, frozenColsWidth + table.tableX, table.tableNoFrameWidth - table.getRightFrozenColsWidth() + table.tableX, changedCells, table);
|
|
45866
|
+
adjustCellContentHorizontalLayout(cellGroup, frozenColsWidth + table.tableX, table.tableNoFrameWidth - table.getRightFrozenColsWidth() + table.tableX, changedCells, style?.textStickBaseOnAlign, table);
|
|
45586
45867
|
}
|
|
45587
45868
|
});
|
|
45588
45869
|
}
|
|
@@ -45591,10 +45872,10 @@
|
|
|
45591
45872
|
break;
|
|
45592
45873
|
}
|
|
45593
45874
|
[rowStart, rowEnd].forEach((row) => {
|
|
45594
|
-
|
|
45595
|
-
|
|
45875
|
+
const style = table._getCellStyle(col, row);
|
|
45876
|
+
if (style?.textStick && table.internalProps.layoutMap.rowHierarchyType !== 'tree') {
|
|
45596
45877
|
const cellGroup = table.scenegraph.getCell(col, row);
|
|
45597
|
-
adjustCellContentVerticalLayout(cellGroup, frozenRowsHeight + table.tableY, table.tableNoFrameHeight - table.getBottomFrozenRowsHeight() + table.tableY, changedCells, table);
|
|
45878
|
+
adjustCellContentVerticalLayout(cellGroup, frozenRowsHeight + table.tableY, table.tableNoFrameHeight - table.getBottomFrozenRowsHeight() + table.tableY, changedCells, style?.textStickBaseOnAlign, table);
|
|
45598
45879
|
}
|
|
45599
45880
|
});
|
|
45600
45881
|
}
|
|
@@ -45603,9 +45884,10 @@
|
|
|
45603
45884
|
break;
|
|
45604
45885
|
}
|
|
45605
45886
|
[rowStart, rowEnd].forEach((row) => {
|
|
45606
|
-
|
|
45887
|
+
const style = table._getCellStyle(col, row);
|
|
45888
|
+
if (style?.textStick) {
|
|
45607
45889
|
const cellGroup = table.scenegraph.getCell(col, row);
|
|
45608
|
-
adjustCellContentVerticalLayout(cellGroup, frozenRowsHeight + table.tableY, table.tableNoFrameHeight - table.getBottomFrozenRowsHeight() + table.tableY, changedCells, table);
|
|
45890
|
+
adjustCellContentVerticalLayout(cellGroup, frozenRowsHeight + table.tableY, table.tableNoFrameHeight - table.getBottomFrozenRowsHeight() + table.tableY, changedCells, style?.textStickBaseOnAlign, table);
|
|
45609
45891
|
}
|
|
45610
45892
|
});
|
|
45611
45893
|
}
|
|
@@ -45614,14 +45896,15 @@
|
|
|
45614
45896
|
break;
|
|
45615
45897
|
}
|
|
45616
45898
|
[colStart, colEnd].forEach((col) => {
|
|
45899
|
+
const style = table._getCellStyle(col, row);
|
|
45617
45900
|
if (table._getCellStyle(col, row)?.textStick) {
|
|
45618
45901
|
const cellGroup = table.scenegraph.getCell(col, row);
|
|
45619
|
-
adjustCellContentHorizontalLayout(cellGroup, frozenColsWidth + table.tableX, table.tableNoFrameWidth - table.getRightFrozenColsWidth() + table.tableX, changedCells, table);
|
|
45902
|
+
adjustCellContentHorizontalLayout(cellGroup, frozenColsWidth + table.tableX, table.tableNoFrameWidth - table.getRightFrozenColsWidth() + table.tableX, changedCells, style?.textStickBaseOnAlign, table);
|
|
45620
45903
|
}
|
|
45621
45904
|
});
|
|
45622
45905
|
}
|
|
45623
45906
|
}
|
|
45624
|
-
function adjustCellContentVerticalLayout(cellGroup, minTop, maxTop, changedCells, table) {
|
|
45907
|
+
function adjustCellContentVerticalLayout(cellGroup, minTop, maxTop, changedCells, textStickBaseOnAlign, table) {
|
|
45625
45908
|
if (isNumber$4(cellGroup.mergeStartCol) &&
|
|
45626
45909
|
isNumber$4(cellGroup.mergeStartRow) &&
|
|
45627
45910
|
isNumber$4(cellGroup.mergeEndCol) &&
|
|
@@ -45630,15 +45913,15 @@
|
|
|
45630
45913
|
for (let col = colStart; col <= colEnd; col++) {
|
|
45631
45914
|
for (let row = rowStart; row <= rowEnd; row++) {
|
|
45632
45915
|
const singleCellGroup = table.scenegraph.getCell(col, row);
|
|
45633
|
-
dealVertical(singleCellGroup, minTop, maxTop, changedCells);
|
|
45916
|
+
dealVertical(singleCellGroup, minTop, maxTop, changedCells, textStickBaseOnAlign);
|
|
45634
45917
|
}
|
|
45635
45918
|
}
|
|
45636
45919
|
}
|
|
45637
45920
|
else {
|
|
45638
|
-
dealVertical(cellGroup, minTop, maxTop, changedCells);
|
|
45921
|
+
dealVertical(cellGroup, minTop, maxTop, changedCells, textStickBaseOnAlign);
|
|
45639
45922
|
}
|
|
45640
45923
|
}
|
|
45641
|
-
function dealVertical(cellGroup, minTop, maxTop, changedCells) {
|
|
45924
|
+
function dealVertical(cellGroup, minTop, maxTop, changedCells, textStickBaseOnAlign) {
|
|
45642
45925
|
const graphic = cellGroup.getChildByName('text', true) || cellGroup.getChildByName('image', true);
|
|
45643
45926
|
if (!graphic) {
|
|
45644
45927
|
return;
|
|
@@ -45653,10 +45936,30 @@
|
|
|
45653
45936
|
return;
|
|
45654
45937
|
}
|
|
45655
45938
|
}
|
|
45939
|
+
const textBaseline = graphic.textBaseline ?? 'top';
|
|
45656
45940
|
graphic.AABBBounds.width();
|
|
45657
45941
|
const textTop = graphic.globalAABBBounds.y1;
|
|
45658
45942
|
const textBottom = graphic.globalAABBBounds.y2;
|
|
45659
|
-
if (
|
|
45943
|
+
if (textBaseline === 'middle' && textStickBaseOnAlign) {
|
|
45944
|
+
const cellTop = cellGroup.globalAABBBounds.y1 + (cellGroup.firstChild?.attribute.dy ?? 0);
|
|
45945
|
+
const cellBottom = cellTop + (cellGroup.contentHeight ?? cellGroup.attribute.height ?? 0);
|
|
45946
|
+
if (cellTop < minTop || cellBottom > maxTop) {
|
|
45947
|
+
const visibleCellTop = Math.max(cellTop, minTop);
|
|
45948
|
+
const visibleCellBottom = Math.min(cellBottom, maxTop);
|
|
45949
|
+
const delta = graphic.globalTransMatrix.f - (visibleCellBottom + visibleCellTop) / 2;
|
|
45950
|
+
!changedCells.has(`${cellGroup.col}-${cellGroup.row}`) &&
|
|
45951
|
+
changedCells.set(`${cellGroup.col}-${cellGroup.row}`, {
|
|
45952
|
+
col: cellGroup.col,
|
|
45953
|
+
row: cellGroup.row,
|
|
45954
|
+
dx: cellGroup.firstChild?.attribute.dx ?? 0,
|
|
45955
|
+
dy: cellGroup.firstChild?.attribute.dy ?? 0
|
|
45956
|
+
});
|
|
45957
|
+
cellGroup.forEachChildren((child) => {
|
|
45958
|
+
child.setAttribute('dy', (child.attribute.dy ?? 0) - delta + 2);
|
|
45959
|
+
});
|
|
45960
|
+
}
|
|
45961
|
+
}
|
|
45962
|
+
else if (textTop < minTop) {
|
|
45660
45963
|
const deltaHeight = textTop - minTop;
|
|
45661
45964
|
!changedCells.has(`${cellGroup.col}-${cellGroup.row}`) &&
|
|
45662
45965
|
changedCells.set(`${cellGroup.col}-${cellGroup.row}`, {
|
|
@@ -45683,7 +45986,7 @@
|
|
|
45683
45986
|
});
|
|
45684
45987
|
}
|
|
45685
45988
|
}
|
|
45686
|
-
function adjustCellContentHorizontalLayout(cellGroup, minLeft, maxLeft, changedCells, table) {
|
|
45989
|
+
function adjustCellContentHorizontalLayout(cellGroup, minLeft, maxLeft, changedCells, textStickBaseOnAlign, table) {
|
|
45687
45990
|
if (isNumber$4(cellGroup.mergeStartCol) &&
|
|
45688
45991
|
isNumber$4(cellGroup.mergeStartRow) &&
|
|
45689
45992
|
isNumber$4(cellGroup.mergeEndCol) &&
|
|
@@ -45692,23 +45995,53 @@
|
|
|
45692
45995
|
for (let col = colStart; col <= colEnd; col++) {
|
|
45693
45996
|
for (let row = rowStart; row <= rowEnd; row++) {
|
|
45694
45997
|
const singleCellGroup = table.scenegraph.getCell(col, row);
|
|
45695
|
-
dealHorizontal(singleCellGroup, minLeft, maxLeft, changedCells);
|
|
45998
|
+
dealHorizontal(singleCellGroup, minLeft, maxLeft, changedCells, textStickBaseOnAlign);
|
|
45696
45999
|
}
|
|
45697
46000
|
}
|
|
45698
46001
|
}
|
|
45699
46002
|
else {
|
|
45700
|
-
dealHorizontal(cellGroup, minLeft, maxLeft, changedCells);
|
|
46003
|
+
dealHorizontal(cellGroup, minLeft, maxLeft, changedCells, textStickBaseOnAlign);
|
|
45701
46004
|
}
|
|
45702
46005
|
}
|
|
45703
|
-
function dealHorizontal(cellGroup, minLeft, maxLeft, changedCells) {
|
|
45704
|
-
const
|
|
45705
|
-
if (!
|
|
46006
|
+
function dealHorizontal(cellGroup, minLeft, maxLeft, changedCells, textStickBaseOnAlign) {
|
|
46007
|
+
const graphic = cellGroup.getChildByName('text', true) || cellGroup.getChildByName('image', true);
|
|
46008
|
+
if (!graphic) {
|
|
45706
46009
|
return;
|
|
45707
46010
|
}
|
|
45708
|
-
|
|
45709
|
-
|
|
45710
|
-
|
|
45711
|
-
|
|
46011
|
+
if (graphic.type === 'image') {
|
|
46012
|
+
const { image: url } = graphic.attribute;
|
|
46013
|
+
if (!url || !graphic.resources) {
|
|
46014
|
+
return;
|
|
46015
|
+
}
|
|
46016
|
+
const res = graphic.resources.get(url);
|
|
46017
|
+
if (res.state !== 'success') {
|
|
46018
|
+
return;
|
|
46019
|
+
}
|
|
46020
|
+
}
|
|
46021
|
+
const textAlign = graphic.attribute.textAlign ?? graphic.textAlign ?? 'left';
|
|
46022
|
+
graphic.AABBBounds.width();
|
|
46023
|
+
const textLeft = graphic.globalAABBBounds.x1;
|
|
46024
|
+
const textRight = graphic.globalAABBBounds.x2;
|
|
46025
|
+
if (textAlign === 'center' && textStickBaseOnAlign) {
|
|
46026
|
+
const cellLeft = cellGroup.globalAABBBounds.x1 + (cellGroup.firstChild?.attribute.dx ?? 0);
|
|
46027
|
+
const cellRight = cellLeft + (cellGroup.contentWidth ?? cellGroup.attribute.width ?? 0);
|
|
46028
|
+
if (cellLeft < minLeft || cellRight > maxLeft) {
|
|
46029
|
+
const visibleCellLeft = Math.max(cellLeft, minLeft);
|
|
46030
|
+
const visibleCellRight = Math.min(cellRight, maxLeft);
|
|
46031
|
+
const delta = graphic.globalTransMatrix.e - (visibleCellRight + visibleCellLeft) / 2;
|
|
46032
|
+
!changedCells.has(`${cellGroup.col}-${cellGroup.row}`) &&
|
|
46033
|
+
changedCells.set(`${cellGroup.col}-${cellGroup.row}`, {
|
|
46034
|
+
col: cellGroup.col,
|
|
46035
|
+
row: cellGroup.row,
|
|
46036
|
+
dx: cellGroup.firstChild?.attribute.dx ?? 0,
|
|
46037
|
+
dy: cellGroup.firstChild?.attribute.dy ?? 0
|
|
46038
|
+
});
|
|
46039
|
+
cellGroup.forEachChildren((child) => {
|
|
46040
|
+
child.setAttribute('dx', (child.attribute.dx ?? 0) - delta + 2);
|
|
46041
|
+
});
|
|
46042
|
+
}
|
|
46043
|
+
}
|
|
46044
|
+
else if (textLeft < minLeft) {
|
|
45712
46045
|
const deltaWidth = textLeft - minLeft;
|
|
45713
46046
|
!changedCells.has(`${cellGroup.col}-${cellGroup.row}`) &&
|
|
45714
46047
|
changedCells.set(`${cellGroup.col}-${cellGroup.row}`, {
|
|
@@ -45775,7 +46108,7 @@
|
|
|
45775
46108
|
scene.colHeaderGroup.setAttribute('x', scene.cornerHeaderGroup.attribute.width);
|
|
45776
46109
|
scene.updateContainer();
|
|
45777
46110
|
scene.updateBorderSizeAndPosition();
|
|
45778
|
-
if (!scene.isPivot && !scene.transpose) {
|
|
46111
|
+
if (!scene.isPivot && !scene.table.transpose) {
|
|
45779
46112
|
scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1);
|
|
45780
46113
|
}
|
|
45781
46114
|
scene.hasFrozen = true;
|
|
@@ -45811,7 +46144,7 @@
|
|
|
45811
46144
|
scene.colHeaderGroup.setAttribute('x', scene.cornerHeaderGroup.attribute.width);
|
|
45812
46145
|
scene.updateContainer();
|
|
45813
46146
|
scene.updateBorderSizeAndPosition();
|
|
45814
|
-
if (!scene.isPivot && !scene.transpose) {
|
|
46147
|
+
if (!scene.isPivot && !scene.table.transpose) {
|
|
45815
46148
|
scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1);
|
|
45816
46149
|
}
|
|
45817
46150
|
scene.hasFrozen = true;
|
|
@@ -46270,151 +46603,6 @@
|
|
|
46270
46603
|
return x;
|
|
46271
46604
|
}
|
|
46272
46605
|
|
|
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
46606
|
function hideHoverIcon(col, row, scene) {
|
|
46419
46607
|
if (col === -1 || row === -1) {
|
|
46420
46608
|
return;
|
|
@@ -47064,13 +47252,13 @@
|
|
|
47064
47252
|
stage;
|
|
47065
47253
|
table;
|
|
47066
47254
|
isPivot;
|
|
47067
|
-
transpose;
|
|
47068
47255
|
hasFrozen;
|
|
47069
47256
|
frozenColCount;
|
|
47070
47257
|
frozenRowCount;
|
|
47071
47258
|
clear;
|
|
47072
47259
|
mergeMap;
|
|
47073
47260
|
_dealAutoFillHeightOriginRowsHeight;
|
|
47261
|
+
_needUpdateContainer = false;
|
|
47074
47262
|
constructor(table) {
|
|
47075
47263
|
this.table = table;
|
|
47076
47264
|
this.hasFrozen = false;
|
|
@@ -47142,7 +47330,6 @@
|
|
|
47142
47330
|
}
|
|
47143
47331
|
initSceneGraph() {
|
|
47144
47332
|
this.isPivot = this.table.isPivotTable();
|
|
47145
|
-
this.transpose = this.table.options.transpose;
|
|
47146
47333
|
initSceneGraph(this);
|
|
47147
47334
|
}
|
|
47148
47335
|
clearCells() {
|
|
@@ -47460,7 +47647,7 @@
|
|
|
47460
47647
|
updateColWidth(col, detaX, skipUpdateContainer, skipTableWidthMap) {
|
|
47461
47648
|
updateColWidth(this, col, Math.round(detaX), skipTableWidthMap);
|
|
47462
47649
|
if (!skipUpdateContainer) {
|
|
47463
|
-
this.updateContainer();
|
|
47650
|
+
this.updateContainer(true);
|
|
47464
47651
|
}
|
|
47465
47652
|
}
|
|
47466
47653
|
updateChartSize(col) {
|
|
@@ -47470,7 +47657,7 @@
|
|
|
47470
47657
|
this.table.isPivotChart() && updateChartState(this, datum);
|
|
47471
47658
|
}
|
|
47472
47659
|
updateCheckboxCellState(col, row, checked) {
|
|
47473
|
-
if (this.transpose) {
|
|
47660
|
+
if (this.table.transpose) {
|
|
47474
47661
|
this.bodyGroup.children?.forEach((columnGroup) => {
|
|
47475
47662
|
columnGroup
|
|
47476
47663
|
.getChildAt(row)
|
|
@@ -47494,7 +47681,7 @@
|
|
|
47494
47681
|
}
|
|
47495
47682
|
}
|
|
47496
47683
|
updateHeaderCheckboxCellState(col, row, checked) {
|
|
47497
|
-
if (this.transpose) {
|
|
47684
|
+
if (this.table.transpose) {
|
|
47498
47685
|
this.rowHeaderGroup.children?.forEach((columnGroup) => {
|
|
47499
47686
|
columnGroup
|
|
47500
47687
|
.getChildAt(row)
|
|
@@ -47805,7 +47992,7 @@
|
|
|
47805
47992
|
this.updateNextFrame();
|
|
47806
47993
|
}
|
|
47807
47994
|
afterScenegraphCreated() {
|
|
47808
|
-
if (!this.isPivot && !this.transpose) {
|
|
47995
|
+
if (!this.isPivot && !this.table.transpose) {
|
|
47809
47996
|
this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
|
|
47810
47997
|
}
|
|
47811
47998
|
this.table.stateManager.checkFrozen();
|
|
@@ -48021,11 +48208,26 @@
|
|
|
48021
48208
|
this.bottomFrozenGroup.setAttribute('x', this.table.getFrozenColsWidth());
|
|
48022
48209
|
this.bodyGroup.setAttribute('x', this.rowHeaderGroup.attribute.width);
|
|
48023
48210
|
}
|
|
48024
|
-
updateContainer() {
|
|
48025
|
-
|
|
48026
|
-
|
|
48027
|
-
|
|
48028
|
-
|
|
48211
|
+
updateContainer(async = false) {
|
|
48212
|
+
if (async) {
|
|
48213
|
+
if (!this._needUpdateContainer) {
|
|
48214
|
+
this._needUpdateContainer = true;
|
|
48215
|
+
setTimeout(() => {
|
|
48216
|
+
this.updateContainerAttrWidthAndX();
|
|
48217
|
+
this.updateTableSize();
|
|
48218
|
+
this.component.updateScrollBar();
|
|
48219
|
+
this.updateNextFrame();
|
|
48220
|
+
this._needUpdateContainer = false;
|
|
48221
|
+
}, 0);
|
|
48222
|
+
}
|
|
48223
|
+
}
|
|
48224
|
+
else {
|
|
48225
|
+
this.updateContainerAttrWidthAndX();
|
|
48226
|
+
this.updateTableSize();
|
|
48227
|
+
this.component.updateScrollBar();
|
|
48228
|
+
this.updateNextFrame();
|
|
48229
|
+
this._needUpdateContainer = false;
|
|
48230
|
+
}
|
|
48029
48231
|
}
|
|
48030
48232
|
updateCellContentWhileResize(col, row) {
|
|
48031
48233
|
const type = this.table.getBodyColumnType(col, row);
|
|
@@ -48127,7 +48329,7 @@
|
|
|
48127
48329
|
}
|
|
48128
48330
|
sortCell() {
|
|
48129
48331
|
if (this.isPivot) ;
|
|
48130
|
-
else if (this.transpose) {
|
|
48332
|
+
else if (this.table.transpose) {
|
|
48131
48333
|
this.proxy.sortCellHorizontal();
|
|
48132
48334
|
}
|
|
48133
48335
|
else {
|
|
@@ -48206,7 +48408,7 @@
|
|
|
48206
48408
|
}
|
|
48207
48409
|
}
|
|
48208
48410
|
this.table.stateManager.checkFrozen();
|
|
48209
|
-
if (!this.isPivot && !this.transpose) {
|
|
48411
|
+
if (!this.isPivot && !this.table.transpose) {
|
|
48210
48412
|
this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
|
|
48211
48413
|
}
|
|
48212
48414
|
this.component.updateScrollBar();
|
|
@@ -48217,7 +48419,7 @@
|
|
|
48217
48419
|
this.recalculateColWidths();
|
|
48218
48420
|
this.recalculateRowHeights();
|
|
48219
48421
|
this.table.stateManager.checkFrozen();
|
|
48220
|
-
if (!this.isPivot && !this.transpose) {
|
|
48422
|
+
if (!this.isPivot && !this.table.transpose) {
|
|
48221
48423
|
this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
|
|
48222
48424
|
}
|
|
48223
48425
|
this.component.updateScrollBar();
|
|
@@ -50241,39 +50443,6 @@
|
|
|
50241
50443
|
function bindTableGroupListener(eventManager) {
|
|
50242
50444
|
const table = eventManager.table;
|
|
50243
50445
|
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
50446
|
table.scenegraph.tableGroup.addEventListener('pointermove', (e) => {
|
|
50278
50447
|
const lastX = table.eventManager.LastPointerXY?.x ?? e.x;
|
|
50279
50448
|
const lastY = table.eventManager.LastPointerXY?.y ?? e.y;
|
|
@@ -51184,12 +51353,12 @@
|
|
|
51184
51353
|
const ranges = table.stateManager.select.ranges;
|
|
51185
51354
|
const col = Math.min(ranges[0].start.col, ranges[0].end.col);
|
|
51186
51355
|
const row = Math.min(ranges[0].start.row, ranges[0].end.row);
|
|
51356
|
+
const values = [];
|
|
51187
51357
|
navigator.clipboard.read().then(clipboardItems => {
|
|
51188
51358
|
for (const item of clipboardItems) {
|
|
51189
51359
|
if (item.types.includes('text/html')) {
|
|
51190
51360
|
item.getType('text/html').then(blob => {
|
|
51191
51361
|
blob.text().then(pastedData => {
|
|
51192
|
-
const values = [];
|
|
51193
51362
|
if (pastedData && /(<table)|(<TABLE)/g.test(pastedData)) {
|
|
51194
51363
|
const regex = /<tr[^>]*>(.*?)<\/tr>/gs;
|
|
51195
51364
|
const matches = Array.from(pastedData.matchAll(regex));
|
|
@@ -51209,22 +51378,33 @@
|
|
|
51209
51378
|
});
|
|
51210
51379
|
values.push(rowValues);
|
|
51211
51380
|
}
|
|
51381
|
+
table.changeCellValues(col, row, values, true);
|
|
51212
51382
|
}
|
|
51213
51383
|
else {
|
|
51214
|
-
|
|
51215
|
-
|
|
51216
|
-
|
|
51217
|
-
|
|
51218
|
-
|
|
51219
|
-
|
|
51220
|
-
|
|
51221
|
-
|
|
51384
|
+
navigator.clipboard.read().then(clipboardItems => {
|
|
51385
|
+
for (const item of clipboardItems) {
|
|
51386
|
+
if (item.types.includes('text/plain')) {
|
|
51387
|
+
item.getType('text/plain').then(blob => {
|
|
51388
|
+
blob.text().then(pastedData => {
|
|
51389
|
+
const rows = pastedData.split('\n');
|
|
51390
|
+
rows.forEach(function (rowCells, rowIndex) {
|
|
51391
|
+
const cells = rowCells.split('\t');
|
|
51392
|
+
const rowValues = [];
|
|
51393
|
+
values.push(rowValues);
|
|
51394
|
+
cells.forEach(function (cell, cellIndex) {
|
|
51395
|
+
if (cellIndex === cells.length - 1) {
|
|
51396
|
+
cell = cell.trim();
|
|
51397
|
+
}
|
|
51398
|
+
rowValues.push(cell);
|
|
51399
|
+
});
|
|
51400
|
+
});
|
|
51401
|
+
table.changeCellValues(col, row, values, true);
|
|
51402
|
+
});
|
|
51403
|
+
});
|
|
51222
51404
|
}
|
|
51223
|
-
|
|
51224
|
-
});
|
|
51405
|
+
}
|
|
51225
51406
|
});
|
|
51226
51407
|
}
|
|
51227
|
-
table.changeCellValues(col, row, values, true);
|
|
51228
51408
|
});
|
|
51229
51409
|
});
|
|
51230
51410
|
}
|
|
@@ -51232,26 +51412,22 @@
|
|
|
51232
51412
|
item.getType('text/plain').then(blob => {
|
|
51233
51413
|
blob.text().then(pastedData => {
|
|
51234
51414
|
const rows = pastedData.replace(/\r(?!\n)/g, '\r\n').split('\r\n');
|
|
51235
|
-
const values = [];
|
|
51236
51415
|
if (rows.length > 1 && rows[rows.length - 1] === '') {
|
|
51237
51416
|
rows.pop();
|
|
51238
51417
|
}
|
|
51239
51418
|
rows.forEach(function (rowCells, rowIndex) {
|
|
51240
51419
|
const cells = rowCells.split('\t');
|
|
51241
|
-
const rowValues = [];
|
|
51242
|
-
values.push(rowValues);
|
|
51243
51420
|
cells.forEach(function (cell, cellIndex) {
|
|
51244
51421
|
if (cell.includes('\n')) {
|
|
51245
51422
|
cell = cell
|
|
51246
51423
|
.replace(/^"(.*)"$/, '$1')
|
|
51247
51424
|
.replace(/["]*/g, match => new Array(Math.floor(match.length / 2)).fill('"').join(''));
|
|
51248
51425
|
}
|
|
51249
|
-
rowValues.push(cell);
|
|
51250
51426
|
});
|
|
51251
51427
|
});
|
|
51252
|
-
table.changeCellValues(col, row, values, true);
|
|
51253
51428
|
});
|
|
51254
51429
|
});
|
|
51430
|
+
table.changeCellValues(col, row, values, true);
|
|
51255
51431
|
}
|
|
51256
51432
|
else ;
|
|
51257
51433
|
}
|
|
@@ -51270,6 +51446,57 @@
|
|
|
51270
51446
|
}
|
|
51271
51447
|
table.resize();
|
|
51272
51448
|
});
|
|
51449
|
+
const globalPointerdownCallback = (e) => {
|
|
51450
|
+
table.eventManager.LastBodyPointerXY = { x: e.x, y: e.y };
|
|
51451
|
+
table.eventManager.isDown = true;
|
|
51452
|
+
};
|
|
51453
|
+
eventManager.globalEventListeners.push({
|
|
51454
|
+
name: 'pointerdown',
|
|
51455
|
+
env: 'body',
|
|
51456
|
+
callback: globalPointerdownCallback
|
|
51457
|
+
});
|
|
51458
|
+
document.body.addEventListener('pointerdown', globalPointerdownCallback);
|
|
51459
|
+
const globalPointerupCallback = (e) => {
|
|
51460
|
+
table.eventManager.LastBodyPointerXY = null;
|
|
51461
|
+
table.eventManager.isDown = false;
|
|
51462
|
+
table.eventManager.isDraging = false;
|
|
51463
|
+
};
|
|
51464
|
+
eventManager.globalEventListeners.push({
|
|
51465
|
+
name: 'pointerup',
|
|
51466
|
+
env: 'document',
|
|
51467
|
+
callback: globalPointerupCallback
|
|
51468
|
+
});
|
|
51469
|
+
document.addEventListener('pointerup', globalPointerupCallback);
|
|
51470
|
+
const globalPointermoveCallback = (e) => {
|
|
51471
|
+
if (table.eventManager.isDown && table.eventManager.LastBodyPointerXY) {
|
|
51472
|
+
const lastX = table.eventManager.LastBodyPointerXY?.x ?? e.x;
|
|
51473
|
+
const lastY = table.eventManager.LastBodyPointerXY?.y ?? e.y;
|
|
51474
|
+
if (Math.abs(lastX - e.x) > 1 || Math.abs(lastY - e.y) > 1) {
|
|
51475
|
+
table.eventManager.isDraging = true;
|
|
51476
|
+
}
|
|
51477
|
+
}
|
|
51478
|
+
const { x, y } = table._getMouseAbstractPoint(e, false);
|
|
51479
|
+
if (stateManager.interactionState === InteractionState.scrolling) {
|
|
51480
|
+
return;
|
|
51481
|
+
}
|
|
51482
|
+
if (stateManager.interactionState === InteractionState.grabing) {
|
|
51483
|
+
if (stateManager.isResizeCol()) {
|
|
51484
|
+
eventManager.dealColumnResize(x, y);
|
|
51485
|
+
if (table.hasListeners(TABLE_EVENT_TYPE.RESIZE_COLUMN)) {
|
|
51486
|
+
table.fireListeners(TABLE_EVENT_TYPE.RESIZE_COLUMN, {
|
|
51487
|
+
col: table.stateManager.columnResize.col,
|
|
51488
|
+
colWidth: table.getColWidth(table.stateManager.columnResize.col)
|
|
51489
|
+
});
|
|
51490
|
+
}
|
|
51491
|
+
}
|
|
51492
|
+
}
|
|
51493
|
+
};
|
|
51494
|
+
eventManager.globalEventListeners.push({
|
|
51495
|
+
name: 'pointermove',
|
|
51496
|
+
env: 'body',
|
|
51497
|
+
callback: globalPointermoveCallback
|
|
51498
|
+
});
|
|
51499
|
+
document.body.addEventListener('pointermove', globalPointermoveCallback);
|
|
51273
51500
|
}
|
|
51274
51501
|
|
|
51275
51502
|
function bindTouchListener(eventManager) {
|
|
@@ -51288,7 +51515,7 @@
|
|
|
51288
51515
|
timestamp: Date.now()
|
|
51289
51516
|
});
|
|
51290
51517
|
});
|
|
51291
|
-
|
|
51518
|
+
const globalTouchMoveCallback = (e) => {
|
|
51292
51519
|
if (eventManager.touchMove) {
|
|
51293
51520
|
e.preventDefault();
|
|
51294
51521
|
}
|
|
@@ -51314,8 +51541,14 @@
|
|
|
51314
51541
|
(Math.abs(deltaY) <= Math.abs(deltaX) && deltaX !== 0 && isHorizontalScrollable(deltaX, stateManager)))) {
|
|
51315
51542
|
e.preventDefault();
|
|
51316
51543
|
}
|
|
51317
|
-
}
|
|
51318
|
-
window.addEventListener('
|
|
51544
|
+
};
|
|
51545
|
+
window.addEventListener('touchmove', globalTouchMoveCallback, { passive: false });
|
|
51546
|
+
eventManager.globalEventListeners.push({
|
|
51547
|
+
name: 'touchmove',
|
|
51548
|
+
env: 'window',
|
|
51549
|
+
callback: globalTouchMoveCallback
|
|
51550
|
+
});
|
|
51551
|
+
const globalTouchEndCallback = (e) => {
|
|
51319
51552
|
eventManager.touchEnd = true;
|
|
51320
51553
|
eventManager.touchMove = false;
|
|
51321
51554
|
if (!eventManager.isTouchdown || !isTouchEvent$1(e)) {
|
|
@@ -51338,8 +51571,14 @@
|
|
|
51338
51571
|
}
|
|
51339
51572
|
eventManager.isTouchdown = false;
|
|
51340
51573
|
eventManager.touchMovePoints = [];
|
|
51574
|
+
};
|
|
51575
|
+
window.addEventListener('touchend', globalTouchEndCallback);
|
|
51576
|
+
eventManager.globalEventListeners.push({
|
|
51577
|
+
name: 'touchend',
|
|
51578
|
+
env: 'window',
|
|
51579
|
+
callback: globalTouchEndCallback
|
|
51341
51580
|
});
|
|
51342
|
-
|
|
51581
|
+
const globalTouchCancelCallback = (e) => {
|
|
51343
51582
|
eventManager.touchEnd = true;
|
|
51344
51583
|
eventManager.touchMove = false;
|
|
51345
51584
|
if (!eventManager.isTouchdown) {
|
|
@@ -51347,6 +51586,12 @@
|
|
|
51347
51586
|
}
|
|
51348
51587
|
eventManager.isTouchdown = false;
|
|
51349
51588
|
eventManager.touchMovePoints = [];
|
|
51589
|
+
};
|
|
51590
|
+
window.addEventListener('touchcancel', globalTouchCancelCallback);
|
|
51591
|
+
eventManager.globalEventListeners.push({
|
|
51592
|
+
name: 'touchcancel',
|
|
51593
|
+
env: 'window',
|
|
51594
|
+
callback: globalTouchCancelCallback
|
|
51350
51595
|
});
|
|
51351
51596
|
}
|
|
51352
51597
|
function isTouchEvent$1(e) {
|
|
@@ -51522,6 +51767,7 @@
|
|
|
51522
51767
|
LastBodyPointerXY;
|
|
51523
51768
|
isDown = false;
|
|
51524
51769
|
isDraging = false;
|
|
51770
|
+
globalEventListeners = [];
|
|
51525
51771
|
constructor(table) {
|
|
51526
51772
|
this.table = table;
|
|
51527
51773
|
if (Env.mode === 'node') {
|
|
@@ -51748,6 +51994,18 @@
|
|
|
51748
51994
|
}
|
|
51749
51995
|
release() {
|
|
51750
51996
|
this.gesture.release();
|
|
51997
|
+
this.globalEventListeners.forEach(item => {
|
|
51998
|
+
if (item.env === 'document') {
|
|
51999
|
+
document.removeEventListener(item.name, item.callback);
|
|
52000
|
+
}
|
|
52001
|
+
else if (item.env === 'body') {
|
|
52002
|
+
document.body.removeEventListener(item.name, item.callback);
|
|
52003
|
+
}
|
|
52004
|
+
else if (item.env === 'window') {
|
|
52005
|
+
window.removeEventListener(item.name, item.callback);
|
|
52006
|
+
}
|
|
52007
|
+
});
|
|
52008
|
+
this.globalEventListeners = [];
|
|
51751
52009
|
}
|
|
51752
52010
|
}
|
|
51753
52011
|
|
|
@@ -51795,7 +52053,7 @@
|
|
|
51795
52053
|
this._barHeight = style.barHeight ?? 3;
|
|
51796
52054
|
this._barHeight = style.barHeight ?? 3;
|
|
51797
52055
|
this._barBottom = style.barBottom ?? 0;
|
|
51798
|
-
this._barPadding = style.barPadding ?? [
|
|
52056
|
+
this._barPadding = style.barPadding ?? [0, 0, 0, 0];
|
|
51799
52057
|
this._showBarMark = style.showBarMark ?? false;
|
|
51800
52058
|
this._barMarkPositiveColor = style.barMarkPositiveColor ?? '#4dbd74';
|
|
51801
52059
|
this._barMarkNegativeColor = style.barMarkNegativeColor ?? '#f86c6b';
|
|
@@ -54949,7 +55207,7 @@
|
|
|
54949
55207
|
return TABLE_EVENT_TYPE;
|
|
54950
55208
|
}
|
|
54951
55209
|
options;
|
|
54952
|
-
version = "0.21.2
|
|
55210
|
+
version = "0.21.2";
|
|
54953
55211
|
pagination;
|
|
54954
55212
|
id = `VTable${Date.now()}`;
|
|
54955
55213
|
headerStyleCache;
|
|
@@ -66537,7 +66795,7 @@
|
|
|
66537
66795
|
}
|
|
66538
66796
|
|
|
66539
66797
|
registerForVrender();
|
|
66540
|
-
const version = "0.21.2
|
|
66798
|
+
const version = "0.21.2";
|
|
66541
66799
|
function getIcons() {
|
|
66542
66800
|
return get$2();
|
|
66543
66801
|
}
|