@univerjs/core 1.0.0-alpha.5 → 1.0.0-alpha.7

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { BehaviorSubject, Observable, ReplaySubject, Subject, Subscription, combineLatest, debounceTime, distinctUntilChanged, filter, firstValueFrom, map, merge as merge$1, of, skip, take, tap, timer } from "rxjs";
1
+ import { BehaviorSubject, Observable, ReplaySubject, Subject, Subscription, combineLatest, debounceTime, distinctUntilChanged, filter, firstValueFrom, map, merge as merge$1, of, skip, take, takeWhile, tap, timer } from "rxjs";
2
2
  import { ObjectScope, UnitRole, UniverType as UniverInstanceType } from "@univerjs/protocol";
3
3
  import { debounceTime as debounceTime$1, filter as filter$1, first, map as map$1 } from "rxjs/operators";
4
4
  import { Inject, Inject as Inject$1, InjectSelf, Injector, Injector as Injector$1, LookUp, Many, Optional, Quantity, RediError, Self, SkipSelf, WithNew, createIdentifier, createIdentifier as createIdentifier$1, forwardRef, isAsyncDependencyItem, isAsyncHook, isClassDependencyItem, isCtor, isDisposable, isFactoryDependencyItem, isValueDependencyItem, setDependencies } from "@wendellhu/redi";
