@univerjs/sheets 0.5.3 → 0.5.4

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.
@@ -1,9 +1,9 @@
1
- import { CommandListener, IDisposable, IRange, IWorkbookData, LocaleType, Workbook, FBaseInitialable, ICommandService, ILogService, Injector, IPermissionService, IResourceLoaderService, IUniverInstanceService, LocaleService } from '@univerjs/core';
1
+ import { CommandListener, CustomData, IDisposable, IEventParamConfig, IRange, IWorkbookData, LocaleType, Workbook, FBaseInitialable, FEnum, FEventName, ICommandService, ILogService, Injector, IPermissionService, IResourceLoaderService, IUniverInstanceService, LocaleService } from '@univerjs/core';
2
2
  import { ISetDefinedNameMutationParam, IDefinedNamesService } from '@univerjs/engine-formula';
3
3
  import { RangeThemeStyle, SheetsSelectionsService } from '@univerjs/sheets';
4
+ import { FontLine as _FontLine, FRange } from './f-range';
4
5
  import { FDefinedName } from './f-defined-name';
5
6
  import { FPermission } from './f-permission';
6
- import { FRange } from './f-range';
7
7
  import { FWorksheet } from './f-worksheet';
8
8
  export declare class FWorkbook extends FBaseInitialable {
9
9
  protected readonly _workbook: Workbook;
@@ -18,6 +18,39 @@ export declare class FWorkbook extends FBaseInitialable {
18
18
  protected readonly _definedNamesService: IDefinedNamesService;
19
19
  readonly id: string;
20
20
  constructor(_workbook: Workbook, _injector: Injector, _resourceLoaderService: IResourceLoaderService, _selectionManagerService: SheetsSelectionsService, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService, _permissionService: IPermissionService, _logService: ILogService, _localeService: LocaleService, _definedNamesService: IDefinedNamesService);
21
+ getWorkbook(): Workbook;
22
+ private _eventRegistry;
23
+ private _ensureEventRegistry;
24
+ /**
25
+ * Add an event listener
26
+ * @param event key of event
27
+ * @param callback callback when event triggered
28
+ * @returns {Disposable} The Disposable instance, for remove the listener
29
+ * @example
30
+ * ```ts
31
+ * univerAPI.addEvent(univerAPI.event.UnitCreated, (params) => {
32
+ * console.log('unit created', params);
33
+ * });
34
+ * ```
35
+ */
36
+ addEvent(event: keyof IEventParamConfig, callback: (params: IEventParamConfig[typeof event]) => void): IDisposable;
37
+ /**
38
+ * Fire an event, used in internal only.
39
+ * @param event {string} key of event
40
+ * @param params {any} params of event
41
+ * @returns {boolean} should cancel
42
+ * @example
43
+ * ```ts
44
+ * this.fireEvent(univerAPI.event.UnitCreated, params);
45
+ * ```
46
+ */
47
+ protected fireEvent<T extends keyof IEventParamConfig>(event: T, params: IEventParamConfig[T]): boolean | undefined;
48
+ addUIEvent(event: keyof IEventParamConfig, _callback: (params: IEventParamConfig[typeof event]) => void): void;
49
+ get Enum(): FEnum;
50
+ /**
51
+ * @returns {FEventName} The event name.
52
+ */
53
+ get Event(): FEventName;
21
54
  /**
22
55
  * Get the id of the workbook.
23
56
  * @returns {string} The id of the workbook.
@@ -52,8 +85,8 @@ export declare class FWorkbook extends FBaseInitialable {
52
85
  */
53
86
  setName(name: string): void;
54
87
  /**
55
- * save workbook snapshot data, including conditional formatting, data validation, and other plugin data.
56
- * @return Workbook snapshot data
88
+ * Save workbook snapshot data, including conditional formatting, data validation, and other plugin data.
89
+ * @returns {IWorkbookData} Workbook snapshot data
57
90
  * @example
58
91
  * ```ts
59
92
  * // The code below saves the workbook snapshot data
@@ -64,13 +97,13 @@ export declare class FWorkbook extends FBaseInitialable {
64
97
  save(): IWorkbookData;
65
98
  /**
66
99
  * @deprecated use 'save' instead.
67
- * @return {*} {IWorkbookData} Workbook snapshot data
100
+ * @returns {*} {IWorkbookData} Workbook snapshot data
68
101
  * @memberof FWorkbook
69
102
  */
70
103
  getSnapshot(): IWorkbookData;
71
104
  /**
72
105
  * Get the active sheet of the workbook.
73
- * @returns The active sheet of the workbook
106
+ * @returns {FWorksheet} The active sheet of the workbook
74
107
  * @example
75
108
  * ```ts
76
109
  * // The code below gets the active sheet of the workbook
@@ -81,7 +114,7 @@ export declare class FWorkbook extends FBaseInitialable {
81
114
  getActiveSheet(): FWorksheet;
82
115
  /**
83
116
  * Gets all the worksheets in this workbook
84
- * @returns An array of all the worksheets in the workbook
117
+ * @returns {FWorksheet[]} An array of all the worksheets in the workbook
85
118
  * @example
86
119
  * ```ts
87
120
  * // The code below gets all the worksheets in the workbook
@@ -107,7 +140,7 @@ export declare class FWorkbook extends FBaseInitialable {
107
140
  /**
108
141
  * Get a worksheet by sheet id.
109
142
  * @param sheetId The id of the sheet to get.
110
- * @return The worksheet with given sheet id
143
+ * @returns The worksheet with given sheet id
111
144
  * @example
112
145
  * ```ts
113
146
  * // The code below gets a worksheet by sheet id
@@ -161,6 +194,7 @@ export declare class FWorkbook extends FBaseInitialable {
161
194
  /**
162
195
  * Deletes the specified worksheet.
163
196
  * @param sheet The worksheet to delete.
197
+ * @returns {boolean} True if the worksheet was deleted, false otherwise.
164
198
  * @example
165
199
  * ```ts
166
200
  * // The code below deletes the specified worksheet
@@ -172,7 +206,7 @@ export declare class FWorkbook extends FBaseInitialable {
172
206
  deleteSheet(sheet: FWorksheet): boolean;
173
207
  /**
174
208
  * Undo the last action.
175
- * @returns A promise that resolves to true if the undo was successful, false otherwise.
209
+ * @returns {FWorkbook} A promise that resolves to true if the undo was successful, false otherwise.
176
210
  * @example
177
211
  * ```ts
178
212
  * // The code below undoes the last action
@@ -231,7 +265,6 @@ export declare class FWorkbook extends FBaseInitialable {
231
265
  onCommandExecuted(callback: CommandListener): IDisposable;
232
266
  /**
233
267
  * Callback for selection changes.
234
- *
235
268
  * @callback onSelectionChangeCallback
236
269
  * @param {IRange[]} selections The new selection.
237
270
  */
@@ -244,13 +277,15 @@ export declare class FWorkbook extends FBaseInitialable {
244
277
  /**
245
278
  * Used to modify the editing permissions of the workbook. When the value is false, editing is not allowed.
246
279
  * @param {boolean} value editable value want to set
280
+ * @returns {FWorkbook} FWorkbook instance
247
281
  */
248
- setEditable(value: boolean): void;
282
+ setEditable(value: boolean): FWorkbook;
249
283
  /**
250
- * Sets the active selection region for this sheet.
284
+ * Sets the selection region for active sheet.
251
285
  * @param range The range to set as the active selection.
286
+ * @returns {FWorkbook} FWorkbook instance
252
287
  */
253
- setActiveRange(range: FRange): void;
288
+ setActiveRange(range: FRange): FWorkbook;
254
289
  /**
255
290
  * Returns the selected range in the active sheet, or null if there is no active range.
256
291
  * @returns the active range
@@ -258,6 +293,7 @@ export declare class FWorkbook extends FBaseInitialable {
258
293
  getActiveRange(): FRange | null;
259
294
  /**
260
295
  * Deletes the currently active sheet.
296
+ * @returns {boolean} true if the sheet was deleted, false otherwise
261
297
  * @example
262
298
  * ```ts
263
299
  * // The code below deletes the currently active sheet and stores the new active
@@ -312,9 +348,15 @@ export declare class FWorkbook extends FBaseInitialable {
312
348
  * ```
313
349
  */
314
350
  getLocale(): LocaleType;
351
+ /**
352
+ * @deprecated use setSpreadsheetLocale instead.
353
+ * @param {LocaleType} locale - The locale to set
354
+ */
355
+ setLocale(locale: LocaleType): void;
315
356
  /**
316
357
  * Set the locale of the workbook.
317
358
  * @param {LocaleType} locale The locale to set
359
+ * @returns {FWorkbook} This workbook, for chaining
318
360
  * @example
319
361
  * ```ts
320
362
  * // The code below sets the locale of the workbook
@@ -322,7 +364,7 @@ export declare class FWorkbook extends FBaseInitialable {
322
364
  * activeSpreadsheet.setLocale(LocaleType.EN_US);
323
365
  * ```
324
366
  */
325
- setLocale(locale: LocaleType): void;
367
+ setSpreadsheetLocale(locale: LocaleType): FWorkbook;
326
368
  /**
327
369
  * Get the URL of the workbook.
328
370
  * @returns {string} The URL of the workbook
@@ -362,7 +404,6 @@ export declare class FWorkbook extends FBaseInitialable {
362
404
  moveActiveSheet(index: number): FWorkbook;
363
405
  /**
364
406
  * Get the PermissionInstance.
365
- *
366
407
  * @returns {FPermission} - The PermissionInstance.
367
408
  */
368
409
  getPermission(): FPermission;
@@ -393,6 +434,7 @@ export declare class FWorkbook extends FBaseInitialable {
393
434
  * Insert a defined name.
394
435
  * @param {string} name The name of the defined name to insert
395
436
  * @param {string} formulaOrRefString The formula(=sum(A2:b10)) or reference(A1) string of the defined name to insert
437
+ * @returns {FWorkbook} The current FWorkbook instance
396
438
  * @example
397
439
  * ```ts
398
440
  * // The code below inserts a defined name
@@ -400,7 +442,7 @@ export declare class FWorkbook extends FBaseInitialable {
400
442
  * activeSpreadsheet.insertDefinedName('MyDefinedName', 'Sheet1!A1');
401
443
  * ```
402
444
  */
403
- insertDefinedName(name: string, formulaOrRefString: string): void;
445
+ insertDefinedName(name: string, formulaOrRefString: string): FWorkbook;
404
446
  /**
405
447
  * Delete the defined name with the given name.
406
448
  * @param {string} name The name of the defined name to delete
@@ -414,7 +456,7 @@ export declare class FWorkbook extends FBaseInitialable {
414
456
  */
415
457
  deleteDefinedName(name: string): boolean;
416
458
  /**
417
- * insert a defined name by builder param
459
+ * Insert a defined name by builder param.
418
460
  * @param {ISetDefinedNameMutationParam} param The param to insert the defined name
419
461
  * @example
420
462
  * ```ts
@@ -453,6 +495,7 @@ export declare class FWorkbook extends FBaseInitialable {
453
495
  getRegisteredRangeThemes(): string[];
454
496
  /**
455
497
  * Register a custom range theme style.
498
+ * @param rangeThemeStyle
456
499
  * @example
457
500
  * ```ts
458
501
  * // import {RangeThemeStyle} from '@univerjs/sheets';
@@ -469,6 +512,7 @@ export declare class FWorkbook extends FBaseInitialable {
469
512
  registerRangeTheme(rangeThemeStyle: RangeThemeStyle): void;
470
513
  /**
471
514
  * Unregister a custom range theme style.
515
+ * @param themeName
472
516
  * @example
473
517
  * ```ts
474
518
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -476,4 +520,30 @@ export declare class FWorkbook extends FBaseInitialable {
476
520
  * ```
477
521
  */
478
522
  unregisterRangeTheme(themeName: string): void;
523
+ /**
524
+ * Set custom metadata of workbook
525
+ * @param {CustomData | undefined} custom custom metadata
526
+ * @returns {FWorkbook} FWorkbook
527
+ * @example
528
+ * ```ts
529
+ * const fWorkbook = univerAPI.getActiveWorkbook();
530
+ * fWorkbook.setCustomMetadata({ key: 'value' });
531
+ * ```
532
+ */
533
+ setCustomMetadata(custom: CustomData | undefined): FWorkbook;
534
+ /**
535
+ * Get custom metadata of workbook
536
+ * @returns {CustomData | undefined} custom metadata
537
+ * @example
538
+ * ```ts
539
+ * const fWorkbook = univerAPI.getActiveWorkbook();
540
+ * const custom = fWorkbook.getCustomMetadata();
541
+ * ```
542
+ */
543
+ getCustomMetadata(): CustomData | undefined;
544
+ }
545
+ export declare namespace FWorkbook {
546
+ type FontLine = _FontLine;
547
+ type FontStyle = _FontLine;
548
+ type FontWeight = _FontLine;
479
549
  }
@@ -1,4 +1,4 @@
1
- import { CustomData, ICellData, IDisposable, IFreeze, IObjectArrayPrimitiveType, IStyleData, Nullable, Workbook, Worksheet, FBaseInitialable, ICommandService, ILogService, Injector, ObjectMatrix } from '@univerjs/core';
1
+ import { CustomData, ICellData, IColumnRange, IDisposable, IEventParamConfig, IFreeze, IObjectArrayPrimitiveType, IRowRange, IStyleData, Nullable, Workbook, Worksheet, FBaseInitialable, ICommandService, ILogService, Injector, ObjectMatrix } from '@univerjs/core';
2
2
  import { FDefinedName } from './f-defined-name';
3
3
  import { FWorkbook } from './f-workbook';
4
4
  import { SheetsSelectionsService } from '@univerjs/sheets';
@@ -20,6 +20,33 @@ export declare class FWorksheet extends FBaseInitialable {
20
20
  protected readonly _logService: ILogService;
21
21
  protected readonly _commandService: ICommandService;
22
22
  constructor(_fWorkbook: FWorkbook, _workbook: Workbook, _worksheet: Worksheet, _injector: Injector, _selectionManagerService: SheetsSelectionsService, _logService: ILogService, _commandService: ICommandService);
23
+ getSheet(): Worksheet;
24
+ private _eventRegistry;
25
+ private _ensureEventRegistry;
26
+ /**
27
+ * Add an event listener
28
+ * @param event key of event
29
+ * @param callback callback when event triggered
30
+ * @returns {Disposable} The Disposable instance, for remove the listener
31
+ * @example
32
+ * ```ts
33
+ * univerAPI.addEvent(univerAPI.event.UnitCreated, (params) => {
34
+ * console.log('unit created', params);
35
+ * });
36
+ * ```
37
+ */
38
+ addEvent(event: keyof IEventParamConfig, callback: (params: IEventParamConfig[typeof event]) => void): IDisposable;
39
+ /**
40
+ * Fire an event, used in internal only.
41
+ * @param event {string} key of event
42
+ * @param params {any} params of event
43
+ * @returns {boolean} should cancel
44
+ * @example
45
+ * ```ts
46
+ * this.fireEvent(univerAPI.event.UnitCreated, params);
47
+ * ```
48
+ */
49
+ protected fireEvent<T extends keyof IEventParamConfig>(event: T, params: IEventParamConfig[T]): boolean | undefined;
23
50
  /**
24
51
  * Returns the injector
25
52
  * @returns The injector
@@ -60,7 +87,7 @@ export declare class FWorksheet extends FBaseInitialable {
60
87
  /**
61
88
  * Get the default style of the worksheet column
62
89
  * @param {number} index The column index
63
- * @param {boolean} [keepRaw] If true, return the raw style data maybe the style name or style data, otherwise return the data from col manager
90
+ * @param {boolean} [keepRaw] If true, return the raw style data maybe the style name or style data, otherwise return the data from col manager
64
91
  * @returns {Nullable<IStyleData> | string} The default style of the worksheet column name or style data
65
92
  */
66
93
  getColumnDefaultStyle(index: number, keepRaw?: boolean): Nullable<IStyleData> | string;
@@ -116,24 +143,24 @@ export declare class FWorksheet extends FBaseInitialable {
116
143
  getRange(a1Notation: string): FRange;
117
144
  /**
118
145
  * Returns the current number of columns in the sheet, regardless of content.
119
- * @return The maximum columns count of the sheet
146
+ * @returns {number} The maximum columns count of the sheet
120
147
  */
121
148
  getMaxColumns(): number;
122
149
  /**
123
150
  * Returns the current number of rows in the sheet, regardless of content.
124
- * @return The maximum rows count of the sheet
151
+ * @returns {number}The maximum rows count of the sheet
125
152
  */
126
153
  getMaxRows(): number;
127
154
  /**
128
155
  * Inserts a row after the given row position.
129
- * @param afterPosition The row after which the new row should be added, starting at 0 for the first row.
130
- * @returns This sheet, for chaining.
156
+ * @param {number} afterPosition The row after which the new row should be added, starting at 0 for the first row.
157
+ * @returns {FWorksheet} This sheet, for chaining.
131
158
  */
132
159
  insertRowAfter(afterPosition: number): FWorksheet;
133
160
  /**
134
161
  * Inserts a row before the given row position.
135
- * @param beforePosition The row before which the new row should be added, starting at 0 for the first row.
136
- * @returns This sheet, for chaining.
162
+ * @param {number} beforePosition The row before which the new row should be added, starting at 0 for the first row.
163
+ * @returns {FWorksheet} This sheet, for chaining.
137
164
  */
138
165
  insertRowBefore(beforePosition: number): FWorksheet;
139
166
  /**
@@ -185,45 +212,46 @@ export declare class FWorksheet extends FBaseInitialable {
185
212
  hideRow(row: FRange): FWorksheet;
186
213
  /**
187
214
  * Hides one or more consecutive rows starting at the given index. Use 0-index for this method.
188
- * @param rowIndex The starting index of the rows to hide.
189
- * @param numRows The number of rows to hide.
190
- * @returns This sheet, for chaining.
215
+ * @param {number} rowIndex The starting index of the rows to hide.
216
+ * @param {number} numRows The number of rows to hide.
217
+ * @returns {FWorksheet} This sheet, for chaining.
191
218
  */
192
219
  hideRows(rowIndex: number, numRows?: number): FWorksheet;
193
220
  /**
194
- * Unhides the row in the given range.
195
- * @param row The range to unhide, if hidden.
196
- * @returns This sheet, for chaining.
221
+ * Make the row in the given range visible.
222
+ * @param {FRange} row The range to unhide, if hidden.
223
+ * @returns {FWorksheet} This sheet, for chaining.
197
224
  */
198
225
  unhideRow(row: FRange): FWorksheet;
199
226
  /**
200
- * Unhides one or more consecutive rows starting at the given index. Use 0-index for this method.
201
- * @param rowIndex The starting index of the rows to unhide.
202
- * @param numRows The number of rows to unhide.
203
- * @returns This sheet, for chaining.
227
+ * Scrolling sheet to make specific rows visible.
228
+ * @param {number} rowIndex The starting index of the rows
229
+ * @param {number} numRows The number of rows
230
+ * @returns {FWorksheet} This sheet, for chaining.
204
231
  */
205
232
  showRows(rowIndex: number, numRows?: number): FWorksheet;
206
233
  /**
207
234
  * Sets the row height of the given row in pixels. By default, rows grow to fit cell contents. If you want to force rows to a specified height, use setRowHeightsForced(startRow, numRows, height).
208
- * @param rowPosition The row position to change.
209
- * @param height The height in pixels to set it to.
210
- * @returns This sheet, for chaining.
235
+ * @param {number} rowPosition The row position to change.
236
+ * @param {number} height The height in pixels to set it to.
237
+ * @returns {FWorksheet} This sheet, for chaining.
211
238
  */
212
239
  setRowHeight(rowPosition: number, height: number): FWorksheet;
213
240
  /**
214
- * Sets the height of the given rows in pixels. By default, rows grow to fit cell contents. If you want to force rows to a specified height, use setRowHeightsForced(startRow, numRows, height).
215
- * @param startRow The starting row position to change.
216
- * @param numRows The number of rows to change.
217
- * @param height The height in pixels to set it to.
218
- * @returns This sheet, for chaining.
241
+ * Sets the height of the given rows in pixels.
242
+ * By default, rows grow to fit cell contents. If you want to force rows to a specified height, use setRowHeightsForced(startRow, numRows, height).
243
+ * @param {number} startRow The starting row position to change.
244
+ * @param {number} numRows The number of rows to change.
245
+ * @param {number} height The height in pixels to set it to.
246
+ * @returns {FWorksheet} This sheet, for chaining.
219
247
  */
220
248
  setRowHeights(startRow: number, numRows: number, height: number): FWorksheet;
221
249
  /**
222
250
  * Sets the height of the given rows in pixels. By default, rows grow to fit cell contents. When you use setRowHeightsForced, rows are forced to the specified height even if the cell contents are taller than the row height.
223
- * @param startRow The starting row position to change.
224
- * @param numRows The number of rows to change.
225
- * @param height The height in pixels to set it to.
226
- * @returns This sheet, for chaining.
251
+ * @param {number} startRow The starting row position to change.
252
+ * @param {number} numRows The number of rows to change.
253
+ * @param {number} height The height in pixels to set it to.
254
+ * @returns {FWorksheet} This sheet, for chaining.
227
255
  */
228
256
  setRowHeightsForced(startRow: number, numRows: number, height: number): FWorksheet;
229
257
  /**
@@ -299,13 +327,13 @@ export declare class FWorksheet extends FBaseInitialable {
299
327
  */
300
328
  hideColumns(columnIndex: number, numColumns?: number): FWorksheet;
301
329
  /**
302
- * Unhides the column in the given range.
330
+ * Show the column in the given range.
303
331
  * @param column The range to unhide, if hidden.
304
332
  * @returns This sheet, for chaining.
305
333
  */
306
334
  unhideColumn(column: FRange): FWorksheet;
307
335
  /**
308
- * Unhides one or more consecutive columns starting at the given index. Use 0-index for this method.
336
+ * Show one or more consecutive columns starting at the given index. Use 0-index for this method.
309
337
  * @param columnIndex The starting index of the columns to unhide.
310
338
  * @param numColumns The number of columns to unhide.
311
339
  * @returns This sheet, for chaining.
@@ -351,19 +379,19 @@ export declare class FWorksheet extends FBaseInitialable {
351
379
  getActiveRange(): FRange | null;
352
380
  /**
353
381
  * Sets the active selection region for this sheet.
354
- * @param range The range to set as the active selection.
382
+ * @param {FRange} range The range to set as the active selection.
383
+ * @returns {FWorksheet} This sheet, for chaining.
355
384
  */
356
- setActiveRange(range: FRange): void;
385
+ setActiveRange(range: FRange): FWorksheet;
357
386
  /**
358
387
  * Sets the active selection region for this sheet.
359
388
  * @param range The range to set as the active selection.
360
389
  */
361
- setActiveSelection: (range: FRange) => void;
390
+ setActiveSelection: (range: FRange) => FWorksheet;
362
391
  /**
363
392
  * Sets the frozen state of the current sheet.
364
393
  * @param freeze - the scrolling viewport start range and count of freezed rows and columns.
365
394
  * that means if you want to freeze the first 3 rows and 2 columns, you should set freeze as { startRow: 3, startColumn: 2, xSplit: 2, ySplit: 3 }
366
- *
367
395
  * @deprecated use `setFrozenRows` and `setFrozenColumns` instead.
368
396
  * @returns True if the command was successful, false otherwise.
369
397
  */
@@ -376,7 +404,6 @@ export declare class FWorksheet extends FBaseInitialable {
376
404
  /**
377
405
  * Get the freeze state of the current sheet.
378
406
  * @returns The freeze state of the current sheet.
379
- *
380
407
  * @deprecated use `getRowFreezeStatus` and `getColumnFreezeStatus` instead.
381
408
  */
382
409
  getFreeze(): IFreeze;
@@ -385,21 +412,21 @@ export declare class FWorksheet extends FBaseInitialable {
385
412
  * @param columns The number of columns to freeze.
386
413
  * To unfreeze all columns, set this value to 0.
387
414
  */
388
- setFrozenColumns(columns: number): void;
415
+ setFrozenColumns(columns: number): FWorksheet;
389
416
  /**
390
417
  * Set freeze column, then the range from startColumn to endColumn will be fixed.
391
418
  * e.g. setFrozenColumns(0, 2) will fix the column range from 0 to 2.
392
419
  * e.g. setFrozenColumns(2, 3) will fix the column range from 2 to 3, And column from 0 to 1 will be invisible.
393
- *
394
420
  * @example
395
- * ``` ts
421
+ * ```typescript
396
422
  * const fWorkbook = univerAPI.getActiveWorkbook();
397
423
  * const fWorkSheet = fWorkbook.getActiveSheet();
398
424
  * // freeze the first too columns.
399
425
  * fWorkSheet.setFrozenColumns(0, 2);
400
426
  * ```
401
- * @param startColumn
402
- * @param endColumn
427
+ * @param startColumn - The start column of the range to freeze.
428
+ * @param endColumn - The end column of the range to freeze.
429
+ * @returns {FWorksheet} This FWorksheet instance.
403
430
  */
404
431
  setFrozenColumns(startColumn: number, endColumn: number): FWorksheet;
405
432
  /**
@@ -407,14 +434,13 @@ export declare class FWorksheet extends FBaseInitialable {
407
434
  * @param rows The number of rows to freeze.
408
435
  * To unfreeze all rows, set this value to 0.
409
436
  */
410
- setFrozenRows(rows: number): void;
437
+ setFrozenRows(rows: number): FWorksheet;
411
438
  /**
412
439
  * Set freeze row, then the range from startRow to endRow will be fixed.
413
440
  * e.g. setFrozenRows(0, 2) will fix the row range from 0 to 2.
414
441
  * e.g. setFrozenRows(2, 3) will fix the row range from 2 to 3, And row from 0 to 1 will be invisible.
415
- * @param startRow
416
- * @param endRow
417
- *
442
+ * @param startRow - The start row of the range to freeze.
443
+ * @param endRow - The end row of the range to freeze.
418
444
  * @example
419
445
  * ``` ts
420
446
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -426,30 +452,24 @@ export declare class FWorksheet extends FBaseInitialable {
426
452
  setFrozenRows(startColumn: number, endColumn: number): FWorksheet;
427
453
  /**
428
454
  * Get the number of frozen columns.
429
- * @returns The number of frozen columns.
430
- * Returns 0 if no columns are frozen.
455
+ * @returns The number of frozen columns, returns 0 if no columns are frozen.
431
456
  */
432
457
  getFrozenColumns(): number;
433
458
  /**
434
459
  * Get the number of frozen rows.
435
- * @returns The number of frozen rows.
436
- * Returns 0 if no rows are frozen.
460
+ * @returns The number of frozen rows. returns 0 if no rows are frozen.
437
461
  */
438
462
  getFrozenRows(): number;
439
463
  /**
440
464
  * Get freezed rows.
465
+ * @returns {IRowRange} The range of the frozen rows.
441
466
  */
442
- getFrozenRowRange(): {
443
- startRow: number;
444
- endRow: number;
445
- };
467
+ getFrozenRowRange(): IRowRange;
446
468
  /**
447
469
  * Get freezed columns
470
+ * @returns {IColumnRange} The range of the frozen columns.
448
471
  */
449
- getFrozenColumnRange(): {
450
- startColumn: number;
451
- endColumn: number;
452
- };
472
+ getFrozenColumnRange(): IColumnRange;
453
473
  /**
454
474
  * Returns true if the sheet's gridlines are hidden; otherwise returns false. Gridlines are visible by default.
455
475
  * @returns {boolean} True if the sheet's gridlines are hidden; otherwise false.
@@ -467,6 +487,7 @@ export declare class FWorksheet extends FBaseInitialable {
467
487
  /**
468
488
  * Hides or reveals the sheet gridlines.
469
489
  * @param {boolean} hidden If `true`, hide gridlines in this sheet; otherwise show the gridlines.
490
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
470
491
  * @example
471
492
  * ``` ts
472
493
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -556,13 +577,14 @@ export declare class FWorksheet extends FBaseInitialable {
556
577
  onBeforeCellDataChange(callback: (cellValue: ObjectMatrix<Nullable<ICellData>>) => void): IDisposable;
557
578
  /**
558
579
  * Hides this sheet. Has no effect if the sheet is already hidden. If this method is called on the only visible sheet, it throws an exception.
580
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
559
581
  * @example
560
582
  * ```ts
561
583
  * const fWorkbook = univerAPI.getActiveWorkbook();
562
584
  * const fWorkSheet = fWorkbook.getActiveSheet();
563
585
  * // hide the active sheet
564
586
  * fWorkSheet.hideSheet();
565
- * ``
587
+ * ```
566
588
  */
567
589
  hideSheet(): FWorksheet;
568
590
  /**
@@ -682,6 +704,7 @@ export declare class FWorksheet extends FBaseInitialable {
682
704
  */
683
705
  getLastColumns(): number;
684
706
  /**
707
+ * @deprecated use getLastColumn instead.
685
708
  * Returns the position of the last column that has content. Same as getLastColumns.
686
709
  * @returns {number} the last column of the sheet that contains content.
687
710
  * @example
@@ -694,6 +717,7 @@ export declare class FWorksheet extends FBaseInitialable {
694
717
  */
695
718
  getLastColumn(): number;
696
719
  /**
720
+ * @deprecated use getLastRow instead.
697
721
  * Returns the position of the last row that has content.
698
722
  * @returns {number} the last row of the sheet that contains content.
699
723
  * @example
@@ -743,5 +767,80 @@ export declare class FWorksheet extends FBaseInitialable {
743
767
  * ```
744
768
  */
745
769
  getDefinedNames(): FDefinedName[];
770
+ /**
771
+ * Set custom metadata of worksheet
772
+ * @param {CustomData | undefined} custom custom metadata
773
+ * @example
774
+ * ```ts
775
+ * const fWorkbook = univerAPI.getActiveWorkbook();
776
+ * const fWorkSheet = fWorkbook.getActiveSheet();
777
+ * fWorkSheet.setCustomMetadata({ key: 'value' });
778
+ * ```
779
+ */
780
+ setCustomMetadata(custom: CustomData | undefined): FWorksheet;
781
+ /**
782
+ * Set custom metadata of row
783
+ * @param {number} index row index
784
+ * @param {CustomData | undefined} custom custom metadata
785
+ * @example
786
+ * ```ts
787
+ * const fWorkbook = univerAPI.getActiveWorkbook();
788
+ * const fWorkSheet = fWorkbook.getActiveSheet();
789
+ * fWorkSheet.setRowCustomMetadata(0, { key: 'value' });
790
+ * ```
791
+ */
792
+ setRowCustomMetadata(index: number, custom: CustomData | undefined): FWorksheet;
793
+ /**
794
+ * Set custom metadata of column
795
+ * @param {number} index column index
796
+ * @param {CustomData | undefined} custom custom metadata
797
+ * @example
798
+ * ```ts
799
+ * const fWorkbook = univerAPI.getActiveWorkbook();
800
+ * const fWorkSheet = fWorkbook.getActiveSheet();
801
+ * fWorkSheet.setColumnCustomMetadata(0, { key: 'value' });
802
+ * ```
803
+ */
804
+ setColumnCustomMetadata(index: number, custom: CustomData | undefined): FWorksheet;
805
+ /**
806
+ * Get custom metadata of row
807
+ * @param {number} index row index
808
+ * @returns {CustomData | undefined} custom metadata
809
+ * @example
810
+ * ```ts
811
+ * const fWorkbook = univerAPI.getActiveWorkbook();
812
+ * const fWorkSheet = fWorkbook.getActiveSheet();
813
+ * const custom = fWorkSheet.getRowCustomMetadata(0);
814
+ * ```
815
+ */
816
+ getRowCustomMetadata(index: number): CustomData | undefined;
817
+ /**
818
+ * Get custom metadata of column
819
+ * @param {number} index column index
820
+ * @returns {CustomData | undefined} custom metadata
821
+ * @example
822
+ * ```ts
823
+ * const fWorkbook = univerAPI.getActiveWorkbook();
824
+ * const fWorkSheet = fWorkbook.getActiveSheet();
825
+ * const custom = fWorkSheet.getColumnCustomMetadata(0);
826
+ * ```
827
+ */
828
+ getColumnCustomMetadata(index: number): CustomData | undefined;
829
+ /**
830
+ * Get all merged cells in the current worksheet
831
+ * @returns {FRange[]} All the merged cells in the worksheet
832
+ * @example
833
+ * ```ts
834
+ * const workbook = univerAPI.getActiveWorkbook();
835
+ * const worksheet = workbook.getActiveSheet();
836
+ * const rangeFirst = worksheet.getRange(0, 0, 2, 2);
837
+ * const mergeFirst = rangeFirst.merge();
838
+ * const rangeSecond = worksheet.getRange(5, 0, 2, 2);
839
+ * const mergeSecond = rangeSecond.merge();
840
+ * const mergeData = worksheet.getMergeData();
841
+ * console.log('debugger', mergeData);
842
+ * ```
843
+ */
844
+ getMergeData(): FRange[];
746
845
  }
747
846
  export {};
@@ -17,7 +17,6 @@ import './f-univer';
17
17
  export * from './f-event';
18
18
  export { FPermission } from './f-permission';
19
19
  export { FRange } from './f-range';
20
- export type { FontLine, FontStyle, FontWeight } from './f-range';
21
20
  export { FSelection } from './f-selection';
22
21
  export { FSheetHooks } from './f-sheet-hooks';
23
22
  export { FWorkbook } from './f-workbook';