@univerjs/engine-render 0.2.14 → 0.2.15

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/lib/es/index.js CHANGED
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { Tools, DEFAULT_STYLES, FontStyleType, BaselineOffset, getCellInfoInMergeData, Rectangle, ColorKit, Disposable, EventSubject, checkParagraphHasIndentByStyle, DataStreamTreeTokenType, BorderStyleTypes, BooleanNumber, DisposableCollection, toDisposable, sortRules, Registry, numberToABC, Inject, LocaleService, insertTextToContent, horizontalLineSegmentsSubtraction, deleteContent, DataStreamTreeNodeType, DocumentDataModel, PositionedObjectLayoutType, WrapTextType, ColumnSeparatorType, GridType, BulletAlignment, TableAlignmentType, ObjectRelativeFromV, TableTextWrapType, SpacingRule, CustomDecorationType, CustomRangeType, ObjectMatrix, SectionType, NumberUnitType, PageOrientType, HorizontalAlign, VerticalAlign, WrapStrategy, AlignTypeH, ObjectRelativeFromH, AlignTypeV, GlyphType as GlyphType$1, numberToListABC, PRESET_LIST_TYPE, searchArray, extractPureTextFromCell, CellValueType, isCellCoverable, isNullCell, getColorStyle, isWhiteColor, IContextService, BuildTextUtils, TextX, DEFAULT_EMPTY_DOCUMENT_VALUE, Range, TextDecoration, COLORS, DocumentFlavor, requestImmediateMacroTask, MOVE_BUFFER_VALUE, sortRulesByDesc, Injector, isClassDependencyItem, createIdentifier, remove, UniverInstanceType, IUniverInstanceService, Plugin, IConfigService } from "@univerjs/core";
5
+ import { Tools, DEFAULT_STYLES, FontStyleType, BaselineOffset, getCellInfoInMergeData, Rectangle, ColorKit, Disposable, EventSubject, checkParagraphHasIndentByStyle, DataStreamTreeTokenType, BorderStyleTypes, BooleanNumber, DisposableCollection, toDisposable, sortRules, Registry, numberToABC, Inject, LocaleService, insertTextToContent, horizontalLineSegmentsSubtraction, deleteContent, DataStreamTreeNodeType, DocumentDataModel, GridType, BulletAlignment, PositionedObjectLayoutType, WrapTextType, ColumnSeparatorType, TableAlignmentType, ObjectRelativeFromV, TableTextWrapType, SpacingRule, CustomDecorationType, CustomRangeType, ObjectMatrix, SectionType, NumberUnitType, PageOrientType, HorizontalAlign, VerticalAlign, WrapStrategy, AlignTypeH, ObjectRelativeFromH, AlignTypeV, GlyphType as GlyphType$1, numberToListABC, PRESET_LIST_TYPE, searchArray, extractPureTextFromCell, CellValueType, isCellCoverable, isNullCell, getColorStyle, isWhiteColor, IContextService, BuildTextUtils, TextX, DEFAULT_EMPTY_DOCUMENT_VALUE, Range, TextDecoration, COLORS, DocumentFlavor, requestImmediateMacroTask, MOVE_BUFFER_VALUE, sortRulesByDesc, Injector, isClassDependencyItem, createIdentifier, remove, UniverInstanceType, IUniverInstanceService, Plugin, IConfigService } from "@univerjs/core";
6
6
  import { BehaviorSubject, Subject, startWith, distinctUntilChanged, Subscription, Observable, shareReplay } from "rxjs";
7
7
  var SHAPE_TYPE = /* @__PURE__ */ ((SHAPE_TYPE2) => (SHAPE_TYPE2.RECT = "rect", SHAPE_TYPE2.CIRCLE = "circle", SHAPE_TYPE2.PATH = "path", SHAPE_TYPE2))(SHAPE_TYPE || {}), LINK_VIEW_PORT_TYPE = /* @__PURE__ */ ((LINK_VIEW_PORT_TYPE2) => (LINK_VIEW_PORT_TYPE2[LINK_VIEW_PORT_TYPE2.XY = 0] = "XY", LINK_VIEW_PORT_TYPE2[LINK_VIEW_PORT_TYPE2.X = 1] = "X", LINK_VIEW_PORT_TYPE2[LINK_VIEW_PORT_TYPE2.Y = 2] = "Y", LINK_VIEW_PORT_TYPE2))(LINK_VIEW_PORT_TYPE || {});
8
8
  const MIDDLE_CELL_POS_MAGIC_NUMBER = 1, DEFAULT_FONTFACE_PLANE = '"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif', DEFAULT_SKELETON_HEADER_FOOTER = {
@@ -4472,6 +4472,7 @@ const SHEET_EXTENSION_PREFIX = "sheet-ext-", _SheetExtension = class _SheetExten
4472
4472
  __publicField(this, "type", 0);
4473
4473
  }
