@univerjs/sheets 0.5.4 → 0.5.5-nightly.202501201336
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/facade.js +1 -1
- package/lib/cjs/index.js +3 -3
- package/lib/es/facade.js +2021 -1010
- package/lib/es/index.js +2214 -1996
- package/lib/types/basics/const/command-listener-const.d.ts +149 -13
- package/lib/types/commands/commands/remove-sheet.command.d.ts +1 -1
- package/lib/types/commands/commands/split-text-to-columns.command.d.ts +1 -1
- package/lib/types/commands/operations/selection.operation.d.ts +1 -0
- package/lib/types/commands/utils/selection-command-util.d.ts +1 -1
- package/lib/types/controllers/config.schema.d.ts +4 -0
- package/lib/types/facade/f-enum.d.ts +21 -0
- package/lib/types/facade/f-event.d.ts +470 -21
- package/lib/types/facade/f-range.d.ts +363 -51
- package/lib/types/facade/f-selection.d.ts +24 -0
- package/lib/types/facade/f-univer.d.ts +30 -0
- package/lib/types/facade/f-workbook.d.ts +44 -55
- package/lib/types/facade/f-worksheet.d.ts +652 -208
- package/lib/types/facade/index.d.ts +2 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/model/range-theme-util.d.ts +3 -3
- package/lib/types/services/selections/selection-data-model.d.ts +7 -7
- package/lib/types/services/selections/selection.service.d.ts +4 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +3 -3
- package/package.json +6 -6
- package/LICENSE +0 -176
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CellValue, CustomData, ICellData, IDocumentData, IObjectMatrixPrimitiveType, IRange, IStyleData, Nullable, Workbook, Worksheet, FBaseInitialable, ICommandService, Injector, RichTextValue, WrapStrategy } from '@univerjs/core';
|
|
1
|
+
import { BorderStyleTypes, BorderType, CellValue, CustomData, ICellData, IDocumentData, IObjectMatrixPrimitiveType, IRange, IStyleData, Nullable, Workbook, Worksheet, FBaseInitialable, ICommandService, Injector, RichTextValue, TextStyleValue, WrapStrategy } from '@univerjs/core';
|
|
2
2
|
import { SplitDelimiterEnum } from '@univerjs/sheets';
|
|
3
3
|
import { FHorizontalAlignment, FVerticalAlignment } from './utils';
|
|
4
4
|
import { FormulaDataModel } from '@univerjs/engine-formula';
|
|
@@ -15,70 +15,202 @@ export declare class FRange extends FBaseInitialable {
|
|
|
15
15
|
constructor(_workbook: Workbook, _worksheet: Worksheet, _range: IRange, _injector: Injector, _commandService: ICommandService, _formulaDataModel: FormulaDataModel);
|
|
16
16
|
/**
|
|
17
17
|
* Get the unit ID of the current workbook
|
|
18
|
-
* @returns The unit ID of the workbook
|
|
18
|
+
* @returns {string} The unit ID of the workbook
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* univerAPI.getActiveWorkbook()
|
|
22
|
+
* .getActiveSheet()
|
|
23
|
+
* .getActiveRange()
|
|
24
|
+
* .getUnitId()
|
|
25
|
+
* ```
|
|
19
26
|
*/
|
|
20
27
|
getUnitId(): string;
|
|
21
28
|
/**
|
|
22
29
|
* Gets the name of the worksheet
|
|
23
|
-
* @returns The name of the worksheet
|
|
30
|
+
* @returns {string} The name of the worksheet
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* univerAPI.getActiveWorkbook()
|
|
34
|
+
* .getActiveSheet()
|
|
35
|
+
* .getActiveRange()
|
|
36
|
+
* .getSheetName()
|
|
37
|
+
* ```
|
|
24
38
|
*/
|
|
25
39
|
getSheetName(): string;
|
|
26
40
|
/**
|
|
27
41
|
* Gets the ID of the worksheet
|
|
28
|
-
* @returns The ID of the worksheet
|
|
42
|
+
* @returns {string} The ID of the worksheet
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* univerAPI.getActiveWorkbook()
|
|
46
|
+
* .getActiveSheet()
|
|
47
|
+
* .getActiveRange()
|
|
48
|
+
* .getSheetId()
|
|
49
|
+
* ```
|
|
29
50
|
*/
|
|
30
51
|
getSheetId(): string;
|
|
31
52
|
/**
|
|
32
53
|
* Gets the area where the statement is applied
|
|
33
|
-
* @returns The area where the statement is applied
|
|
54
|
+
* @returns {IRange} The area where the statement is applied
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* univerAPI.getActiveWorkbook()
|
|
58
|
+
* .getActiveSheet()
|
|
59
|
+
* .getActiveRange()
|
|
60
|
+
* .getRange()
|
|
61
|
+
* ```
|
|
34
62
|
*/
|
|
35
63
|
getRange(): IRange;
|
|
36
64
|
/**
|
|
37
65
|
* Gets the starting row number of the applied area
|
|
38
|
-
* @returns The starting row number of the area
|
|
66
|
+
* @returns {number} The starting row number of the area
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* univerAPI.getActiveWorkbook()
|
|
70
|
+
* .getActiveSheet()
|
|
71
|
+
* .getActiveRange()
|
|
72
|
+
* .getRow()
|
|
73
|
+
* ```
|
|
39
74
|
*/
|
|
40
75
|
getRow(): number;
|
|
41
76
|
/**
|
|
42
77
|
* Gets the starting column number of the applied area
|
|
43
|
-
* @returns The starting column number of the area
|
|
78
|
+
* @returns {number} The starting column number of the area
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* univerAPI.getActiveWorkbook()
|
|
82
|
+
* .getActiveSheet()
|
|
83
|
+
* .getActiveRange()
|
|
84
|
+
* .getColumn()
|
|
85
|
+
* ```
|
|
44
86
|
*/
|
|
45
87
|
getColumn(): number;
|
|
46
88
|
/**
|
|
47
89
|
* Gets the width of the applied area
|
|
48
|
-
* @returns The width of the area
|
|
90
|
+
* @returns {number} The width of the area
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* univerAPI.getActiveWorkbook()
|
|
94
|
+
* .getActiveSheet()
|
|
95
|
+
* .getActiveRange()
|
|
96
|
+
* .getWidth()
|
|
97
|
+
* ```
|
|
49
98
|
*/
|
|
50
99
|
getWidth(): number;
|
|
51
100
|
/**
|
|
52
101
|
* Gets the height of the applied area
|
|
53
|
-
* @returns The height of the area
|
|
102
|
+
* @returns {number} The height of the area
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* univerAPI.getActiveWorkbook()
|
|
106
|
+
* .getActiveSheet()
|
|
107
|
+
* .getActiveRange()
|
|
108
|
+
* .getHeight()
|
|
109
|
+
* ```
|
|
54
110
|
*/
|
|
55
111
|
getHeight(): number;
|
|
56
112
|
/**
|
|
57
113
|
* Return range whether this range is merged
|
|
58
|
-
* @returns if true is merged
|
|
114
|
+
* @returns {boolean} if true is merged
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* univerAPI.getActiveWorkbook()
|
|
118
|
+
* .getActiveSheet()
|
|
119
|
+
* .getActiveRange()
|
|
120
|
+
* .isMerged()
|
|
121
|
+
* ```
|
|
59
122
|
*/
|
|
60
123
|
isMerged(): boolean;
|
|
61
124
|
/**
|
|
62
125
|
* Return first cell style data in this range
|
|
63
126
|
* @returns {IStyleData | null} The cell style data
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* univerAPI.getActiveWorkbook()
|
|
130
|
+
* .getActiveSheet()
|
|
131
|
+
* .getActiveRange()
|
|
132
|
+
* .getCellStyleData()
|
|
133
|
+
* ```
|
|
64
134
|
*/
|
|
65
135
|
getCellStyleData(): IStyleData | null;
|
|
66
136
|
/**
|
|
67
|
-
*
|
|
68
|
-
* @returns {
|
|
137
|
+
* Return first cell style in this range
|
|
138
|
+
* @returns {TextStyleValue | null} The cell style
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* univerAPI.getActiveWorkbook()
|
|
142
|
+
* .getActiveSheet()
|
|
143
|
+
* .getActiveRange()
|
|
144
|
+
* .getCellStyle()
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
getCellStyle(): TextStyleValue | null;
|
|
148
|
+
/**
|
|
149
|
+
* Returns the cell styles for the cells in the range.
|
|
150
|
+
* @returns {Array<Array<TextStyleValue | null>>} A two-dimensional array of cell styles.
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* univerAPI.getActiveWorkbook()
|
|
154
|
+
* .getActiveSheet()
|
|
155
|
+
* .getActiveRange()
|
|
156
|
+
* .getCellStyles()
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
getCellStyles(): Array<Array<TextStyleValue | null>>;
|
|
160
|
+
/**
|
|
161
|
+
* Return first cell value in this range
|
|
162
|
+
* @returns {CellValue | null} The cell value
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* univerAPI.getActiveWorkbook()
|
|
166
|
+
* .getActiveSheet()
|
|
167
|
+
* .getActiveRange()
|
|
168
|
+
* .getValue()
|
|
169
|
+
* ```
|
|
69
170
|
*/
|
|
70
171
|
getValue(): CellValue | null;
|
|
71
172
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* @returns {
|
|
173
|
+
* Return first cell value in this range
|
|
174
|
+
* @param {boolean} includeRichText Should the returns of this func to include rich text
|
|
175
|
+
* @returns {CellValue | RichTextValue | null} The cell value
|
|
176
|
+
* @example
|
|
177
|
+
* ```ts
|
|
178
|
+
* univerAPI.getActiveWorkbook()
|
|
179
|
+
* .getActiveSheet()
|
|
180
|
+
* .getActiveRange()
|
|
181
|
+
* .getValue(true)
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
getValue(includeRichText: true): Nullable<CellValue | RichTextValue>;
|
|
185
|
+
/**
|
|
186
|
+
* Returns the cell values for the cells in the range.
|
|
187
|
+
* @returns {Nullable<CellValue>[][]} A two-dimensional array of cell values.
|
|
188
|
+
* @example
|
|
189
|
+
* ```ts
|
|
190
|
+
* // Get plain values
|
|
191
|
+
* const values = range.getValues();
|
|
192
|
+
* ```
|
|
75
193
|
*/
|
|
76
194
|
getValues(): Nullable<CellValue>[][];
|
|
195
|
+
/**
|
|
196
|
+
* Returns the cell values for the cells in the range.
|
|
197
|
+
* @param {boolean} includeRichText Should the returns of this func to include rich text
|
|
198
|
+
* @returns {Nullable<RichTextValue | CellValue>[][]} A two-dimensional array of cell values.
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* // Get values with rich text if available
|
|
202
|
+
* const richTextValues = univerAPI.getActiveWorkbook()
|
|
203
|
+
* .getActiveSheet()
|
|
204
|
+
* .getActiveRange()
|
|
205
|
+
* .getValues(true)
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
getValues(includeRichText: true): (Nullable<RichTextValue | CellValue>)[][];
|
|
77
209
|
/**
|
|
78
210
|
* Return first cell model data in this range
|
|
79
211
|
* @returns {ICellData | null} The cell model data
|
|
80
212
|
* @example
|
|
81
|
-
* ```
|
|
213
|
+
* ```ts
|
|
82
214
|
* univerAPI.getActiveWorkbook()
|
|
83
215
|
* .getActiveSheet()
|
|
84
216
|
* .getActiveRange()
|
|
@@ -87,10 +219,10 @@ export declare class FRange extends FBaseInitialable {
|
|
|
87
219
|
*/
|
|
88
220
|
getCellData(): ICellData | null;
|
|
89
221
|
/**
|
|
90
|
-
*
|
|
222
|
+
* Alias for getCellDataGrid.
|
|
91
223
|
* @returns {Nullable<ICellData>[][]} A two-dimensional array of cell data.
|
|
92
224
|
* @example
|
|
93
|
-
* ```
|
|
225
|
+
* ```ts
|
|
94
226
|
* univerAPI.getActiveWorkbook()
|
|
95
227
|
* .getActiveSheet()
|
|
96
228
|
* .getActiveRange()
|
|
@@ -99,50 +231,64 @@ export declare class FRange extends FBaseInitialable {
|
|
|
99
231
|
*/
|
|
100
232
|
getCellDatas(): Nullable<ICellData>[][];
|
|
101
233
|
/**
|
|
102
|
-
*
|
|
234
|
+
* Returns the cell data for the cells in the range.
|
|
235
|
+
* @returns {Nullable<ICellData>[][]} A two-dimensional array of cell data.
|
|
236
|
+
* @example
|
|
237
|
+
* ```ts
|
|
238
|
+
* univerAPI.getActiveWorkbook()
|
|
239
|
+
* .getActiveSheet()
|
|
240
|
+
* .getActiveRange()
|
|
241
|
+
* .getCellDataGrid()
|
|
242
|
+
* ```
|
|
103
243
|
*/
|
|
104
244
|
getCellDataGrid(): Nullable<ICellData>[][];
|
|
105
245
|
/**
|
|
106
246
|
* Returns the rich text value for the cell at the start of this range.
|
|
107
247
|
* @returns {Nullable<RichTextValue>} The rich text value
|
|
248
|
+
* @internal
|
|
249
|
+
* @beta
|
|
108
250
|
* @example
|
|
109
|
-
* ```
|
|
251
|
+
* ```ts
|
|
110
252
|
* univerAPI.getActiveWorkbook()
|
|
111
253
|
* .getActiveSheet()
|
|
112
254
|
* .getActiveRange()
|
|
113
255
|
* .getRichTextValue()
|
|
114
256
|
* ```
|
|
115
257
|
*/
|
|
116
|
-
getRichTextValue
|
|
258
|
+
private getRichTextValue;
|
|
117
259
|
/**
|
|
118
260
|
* Returns the rich text value for the cells in the range.
|
|
119
261
|
* @returns {Nullable<RichTextValue>[][]} A two-dimensional array of RichTextValue objects.
|
|
262
|
+
* @internal
|
|
263
|
+
* @beta
|
|
120
264
|
* @example
|
|
121
|
-
* ```
|
|
265
|
+
* ```ts
|
|
122
266
|
* univerAPI.getActiveWorkbook()
|
|
123
267
|
* .getActiveSheet()
|
|
124
268
|
* .getActiveRange()
|
|
125
269
|
* .getRichTextValues()
|
|
126
270
|
* ```
|
|
127
271
|
*/
|
|
128
|
-
getRichTextValues
|
|
272
|
+
private getRichTextValues;
|
|
129
273
|
/**
|
|
130
274
|
* Returns the value and rich text value for the cell at the start of this range.
|
|
131
275
|
* @returns {Nullable<CellValue | RichTextValue>} The value and rich text value
|
|
276
|
+
* @internal
|
|
277
|
+
* @beta
|
|
132
278
|
* @example
|
|
133
|
-
* ```
|
|
279
|
+
* ```ts
|
|
134
280
|
* univerAPI.getActiveWorkbook()
|
|
135
281
|
* .getActiveSheet()
|
|
136
282
|
* .getActiveRange()
|
|
137
283
|
* .getValueAndRichTextValue()
|
|
138
284
|
* ```
|
|
139
285
|
*/
|
|
140
|
-
getValueAndRichTextValue
|
|
286
|
+
private getValueAndRichTextValue;
|
|
141
287
|
/**
|
|
142
288
|
* Returns the value and rich text value for the cells in the range.
|
|
143
289
|
* @returns {Nullable<CellValue | RichTextValue>[][]} A two-dimensional array of value and rich text value
|
|
144
290
|
* @example
|
|
145
|
-
* ```
|
|
291
|
+
* ```ts
|
|
146
292
|
* univerAPI.getActiveWorkbook()
|
|
147
293
|
* .getActiveSheet()
|
|
148
294
|
* .getActiveRange()
|
|
@@ -162,9 +308,53 @@ export declare class FRange extends FBaseInitialable {
|
|
|
162
308
|
* ```
|
|
163
309
|
*/
|
|
164
310
|
getFormulas(): string[][];
|
|
311
|
+
/**
|
|
312
|
+
* Returns true if the cell wrap is enabled
|
|
313
|
+
* @returns {boolean} True if the cell wrap is enabled
|
|
314
|
+
* @example
|
|
315
|
+
* ```ts
|
|
316
|
+
* univerAPI.getActiveWorkbook()
|
|
317
|
+
* .getActiveSheet()
|
|
318
|
+
* .getActiveRange()
|
|
319
|
+
* .getWrap()
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
165
322
|
getWrap(): boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Returns the text wrapping strategy for the top left cell of the range.
|
|
325
|
+
* @returns {WrapStrategy} The text wrapping strategy
|
|
326
|
+
* @example
|
|
327
|
+
* ```ts
|
|
328
|
+
* univerAPI.getActiveWorkbook()
|
|
329
|
+
* .getActiveSheet()
|
|
330
|
+
* .getActiveRange()
|
|
331
|
+
* .getWrapStrategy()
|
|
332
|
+
* ```
|
|
333
|
+
*/
|
|
166
334
|
getWrapStrategy(): WrapStrategy;
|
|
335
|
+
/**
|
|
336
|
+
* Returns the horizontal alignment for the top left cell of the range.
|
|
337
|
+
* @returns {string} The horizontal alignment
|
|
338
|
+
* @example
|
|
339
|
+
* ```ts
|
|
340
|
+
* univerAPI.getActiveWorkbook()
|
|
341
|
+
* .getActiveSheet()
|
|
342
|
+
* .getActiveRange()
|
|
343
|
+
* .getHorizontalAlignment()
|
|
344
|
+
* ```
|
|
345
|
+
*/
|
|
167
346
|
getHorizontalAlignment(): string;
|
|
347
|
+
/**
|
|
348
|
+
* Returns the vertical alignment for the top left cell of the range.
|
|
349
|
+
* @returns {string} The vertical alignment
|
|
350
|
+
* @example
|
|
351
|
+
* ```ts
|
|
352
|
+
* univerAPI.getActiveWorkbook()
|
|
353
|
+
* .getActiveSheet()
|
|
354
|
+
* .getActiveRange()
|
|
355
|
+
* .getVerticalAlignment()
|
|
356
|
+
* ```
|
|
357
|
+
*/
|
|
168
358
|
getVerticalAlignment(): string;
|
|
169
359
|
/**
|
|
170
360
|
* Set custom meta data for first cell in current range.
|
|
@@ -215,10 +405,26 @@ export declare class FRange extends FBaseInitialable {
|
|
|
215
405
|
*/
|
|
216
406
|
getCustomMetaDatas(): Nullable<CustomData>[][];
|
|
217
407
|
/**
|
|
218
|
-
*
|
|
219
|
-
* @param
|
|
408
|
+
* Sets basic border properties for the current range.
|
|
409
|
+
* @param {BorderType} type The type of border to apply
|
|
410
|
+
* @param {BorderStyleTypes} style The border style
|
|
411
|
+
* @param {string} [color] Optional border color in CSS notation
|
|
412
|
+
* @returns {FRange} This range, for chaining
|
|
220
413
|
* @example
|
|
414
|
+
* ```ts
|
|
415
|
+
* univerAPI.getActiveWorkbook()
|
|
416
|
+
* .getActiveSheet()
|
|
417
|
+
* .getActiveRange()
|
|
418
|
+
* .setBorder(BorderType.ALL, BorderStyleType.THIN, '#ff0000');
|
|
221
419
|
* ```
|
|
420
|
+
*/
|
|
421
|
+
setBorder(type: BorderType, style: BorderStyleTypes, color?: string): FRange;
|
|
422
|
+
/**
|
|
423
|
+
* Set background color for current range.
|
|
424
|
+
* @param {string} color The background color
|
|
425
|
+
* @returns {FRange} This range, for chaining
|
|
426
|
+
* @example
|
|
427
|
+
* ```ts
|
|
222
428
|
* univerAPI.getActiveWorkbook()
|
|
223
429
|
* .getActiveSheet()
|
|
224
430
|
* .getActiveRange()
|
|
@@ -228,21 +434,30 @@ export declare class FRange extends FBaseInitialable {
|
|
|
228
434
|
setBackgroundColor(color: string): FRange;
|
|
229
435
|
/**
|
|
230
436
|
* Set background color for current range.
|
|
437
|
+
* @param {string} color The background color
|
|
438
|
+
* @returns {FRange} This range, for chaining
|
|
231
439
|
* @example
|
|
232
440
|
* ```typescript
|
|
233
441
|
* univerAPI.getActiveWorkbook().getActiveSheet().getActiveRange().setBackground('red')
|
|
234
442
|
* ```
|
|
235
|
-
* @param color {string}
|
|
236
443
|
*/
|
|
237
444
|
setBackground(color: string): FRange;
|
|
238
445
|
/**
|
|
239
446
|
* Set new value for current cell, first cell in this range.
|
|
240
447
|
* @param {CellValue | ICellData} value The value can be a number, string, boolean, or standard cell format. If it begins with `=`, it is interpreted as a formula. The value is tiled to all cells in the range.
|
|
448
|
+
* @returns {FRange} This range, for chaining
|
|
449
|
+
* ```ts
|
|
450
|
+
* univerAPI.getActiveWorkbook()
|
|
451
|
+
* .getActiveSheet()
|
|
452
|
+
* .getActiveRange()
|
|
453
|
+
* .setValue(1);
|
|
454
|
+
* ```
|
|
241
455
|
*/
|
|
242
456
|
setValue(value: CellValue | ICellData): FRange;
|
|
243
457
|
/**
|
|
244
458
|
* Set new value for current cell, first cell in this range.
|
|
245
459
|
* @param {CellValue | ICellData} value The value can be a number, string, boolean, or standard cell format. If it begins with `=`, it is interpreted as a formula. The value is tiled to all cells in the range.
|
|
460
|
+
* @returns {FRange} This range, for chaining
|
|
246
461
|
* ```ts
|
|
247
462
|
* univerAPI.getActiveWorkbook()
|
|
248
463
|
* .getActiveSheet()
|
|
@@ -281,73 +496,170 @@ export declare class FRange extends FBaseInitialable {
|
|
|
281
496
|
/**
|
|
282
497
|
* Set the cell wrap of the given range.
|
|
283
498
|
* Cells with wrap enabled (the default) resize to display their full content. Cells with wrap disabled display as much as possible in the cell without resizing or running to multiple lines.
|
|
284
|
-
* @param isWrapEnabled
|
|
499
|
+
* @param {boolean} isWrapEnabled Whether to enable wrap
|
|
500
|
+
* @returns {FRange} this range, for chaining
|
|
501
|
+
* @example
|
|
502
|
+
* ```ts
|
|
503
|
+
* univerAPI.getActiveWorkbook()
|
|
504
|
+
* .getActiveSheet()
|
|
505
|
+
* .getActiveRange()
|
|
506
|
+
* .setWrap(true);
|
|
507
|
+
* ```
|
|
285
508
|
*/
|
|
286
509
|
setWrap(isWrapEnabled: boolean): FRange;
|
|
287
510
|
/**
|
|
288
511
|
* Sets the text wrapping strategy for the cells in the range.
|
|
289
|
-
* @param strategy
|
|
512
|
+
* @param {WrapStrategy} strategy The text wrapping strategy
|
|
513
|
+
* @returns {FRange} this range, for chaining
|
|
514
|
+
* @example
|
|
515
|
+
* ```ts
|
|
516
|
+
* univerAPI.getActiveWorkbook()
|
|
517
|
+
* .getActiveSheet()
|
|
518
|
+
* .getActiveRange()
|
|
519
|
+
* .setWrapStrategy(WrapStrategy.WRAP);
|
|
520
|
+
* ```
|
|
290
521
|
*/
|
|
291
522
|
setWrapStrategy(strategy: WrapStrategy): FRange;
|
|
292
523
|
/**
|
|
293
524
|
* Set the vertical (top to bottom) alignment for the given range (top/middle/bottom).
|
|
294
|
-
* @param alignment
|
|
525
|
+
* @param {"top" | "middle" | "bottom"} alignment The vertical alignment
|
|
526
|
+
* @returns {FRange} this range, for chaining
|
|
527
|
+
* @example
|
|
528
|
+
* ```ts
|
|
529
|
+
* univerAPI.getActiveWorkbook()
|
|
530
|
+
* .getActiveSheet()
|
|
531
|
+
* .getActiveRange()
|
|
532
|
+
* .setVerticalAlignment('top');
|
|
533
|
+
* ```
|
|
295
534
|
*/
|
|
296
535
|
setVerticalAlignment(alignment: FVerticalAlignment): FRange;
|
|
297
536
|
/**
|
|
298
537
|
* Set the horizontal (left to right) alignment for the given range (left/center/right).
|
|
299
|
-
* @param alignment
|
|
538
|
+
* @param {"left" | "center" | "normal"} alignment The horizontal alignment
|
|
539
|
+
* @returns {FRange} this range, for chaining
|
|
540
|
+
* @example
|
|
541
|
+
* ```ts
|
|
542
|
+
* univerAPI.getActiveWorkbook()
|
|
543
|
+
* .getActiveSheet()
|
|
544
|
+
* .getActiveRange()
|
|
545
|
+
* .setHorizontalAlignment('left');
|
|
546
|
+
* ```
|
|
300
547
|
*/
|
|
301
548
|
setHorizontalAlignment(alignment: FHorizontalAlignment): FRange;
|
|
302
549
|
/**
|
|
303
550
|
* Sets a different value for each cell in the range. The value can be a two-dimensional array or a standard range matrix (must match the dimensions of this range), consisting of numbers, strings, Boolean values or Composed of standard cell formats. If a value begins with `=`, it is interpreted as a formula.
|
|
304
|
-
* @param value
|
|
551
|
+
* @param {CellValue[][] | IObjectMatrixPrimitiveType<CellValue> | ICellData[][] | IObjectMatrixPrimitiveType<ICellData>} value The value can be a two-dimensional array or a standard range matrix (must match the dimensions of this range), consisting of numbers, strings, Boolean values or Composed of standard cell formats.
|
|
552
|
+
* @returns {FRange} This range, for chaining
|
|
553
|
+
* @example
|
|
554
|
+
* ```ts
|
|
555
|
+
* univerAPI.getActiveWorkbook()
|
|
556
|
+
* .getActiveSheet()
|
|
557
|
+
* .getActiveRange()
|
|
558
|
+
* .setValues([[1, 2], [3, 4]]);
|
|
559
|
+
* ```
|
|
305
560
|
*/
|
|
306
561
|
setValues(value: CellValue[][] | IObjectMatrixPrimitiveType<CellValue> | ICellData[][] | IObjectMatrixPrimitiveType<ICellData>): FRange;
|
|
307
562
|
/**
|
|
308
563
|
* Sets the font weight for the given range (normal/bold),
|
|
309
|
-
* @param fontWeight The font weight, either 'normal' or 'bold'; a null value resets the font weight.
|
|
564
|
+
* @param {FontWeight|null} fontWeight The font weight, either 'normal' or 'bold'; a null value resets the font weight.
|
|
565
|
+
* @returns {FRange} This range, for chaining
|
|
566
|
+
* @example
|
|
567
|
+
* ```ts
|
|
568
|
+
* univerAPI.getActiveWorkbook()
|
|
569
|
+
* .getActiveSheet()
|
|
570
|
+
* .getActiveRange()
|
|
571
|
+
* .setFontWeight('bold');
|
|
572
|
+
* ```
|
|
310
573
|
*/
|
|
311
574
|
setFontWeight(fontWeight: FontWeight | null): this;
|
|
312
575
|
/**
|
|
313
576
|
* Sets the font style for the given range ('italic' or 'normal').
|
|
314
|
-
* @param fontStyle The font style, either 'italic' or 'normal'; a null value resets the font style.
|
|
577
|
+
* @param {FontStyle|null} fontStyle The font style, either 'italic' or 'normal'; a null value resets the font style.
|
|
578
|
+
* @returns {FRange} This range, for chaining
|
|
579
|
+
* @example
|
|
580
|
+
* ```ts
|
|
581
|
+
* univerAPI.getActiveWorkbook()
|
|
582
|
+
* .getActiveSheet()
|
|
583
|
+
* .getActiveRange()
|
|
584
|
+
* .setFontStyle('italic');
|
|
585
|
+
* ```
|
|
315
586
|
*/
|
|
316
587
|
setFontStyle(fontStyle: FontStyle | null): this;
|
|
317
588
|
/**
|
|
318
589
|
* Sets the font line style of the given range ('underline', 'line-through', or 'none').
|
|
319
|
-
* @param fontLine The font line style, either 'underline', 'line-through', or 'none'; a null value resets the font line style.
|
|
590
|
+
* @param {FontLine|null} fontLine The font line style, either 'underline', 'line-through', or 'none'; a null value resets the font line style.
|
|
591
|
+
* @returns {FRange} This range, for chaining
|
|
592
|
+
* @example
|
|
593
|
+
* ```ts
|
|
594
|
+
* univerAPI.getActiveWorkbook()
|
|
595
|
+
* .getActiveSheet()
|
|
596
|
+
* .getActiveRange()
|
|
597
|
+
* .setFontLine('underline');
|
|
598
|
+
* ```
|
|
320
599
|
*/
|
|
321
600
|
setFontLine(fontLine: FontLine | null): this;
|
|
322
601
|
/**
|
|
323
602
|
* Sets the font underline style of the given ITextDecoration
|
|
324
|
-
* @param value
|
|
603
|
+
* @param {ITextDecoration|null} value The font underline style of the given ITextDecoration; a null value resets the font underline style
|
|
604
|
+
* @returns {void}
|
|
605
|
+
* @example
|
|
606
|
+
* ```ts
|
|
607
|
+
* univerAPI.getActiveWorkbook()
|
|
608
|
+
* .getActiveSheet()
|
|
609
|
+
* .getActiveRange()
|
|
610
|
+
* .setFontLine('underline');
|
|
611
|
+
* ```
|
|
325
612
|
*/
|
|
326
613
|
private _setFontUnderline;
|
|
327
614
|
/**
|
|
328
615
|
* Sets the font strikethrough style of the given ITextDecoration
|
|
329
|
-
* @param value
|
|
616
|
+
* @param {ITextDecoration|null} value The font strikethrough style of the given ITextDecoration; a null value resets the font strikethrough style
|
|
617
|
+
* @returns {void}
|
|
330
618
|
*/
|
|
331
619
|
private _setFontStrikethrough;
|
|
332
620
|
/**
|
|
333
621
|
* Sets the font family, such as "Arial" or "Helvetica".
|
|
334
|
-
* @param fontFamily The font family to set; a null value resets the font family.
|
|
622
|
+
* @param {string|null} fontFamily The font family to set; a null value resets the font family.
|
|
623
|
+
* @returns {FRange} This range, for chaining
|
|
624
|
+
* @example
|
|
625
|
+
* ```ts
|
|
626
|
+
* univerAPI.getActiveWorkbook()
|
|
627
|
+
* .getActiveSheet()
|
|
628
|
+
* .getActiveRange()
|
|
629
|
+
* .setFontFamily('Arial');
|
|
630
|
+
* ```
|
|
335
631
|
*/
|
|
336
632
|
setFontFamily(fontFamily: string | null): this;
|
|
337
633
|
/**
|
|
338
634
|
* Sets the font size, with the size being the point size to use.
|
|
339
|
-
* @param size A font size in point size. A null value resets the font size.
|
|
635
|
+
* @param {number|null} size A font size in point size. A null value resets the font size.
|
|
636
|
+
* @returns {FRange} This range, for chaining
|
|
637
|
+
* @example
|
|
638
|
+
* ```ts
|
|
639
|
+
* univerAPI.getActiveWorkbook()
|
|
640
|
+
* .getActiveSheet()
|
|
641
|
+
* .getActiveRange()
|
|
642
|
+
* .setFontSize(12);
|
|
643
|
+
* ```
|
|
340
644
|
*/
|
|
341
645
|
setFontSize(size: number | null): this;
|
|
342
646
|
/**
|
|
343
647
|
* Sets the font color in CSS notation (such as '#ffffff' or 'white').
|
|
344
|
-
* @param color The font color in CSS notation (such as '#ffffff' or 'white'); a null value resets the color.
|
|
648
|
+
* @param {string|null} color The font color in CSS notation (such as '#ffffff' or 'white'); a null value resets the color.
|
|
649
|
+
* @returns {FRange} This range, for chaining
|
|
650
|
+
* @example
|
|
651
|
+
* ```ts
|
|
652
|
+
* univerAPI.getActiveWorkbook()
|
|
653
|
+
* .getActiveSheet()
|
|
654
|
+
* .getActiveRange()
|
|
655
|
+
* .setFontColor('#ff0000');
|
|
656
|
+
* ```
|
|
345
657
|
*/
|
|
346
658
|
setFontColor(color: string | null): this;
|
|
347
659
|
/**
|
|
348
660
|
* Merge cells in a range into one merged cell
|
|
349
|
-
* @param [defaultMerge] - If true, only the value in the upper left cell is retained.
|
|
350
|
-
* @returns This range, for chaining
|
|
661
|
+
* @param {boolean} [defaultMerge] - If true, only the value in the upper left cell is retained.
|
|
662
|
+
* @returns {FRange} This range, for chaining
|
|
351
663
|
* @example
|
|
352
664
|
* ```ts
|
|
353
665
|
* const workbook = univerAPI.getActiveWorkbook();
|
|
@@ -361,8 +673,8 @@ export declare class FRange extends FBaseInitialable {
|
|
|
361
673
|
merge(defaultMerge?: boolean): FRange;
|
|
362
674
|
/**
|
|
363
675
|
* Merges cells in a range horizontally.
|
|
364
|
-
* @param [defaultMerge] - If true, only the value in the upper left cell is retained.
|
|
365
|
-
* @returns This range, for chaining
|
|
676
|
+
* @param {boolean} [defaultMerge] - If true, only the value in the upper left cell is retained.
|
|
677
|
+
* @returns {FRange} This range, for chaining
|
|
366
678
|
* @example
|
|
367
679
|
* ```ts
|
|
368
680
|
* const workbook = univerAPI.getActiveWorkbook();
|
|
@@ -376,8 +688,8 @@ export declare class FRange extends FBaseInitialable {
|
|
|
376
688
|
mergeAcross(defaultMerge?: boolean): FRange;
|
|
377
689
|
/**
|
|
378
690
|
* Merges cells in a range vertically.
|
|
379
|
-
* @param [defaultMerge] - If true, only the value in the upper left cell is retained.
|
|
380
|
-
* @returns This range, for chaining
|
|
691
|
+
* @param {boolean} [defaultMerge] - If true, only the value in the upper left cell is retained.
|
|
692
|
+
* @returns {FRange} This range, for chaining
|
|
381
693
|
* @example
|
|
382
694
|
* ```ts
|
|
383
695
|
* const workbook = univerAPI.getActiveWorkbook();
|
|
@@ -406,7 +718,7 @@ export declare class FRange extends FBaseInitialable {
|
|
|
406
718
|
isPartOfMerge(): boolean;
|
|
407
719
|
/**
|
|
408
720
|
* Break all horizontally- or vertically-merged cells contained within the range list into individual cells again.
|
|
409
|
-
* @returns This range, for chaining
|
|
721
|
+
* @returns {FRange} This range, for chaining
|
|
410
722
|
* @example
|
|
411
723
|
* ```ts
|
|
412
724
|
* const workbook = univerAPI.getActiveWorkbook();
|
|
@@ -424,7 +736,7 @@ export declare class FRange extends FBaseInitialable {
|
|
|
424
736
|
breakApart(): FRange;
|
|
425
737
|
/**
|
|
426
738
|
* Iterate cells in this range. Merged cells will be respected.
|
|
427
|
-
* @param callback the callback function to be called for each cell in the range
|
|
739
|
+
* @param {Function} callback the callback function to be called for each cell in the range
|
|
428
740
|
* @param {number} callback.row the row number of the cell
|
|
429
741
|
* @param {number} callback.col the column number of the cell
|
|
430
742
|
* @param {ICellData} callback.cell the cell data
|
|
@@ -440,7 +752,7 @@ export declare class FRange extends FBaseInitialable {
|
|
|
440
752
|
forEach(callback: (row: number, col: number, cell: ICellData) => void): void;
|
|
441
753
|
/**
|
|
442
754
|
* Returns a string description of the range, in A1 notation.
|
|
443
|
-
* @param withSheet
|
|
755
|
+
* @param {boolean} [withSheet] - If true, the sheet name is included in the A1 notation.
|
|
444
756
|
* @returns {string} The A1 notation of the range.
|
|
445
757
|
* ```ts
|
|
446
758
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -22,16 +22,40 @@ export declare class FSelection {
|
|
|
22
22
|
/**
|
|
23
23
|
* Represents the active selection in the sheet. Which means the selection contains the active cell.
|
|
24
24
|
* @returns {FRange | null} The active selection.
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
28
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
29
|
+
* const fSelection = fWorksheet.getSelection();
|
|
30
|
+
* const activeRange = fSelection.getActiveRange();
|
|
31
|
+
* console.log(activeRange);
|
|
32
|
+
* ```
|
|
25
33
|
*/
|
|
26
34
|
getActiveRange(): FRange | null;
|
|
27
35
|
/**
|
|
28
36
|
* Represents the active selection list in the sheet.
|
|
29
37
|
* @returns {FRange[]} The active selection list.
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
41
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
42
|
+
* const fSelection = fWorksheet.getSelection();
|
|
43
|
+
* const activeRangeList = fSelection.getActiveRangeList();
|
|
44
|
+
* console.log(activeRangeList);
|
|
45
|
+
* ```
|
|
30
46
|
*/
|
|
31
47
|
getActiveRangeList(): FRange[];
|
|
32
48
|
/**
|
|
33
49
|
* Represents the current select cell in the sheet.
|
|
34
50
|
* @returns {ISelectionCell} The current select cell info.Pay attention to the type of the return value.
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
54
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
55
|
+
* const fSelection = fWorksheet.getSelection();
|
|
56
|
+
* const currentCell = fSelection.getCurrentCell();
|
|
57
|
+
* console.log(currentCell);
|
|
58
|
+
* ```
|
|
35
59
|
*/
|
|
36
60
|
getCurrentCell(): Nullable<ISelectionCell>;
|
|
37
61
|
/**
|