@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.
- package/README.md +23 -61
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/facade.js +1 -1
- package/lib/index.js +1 -1
- package/lib/types/commands/insert-columns.command.d.ts +2 -2
- package/lib/types/commands/insert-rows.command.d.ts +2 -2
- package/lib/types/commands/move-columns.command.d.ts +2 -1
- package/lib/types/commands/move-rows.command.d.ts +2 -1
- package/lib/types/commands/set-table-background.command.d.ts +2 -2
- package/lib/types/commands/set-table-border-color.command.d.ts +5 -4
- package/lib/types/commands/set-table-vertical-align.command.d.ts +7 -0
- package/lib/types/common/actions.d.ts +22 -5
- package/lib/types/common/border.d.ts +17 -3
- package/lib/types/common/insert-table.d.ts +46 -1
- package/lib/types/common/layout.d.ts +18 -0
- package/lib/types/common/sort.d.ts +4 -1
- package/lib/types/common/type.d.ts +22 -2
- package/lib/types/facade/f-document-table-cell.d.ts +162 -0
- package/lib/types/facade/f-document-table.d.ts +931 -0
- package/lib/types/facade/f-document.d.ts +95 -36
- package/lib/types/facade/f-enum.d.ts +114 -0
- package/lib/types/facade/index.d.ts +4 -4
- package/lib/types/facade/types.d.ts +1 -7
- package/lib/types/index.d.ts +23 -17
- package/lib/types/plugin.d.ts +1 -1
- package/lib/types/services/docs-table-selection.service.d.ts +5 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +7 -8
- package/lib/types/facade/f-docs-table-cell.d.ts +0 -83
- package/lib/types/facade/f-docs-table.d.ts +0 -130
- /package/lib/types/{controllers/config.schema.d.ts → config/config.d.ts} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ICommand } from '@univerjs/core';
|
|
2
|
-
import type {
|
|
2
|
+
import type { DocsTableColumnInsertPosition } from '../common/actions';
|
|
3
3
|
export interface IDocsTableInsertColumnsCommandParams {
|
|
4
4
|
tableId?: string;
|
|
5
5
|
column?: number;
|
|
6
6
|
count?: number;
|
|
7
|
-
position:
|
|
7
|
+
position: DocsTableColumnInsertPosition;
|
|
8
8
|
}
|
|
9
9
|
export declare const DocsTableInsertColumnsCommand: ICommand<IDocsTableInsertColumnsCommandParams>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ICommand } from '@univerjs/core';
|
|
2
|
-
import type {
|
|
2
|
+
import type { DocsTableRowInsertPosition } from '../common/actions';
|
|
3
3
|
export interface IDocsTableInsertRowsCommandParams {
|
|
4
4
|
tableId?: string;
|
|
5
5
|
row?: number;
|
|
6
6
|
count?: number;
|
|
7
|
-
position:
|
|
7
|
+
position: DocsTableRowInsertPosition;
|
|
8
8
|
}
|
|
9
9
|
export declare const DocsTableInsertRowsCommand: ICommand<IDocsTableInsertRowsCommandParams>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ICommand } from '@univerjs/core';
|
|
2
|
+
import type { DocsTableColumnInsertPosition } from '../common/actions';
|
|
2
3
|
export interface IDocsTableMoveColumnsCommandParams {
|
|
3
4
|
tableId?: string;
|
|
4
5
|
fromColumn?: number;
|
|
5
6
|
toColumn: number;
|
|
6
7
|
count?: number;
|
|
7
|
-
position:
|
|
8
|
+
position: DocsTableColumnInsertPosition;
|
|
8
9
|
}
|
|
9
10
|
export declare const DocsTableMoveColumnsCommand: ICommand<IDocsTableMoveColumnsCommandParams>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ICommand } from '@univerjs/core';
|
|
2
|
+
import type { DocsTableRowInsertPosition } from '../common/actions';
|
|
2
3
|
export interface IDocsTableMoveRowsCommandParams {
|
|
3
4
|
tableId?: string;
|
|
4
5
|
fromRow?: number;
|
|
5
6
|
toRow: number;
|
|
6
7
|
count?: number;
|
|
7
|
-
position:
|
|
8
|
+
position: DocsTableRowInsertPosition;
|
|
8
9
|
}
|
|
9
10
|
export declare const DocsTableMoveRowsCommand: ICommand<IDocsTableMoveRowsCommandParams>;
|
|
@@ -3,8 +3,8 @@ import type { IDocsTableCellRange } from '../common/type';
|
|
|
3
3
|
import { DocsTableSelectionService } from '../services/docs-table-selection.service';
|
|
4
4
|
export interface IDocsTableSetTableBackgroundCommandParams extends Partial<IDocsTableCellRange> {
|
|
5
5
|
tableId?: string;
|
|
6
|
-
color?: string;
|
|
7
|
-
value?: string;
|
|
6
|
+
color?: string | null;
|
|
7
|
+
value?: string | null;
|
|
8
8
|
}
|
|
9
9
|
export declare const DocsTableSetTableBackgroundCommand: ICommand<IDocsTableSetTableBackgroundCommandParams>;
|
|
10
10
|
export declare function getStableTableStyleSelection(selectionService: DocsTableSelectionService): import("@univerjs/core").Nullable<import("..").IDocsTableSelection>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { IAccessor, ICommand
|
|
1
|
+
import type { IAccessor, ICommand } from '@univerjs/core';
|
|
2
|
+
import type { TTableBorderStylePatch } from '../common/border';
|
|
2
3
|
import type { IDocsTableCellRange } from '../common/type';
|
|
3
4
|
export interface IDocsTableSetTableBorderColorCommandParams extends Partial<IDocsTableCellRange> {
|
|
4
5
|
tableId?: string;
|
|
5
|
-
color?: string;
|
|
6
|
-
value?: string;
|
|
6
|
+
color?: string | null;
|
|
7
|
+
value?: string | null;
|
|
7
8
|
}
|
|
8
9
|
export declare const DocsTableSetTableBorderColorCommand: ICommand<IDocsTableSetTableBorderColorCommandParams>;
|
|
9
10
|
export declare function updateTableBorder(accessor: IAccessor, params: Partial<IDocsTableCellRange> & {
|
|
10
11
|
tableId?: string;
|
|
11
|
-
} | undefined, border:
|
|
12
|
+
} | undefined, border: TTableBorderStylePatch): Promise<boolean>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ICommand, VerticalAlignmentType } from '@univerjs/core';
|
|
2
|
+
import type { IDocsTableCellRange } from '../common/type';
|
|
3
|
+
export interface IDocsTableSetTableVerticalAlignCommandParams extends Partial<IDocsTableCellRange> {
|
|
4
|
+
tableId?: string;
|
|
5
|
+
value: VerticalAlignmentType;
|
|
6
|
+
}
|
|
7
|
+
export declare const DocsTableSetTableVerticalAlignCommand: ICommand<IDocsTableSetTableVerticalAlignCommandParams>;
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import type { IDocumentData } from '@univerjs/core';
|
|
2
2
|
import type { IDocsTableMetadataResource } from './type';
|
|
3
|
-
export
|
|
3
|
+
export declare enum DocsTableInsertPosition {
|
|
4
|
+
Above = "above",
|
|
5
|
+
Below = "below",
|
|
6
|
+
Left = "left",
|
|
7
|
+
Right = "right"
|
|
8
|
+
}
|
|
9
|
+
export declare const DocsTableRowInsertPosition: {
|
|
10
|
+
readonly Above: DocsTableInsertPosition.Above;
|
|
11
|
+
readonly Below: DocsTableInsertPosition.Below;
|
|
12
|
+
};
|
|
13
|
+
export declare const DocsTableColumnInsertPosition: {
|
|
14
|
+
readonly Left: DocsTableInsertPosition.Left;
|
|
15
|
+
readonly Right: DocsTableInsertPosition.Right;
|
|
16
|
+
};
|
|
17
|
+
export type DocsTableRowInsertPosition = typeof DocsTableRowInsertPosition[keyof typeof DocsTableRowInsertPosition];
|
|
18
|
+
export type DocsTableColumnInsertPosition = typeof DocsTableColumnInsertPosition[keyof typeof DocsTableColumnInsertPosition];
|
|
4
19
|
export interface IDocsTableActionCursor {
|
|
5
20
|
row: number;
|
|
6
21
|
column: number;
|
|
@@ -17,7 +32,7 @@ export interface IInsertRowsActionParams {
|
|
|
17
32
|
tableId: string;
|
|
18
33
|
row: number;
|
|
19
34
|
count: number;
|
|
20
|
-
position:
|
|
35
|
+
position: DocsTableRowInsertPosition;
|
|
21
36
|
}
|
|
22
37
|
export interface IInsertColumnsActionParams {
|
|
23
38
|
documentData: IDocumentData;
|
|
@@ -25,7 +40,9 @@ export interface IInsertColumnsActionParams {
|
|
|
25
40
|
tableId: string;
|
|
26
41
|
column: number;
|
|
27
42
|
count: number;
|
|
28
|
-
|
|
43
|
+
insertedColumnWidth?: number;
|
|
44
|
+
position: DocsTableColumnInsertPosition;
|
|
45
|
+
preserveTotalWidth?: boolean;
|
|
29
46
|
}
|
|
30
47
|
export interface IDeleteRowsActionParams {
|
|
31
48
|
documentData: IDocumentData;
|
|
@@ -53,7 +70,7 @@ export interface IMoveRowsActionParams {
|
|
|
53
70
|
fromRow: number;
|
|
54
71
|
toRow: number;
|
|
55
72
|
count?: number;
|
|
56
|
-
position:
|
|
73
|
+
position: DocsTableRowInsertPosition;
|
|
57
74
|
}
|
|
58
75
|
export interface IMoveColumnsActionParams {
|
|
59
76
|
documentData: IDocumentData;
|
|
@@ -62,7 +79,7 @@ export interface IMoveColumnsActionParams {
|
|
|
62
79
|
fromColumn: number;
|
|
63
80
|
toColumn: number;
|
|
64
81
|
count?: number;
|
|
65
|
-
position:
|
|
82
|
+
position: DocsTableColumnInsertPosition;
|
|
66
83
|
}
|
|
67
84
|
export declare function buildInsertRowsActions(params: IInsertRowsActionParams): IDocsTableActionBuildResult;
|
|
68
85
|
export declare function buildInsertColumnsActions(params: IInsertColumnsActionParams): IDocsTableActionBuildResult;
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { IDocumentData, ITableCellBorder } from '@univerjs/core';
|
|
2
2
|
import type { IDocsTableCellRange } from './type';
|
|
3
|
-
export
|
|
3
|
+
export declare enum DocsTableBorderPreset {
|
|
4
|
+
All = "all",
|
|
5
|
+
Inner = "inner",
|
|
6
|
+
Outer = "outer",
|
|
7
|
+
Top = "top",
|
|
8
|
+
Bottom = "bottom",
|
|
9
|
+
Left = "left",
|
|
10
|
+
Right = "right",
|
|
11
|
+
None = "none",
|
|
12
|
+
InnerHorizontal = "innerHorizontal",
|
|
13
|
+
InnerVertical = "innerVertical"
|
|
14
|
+
}
|
|
4
15
|
export interface ISetTableBorderActionParams extends IDocsTableCellRange {
|
|
5
16
|
documentData: IDocumentData;
|
|
6
17
|
tableId: string;
|
|
@@ -13,12 +24,15 @@ export interface ISetTableBorderActionResult {
|
|
|
13
24
|
export interface ISetTableCellBackgroundActionParams extends IDocsTableCellRange {
|
|
14
25
|
documentData: IDocumentData;
|
|
15
26
|
tableId: string;
|
|
16
|
-
color: string;
|
|
27
|
+
color: string | null;
|
|
17
28
|
}
|
|
29
|
+
export type TTableBorderStylePatch = Partial<ITableCellBorder> & {
|
|
30
|
+
clearColor?: boolean;
|
|
31
|
+
};
|
|
18
32
|
export interface IUpdateTableBorderStyleActionParams extends IDocsTableCellRange {
|
|
19
33
|
documentData: IDocumentData;
|
|
20
34
|
tableId: string;
|
|
21
|
-
border:
|
|
35
|
+
border: TTableBorderStylePatch;
|
|
22
36
|
}
|
|
23
37
|
export declare function buildSetTableBorderActions(params: ISetTableBorderActionParams): ISetTableBorderActionResult;
|
|
24
38
|
export declare function buildSetTableCellBackgroundActions(params: ISetTableCellBackgroundActionParams): ISetTableBorderActionResult;
|
|
@@ -1,15 +1,60 @@
|
|
|
1
1
|
import type { IDocumentData } from '@univerjs/core';
|
|
2
2
|
import type { IDocsTableColumnTypeConfig, IDocsTableMetadataResource } from './type';
|
|
3
|
+
export declare enum DocsTableInsertTablePosition {
|
|
4
|
+
Selection = "selection",
|
|
5
|
+
DocumentEnd = "documentEnd",
|
|
6
|
+
Offset = "offset"
|
|
7
|
+
}
|
|
3
8
|
export interface IDocsTableInsertOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Custom table id for the inserted table. When omitted by command/facade callers,
|
|
11
|
+
* a random id is generated before the table is inserted.
|
|
12
|
+
*/
|
|
4
13
|
tableId?: string;
|
|
5
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Requested insertion position. `Offset` uses `offset`; `DocumentEnd` appends
|
|
16
|
+
* before the trailing section break; `Selection` is reserved for selection-based insertion.
|
|
17
|
+
*/
|
|
18
|
+
position?: DocsTableInsertTablePosition;
|
|
19
|
+
/**
|
|
20
|
+
* Character offset in the document body data stream where the table should be inserted.
|
|
21
|
+
* The value is clamped to the current data stream bounds and is honored whenever it is provided.
|
|
22
|
+
*/
|
|
6
23
|
offset?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Total table width. Also acts as the fallback source for column widths
|
|
26
|
+
* by distributing `width / columnCount` when `columnWidths` is not provided.
|
|
27
|
+
*/
|
|
7
28
|
width?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Per-column widths for the created table. Missing entries fall back to
|
|
31
|
+
* `width / columnCount`, or `100` when `width` is not provided.
|
|
32
|
+
*/
|
|
8
33
|
columnWidths?: number[];
|
|
34
|
+
/**
|
|
35
|
+
* Per-row heights for the created table. Missing entries fall back to `30`
|
|
36
|
+
* and rows use the `AT_LEAST` height rule.
|
|
37
|
+
*/
|
|
9
38
|
rowHeights?: number[];
|
|
39
|
+
/**
|
|
40
|
+
* Whether the first row is a title row. A title row spans the first cell across
|
|
41
|
+
* all columns and stores the flag in docs table metadata.
|
|
42
|
+
*/
|
|
10
43
|
titleRow?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Number of leading rows to mark as repeating header rows. The count is also
|
|
46
|
+
* stored in docs table metadata for layout and sorting helpers.
|
|
47
|
+
*/
|
|
11
48
|
headerRowCount?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Plain text cell values to insert. The matrix determines row/column count
|
|
51
|
+
* unless explicit action `rows` or `columns` are provided; missing cells are filled with empty strings.
|
|
52
|
+
*/
|
|
12
53
|
values?: string[][];
|
|
54
|
+
/**
|
|
55
|
+
* Per-column metadata describing logical column types such as text, number,
|
|
56
|
+
* date, checkbox, or dropdown.
|
|
57
|
+
*/
|
|
13
58
|
columnTypes?: Record<number, IDocsTableColumnTypeConfig>;
|
|
14
59
|
}
|
|
15
60
|
export interface IDocsTableInsertActionParams extends IDocsTableInsertOptions {
|
|
@@ -40,10 +40,28 @@ export interface IResizeColumnActionParams {
|
|
|
40
40
|
width: number;
|
|
41
41
|
}
|
|
42
42
|
export interface IMoveTableActionParams {
|
|
43
|
+
/**
|
|
44
|
+
* Document snapshot that contains the table to move.
|
|
45
|
+
*/
|
|
43
46
|
documentData: IDocumentData;
|
|
47
|
+
/**
|
|
48
|
+
* Id of the table to move.
|
|
49
|
+
*/
|
|
44
50
|
tableId: string;
|
|
51
|
+
/**
|
|
52
|
+
* Horizontal offset delta applied to the table's floating position.
|
|
53
|
+
* Used only when `targetOffset` is not provided.
|
|
54
|
+
*/
|
|
45
55
|
deltaX?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Vertical offset delta applied to the table's floating position.
|
|
58
|
+
* Used only when `targetOffset` is not provided.
|
|
59
|
+
*/
|
|
46
60
|
deltaY?: number;
|
|
61
|
+
/**
|
|
62
|
+
* Target character offset in the document body data stream. When provided,
|
|
63
|
+
* the table block is moved in the document flow and its floating offsets are reset.
|
|
64
|
+
*/
|
|
47
65
|
targetOffset?: number;
|
|
48
66
|
}
|
|
49
67
|
export declare function buildInsertTitleRowActions(params: IInsertTitleRowActionParams): IDocsTableLayoutActionResult;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { IDocumentData } from '@univerjs/core';
|
|
2
2
|
import type { IDocsTableMetadataResource } from './type';
|
|
3
|
-
export
|
|
3
|
+
export declare enum DocsTableSortDirection {
|
|
4
|
+
Asc = "asc",
|
|
5
|
+
Desc = "desc"
|
|
6
|
+
}
|
|
4
7
|
export interface ISortTableActionParams {
|
|
5
8
|
documentData: IDocumentData;
|
|
6
9
|
metadata?: IDocsTableMetadataResource;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare enum DocsTableColumnType {
|
|
2
|
+
Text = "text",
|
|
3
|
+
Number = "number",
|
|
4
|
+
Date = "date",
|
|
5
|
+
Checkbox = "checkbox",
|
|
6
|
+
Dropdown = "dropdown"
|
|
7
|
+
}
|
|
2
8
|
export interface IDocsTableDropdownOption {
|
|
3
9
|
id: string;
|
|
4
10
|
label: string;
|
|
@@ -16,7 +22,20 @@ export interface IDocsTableMetadata {
|
|
|
16
22
|
export interface IDocsTableMetadataResource {
|
|
17
23
|
tables: Record<string, IDocsTableMetadata>;
|
|
18
24
|
}
|
|
19
|
-
export
|
|
25
|
+
export declare enum DocsTableSelectionKind {
|
|
26
|
+
None = "none",
|
|
27
|
+
Text = "text",
|
|
28
|
+
Cell = "cell",
|
|
29
|
+
Range = "range",
|
|
30
|
+
Row = "row",
|
|
31
|
+
Column = "column",
|
|
32
|
+
Table = "table"
|
|
33
|
+
}
|
|
34
|
+
export declare enum DocsTableSelectionSource {
|
|
35
|
+
Rect = "rect",
|
|
36
|
+
Structural = "structural",
|
|
37
|
+
Text = "text"
|
|
38
|
+
}
|
|
20
39
|
export interface IDocsTableCellRange {
|
|
21
40
|
startRow: number;
|
|
22
41
|
endRow: number;
|
|
@@ -30,4 +49,5 @@ export interface IDocsTableSelection extends IDocsTableCellRange {
|
|
|
30
49
|
tableId: string;
|
|
31
50
|
startOffset: number;
|
|
32
51
|
endOffset: number;
|
|
52
|
+
source?: DocsTableSelectionSource;
|
|
33
53
|
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import type { FDocumentTable } from './f-document-table';
|
|
2
|
+
import type { IDocsTableBorderOptions, IDocsTableCellContentRange } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Facade object for a single docs table cell.
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const fDocument = univerAPI.getActiveDocument();
|
|
8
|
+
* const table = fDocument?.findTableByText('Status');
|
|
9
|
+
* const cell = table.getCell(0, 0);
|
|
10
|
+
* cell?.setText('Owner');
|
|
11
|
+
* cell?.setBackgroundColor('#E8F1FF');
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare class FDocumentTableCell {
|
|
15
|
+
private readonly _table;
|
|
16
|
+
private readonly _row;
|
|
17
|
+
private readonly _column;
|
|
18
|
+
constructor(_table: FDocumentTable, _row: number, _column: number);
|
|
19
|
+
/**
|
|
20
|
+
* Returns the parent table facade.
|
|
21
|
+
* @returns {FDocumentTable} The parent table.
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const fDocument = univerAPI.getActiveDocument();
|
|
25
|
+
* const table = fDocument?.findTableByText('Status');
|
|
26
|
+
* const cell = table.getCell(0, 0);
|
|
27
|
+
* const parentTable = cell?.getTable(); // Returns the same table as `table`
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
getTable(): FDocumentTable;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the zero-based row index.
|
|
33
|
+
* @returns {number} The row index.
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const fDocument = univerAPI.getActiveDocument();
|
|
37
|
+
* const table = fDocument?.findTableByText('Status');
|
|
38
|
+
* const cell = table.getCell(2, 3);
|
|
39
|
+
* const rowIndex = cell?.getRowIndex(); // Returns 2
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
getRowIndex(): number;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the zero-based column index.
|
|
45
|
+
* @returns {number} The column index.
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const fDocument = univerAPI.getActiveDocument();
|
|
49
|
+
* const table = fDocument?.findTableByText('Status');
|
|
50
|
+
* const cell = table.getCell(2, 3);
|
|
51
|
+
* const columnIndex = cell?.getColumnIndex(); // Returns 3
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
getColumnIndex(): number;
|
|
55
|
+
/**
|
|
56
|
+
* Returns plain text in this cell.
|
|
57
|
+
* @returns {string} The cell text.
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const fDocument = univerAPI.getActiveDocument();
|
|
61
|
+
* const table = fDocument?.findTableByText('Status');
|
|
62
|
+
* const cell = table.getCell(0, 0);
|
|
63
|
+
* const text = cell?.getText(); // Returns the text content of the cell
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
getText(): string;
|
|
67
|
+
/**
|
|
68
|
+
* Returns the editable document range inside this cell.
|
|
69
|
+
* @returns {IDocsTableCellContentRange | null} The cell content range, or `null` if the cell does not exist.
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const fDocument = univerAPI.getActiveDocument();
|
|
73
|
+
* const table = fDocument?.findTableByText('Status');
|
|
74
|
+
* const cell = table.getCell(0, 0);
|
|
75
|
+
* const contentRange = cell?.getContentRange(); // Returns the content range of the cell
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
getContentRange(): IDocsTableCellContentRange | null;
|
|
79
|
+
/**
|
|
80
|
+
* Returns the offset before this cell's final section break.
|
|
81
|
+
* @returns {number | null} The insertion offset, or `null` if the cell does not exist.
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const fDocument = univerAPI.getActiveDocument();
|
|
85
|
+
* const table = fDocument?.findTableByText('Status');
|
|
86
|
+
* const cell = table.getCell(0, 0);
|
|
87
|
+
* const insertOffset = cell?.getInsertOffset(); // Returns the offset for inserting new content into the cell
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
getInsertOffset(): number | null;
|
|
91
|
+
/**
|
|
92
|
+
* Replaces the cell text.
|
|
93
|
+
* @param {string} text The new cell text.
|
|
94
|
+
* @returns {boolean} Whether the mutation succeeded.
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* const fDocument = univerAPI.getActiveDocument();
|
|
98
|
+
* const table = fDocument?.findTableByText('Status');
|
|
99
|
+
* const cell = table.getCell(0, 0);
|
|
100
|
+
* cell?.setText('Owner'); // Sets the cell text to "Owner"
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
setText(text: string): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Sets the cell background color.
|
|
106
|
+
* @param {string} color CSS color string, for example `#E8F1FF`.
|
|
107
|
+
* @returns {boolean} Whether the mutation succeeded.
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* const fDocument = univerAPI.getActiveDocument();
|
|
111
|
+
* const table = fDocument?.findTableByText('Status');
|
|
112
|
+
* const cell = table.getCell(0, 0);
|
|
113
|
+
* cell?.setBackgroundColor('#E8F1FF'); // Sets the cell background color to a light blue
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
setBackgroundColor(color: string): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Applies border options to this cell.
|
|
119
|
+
* @param {IDocsTableBorderOptions} border Border preset and style options.
|
|
120
|
+
* @returns {boolean} Whether the mutation succeeded.
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* const fDocument = univerAPI.getActiveDocument();
|
|
124
|
+
* const table = fDocument?.findTableByText('Status');
|
|
125
|
+
*
|
|
126
|
+
* // Sets a light gray border around the cell
|
|
127
|
+
* const cell = table.getCell(0, 0);
|
|
128
|
+
* cell?.setBorder({
|
|
129
|
+
* preset: univerAPI.Enum.DocsTableBorderPreset.Outer,
|
|
130
|
+
* color: '#CCCCCC',
|
|
131
|
+
* width: 1
|
|
132
|
+
* });
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
setBorder(border: IDocsTableBorderOptions): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Merges this cell with a rectangular span starting from this cell.
|
|
138
|
+
* @param {number} rowSpan Number of rows to include.
|
|
139
|
+
* @param {number} columnSpan Number of columns to include.
|
|
140
|
+
* @returns {boolean} Whether the mutation succeeded.
|
|
141
|
+
* @example
|
|
142
|
+
* ```ts
|
|
143
|
+
* const fDocument = univerAPI.getActiveDocument();
|
|
144
|
+
* const table = fDocument?.findTableByText('Status');
|
|
145
|
+
* const cell = table.getCell(0, 0);
|
|
146
|
+
* cell?.mergeTo(2, 3); // Merges a 2-row-by-3-column range starting from this cell
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
mergeTo(rowSpan: number, columnSpan: number): boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Unmerges the merged range containing this cell.
|
|
152
|
+
* @returns {boolean} Whether the mutation succeeded.
|
|
153
|
+
* @example
|
|
154
|
+
* ```ts
|
|
155
|
+
* const fDocument = univerAPI.getActiveDocument();
|
|
156
|
+
* const table = fDocument?.findTableByText('Status');
|
|
157
|
+
* const cell = table.getCell(0, 0);
|
|
158
|
+
* cell?.unmerge(); // Unmerges the merged range containing this cell
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
unmerge(): boolean;
|
|
162
|
+
}
|