@univerjs/engine-render 0.4.2-nightly.202410291606 → 0.4.2-nightly.202410310419

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.
Files changed (86) hide show
  1. package/lib/es/index.js +101 -108
  2. package/lib/types/basics/tools.d.ts +2 -2
  3. package/lib/types/components/docs/document.d.ts +1 -0
  4. package/lib/types/components/sheets/sheet-skeleton.d.ts +2 -4
  5. package/lib/types/components/sheets/util.d.ts +13 -0
  6. package/lib/types/components/skeleton.d.ts +3 -3
  7. package/lib/umd/index.js +1 -1
  8. package/package.json +7 -11
  9. package/lib/af-Bpw3gNwc.js +0 -1
  10. package/lib/as-C73oboNR.js +0 -1
  11. package/lib/be-DM7HH-wL.js +0 -1
  12. package/lib/bg-BVx3UMtW.js +0 -1
  13. package/lib/bn-C-O6Dyni.js +0 -1
  14. package/lib/ca-DyIg63pT.js +0 -1
  15. package/lib/cjs/index.js +0 -1
  16. package/lib/cop-CzalNZMy.js +0 -1
  17. package/lib/cs-jFzUvpSW.js +0 -1
  18. package/lib/cu-C1YL2AZ4.js +0 -1
  19. package/lib/cy-45KfwWEx.js +0 -1
  20. package/lib/da-DuIo_kbC.js +0 -1
  21. package/lib/de-1901-I9pw9K2h.js +0 -1
  22. package/lib/de-1996-ChjJNsQw.js +0 -1
  23. package/lib/de-ch-1901-9RETBFw-.js +0 -1
  24. package/lib/el-monoton-8RvMnHth.js +0 -1
  25. package/lib/el-polyton-Bu66EDJ7.js +0 -1
  26. package/lib/en-gb-SV_a9fn-.js +0 -1
  27. package/lib/es-D0mhZjcV.js +0 -1
  28. package/lib/et-B0RzltQe.js +0 -1
  29. package/lib/eu-4jAKFEjV.js +0 -1
  30. package/lib/fi-DaRVklIS.js +0 -1
  31. package/lib/fr-DrZ3bXXV.js +0 -1
  32. package/lib/fur-_oHJfsBQ.js +0 -1
  33. package/lib/ga-CFmZeeI7.js +0 -1
  34. package/lib/gl-CfY7Df_j.js +0 -1
  35. package/lib/grc-yz3tVRuC.js +0 -1
  36. package/lib/gu-D-qwCz1q.js +0 -1
  37. package/lib/hi-BRIhY2xN.js +0 -1
  38. package/lib/hr-CKYeeRlN.js +0 -1
  39. package/lib/hsb-BG3O4bTN.js +0 -1
  40. package/lib/hu-11gHgrEC.js +0 -1
  41. package/lib/hy-CbR2hSXC.js +0 -1
  42. package/lib/ia-WpPFDdGr.js +0 -1
  43. package/lib/id-D4J_Cd04.js +0 -1
  44. package/lib/is-DERAkBFR.js +0 -1
  45. package/lib/it-UyiCWqfU.js +0 -1
  46. package/lib/ka-CLqmc6Xv.js +0 -1
  47. package/lib/kmr-CxwXQJXr.js +0 -1
  48. package/lib/kn-BVOgEmVc.js +0 -1
  49. package/lib/la-BjneBRWO.js +0 -1
  50. package/lib/la-x-classic-CZHKpRvI.js +0 -1
  51. package/lib/la-x-liturgic-pcl0n-zH.js +0 -1
  52. package/lib/lt-WYhIeybJ.js +0 -1
  53. package/lib/lv-CnvXw6FR.js +0 -1
  54. package/lib/ml-cY172xt6.js +0 -1
  55. package/lib/mn-cyrl-DjlymiLm.js +0 -1
  56. package/lib/mn-cyrl-x-lmc-j2L28W57.js +0 -1
  57. package/lib/mr-Dm28ir_Z.js +0 -1
  58. package/lib/mul-ethi-YVbJ7VwR.js +0 -1
  59. package/lib/nb-mojOW3Qu.js +0 -1
  60. package/lib/nl-Ds27_sIG.js +0 -1
  61. package/lib/nn-DWxFsoNc.js +0 -1
  62. package/lib/no-Cg50WX2I.js +0 -1
  63. package/lib/oc-K9bKXqET.js +0 -1
  64. package/lib/or-BMcshzJR.js +0 -1
  65. package/lib/pa-Bs8RctRX.js +0 -1
  66. package/lib/pi-Cvbb6qiX.js +0 -1
  67. package/lib/pl-D6gpqB1f.js +0 -1
  68. package/lib/pms-Cv7R-yy1.js +0 -1
  69. package/lib/pt-PAYrX3iM.js +0 -1
  70. package/lib/rm-Cp4-gmvX.js +0 -1
  71. package/lib/ro-D8uNKL54.js +0 -1
  72. package/lib/ru-yfURp3OS.js +0 -1
  73. package/lib/sa-BFf1hHnA.js +0 -1
  74. package/lib/sh-cyrl-CuVvXDHJ.js +0 -1
  75. package/lib/sh-latn-DBgzZ57b.js +0 -1
  76. package/lib/sk-D327HWGT.js +0 -1
  77. package/lib/sl-CJ43wdf2.js +0 -1
  78. package/lib/sr-cyrl-BSAkTr8N.js +0 -1
  79. package/lib/sv-Xk_o_no8.js +0 -1
  80. package/lib/ta-BS1JYNX3.js +0 -1
  81. package/lib/te-CNKqRcI1.js +0 -1
  82. package/lib/th-BNuoQKBG.js +0 -1
  83. package/lib/tk-MvsybXmO.js +0 -1
  84. package/lib/tr-DXSmP_xl.js +0 -1
  85. package/lib/uk-BDFck_NF.js +0 -1
  86. package/lib/zh-latn-pinyin-B17sY_zq.js +0 -1
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, Range, numberToABC, Inject, LocaleService, insertTextToContent, horizontalLineSegmentsSubtraction, deleteContent, DataStreamTreeNodeType, DocumentDataModel, GridType, BulletAlignment, PositionedObjectLayoutType, WrapTextType, ColumnSeparatorType, TableAlignmentType, ObjectRelativeFromV, TableTextWrapType, SpacingRule, CustomDecorationType, CustomRangeType, ObjectMatrix, SectionType, NumberUnitType, DocumentFlavor, PageOrientType, HorizontalAlign, VerticalAlign, WrapStrategy, AlignTypeH, ObjectRelativeFromH, AlignTypeV, mergeWith, GlyphType as GlyphType$1, numberToListABC, PRESET_LIST_TYPE, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, searchArray, extractPureTextFromCell, CellValueType, isCellCoverable, isNullCell, composeStyles, getColorStyle, isWhiteColor, IContextService, IConfigService, BuildTextUtils, TextX, DEFAULT_EMPTY_DOCUMENT_VALUE, TextDecoration, COLORS, requestImmediateMacroTask, MOVE_BUFFER_VALUE, sortRulesByDesc, Injector, isClassDependencyItem, createIdentifier, remove, UniverInstanceType, IUniverInstanceService, Plugin, registerDependencies } from "@univerjs/core";
5
+ import { Tools, DEFAULT_STYLES, FontStyleType, BaselineOffset, getCellInfoInMergeData, Rectangle, ColorKit, Disposable, EventSubject, checkParagraphHasIndentByStyle, DataStreamTreeTokenType, BorderStyleTypes, BooleanNumber, DisposableCollection, toDisposable, sortRules, Registry, Range, numberToABC, Inject, LocaleService, insertTextToContent, horizontalLineSegmentsSubtraction, deleteContent, DataStreamTreeNodeType, DocumentDataModel, GridType, BulletAlignment, PositionedObjectLayoutType, WrapTextType, ColumnSeparatorType, TableAlignmentType, ObjectRelativeFromV, TableTextWrapType, SpacingRule, CustomDecorationType, CustomRangeType, ObjectMatrix, SectionType, NumberUnitType, DocumentFlavor, PageOrientType, HorizontalAlign, VerticalAlign, WrapStrategy, AlignTypeH, ObjectRelativeFromH, AlignTypeV, mergeWith, GlyphType as GlyphType$1, numberToListABC, PRESET_LIST_TYPE, DEFAULT_EMPTY_DOCUMENT_VALUE, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, searchArray, extractPureTextFromCell, CellValueType, isCellCoverable, isNullCell, composeStyles, getColorStyle, isWhiteColor, IContextService, IConfigService, BuildTextUtils, TextX, TextDecoration, COLORS, requestImmediateMacroTask, MOVE_BUFFER_VALUE, sortRulesByDesc, Injector, isClassDependencyItem, createIdentifier, remove, UniverInstanceType, IUniverInstanceService, Plugin, registerDependencies } from "@univerjs/core";
6
6
  import { BehaviorSubject, Subject, startWith, distinctUntilChanged, Subscription, debounceTime, 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 = {
@@ -1388,7 +1388,7 @@ function fixLineWidthByScale(num, scale) {
1388
1388
  return Math.round(num * scale) / scale;
1389
1389
  }
1390
1390
  __name(fixLineWidthByScale, "fixLineWidthByScale");
1391
- function getFontStyleString(textStyle, _localeService) {
1391
+ function getFontStyleString(textStyle) {
1392
1392
  const defaultFont = DEFAULT_STYLES.ff, defaultFontSize = DEFAULT_STYLES.fs;
1393
1393
  if (!textStyle) {
1394
1394
  const fontString2 = `${defaultFontSize}pt ${defaultFont}`;
@@ -4926,11 +4926,11 @@ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPrope
4926
4926
  return kind && result && __defProp$4(target, key, result), result;
4927
4927
  }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$4"), _a3;
4928
4928
  let Skeleton = (_a3 = class extends Disposable {
4929
- constructor(_localService) {
4929
+ constructor(_localeService) {
4930
4930
  super();
4931
4931
  __publicField(this, "_fontLocale");
4932
4932
  __publicField(this, "_dirty", !0);
4933
- this._localService = _localService, this._localeInitial();
4933
+ this._localeService = _localeService, this._localeInitial();
4934
4934
  }
4935
4935
  get dirty() {
4936
4936
  return this._dirty;
@@ -7268,7 +7268,7 @@ function getFontCreateConfig(index2, viewModel, paragraphNode, sectionBreakConfi
7268
7268
  },
7269
7269
  marginRight = 0,
7270
7270
  marginLeft = 0,
7271
- localeService,
7271
+ // localeService,
7272
7272
  renderConfig = {}
7273
7273
  } = sectionBreakConfig, { paragraphStyle = {}, bullet } = paragraph, { isRenderStyle } = renderConfig, { startIndex } = paragraphNode, originTextRun = viewModel.getTextRun(index2 + startIndex), textRun = isRenderStyle === BooleanNumber.FALSE ? DEFAULT_TEXT_RUN : originTextRun != null ? originTextRun : DEFAULT_TEXT_RUN, customDecoration = viewModel.getCustomDecoration(index2 + startIndex), showCustomDecoration = customDecoration && customDecoration.show !== !1, customDecorationStyle = showCustomDecoration ? getCustomDecorationStyle(customDecoration) : null, customRange = viewModel.getCustomRange(index2 + startIndex), showCustomRange = customRange && customRange.show !== !1, customRangeStyle = showCustomRange ? getCustomRangeStyle(customRange) : null, hasAddonStyle = showCustomRange || showCustomDecoration || !!bullet, { st, ed } = textRun;
7274
7274
  let { ts: textStyle = {} } = textRun;
@@ -7941,7 +7941,7 @@ function getDefaultBulletSke(listId, startIndex = 1) {
7941
7941
  };
7942
7942
  }
7943
7943
  __name(getDefaultBulletSke, "getDefaultBulletSke");
7944
- function _getBulletSke(listId, nestingLevel, nestings, listLevelAncestors, textStyleConfig, localeService) {
7944
+ function _getBulletSke(listId, nestingLevel, nestings, listLevelAncestors, textStyleConfig, _localeService) {
7945
7945
  var _a10, _b;
7946
7946
  const nesting = nestings[nestingLevel], {
7947
7947
  bulletAlignment,
@@ -24437,7 +24437,7 @@ const _DocumentSkeleton = class _DocumentSkeleton extends Skeleton {
24437
24437
  footerTreeMap,
24438
24438
  lists,
24439
24439
  drawings,
24440
- localeService: this._localService,
24440
+ localeService: this._localeService,
24441
24441
  paragraphLineGapDefault,
24442
24442
  defaultTabStop,
24443
24443
  documentTextStyle: textStyle
@@ -24635,6 +24635,88 @@ const _DocumentSkeleton = class _DocumentSkeleton extends Skeleton {
24635
24635
  };
24636
24636
  __name(_DocumentSkeleton, "DocumentSkeleton");
24637
24637
  let DocumentSkeleton = _DocumentSkeleton;
24638
+ function createDocumentModelWithStyle(content, textStyle, config = {}) {
24639
+ const contentLength = content.length, {
24640
+ textRotation,
24641
+ paddingData = DEFAULT_PADDING_DATA,
24642
+ horizontalAlign = HorizontalAlign.UNSPECIFIED,
24643
+ verticalAlign = VerticalAlign.UNSPECIFIED,
24644
+ wrapStrategy = WrapStrategy.UNSPECIFIED,
24645
+ cellValueType
24646
+ } = config, { t: marginTop, r: marginRight, b: marginBottom, l: marginLeft } = paddingData, { vertexAngle, centerAngle } = convertTextRotation(textRotation), documentData = {
24647
+ id: "d",
24648
+ body: {
24649
+ dataStream: `${content}${DEFAULT_EMPTY_DOCUMENT_VALUE}`,
24650
+ textRuns: [
24651
+ {
24652
+ ts: textStyle,
24653
+ st: 0,
24654
+ ed: contentLength
24655
+ }
24656
+ ],
24657
+ paragraphs: [
24658
+ {
24659
+ startIndex: contentLength,
24660
+ paragraphStyle: {
24661
+ horizontalAlign
24662
+ }
24663
+ }
24664
+ ],
24665
+ sectionBreaks: [{
24666
+ startIndex: contentLength + 1
24667
+ }]
24668
+ },
24669
+ documentStyle: {
24670
+ pageSize: {
24671
+ width: Number.POSITIVE_INFINITY,
24672
+ height: Number.POSITIVE_INFINITY
24673
+ },
24674
+ marginTop,
24675
+ marginBottom,
24676
+ marginRight,
24677
+ marginLeft,
24678
+ renderConfig: {
24679
+ horizontalAlign,
24680
+ verticalAlign,
24681
+ centerAngle,
24682
+ vertexAngle,
24683
+ wrapStrategy,
24684
+ cellValueType
24685
+ }
24686
+ },
24687
+ drawings: {},
24688
+ drawingsOrder: []
24689
+ };
24690
+ return new DocumentDataModel(documentData);
24691
+ }
24692
+ __name(createDocumentModelWithStyle, "createDocumentModelWithStyle");
24693
+ function extractOtherStyle(style) {
24694
+ if (!style) return {};
24695
+ const {
24696
+ tr: textRotation,
24697
+ td: textDirection,
24698
+ ht: horizontalAlign,
24699
+ vt: verticalAlign,
24700
+ tb: wrapStrategy,
24701
+ pd: paddingData
24702
+ } = style;
24703
+ return {
24704
+ textRotation,
24705
+ textDirection,
24706
+ horizontalAlign,
24707
+ verticalAlign,
24708
+ wrapStrategy,
24709
+ paddingData
24710
+ };
24711
+ }
24712
+ __name(extractOtherStyle, "extractOtherStyle");
24713
+ function getFontFormat(format) {
24714
+ if (!format)
24715
+ return {};
24716
+ const { ff, fs, it, bl, ul, st, ol, cl } = format, style = {};
24717
+ return ff && (style.ff = ff), fs && (style.fs = fs), it && (style.it = it), bl && (style.bl = bl), ul && (style.ul = ul), st && (style.st = st), ol && (style.ol = ol), cl && (style.cl = cl), style;
24718
+ }
24719
+ __name(getFontFormat, "getFontFormat");
24638
24720
  var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
24639
24721
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
24640
24722
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
@@ -24950,7 +25032,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
24950
25032
  continue;
24951
25033
  const documentViewModel = new DocumentViewModel(documentModel), { vertexAngle: angle } = convertTextRotation(textRotation), colWidth = (_b = (_a10 = columnData[i]) == null ? void 0 : _a10.w) != null ? _b : defaultColumnWidth;
24952
25034
  typeof colWidth == "number" && wrapStrategy === WrapStrategy.WRAP && documentModel.updateDocumentDataPageSize(colWidth);
24953
- const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localService);
25035
+ const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localeService);
24954
25036
  documentSkeleton.calculate();
24955
25037
  let { height: h = 0 } = (_c = getDocsSkeletonPageSize(documentSkeleton, angle)) != null ? _c : {};
24956
25038
  if (documentSkeleton) {
@@ -25042,7 +25124,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
25042
25124
  return measuredWidth;
25043
25125
  const documentViewModel = new DocumentViewModel(documentModel), { vertexAngle: angle } = convertTextRotation(textRotation), cellStyle = this._styles.getStyleByCell(cell);
25044
25126
  (cellStyle == null ? void 0 : cellStyle.tb) === WrapStrategy.WRAP ? documentModel.updateDocumentDataPageSize(currColWidth, 1 / 0) : documentModel.updateDocumentDataPageSize(1 / 0, 1 / 0);
25045
- const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localService);
25127
+ const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localeService);
25046
25128
  if (documentSkeleton.calculate(), measuredWidth = ((_c = getDocsSkeletonPageSize(documentSkeleton, angle)) != null ? _c : { width: 0 }).width, documentSkeleton) {
25047
25129
  const skeletonData = documentSkeleton.getSkeletonData(), {
25048
25130
  marginTop: t,
@@ -25348,16 +25430,14 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
25348
25430
  }
25349
25431
  // Only used for cell edit, and no need to rotate text when edit cell content!
25350
25432
  getBlankCellDocumentModel(cell) {
25351
- const documentModelObject = this._getCellDocumentModel(cell, {
25352
- ignoreTextRotation: !0
25353
- }), style = this._styles.getStyleByCell(cell), textStyle = this._getFontFormat(style);
25433
+ const documentModelObject = this._getCellDocumentModel(cell, { ignoreTextRotation: !0 }), style = this._styles.getStyleByCell(cell), textStyle = getFontFormat(style);
25354
25434
  if (documentModelObject != null)
25355
- return documentModelObject.documentModel == null && (documentModelObject.documentModel = this._getDocumentDataByStyle("", textStyle, {})), documentModelObject;
25435
+ return documentModelObject.documentModel == null && (documentModelObject.documentModel = createDocumentModelWithStyle("", textStyle)), documentModelObject;
25356
25436
  const content = "";
25357
25437
  let fontString = "document";
25358
25438
  const textRotation = DEFAULT_STYLES.tr, horizontalAlign = DEFAULT_STYLES.ht, verticalAlign = DEFAULT_STYLES.vt, wrapStrategy = DEFAULT_STYLES.tb, paddingData = DEFAULT_PADDING_DATA;
25359
- return fontString = getFontStyleString({}, this._localService).fontCache, {
25360
- documentModel: this._getDocumentDataByStyle(content, textStyle, {}),
25439
+ return fontString = getFontStyleString({}).fontCache, {
25440
+ documentModel: createDocumentModelWithStyle(content, textStyle),
25361
25441
  fontString,
25362
25442
  textRotation,
25363
25443
  wrapStrategy,
@@ -25391,11 +25471,11 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
25391
25471
  if (!cell)
25392
25472
  return;
25393
25473
  let documentModel, fontString = "document";
25394
- const cellOtherConfig = this._getOtherStyle(style), textRotation = ignoreTextRotation ? DEFAULT_STYLES.tr : cellOtherConfig.textRotation || DEFAULT_STYLES.tr;
25474
+ const cellOtherConfig = extractOtherStyle(style), textRotation = ignoreTextRotation ? DEFAULT_STYLES.tr : cellOtherConfig.textRotation || DEFAULT_STYLES.tr;
25395
25475
  let horizontalAlign = cellOtherConfig.horizontalAlign || DEFAULT_STYLES.ht;
25396
25476
  const verticalAlign = cellOtherConfig.verticalAlign || DEFAULT_STYLES.vt, wrapStrategy = cellOtherConfig.wrapStrategy || DEFAULT_STYLES.tb, paddingData = cellOtherConfig.paddingData || DEFAULT_PADDING_DATA;
25397
25477
  if (cell.f && displayRawFormula)
25398
- documentModel = this._getDocumentDataByStyle(cell.f.toString(), {}, { verticalAlign }), horizontalAlign = DEFAULT_STYLES.ht;
25478
+ documentModel = createDocumentModelWithStyle(cell.f.toString(), {}, { verticalAlign }), horizontalAlign = DEFAULT_STYLES.ht;
25399
25479
  else if (cell.p) {
25400
25480
  const { centerAngle, vertexAngle } = convertTextRotation(textRotation);
25401
25481
  documentModel = this._updateConfigAndGetDocumentModel(
@@ -25411,10 +25491,10 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
25411
25491
  }
25412
25492
  );
25413
25493
  } else if (cell.v != null) {
25414
- const textStyle = this._getFontFormat(style);
25415
- fontString = getFontStyleString(textStyle, this._localService).fontCache;
25494
+ const textStyle = getFontFormat(style);
25495
+ fontString = getFontStyleString(textStyle).fontCache;
25416
25496
  let cellText = extractPureTextFromCell(cell);
25417
- cell.t === CellValueType.FORCE_STRING && displayRawFormula && (cellText = `'${cellText}`), documentModel = this._getDocumentDataByStyle(cellText, textStyle, {
25497
+ cell.t === CellValueType.FORCE_STRING && displayRawFormula && (cellText = `'${cellText}`), documentModel = createDocumentModelWithStyle(cellText, textStyle, {
25418
25498
  ...cellOtherConfig,
25419
25499
  textRotation,
25420
25500
  cellValueType: cell.t
@@ -25611,19 +25691,6 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
25611
25691
  intersectMergeRange(row, column) {
25612
25692
  return !!this.worksheet.getMergedCell(row, column);
25613
25693
  }
25614
- // private _getMergeRangeCache() {
25615
- // const dataMergeCache = this.dataMergeCache;
25616
- // const mergeRangeCache = new ObjectMatrix<ObjectMatrix<boolean>>();
25617
- // dataMergeCache?.forEach((r, dataMergeRow) => {
25618
- // dataMergeRow?.forEach((c, dataCache) => {
25619
- // const { startRow: startRowMargeIndex, endRow: endRowMargeIndex, startColumn: startColumnMargeIndex, endColumn: endColumnMargeIndex } = dataCache;
25620
- // const endObject = new ObjectMatrix<boolean>();
25621
- // endObject.setValue(endRowMargeIndex, endColumnMargeIndex, true);
25622
- // mergeRangeCache.setValue(startRowMargeIndex, startColumnMargeIndex, endObject);
25623
- // });
25624
- // });
25625
- // return mergeRangeCache;
25626
- // }
25627
25694
  /**
25628
25695
  * get the current row and column segment visible merge data
25629
25696
  * @returns {IRange} The visible merge data
@@ -25681,7 +25748,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
25681
25748
  if (documentModel == null) return;
25682
25749
  const { fontString: _fontString, textRotation, wrapStrategy, verticalAlign, horizontalAlign } = modelObject, documentViewModel = new DocumentViewModel(documentModel);
25683
25750
  if (documentViewModel) {
25684
- const { vertexAngle, centerAngle } = convertTextRotation(textRotation), documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localService);
25751
+ const { vertexAngle, centerAngle } = convertTextRotation(textRotation), documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localeService);
25685
25752
  documentSkeleton.calculate();
25686
25753
  const config = {
25687
25754
  documentSkeleton,
@@ -25730,60 +25797,6 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
25730
25797
  paragraph.paragraphStyle || (paragraph.paragraphStyle = {}), paragraph.paragraphStyle.horizontalAlign = horizontalAlign;
25731
25798
  return new DocumentDataModel(documentData);
25732
25799
  }
25733
- _getDocumentDataByStyle(content, textStyle, config) {
25734
- const contentLength = content.length, {
25735
- textRotation,
25736
- paddingData = DEFAULT_PADDING_DATA,
25737
- horizontalAlign = HorizontalAlign.UNSPECIFIED,
25738
- verticalAlign = VerticalAlign.UNSPECIFIED,
25739
- wrapStrategy = WrapStrategy.UNSPECIFIED,
25740
- cellValueType
25741
- } = config, { t: marginTop, r: marginRight, b: marginBottom, l: marginLeft } = paddingData || {}, { vertexAngle, centerAngle } = convertTextRotation(textRotation), documentData = {
25742
- id: "d",
25743
- body: {
25744
- dataStream: `${content}${DEFAULT_EMPTY_DOCUMENT_VALUE}`,
25745
- textRuns: [
25746
- {
25747
- ts: textStyle,
25748
- st: 0,
25749
- ed: contentLength
25750
- }
25751
- ],
25752
- paragraphs: [
25753
- {
25754
- startIndex: contentLength,
25755
- paragraphStyle: {
25756
- horizontalAlign
25757
- }
25758
- }
25759
- ],
25760
- sectionBreaks: [{
25761
- startIndex: contentLength + 1
25762
- }]
25763
- },
25764
- documentStyle: {
25765
- pageSize: {
25766
- width: Number.POSITIVE_INFINITY,
25767
- height: Number.POSITIVE_INFINITY
25768
- },
25769
- marginTop,
25770
- marginBottom,
25771
- marginRight,
25772
- marginLeft,
25773
- renderConfig: {
25774
- horizontalAlign,
25775
- verticalAlign,
25776
- centerAngle,
25777
- vertexAngle,
25778
- wrapStrategy,
25779
- cellValueType
25780
- }
25781
- },
25782
- drawings: {},
25783
- drawingsOrder: []
25784
- };
25785
- return new DocumentDataModel(documentData);
25786
- }
25787
25800
  /**
25788
25801
  * pro/issues/344
25789
25802
  * In Excel, for the border rendering of merged cells to take effect, the outermost cells need to have the same border style.
@@ -25851,26 +25864,6 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
25851
25864
  const { ff, fs, it, bl, ul, st, ol, cl } = format, style = {};
25852
25865
  return ff && (style.ff = ff), fs && (style.fs = fs), it && (style.it = it), bl && (style.bl = bl), ul && (style.ul = ul), st && (style.st = st), ol && (style.ol = ol), cl && (style.cl = cl), style;
25853
25866
  }
25854
- _getOtherStyle(format) {
25855
- if (!format)
25856
- return {};
25857
- const {
25858
- tr: textRotation,
25859
- td: textDirection,
25860
- ht: horizontalAlign,
25861
- vt: verticalAlign,
25862
- tb: wrapStrategy,
25863
- pd: paddingData
25864
- } = format;
25865
- return {
25866
- textRotation,
25867
- textDirection,
25868
- horizontalAlign,
25869
- verticalAlign,
25870
- wrapStrategy,
25871
- paddingData
25872
- };
25873
- }
25874
25867
  /**
25875
25868
  * New version to get merge data.
25876
25869
  * @param row
@@ -1,4 +1,4 @@
1
- import { IRange, IRangeWithCoord, IScale, ISelectionCell, ISelectionCellWithMergeInfo, IStyleBase, LocaleService, Nullable } from '@univerjs/core';
1
+ import { IRange, IRangeWithCoord, IScale, ISelectionCell, ISelectionCellWithMergeInfo, IStyleBase, Nullable } from '@univerjs/core';
2
2
  import { IDocumentSkeletonFontStyle } from './i-document-skeleton-cached';
3
3
  import { IBoundRectNoAngle } from './vector2';
4
4
  export declare const getColor: (RgbArray: number[], opacity?: number) => string;
@@ -42,7 +42,7 @@ export declare function precisionTo(num: number, accurate: number): number;
42
42
  * var time = performance.now(); for(let i=0;i<100000000;i++){ fixLineWidthByScale(i, 0.666); }; console.log(performance.now()-time);
43
43
  */
44
44
  export declare function fixLineWidthByScale(num: number, scale: number): number;
45
- export declare function getFontStyleString(textStyle?: IStyleBase, _localeService?: LocaleService): IDocumentSkeletonFontStyle;
45
+ export declare function getFontStyleString(textStyle?: IStyleBase): IDocumentSkeletonFontStyle;
46
46
  export declare function hasCJKText(text: string): boolean;
47
47
  export declare function hasCJK(text: string): boolean;
48
48
  export declare function hasCJKPunctuation(text: string): boolean;
@@ -5,6 +5,7 @@ import { IViewportInfo } from '../../basics/vector2';
5
5
  import { UniverRenderingContext } from '../../context';
6
6
  import { IDocumentsConfig, IPageMarginLayout, DocComponent } from './doc-component';
7
7
  import { DocumentSkeleton } from './layout/doc-skeleton';
8
+ import './extensions';
8
9
  export interface IPageRenderConfig {
9
10
  page: IDocumentSkeletonPage;
10
11
  pageLeft: number;
@@ -1,8 +1,8 @@
1
- import { ICellData, ICellDataForSheetInterceptor, IColAutoWidthInfo, IColumnRange, IPaddingData, IPosition, IRange, IRowAutoHeightInfo, IRowRange, ISelectionCellWithMergeInfo, ISize, IStyleData, ITextRotation, IWorksheetData, Nullable, Styles, Worksheet, BooleanNumber, DocumentDataModel, HorizontalAlign, IConfigService, IContextService, LocaleService, ObjectMatrix, VerticalAlign, WrapStrategy } from '@univerjs/core';
1
+ import { ICellData, ICellDataForSheetInterceptor, IColAutoWidthInfo, IColumnRange, IPaddingData, IPosition, IRange, IRowAutoHeightInfo, IRowRange, ISelectionCellWithMergeInfo, ISize, IStyleData, ITextRotation, IWorksheetData, Nullable, Styles, VerticalAlign, Worksheet, BooleanNumber, DocumentDataModel, HorizontalAlign, IConfigService, IContextService, LocaleService, ObjectMatrix, WrapStrategy } from '@univerjs/core';
2
2
  import { IBoundRectNoAngle, IViewportInfo } from '../../basics/vector2';
3
- import { IFontCacheItem, IStylesCache, SHEET_VIEWPORT_KEY } from './interfaces';
4
3
  import { DocumentSkeleton } from '../docs/layout/doc-skeleton';
5
4
  import { Skeleton } from '../skeleton';
5
+ import { IFontCacheItem, IStylesCache, SHEET_VIEWPORT_KEY } from './interfaces';
6
6
  /**
7
7
  * Obtain the height and width of a cell's text, taking into account scenarios with rotated text.
8
8
  * @param documentSkeleton Data of the document's ViewModel
@@ -316,7 +316,6 @@ export declare class SpreadsheetSkeleton extends Skeleton {
316
316
  */
317
317
  private _setStylesCacheForOneCell;
318
318
  private _updateConfigAndGetDocumentModel;
319
- private _getDocumentDataByStyle;
320
319
  /**
321
320
  * pro/issues/344
322
321
  * In Excel, for the border rendering of merged cells to take effect, the outermost cells need to have the same border style.
@@ -324,7 +323,6 @@ export declare class SpreadsheetSkeleton extends Skeleton {
324
323
  private _setMergeBorderProps;
325
324
  private _setBorderProps;
326
325
  private _getFontFormat;
327
- private _getOtherStyle;
328
326
  /**
329
327
  * New version to get merge data.
330
328
  * @param row
@@ -0,0 +1,13 @@
1
+ import { CellValueType, IPaddingData, IStyleBase, IStyleData, ITextRotation, ITextStyle, Nullable, TextDirection, DocumentDataModel, HorizontalAlign, VerticalAlign, WrapStrategy } from '@univerjs/core';
2
+ export interface ICellStyle {
3
+ textRotation?: ITextRotation;
4
+ textDirection?: Nullable<TextDirection>;
5
+ horizontalAlign?: HorizontalAlign;
6
+ verticalAlign?: VerticalAlign;
7
+ wrapStrategy?: WrapStrategy;
8
+ paddingData?: IPaddingData;
9
+ cellValueType?: CellValueType;
10
+ }
11
+ export declare function createDocumentModelWithStyle(content: string, textStyle: ITextStyle, config?: ICellStyle): DocumentDataModel;
12
+ export declare function extractOtherStyle(style?: Nullable<IStyleData>): ICellStyle;
13
+ export declare function getFontFormat(format?: Nullable<IStyleData>): IStyleBase;
@@ -1,10 +1,10 @@
1
- import { Disposable, LocaleService } from '@univerjs/core';
2
1
  import { IFontLocale } from '../basics/interfaces';
2
+ import { Disposable, LocaleService } from '@univerjs/core';
3
3
  export declare class Skeleton extends Disposable {
4
- protected readonly _localService: LocaleService;
4
+ protected readonly _localeService: LocaleService;
5
5
  private _fontLocale;
6
6
  private _dirty;
7
- constructor(_localService: LocaleService);
7
+ constructor(_localeService: LocaleService);
8
8
  get dirty(): boolean;
9
9
  getFontLocale(): IFontLocale;
10
10
  makeDirty(state: boolean): void;