@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs-pro/docs-table",
3
- "version": "0.25.0",
3
+ "version": "1.0.0-alpha.0",
4
4
  "private": false,
5
5
  "description": "Enhanced table model integration for Univer Docs.",
6
6
  "author": "DreamNum Co., Ltd. <developer@univer.ai>",
@@ -61,17 +61,16 @@
61
61
  "rxjs": ">=7.0.0"
62
62
  },
63
63
  "dependencies": {
64
- "@univerjs-pro/license": "0.25.0",
65
- "@univerjs/docs-ui": "0.25.0",
66
- "@univerjs/docs": "0.25.0",
67
- "@univerjs/core": "0.25.0"
64
+ "@univerjs-pro/license": "1.0.0-alpha.0",
65
+ "@univerjs/core": "1.0.0-alpha.0",
66
+ "@univerjs/docs": "1.0.0-alpha.0"
68
67
  },
69
68
  "devDependencies": {
70
69
  "rxjs": "7.8.2",
71
70
  "typescript": "^6.0.3",
72
- "vitest": "^4.1.6",
73
- "@univerjs/engine-render": "0.25.0",
74
- "@univerjs-infra/shared": "0.25.0"
71
+ "vitest": "^4.1.9",
72
+ "@univerjs-infra/shared": "1.0.0-alpha.0",
73
+ "@univerjs/engine-render": "1.0.0-alpha.0"
75
74
  },
