@univerjs/core 0.1.16 → 0.2.0
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 +2541 -2500
- package/lib/types/common/array.d.ts +1 -0
- package/lib/types/common/const.d.ts +2 -2
- package/lib/types/common/interceptor.d.ts +1 -1
- package/lib/types/{observer/index.d.ts → common/url.d.ts} +1 -2
- package/lib/types/docs/data-model/document-data-model.d.ts +3 -3
- package/lib/types/docs/data-model/json-x/json-x.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/apply-utils/common.d.ts +4 -1
- package/lib/types/docs/data-model/text-x/utils.d.ts +13 -1
- package/lib/types/docs/data-model/types.d.ts +2 -2
- package/lib/types/index.d.ts +7 -2
- package/lib/types/observer/observable.d.ts +21 -125
- package/lib/types/services/__tests__/index.d.ts +18 -0
- package/lib/types/services/command/command.service.d.ts +1 -0
- package/lib/types/services/instance/instance.service.d.ts +1 -1
- package/lib/types/services/resource-loader/resource-loader.service.d.ts +2 -0
- package/lib/types/services/resource-loader/type.d.ts +3 -0
- package/lib/types/services/resource-manager/resource-manager.service.d.ts +5 -0
- package/lib/types/services/resource-manager/type.d.ts +1 -0
- package/lib/types/services/undoredo/undoredo.service.d.ts +1 -1
- package/lib/types/services/user-manager/user-manager.service.d.ts +2 -2
- package/lib/types/shared/__tests__/name.spec.d.ts +16 -0
- package/lib/types/shared/common.d.ts +2 -7
- package/lib/types/shared/lifecycle.d.ts +1 -4
- package/lib/types/shared/name.d.ts +26 -0
- package/lib/types/shared/rxjs.d.ts +9 -0
- package/lib/types/shared/tools.d.ts +2 -0
- package/lib/types/sheets/__tests__/create-core-test-bed.d.ts +6 -6
- package/lib/types/sheets/range.d.ts +1 -5
- package/lib/types/sheets/workbook.d.ts +1 -0
- package/lib/types/types/const/clipboard.d.ts +16 -0
- package/lib/types/types/interfaces/i-cell-custom-render.d.ts +3 -3
- package/lib/types/types/interfaces/i-cell-data.d.ts +1 -1
- package/lib/types/types/interfaces/i-document-data.d.ts +24 -1
- package/lib/types/types/interfaces/i-selection-data.d.ts +7 -2
- package/lib/types/types/interfaces/i-style-data.d.ts +4 -0
- package/lib/umd/index.js +8 -8
- package/package.json +7 -7
- package/lib/types/observer/observable-hooks.d.ts +0 -18
- package/lib/types/services/__test__/index.d.ts +0 -18
- package/lib/types/shared/props-from.d.ts +0 -6
- /package/lib/types/services/{__test__ → __tests__}/permission.spec.d.ts +0 -0
|
@@ -29,3 +29,4 @@ export declare function findLast<T>(arr: T[], callback: (item: T, index: number)
|
|
|
29
29
|
*/
|
|
30
30
|
export declare function rotate<T>(arr: Readonly<T[]>, steps: number): readonly T[];
|
|
31
31
|
export declare function groupBy<T>(arr: Readonly<T[]>, keyFn: (v: T) => string): Map<string, T[]>;
|
|
32
|
+
export declare function makeArray<T>(thing: T | T[]): T[];
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export declare const DOCS_NORMAL_EDITOR_UNIT_ID_KEY = "
|
|
17
|
-
export declare const DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY = "
|
|
16
|
+
export declare const DOCS_NORMAL_EDITOR_UNIT_ID_KEY = "__INTERNAL_EDITOR__DOCS_NORMAL";
|
|
17
|
+
export declare const DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY = "__INTERNAL_EDITOR__DOCS_FORMULA_BAR";
|
|
18
18
|
export declare const DEFAULT_EMPTY_DOCUMENT_VALUE = "\r\n";
|
|
19
19
|
export declare function createInternalEditorID(id: string): string;
|
|
20
20
|
export declare function isInternalEditorID(id: string): boolean;
|
|
@@ -10,7 +10,7 @@ export type IComposeInterceptors<T = any, C = any> = (interceptors: Array<IInter
|
|
|
10
10
|
/**
|
|
11
11
|
* A helper to compose a certain type of interceptors.
|
|
12
12
|
*/
|
|
13
|
-
export declare const composeInterceptors: <T, C>(interceptors: Array<IInterceptor<T, C>>) =>
|
|
13
|
+
export declare const composeInterceptors: <T, C>(interceptors: Array<IInterceptor<T, C>>) => ReturnType<IComposeInterceptors<T, C>>;
|
|
14
14
|
export declare class InterceptorManager<P extends Record<string, IInterceptor<any, any>>> {
|
|
15
15
|
private _interceptorsByName;
|
|
16
16
|
private _interceptorPoints;
|
|
@@ -44,15 +44,15 @@ export declare class DocumentDataModel extends DocumentDataModelSimple {
|
|
|
44
44
|
dispose(): void;
|
|
45
45
|
getDrawings(): IDrawings | undefined;
|
|
46
46
|
getDrawingsOrder(): string[] | undefined;
|
|
47
|
+
getCustomRanges(): import('../../types/interfaces/i-document-data').ICustomRange[] | undefined;
|
|
48
|
+
getCustomDecorations(): import('../../types/interfaces/i-document-data').ICustomDecoration[] | undefined;
|
|
47
49
|
getRev(): number;
|
|
48
50
|
incrementRev(): void;
|
|
49
51
|
getSettings(): import('../../types/interfaces/i-document-data').IDocumentSettings | undefined;
|
|
50
52
|
reset(snapshot: Partial<IDocumentData>): void;
|
|
51
53
|
getSelfOrHeaderFooterModel(segmentId?: string): DocumentDataModel;
|
|
52
54
|
getUnitId(): string;
|
|
53
|
-
apply(actions: JSONXActions):
|
|
54
|
-
[k: string]: import('ot-json1').Doc;
|
|
55
|
-
} | null | undefined;
|
|
55
|
+
apply(actions: JSONXActions): IDocumentData | undefined;
|
|
56
56
|
sliceBody(startOffset: number, endOffset: number): Nullable<IDocumentBody>;
|
|
57
57
|
private _initializeHeaderFooterModel;
|
|
58
58
|
updateDocumentId(unitId: string): void;
|
|
@@ -34,5 +34,5 @@ export declare class JSONX {
|
|
|
34
34
|
moveOp(from: Path, to: Path): JSONOp;
|
|
35
35
|
insertOp(path: Path, value: any): JSONOp;
|
|
36
36
|
replaceOp(path: Path, oldVal: any, newVal: any): JSONOp;
|
|
37
|
-
editOp(subOp: TextXAction[]): JSONOp;
|
|
37
|
+
editOp(subOp: TextXAction[], path?: string[]): JSONOp;
|
|
38
38
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICustomBlock, ICustomRange, IDocumentBody, IParagraph, ISectionBreak, ITable, ITextRun } from '../../../../types/interfaces';
|
|
1
|
+
import { ICustomBlock, ICustomDecoration, ICustomRange, IDocumentBody, IParagraph, ISectionBreak, ITable, ITextRun } from '../../../../types/interfaces';
|
|
2
2
|
|
|
3
3
|
export declare function normalizeTextRuns(textRuns: ITextRun[]): ITextRun[];
|
|
4
4
|
/**
|
|
@@ -22,9 +22,12 @@ export declare function insertSectionBreaks(body: IDocumentBody, insertBody: IDo
|
|
|
22
22
|
export declare function insertCustomBlocks(body: IDocumentBody, insertBody: IDocumentBody, textLength: number, currentIndex: number): void;
|
|
23
23
|
export declare function insertTables(body: IDocumentBody, insertBody: IDocumentBody, textLength: number, currentIndex: number): void;
|
|
24
24
|
export declare function insertCustomRanges(body: IDocumentBody, insertBody: IDocumentBody, textLength: number, currentIndex: number): void;
|
|
25
|
+
export declare function mergeDecorations(customDecorations: ICustomDecoration[]): ICustomDecoration[];
|
|
26
|
+
export declare function insertCustomDecorations(body: IDocumentBody, insertBody: IDocumentBody, textLength: number, currentIndex: number): void;
|
|
25
27
|
export declare function deleteTextRuns(body: IDocumentBody, textLength: number, currentIndex: number): ITextRun[];
|
|
26
28
|
export declare function deleteParagraphs(body: IDocumentBody, textLength: number, currentIndex: number): IParagraph[];
|
|
27
29
|
export declare function deleteSectionBreaks(body: IDocumentBody, textLength: number, currentIndex: number): ISectionBreak[];
|
|
28
30
|
export declare function deleteCustomBlocks(body: IDocumentBody, textLength: number, currentIndex: number): ICustomBlock[];
|
|
29
31
|
export declare function deleteTables(body: IDocumentBody, textLength: number, currentIndex: number): ITable[];
|
|
30
32
|
export declare function deleteCustomRanges(body: IDocumentBody, textLength: number, currentIndex: number): ICustomRange[];
|
|
33
|
+
export declare function deleteCustomDecorations(body: IDocumentBody, textLength: number, currentIndex: number, needOffset?: boolean): ICustomDecoration[];
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { UpdateDocsAttributeType } from '../../../shared/command-enum';
|
|
2
|
-
import { IDocumentBody } from '../../../types/interfaces/i-document-data';
|
|
2
|
+
import { ICustomDecoration, IDocumentBody } from '../../../types/interfaces/i-document-data';
|
|
3
3
|
import { IRetainAction } from './action-types';
|
|
4
4
|
|
|
5
5
|
export declare function getBodySlice(body: IDocumentBody, startOffset: number, endOffset: number, returnEmptyTextRun?: boolean): IDocumentBody;
|
|
6
|
+
export declare function normalizeBody(body: IDocumentBody): IDocumentBody;
|
|
7
|
+
export declare function getCustomRangeSlice(body: IDocumentBody, startOffset: number, endOffset: number): {
|
|
8
|
+
customRanges: {
|
|
9
|
+
startIndex: number;
|
|
10
|
+
endIndex: number;
|
|
11
|
+
rangeId: string;
|
|
12
|
+
rangeType: import('../../../types/interfaces/i-document-data').CustomRangeType;
|
|
13
|
+
}[];
|
|
14
|
+
leftOffset: number;
|
|
15
|
+
rightOffset: number;
|
|
16
|
+
};
|
|
17
|
+
export declare function getCustomDecorationSlice(body: IDocumentBody, startOffset: number, endOffset: number): ICustomDecoration[];
|
|
6
18
|
export declare function composeBody(thisBody: IDocumentBody, otherBody: IDocumentBody, coverType?: UpdateDocsAttributeType): IDocumentBody;
|
|
7
19
|
export declare function isUselessRetainAction(action: IRetainAction): boolean;
|
|
@@ -28,8 +28,8 @@ export declare enum DataStreamTreeTokenType {
|
|
|
28
28
|
TABLE_ROW_START = "\u001B",// 表格开始
|
|
29
29
|
TABLE_CELL_START = "\u001C",// 表格开始
|
|
30
30
|
TABLE_CELL_END = "\u001D",// 表格开始
|
|
31
|
-
TABLE_ROW_END = "
|
|
32
|
-
TABLE_END = "
|
|
31
|
+
TABLE_ROW_END = "*",// 表格开始
|
|
32
|
+
TABLE_END = "+",// 表格结束
|
|
33
33
|
CUSTOM_RANGE_START = "\u001F",// 自定义范围开始
|
|
34
34
|
CUSTOM_RANGE_END = "\u001E",// 自定义范围结束
|
|
35
35
|
COLUMN_BREAK = "\v",// 换列
|
package/lib/types/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export { Univer } from './univer';
|
|
|
20
20
|
export { shallowEqual, isRangesEqual, isUnitRangesEqual } from './common/equal';
|
|
21
21
|
export { isNumeric, isSafeNumeric } from './common/number';
|
|
22
22
|
export { isBooleanString } from './common/boolean';
|
|
23
|
-
export { dedupe, remove, rotate, groupBy } from './common/array';
|
|
23
|
+
export { dedupe, remove, rotate, groupBy, makeArray } from './common/array';
|
|
24
24
|
export { mergeSets } from './common/set';
|
|
25
25
|
export { DEFAULT_EMPTY_DOCUMENT_VALUE, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, createInternalEditorID, isInternalEditorID, } from './common/const';
|
|
26
26
|
export { throttle } from './common/function';
|
|
@@ -37,7 +37,7 @@ export type { TPriority } from './docs/data-model/text-x/text-x';
|
|
|
37
37
|
export { JSONX, JSON1 } from './docs/data-model/json-x/json-x';
|
|
38
38
|
export type { JSONXActions, JSONXPath } from './docs/data-model/json-x/json-x';
|
|
39
39
|
export { replaceInDocumentBody } from './docs/data-model/replacement';
|
|
40
|
-
export
|
|
40
|
+
export { type IEventObserver, EventState, EventSubject } from './observer/observable';
|
|
41
41
|
export { Plugin } from './services/plugin/plugin';
|
|
42
42
|
export { PluginService, DependentOn } from './services/plugin/plugin.service';
|
|
43
43
|
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';
|
|
@@ -105,3 +105,8 @@ export { PermissionService } from './services/permission/permission.service';
|
|
|
105
105
|
export { AuthzIoLocalService } from './services/authz-io/authz-io-local.service';
|
|
106
106
|
export { IAuthzIoService } from './services/authz-io/type';
|
|
107
107
|
export { createDefaultUser } from './services/user-manager/const';
|
|
108
|
+
export { skipParseTagNames } from './types/const/clipboard';
|
|
109
|
+
export { normalizeBody, getCustomRangeSlice, getCustomDecorationSlice } from './docs/data-model/text-x/utils';
|
|
110
|
+
export { updateAttributeByDelete } from './docs/data-model/text-x/apply-utils/delete-apply';
|
|
111
|
+
export { updateAttributeByInsert } from './docs/data-model/text-x/apply-utils/insert-apply';
|
|
112
|
+
export { nameCharacterCheck } from './shared/name';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Observer as RxObserver, Subscription, Subject } from 'rxjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A class serves as a medium between the observable and its observers
|
|
@@ -7,145 +7,41 @@ export declare class EventState {
|
|
|
7
7
|
/**
|
|
8
8
|
* An WorkBookObserver can set this property to true to prevent subsequent observers of being notified
|
|
9
9
|
*/
|
|
10
|
-
skipNextObservers: boolean
|
|
10
|
+
skipNextObservers: boolean;
|
|
11
11
|
/**
|
|
12
12
|
* This will be populated with the return value of the last function that was executed.
|
|
13
13
|
* If it is the first function in the callback chain it will be the event data.
|
|
14
14
|
*/
|
|
15
15
|
lastReturnValue?: unknown;
|
|
16
16
|
isStopPropagation: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Create a new EventState
|
|
19
|
-
* @param skipNextObservers defines a flag which will instruct the observable to skip following observers when set to true
|
|
20
|
-
* @param target defines the original target of the state
|
|
21
|
-
* @param currentTarget defines the current target of the state
|
|
22
|
-
*/
|
|
23
|
-
constructor(skipNextObservers?: boolean);
|
|
24
|
-
/**
|
|
25
|
-
* Initialize the current event state
|
|
26
|
-
* @param skipNextObservers defines a flag which will instruct the observable to skip following observers when set to true
|
|
27
|
-
* @param target defines the original target of the state
|
|
28
|
-
* @param currentTarget defines the current target of the state
|
|
29
|
-
* @returns the current event state
|
|
30
|
-
*/
|
|
31
|
-
initialize(skipNextObservers?: boolean): EventState;
|
|
32
17
|
stopPropagation(): void;
|
|
33
18
|
}
|
|
34
19
|
interface INotifyObserversReturn {
|
|
20
|
+
/** If the event has been handled by any event handler. */
|
|
21
|
+
handled: boolean;
|
|
35
22
|
lastReturnValue: unknown;
|
|
36
23
|
stopPropagation: boolean;
|
|
37
24
|
}
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
* The current implementation of the rendering layer is still in use.
|
|
42
|
-
*
|
|
43
|
-
* @deprecated use rxjs instead
|
|
44
|
-
*/
|
|
45
|
-
export declare class Observer<T = void> {
|
|
46
|
-
/**
|
|
47
|
-
* Defines the callback to call when the observer is notified
|
|
48
|
-
*/
|
|
49
|
-
callback: (eventData: T, eventState: EventState) => void;
|
|
50
|
-
observable: Observable<T>;
|
|
51
|
-
dispose(): void;
|
|
52
|
-
/**
|
|
53
|
-
* Creates a new observer
|
|
54
|
-
* @param callback defines the callback to call when the observer is notified
|
|
55
|
-
*/
|
|
56
|
-
constructor(
|
|
57
|
-
/**
|
|
58
|
-
* Defines the callback to call when the observer is notified
|
|
59
|
-
*/
|
|
60
|
-
callback: (eventData: T, eventState: EventState) => void, observable: Observable<T>);
|
|
25
|
+
export interface IEventObserver<T> extends Partial<RxObserver<[T, EventState]>> {
|
|
26
|
+
next?: (value: [T, EventState]) => unknown;
|
|
27
|
+
priority?: number;
|
|
61
28
|
}
|
|
62
29
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
30
|
+
* This is a custom implementation of RxJS subject. It handles events on canvas elements.
|
|
31
|
+
* In addition to the event, it also emits a state object that can be used to controls the
|
|
32
|
+
* propagation of the event.
|
|
65
33
|
*
|
|
66
|
-
* @deprecated use rxjs instead
|
|
67
|
-
*
|
|
68
|
-
* @remarks
|
|
69
|
-
* There's one slight particularity though: a given Observable can notify its observer using a particular mask value, only the Observers registered with this mask value will be notified.
|
|
70
|
-
* This enable a more fine grained execution without having to rely on multiple different Observable objects.
|
|
71
|
-
* For instance you may have a given Observable that have four different types of notifications: Move (mask = 0x01), Stop (mask = 0x02), Turn Right (mask = 0X04), Turn Left (mask = 0X08).
|
|
72
|
-
* A given observer can register itself with only Move and Stop (mask = 0x03), then it will only be notified when one of these two occurs and will never be for Turn Left/Right.
|
|
73
34
|
*/
|
|
74
|
-
export declare class
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
*/
|
|
86
|
-
get observers(): Array<Observer<T>>;
|
|
87
|
-
/**
|
|
88
|
-
* Create a new WorkBookObserver with the specified callback
|
|
89
|
-
* @param callback the callback that will be executed for that WorkBookObserver
|
|
90
|
-
* @param insertFirst if true the callback will be inserted at the first position, hence executed before the others ones. If false (default behavior) the callback will be inserted at the last position, executed after all the others already present.
|
|
91
|
-
* @param unregisterOnFirstCall defines if the observer as to be unregistered after the next notification
|
|
92
|
-
* @returns the new observer created for the callback
|
|
93
|
-
*/
|
|
94
|
-
add(callback: (eventData: T, eventState: EventState) => void, insertFirst?: boolean): Nullable<Observer<T>>;
|
|
95
|
-
/**
|
|
96
|
-
* Remove an WorkBookObserver from the Observable object
|
|
97
|
-
* @param observer the instance of the WorkBookObserver to remove
|
|
98
|
-
* @returns false if it doesn't belong to this Observable
|
|
99
|
-
*/
|
|
100
|
-
remove(observer: Nullable<Observer<T>>): boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Moves the observable to the top of the observer list making it get called first when notified
|
|
103
|
-
* @param observer the observer to move
|
|
104
|
-
*/
|
|
105
|
-
makeObserverTopPriority(observer: Observer<T>): void;
|
|
106
|
-
/**
|
|
107
|
-
* Moves the observable to the bottom of the observer list making it get called last when notified
|
|
108
|
-
* @param observer the observer to move
|
|
109
|
-
*/
|
|
110
|
-
makeObserverBottomPriority(observer: Observer<T>): void;
|
|
111
|
-
/**
|
|
112
|
-
* Notify all Observers by calling their respective callback with the given data
|
|
113
|
-
* Will return true if all observers were executed, false if an observer set skipNextObservers to true, then prevent the subsequent ones to execute
|
|
114
|
-
* @param eventData defines the data to send to all observers
|
|
115
|
-
* @returns false if the complete observer chain was not processed (because one observer set the skipNextObservers to true)
|
|
116
|
-
*/
|
|
117
|
-
notifyObservers(eventData: T): Nullable<INotifyObserversReturn>;
|
|
118
|
-
/**
|
|
119
|
-
* Calling this will execute each callback, expecting it to be a promise or return a value.
|
|
120
|
-
* If at any point in the chain one function fails, the promise will fail and the execution will not continue.
|
|
121
|
-
* This is useful when a chain of Events (sometimes async Events) is needed to initialize a certain object
|
|
122
|
-
* and it is crucial that all callbacks will be executed.
|
|
123
|
-
* The order of the callbacks is kept, callbacks are not executed parallel.
|
|
124
|
-
*
|
|
125
|
-
* @param eventData The data to be sent to each callback
|
|
126
|
-
* @returns {Promise<T>} will return a Promise than resolves when all callbacks executed successfully.
|
|
127
|
-
*/
|
|
128
|
-
notifyObserversWithPromise(eventData: T): Promise<T>;
|
|
129
|
-
/**
|
|
130
|
-
* Notify a specific observer
|
|
131
|
-
* @param observer defines the observer to notify
|
|
132
|
-
* @param eventData defines the data to be sent to each callback
|
|
133
|
-
*/
|
|
134
|
-
notifyObserver(observer: Observer<T>, eventData: T): Nullable<INotifyObserversReturn>;
|
|
135
|
-
/**
|
|
136
|
-
* Gets a boolean indicating if the observable has at least one observer
|
|
137
|
-
* @returns true is the Observable has at least one WorkBookObserver registered
|
|
138
|
-
*/
|
|
139
|
-
hasObservers(): boolean;
|
|
140
|
-
/**
|
|
141
|
-
* Clear the list of observers
|
|
142
|
-
*/
|
|
143
|
-
clear(): void;
|
|
144
|
-
/**
|
|
145
|
-
* Clone the current observable
|
|
146
|
-
* @returns a new observable
|
|
147
|
-
*/
|
|
148
|
-
clone(): Observable<T>;
|
|
149
|
-
private _remove;
|
|
35
|
+
export declare class EventSubject<T> extends Subject<[T, EventState]> {
|
|
36
|
+
private _sortedObservers;
|
|
37
|
+
/** @deprecated Use `subscribeEvent` instead. */
|
|
38
|
+
subscribe(): Subscription;
|
|
39
|
+
/** @deprecated Use `emitEvent` instead. */
|
|
40
|
+
next(): void;
|
|
41
|
+
unsubscribe(): void;
|
|
42
|
+
complete(): void;
|
|
43
|
+
subscribeEvent(observer: IEventObserver<T> | ((evt: T, state: EventState) => unknown)): Subscription;
|
|
44
|
+
clearObservers(): void;
|
|
45
|
+
emitEvent(event: T): INotifyObserversReturn;
|
|
150
46
|
}
|
|
151
47
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ICommandService, Univer } from '@univerjs/core';
|
|
2
|
+
import { Dependency } from '@wendellhu/redi';
|
|
3
|
+
|
|
4
|
+
export declare const createTestBed: (dependencies?: Dependency[]) => {
|
|
5
|
+
univer: Univer;
|
|
6
|
+
get: {
|
|
7
|
+
<T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, lookUp?: import('@wendellhu/redi').LookUp): T;
|
|
8
|
+
<T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.MANY, lookUp?: import('@wendellhu/redi').LookUp): T[];
|
|
9
|
+
<T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.OPTIONAL, lookUp?: import('@wendellhu/redi').LookUp): T | null;
|
|
10
|
+
<T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.REQUIRED, lookUp?: import('@wendellhu/redi').LookUp): T;
|
|
11
|
+
<T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity?: import('@wendellhu/redi').Quantity, lookUp?: import('@wendellhu/redi').LookUp): T[] | T | null;
|
|
12
|
+
<T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantityOrLookup?: import('@wendellhu/redi').Quantity | import('@wendellhu/redi').LookUp, lookUp?: import('@wendellhu/redi').LookUp): T[] | T | null;
|
|
13
|
+
};
|
|
14
|
+
workbook: import('@univerjs/core').Workbook;
|
|
15
|
+
unitId: string;
|
|
16
|
+
subUnitId: string;
|
|
17
|
+
commandService: ICommandService;
|
|
18
|
+
};
|
|
@@ -84,6 +84,7 @@ export interface IExecutionOptions {
|
|
|
84
84
|
onlyLocal?: boolean;
|
|
85
85
|
/** This command is from collaboration peers. */
|
|
86
86
|
fromCollab?: boolean;
|
|
87
|
+
fromChangeset?: boolean;
|
|
87
88
|
[key: PropertyKey]: string | number | boolean | undefined;
|
|
88
89
|
}
|
|
89
90
|
export type CommandListener = (commandInfo: Readonly<ICommandInfo>, options?: IExecutionOptions) => void;
|
|
@@ -18,7 +18,7 @@ export interface IUniverInstanceService {
|
|
|
18
18
|
unitAdded$: Observable<UnitModel>;
|
|
19
19
|
/** Subscribe to curtain type of units' creation. */
|
|
20
20
|
getTypeOfUnitAdded$<T extends UnitModel>(type: UnitType): Observable<T>;
|
|
21
|
-
/** @
|
|
21
|
+
/** @ignore */
|
|
22
22
|
__addUnit(unit: UnitModel): void;
|
|
23
23
|
/** Omits value when a UnitModel is disposed. */
|
|
24
24
|
unitDisposed$: Observable<UnitModel>;
|
|
@@ -3,6 +3,7 @@ import { IWorkbookData } from '../../types/interfaces';
|
|
|
3
3
|
import { IResourceManagerService } from '../resource-manager/type';
|
|
4
4
|
import { IUniverInstanceService } from '../instance/instance.service';
|
|
5
5
|
import { Disposable } from '../../shared/lifecycle';
|
|
6
|
+
import { DocumentDataModel } from '../../docs';
|
|
6
7
|
import { IResourceLoaderService } from './type';
|
|
7
8
|
|
|
8
9
|
export declare class ResourceLoaderService extends Disposable implements IResourceLoaderService {
|
|
@@ -11,4 +12,5 @@ export declare class ResourceLoaderService extends Disposable implements IResour
|
|
|
11
12
|
constructor(_resourceManagerService: IResourceManagerService, _univerInstanceService: IUniverInstanceService);
|
|
12
13
|
private _init;
|
|
13
14
|
saveWorkbook: (workbook: Workbook) => IWorkbookData;
|
|
15
|
+
saveDoc(doc: DocumentDataModel): import('../../types/interfaces').IDocumentData;
|
|
14
16
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Workbook } from '../../sheets/workbook';
|
|
2
2
|
import { IWorkbookData } from '../../types/interfaces/i-workbook-data';
|
|
3
|
+
import { IDocumentData } from '../../types/interfaces';
|
|
4
|
+
import { DocumentDataModel } from '../../docs';
|
|
3
5
|
|
|
4
6
|
export interface IResourceLoaderService {
|
|
5
7
|
saveWorkbook: (workbook: Workbook) => IWorkbookData;
|
|
8
|
+
saveDoc: (doc: DocumentDataModel) => IDocumentData;
|
|
6
9
|
}
|
|
7
10
|
export declare const IResourceLoaderService: import('@wendellhu/redi').IdentifierDecorator<IResourceLoaderService>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Disposable } from '../../shared/lifecycle';
|
|
2
2
|
import { IWorkbookData } from '../../types/interfaces/i-workbook-data';
|
|
3
|
+
import { UniverInstanceType } from '../../common/unit';
|
|
3
4
|
import { IResourceHook, IResourceManagerService, IResourceName } from './type';
|
|
4
5
|
|
|
5
6
|
export declare class ResourceManagerService extends Disposable implements IResourceManagerService {
|
|
@@ -11,6 +12,10 @@ export declare class ResourceManagerService extends Disposable implements IResou
|
|
|
11
12
|
name: `SHEET_${string}_PLUGIN` | `DOC_${string}_PLUGIN`;
|
|
12
13
|
data: string;
|
|
13
14
|
}[];
|
|
15
|
+
getResourcesByType(unitId: string, type: UniverInstanceType): {
|
|
16
|
+
name: `SHEET_${string}_PLUGIN` | `DOC_${string}_PLUGIN`;
|
|
17
|
+
data: string;
|
|
18
|
+
}[];
|
|
14
19
|
registerPluginResource<T = unknown>(hook: IResourceHook<T>): import('@wendellhu/redi').IDisposable;
|
|
15
20
|
disposePluginResource(pluginName: IResourceName): void;
|
|
16
21
|
loadResources(unitId: string, resources: IWorkbookData['resources']): void;
|
|
@@ -19,6 +19,7 @@ export interface IResourceManagerService {
|
|
|
19
19
|
disposePluginResource: (pluginName: IResourceName) => void;
|
|
20
20
|
getAllResourceHooks: () => IResourceHook[];
|
|
21
21
|
getResources: (unitId: string) => IWorkbookData['resources'];
|
|
22
|
+
getResourcesByType: (unitId: string, type: UniverInstanceType) => IWorkbookData['resources'];
|
|
22
23
|
loadResources: (unitId: string, resources: IWorkbookData['resources']) => void;
|
|
23
24
|
unloadResources(unitId: string): void;
|
|
24
25
|
}
|
|
@@ -21,7 +21,7 @@ export interface IUndoRedoService {
|
|
|
21
21
|
pitchTopRedoElement(): Nullable<IUndoRedoItem>;
|
|
22
22
|
popUndoToRedo(): void;
|
|
23
23
|
popRedoToUndo(): void;
|
|
24
|
-
clearUndoRedo(
|
|
24
|
+
clearUndoRedo(unitId: string): void;
|
|
25
25
|
/**
|
|
26
26
|
* Batch undo redo elements into a single `IUndoRedoItem` util the returned `IDisposable` is called.
|
|
27
27
|
*
|
|
@@ -22,10 +22,10 @@ export declare class UserManagerService {
|
|
|
22
22
|
private _model;
|
|
23
23
|
private _userChange$;
|
|
24
24
|
userChange$: import('rxjs').Observable<{
|
|
25
|
-
type:
|
|
25
|
+
type: "add" | "delete";
|
|
26
26
|
user: IUser;
|
|
27
27
|
} | {
|
|
28
|
-
type:
|
|
28
|
+
type: "clear";
|
|
29
29
|
}>;
|
|
30
30
|
private _currentUser$;
|
|
31
31
|
/**
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
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
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { IRange } from '../types/interfaces';
|
|
2
2
|
import { ICellData, ICellDataForSheetInterceptor } from '../types/interfaces/i-cell-data';
|
|
3
3
|
import { IDocumentData } from '../types/interfaces/i-document-data';
|
|
4
|
-
import { IRangeWithCoord, ISelectionCell,
|
|
4
|
+
import { IRangeWithCoord, ISelectionCell, ISelectionCellWithMergeInfo } from '../types/interfaces/i-selection-data';
|
|
5
5
|
import { IColorStyle, IStyleData } from '../types/interfaces/i-style-data';
|
|
6
6
|
import { Nullable } from './types';
|
|
7
7
|
|
|
8
|
-
export declare function makeCellToSelection(cellInfo: Nullable<
|
|
8
|
+
export declare function makeCellToSelection(cellInfo: Nullable<ISelectionCellWithMergeInfo>): Nullable<IRangeWithCoord>;
|
|
9
9
|
export declare function makeCellRangeToRangeData(cellInfo: Nullable<ISelectionCell>): Nullable<IRange>;
|
|
10
10
|
export declare function isEmptyCell(cell: Nullable<ICellData>): boolean;
|
|
11
11
|
export declare function isCellCoverable(cell: Nullable<ICellDataForSheetInterceptor>): boolean;
|
|
@@ -22,11 +22,6 @@ export declare function isFormulaString(value: any): boolean;
|
|
|
22
22
|
* @returns
|
|
23
23
|
*/
|
|
24
24
|
export declare function isFormulaId(value: any): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Convert rich text json to DOM
|
|
27
|
-
* @param p
|
|
28
|
-
*/
|
|
29
|
-
export declare function handleJsonToDom(p: IDocumentData): string;
|
|
30
25
|
/**
|
|
31
26
|
* transform style object to string
|
|
32
27
|
* @param style
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { IDisposable } from '@wendellhu/redi';
|
|
2
2
|
import { Subscription, SubscriptionLike, Subject } from 'rxjs';
|
|
3
|
-
import { Nullable } from '../common/type-util';
|
|
4
|
-
import { Observer } from '../observer/observable';
|
|
5
3
|
|
|
6
|
-
type DisposableLike = IDisposable |
|
|
4
|
+
type DisposableLike = IDisposable | SubscriptionLike | (() => void);
|
|
7
5
|
export declare function toDisposable(disposable: IDisposable): IDisposable;
|
|
8
|
-
export declare function toDisposable(observer: Nullable<Observer<any>>): IDisposable;
|
|
9
6
|
export declare function toDisposable(subscription: SubscriptionLike): IDisposable;
|
|
10
7
|
export declare function toDisposable(callback: () => void): IDisposable;
|
|
11
8
|
export declare function toDisposable(v: DisposableLike): IDisposable;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
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
|
+
/**
|
|
17
|
+
* The name you entered for the worksheet or chart is invalid. Please ensure:
|
|
18
|
+
|
|
19
|
+
The name is no more than 31 characters.
|
|
20
|
+
The first and last characters cannot be '
|
|
21
|
+
The name does not contain any of the following characters: : \ / ? * [ or ].
|
|
22
|
+
The name is not empty.
|
|
23
|
+
* @param name
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
export declare function nameCharacterCheck(name: string): boolean;
|
|
@@ -2,5 +2,14 @@ import { IDisposable } from '@wendellhu/redi';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
|
|
4
4
|
type CallbackFn<T extends readonly unknown[]> = (cb: (...args: T) => void) => IDisposable;
|
|
5
|
+
/**
|
|
6
|
+
* Creates an observable from a callback function.
|
|
7
|
+
*
|
|
8
|
+
* @param callback The callback function that will be called when the observable is subscribed to. **Please not that the
|
|
9
|
+
* if the callback function has `this` context, it will be lost when the callback is called. So you probably
|
|
10
|
+
* should bind the callback to the correct context.**
|
|
11
|
+
*
|
|
12
|
+
* @returns The observable that will emit when the callback function gets called.
|
|
13
|
+
*/
|
|
5
14
|
export declare function fromCallback<T extends readonly unknown[]>(callback: CallbackFn<T>): Observable<T>;
|
|
6
15
|
export {};
|
|
@@ -36,6 +36,7 @@ export declare class Tools {
|
|
|
36
36
|
static isWeChat(): boolean;
|
|
37
37
|
static isAndroid(): boolean;
|
|
38
38
|
static isIPhone(): boolean;
|
|
39
|
+
static isLegalUrl(url: string): boolean;
|
|
39
40
|
static itCount(count: number): Function;
|
|
40
41
|
static hasLength(target: IArguments | any[] | string, length?: number): boolean;
|
|
41
42
|
static capitalize(str: string): string;
|
|
@@ -105,4 +106,5 @@ export declare class Tools {
|
|
|
105
106
|
* @param value
|
|
106
107
|
*/
|
|
107
108
|
static set(data: Record<string, any>, propertyPath: string, value: any): void;
|
|
109
|
+
static clamp(value: number, min: number, max: number): number;
|
|
108
110
|
}
|
|
@@ -4,12 +4,12 @@ import { IWorkbookData } from '../../types/interfaces/i-workbook-data';
|
|
|
4
4
|
export declare function createCoreTestBed(workbookData?: IWorkbookData): {
|
|
5
5
|
univer: Univer;
|
|
6
6
|
get: {
|
|
7
|
-
<T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, lookUp?: import('@wendellhu/redi').LookUp
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
<
|
|
7
|
+
<T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, lookUp?: import('@wendellhu/redi').LookUp): T;
|
|
8
|
+
<T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.MANY, lookUp?: import('@wendellhu/redi').LookUp): T[];
|
|
9
|
+
<T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.OPTIONAL, lookUp?: import('@wendellhu/redi').LookUp): T | null;
|
|
10
|
+
<T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.REQUIRED, lookUp?: import('@wendellhu/redi').LookUp): T;
|
|
11
|
+
<T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity?: import('@wendellhu/redi').Quantity, lookUp?: import('@wendellhu/redi').LookUp): T[] | T | null;
|
|
12
|
+
<T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantityOrLookup?: import('@wendellhu/redi').Quantity | import('@wendellhu/redi').LookUp, lookUp?: import('@wendellhu/redi').LookUp): T[] | T | null;
|
|
13
13
|
};
|
|
14
14
|
sheet: import('../workbook').Workbook;
|
|
15
15
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IObjectMatrixPrimitiveType, Nullable, ObjectMatrix } from '../shared';
|
|
2
|
-
import { HorizontalAlign, VerticalAlign,
|
|
2
|
+
import { HorizontalAlign, VerticalAlign, BooleanNumber, FontItalic, FontWeight, WrapStrategy } from '../types/enum';
|
|
3
3
|
import { IBorderData, ICellData, IDocumentBody, IDocumentData, IRange, IStyleBase, IStyleData, ITextDecoration, ITextRotation } from '../types/interfaces';
|
|
4
4
|
import { Styles } from './styles';
|
|
5
5
|
import { Worksheet } from './worksheet';
|
|
@@ -275,10 +275,6 @@ export declare class Range {
|
|
|
275
275
|
* Returns whether the text in the cell wraps.
|
|
276
276
|
*/
|
|
277
277
|
getWrap(): BooleanNumber;
|
|
278
|
-
/**
|
|
279
|
-
* Returns whether the text in the cells wrap.
|
|
280
|
-
*/
|
|
281
|
-
getWraps(): BooleanNumber[][];
|
|
282
278
|
/**
|
|
283
279
|
* Returns the text wrapping strategies for the cells in the range.
|
|
284
280
|
*/
|
|
@@ -83,6 +83,7 @@ export declare class Workbook extends UnitModel<IWorkbookData, UniverInstanceTyp
|
|
|
83
83
|
getSheetBySheetId(sheetId: string): Nullable<Worksheet>;
|
|
84
84
|
getSheetByIndex(index: number): Nullable<Worksheet>;
|
|
85
85
|
getHiddenWorksheets(): string[];
|
|
86
|
+
getUnhiddenWorksheets(): string[];
|
|
86
87
|
load(config: IWorkbookData): void;
|
|
87
88
|
/**
|
|
88
89
|
* Check if sheet name is unique
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
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
|
+
export declare const skipParseTagNames: string[];
|