@univerjs/core 0.4.1 → 0.4.2-nightly.202410301606
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/es/index.js +2653 -1711
- package/lib/types/common/__tests__/interceptor.spec.d.ts +16 -0
- package/lib/types/common/const.d.ts +1 -0
- package/lib/types/common/interceptor.d.ts +17 -0
- package/lib/types/docs/data-model/json-x/json-x.d.ts +2 -2
- package/lib/types/docs/data-model/text-x/__tests__/apply.spec.d.ts +16 -0
- package/lib/types/docs/data-model/text-x/__tests__/transform-paragraph.spec.d.ts +16 -0
- package/lib/types/docs/data-model/text-x/__tests__/transform-textrun.spec.d.ts +16 -0
- package/lib/types/docs/data-model/text-x/action-types.d.ts +0 -5
- package/lib/types/docs/data-model/text-x/apply-utils/update-apply.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/build-utils/custom-range.d.ts +9 -1
- package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +3 -3
- package/lib/types/docs/data-model/text-x/text-x.d.ts +4 -4
- package/lib/types/docs/data-model/text-x/transform-utils.d.ts +7 -1
- package/lib/types/docs/data-model/utils.d.ts +20 -0
- package/lib/types/facade/f-base.d.ts +26 -0
- package/lib/types/facade/f-hooks.d.ts +57 -0
- package/lib/types/facade/f-univer.d.ts +76 -0
- package/lib/types/index.d.ts +6 -3
- package/lib/types/services/config/config.service.d.ts +10 -1
- package/lib/types/services/permission/permission.service.d.ts +3 -0
- package/lib/types/services/permission/type.d.ts +2 -0
- package/lib/types/services/resource-loader/resource-loader.service.d.ts +3 -3
- package/lib/types/shared/__tests__/compose.spec.d.ts +16 -0
- package/lib/types/shared/command-enum.d.ts +1 -2
- package/lib/types/shared/lifecycle.d.ts +1 -1
- package/lib/types/shared/r-tree.d.ts +21 -4
- package/lib/types/shared/rectangle.d.ts +1 -0
- package/lib/types/shared/rxjs.d.ts +1 -0
- package/lib/types/shared/tools.d.ts +9 -2
- package/lib/types/sheets/column-manager.d.ts +19 -2
- package/lib/types/sheets/row-manager.d.ts +22 -4
- package/lib/types/sheets/typedef.d.ts +32 -2
- package/lib/types/sheets/util.d.ts +35 -0
- package/lib/types/sheets/view-model.d.ts +2 -2
- package/lib/types/sheets/worksheet.d.ts +84 -2
- package/lib/types/types/enum/data-validation-type.d.ts +2 -1
- package/lib/types/types/interfaces/i-document-data.d.ts +3 -2
- package/lib/umd/index.js +9 -9
- package/package.json +10 -13
- package/LICENSE +0 -176
- package/lib/cjs/index.js +0 -10
|
@@ -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 {};
|
|
@@ -17,5 +17,6 @@ export declare const DOCS_NORMAL_EDITOR_UNIT_ID_KEY = "__INTERNAL_EDITOR__DOCS_N
|
|
|
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
19
|
export declare const DEFAULT_EMPTY_DOCUMENT_VALUE = "\r\n";
|
|
20
|
+
export declare const IS_ROW_STYLE_PRECEDE_COLUMN_STYLE = "isRowStylePrecedeColumnStyle";
|
|
20
21
|
export declare function createInternalEditorID(id: string): string;
|
|
21
22
|
export declare function isInternalEditorID(id: string): boolean;
|
|
@@ -26,3 +26,20 @@ export declare class InterceptorManager<P extends Record<string, IInterceptor<an
|
|
|
26
26
|
getInterceptPoints(): P;
|
|
27
27
|
dispose(): void;
|
|
28
28
|
}
|
|
29
|
+
export declare function createAsyncInterceptorKey<T, C>(key: string): IAsyncInterceptor<T, C>;
|
|
30
|
+
export type AsyncInterceptorHandler<M = unknown, C = unknown> = (value: Nullable<M>, context: C, next: (value: Nullable<M>) => Promise<Nullable<M>>) => Promise<Nullable<M>>;
|
|
31
|
+
export interface IAsyncInterceptor<M, C> {
|
|
32
|
+
priority?: number;
|
|
33
|
+
handler: AsyncInterceptorHandler<M, C>;
|
|
34
|
+
}
|
|
35
|
+
export type IComposeAsyncInterceptors<T = any, C = any> = (interceptors: Array<IAsyncInterceptor<T, C>>) => (initValue: Nullable<T>, initContext: C) => Promise<Nullable<T>>;
|
|
36
|
+
export declare const composeAsyncInterceptors: <T, C>(interceptors: Array<IAsyncInterceptor<T, C>>) => ((initialValue: Nullable<T>, context: C) => Promise<Nullable<T>>);
|
|
37
|
+
export declare class AsyncInterceptorManager<P extends Record<string, IAsyncInterceptor<any, any>>> {
|
|
38
|
+
private _asyncInterceptorsByName;
|
|
39
|
+
private _asyncInterceptorPoints;
|
|
40
|
+
constructor(asyncInterceptorPoints: P);
|
|
41
|
+
fetchThroughAsyncInterceptors<T, C>(name: IAsyncInterceptor<T, C>): (initialValue: Nullable<T>, context: C) => Promise<Nullable<T>>;
|
|
42
|
+
interceptAsync<T extends IAsyncInterceptor<any, any>>(name: T, interceptor: T): Promise<() => boolean>;
|
|
43
|
+
getInterceptPoints(): P;
|
|
44
|
+
dispose(): void;
|
|
45
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Doc, JSONOp, Path } from 'ot-json1';
|
|
2
2
|
import { IDocumentBody, IDocumentData } from '../../../types/interfaces';
|
|
3
|
-
import { TPriority } from '../text-x/text-x';
|
|
4
3
|
import { TextXAction } from '../text-x/action-types';
|
|
4
|
+
import { TPriority } from '../text-x/text-x';
|
|
5
5
|
import * as json1 from 'ot-json1';
|
|
6
6
|
export interface ISubType {
|
|
7
7
|
name: string;
|
|
@@ -15,7 +15,7 @@ export interface ISubType {
|
|
|
15
15
|
makeInvertible?: (actions: TextXAction[], doc: IDocumentBody) => TextXAction[];
|
|
16
16
|
[k: string]: any;
|
|
17
17
|
}
|
|
18
|
-
export {
|
|
18
|
+
export { json1 as JSON1, JSONOp as JSONXActions, Path as JSONXPath };
|
|
19
19
|
export declare class JSONX {
|
|
20
20
|
static uri: string;
|
|
21
21
|
private static _subTypes;
|
|
@@ -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 {};
|
|
@@ -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 {};
|
|
@@ -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 {};
|
|
@@ -14,7 +14,6 @@ export interface IRetainAction {
|
|
|
14
14
|
body?: IDocumentBody;
|
|
15
15
|
oldBody?: IDocumentBody;
|
|
16
16
|
coverType?: UpdateDocsAttributeType;
|
|
17
|
-
segmentId?: string;
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
19
|
* Insert mutation is used to insert text (maybe with rich text properties) at the given position.
|
|
@@ -23,8 +22,6 @@ export interface IInsertAction {
|
|
|
23
22
|
t: TextXActionType.INSERT;
|
|
24
23
|
body: IDocumentBody;
|
|
25
24
|
len: number;
|
|
26
|
-
line: number;
|
|
27
|
-
segmentId?: string;
|
|
28
25
|
}
|
|
29
26
|
/**
|
|
30
27
|
* Delete mutation is used to delete text at the given position.
|
|
@@ -32,8 +29,6 @@ export interface IInsertAction {
|
|
|
32
29
|
export interface IDeleteAction {
|
|
33
30
|
t: TextXActionType.DELETE;
|
|
34
31
|
len: number;
|
|
35
|
-
line: number;
|
|
36
32
|
body?: IDocumentBody;
|
|
37
|
-
segmentId?: string;
|
|
38
33
|
}
|
|
39
34
|
export type TextXAction = IRetainAction | IInsertAction | IDeleteAction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IDocumentBody, ITextRun } from '../../../../types/interfaces';
|
|
2
2
|
import { UpdateDocsAttributeType } from '../../../../shared';
|
|
3
3
|
export declare function updateAttribute(body: IDocumentBody, updateBody: IDocumentBody, textLength: number, currentIndex: number, coverType: UpdateDocsAttributeType): IDocumentBody;
|
|
4
|
-
export declare function coverTextRuns(updateDataTextRuns: ITextRun[],
|
|
4
|
+
export declare function coverTextRuns(updateDataTextRuns: ITextRun[], originTextRuns: ITextRun[], coverType: UpdateDocsAttributeType): ITextRun[];
|
|
@@ -2,9 +2,17 @@ import { ITextRange } from '../../../../sheets/typedef';
|
|
|
2
2
|
import { ICustomRange } from '../../../../types/interfaces';
|
|
3
3
|
import { DataStreamTreeTokenType } from '../../types';
|
|
4
4
|
export declare function isCustomRangeSplitSymbol(text: string): text is DataStreamTreeTokenType.CUSTOM_RANGE_START | DataStreamTreeTokenType.CUSTOM_RANGE_END;
|
|
5
|
+
/**
|
|
6
|
+
* Check if two ranges intersect
|
|
7
|
+
* @param line1Start - The start of the first range
|
|
8
|
+
* @param line1End - The end of the first range
|
|
9
|
+
* @param line2Start - The start of the second range
|
|
10
|
+
* @param line2End - The end of the second range
|
|
11
|
+
* @returns True if the ranges intersect, false otherwise
|
|
12
|
+
*/
|
|
5
13
|
export declare function isIntersecting(line1Start: number, line1End: number, line2Start: number, line2End: number): boolean;
|
|
6
14
|
export declare function shouldDeleteCustomRange(deleteStart: number, deleteLen: number, customRange: ICustomRange, dataStream: string): boolean;
|
|
7
|
-
export declare function
|
|
15
|
+
export declare function getCustomRangesInterestsWithSelection(range: ITextRange, customRanges: ICustomRange[]): ICustomRange<Record<string, any>>[];
|
|
8
16
|
export declare function copyCustomRange(range: ICustomRange): {
|
|
9
17
|
rangeId: string;
|
|
10
18
|
startIndex: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { copyCustomRange,
|
|
1
|
+
import { copyCustomRange, getCustomRangesInterestsWithSelection, isIntersecting, shouldDeleteCustomRange } from './custom-range';
|
|
2
2
|
import { getDeleteSelection, getInsertSelection, getRetainAndDeleteFromReplace, isSegmentIntersects, makeSelection, normalizeSelection } from './selection';
|
|
3
3
|
import { addCustomRangeTextX, deleteCustomRangeTextX, getRetainAndDeleteAndExcludeLineBreak } from './text-x-utils';
|
|
4
4
|
export declare class BuildTextUtils {
|
|
@@ -6,7 +6,7 @@ export declare class BuildTextUtils {
|
|
|
6
6
|
add: typeof addCustomRangeTextX;
|
|
7
7
|
delete: typeof deleteCustomRangeTextX;
|
|
8
8
|
copyCustomRange: typeof copyCustomRange;
|
|
9
|
-
|
|
9
|
+
getCustomRangesInterestsWithSelection: typeof getCustomRangesInterestsWithSelection;
|
|
10
10
|
shouldDeleteCustomRange: typeof shouldDeleteCustomRange;
|
|
11
11
|
isIntersecting: typeof isIntersecting;
|
|
12
12
|
};
|
|
@@ -17,7 +17,7 @@ export declare class BuildTextUtils {
|
|
|
17
17
|
getDeleteSelection: typeof getDeleteSelection;
|
|
18
18
|
getInsertSelection: typeof getInsertSelection;
|
|
19
19
|
getDeleteActions: typeof getRetainAndDeleteFromReplace;
|
|
20
|
-
|
|
20
|
+
getDeleteExcludeLastLineBreakActions: typeof getRetainAndDeleteAndExcludeLineBreak;
|
|
21
21
|
};
|
|
22
22
|
static range: {
|
|
23
23
|
isIntersects: typeof isSegmentIntersects;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UpdateDocsAttributeType } from '../../../shared/command-enum';
|
|
2
1
|
import { IDocumentBody } from '../../../types/interfaces/i-document-data';
|
|
2
|
+
import { UpdateDocsAttributeType } from '../../../shared/command-enum';
|
|
3
3
|
import { TextXAction } from './action-types';
|
|
4
4
|
export type TPriority = 'left' | 'right';
|
|
5
5
|
export declare class TextX {
|
|
@@ -42,9 +42,9 @@ export declare class TextX {
|
|
|
42
42
|
static invert(actions: TextXAction[]): TextXAction[];
|
|
43
43
|
static makeInvertible(actions: TextXAction[], doc: IDocumentBody): TextXAction[];
|
|
44
44
|
private _actions;
|
|
45
|
-
insert(len: number, body: IDocumentBody
|
|
46
|
-
retain(len: number,
|
|
47
|
-
delete(len: number
|
|
45
|
+
insert(len: number, body: IDocumentBody): this;
|
|
46
|
+
retain(len: number, body?: IDocumentBody, coverType?: UpdateDocsAttributeType): this;
|
|
47
|
+
delete(len: number): this;
|
|
48
48
|
empty(): this;
|
|
49
49
|
serialize(): TextXAction[];
|
|
50
50
|
push(...args: TextXAction[]): this;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { IDocumentBody } from '../../../types/interfaces';
|
|
2
2
|
import { IRetainAction } from './action-types';
|
|
3
|
-
|
|
3
|
+
import { UpdateDocsAttributeType } from '../../../shared';
|
|
4
|
+
interface ITransformBodyResult {
|
|
5
|
+
body: IDocumentBody;
|
|
6
|
+
coverType: UpdateDocsAttributeType;
|
|
7
|
+
}
|
|
8
|
+
export declare function transformBody(thisAction: IRetainAction, otherAction: IRetainAction, priority?: boolean): ITransformBodyResult;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IStyleBase, ITextRotation } from '../../types/interfaces';
|
|
2
|
+
export declare const DEFAULT_FONTFACE_PLANE = "\"Helvetica Neue\", Helvetica, Arial, \"PingFang SC\", \"Hiragino Sans GB\", \"Heiti SC\", \"Microsoft YaHei\", \"WenQuanYi Micro Hei\", sans-serif";
|
|
3
|
+
export interface IDocumentSkeletonFontStyle {
|
|
4
|
+
fontString: string;
|
|
5
|
+
fontSize: number;
|
|
6
|
+
originFontSize: number;
|
|
7
|
+
fontFamily: string;
|
|
8
|
+
fontCache: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function getFontStyleString(textStyle?: IStyleBase): IDocumentSkeletonFontStyle;
|
|
11
|
+
export declare function getBaselineOffsetInfo(_fontFamily: string, fontSize: number): {
|
|
12
|
+
sbr: number;
|
|
13
|
+
sbo: number;
|
|
14
|
+
spr: number;
|
|
15
|
+
spo: number;
|
|
16
|
+
};
|
|
17
|
+
export declare function convertTextRotation(textRotation?: ITextRotation): {
|
|
18
|
+
centerAngle: number;
|
|
19
|
+
vertexAngle: number;
|
|
20
|
+
};
|
|
@@ -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
|
+
* `FBase` is a base class for all facade classes.
|
|
18
|
+
* It provides a way to extend classes with static and instance methods.
|
|
19
|
+
* The `_initialize` as a special method that will be called after the constructor. You should never call it directly.
|
|
20
|
+
*/
|
|
21
|
+
export declare abstract class FBase {
|
|
22
|
+
private static _constructorQueue;
|
|
23
|
+
constructor();
|
|
24
|
+
_initialize(): void;
|
|
25
|
+
static extend(source: any): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { IDisposable, Injector } from '../common/di';
|
|
2
|
+
import { IUndoRedoItem } from '../services/undoredo/undoredo.service';
|
|
3
|
+
import { LifecycleService } from '../services/lifecycle/lifecycle.service';
|
|
4
|
+
import { FBase } from './f-base';
|
|
5
|
+
export declare class FHooks extends FBase {
|
|
6
|
+
protected readonly _injector: Injector;
|
|
7
|
+
private readonly _lifecycleService;
|
|
8
|
+
constructor(_injector: Injector, _lifecycleService: LifecycleService);
|
|
9
|
+
/**
|
|
10
|
+
* The onStarting event is fired when lifecycle stage is Starting.
|
|
11
|
+
* @param callback Callback function that will be called when the event is fired
|
|
12
|
+
* @returns A disposable object that can be used to unsubscribe from the event
|
|
13
|
+
*/
|
|
14
|
+
onStarting(callback: () => void): IDisposable;
|
|
15
|
+
/**
|
|
16
|
+
* The onReady event is fired when lifecycle stage is Ready.
|
|
17
|
+
* @param callback Callback function that will be called when the event is fired
|
|
18
|
+
* @returns A disposable object that can be used to unsubscribe from the event
|
|
19
|
+
*/
|
|
20
|
+
onReady(callback: () => void): IDisposable;
|
|
21
|
+
/**
|
|
22
|
+
* The onRendered event is fired when lifecycle stage is Rendered.
|
|
23
|
+
* @param callback Callback function that will be called when the event is fired
|
|
24
|
+
* @returns A disposable object that can be used to unsubscribe from the event
|
|
25
|
+
*/
|
|
26
|
+
onRendered(callback: () => void): IDisposable;
|
|
27
|
+
/**
|
|
28
|
+
* The onSteady event is fired when lifecycle stage is Steady.
|
|
29
|
+
* @param callback Callback function that will be called when the event is fired
|
|
30
|
+
* @returns A disposable object that can be used to unsubscribe from the event
|
|
31
|
+
*/
|
|
32
|
+
onSteady(callback: () => void): IDisposable;
|
|
33
|
+
/**
|
|
34
|
+
* Hook that fires before an undo operation is executed.
|
|
35
|
+
* @param callback Function to be called when the event is triggered
|
|
36
|
+
* @returns A disposable object that can be used to unsubscribe from the event
|
|
37
|
+
*/
|
|
38
|
+
onBeforeUndo(callback: (action: IUndoRedoItem) => void): IDisposable;
|
|
39
|
+
/**
|
|
40
|
+
* Hook that fires after an undo operation is executed.
|
|
41
|
+
* @param callback Function to be called when the event is triggered
|
|
42
|
+
* @returns A disposable object that can be used to unsubscribe from the event
|
|
43
|
+
*/
|
|
44
|
+
onUndo(callback: (action: IUndoRedoItem) => void): IDisposable;
|
|
45
|
+
/**
|
|
46
|
+
* Hook that fires before a redo operation is executed.
|
|
47
|
+
* @param callback Function to be called when the event is triggered
|
|
48
|
+
* @returns A disposable object that can be used to unsubscribe from the event
|
|
49
|
+
*/
|
|
50
|
+
onBeforeRedo(callback: (action: IUndoRedoItem) => void): IDisposable;
|
|
51
|
+
/**
|
|
52
|
+
* Hook that fires after a redo operation is executed.
|
|
53
|
+
* @param callback Function to be called when the event is triggered
|
|
54
|
+
* @returns A disposable object that can be used to unsubscribe from the event
|
|
55
|
+
*/
|
|
56
|
+
onRedo(callback: (action: IUndoRedoItem) => void): IDisposable;
|
|
57
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { IDisposable, Injector } from '../common/di';
|
|
2
|
+
import { CommandListener, IExecutionOptions, ICommandService } from '../services/command/command.service';
|
|
3
|
+
import { LifecycleStages } from '../services/lifecycle/lifecycle';
|
|
4
|
+
import { IUniverInstanceService } from '../services/instance/instance.service';
|
|
5
|
+
import { Univer } from '../univer';
|
|
6
|
+
import { FBase } from './f-base';
|
|
7
|
+
import { FHooks } from './f-hooks';
|
|
8
|
+
export declare class FUniver extends FBase {
|
|
9
|
+
protected readonly _injector: Injector;
|
|
10
|
+
protected readonly _commandService: ICommandService;
|
|
11
|
+
protected readonly _univerInstanceService: IUniverInstanceService;
|
|
12
|
+
/**
|
|
13
|
+
* Create an FUniver instance, if the injector is not provided, it will create a new Univer instance.
|
|
14
|
+
*
|
|
15
|
+
* @static
|
|
16
|
+
*
|
|
17
|
+
* @param {Univer | Injector} wrapped - The Univer instance or injector instance.
|
|
18
|
+
* @returns {FUniver} - The FUniver instance.
|
|
19
|
+
*/
|
|
20
|
+
static newAPI(wrapped: Univer | Injector): FUniver;
|
|
21
|
+
constructor(_injector: Injector, _commandService: ICommandService, _univerInstanceService: IUniverInstanceService);
|
|
22
|
+
/**
|
|
23
|
+
* Dispose the UniverSheet by the `unitId`. The UniverSheet would be unload from the application.
|
|
24
|
+
*
|
|
25
|
+
* @param unitId The unit id of the UniverSheet.
|
|
26
|
+
* @returns Whether the Univer instance is disposed successfully.
|
|
27
|
+
*/
|
|
28
|
+
disposeUnit(unitId: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Get the current lifecycle stage.
|
|
31
|
+
*
|
|
32
|
+
* @returns {LifecycleStages} - The current lifecycle stage.
|
|
33
|
+
*/
|
|
34
|
+
getCurrentLifecycleStage(): LifecycleStages;
|
|
35
|
+
/**
|
|
36
|
+
* Undo an editing on the currently focused document.
|
|
37
|
+
*
|
|
38
|
+
* @returns {Promise<boolean>} undo result
|
|
39
|
+
*/
|
|
40
|
+
undo(): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Redo an editing on the currently focused document.
|
|
43
|
+
*
|
|
44
|
+
* @returns {Promise<boolean>} redo result
|
|
45
|
+
*/
|
|
46
|
+
redo(): Promise<boolean>;
|
|
47
|
+
/**
|
|
48
|
+
* Register a callback that will be triggered before invoking a command.
|
|
49
|
+
*
|
|
50
|
+
* @param {CommandListener} callback The callback.
|
|
51
|
+
* @returns {IDisposable} The disposable instance.
|
|
52
|
+
*/
|
|
53
|
+
onBeforeCommandExecute(callback: CommandListener): IDisposable;
|
|
54
|
+
/**
|
|
55
|
+
* Register a callback that will be triggered when a command is invoked.
|
|
56
|
+
*
|
|
57
|
+
* @param {CommandListener} callback The callback.
|
|
58
|
+
* @returns {IDisposable} The disposable instance.
|
|
59
|
+
*/
|
|
60
|
+
onCommandExecuted(callback: CommandListener): IDisposable;
|
|
61
|
+
/**
|
|
62
|
+
* Execute command
|
|
63
|
+
*
|
|
64
|
+
* @param {string} id Command ID
|
|
65
|
+
* @param {object} params Command parameters
|
|
66
|
+
* @param {IExecutionOptions} options Command execution options
|
|
67
|
+
* @returns {Promise<R>} Command execution result
|
|
68
|
+
*/
|
|
69
|
+
executeCommand<P extends object = object, R = boolean>(id: string, params?: P, options?: IExecutionOptions): Promise<R>;
|
|
70
|
+
/**
|
|
71
|
+
* Get hooks.
|
|
72
|
+
*
|
|
73
|
+
* @returns {FHooks} FHooks instance
|
|
74
|
+
*/
|
|
75
|
+
getHooks(): FHooks;
|
|
76
|
+
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -16,16 +16,19 @@
|
|
|
16
16
|
export { debounce, get, merge, mergeWith, set } from 'lodash-es';
|
|
17
17
|
export { dedupe, groupBy, makeArray, remove, rotate } from './common/array';
|
|
18
18
|
export { isBooleanString } from './common/boolean';
|
|
19
|
-
export { createInternalEditorID, DEFAULT_EMPTY_DOCUMENT_VALUE, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, isInternalEditorID, } from './common/const';
|
|
19
|
+
export { createInternalEditorID, DEFAULT_EMPTY_DOCUMENT_VALUE, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, isInternalEditorID, } from './common/const';
|
|
20
20
|
export * from './common/di';
|
|
21
21
|
export { shallowEqual } from './common/equal';
|
|
22
22
|
export { CustomCommandExecutionError } from './common/error';
|
|
23
23
|
export { throttle } from './common/function';
|
|
24
24
|
export type { ICellInterceptor, IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';
|
|
25
|
-
export { composeInterceptors, createInterceptorKey, InterceptorEffectEnum, InterceptorManager } from './common/interceptor';
|
|
25
|
+
export { AsyncInterceptorManager, composeInterceptors, createAsyncInterceptorKey, createInterceptorKey, InterceptorEffectEnum, InterceptorManager } from './common/interceptor';
|
|
26
26
|
export type { Serializable } from './common/json';
|
|
27
27
|
export { MemoryCursor } from './common/memory-cursor';
|
|
28
28
|
export { mixinClass } from './common/mixin';
|
|
29
|
+
export { FBase } from './facade/f-base';
|
|
30
|
+
export { FUniver } from './facade/f-univer';
|
|
31
|
+
export { FHooks } from './facade/f-hooks';
|
|
29
32
|
export { isNumeric, isSafeNumeric } from './common/number';
|
|
30
33
|
export { Registry, RegistryAsMap } from './common/registry';
|
|
31
34
|
export { requestImmediateMacroTask } from './common/request-immediate-macro-task';
|
|
@@ -84,7 +87,7 @@ export { isBlackColor, isWhiteColor } from './shared/color/color-kit';
|
|
|
84
87
|
export { cellToRange } from './shared/common';
|
|
85
88
|
export { getIntersectRange } from './shared/range';
|
|
86
89
|
export { nameCharacterCheck } from './shared/name';
|
|
87
|
-
export { bufferDebounceTime, fromCallback, takeAfter } from './shared/rxjs';
|
|
90
|
+
export { afterTime, bufferDebounceTime, fromCallback, takeAfter } from './shared/rxjs';
|
|
88
91
|
export { awaitTime } from './shared/timer';
|
|
89
92
|
export { Range } from './sheets/range';
|
|
90
93
|
export { 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, mergeWorksheetSnapshotWithDefault, } from './sheets/sheet-snapshot-utils';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { IDisposable } from '../../common/di';
|
|
1
2
|
import { Nullable } from '../../shared/types';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
2
4
|
/**
|
|
3
5
|
* IConfig provides universal configuration for the whole application.
|
|
4
6
|
*/
|
|
@@ -20,11 +22,18 @@ export interface IConfigService {
|
|
|
20
22
|
getConfig<T>(id: string): Nullable<T>;
|
|
21
23
|
setConfig(id: string | symbol, value: unknown, options?: IConfigOptions): void;
|
|
22
24
|
deleteConfig(id: string): boolean;
|
|
25
|
+
subscribeConfigValue$<T = unknown>(key: string): Observable<T>;
|
|
23
26
|
}
|
|
24
|
-
export declare class ConfigService implements IConfigService {
|
|
27
|
+
export declare class ConfigService implements IConfigService, IDisposable {
|
|
28
|
+
private _configChanged$;
|
|
29
|
+
readonly configChanged$: Observable<{
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
}>;
|
|
25
32
|
private readonly _config;
|
|
33
|
+
dispose(): void;
|
|
26
34
|
getConfig<T>(id: string | symbol): Nullable<T>;
|
|
27
35
|
setConfig(id: string, value: unknown, options?: IConfigOptions): void;
|
|
28
36
|
deleteConfig(id: string | symbol): boolean;
|
|
37
|
+
subscribeConfigValue$<T = unknown>(key: string): Observable<T>;
|
|
29
38
|
}
|
|
30
39
|
export {};
|
|
@@ -5,6 +5,9 @@ export declare class PermissionService extends Disposable implements IPermission
|
|
|
5
5
|
private _permissionPointMap;
|
|
6
6
|
private _permissionPointUpdate$;
|
|
7
7
|
permissionPointUpdate$: Observable<IPermissionPoint<unknown>>;
|
|
8
|
+
private _showComponents;
|
|
9
|
+
setShowComponents(showComponents: boolean): void;
|
|
10
|
+
getShowComponents(): boolean;
|
|
8
11
|
deletePermissionPoint(permissionId: string): void;
|
|
9
12
|
addPermissionPoint<T = boolean>(_item: IPermissionPoint<T> | BehaviorSubject<IPermissionPoint<T>>): boolean;
|
|
10
13
|
updatePermissionPoint<T = boolean>(permissionId: string, value: T): void;
|
|
@@ -38,5 +38,7 @@ export interface IPermissionService {
|
|
|
38
38
|
composePermission$(permissionId: string[]): Observable<IPermissionPoint<unknown>[]>;
|
|
39
39
|
composePermission(permissionId: string[]): IPermissionPoint<unknown>[];
|
|
40
40
|
getAllPermissionPoint(): Map<string, Observable<IPermissionPoint<unknown>>>;
|
|
41
|
+
getShowComponents(): boolean;
|
|
42
|
+
setShowComponents(showComponents: boolean): void;
|
|
41
43
|
}
|
|
42
44
|
export declare const IPermissionService: import('@wendellhu/redi').IdentifierDecorator<IPermissionService>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IResourceManagerService } from '../resource-manager/type';
|
|
2
|
-
import { IUniverInstanceService } from '../instance/instance.service';
|
|
3
|
-
import { Disposable } from '../../shared/lifecycle';
|
|
4
1
|
import { IResourceLoaderService } from './type';
|
|
2
|
+
import { Disposable } from '../../shared/lifecycle';
|
|
3
|
+
import { IUniverInstanceService } from '../instance/instance.service';
|
|
4
|
+
import { IResourceManagerService } from '../resource-manager/type';
|
|
5
5
|
export declare class ResourceLoaderService extends Disposable implements IResourceLoaderService {
|
|
6
6
|
private readonly _resourceManagerService;
|
|
7
7
|
private readonly _univerInstanceService;
|
|
@@ -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 {};
|
|
@@ -15,6 +15,5 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export declare enum UpdateDocsAttributeType {
|
|
17
17
|
COVER = 0,// Default, if not present, add; if present, overwrite, while retaining the original properties.
|
|
18
|
-
REPLACE = 1
|
|
19
|
-
INTERSECTION = 2
|
|
18
|
+
REPLACE = 1
|
|
20
19
|
}
|
|
@@ -17,7 +17,7 @@ export declare class DisposableCollection implements IDisposable {
|
|
|
17
17
|
export declare class Disposable implements IDisposable {
|
|
18
18
|
protected _disposed: boolean;
|
|
19
19
|
private readonly _collection;
|
|
20
|
-
|
|
20
|
+
disposeWithMe(disposable: DisposableLike): IDisposable;
|
|
21
21
|
protected ensureNotDisposed(): void;
|
|
22
22
|
dispose(): void;
|
|
23
23
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { BBox, default as RBush } from 'rbush';
|
|
2
2
|
import { IUnitRange } from '../sheets/typedef';
|
|
3
|
+
type StringOrNumber = string | number;
|
|
3
4
|
export interface IRTreeItem extends IUnitRange {
|
|
4
|
-
id:
|
|
5
|
+
id: StringOrNumber;
|
|
5
6
|
}
|
|
6
7
|
interface IRBushItem extends BBox {
|
|
7
|
-
id:
|
|
8
|
+
id: StringOrNumber;
|
|
8
9
|
}
|
|
9
10
|
export interface IRTreeData {
|
|
10
11
|
[unitId: string]: {
|
|
@@ -12,13 +13,29 @@ export interface IRTreeData {
|
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
15
|
export declare class RTree {
|
|
16
|
+
private _enableOneCellCache;
|
|
15
17
|
private _tree;
|
|
18
|
+
private _oneCellCache;
|
|
19
|
+
private _kdTree;
|
|
20
|
+
private _kdTreeSearchState;
|
|
21
|
+
constructor(_enableOneCellCache?: boolean);
|
|
16
22
|
dispose(): void;
|
|
17
23
|
getTree(unitId: string, subUnitId: string): RBush<IRBushItem>;
|
|
24
|
+
private _getOneCellCache;
|
|
25
|
+
private _removeOneCellCache;
|
|
26
|
+
private _insertOneCellCache;
|
|
27
|
+
private _getRdTreeItems;
|
|
28
|
+
private _searchByOneCellCache;
|
|
29
|
+
/**
|
|
30
|
+
* Open the kd-tree search state.
|
|
31
|
+
* The kd-tree is used to search for data in a single cell.
|
|
32
|
+
*/
|
|
33
|
+
openKdTree(): void;
|
|
34
|
+
closeKdTree(): void;
|
|
18
35
|
insert(item: IRTreeItem): void;
|
|
19
36
|
bulkInsert(items: IRTreeItem[]): void;
|
|
20
|
-
search(search: IUnitRange):
|
|
21
|
-
bulkSearch(searchList: IUnitRange[]):
|
|
37
|
+
search(search: IUnitRange): StringOrNumber[];
|
|
38
|
+
bulkSearch(searchList: IUnitRange[]): Set<StringOrNumber>;
|
|
22
39
|
removeById(unitId: string, subUnitId?: string): void;
|
|
23
40
|
remove(search: IRTreeItem): void;
|
|
24
41
|
bulkRemove(searchList: IRTreeItem[]): void;
|
|
@@ -45,4 +45,5 @@ export declare class Rectangle {
|
|
|
45
45
|
static subtractMulti(ranges1: IRange[], ranges2: IRange[]): IRange[];
|
|
46
46
|
static hasIntersectionBetweenTwoRect(rect1: IRectLTRB, rect2: IRectLTRB): boolean;
|
|
47
47
|
static getIntersectionBetweenTwoRect(rect1: IRectLTRB, rect2: IRectLTRB): Required<IRectLTRB> | null;
|
|
48
|
+
static sort(ranges: IRange[]): IRange[];
|
|
48
49
|
}
|
|
@@ -16,4 +16,5 @@ export declare function fromCallback<T extends readonly unknown[]>(callback: Cal
|
|
|
16
16
|
*/
|
|
17
17
|
export declare function takeAfter<T>(callback: (value: T) => boolean): (source: Observable<T>) => Observable<T>;
|
|
18
18
|
export declare function bufferDebounceTime<T>(time?: number): OperatorFunction<T, T[]>;
|
|
19
|
+
export declare function afterTime(ms: number): Observable<void>;
|
|
19
20
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IStyleData } from '../types/interfaces';
|
|
2
|
+
import { IKeyValue, Nullable } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* Universal tool library
|
|
4
5
|
*/
|
|
@@ -17,7 +18,7 @@ export declare class Tools {
|
|
|
17
18
|
static getClassName(instance: object): string;
|
|
18
19
|
static deepMerge(target: any, ...sources: any[]): any;
|
|
19
20
|
static numberFixed(value: number, digit: number): number;
|
|
20
|
-
static diffValue(one: any,
|
|
21
|
+
static diffValue(one: any, two: any): boolean;
|
|
21
22
|
static deepClone<T = unknown>(value: T): T;
|
|
22
23
|
static getLanguage(): string;
|
|
23
24
|
static getValueType(value: any): string;
|
|
@@ -106,3 +107,9 @@ export declare class Tools {
|
|
|
106
107
|
static now(): number;
|
|
107
108
|
}
|
|
108
109
|
export declare function generateRandomId(n?: number, alphabet?: string): string;
|
|
110
|
+
/**
|
|
111
|
+
* compose styles by priority, the latter will overwrite the former
|
|
112
|
+
* @param { Nullable<IStyleData>[]} styles the styles to be composed
|
|
113
|
+
* @returns { Nullable<IStyleData>[]} Returns the composed style
|
|
114
|
+
*/
|
|
115
|
+
export declare function composeStyles(...styles: Nullable<IStyleData>[]): IStyleData;
|