76
75
  "scripts": {
77
76
  "test": "vitest run",
@@ -1,83 +0,0 @@
1
- import type { FDocsTable } from './f-docs-table';
2
- import type { IDocsTableBorderOptions, IDocsTableCellContentRange, IDocsTableCellStyle } from './types';
3
- /**
4
- * Facade object for a single docs table cell.
5
- * @example
6
- * ```ts
7
- * const cell = table.getCell(0, 0);
8
- * cell?.setText('Owner');
9
- * cell?.setBackgroundColor('#E8F1FF');
10
- * ```
11
- */
12
- export declare class FDocsTableCell {
13
- private readonly _table;
14
- private readonly _row;
15
- private readonly _column;
16
- constructor(_table: FDocsTable, _row: number, _column: number);
17
- /**
18
- * Returns the parent table facade.
19
- * @returns {FDocsTable} The parent table.
20
- */
21
- getTable(): FDocsTable;
22
- /**
23
- * Returns the zero-based row index.
24
- * @returns {number} The row index.
25
- */
26
- getRowIndex(): number;
27
- /**
28
- * Returns the zero-based column index.
29
- * @returns {number} The column index.
30
- */
31
- getColumnIndex(): number;
32
- /**
33
- * Returns plain text in this cell.
34
- * @returns {string} The cell text.
35
- */
36
- getText(): string;
37
- /**
38
- * Returns the editable document range inside this cell.
39
- * @returns {IDocsTableCellContentRange | null} The cell content range, or `null` if the cell does not exist.
40
- */
41
- getContentRange(): IDocsTableCellContentRange | null;
42
- /**
43
- * Returns the offset before this cell's final section break.
44
- * @returns {number | null} The insertion offset, or `null` if the cell does not exist.
45
- */
46
- getInsertOffset(): number | null;
47
- /**
48
- * Replaces the cell text.
49
- * @param {string} text The new cell text.
50
- * @returns {boolean} Whether the mutation succeeded.
51
- */
52
- setText(text: string): boolean;
53
- /**
54
- * Sets the cell background color.
55
- * @param {string} color CSS color string, for example `#E8F1FF`.
56
- * @returns {boolean} Whether the mutation succeeded.
57
- */
58
- setBackgroundColor(color: string): boolean;
59
- /**
60
- * Applies supported cell style options.
61
- * @param {IDocsTableCellStyle} style Cell style options.
62
- * @returns {boolean} Whether the mutation succeeded.
63
- */
64
- setStyle(style: IDocsTableCellStyle): boolean;
65
- /**
66
- * Applies border options to this cell.
67
- * @param {IDocsTableBorderOptions} border Border preset and style options.
68
- * @returns {boolean} Whether the mutation succeeded.
69
- */
70
- setBorder(border: IDocsTableBorderOptions): boolean;
71
- /**
72
- * Merges this cell with a rectangular span starting from this cell.
73
- * @param {number} rowSpan Number of rows to include.
74
- * @param {number} columnSpan Number of columns to include.
75
- * @returns {boolean} Whether the mutation succeeded.
76
- */
77
- mergeTo(rowSpan: number, columnSpan: number): boolean;
78
- /**
79
- * Unmerges the merged range containing this cell.
80
- * @returns {boolean} Whether the mutation succeeded.
81
- */
82
- unmerge(): boolean;
83
- }
@@ -1,130 +0,0 @@
1
- import type { ICommandService, IDocumentData, ITable } from '@univerjs/core';
2
- import type { DocsTableSortDirection } from '../common/sort';
3
- import type { IDocsTableOffsetRange } from '../common/table-range';
4
- import type { IDocsTableColumnTypeConfig, IDocsTableMetadata } from '../common/type';
5
- import type { DocsTableModel } from '../models/docs-table-model';
6
- import type { DocsTableSelectionService } from '../services/docs-table-selection.service';
7
- import type { IDocsTableBorderOptions, IDocsTableCellContentRange, IDocsTableCellStyle, IDocsTableDescription, IDocsTableInfo, IDocsTableRange, IDocsTableStyle } from './types';
8
- import { FDocsTableCell } from './f-docs-table-cell';
9
- export interface IFDocsTableContext {
10
- unitId: string;
11
- tableId: string;
12
- getDocumentData: () => IDocumentData;
13
- commandService: ICommandService;
14
- model?: DocsTableModel;
15
- selectionService?: DocsTableSelectionService;
16
- }
17
- /**
18
- * Facade object for a single enhanced docs table.
19
- *
20
- * All mutating methods execute synchronously through the Univer command service and return
21
- * `true` when the underlying document mutation succeeds.
22
- * @example
23
- * ```ts
24
- * import '@univerjs-pro/docs-table/facade';
25
- *
26
- * const doc = univerAPI.getActiveDocument();
27
- * const table = doc?.findTableByText('Status');
28
- * table?.setCellText(1, 1, 'Done');
29
- * table?.setTableBorder({ color: '#3367D6', width: 1 });
30
- * ```
31
- */
32
- export declare class FDocsTable {
33
- private readonly _context;
34
- constructor(_context: IFDocsTableContext);
35
- /**
36
- * Returns the table id.
37
- * @returns {string} The table id stored in the document snapshot.
38
- */
39
- getId(): string;
40
- /**
41
- * Returns compact table metadata for agents.
42
- * @returns {IDocsTableInfo} The id, row count, column count, metadata, and raw table source.
43
- */
44
- getInfo(): IDocsTableInfo;
45
- /**
46
- * Returns a human-readable table summary with sample rows.
47
- * @returns {IDocsTableDescription} A compact description suitable for agents or logs.
48
- */
49
- describe(): IDocsTableDescription;
50
- getRowCount(): number;
51
- getColumnCount(): number;
52
- getCell(row: number, column: number): FDocsTableCell | null;
53
- getCellText(row: number, column: number): string;
54
- getMetadata(): IDocsTableMetadata | undefined;
55
- getSource(): ITable | undefined;
56
- getRange(): IDocsTableOffsetRange | null;
57
- getTableRange(): IDocsTableRange;
58
- getCellRange(row: number, column: number): IDocsTableRange;
59
- /**
60
- * Returns the editable document range inside a table cell.
61
- * The range excludes the table cell tokens and the final section break, so block/list facades
62
- * can use it as their `startOffset`/`endOffset` target.
63
- * @param {number} row The zero-based row index.
64
- * @param {number} column The zero-based column index.
65
- * @returns {IDocsTableCellContentRange | null} The cell content range, or `null` if the cell does not exist.
66
- */
67
- getCellContentRange(row: number, column: number): IDocsTableCellContentRange | null;
68
- /**
69
- * Returns the offset before the cell's final section break.
70
- * Use this offset to insert an empty callout, quote, code block, or paragraph in the cell.
71
- * @param {number} row The zero-based row index.
72
- * @param {number} column The zero-based column index.
73
- * @returns {number | null} The insertion offset, or `null` if the cell does not exist.
74
- */
75
- getCellInsertOffset(row: number, column: number): number | null;
76
- getRowRange(row: number): IDocsTableRange;
77
- getRowsRange(startRow: number, count?: number): IDocsTableRange;
78
- getColumnRange(column: number): IDocsTableRange;
79
- getColumnsRange(startColumn: number, count?: number): IDocsTableRange;
80
- selectTable(): boolean;
81
- selectRow(row: number): boolean;
82
- selectRows(startRow: number, count?: number): boolean;
83
- selectColumn(column: number): boolean;
84
- selectColumns(startColumn: number, count?: number): boolean;
85
- selectCell(row: number, column: number): boolean;
86
- selectRange(range: IDocsTableRange, kind?: 'cell' | 'range' | 'row' | 'column' | 'table'): boolean;
87
- insertRowBefore(row: number): boolean;
88
- insertRowAfter(row: number): boolean;
89
- insertRowsBefore(row: number, count: number): boolean;
90
- insertRowsAfter(row: number, count: number): boolean;
91
- appendRow(): boolean;
92
- insertColumnBefore(column: number): boolean;
93
- insertColumnAfter(column: number): boolean;
94
- insertColumnsBefore(column: number, count: number): boolean;
95
- insertColumnsAfter(column: number, count: number): boolean;
96
- appendColumn(): boolean;
97
- deleteRow(row: number): boolean;
98
- deleteRows(startRow: number, count?: number): boolean;
99
- deleteColumn(column: number): boolean;
100
- deleteColumns(startColumn: number, count?: number): boolean;
101
- deleteTable(): boolean;
102
- moveTableBy(deltaX: number, deltaY: number): boolean;
103
- moveTableToOffset(offset: number): boolean;
104
- moveRow(row: number, targetRow: number, position?: 'before' | 'after'): boolean;
105
- moveRows(startRow: number, count: number, targetRow: number, position?: 'before' | 'after'): boolean;
106
- moveColumn(column: number, targetColumn: number, position?: 'before' | 'after'): boolean;
107
- moveColumns(startColumn: number, count: number, targetColumn: number, position?: 'before' | 'after'): boolean;
108
- mergeCells(range: IDocsTableRange): boolean;
109
- unmergeCells(range: IDocsTableRange): boolean;
110
- setCellText(row: number, column: number, text: string): boolean;
111
- setCellStyle(range: IDocsTableRange, style: IDocsTableCellStyle): boolean;
112
- setCellBackground(range: IDocsTableRange, color: string): boolean;
113
- setBorder(range: IDocsTableRange, options: IDocsTableBorderOptions): boolean;
114
- setTableBackground(color: string): boolean;
115
- setTableBorder(border: IDocsTableBorderOptions): boolean;
116
- setTableStyle(style: IDocsTableStyle): boolean;
117
- setRowHeight(row: number, height: number): boolean;
118
- setColumnWidth(column: number, width: number): boolean;
119
- distributeRows(startRow?: number, count?: number): boolean;
120
- distributeColumns(startColumn?: number, count?: number): boolean;
121
- getHeaderRowCount(): number;
122
- setHeaderRowCount(count: number): boolean;
123
- pinHeaderRows(count: number): boolean;
124
- hasTitleRow(): boolean;
125
- insertTitleRow(): boolean;
126
- setColumnType(column: number, config: IDocsTableColumnTypeConfig): boolean;
127
- sortByColumn(column: number, direction: DocsTableSortDirection): boolean;
128
- private _documentData;
129
- private _mutate;
130
- }