@univerjs/core 0.2.8 → 0.2.10
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 +7 -9
- package/lib/es/index.js +220 -688
- package/lib/types/common/equal.d.ts +15 -3
- package/lib/types/common/interceptor.d.ts +1 -1
- package/lib/types/{types/interfaces/i-extra-model-data.d.ts → common/mixin.d.ts} +9 -11
- package/lib/types/common/unit.d.ts +2 -1
- package/lib/types/docs/data-model/document-data-model.d.ts +2 -3
- package/lib/types/index.d.ts +5 -9
- package/lib/types/services/authz-io/type.d.ts +2 -2
- package/lib/types/services/command/command.service.d.ts +111 -28
- package/lib/types/services/lifecycle/lifecycle.d.ts +5 -0
- package/lib/types/services/permission/type.d.ts +2 -2
- package/lib/types/services/resource-loader/resource-loader.service.d.ts +3 -5
- package/lib/types/services/resource-loader/type.d.ts +4 -6
- package/lib/types/services/resource-manager/resource-manager.service.d.ts +4 -4
- package/lib/types/services/resource-manager/type.d.ts +9 -5
- package/lib/types/services/undoredo/undoredo.service.d.ts +1 -1
- package/lib/types/shared/check-if-move.d.ts +1 -1
- package/lib/types/shared/color/color.d.ts +1 -1
- package/lib/types/shared/common.d.ts +2 -4
- package/lib/types/shared/numfmt.d.ts +2 -1
- package/lib/types/shared/object-matrix-query.d.ts +1 -1
- package/lib/types/shared/object-matrix.d.ts +1 -1
- package/lib/types/shared/range.d.ts +1 -1
- package/lib/types/shared/rectangle.d.ts +1 -1
- package/lib/types/shared/tools.d.ts +1 -2
- package/lib/types/shared/types/numfmt.type.d.ts +227 -0
- package/lib/types/shared/types.d.ts +7 -13
- package/lib/types/sheets/__tests__/create-core-test-bed.d.ts +1 -1
- package/lib/types/sheets/column-manager.d.ts +2 -2
- package/lib/types/sheets/empty-snapshot.d.ts +1 -1
- package/lib/types/sheets/range.d.ts +2 -1
- package/lib/types/sheets/row-manager.d.ts +1 -1
- package/lib/types/sheets/sheet-snapshot-utils.d.ts +1 -1
- package/lib/types/sheets/styles.d.ts +2 -1
- package/lib/types/sheets/typedef.d.ts +451 -0
- package/lib/types/sheets/util.d.ts +3 -0
- package/lib/types/sheets/view-model.d.ts +2 -2
- package/lib/types/sheets/workbook.d.ts +13 -4
- package/lib/types/sheets/worksheet.d.ts +11 -1
- package/lib/types/slides/slide-model.d.ts +0 -1
- package/lib/types/types/const/const.d.ts +4 -0
- package/lib/types/types/enum/locale-type.d.ts +3 -1
- package/lib/types/types/enum/text-style.d.ts +1 -1
- package/lib/types/types/interfaces/i-cell-custom-render.d.ts +2 -2
- package/lib/types/types/interfaces/i-data-validation.d.ts +1 -1
- package/lib/types/types/interfaces/i-document-data.d.ts +2 -4
- package/lib/types/types/interfaces/i-slide-data.d.ts +5 -3
- package/lib/types/types/interfaces/index.d.ts +0 -11
- package/lib/types/univer.d.ts +14 -2
- package/lib/umd/index.js +7 -9
- package/package.json +5 -5
- package/lib/types/common/type-util.d.ts +0 -16
- package/lib/types/common/type-utils.d.ts +0 -16
- package/lib/types/services/snapshot/__tests__/snapshot-mock.d.ts +0 -22
- package/lib/types/services/snapshot/snapshot-server.service.d.ts +0 -42
- package/lib/types/services/snapshot/snapshot-transform.d.ts +0 -31
- package/lib/types/services/snapshot/snapshot-utils.d.ts +0 -19
- package/lib/types/types/interfaces/i-cell-data.d.ts +0 -66
- package/lib/types/types/interfaces/i-column-data.d.ts +0 -14
- package/lib/types/types/interfaces/i-freeze.d.ts +0 -21
- package/lib/types/types/interfaces/i-range.d.ts +0 -208
- package/lib/types/types/interfaces/i-row-data.d.ts +0 -26
- package/lib/types/types/interfaces/i-selection-data.d.ts +0 -58
- package/lib/types/types/interfaces/i-service-data.d.ts +0 -17
- package/lib/types/types/interfaces/i-univer-data.d.ts +0 -13
- package/lib/types/types/interfaces/i-workbook-data.d.ts +0 -39
- package/lib/types/types/interfaces/i-worksheet-data.d.ts +0 -54
- package/lib/types/types/interfaces/i-worksheet-order-data.d.ts +0 -17
- /package/lib/types/services/{snapshot/__tests__/snapshot-transform.spec.d.ts → __tests__/resources.spec.d.ts} +0 -0
- /package/lib/types/{types/interfaces/__tests__/i-cell-data.spec.d.ts → sheets/__tests__/cell-data.spec.d.ts} +0 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { LocaleType } from '../types/enum/locale-type';
|
|
2
|
+
import { IStyleData } from '../types/interfaces/i-style-data';
|
|
3
|
+
import { IResources } from '../services/resource-manager/type';
|
|
4
|
+
import { IObjectArrayPrimitiveType, IObjectMatrixPrimitiveType, Nullable } from '../shared';
|
|
5
|
+
import { BooleanNumber, CellValueType } from '../types/enum';
|
|
6
|
+
import { IDocumentData } from '../types/interfaces';
|
|
7
|
+
import { ICellCustomRender } from '../types/interfaces/i-cell-custom-render';
|
|
8
|
+
import { ICellValidationData } from '../types/interfaces/i-cell-validation-data';
|
|
9
|
+
/**
|
|
10
|
+
* Snapshot of a workbook.
|
|
11
|
+
*/
|
|
12
|
+
export interface IWorkbookData {
|
|
13
|
+
/**
|
|
14
|
+
* Id of the Univer Sheet.
|
|
15
|
+
*/
|
|
16
|
+
id: string;
|
|
17
|
+
/**
|
|
18
|
+
* Revision of this spreadsheet. Used in collaborated editing. Starts from one.
|
|
19
|
+
* @ignore
|
|
20
|
+
*/
|
|
21
|
+
rev?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Name of the Univer Sheet.
|
|
24
|
+
*/
|
|
25
|
+
name: string;
|
|
26
|
+
/**
|
|
27
|
+
* Version of Univer model definition.
|
|
28
|
+
*/
|
|
29
|
+
appVersion: string;
|
|
30
|
+
/**
|
|
31
|
+
* Locale of the document.
|
|
32
|
+
*/
|
|
33
|
+
locale: LocaleType;
|
|
34
|
+
/**
|
|
35
|
+
* Style references.
|
|
36
|
+
*/
|
|
37
|
+
styles: Record<string, Nullable<IStyleData>>;
|
|
38
|
+
/** Ids of {@link IWorksheetData}s of this Univer Sheet in sequence order. */
|
|
39
|
+
sheetOrder: string[];
|
|
40
|
+
/**
|
|
41
|
+
* Data of each {@link IWorksheetData} in this Univer Sheet.
|
|
42
|
+
*/
|
|
43
|
+
sheets: {
|
|
44
|
+
[sheetId: string]: Partial<IWorksheetData>;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Resources of the Univer Sheet. It is used to store the data of other plugins.
|
|
48
|
+
*/
|
|
49
|
+
resources?: IResources;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Snapshot of a worksheet.
|
|
53
|
+
*/
|
|
54
|
+
export interface IWorksheetData {
|
|
55
|
+
/**
|
|
56
|
+
* Id of the worksheet. This should be unique and immutable across the lifecycle of the worksheet.
|
|
57
|
+
*/
|
|
58
|
+
id: string;
|
|
59
|
+
/** Name of the sheet. */
|
|
60
|
+
name: string;
|
|
61
|
+
tabColor: string;
|
|
62
|
+
/**
|
|
63
|
+
* Determine whether the sheet is hidden.
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* See {@link BooleanNumber| the BooleanNumber enum} for more details.
|
|
67
|
+
*
|
|
68
|
+
* @defaultValue `BooleanNumber.FALSE`
|
|
69
|
+
*/
|
|
70
|
+
hidden: BooleanNumber;
|
|
71
|
+
freeze: IFreeze;
|
|
72
|
+
rowCount: number;
|
|
73
|
+
columnCount: number;
|
|
74
|
+
/** @deprecated */
|
|
75
|
+
zoomRatio: number;
|
|
76
|
+
/** @deprecated */
|
|
77
|
+
scrollTop: number;
|
|
78
|
+
/** @deprecated */
|
|
79
|
+
scrollLeft: number;
|
|
80
|
+
defaultColumnWidth: number;
|
|
81
|
+
defaultRowHeight: number;
|
|
82
|
+
/** All merged cells in this worksheet. */
|
|
83
|
+
mergeData: IRange[];
|
|
84
|
+
/** A matrix storing cell contents by row and column index. */
|
|
85
|
+
cellData: IObjectMatrixPrimitiveType<ICellData>;
|
|
86
|
+
rowData: IObjectArrayPrimitiveType<Partial<IRowData>>;
|
|
87
|
+
columnData: IObjectArrayPrimitiveType<Partial<IColumnData>>;
|
|
88
|
+
rowHeader: {
|
|
89
|
+
width: number;
|
|
90
|
+
hidden?: BooleanNumber;
|
|
91
|
+
};
|
|
92
|
+
columnHeader: {
|
|
93
|
+
height: number;
|
|
94
|
+
hidden?: BooleanNumber;
|
|
95
|
+
};
|
|
96
|
+
showGridlines: BooleanNumber;
|
|
97
|
+
rightToLeft: BooleanNumber;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Properties of row data
|
|
101
|
+
*/
|
|
102
|
+
export interface IRowData {
|
|
103
|
+
/**
|
|
104
|
+
* height in pixel
|
|
105
|
+
*/
|
|
106
|
+
h?: number;
|
|
107
|
+
/**
|
|
108
|
+
* is current row self-adaptive to its content, use `ah` to set row height when true, else use `h`.
|
|
109
|
+
*/
|
|
110
|
+
ia?: BooleanNumber;
|
|
111
|
+
/**
|
|
112
|
+
* auto height
|
|
113
|
+
*/
|
|
114
|
+
ah?: number;
|
|
115
|
+
/**
|
|
116
|
+
* hidden
|
|
117
|
+
*/
|
|
118
|
+
hd?: BooleanNumber;
|
|
119
|
+
}
|
|
120
|
+
export interface IRowAutoHeightInfo {
|
|
121
|
+
row: number;
|
|
122
|
+
autoHeight?: number;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Properties of column data
|
|
126
|
+
*/
|
|
127
|
+
export interface IColumnData {
|
|
128
|
+
/**
|
|
129
|
+
* width
|
|
130
|
+
*/
|
|
131
|
+
w?: number;
|
|
132
|
+
/**
|
|
133
|
+
* hidden
|
|
134
|
+
*/
|
|
135
|
+
hd?: BooleanNumber;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Cell value type
|
|
139
|
+
*/
|
|
140
|
+
export type CellValue = string | number | boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Cell data
|
|
143
|
+
*/
|
|
144
|
+
export interface ICellData {
|
|
145
|
+
/**
|
|
146
|
+
* The unique key, a random string, is used for the plug-in to associate the cell. When the cell information changes,
|
|
147
|
+
* the plug-in does not need to change the data, reducing the pressure on the back-end interface id?: string.
|
|
148
|
+
*/
|
|
149
|
+
p?: Nullable<IDocumentData>;
|
|
150
|
+
/** style id */
|
|
151
|
+
s?: Nullable<IStyleData | string>;
|
|
152
|
+
/**
|
|
153
|
+
* Origin value
|
|
154
|
+
*/
|
|
155
|
+
v?: Nullable<CellValue>;
|
|
156
|
+
t?: Nullable<CellValueType>;
|
|
157
|
+
/**
|
|
158
|
+
* Raw formula string. For example `=SUM(A1:B4)`.
|
|
159
|
+
*/
|
|
160
|
+
f?: Nullable<string>;
|
|
161
|
+
/**
|
|
162
|
+
* Id of the formula.
|
|
163
|
+
*/
|
|
164
|
+
si?: Nullable<string>;
|
|
165
|
+
/**
|
|
166
|
+
* User stored custom fields
|
|
167
|
+
*/
|
|
168
|
+
custom?: Nullable<Record<string, any>>;
|
|
169
|
+
}
|
|
170
|
+
export interface ICellMarksStyle {
|
|
171
|
+
color: string;
|
|
172
|
+
size: number;
|
|
173
|
+
}
|
|
174
|
+
export interface ICellMarks {
|
|
175
|
+
tl?: ICellMarksStyle;
|
|
176
|
+
tr?: ICellMarksStyle;
|
|
177
|
+
bl?: ICellMarksStyle;
|
|
178
|
+
br?: ICellMarksStyle;
|
|
179
|
+
isSkip?: boolean;
|
|
180
|
+
}
|
|
181
|
+
export interface ICellDataForSheetInterceptor extends ICellData {
|
|
182
|
+
interceptorStyle?: Nullable<IStyleData>;
|
|
183
|
+
isInArrayFormulaRange?: Nullable<boolean>;
|
|
184
|
+
dataValidation?: Nullable<ICellValidationData>;
|
|
185
|
+
markers?: ICellMarks;
|
|
186
|
+
customRender?: Nullable<ICellCustomRender[]>;
|
|
187
|
+
interceptorAutoHeight?: () => number | undefined;
|
|
188
|
+
/**
|
|
189
|
+
* can cell be covered when sibling is overflow
|
|
190
|
+
*/
|
|
191
|
+
coverable?: boolean;
|
|
192
|
+
}
|
|
193
|
+
export declare function isICellData(value: any): value is ICellData;
|
|
194
|
+
export declare function getCellValueType(cell: ICellData): CellValueType | null | undefined;
|
|
195
|
+
export declare function isNullCell(cell: Nullable<ICellData>): boolean;
|
|
196
|
+
export declare function isCellV(cell: Nullable<ICellData | CellValue>): cell is string | number | boolean;
|
|
197
|
+
export interface IFreeze {
|
|
198
|
+
xSplit: number;
|
|
199
|
+
ySplit: number;
|
|
200
|
+
startRow: number;
|
|
201
|
+
startColumn: number;
|
|
202
|
+
}
|
|
203
|
+
export declare enum RANGE_TYPE {
|
|
204
|
+
NORMAL = 0,
|
|
205
|
+
ROW = 1,
|
|
206
|
+
COLUMN = 2,
|
|
207
|
+
ALL = 3
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* none: A1
|
|
211
|
+
* row: A$1
|
|
212
|
+
* column: $A1
|
|
213
|
+
* all: $A$1
|
|
214
|
+
*/
|
|
215
|
+
export declare enum AbsoluteRefType {
|
|
216
|
+
NONE = 0,
|
|
217
|
+
ROW = 1,
|
|
218
|
+
COLUMN = 2,
|
|
219
|
+
ALL = 3
|
|
220
|
+
}
|
|
221
|
+
interface IRangeLocation {
|
|
222
|
+
/**
|
|
223
|
+
* Id of the Workbook the range belongs to.
|
|
224
|
+
* When this field is not defined, it should be considered as the range in the currently activated worksheet.
|
|
225
|
+
*/
|
|
226
|
+
unitId?: string;
|
|
227
|
+
/**
|
|
228
|
+
* Id of the Worksheet the range belongs to.
|
|
229
|
+
* When this field is not defined, it should be considered as the range in the currently activated worksheet.
|
|
230
|
+
*/
|
|
231
|
+
sheetId?: string;
|
|
232
|
+
}
|
|
233
|
+
export interface IRowRange extends IRangeLocation {
|
|
234
|
+
/**
|
|
235
|
+
* The start row (inclusive) of the range
|
|
236
|
+
* startRow
|
|
237
|
+
*/
|
|
238
|
+
startRow: number;
|
|
239
|
+
/**
|
|
240
|
+
* The end row (exclusive) of the range
|
|
241
|
+
* endRow
|
|
242
|
+
*/
|
|
243
|
+
endRow: number;
|
|
244
|
+
}
|
|
245
|
+
export interface IColumnRange extends IRangeLocation {
|
|
246
|
+
/**
|
|
247
|
+
* The start column (inclusive) of the range
|
|
248
|
+
* startColumn
|
|
249
|
+
*/
|
|
250
|
+
startColumn: number;
|
|
251
|
+
/**
|
|
252
|
+
* The end column (exclusive) of the range
|
|
253
|
+
* endColumn
|
|
254
|
+
*/
|
|
255
|
+
endColumn: number;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Range data structure
|
|
259
|
+
*
|
|
260
|
+
* One of the range types,
|
|
261
|
+
*
|
|
262
|
+
* e.g.,
|
|
263
|
+
* {
|
|
264
|
+
* startRow:0 ,
|
|
265
|
+
* startColumn:0,
|
|
266
|
+
* endRow:1,
|
|
267
|
+
* endColumn:1,
|
|
268
|
+
* }
|
|
269
|
+
*
|
|
270
|
+
* means "A1:B2"
|
|
271
|
+
*/
|
|
272
|
+
export interface IRange extends IRowRange, IColumnRange {
|
|
273
|
+
rangeType?: RANGE_TYPE;
|
|
274
|
+
startAbsoluteRefType?: AbsoluteRefType;
|
|
275
|
+
endAbsoluteRefType?: AbsoluteRefType;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Transform an `IRange` object to an array.
|
|
279
|
+
* @param range
|
|
280
|
+
* @returns [rowStart, colStart, rowEnd, colEnd]
|
|
281
|
+
*/
|
|
282
|
+
export declare function selectionToArray(range: IRange): [number, number, number, number];
|
|
283
|
+
/**
|
|
284
|
+
* Range data of grid
|
|
285
|
+
*/
|
|
286
|
+
export interface IGridRange {
|
|
287
|
+
sheetId: string;
|
|
288
|
+
range: IRange;
|
|
289
|
+
}
|
|
290
|
+
export interface IUnitRangeName {
|
|
291
|
+
unitId: string;
|
|
292
|
+
sheetName: string;
|
|
293
|
+
range: IRange;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Range data of Unit
|
|
297
|
+
*/
|
|
298
|
+
export interface IUnitRange extends IGridRange {
|
|
299
|
+
unitId: string;
|
|
300
|
+
}
|
|
301
|
+
export interface IUnitRangeWithName extends IUnitRange {
|
|
302
|
+
sheetName: string;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* One of the range types,
|
|
306
|
+
*
|
|
307
|
+
* e.g.,"A1:B2","sheet1!A1:B2","A1","1:1","A:A","AA1:BB2"
|
|
308
|
+
*/
|
|
309
|
+
export type IRangeStringData = string;
|
|
310
|
+
/**
|
|
311
|
+
* Row data type
|
|
312
|
+
*/
|
|
313
|
+
export type IRowStartEndData = [startRow: number, endRow: number] | number[];
|
|
314
|
+
/**
|
|
315
|
+
* Column data type
|
|
316
|
+
*/
|
|
317
|
+
export type IColumnStartEndData = [startColumn: number, endColumn: number] | number[];
|
|
318
|
+
/**
|
|
319
|
+
* One of the range types,
|
|
320
|
+
*
|
|
321
|
+
* e.g.,
|
|
322
|
+
* {
|
|
323
|
+
* row:[0,1],
|
|
324
|
+
* column:[0,1]
|
|
325
|
+
* }
|
|
326
|
+
*todo
|
|
327
|
+
|
|
328
|
+
true false 枚举
|
|
329
|
+
* means "A1:B2"
|
|
330
|
+
*/
|
|
331
|
+
export interface IRangeArrayData {
|
|
332
|
+
/**
|
|
333
|
+
* row
|
|
334
|
+
*/
|
|
335
|
+
row: IRowStartEndData;
|
|
336
|
+
/**
|
|
337
|
+
* column
|
|
338
|
+
*/
|
|
339
|
+
column: IColumnStartEndData;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* The row and column numbers represent a cell
|
|
343
|
+
*/
|
|
344
|
+
export interface IRangeCellData {
|
|
345
|
+
/**
|
|
346
|
+
* row
|
|
347
|
+
*/
|
|
348
|
+
row: number;
|
|
349
|
+
/**
|
|
350
|
+
* column
|
|
351
|
+
*/
|
|
352
|
+
column: number;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* range types
|
|
356
|
+
*
|
|
357
|
+
* Allow users to provide one of three formats, we need to convert to IRange to store
|
|
358
|
+
*/
|
|
359
|
+
export type IRangeType = IRange | IRangeStringData | IRangeArrayData | IRangeCellData;
|
|
360
|
+
/**
|
|
361
|
+
* Whether to clear only the contents. Whether to clear only the format; note that clearing format also clears data validation rules.
|
|
362
|
+
*/
|
|
363
|
+
export interface IOptionData {
|
|
364
|
+
/**
|
|
365
|
+
* 1. designates that only the format should be copied
|
|
366
|
+
*
|
|
367
|
+
* 2. Whether to clear only the format; note that clearing format also clears data validation rules.
|
|
368
|
+
*
|
|
369
|
+
* 3. worksheet Whether to clear the format.
|
|
370
|
+
*/
|
|
371
|
+
formatOnly?: boolean;
|
|
372
|
+
/**
|
|
373
|
+
* 1. designates that only the content should be copied
|
|
374
|
+
*
|
|
375
|
+
* 2. Whether to clear only the contents.
|
|
376
|
+
*
|
|
377
|
+
* 3. worksheet Whether to clear the content.
|
|
378
|
+
*
|
|
379
|
+
*/
|
|
380
|
+
contentsOnly?: boolean;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Option of copyTo function
|
|
384
|
+
*/
|
|
385
|
+
export interface ICopyToOptionsData extends IOptionData {
|
|
386
|
+
}
|
|
387
|
+
export interface IRectLTRB {
|
|
388
|
+
left: number;
|
|
389
|
+
top: number;
|
|
390
|
+
right: number;
|
|
391
|
+
bottom: number;
|
|
392
|
+
width?: number;
|
|
393
|
+
height?: number;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Properties of selection data
|
|
397
|
+
*/
|
|
398
|
+
export interface IPosition {
|
|
399
|
+
startX: number;
|
|
400
|
+
startY: number;
|
|
401
|
+
endX: number;
|
|
402
|
+
endY: number;
|
|
403
|
+
}
|
|
404
|
+
export interface ISingleCell {
|
|
405
|
+
actualRow: number;
|
|
406
|
+
actualColumn: number;
|
|
407
|
+
isMerged: boolean;
|
|
408
|
+
isMergedMainCell: boolean;
|
|
409
|
+
}
|
|
410
|
+
export interface IRangeWithCoord extends IPosition, IRange {
|
|
411
|
+
}
|
|
412
|
+
export interface ISelectionCell extends IRange, ISingleCell {
|
|
413
|
+
}
|
|
414
|
+
export interface ISelectionCellWithMergeInfo extends IPosition, ISingleCell {
|
|
415
|
+
mergeInfo: IRangeWithCoord;
|
|
416
|
+
}
|
|
417
|
+
export interface ISelection {
|
|
418
|
+
/**
|
|
419
|
+
* Sheet selection range.
|
|
420
|
+
*/
|
|
421
|
+
range: IRange;
|
|
422
|
+
/**
|
|
423
|
+
* The highlighted cell in the selection range. If there are several selections, only one selection would have a primary cell.
|
|
424
|
+
*/
|
|
425
|
+
primary: Nullable<ISelectionCell>;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Selection range Info, contains selectionrange & primaryrange
|
|
429
|
+
* primaryrange is the range of the highlighted cell.
|
|
430
|
+
*/
|
|
431
|
+
export interface ISelectionWithCoord {
|
|
432
|
+
rangeWithCoord: IRangeWithCoord;
|
|
433
|
+
primaryWithCoord: Nullable<ISelectionCellWithMergeInfo>;
|
|
434
|
+
}
|
|
435
|
+
export interface ITextRangeStart {
|
|
436
|
+
startOffset: number;
|
|
437
|
+
}
|
|
438
|
+
export interface ITextRange extends ITextRangeStart {
|
|
439
|
+
endOffset: number;
|
|
440
|
+
collapsed: boolean;
|
|
441
|
+
}
|
|
442
|
+
export interface ITextRangeParam extends ITextRange {
|
|
443
|
+
segmentId?: string;
|
|
444
|
+
segmentPage?: number;
|
|
445
|
+
isActive?: boolean;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Determines whether the cell(row, column) is within the range of the merged cells.
|
|
449
|
+
*/
|
|
450
|
+
export declare function getCellInfoInMergeData(row: number, column: number, mergeData?: IRange[]): ISelectionCell;
|
|
451
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IDisposable } from '../common/di';
|
|
2
|
-
import { Nullable } from '../common/type-util';
|
|
3
2
|
import { Disposable } from '../shared/lifecycle';
|
|
4
|
-
import {
|
|
3
|
+
import { Nullable } from '../shared/types';
|
|
4
|
+
import { ICellData, ICellDataForSheetInterceptor } from './typedef';
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { ILogService } from '../services/log/log.service';
|
|
3
3
|
import { Nullable } from '../shared';
|
|
4
|
-
import { IRangeType, IWorkbookData, IWorksheetData } from '../types/interfaces';
|
|
5
4
|
import { UnitModel, UniverInstanceType } from '../common/unit';
|
|
6
5
|
import { Styles } from './styles';
|
|
7
6
|
import { Worksheet } from './worksheet';
|
|
7
|
+
import { IRangeType, IWorkbookData, IWorksheetData } from './typedef';
|
|
8
8
|
export declare function getWorksheetUID(workbook: Workbook, worksheet: Worksheet): string;
|
|
9
9
|
/**
|
|
10
10
|
* Access and create Univer Sheets files
|
|
@@ -39,10 +39,21 @@ export declare class Workbook extends UnitModel<IWorkbookData, UniverInstanceTyp
|
|
|
39
39
|
private readonly _name$;
|
|
40
40
|
readonly name$: Observable<string>;
|
|
41
41
|
get name(): string;
|
|
42
|
+
static isIRangeType(range: IRangeType | IRangeType[]): boolean;
|
|
42
43
|
constructor(workbookData: Partial<IWorkbookData> | undefined, _logService: ILogService);
|
|
43
44
|
dispose(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Create a clone of the current snapshot.
|
|
47
|
+
* Call resourceLoaderService.saveWorkbook to save the data associated with the current plugin if needed.
|
|
48
|
+
* @memberof Workbook
|
|
49
|
+
*/
|
|
44
50
|
save(): IWorkbookData;
|
|
45
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Get current snapshot reference.
|
|
53
|
+
* Call resourceLoaderService.saveWorkbook to save the data associated with the current plugin if needed.
|
|
54
|
+
* @return {*} {IWorkbookData}
|
|
55
|
+
* @memberof Workbook
|
|
56
|
+
*/
|
|
46
57
|
getSnapshot(): IWorkbookData;
|
|
47
58
|
/** @deprecated use use name property instead */
|
|
48
59
|
getName(): string;
|
|
@@ -50,8 +61,6 @@ export declare class Workbook extends UnitModel<IWorkbookData, UniverInstanceTyp
|
|
|
50
61
|
getUnitId(): string;
|
|
51
62
|
getRev(): number;
|
|
52
63
|
incrementRev(): void;
|
|
53
|
-
getShouldRenderLoopImmediately(): boolean;
|
|
54
|
-
getContainer(): string | undefined;
|
|
55
64
|
/**
|
|
56
65
|
* Add a Worksheet into Workbook.
|
|
57
66
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Nullable, ObjectMatrix } from '../shared';
|
|
2
2
|
import { BooleanNumber } from '../types/enum';
|
|
3
|
-
import { ICellData, ICellDataForSheetInterceptor, IFreeze, IRange, IWorksheetData } from '../types/interfaces';
|
|
4
3
|
import { ColumnManager } from './column-manager';
|
|
5
4
|
import { Range } from './range';
|
|
6
5
|
import { RowManager } from './row-manager';
|
|
7
6
|
import { Styles } from './styles';
|
|
7
|
+
import { ICellData, ICellDataForSheetInterceptor, IFreeze, IRange, IWorksheetData } from './typedef';
|
|
8
8
|
import { SheetViewModel } from './view-model';
|
|
9
9
|
/**
|
|
10
10
|
* The model of a Worksheet.
|
|
@@ -72,6 +72,16 @@ export declare class Worksheet {
|
|
|
72
72
|
clone(): Worksheet;
|
|
73
73
|
getMergeData(): IRange[];
|
|
74
74
|
getMergedCell(row: number, col: number): Nullable<IRange>;
|
|
75
|
+
/**
|
|
76
|
+
* Get cellData, includes cellData, customRender, markers, dataValidate, etc.
|
|
77
|
+
*
|
|
78
|
+
* WARNING: All sheet CELL_CONTENT interceptors will be called in this method, cause performance issue.
|
|
79
|
+
* example: this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT);
|
|
80
|
+
*
|
|
81
|
+
* @param row
|
|
82
|
+
* @param col
|
|
83
|
+
* @returns ICellDataForSheetInterceptor
|
|
84
|
+
*/
|
|
75
85
|
getCell(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;
|
|
76
86
|
getCellRaw(row: number, col: number): Nullable<ICellData>;
|
|
77
87
|
getRowFiltered(row: number): boolean;
|
|
@@ -13,7 +13,6 @@ export declare class SlideDataModel extends UnitModel<ISlideData, UniverInstance
|
|
|
13
13
|
private _unitId;
|
|
14
14
|
constructor(snapshot: Partial<ISlideData>);
|
|
15
15
|
setName(name: string): void;
|
|
16
|
-
getContainer(): string | undefined;
|
|
17
16
|
getSnapshot(): ISlideData;
|
|
18
17
|
getUnitId(): string;
|
|
19
18
|
getPages(): {
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
/**
|
|
17
|
+
* Built-in locales.
|
|
18
|
+
*/
|
|
16
19
|
export declare enum LocaleType {
|
|
17
20
|
EN_US = "enUS",
|
|
18
21
|
ZH_CN = "zhCN",
|
|
@@ -20,4 +23,3 @@ export declare enum LocaleType {
|
|
|
20
23
|
ZH_TW = "zhTW",
|
|
21
24
|
VI_VN = "viVN"
|
|
22
25
|
}
|
|
23
|
-
export type LocaleTypes = `${LocaleType}`;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Nullable } from '../../shared';
|
|
2
2
|
import { Worksheet } from '../../sheets/worksheet';
|
|
3
3
|
import { Workbook } from '../../sheets/workbook';
|
|
4
|
-
import { ISelectionCellWithMergeInfo } from '
|
|
4
|
+
import { ICellDataForSheetInterceptor, ISelectionCellWithMergeInfo } from '../../sheets/typedef';
|
|
5
5
|
import { IStyleData } from './i-style-data';
|
|
6
|
-
import { ICellDataForSheetInterceptor } from './i-cell-data';
|
|
7
6
|
export interface ICellRenderContext {
|
|
8
7
|
data: ICellDataForSheetInterceptor;
|
|
9
8
|
style: Nullable<IStyleData>;
|
|
@@ -17,6 +16,7 @@ export interface ICellRenderContext {
|
|
|
17
16
|
}
|
|
18
17
|
/**
|
|
19
18
|
* @debt This shouldn't exist in core package.
|
|
19
|
+
* @ignore
|
|
20
20
|
*
|
|
21
21
|
* @deprecated This interface is subject to change in the future.
|
|
22
22
|
*/
|
|
@@ -3,7 +3,7 @@ import { DataValidationType } from '../enum/data-validation-type';
|
|
|
3
3
|
import { DataValidationImeMode } from '../enum/data-validation-ime-mode';
|
|
4
4
|
import { DataValidationErrorStyle } from '../enum/data-validation-error-style';
|
|
5
5
|
import { DataValidationRenderMode } from '../enum/data-validation-render-mode';
|
|
6
|
-
import { IRange } from '
|
|
6
|
+
import { IRange } from '../../sheets/typedef';
|
|
7
7
|
export interface IDataValidationRuleBase {
|
|
8
8
|
type: DataValidationType;
|
|
9
9
|
allowBlank?: boolean;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { Nullable } from '../../common/type-util';
|
|
2
1
|
import { IAbsoluteTransform, ISize } from '../../shared/shape';
|
|
2
|
+
import { Nullable } from '../../shared/types';
|
|
3
3
|
import { BooleanNumber, CellValueType, HorizontalAlign, LocaleType, TextDirection, VerticalAlign, WrapStrategy } from '../enum';
|
|
4
|
-
import { IExtraModelData } from './i-extra-model-data';
|
|
5
4
|
import { IColorStyle, IStyleBase } from './i-style-data';
|
|
6
5
|
/**
|
|
7
6
|
* Properties of document
|
|
8
7
|
*/
|
|
9
|
-
export interface IDocumentData extends IReferenceSource
|
|
8
|
+
export interface IDocumentData extends IReferenceSource {
|
|
10
9
|
/** unit ID */
|
|
11
10
|
id: string;
|
|
12
11
|
/** Revision of this document. Would be used in collaborated editing. Starts with zero. */
|
|
@@ -148,7 +147,6 @@ export interface IListData {
|
|
|
148
147
|
*/
|
|
149
148
|
export interface INestingLevel {
|
|
150
149
|
paragraphProperties?: IParagraphStyle;
|
|
151
|
-
paragraphTextStyle?: ITextStyle;
|
|
152
150
|
bulletAlignment: BulletAlignment;
|
|
153
151
|
glyphFormat: string;
|
|
154
152
|
textStyle?: ITextStyle;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { ISize } from '../../shared/shape';
|
|
2
2
|
import { IKeyType, Nullable } from '../../shared/types';
|
|
3
|
+
import { IWorksheetData } from '../../sheets/typedef';
|
|
3
4
|
import { LocaleType, ThemeColorType } from '../enum';
|
|
4
5
|
import { ShapeType } from '../enum/prst-geom-type';
|
|
5
6
|
import { ICustomBlock, IDocumentData, ILists, ITransformState } from './i-document-data';
|
|
6
|
-
import { IExtraModelData } from './i-extra-model-data';
|
|
7
7
|
import { IImageProperties } from './i-image-properties';
|
|
8
8
|
import { IPlaceholder } from './i-placeholder';
|
|
9
9
|
import { IShapeProperties } from './i-shape-properties';
|
|
10
10
|
import { IColorStyle, IStyleBase, IStyleData } from './i-style-data';
|
|
11
|
-
|
|
12
|
-
export interface ISlideData extends IReferenceSource, IExtraModelData {
|
|
11
|
+
export interface ISlideData extends IReferenceSource {
|
|
13
12
|
id: string;
|
|
14
13
|
locale?: LocaleType;
|
|
15
14
|
title: string;
|
|
@@ -96,11 +95,14 @@ export interface IPageElement {
|
|
|
96
95
|
shape?: IShape;
|
|
97
96
|
image?: IImage;
|
|
98
97
|
richText?: IRichTextProps;
|
|
98
|
+
/** @deprecated */
|
|
99
99
|
spreadsheet?: {
|
|
100
100
|
worksheet: IWorksheetData;
|
|
101
101
|
styles: IKeyType<Nullable<IStyleData>>;
|
|
102
102
|
};
|
|
103
|
+
/** @deprecated */
|
|
103
104
|
document?: IDocumentData;
|
|
105
|
+
/** @deprecated */
|
|
104
106
|
slide?: ISlideData;
|
|
105
107
|
customBlock?: ICustomBlock;
|
|
106
108
|
}
|
|
@@ -13,21 +13,10 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export * from './i-cell-data';
|
|
17
|
-
export * from './i-column-data';
|
|
18
16
|
export * from './i-document-data';
|
|
19
17
|
export * from './i-document-data-interceptor';
|
|
20
|
-
export * from './i-freeze';
|
|
21
18
|
export * from './i-image-properties';
|
|
22
19
|
export * from './i-placeholder';
|
|
23
|
-
export * from './i-range';
|
|
24
|
-
export * from './i-row-data';
|
|
25
|
-
export * from './i-selection-data';
|
|
26
|
-
export * from './i-service-data';
|
|
27
20
|
export * from './i-shape-properties';
|
|
28
21
|
export * from './i-slide-data';
|
|
29
22
|
export * from './i-style-data';
|
|
30
|
-
export * from './i-univer-data';
|
|
31
|
-
export * from './i-workbook-data';
|
|
32
|
-
export * from './i-worksheet-data';
|
|
33
|
-
export * from './i-worksheet-order-data';
|