@univerjs/core 0.12.3 → 0.12.4-experimental.20251210-8d33c6e
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 +8 -8
- package/lib/es/index.js +3298 -3146
- package/lib/index.js +3298 -3146
- package/lib/types/common/const.d.ts +2 -0
- package/lib/types/index.d.ts +2 -1
- package/lib/types/services/command/command.service.d.ts +33 -1
- package/lib/types/services/context/context.d.ts +2 -0
- package/lib/types/services/instance/instance.service.d.ts +3 -1
- package/lib/types/sheets/clone.d.ts +38 -0
- package/lib/types/sheets/sheet-skeleton.d.ts +1 -1
- package/lib/types/univer.d.ts +5 -0
- package/lib/umd/index.js +8 -8
- package/package.json +5 -5
- package/LICENSE +0 -176
|
@@ -16,8 +16,10 @@
|
|
|
16
16
|
export declare const DOCS_NORMAL_EDITOR_UNIT_ID_KEY = "__INTERNAL_EDITOR__DOCS_NORMAL";
|
|
17
17
|
export declare const DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY = "__INTERNAL_EDITOR__DOCS_FORMULA_BAR";
|
|
18
18
|
export declare const DOCS_ZEN_EDITOR_UNIT_ID_KEY = "__INTERNAL_EDITOR__ZEN_EDITOR";
|
|
19
|
+
export declare const DOCS_COMMENT_EDITOR_UNIT_ID_KEY = "__INTERNAL_EDITOR__COMMENT_EDITOR";
|
|
19
20
|
export declare const DEFAULT_EMPTY_DOCUMENT_VALUE = "\r\n";
|
|
20
21
|
export declare const IS_ROW_STYLE_PRECEDE_COLUMN_STYLE = "isRowStylePrecedeColumnStyle";
|
|
21
22
|
export declare const AUTO_HEIGHT_FOR_MERGED_CELLS: unique symbol;
|
|
22
23
|
export declare function createInternalEditorID(id: string): string;
|
|
23
24
|
export declare function isInternalEditorID(id: string): boolean;
|
|
25
|
+
export declare function isCommentEditorID(id: string): id is "__INTERNAL_EDITOR__COMMENT_EDITOR";
|
package/lib/types/index.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export { composeBody, getBodySlice, getCustomBlockSlice, getCustomDecorationSlic
|
|
|
54
54
|
export { EventState, EventSubject, fromEventSubject, type IEventObserver } from './observer/observable';
|
|
55
55
|
export { AuthzIoLocalService } from './services/authz-io/authz-io-local.service';
|
|
56
56
|
export { IAuthzIoService } from './services/authz-io/type';
|
|
57
|
-
export { type CommandListener, CommandService, CommandType, type ICommand, type ICommandInfo, ICommandService, type IExecutionOptions, type IMultiCommand, type IMutation, type IMutationCommonParams, type IMutationInfo, type IOperation, type IOperationInfo, NilCommand, sequenceExecute, sequenceExecuteAsync, } from './services/command/command.service';
|
|
57
|
+
export { COMMAND_LOG_EXECUTION_CONFIG_KEY, type CommandListener, CommandService, CommandType, type ICommand, type ICommandInfo, ICommandService, type IExecutionOptions, type IMultiCommand, type IMutation, type IMutationCommonParams, type IMutationInfo, type IOperation, type IOperationInfo, NilCommand, sequenceExecute, sequenceExecuteAsync, } from './services/command/command.service';
|
|
58
58
|
export { IConfigService } from './services/config/config.service';
|
|
59
59
|
export { ConfigService } from './services/config/config.service';
|
|
60
60
|
export * from './services/context/context';
|
|
@@ -96,6 +96,7 @@ export { afterTime, bufferDebounceTime, convertObservableToBehaviorSubject, from
|
|
|
96
96
|
export { textDiff } from './shared/text-diff';
|
|
97
97
|
export { awaitTime, delayAnimationFrame } from './shared/timer';
|
|
98
98
|
export { isNodeEnv } from './shared/tools';
|
|
99
|
+
export * from './sheets/clone';
|
|
99
100
|
export { Range } from './sheets/range';
|
|
100
101
|
export { getCellCoordByIndexSimple, getCellPositionByIndexSimple, getCellWithCoordByIndexCore, SheetSkeleton } from './sheets/sheet-skeleton';
|
|
101
102
|
export type { IGetRowColByPosOptions } from './sheets/sheet-skeleton';
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { IAccessor, IDisposable, Injector } from '../../common/di';
|
|
2
2
|
import { Disposable } from '../../shared/lifecycle';
|
|
3
|
+
import { IConfigService } from '../config/config.service';
|
|
3
4
|
import { IContextService } from '../context/context.service';
|
|
4
5
|
import { ILogService } from '../log/log.service';
|
|
6
|
+
/**
|
|
7
|
+
* The config key for enabling command execution logging.
|
|
8
|
+
* Set via `logCommandExecution` in `IUniverConfig` when calling `new Univer()`.
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
export declare const COMMAND_LOG_EXECUTION_CONFIG_KEY = "command.logExecution";
|
|
5
12
|
/**
|
|
6
13
|
* The type of a command.
|
|
7
14
|
*/
|
|
@@ -77,6 +84,15 @@ export interface IMutationCommonParams {
|
|
|
77
84
|
* It is used to indicate which {@link CommandType.COMMAND} triggers the mutation.
|
|
78
85
|
*/
|
|
79
86
|
trigger?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Mark this mutation as a split chunk from a large mutation.
|
|
89
|
+
* When collaboration layer encounters this flag, it will send this mutation
|
|
90
|
+
* in a separate changeset to avoid oversized payloads.
|
|
91
|
+
*
|
|
92
|
+
* This is typically set by operations that split large data (e.g., copy worksheet,
|
|
93
|
+
* paste large ranges) into smaller chunks for better network transmission.
|
|
94
|
+
*/
|
|
95
|
+
__splitChunk__?: boolean;
|
|
80
96
|
}
|
|
81
97
|
/**
|
|
82
98
|
* {@link CommandType.MUTATION} should implement this interface.
|
|
@@ -142,6 +158,11 @@ export interface IExecutionOptions {
|
|
|
142
158
|
fromCollab?: boolean;
|
|
143
159
|
/** @deprecated */
|
|
144
160
|
fromChangeset?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* This mutation should be synced to changeset but not executed locally.
|
|
163
|
+
* The actual execution will be handled asynchronously via onlyLocal.
|
|
164
|
+
*/
|
|
165
|
+
syncOnly?: boolean;
|
|
145
166
|
[key: PropertyKey]: string | number | boolean | undefined;
|
|
146
167
|
}
|
|
147
168
|
export type CommandListener = (commandInfo: Readonly<ICommandInfo>, options?: IExecutionOptions) => void;
|
|
@@ -192,6 +213,7 @@ export interface ICommandService {
|
|
|
192
213
|
syncExecuteCommand<P extends object = object, R = boolean>(id: string, params?: P, options?: IExecutionOptions): R;
|
|
193
214
|
/**
|
|
194
215
|
* Register a callback function that will be executed after a command is executed.
|
|
216
|
+
* Note: This will NOT be called for commands with syncOnly option.
|
|
195
217
|
* @param listener
|
|
196
218
|
*/
|
|
197
219
|
onCommandExecuted(listener: CommandListener): IDisposable;
|
|
@@ -200,6 +222,13 @@ export interface ICommandService {
|
|
|
200
222
|
* @param listener
|
|
201
223
|
*/
|
|
202
224
|
beforeCommandExecuted(listener: CommandListener): IDisposable;
|
|
225
|
+
/**
|
|
226
|
+
* Register a callback function specifically for collaboration sync.
|
|
227
|
+
* This will only be called for mutations (not commands/operations) that need to be synced,
|
|
228
|
+
* including syncOnly mutations.
|
|
229
|
+
* @param listener
|
|
230
|
+
*/
|
|
231
|
+
onMutationExecutedForCollab(listener: CommandListener): IDisposable;
|
|
203
232
|
}
|
|
204
233
|
declare class CommandRegistry {
|
|
205
234
|
private readonly _commands;
|
|
@@ -214,13 +243,15 @@ export declare const NilCommand: ICommand;
|
|
|
214
243
|
export declare class CommandService extends Disposable implements ICommandService {
|
|
215
244
|
private readonly _injector;
|
|
216
245
|
private readonly _logService;
|
|
246
|
+
private readonly _configService;
|
|
217
247
|
protected readonly _commandRegistry: CommandRegistry;
|
|
218
248
|
private readonly _beforeCommandExecutionListeners;
|
|
219
249
|
private readonly _commandExecutedListeners;
|
|
250
|
+
private readonly _collabMutationListeners;
|
|
220
251
|
private _multiCommandDisposables;
|
|
221
252
|
private _commandExecutingLevel;
|
|
222
253
|
private _commandExecutionStack;
|
|
223
|
-
constructor(_injector: Injector, _logService: ILogService);
|
|
254
|
+
constructor(_injector: Injector, _logService: ILogService, _configService: IConfigService);
|
|
224
255
|
dispose(): void;
|
|
225
256
|
hasCommand(commandId: string): boolean;
|
|
226
257
|
registerCommand(command: ICommand): IDisposable;
|
|
@@ -228,6 +259,7 @@ export declare class CommandService extends Disposable implements ICommandServic
|
|
|
228
259
|
registerMultipleCommand(command: ICommand): IDisposable;
|
|
229
260
|
beforeCommandExecuted(listener: CommandListener): IDisposable;
|
|
230
261
|
onCommandExecuted(listener: (commandInfo: ICommandInfo) => void): IDisposable;
|
|
262
|
+
onMutationExecutedForCollab(listener: CommandListener): IDisposable;
|
|
231
263
|
executeCommand<P extends object = object, R = boolean>(id: string, params?: P, options?: IExecutionOptions): Promise<R>;
|
|
232
264
|
syncExecuteCommand<P extends object = object, R = boolean>(id: string, params?: P | undefined, options?: IExecutionOptions): R;
|
|
233
265
|
private _pushCommandExecutionStack;
|
|
@@ -26,6 +26,8 @@ export declare const FOCUSING_FX_BAR_EDITOR = "FOCUSING_FX_BAR_EDITOR";
|
|
|
26
26
|
/** The focusing state of the cell editor. */
|
|
27
27
|
export declare const FOCUSING_UNIVER_EDITOR = "FOCUSING_UNIVER_EDITOR";
|
|
28
28
|
export declare const FOCUSING_EDITOR_STANDALONE = "FOCUSING_EDITOR_INPUT_FORMULA";
|
|
29
|
+
/** The focusing state of the comment editor. */
|
|
30
|
+
export declare const FOCUSING_COMMENT_EDITOR = "FOCUSING_COMMENT_EDITOR";
|
|
29
31
|
/** The focusing state of the editor in side panel, such as Chart Editor Panel. */
|
|
30
32
|
export declare const FOCUSING_PANEL_EDITOR = "FOCUSING_PANEL_EDITOR";
|
|
31
33
|
export declare const FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE = "FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE";
|
|
@@ -6,6 +6,7 @@ import { DocumentDataModel } from '../../docs/data-model/document-data-model';
|
|
|
6
6
|
import { Disposable } from '../../shared/lifecycle';
|
|
7
7
|
import { Workbook } from '../../sheets/workbook';
|
|
8
8
|
import { IContextService } from '../context/context.service';
|
|
9
|
+
import { ILogService } from '../log/log.service';
|
|
9
10
|
export type UnitCtor = new (...args: any[]) => UnitModel;
|
|
10
11
|
export interface ICreateUnitOptions {
|
|
11
12
|
/**
|
|
@@ -70,8 +71,9 @@ export declare const IUniverInstanceService: import('@wendellhu/redi').Identifie
|
|
|
70
71
|
export declare class UniverInstanceService extends Disposable implements IUniverInstanceService {
|
|
71
72
|
private readonly _injector;
|
|
72
73
|
private readonly _contextService;
|
|
74
|
+
private readonly _logService;
|
|
73
75
|
private readonly _unitsByType;
|
|
74
|
-
constructor(_injector: Injector, _contextService: IContextService);
|
|
76
|
+
constructor(_injector: Injector, _contextService: IContextService, _logService: ILogService);
|
|
75
77
|
dispose(): void;
|
|
76
78
|
private _createHandler;
|
|
77
79
|
__setCreateHandler(handler: (type: UnitType, data: unknown, ctor: UnitCtor, options?: ICreateUnitOptions) => UnitModel): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { IObjectMatrixPrimitiveType, Nullable } from '../shared';
|
|
2
|
+
import { ICellData, ICellDataWithSpanAndDisplay, IWorksheetData } from './typedef';
|
|
3
|
+
/**
|
|
4
|
+
* Fast clone for primitive values and simple objects.
|
|
5
|
+
* Avoids type checking overhead when we know the structure.
|
|
6
|
+
*/
|
|
7
|
+
export declare function cloneValue<T>(value: T): T;
|
|
8
|
+
/**
|
|
9
|
+
* Fast clone for ICellData. Optimized for the known structure.
|
|
10
|
+
* @param cell - The cell data to clone
|
|
11
|
+
* @returns A deep clone of the cell data
|
|
12
|
+
*/
|
|
13
|
+
export declare function cloneCellData(cell: Nullable<ICellData>): Nullable<ICellData>;
|
|
14
|
+
/**
|
|
15
|
+
* Fast clone for ICellDataWithSpanAndDisplay. Optimized for the known structure.
|
|
16
|
+
* This extends cloneCellData with additional span and display properties.
|
|
17
|
+
* @param cell - The cell data with span and display info to clone
|
|
18
|
+
* @returns A deep clone of the cell data
|
|
19
|
+
*/
|
|
20
|
+
export declare function cloneCellDataWithSpanAndDisplay(cell: Nullable<ICellDataWithSpanAndDisplay>): Nullable<ICellDataWithSpanAndDisplay>;
|
|
21
|
+
/**
|
|
22
|
+
* Fast clone for cell data matrix. Optimized for sparse matrix structure.
|
|
23
|
+
* @param cellData - The cell data matrix to clone
|
|
24
|
+
* @returns A deep clone of the cell data matrix
|
|
25
|
+
*/
|
|
26
|
+
export declare function cloneCellDataMatrix(cellData: IObjectMatrixPrimitiveType<ICellData>): IObjectMatrixPrimitiveType<ICellData>;
|
|
27
|
+
/**
|
|
28
|
+
* Optimized deep clone specifically for IWorksheetData.
|
|
29
|
+
* This is significantly faster than generic deepClone because:
|
|
30
|
+
* 1. No recursive type checking - we know the structure
|
|
31
|
+
* 2. Direct property access instead of Object.keys iteration for known properties
|
|
32
|
+
* 3. Specialized handlers for cellData matrix (the largest data)
|
|
33
|
+
* 4. Primitive values copied directly without cloning
|
|
34
|
+
*
|
|
35
|
+
* @param worksheet - The worksheet data to clone
|
|
36
|
+
* @returns A deep clone of the worksheet data
|
|
37
|
+
*/
|
|
38
|
+
export declare function cloneWorksheetData(worksheet: IWorksheetData): IWorksheetData;
|
|
@@ -113,7 +113,7 @@ export declare class SheetSkeleton extends Skeleton {
|
|
|
113
113
|
* @param range
|
|
114
114
|
* @returns {IRange} expanded range because merge info.
|
|
115
115
|
*/
|
|
116
|
-
expandRangeByMerge(range: IRange): IRange;
|
|
116
|
+
expandRangeByMerge(range: IRange, inRefSelectionMode?: boolean): IRange;
|
|
117
117
|
getColumnCount(): number;
|
|
118
118
|
getRowCount(): number;
|
|
119
119
|
/**
|
package/lib/types/univer.d.ts
CHANGED
|
@@ -33,6 +33,11 @@ export interface IUniverConfig {
|
|
|
33
33
|
* The log level of the Univer instance.
|
|
34
34
|
*/
|
|
35
35
|
logLevel?: LogLevel;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to enable logging for command execution.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
logCommandExecution?: boolean;
|
|
36
41
|
/**
|
|
37
42
|
* The override dependencies of the Univer instance.
|
|
38
43
|
*/
|