@univerjs-pro/docs-table 0.25.0 → 1.0.0-alpha.0

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 (35) hide show
  1. package/README.md +23 -61
  2. package/lib/cjs/facade.js +1 -1
  3. package/lib/cjs/index.js +1 -1
  4. package/lib/es/facade.js +1 -1
  5. package/lib/es/index.js +1 -1
  6. package/lib/facade.js +1 -1
  7. package/lib/index.js +1 -1
  8. package/lib/types/commands/insert-columns.command.d.ts +2 -2
  9. package/lib/types/commands/insert-rows.command.d.ts +2 -2
  10. package/lib/types/commands/move-columns.command.d.ts +2 -1
  11. package/lib/types/commands/move-rows.command.d.ts +2 -1
  12. package/lib/types/commands/set-table-background.command.d.ts +2 -2
  13. package/lib/types/commands/set-table-border-color.command.d.ts +5 -4
  14. package/lib/types/commands/set-table-vertical-align.command.d.ts +7 -0
  15. package/lib/types/common/actions.d.ts +22 -5
  16. package/lib/types/common/border.d.ts +17 -3
  17. package/lib/types/common/insert-table.d.ts +46 -1
  18. package/lib/types/common/layout.d.ts +18 -0
  19. package/lib/types/common/sort.d.ts +4 -1
  20. package/lib/types/common/type.d.ts +22 -2
  21. package/lib/types/facade/f-document-table-cell.d.ts +162 -0
  22. package/lib/types/facade/f-document-table.d.ts +931 -0
  23. package/lib/types/facade/f-document.d.ts +95 -36
  24. package/lib/types/facade/f-enum.d.ts +114 -0
  25. package/lib/types/facade/index.d.ts +4 -4
  26. package/lib/types/facade/types.d.ts +1 -7
  27. package/lib/types/index.d.ts +23 -17
  28. package/lib/types/plugin.d.ts +1 -1
  29. package/lib/types/services/docs-table-selection.service.d.ts +5 -0
  30. package/lib/umd/facade.js +1 -1
  31. package/lib/umd/index.js +1 -1
  32. package/package.json +7 -8
  33. package/lib/types/facade/f-docs-table-cell.d.ts +0 -83
  34. package/lib/types/facade/f-docs-table.d.ts +0 -130
  35. /package/lib/types/{controllers/config.schema.d.ts → config/config.d.ts} +0 -0