4474
4474
  /**
4475
+ * @deprecated The function maybe cause performance issue, use spreadsheetSkeleton.getCellByIndexWithNoHeader instead.
4475
4476
  * Get ISelectionCellWithMergeInfo by cell rowIndex and cell columnIndex.
4476
4477
  * The startXY in return value does not include rowHeader and columnHeader.
4477
4478
  * @param rowIndex
@@ -4644,7 +4645,7 @@ let Border$1 = (_a2 = class extends SheetExtension {
4644
4645
  }
4645
4646
  // eslint-disable-next-line max-lines-per-function
4646
4647
  draw(ctx, _parentScale, spreadsheetSkeleton, diffRanges) {
4647
- const { dataMergeCache, stylesCache, overflowCache, worksheet, rowHeightAccumulation, columnTotalWidth, columnWidthAccumulation, rowTotalHeight } = spreadsheetSkeleton;
4648
+ const { stylesCache, overflowCache, worksheet, rowHeightAccumulation, columnTotalWidth, columnWidthAccumulation, rowTotalHeight } = spreadsheetSkeleton;
4648
4649
  if (!worksheet || !rowHeightAccumulation || !columnWidthAccumulation || columnTotalWidth === void 0 || rowTotalHeight === void 0)
4649
4650
  return;
4650
4651
  ctx.save();
@@ -4654,13 +4655,7 @@ let Border$1 = (_a2 = class extends SheetExtension {
4654
4655
  border == null || border.forValue((rowIndex, columnIndex, borderCaches) => {
4655
4656
  if (!borderCaches)
4656
4657
  return !0;
4657
- const cellInfo = this.getCellByIndex(
4658
- rowIndex,
4659
- columnIndex,
4660
- rowHeightAccumulation,
4661
- columnWidthAccumulation,
4662
- dataMergeCache
4663
- ), { startY: cellStartY, endY: cellEndY, startX: cellStartX, endX: cellEndX } = cellInfo, { isMerged, isMergedMainCell, mergeInfo } = cellInfo;
4658
+ const cellInfo = spreadsheetSkeleton.getCellByIndexWithNoHeader(rowIndex, columnIndex), { startY: cellStartY, endY: cellEndY, startX: cellStartX, endX: cellEndX } = cellInfo, { isMerged, isMergedMainCell, mergeInfo } = cellInfo;
4664
4659
  if (!isMerged) {
4665
4660
  const visibleRow = spreadsheetSkeleton.worksheet.getRowVisible(rowIndex), visibleCol = spreadsheetSkeleton.worksheet.getColVisible(columnIndex);
4666
4661
  if (!visibleRow || !visibleCol) return !0;
@@ -5440,6 +5435,226 @@ const _DocumentViewModel = class _DocumentViewModel {
5440
5435
  };
5441
5436
  __name(_DocumentViewModel, "DocumentViewModel");
5442
5437
  let DocumentViewModel = _DocumentViewModel;
5438
+ var BreakPointType = /* @__PURE__ */ ((BreakPointType2) => (BreakPointType2.Normal = "Normal", BreakPointType2.Mandatory = "Mandatory", BreakPointType2.Hyphen = "Hyphen", BreakPointType2.Link = "Link", BreakPointType2))(BreakPointType || {});
5439
+ const _Break = class _Break {
5440
+ constructor(position, type = "Normal") {
5441
+ this.position = position, this.type = type;
5442
+ }
5443
+ };
5444
+ __name(_Break, "Break");
5445
+ let Break = _Break;
5446
+ function isSpace(char) {
5447
+ return [" ", " ", " "].includes(char);
5448
+ }
5449
+ __name(isSpace, "isSpace");
5450
+ function isJustifiable(content) {
5451
+ return isSpace(content) || hasCJKText(content) || isCjkLeftAlignedPunctuation(content) || isCjkRightAlignedPunctuation(content) || isCjkCenterAlignedPunctuation(content);
5452
+ }
5453
+ __name(isJustifiable, "isJustifiable");
5454
+ function baseAdjustability(content, width) {
5455
+ return isSpace(content) ? {
5456
+ // The number for spaces is from Knuth-Plass' paper
5457
+ stretchability: [0, width / 2],
5458
+ shrinkability: [0, width / 3]
5459
+ } : isCjkLeftAlignedPunctuation(content) ? {
5460
+ stretchability: [0, 0],
5461
+ shrinkability: [0, width / 2]
5462
+ } : isCjkRightAlignedPunctuation(content) ? {
5463
+ stretchability: [0, 0],
5464
+ shrinkability: [width / 2, 0]
5465
+ } : isCjkCenterAlignedPunctuation(content) ? {
5466
+ stretchability: [0, 0],
5467
+ shrinkability: [width / 4, width / 4]
5468
+ } : {
5469
+ stretchability: [0, 0],
5470
+ shrinkability: [0, 0]
5471
+ };
5472
+ }
5473
+ __name(baseAdjustability, "baseAdjustability");
5474
+ function createSkeletonWordGlyph(content, config, glyphWidth) {
5475
+ return _createSkeletonWordOrLetter(GlyphType.WORD, content, config, glyphWidth);
5476
+ }
5477
+ __name(createSkeletonWordGlyph, "createSkeletonWordGlyph");
5478
+ function createSkeletonLetterGlyph(content, config, glyphWidth, glyphInfo) {
5479
+ return _createSkeletonWordOrLetter(GlyphType.LETTER, content, config, glyphWidth, glyphInfo);
5480
+ }
5481
+ __name(createSkeletonLetterGlyph, "createSkeletonLetterGlyph");
5482
+ function createSkeletonTabGlyph(config, glyphWidth) {
5483
+ return _createSkeletonWordOrLetter(GlyphType.TAB, DataStreamTreeTokenType.TAB, config, glyphWidth);
5484
+ }
5485
+ __name(createSkeletonTabGlyph, "createSkeletonTabGlyph");
5486
+ function createHyphenDashGlyph(config) {
5487
+ const dashLetterGlyph = _createSkeletonWordOrLetter(GlyphType.LETTER, "-", config);
5488
+ return dashLetterGlyph.count = 0, dashLetterGlyph;
5489
+ }
5490
+ __name(createHyphenDashGlyph, "createHyphenDashGlyph");
5491
+ function createSkeletonCustomBlockGlyph(config, glyphWidth = 0, glyphHeight = 0, drawingId = "") {
5492
+ const { fontStyle, textStyle } = config, content = DataStreamTreeTokenType.CUSTOM_BLOCK;
5493
+ return {
5494
+ content: "",
5495
+ raw: content,
5496
+ ts: textStyle,
5497
+ fontStyle,
5498
+ width: glyphWidth,
5499
+ bBox: {
5500
+ width: 0,
5501
+ ba: glyphHeight,
5502
+ // Or 1/2 glyphHeight each for ba and bd.
5503
+ bd: 0,
5504
+ aba: 0,
5505
+ abd: 0,
5506
+ sp: 0,
5507
+ sbr: 0,
5508
+ sbo: 0,
5509
+ spr: 0,
5510
+ spo: 0
5511
+ },
5512
+ xOffset: 0,
5513
+ left: 0,
5514
+ isJustifiable: !1,
5515
+ adjustability: baseAdjustability(content, 0),
5516
+ glyphType: GlyphType.PLACEHOLDER,
5517
+ streamType: content,
5518
+ count: 1,
5519
+ drawingId
5520
+ };
5521
+ }
5522
+ __name(createSkeletonCustomBlockGlyph, "createSkeletonCustomBlockGlyph");
5523
+ function _createSkeletonWordOrLetter(glyphType, content, config, glyphWidth, glyphInfo) {
5524
+ const { fontStyle, textStyle, charSpace = 1, gridType = GridType.LINES, snapToGrid = BooleanNumber.FALSE } = config, skipWidthList = [
5525
+ DataStreamTreeTokenType.SECTION_BREAK,
5526
+ DataStreamTreeTokenType.TABLE_START,
5527
+ DataStreamTreeTokenType.TABLE_END,
5528
+ DataStreamTreeTokenType.TABLE_ROW_START,
5529
+ DataStreamTreeTokenType.TABLE_ROW_END,
5530
+ DataStreamTreeTokenType.TABLE_CELL_START,
5531
+ DataStreamTreeTokenType.TABLE_CELL_END,
5532
+ DataStreamTreeTokenType.CUSTOM_RANGE_START,
5533
+ DataStreamTreeTokenType.CUSTOM_RANGE_END,
5534
+ DataStreamTreeTokenType.COLUMN_BREAK,
5535
+ DataStreamTreeTokenType.PAGE_BREAK,
5536
+ DataStreamTreeTokenType.DOCS_END,
5537
+ DataStreamTreeTokenType.CUSTOM_BLOCK
5538
+ ];
5539
+ let streamType = DataStreamTreeTokenType.LETTER;
5540
+ if (skipWidthList.indexOf(content) > -1)
5541
+ return {
5542
+ content: "",
5543
+ raw: content,
5544
+ ts: textStyle,
5545
+ fontStyle,
5546
+ width: 0,
5547
+ bBox: {
5548
+ width: 0,
5549
+ ba: 0,
5550
+ bd: 0,
5551
+ aba: 0,
5552
+ abd: 0,
5553
+ sp: 0,
5554
+ sbr: 0,
5555
+ sbo: 0,
5556
+ spr: 0,
5557
+ spo: 0
5558
+ },
5559
+ xOffset: 0,
5560
+ left: 0,
5561
+ isJustifiable: !1,
5562
+ adjustability: baseAdjustability(content, 0),
5563
+ glyphType: GlyphType.PLACEHOLDER,
5564
+ streamType: content,
5565
+ count: 1
5566
+ };
5567
+ content === DataStreamTreeTokenType.PARAGRAPH && (streamType = DataStreamTreeTokenType.PARAGRAPH);
5568
+ let bBox = null, xOffset = 0;
5569
+ glyphInfo && glyphInfo.boundingBox && glyphInfo.font ? bBox = FontCache.getBBoxFromGlyphInfo(glyphInfo, fontStyle) : bBox = FontCache.getTextSize(content, fontStyle);
5570
+ const { width: contentWidth = 0 } = bBox;
5571
+ let width = glyphWidth != null ? glyphWidth : contentWidth;
5572
+ if (validationGrid(gridType, snapToGrid) && (width = contentWidth + (hasCJK(content) ? charSpace : charSpace / 2), gridType === GridType.SNAP_TO_CHARS && (xOffset = (width - contentWidth) / 2)), glyphInfo && glyphInfo.kerning !== 0 && glyphInfo.font) {
5573
+ const radio = ptToPixel(fontStyle.fontSize) / glyphInfo.font.unitsPerEm, delta = glyphInfo.kerning * radio;
5574
+ width += delta, xOffset += delta;
5575
+ }
5576
+ return {
5577
+ content,
5578
+ ts: textStyle,
5579
+ fontStyle,
5580
+ width,
5581
+ bBox,
5582
+ xOffset,
5583
+ left: 0,
5584
+ glyphType,
5585
+ streamType,
5586
+ isJustifiable: isJustifiable(content),
5587
+ adjustability: baseAdjustability(content, width),
5588
+ count: content.length,
5589
+ raw: content
5590
+ };
5591
+ }
5592
+ __name(_createSkeletonWordOrLetter, "_createSkeletonWordOrLetter");
5593
+ function createSkeletonBulletGlyph(glyph, bulletSkeleton, charSpaceApply) {
5594
+ const {
5595
+ // bBox: boundingBox,
5596
+ symbol: content,
5597
+ // ts: textStyle,
5598
+ // fontStyle,
5599
+ bulletAlign = BulletAlignment.START,
5600
+ bulletType = !1
5601
+ } = bulletSkeleton, { fontStyle } = glyph, boundingBox = FontCache.getTextSize(content, fontStyle), contentWidth = boundingBox.width, multiple = Math.ceil(contentWidth / charSpaceApply);
5602
+ let width = (multiple < 2 ? 2 : multiple) * charSpaceApply, left = 0;
5603
+ bulletType && (bulletAlign === BulletAlignment.CENTER ? (left = -contentWidth / 2, width -= left) : bulletAlign === BulletAlignment.END && (left = -contentWidth, width -= left));
5604
+ const bBox = _getMaxBoundingBox(glyph, boundingBox);
5605
+ return {
5606
+ content,
5607
+ ts: {
5608
+ ...glyph.ts,
5609
+ // ...textStyle,
5610
+ st: {
5611
+ s: BooleanNumber.FALSE
5612
+ }
5613
+ },
5614
+ fontStyle,
5615
+ width,
5616
+ xOffset: 0,
5617
+ bBox,
5618
+ left,
5619
+ isJustifiable: isJustifiable(content),
5620
+ adjustability: baseAdjustability(content, width),
5621
+ glyphType: GlyphType.LIST,
5622
+ streamType: DataStreamTreeTokenType.LETTER,
5623
+ // Deliberately set to 0 so that there is no need to count when calculating the cursor.
5624
+ count: 0,
5625
+ raw: content
5626
+ };
5627
+ }
5628
+ __name(createSkeletonBulletGlyph, "createSkeletonBulletGlyph");
5629
+ function setGlyphGroupLeft(glyphGroup, left = 0) {
5630
+ const spanGroupLen = glyphGroup.length;
5631
+ let preGlyph;
5632
+ for (let i = 0; i < spanGroupLen; i++) {
5633
+ const glyph = glyphGroup[i];
5634
+ glyph.left = preGlyph ? preGlyph.left + preGlyph.width : left, preGlyph = glyph;
5635
+ }
5636
+ }
5637
+ __name(setGlyphGroupLeft, "setGlyphGroupLeft");
5638
+ function addGlyphToDivide(divide, glyphGroup, offsetLeft = 0) {
5639
+ setGlyphGroupLeft(glyphGroup, offsetLeft);
5640
+ for (const glyph of glyphGroup)
5641
+ glyph.parent = divide;
5642
+ divide.glyphGroup.push(...glyphGroup);
5643
+ }
5644
+ __name(addGlyphToDivide, "addGlyphToDivide");
5645
+ function _getMaxBoundingBox(glyph, bulletBBox) {
5646
+ const { ba: spanAscent, bd: spanDescent } = glyph.bBox, { ba: bulletAscent, bd: bulletDescent } = bulletBBox;
5647
+ return spanAscent + spanDescent > bulletAscent + bulletDescent ? glyph.bBox : bulletBBox;
5648
+ }
5649
+ __name(_getMaxBoundingBox, "_getMaxBoundingBox");
5650
+ function glyphShrinkRight(glyph, amount) {
5651
+ glyph.width -= amount, glyph.adjustability.shrinkability[1] -= amount;
5652
+ }
5653
+ __name(glyphShrinkRight, "glyphShrinkRight");
5654
+ function glyphShrinkLeft(glyph, amount) {
5655
+ glyph.width -= amount, glyph.xOffset -= amount, glyph.adjustability.shrinkability[0] -= amount;
5656
+ }
5657
+ __name(glyphShrinkLeft, "glyphShrinkLeft");
5443
5658
  function createSkeletonLine(paragraphIndex, lineType, lineBoundingBox, columnWidth, lineIndex = 0, isParagraphStart = !1, paragraphConfig, page, headerPage, footerPage) {
5444
5659
  var _a10;
5445
5660
  const {
@@ -5797,226 +6012,6 @@ function _getSkeletonColumn(left, width, spaceWidth, columnSeparatorType) {
5797
6012
  };
5798
6013
  }
5799
6014
  __name(_getSkeletonColumn, "_getSkeletonColumn");
5800
- function isSpace(char) {
5801
- return [" ", " ", " "].includes(char);
5802
- }
5803
- __name(isSpace, "isSpace");
5804
- function isJustifiable(content) {
5805
- return isSpace(content) || hasCJKText(content) || isCjkLeftAlignedPunctuation(content) || isCjkRightAlignedPunctuation(content) || isCjkCenterAlignedPunctuation(content);
5806
- }
5807
- __name(isJustifiable, "isJustifiable");
5808
- function baseAdjustability(content, width) {
5809
- return isSpace(content) ? {
5810
- // The number for spaces is from Knuth-Plass' paper
5811
- stretchability: [0, width / 2],
5812
- shrinkability: [0, width / 3]
5813
- } : isCjkLeftAlignedPunctuation(content) ? {
5814
- stretchability: [0, 0],
5815
- shrinkability: [0, width / 2]
5816
- } : isCjkRightAlignedPunctuation(content) ? {
5817
- stretchability: [0, 0],
5818
- shrinkability: [width / 2, 0]
5819
- } : isCjkCenterAlignedPunctuation(content) ? {
5820
- stretchability: [0, 0],
5821
- shrinkability: [width / 4, width / 4]
5822
- } : {
5823
- stretchability: [0, 0],
5824
- shrinkability: [0, 0]
5825
- };
5826
- }
5827
- __name(baseAdjustability, "baseAdjustability");
5828
- function createSkeletonWordGlyph(content, config, glyphWidth) {
5829
- return _createSkeletonWordOrLetter(GlyphType.WORD, content, config, glyphWidth);
5830
- }
5831
- __name(createSkeletonWordGlyph, "createSkeletonWordGlyph");
5832
- function createSkeletonLetterGlyph(content, config, glyphWidth, glyphInfo) {
5833
- return _createSkeletonWordOrLetter(GlyphType.LETTER, content, config, glyphWidth, glyphInfo);
5834
- }
5835
- __name(createSkeletonLetterGlyph, "createSkeletonLetterGlyph");
5836
- function createSkeletonTabGlyph(config, glyphWidth) {
5837
- return _createSkeletonWordOrLetter(GlyphType.TAB, DataStreamTreeTokenType.TAB, config, glyphWidth);
5838
- }
5839
- __name(createSkeletonTabGlyph, "createSkeletonTabGlyph");
5840
- function createHyphenDashGlyph(config) {
5841
- const dashLetterGlyph = _createSkeletonWordOrLetter(GlyphType.LETTER, "-", config);
5842
- return dashLetterGlyph.count = 0, dashLetterGlyph;
5843
- }
5844
- __name(createHyphenDashGlyph, "createHyphenDashGlyph");
5845
- function createSkeletonCustomBlockGlyph(config, glyphWidth = 0, glyphHeight = 0, drawingId = "") {
5846
- const { fontStyle, textStyle } = config, content = DataStreamTreeTokenType.CUSTOM_BLOCK;
5847
- return {
5848
- content: "",
5849
- raw: content,
5850
- ts: textStyle,
5851
- fontStyle,
5852
- width: glyphWidth,
5853
- bBox: {
5854
- width: 0,
5855
- ba: glyphHeight,
5856
- // Or 1/2 glyphHeight each for ba and bd.
5857
- bd: 0,
5858
- aba: 0,
5859
- abd: 0,
5860
- sp: 0,
5861
- sbr: 0,
5862
- sbo: 0,
5863
- spr: 0,
5864
- spo: 0
5865
- },
5866
- xOffset: 0,
5867
- left: 0,
5868
- isJustifiable: !1,
5869
- adjustability: baseAdjustability(content, 0),
5870
- glyphType: GlyphType.PLACEHOLDER,
5871
- streamType: content,
5872
- count: 1,
5873
- drawingId
5874
- };
5875
- }
5876
- __name(createSkeletonCustomBlockGlyph, "createSkeletonCustomBlockGlyph");
5877
- function _createSkeletonWordOrLetter(glyphType, content, config, glyphWidth, glyphInfo) {
5878
- const { fontStyle, textStyle, charSpace = 1, gridType = GridType.LINES, snapToGrid = BooleanNumber.FALSE } = config, skipWidthList = [
5879
- DataStreamTreeTokenType.SECTION_BREAK,
5880
- DataStreamTreeTokenType.TABLE_START,
5881
- DataStreamTreeTokenType.TABLE_END,
5882
- DataStreamTreeTokenType.TABLE_ROW_START,
5883
- DataStreamTreeTokenType.TABLE_ROW_END,
5884
- DataStreamTreeTokenType.TABLE_CELL_START,
5885
- DataStreamTreeTokenType.TABLE_CELL_END,
5886
- DataStreamTreeTokenType.CUSTOM_RANGE_START,
5887
- DataStreamTreeTokenType.CUSTOM_RANGE_END,
5888
- DataStreamTreeTokenType.COLUMN_BREAK,
5889
- DataStreamTreeTokenType.PAGE_BREAK,
5890
- DataStreamTreeTokenType.DOCS_END,
5891
- DataStreamTreeTokenType.CUSTOM_BLOCK
5892
- ];
5893
- let streamType = DataStreamTreeTokenType.LETTER;
5894
- if (skipWidthList.indexOf(content) > -1)
5895
- return {
5896
- content: "",
5897
- raw: content,
5898
- ts: textStyle,
5899
- fontStyle,
5900
- width: 0,
5901
- bBox: {
5902
- width: 0,
5903
- ba: 0,
5904
- bd: 0,
5905
- aba: 0,
5906
- abd: 0,
5907
- sp: 0,
5908
- sbr: 0,
5909
- sbo: 0,
5910
- spr: 0,
5911
- spo: 0
5912
- },
5913
- xOffset: 0,
5914
- left: 0,
5915
- isJustifiable: !1,
5916
- adjustability: baseAdjustability(content, 0),
5917
- glyphType: GlyphType.PLACEHOLDER,
5918
- streamType: content,
5919
- count: 1
5920
- };
5921
- content === DataStreamTreeTokenType.PARAGRAPH && (streamType = DataStreamTreeTokenType.PARAGRAPH);
5922
- let bBox = null, xOffset = 0;
5923
- glyphInfo && glyphInfo.boundingBox && glyphInfo.font ? bBox = FontCache.getBBoxFromGlyphInfo(glyphInfo, fontStyle) : bBox = FontCache.getTextSize(content, fontStyle);
5924
- const { width: contentWidth = 0 } = bBox;
5925
- let width = glyphWidth != null ? glyphWidth : contentWidth;
5926
- if (validationGrid(gridType, snapToGrid) && (width = contentWidth + (hasCJK(content) ? charSpace : charSpace / 2), gridType === GridType.SNAP_TO_CHARS && (xOffset = (width - contentWidth) / 2)), glyphInfo && glyphInfo.kerning !== 0 && glyphInfo.font) {
5927
- const radio = ptToPixel(fontStyle.fontSize) / glyphInfo.font.unitsPerEm, delta = glyphInfo.kerning * radio;
5928
- width += delta, xOffset += delta;
5929
- }
5930
- return {
5931
- content,
5932
- ts: textStyle,
5933
- fontStyle,
5934
- width,
5935
- bBox,
5936
- xOffset,
5937
- left: 0,
5938
- glyphType,
5939
- streamType,
5940
- isJustifiable: isJustifiable(content),
5941
- adjustability: baseAdjustability(content, width),
5942
- count: content.length,
5943
- raw: content
5944
- };
5945
- }
5946
- __name(_createSkeletonWordOrLetter, "_createSkeletonWordOrLetter");
5947
- function createSkeletonBulletGlyph(glyph, bulletSkeleton, charSpaceApply) {
5948
- const {
5949
- bBox: boundingBox,
5950
- symbol: content,
5951
- ts: textStyle,
5952
- fontStyle,
5953
- bulletAlign = BulletAlignment.START,
5954
- bulletType = !1
5955
- } = bulletSkeleton, contentWidth = boundingBox.width, multiple = Math.ceil(contentWidth / charSpaceApply);
5956
- let width = (multiple < 2 ? 2 : multiple) * charSpaceApply, left = 0;
5957
- bulletType && (bulletAlign === BulletAlignment.CENTER ? (left = -contentWidth / 2, width -= left) : bulletAlign === BulletAlignment.END && (left = -contentWidth, width -= left));
5958
- const bBox = _getMaxBoundingBox(glyph, bulletSkeleton);
5959
- return {
5960
- content,
5961
- ts: {
5962
- ...glyph.ts,
5963
- ...textStyle,
5964
- st: {
5965
- s: BooleanNumber.FALSE
5966
- }
5967
- },
5968
- fontStyle,
5969
- width,
5970
- xOffset: 0,
5971
- bBox,
5972
- left,
5973
- isJustifiable: isJustifiable(content),
5974
- adjustability: baseAdjustability(content, width),
5975
- glyphType: GlyphType.LIST,
5976
- streamType: DataStreamTreeTokenType.LETTER,
5977
- // Deliberately set to 0 so that there is no need to count when calculating the cursor.
5978
- count: 0,
5979
- raw: content
5980
- };
5981
- }
5982
- __name(createSkeletonBulletGlyph, "createSkeletonBulletGlyph");
5983
- function setGlyphGroupLeft(glyphGroup, left = 0) {
5984
- const spanGroupLen = glyphGroup.length;
5985
- let preGlyph;
5986
- for (let i = 0; i < spanGroupLen; i++) {
5987
- const glyph = glyphGroup[i];
5988
- glyph.left = preGlyph ? preGlyph.left + preGlyph.width : left, preGlyph = glyph;
5989
- }
5990
- }
5991
- __name(setGlyphGroupLeft, "setGlyphGroupLeft");
5992
- function addGlyphToDivide(divide, glyphGroup, offsetLeft = 0) {
5993
- setGlyphGroupLeft(glyphGroup, offsetLeft);
5994
- for (const glyph of glyphGroup)
5995
- glyph.parent = divide;
5996
- divide.glyphGroup.push(...glyphGroup);
5997
- }
5998
- __name(addGlyphToDivide, "addGlyphToDivide");
5999
- function _getMaxBoundingBox(glyph, bulletSkeleton) {
6000
- const { ba: spanAscent, bd: spanDescent } = glyph.bBox, { ba: bulletAscent, bd: bulletDescent } = bulletSkeleton.bBox;
6001
- return spanAscent + spanDescent > bulletAscent + bulletDescent ? glyph.bBox : bulletSkeleton.bBox;
6002
- }
6003
- __name(_getMaxBoundingBox, "_getMaxBoundingBox");
6004
- function glyphShrinkRight(glyph, amount) {
6005
- glyph.width -= amount, glyph.adjustability.shrinkability[1] -= amount;
6006
- }
6007
- __name(glyphShrinkRight, "glyphShrinkRight");
6008
- function glyphShrinkLeft(glyph, amount) {
6009
- glyph.width -= amount, glyph.xOffset -= amount, glyph.adjustability.shrinkability[0] -= amount;
6010
- }
6011
- __name(glyphShrinkLeft, "glyphShrinkLeft");
6012
- var BreakPointType = /* @__PURE__ */ ((BreakPointType2) => (BreakPointType2.Normal = "Normal", BreakPointType2.Mandatory = "Mandatory", BreakPointType2.Hyphen = "Hyphen", BreakPointType2.Link = "Link", BreakPointType2))(BreakPointType || {});
6013
- const _Break = class _Break {
6014
- constructor(position, type = "Normal") {
6015
- this.position = position, this.type = type;
6016
- }
6017
- };
6018
- __name(_Break, "Break");
6019
- let Break = _Break;
6020
6015
  function createTableSkeleton(ctx, curPage, viewModel, tableNode, sectionBreakConfig) {
6021
6016
  const { startIndex, endIndex, children: rowNodes } = tableNode, table2 = viewModel.getTable(startIndex);
6022
6017
  if (table2 == null)
@@ -6105,10 +6100,8 @@ __name(getTableIdAndSliceIndex, "getTableIdAndSliceIndex");
6105
6100
  function layoutParagraph(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = BreakPointType.Normal) {
6106
6101
  if (isParagraphFirstShapedText)
6107
6102
  if (paragraphConfig.bulletSkeleton) {
6108
- const { bulletSkeleton, paragraphStyle = {} } = paragraphConfig, { gridType = GridType.LINES, charSpace = 0, defaultTabStop = 10.5 } = sectionBreakConfig, paragraphProperties = bulletSkeleton.paragraphProperties || {};
6109
- paragraphConfig.paragraphStyle = mergeByV(paragraphConfig.paragraphStyle, paragraphProperties);
6110
- const { snapToGrid = BooleanNumber.TRUE } = paragraphStyle, charSpaceApply = getCharSpaceApply(charSpace, defaultTabStop, gridType, snapToGrid), bulletGlyph = createSkeletonBulletGlyph(glyphGroup[0], bulletSkeleton, charSpaceApply);
6111
- _lineOperator(ctx, [bulletGlyph, ...glyphGroup], pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType);
6103
+ const { bulletSkeleton, paragraphStyle = {} } = paragraphConfig, { gridType = GridType.LINES, charSpace = 0, defaultTabStop = 10.5 } = sectionBreakConfig, { snapToGrid = BooleanNumber.TRUE } = paragraphStyle, charSpaceApply = getCharSpaceApply(charSpace, defaultTabStop, gridType, snapToGrid), bulletGlyph = createSkeletonBulletGlyph(glyphGroup[0], bulletSkeleton, charSpaceApply), paragraphProperties = bulletSkeleton.paragraphProperties || {};
6104
+ paragraphConfig.paragraphStyle = mergeByV(paragraphConfig.paragraphStyle, { ...paragraphProperties, hanging: { v: bulletGlyph.width } }), _lineOperator(ctx, [bulletGlyph, ...glyphGroup], pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType);
6112
6105
  } else
6113
6106
  _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType);
6114
6107
  else
@@ -22704,18 +22697,18 @@ function getDefaultBulletSke(listId, startIndex = 1) {
22704
22697
  },
22705
22698
  // 文字样式
22706
22699
  startIndexItem: startIndex,
22707
- bBox: {
22708
- width: 8.4560546875,
22709
- ba: 7,
22710
- bd: -1,
22711
- aba: 7,
22712
- abd: -1,
22713
- sp: -2,
22714
- sbr: 0.5,
22715
- sbo: 0,
22716
- spr: 0.5,
22717
- spo: 0
22718
- },
22700
+ // bBox: {
22701
+ // width: 8.4560546875,
22702
+ // ba: 7,
22703
+ // bd: -1,
22704
+ // aba: 7,
22705
+ // abd: -1,
22706
+ // sp: -2,
22707
+ // sbr: 0.5,
22708
+ // sbo: 0,
22709
+ // spr: 0.5,
22710
+ // spo: 0,
22711
+ // },
22719
22712
  paragraphProperties: {
22720
22713
  indentFirstLine: { v: 0 },
22721
22714
  hanging: { v: 21 },
@@ -22730,13 +22723,13 @@ function _getBulletSke(listId, nestingLevel, nestings, listLevelAncestors, textS
22730
22723
  bulletAlignment,
22731
22724
  glyphFormat,
22732
22725
  textStyle: textStyleFirst = {},
22733
- startNumber,
22726
+ // startNumber,
22734
22727
  glyphType,
22735
22728
  glyphSymbol
22736
22729
  } = nesting, textStyle = { ...textStyleConfig, ...textStyleFirst }, fontStyle = getFontStyleString(textStyle);
22737
22730
  let symbolContent;
22738
22731
  glyphSymbol ? symbolContent = glyphSymbol : symbolContent = __generateOrderedListSymbol(glyphFormat, nestingLevel, nestings, listLevelAncestors);
22739
- const bBox = FontCache.getTextSize(symbolContent, fontStyle), startIndex = (_b = (_a10 = listLevelAncestors == null ? void 0 : listLevelAncestors[nestingLevel]) == null ? void 0 : _a10.startIndexItem) != null ? _b : 1;
22732
+ const startIndex = (_b = (_a10 = listLevelAncestors == null ? void 0 : listLevelAncestors[nestingLevel]) == null ? void 0 : _a10.startIndexItem) != null ? _b : 1;
22740
22733
  return {
22741
22734
  listId,
22742
22735
  symbol: symbolContent,
@@ -22746,7 +22739,7 @@ function _getBulletSke(listId, nestingLevel, nestings, listLevelAncestors, textS
22746
22739
  fontStyle,
22747
22740
  //
22748
22741
  startIndexItem: startIndex + 1,
22749
- bBox,
22742
+ // bBox,
22750
22743
  nestingLevel: nesting,
22751
22744
  bulletAlign: bulletAlignment,
22752
22745
  bulletType: glyphSymbol ? !1 : !!glyphType,
@@ -24522,8 +24515,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
24522
24515
  startColumn: -1,
24523
24516
  endColumn: -1
24524
24517
  });
24525
- __publicField(this, "_dataMergeCache", []);
24526
- __publicField(this, "_dataMergeCacheMap", /* @__PURE__ */ new Map());
24518
+ // private _dataMergeCache: IRange[] = [];
24527
24519
  __publicField(this, "_overflowCache", new ObjectMatrix());
24528
24520
  __publicField(this, "_stylesCache", {
24529
24521
  background: {},
@@ -24563,9 +24555,9 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
24563
24555
  get rowColumnSegment() {
24564
24556
  return this._rowColumnSegment;
24565
24557
  }
24566
- get dataMergeCache() {
24567
- return this._dataMergeCache;
24568
- }
24558
+ // get dataMergeCache(): IRange[] {
24559
+ // return this._dataMergeCache;
24560
+ // }
24569
24561
  get stylesCache() {
24570
24562
  return this._stylesCache;
24571
24563
  }
@@ -24585,7 +24577,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
24585
24577
  return this.columnHeaderHeight + this._marginTop;
24586
24578
  }
24587
24579
  dispose() {
24588
- super.dispose(), this._rowHeightAccumulation = [], this._columnWidthAccumulation = [], this._rowTotalHeight = 0, this._columnTotalWidth = 0, this._rowHeaderWidth = 0, this._columnHeaderHeight = 0, this._rowColumnSegment = null, this._dataMergeCache = [], this._stylesCache = {
24580
+ super.dispose(), this._rowHeightAccumulation = [], this._columnWidthAccumulation = [], this._rowTotalHeight = 0, this._columnTotalWidth = 0, this._rowHeaderWidth = 0, this._columnHeaderHeight = 0, this._rowColumnSegment = null, this._stylesCache = {
24589
24581
  background: {},
24590
24582
  backgroundPositions: new ObjectMatrix(),
24591
24583
  font: {},
@@ -24644,10 +24636,8 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
24644
24636
  return !this._worksheetData || (this._updateLayout(), !this._rowHeightAccumulation || !this._columnWidthAccumulation) ? !1 : (bounds != null && (this._rowColumnSegment = this.getRowColumnSegment(bounds)), !0);
24645
24637
  }
24646
24638
  calculateWithoutClearingCache(bounds) {
24647
- if (!this.calculateSegment(bounds))
24648
- return;
24649
- const { mergeData } = this._worksheetData;
24650
- return this._dataMergeCache = mergeData && this._getMergeCells(mergeData, this._rowColumnSegment), this._dataMergeCacheMap = mergeData && this._getMergeCellsCache(mergeData), this._calculateStylesCache(), this;
24639
+ if (this.calculateSegment(bounds))
24640
+ return this._calculateStylesCache(), this;
24651
24641
  }
24652
24642
  calculate(bounds) {
24653
24643
  return this._resetCache(), this.calculateWithoutClearingCache(bounds), this;
@@ -24656,13 +24646,13 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
24656
24646
  var _a10;
24657
24647
  if (!Tools.isArray(ranges))
24658
24648
  return [];
24659
- const results = [], { mergeData, rowData } = this._worksheetData, rowObjectArray = rowData, calculatedRows = /* @__PURE__ */ new Set();
24649
+ const results = [], { rowData } = this._worksheetData, rowObjectArray = rowData, calculatedRows = /* @__PURE__ */ new Set();
24660
24650
  for (const range of ranges) {
24661
24651
  const { startRow, endRow, startColumn, endColumn } = range;
24662
24652
  for (let rowIndex = startRow; rowIndex <= endRow; rowIndex++) {
24663
24653
  if (calculatedRows.has(rowIndex) || ((_a10 = rowObjectArray[rowIndex]) == null ? void 0 : _a10.ia) === BooleanNumber.FALSE)
24664
24654
  continue;
24665
- if (hasUnMergedCellInRow(rowIndex, startColumn, endColumn, mergeData)) {
24655
+ if (this._hasUnMergedCellInRow(rowIndex, startColumn, endColumn)) {
24666
24656
  const autoHeight = this._calculateRowAutoHeight(rowIndex);
24667
24657
  calculatedRows.add(rowIndex), results.push({
24668
24658
  row: rowIndex,
@@ -24673,16 +24663,26 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
24673
24663
  }
24674
24664
  return results;
24675
24665
  }
24666
+ _hasUnMergedCellInRow(rowIndex, startColumn, endColumn) {
24667
+ if (!this.worksheet.getMergeData())
24668
+ return !1;
24669
+ for (let i = startColumn; i <= endColumn; i++) {
24670
+ const { isMerged, isMergedMainCell } = this._getCellMergeInfo(rowIndex, i);
24671
+ if (!isMerged && !isMergedMainCell)
24672
+ return !0;
24673
+ }
24674
+ return !1;
24675
+ }
24676
24676
  // TODO: auto height
24677
24677
  _calculateRowAutoHeight(rowNum) {
24678
24678
  var _a10, _b, _c;
24679
- const { columnCount, columnData, mergeData, defaultRowHeight, defaultColumnWidth } = this._worksheetData;
24679
+ const { columnCount, columnData, defaultRowHeight, defaultColumnWidth } = this._worksheetData;
24680
24680
  let height = defaultRowHeight;
24681
24681
  const worksheet = this.worksheet;
24682
24682
  if (!worksheet)
24683
24683
  return height;
24684
24684
  for (let i = 0; i < columnCount; i++) {
24685
- const { isMerged, isMergedMainCell } = this._getCellMergeInfo(rowNum, i, mergeData);
24685
+ const { isMerged, isMergedMainCell } = this._getCellMergeInfo(rowNum, i);
24686
24686
  if (isMerged || isMergedMainCell)
24687
24687
  continue;
24688
24688
  const cell = worksheet.getCell(rowNum, i);
@@ -24954,7 +24954,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
24954
24954
  column,
24955
24955
  rowHeightAccumulation,
24956
24956
  columnWidthAccumulation,
24957
- this._getCellMergeInfo(row, column, this._worksheetData.mergeData)
24957
+ this._getCellMergeInfo(row, column)
24958
24958
  ), { isMerged, isMergedMainCell } = primary;
24959
24959
  let { startY, endY, startX, endX, mergeInfo } = primary;
24960
24960
  return startY += columnHeaderHeightAndMarginTop, endY += columnHeaderHeightAndMarginTop, startX += rowHeaderWidthAndMarginLeft, endX += rowHeaderWidthAndMarginLeft, mergeInfo = mergeInfoOffset(mergeInfo, rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop), {
@@ -24975,7 +24975,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
24975
24975
  column,
24976
24976
  rowHeightAccumulation,
24977
24977
  columnWidthAccumulation,
24978
- this._getCellMergeInfo(row, column, this._worksheetData.mergeData)
24978
+ this._getCellMergeInfo(row, column)
24979
24979
  ), { isMerged, isMergedMainCell } = primary, { startY, endY, startX, endX, mergeInfo } = primary, newMergeInfo = mergeInfoOffset(mergeInfo, 0, 0);
24980
24980
  return {
24981
24981
  actualRow: row,
@@ -25112,7 +25112,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
25112
25112
  column,
25113
25113
  this.rowHeightAccumulation,
25114
25114
  this.columnWidthAccumulation,
25115
- this._getCellMergeInfo(row, column, this._worksheetData.mergeData)
25115
+ this._getCellMergeInfo(row, column)
25116
25116
  ), cellWidth = endX - startX, cellHeight = endY - startY;
25117
25117
  contentSize.height > cellHeight && (contentSize = {
25118
25118
  width: cellHeight / Math.tan(Math.abs(vertexAngle)) + cellWidth,
@@ -25131,7 +25131,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
25131
25131
  column,
25132
25132
  this.rowHeightAccumulation,
25133
25133
  this.columnWidthAccumulation,
25134
- this._getCellMergeInfo(row, column, this._worksheetData.mergeData)
25134
+ this._getCellMergeInfo(row, column)
25135
25135
  ), cellHeight = endY - startY;
25136
25136
  documentSkeleton.getViewModel().getDataModel().updateDocumentDataPageSize(cellHeight), documentSkeleton.calculate();
25137
25137
  const contentSize = getDocsSkeletonPageSize(documentSkeleton, vertexAngle);
@@ -25252,18 +25252,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
25252
25252
  return endColumn;
25253
25253
  }
25254
25254
  intersectMergeRange(row, column) {
25255
- const dataMergeCache = this.dataMergeCache;
25256
- for (const dataCache of dataMergeCache) {
25257
- const {
25258
- startRow: startRowMargeIndex,
25259
- endRow: endRowMargeIndex,
25260
- startColumn: startColumnMargeIndex,
25261
- endColumn: endColumnMargeIndex
25262
- } = dataCache;
25263
- if (row >= startRowMargeIndex && row <= endRowMargeIndex && column >= startColumnMargeIndex && column <= endColumnMargeIndex)
25264
- return !0;
25265
- }
25266
- return !1;
25255
+ return !!this.worksheet.getMergedCell(row, column);
25267
25256
  }
25268
25257
  // private _getMergeRangeCache() {
25269
25258
  // const dataMergeCache = this.dataMergeCache;
@@ -25278,24 +25267,37 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
25278
25267
  // });
25279
25268
  // return mergeRangeCache;
25280
25269
  // }
25270
+ /**
25271
+ * get the current row and column segment visible merge data
25272
+ * @returns {IRange} The visible merge data
25273
+ */
25274
+ getCurrentRowColumnSegmentMergeData(range) {
25275
+ const endColumnLast = this.columnWidthAccumulation.length - 1;
25276
+ return range ? range = {
25277
+ startRow: range.startRow,
25278
+ endRow: range.endRow,
25279
+ endColumn: endColumnLast,
25280
+ startColumn: 0
25281
+ } : range = { startRow: 0, startColumn: 0, endRow: this.rowHeightAccumulation.length - 1, endColumn: endColumnLast }, this.worksheet.getSpanModel().getMergedCellRangeForSkeleton(range.startRow, range.startColumn, range.endRow, range.endColumn);
25282
+ }
25281
25283
  _calculateStylesCache() {
25282
- const dataMergeCaches = this._dataMergeCache, rowColumnSegment = this._rowColumnSegment, columnWidthAccumulation = this.columnWidthAccumulation, { startRow, endRow, startColumn, endColumn } = rowColumnSegment;
25283
- if (!(endColumn === -1 || endRow === -1)) {
25284
- for (const mergeRange of dataMergeCaches)
25285
- this._setStylesCache(mergeRange.startRow, mergeRange.startColumn, {
25286
- mergeRange
25287
- });
25288
- for (let r = startRow; r <= endRow; r++)
25289
- if (this.worksheet.getRowVisible(r) !== !1) {
25290
- for (let c = startColumn; c <= endColumn; c++)
25291
- this._setStylesCache(r, c, { cacheItem: { bg: !0, border: !0 } });
25292
- for (let c = 0; c < startColumn; c++)
25284
+ const rowColumnSegment = this._rowColumnSegment, columnWidthAccumulation = this.columnWidthAccumulation, { startRow, endRow, startColumn, endColumn } = rowColumnSegment;
25285
+ if (endColumn === -1 || endRow === -1) return;
25286
+ const mergeRanges = this.getCurrentRowColumnSegmentMergeData(this._rowColumnSegment);
25287
+ for (const mergeRange of mergeRanges)
25288
+ this._setStylesCache(mergeRange.startRow, mergeRange.startColumn, {
25289
+ mergeRange
25290
+ });
25291
+ for (let r = startRow; r <= endRow; r++)
25292
+ if (this.worksheet.getRowVisible(r) !== !1) {
25293
+ for (let c = startColumn; c <= endColumn; c++)
25294
+ this._setStylesCache(r, c, { cacheItem: { bg: !0, border: !0 } });
25295
+ for (let c = 0; c < startColumn; c++)
25296
+ this._setStylesCache(r, c, { cacheItem: { bg: !1, border: !1 } });
25297
+ if (endColumn !== 0)
25298
+ for (let c = endColumn + 1; c < columnWidthAccumulation.length; c++)
25293
25299
  this._setStylesCache(r, c, { cacheItem: { bg: !1, border: !1 } });
25294
- if (endColumn !== 0)
25295
- for (let c = endColumn + 1; c < columnWidthAccumulation.length; c++)
25296
- this._setStylesCache(r, c, { cacheItem: { bg: !1, border: !1 } });
25297
- }
25298
- }
25300
+ }
25299
25301
  }
25300
25302
  /**
25301
25303
  * Any changes to sheet model would reset cache.
@@ -25341,11 +25343,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
25341
25343
  const cell = this.worksheet.getCell(row, col) || this.worksheet.getCellRaw(row, col);
25342
25344
  if (!cell) return;
25343
25345
  if (this.worksheet.getColVisible(col) === !1 || this.worksheet.getRowVisible(row) === !1) {
25344
- const { isMerged, isMergedMainCell } = this._getCellMergeInfo(
25345
- row,
25346
- col,
25347
- this._dataMergeCache
25348
- );
25346
+ const { isMerged, isMergedMainCell } = this._getCellMergeInfo(row, col);
25349
25347
  if (isMerged && !isMergedMainCell)
25350
25348
  return;
25351
25349
  if (!isMergedMainCell)
@@ -25548,28 +25546,8 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
25548
25546
  paddingData
25549
25547
  };
25550
25548
  }
25551
- _getMergeCellsCache(mergeData) {
25552
- const map = /* @__PURE__ */ new Map();
25553
- return mergeData.forEach((range) => {
25554
- for (let r = range.startRow; r <= range.endRow; r++)
25555
- for (let c = range.startColumn; c <= range.endColumn; c++)
25556
- map.set(`${r}-${c}`, range);
25557
- }), map;
25558
- }
25559
- _getCellMergeInfo(row, column, mergeData) {
25560
- this._dataMergeCacheMap || (this._dataMergeCacheMap = this._getMergeCellsCache(mergeData));
25561
- const key = `${row}-${column}`, mergeRange = this._dataMergeCacheMap.get(key);
25562
- let isMerged = !1, isMergedMainCell = !1, newEndRow = row, newEndColumn = column, mergeRow = row, mergeColumn = column;
25563
- return mergeRange && (isMergedMainCell = mergeRange.startRow === row && mergeRange.startColumn === column, isMergedMainCell ? (newEndRow = mergeRange.endRow, newEndColumn = mergeRange.endColumn, mergeRow = mergeRange.startRow, mergeColumn = mergeRange.startColumn) : row > mergeRange.startRow && row <= mergeRange.endRow && column > mergeRange.startColumn && column <= mergeRange.endColumn && (isMerged = !0, newEndRow = mergeRange.endRow, newEndColumn = mergeRange.endColumn, mergeRow = mergeRange.startRow, mergeColumn = mergeRange.startColumn)), {
25564
- actualRow: row,
25565
- actualColumn: column,
25566
- isMergedMainCell,
25567
- isMerged,
25568
- endRow: newEndRow,
25569
- endColumn: newEndColumn,
25570
- startRow: mergeRow,
25571
- startColumn: mergeColumn
25572
- };
25549
+ _getCellMergeInfo(row, column) {
25550
+ return this.worksheet.getCellInfoInMergeData(row, column);
25573
25551
  }
25574
25552
  /**
25575
25553
  * Cache the merged cells on the current screen to improve computational performance.
@@ -25626,7 +25604,7 @@ const UNIQUE_KEY$7 = "DefaultFontExtension", EXTENSION_Z_INDEX = 45, _Font = cla
25626
25604
  return parent == null ? void 0 : parent.getDocuments();
25627
25605
  }
25628
25606
  draw(ctx, parentScale, spreadsheetSkeleton, diffRanges, moreBoundsInfo) {
25629
- const { stylesCache, dataMergeCache, overflowCache, worksheet } = spreadsheetSkeleton, { font: fontList } = stylesCache;
25607
+ const { stylesCache, overflowCache, worksheet } = spreadsheetSkeleton, { font: fontList } = stylesCache;
25630
25608
  if (!spreadsheetSkeleton || !worksheet || !fontList)
25631
25609
  return;
25632
25610
  const { rowHeightAccumulation, columnTotalWidth, columnWidthAccumulation, rowTotalHeight } = spreadsheetSkeleton;
@@ -25639,12 +25617,9 @@ const UNIQUE_KEY$7 = "DefaultFontExtension", EXTENSION_Z_INDEX = 45, _Font = cla
25639
25617
  var _a10, _b, _c, _d, _e;
25640
25618
  if (!checkOutOfViewBound && !inViewRanges(viewRanges, rowIndex, columnIndex))
25641
25619
  return !0;
25642
- const cellInfo = this.getCellByIndex(
25620
+ const cellInfo = spreadsheetSkeleton.getCellByIndexWithNoHeader(
25643
25621
  rowIndex,
25644
- columnIndex,
25645
- rowHeightAccumulation,
25646
- columnWidthAccumulation,
25647
- dataMergeCache
25622
+ columnIndex
25648
25623
  );
25649
25624
  let { startY, endY, startX, endX } = cellInfo;
25650
25625
  const { isMerged, isMergedMainCell, mergeInfo } = cellInfo;
@@ -25844,13 +25819,7 @@ const UNIQUE_KEY$5 = "DefaultMarkerExtension", Z_INDEX$1 = 60, stringifyRange$1
25844
25819
  if (!worksheet.getRowVisible(row) || !worksheet.getColVisible(col))
25845
25820
  return;
25846
25821
  let cellData = worksheet.getCell(row, col);
25847
- const cellInfo = this.getCellByIndex(
25848
- row,
25849
- col,
25850
- skeleton.rowHeightAccumulation,
25851
- skeleton.columnWidthAccumulation,
25852
- skeleton.dataMergeCache
25853
- ), { isMerged, isMergedMainCell, mergeInfo } = cellInfo;
25822
+ const cellInfo = skeleton.getCellByIndexWithNoHeader(row, col), { isMerged, isMergedMainCell, mergeInfo } = cellInfo;
25854
25823
  let { startY, endY, startX, endX } = cellInfo;
25855
25824
  if ((isMergedMainCell || isMerged) && (startY = mergeInfo.startY, endY = mergeInfo.endY, startX = mergeInfo.startX, endX = mergeInfo.endX), isMerged) {
25856
25825
  const mainCell = {
@@ -25905,7 +25874,7 @@ const UNIQUE_KEY$4 = "DefaultCustomExtension", Z_INDEX = 55, stringifyRange = /*
25905
25874
  __publicField(this, "uKey", UNIQUE_KEY$4);
25906
25875
  }
25907
25876
  draw(ctx, _parentScale, skeleton, diffRanges) {
25908
- const { rowHeightAccumulation, columnWidthAccumulation, worksheet, dataMergeCache, rowColumnSegment } = skeleton;
25877
+ const { worksheet, rowColumnSegment } = skeleton;
25909
25878
  if (!worksheet)
25910
25879
  return;
25911
25880
  const mergeCellRendered = /* @__PURE__ */ new Set(), subUnitId = worksheet.getSheetId();
@@ -25915,7 +25884,7 @@ const UNIQUE_KEY$4 = "DefaultCustomExtension", Z_INDEX = 55, stringifyRange = /*
25915
25884
  let cellData = worksheet.getCell(row, col);
25916
25885
  if (!(cellData != null && cellData.customRender))
25917
25886
  return;
25918
- let primaryWithCoord = this.getCellByIndex(row, col, rowHeightAccumulation, columnWidthAccumulation, dataMergeCache);
25887
+ let primaryWithCoord = skeleton.getCellByIndexWithNoHeader(row, col);
25919
25888
  const { mergeInfo } = primaryWithCoord;
25920
25889
  if (!this.isRenderDiffRangesByRow(mergeInfo.startRow, mergeInfo.endRow, diffRanges))
25921
25890
  return !0;
@@ -25932,7 +25901,7 @@ const UNIQUE_KEY$4 = "DefaultCustomExtension", Z_INDEX = 55, stringifyRange = /*
25932
25901
  };
25933
25902
  if (cellData = worksheet.getCell(mainCell.row, mainCell.col), !(cellData != null && cellData.customRender))
25934
25903
  return;
25935
- primaryWithCoord = this.getCellByIndex(mainCell.row, mainCell.col, rowHeightAccumulation, columnWidthAccumulation, dataMergeCache);
25904
+ primaryWithCoord = skeleton.getCellByIndex(mainCell.row, mainCell.col);
25936
25905
  }
25937
25906
  const renderInfo = {
25938
25907
  data: cellData,
@@ -27418,9 +27387,9 @@ const _BaseScrollBar = class _BaseScrollBar extends Disposable {
27418
27387
  __publicField(this, "verticalThumbHeight", 0);
27419
27388
  __publicField(this, "verticalBarHeight", 0);
27420
27389
  __publicField(this, "verticalMinusMiniThumb", 0);
27421
- __publicField(this, "horizonBarRect");
27390
+ __publicField(this, "horizonScrollTrack");
27422
27391
  __publicField(this, "horizonThumbRect");
27423
- __publicField(this, "verticalBarRect");
27392
+ __publicField(this, "verticalScrollTrack");
27424
27393
  __publicField(this, "verticalThumbRect");
27425
27394
  __publicField(this, "placeholderBarRect");
27426
27395
  }
@@ -27460,11 +27429,11 @@ const _BaseScrollBar = class _BaseScrollBar extends Disposable {
27460
27429
  }
27461
27430
  pick(coord) {
27462
27431
  var _a10, _b, _c, _d;
27463
- return (_a10 = this.horizonThumbRect) != null && _a10.isHit(coord) ? this.horizonThumbRect : (_b = this.verticalThumbRect) != null && _b.isHit(coord) ? this.verticalThumbRect : (_c = this.horizonBarRect) != null && _c.isHit(coord) ? this.horizonBarRect : (_d = this.verticalBarRect) != null && _d.isHit(coord) ? this.verticalBarRect : null;
27432
+ return (_a10 = this.horizonThumbRect) != null && _a10.isHit(coord) ? this.horizonThumbRect : (_b = this.verticalThumbRect) != null && _b.isHit(coord) ? this.verticalThumbRect : (_c = this.horizonScrollTrack) != null && _c.isHit(coord) ? this.horizonScrollTrack : (_d = this.verticalScrollTrack) != null && _d.isHit(coord) ? this.verticalScrollTrack : null;
27464
27433
  }
27465
27434
  dispose() {
27466
27435
  var _a10, _b, _c, _d, _e;
27467
- (_a10 = this.horizonBarRect) == null || _a10.dispose(), (_b = this.horizonThumbRect) == null || _b.dispose(), (_c = this.verticalBarRect) == null || _c.dispose(), (_d = this.verticalThumbRect) == null || _d.dispose(), (_e = this.placeholderBarRect) == null || _e.dispose(), this.horizonBarRect = null, this.horizonThumbRect = null, this.verticalBarRect = null, this.verticalThumbRect = null, this.placeholderBarRect = null;
27436
+ (_a10 = this.horizonScrollTrack) == null || _a10.dispose(), (_b = this.horizonThumbRect) == null || _b.dispose(), (_c = this.verticalScrollTrack) == null || _c.dispose(), (_d = this.verticalThumbRect) == null || _d.dispose(), (_e = this.placeholderBarRect) == null || _e.dispose(), this.horizonScrollTrack = null, this.horizonThumbRect = null, this.verticalScrollTrack = null, this.verticalThumbRect = null, this.placeholderBarRect = null;
27468
27437
  }
27469
27438
  hasHorizonThumb() {
27470
27439
  var _a10;
@@ -27480,7 +27449,7 @@ let BaseScrollBar = _BaseScrollBar;
27480
27449
  const MINI_THUMB_SIZE = 17, _ScrollBar = class _ScrollBar extends BaseScrollBar {
27481
27450
  constructor(view, props) {
27482
27451
  super();
27483
- __publicField(this, "_view");
27452
+ __publicField(this, "_viewport");
27484
27453
  __publicField(this, "_mainScene");
27485
27454
  __publicField(this, "_lastX", -1);
27486
27455
  __publicField(this, "_lastY", -1);
@@ -27503,20 +27472,20 @@ const MINI_THUMB_SIZE = 17, _ScrollBar = class _ScrollBar extends BaseScrollBar
27503
27472
  __publicField(this, "barBackgroundColor", "rgba(255,255,255,0.5)");
27504
27473
  __publicField(this, "barBorderColor", "rgba(255,255,255,0.7)");
27505
27474
  __publicField(this, "_eventSub", new Subscription());
27506
- view || console.warn("Missing viewport"), this.setProps(props), this._view = view, this._initialScrollRect(), this._initialVerticalEvent(), this._initialHorizontalEvent(), this._view.setScrollBar(this);
27475
+ view || console.warn("Missing viewport"), this.setProps(props), this._viewport = view, this._initialScrollRect(), this._initialVerticalEvent(), this._initialHorizontalEvent(), this._viewport.setScrollBar(this);
27507
27476
  }
27508
27477
  static attachTo(view, props) {
27509
27478
  return new _ScrollBar(view, props);
27510
27479
  }
27511
27480
  dispose() {
27512
27481
  var _a10, _b, _c, _d;
27513
- super.dispose(), (_a10 = this._horizonPointerMoveSub) == null || _a10.unsubscribe(), (_b = this._horizonPointerUpSub) == null || _b.unsubscribe(), (_c = this._verticalPointerMoveSub) == null || _c.unsubscribe(), (_d = this._verticalPointerUpSub) == null || _d.unsubscribe(), this._eventSub.unsubscribe(), this._mainScene = null, this._view.removeScrollBar();
27482
+ super.dispose(), (_a10 = this._horizonPointerMoveSub) == null || _a10.unsubscribe(), (_b = this._horizonPointerUpSub) == null || _b.unsubscribe(), (_c = this._verticalPointerMoveSub) == null || _c.unsubscribe(), (_d = this._verticalPointerUpSub) == null || _d.unsubscribe(), this._eventSub.unsubscribe(), this._mainScene = null, this._viewport.removeScrollBar();
27514
27483
  }
27515
27484
  render(ctx, left = 0, top = 0) {
27516
- const { scrollX, scrollY } = this._view;
27485
+ const { scrollX, scrollY } = this._viewport;
27517
27486
  ctx.save();
27518
27487
  const m = new Transform([1, 0, 0, 1, left, top]).getMatrix();
27519
- ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]), this.enableHorizontal && (this.horizonBarRect.render(ctx), this.horizonThumbRect.translate(scrollX).render(ctx)), this.enableVertical && (this.verticalBarRect.render(ctx), this.verticalThumbRect.translate(void 0, scrollY).render(ctx)), this.enableHorizontal && this.enableVertical && this.placeholderBarRect.render(ctx), ctx.restore();
27488
+ ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]), this.enableHorizontal && (this.horizonScrollTrack.render(ctx), this.horizonThumbRect.translate(scrollX).render(ctx)), this.enableVertical && (this.verticalScrollTrack.render(ctx), this.verticalThumbRect.translate(void 0, scrollY).render(ctx)), this.enableHorizontal && this.enableVertical && this.placeholderBarRect.render(ctx), ctx.restore();
27520
27489
  }
27521
27490
  resize(parentWidth = 0, parentHeight = 0, contentWidth = 0, contentHeight = 0) {
27522
27491
  var _a10;
@@ -27529,14 +27498,14 @@ const MINI_THUMB_SIZE = 17, _ScrollBar = class _ScrollBar extends BaseScrollBar
27529
27498
  }
27530
27499
  makeDirty(state) {
27531
27500
  var _a10, _b, _c, _d, _e;
27532
- (_a10 = this.horizonBarRect) == null || _a10.makeDirty(state), (_b = this.horizonThumbRect) == null || _b.makeDirty(state), (_c = this.verticalBarRect) == null || _c.makeDirty(state), (_d = this.verticalThumbRect) == null || _d.makeDirty(state), (_e = this.placeholderBarRect) == null || _e.makeDirty(state), this.makeViewDirty(state);
27501
+ (_a10 = this.horizonScrollTrack) == null || _a10.makeDirty(state), (_b = this.horizonThumbRect) == null || _b.makeDirty(state), (_c = this.verticalScrollTrack) == null || _c.makeDirty(state), (_d = this.verticalThumbRect) == null || _d.makeDirty(state), (_e = this.placeholderBarRect) == null || _e.makeDirty(state), this.makeViewDirty(state);
27533
27502
  }
27534
27503
  makeViewDirty(state) {
27535
- (this._mainScene || this._view.scene).makeDirty(state);
27504
+ (this._mainScene || this._viewport.scene).makeDirty(state);
27536
27505
  }
27537
27506
  pick(coord) {
27538
27507
  var _a10, _b, _c, _d;
27539
- return (_a10 = this.horizonThumbRect) != null && _a10.isHit(coord) ? this.horizonThumbRect : (_b = this.verticalThumbRect) != null && _b.isHit(coord) ? this.verticalThumbRect : (_c = this.horizonBarRect) != null && _c.isHit(coord) ? this.horizonBarRect : (_d = this.verticalBarRect) != null && _d.isHit(coord) ? this.verticalBarRect : null;
27508
+ return (_a10 = this.horizonThumbRect) != null && _a10.isHit(coord) ? this.horizonThumbRect : (_b = this.verticalThumbRect) != null && _b.isHit(coord) ? this.verticalThumbRect : (_c = this.horizonScrollTrack) != null && _c.isHit(coord) ? this.horizonScrollTrack : (_d = this.verticalScrollTrack) != null && _d.isHit(coord) ? this.verticalScrollTrack : null;
27540
27509
  }
27541
27510
  setProps(props) {
27542
27511
  if (!props)
@@ -27548,7 +27517,7 @@ const MINI_THUMB_SIZE = 17, _ScrollBar = class _ScrollBar extends BaseScrollBar
27548
27517
  }
27549
27518
  _resizeHorizontal(parentWidth, parentHeight, contentWidth) {
27550
27519
  var _a10, _b, _c, _d, _e;
27551
- this.enableHorizontal && (this.horizontalMinusMiniThumb = 0, this.horizontalBarWidth = parentWidth - (this.enableVertical ? this.barSize : 0) - this.barBorder, this.horizontalThumbWidth = this.horizontalBarWidth * (this.horizontalBarWidth - this.barBorder) / contentWidth * this.thumbLengthRatio, this.horizontalThumbWidth < MINI_THUMB_SIZE && (this.horizontalMinusMiniThumb = MINI_THUMB_SIZE - this.horizontalThumbWidth, this.horizontalThumbWidth = MINI_THUMB_SIZE), (_a10 = this.horizonBarRect) == null || _a10.transformByState({
27520
+ this.enableHorizontal && (this.horizontalMinusMiniThumb = 0, this.horizontalBarWidth = parentWidth - (this.enableVertical ? this.barSize : 0) - this.barBorder, this.horizontalThumbWidth = this.horizontalBarWidth * (this.horizontalBarWidth - this.barBorder) / contentWidth * this.thumbLengthRatio, this.horizontalThumbWidth < MINI_THUMB_SIZE && (this.horizontalMinusMiniThumb = MINI_THUMB_SIZE - this.horizontalThumbWidth, this.horizontalThumbWidth = MINI_THUMB_SIZE), (_a10 = this.horizonScrollTrack) == null || _a10.transformByState({
27552
27521
  left: 0,
27553
27522
  top: parentHeight - this.barSize,
27554
27523
  width: this.horizontalBarWidth,
@@ -27558,7 +27527,7 @@ const MINI_THUMB_SIZE = 17, _ScrollBar = class _ScrollBar extends BaseScrollBar
27558
27527
  }) : ((_c = this.horizonThumbRect) != null && _c.visible || (_d = this.horizonThumbRect) == null || _d.setProps({
27559
27528
  visible: !0
27560
27529
  }), (_e = this.horizonThumbRect) == null || _e.transformByState({
27561
- left: this._view.scrollX,
27530
+ left: this._viewport.scrollX,
27562
27531
  top: parentHeight - this.barSize + this.thumbMargin,
27563
27532
  width: this.horizontalThumbWidth,
27564
27533
  height: this.barSize - this.thumbMargin * 2
@@ -27566,7 +27535,7 @@ const MINI_THUMB_SIZE = 17, _ScrollBar = class _ScrollBar extends BaseScrollBar
27566
27535
  }
27567
27536
  _resizeVertical(parentWidth, parentHeight, contentHeight) {
27568
27537
  var _a10, _b, _c, _d, _e;
27569
- this.enableVertical && (this.verticalMinusMiniThumb = 0, this.verticalBarHeight = parentHeight - (this.enableHorizontal ? this.barSize : 0) - this.barBorder, this.verticalThumbHeight = this.verticalBarHeight * this.verticalBarHeight / contentHeight * this.thumbLengthRatio, this.verticalThumbHeight < MINI_THUMB_SIZE && (this.verticalMinusMiniThumb = MINI_THUMB_SIZE - this.verticalThumbHeight, this.verticalThumbHeight = MINI_THUMB_SIZE), (_a10 = this.verticalBarRect) == null || _a10.transformByState({
27538
+ this.enableVertical && (this.verticalMinusMiniThumb = 0, this.verticalBarHeight = parentHeight - (this.enableHorizontal ? this.barSize : 0) - this.barBorder, this.verticalThumbHeight = this.verticalBarHeight * this.verticalBarHeight / contentHeight * this.thumbLengthRatio, this.verticalThumbHeight < MINI_THUMB_SIZE && (this.verticalMinusMiniThumb = MINI_THUMB_SIZE - this.verticalThumbHeight, this.verticalThumbHeight = MINI_THUMB_SIZE), (_a10 = this.verticalScrollTrack) == null || _a10.transformByState({
27570
27539
  left: parentWidth - this.barSize,
27571
27540
  top: 0,
27572
27541
  width: this.barSize - this.barBorder,
@@ -27577,20 +27546,20 @@ const MINI_THUMB_SIZE = 17, _ScrollBar = class _ScrollBar extends BaseScrollBar
27577
27546
  visible: !0
27578
27547
  }), (_e = this.verticalThumbRect) == null || _e.transformByState({
27579
27548
  left: parentWidth - this.barSize + this.thumbMargin,
27580
- top: this._view.scrollY,
27549
+ top: this._viewport.scrollY,
27581
27550
  width: this.barSize - this.thumbMargin * 2,
27582
27551
  height: this.verticalThumbHeight
27583
27552
  })));
27584
27553
  }
27585
27554
  _initialScrollRect() {
27586
- this.enableHorizontal && (this.horizonBarRect = new Rect("__horizonBarRect__", {
27555
+ this.enableHorizontal && (this.horizonScrollTrack = new Rect("__horizonBarRect__", {
27587
27556
  fill: this.barBackgroundColor,
27588
27557
  strokeWidth: this.barBorder,
27589
27558
  stroke: this.barBorderColor
27590
27559
  }), this.horizonThumbRect = new Rect("__horizonThumbRect__", {
27591
27560
  radius: 6,
27592
27561
  fill: this.thumbBackgroundColor
27593
- })), this.enableVertical && (this.verticalBarRect = new Rect("__verticalBarRect__", {
27562
+ })), this.enableVertical && (this.verticalScrollTrack = new Rect("__verticalBarRect__", {
27594
27563
  fill: this.barBackgroundColor,
27595
27564
  strokeWidth: this.barBorder,
27596
27565
  stroke: this.barBorderColor
@@ -27606,15 +27575,15 @@ const MINI_THUMB_SIZE = 17, _ScrollBar = class _ScrollBar extends BaseScrollBar
27606
27575
  _initialVerticalEvent() {
27607
27576
  if (!this.enableVertical)
27608
27577
  return;
27609
- const mainScene = this._mainScene || this._view.scene;
27578
+ const mainScene = this._mainScene || this._viewport.scene;
27610
27579
  this.verticalThumbRect && this._eventSub.add(this.verticalThumbRect.onPointerEnter$.subscribeEvent((_evt, _state) => {
27611
27580
  this._hoverFunc(this.thumbHoverBackgroundColor, this.verticalThumbRect);
27612
27581
  })), this.verticalThumbRect && this._eventSub.add(this.verticalThumbRect.onPointerLeave$.subscribeEvent((_evt, _state) => {
27613
27582
  this._hoverFunc(this.thumbHoverBackgroundColor, this.verticalThumbRect);
27614
- })), this.verticalBarRect && this._eventSub.add(this.verticalBarRect.onPointerDown$.subscribeEvent((evt, state) => {
27583
+ })), this.verticalScrollTrack && this._eventSub.add(this.verticalScrollTrack.onPointerDown$.subscribeEvent((evt, state) => {
27615
27584
  const e = evt;
27616
- this._view.scrollToBarPos({
27617
- y: e.offsetY - this._view.top - this.verticalThumbHeight / 2
27585
+ this._viewport.scrollToBarPos({
27586
+ y: e.offsetY - this._viewport.top - this.verticalThumbHeight / 2
27618
27587
  }), state.stopPropagation();
27619
27588
  })), this.verticalThumbRect && this._eventSub.add(this.verticalThumbRect.onPointerDown$.subscribeEvent((evt, state) => {
27620
27589
  const e = evt, srcElement = this.verticalThumbRect;
@@ -27624,8 +27593,8 @@ const MINI_THUMB_SIZE = 17, _ScrollBar = class _ScrollBar extends BaseScrollBar
27624
27593
  })), this._verticalPointerMoveSub = mainScene.onPointerMove$.subscribeEvent((evt, _state) => {
27625
27594
  var _a10;
27626
27595
  const e = evt;
27627
- this._isVerticalMove && (this._view.scrollByBar({
27628
- y: e.offsetY - this._lastY
27596
+ this._isVerticalMove && (this._viewport.scrollToBarPos({
27597
+ y: e.offsetY
27629
27598
  }), this._lastY = e.offsetY, (_a10 = mainScene.getEngine()) == null || _a10.setRemainCapture());
27630
27599
  }), this._verticalPointerUpSub = mainScene.onPointerUp$.subscribeEvent((_evt, _state) => {
27631
27600
  const srcElement = this.verticalThumbRect;
@@ -27646,15 +27615,15 @@ const MINI_THUMB_SIZE = 17, _ScrollBar = class _ScrollBar extends BaseScrollBar
27646
27615
  _initialHorizontalEvent() {
27647
27616
  if (!this.enableHorizontal)
27648
27617
  return;
27649
- const mainScene = this._mainScene || this._view.scene;
27618
+ const mainScene = this._mainScene || this._viewport.scene;
27650
27619
  this.horizonThumbRect && this._eventSub.add(this.horizonThumbRect.onPointerEnter$.subscribeEvent((_evt, _state) => {
27651
27620
  this._hoverFunc(this.thumbHoverBackgroundColor, this.horizonThumbRect);
27652
27621
  })), this.horizonThumbRect && this._eventSub.add(this.horizonThumbRect.onPointerLeave$.subscribeEvent((_evt, _state) => {
27653
27622
  this._hoverFunc(this.thumbHoverBackgroundColor, this.horizonThumbRect);
27654
- })), this.horizonBarRect && this._eventSub.add(this.horizonBarRect.onPointerDown$.subscribeEvent((evt, state) => {
27623
+ })), this.horizonScrollTrack && this._eventSub.add(this.horizonScrollTrack.onPointerDown$.subscribeEvent((evt, state) => {
27655
27624
  const e = evt;
27656
- this._view.scrollToBarPos({
27657
- x: e.offsetX - this._view.left - this.horizontalThumbWidth / 2
27625
+ this._viewport.scrollToBarPos({
27626
+ x: e.offsetX - this._viewport.left - this.horizontalThumbWidth / 2
27658
27627
  }), state.stopPropagation();
27659
27628
  })), this.horizonThumbRect && this._eventSub.add(this.horizonThumbRect.onPointerDown$.subscribeEvent((evt, state) => {
27660
27629
  var _a10;
@@ -27665,8 +27634,8 @@ const MINI_THUMB_SIZE = 17, _ScrollBar = class _ScrollBar extends BaseScrollBar
27665
27634
  })), this._horizonPointerMoveSub = mainScene.onPointerMove$.subscribeEvent((evt, _state) => {
27666
27635
  var _a10;
27667
27636
  const e = evt;
27668
- this._isHorizonMove && (this._view.scrollByBar({
27669
- x: e.offsetX - this._lastX
27637
+ this._isHorizonMove && (this._viewport.scrollToBarPos({
27638
+ x: e.offsetX
27670
27639
  }), this._lastX = e.offsetX, (_a10 = mainScene.getEngine()) == null || _a10.setRemainCapture());
27671
27640
  }), this._horizonPointerUpSub = mainScene.onPointerUp$.subscribeEvent((evt, state) => {
27672
27641
  const srcElement = this.horizonThumbRect;
@@ -27764,8 +27733,8 @@ const UNIQUE_KEY$1 = "DefaultDocsFontAndBaseLineExtension", DOC_EXTENSION_Z_INDE
27764
27733
  const CHECKED_GLYPH = "☑";
27765
27734
  if ((content === "☐" || content === CHECKED_GLYPH) && glyph.glyphType === GlyphType.LIST) {
27766
27735
  ctx.save();
27767
- const size = (_b = (_a10 = glyph.ts) == null ? void 0 : _a10.fs) != null ? _b : 16;
27768
- ctx.translate(spanPointWithFont.x, spanPointWithFont.y - (bBox.aba + bBox.abd) - 3), Checkbox.drawWith(ctx, {
27736
+ const size = Math.ceil(((_b = (_a10 = glyph.ts) == null ? void 0 : _a10.fs) != null ? _b : 12) * 1.2);
27737
+ ctx.translate(spanPointWithFont.x, spanPointWithFont.y - size), Checkbox.drawWith(ctx, {
27769
27738
  width: size,
27770
27739
  height: size,
27771
27740
  checked: content === CHECKED_GLYPH
@@ -28684,7 +28653,7 @@ const OBJECT_KEY = "__SHEET_EXTENSION_FONT_DOCUMENT_INSTANCE__", _Spreadsheet =
28684
28653
  const spreadsheetSkeleton = this.getSkeleton();
28685
28654
  if (spreadsheetSkeleton == null)
28686
28655
  return;
28687
- const { rowColumnSegment, dataMergeCache: mergeCellRanges, overflowCache, showGridlines } = spreadsheetSkeleton, { startRow, endRow, startColumn, endColumn } = rowColumnSegment;
28656
+ const { rowColumnSegment, overflowCache, showGridlines } = spreadsheetSkeleton, mergeCellRanges = spreadsheetSkeleton.getCurrentRowColumnSegmentMergeData(rowColumnSegment), { startRow, endRow, startColumn, endColumn } = rowColumnSegment;
28688
28657
  if (!spreadsheetSkeleton || showGridlines === BooleanNumber.FALSE || this._forceDisableGridlines)
28689
28658
  return;
28690
28659
  const { rowHeightAccumulation, columnTotalWidth, columnWidthAccumulation, rowTotalHeight } = spreadsheetSkeleton;
@@ -32405,7 +32374,7 @@ const MOUSE_WHEEL_SPEED_SMOOTHING_FACTOR = 3, _Viewport = class _Viewport {
32405
32374
  __publicField(this, "_sceneHeightAfterScale");
32406
32375
  __publicField(this, "onMouseWheel$", new EventSubject());
32407
32376
  __publicField(this, "onScrollAfter$", new EventSubject());
32408
- __publicField(this, "onScrollBefore$", new EventSubject());
32377
+ // onScrollBefore$ = new EventSubject<IScrollObserverParam>();
32409
32378
  __publicField(this, "onScrollEnd$", new EventSubject());
32410
32379
  __publicField(this, "onScrollByBar$", new EventSubject());
32411
32380
  __publicField(this, "_viewportKey", "");
@@ -32551,7 +32520,7 @@ const MOUSE_WHEEL_SPEED_SMOOTHING_FACTOR = 3, _Viewport = class _Viewport {
32551
32520
  }
32552
32521
  set height(height) {
32553
32522
  const maxHeight = this.scene.getParent().height;
32554
- height != null ? this._height = Tools.clamp(height, 0, maxHeight) : this._height = height;
32523
+ Tools.isDefine(height) ? this._height = Tools.clamp(height, 0, maxHeight) : this._height = height;
32555
32524
  }
32556
32525
  get isActive() {
32557
32526
  return this._active === !1 || (this.height || 0) <= 0 || (this.width || 0) <= 0 ? !1 : this._active;
@@ -32661,14 +32630,14 @@ const MOUSE_WHEEL_SPEED_SMOOTHING_FACTOR = 3, _Viewport = class _Viewport {
32661
32630
  // 2. changing curr skeleton
32662
32631
  // 3. changing selection which cross viewport
32663
32632
  // 4. changing the viewport size (also include change window size)
32664
- // 5. changing the scroll bar position
32633
+ // 5. changing the scroll bar position(click at certain pos of scrolltrack)
32665
32634
  // Debug
32666
32635
  // window.scene.getViewports()[0].scrollTo({x: 14.2, y: 1.8}, true)
32667
32636
  scrollToBarPos(pos) {
32668
32637
  return this._scrollToBarPosCore(pos);
32669
32638
  }
32670
32639
  /**
32671
- * scrolling by current position plus offset
32640
+ * Srolling by current position plus delta.
32672
32641
  * the most common case is triggered by scroll-timer(in sheet)
32673
32642
  * @param delta
32674
32643
  * @returns isLimited
@@ -32677,23 +32646,6 @@ const MOUSE_WHEEL_SPEED_SMOOTHING_FACTOR = 3, _Viewport = class _Viewport {
32677
32646
  const x = this.scrollX + (delta.x || 0), y = this.scrollY + (delta.y || 0);
32678
32647
  return this._scrollToBarPosCore({ x, y }, isTrigger);
32679
32648
  }
32680
- scrollByBar(delta, isTrigger = !0) {
32681
- var _a10, _b;
32682
- this.scrollByBarDeltaValue(delta, isTrigger);
32683
- const { x, y } = delta;
32684
- this.onScrollByBar$.emitEvent({
32685
- viewport: this,
32686
- scrollX: this.scrollX,
32687
- scrollY: this.scrollY,
32688
- rawScrollX: x,
32689
- rawScrollY: y,
32690
- viewportScrollX: this.viewportScrollX,
32691
- viewportScrollY: this.viewportScrollY,
32692
- limitX: (_a10 = this._scrollBar) == null ? void 0 : _a10.limitX,
32693
- limitY: (_b = this._scrollBar) == null ? void 0 : _b.limitY,
32694
- isTrigger
32695
- });
32696
- }
32697
32649
  /**
32698
32650
  * Viewport scroll to certain position.
32699
32651
  * @param pos
@@ -32712,19 +32664,6 @@ const MOUSE_WHEEL_SPEED_SMOOTHING_FACTOR = 3, _Viewport = class _Viewport {
32712
32664
  const viewportScrollX = this.viewportScrollX + (delta.viewportScrollX || 0), viewportScrollY = this.viewportScrollY + (delta.viewportScrollY || 0);
32713
32665
  return this._scrollToViewportPosCore({ viewportScrollX, viewportScrollY }, isTrigger);
32714
32666
  }
32715
- /**
32716
- * current position plus offset relatively
32717
- * the caller no need to deal with the padding when frozen
32718
- * @param offsetX
32719
- * @param offsetY
32720
- * @param isTrigger
32721
- */
32722
- scrollByOffset(offsetX = 0, offsetY = 0, isTrigger = !0) {
32723
- if (!this._scrollBar || this.isActive === !1)
32724
- return;
32725
- const x = offsetX + this._paddingStartX, y = offsetY + this._paddingStartY, param = this.transViewportScroll2ScrollValue(x, y);
32726
- return this.scrollByBarDeltaValue(param, isTrigger);
32727
- }
32728
32667
  transViewportScroll2ScrollValue(viewportScrollX, viewportScrollY) {
32729
32668
  let x = viewportScrollX - this._paddingStartX, y = viewportScrollY - this._paddingStartY;
32730
32669
  if (this._scrollBar) {
@@ -32965,7 +32904,7 @@ const MOUSE_WHEEL_SPEED_SMOOTHING_FACTOR = 3, _Viewport = class _Viewport {
32965
32904
  }
32966
32905
  dispose() {
32967
32906
  var _a10, _b;
32968
- this.onMouseWheel$.complete(), this.onScrollAfter$.complete(), this.onScrollBefore$.complete(), this.onScrollEnd$.complete(), (_a10 = this._scrollBar) == null || _a10.dispose(), (_b = this._cacheCanvas) == null || _b.dispose(), this._scene.removeViewport(this._viewportKey);
32907
+ this.onMouseWheel$.complete(), this.onScrollAfter$.complete(), this.onScrollEnd$.complete(), (_a10 = this._scrollBar) == null || _a10.dispose(), (_b = this._cacheCanvas) == null || _b.dispose(), this._scene.removeViewport(this._viewportKey);
32969
32908
  }
32970
32909
  limitedScroll(scrollX, scrollY) {
32971
32910
  var _a10, _b;
@@ -33059,6 +32998,10 @@ const MOUSE_WHEEL_SPEED_SMOOTHING_FACTOR = 3, _Viewport = class _Viewport {
33059
32998
  */
33060
32999
  _afterRender() {
33061
33000
  }
33001
+ /**
33002
+ * mock scrollend.
33003
+ * @param scrollSubParam
33004
+ */
33062
33005
  _emitScrollEnd$(scrollSubParam) {
33063
33006
  clearTimeout(this._scrollStopNum), this._scrollStopNum = setTimeout(() => {
33064
33007
  var _a10, _b;
@@ -33083,7 +33026,7 @@ const MOUSE_WHEEL_SPEED_SMOOTHING_FACTOR = 3, _Viewport = class _Viewport {
33083
33026
  * @param isTrigger
33084
33027
  */
33085
33028
  _scrollToBarPosCore(rawScrollXY, isTrigger = !0) {
33086
- var _a10, _b, _c;
33029
+ var _a10, _b, _c, _d, _e;
33087
33030
  if (this._scrollBar == null)
33088
33031
  return;
33089
33032
  let scrollX = rawScrollXY.x, scrollY = rawScrollXY.y;
@@ -33101,7 +33044,16 @@ const MOUSE_WHEEL_SPEED_SMOOTHING_FACTOR = 3, _Viewport = class _Viewport {
33101
33044
  limitY: (_b = this._scrollBar) == null ? void 0 : _b.limitY,
33102
33045
  isTrigger
33103
33046
  };
33104
- return (_c = this._scrollBar) == null || _c.makeDirty(!0), this.onScrollBefore$.emitEvent(scrollSubParam), this.onScrollAfter$.emitEvent(scrollSubParam), this._emitScrollEnd$(scrollSubParam), afterLimit;
33047
+ return (_c = this._scrollBar) == null || _c.makeDirty(!0), this.onScrollAfter$.emitEvent(scrollSubParam), this._emitScrollEnd$(scrollSubParam), this.onScrollByBar$.emitEvent({
33048
+ viewport: this,
33049
+ scrollX: this.scrollX,
33050
+ scrollY: this.scrollY,
33051
+ viewportScrollX: this.viewportScrollX,
33052
+ viewportScrollY: this.viewportScrollY,
33053
+ limitX: (_d = this._scrollBar) == null ? void 0 : _d.limitX,
33054
+ limitY: (_e = this._scrollBar) == null ? void 0 : _e.limitY,
33055
+ isTrigger
33056
+ }), afterLimit;
33105
33057
  }
33106
33058
  /**
33107
33059
  * Scroll to position in viewport.
@@ -33130,7 +33082,7 @@ const MOUSE_WHEEL_SPEED_SMOOTHING_FACTOR = 3, _Viewport = class _Viewport {
33130
33082
  limitX: (_c = this._scrollBar) == null ? void 0 : _c.limitX,
33131
33083
  limitY: (_d = this._scrollBar) == null ? void 0 : _d.limitY
33132
33084
  };
33133
- return (_e = this._scrollBar) == null || _e.makeDirty(!0), this.onScrollBefore$.emitEvent(scrollSubParam), this.onScrollAfter$.emitEvent(scrollSubParam), this._emitScrollEnd$(scrollSubParam), afterLimitViewportXY;
33085
+ return (_e = this._scrollBar) == null || _e.makeDirty(!0), this.onScrollAfter$.emitEvent(scrollSubParam), this._emitScrollEnd$(scrollSubParam), afterLimitViewportXY;
33134
33086
  }
33135
33087
  expandBounds(value) {
33136
33088
  const onePixelFix = FIX_ONE_PIXEL_BLUR_OFFSET * 2;