@univerjs/sheets 0.5.2 → 0.5.3-experimental.20250106-e3b7a39

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.
Files changed (42) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +3 -3
  3. package/lib/es/facade.js +747 -497
  4. package/lib/es/index.js +5559 -4090
  5. package/lib/types/basics/interfaces/mutation-interface.d.ts +7 -0
  6. package/lib/types/commands/commands/__tests__/range-template-command.sepc.d.ts +16 -0
  7. package/lib/types/commands/commands/add-worksheet-merge.command.d.ts +1 -1
  8. package/lib/types/commands/commands/add-worksheet-range-theme.command.d.ts +2 -0
  9. package/lib/types/commands/commands/delete-worksheet-range-theme.command.d.ts +2 -0
  10. package/lib/types/commands/commands/insert-row-col.command.d.ts +2 -0
  11. package/lib/types/commands/commands/register-range-theme.command.d.ts +7 -0
  12. package/lib/types/commands/commands/remove-row-col.command.d.ts +12 -0
  13. package/lib/types/commands/commands/unregister-range-theme.command.d.ts +6 -0
  14. package/lib/types/commands/mutations/add-worksheet-range-theme.mutation.d.ts +9 -0
  15. package/lib/types/commands/mutations/delete-worksheet-range-theme.mutation.d.ts +9 -0
  16. package/lib/types/commands/mutations/register-range-theme.mutation.d.ts +8 -0
  17. package/lib/types/commands/mutations/unregister-range-theme-style.mutation.d.ts +6 -0
  18. package/lib/types/controllers/permission/sheet-permission-check.controller.d.ts +33 -0
  19. package/lib/types/controllers/permission/sheet-permission-init.controller.d.ts +29 -0
  20. package/lib/types/controllers/permission/sheet-permission-view-model.controller.d.ts +13 -0
  21. package/lib/types/facade/f-defined-name.d.ts +61 -61
  22. package/lib/types/facade/f-event.d.ts +30 -0
  23. package/lib/types/facade/f-permission.d.ts +0 -6
  24. package/lib/types/facade/f-range.d.ts +121 -36
  25. package/lib/types/facade/f-selection.d.ts +1 -1
  26. package/lib/types/facade/f-univer.d.ts +22 -6
  27. package/lib/types/facade/f-workbook.d.ts +78 -31
  28. package/lib/types/facade/f-worksheet.d.ts +130 -117
  29. package/lib/types/facade/index.d.ts +2 -1
  30. package/lib/types/facade/utils.d.ts +38 -2
  31. package/lib/types/index.d.ts +17 -3
  32. package/lib/types/model/range-theme-model.d.ts +66 -0
  33. package/lib/types/model/range-theme-util.d.ts +97 -0
  34. package/lib/types/model/range-themes/build-in-theme.factory.d.ts +5 -0
  35. package/lib/types/model/range-themes/default.d.ts +2 -0
  36. package/lib/types/services/range-theme-service.d.ts +34 -0
  37. package/lib/types/services/sheet-interceptor/interceptor-const.d.ts +2 -0
  38. package/lib/types/services/sheet-interceptor/sheet-interceptor.service.d.ts +5 -3
  39. package/lib/umd/facade.js +1 -1
  40. package/lib/umd/index.js +3 -3
  41. package/package.json +8 -31
  42. package/LICENSE +0 -176