@@ -1714,7 +1714,7 @@ let ThemeColors = /* @__PURE__ */ function(ThemeColors) {
1714
1714
  //#endregion
1715
1715
  //#region package.json
1716
1716
  var name = "@univerjs/core";
1717
- var version = "1.0.0-alpha.5";
1717
+ var version = "1.0.0-alpha.7";
1718
1718
 
1719
1719
  //#endregion
1720
1720
  //#region src/common/array.ts
@@ -2431,17 +2431,7 @@ function fromCallback(callback) {
2431
2431
  */
2432
2432
  function takeAfter(callback) {
2433
2433
  return function complateAfter(source) {
2434
- return new Observable((subscriber) => {
2435
- source.subscribe({
2436
- next: (v) => {
2437
- subscriber.next(v);
2438
- if (callback(v)) subscriber.complete();
2439
- },
2440
- complete: () => subscriber.complete(),
2441
- error: (error) => subscriber.error(error)
2442
- });
2443
- return () => subscriber.unsubscribe();
2444
- });
2434
+ return source.pipe(takeWhile((value) => !callback(value), true));
2445
2435
  };
2446
2436
  }
2447
2437
  function bufferDebounceTime(time = 0) {
@@ -13204,16 +13194,24 @@ var RegistryAsMap = class RegistryAsMap {
13204
13194
  function requestImmediateMacroTask(callback) {
13205
13195
  const channel = new MessageChannel();
13206
13196
  let cancelled = false;
13197
+ const close = () => {
13198
+ channel.port1.onmessage = null;
13199
+ channel.port1.close();
13200
+ channel.port2.close();
13201
+ };
13207
13202
  const handler = () => {
13208
- if (!cancelled) callback();
13203
+ if (!cancelled) {
13204
+ cancelled = true;
13205
+ close();
13206
+ callback();
13207
+ }
13209
13208
  };
13210
13209
  channel.port1.onmessage = handler;
13211
13210
  channel.port2.postMessage(null);
13212
13211
  return () => {
13212
+ if (cancelled) return;
13213
13213
  cancelled = true;
13214
- channel.port1.onmessage = null;
13215
- channel.port1.close();
13216
- channel.port2.close();
13214
+ close();
13217
13215
  };
13218
13216
  }
13219
13217
 
@@ -17628,10 +17626,10 @@ function buildDrawingInsertBody(body, drawings, insertOffset) {
17628
17626
  //#endregion
17629
17627
  //#region src/docs/data-model/text-x/build-utils/data-stream-change.ts
17630
17628
  /**
17631
- * Finds one contiguous dataStream change. Pure structural insertions are
17632
- * anchored by their new stable ids before falling back to string comparison.
17629
+ * Finds one contiguous dataStream change. Pure structural insertions and deletions
17630
+ * are anchored by their stable ids before falling back to string comparison.
17633
17631
  * This prevents an adjacent identical sentinel from being mistaken for an
17634
- * unchanged prefix and keeps the inserted structure metadata in the TextX body.
17632
+ * unchanged prefix and keeps the structure metadata aligned with the TextX body.
17635
17633
  */
17636
17634
  function getSingleDataStreamChange(previousBody, nextBody) {
17637
17635
  if (previousBody == null || nextBody == null) return null;
@@ -17642,6 +17640,9 @@ function getSingleDataStreamChange(previousBody, nextBody) {
17642
17640
  if (insertedLength > 0) {
17643
17641
  const structuralInsertion = findStructuralInsertion(previousBody, nextBody, previousDataStream, nextDataStream, insertedLength);
17644
17642
  if (structuralInsertion) return structuralInsertion;
17643
+ } else if (insertedLength < 0) {
17644
+ const structuralDeletion = findStructuralDeletion(previousBody, nextBody, previousDataStream, nextDataStream, -insertedLength);
17645
+ if (structuralDeletion) return structuralDeletion;
17645
17646
  }
17646
17647
  let start = 0;
17647
17648
  while (start < previousDataStream.length && start < nextDataStream.length && previousDataStream[start] === nextDataStream[start]) start++;
@@ -17657,6 +17658,14 @@ function getSingleDataStreamChange(previousBody, nextBody) {
17657
17658
  insertLength: nextEnd - start
17658
17659
  };
17659
17660
  }
17661
+ function findStructuralDeletion(previousBody, nextBody, previousDataStream, nextDataStream, deletedLength) {
17662
+ for (const start of collectNewStructuralStartOffsets(nextBody, previousBody)) if (previousDataStream.slice(0, start) === nextDataStream.slice(0, start) && previousDataStream.slice(start + deletedLength) === nextDataStream.slice(start)) return {
17663
+ start,
17664
+ deleteLength: deletedLength,
17665
+ insertLength: 0
17666
+ };
17667
+ return null;
17668
+ }
17660
17669
  function findStructuralInsertion(previousBody, nextBody, previousDataStream, nextDataStream, insertedLength) {
17661
17670
  for (const start of collectNewStructuralStartOffsets(previousBody, nextBody)) if (previousDataStream.slice(0, start) === nextDataStream.slice(0, start) && previousDataStream.slice(start) === nextDataStream.slice(start + insertedLength)) return {
17662
17671
  start,
@@ -21007,6 +21016,7 @@ const FOCUSING_UNIT = "FOCUSING_UNIT";
21007
21016
  const FOCUSING_SHEET = "FOCUSING_SHEET";
21008
21017
  const FOCUSING_DOC = "FOCUSING_DOC";
21009
21018
  const FOCUSING_SLIDE = "FOCUSING_SLIDE";
21019
+ const FOCUSING_BOARD = "FOCUSING_BOARD";
21010
21020
  /** @deprecated */
21011
21021
  const FOCUSING_EDITOR_BUT_HIDDEN = "FOCUSING_EDITOR_BUT_HIDDEN";
21012
21022
  const EDITOR_ACTIVATED = "EDITOR_ACTIVATED";
@@ -23759,7 +23769,7 @@ let UniverInstanceService = class UniverInstanceService extends Disposable {
23759
23769
  return (_this$_getUnitById2 = this._getUnitById(id)) === null || _this$_getUnitById2 === void 0 ? void 0 : _this$_getUnitById2[0];
23760
23770
  }
23761
23771
  focusUnit(id) {
23762
- var _this$focused;
23772
+ var _this$focused, _this$focused2;
23763
23773
  if (this._focused$.getValue() === id) return;
23764
23774
  this._focused$.next(id);
23765
23775
  if (this.focused instanceof Workbook) {
@@ -23767,24 +23777,35 @@ let UniverInstanceService = class UniverInstanceService extends Disposable {
23767
23777
  this._contextService.setContextValue(FOCUSING_DOC, false);
23768
23778
  this._contextService.setContextValue(FOCUSING_SHEET, true);
23769
23779
  this._contextService.setContextValue(FOCUSING_SLIDE, false);
23780
+ this._contextService.setContextValue(FOCUSING_BOARD, false);
23770
23781
  this.setCurrentUnitForType(id);
23771
23782
  } else if (this.focused instanceof DocumentDataModel) {
23772
23783
  this._contextService.setContextValue(FOCUSING_UNIT, true);
23773
23784
  this._contextService.setContextValue(FOCUSING_DOC, true);
23774
23785
  this._contextService.setContextValue(FOCUSING_SHEET, false);
23775
23786
  this._contextService.setContextValue(FOCUSING_SLIDE, false);
23787
+ this._contextService.setContextValue(FOCUSING_BOARD, false);
23776
23788
  this.setCurrentUnitForType(id);
23777
23789
  } else if (((_this$focused = this.focused) === null || _this$focused === void 0 ? void 0 : _this$focused.type) === UniverInstanceType.UNIVER_SLIDE) {
23778
23790
  this._contextService.setContextValue(FOCUSING_UNIT, true);
23779
23791
  this._contextService.setContextValue(FOCUSING_DOC, false);
23780
23792
  this._contextService.setContextValue(FOCUSING_SHEET, false);
23781
23793
  this._contextService.setContextValue(FOCUSING_SLIDE, true);
23794
+ this._contextService.setContextValue(FOCUSING_BOARD, false);
23795
+ this.setCurrentUnitForType(id);
23796
+ } else if (((_this$focused2 = this.focused) === null || _this$focused2 === void 0 ? void 0 : _this$focused2.type) === UniverInstanceType.UNIVER_BOARD) {
23797
+ this._contextService.setContextValue(FOCUSING_UNIT, true);
23798
+ this._contextService.setContextValue(FOCUSING_DOC, false);
23799
+ this._contextService.setContextValue(FOCUSING_SHEET, false);
23800
+ this._contextService.setContextValue(FOCUSING_SLIDE, false);
23801
+ this._contextService.setContextValue(FOCUSING_BOARD, true);
23782
23802
  this.setCurrentUnitForType(id);
23783
23803
  } else {
23784
23804
  this._contextService.setContextValue(FOCUSING_UNIT, false);
23785
23805
  this._contextService.setContextValue(FOCUSING_DOC, false);
23786
23806
  this._contextService.setContextValue(FOCUSING_SHEET, false);
23787
23807
  this._contextService.setContextValue(FOCUSING_SLIDE, false);
23808
+ this._contextService.setContextValue(FOCUSING_BOARD, false);
23788
23809
  }
23789
23810
  }
23790
23811
  getFocusedUnit() {
@@ -23821,8 +23842,8 @@ let UniverInstanceService = class UniverInstanceService extends Disposable {
23821
23842
  }
23822
23843
  }
23823
23844
  _tryResetFocusOnRemoval(unitId) {
23824
- var _this$focused2;
23825
- if (((_this$focused2 = this.focused) === null || _this$focused2 === void 0 ? void 0 : _this$focused2.getUnitId()) === unitId) this._focused$.next(null);
23845
+ var _this$focused3;
23846
+ if (((_this$focused3 = this.focused) === null || _this$focused3 === void 0 ? void 0 : _this$focused3.getUnitId()) === unitId) this._focused$.next(null);
23826
23847
  }
23827
23848
  _getUnitById(unitId) {
23828
23849
  for (const [type, units] of this._unitsByType) {
@@ -24418,6 +24439,32 @@ PluginService = __decorate([
24418
24439
  __decorateParam(2, ILogService)
24419
24440
  ], PluginService);
24420
24441
 
24442
+ //#endregion
24443
+ //#region src/services/region/region.service.ts
24444
+ let RegionService = class RegionService extends Disposable {
24445
+ constructor(_localeService) {
24446
+ super();
24447
+ this._localeService = _localeService;
24448
+ _defineProperty(this, "_currentRegion$", void 0);
24449
+ _defineProperty(this, "currentRegion$", void 0);
24450
+ _defineProperty(this, "_hasExplicitRegion", false);
24451
+ this._currentRegion$ = new BehaviorSubject(this._localeService.getCurrentLocale());
24452
+ this.currentRegion$ = this._currentRegion$.asObservable();
24453
+ this.disposeWithMe(this._localeService.currentLocale$.subscribe((locale) => {
24454
+ if (!this._hasExplicitRegion && locale !== this._currentRegion$.value) this._currentRegion$.next(locale);
24455
+ }));
24456
+ this.disposeWithMe(toDisposable(() => this._currentRegion$.complete()));
24457
+ }
24458
+ setRegion(region) {
24459
+ this._hasExplicitRegion = true;
24460
+ this._currentRegion$.next(region);
24461
+ }
24462
+ getCurrentRegion() {
24463
+ return this._currentRegion$.value;
24464
+ }
24465
+ };
24466
+ RegionService = __decorate([__decorateParam(0, Inject(LocaleService))], RegionService);
24467
+
24421
24468
  //#endregion
24422
24469
  //#region src/services/resource-loader/type.ts
24423
24470
  const IResourceLoaderService = createIdentifier("resource-loader-service");
@@ -26316,11 +26363,12 @@ var Univer = class {
26316
26363
  _defineProperty(this, "_injector", void 0);
26317
26364
  _defineProperty(this, "_disposingCallbacks", new DisposableCollection());
26318
26365
  const injector = this._injector = createUniverInjector(parentInjector, config === null || config === void 0 ? void 0 : config.override);
26319
- const { theme, darkMode, locale, locales, direction, logLevel, logCommandExecution } = config;
26366
+ const { theme, darkMode, locale, region, locales, direction, logLevel, logCommandExecution } = config;
26320
26367
  if (theme) this._injector.get(ThemeService).setTheme(theme);
26321
26368
  if (darkMode) this._injector.get(ThemeService).setDarkMode(darkMode);
26322
26369
  if (locales) this._injector.get(LocaleService).load(locales);
26323
26370
  if (locale) this._injector.get(LocaleService).setLocale(locale);
26371
+ if (region) this._injector.get(RegionService).setRegion(region);
26324
26372
  if (direction) this._injector.get(LocaleService).setDirection(direction);
26325
26373
  if (logLevel) this._injector.get(ILogService).setLogLevel(logLevel);
26326
26374
  if (logCommandExecution !== void 0) this._injector.get(IConfigService).setConfig(COMMAND_LOG_EXECUTION_CONFIG_KEY, logCommandExecution);
@@ -26351,6 +26399,9 @@ var Univer = class {
26351
26399
  setLocale(locale) {
26352
26400
  this._injector.get(LocaleService).setLocale(locale);
26353
26401
  }
26402
+ setRegion(region) {
26403
+ this._injector.get(RegionService).setRegion(region);
26404
+ }
26354
26405
  createUnit(type, data) {
26355
26406
  return this._univerInstanceService.createUnit(type, data);
26356
26407
  }
@@ -26396,6 +26447,7 @@ function createUniverInjector(parentInjector, override) {
26396
26447
  const dependencies = mergeOverrideWithDependencies([
26397
26448
  [ErrorService],
26398
26449
  [LocaleService],
26450
+ [RegionService],
26399
26451
  [ThemeService],
26400
26452
  [LifecycleService],
26401
26453
  [PluginService],
@@ -26452,4 +26504,4 @@ function createUniverInjector(parentInjector, override) {
26452
26504
  installShims();
26453
26505
 
26454
26506
  //#endregion
26455
- export { ABCToNumber, AUTO_HEIGHT_FOR_MERGED_CELLS, AbsoluteRefType, ActionIterator, AlignTypeH, AlignTypeV, ArrangeTypeEnum, AsyncInterceptorManager, AsyncLock, AuthzIoLocalService, AutoFillSeries, BORDER_KEYS, BORDER_STYLE_KEYS, BaseDataModel, BaseFieldType, BaseFilterConjunction, BaseFilterOperator, BaseSortDirection, BaseViewType, BaselineOffset, BlockType, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, BulletAlignment, COLORS, COLOR_STYLE_KEYS, COMMAND_LOG_EXECUTION_CONFIG_KEY, CanceledError, CellModeEnum, CellValueType, ColorKit, ColorType, ColumnLayoutType, ColumnResponsiveType, ColumnSeparatorType, CommandService, CommandType, CommonHideTypes, ConfigService, ContextService, CopyPasteType, CustomCommandExecutionError, CustomDecorationType, CustomRangeType, DEFAULT_CELL, DEFAULT_DOC, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW, DEFAULT_DOCUMENT_SUB_COMPONENT_ID, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_NUMBER_FORMAT, DEFAULT_RANGE, DEFAULT_RANGE_ARRAY, DEFAULT_SELECTION, DEFAULT_STYLES, DEFAULT_TEXT_FORMAT, DEFAULT_TEXT_FORMAT_EXCEL, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_COUNT_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_COUNT_KEY, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_HEIGHT_KEY, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY, DOCS_COMMENT_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOC_DRAWING_PRINTING_COMPONENT_KEY, DOC_RANGE_TYPE, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, DataValidationErrorStyle, DataValidationImeMode, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DeleteDirection, DependentOn, DesktopLogService, DeveloperMetadataVisibility, Dimension, Direction, Disposable, DisposableCollection, DocStyleType, DocumentBlockRangeType, DocumentBlockType, DocumentDataModel, DocumentFlavor, DrawingTypeEnum, EDITOR_ACTIVATED, EXTENSION_NAMES, ErrorService, EventState, EventSubject, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_EDITOR_BUT_HIDDEN, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_PANEL_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_SLIDE, FOCUSING_UNIT, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FORMULA_EDITOR_ACTIVATED, FollowNumberWithType, FontItalic, FontStyleType, FontWeight, GridType, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, IImageIoService, ILocalStorageService, ILogService, IMentionIOService, IPermissionService, IResourceLoaderService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IURLImageService, IUndoRedoService, IUniverInstanceService, ImageCacheMap, ImageSourceType, ImageUploadStatusType, Inject, InjectSelf, Injector, InterceptorEffectEnum, InterceptorManager, InterpolationPointType, json1 as JSON1, JSONX, LOCALE_META, LRUHelper, LRUMap, LifecycleService, LifecycleStages, LifecycleUnreachableError, ListGlyphType, LocalUndoRedoService, LocaleService, LocaleType, LogLevel, LookUp, MAX_COLUMN_COUNT, MAX_ROW_COUNT, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MOVE_BUFFER_VALUE, Many, MemoryCursor, MentionIOLocalService, MentionType, ModernDocumentWidthMode, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NamedStyleType, NilCommand, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PADDING_KEYS, PAGE_SIZE, PAPER_TYPES, PARAGRAPH_ID_PREFIX, PRESERVE_INSERTED_PARAGRAPH_IDS, PRESET_LIST_TYPE, PageOrientType, PaperType, ParagraphElementType, ParagraphStyleBuilder, ParagraphStyleValue, PermissionService, PermissionStatus, Plugin, PluginService, PositionedObjectLayoutType, PresetListType, ProtectionType, Quantity, QuickListType, QuickListTypeMap, RANGE_DIRECTION, RANGE_TYPE, RBush, RCDisposable, RESTORE_INSERTED_PARAGRAPH_IDS, RGBA_PAREN, RGB_PAREN, ROTATE_BUFFER_VALUE, RTree, Range, Rectangle, RediError, RedoCommand, RedoCommandId, RefAlias, Registry, RegistryAsMap, RelativeDate, ResourceManagerService, RichTextBuilder, RichTextParagraphBuilder, RichTextRunBuilder, RichTextValue, RxDisposable, SECTION_ID_PREFIX, SHEET_EDITOR_UNITS, STYLE_KEYS, SectionType, Self, SheetSkeleton, SheetTypes, SheetViewModel, Skeleton, SkipSelf, SliceBodyType, SpacingRule, Styles, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, THEME_COLORS, TabStopAlignment, TableAlignmentType, TableLayoutType, TableRowHeightRule, TableSizeType, TableTextWrapType, TestConfirmService, TextDecoration, TextDecorationBuilder, TextDirection, TextDirectionType, TextStyleBuilder, TextStyleValue, TextX, TextXActionType, ThemeColorType, ThemeColors, ThemeService, Tools, UndoCommand, UndoCommandId, UnitModel, Univer, UniverInstanceService, UniverInstanceType, UpdateDocsAttributeType, UserManagerService, VerticalAlign, VerticalAlignmentType, WithNew, Workbook, Worksheet, WrapStrategy, WrapTextType, addLinkToDocumentModel, afterInitApply, afterTime, awaitTime, binSearchFirstGreaterThanTarget, binarySearchArray, bufferDebounceTime, cellToRange, characterSpacingControlType, checkForSubstrings, checkIfMove, checkParagraphHasBullet, checkParagraphHasIndent, checkParagraphHasIndentByStyle, cloneBodyWithFreshParagraphIds, cloneCellData, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneParagraphWithId, cloneSectionBreakWithId, cloneValue, cloneWorksheetData, codeToBlob, columnLabelToNumber, composeBody, composeInterceptors, composeStyles, concatMatrixArray, containsInteriorInsertionOffset, containsStreamIndex, convertCellToRange, convertObservableToBehaviorSubject, covertCellValue, covertCellValues, createAsyncInterceptorKey, createDefaultBaseTableSnapshot, createDefaultUser, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createInternalEditorID, createParagraphId, createRandomId, createRowColIter, createSectionId, createSheetGapTestConfig, currencySymbols, customNameCharacterCheck, dateKit, debounce, dedupe, dedupeBy, deepCompare, delayAnimationFrame, deleteContent, extractPureTextFromCell, forwardRef, fromCallback, fromEventSubject, generateIntervalsByPoints, generateRandomId, get, getArrayLength, getEmptySnapshot as getBasesEmptySnapshot, getBlockRangeInterval, getBodySlice, getBodySliceForSplitTextXAction, getBodySliceForTextXAction, getBorderStyleType, getCellCoordByIndexSimple, getCellInfoInMergeData, getCellValueType, getCellWithCoordByIndexCore, getColorStyle, getColumnGroupRangeInterval, getCustomBlockIdsInSelections, getCustomBlockInterval, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeInterval, getCustomRangeSlice, getDisplayValueFromCell, getEmptySnapshot$1 as getDocsEmptySnapshot, getDocsUpdateBody, getEmptyCell, getExclusiveRangeInterval, getInclusiveRangeInterval, getIntersectRange, getNumfmtParseValueFilter, getOriginCellValue, getParagraphContentStartOffset, getParagraphContentStartOffsets, getParagraphFollowingBlockOffset, getParagraphsSlice, getPlainText, getReverseDirection, getRichTextEditPath, getSectionBreakSlice, getSectionHeaderFooterReferenceKey, getEmptySnapshot$2 as getSheetsEmptySnapshot, getSingleDataStreamChange, getTableCellTokenInterval, getTableRangeInterval, getTableRowTokenInterval, getTableSlice, getTextRunSlice, getTransformOffsetX, getTransformOffsetY, getWorksheetUID, groupBy, handleStyleToString, hashAlgorithm, horizontalLineSegmentsSubtraction, insertMatrixArray, insertTextToContent, intersectsOperationalIntervals, invertColorByHSL, invertColorByMatrix, isAsyncDependencyItem, isAsyncHook, isBlackColor, isBooleanString, isCellCoverable, isCellV, isClassDependencyItem, isCommentEditorID, isCtor, isDefaultFormat, isDisposable, isEmptyCell, isFactoryDependencyItem, isFormulaId, isFormulaString, isICellData, isInternalEditorID, isNodeEnv, isNotNullOrUndefined, isNullCell, isNumeric, isPatternEqualWithoutDecimal, isRangesEqual, isRealNum, isSafeNumeric, isSafeUrl, isSameStyleTextRun, isTextFormat, isUnitRangesEqual, isValidRange, isValueDependencyItem, isWhiteColor, makeArray, makeCellRangeToRangeData, makeCellToSelection, makeCustomRangeStream, mapObjectMatrix, merge, mergeIntervals, mergeLocales, mergeOverrideWithDependencies, mergeSets, mergeWith, mergeWorksheetSnapshotWithDefault, mixinClass, moveMatrixArray, moveRangeByOffset, nameCharacterCheck, noop, normalizeBody, normalizeInsertedSectionIdsForDocument, normalizeTextRuns, normalizeUrl, numberToABC, numberToListABC, api_exports as numfmt, queryObjectMatrix, regexp, registerDependencies, remove, repeatStringNumTimes, replaceInDocumentBody, requestImmediateMacroTask, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReference, resolveSectionHeaderFooterReferences, resolveWithBasePath, rotate, searchArray, searchInOrderedArray, selectionToArray, sequence, sequenceAsync, sequenceExecute, sequenceExecuteAsync, set, setDependencies, shallowEqual, shiftExclusiveRangeOnDelete, shiftExclusiveRangeOnInsert, shiftInclusiveRangeOnDelete, shiftInclusiveRangeOnInsert, skipParseTagNames, sliceMatrixArray, sortRules, sortRulesByDesc, sortRulesFactory, spliceArray, splitIntoGrid, takeAfter, throttle, toDisposable, touchDependencies, updateAttributeByDelete, updateAttributeByInsert, validateDocBodyStructure, validateDocumentStructure, willLoseNumericPrecision };
26507
+ export { ABCToNumber, AUTO_HEIGHT_FOR_MERGED_CELLS, AbsoluteRefType, ActionIterator, AlignTypeH, AlignTypeV, ArrangeTypeEnum, AsyncInterceptorManager, AsyncLock, AuthzIoLocalService, AutoFillSeries, BORDER_KEYS, BORDER_STYLE_KEYS, BaseDataModel, BaseFieldType, BaseFilterConjunction, BaseFilterOperator, BaseSortDirection, BaseViewType, BaselineOffset, BlockType, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, BulletAlignment, COLORS, COLOR_STYLE_KEYS, COMMAND_LOG_EXECUTION_CONFIG_KEY, CanceledError, CellModeEnum, CellValueType, ColorKit, ColorType, ColumnLayoutType, ColumnResponsiveType, ColumnSeparatorType, CommandService, CommandType, CommonHideTypes, ConfigService, ContextService, CopyPasteType, CustomCommandExecutionError, CustomDecorationType, CustomRangeType, DEFAULT_CELL, DEFAULT_DOC, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW, DEFAULT_DOCUMENT_SUB_COMPONENT_ID, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_NUMBER_FORMAT, DEFAULT_RANGE, DEFAULT_RANGE_ARRAY, DEFAULT_SELECTION, DEFAULT_STYLES, DEFAULT_TEXT_FORMAT, DEFAULT_TEXT_FORMAT_EXCEL, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_COUNT_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_COUNT_KEY, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_HEIGHT_KEY, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY, DOCS_COMMENT_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOC_DRAWING_PRINTING_COMPONENT_KEY, DOC_RANGE_TYPE, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, DataValidationErrorStyle, DataValidationImeMode, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DeleteDirection, DependentOn, DesktopLogService, DeveloperMetadataVisibility, Dimension, Direction, Disposable, DisposableCollection, DocStyleType, DocumentBlockRangeType, DocumentBlockType, DocumentDataModel, DocumentFlavor, DrawingTypeEnum, EDITOR_ACTIVATED, EXTENSION_NAMES, ErrorService, EventState, EventSubject, FOCUSING_BOARD, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_EDITOR_BUT_HIDDEN, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_PANEL_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_SLIDE, FOCUSING_UNIT, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FORMULA_EDITOR_ACTIVATED, FollowNumberWithType, FontItalic, FontStyleType, FontWeight, GridType, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, IImageIoService, ILocalStorageService, ILogService, IMentionIOService, IPermissionService, IResourceLoaderService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IURLImageService, IUndoRedoService, IUniverInstanceService, ImageCacheMap, ImageSourceType, ImageUploadStatusType, Inject, InjectSelf, Injector, InterceptorEffectEnum, InterceptorManager, InterpolationPointType, json1 as JSON1, JSONX, LOCALE_META, LRUHelper, LRUMap, LifecycleService, LifecycleStages, LifecycleUnreachableError, ListGlyphType, LocalUndoRedoService, LocaleService, LocaleType, LogLevel, LookUp, MAX_COLUMN_COUNT, MAX_ROW_COUNT, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MOVE_BUFFER_VALUE, Many, MemoryCursor, MentionIOLocalService, MentionType, ModernDocumentWidthMode, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NamedStyleType, NilCommand, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PADDING_KEYS, PAGE_SIZE, PAPER_TYPES, PARAGRAPH_ID_PREFIX, PRESERVE_INSERTED_PARAGRAPH_IDS, PRESET_LIST_TYPE, PageOrientType, PaperType, ParagraphElementType, ParagraphStyleBuilder, ParagraphStyleValue, PermissionService, PermissionStatus, Plugin, PluginService, PositionedObjectLayoutType, PresetListType, ProtectionType, Quantity, QuickListType, QuickListTypeMap, RANGE_DIRECTION, RANGE_TYPE, RBush, RCDisposable, RESTORE_INSERTED_PARAGRAPH_IDS, RGBA_PAREN, RGB_PAREN, ROTATE_BUFFER_VALUE, RTree, Range, Rectangle, RediError, RedoCommand, RedoCommandId, RefAlias, RegionService, Registry, RegistryAsMap, RelativeDate, ResourceManagerService, RichTextBuilder, RichTextParagraphBuilder, RichTextRunBuilder, RichTextValue, RxDisposable, SECTION_ID_PREFIX, SHEET_EDITOR_UNITS, STYLE_KEYS, SectionType, Self, SheetSkeleton, SheetTypes, SheetViewModel, Skeleton, SkipSelf, SliceBodyType, SpacingRule, Styles, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, THEME_COLORS, TabStopAlignment, TableAlignmentType, TableLayoutType, TableRowHeightRule, TableSizeType, TableTextWrapType, TestConfirmService, TextDecoration, TextDecorationBuilder, TextDirection, TextDirectionType, TextStyleBuilder, TextStyleValue, TextX, TextXActionType, ThemeColorType, ThemeColors, ThemeService, Tools, UndoCommand, UndoCommandId, UnitModel, Univer, UniverInstanceService, UniverInstanceType, UpdateDocsAttributeType, UserManagerService, VerticalAlign, VerticalAlignmentType, WithNew, Workbook, Worksheet, WrapStrategy, WrapTextType, addLinkToDocumentModel, afterInitApply, afterTime, awaitTime, binSearchFirstGreaterThanTarget, binarySearchArray, bufferDebounceTime, cellToRange, characterSpacingControlType, checkForSubstrings, checkIfMove, checkParagraphHasBullet, checkParagraphHasIndent, checkParagraphHasIndentByStyle, cloneBodyWithFreshParagraphIds, cloneCellData, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneParagraphWithId, cloneSectionBreakWithId, cloneValue, cloneWorksheetData, codeToBlob, columnLabelToNumber, composeBody, composeInterceptors, composeStyles, concatMatrixArray, containsInteriorInsertionOffset, containsStreamIndex, convertCellToRange, convertObservableToBehaviorSubject, covertCellValue, covertCellValues, createAsyncInterceptorKey, createDefaultBaseTableSnapshot, createDefaultUser, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createInternalEditorID, createParagraphId, createRandomId, createRowColIter, createSectionId, createSheetGapTestConfig, currencySymbols, customNameCharacterCheck, dateKit, debounce, dedupe, dedupeBy, deepCompare, delayAnimationFrame, deleteContent, extractPureTextFromCell, forwardRef, fromCallback, fromEventSubject, generateIntervalsByPoints, generateRandomId, get, getArrayLength, getEmptySnapshot as getBasesEmptySnapshot, getBlockRangeInterval, getBodySlice, getBodySliceForSplitTextXAction, getBodySliceForTextXAction, getBorderStyleType, getCellCoordByIndexSimple, getCellInfoInMergeData, getCellValueType, getCellWithCoordByIndexCore, getColorStyle, getColumnGroupRangeInterval, getCustomBlockIdsInSelections, getCustomBlockInterval, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeInterval, getCustomRangeSlice, getDisplayValueFromCell, getEmptySnapshot$1 as getDocsEmptySnapshot, getDocsUpdateBody, getEmptyCell, getExclusiveRangeInterval, getInclusiveRangeInterval, getIntersectRange, getNumfmtParseValueFilter, getOriginCellValue, getParagraphContentStartOffset, getParagraphContentStartOffsets, getParagraphFollowingBlockOffset, getParagraphsSlice, getPlainText, getReverseDirection, getRichTextEditPath, getSectionBreakSlice, getSectionHeaderFooterReferenceKey, getEmptySnapshot$2 as getSheetsEmptySnapshot, getSingleDataStreamChange, getTableCellTokenInterval, getTableRangeInterval, getTableRowTokenInterval, getTableSlice, getTextRunSlice, getTransformOffsetX, getTransformOffsetY, getWorksheetUID, groupBy, handleStyleToString, hashAlgorithm, horizontalLineSegmentsSubtraction, insertMatrixArray, insertTextToContent, intersectsOperationalIntervals, invertColorByHSL, invertColorByMatrix, isAsyncDependencyItem, isAsyncHook, isBlackColor, isBooleanString, isCellCoverable, isCellV, isClassDependencyItem, isCommentEditorID, isCtor, isDefaultFormat, isDisposable, isEmptyCell, isFactoryDependencyItem, isFormulaId, isFormulaString, isICellData, isInternalEditorID, isNodeEnv, isNotNullOrUndefined, isNullCell, isNumeric, isPatternEqualWithoutDecimal, isRangesEqual, isRealNum, isSafeNumeric, isSafeUrl, isSameStyleTextRun, isTextFormat, isUnitRangesEqual, isValidRange, isValueDependencyItem, isWhiteColor, makeArray, makeCellRangeToRangeData, makeCellToSelection, makeCustomRangeStream, mapObjectMatrix, merge, mergeIntervals, mergeLocales, mergeOverrideWithDependencies, mergeSets, mergeWith, mergeWorksheetSnapshotWithDefault, mixinClass, moveMatrixArray, moveRangeByOffset, nameCharacterCheck, noop, normalizeBody, normalizeInsertedSectionIdsForDocument, normalizeTextRuns, normalizeUrl, numberToABC, numberToListABC, api_exports as numfmt, queryObjectMatrix, regexp, registerDependencies, remove, repeatStringNumTimes, replaceInDocumentBody, requestImmediateMacroTask, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReference, resolveSectionHeaderFooterReferences, resolveWithBasePath, rotate, searchArray, searchInOrderedArray, selectionToArray, sequence, sequenceAsync, sequenceExecute, sequenceExecuteAsync, set, setDependencies, shallowEqual, shiftExclusiveRangeOnDelete, shiftExclusiveRangeOnInsert, shiftInclusiveRangeOnDelete, shiftInclusiveRangeOnInsert, skipParseTagNames, sliceMatrixArray, sortRules, sortRulesByDesc, sortRulesFactory, spliceArray, splitIntoGrid, takeAfter, throttle, toDisposable, touchDependencies, updateAttributeByDelete, updateAttributeByInsert, validateDocBodyStructure, validateDocumentStructure, willLoseNumericPrecision };
@@ -443,6 +443,14 @@ export interface IGridCellSelection {
443
443
  viewId: ViewId;
444
444
  recordId: RecordId;
445
445
  fieldId: FieldId;
446
+ mode?: 'cell' | 'row' | 'column';
447
+ anchorRecordId?: RecordId;
448
+ focusRecordId?: RecordId;
449
+ anchorFieldId?: FieldId;
450
+ focusFieldId?: FieldId;
451
+ selectedRecordIds?: RecordId[];
452
+ showBorder?: boolean;
453
+ virtual?: boolean;
446
454
  }
447
455
  export interface IGridGroupSelection {
448
456
  type: 'grid-group';
@@ -20,9 +20,9 @@ export interface IDataStreamChange {
20
20
  insertLength: number;
21
21
  }
22
22
  /**
23
- * Finds one contiguous dataStream change. Pure structural insertions are
24
- * anchored by their new stable ids before falling back to string comparison.
23
+ * Finds one contiguous dataStream change. Pure structural insertions and deletions
24
+ * are anchored by their stable ids before falling back to string comparison.
25
25
  * This prevents an adjacent identical sentinel from being mistaken for an
26
- * unchanged prefix and keeps the inserted structure metadata in the TextX body.
26
+ * unchanged prefix and keeps the structure metadata aligned with the TextX body.
27
27
  */
28
28
  export declare function getSingleDataStreamChange(previousBody: IDocumentBody | undefined, nextBody: IDocumentBody | undefined): IDataStreamChange | null;
@@ -76,6 +76,7 @@ export { mergeOverrideWithDependencies } from './services/plugin/plugin-override
76
76
  export type { DependencyOverride } from './services/plugin/plugin-override';
77
77
  export type { PluginCtor } from './services/plugin/plugin.service';
78
78
  export { DependentOn, Plugin, PluginService } from './services/plugin/plugin.service';
79
+ export { RegionService } from './services/region/region.service';
79
80
  export { IResourceLoaderService } from './services/resource-loader/type';
80
81
  export { ResourceManagerService } from './services/resource-manager/resource-manager.service';
81
82
  export type { IResourceHook, IResources } from './services/resource-manager/type';
@@ -17,6 +17,7 @@ export declare const FOCUSING_UNIT = "FOCUSING_UNIT";
17
17
  export declare const FOCUSING_SHEET = "FOCUSING_SHEET";
18
18
  export declare const FOCUSING_DOC = "FOCUSING_DOC";
19
19
  export declare const FOCUSING_SLIDE = "FOCUSING_SLIDE";
20
+ export declare const FOCUSING_BOARD = "FOCUSING_BOARD";
20
21
  /** @deprecated */
21
22
  export declare const FOCUSING_EDITOR_BUT_HIDDEN = "FOCUSING_EDITOR_BUT_HIDDEN";
22
23
  export declare const EDITOR_ACTIVATED = "EDITOR_ACTIVATED";
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { Observable } from 'rxjs';
17
+ import type { LocaleType } from '../../types/enum/locale-type';
18
+ import { Disposable } from '../../shared/lifecycle';
19
+ import { LocaleService } from '../locale/locale.service';
20
+ export declare class RegionService extends Disposable {
21
+ private readonly _localeService;
22
+ private readonly _currentRegion$;
23
+ readonly currentRegion$: Observable<LocaleType>;
24
+ private _hasExplicitRegion;
25
+ constructor(_localeService: LocaleService);
26
+ setRegion(region: LocaleType): void;
27
+ getCurrentRegion(): LocaleType;
28
+ }
@@ -16,6 +16,8 @@
16
16
  import type { ICustomDecoration, ICustomRange, IParagraph } from './i-document-data';
17
17
  export interface ICustomRangeForInterceptor extends ICustomRange {
18
18
  active?: boolean;
19
+ glyphAscentEm?: number;
20
+ glyphDescentEm?: number;
19
21
  glyphWidthEm?: number;
20
22
  show?: boolean;
21
23
  }
@@ -37,6 +37,10 @@ export interface IUniverConfig {
37
37
  * The locale of the Univer instance.
38
38
  */
39
39
  locale?: LocaleType;
40
+ /**
41
+ * The region of the Univer instance. It follows locale until explicitly configured.
42
+ */
43
+ region?: LocaleType;
40
44
  /**
41
45
  * The direction of the Univer instance.
42
46
  * @default 'ltr'
@@ -90,6 +94,7 @@ export declare class Univer implements IDisposable {
90
94
  onDispose(callback: () => void): IDisposable;
91
95
  dispose(): void;
92
96
  setLocale(locale: LocaleType): void;
97
+ setRegion(region: LocaleType): void;
93
98
  createUnit<T, U extends UnitModel>(type: UniverInstanceType, data: Partial<T>): U;
94
99
  private _init;
95
100
  private _tryProgressToReady;