@univerjs/core 0.5.3 → 0.5.4-nightly.202501131606
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 +9 -8
- package/lib/es/index.js +10202 -7862
- package/lib/types/common/error.d.ts +3 -0
- package/lib/types/docs/data-model/document-data-model.d.ts +4 -3
- package/lib/types/docs/data-model/rich-text-builder.d.ts +1340 -0
- package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +3 -1
- package/lib/types/docs/data-model/text-x/build-utils/text-x-utils.d.ts +3 -2
- package/lib/types/docs/data-model/text-x/utils.d.ts +48 -1
- package/lib/types/facade/f-blob.d.ts +12 -12
- package/lib/types/facade/f-doc.d.ts +7 -0
- package/lib/types/facade/f-enum.d.ts +51 -0
- package/lib/types/facade/f-event.d.ts +168 -13
- package/lib/types/facade/f-univer.d.ts +95 -20
- package/lib/types/facade/f-usermanager.d.ts +4 -3
- package/lib/types/facade/f-util.d.ts +16 -23
- package/lib/types/index.d.ts +4 -3
- package/lib/types/services/context/context.d.ts +1 -0
- package/lib/types/services/image-io/image-io.service.d.ts +12 -0
- package/lib/types/shared/check-if-move.d.ts +1 -1
- package/lib/types/shared/rectangle.d.ts +267 -12
- package/lib/types/sheets/column-manager.d.ts +3 -1
- package/lib/types/sheets/row-manager.d.ts +3 -1
- package/lib/types/sheets/typedef.d.ts +8 -0
- package/lib/types/sheets/workbook.d.ts +11 -1
- package/lib/types/sheets/worksheet.d.ts +11 -1
- package/lib/types/types/const/const.d.ts +9 -0
- package/lib/types/types/interfaces/i-document-data.d.ts +2 -52
- package/lib/types/types/interfaces/i-drawing.d.ts +93 -0
- package/lib/types/types/interfaces/i-slide-data.d.ts +2 -1
- package/lib/types/types/interfaces/i-style-data.d.ts +12 -0
- package/lib/types/types/interfaces/index.d.ts +1 -0
- package/lib/umd/index.js +9 -8
- package/package.json +3 -3
- package/LICENSE +0 -176
|
@@ -1,25 +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
|
-
*/
|
|
1
|
+
import { Rectangle, Tools } from '../shared';
|
|
16
2
|
export declare class FUtil {
|
|
17
|
-
static
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
3
|
+
static _instance: FUtil | null;
|
|
4
|
+
static get(): FUtil;
|
|
5
|
+
static extend(source: any): void;
|
|
6
|
+
/**
|
|
7
|
+
* Rectangle utils, including range operations likes merge, subtract, split
|
|
8
|
+
*/
|
|
9
|
+
get rectangle(): typeof Rectangle;
|
|
10
|
+
/**
|
|
11
|
+
* Number format utils, including parse and strigify about date, price, etc
|
|
12
|
+
*/
|
|
13
|
+
get numfmt(): import('../shared/types/numfmt.type').INumfmt;
|
|
14
|
+
/**
|
|
15
|
+
* common tools
|
|
16
|
+
*/
|
|
17
|
+
get tools(): typeof Tools;
|
|
25
18
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -20,7 +20,8 @@ export { isBooleanString } from './common/boolean';
|
|
|
20
20
|
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';
|
|
21
21
|
export * from './common/di';
|
|
22
22
|
export { shallowEqual } from './common/equal';
|
|
23
|
-
export {
|
|
23
|
+
export { ParagraphStyleBuilder, ParagraphStyleValue, RichTextBuilder, RichTextValue, TextDecorationBuilder, TextStyleBuilder, TextStyleValue } from './docs/data-model/rich-text-builder';
|
|
24
|
+
export { CanceledError, CustomCommandExecutionError } from './common/error';
|
|
24
25
|
export { throttle } from './common/function';
|
|
25
26
|
export type { IAsyncInterceptor, ICellInterceptor, IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';
|
|
26
27
|
export { AsyncInterceptorManager, composeInterceptors, createAsyncInterceptorKey, createInterceptorKey, InterceptorEffectEnum, InterceptorManager } from './common/interceptor';
|
|
@@ -33,6 +34,7 @@ export { FHooks } from './facade/f-hooks';
|
|
|
33
34
|
export { FBlob, type IFBlobSource } from './facade/f-blob';
|
|
34
35
|
export { FEventName, type IEventBase, type IEventParamConfig } from './facade/f-event';
|
|
35
36
|
export { FEnum } from './facade/f-enum';
|
|
37
|
+
export { FUtil } from './facade/f-util';
|
|
36
38
|
export { isNumeric, isSafeNumeric } from './common/number';
|
|
37
39
|
export { Registry, RegistryAsMap } from './common/registry';
|
|
38
40
|
export { requestImmediateMacroTask } from './common/request-immediate-macro-task';
|
|
@@ -51,8 +53,7 @@ export { updateAttributeByDelete } from './docs/data-model/text-x/apply-utils/de
|
|
|
51
53
|
export { updateAttributeByInsert } from './docs/data-model/text-x/apply-utils/insert-apply';
|
|
52
54
|
export { TextX } from './docs/data-model/text-x/text-x';
|
|
53
55
|
export type { TPriority } from './docs/data-model/text-x/text-x';
|
|
54
|
-
export { composeBody, getBodySlice, SliceBodyType } from './docs/data-model/text-x/utils';
|
|
55
|
-
export { getCustomDecorationSlice, getCustomRangeSlice, normalizeBody } from './docs/data-model/text-x/utils';
|
|
56
|
+
export { composeBody, getBodySlice, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeSlice, getParagraphsSlice, getSectionBreakSlice, getTableSlice, getTextRunSlice, normalizeBody, SliceBodyType, } from './docs/data-model/text-x/utils';
|
|
56
57
|
export { EventState, EventSubject, fromEventSubject, type IEventObserver } from './observer/observable';
|
|
57
58
|
export { AuthzIoLocalService } from './services/authz-io/authz-io-local.service';
|
|
58
59
|
export { IAuthzIoService } from './services/authz-io/type';
|
|
@@ -23,6 +23,7 @@ export declare const EDITOR_ACTIVATED = "EDITOR_ACTIVATED";
|
|
|
23
23
|
export declare const FOCUSING_EDITOR_INPUT_FORMULA = "FOCUSING_EDITOR_INPUT_FORMULA";
|
|
24
24
|
/** The focusing state of the formula editor (Fx bar). */
|
|
25
25
|
export declare const FOCUSING_FX_BAR_EDITOR = "FOCUSING_FX_BAR_EDITOR";
|
|
26
|
+
/** The focusing state of the cell editor. */
|
|
26
27
|
export declare const FOCUSING_UNIVER_EDITOR = "FOCUSING_UNIVER_EDITOR";
|
|
27
28
|
export declare const FOCUSING_EDITOR_STANDALONE = "FOCUSING_EDITOR_INPUT_FORMULA";
|
|
28
29
|
/** The focusing state of the editor in side panel, such as Chart Editor Panel. */
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { Nullable } from '../../shared/types';
|
|
3
|
+
/**
|
|
4
|
+
* The type of image data source
|
|
5
|
+
*/
|
|
3
6
|
export declare enum ImageSourceType {
|
|
7
|
+
/**
|
|
8
|
+
* The image source is a URL, for example: https://avatars.githubusercontent.com/u/61444807?s=48&v=4
|
|
9
|
+
*/
|
|
4
10
|
URL = "URL",
|
|
11
|
+
/**
|
|
12
|
+
* The image source is a UUID, this ID is generated by the Univer image hosting service. For specific generation rules, please refer to the Univer image hosting service API documentation.
|
|
13
|
+
*/
|
|
5
14
|
UUID = "UUID",
|
|
15
|
+
/**
|
|
16
|
+
* The image source is BASE64, for example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB7ZJ...
|
|
17
|
+
*/
|
|
6
18
|
BASE64 = "BASE64"
|
|
7
19
|
}
|
|
8
20
|
export declare enum ImageUploadStatusType {
|
|
@@ -1,50 +1,305 @@
|
|
|
1
1
|
import { Nullable } from './types';
|
|
2
2
|
import { IRange, IRectLTRB } from '../sheets/typedef';
|
|
3
3
|
/**
|
|
4
|
-
* This class provides a set of methods to calculate
|
|
4
|
+
* This class provides a set of methods to calculate and manipulate rectangular ranges (IRange).
|
|
5
|
+
* A range represents a rectangular area in a grid, defined by start/end rows and columns.
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // Example range representing cells from A1 to C3
|
|
9
|
+
* const range: IRange = {
|
|
10
|
+
* startRow: 0,
|
|
11
|
+
* startColumn: 0,
|
|
12
|
+
* endRow: 2,
|
|
13
|
+
* endColumn: 2,
|
|
14
|
+
* rangeType: RANGE_TYPE.NORMAL
|
|
15
|
+
* };
|
|
16
|
+
* ```
|
|
5
17
|
*/
|
|
6
18
|
export declare class Rectangle {
|
|
19
|
+
/**
|
|
20
|
+
* Creates a deep copy of an IRange object
|
|
21
|
+
* @param src
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const original = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
|
|
25
|
+
* const copy = Rectangle.clone(original);
|
|
26
|
+
* // copy = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
7
29
|
static clone(src: IRange): IRange;
|
|
30
|
+
/**
|
|
31
|
+
* Checks if two ranges are equal by comparing their properties
|
|
32
|
+
* @param src
|
|
33
|
+
* @param target
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const range1 = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
|
|
37
|
+
* const range2 = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
|
|
38
|
+
* const areEqual = Rectangle.equals(range1, range2); // true
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
8
41
|
static equals(src: IRange, target: IRange): boolean;
|
|
9
42
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
43
|
+
* Quickly checks if two normal ranges intersect. For specialized range types,
|
|
44
|
+
* use the intersects() method instead.
|
|
12
45
|
* @param rangeA
|
|
13
46
|
* @param rangeB
|
|
14
|
-
* @
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const range1 = { startRow: 0, startColumn: 0, endRow: 2, endColumn: 2 };
|
|
50
|
+
* const range2 = { startRow: 1, startColumn: 1, endRow: 3, endColumn: 3 };
|
|
51
|
+
* const doIntersect = Rectangle.simpleRangesIntersect(range1, range2); // true
|
|
52
|
+
* ```
|
|
15
53
|
*/
|
|
16
54
|
static simpleRangesIntersect(rangeA: IRange, rangeB: IRange): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Checks if two ranges intersect, handling special range types (ROW, COLUMN)
|
|
57
|
+
* @param src
|
|
58
|
+
* @param target
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* const rowRange = {
|
|
62
|
+
* startRow: 0, endRow: 2,
|
|
63
|
+
* startColumn: NaN, endColumn: NaN,
|
|
64
|
+
* rangeType: RANGE_TYPE.ROW
|
|
65
|
+
* };
|
|
66
|
+
* const colRange = {
|
|
67
|
+
* startRow: NaN, endRow: NaN,
|
|
68
|
+
* startColumn: 0, endColumn: 2,
|
|
69
|
+
* rangeType: RANGE_TYPE.COLUMN
|
|
70
|
+
* };
|
|
71
|
+
* const doIntersect = Rectangle.intersects(rowRange, colRange); // true
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
17
74
|
static intersects(src: IRange, target: IRange): boolean;
|
|
18
75
|
/**
|
|
19
|
-
*
|
|
20
|
-
* @
|
|
76
|
+
* Gets the intersection range between two ranges
|
|
77
|
+
* @param src
|
|
78
|
+
* @param target
|
|
79
|
+
* @deprecated use `getIntersectRange` instead
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* const range1 = { startRow: 0, startColumn: 0, endRow: 2, endColumn: 2 };
|
|
83
|
+
* const range2 = { startRow: 1, startColumn: 1, endRow: 3, endColumn: 3 };
|
|
84
|
+
* const intersection = Rectangle.getIntersects(range1, range2);
|
|
85
|
+
* // intersection = { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
|
|
86
|
+
* ```
|
|
21
87
|
*/
|
|
22
88
|
static getIntersects(src: IRange, target: IRange): Nullable<IRange>;
|
|
89
|
+
/**
|
|
90
|
+
* Checks if one range completely contains another range
|
|
91
|
+
* @param src
|
|
92
|
+
* @param target
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const outer = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
|
|
96
|
+
* const inner = { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 };
|
|
97
|
+
* const contains = Rectangle.contains(outer, inner); // true
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
23
100
|
static contains(src: IRange, target: IRange): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Checks if one range strictly contains another range (not equal)
|
|
103
|
+
* @param src
|
|
104
|
+
* @param target
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* const outer = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
|
|
108
|
+
* const same = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
|
|
109
|
+
* const realContains = Rectangle.realContain(outer, same); // false
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
24
112
|
static realContain(src: IRange, target: IRange): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Creates a union range that encompasses all input ranges
|
|
115
|
+
* @param {...any} ranges
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* const range1 = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
|
|
119
|
+
* const range2 = { startRow: 2, startColumn: 2, endRow: 3, endColumn: 3 };
|
|
120
|
+
* const union = Rectangle.union(range1, range2);
|
|
121
|
+
* // union = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 }
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
25
124
|
static union(...ranges: IRange[]): IRange;
|
|
125
|
+
/**
|
|
126
|
+
* Creates a union range considering special range types (ROW, COLUMN)
|
|
127
|
+
* @param {...any} ranges
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const rowRange = {
|
|
131
|
+
* startRow: 0, endRow: 2,
|
|
132
|
+
* rangeType: RANGE_TYPE.ROW
|
|
133
|
+
* };
|
|
134
|
+
* const normalRange = {
|
|
135
|
+
* startRow: 1, startColumn: 1,
|
|
136
|
+
* endRow: 3, endColumn: 3
|
|
137
|
+
* };
|
|
138
|
+
* const union = Rectangle.realUnion(rowRange, normalRange);
|
|
139
|
+
* // Result will have NaN for columns due to ROW type
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
26
142
|
static realUnion(...ranges: IRange[]): IRange;
|
|
143
|
+
/**
|
|
144
|
+
* Converts an absolute range to a relative range based on an origin range
|
|
145
|
+
* @param range
|
|
146
|
+
* @param originRange
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const range = { startRow: 5, startColumn: 5, endRow: 7, endColumn: 7 };
|
|
150
|
+
* const origin = { startRow: 3, startColumn: 3, endRow: 8, endColumn: 8 };
|
|
151
|
+
* const relative = Rectangle.getRelativeRange(range, origin);
|
|
152
|
+
* // relative = { startRow: 2, startColumn: 2, endRow: 2, endColumn: 2 }
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
27
155
|
static getRelativeRange: (range: IRange, originRange: IRange) => IRange;
|
|
156
|
+
/**
|
|
157
|
+
* Converts a relative range back to an absolute range based on origin
|
|
158
|
+
* @param relativeRange
|
|
159
|
+
* @param originRange
|
|
160
|
+
* @param absoluteRange
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* const relative = { startRow: 2, startColumn: 2, endRow: 2, endColumn: 2 };
|
|
164
|
+
* const origin = { startRow: 3, startColumn: 3, endRow: 8, endColumn: 8 };
|
|
165
|
+
* const absolute = Rectangle.getPositionRange(relative, origin);
|
|
166
|
+
* // absolute = { startRow: 5, startColumn: 5, endRow: 7, endColumn: 7 }
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
28
169
|
static getPositionRange: (relativeRange: IRange, originRange: IRange, absoluteRange?: IRange) => IRange;
|
|
170
|
+
/**
|
|
171
|
+
* Moves a range horizontally by a specified step and optionally extends it
|
|
172
|
+
* @param range
|
|
173
|
+
* @param step
|
|
174
|
+
* @param length
|
|
175
|
+
* @example
|
|
176
|
+
* ```typescript
|
|
177
|
+
* const range = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
|
|
178
|
+
* const moved = Rectangle.moveHorizontal(range, 2, 1);
|
|
179
|
+
* // moved = { startRow: 0, startColumn: 2, endRow: 1, endColumn: 4 }
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
29
182
|
static moveHorizontal: (range: IRange, step?: number, length?: number) => IRange;
|
|
183
|
+
/**
|
|
184
|
+
* Moves a range vertically by a specified step and optionally extends it
|
|
185
|
+
* @param range
|
|
186
|
+
* @param step
|
|
187
|
+
* @param length
|
|
188
|
+
* @example
|
|
189
|
+
* ```typescript
|
|
190
|
+
* const range = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
|
|
191
|
+
* const moved = Rectangle.moveVertical(range, 2, 1);
|
|
192
|
+
* // moved = { startRow: 2, startColumn: 0, endRow: 4, endColumn: 1 }
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
30
195
|
static moveVertical: (range: IRange, step?: number, length?: number) => IRange;
|
|
196
|
+
/**
|
|
197
|
+
* Moves a range by specified offsets in both directions
|
|
198
|
+
* @param range
|
|
199
|
+
* @param offsetX
|
|
200
|
+
* @param offsetY
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* const range = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
|
|
204
|
+
* const moved = Rectangle.moveOffset(range, 2, 3);
|
|
205
|
+
* // moved = { startRow: 3, startColumn: 2, endRow: 4, endColumn: 3 }
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
31
208
|
static moveOffset: (range: IRange, offsetX: number, offsetY: number) => IRange;
|
|
32
209
|
/**
|
|
33
|
-
*
|
|
34
|
-
* @param
|
|
35
|
-
* @param
|
|
36
|
-
* @
|
|
210
|
+
* Subtracts one range from another, returning the remaining areas as separate ranges
|
|
211
|
+
* @param range1
|
|
212
|
+
* @param range2
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* const range1 = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
|
|
216
|
+
* const range2 = { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 };
|
|
217
|
+
* const result = Rectangle.subtract(range1, range2);
|
|
218
|
+
* // Results in up to 4 ranges representing the non-overlapping areas
|
|
219
|
+
* ```
|
|
37
220
|
*/
|
|
38
221
|
static subtract(range1: IRange, range2: IRange): IRange[];
|
|
39
222
|
/**
|
|
40
|
-
*
|
|
223
|
+
* Merges overlapping or adjacent ranges into larger ranges
|
|
41
224
|
* @param ranges
|
|
42
|
-
* @
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* const ranges = [
|
|
228
|
+
* { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 },
|
|
229
|
+
* { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
|
|
230
|
+
* ];
|
|
231
|
+
* const merged = Rectangle.mergeRanges(ranges);
|
|
232
|
+
* // Combines overlapping ranges into larger ones
|
|
233
|
+
* ```
|
|
43
234
|
*/
|
|
44
235
|
static mergeRanges(ranges: IRange[]): IRange[];
|
|
236
|
+
/**
|
|
237
|
+
* Splits overlapping ranges into a grid of non-overlapping ranges
|
|
238
|
+
* @param ranges
|
|
239
|
+
* @example
|
|
240
|
+
* ```typescript
|
|
241
|
+
* const ranges = [
|
|
242
|
+
* { startRow: 0, startColumn: 0, endRow: 2, endColumn: 2 },
|
|
243
|
+
* { startRow: 1, startColumn: 1, endRow: 3, endColumn: 3 }
|
|
244
|
+
* ];
|
|
245
|
+
* const grid = Rectangle.splitIntoGrid(ranges);
|
|
246
|
+
* // Splits into non-overlapping grid sections
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
45
249
|
static splitIntoGrid(ranges: IRange[]): IRange[];
|
|
250
|
+
/**
|
|
251
|
+
* Subtracts multiple ranges from multiple ranges
|
|
252
|
+
* @param ranges1
|
|
253
|
+
* @param ranges2
|
|
254
|
+
* @example
|
|
255
|
+
* ```typescript
|
|
256
|
+
* const ranges1 = [{ startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 }];
|
|
257
|
+
* const ranges2 = [
|
|
258
|
+
* { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 },
|
|
259
|
+
* { startRow: 2, startColumn: 2, endRow: 3, endColumn: 3 }
|
|
260
|
+
* ];
|
|
261
|
+
* const result = Rectangle.subtractMulti(ranges1, ranges2);
|
|
262
|
+
* // Returns remaining non-overlapping areas
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
46
265
|
static subtractMulti(ranges1: IRange[], ranges2: IRange[]): IRange[];
|
|
266
|
+
/**
|
|
267
|
+
* Checks if two rectangles defined by left, top, right, bottom coordinates intersect
|
|
268
|
+
* @param rect1
|
|
269
|
+
* @param rect2
|
|
270
|
+
* @example
|
|
271
|
+
* ```typescript
|
|
272
|
+
* const rect1 = { left: 0, top: 0, right: 10, bottom: 10 };
|
|
273
|
+
* const rect2 = { left: 5, top: 5, right: 15, bottom: 15 };
|
|
274
|
+
* const intersects = Rectangle.hasIntersectionBetweenTwoRect(rect1, rect2); // true
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
47
277
|
static hasIntersectionBetweenTwoRect(rect1: IRectLTRB, rect2: IRectLTRB): boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Gets the intersection area between two rectangles defined by LTRB coordinates
|
|
280
|
+
* @param rect1
|
|
281
|
+
* @param rect2
|
|
282
|
+
* @example
|
|
283
|
+
* ```typescript
|
|
284
|
+
* const rect1 = { left: 0, top: 0, right: 10, bottom: 10 };
|
|
285
|
+
* const rect2 = { left: 5, top: 5, right: 15, bottom: 15 };
|
|
286
|
+
* const intersection = Rectangle.getIntersectionBetweenTwoRect(rect1, rect2);
|
|
287
|
+
* // Returns { left: 5, top: 5, right: 10, bottom: 10, width: 5, height: 5 }
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
48
290
|
static getIntersectionBetweenTwoRect(rect1: IRectLTRB, rect2: IRectLTRB): Required<IRectLTRB> | null;
|
|
291
|
+
/**
|
|
292
|
+
* Sorts an array of ranges by startRow, then by startColumn
|
|
293
|
+
* @param ranges
|
|
294
|
+
* @example
|
|
295
|
+
* ```typescript
|
|
296
|
+
* const ranges = [
|
|
297
|
+
* { startRow: 1, startColumn: 0, endRow: 2, endColumn: 1 },
|
|
298
|
+
* { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 }
|
|
299
|
+
* ];
|
|
300
|
+
* const sorted = Rectangle.sort(ranges);
|
|
301
|
+
* // Ranges will be sorted by startRow first, then startColumn
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
49
304
|
static sort(ranges: IRange[]): IRange[];
|
|
50
305
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IObjectArrayPrimitiveType } from '../shared/object-matrix';
|
|
2
2
|
import { Nullable } from '../shared/types';
|
|
3
3
|
import { IStyleData } from '../types/interfaces';
|
|
4
|
-
import { IColumnData, IRange, IWorksheetData } from './typedef';
|
|
4
|
+
import { CustomData, IColumnData, IRange, IWorksheetData } from './typedef';
|
|
5
5
|
/**
|
|
6
6
|
* Manage configuration information of all columns, get column width, column length, set column width, etc.
|
|
7
7
|
*/
|
|
@@ -69,4 +69,6 @@ export declare class ColumnManager {
|
|
|
69
69
|
* @returns {Partial<IColumnData>} columnData
|
|
70
70
|
*/
|
|
71
71
|
getColumnOrCreate(columnPos: number): Partial<IColumnData>;
|
|
72
|
+
setCustomMetadata(index: number, custom: CustomData | undefined): void;
|
|
73
|
+
getCustomMetadata(index: number): CustomData | undefined;
|
|
72
74
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Nullable } from '../shared/types';
|
|
2
2
|
import { IStyleData } from '../types/interfaces';
|
|
3
|
+
import { CustomData, IRange, IRowData, IWorksheetData } from './typedef';
|
|
3
4
|
import { SheetViewModel } from './view-model';
|
|
4
5
|
import { IObjectArrayPrimitiveType } from '../shared/object-matrix';
|
|
5
|
-
import { IRange, IRowData, IWorksheetData } from './typedef';
|
|
6
6
|
/**
|
|
7
7
|
* Manage configuration information of all rows, get row height, row length, set row height, etc.
|
|
8
8
|
*/
|
|
@@ -68,4 +68,6 @@ export declare class RowManager {
|
|
|
68
68
|
* @returns {number} row count
|
|
69
69
|
*/
|
|
70
70
|
getSize(): number;
|
|
71
|
+
setCustomMetadata(index: number, custom: CustomData | undefined): void;
|
|
72
|
+
getCustomMetadata(index: number): CustomData | undefined;
|
|
71
73
|
}
|
|
@@ -50,6 +50,10 @@ export interface IWorkbookData {
|
|
|
50
50
|
* Resources of the Univer Sheet. It is used to store the data of other plugins.
|
|
51
51
|
*/
|
|
52
52
|
resources?: IResources;
|
|
53
|
+
/**
|
|
54
|
+
* User stored custom fields
|
|
55
|
+
*/
|
|
56
|
+
custom?: CustomData;
|
|
53
57
|
}
|
|
54
58
|
/**
|
|
55
59
|
* Snapshot of a worksheet.
|
|
@@ -106,6 +110,10 @@ export interface IWorksheetData {
|
|
|
106
110
|
*/
|
|
107
111
|
gridlinesColor?: string;
|
|
108
112
|
rightToLeft: BooleanNumber;
|
|
113
|
+
/**
|
|
114
|
+
* User stored custom fields
|
|
115
|
+
*/
|
|
116
|
+
custom?: CustomData;
|
|
109
117
|
}
|
|
110
118
|
export type CustomData = Nullable<Record<string, any>>;
|
|
111
119
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { Nullable } from '../shared';
|
|
3
|
-
import { IRangeType, IWorkbookData, IWorksheetData } from './typedef';
|
|
3
|
+
import { CustomData, IRangeType, IWorkbookData, IWorksheetData } from './typedef';
|
|
4
4
|
import { UnitModel, UniverInstanceType } from '../common/unit';
|
|
5
5
|
import { ILogService } from '../services/log/log.service';
|
|
6
6
|
import { Styles } from './styles';
|
|
@@ -123,4 +123,14 @@ export declare class Workbook extends UnitModel<IWorkbookData, UniverInstanceTyp
|
|
|
123
123
|
* Get Default Sheet
|
|
124
124
|
*/
|
|
125
125
|
private _parseWorksheetSnapshots;
|
|
126
|
+
/**
|
|
127
|
+
* Get custom metadata of workbook
|
|
128
|
+
* @returns {CustomData | undefined} custom metadata
|
|
129
|
+
*/
|
|
130
|
+
getCustomMetadata(): CustomData | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Set custom metadata of workbook
|
|
133
|
+
* @param {CustomData | undefined} custom custom metadata
|
|
134
|
+
*/
|
|
135
|
+
setCustomMetadata(custom: CustomData | undefined): void;
|
|
126
136
|
}
|
|
@@ -2,7 +2,7 @@ import { IInterceptor } from '../common/interceptor';
|
|
|
2
2
|
import { Nullable, ObjectMatrix } from '../shared';
|
|
3
3
|
import { IPaddingData, IStyleData, ITextRotation } from '../types/interfaces';
|
|
4
4
|
import { Styles } from './styles';
|
|
5
|
-
import { ICellData, ICellDataForSheetInterceptor, ICellDataWithSpanAndDisplay, IFreeze, IRange, ISelectionCell, IWorksheetData, CellModeEnum } from './typedef';
|
|
5
|
+
import { CustomData, ICellData, ICellDataForSheetInterceptor, ICellDataWithSpanAndDisplay, IFreeze, IRange, ISelectionCell, IWorksheetData, CellModeEnum } from './typedef';
|
|
6
6
|
import { DocumentDataModel } from '../docs';
|
|
7
7
|
import { BooleanNumber, CellValueType, HorizontalAlign, TextDirection, VerticalAlign, WrapStrategy } from '../types/enum';
|
|
8
8
|
import { ColumnManager } from './column-manager';
|
|
@@ -391,6 +391,16 @@ export declare class Worksheet {
|
|
|
391
391
|
*/
|
|
392
392
|
getBlankCellDocumentModel(cell: Nullable<ICellData>): IDocumentLayoutObject;
|
|
393
393
|
getCellDocumentModelWithFormula(cell: ICellData): Nullable<IDocumentLayoutObject>;
|
|
394
|
+
/**
|
|
395
|
+
* Get custom metadata of worksheet
|
|
396
|
+
* @returns {CustomData | undefined} custom metadata
|
|
397
|
+
*/
|
|
398
|
+
getCustomMetadata(): CustomData | undefined;
|
|
399
|
+
/**
|
|
400
|
+
* Set custom metadata of workbook
|
|
401
|
+
* @param {CustomData | undefined} custom custom metadata
|
|
402
|
+
*/
|
|
403
|
+
setCustomMetadata(custom: CustomData | undefined): void;
|
|
394
404
|
}
|
|
395
405
|
/**
|
|
396
406
|
* A cell info including its span (if it is the top-left cell of a merged cell).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Nullable } from '../../shared/types';
|
|
1
|
+
import { ISize } from '../../shared/shape';
|
|
3
2
|
import { BooleanNumber, CellValueType, HorizontalAlign, LocaleType, TextDirection, VerticalAlign, WrapStrategy } from '../enum';
|
|
3
|
+
import { IDrawingParam } from './i-drawing';
|
|
4
4
|
import { IMention } from './i-mention';
|
|
5
5
|
import { IColorStyle, IStyleBase } from './i-style-data';
|
|
6
6
|
/**
|
|
@@ -842,53 +842,3 @@ export declare enum PageOrientType {
|
|
|
842
842
|
PORTRAIT = 0,
|
|
843
843
|
LANDSCAPE = 1
|
|
844
844
|
}
|
|
845
|
-
/** @deprecated */
|
|
846
|
-
export declare enum ArrangeTypeEnum {
|
|
847
|
-
forward = 0,
|
|
848
|
-
backward = 1,
|
|
849
|
-
front = 2,
|
|
850
|
-
back = 3
|
|
851
|
-
}
|
|
852
|
-
/** @deprecated */
|
|
853
|
-
export declare enum DrawingTypeEnum {
|
|
854
|
-
UNRECOGNIZED = -1,
|
|
855
|
-
DRAWING_IMAGE = 0,
|
|
856
|
-
DRAWING_SHAPE = 1,
|
|
857
|
-
DRAWING_CHART = 2,
|
|
858
|
-
DRAWING_TABLE = 3,
|
|
859
|
-
DRAWING_SMART_ART = 4,
|
|
860
|
-
DRAWING_VIDEO = 5,
|
|
861
|
-
DRAWING_GROUP = 6,
|
|
862
|
-
DRAWING_UNIT = 7,
|
|
863
|
-
DRAWING_DOM = 8
|
|
864
|
-
}
|
|
865
|
-
/** @deprecated */
|
|
866
|
-
export type DrawingType = DrawingTypeEnum | number;
|
|
867
|
-
/** @deprecated */
|
|
868
|
-
export interface IDrawingSpace {
|
|
869
|
-
unitId: string;
|
|
870
|
-
subUnitId: string;
|
|
871
|
-
}
|
|
872
|
-
/** @deprecated */
|
|
873
|
-
export interface IDrawingSearch extends IDrawingSpace {
|
|
874
|
-
drawingId: string;
|
|
875
|
-
}
|
|
876
|
-
/** @deprecated */
|
|
877
|
-
export interface IRotationSkewFlipTransform {
|
|
878
|
-
angle?: number;
|
|
879
|
-
skewX?: number;
|
|
880
|
-
skewY?: number;
|
|
881
|
-
flipX?: boolean;
|
|
882
|
-
flipY?: boolean;
|
|
883
|
-
}
|
|
884
|
-
/** @deprecated */
|
|
885
|
-
export interface ITransformState extends IAbsoluteTransform, IRotationSkewFlipTransform {
|
|
886
|
-
}
|
|
887
|
-
/** @deprecated */
|
|
888
|
-
export interface IDrawingParam extends IDrawingSearch {
|
|
889
|
-
drawingType: DrawingType;
|
|
890
|
-
transform?: Nullable<ITransformState>;
|
|
891
|
-
transforms?: Nullable<ITransformState[]>;
|
|
892
|
-
isMultiTransform?: BooleanNumber;
|
|
893
|
-
groupId?: string;
|
|
894
|
-
}
|