@@ -0,0 +1,931 @@
1
+ import type { DocsTableColumnInsertPosition, DocsTableRowInsertPosition, DocsTableSortDirection, IDocsTableCellRange, IDocsTableColumnTypeConfig, IDocsTableMetadata, IDocsTableOffsetRange } from '@univerjs-pro/docs-table';
2
+ import type { ITable } from '@univerjs/core';
3
+ import type { FDocument } from '@univerjs/docs/facade';
4
+ import type { IDocsTableBorderOptions, IDocsTableCellContentRange, IDocsTableDescription, IDocsTableInfo, IDocsTableStyle } from './types';
5
+ import { DocsTableSelectionKind } from '@univerjs-pro/docs-table';
6
+ import { Injector } from '@univerjs/core';
7
+ import { FDocumentTableCell } from './f-document-table-cell';
8
+ /**
9
+ * Facade object for a single enhanced docs table.
10
+ *
11
+ * All mutating methods execute synchronously through the Univer command service and return
12
+ * `true` when the underlying document mutation succeeds.
13
+ * @example
14
+ * ```ts
15
+ * const fDocument = univerAPI.getActiveDocument();
16
+ *
17
+ * const table = fDocument?.findTableByText('Status');
18
+ * console.log(table?.describe());
19
+ *
20
+ * table?.setCellText(1, 1, 'Done');
21
+ * table?.setTableBorder({ color: '#3367D6', width: 1 });
22
+ * ```
23
+ */
24
+ export declare class FDocumentTable {
25
+ private _document;
26
+ private _tableId;
27
+ protected readonly _injector: Injector;
28
+ private readonly _unitId;
29
+ constructor(_document: FDocument, _tableId: string, _injector: Injector);
30
+ /**
31
+ * Returns the table id.
32
+ * @returns {string} The table id stored in the document snapshot.
33
+ * @example
34
+ * ```ts
35
+ * const fDocument = univerAPI.getActiveDocument();
36
+ * const table = fDocument?.findTableByText('Status');
37
+ * console.log(table?.getId()); // e.g. 'table-12345'
38
+ * ```
39
+ */
40
+ getId(): string;
41
+ /**
42
+ * Returns compact table metadata for agents.
43
+ * @returns {IDocsTableInfo} The id, row count, column count, metadata, and raw table source.
44
+ * @example
45
+ * ```ts
46
+ * const fDocument = univerAPI.getActiveDocument();
47
+ * const table = fDocument?.findTableByText('Status');
48
+ * console.log(table?.getInfo());
49
+ * ```
50
+ */
51
+ getInfo(): IDocsTableInfo;
52
+ /**
53
+ * Returns a human-readable table summary with sample rows.
54
+ * @returns {IDocsTableDescription} A compact description suitable for agents or logs.
55
+ * @example
56
+ * ```ts
57
+ * const fDocument = univerAPI.getActiveDocument();
58
+ * const table = fDocument?.findTableByText('Status');
59
+ * console.log(table?.describe());
60
+ * ```
61
+ */
62
+ describe(): IDocsTableDescription;
63
+ /**
64
+ * Gets the number of rows in the table.
65
+ * @returns {number} The row count, or `0` if the table source is not found in the document snapshot.
66
+ * @example
67
+ * ```ts
68
+ * const fDocument = univerAPI.getActiveDocument();
69
+ * const table = fDocument?.findTableByText('Status');
70
+ * console.log(table?.getRowCount());
71
+ * ```
72
+ */
73
+ getRowCount(): number;
74
+ /**
75
+ * Gets the number of columns in the table.
76
+ * @returns {number} The column count, or `0` if the table source is not found in the document snapshot.
77
+ * @example
78
+ * ```ts
79
+ * const fDocument = univerAPI.getActiveDocument();
80
+ * const table = fDocument?.findTableByText('Status');
81
+ * console.log(table?.getColumnCount());
82
+ * ```
83
+ */
84
+ getColumnCount(): number;
85
+ /**
86
+ * Gets a FDocumentTableCell instance for the specified cell coordinates.
87
+ * @param {number} row The zero-based row index.
88
+ * @param {number} column The zero-based column index.
89
+ * @returns {FDocumentTableCell | null} The FDocumentTableCell instance, or `null` if the cell does not exist.
90
+ * @example
91
+ * ```ts
92
+ * const fDocument = univerAPI.getActiveDocument();
93
+ * const table = fDocument?.findTableByText('Status');
94
+ * const cell = table?.getCell(0, 0);
95
+ * console.log(cell?.getText()); // e.g. 'Status'
96
+ * ```
97
+ */
98
+ getCell(row: number, column: number): FDocumentTableCell | null;
99
+ /**
100
+ * Gets the plain text content of a cell.
101
+ * @param {number} row The zero-based row index.
102
+ * @param {number} column The zero-based column index.
103
+ * @returns {string} The cell text, or an empty string if the cell does not exist or has no text.
104
+ * @example
105
+ * ```ts
106
+ * const fDocument = univerAPI.getActiveDocument();
107
+ * const table = fDocument?.findTableByText('Status');
108
+ * const cellText = table?.getCellText(0, 0);
109
+ * console.log(cellText); // e.g. 'Status'
110
+ * ```
111
+ */
112
+ getCellText(row: number, column: number): string;
113
+ /**
114
+ * Gets the table metadata stored in the document snapshot, including header row count, title row, and column type configs.
115
+ * @returns {IDocsTableMetadata | undefined} The table metadata, or `undefined` if the table source is not found in the document snapshot.
116
+ * @example
117
+ * ```ts
118
+ * const fDocument = univerAPI.getActiveDocument();
119
+ * const table = fDocument?.findTableByText('Status');
120
+ * console.log(table?.getMetadata());
121
+ * ```
122
+ */
123
+ getMetadata(): IDocsTableMetadata | undefined;
124
+ /**
125
+ * Gets the raw table source from the document snapshot, including all table rows, cells, and columns.
126
+ * @returns {ITable | undefined} The table source, or `undefined` if the table is not found in the document snapshot.
127
+ * @example
128
+ * ```ts
129
+ * const fDocument = univerAPI.getActiveDocument();
130
+ * const table = fDocument?.findTableByText('Status');
131
+ * console.log(table?.getSource());
132
+ * ```
133
+ */
134
+ getSource(): ITable | undefined;
135
+ /**
136
+ * Gets the table range with offsets for all cells in the table.
137
+ * @returns {IDocsTableOffsetRange} The table range with offsets, or `null` if the table source is not found in the document snapshot.
138
+ * @example
139
+ * ```ts
140
+ * const fDocument = univerAPI.getActiveDocument();
141
+ * const table = fDocument?.findTableByText('Status');
142
+ * console.log(table?._getDocumentData());
143
+ * ```
144
+ */
145
+ getRange(): IDocsTableOffsetRange | null;
146
+ /**
147
+ * Gets the table cell range covering all cells in the table.
148
+ * @returns {IDocsTableCellRange} The table cell range covering all cells in the table, or `null` if the table source is not found in the document snapshot.
149
+ * @example
150
+ * ```ts
151
+ * const fDocument = univerAPI.getActiveDocument();
152
+ * const table = fDocument?.findTableByText('Status');
153
+ * console.log(table?._getTableRange());
154
+ * ```
155
+ */
156
+ getTableRange(): IDocsTableCellRange;
157
+ /**
158
+ * Gets the table cell range for the specified cell coordinates.
159
+ * @param {number} row The zero-based row index.
160
+ * @param {number} column The zero-based column index.
161
+ * @returns {IDocsTableCellRange} The cell range, or `null` if the cell does not exist.
162
+ * @example
163
+ * ```ts
164
+ * const fDocument = univerAPI.getActiveDocument();
165
+ * const table = fDocument?.findTableByText('Status');
166
+ * const cellRange = table?.getCellRange(1, 1);
167
+ * console.log(cellRange); // e.g. { startRow: 1, endRow: 1, startColumn: 1, endColumn: 1 }
168
+ * ```
169
+ */
170
+ getCellRange(row: number, column: number): IDocsTableCellRange;
171
+ /**
172
+ * Returns the editable document range inside a table cell.
173
+ * The range excludes the table cell tokens and the final section break, so block/list facades
174
+ * can use it as their `startOffset`/`endOffset` target.
175
+ * @param {number} row The zero-based row index.
176
+ * @param {number} column The zero-based column index.
177
+ * @returns {IDocsTableCellContentRange | null} The cell content range, or `null` if the cell does not exist.
178
+ * @example
179
+ * ```
180
+ * const fDocument = univerAPI.getActiveDocument();
181
+ * const table = fDocument?.findTableByText('Status');
182
+ * const contentRange = table?.getCellContentRange(1, 1);
183
+ * console.log(contentRange); // e.g. { startOffset: 123, endOffset: 130, segmentId: 'segment-1' }
184
+ * ```
185
+ */
186
+ getCellContentRange(row: number, column: number): IDocsTableCellContentRange | null;
187
+ /**
188
+ * Returns the offset before the cell's final section break.
189
+ * Use this offset to insert an empty callout, quote, code block, or paragraph in the cell.
190
+ * @param {number} row The zero-based row index.
191
+ * @param {number} column The zero-based column index.
192
+ * @returns {number | null} The insertion offset, or `null` if the cell does not exist.
193
+ * @example
194
+ * ```
195
+ * const fDocument = univerAPI.getActiveDocument();
196
+ * const table = fDocument?.findTableByText('Status');
197
+ * const insertOffset = table?.getCellInsertOffset(1, 1);
198
+ * console.log(insertOffset); // e.g. 129
199
+ * ```
200
+ */
201
+ getCellInsertOffset(row: number, column: number): number | null;
202
+ /**
203
+ * Gets the cell range for the specified row index, covering all columns in the row.
204
+ * @param {number} row The zero-based row index.
205
+ * @returns {IDocsTableCellRange} The cell range for the specified row, or `null` if the row does not exist.
206
+ * @example
207
+ * ```ts
208
+ * const fDocument = univerAPI.getActiveDocument();
209
+ * const table = fDocument?.findTableByText('Status');
210
+ * const rowRange = table?.getRowRange(1);
211
+ * console.log(rowRange); // e.g. { startRow: 1, endRow: 1, startColumn: 0, endColumn: 4 }
212
+ * ```
213
+ */
214
+ getRowRange(row: number): IDocsTableCellRange;
215
+ /**
216
+ * Gets the cell range for the specified row index and row count, covering all columns in the rows.
217
+ * @param {number} startRow The zero-based starting row index.
218
+ * @param {number} [count] The number of rows to include in the range.
219
+ * @returns {IDocsTableCellRange} The cell range for the specified rows, or `null` if the starting row does not exist.
220
+ * @example
221
+ * ```ts
222
+ * const fDocument = univerAPI.getActiveDocument();
223
+ * const table = fDocument?.findTableByText('Status');
224
+ * const rowsRange = table?.getRowsRange(1, 2);
225
+ * console.log(rowsRange); // e.g. { startRow: 1, endRow: 2, startColumn: 0, endColumn: 4 }
226
+ * ```
227
+ */
228
+ getRowsRange(startRow: number, count?: number): IDocsTableCellRange;
229
+ /**
230
+ * Gets the cell range for the specified column index, covering all rows in the column.
231
+ * @param {number} column The zero-based column index.
232
+ * @returns {IDocsTableCellRange} The cell range for the specified column, or `null` if the column does not exist.
233
+ * @example
234
+ * ```ts
235
+ * const fDocument = univerAPI.getActiveDocument();
236
+ * const table = fDocument?.findTableByText('Status');
237
+ * const columnRange = table?.getColumnRange(1);
238
+ * console.log(columnRange); // e.g. { startRow: 0, endRow: 4, startColumn: 1, endColumn: 1 }
239
+ * ```
240
+ */
241
+ getColumnRange(column: number): IDocsTableCellRange;
242
+ /**
243
+ * Gets the cell range for the specified column index and column count, covering all rows in the columns.
244
+ * @param {number} startColumn The zero-based starting column index.
245
+ * @param {number} [count] The number of columns to include in the range.
246
+ * @returns {IDocsTableCellRange} The cell range for the specified columns, or `null` if the starting column does not exist.
247
+ * @example
248
+ * ```ts
249
+ * const fDocument = univerAPI.getActiveDocument();
250
+ * const table = fDocument?.findTableByText('Status');
251
+ * const columnsRange = table?.getColumnsRange(1, 2);
252
+ * console.log(columnsRange); // e.g. { startRow: 0, endRow: 4, startColumn: 1, endColumn: 2 }
253
+ * ```
254
+ */
255
+ getColumnsRange(startColumn: number, count?: number): IDocsTableCellRange;
256
+ /**
257
+ * Selects the entire table.
258
+ * @returns {boolean} `true` if the selection was successfully set, or `false` if the table source is not found in the document snapshot.
259
+ * @example
260
+ * ```ts
261
+ * const fDocument = univerAPI.getActiveDocument();
262
+ * const table = fDocument?.findTableByText('Status');
263
+ * table?.selectTable();
264
+ * ```
265
+ */
266
+ selectTable(): boolean;
267
+ /**
268
+ * Selects a single row in the table.
269
+ * @param {number} row The zero-based row index to select.
270
+ * @returns {boolean} `true` if the selection was successfully set, or `false` if the table source is not found in the document snapshot.
271
+ * @example
272
+ * ```ts
273
+ * const fDocument = univerAPI.getActiveDocument();
274
+ * const table = fDocument?.findTableByText('Status');
275
+ * table?.selectRow(1);
276
+ * ```
277
+ */
278
+ selectRow(row: number): boolean;
279
+ /**
280
+ * Selects multiple rows in the table.
281
+ * @param {number} startRow The zero-based starting row index to select.
282
+ * @param {number} [count] The number of rows to select.
283
+ * @returns {boolean} `true` if the selection was successfully set, or `false` if the table source is not found in the document snapshot.
284
+ * @example
285
+ * ```ts
286
+ * const fDocument = univerAPI.getActiveDocument();
287
+ * const table = fDocument?.findTableByText('Status');
288
+ * table?.selectRows(1, 2); // Selects rows 1 and 2
289
+ * ```
290
+ */
291
+ selectRows(startRow: number, count?: number): boolean;
292
+ /**
293
+ * Selects a single column in the table.
294
+ * @param {number} column The zero-based column index to select.
295
+ * @returns {boolean} `true` if the selection was successfully set, or `false` if the table source is not found in the document snapshot.
296
+ * @example
297
+ * ```ts
298
+ * const fDocument = univerAPI.getActiveDocument();
299
+ * const table = fDocument?.findTableByText('Status');
300
+ * table?.selectColumn(1);
301
+ * ```
302
+ */
303
+ selectColumn(column: number): boolean;
304
+ /**
305
+ * Selects multiple columns in the table.
306
+ * @param {number} startColumn The zero-based starting column index to select.
307
+ * @param {number} [count] The number of columns to select.
308
+ * @returns {boolean} `true` if the selection was successfully set, or `false` if the table source is not found in the document snapshot.
309
+ * @example
310
+ * ```ts
311
+ * const fDocument = univerAPI.getActiveDocument();
312
+ * const table = fDocument?.findTableByText('Status');
313
+ * table?.selectColumns(1, 2); // Selects columns 1 and 2
314
+ * ```
315
+ */
316
+ selectColumns(startColumn: number, count?: number): boolean;
317
+ /**
318
+ * Selects a single cell in the table.
319
+ * @param {number} row The zero-based row index of the cell to select.
320
+ * @param {number} column The zero-based column index of the cell to select.
321
+ * @returns {boolean} `true` if the selection was successfully set, or `false` if the table source is not found in the document snapshot.
322
+ * @example
323
+ * ```ts
324
+ * const fDocument = univerAPI.getActiveDocument();
325
+ * const table = fDocument?.findTableByText('Status');
326
+ * table?.selectCell(1, 1); // Selects the cell at row 1, column 1
327
+ * ```
328
+ */
329
+ selectCell(row: number, column: number): boolean;
330
+ /**
331
+ * Selects a range of cells in the table with the specified selection kind.
332
+ * @param {IDocsTableCellRange} range The cell range to select.
333
+ * @param {DocsTableSelectionKind} [kind] The selection kind, which determines the selection behavior and UI. Defaults to `Range`.
334
+ * @returns {boolean} `true` if the selection was successfully set, or `false` if the table source is not found in the document snapshot.
335
+ * @example
336
+ * ```ts
337
+ * const fDocument = univerAPI.getActiveDocument();
338
+ * const table = fDocument?.findTableByText('Status');
339
+ *
340
+ * // Select a range of cells from row 1 to 2 and column 1 to 2 with the 'Range' selection kind
341
+ * table.selectRange({
342
+ * startRow: 1,
343
+ * endRow: 2,
344
+ * startColumn: 1,
345
+ * endColumn: 2,
346
+ * });
347
+ * ```
348
+ */
349
+ selectRange(range: IDocsTableCellRange, kind?: Exclude<DocsTableSelectionKind, DocsTableSelectionKind.None | DocsTableSelectionKind.Text>): boolean;
350
+ /**
351
+ * Inserts a new row before the specified row index.
352
+ * @param {number} row The zero-based row index to insert before.
353
+ * @returns {boolean} `true` if the row was successfully inserted.
354
+ * @example
355
+ * ```ts
356
+ * const fDocument = univerAPI.getActiveDocument();
357
+ * const table = fDocument?.findTableByText('Status');
358
+ * table?.insertRowBefore(1); // Inserts a new row before row 1
359
+ * ```
360
+ */
361
+ insertRowBefore(row: number): boolean;
362
+ /**
363
+ * Inserts a new row after the specified row index.
364
+ * @param {number} row The zero-based row index to insert after.
365
+ * @returns {boolean} `true` if the row was successfully inserted.
366
+ * @example
367
+ * ```ts
368
+ * const fDocument = univerAPI.getActiveDocument();
369
+ * const table = fDocument?.findTableByText('Status');
370
+ * table?.insertRowAfter(1); // Inserts a new row after row 1
371
+ * ```
372
+ */
373
+ insertRowAfter(row: number): boolean;
374
+ /**
375
+ * Inserts multiple rows before the specified row index.
376
+ * @param {number} row The zero-based row index to insert before.
377
+ * @param {number} count The number of rows to insert.
378
+ * @returns {boolean} `true` if the rows were successfully inserted.
379
+ * @example
380
+ * ```ts
381
+ * const fDocument = univerAPI.getActiveDocument();
382
+ * const table = fDocument?.findTableByText('Status');
383
+ * table?.insertRowsBefore(1, 2); // Inserts 2 new rows before row 1
384
+ * ```
385
+ */
386
+ insertRowsBefore(row: number, count: number): boolean;
387
+ /**
388
+ * Inserts multiple rows after the specified row index.
389
+ * @param {number} row The zero-based row index to insert after.
390
+ * @param {number} count The number of rows to insert.
391
+ * @returns {boolean} `true` if the rows were successfully inserted.
392
+ * @example
393
+ * ```ts
394
+ * const fDocument = univerAPI.getActiveDocument();
395
+ * const table = fDocument?.findTableByText('Status');
396
+ * table?.insertRowsAfter(1, 2); // Inserts 2 new rows after row 1
397
+ * ```
398
+ */
399
+ insertRowsAfter(row: number, count: number): boolean;
400
+ /**
401
+ * Appends a new row at the end of the table.
402
+ * @returns {boolean} `true` if the row was successfully appended.
403
+ * @example
404
+ * ```ts
405
+ * const fDocument = univerAPI.getActiveDocument();
406
+ * const table = fDocument?.findTableByText('Status');
407
+ * table?.appendRow(); // Appends a new row at the end of the table
408
+ * ```
409
+ */
410
+ appendRow(): boolean;
411
+ /**
412
+ * Inserts a new column before the specified column index.
413
+ * @param {number} column The zero-based column index to insert before.
414
+ * @returns {boolean} `true` if the column was successfully inserted.
415
+ * @example
416
+ * ```ts
417
+ * const fDocument = univerAPI.getActiveDocument();
418
+ * const table = fDocument?.findTableByText('Status');
419
+ * table?.insertColumnBefore(1); // Inserts a new column before column 1
420
+ * ```
421
+ */
422
+ insertColumnBefore(column: number): boolean;
423
+ /**
424
+ * Inserts a new column after the specified column index.
425
+ * @param {number} column The zero-based column index to insert after.
426
+ * @returns {boolean} `true` if the column was successfully inserted.
427
+ * @example
428
+ * ```ts
429
+ * const fDocument = univerAPI.getActiveDocument();
430
+ * const table = fDocument?.findTableByText('Status');
431
+ * table?.insertColumnAfter(1); // Inserts a new column after column 1
432
+ * ```
433
+ */
434
+ insertColumnAfter(column: number): boolean;
435
+ /**
436
+ * Inserts multiple columns before the specified column index.
437
+ * @param {number} column The zero-based column index to insert before.
438
+ * @param {number} count The number of columns to insert.
439
+ * @returns {boolean} `true` if the columns were successfully inserted.
440
+ * @example
441
+ * ```ts
442
+ * const fDocument = univerAPI.getActiveDocument();
443
+ * const table = fDocument?.findTableByText('Status');
444
+ * table?.insertColumnsBefore(1, 2); // Inserts 2 new columns before column 1
445
+ * ```
446
+ */
447
+ insertColumnsBefore(column: number, count: number): boolean;
448
+ /**
449
+ * Inserts multiple columns after the specified column index.
450
+ * @param {number} column The zero-based column index to insert after.
451
+ * @param {number} count The number of columns to insert.
452
+ * @returns {boolean} `true` if the columns were successfully inserted.
453
+ * @example
454
+ * ```ts
455
+ * const fDocument = univerAPI.getActiveDocument();
456
+ * const table = fDocument?.findTableByText('Status');
457
+ * table?.insertColumnsAfter(1, 2); // Inserts 2 new columns after column 1
458
+ * ```
459
+ */
460
+ insertColumnsAfter(column: number, count: number): boolean;
461
+ /**
462
+ * Appends a new column at the end of the table.
463
+ * @returns {boolean} `true` if the column was successfully appended.
464
+ * @example
465
+ * ```ts
466
+ * const fDocument = univerAPI.getActiveDocument();
467
+ * const table = fDocument?.findTableByText('Status');
468
+ * table?.appendColumn(); // Appends a new column at the end of the table
469
+ * ```
470
+ */
471
+ appendColumn(): boolean;
472
+ /**
473
+ * Deletes a single row at the specified row index.
474
+ * @param {number} row The zero-based row index to delete.
475
+ * @returns {boolean} `true` if the row was successfully deleted.
476
+ * @example
477
+ * ```ts
478
+ * const fDocument = univerAPI.getActiveDocument();
479
+ * const table = fDocument?.findTableByText('Status');
480
+ * table?.deleteRow(1); // Deletes row 1
481
+ * ```
482
+ */
483
+ deleteRow(row: number): boolean;
484
+ /**
485
+ * Deletes multiple rows starting from the specified row index.
486
+ * @param {number} startRow The zero-based starting row index to delete.
487
+ * @param {number} [count] The number of rows to delete.
488
+ * @returns {boolean} `true` if the rows were successfully deleted.
489
+ * @example
490
+ * ```ts
491
+ * const fDocument = univerAPI.getActiveDocument();
492
+ * const table = fDocument?.findTableByText('Status');
493
+ * table?.deleteRows(1, 2); // Deletes rows 1 and 2
494
+ * ```
495
+ */
496
+ deleteRows(startRow: number, count?: number): boolean;
497
+ /**
498
+ * Deletes a single column at the specified column index.
499
+ * @param {number} column The zero-based column index to delete.
500
+ * @returns {boolean} `true` if the column was successfully deleted.
501
+ * @example
502
+ * ```ts
503
+ * const fDocument = univerAPI.getActiveDocument();
504
+ * const table = fDocument?.findTableByText('Status');
505
+ * table?.deleteColumn(1); // Deletes column 1
506
+ * ```
507
+ */
508
+ deleteColumn(column: number): boolean;
509
+ /**
510
+ * Deletes multiple columns starting from the specified column index.
511
+ * @param {number} startColumn The zero-based starting column index to delete.
512
+ * @param {number} [count] The number of columns to delete.
513
+ * @returns {boolean} `true` if the columns were successfully deleted.
514
+ * @example
515
+ * ```ts
516
+ * const fDocument = univerAPI.getActiveDocument();
517
+ * const table = fDocument?.findTableByText('Status');
518
+ * table?.deleteColumns(1, 2); // Deletes columns 1 and 2
519
+ * ```
520
+ */
521
+ deleteColumns(startColumn: number, count?: number): boolean;
522
+ /**
523
+ * Deletes the entire table.
524
+ * @returns {boolean} `true` if the table was successfully deleted.
525
+ * @example
526
+ * ```ts
527
+ * const fDocument = univerAPI.getActiveDocument();
528
+ * const table = fDocument?.findTableByText('Status');
529
+ * table?.deleteTable(); // Deletes the entire table
530
+ * ```
531
+ */
532
+ deleteTable(): boolean;
533
+ /**
534
+ * Moves the entire table by the specified horizontal and vertical offsets.
535
+ * @param {number} deltaX Horizontal offset delta applied to the table's floating position
536
+ * @param {number} deltaY Vertical offset delta applied to the table's floating position
537
+ * @returns {boolean} `true` if the table was successfully moved.
538
+ * @example
539
+ * ```ts
540
+ * const fDocument = univerAPI.getActiveDocument();
541
+ * const table = fDocument?.findTableByText('Status');
542
+ * table?.moveTableBy(50, 100); // Moves the table 50 units to the right and 100 units down
543
+ * ```
544
+ */
545
+ moveTableBy(deltaX: number, deltaY: number): boolean;
546
+ /**
547
+ * Moves the entire table to the specified offset in the document's data stream.
548
+ * @param {number} offset The target offset to move the table to.
549
+ * @returns {boolean} `true` if the table was successfully moved.
550
+ * @example
551
+ * ```ts
552
+ * const fDocument = univerAPI.getActiveDocument();
553
+ * const table = fDocument?.findTableByText('Status');
554
+ * table?.moveTableToOffset(500); // Moves the table to offset 500 in the document's data stream
555
+ * ```
556
+ */
557
+ moveTableToOffset(offset: number): boolean;
558
+ /**
559
+ * Moves a single row to a target row index with the specified insert position relative to the target row.
560
+ * @param {number} row The zero-based row index to move.
561
+ * @param {number} targetRow The zero-based target row index to move to.
562
+ * @param {DocsTableRowInsertPosition} [position] The position to insert the moved row relative to the target row. Defaults to `Above`.
563
+ * @returns {boolean} `true` if the row was successfully moved.
564
+ * @example
565
+ * ```ts
566
+ * const fDocument = univerAPI.getActiveDocument();
567
+ * const table = fDocument?.findTableByText('Status');
568
+ * table?.moveRow(1, 3, univerAPI.Enum.DocsTableRowInsertPosition.Below); // Moves row 1 to below row 3
569
+ * ```
570
+ */
571
+ moveRow(row: number, targetRow: number, position?: DocsTableRowInsertPosition): boolean;
572
+ /**
573
+ * Moves multiple rows to a target row index with the specified insert position relative to the target row.
574
+ * @param {number} startRow The zero-based starting row index to move.
575
+ * @param {number} count The number of rows to move.
576
+ * @param {number} targetRow The zero-based target row index to move to.
577
+ * @param {DocsTableRowInsertPosition} [position] The position to insert the moved rows relative to the target row. Defaults to `Above`.
578
+ * @returns {boolean} `true` if the rows were successfully moved.
579
+ * @example
580
+ * ```ts
581
+ * const fDocument = univerAPI.getActiveDocument();
582
+ * const table = fDocument?.findTableByText('Status');
583
+ * table?.moveRows(1, 2, 4, univerAPI.Enum.DocsTableRowInsertPosition.Below); // Moves rows 1 and 2 to below row 4
584
+ * ```
585
+ */
586
+ moveRows(startRow: number, count: number, targetRow: number, position?: DocsTableRowInsertPosition): boolean;
587
+ /**
588
+ * Moves a single column to a target column index with the specified insert position relative to the target column.
589
+ * @param {number} column The zero-based column index to move.
590
+ * @param {number} targetColumn The zero-based target column index to move to.
591
+ * @param {DocsTableColumnInsertPosition} [position] The position to insert the moved column relative to the target column. Defaults to `Left`.
592
+ * @returns {boolean} `true` if the column was successfully moved.
593
+ * @example
594
+ * ```ts
595
+ * const fDocument = univerAPI.getActiveDocument();
596
+ * const table = fDocument?.findTableByText('Status');
597
+ * table?.moveColumn(1, 3, univerAPI.Enum.DocsTableColumnInsertPosition.Right); // Moves column 1 to right of column 3
598
+ * ```
599
+ */
600
+ moveColumn(column: number, targetColumn: number, position?: DocsTableColumnInsertPosition): boolean;
601
+ /**
602
+ * Moves multiple columns to a target column index with the specified insert position relative to the target column.
603
+ * @param {number} startColumn The zero-based starting column index to move.
604
+ * @param {number} count The number of columns to move.
605
+ * @param {number} targetColumn The zero-based target column index to move to.
606
+ * @param {DocsTableColumnInsertPosition} [position] The position to insert the moved columns relative to the target column. Defaults to `Left`.
607
+ * @returns {boolean} `true` if the columns were successfully moved.
608
+ * @example
609
+ * ```ts
610
+ * const fDocument = univerAPI.getActiveDocument();
611
+ * const table = fDocument?.findTableByText('Status');
612
+ * table?.moveColumns(1, 2, 4, univerAPI.Enum.DocsTableColumnInsertPosition.Right); // Moves columns 1 and 2 to right of column 4
613
+ * ```
614
+ */
615
+ moveColumns(startColumn: number, count: number, targetColumn: number, position?: DocsTableColumnInsertPosition): boolean;
616
+ /**
617
+ * Merges a range of cells in the table into a single cell. The content of the merged cell will be taken from the top-left cell in the range.
618
+ * @param {IDocsTableCellRange} range The range of cells to merge.
619
+ * @returns {boolean} `true` if the cells were successfully merged.
620
+ * @example
621
+ * ```ts
622
+ * const fDocument = univerAPI.getActiveDocument();
623
+ * const table = fDocument?.findTableByText('Status');
624
+ *
625
+ * // Merges the cells in the range from row 1 to 2 and column 1 to 2 into a single cell
626
+ * table?.mergeCells({
627
+ * startRow: 1,
628
+ * endRow: 2,
629
+ * startColumn: 1,
630
+ * endColumn: 2,
631
+ * });
632
+ * ```
633
+ */
634
+ mergeCells(range: IDocsTableCellRange): boolean;
635
+ /**
636
+ * Unmerges a previously merged cell back into individual cells based on the specified range.
637
+ * @param {IDocsTableCellRange} range The range of the merged cell to unmerge, which should match the original merge range.
638
+ * @returns {boolean} `true` if the cells were successfully unmerged.
639
+ * @example
640
+ * ```ts
641
+ * const fDocument = univerAPI.getActiveDocument();
642
+ * const table = fDocument?.findTableByText('Status');
643
+ *
644
+ * // Unmerges the previously merged cell in the range from row 1 to 2 and column 1 to 2 back into individual cells
645
+ * table?.unmergeCells({
646
+ * startRow: 1,
647
+ * endRow: 2,
648
+ * startColumn: 1,
649
+ * endColumn: 2,
650
+ * });
651
+ * ```
652
+ */
653
+ unmergeCells(range: IDocsTableCellRange): boolean;
654
+ /**
655
+ * Sets the text content of a specific cell in the table. If the cell is merged, the text will be set for the entire merged cell range.
656
+ * @param {number} row The zero-based row index of the cell to set text for.
657
+ * @param {number} column The zero-based column index of the cell to set text for.
658
+ * @param {text} text The text content to set in the cell.
659
+ * @returns {boolean} `true` if the cell text was successfully set.
660
+ * @example
661
+ * ```ts
662
+ * const fDocument = univerAPI.getActiveDocument();
663
+ * const table = fDocument?.findTableByText('Status');
664
+ * table?.setCellText(1, 1, 'In Progress'); // Sets the text of the cell at row 1, column 1 to 'In Progress'
665
+ * ```
666
+ */
667
+ setCellText(row: number, column: number, text: string): boolean;
668
+ /**
669
+ * Sets the background color of a range of cells in the table.
670
+ * @param {IDocsTableCellRange} range The range of cells to set the background color for.
671
+ * @param {string} color The background color to set, specified as a hex string (e.g., `#ff0000` for red).
672
+ * @returns {boolean} `true` if the cell background color was successfully set.
673
+ * @example
674
+ * ```ts
675
+ * const fDocument = univerAPI.getActiveDocument();
676
+ * const table = fDocument?.findTableByText('Status');
677
+ *
678
+ * // Sets the background color of the cells in the range from row 1 to 2 and column 1 to 2 to red
679
+ * table?.setCellBackground({
680
+ * startRow: 1,
681
+ * endRow: 2,
682
+ * startColumn: 1,
683
+ * endColumn: 2,
684
+ * }, '#ff0000');
685
+ * ```
686
+ */
687
+ setCellBackground(range: IDocsTableCellRange, color: string): boolean;
688
+ /**
689
+ * Sets the border properties for a range of cells in the table.
690
+ * @param {IDocsTableCellRange} range The range of cells to set the border for.
691
+ * @param {IDocsTableBorderOptions} options The border options, including color, width, dash style, and presets for which sides to apply the border to.
692
+ * @returns {boolean} `true` if the cell border was successfully set.
693
+ * @example
694
+ * ```ts
695
+ * const fDocument = univerAPI.getActiveDocument();
696
+ * const table = fDocument?.findTableByText('Status');
697
+ *
698
+ * // Sets a solid red border with a width of 2 for the cells in the range from row 1 to 2 and column 1 to 2
699
+ * table?.setBorder({
700
+ * startRow: 1,
701
+ * endRow: 2,
702
+ * startColumn: 1,
703
+ * endColumn: 2,
704
+ * }, {
705
+ * preset: univerAPI.Enum.DocsTableBorderPreset.All,
706
+ * color: '#ff0000',
707
+ * width: 2,
708
+ * });
709
+ *
710
+ * // Sets a dashed blue border with a width of 1 for the cells in the range from row 0 to 0 and column 0 to 2, applying only to the bottom side
711
+ * table?.setBorder({
712
+ * startRow: 0,
713
+ * endRow: 0,
714
+ * startColumn: 0,
715
+ * endColumn: 2,
716
+ * }, {
717
+ * preset: univerAPI.Enum.DocsTableBorderPreset.Bottom,
718
+ * border: {
719
+ * color: { rgb: '#0000ff' },
720
+ * width: { v: 1 },
721
+ * dashStyle: univerAPI.Enum.DashStyleType.DASHED,
722
+ * },
723
+ * });
724
+ * ```
725
+ */
726
+ setBorder(range: IDocsTableCellRange, options: IDocsTableBorderOptions): boolean;
727
+ /**
728
+ * Sets the background color for the entire table.
729
+ * @param {string} color The background color to set for the table, specified as a hex string (e.g., `#ff0000` for red).
730
+ * @returns {boolean} `true` if the table background color was successfully set.
731
+ * @example
732
+ * ```ts
733
+ * const fDocument = univerAPI.getActiveDocument();
734
+ * const table = fDocument?.findTableByText('Status');
735
+ * table?.setTableBackground('#ff0000'); // Sets the background color of the entire table to red
736
+ * ```
737
+ */
738
+ setTableBackground(color: string): boolean;
739
+ /**
740
+ * Sets the border properties for the entire table.
741
+ * @param {IDocsTableBorderOptions} border The border options, including color, width, dash style, and presets for which sides to apply the border to.
742
+ * @returns {boolean} `true` if the table border was successfully set.
743
+ * @example
744
+ * ```ts
745
+ * const fDocument = univerAPI.getActiveDocument();
746
+ * const table = fDocument?.findTableByText('Status');
747
+ *
748
+ * // Sets a solid red border with a width of 2 for the entire table
749
+ * table?.setTableBorder({
750
+ * preset: univerAPI.Enum.DocsTableBorderPreset.All,
751
+ * color: '#ff0000',
752
+ * width: 2,
753
+ * });
754
+ *
755
+ * // Sets a dashed blue border with a width of 1 for the entire table, applying only to the bottom side
756
+ * table?.setTableBorder({
757
+ * preset: univerAPI.Enum.DocsTableBorderPreset.Bottom,
758
+ * border: {
759
+ * color: { rgb: '#0000ff' },
760
+ * width: { v: 1 },
761
+ * dashStyle: univerAPI.Enum.DashStyleType.DASHED,
762
+ * },
763
+ * });
764
+ * ```
765
+ */
766
+ setTableBorder(border: IDocsTableBorderOptions): boolean;
767
+ /**
768
+ * Sets the overall style for the entire table, including background color and border properties.
769
+ * @param {IDocsTableStyle} style The table style options, including background color and border properties.
770
+ * @returns {boolean} `true` if the table style was successfully set.
771
+ * @example
772
+ * ```ts
773
+ * const fDocument = univerAPI.getActiveDocument();
774
+ * const table = fDocument?.findTableByText('Status');
775
+ *
776
+ * // Sets the background color of the entire table to light gray and applies a solid black border with a width of 1
777
+ * table?.setTableStyle({
778
+ * backgroundColor: '#f0f0f0',
779
+ * border: {
780
+ * preset: univerAPI.Enum.DocsTableBorderPreset.All,
781
+ * color: '#000000',
782
+ * width: 1,
783
+ * },
784
+ * });
785
+ * ```
786
+ */
787
+ setTableStyle(style: IDocsTableStyle): boolean;
788
+ /**
789
+ * Sets the height of a specific row in the table.
790
+ * @param {number} row The zero-based row index to set the height for.
791
+ * @param {number} height The height value to set for the row.
792
+ * @returns {boolean} `true` if the row height was successfully set.
793
+ * @example
794
+ * ```ts
795
+ * const fDocument = univerAPI.getActiveDocument();
796
+ * const table = fDocument?.findTableByText('Status');
797
+ * table?.setRowHeight(1, 30); // Sets the height of row 1 to 30 units
798
+ * ```
799
+ */
800
+ setRowHeight(row: number, height: number): boolean;
801
+ /**
802
+ * Sets the width of a specific column in the table.
803
+ * @param {number} column The zero-based column index to set the width for.
804
+ * @param {number} width The width value to set for the column.
805
+ * @returns {boolean} `true` if the column width was successfully set.
806
+ * @example
807
+ * ```ts
808
+ * const fDocument = univerAPI.getActiveDocument();
809
+ * const table = fDocument?.findTableByText('Status');
810
+ * table?.setColumnWidth(1, 100); // Sets the width of column 1 to 100 units
811
+ * ```
812
+ */
813
+ setColumnWidth(column: number, width: number): boolean;
814
+ /**
815
+ * Distributes the height of rows evenly across a specified range of rows in the table.
816
+ * @param {number} startRow The zero-based starting row index to distribute from.
817
+ * @param {number} [count] The number of rows to distribute. If not provided, it will distribute all rows starting from the `startRow` to the end of the table.
818
+ * @returns {boolean} `true` if the row heights were successfully distributed.
819
+ * @example
820
+ * ```ts
821
+ * const fDocument = univerAPI.getActiveDocument();
822
+ * const table = fDocument?.findTableByText('Status');
823
+ * table?.distributeRows(1, 3); // Distributes the height of rows 1 to 3 evenly
824
+ * ```
825
+ */
826
+ distributeRows(startRow?: number, count?: number): boolean;
827
+ /**
828
+ * Distributes the width of columns evenly across a specified range of columns in the table.
829
+ * @param {number} startColumn The zero-based starting column index to distribute from.
830
+ * @param {number} [count] The number of columns to distribute. If not provided, it will distribute all columns starting from the `startColumn` to the end of the table.
831
+ * @returns {boolean} `true` if the column widths were successfully distributed.
832
+ * @example
833
+ * ```ts
834
+ * const fDocument = univerAPI.getActiveDocument();
835
+ * const table = fDocument?.findTableByText('Status');
836
+ * table?.distributeColumns(1, 3); // Distributes the width of columns 1 to 3 evenly
837
+ * ```
838
+ */
839
+ distributeColumns(startColumn?: number, count?: number): boolean;
840
+ /**
841
+ * Gets the number of header rows in the table.
842
+ * @returns {number} The number of header rows in the table.
843
+ * @example
844
+ * ```ts
845
+ * const fDocument = univerAPI.getActiveDocument();
846
+ * const table = fDocument?.findTableByText('Status');
847
+ * const headerRowCount = table?.getHeaderRowCount();
848
+ * ```
849
+ */
850
+ getHeaderRowCount(): number;
851
+ /**
852
+ * Sets the number of header rows in the table.
853
+ * Header rows are typically styled differently and repeated on each page when the table spans multiple pages.
854
+ * @param {number} count The number of header rows to set for the table.
855
+ * @returns {boolean} `true` if the header row count was successfully set.
856
+ * @example
857
+ * ```ts
858
+ * const fDocument = univerAPI.getActiveDocument();
859
+ * const table = fDocument?.findTableByText('Status');
860
+ * table?.setHeaderRowCount(2); // Sets the first 2 rows of the table as header rows
861
+ * ```
862
+ */
863
+ setHeaderRowCount(count: number): boolean;
864
+ /**
865
+ * Pins the specified number of rows at the top of the table as header rows, which will be repeated on each page when the table spans multiple pages.
866
+ * @param {number} count The number of rows to pin as header rows.
867
+ * @returns {boolean} `true` if the header rows were successfully pinned.
868
+ * @example
869
+ * ```ts
870
+ * const fDocument = univerAPI.getActiveDocument();
871
+ * const table = fDocument?.findTableByText('Status');
872
+ * table?.pinHeaderRows(2); // Pins the first 2 rows of the table as header rows
873
+ * ```
874
+ */
875
+ pinHeaderRows(count: number): boolean;
876
+ /**
877
+ * Checks if the table has a title row.
878
+ * @returns {boolean} `true` if the table has a title row, otherwise `false`.
879
+ * @example
880
+ * ```ts
881
+ * const fDocument = univerAPI.getActiveDocument();
882
+ * const table = fDocument?.findTableByText('Status');
883
+ * const hasTitle = table?.hasTitleRow();
884
+ * ```
885
+ */
886
+ hasTitleRow(): boolean;
887
+ /**
888
+ * Inserts a title row at the top of the table.
889
+ * @returns {boolean} `true` if the title row was successfully inserted.
890
+ * @example
891
+ * ```ts
892
+ * const fDocument = univerAPI.getActiveDocument();
893
+ * const table = fDocument?.findTableByText('Status');
894
+ * table?.insertTitleRow(); // Inserts a title row at the top of the table
895
+ * ```
896
+ */
897
+ insertTitleRow(): boolean;
898
+ /**
899
+ * Sets the type of a specific column in the table.
900
+ * @param {number} column The zero-based column index to set the type for.
901
+ * @param {IDocsTableColumnTypeConfig} config The column type configuration, including the type and any additional options specific to the column type.
902
+ * @returns {boolean} `true` if the column type was successfully set.
903
+ * @example
904
+ * ```ts
905
+ * const fDocument = univerAPI.getActiveDocument();
906
+ * const table = fDocument?.findTableByText('Status');
907
+ *
908
+ * // Sets column 2 as a date column with a specific date format
909
+ * table?.setColumnType(2, {
910
+ * type: univerAPI.Enum.DocsTableColumnType.Date,
911
+ * });
912
+ * ```
913
+ */
914
+ setColumnType(column: number, config: IDocsTableColumnTypeConfig): boolean;
915
+ /**
916
+ * Sort the table by a specific column in either ascending or descending order.
917
+ * @param {number} column The zero-based column index to sort by.
918
+ * @param {DocsTableSortDirection} direction The direction to sort the column, either ascending or descending.
919
+ * @returns {boolean} `true` if the table was successfully sorted.
920
+ * @example
921
+ * ```ts
922
+ * const fDocument = univerAPI.getActiveDocument();
923
+ * const table = fDocument?.findTableByText('Status');
924
+ * table?.sortByColumn(1, univerAPI.Enum.DocsTableSortDirection.Asc); // Sorts the table by column 1 in ascending order
925
+ * ```
926
+ */
927
+ sortByColumn(column: number, direction: DocsTableSortDirection): boolean;
928
+ private _getDocumentData;
929
+ private _serializeModel;
930
+ private _mutate;
931
+ }