@windoc/core 0.3.21 → 0.3.23

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/dist/index.js CHANGED
@@ -78,7 +78,7 @@ __export(index_exports, {
78
78
  module.exports = __toCommonJS(index_exports);
79
79
 
80
80
  // src/version.ts
81
- var version = "0.3.21";
81
+ var version = "0.3.23";
82
82
 
83
83
  // src/dataset/enum/Common.ts
84
84
  var MaxHeightRatio = /* @__PURE__ */ ((MaxHeightRatio2) => {
@@ -503,7 +503,7 @@ var ElementType = /* @__PURE__ */ ((ElementType2) => {
503
503
  // src/utils/ua.ts
504
504
  var isApple = typeof navigator !== "undefined" && /Mac OS X/.test(navigator.userAgent);
505
505
  var isIOS = typeof navigator !== "undefined" && /iPad|iPhone/.test(navigator.userAgent);
506
- var isMobile = /Mobile|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
506
+ var isMobile = typeof navigator !== "undefined" && /Mobile|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
507
507
  navigator.userAgent
508
508
  );
509
509
  var isFirefox = typeof navigator !== "undefined" && /Firefox/.test(navigator.userAgent);
@@ -598,6 +598,8 @@ var TABLE_TD_ZIP_ATTR = [
598
598
  "externalId",
599
599
  "verticalAlign",
600
600
  "backgroundColor",
601
+ "borderColor",
602
+ "padding",
601
603
  "borderTypes",
602
604
  "slashTypes",
603
605
  "disabled",
@@ -4499,6 +4501,7 @@ function mergeOption(options = {}) {
4499
4501
  wordBreak: "break-word" /* BREAK_WORD */,
4500
4502
  printPixelRatio: 3,
4501
4503
  maskMargin: [0, 0, 0, 0],
4504
+ scrollPaddingLines: 3,
4502
4505
  letterClass: [LETTER_CLASS.ENGLISH],
4503
4506
  contextMenuDisableKeys: [],
4504
4507
  shortcutDisableKeys: [],
@@ -5016,6 +5019,37 @@ function pickElementAttr(payload, option = {}) {
5016
5019
  });
5017
5020
  return element;
5018
5021
  }
5022
+ function mergeSplitTableRowsForZip(trList) {
5023
+ for (let t = trList.length - 1; t >= 0; t--) {
5024
+ const splitTr = trList[t];
5025
+ if (!splitTr.splitParentId) continue;
5026
+ const parentTrIdx = trList.findIndex(
5027
+ (tr) => tr.id === splitTr.splitParentId
5028
+ );
5029
+ if (!~parentTrIdx) continue;
5030
+ const parentTr = trList[parentTrIdx];
5031
+ parentTr.height += splitTr.height;
5032
+ for (let d = 0; d < parentTr.tdList.length; d++) {
5033
+ const parentTd = parentTr.tdList[d];
5034
+ const splitTd = splitTr.tdList[d];
5035
+ if (!parentTd || !splitTd) continue;
5036
+ const hasSyntheticLeadingZero = !!splitTd.splitSyntheticLeadingZero && splitTd.value[0]?.value === ZERO;
5037
+ parentTd.value.push(
5038
+ ...hasSyntheticLeadingZero ? splitTd.value.slice(1) : splitTd.value
5039
+ );
5040
+ }
5041
+ trList.splice(t, 1);
5042
+ }
5043
+ for (let t = 0; t < trList.length; t++) {
5044
+ const tr = trList[t];
5045
+ delete tr.id;
5046
+ delete tr.splitParentId;
5047
+ delete tr.splitRootId;
5048
+ delete tr.splitLevel;
5049
+ delete tr.splitBoundaryTop;
5050
+ delete tr.splitBoundaryBottom;
5051
+ }
5052
+ }
5019
5053
  function zipElementList(payload, options = {}) {
5020
5054
  const { extraPickAttrs, isClassifyArea = false, isClone = true } = options;
5021
5055
  const elementList = isClone ? deepClone(payload) : payload;
@@ -5115,8 +5149,11 @@ function zipElementList(payload, options = {}) {
5115
5149
  while (tableIndex < elementList.length) {
5116
5150
  const nextElement = elementList[tableIndex];
5117
5151
  if (nextElement.pagingId === element.pagingId) {
5152
+ const nextTrList = nextElement.trList.filter(
5153
+ (tr) => !tr.pagingRepeat
5154
+ );
5118
5155
  element.height += nextElement.height;
5119
- element.trList.push(...nextElement.trList);
5156
+ element.trList.push(...nextTrList);
5120
5157
  tableIndex++;
5121
5158
  combineCount++;
5122
5159
  } else {
@@ -5126,9 +5163,9 @@ function zipElementList(payload, options = {}) {
5126
5163
  e += combineCount;
5127
5164
  }
5128
5165
  if (element.trList) {
5166
+ mergeSplitTableRowsForZip(element.trList);
5129
5167
  for (let t = 0; t < element.trList.length; t++) {
5130
5168
  const tr = element.trList[t];
5131
- delete tr.id;
5132
5169
  for (let d = 0; d < tr.tdList.length; d++) {
5133
5170
  const td = tr.tdList[d];
5134
5171
  const zipTd = {
@@ -6453,7 +6490,10 @@ var Cursor = class {
6453
6490
  const agentCursorDom = this.cursorAgent.getAgentCursorDom();
6454
6491
  if (document.activeElement !== agentCursorDom) {
6455
6492
  agentCursorDom.focus({ preventScroll: true });
6493
+ const scrollContainer = findScrollContainer(this.container);
6494
+ const { scrollLeft, scrollTop } = scrollContainer;
6456
6495
  agentCursorDom.setSelectionRange(0, 0);
6496
+ scrollContainer.scroll(scrollLeft, scrollTop);
6457
6497
  }
6458
6498
  }
6459
6499
  drawCursor(payload) {
@@ -6523,7 +6563,6 @@ var Cursor = class {
6523
6563
  this.recoveryCursor();
6524
6564
  return;
6525
6565
  }
6526
- const oldTop = this.cursorDom.style.top;
6527
6566
  const isReadonly = this.draw.isReadonly();
6528
6567
  this.cursorDom.style.width = `${width * scale}px`;
6529
6568
  this.cursorDom.style.backgroundColor = color;
@@ -6537,10 +6576,7 @@ var Cursor = class {
6537
6576
  this._clearBlinkTimeout();
6538
6577
  }
6539
6578
  nextTick2(() => {
6540
- this.moveCursorToVisible({
6541
- cursorPosition,
6542
- direction: parseInt(oldTop) > cursorTop ? "top" /* UP */ : "down" /* DOWN */
6543
- });
6579
+ this.moveCursorToVisible({ cursorPosition });
6544
6580
  });
6545
6581
  }
6546
6582
  recoveryCursor() {
@@ -6548,41 +6584,44 @@ var Cursor = class {
6548
6584
  this._clearBlinkTimeout();
6549
6585
  }
6550
6586
  moveCursorToVisible(payload) {
6551
- const { cursorPosition, direction } = payload;
6552
- if (!cursorPosition || !direction) return;
6587
+ const { cursorPosition } = payload;
6588
+ if (!cursorPosition) return;
6553
6589
  const {
6554
6590
  pageNo,
6555
- coordinate: { leftTop, leftBottom }
6591
+ coordinate: { leftTop },
6592
+ ascent,
6593
+ metrics: { boundingBoxAscent, boundingBoxDescent }
6556
6594
  } = cursorPosition;
6557
- const prePageY = pageNo * (this.draw.getHeight() + this.draw.getPageGap()) + this.container.getBoundingClientRect().top;
6558
- const isUp = direction === "top" /* UP */;
6559
- const x = leftBottom[0];
6560
- const cursorTop = leftTop[1] + cursorPosition.ascent - cursorPosition.metrics.boundingBoxAscent;
6561
- const cursorBottom = cursorTop + cursorPosition.metrics.boundingBoxAscent + cursorPosition.metrics.boundingBoxDescent;
6562
- const y = isUp ? cursorTop + prePageY : cursorBottom + prePageY;
6595
+ const containerRect = this.container.getBoundingClientRect();
6596
+ const pageOffset = pageNo * (this.draw.getHeight() + this.draw.getPageGap());
6597
+ const cursorTopViewport = containerRect.top + pageOffset + leftTop[1] + ascent - boundingBoxAscent;
6598
+ const cursorBottomViewport = cursorTopViewport + boundingBoxAscent + boundingBoxDescent;
6563
6599
  const scrollContainer = findScrollContainer(this.container);
6564
- const rect = {
6565
- left: 0,
6566
- right: 0,
6567
- top: 0,
6568
- bottom: 0
6569
- };
6600
+ let visibleTop;
6601
+ let visibleBottom;
6570
6602
  if (scrollContainer === document.documentElement) {
6571
- rect.right = window.innerWidth;
6572
- rect.bottom = window.innerHeight;
6603
+ visibleTop = 0;
6604
+ visibleBottom = window.innerHeight;
6573
6605
  } else {
6574
- const { left: left2, right: right2, top, bottom } = scrollContainer.getBoundingClientRect();
6575
- rect.left = left2;
6576
- rect.right = right2;
6577
- rect.top = top;
6578
- rect.bottom = bottom;
6579
- }
6580
- const { maskMargin } = this.options;
6581
- rect.top += maskMargin[0];
6582
- rect.bottom -= maskMargin[2];
6583
- if (!(x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom)) {
6584
- const { scrollLeft, scrollTop } = scrollContainer;
6585
- isUp ? scrollContainer.scroll(scrollLeft, scrollTop - (rect.top - y)) : scrollContainer.scroll(scrollLeft, scrollTop + y - rect.bottom);
6606
+ const scrollRect = scrollContainer.getBoundingClientRect();
6607
+ visibleTop = scrollRect.top;
6608
+ visibleBottom = scrollRect.bottom;
6609
+ }
6610
+ if (cursorTopViewport >= visibleTop && cursorBottomViewport <= visibleBottom) {
6611
+ return;
6612
+ }
6613
+ const scrollPadding = (boundingBoxAscent + boundingBoxDescent) * this.options.scrollPaddingLines;
6614
+ const { scrollLeft, scrollTop } = scrollContainer;
6615
+ if (cursorTopViewport < visibleTop) {
6616
+ scrollContainer.scroll(
6617
+ scrollLeft,
6618
+ scrollTop - (visibleTop - cursorTopViewport) - scrollPadding
6619
+ );
6620
+ } else {
6621
+ scrollContainer.scroll(
6622
+ scrollLeft,
6623
+ scrollTop + (cursorBottomViewport - visibleBottom) + scrollPadding
6624
+ );
6586
6625
  }
6587
6626
  }
6588
6627
  };
@@ -6828,6 +6867,57 @@ var RadioControl = class extends CheckboxControl {
6828
6867
  }
6829
6868
  };
6830
6869
 
6870
+ // src/core/event/handlers/splitCell.ts
6871
+ function isSameSplitCellSelection(first, second) {
6872
+ if (!first || !second) return false;
6873
+ return first.pagingId === second.pagingId && first.rootTrId === second.rootTrId && first.colIndex === second.colIndex;
6874
+ }
6875
+ function getSplitCellPointer(draw, position) {
6876
+ if (!position.isTable || position.index === void 0 || position.tdIndex === void 0 || position.tdValueIndex === void 0 || !position.trId) {
6877
+ return null;
6878
+ }
6879
+ const originalElementList = draw.getOriginalElementList();
6880
+ const tableElement = originalElementList[position.index];
6881
+ if (tableElement?.type !== "table" /* TABLE */ || !tableElement.pagingId || !tableElement.trList?.length) {
6882
+ return null;
6883
+ }
6884
+ const tr = tableElement.trList.find((row) => row.id === position.trId);
6885
+ const td = tr?.tdList[position.tdIndex];
6886
+ if (!tr || !td || td.colIndex === void 0 || !tr.id) {
6887
+ return null;
6888
+ }
6889
+ const splitCellSelection = {
6890
+ pagingId: tableElement.pagingId,
6891
+ rootTrId: tr.splitRootId || tr.id,
6892
+ colIndex: td.colIndex
6893
+ };
6894
+ const splitCellContext = draw.getSplitCellSelectionContext(
6895
+ originalElementList,
6896
+ splitCellSelection
6897
+ );
6898
+ if (!splitCellContext) {
6899
+ return null;
6900
+ }
6901
+ let globalIndex = 0;
6902
+ for (let c = 0; c < splitCellContext.cellContextList.length; c++) {
6903
+ const cellContext = splitCellContext.cellContextList[c];
6904
+ const currentTd = cellContext.td;
6905
+ const skipLeadingZero = !!currentTd.splitSyntheticLeadingZero && currentTd.value[0]?.value === ZERO ? 1 : 0;
6906
+ if (cellContext.tr.id === tr.id && currentTd.id === td.id) {
6907
+ globalIndex += Math.max(position.tdValueIndex - skipLeadingZero, 0);
6908
+ return {
6909
+ splitCellSelection,
6910
+ globalIndex
6911
+ };
6912
+ }
6913
+ globalIndex += Math.max(currentTd.value.length - skipLeadingZero, 0);
6914
+ }
6915
+ return null;
6916
+ }
6917
+ function isSameSplitCellPointer(first, second) {
6918
+ return isSameSplitCellSelection(first, second);
6919
+ }
6920
+
6831
6921
  // src/core/event/handlers/mousedown.ts
6832
6922
  function setRangeCache(host) {
6833
6923
  const draw = host.getDraw();
@@ -6915,9 +7005,11 @@ function mousedown(evt, host) {
6915
7005
  tdValueIndex,
6916
7006
  hitLineStartIndex
6917
7007
  } = positionResult;
7008
+ const splitCellPointer = getSplitCellPointer(draw, positionResult);
6918
7009
  host.mouseDownStartPosition = {
6919
7010
  ...positionResult,
6920
- index: isTable ? tdValueIndex : index,
7011
+ index: splitCellPointer ? splitCellPointer.globalIndex : isTable ? tdValueIndex : index,
7012
+ splitCellSelection: splitCellPointer?.splitCellSelection,
6921
7013
  x: evt.offsetX,
6922
7014
  y: evt.offsetY
6923
7015
  };
@@ -7357,10 +7449,33 @@ function mousemove(evt, host) {
7357
7449
  isTable: startIsTable,
7358
7450
  tdIndex: startTdIndex,
7359
7451
  trIndex: startTrIndex,
7360
- tableId: startTableId
7452
+ tableId: startTableId,
7453
+ splitCellSelection: startSplitCellSelection
7361
7454
  } = host.mouseDownStartPosition;
7362
7455
  const endIndex = isTable ? tdValueIndex : index;
7363
7456
  const rangeManager = draw.getRange();
7457
+ if (startSplitCellSelection) {
7458
+ const currentSplitCellPointer = getSplitCellPointer(draw, positionResult);
7459
+ if (currentSplitCellPointer && isSameSplitCellPointer(
7460
+ startSplitCellSelection,
7461
+ currentSplitCellPointer.splitCellSelection
7462
+ )) {
7463
+ let start = startIndex;
7464
+ let end = currentSplitCellPointer.globalIndex;
7465
+ if (start > end) {
7466
+ [start, end] = [end, start];
7467
+ }
7468
+ if (start === end) return;
7469
+ rangeManager.setRange(start, end);
7470
+ rangeManager.setSplitCellSelection(startSplitCellSelection);
7471
+ draw.render({
7472
+ isSubmitHistory: false,
7473
+ isSetCursor: false,
7474
+ isCompute: false
7475
+ });
7476
+ return;
7477
+ }
7478
+ }
7364
7479
  if (isTable && startIsTable && (tdIndex !== startTdIndex || trIndex !== startTrIndex)) {
7365
7480
  rangeManager.setRange(
7366
7481
  endIndex,
@@ -7527,7 +7642,9 @@ function backspace(evt, host) {
7527
7642
  const control = draw.getControl();
7528
7643
  const { startIndex, endIndex, isCrossRowCol } = rangeManager.getRange();
7529
7644
  let curIndex;
7530
- if (isCrossRowCol) {
7645
+ if (rangeManager.getSplitCellSelection() && startIndex !== endIndex) {
7646
+ curIndex = draw.replaceSplitCellSelection([]);
7647
+ } else if (isCrossRowCol) {
7531
7648
  const rowCol = draw.getTableParticle().getRangeRowCol();
7532
7649
  if (!rowCol) return;
7533
7650
  let isDeleted = false;
@@ -7685,7 +7802,9 @@ function del(evt, host) {
7685
7802
  deleteHideElement(host);
7686
7803
  }
7687
7804
  let curIndex;
7688
- if (isCrossRowCol) {
7805
+ if (rangeManager.getSplitCellSelection() && startIndex !== endIndex) {
7806
+ curIndex = draw.replaceSplitCellSelection([]);
7807
+ } else if (isCrossRowCol) {
7689
7808
  const rowCol = draw.getTableParticle().getRangeRowCol();
7690
7809
  if (!rowCol) return;
7691
7810
  let isDeleted = false;
@@ -8474,8 +8593,7 @@ function updown(evt, host) {
8474
8593
  });
8475
8594
  if (!isCollapsed) {
8476
8595
  draw.getCursor().moveCursorToVisible({
8477
- cursorPosition: positionList[isUp ? anchorStartIndex : anchorEndIndex],
8478
- direction: isUp ? "top" /* UP */ : "down" /* DOWN */
8596
+ cursorPosition: positionList[isUp ? anchorStartIndex : anchorEndIndex]
8479
8597
  });
8480
8598
  }
8481
8599
  }
@@ -8597,6 +8715,8 @@ function input(data2, host) {
8597
8715
  if (!isComposing) {
8598
8716
  control.emitControlContentChange();
8599
8717
  }
8718
+ } else if (rangeManager.getSplitCellSelection()) {
8719
+ curIndex = draw.replaceSplitCellSelection(inputData);
8600
8720
  } else {
8601
8721
  const start = startIndex + 1;
8602
8722
  if (startIndex !== endIndex) {
@@ -9096,7 +9216,7 @@ var CanvasEvent = class {
9096
9216
  }
9097
9217
  selectAll() {
9098
9218
  if (this.position.getPositionContext().isTable) {
9099
- this.draw.getTableOperate().tableSelectAll();
9219
+ this.draw.getTableOperate().tableTdSelectAll();
9100
9220
  } else {
9101
9221
  const positionList = this.position.getPositionList();
9102
9222
  this.range.setRange(0, positionList.length - 1);
@@ -9373,6 +9493,10 @@ var Position = class {
9373
9493
  return this.floatPositionList;
9374
9494
  }
9375
9495
  getTablePositionList(sourceElementList) {
9496
+ const splitCellSelectionContext = this.draw.getSplitCellSelectionContext(sourceElementList);
9497
+ if (splitCellSelectionContext) {
9498
+ return splitCellSelectionContext.positionList;
9499
+ }
9376
9500
  return this.draw.resolveTableCellContext(sourceElementList, this.positionContext)?.td.positionList || [];
9377
9501
  }
9378
9502
  getPositionList() {
@@ -10163,6 +10287,18 @@ var RangeManager = class {
10163
10287
  clearRange() {
10164
10288
  this.setRange(-1, -1);
10165
10289
  }
10290
+ getSplitCellSelection() {
10291
+ return this.range.splitCellSelection;
10292
+ }
10293
+ setSplitCellSelection(payload) {
10294
+ this.range.splitCellSelection = payload || void 0;
10295
+ }
10296
+ getTableCellSelection() {
10297
+ return this.range.tableCellSelection;
10298
+ }
10299
+ setTableCellSelection(payload) {
10300
+ this.range.tableCellSelection = payload || void 0;
10301
+ }
10166
10302
  setDefaultStyle(style) {
10167
10303
  if (!style) {
10168
10304
  this.defaultStyle = null;
@@ -10453,6 +10589,8 @@ var RangeManager = class {
10453
10589
  this.range.isCrossRowCol = !!(startTdIndex || endTdIndex || startTrIndex || endTrIndex);
10454
10590
  this.setDefaultStyle(null);
10455
10591
  }
10592
+ this.range.splitCellSelection = void 0;
10593
+ this.range.tableCellSelection = void 0;
10456
10594
  this.range.zone = this.draw.getZone().getZone();
10457
10595
  const control = this.draw.getControl();
10458
10596
  if (~startIndex && ~endIndex) {
@@ -12175,6 +12313,44 @@ var TableParticle = class {
12175
12313
  }
12176
12314
  ctx.restore();
12177
12315
  }
12316
+ _isSelectedCell(element, tr, td, selection) {
12317
+ if (selection.pagingId && selection.rootTrId && selection.colIndex !== void 0) {
12318
+ return element.pagingId === selection.pagingId && (tr.id === selection.rootTrId || tr.splitRootId === selection.rootTrId) && td.colIndex === selection.colIndex;
12319
+ }
12320
+ if (selection.tableId && element.id !== selection.tableId) {
12321
+ return false;
12322
+ }
12323
+ if (selection.trId && tr.id !== selection.trId) {
12324
+ return false;
12325
+ }
12326
+ if (selection.tdId) {
12327
+ return td.id === selection.tdId;
12328
+ }
12329
+ return false;
12330
+ }
12331
+ drawCellRange(ctx, element, startX, startY, selection) {
12332
+ const { scale, rangeAlpha, rangeColor } = this.options;
12333
+ const { type, trList } = element;
12334
+ if (!trList || type !== "table" /* TABLE */) return;
12335
+ ctx.save();
12336
+ ctx.globalAlpha = rangeAlpha;
12337
+ ctx.fillStyle = rangeColor;
12338
+ for (let t = 0; t < trList.length; t++) {
12339
+ const tr = trList[t];
12340
+ for (let d = 0; d < tr.tdList.length; d++) {
12341
+ const td = tr.tdList[d];
12342
+ if (!this._isSelectedCell(element, tr, td, selection)) {
12343
+ continue;
12344
+ }
12345
+ const x = td.x * scale;
12346
+ const y = td.y * scale;
12347
+ const width = td.width * scale;
12348
+ const height = td.height * scale;
12349
+ ctx.fillRect(x + startX, y + startY, width, height);
12350
+ }
12351
+ }
12352
+ ctx.restore();
12353
+ }
12178
12354
  render(ctx, element, startX, startY) {
12179
12355
  this._drawBackgroundColor(ctx, element, startX, startY);
12180
12356
  this._drawBorder(ctx, element, startX, startY);
@@ -16679,17 +16855,14 @@ function computeValue(data2, options) {
16679
16855
  const { extraPickAttrs = [] } = options || {};
16680
16856
  return {
16681
16857
  header: zipElementList(data2.header, {
16682
- extraPickAttrs,
16683
- isClone: false
16858
+ extraPickAttrs
16684
16859
  }),
16685
16860
  main: zipElementList(data2.main, {
16686
16861
  extraPickAttrs,
16687
- isClassifyArea: true,
16688
- isClone: false
16862
+ isClassifyArea: true
16689
16863
  }),
16690
16864
  footer: zipElementList(data2.footer, {
16691
- extraPickAttrs,
16692
- isClone: false
16865
+ extraPickAttrs
16693
16866
  })
16694
16867
  };
16695
16868
  }
@@ -18728,6 +18901,38 @@ var ListParticle = class {
18728
18901
  const level = element.listLevel ?? 0;
18729
18902
  return level * INDENT_PER_LEVEL * scale;
18730
18903
  }
18904
+ _getListMarkerStyleElement(elementList, startIndex = 0) {
18905
+ const startElement = elementList[startIndex];
18906
+ for (let i = startIndex + 1; i < elementList.length; i++) {
18907
+ const element = elementList[i];
18908
+ if (element.value === ZERO && !element.listWrap) {
18909
+ break;
18910
+ }
18911
+ if (element.type === "tab" /* TAB */) {
18912
+ continue;
18913
+ }
18914
+ if (element.value !== ZERO || element.type) {
18915
+ return element;
18916
+ }
18917
+ }
18918
+ return startElement;
18919
+ }
18920
+ _getListMarkerText(element, listIndex) {
18921
+ if (element.listStyle === "checkbox" /* CHECKBOX */) {
18922
+ return "";
18923
+ }
18924
+ if (element.listType === "ul" /* UL */) {
18925
+ if (element.listPreset) {
18926
+ return this._getUlBulletForLevel(element);
18927
+ }
18928
+ return ulStyleMapping[element.listStyle] || ulStyleMapping["disc" /* DISC */];
18929
+ }
18930
+ if (element.listPreset) {
18931
+ const olStyle = this._getOlStyleForLevel(element);
18932
+ return formatOlNumber(listIndex, olStyle);
18933
+ }
18934
+ return `${listIndex + 1}${"." /* PERIOD */}`;
18935
+ }
18731
18936
  computeListStyle(ctx, elementList) {
18732
18937
  const listStyleMap = /* @__PURE__ */ new Map();
18733
18938
  let start = 0;
@@ -18758,23 +18963,40 @@ var ListParticle = class {
18758
18963
  }
18759
18964
  getListStyleWidth(ctx, listElementList) {
18760
18965
  const { scale, checkbox } = this.options;
18761
- const startElement = listElementList[0];
18762
- if (startElement.listStyle && startElement.listStyle !== "decimal" /* DECIMAL */) {
18763
- if (startElement.listStyle === "checkbox" /* CHECKBOX */) {
18764
- return (checkbox.width + this.LIST_GAP) * scale;
18966
+ let maxWidth = 0;
18967
+ let listIndex = 0;
18968
+ for (let i = 0; i < listElementList.length; i++) {
18969
+ const element = listElementList[i];
18970
+ if (element.value !== ZERO || element.listWrap) continue;
18971
+ if (element.listStyle === "checkbox" /* CHECKBOX */) {
18972
+ maxWidth = Math.max(maxWidth, checkbox.width + this.LIST_GAP);
18973
+ listIndex++;
18974
+ continue;
18765
18975
  }
18766
- return this.UN_COUNT_STYLE_WIDTH * scale;
18767
- }
18768
- const count = listElementList.reduce((pre, cur) => {
18769
- if (cur.value === ZERO) {
18770
- pre += 1;
18976
+ const markerStyleElement = this._getListMarkerStyleElement(
18977
+ listElementList,
18978
+ i
18979
+ );
18980
+ const text = this._getListMarkerText(element, listIndex);
18981
+ if (!text) {
18982
+ listIndex++;
18983
+ continue;
18771
18984
  }
18772
- return pre;
18773
- }, 0);
18774
- if (!count) return 0;
18775
- const text = `${this.MEASURE_BASE_TEXT.repeat(String(count).length)}${"." /* PERIOD */}`;
18776
- const textMetrics = ctx.measureText(text);
18777
- return Math.ceil((textMetrics.width + this.LIST_GAP) * scale);
18985
+ ctx.save();
18986
+ ctx.font = this.draw.getElementFont(markerStyleElement);
18987
+ const textMetrics = ctx.measureText(text);
18988
+ ctx.restore();
18989
+ maxWidth = Math.max(maxWidth, textMetrics.width + this.LIST_GAP);
18990
+ listIndex++;
18991
+ }
18992
+ if (maxWidth > 0) {
18993
+ return Math.ceil(maxWidth * scale);
18994
+ }
18995
+ const startElement = listElementList[0];
18996
+ if (startElement?.listStyle === "checkbox" /* CHECKBOX */) {
18997
+ return (checkbox.width + this.LIST_GAP) * scale;
18998
+ }
18999
+ return this.UN_COUNT_STYLE_WIDTH * scale;
18778
19000
  }
18779
19001
  _getOlStyleForLevel(element) {
18780
19002
  const preset = element.listPreset || "olDefault" /* DEFAULT */;
@@ -18795,7 +19017,7 @@ var ListParticle = class {
18795
19017
  const startElement = elementList[0];
18796
19018
  if (startElement.value !== ZERO || startElement.listWrap) return;
18797
19019
  let tabWidth = 0;
18798
- const { defaultTabWidth, scale, defaultFont, defaultSize } = this.options;
19020
+ const { defaultTabWidth, scale } = this.options;
18799
19021
  for (let i = 1; i < elementList.length; i++) {
18800
19022
  const element = elementList[i];
18801
19023
  if (element?.type !== "tab" /* TAB */) break;
@@ -18833,24 +19055,11 @@ var ListParticle = class {
18833
19055
  }
18834
19056
  });
18835
19057
  } else {
18836
- let text = "";
18837
- if (startElement.listType === "ul" /* UL */) {
18838
- if (startElement.listPreset) {
18839
- text = this._getUlBulletForLevel(startElement);
18840
- } else {
18841
- text = ulStyleMapping[startElement.listStyle] || ulStyleMapping["disc" /* DISC */];
18842
- }
18843
- } else {
18844
- if (startElement.listPreset) {
18845
- const olStyle = this._getOlStyleForLevel(startElement);
18846
- text = formatOlNumber(listIndex, olStyle);
18847
- } else {
18848
- text = `${listIndex + 1}${"." /* PERIOD */}`;
18849
- }
18850
- }
19058
+ const text = this._getListMarkerText(startElement, listIndex);
18851
19059
  if (!text) return;
19060
+ const markerStyleElement = this._getListMarkerStyleElement(elementList);
18852
19061
  ctx.save();
18853
- ctx.font = `${defaultSize * (96 / 72) * scale}px ${defaultFont}`;
19062
+ ctx.font = this.draw.getElementFont(markerStyleElement, scale);
18854
19063
  ctx.fillText(text, x, y);
18855
19064
  ctx.restore();
18856
19065
  }
@@ -19300,6 +19509,39 @@ var TableOperate = class {
19300
19509
  this.tableParticle = draw.getTableParticle();
19301
19510
  this.options = draw.getOptions();
19302
19511
  }
19512
+ getActiveTableElements() {
19513
+ const positionContext = this.position.getPositionContext();
19514
+ if (!positionContext.isTable) return [];
19515
+ const originalElementList = this.draw.getOriginalElementList();
19516
+ const element = originalElementList[positionContext.index];
19517
+ if (!element || element.type !== "table" /* TABLE */) return [];
19518
+ if (!element.pagingId) return [element];
19519
+ return originalElementList.filter(
19520
+ (item) => item.type === "table" /* TABLE */ && item.pagingId === element.pagingId
19521
+ );
19522
+ }
19523
+ getSplitCellStyleSelection() {
19524
+ const tableCellSelection = this.range.getTableCellSelection();
19525
+ if (tableCellSelection?.pagingId && tableCellSelection.rootTrId && tableCellSelection.colIndex !== void 0) {
19526
+ return tableCellSelection;
19527
+ }
19528
+ return this.range.getSplitCellSelection();
19529
+ }
19530
+ getStyleTargetRowCol() {
19531
+ const splitCellSelection = this.getSplitCellStyleSelection();
19532
+ if (splitCellSelection) {
19533
+ const splitCellContext = this.draw.getSplitCellSelectionContext(
19534
+ this.draw.getOriginalElementList(),
19535
+ splitCellSelection
19536
+ );
19537
+ if (splitCellContext) {
19538
+ return splitCellContext.cellContextList.map((cellContext) => [
19539
+ cellContext.td
19540
+ ]);
19541
+ }
19542
+ }
19543
+ return this.tableParticle.getRangeRowCol();
19544
+ }
19303
19545
  insertTable(row, col) {
19304
19546
  const { startIndex, endIndex } = this.range.getRange();
19305
19547
  if (!~startIndex && !~endIndex) return;
@@ -19980,7 +20222,7 @@ var TableOperate = class {
19980
20222
  this.tableTool.render();
19981
20223
  }
19982
20224
  tableTdVerticalAlign(payload) {
19983
- const rowCol = this.tableParticle.getRangeRowCol();
20225
+ const rowCol = this.getStyleTargetRowCol();
19984
20226
  if (!rowCol) return;
19985
20227
  for (let r = 0; r < rowCol.length; r++) {
19986
20228
  const row = rowCol[r];
@@ -20000,13 +20242,17 @@ var TableOperate = class {
20000
20242
  tableBorderType(payload) {
20001
20243
  const positionContext = this.position.getPositionContext();
20002
20244
  if (!positionContext.isTable) return;
20003
- const { index } = positionContext;
20004
- const originalElementList = this.draw.getOriginalElementList();
20005
- const element = originalElementList[index];
20006
- if (!element.borderType && payload === "all" /* ALL */ || element.borderType === payload) {
20245
+ const tableElements = this.getActiveTableElements();
20246
+ if (!tableElements.length) return;
20247
+ const isAllSame = tableElements.every(
20248
+ (element) => !element.borderType && payload === "all" /* ALL */ || element.borderType === payload
20249
+ );
20250
+ if (isAllSame) {
20007
20251
  return;
20008
20252
  }
20009
- element.borderType = payload;
20253
+ tableElements.forEach((element) => {
20254
+ element.borderType = payload;
20255
+ });
20010
20256
  const { endIndex } = this.range.getRange();
20011
20257
  this.draw.render({
20012
20258
  curIndex: endIndex
@@ -20015,13 +20261,17 @@ var TableOperate = class {
20015
20261
  tableBorderColor(payload) {
20016
20262
  const positionContext = this.position.getPositionContext();
20017
20263
  if (!positionContext.isTable) return;
20018
- const { index } = positionContext;
20019
- const originalElementList = this.draw.getOriginalElementList();
20020
- const element = originalElementList[index];
20021
- if (!element.borderColor && payload === this.options.table.defaultBorderColor || element.borderColor === payload) {
20264
+ const tableElements = this.getActiveTableElements();
20265
+ if (!tableElements.length) return;
20266
+ const isAllSame = tableElements.every(
20267
+ (element) => !element.borderColor && payload === this.options.table.defaultBorderColor || element.borderColor === payload
20268
+ );
20269
+ if (isAllSame) {
20022
20270
  return;
20023
20271
  }
20024
- element.borderColor = payload;
20272
+ tableElements.forEach((element) => {
20273
+ element.borderColor = payload;
20274
+ });
20025
20275
  const { endIndex } = this.range.getRange();
20026
20276
  this.draw.render({
20027
20277
  curIndex: endIndex,
@@ -20029,7 +20279,7 @@ var TableOperate = class {
20029
20279
  });
20030
20280
  }
20031
20281
  tableTdBorderType(payload) {
20032
- const rowCol = this.tableParticle.getRangeRowCol();
20282
+ const rowCol = this.getStyleTargetRowCol();
20033
20283
  if (!rowCol) return;
20034
20284
  const tdList = rowCol.flat();
20035
20285
  const isSetBorderType = tdList.some(
@@ -20061,7 +20311,7 @@ var TableOperate = class {
20061
20311
  });
20062
20312
  }
20063
20313
  tableTdSlashType(payload) {
20064
- const rowCol = this.tableParticle.getRangeRowCol();
20314
+ const rowCol = this.getStyleTargetRowCol();
20065
20315
  if (!rowCol) return;
20066
20316
  const tdList = rowCol.flat();
20067
20317
  const isSetTdSlashType = tdList.some(
@@ -20091,7 +20341,7 @@ var TableOperate = class {
20091
20341
  });
20092
20342
  }
20093
20343
  tableTdBackgroundColor(payload) {
20094
- const rowCol = this.tableParticle.getRangeRowCol();
20344
+ const rowCol = this.getStyleTargetRowCol();
20095
20345
  if (!rowCol) return;
20096
20346
  for (let r = 0; r < rowCol.length; r++) {
20097
20347
  const row = rowCol[r];
@@ -20112,14 +20362,14 @@ var TableOperate = class {
20112
20362
  const { index } = positionContext;
20113
20363
  const originalElementList = this.draw.getOriginalElementList();
20114
20364
  const element = originalElementList[index];
20115
- const rowCol = this.tableParticle.getRangeRowCol();
20365
+ const rowCol = this.getStyleTargetRowCol();
20116
20366
  if (!rowCol) return;
20117
20367
  const tdList = rowCol.flat();
20118
20368
  const totalCells = element.trList.reduce(
20119
20369
  (sum, tr) => sum + tr.tdList.length,
20120
20370
  0
20121
20371
  );
20122
- const allSelected = tdList.length >= totalCells;
20372
+ const allSelected = !element.pagingId && !this.getSplitCellStyleSelection() && tdList.length >= totalCells;
20123
20373
  if (allSelected) {
20124
20374
  element.borderColor = payload || void 0;
20125
20375
  element.trList.forEach(
@@ -20139,7 +20389,7 @@ var TableOperate = class {
20139
20389
  });
20140
20390
  }
20141
20391
  tableTdPadding(payload) {
20142
- const rowCol = this.tableParticle.getRangeRowCol();
20392
+ const rowCol = this.getStyleTargetRowCol();
20143
20393
  if (!rowCol) return;
20144
20394
  const tdList = rowCol.flat();
20145
20395
  tdList.forEach((td) => {
@@ -20174,6 +20424,46 @@ var TableOperate = class {
20174
20424
  isSubmitHistory: false
20175
20425
  });
20176
20426
  }
20427
+ tableTdSelectAll() {
20428
+ const originalElementList = this.draw.getOriginalElementList();
20429
+ const resolved = this.draw.resolveTableCellContext(originalElementList);
20430
+ if (!resolved) return;
20431
+ const currentTr = resolved.element.trList?.[resolved.trIndex];
20432
+ if (!currentTr) return;
20433
+ const currentTd = resolved.td;
20434
+ const currentElement = resolved.element;
20435
+ const splitCellSelection = currentElement.pagingId && currentTr.id && currentTd.colIndex !== void 0 ? {
20436
+ pagingId: currentElement.pagingId,
20437
+ rootTrId: currentTr.splitRootId || currentTr.id,
20438
+ colIndex: currentTd.colIndex
20439
+ } : void 0;
20440
+ const splitCellSelectionContext = this.draw.getSplitCellSelectionContext(
20441
+ originalElementList,
20442
+ splitCellSelection
20443
+ );
20444
+ if (splitCellSelectionContext) {
20445
+ const endIndex = Math.max(
20446
+ splitCellSelectionContext.positionList.length - 1,
20447
+ 0
20448
+ );
20449
+ this.range.setRange(0, endIndex);
20450
+ this.range.setSplitCellSelection(splitCellSelection);
20451
+ this.range.setTableCellSelection(splitCellSelection);
20452
+ } else {
20453
+ const endIndex = Math.max(currentTd.value.length - 1, 0);
20454
+ this.range.setRange(0, endIndex);
20455
+ this.range.setTableCellSelection({
20456
+ tableId: currentElement.id,
20457
+ trId: currentTr.id,
20458
+ tdId: currentTd.id
20459
+ });
20460
+ }
20461
+ this.draw.render({
20462
+ isSetCursor: false,
20463
+ isCompute: false,
20464
+ isSubmitHistory: false
20465
+ });
20466
+ }
20177
20467
  };
20178
20468
 
20179
20469
  // src/dataset/enum/Area.ts
@@ -21031,8 +21321,156 @@ var Draw = class {
21031
21321
  return this.header.getElementList();
21032
21322
  }
21033
21323
  getTableElementList(sourceElementList) {
21324
+ const splitCellSelectionContext = this.getSplitCellSelectionContext(
21325
+ sourceElementList
21326
+ );
21327
+ if (splitCellSelectionContext) {
21328
+ return splitCellSelectionContext.value;
21329
+ }
21034
21330
  return this.resolveTableCellContext(sourceElementList)?.td.value || [];
21035
21331
  }
21332
+ getSplitCellSelectionContext(sourceElementList = this.getOriginalElementList(), splitCellSelection = this.range.getSplitCellSelection()) {
21333
+ if (!splitCellSelection) return null;
21334
+ const { pagingId, rootTrId, colIndex } = splitCellSelection;
21335
+ const cellContextList = [];
21336
+ for (let i = 0; i < sourceElementList.length; i++) {
21337
+ const element = sourceElementList[i];
21338
+ if (element.type !== "table" /* TABLE */ || element.pagingId !== pagingId) {
21339
+ continue;
21340
+ }
21341
+ const trList = element.trList;
21342
+ if (!trList?.length) continue;
21343
+ for (let t = 0; t < trList.length; t++) {
21344
+ const tr = trList[t];
21345
+ if (tr.id !== rootTrId && tr.splitRootId !== rootTrId) continue;
21346
+ const tdIndex = tr.tdList.findIndex((td2) => td2.colIndex === colIndex);
21347
+ if (tdIndex < 0) continue;
21348
+ const td = tr.tdList[tdIndex];
21349
+ cellContextList.push({
21350
+ tableIndex: i,
21351
+ trIndex: t,
21352
+ tdIndex,
21353
+ element,
21354
+ tr,
21355
+ td
21356
+ });
21357
+ }
21358
+ }
21359
+ if (cellContextList.length < 2) return null;
21360
+ const value = [];
21361
+ const positionList = [];
21362
+ for (let c = 0; c < cellContextList.length; c++) {
21363
+ const { td } = cellContextList[c];
21364
+ const skipLeadingZero = !!td.splitSyntheticLeadingZero && td.value[0]?.value === ZERO ? 1 : 0;
21365
+ value.push(...td.value.slice(skipLeadingZero));
21366
+ if (td.positionList?.length) {
21367
+ positionList.push(...td.positionList.slice(skipLeadingZero));
21368
+ }
21369
+ }
21370
+ return {
21371
+ value,
21372
+ positionList,
21373
+ cellContextList
21374
+ };
21375
+ }
21376
+ syncTableElementContext(elementList, context) {
21377
+ const { tableId, trId, tdId } = context;
21378
+ for (let i = 0; i < elementList.length; i++) {
21379
+ const element = elementList[i];
21380
+ element.tableId = tableId;
21381
+ element.trId = trId;
21382
+ element.tdId = tdId;
21383
+ }
21384
+ }
21385
+ getCollapsedSplitTableCursorContext(element) {
21386
+ const positionContext = this.position.getPositionContext();
21387
+ const { startIndex, endIndex } = this.range.getRange();
21388
+ if (!element.pagingId || !positionContext.isTable || startIndex !== endIndex || positionContext.tableId !== element.id || !positionContext.trId) {
21389
+ return null;
21390
+ }
21391
+ const trList = element.trList;
21392
+ if (!trList?.length) return null;
21393
+ const currentTr = trList.find((tr) => tr.id === positionContext.trId);
21394
+ const currentTd = currentTr && (positionContext.tdId ? currentTr.tdList.find((td) => td.id === positionContext.tdId) : currentTr.tdList[positionContext.tdIndex]);
21395
+ if (!currentTr?.id || !currentTd || currentTd.colIndex === void 0) {
21396
+ return null;
21397
+ }
21398
+ const rootTrId = currentTr.splitRootId || currentTr.id;
21399
+ let mergedIndex = 0;
21400
+ for (let t = 0; t < trList.length; t++) {
21401
+ const tr = trList[t];
21402
+ if (tr.id !== rootTrId && tr.splitRootId !== rootTrId) {
21403
+ continue;
21404
+ }
21405
+ const td = tr.tdList.find((cell) => cell.colIndex === currentTd.colIndex);
21406
+ if (!td) continue;
21407
+ const skipLeadingZero = !!td.splitSyntheticLeadingZero && td.value[0]?.value === ZERO ? 1 : 0;
21408
+ if (tr.id === currentTr.id && td.id === currentTd.id) {
21409
+ mergedIndex += Math.max(startIndex - skipLeadingZero, 0);
21410
+ return {
21411
+ rootTrId,
21412
+ colIndex: currentTd.colIndex,
21413
+ mergedIndex
21414
+ };
21415
+ }
21416
+ mergedIndex += Math.max(td.value.length - skipLeadingZero, 0);
21417
+ }
21418
+ return null;
21419
+ }
21420
+ applyCollapsedSplitTableCursor(payload) {
21421
+ const {
21422
+ tableIndex,
21423
+ tableId,
21424
+ overflowTr,
21425
+ overflowTrIdx,
21426
+ continuationTr,
21427
+ continuationTdList,
21428
+ logicalCursor,
21429
+ splits
21430
+ } = payload;
21431
+ const tdIndex = overflowTr.tdList.findIndex(
21432
+ (td) => td.colIndex === logicalCursor.colIndex
21433
+ );
21434
+ if (tdIndex < 0) return false;
21435
+ const splitIdx = splits[tdIndex]?.elemIdx;
21436
+ if (splitIdx === void 0) return false;
21437
+ const positionContext = this.position.getPositionContext();
21438
+ if (logicalCursor.mergedIndex >= splitIdx) {
21439
+ const continuationTd = continuationTdList[tdIndex];
21440
+ if (!continuationTd) return false;
21441
+ const hasPrependedZero = !!continuationTd.splitSyntheticLeadingZero && continuationTd.value[0]?.value === ZERO;
21442
+ const continuationCursorIndex = logicalCursor.mergedIndex - splitIdx + (hasPrependedZero ? 1 : 0);
21443
+ positionContext.index = tableIndex;
21444
+ positionContext.trIndex = overflowTrIdx + 1;
21445
+ positionContext.tdIndex = tdIndex;
21446
+ positionContext.tdId = continuationTd.id;
21447
+ positionContext.trId = continuationTr.id;
21448
+ positionContext.tableId = tableId;
21449
+ this.position.setPositionContext(positionContext);
21450
+ this.range.setRange(
21451
+ continuationCursorIndex,
21452
+ continuationCursorIndex
21453
+ );
21454
+ this.pendingTableCursorIndex = continuationCursorIndex;
21455
+ return true;
21456
+ }
21457
+ const rootTd = overflowTr.tdList[tdIndex];
21458
+ if (!rootTd) return false;
21459
+ const rootCursorIndex = Math.min(
21460
+ logicalCursor.mergedIndex,
21461
+ Math.max(rootTd.value.length - 1, 0)
21462
+ );
21463
+ positionContext.index = tableIndex;
21464
+ positionContext.trIndex = overflowTrIdx;
21465
+ positionContext.tdIndex = tdIndex;
21466
+ positionContext.tdId = rootTd.id;
21467
+ positionContext.trId = overflowTr.id;
21468
+ positionContext.tableId = tableId;
21469
+ this.position.setPositionContext(positionContext);
21470
+ this.range.setRange(rootCursorIndex, rootCursorIndex);
21471
+ this.pendingTableCursorIndex = rootCursorIndex;
21472
+ return true;
21473
+ }
21036
21474
  getElementList() {
21037
21475
  const positionContext = this.position.getPositionContext();
21038
21476
  const elementList = this.getOriginalElementList();
@@ -21070,6 +21508,18 @@ var Draw = class {
21070
21508
  isHandleFirstElement: false,
21071
21509
  editorOptions: this.options
21072
21510
  });
21511
+ const splitCellSelection = this.range.getSplitCellSelection();
21512
+ if (splitCellSelection) {
21513
+ const curIndex2 = this.replaceSplitCellSelection(payload, splitCellSelection);
21514
+ if (~curIndex2) {
21515
+ this.range.setRange(curIndex2, curIndex2);
21516
+ this.render({
21517
+ curIndex: curIndex2,
21518
+ isSubmitHistory
21519
+ });
21520
+ }
21521
+ return;
21522
+ }
21073
21523
  let curIndex = -1;
21074
21524
  let activeControl = this.control.getActiveControl();
21075
21525
  if (!activeControl && this.control.getIsRangeWithinControl()) {
@@ -21165,6 +21615,80 @@ var Draw = class {
21165
21615
  }
21166
21616
  }
21167
21617
  }
21618
+ replaceSplitCellSelection(payload, splitCellSelection = this.range.getSplitCellSelection()) {
21619
+ const splitCellSelectionContext = this.getSplitCellSelectionContext(
21620
+ this.getOriginalElementList(),
21621
+ splitCellSelection
21622
+ );
21623
+ if (!splitCellSelectionContext) return -1;
21624
+ const [rootCellContext, ...continuationCellContextList] = splitCellSelectionContext.cellContextList;
21625
+ const rootTd = rootCellContext.td;
21626
+ const rootStartIndex = rootTd.value[0]?.value === ZERO ? 1 : 0;
21627
+ if (!rootStartIndex) {
21628
+ rootTd.value.unshift({
21629
+ value: ZERO,
21630
+ type: "text" /* TEXT */
21631
+ });
21632
+ this.syncTableElementContext([rootTd.value[0]], {
21633
+ tableId: rootCellContext.element.id,
21634
+ trId: rootCellContext.tr.id,
21635
+ tdId: rootTd.id
21636
+ });
21637
+ }
21638
+ this.syncTableElementContext(payload, {
21639
+ tableId: rootCellContext.element.id,
21640
+ trId: rootCellContext.tr.id,
21641
+ tdId: rootTd.id
21642
+ });
21643
+ this.spliceElementList(
21644
+ rootTd.value,
21645
+ 1,
21646
+ rootTd.value.length - 1,
21647
+ payload
21648
+ );
21649
+ rootTd.rowList = void 0;
21650
+ rootTd.positionList = void 0;
21651
+ rootTd.mainHeight = void 0;
21652
+ rootTd.realHeight = void 0;
21653
+ rootTd.realMinHeight = void 0;
21654
+ for (let c = 0; c < continuationCellContextList.length; c++) {
21655
+ const continuationTd = continuationCellContextList[c].td;
21656
+ const startIndex = continuationTd.value[0]?.value === ZERO ? 1 : 0;
21657
+ if (!startIndex) {
21658
+ continuationTd.value.unshift({
21659
+ value: ZERO,
21660
+ type: "text" /* TEXT */
21661
+ });
21662
+ this.syncTableElementContext([continuationTd.value[0]], {
21663
+ tableId: continuationCellContextList[c].element.id,
21664
+ trId: continuationCellContextList[c].tr.id,
21665
+ tdId: continuationTd.id
21666
+ });
21667
+ }
21668
+ if (continuationTd.value.length > 1) {
21669
+ this.spliceElementList(
21670
+ continuationTd.value,
21671
+ 1,
21672
+ continuationTd.value.length - 1
21673
+ );
21674
+ }
21675
+ continuationTd.rowList = void 0;
21676
+ continuationTd.positionList = void 0;
21677
+ continuationTd.mainHeight = void 0;
21678
+ continuationTd.realHeight = void 0;
21679
+ continuationTd.realMinHeight = void 0;
21680
+ }
21681
+ this.position.setPositionContext({
21682
+ isTable: true,
21683
+ index: rootCellContext.tableIndex,
21684
+ trIndex: rootCellContext.trIndex,
21685
+ tdIndex: rootCellContext.tdIndex,
21686
+ tdId: rootTd.id,
21687
+ trId: rootCellContext.tr.id,
21688
+ tableId: rootCellContext.element.id
21689
+ });
21690
+ return Math.max(rootTd.value.length - 1, 0);
21691
+ }
21168
21692
  getCanvasEvent() {
21169
21693
  return this.canvasEvent;
21170
21694
  }
@@ -21727,6 +22251,9 @@ var Draw = class {
21727
22251
  } else if (element.type === "table" /* TABLE */) {
21728
22252
  let activeSplitRange;
21729
22253
  let mergedSplitFallback;
22254
+ const logicalSplitCursor = this.getCollapsedSplitTableCursorContext(
22255
+ element
22256
+ );
21730
22257
  if (element.pagingId) {
21731
22258
  let tableIndex = i + 1;
21732
22259
  let combineCount = 0;
@@ -21785,6 +22312,11 @@ var Draw = class {
21785
22312
  if (!splitTd) continue;
21786
22313
  const hasSyntheticLeadingZero = !!splitTd.splitSyntheticLeadingZero && splitTd.value[0]?.value === ZERO;
21787
22314
  const splitValue = hasSyntheticLeadingZero ? splitTd.value.slice(1) : splitTd.value;
22315
+ this.syncTableElementContext(splitValue, {
22316
+ tableId: element.id,
22317
+ trId: parentTr.id,
22318
+ tdId: parentTd.id
22319
+ });
21788
22320
  parentTd.value.push(...splitValue);
21789
22321
  parentTd.rowList = void 0;
21790
22322
  parentTd.positionList = void 0;
@@ -22066,13 +22598,12 @@ var Draw = class {
22066
22598
  const continuationTdList = overflowTr.tdList.map(
22067
22599
  (td, d) => {
22068
22600
  const splitIdx = splits[d].elemIdx;
22601
+ const newTdId = getUUID();
22069
22602
  const initialListState2 = this.getListStateBeforeIndex(
22070
22603
  td.value,
22071
22604
  splitIdx
22072
22605
  );
22073
- const overflowElements = deepClone(
22074
- td.value.slice(splitIdx)
22075
- );
22606
+ const overflowElements = td.value.slice(splitIdx);
22076
22607
  const overflowStartElement = overflowElements[0];
22077
22608
  let splitSyntheticLeadingZero = false;
22078
22609
  if (!overflowElements.length || overflowElements[0]?.value !== ZERO) {
@@ -22088,7 +22619,13 @@ var Draw = class {
22088
22619
  });
22089
22620
  splitSyntheticLeadingZero = true;
22090
22621
  }
22622
+ this.syncTableElementContext(overflowElements, {
22623
+ tableId: element.id,
22624
+ trId: newTrId,
22625
+ tdId: newTdId
22626
+ });
22091
22627
  const {
22628
+ id: _tdId,
22092
22629
  value: _v,
22093
22630
  rowList: _rl,
22094
22631
  positionList: _pl,
@@ -22098,6 +22635,7 @@ var Draw = class {
22098
22635
  } = td;
22099
22636
  return {
22100
22637
  ...deepClone(tdMeta),
22638
+ id: newTdId,
22101
22639
  value: overflowElements,
22102
22640
  splitSyntheticLeadingZero,
22103
22641
  splitListState: initialListState2,
@@ -22119,8 +22657,21 @@ var Draw = class {
22119
22657
  splitRootId,
22120
22658
  splitLevel
22121
22659
  };
22660
+ let isLogicalSplitCursorHandled = false;
22661
+ if (logicalSplitCursor && logicalSplitCursor.rootTrId === splitRootId) {
22662
+ isLogicalSplitCursorHandled = this.applyCollapsedSplitTableCursor({
22663
+ tableIndex: i,
22664
+ tableId: element.id,
22665
+ overflowTr,
22666
+ overflowTrIdx,
22667
+ continuationTr,
22668
+ continuationTdList,
22669
+ logicalCursor: logicalSplitCursor,
22670
+ splits
22671
+ });
22672
+ }
22122
22673
  const positionContext = this.position.getPositionContext();
22123
- if (activeSplitRange && positionContext.isTable && positionContext.trId === activeSplitRange.trId) {
22674
+ if (!isLogicalSplitCursorHandled && activeSplitRange && positionContext.isTable && positionContext.trId === activeSplitRange.trId) {
22124
22675
  const splitIdx = splits[activeSplitRange.tdIndex]?.elemIdx;
22125
22676
  const continuationTd = continuationTdList[activeSplitRange.tdIndex];
22126
22677
  if (splitIdx !== void 0 && continuationTd && activeSplitRange.mergedIndex >= splitIdx) {
@@ -22177,16 +22728,26 @@ var Draw = class {
22177
22728
  element.height -= cloneTrHeight;
22178
22729
  metrics.height -= cloneTrRealHeight;
22179
22730
  metrics.boundingBoxDescent -= cloneTrRealHeight;
22180
- const cloneElement = deepClone(element);
22181
- cloneElement.pagingId = pagingId;
22182
- cloneElement.pagingIndex = element.pagingIndex + 1;
22731
+ const {
22732
+ trList: _currentTrList,
22733
+ id: _currentId,
22734
+ height: _currentHeight,
22735
+ pagingIndex: _currentPagingIndex,
22736
+ ...cloneElementMeta
22737
+ } = element;
22738
+ const cloneElement = {
22739
+ ...deepClone(cloneElementMeta),
22740
+ trList: cloneTrList,
22741
+ height: cloneTrHeight,
22742
+ pagingId,
22743
+ pagingIndex: element.pagingIndex + 1
22744
+ };
22183
22745
  const repeatTrList = trList2.filter((tr) => tr.pagingRepeat);
22184
22746
  if (repeatTrList.length) {
22185
22747
  const cloneRepeatTrList = deepClone(repeatTrList);
22186
22748
  cloneRepeatTrList.forEach((tr) => tr.id = getUUID());
22187
22749
  cloneTrList.unshift(...cloneRepeatTrList);
22188
22750
  }
22189
- cloneElement.trList = cloneTrList;
22190
22751
  cloneElement.id = getUUID();
22191
22752
  this.spliceElementList(elementList, i + 1, 0, [cloneElement]);
22192
22753
  }
@@ -22634,6 +23195,27 @@ var Draw = class {
22634
23195
  const isPrintMode = this.isPrintMode();
22635
23196
  const isGraffitiMode = this.isGraffitiMode();
22636
23197
  const { isCrossRowCol, tableId } = this.range.getRange();
23198
+ const splitCellSelection = this.range.getSplitCellSelection();
23199
+ const tableCellSelection = this.range.getTableCellSelection();
23200
+ const splitCellRenderOffsetMap = splitCellSelection ? (() => {
23201
+ const splitCellContext = this.getSplitCellSelectionContext(
23202
+ this.getOriginalElementList(),
23203
+ splitCellSelection
23204
+ );
23205
+ if (!splitCellContext) return null;
23206
+ const offsetMap = /* @__PURE__ */ new Map();
23207
+ let offset = 0;
23208
+ for (let c = 0; c < splitCellContext.cellContextList.length; c++) {
23209
+ const { td } = splitCellContext.cellContextList[c];
23210
+ const skipLeadingZero = !!td.splitSyntheticLeadingZero && td.value[0]?.value === ZERO ? 1 : 0;
23211
+ offsetMap.set(td.id, {
23212
+ offset,
23213
+ skipLeadingZero
23214
+ });
23215
+ offset += Math.max(td.value.length - skipLeadingZero, 0);
23216
+ }
23217
+ return offsetMap;
23218
+ })() : null;
22637
23219
  let index = startIndex;
22638
23220
  for (let i = 0; i < rowList.length; i++) {
22639
23221
  const curRow = rowList[i];
@@ -22665,6 +23247,9 @@ var Draw = class {
22665
23247
  this.textParticle.complete();
22666
23248
  this.laTexParticle.render(ctx, element, x, y + offsetY);
22667
23249
  } else if (element.type === "table" /* TABLE */) {
23250
+ if (tableCellSelection) {
23251
+ tableRangeElement = element;
23252
+ }
22668
23253
  if (isCrossRowCol) {
22669
23254
  rangeRecord.x = x;
22670
23255
  rangeRecord.y = y;
@@ -22812,11 +23397,14 @@ var Draw = class {
22812
23397
  startIndex: startIndex2,
22813
23398
  endIndex
22814
23399
  } = this.range.getRange();
22815
- if (currentZone === zone && startIndex2 !== endIndex && startIndex2 <= index && index <= endIndex) {
23400
+ const splitCellOffset = element.tdId ? splitCellRenderOffsetMap?.get(element.tdId) : void 0;
23401
+ const splitCellIndex = splitCellOffset ? index - splitCellOffset.skipLeadingZero + splitCellOffset.offset : index;
23402
+ const isSplitCellElement = !!splitCellOffset && index >= splitCellOffset.skipLeadingZero;
23403
+ if (currentZone === zone && startIndex2 !== endIndex && startIndex2 <= splitCellIndex && splitCellIndex <= endIndex) {
22816
23404
  const positionContext = this.position.getPositionContext();
22817
- if (!positionContext.isTable && !element.tdId || positionContext.tdId === element.tdId) {
22818
- if (startIndex2 === index) {
22819
- const nextElement = elementList[startIndex2 + 1];
23405
+ if (splitCellRenderOffsetMap && isSplitCellElement || !splitCellRenderOffsetMap && (!positionContext.isTable && !element.tdId || positionContext.tdId === element.tdId)) {
23406
+ if (startIndex2 === splitCellIndex) {
23407
+ const nextElement = splitCellRenderOffsetMap && isSplitCellElement ? this.getElementList()[startIndex2 + 1] : elementList[startIndex2 + 1];
22820
23408
  if (nextElement && nextElement.value === ZERO) {
22821
23409
  rangeRecord.x = x + metrics.width;
22822
23410
  rangeRecord.y = y - (curRow.spaceAbove || 0);
@@ -22881,7 +23469,7 @@ var Draw = class {
22881
23469
  this.strikeout.render(ctx);
22882
23470
  this.group.render(ctx);
22883
23471
  if (!isPrintMode && !isGraffitiMode) {
22884
- if (rangeRecord.width && rangeRecord.height) {
23472
+ if (!tableCellSelection && rangeRecord.width && rangeRecord.height) {
22885
23473
  const { x, y, width, height } = rangeRecord;
22886
23474
  this.range.render(ctx, x, y, width, height);
22887
23475
  }
@@ -22893,6 +23481,20 @@ var Draw = class {
22893
23481
  } = positionList[curRow.startIndex];
22894
23482
  this.tableParticle.drawRange(ctx, tableRangeElement, x, y);
22895
23483
  }
23484
+ if (tableCellSelection && tableRangeElement) {
23485
+ const {
23486
+ coordinate: {
23487
+ leftTop: [x, y]
23488
+ }
23489
+ } = positionList[curRow.startIndex];
23490
+ this.tableParticle.drawCellRange(
23491
+ ctx,
23492
+ tableRangeElement,
23493
+ x,
23494
+ y,
23495
+ tableCellSelection
23496
+ );
23497
+ }
22896
23498
  }
22897
23499
  }
22898
23500
  }
@@ -23519,6 +24121,34 @@ var CommandAdapt = class {
23519
24121
  this.zone = draw.getZone();
23520
24122
  this.tableOperate = draw.getTableOperate();
23521
24123
  }
24124
+ getStyleSelectionElementList(options = {}) {
24125
+ const selection = this.range.getSelectionElementList();
24126
+ if (!selection?.length) return null;
24127
+ const { textLikeOnly = false } = options;
24128
+ const result = [];
24129
+ const collect = (elementList) => {
24130
+ for (let i = 0; i < elementList.length; i++) {
24131
+ const element = elementList[i];
24132
+ if (element.type === "table" /* TABLE */ && element.trList?.length) {
24133
+ for (let t = 0; t < element.trList.length; t++) {
24134
+ const tr = element.trList[t];
24135
+ for (let d = 0; d < tr.tdList.length; d++) {
24136
+ collect(tr.tdList[d].value);
24137
+ }
24138
+ }
24139
+ continue;
24140
+ }
24141
+ result.push(element);
24142
+ }
24143
+ };
24144
+ collect(selection);
24145
+ if (!textLikeOnly) {
24146
+ return result;
24147
+ }
24148
+ return result.filter(
24149
+ (element) => isTextLikeElement(element) || element.type === "label" /* LABEL */
24150
+ );
24151
+ }
23522
24152
  mode(payload) {
23523
24153
  this.draw.setMode(payload);
23524
24154
  }
@@ -23664,7 +24294,7 @@ var CommandAdapt = class {
23664
24294
  const { isIgnoreDisabledRule = false } = options || {};
23665
24295
  const isDisabled = !isIgnoreDisabledRule && (this.draw.isReadonly() || this.draw.isDisabled());
23666
24296
  if (isDisabled) return;
23667
- const selection = this.range.getSelectionElementList();
24297
+ const selection = this.getStyleSelectionElementList();
23668
24298
  let renderOption = {};
23669
24299
  let changeElementList = [];
23670
24300
  if (selection?.length) {
@@ -23691,7 +24321,7 @@ var CommandAdapt = class {
23691
24321
  const { isIgnoreDisabledRule = false } = options || {};
23692
24322
  const isDisabled = !isIgnoreDisabledRule && (this.draw.isReadonly() || this.draw.isDisabled());
23693
24323
  if (isDisabled) return;
23694
- const selection = this.range.getSelectionElementList();
24324
+ const selection = this.getStyleSelectionElementList();
23695
24325
  if (selection?.length) {
23696
24326
  selection.forEach((el) => {
23697
24327
  el.font = payload;
@@ -23725,7 +24355,9 @@ var CommandAdapt = class {
23725
24355
  if (payload < minSize || payload > maxSize) return;
23726
24356
  let renderOption = {};
23727
24357
  let changeElementList = [];
23728
- const selection = this.range.getTextLikeSelectionElementList();
24358
+ const selection = this.getStyleSelectionElementList({
24359
+ textLikeOnly: true
24360
+ });
23729
24361
  if (selection?.length) {
23730
24362
  changeElementList = selection;
23731
24363
  renderOption = { isSetCursor: false };
@@ -23765,7 +24397,9 @@ var CommandAdapt = class {
23765
24397
  const isDisabled = !isIgnoreDisabledRule && (this.draw.isReadonly() || this.draw.isDisabled());
23766
24398
  if (isDisabled) return;
23767
24399
  const { defaultSize, maxSize } = this.options;
23768
- const selection = this.range.getTextLikeSelectionElementList();
24400
+ const selection = this.getStyleSelectionElementList({
24401
+ textLikeOnly: true
24402
+ });
23769
24403
  let renderOption = {};
23770
24404
  let changeElementList = [];
23771
24405
  if (selection?.length) {
@@ -23814,7 +24448,9 @@ var CommandAdapt = class {
23814
24448
  const isDisabled = !isIgnoreDisabledRule && (this.draw.isReadonly() || this.draw.isDisabled());
23815
24449
  if (isDisabled) return;
23816
24450
  const { defaultSize, minSize } = this.options;
23817
- const selection = this.range.getTextLikeSelectionElementList();
24451
+ const selection = this.getStyleSelectionElementList({
24452
+ textLikeOnly: true
24453
+ });
23818
24454
  let renderOption = {};
23819
24455
  let changeElementList = [];
23820
24456
  if (selection?.length) {
@@ -23862,7 +24498,7 @@ var CommandAdapt = class {
23862
24498
  const { isIgnoreDisabledRule = false } = options || {};
23863
24499
  const isDisabled = !isIgnoreDisabledRule && (this.draw.isReadonly() || this.draw.isDisabled());
23864
24500
  if (isDisabled) return;
23865
- const selection = this.range.getSelectionElementList();
24501
+ const selection = this.getStyleSelectionElementList();
23866
24502
  if (selection?.length) {
23867
24503
  const noBoldIndex = selection.findIndex((s) => !s.bold);
23868
24504
  selection.forEach((el) => {
@@ -23894,7 +24530,7 @@ var CommandAdapt = class {
23894
24530
  const { isIgnoreDisabledRule = false } = options || {};
23895
24531
  const isDisabled = !isIgnoreDisabledRule && (this.draw.isReadonly() || this.draw.isDisabled());
23896
24532
  if (isDisabled) return;
23897
- const selection = this.range.getSelectionElementList();
24533
+ const selection = this.getStyleSelectionElementList();
23898
24534
  if (selection?.length) {
23899
24535
  const noItalicIndex = selection.findIndex((s) => !s.italic);
23900
24536
  selection.forEach((el) => {
@@ -23926,7 +24562,7 @@ var CommandAdapt = class {
23926
24562
  const { isIgnoreDisabledRule = false } = options || {};
23927
24563
  const isDisabled = !isIgnoreDisabledRule && (this.draw.isReadonly() || this.draw.isDisabled());
23928
24564
  if (isDisabled) return;
23929
- const selection = this.range.getSelectionElementList();
24565
+ const selection = this.getStyleSelectionElementList();
23930
24566
  if (selection?.length) {
23931
24567
  const isSetUnderline = selection.some(
23932
24568
  (s) => !s.underline || !textDecoration && s.textDecoration || textDecoration && !s.textDecoration || textDecoration && s.textDecoration && !isObjectEqual(s.textDecoration, textDecoration)
@@ -23968,7 +24604,7 @@ var CommandAdapt = class {
23968
24604
  const { isIgnoreDisabledRule = false } = options || {};
23969
24605
  const isDisabled = !isIgnoreDisabledRule && (this.draw.isReadonly() || this.draw.isDisabled());
23970
24606
  if (isDisabled) return;
23971
- const selection = this.range.getSelectionElementList();
24607
+ const selection = this.getStyleSelectionElementList();
23972
24608
  if (selection?.length) {
23973
24609
  const noStrikeoutIndex = selection.findIndex((s) => !s.strikeout);
23974
24610
  selection.forEach((el) => {
@@ -24003,7 +24639,7 @@ var CommandAdapt = class {
24003
24639
  const { isIgnoreDisabledRule = false } = options || {};
24004
24640
  const isDisabled = !isIgnoreDisabledRule && (this.draw.isReadonly() || this.draw.isDisabled());
24005
24641
  if (isDisabled) return;
24006
- const selection = this.range.getSelectionElementList();
24642
+ const selection = this.getStyleSelectionElementList();
24007
24643
  if (!selection) return;
24008
24644
  const superscriptIndex = selection.findIndex(
24009
24645
  (s) => s.type === "superscript" /* SUPERSCRIPT */
@@ -24026,7 +24662,7 @@ var CommandAdapt = class {
24026
24662
  const { isIgnoreDisabledRule = false } = options || {};
24027
24663
  const isDisabled = !isIgnoreDisabledRule && (this.draw.isReadonly() || this.draw.isDisabled());
24028
24664
  if (isDisabled) return;
24029
- const selection = this.range.getSelectionElementList();
24665
+ const selection = this.getStyleSelectionElementList();
24030
24666
  if (!selection) return;
24031
24667
  const subscriptIndex = selection.findIndex(
24032
24668
  (s) => s.type === "subscript" /* SUBSCRIPT */
@@ -24049,7 +24685,7 @@ var CommandAdapt = class {
24049
24685
  const { isIgnoreDisabledRule = false } = options || {};
24050
24686
  const isDisabled = !isIgnoreDisabledRule && (this.draw.isReadonly() || this.draw.isDisabled());
24051
24687
  if (isDisabled) return;
24052
- const selection = this.range.getSelectionElementList();
24688
+ const selection = this.getStyleSelectionElementList();
24053
24689
  if (selection?.length) {
24054
24690
  selection.forEach((el) => {
24055
24691
  if (payload) {
@@ -24090,7 +24726,7 @@ var CommandAdapt = class {
24090
24726
  const { isIgnoreDisabledRule = false } = options || {};
24091
24727
  const isDisabled = !isIgnoreDisabledRule && (this.draw.isReadonly() || this.draw.isDisabled());
24092
24728
  if (isDisabled) return;
24093
- const selection = this.range.getSelectionElementList();
24729
+ const selection = this.getStyleSelectionElementList();
24094
24730
  if (selection?.length) {
24095
24731
  selection.forEach((el) => {
24096
24732
  if (payload) {
@@ -24721,25 +25357,39 @@ var CommandAdapt = class {
24721
25357
  const endElement = pickElementAttr(elementList[endIndex], {
24722
25358
  extraPickAttrs: ["id", "controlComponent"]
24723
25359
  });
24724
- const rowList = this.draw.getRowList();
24725
25360
  const positionList = this.position.getPositionList();
24726
25361
  const startPosition = positionList[startIndex];
24727
25362
  const endPosition = positionList[endIndex];
25363
+ if (!startPosition || !endPosition) return null;
24728
25364
  const startPageNo = startPosition.pageNo;
24729
25365
  const endPageNo = endPosition.pageNo;
24730
25366
  const startRowNo = startPosition.rowIndex;
24731
25367
  const endRowNo = endPosition.rowIndex;
24732
- const startRow = rowList[startRowNo];
24733
- const endRow = rowList[endRowNo];
25368
+ const getRowStartPositionIndex = (targetIndex) => {
25369
+ let rowStartIndex = targetIndex;
25370
+ const targetPosition = positionList[targetIndex];
25371
+ while (rowStartIndex > 0) {
25372
+ const prePosition = positionList[rowStartIndex - 1];
25373
+ if (!prePosition || prePosition.pageNo !== targetPosition.pageNo || prePosition.rowNo !== targetPosition.rowNo || prePosition.columnNo !== targetPosition.columnNo) {
25374
+ break;
25375
+ }
25376
+ rowStartIndex--;
25377
+ }
25378
+ return rowStartIndex;
25379
+ };
25380
+ const startRowStartIndex = getRowStartPositionIndex(startIndex);
25381
+ const endRowStartIndex = getRowStartPositionIndex(endIndex);
25382
+ const startRowStartsWithZero = elementList[startRowStartIndex]?.value === ZERO;
25383
+ const endRowStartsWithZero = elementList[endRowStartIndex]?.value === ZERO;
24734
25384
  let startColNo = 0;
24735
25385
  let endColNo = 0;
24736
25386
  if (!this.draw.getCursor().getHitLineStartIndex()) {
24737
- startColNo = startRow.elementList[0]?.value === ZERO ? startPosition.index - startRow.startIndex : startPosition.index - startRow.startIndex + 1;
25387
+ startColNo = startRowStartsWithZero ? startIndex - startRowStartIndex : startIndex - startRowStartIndex + 1;
24738
25388
  }
24739
25389
  if (startPosition === endPosition) {
24740
25390
  endColNo = startColNo;
24741
25391
  } else {
24742
- endColNo = endRow.elementList[0]?.value === ZERO ? endPosition.index - endRow.startIndex : endPosition.index - endRow.startIndex + 1;
25392
+ endColNo = endRowStartsWithZero ? endIndex - endRowStartIndex : endIndex - endRowStartIndex + 1;
24743
25393
  }
24744
25394
  const rangeRects = [];
24745
25395
  const height = this.draw.getOriginalHeight();
@@ -24747,6 +25397,7 @@ var CommandAdapt = class {
24747
25397
  const selectionPositionList = this.position.getSelectionPositionList();
24748
25398
  if (selectionPositionList) {
24749
25399
  let currentRowNo = null;
25400
+ let currentPageNo = null;
24750
25401
  let currentX = 0;
24751
25402
  let rangeRect = null;
24752
25403
  for (let p = 0; p < selectionPositionList.length; p++) {
@@ -24756,7 +25407,7 @@ var CommandAdapt = class {
24756
25407
  coordinate: { leftTop, rightTop },
24757
25408
  lineHeight
24758
25409
  } = selectionPositionList[p];
24759
- if (currentRowNo === null || currentRowNo !== rowNo) {
25410
+ if (currentRowNo === null || currentPageNo === null || currentRowNo !== rowNo || currentPageNo !== pageNo) {
24760
25411
  if (rangeRect) {
24761
25412
  rangeRects.push(rangeRect);
24762
25413
  }
@@ -24767,6 +25418,7 @@ var CommandAdapt = class {
24767
25418
  height: lineHeight
24768
25419
  };
24769
25420
  currentRowNo = rowNo;
25421
+ currentPageNo = pageNo;
24770
25422
  currentX = leftTop[0];
24771
25423
  } else {
24772
25424
  rangeRect.width = rightTop[0] - currentX;