@@ -1,4 +1,4 @@
1
- import { CustomData, ICellData, IDisposable, IFreeze, IObjectArrayPrimitiveType, IStyleData, Nullable, Workbook, Worksheet, FBase, ICommandService, ILogService, Injector, ObjectMatrix } from '@univerjs/core';
1
+ import { CustomData, ICellData, IColumnRange, IDisposable, 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';
@@ -11,7 +11,7 @@ interface IFacadeClearOptions {
11
11
  /**
12
12
  * Represents a worksheet facade api instance. Which provides a set of methods to interact with the worksheet.
13
13
  */
14
- export declare class FWorksheet extends FBase {
14
+ export declare class FWorksheet extends FBaseInitialable {
15
15
  protected readonly _fWorkbook: FWorkbook;
16
16
  protected readonly _workbook: Workbook;
17
17
  protected readonly _worksheet: Worksheet;
@@ -60,30 +60,30 @@ export declare class FWorksheet extends FBase {
60
60
  /**
61
61
  * Get the default style of the worksheet column
62
62
  * @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
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
64
64
  * @returns {Nullable<IStyleData> | string} The default style of the worksheet column name or style data
65
65
  */
66
66
  getColumnDefaultStyle(index: number, keepRaw?: boolean): Nullable<IStyleData> | string;
67
67
  /**
68
68
  * Set the default style of the worksheet
69
69
  * @param {StyleDataInfo} style default style
70
- * @returns {Promise<FWorksheet>} This sheet, for chaining.
70
+ * @returns {FWorksheet} This sheet, for chaining.
71
71
  */
72
- setDefaultStyle(style: string): Promise<FWorksheet>;
72
+ setDefaultStyle(style: string): FWorksheet;
73
73
  /**
74
74
  * Set the default style of the worksheet row
75
75
  * @param {number} index The row index
76
76
  * @param {string | Nullable<IStyleData>} style The style name or style data
77
- * @returns {Promise<FWorksheet>} This sheet, for chaining.
77
+ * @returns {FWorksheet} This sheet, for chaining.
78
78
  */
79
- setColumnDefaultStyle(index: number, style: string | Nullable<IStyleData>): Promise<FWorksheet>;
79
+ setColumnDefaultStyle(index: number, style: string | Nullable<IStyleData>): FWorksheet;
80
80
  /**
81
81
  * Set the default style of the worksheet column
82
82
  * @param {number} index The column index
83
83
  * @param {string | Nullable<IStyleData>} style The style name or style data
84
- * @returns {Promise<FWorksheet>} This sheet, for chaining.
84
+ * @returns {FWorksheet} This sheet, for chaining.
85
85
  */
86
- setRowDefaultStyle(index: number, style: string | Nullable<IStyleData>): Promise<FWorksheet>;
86
+ setRowDefaultStyle(index: number, style: string | Nullable<IStyleData>): FWorksheet;
87
87
  /**
88
88
  * Returns a Range object representing a single cell at the specified row and column.
89
89
  * @param row The row index of the cell.
@@ -116,208 +116,209 @@ export declare class FWorksheet extends FBase {
116
116
  getRange(a1Notation: string): FRange;
117
117
  /**
118
118
  * Returns the current number of columns in the sheet, regardless of content.
119
- * @return The maximum columns count of the sheet
119
+ * @returns {number} The maximum columns count of the sheet
120
120
  */
121
121
  getMaxColumns(): number;
122
122
  /**
123
123
  * Returns the current number of rows in the sheet, regardless of content.
124
- * @return The maximum rows count of the sheet
124
+ * @returns {number}The maximum rows count of the sheet
125
125
  */
126
126
  getMaxRows(): number;
127
127
  /**
128
128
  * 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.
129
+ * @param {number} afterPosition The row after which the new row should be added, starting at 0 for the first row.
130
+ * @returns {FWorksheet} This sheet, for chaining.
131
131
  */
132
- insertRowAfter(afterPosition: number): Promise<FWorksheet>;
132
+ insertRowAfter(afterPosition: number): FWorksheet;
133
133
  /**
134
134
  * 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.
135
+ * @param {number} beforePosition The row before which the new row should be added, starting at 0 for the first row.
136
+ * @returns {FWorksheet} This sheet, for chaining.
137
137
  */
138
- insertRowBefore(beforePosition: number): Promise<FWorksheet>;
138
+ insertRowBefore(beforePosition: number): FWorksheet;
139
139
  /**
140
140
  * Inserts one or more consecutive blank rows in a sheet starting at the specified location.
141
141
  * @param rowIndex The index indicating where to insert a row, starting at 0 for the first row.
142
142
  * @param numRows The number of rows to insert.
143
143
  * @returns This sheet, for chaining.
144
144
  */
145
- insertRows(rowIndex: number, numRows?: number): Promise<FWorksheet>;
145
+ insertRows(rowIndex: number, numRows?: number): FWorksheet;
146
146
  /**
147
147
  * Inserts a number of rows after the given row position.
148
148
  * @param afterPosition The row after which the new rows should be added, starting at 0 for the first row.
149
149
  * @param howMany The number of rows to insert.
150
150
  * @returns This sheet, for chaining.
151
151
  */
152
- insertRowsAfter(afterPosition: number, howMany: number): Promise<FWorksheet>;
152
+ insertRowsAfter(afterPosition: number, howMany: number): FWorksheet;
153
153
  /**
154
154
  * Inserts a number of rows before the given row position.
155
155
  * @param beforePosition The row before which the new rows should be added, starting at 0 for the first row.
156
156
  * @param howMany The number of rows to insert.
157
157
  * @returns This sheet, for chaining.
158
158
  */
159
- insertRowsBefore(beforePosition: number, howMany: number): Promise<FWorksheet>;
159
+ insertRowsBefore(beforePosition: number, howMany: number): FWorksheet;
160
160
  /**
161
161
  * Deletes the row at the given row position.
162
162
  * @param rowPosition The position of the row, starting at 0 for the first row.
163
163
  * @returns This sheet, for chaining.
164
164
  */
165
- deleteRow(rowPosition: number): Promise<FWorksheet>;
165
+ deleteRow(rowPosition: number): FWorksheet;
166
166
  /**
167
167
  * Deletes a number of rows starting at the given row position.
168
168
  * @param rowPosition The position of the first row to delete, starting at 0 for the first row.
169
169
  * @param howMany The number of rows to delete.
170
170
  * @returns This sheet, for chaining.
171
171
  */
172
- deleteRows(rowPosition: number, howMany: number): Promise<FWorksheet>;
172
+ deleteRows(rowPosition: number, howMany: number): FWorksheet;
173
173
  /**
174
174
  * Moves the rows selected by the given range to the position indicated by the destinationIndex. The rowSpec itself does not have to exactly represent an entire row or group of rows to move—it selects all rows that the range spans.
175
175
  * @param rowSpec A range spanning the rows that should be moved.
176
176
  * @param destinationIndex The index that the rows should be moved to. Note that this index is based on the coordinates before the rows are moved. Existing data is shifted down to make room for the moved rows while the source rows are removed from the grid. Therefore, the data may end up at a different index than originally specified. Use 0-index for this method.
177
177
  * @returns This sheet, for chaining.
178
178
  */
179
- moveRows(rowSpec: FRange, destinationIndex: number): Promise<FWorksheet>;
179
+ moveRows(rowSpec: FRange, destinationIndex: number): FWorksheet;
180
180
  /**
181
181
  * Hides the rows in the given range.
182
182
  * @param row The row range to hide.
183
183
  * @returns This sheet, for chaining.
184
184
  */
185
- hideRow(row: FRange): Promise<FWorksheet>;
185
+ hideRow(row: FRange): FWorksheet;
186
186
  /**
187
187
  * 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.
188
+ * @param {number} rowIndex The starting index of the rows to hide.
189
+ * @param {number} numRows The number of rows to hide.
190
+ * @returns {FWorksheet} This sheet, for chaining.
191
191
  */
192
- hideRows(rowIndex: number, numRows?: number): Promise<FWorksheet>;
192
+ hideRows(rowIndex: number, numRows?: number): FWorksheet;
193
193
  /**
194
- * Unhides the row in the given range.
195
- * @param row The range to unhide, if hidden.
196
- * @returns This sheet, for chaining.
194
+ * Make the row in the given range visible.
195
+ * @param {FRange} row The range to unhide, if hidden.
196
+ * @returns {FWorksheet} This sheet, for chaining.
197
197
  */
198
- unhideRow(row: FRange): Promise<FWorksheet>;
198
+ unhideRow(row: FRange): FWorksheet;
199
199
  /**
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.
200
+ * Scrolling sheet to make specific rows visible.
201
+ * @param {number} rowIndex The starting index of the rows
202
+ * @param {number} numRows The number of rows
203
+ * @returns {FWorksheet} This sheet, for chaining.
204
204
  */
205
- showRows(rowIndex: number, numRows?: number): Promise<FWorksheet>;
205
+ showRows(rowIndex: number, numRows?: number): FWorksheet;
206
206
  /**
207
207
  * 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.
208
+ * @param {number} rowPosition The row position to change.
209
+ * @param {number} height The height in pixels to set it to.
210
+ * @returns {FWorksheet} This sheet, for chaining.
211
211
  */
212
- setRowHeight(rowPosition: number, height: number): Promise<FWorksheet>;
212
+ setRowHeight(rowPosition: number, height: number): FWorksheet;
213
213
  /**
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.
214
+ * Sets the height of the given rows in pixels.
215
+ * By default, rows grow to fit cell contents. If you want to force rows to a specified height, use setRowHeightsForced(startRow, numRows, height).
216
+ * @param {number} startRow The starting row position to change.
217
+ * @param {number} numRows The number of rows to change.
218
+ * @param {number} height The height in pixels to set it to.
219
+ * @returns {FWorksheet} This sheet, for chaining.
219
220
  */
220
- setRowHeights(startRow: number, numRows: number, height: number): Promise<FWorksheet>;
221
+ setRowHeights(startRow: number, numRows: number, height: number): FWorksheet;
221
222
  /**
222
223
  * 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.
224
+ * @param {number} startRow The starting row position to change.
225
+ * @param {number} numRows The number of rows to change.
226
+ * @param {number} height The height in pixels to set it to.
227
+ * @returns {FWorksheet} This sheet, for chaining.
227
228
  */
228
- setRowHeightsForced(startRow: number, numRows: number, height: number): Promise<FWorksheet>;
229
+ setRowHeightsForced(startRow: number, numRows: number, height: number): FWorksheet;
229
230
  /**
230
231
  * Set custom properties for given rows.
231
232
  * @param custom The custom properties to set.
232
233
  * @returns This sheet, for chaining.
233
234
  */
234
- setRowCustom(custom: IObjectArrayPrimitiveType<CustomData>): Promise<FWorksheet>;
235
+ setRowCustom(custom: IObjectArrayPrimitiveType<CustomData>): FWorksheet;
235
236
  /**
236
237
  * Inserts a column after the given column position.
237
238
  * @param afterPosition The column after which the new column should be added, starting at 0 for the first column.
238
239
  * @returns This sheet, for chaining.
239
240
  */
240
- insertColumnAfter(afterPosition: number): Promise<FWorksheet>;
241
+ insertColumnAfter(afterPosition: number): FWorksheet;
241
242
  /**
242
243
  * Inserts a column before the given column position.
243
244
  * @param beforePosition The column before which the new column should be added, starting at 0 for the first column.
244
245
  * @returns This sheet, for chaining.
245
246
  */
246
- insertColumnBefore(beforePosition: number): Promise<FWorksheet>;
247
+ insertColumnBefore(beforePosition: number): FWorksheet;
247
248
  /**
248
249
  * Inserts one or more consecutive blank columns in a sheet starting at the specified location.
249
250
  * @param columnIndex The index indicating where to insert a column, starting at 0 for the first column.
250
251
  * @param numColumns The number of columns to insert.
251
252
  * @returns This sheet, for chaining.
252
253
  */
253
- insertColumns(columnIndex: number, numColumns?: number): Promise<FWorksheet>;
254
+ insertColumns(columnIndex: number, numColumns?: number): FWorksheet;
254
255
  /**
255
256
  * Inserts a given number of columns after the given column position.
256
257
  * @param afterPosition The column after which the new column should be added, starting at 0 for the first column.
257
258
  * @param howMany The number of columns to insert.
258
259
  * @returns This sheet, for chaining.
259
260
  */
260
- insertColumnsAfter(afterPosition: number, howMany: number): Promise<FWorksheet>;
261
+ insertColumnsAfter(afterPosition: number, howMany: number): FWorksheet;
261
262
  /**
262
263
  * Inserts a number of columns before the given column position.
263
264
  * @param beforePosition The column before which the new column should be added, starting at 0 for the first column.
264
265
  * @param howMany The number of columns to insert.
265
266
  * @returns This sheet, for chaining.
266
267
  */
267
- insertColumnsBefore(beforePosition: number, howMany: number): Promise<FWorksheet>;
268
+ insertColumnsBefore(beforePosition: number, howMany: number): FWorksheet;
268
269
  /**
269
270
  * Deletes the column at the given column position.
270
271
  * @param columnPosition The position of the column, starting at 0 for the first column.
271
272
  * @returns This sheet, for chaining.
272
273
  */
273
- deleteColumn(columnPosition: number): Promise<FWorksheet>;
274
+ deleteColumn(columnPosition: number): FWorksheet;
274
275
  /**
275
276
  * Deletes a number of columns starting at the given column position.
276
277
  * @param columnPosition The position of the first column to delete, starting at 0 for the first column.
277
278
  * @param howMany The number of columns to delete.
278
279
  * @returns This sheet, for chaining.
279
280
  */
280
- deleteColumns(columnPosition: number, howMany: number): Promise<FWorksheet>;
281
+ deleteColumns(columnPosition: number, howMany: number): FWorksheet;
281
282
  /**
282
283
  * Moves the columns selected by the given range to the position indicated by the destinationIndex. The columnSpec itself does not have to exactly represent an entire column or group of columns to move—it selects all columns that the range spans.
283
284
  * @param columnSpec A range spanning the columns that should be moved.
284
285
  * @param destinationIndex The index that the columns should be moved to. Note that this index is based on the coordinates before the columns are moved. Existing data is shifted right to make room for the moved columns while the source columns are removed from the grid. Therefore, the data may end up at a different index than originally specified. Use 0-index for this method.
285
286
  * @returns This sheet, for chaining.
286
287
  */
287
- moveColumns(columnSpec: FRange, destinationIndex: number): Promise<FWorksheet>;
288
+ moveColumns(columnSpec: FRange, destinationIndex: number): FWorksheet;
288
289
  /**
289
290
  * Hides the column or columns in the given range.
290
291
  * @param column The column range to hide.
291
292
  * @returns This sheet, for chaining.
292
293
  */
293
- hideColumn(column: FRange): Promise<FWorksheet>;
294
+ hideColumn(column: FRange): FWorksheet;
294
295
  /**
295
296
  * Hides one or more consecutive columns starting at the given index. Use 0-index for this method.
296
297
  * @param columnIndex The starting index of the columns to hide.
297
298
  * @param numColumns The number of columns to hide.
298
299
  * @returns This sheet, for chaining.
299
300
  */
300
- hideColumns(columnIndex: number, numColumns?: number): Promise<FWorksheet>;
301
+ hideColumns(columnIndex: number, numColumns?: number): FWorksheet;
301
302
  /**
302
- * Unhides the column in the given range.
303
+ * Show the column in the given range.
303
304
  * @param column The range to unhide, if hidden.
304
305
  * @returns This sheet, for chaining.
305
306
  */
306
- unhideColumn(column: FRange): Promise<FWorksheet>;
307
+ unhideColumn(column: FRange): FWorksheet;
307
308
  /**
308
- * Unhides one or more consecutive columns starting at the given index. Use 0-index for this method.
309
+ * Show one or more consecutive columns starting at the given index. Use 0-index for this method.
309
310
  * @param columnIndex The starting index of the columns to unhide.
310
311
  * @param numColumns The number of columns to unhide.
311
312
  * @returns This sheet, for chaining.
312
313
  */
313
- showColumns(columnIndex: number, numColumns?: number): Promise<FWorksheet>;
314
+ showColumns(columnIndex: number, numColumns?: number): FWorksheet;
314
315
  /**
315
316
  * Sets the width of the given column in pixels.
316
317
  * @param columnPosition The position of the given column to set.
317
318
  * @param width The width in pixels to set it to.
318
319
  * @returns This sheet, for chaining.
319
320
  */
320
- setColumnWidth(columnPosition: number, width: number): Promise<FWorksheet>;
321
+ setColumnWidth(columnPosition: number, width: number): FWorksheet;
321
322
  /**
322
323
  * Sets the width of the given columns in pixels.
323
324
  * @param startColumn The starting column position to change.
@@ -325,13 +326,13 @@ export declare class FWorksheet extends FBase {
325
326
  * @param width The width in pixels to set it to.
326
327
  * @returns This sheet, for chaining.
327
328
  */
328
- setColumnWidths(startColumn: number, numColumns: number, width: number): Promise<FWorksheet>;
329
+ setColumnWidths(startColumn: number, numColumns: number, width: number): FWorksheet;
329
330
  /**
330
331
  * Set custom properties for given columns.
331
332
  * @param custom The custom properties to set.
332
333
  * @returns This sheet, for chaining.
333
334
  */
334
- setColumnCustom(custom: IObjectArrayPrimitiveType<CustomData>): Promise<FWorksheet>;
335
+ setColumnCustom(custom: IObjectArrayPrimitiveType<CustomData>): FWorksheet;
335
336
  /**
336
337
  * Get all merged cells in the current sheet
337
338
  * @returns all merged cells
@@ -351,32 +352,31 @@ export declare class FWorksheet extends FBase {
351
352
  getActiveRange(): FRange | null;
352
353
  /**
353
354
  * Sets the active selection region for this sheet.
354
- * @param range The range to set as the active selection.
355
+ * @param {FRange} range The range to set as the active selection.
356
+ * @returns {FWorksheet} This sheet, for chaining.
355
357
  */
356
- setActiveRange(range: FRange): void;
358
+ setActiveRange(range: FRange): FWorksheet;
357
359
  /**
358
360
  * Sets the active selection region for this sheet.
359
361
  * @param range The range to set as the active selection.
360
362
  */
361
- setActiveSelection: (range: FRange) => void;
363
+ setActiveSelection: (range: FRange) => FWorksheet;
362
364
  /**
363
365
  * Sets the frozen state of the current sheet.
364
366
  * @param freeze - the scrolling viewport start range and count of freezed rows and columns.
365
367
  * 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
368
  * @deprecated use `setFrozenRows` and `setFrozenColumns` instead.
368
369
  * @returns True if the command was successful, false otherwise.
369
370
  */
370
- setFreeze(freeze: IFreeze): boolean;
371
+ setFreeze(freeze: IFreeze): FWorksheet;
371
372
  /**
372
373
  * Cancels the frozen state of the current sheet.
373
374
  * @returns True if the command was successful, false otherwise.
374
375
  */
375
- cancelFreeze(): boolean;
376
+ cancelFreeze(): FWorksheet;
376
377
  /**
377
378
  * Get the freeze state of the current sheet.
378
379
  * @returns The freeze state of the current sheet.
379
- *
380
380
  * @deprecated use `getRowFreezeStatus` and `getColumnFreezeStatus` instead.
381
381
  */
382
382
  getFreeze(): IFreeze;
@@ -385,36 +385,35 @@ export declare class FWorksheet extends FBase {
385
385
  * @param columns The number of columns to freeze.
386
386
  * To unfreeze all columns, set this value to 0.
387
387
  */
388
- setFrozenColumns(columns: number): void;
388
+ setFrozenColumns(columns: number): FWorksheet;
389
389
  /**
390
390
  * Set freeze column, then the range from startColumn to endColumn will be fixed.
391
391
  * e.g. setFrozenColumns(0, 2) will fix the column range from 0 to 2.
392
392
  * 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
393
  * @example
395
- * ``` ts
394
+ * ```typescript
396
395
  * const fWorkbook = univerAPI.getActiveWorkbook();
397
396
  * const fWorkSheet = fWorkbook.getActiveSheet();
398
397
  * // freeze the first too columns.
399
398
  * fWorkSheet.setFrozenColumns(0, 2);
400
399
  * ```
401
- * @param startColumn
402
- * @param endColumn
400
+ * @param startColumn - The start column of the range to freeze.
401
+ * @param endColumn - The end column of the range to freeze.
402
+ * @returns {FWorksheet} This FWorksheet instance.
403
403
  */
404
- setFrozenColumns(startColumn: number, endColumn: number): void;
404
+ setFrozenColumns(startColumn: number, endColumn: number): FWorksheet;
405
405
  /**
406
406
  * Set the number of frozen rows.
407
407
  * @param rows The number of rows to freeze.
408
408
  * To unfreeze all rows, set this value to 0.
409
409
  */
410
- setFrozenRows(rows: number): void;
410
+ setFrozenRows(rows: number): FWorksheet;
411
411
  /**
412
412
  * Set freeze row, then the range from startRow to endRow will be fixed.
413
413
  * e.g. setFrozenRows(0, 2) will fix the row range from 0 to 2.
414
414
  * 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
- *
415
+ * @param startRow - The start row of the range to freeze.
416
+ * @param endRow - The end row of the range to freeze.
418
417
  * @example
419
418
  * ``` ts
420
419
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -423,33 +422,27 @@ export declare class FWorksheet extends FBase {
423
422
  * fWorkSheet.setFrozenRows(0, 2);
424
423
  * ```
425
424
  */
426
- setFrozenRows(startColumn: number, endColumn: number): void;
425
+ setFrozenRows(startColumn: number, endColumn: number): FWorksheet;
427
426
  /**
428
427
  * Get the number of frozen columns.
429
- * @returns The number of frozen columns.
430
- * Returns 0 if no columns are frozen.
428
+ * @returns The number of frozen columns, returns 0 if no columns are frozen.
431
429
  */
432
430
  getFrozenColumns(): number;
433
431
  /**
434
432
  * Get the number of frozen rows.
435
- * @returns The number of frozen rows.
436
- * Returns 0 if no rows are frozen.
433
+ * @returns The number of frozen rows. returns 0 if no rows are frozen.
437
434
  */
438
435
  getFrozenRows(): number;
439
436
  /**
440
437
  * Get freezed rows.
438
+ * @returns {IRowRange} The range of the frozen rows.
441
439
  */
442
- getFrozenRowRange(): {
443
- startRow: number;
444
- endRow: number;
445
- };
440
+ getFrozenRowRange(): IRowRange;
446
441
  /**
447
442
  * Get freezed columns
443
+ * @returns {IColumnRange} The range of the frozen columns.
448
444
  */
449
- getFrozenColumnRange(): {
450
- startColumn: number;
451
- endColumn: number;
452
- };
445
+ getFrozenColumnRange(): IColumnRange;
453
446
  /**
454
447
  * Returns true if the sheet's gridlines are hidden; otherwise returns false. Gridlines are visible by default.
455
448
  * @returns {boolean} True if the sheet's gridlines are hidden; otherwise false.
@@ -467,6 +460,7 @@ export declare class FWorksheet extends FBase {
467
460
  /**
468
461
  * Hides or reveals the sheet gridlines.
469
462
  * @param {boolean} hidden If `true`, hide gridlines in this sheet; otherwise show the gridlines.
463
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
470
464
  * @example
471
465
  * ``` ts
472
466
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -475,11 +469,11 @@ export declare class FWorksheet extends FBase {
475
469
  * fWorkSheet.setHiddenGridlines(true);
476
470
  * ```
477
471
  */
478
- setHiddenGridlines(hidden: boolean): Promise<boolean>;
472
+ setHiddenGridlines(hidden: boolean): FWorksheet;
479
473
  /**
480
474
  * Set the color of the gridlines in the sheet.
481
475
  * @param {string|undefined} color The color to set for the gridlines.Undefined or null to reset to the default color.
482
- * @returns {Promise<boolean>} True if the command was successful, false otherwise.
476
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
483
477
  * @example
484
478
  * ```ts
485
479
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -488,7 +482,7 @@ export declare class FWorksheet extends FBase {
488
482
  * fWorkSheet.setGridLinesColor('#ff0000');
489
483
  * ```
490
484
  */
491
- setGridLinesColor(color: string | undefined): Promise<boolean>;
485
+ setGridLinesColor(color: string | undefined): FWorksheet;
492
486
  /**
493
487
  * Get the color of the gridlines in the sheet.
494
488
  * @returns {string | undefined} The color of the gridlines in the sheet or undefined. The default color is 'rgb(214, 216, 219)'.
@@ -497,7 +491,7 @@ export declare class FWorksheet extends FBase {
497
491
  /**
498
492
  * Sets the sheet tab color.
499
493
  * @param {string|null|undefined} color A color code in CSS notation (like '#ffffff' or 'white'), or null to reset the tab color.
500
- * @returns {Promise<boolean>} True if the command was successful, false otherwise.
494
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
501
495
  * @example
502
496
  * ```ts
503
497
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -506,7 +500,7 @@ export declare class FWorksheet extends FBase {
506
500
  * fWorkSheet.setTabColor('#ff0000');
507
501
  * ```
508
502
  */
509
- setTabColor(color: string): Promise<boolean>;
503
+ setTabColor(color: string): FWorksheet;
510
504
  /**
511
505
  * Get the tab color of the sheet.
512
506
  * @returns {string} The tab color of the sheet or undefined.
@@ -556,18 +550,19 @@ export declare class FWorksheet extends FBase {
556
550
  onBeforeCellDataChange(callback: (cellValue: ObjectMatrix<Nullable<ICellData>>) => void): IDisposable;
557
551
  /**
558
552
  * 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.
553
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
559
554
  * @example
560
555
  * ```ts
561
556
  * const fWorkbook = univerAPI.getActiveWorkbook();
562
557
  * const fWorkSheet = fWorkbook.getActiveSheet();
563
558
  * // hide the active sheet
564
559
  * fWorkSheet.hideSheet();
565
- * ``
560
+ * ```
566
561
  */
567
- hideSheet(): void;
562
+ hideSheet(): FWorksheet;
568
563
  /**
569
564
  * Shows this sheet. Has no effect if the sheet is already visible.
570
- * @returns {Promise<boolean>} True if the command was successful, false otherwise.
565
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
571
566
  * @example
572
567
  * ```ts
573
568
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -576,7 +571,7 @@ export declare class FWorksheet extends FBase {
576
571
  * fWorkSheets[fWorkSheets.length - 1].showSheet();
577
572
  * ```
578
573
  */
579
- showSheet(): Promise<boolean>;
574
+ showSheet(): FWorksheet;
580
575
  /**
581
576
  * Returns true if the sheet is currently hidden.
582
577
  * @returns {boolean} True if the sheet is hidden; otherwise, false.
@@ -585,7 +580,7 @@ export declare class FWorksheet extends FBase {
585
580
  /**
586
581
  * Sets the sheet name.
587
582
  * @param {string} name The new name for the sheet.
588
- * @returns {Promise<boolean>} True if the command was successful, false otherwise.
583
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
589
584
  * @example
590
585
  * ```ts
591
586
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -594,7 +589,7 @@ export declare class FWorksheet extends FBase {
594
589
  * fWorkSheet.setName('Sheet1');
595
590
  * ```
596
591
  */
597
- setName(name: string): Promise<boolean>;
592
+ setName(name: string): FWorksheet;
598
593
  /**
599
594
  * Activates this sheet. Does not alter the sheet itself, only the parent's notion of the active sheet.
600
595
  * @returns Current sheet, for chaining.
@@ -618,7 +613,7 @@ export declare class FWorksheet extends FBase {
618
613
  * @param {IFacadeClearOptions} [options] Options for clearing the sheet. If not provided, the contents and formatting are cleared both.
619
614
  * @param {boolean} [options.contentsOnly] If true, the contents of the sheet are cleared. If false, the contents and formatting are cleared. Default is false.
620
615
  * @param {boolean} [options.formatOnly] If true, the formatting of the sheet is cleared. If false, the contents and formatting are cleared. Default is false.
621
- * @returns {Promise<boolean>} True if the command was successful, false otherwise.
616
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
622
617
  * @example
623
618
  * ```ts
624
619
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -629,10 +624,10 @@ export declare class FWorksheet extends FBase {
629
624
  * fWorkSheet.clear({ contentsOnly: true });
630
625
  * ```
631
626
  */
632
- clear(options?: IFacadeClearOptions): Promise<boolean>;
627
+ clear(options?: IFacadeClearOptions): FWorksheet;
633
628
  /**
634
629
  * Clears the sheet of contents, while preserving formatting information.
635
- * @returns {Promise<boolean>} True if the command was successful, false otherwise.
630
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
636
631
  * @example
637
632
  * ```ts
638
633
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -641,10 +636,10 @@ export declare class FWorksheet extends FBase {
641
636
  * fWorkSheet.clearContents();
642
637
  * ```
643
638
  */
644
- clearContents(): Promise<boolean>;
639
+ clearContents(): FWorksheet;
645
640
  /**
646
641
  * Clears the sheet of formatting, while preserving contents.
647
- * @returns {Promise<boolean>} True if the command was successful, false otherwise.
642
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
648
643
  * @example
649
644
  * ```ts
650
645
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -653,7 +648,7 @@ export declare class FWorksheet extends FBase {
653
648
  * fWorkSheet.clearFormats();
654
649
  * ```
655
650
  */
656
- clearFormats(): Promise<boolean>;
651
+ clearFormats(): FWorksheet;
657
652
  /**
658
653
  * Returns a Range corresponding to the dimensions in which data is present.
659
654
  * This is functionally equivalent to creating a Range bounded by A1 and (Sheet.getLastColumns(), Sheet.getLastRows()).
@@ -682,6 +677,7 @@ export declare class FWorksheet extends FBase {
682
677
  */
683
678
  getLastColumns(): number;
684
679
  /**
680
+ * @deprecated use getLastColumn instead.
685
681
  * Returns the position of the last column that has content. Same as getLastColumns.
686
682
  * @returns {number} the last column of the sheet that contains content.
687
683
  * @example
@@ -694,6 +690,7 @@ export declare class FWorksheet extends FBase {
694
690
  */
695
691
  getLastColumn(): number;
696
692
  /**
693
+ * @deprecated use getLastRow instead.
697
694
  * Returns the position of the last row that has content.
698
695
  * @returns {number} the last row of the sheet that contains content.
699
696
  * @example
@@ -743,5 +740,21 @@ export declare class FWorksheet extends FBase {
743
740
  * ```
744
741
  */
745
742
  getDefinedNames(): FDefinedName[];
743
+ /**
744
+ * Get all merged cells in the current worksheet
745
+ * @returns {FRange[]} All the merged cells in the worksheet
746
+ * @example
747
+ * ```ts
748
+ * const workbook = univerAPI.getActiveWorkbook();
749
+ * const worksheet = workbook.getActiveSheet();
750
+ * const rangeFirst = worksheet.getRange(0, 0, 2, 2);
751
+ * const mergeFirst = rangeFirst.merge();
752
+ * const rangeSecond = worksheet.getRange(5, 0, 2, 2);
753
+ * const mergeSecond = rangeSecond.merge();
754
+ * const mergeData = worksheet.getMergeData();
755
+ * console.log('debugger', mergeData);
756
+ * ```
757
+ */
758
+ getMergeData(): FRange[];
746
759
  }
747
760
  export {};
@@ -14,11 +14,12 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import './f-univer';
17
+ export * from './f-event';
17
18
  export { FPermission } from './f-permission';
18
19
  export { FRange } from './f-range';
19
20
  export type { FontLine, FontStyle, FontWeight } from './f-range';
20
21
  export { FSelection } from './f-selection';
21
22
  export { FSheetHooks } from './f-sheet-hooks';
22
23
  export { FWorkbook } from './f-workbook';
23
- export { FWorksheet } from './f-worksheet';
24
24
  export type * from './f-univer';
25
+ export { FWorksheet } from './f-worksheet';