@univerjs/core 0.22.1 → 0.23.0-insiders.20260522-e8f2a3b
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/cjs/index.js +69 -18
- package/lib/es/index.js +72 -16
- package/lib/index.js +72 -16
- package/lib/types/common/function.d.ts +5 -0
- package/lib/types/index.d.ts +6 -7
- package/lib/types/services/command/command.service.d.ts +1 -0
- package/lib/types/services/locale/locale.service.d.ts +4 -0
- package/lib/types/shared/timer.d.ts +14 -0
- package/lib/types/univer.d.ts +5 -0
- package/lib/umd/index.js +9 -9
- package/package.json +4 -4
- package/LICENSE +0 -176
- package/lib/types/shared/text-diff.d.ts +0 -16
package/lib/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import * as json1 from "ot-json1";
|
|
|
8
8
|
import { debounceTime as debounceTime$1, filter as filter$1, first, map as map$1 } from "rxjs/operators";
|
|
9
9
|
import * as numfmt from "numfmt";
|
|
10
10
|
import RBush, { default as RBush$1 } from "rbush";
|
|
11
|
-
import
|
|
11
|
+
import fastDiff from "fast-diff";
|
|
12
12
|
import { defaultTheme } from "@univerjs/themes";
|
|
13
13
|
import KDBush from "kdbush";
|
|
14
14
|
|
|
@@ -371,6 +371,11 @@ var CanceledError = class extends CustomCommandExecutionError {
|
|
|
371
371
|
* See the License for the specific language governing permissions and
|
|
372
372
|
* limitations under the License.
|
|
373
373
|
*/
|
|
374
|
+
/**
|
|
375
|
+
* A no-op (no operation) function that does nothing.
|
|
376
|
+
* Use this as a default placeholder for callbacks or optional handlers.
|
|
377
|
+
*/
|
|
378
|
+
function noop() {}
|
|
374
379
|
function throttle(fn, wait = 16) {
|
|
375
380
|
let lastTime = 0;
|
|
376
381
|
let timer = null;
|
|
@@ -447,16 +452,17 @@ function createInterceptorKey(key) {
|
|
|
447
452
|
const composeInterceptors = (interceptors) => function(initialValue, context) {
|
|
448
453
|
let index = -1;
|
|
449
454
|
let value = initialValue;
|
|
450
|
-
|
|
455
|
+
let nextCalled = false;
|
|
456
|
+
const next = (nextValue) => {
|
|
457
|
+
nextCalled = true;
|
|
458
|
+
return nextValue;
|
|
459
|
+
};
|
|
460
|
+
for (let i = 0; i < interceptors.length; i++) {
|
|
451
461
|
if (i <= index) throw new Error("[SheetInterceptorService]: next() called multiple times!");
|
|
452
462
|
index = i;
|
|
453
|
-
if (i === interceptors.length) return value;
|
|
454
463
|
const interceptor = interceptors[i];
|
|
455
|
-
|
|
456
|
-
value = interceptor.handler(value, context,
|
|
457
|
-
nextCalled = true;
|
|
458
|
-
return nextValue;
|
|
459
|
-
});
|
|
464
|
+
nextCalled = false;
|
|
465
|
+
value = interceptor.handler(value, context, next);
|
|
460
466
|
if (!nextCalled) break;
|
|
461
467
|
}
|
|
462
468
|
return value;
|
|
@@ -3303,6 +3309,9 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3303
3309
|
disposed() {
|
|
3304
3310
|
return this._disposed;
|
|
3305
3311
|
}
|
|
3312
|
+
_warnCommandSkippedAfterDisposed(id) {
|
|
3313
|
+
this._logService.warn("[CommandService]", `command "${id}" skipped because CommandService is disposed.`);
|
|
3314
|
+
}
|
|
3306
3315
|
hasCommand(commandId) {
|
|
3307
3316
|
return this._commandRegistry.hasCommand(commandId);
|
|
3308
3317
|
}
|
|
@@ -3348,6 +3357,10 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3348
3357
|
throw new Error("[CommandService]: could not add a collab mutation listener twice.");
|
|
3349
3358
|
}
|
|
3350
3359
|
async executeCommand(id, params, options) {
|
|
3360
|
+
if (this._disposed) {
|
|
3361
|
+
this._warnCommandSkippedAfterDisposed(id);
|
|
3362
|
+
return false;
|
|
3363
|
+
}
|
|
3351
3364
|
try {
|
|
3352
3365
|
const item = this._commandRegistry.getCommand(id);
|
|
3353
3366
|
if (item) {
|
|
@@ -3360,6 +3373,11 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3360
3373
|
const stackItemDisposable = this._pushCommandExecutionStack(commandInfo);
|
|
3361
3374
|
const _options = options !== null && options !== void 0 ? options : {};
|
|
3362
3375
|
this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3376
|
+
if (this._disposed) {
|
|
3377
|
+
stackItemDisposable.dispose();
|
|
3378
|
+
this._warnCommandSkippedAfterDisposed(id);
|
|
3379
|
+
return false;
|
|
3380
|
+
}
|
|
3363
3381
|
const result = await this._execute(command, params, _options);
|
|
3364
3382
|
if (_options.syncOnly) {
|
|
3365
3383
|
if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
|
|
@@ -3377,6 +3395,10 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3377
3395
|
}
|
|
3378
3396
|
}
|
|
3379
3397
|
syncExecuteCommand(id, params, options) {
|
|
3398
|
+
if (this._disposed) {
|
|
3399
|
+
this._warnCommandSkippedAfterDisposed(id);
|
|
3400
|
+
return false;
|
|
3401
|
+
}
|
|
3380
3402
|
try {
|
|
3381
3403
|
const item = this._commandRegistry.getCommand(id);
|
|
3382
3404
|
if (item) {
|
|
@@ -3397,6 +3419,11 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3397
3419
|
const stackItemDisposable = this._pushCommandExecutionStack(commandInfo);
|
|
3398
3420
|
const _options = options !== null && options !== void 0 ? options : {};
|
|
3399
3421
|
this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3422
|
+
if (this._disposed) {
|
|
3423
|
+
stackItemDisposable.dispose();
|
|
3424
|
+
this._warnCommandSkippedAfterDisposed(id);
|
|
3425
|
+
return false;
|
|
3426
|
+
}
|
|
3400
3427
|
const result = this._syncExecute(command, params, _options);
|
|
3401
3428
|
if (_options.syncOnly) {
|
|
3402
3429
|
if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
|
|
@@ -3568,7 +3595,12 @@ function afterTime(ms) {
|
|
|
3568
3595
|
}
|
|
3569
3596
|
function convertObservableToBehaviorSubject(observable, initValue) {
|
|
3570
3597
|
const subject = new BehaviorSubject(initValue);
|
|
3571
|
-
observable.subscribe(subject);
|
|
3598
|
+
const subscription = observable.subscribe(subject);
|
|
3599
|
+
const originalComplete = subject.complete.bind(subject);
|
|
3600
|
+
subject.complete = () => {
|
|
3601
|
+
subscription.unsubscribe();
|
|
3602
|
+
originalComplete();
|
|
3603
|
+
};
|
|
3572
3604
|
return subject;
|
|
3573
3605
|
}
|
|
3574
3606
|
|
|
@@ -11690,7 +11722,7 @@ const replaceSelectionTextX = (params) => {
|
|
|
11690
11722
|
const body = (_doc$getSelfOrHeaderF = doc.getSelfOrHeaderFooterModel(segmentId)) === null || _doc$getSelfOrHeaderF === void 0 ? void 0 : _doc$getSelfOrHeaderF.getBody();
|
|
11691
11723
|
if (!body) return false;
|
|
11692
11724
|
const oldBody = selection.collapsed ? null : getBodySlice(body, selection.startOffset, selection.endOffset);
|
|
11693
|
-
const diffs =
|
|
11725
|
+
const diffs = fastDiff(oldBody ? oldBody.dataStream : "", insertBody.dataStream);
|
|
11694
11726
|
let cursor = 0;
|
|
11695
11727
|
const actions = diffs.map(([type, text]) => {
|
|
11696
11728
|
switch (type) {
|
|
@@ -11740,7 +11772,7 @@ const replaceSelectionTextRuns = (params) => {
|
|
|
11740
11772
|
const body = (_doc$getSelfOrHeaderF2 = doc.getSelfOrHeaderFooterModel(segmentId)) === null || _doc$getSelfOrHeaderF2 === void 0 ? void 0 : _doc$getSelfOrHeaderF2.getBody();
|
|
11741
11773
|
if (!body) return false;
|
|
11742
11774
|
const oldBody = selection.collapsed ? null : getBodySlice(body, selection.startOffset, selection.endOffset);
|
|
11743
|
-
const diffs =
|
|
11775
|
+
const diffs = fastDiff(oldBody ? oldBody.dataStream : "", insertBody.dataStream);
|
|
11744
11776
|
let cursor = 0;
|
|
11745
11777
|
const actions = diffs.map(([type, text]) => {
|
|
11746
11778
|
switch (type) {
|
|
@@ -14724,7 +14756,7 @@ const IURLImageService = createIdentifier("core.url-image.service");
|
|
|
14724
14756
|
//#endregion
|
|
14725
14757
|
//#region package.json
|
|
14726
14758
|
var name = "@univerjs/core";
|
|
14727
|
-
var version = "0.
|
|
14759
|
+
var version = "0.23.0-insiders.20260522-e8f2a3b";
|
|
14728
14760
|
|
|
14729
14761
|
//#endregion
|
|
14730
14762
|
//#region src/sheets/empty-snapshot.ts
|
|
@@ -17607,6 +17639,8 @@ var LocaleService = class extends Disposable {
|
|
|
17607
17639
|
super();
|
|
17608
17640
|
_defineProperty(this, "_currentLocale$", new BehaviorSubject("zhCN"));
|
|
17609
17641
|
_defineProperty(this, "currentLocale$", this._currentLocale$.asObservable());
|
|
17642
|
+
_defineProperty(this, "_direction$", new BehaviorSubject("ltr"));
|
|
17643
|
+
_defineProperty(this, "direction$", this._direction$.asObservable());
|
|
17610
17644
|
_defineProperty(this, "_locales", null);
|
|
17611
17645
|
_defineProperty(this, "localeChanged$", new Subject());
|
|
17612
17646
|
_defineProperty(
|
|
@@ -17653,6 +17687,7 @@ var LocaleService = class extends Disposable {
|
|
|
17653
17687
|
this.disposeWithMe(toDisposable(() => {
|
|
17654
17688
|
this._locales = null;
|
|
17655
17689
|
this._currentLocale$.complete();
|
|
17690
|
+
this._direction$.complete();
|
|
17656
17691
|
this.localeChanged$.complete();
|
|
17657
17692
|
}));
|
|
17658
17693
|
}
|
|
@@ -17676,6 +17711,12 @@ var LocaleService = class extends Disposable {
|
|
|
17676
17711
|
getCurrentLocale() {
|
|
17677
17712
|
return this._currentLocale;
|
|
17678
17713
|
}
|
|
17714
|
+
setDirection(direction) {
|
|
17715
|
+
this._direction$.next(direction);
|
|
17716
|
+
}
|
|
17717
|
+
getDirection() {
|
|
17718
|
+
return this._direction$.value;
|
|
17719
|
+
}
|
|
17679
17720
|
resolveKeyPath(obj, keys) {
|
|
17680
17721
|
const currentKey = keys.shift();
|
|
17681
17722
|
if (currentKey && obj && currentKey in obj) {
|
|
@@ -18703,9 +18744,23 @@ var RTree = class {
|
|
|
18703
18744
|
* See the License for the specific language governing permissions and
|
|
18704
18745
|
* limitations under the License.
|
|
18705
18746
|
*/
|
|
18747
|
+
/**
|
|
18748
|
+
* Returns a Promise that resolves after the specified number of milliseconds.
|
|
18749
|
+
* Use this to pause execution for a given duration.
|
|
18750
|
+
*
|
|
18751
|
+
* @param ms The number of milliseconds to wait before resolving.
|
|
18752
|
+
* @returns A Promise that resolves after `ms` milliseconds.
|
|
18753
|
+
*/
|
|
18706
18754
|
function awaitTime(ms) {
|
|
18707
18755
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
18708
18756
|
}
|
|
18757
|
+
/**
|
|
18758
|
+
* Returns a Promise that resolves after the specified number of animation frames.
|
|
18759
|
+
* Use this to wait for the browser to complete one or more rendering cycles.
|
|
18760
|
+
*
|
|
18761
|
+
* @param frames The number of animation frames to wait before resolving. Defaults to `1`.
|
|
18762
|
+
* @returns A Promise that resolves after `frames` animation frames.
|
|
18763
|
+
*/
|
|
18709
18764
|
function delayAnimationFrame(frames = 1) {
|
|
18710
18765
|
return new Promise((resolve) => {
|
|
18711
18766
|
let count = 0;
|
|
@@ -18923,8 +18978,8 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
18923
18978
|
const { r, g, b } = new ColorKit(this._injector.get(ThemeService).getColorFromTheme("primary.500")).toRgb();
|
|
18924
18979
|
return {
|
|
18925
18980
|
...config,
|
|
18926
|
-
defaultBackgroundColor: (_config$defaultBackgr = config.defaultBackgroundColor) !== null && _config$defaultBackgr !== void 0 ? _config$defaultBackgr : `rgba(${r}, ${g}, ${b}, 0.
|
|
18927
|
-
defaultStripeColor: (_config$defaultStripe = config.defaultStripeColor) !== null && _config$defaultStripe !== void 0 ? _config$defaultStripe : `rgba(${r}, ${g}, ${b}, 0.
|
|
18981
|
+
defaultBackgroundColor: (_config$defaultBackgr = config.defaultBackgroundColor) !== null && _config$defaultBackgr !== void 0 ? _config$defaultBackgr : `rgba(${r}, ${g}, ${b}, 0.025)`,
|
|
18982
|
+
defaultStripeColor: (_config$defaultStripe = config.defaultStripeColor) !== null && _config$defaultStripe !== void 0 ? _config$defaultStripe : `rgba(${r}, ${g}, ${b}, 0.08)`
|
|
18928
18983
|
};
|
|
18929
18984
|
}
|
|
18930
18985
|
/**
|
|
@@ -19857,11 +19912,12 @@ var Univer = class {
|
|
|
19857
19912
|
_defineProperty(this, "_injector", void 0);
|
|
19858
19913
|
_defineProperty(this, "_disposingCallbacks", new DisposableCollection());
|
|
19859
19914
|
const injector = this._injector = createUniverInjector(parentInjector, config === null || config === void 0 ? void 0 : config.override);
|
|
19860
|
-
const { theme, darkMode, locale, locales, logLevel, logCommandExecution } = config;
|
|
19915
|
+
const { theme, darkMode, locale, locales, direction, logLevel, logCommandExecution } = config;
|
|
19861
19916
|
if (theme) this._injector.get(ThemeService).setTheme(theme);
|
|
19862
19917
|
if (darkMode) this._injector.get(ThemeService).setDarkMode(darkMode);
|
|
19863
19918
|
if (locales) this._injector.get(LocaleService).load(locales);
|
|
19864
19919
|
if (locale) this._injector.get(LocaleService).setLocale(locale);
|
|
19920
|
+
if (direction) this._injector.get(LocaleService).setDirection(direction);
|
|
19865
19921
|
if (logLevel) this._injector.get(ILogService).setLogLevel(logLevel);
|
|
19866
19922
|
if (logCommandExecution !== void 0) this._injector.get(IConfigService).setConfig(COMMAND_LOG_EXECUTION_CONFIG_KEY, logCommandExecution);
|
|
19867
19923
|
this._init(injector);
|
|
@@ -19992,4 +20048,4 @@ function createUniverInjector(parentInjector, override) {
|
|
|
19992
20048
|
installShims();
|
|
19993
20049
|
|
|
19994
20050
|
//#endregion
|
|
19995
|
-
export { ABCToNumber, AUTO_HEIGHT_FOR_MERGED_CELLS, AbsoluteRefType, ActionIterator, AlignTypeH, AlignTypeV, ArrangeTypeEnum, AsyncInterceptorManager, AsyncLock, AuthzIoLocalService, AutoFillSeries, BORDER_KEYS, BORDER_STYLE_KEYS, BaselineOffset, BlockType, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, BulletAlignment, COLORS, COLOR_STYLE_KEYS, COMMAND_LOG_EXECUTION_CONFIG_KEY, CanceledError, CellModeEnum, CellValueType, ColorKit, ColorType, ColumnSeparatorType, CommandService, CommandType, CommonHideTypes, ConfigService, ContextService, CopyPasteType, CustomCommandExecutionError, CustomDecorationType, CustomRangeType, DEFAULT_CELL, DEFAULT_DOC, 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, DOCS_ZEN_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, 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, LRUHelper, LRUMap, LifecycleService, LifecycleStages, LifecycleUnreachableError, ListGlyphType, LocalUndoRedoService, LocaleService, LocaleType, LogLevel, LookUp, MAX_COLUMN_COUNT, MAX_ROW_COUNT, MOVE_BUFFER_VALUE, Many, MemoryCursor, MentionIOLocalService, MentionType, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NamedStyleType, NilCommand, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PADDING_KEYS, PAGE_SIZE, PAPER_TYPES, PRESET_LIST_TYPE, PRINT_CHART_COMPONENT_KEY, PageOrientType, PaperType, ParagraphElementType, ParagraphStyleBuilder, ParagraphStyleValue, PermissionService, PermissionStatus, Plugin, PluginService, PositionedObjectLayoutType, PresetListType, ProtectionType, Quantity, QuickListType, QuickListTypeMap, RANGE_DIRECTION, RANGE_TYPE, RBush, RCDisposable, RGBA_PAREN, RGB_PAREN, ROTATE_BUFFER_VALUE, RTree, Range, Rectangle, RediError, RedoCommand, RedoCommandId, RefAlias, Registry, RegistryAsMap, RelativeDate, ResourceManagerService, RichTextBuilder, RichTextValue, RxDisposable, 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, cloneCellData, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneValue, cloneWorksheetData, codeToBlob, columnLabelToNumber, composeBody, composeInterceptors, composeStyles, concatMatrixArray, convertCellToRange, convertObservableToBehaviorSubject, covertCellValue, covertCellValues, createAsyncInterceptorKey, createDefaultUser, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createInternalEditorID, createREGEXFromWildChar, createRowColIter, createSheetGapTestConfig, customNameCharacterCheck, dateKit, debounce, dedupe, dedupeBy, deepCompare, delayAnimationFrame, deleteContent, extractPureTextFromCell, forwardRef, fromCallback, fromEventSubject, generateIntervalsByPoints, generateRandomId, get, getArrayLength, getBodySlice, getBorderStyleType, getCellCoordByIndexSimple, getCellInfoInMergeData, getCellValueType, getCellWithCoordByIndexCore, getColorStyle, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeSlice, getDisplayValueFromCell, getDocsUpdateBody, getEmptyCell, getIntersectRange, getNumfmtParseValueFilter, getOriginCellValue, getParagraphsSlice, getPlainText, getReverseDirection, getSectionBreakSlice, getTableSlice, getTextRunSlice, getTransformOffsetX, getTransformOffsetY, getWorksheetUID, groupBy, handleStyleToString, hashAlgorithm, horizontalLineSegmentsSubtraction, insertMatrixArray, insertTextToContent, 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, isSameStyleTextRun, isTextFormat, isUnitRangesEqual, isValidRange, isValueDependencyItem, isWhiteColor, makeArray, makeCellRangeToRangeData, makeCellToSelection, makeCustomRangeStream, mapObjectMatrix, merge, mergeIntervals, mergeLocales, mergeOverrideWithDependencies, mergeSets, mergeWith, mergeWorksheetSnapshotWithDefault, mixinClass, moveMatrixArray, moveRangeByOffset, nameCharacterCheck, normalizeBody, normalizeTextRuns, numberToABC, numberToListABC, numfmt, queryObjectMatrix, registerDependencies, remove, repeatStringNumTimes, replaceInDocumentBody, requestImmediateMacroTask, resolveWithBasePath, rotate, searchArray, searchInOrderedArray, selectionToArray, sequence, sequenceAsync, sequenceExecute, sequenceExecuteAsync, set, setDependencies, shallowEqual, skipParseTagNames, sliceMatrixArray, sortRules, sortRulesByDesc, sortRulesFactory, spliceArray, splitIntoGrid, takeAfter,
|
|
20051
|
+
export { ABCToNumber, AUTO_HEIGHT_FOR_MERGED_CELLS, AbsoluteRefType, ActionIterator, AlignTypeH, AlignTypeV, ArrangeTypeEnum, AsyncInterceptorManager, AsyncLock, AuthzIoLocalService, AutoFillSeries, BORDER_KEYS, BORDER_STYLE_KEYS, BaselineOffset, BlockType, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, BulletAlignment, COLORS, COLOR_STYLE_KEYS, COMMAND_LOG_EXECUTION_CONFIG_KEY, CanceledError, CellModeEnum, CellValueType, ColorKit, ColorType, ColumnSeparatorType, CommandService, CommandType, CommonHideTypes, ConfigService, ContextService, CopyPasteType, CustomCommandExecutionError, CustomDecorationType, CustomRangeType, DEFAULT_CELL, DEFAULT_DOC, 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, DOCS_ZEN_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, 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, LRUHelper, LRUMap, LifecycleService, LifecycleStages, LifecycleUnreachableError, ListGlyphType, LocalUndoRedoService, LocaleService, LocaleType, LogLevel, LookUp, MAX_COLUMN_COUNT, MAX_ROW_COUNT, MOVE_BUFFER_VALUE, Many, MemoryCursor, MentionIOLocalService, MentionType, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NamedStyleType, NilCommand, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PADDING_KEYS, PAGE_SIZE, PAPER_TYPES, PRESET_LIST_TYPE, PRINT_CHART_COMPONENT_KEY, PageOrientType, PaperType, ParagraphElementType, ParagraphStyleBuilder, ParagraphStyleValue, PermissionService, PermissionStatus, Plugin, PluginService, PositionedObjectLayoutType, PresetListType, ProtectionType, Quantity, QuickListType, QuickListTypeMap, RANGE_DIRECTION, RANGE_TYPE, RBush, RCDisposable, RGBA_PAREN, RGB_PAREN, ROTATE_BUFFER_VALUE, RTree, Range, Rectangle, RediError, RedoCommand, RedoCommandId, RefAlias, Registry, RegistryAsMap, RelativeDate, ResourceManagerService, RichTextBuilder, RichTextValue, RxDisposable, 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, cloneCellData, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneValue, cloneWorksheetData, codeToBlob, columnLabelToNumber, composeBody, composeInterceptors, composeStyles, concatMatrixArray, convertCellToRange, convertObservableToBehaviorSubject, covertCellValue, covertCellValues, createAsyncInterceptorKey, createDefaultUser, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createInternalEditorID, createREGEXFromWildChar, createRowColIter, createSheetGapTestConfig, customNameCharacterCheck, dateKit, debounce, dedupe, dedupeBy, deepCompare, delayAnimationFrame, deleteContent, extractPureTextFromCell, forwardRef, fromCallback, fromEventSubject, generateIntervalsByPoints, generateRandomId, get, getArrayLength, getBodySlice, getBorderStyleType, getCellCoordByIndexSimple, getCellInfoInMergeData, getCellValueType, getCellWithCoordByIndexCore, getColorStyle, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeSlice, getDisplayValueFromCell, getDocsUpdateBody, getEmptyCell, getIntersectRange, getNumfmtParseValueFilter, getOriginCellValue, getParagraphsSlice, getPlainText, getReverseDirection, getSectionBreakSlice, getTableSlice, getTextRunSlice, getTransformOffsetX, getTransformOffsetY, getWorksheetUID, groupBy, handleStyleToString, hashAlgorithm, horizontalLineSegmentsSubtraction, insertMatrixArray, insertTextToContent, 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, isSameStyleTextRun, isTextFormat, isUnitRangesEqual, isValidRange, isValueDependencyItem, isWhiteColor, makeArray, makeCellRangeToRangeData, makeCellToSelection, makeCustomRangeStream, mapObjectMatrix, merge, mergeIntervals, mergeLocales, mergeOverrideWithDependencies, mergeSets, mergeWith, mergeWorksheetSnapshotWithDefault, mixinClass, moveMatrixArray, moveRangeByOffset, nameCharacterCheck, noop, normalizeBody, normalizeTextRuns, numberToABC, numberToListABC, numfmt, queryObjectMatrix, registerDependencies, remove, repeatStringNumTimes, replaceInDocumentBody, requestImmediateMacroTask, resolveWithBasePath, rotate, searchArray, searchInOrderedArray, selectionToArray, sequence, sequenceAsync, sequenceExecute, sequenceExecuteAsync, set, setDependencies, shallowEqual, skipParseTagNames, sliceMatrixArray, sortRules, sortRulesByDesc, sortRulesFactory, spliceArray, splitIntoGrid, takeAfter, throttle, toDisposable, touchDependencies, updateAttributeByDelete, updateAttributeByInsert, willLoseNumericPrecision };
|
|
@@ -13,4 +13,9 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
/**
|
|
17
|
+
* A no-op (no operation) function that does nothing.
|
|
18
|
+
* Use this as a default placeholder for callbacks or optional handlers.
|
|
19
|
+
*/
|
|
20
|
+
export declare function noop(): void;
|
|
16
21
|
export declare function throttle<T extends (...args: any[]) => any>(fn: T, wait?: number): T;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -20,9 +20,9 @@ export * from './common/const';
|
|
|
20
20
|
export * from './common/di';
|
|
21
21
|
export { shallowEqual } from './common/equal';
|
|
22
22
|
export { CanceledError, CustomCommandExecutionError } from './common/error';
|
|
23
|
-
export { throttle } from './common/function';
|
|
24
|
-
export type { IAsyncInterceptor, ICellInterceptor, IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';
|
|
25
|
-
export { AsyncInterceptorManager, composeInterceptors, createAsyncInterceptorKey, createInterceptorKey, InterceptorEffectEnum, InterceptorManager } from './common/interceptor';
|
|
23
|
+
export { noop, throttle } from './common/function';
|
|
24
|
+
export type { IAsyncInterceptor, ICellInterceptor, IComposeInterceptors, IInterceptor, InterceptorHandler, } from './common/interceptor';
|
|
25
|
+
export { AsyncInterceptorManager, composeInterceptors, createAsyncInterceptorKey, createInterceptorKey, InterceptorEffectEnum, InterceptorManager, } from './common/interceptor';
|
|
26
26
|
export { invertColorByHSL } from './common/invert-color/invert-hsl';
|
|
27
27
|
export { invertColorByMatrix } from './common/invert-color/invert-rgb';
|
|
28
28
|
export type { RGBColorType } from './common/invert-color/utils';
|
|
@@ -41,7 +41,7 @@ export * from './docs/data-model';
|
|
|
41
41
|
export { JSON1, JSONX } from './docs/data-model/json-x/json-x';
|
|
42
42
|
export type { JSONXActions, JSONXPath } from './docs/data-model/json-x/json-x';
|
|
43
43
|
export { replaceInDocumentBody } from './docs/data-model/replacement';
|
|
44
|
-
export { ParagraphStyleBuilder, ParagraphStyleValue, RichTextBuilder, RichTextValue, TextDecorationBuilder, TextStyleBuilder, TextStyleValue } from './docs/data-model/rich-text-builder';
|
|
44
|
+
export { ParagraphStyleBuilder, ParagraphStyleValue, RichTextBuilder, RichTextValue, TextDecorationBuilder, TextStyleBuilder, TextStyleValue, } from './docs/data-model/rich-text-builder';
|
|
45
45
|
export { DEFAULT_DOCUMENT_SUB_COMPONENT_ID } from './docs/data-model/subdocument';
|
|
46
46
|
export { ActionIterator } from './docs/data-model/text-x/action-iterator';
|
|
47
47
|
export { type IDeleteAction, type IInsertAction, type IRetainAction, type TextXAction, TextXActionType, } from './docs/data-model/text-x/action-types';
|
|
@@ -77,7 +77,7 @@ export { PermissionService } from './services/permission/permission.service';
|
|
|
77
77
|
export { IPermissionService, PermissionStatus } from './services/permission/type';
|
|
78
78
|
export type { IPermissionParam } from './services/permission/type';
|
|
79
79
|
export type { IPermissionPoint } from './services/permission/type';
|
|
80
|
-
export type { IPermissionTypes, RangePermissionPointConstructor, WorkbookPermissionPointConstructor, WorkSheetPermissionPointConstructor } from './services/permission/type';
|
|
80
|
+
export type { IPermissionTypes, RangePermissionPointConstructor, WorkbookPermissionPointConstructor, WorkSheetPermissionPointConstructor, } from './services/permission/type';
|
|
81
81
|
export { type DependencyOverride, mergeOverrideWithDependencies } from './services/plugin/plugin-override';
|
|
82
82
|
export type { PluginCtor } from './services/plugin/plugin.service';
|
|
83
83
|
export { DependentOn, Plugin, PluginService } from './services/plugin/plugin.service';
|
|
@@ -97,7 +97,6 @@ export { customNameCharacterCheck, nameCharacterCheck } from './shared/name';
|
|
|
97
97
|
export { type BBox, type IRTreeItem, RBush, RTree } from './shared/r-tree';
|
|
98
98
|
export { getIntersectRange } from './shared/range';
|
|
99
99
|
export { afterTime, bufferDebounceTime, convertObservableToBehaviorSubject, fromCallback, takeAfter } from './shared/rxjs';
|
|
100
|
-
export { textDiff } from './shared/text-diff';
|
|
101
100
|
export { awaitTime, delayAnimationFrame } from './shared/timer';
|
|
102
101
|
export { isNodeEnv } from './shared/tools';
|
|
103
102
|
export * from './sheets/clone';
|
|
@@ -126,5 +125,5 @@ export { DataValidationStatus } from './types/enum/data-validation-status';
|
|
|
126
125
|
export { DataValidationType } from './types/enum/data-validation-type';
|
|
127
126
|
export * from './types/interfaces';
|
|
128
127
|
export type { ICellCustomRender, ICellRenderContext } from './types/interfaces/i-cell-custom-render';
|
|
129
|
-
export type { IDataValidationRule, IDataValidationRuleBase, IDataValidationRuleInfo, IDataValidationRuleOptions, ISheetDataValidationRule } from './types/interfaces/i-data-validation';
|
|
128
|
+
export type { IDataValidationRule, IDataValidationRuleBase, IDataValidationRuleInfo, IDataValidationRuleOptions, ISheetDataValidationRule, } from './types/interfaces/i-data-validation';
|
|
130
129
|
export { type IUniverConfig, Univer } from './univer';
|
|
@@ -271,6 +271,7 @@ export declare class CommandService extends Disposable implements ICommandServic
|
|
|
271
271
|
constructor(_injector: Injector, _logService: ILogService, _configService: IConfigService);
|
|
272
272
|
dispose(): void;
|
|
273
273
|
disposed(): boolean;
|
|
274
|
+
private _warnCommandSkippedAfterDisposed;
|
|
274
275
|
hasCommand(commandId: string): boolean;
|
|
275
276
|
registerCommand(command: ICommand): IDisposable;
|
|
276
277
|
unregisterCommand(commandId: string): void;
|
|
@@ -24,6 +24,8 @@ export declare class LocaleService extends Disposable {
|
|
|
24
24
|
private _currentLocale$;
|
|
25
25
|
readonly currentLocale$: import("rxjs").Observable<LocaleType>;
|
|
26
26
|
private get _currentLocale();
|
|
27
|
+
private _direction$;
|
|
28
|
+
readonly direction$: import("rxjs").Observable<"ltr" | "rtl">;
|
|
27
29
|
private _locales;
|
|
28
30
|
localeChanged$: Subject<void>;
|
|
29
31
|
constructor();
|
|
@@ -62,5 +64,7 @@ export declare class LocaleService extends Disposable {
|
|
|
62
64
|
setLocale(locale: LocaleType): void;
|
|
63
65
|
getLocales(): ILanguagePack | undefined;
|
|
64
66
|
getCurrentLocale(): LocaleType;
|
|
67
|
+
setDirection(direction: 'ltr' | 'rtl'): void;
|
|
68
|
+
getDirection(): "ltr" | "rtl";
|
|
65
69
|
resolveKeyPath(obj: ILanguagePack, keys: string[]): LanguageValue | null;
|
|
66
70
|
}
|
|
@@ -13,5 +13,19 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
/**
|
|
17
|
+
* Returns a Promise that resolves after the specified number of milliseconds.
|
|
18
|
+
* Use this to pause execution for a given duration.
|
|
19
|
+
*
|
|
20
|
+
* @param ms The number of milliseconds to wait before resolving.
|
|
21
|
+
* @returns A Promise that resolves after `ms` milliseconds.
|
|
22
|
+
*/
|
|
16
23
|
export declare function awaitTime(ms: number): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Returns a Promise that resolves after the specified number of animation frames.
|
|
26
|
+
* Use this to wait for the browser to complete one or more rendering cycles.
|
|
27
|
+
*
|
|
28
|
+
* @param frames The number of animation frames to wait before resolving. Defaults to `1`.
|
|
29
|
+
* @returns A Promise that resolves after `frames` animation frames.
|
|
30
|
+
*/
|
|
17
31
|
export declare function delayAnimationFrame(frames?: number): Promise<void>;
|
package/lib/types/univer.d.ts
CHANGED