@univerjs/core 0.1.0-beta.5 → 0.1.2
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/README.md +22 -2
- package/lib/cjs/index.js +6 -5
- package/lib/es/index.js +772 -669
- package/lib/types/docs/data-model/__tests__/replacement.spec.d.ts +16 -0
- package/lib/types/docs/data-model/document-data-model.d.ts +3 -2
- package/lib/types/docs/data-model/replacement.d.ts +17 -0
- package/lib/types/docs/data-model/text-x/text-x.d.ts +3 -3
- package/lib/types/index.d.ts +4 -0
- package/lib/types/services/context/context.d.ts +1 -0
- package/lib/types/services/lifecycle/lifecycle.d.ts +1 -1
- package/lib/types/shared/debounce.d.ts +18 -0
- package/lib/types/shared/generate.d.ts +1 -1
- package/lib/types/shared/index.d.ts +1 -0
- package/lib/types/sheets/__tests__/ranges.spec.d.ts +16 -0
- package/lib/types/sheets/__tests__/worksheet.spec.d.ts +16 -0
- package/lib/types/sheets/range.d.ts +3 -2
- package/lib/types/sheets/worksheet.d.ts +22 -0
- package/lib/types/types/interfaces/i-document-data.d.ts +1 -1
- package/lib/types/types/interfaces/i-selection-data.d.ts +1 -0
- package/lib/umd/index.js +6 -5
- package/package.json +2 -2
|
@@ -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,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { Nullable } from '../../shared';
|
|
17
|
-
import type { IDocumentBody, IDocumentData, IDocumentRenderConfig } from '../../types/interfaces/i-document-data';
|
|
17
|
+
import type { IDocumentBody, IDocumentData, IDocumentRenderConfig, IDocumentStyle } from '../../types/interfaces/i-document-data';
|
|
18
18
|
import type { IPaddingData } from '../../types/interfaces/i-style-data';
|
|
19
19
|
import { type TextXAction } from './action-types';
|
|
20
20
|
export declare const DEFAULT_DOC: {
|
|
@@ -31,7 +31,7 @@ declare class DocumentDataModelSimple {
|
|
|
31
31
|
snapshot: IDocumentData;
|
|
32
32
|
constructor(snapshot: Partial<IDocumentData>);
|
|
33
33
|
get drawings(): import("../../types/interfaces/i-document-data").IDrawings | undefined;
|
|
34
|
-
get documentStyle():
|
|
34
|
+
get documentStyle(): IDocumentStyle;
|
|
35
35
|
get lists(): import("../../types/interfaces/i-document-data").ILists | undefined;
|
|
36
36
|
/**
|
|
37
37
|
* @deprecated use getBody to instead.
|
|
@@ -45,6 +45,7 @@ declare class DocumentDataModelSimple {
|
|
|
45
45
|
getSnapshot(): IDocumentData;
|
|
46
46
|
updateDocumentId(unitId: string): void;
|
|
47
47
|
updateDocumentRenderConfig(config: IDocumentRenderConfig): void;
|
|
48
|
+
updateDocumentStyle(config: IDocumentStyle): void;
|
|
48
49
|
updateDocumentDataMargin(data: IPaddingData): void;
|
|
49
50
|
updateDocumentDataPageSize(width?: number, height?: number): void;
|
|
50
51
|
updateDrawing(id: string, config: IDrawingUpdateConfig): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
import type { IDocumentBody } from '../../types/interfaces/i-document-data';
|
|
17
|
+
export declare function replaceInDocumentBody(body: IDocumentBody, query: string, target: string): IDocumentBody;
|
|
@@ -19,9 +19,9 @@ import { type TextXAction } from '../action-types';
|
|
|
19
19
|
export declare class TextX {
|
|
20
20
|
static compose(thisActions: TextXAction[], otherActions: TextXAction[]): TextXAction[];
|
|
21
21
|
private _actions;
|
|
22
|
-
insert(len: number, body: IDocumentBody, segmentId
|
|
23
|
-
retain(len: number, segmentId
|
|
24
|
-
delete(len: number, segmentId
|
|
22
|
+
insert(len: number, body: IDocumentBody, segmentId?: string): this;
|
|
23
|
+
retain(len: number, segmentId?: string, body?: IDocumentBody, coverType?: UpdateDocsAttributeType): this;
|
|
24
|
+
delete(len: number, segmentId?: string): this;
|
|
25
25
|
serialize(): TextXAction[];
|
|
26
26
|
push(...args: TextXAction[]): this;
|
|
27
27
|
trimEndUselessRetainAction(): this;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export { TextXActionType, type TextXAction, type IDeleteAction, type IInsertActi
|
|
|
25
25
|
export { ActionIterator } from './docs/data-model/text-x/action-iterator';
|
|
26
26
|
export { getBodySlice, composeBody } from './docs/data-model/text-x/utils';
|
|
27
27
|
export { TextX } from './docs/data-model/text-x/text-x';
|
|
28
|
+
export { replaceInDocumentBody } from './docs/data-model/replacement';
|
|
28
29
|
export * from './observer';
|
|
29
30
|
export { Plugin, PluginType } from './plugin/plugin';
|
|
30
31
|
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';
|
|
@@ -61,3 +62,6 @@ export * from './slides/domain';
|
|
|
61
62
|
export * from './types/const';
|
|
62
63
|
export * from './types/enum';
|
|
63
64
|
export * from './types/interfaces';
|
|
65
|
+
export { UniverInstanceService } from './services/instance/instance.service';
|
|
66
|
+
export { LifecycleInitializerService } from './services/lifecycle/lifecycle.service';
|
|
67
|
+
export { ConfigService } from './services/config/config.service';
|
|
@@ -22,3 +22,4 @@ export declare const EDITOR_ACTIVATED = "EDITOR_ACTIVATED";
|
|
|
22
22
|
export declare const FOCUSING_EDITOR_INPUT_FORMULA = "FOCUSING_EDITOR_INPUT_FORMULA";
|
|
23
23
|
export declare const FOCUSING_FORMULA_EDITOR = "FOCUSING_FORMULA_EDITOR";
|
|
24
24
|
export declare const FOCUSING_UNIVER_EDITOR = "FOCUSING_UNIVER_EDITOR";
|
|
25
|
+
export declare const FOCUSING_UNIVER_EDITOR_SINGLE_MODE = "FOCUSING_UNIVER_EDITOR_SINGLE_MODE";
|
|
@@ -17,7 +17,7 @@ import type { Ctor, DependencyIdentifier } from '@wendellhu/redi';
|
|
|
17
17
|
/**
|
|
18
18
|
* This enum defines multiple lifecycle stages in Univer SDK.
|
|
19
19
|
*/
|
|
20
|
-
export declare
|
|
20
|
+
export declare enum LifecycleStages {
|
|
21
21
|
/**
|
|
22
22
|
* Register plugins to Univer.
|
|
23
23
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
type debounceFn<T extends (...args: any[]) => any> = (this: ThisParameterType<T>, ...args: Parameters<T>) => void;
|
|
17
|
+
export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): debounceFn<T>;
|
|
18
|
+
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 {};
|
|
@@ -17,7 +17,7 @@ import type { IObjectMatrixPrimitiveType, Nullable } from '../shared';
|
|
|
17
17
|
import { ObjectMatrix } from '../shared';
|
|
18
18
|
import type { HorizontalAlign, VerticalAlign, WrapStrategy } from '../types/enum';
|
|
19
19
|
import { BooleanNumber, FontItalic, FontWeight } from '../types/enum';
|
|
20
|
-
import type { IBorderData, ICellData, IDocumentData, IRange, IStyleData, ITextDecoration, ITextRotation } from '../types/interfaces';
|
|
20
|
+
import type { IBorderData, ICellData, IDocumentBody, IDocumentData, IRange, IStyleBase, IStyleData, ITextDecoration, ITextRotation } from '../types/interfaces';
|
|
21
21
|
import type { Styles } from './styles';
|
|
22
22
|
import type { Worksheet } from './worksheet';
|
|
23
23
|
/**
|
|
@@ -32,6 +32,7 @@ interface IValueOptionsType {
|
|
|
32
32
|
export interface IRangeDependencies {
|
|
33
33
|
getStyles(): Readonly<Styles>;
|
|
34
34
|
}
|
|
35
|
+
export declare function isAllFormatInTextRuns(key: keyof IStyleBase, body: IDocumentBody): BooleanNumber;
|
|
35
36
|
/**
|
|
36
37
|
* Access and modify spreadsheet ranges.
|
|
37
38
|
*
|
|
@@ -189,7 +190,7 @@ export declare class Range {
|
|
|
189
190
|
/**
|
|
190
191
|
* Returns the font styles of the cells in the range.
|
|
191
192
|
*/
|
|
192
|
-
private
|
|
193
|
+
private _getFontStyles;
|
|
193
194
|
/**
|
|
194
195
|
* Returns the font weight (normal/bold) of the cell in the top-left corner of the range.
|
|
195
196
|
* If the cell has rich text, the return value according to the textRuns of the rich text,
|
|
@@ -192,4 +192,26 @@ export declare class Worksheet {
|
|
|
192
192
|
*/
|
|
193
193
|
getLastColumnWithContent(): number;
|
|
194
194
|
cellHasValue(value: ICellData): boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Iterate a range row by row.
|
|
197
|
+
*
|
|
198
|
+
* Performance intensive.
|
|
199
|
+
*/
|
|
200
|
+
iterateByRow(range: IRange): Iterator<Readonly<ICell>, Readonly<ICell>>;
|
|
201
|
+
/**
|
|
202
|
+
* Iterate a range column by column. This is pretty similar to `iterateByRow` but with different order.
|
|
203
|
+
*
|
|
204
|
+
* Performance intensive.
|
|
205
|
+
*/
|
|
206
|
+
iterateByColumn(range: IRange): Iterator<Readonly<ICell>, Readonly<ICell>>;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* A cell info including its span (if it is the top-left cell of a merged cell).
|
|
210
|
+
*/
|
|
211
|
+
export interface ICell {
|
|
212
|
+
row: number;
|
|
213
|
+
col: number;
|
|
214
|
+
rowSpan?: number;
|
|
215
|
+
colSpan?: number;
|
|
216
|
+
value: ICellData;
|
|
195
217
|
}
|