@univerjs-pro/docs-table 1.0.0-alpha.1 → 1.0.0-alpha.3

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 (54) hide show
  1. package/README.md +4 -2
  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/copy-selection.command.d.ts +2 -2
  9. package/lib/types/commands/delete-columns.command.d.ts +2 -1
  10. package/lib/types/commands/delete-rows.command.d.ts +2 -1
  11. package/lib/types/commands/delete-table.command.d.ts +2 -1
  12. package/lib/types/commands/distribute-columns.command.d.ts +2 -1
  13. package/lib/types/commands/distribute-rows.command.d.ts +2 -1
  14. package/lib/types/commands/insert-columns.command.d.ts +2 -1
  15. package/lib/types/commands/insert-rows.command.d.ts +2 -1
  16. package/lib/types/commands/insert-table.command.d.ts +1 -0
  17. package/lib/types/commands/insert-title-row.command.d.ts +2 -1
  18. package/lib/types/commands/merge-cells.command.d.ts +2 -2
  19. package/lib/types/commands/move-columns.command.d.ts +2 -1
  20. package/lib/types/commands/move-rows.command.d.ts +2 -1
  21. package/lib/types/commands/move-table.command.d.ts +2 -1
  22. package/lib/types/commands/paste-without-formatting.command.d.ts +2 -2
  23. package/lib/types/commands/resize-column.command.d.ts +2 -1
  24. package/lib/types/commands/resize-row.command.d.ts +4 -2
  25. package/lib/types/commands/set-column-type.command.d.ts +2 -2
  26. package/lib/types/commands/set-header-row-count.command.d.ts +2 -1
  27. package/lib/types/commands/set-table-background.command.d.ts +7 -3
  28. package/lib/types/commands/set-table-border-color.command.d.ts +4 -4
  29. package/lib/types/commands/set-table-border-style.command.d.ts +2 -2
  30. package/lib/types/commands/set-table-border-width.command.d.ts +2 -2
  31. package/lib/types/commands/set-table-border.command.d.ts +2 -2
  32. package/lib/types/commands/set-table-vertical-align.command.d.ts +7 -3
  33. package/lib/types/commands/sort-table.command.d.ts +2 -1
  34. package/lib/types/commands/unmerge-cells.command.d.ts +2 -2
  35. package/lib/types/commands/utils.d.ts +50 -4
  36. package/lib/types/common/border.d.ts +3 -1
  37. package/lib/types/common/cell-text.d.ts +8 -1
  38. package/lib/types/common/clipboard.d.ts +2 -1
  39. package/lib/types/common/document-copy.d.ts +7 -0
  40. package/lib/types/common/insert-table.d.ts +25 -4
  41. package/lib/types/common/margin.d.ts +10 -0
  42. package/lib/types/common/merge.d.ts +7 -1
  43. package/lib/types/common/sort.d.ts +5 -0
  44. package/lib/types/common/table-fixture.d.ts +0 -1
  45. package/lib/types/common/table-range.d.ts +6 -0
  46. package/lib/types/common/type.d.ts +3 -0
  47. package/lib/types/facade/f-document-table-cell.d.ts +12 -0
  48. package/lib/types/facade/f-document-table.d.ts +68 -14
  49. package/lib/types/facade/f-document.d.ts +64 -16
  50. package/lib/types/index.d.ts +17 -57
  51. package/lib/types/services/docs-table-selection.service.d.ts +1 -0
  52. package/lib/umd/facade.js +1 -1
  53. package/lib/umd/index.js +1 -1
  54. package/package.json +7 -7
@@ -1,6 +1,6 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
- import type { IDocsTableCellRange } from '../common/type';
3
- export interface IDocsTableCopySelectionCommandParams extends Partial<IDocsTableCellRange> {
2
+ import type { IDocsTableCellRange, IDocsTableSegmentOptions } from '../common/type';
3
+ export interface IDocsTableCopySelectionCommandParams extends Partial<IDocsTableCellRange>, IDocsTableSegmentOptions {
4
4
  tableId?: string;
5
5
  }
6
6
  export declare const DocsTableCopySelectionCommand: ICommand<IDocsTableCopySelectionCommandParams>;
@@ -1,5 +1,6 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
- export interface IDocsTableDeleteColumnsCommandParams {
2
+ import type { IDocsTableSegmentOptions } from '../common/type';
3
+ export interface IDocsTableDeleteColumnsCommandParams extends IDocsTableSegmentOptions {
3
4
  tableId?: string;
4
5
  startColumn?: number;
5
6
  endColumn?: number;
@@ -1,5 +1,6 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
- export interface IDocsTableDeleteRowsCommandParams {
2
+ import type { IDocsTableSegmentOptions } from '../common/type';
3
+ export interface IDocsTableDeleteRowsCommandParams extends IDocsTableSegmentOptions {
3
4
  tableId?: string;
4
5
  startRow?: number;
5
6
  endRow?: number;
@@ -1,5 +1,6 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
- export interface IDocsTableDeleteTableCommandParams {
2
+ import type { IDocsTableSegmentOptions } from '../common/type';
3
+ export interface IDocsTableDeleteTableCommandParams extends IDocsTableSegmentOptions {
3
4
  tableId?: string;
4
5
  }
5
6
  export declare const DocsTableDeleteTableCommand: ICommand<IDocsTableDeleteTableCommandParams>;
@@ -1,5 +1,6 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
- export interface IDocsTableDistributeColumnsCommandParams {
2
+ import type { IDocsTableSegmentOptions } from '../common/type';
3
+ export interface IDocsTableDistributeColumnsCommandParams extends IDocsTableSegmentOptions {
3
4
  tableId?: string;
4
5
  startColumn?: number;
5
6
  endColumn?: number;
@@ -1,5 +1,6 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
- export interface IDocsTableDistributeRowsCommandParams {
2
+ import type { IDocsTableSegmentOptions } from '../common/type';
3
+ export interface IDocsTableDistributeRowsCommandParams extends IDocsTableSegmentOptions {
3
4
  tableId?: string;
4
5
  startRow?: number;
5
6
  endRow?: number;
@@ -1,6 +1,7 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
2
  import type { DocsTableColumnInsertPosition } from '../common/actions';
3
- export interface IDocsTableInsertColumnsCommandParams {
3
+ import type { IDocsTableSegmentOptions } from '../common/type';
4
+ export interface IDocsTableInsertColumnsCommandParams extends IDocsTableSegmentOptions {
4
5
  tableId?: string;
5
6
  column?: number;
6
7
  count?: number;
@@ -1,6 +1,7 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
2
  import type { DocsTableRowInsertPosition } from '../common/actions';
3
- export interface IDocsTableInsertRowsCommandParams {
3
+ import type { IDocsTableSegmentOptions } from '../common/type';
4
+ export interface IDocsTableInsertRowsCommandParams extends IDocsTableSegmentOptions {
4
5
  tableId?: string;
5
6
  row?: number;
6
7
  count?: number;
@@ -1,6 +1,7 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
2
  import type { IDocsTableInsertOptions } from '../common/insert-table';
3
3
  export interface IDocsTableInsertTableCommandParams extends IDocsTableInsertOptions {
4
+ unitId?: string;
4
5
  rows?: number;
5
6
  columns?: number;
6
7
  }
@@ -1,5 +1,6 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
- export interface IDocsTableInsertTitleRowCommandParams {
2
+ import type { IDocsTableSegmentOptions } from '../common/type';
3
+ export interface IDocsTableInsertTitleRowCommandParams extends IDocsTableSegmentOptions {
3
4
  tableId?: string;
4
5
  }
5
6
  export declare const DocsTableInsertTitleRowCommand: ICommand<IDocsTableInsertTitleRowCommandParams>;
@@ -1,6 +1,6 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
- import type { IDocsTableCellRange } from '../common/type';
3
- export interface IDocsTableMergeCellsCommandParams extends Partial<IDocsTableCellRange> {
2
+ import type { IDocsTableCellRange, IDocsTableSegmentOptions } from '../common/type';
3
+ export interface IDocsTableMergeCellsCommandParams extends Partial<IDocsTableCellRange>, IDocsTableSegmentOptions {
4
4
  tableId?: string;
5
5
  }
6
6
  export declare const DocsTableMergeCellsCommand: ICommand<IDocsTableMergeCellsCommandParams>;
@@ -1,6 +1,7 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
2
  import type { DocsTableColumnInsertPosition } from '../common/actions';
3
- export interface IDocsTableMoveColumnsCommandParams {
3
+ import type { IDocsTableSegmentOptions } from '../common/type';
4
+ export interface IDocsTableMoveColumnsCommandParams extends IDocsTableSegmentOptions {
4
5
  tableId?: string;
5
6
  fromColumn?: number;
6
7
  toColumn: number;
@@ -1,6 +1,7 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
2
  import type { DocsTableRowInsertPosition } from '../common/actions';
3
- export interface IDocsTableMoveRowsCommandParams {
3
+ import type { IDocsTableSegmentOptions } from '../common/type';
4
+ export interface IDocsTableMoveRowsCommandParams extends IDocsTableSegmentOptions {
4
5
  tableId?: string;
5
6
  fromRow?: number;
6
7
  toRow: number;
@@ -1,5 +1,6 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
- export interface IDocsTableMoveTableCommandParams {
2
+ import type { IDocsTableSegmentOptions } from '../common/type';
3
+ export interface IDocsTableMoveTableCommandParams extends IDocsTableSegmentOptions {
3
4
  tableId?: string;
4
5
  deltaX?: number;
5
6
  deltaY?: number;
@@ -1,6 +1,6 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
- import type { IDocsTableCellRange } from '../common/type';
3
- export interface IDocsTablePasteWithoutFormattingCommandParams extends Partial<IDocsTableCellRange> {
2
+ import type { IDocsTableCellRange, IDocsTableSegmentOptions } from '../common/type';
3
+ export interface IDocsTablePasteWithoutFormattingCommandParams extends Partial<IDocsTableCellRange>, IDocsTableSegmentOptions {
4
4
  tableId?: string;
5
5
  text: string;
6
6
  }
@@ -1,5 +1,6 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
- export interface IDocsTableResizeColumnCommandParams {
2
+ import type { IDocsTableSegmentOptions } from '../common/type';
3
+ export interface IDocsTableResizeColumnCommandParams extends IDocsTableSegmentOptions {
3
4
  tableId?: string;
4
5
  column?: number;
5
6
  width: number;
@@ -1,7 +1,9 @@
1
- import type { ICommand } from '@univerjs/core';
2
- export interface IDocsTableResizeRowCommandParams {
1
+ import type { ICommand, TableRowHeightRule } from '@univerjs/core';
2
+ import type { IDocsTableSegmentOptions } from '../common/type';
3
+ export interface IDocsTableResizeRowCommandParams extends IDocsTableSegmentOptions {
3
4
  tableId?: string;
4
5
  row?: number;
5
6
  height: number;
7
+ hRule?: TableRowHeightRule;
6
8
  }
7
9
  export declare const DocsTableResizeRowCommand: ICommand<IDocsTableResizeRowCommandParams>;
@@ -1,6 +1,6 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
- import type { IDocsTableColumnTypeConfig } from '../common/type';
3
- export interface IDocsTableSetColumnTypeCommandParams {
2
+ import type { IDocsTableColumnTypeConfig, IDocsTableSegmentOptions } from '../common/type';
3
+ export interface IDocsTableSetColumnTypeCommandParams extends IDocsTableSegmentOptions {
4
4
  tableId?: string;
5
5
  column?: number;
6
6
  config: IDocsTableColumnTypeConfig;
@@ -1,5 +1,6 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
- export interface IDocsTableSetHeaderRowCountCommandParams {
2
+ import type { IDocsTableSegmentOptions } from '../common/type';
3
+ export interface IDocsTableSetHeaderRowCountCommandParams extends IDocsTableSegmentOptions {
3
4
  tableId?: string;
4
5
  headerRowCount?: number;
5
6
  row?: number;
@@ -1,10 +1,14 @@
1
- import type { ICommand } from '@univerjs/core';
2
- import type { IDocsTableCellRange } from '../common/type';
1
+ import type { ICommand, IDocumentData, JSONXActions } from '@univerjs/core';
2
+ import type { IDocsTableCellRange, IDocsTableSegmentOptions } from '../common/type';
3
3
  import { DocsTableSelectionService } from '../services/docs-table-selection.service';
4
- export interface IDocsTableSetTableBackgroundCommandParams extends Partial<IDocsTableCellRange> {
4
+ export interface IDocsTableSetTableBackgroundCommandParams extends Partial<IDocsTableCellRange>, IDocsTableSegmentOptions {
5
5
  tableId?: string;
6
6
  color?: string | null;
7
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>;
11
+ export declare function buildSetTableBackgroundMutationActions(documentData: IDocumentData, params: Partial<IDocsTableCellRange> & {
12
+ tableId: string;
13
+ value: string | null;
14
+ }): JSONXActions | null;
@@ -1,12 +1,12 @@
1
1
  import type { IAccessor, ICommand } from '@univerjs/core';
2
2
  import type { TTableBorderStylePatch } from '../common/border';
3
- import type { IDocsTableCellRange } from '../common/type';
4
- export interface IDocsTableSetTableBorderColorCommandParams extends Partial<IDocsTableCellRange> {
3
+ import type { IDocsTableCellRange, IDocsTableSegmentOptions } from '../common/type';
4
+ export interface IDocsTableSetTableBorderColorCommandParams extends Partial<IDocsTableCellRange>, IDocsTableSegmentOptions {
5
5
  tableId?: string;
6
6
  color?: string | null;
7
7
  value?: string | null;
8
8
  }
9
9
  export declare const DocsTableSetTableBorderColorCommand: ICommand<IDocsTableSetTableBorderColorCommandParams>;
10
- export declare function updateTableBorder(accessor: IAccessor, params: Partial<IDocsTableCellRange> & {
10
+ export declare function updateTableBorder(accessor: IAccessor, params: (Partial<IDocsTableCellRange> & IDocsTableSegmentOptions & {
11
11
  tableId?: string;
12
- } | undefined, border: TTableBorderStylePatch): Promise<boolean>;
12
+ }) | undefined, border: TTableBorderStylePatch): Promise<boolean>;
@@ -1,7 +1,7 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
- import type { IDocsTableCellRange } from '../common/type';
2
+ import type { IDocsTableCellRange, IDocsTableSegmentOptions } from '../common/type';
3
3
  import { DashStyleType } from '@univerjs/core';
4
- export interface IDocsTableSetTableBorderStyleCommandParams extends Partial<IDocsTableCellRange> {
4
+ export interface IDocsTableSetTableBorderStyleCommandParams extends Partial<IDocsTableCellRange>, IDocsTableSegmentOptions {
5
5
  tableId?: string;
6
6
  dashStyle?: DashStyleType | DocsTableBorderStyleValue;
7
7
  value?: DashStyleType | DocsTableBorderStyleValue;
@@ -1,6 +1,6 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
- import type { IDocsTableCellRange } from '../common/type';
3
- export interface IDocsTableSetTableBorderWidthCommandParams extends Partial<IDocsTableCellRange> {
2
+ import type { IDocsTableCellRange, IDocsTableSegmentOptions } from '../common/type';
3
+ export interface IDocsTableSetTableBorderWidthCommandParams extends Partial<IDocsTableCellRange>, IDocsTableSegmentOptions {
4
4
  tableId?: string;
5
5
  width?: number;
6
6
  value?: number;
@@ -1,7 +1,7 @@
1
1
  import type { ICommand, ITableCellBorder } from '@univerjs/core';
2
2
  import type { DocsTableBorderPreset } from '../common/border';
3
- import type { IDocsTableCellRange } from '../common/type';
4
- export interface IDocsTableSetTableBorderCommandParams extends Partial<IDocsTableCellRange> {
3
+ import type { IDocsTableCellRange, IDocsTableSegmentOptions } from '../common/type';
4
+ export interface IDocsTableSetTableBorderCommandParams extends Partial<IDocsTableCellRange>, IDocsTableSegmentOptions {
5
5
  tableId?: string;
6
6
  preset: DocsTableBorderPreset;
7
7
  border?: ITableCellBorder;
@@ -1,7 +1,11 @@
1
- import type { ICommand, VerticalAlignmentType } from '@univerjs/core';
2
- import type { IDocsTableCellRange } from '../common/type';
3
- export interface IDocsTableSetTableVerticalAlignCommandParams extends Partial<IDocsTableCellRange> {
1
+ import type { ICommand, IDocumentData, JSONXActions, VerticalAlignmentType } from '@univerjs/core';
2
+ import type { IDocsTableCellRange, IDocsTableSegmentOptions } from '../common/type';
3
+ export interface IDocsTableSetTableVerticalAlignCommandParams extends Partial<IDocsTableCellRange>, IDocsTableSegmentOptions {
4
4
  tableId?: string;
5
5
  value: VerticalAlignmentType;
6
6
  }
7
7
  export declare const DocsTableSetTableVerticalAlignCommand: ICommand<IDocsTableSetTableVerticalAlignCommandParams>;
8
+ export declare function buildSetTableVerticalAlignMutationActions(documentData: IDocumentData, params: IDocsTableCellRange & {
9
+ tableId: string;
10
+ value: VerticalAlignmentType;
11
+ }): JSONXActions | null;
@@ -1,6 +1,7 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
2
  import type { DocsTableSortDirection } from '../common/sort';
3
- export interface IDocsTableSortTableCommandParams {
3
+ import type { IDocsTableSegmentOptions } from '../common/type';
4
+ export interface IDocsTableSortTableCommandParams extends IDocsTableSegmentOptions {
4
5
  tableId?: string;
5
6
  column?: number;
6
7
  direction: DocsTableSortDirection;
@@ -1,6 +1,6 @@
1
1
  import type { ICommand } from '@univerjs/core';
2
- import type { IDocsTableCellRange } from '../common/type';
3
- export interface IDocsTableUnmergeCellsCommandParams extends Partial<IDocsTableCellRange> {
2
+ import type { IDocsTableCellRange, IDocsTableSegmentOptions } from '../common/type';
3
+ export interface IDocsTableUnmergeCellsCommandParams extends Partial<IDocsTableCellRange>, IDocsTableSegmentOptions {
4
4
  tableId?: string;
5
5
  }
6
6
  export declare const DocsTableUnmergeCellsCommand: ICommand<IDocsTableUnmergeCellsCommandParams>;
@@ -1,10 +1,56 @@
1
- import type { ICommandService, IDocumentData, JSONXActions } from '@univerjs/core';
1
+ import type { DocumentDataModel, ICommandService, IDocumentData, ITableRow, JSONXActions } from '@univerjs/core';
2
2
  import type { IRectRangeWithStyle } from '@univerjs/engine-render';
3
- import type { IDocsTableCellRange } from '../common/type';
3
+ import type { DocsTableColumnInsertPosition, DocsTableRowInsertPosition } from '../common/actions';
4
+ import type { DocsTableSortDirection } from '../common/sort';
5
+ import type { IDocsTableCellRange, IDocsTableMetadataResource } from '../common/type';
6
+ import { TableRowHeightRule } from '@univerjs/core';
4
7
  export interface IDocsTableMutationSelection extends IDocsTableCellRange {
5
8
  tableId: string;
6
9
  segmentId?: string;
7
10
  }
8
- export declare function buildReplaceDocumentTableActions(previousDocumentData: IDocumentData, nextDocumentData: IDocumentData): JSONXActions | null;
9
- export declare function executeRichTextTableMutation(commandService: ICommandService, unitId: string, previousDocumentData: IDocumentData, nextDocumentData: IDocumentData, selection?: IDocsTableMutationSelection): boolean;
11
+ export declare function getTableCommandSegmentId(params?: {
12
+ segmentId?: string;
13
+ } | null | void, selection?: {
14
+ segmentId?: string;
15
+ } | null | void): string;
16
+ export declare function getTableCommandRange(params?: Partial<IDocsTableCellRange> | null | void, selection?: Partial<IDocsTableCellRange> | null | void): IDocsTableCellRange | null;
17
+ export declare function getTableActionDocumentData(doc: DocumentDataModel, segmentId?: string): IDocumentData | null;
18
+ export declare function buildMoveFloatingTableActions(previousDocumentData: IDocumentData, nextDocumentData: IDocumentData, tableId: string): JSONXActions | null;
19
+ export declare function buildResizeTableColumnActions(previousDocumentData: IDocumentData, nextDocumentData: IDocumentData, tableId: string, column: number): JSONXActions | null;
20
+ export declare function buildResizeTableColumnActionsFromWidth(documentData: IDocumentData, tableId: string, column: number, width: number): JSONXActions | null;
21
+ export declare function buildResizeTableRowActions(previousDocumentData: IDocumentData, nextDocumentData: IDocumentData, tableId: string, row: number): JSONXActions | null;
22
+ export declare function buildMoveFloatingTableMutationActions(documentData: IDocumentData, tableId: string, deltaX: number, deltaY: number): JSONXActions | null;
23
+ export declare function buildMoveTableToOffsetMutationActions(documentData: IDocumentData, tableId: string, requestedTargetOffset: number, bodyPath?: string[]): JSONXActions | null;
24
+ export declare function buildResizeTableRowActionsFromHeight(documentData: IDocumentData, tableId: string, row: number, height: number, hRule?: TableRowHeightRule): JSONXActions | null;
25
+ export declare function buildDistributeTableRowsMutationActions(documentData: IDocumentData, tableId: string, startRow: number, endRow: number): JSONXActions | null;
26
+ export declare function buildDistributeTableColumnsMutationActions(documentData: IDocumentData, tableId: string, startColumn: number, endColumn: number): JSONXActions | null;
27
+ export declare function buildSetTableHeaderRowCountMutationActions(documentData: IDocumentData, tableId: string, requestedHeaderRowCount: number): {
28
+ actions: JSONXActions | null;
29
+ headerRowCount: number;
30
+ } | null;
31
+ export interface IDocsTableRowsMutationActionResult {
32
+ actions: JSONXActions | null;
33
+ cursorRow: number;
34
+ deleteTable?: boolean;
35
+ }
36
+ export interface IDocsTableColumnsMutationActionResult {
37
+ actions: JSONXActions | null;
38
+ cursorColumn: number;
39
+ deleteTable?: boolean;
40
+ }
41
+ export declare function buildInsertTableColumnsMutationActions(documentData: IDocumentData, tableId: string, column: number, count: number, position: DocsTableColumnInsertPosition, options?: {
42
+ bodyPath?: string[];
43
+ insertedColumnWidth?: number;
44
+ preserveTotalWidth?: boolean;
45
+ }): IDocsTableColumnsMutationActionResult | null;
46
+ export declare function buildDeleteTableColumnsMutationActions(documentData: IDocumentData, tableId: string, startColumn: number, endColumn: number, bodyPath?: string[]): IDocsTableColumnsMutationActionResult | null;
47
+ export declare function buildMoveTableRowsMutationActions(documentData: IDocumentData, tableId: string, fromRow: number, toRow: number, count: number, position: DocsTableRowInsertPosition, bodyPath?: string[]): IDocsTableRowsMutationActionResult | null;
48
+ export declare function buildMoveTableColumnsMutationActions(documentData: IDocumentData, tableId: string, fromColumn: number, toColumn: number, count: number, position: DocsTableColumnInsertPosition, bodyPath?: string[]): IDocsTableColumnsMutationActionResult | null;
49
+ export declare function buildSortTableMutationActions(documentData: IDocumentData, metadata: IDocsTableMetadataResource | undefined, tableId: string, column: number, direction: DocsTableSortDirection, bodyPath?: string[]): JSONXActions | null;
50
+ export declare function buildInsertTableRowsMutationActions(documentData: IDocumentData, tableId: string, row: number, count: number, position: DocsTableRowInsertPosition, bodyPath?: string[], configureInsertedRow?: (row: ITableRow, index: number) => void): IDocsTableRowsMutationActionResult | null;
51
+ export declare function buildInsertTableTitleRowMutationActions(documentData: IDocumentData, tableId: string, bodyPath?: string[]): IDocsTableRowsMutationActionResult | null;
52
+ export declare function buildDeleteTableRowsMutationActions(documentData: IDocumentData, tableId: string, startRow: number, endRow: number, bodyPath?: string[]): IDocsTableRowsMutationActionResult | null;
53
+ export declare function buildDeleteTableMutationActions(documentData: IDocumentData, tableId: string, bodyPath: string[]): IDocsTableRowsMutationActionResult | null;
54
+ export declare function executeRichTextTableActions(commandService: ICommandService, unitId: string, documentData: IDocumentData, actions: JSONXActions | null, selection?: IDocsTableMutationSelection, cursorOffset?: number, trigger?: string): boolean;
55
+ export declare function getTableActionBodyPath(documentData: IDocumentData, segmentId?: string): string[];
10
56
  export declare function buildTableRectMutationRanges(documentData: IDocumentData, selection: IDocsTableMutationSelection): IRectRangeWithStyle[];
@@ -1,4 +1,4 @@
1
- import type { IDocumentData, ITableCellBorder } from '@univerjs/core';
1
+ import type { IDocumentData, ITableCellBorder, JSONXActions } from '@univerjs/core';
2
2
  import type { IDocsTableCellRange } from './type';
3
3
  export declare enum DocsTableBorderPreset {
4
4
  All = "all",
@@ -35,5 +35,7 @@ export interface IUpdateTableBorderStyleActionParams extends IDocsTableCellRange
35
35
  border: TTableBorderStylePatch;
36
36
  }
37
37
  export declare function buildSetTableBorderActions(params: ISetTableBorderActionParams): ISetTableBorderActionResult;
38
+ export declare function buildSetTableBorderMutationActions(params: ISetTableBorderActionParams): JSONXActions | null;
38
39
  export declare function buildSetTableCellBackgroundActions(params: ISetTableCellBackgroundActionParams): ISetTableBorderActionResult;
39
40
  export declare function buildUpdateTableBorderStyleActions(params: IUpdateTableBorderStyleActionParams): ISetTableBorderActionResult;
41
+ export declare function buildUpdateTableBorderStyleMutationActions(params: IUpdateTableBorderStyleActionParams): JSONXActions | null;
@@ -1,4 +1,4 @@
1
- import type { IDocumentData } from '@univerjs/core';
1
+ import type { IDocumentData, JSONXActions } from '@univerjs/core';
2
2
  export interface ISetTableCellTextActionParams {
3
3
  documentData: IDocumentData;
4
4
  tableId: string;
@@ -9,4 +9,11 @@ export interface ISetTableCellTextActionParams {
9
9
  export interface ISetTableCellTextActionResult {
10
10
  nextDocumentData: IDocumentData;
11
11
  }
12
+ export interface ITableTextReplacement {
13
+ endOffset: number;
14
+ startOffset: number;
15
+ text: string;
16
+ }
17
+ export declare function buildSetTableCellTextMutationActions(params: ISetTableCellTextActionParams, bodyPath?: string[]): JSONXActions | null;
18
+ export declare function buildTableTextReplacementMutationActions(documentData: IDocumentData, replacements: ITableTextReplacement[], bodyPath?: string[]): JSONXActions | null;
12
19
  export declare function buildSetTableCellTextActions(params: ISetTableCellTextActionParams): ISetTableCellTextActionResult;
@@ -1,4 +1,4 @@
1
- import type { IDocumentData } from '@univerjs/core';
1
+ import type { IDocumentData, JSONXActions } from '@univerjs/core';
2
2
  import type { IDocsTableCellRange } from './type';
3
3
  export interface ITableClipboardParams extends IDocsTableCellRange {
4
4
  documentData: IDocumentData;
@@ -36,5 +36,6 @@ export declare function parseHtmlTablesClipboard(html: string): IParsedHtmlTable
36
36
  export declare function serializeTableSelectionAsPlainText(params: ITableClipboardParams): string;
37
37
  export declare function serializeTableSelectionAsHtml(params: ITableClipboardParams): string;
38
38
  export declare function buildPastePlainTextTableActions(params: IPastePlainTextTableParams): IPastePlainTextTableResult;
39
+ export declare function buildPastePlainTextTableMutationActions(params: IPastePlainTextTableParams, bodyPath?: string[]): JSONXActions | null;
39
40
  export declare function buildPasteHtmlTableActions(params: IPasteHtmlTableParams): IPasteHtmlTableResult;
40
41
  export declare function parseHtmlTableClipboard(html: string): IParsedHtmlTableClipboard;
@@ -0,0 +1,7 @@
1
+ import type { IDocumentData } from '@univerjs/core';
2
+ interface IEditableDocumentCopyOptions {
3
+ cloneBody?: boolean;
4
+ tableIds?: string[];
5
+ }
6
+ export declare function createEditableDocumentDataCopy(documentData: IDocumentData, options?: IEditableDocumentCopyOptions): IDocumentData;
7
+ export {};
@@ -1,10 +1,13 @@
1
- import type { IDocumentData } from '@univerjs/core';
1
+ import type { IDocumentData, ITableCellMargin, JSONXActions } from '@univerjs/core';
2
2
  import type { IDocsTableColumnTypeConfig, IDocsTableMetadataResource } from './type';
3
3
  export declare enum DocsTableInsertTablePosition {
4
4
  Selection = "selection",
5
5
  DocumentEnd = "documentEnd",
6
6
  Offset = "offset"
7
7
  }
8
+ export declare class InvalidInsertTableRangeError extends Error {
9
+ constructor();
10
+ }
8
11
  export interface IDocsTableInsertOptions {
9
12
  /**
10
13
  * Custom table id for the inserted table. When omitted by command/facade callers,
@@ -12,15 +15,22 @@ export interface IDocsTableInsertOptions {
12
15
  */
13
16
  tableId?: string;
14
17
  /**
15
- * Requested insertion position. `Offset` uses `offset`; `DocumentEnd` appends
16
- * before the trailing section break; `Selection` is reserved for selection-based insertion.
18
+ * Requested insertion position. When `offset` is provided it takes priority.
19
+ * Otherwise `DocumentEnd` appends before the trailing section break, while
20
+ * `Offset` and `Selection` are resolved from the current cursor by the command.
17
21
  */
18
22
  position?: DocsTableInsertTablePosition;
19
23
  /**
20
24
  * 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.
25
+ * The value is clamped to the current data stream bounds and is honored whenever
26
+ * it is provided.
22
27
  */
23
28
  offset?: number;
29
+ /**
30
+ * Header/footer segment id where the table should be inserted. Defaults to the
31
+ * main document body when omitted.
32
+ */
33
+ segmentId?: string;
24
34
  /**
25
35
  * Total table width. Also acts as the fallback source for column widths
26
36
  * by distributing `width / columnCount` when `columnWidths` is not provided.
@@ -36,6 +46,10 @@ export interface IDocsTableInsertOptions {
36
46
  * and rows use the `AT_LEAST` height rule.
37
47
  */
38
48
  rowHeights?: number[];
49
+ /**
50
+ * Default margin inherited by cells that do not define their own margin override.
51
+ */
52
+ cellMargin?: ITableCellMargin;
39
53
  /**
40
54
  * Whether the first row is a title row. A title row spans the first cell across
41
55
  * all columns and stores the flag in docs table metadata.
@@ -69,4 +83,11 @@ export interface IDocsTableInsertActionResult {
69
83
  nextMetadata: IDocsTableMetadataResource;
70
84
  tableId: string;
71
85
  }
86
+ export interface IDocsTableInsertMutationActionResult {
87
+ actions: JSONXActions;
88
+ cursorOffset: number;
89
+ nextMetadata: IDocsTableMetadataResource;
90
+ tableId: string;
91
+ }
72
92
  export declare function buildInsertTableActions(params: IDocsTableInsertActionParams): IDocsTableInsertActionResult;
93
+ export declare function buildInsertTableMutationActionsDirect(params: IDocsTableInsertActionParams, bodyPath?: string[]): IDocsTableInsertMutationActionResult;
@@ -0,0 +1,10 @@
1
+ import type { IDocumentData, ITableCellMargin, JSONXActions, Nullable } from '@univerjs/core';
2
+ import type { IDocsTableCellRange } from './type';
3
+ export declare const DEFAULT_DOCS_TABLE_CELL_MARGIN: ITableCellMargin;
4
+ export interface ISetTableCellMarginMutationParams extends IDocsTableCellRange {
5
+ documentData: IDocumentData;
6
+ tableId: string;
7
+ margin: Nullable<ITableCellMargin>;
8
+ }
9
+ export declare function buildSetTableCellMarginMutationActions(params: ISetTableCellMarginMutationParams): JSONXActions | null;
10
+ export declare function buildSetTableDefaultCellMarginMutationActions(documentData: IDocumentData, tableId: string, margin: Nullable<ITableCellMargin>): JSONXActions | null;
@@ -1,4 +1,4 @@
1
- import type { IDocumentData, ITable } from '@univerjs/core';
1
+ import type { IDocumentData, ITable, JSONXActions } from '@univerjs/core';
2
2
  import type { IDocsTableCellRange } from './type';
3
3
  export interface IDocsTableMergeActionParams extends IDocsTableCellRange {
4
4
  documentData: IDocumentData;
@@ -8,10 +8,16 @@ export interface IDocsTableMergeActionResult {
8
8
  nextDocumentData: IDocumentData;
9
9
  range: IDocsTableCellRange;
10
10
  }
11
+ export interface IDocsTableMergeMutationActionResult {
12
+ actions: JSONXActions | null;
13
+ range: IDocsTableCellRange;
14
+ }
11
15
  export declare function canMergeCells(documentData: IDocumentData, tableId: string, range: IDocsTableCellRange): boolean;
12
16
  export declare function canUnmergeCells(documentData: IDocumentData, tableId: string, range: IDocsTableCellRange): boolean;
13
17
  export declare function buildMergeCellsActions(params: IDocsTableMergeActionParams): IDocsTableMergeActionResult;
18
+ export declare function buildMergeCellsMutationActions(params: IDocsTableMergeActionParams): IDocsTableMergeMutationActionResult | null;
14
19
  export declare function buildUnmergeCellsActions(params: IDocsTableMergeActionParams): IDocsTableMergeActionResult;
20
+ export declare function buildUnmergeCellsMutationActions(params: IDocsTableMergeActionParams): IDocsTableMergeMutationActionResult | null;
15
21
  export declare function findMergeRange(table: ITable, row: number, column: number): IDocsTableCellRange | null;
16
22
  export declare function expandRangeByMergedCells(table: ITable, range: IDocsTableCellRange): IDocsTableCellRange;
17
23
  export declare function updateMergedCellsForInsertRows(table: ITable, insertIndex: number, count: number, ranges?: IDocsTableCellRange[]): void;
@@ -14,4 +14,9 @@ export interface ISortTableActionParams {
14
14
  export interface ISortTableActionResult {
15
15
  nextDocumentData: IDocumentData;
16
16
  }
17
+ export interface IDocsTableSortPlan {
18
+ sortStartRow: number;
19
+ sortedRowIndexes: number[];
20
+ }
17
21
  export declare function buildSortTableActions(params: ISortTableActionParams): ISortTableActionResult;
22
+ export declare function buildTableSortPlan(params: ISortTableActionParams): IDocsTableSortPlan;
@@ -1,3 +1,2 @@
1
1
  import type { IDocumentData } from '@univerjs/core';
2
- export declare function createThreeByThreeTableDocument(): IDocumentData;
3
2
  export declare function createThreeByThreeTableDocumentWithValues(values?: string[][]): IDocumentData;
@@ -2,12 +2,16 @@ import type { IDocumentData, ITable } from '@univerjs/core';
2
2
  export interface IDocsTableCellOffsetRange {
3
3
  row: number;
4
4
  column: number;
5
+ /** Inclusive offset of `TABLE_CELL_START`. */
5
6
  startOffset: number;
7
+ /** Inclusive offset of the matching `TABLE_CELL_END`. */
6
8
  endOffset: number;
7
9
  }
8
10
  export interface IDocsTableRowOffsetRange {
9
11
  row: number;
12
+ /** Inclusive offset of `TABLE_ROW_START`. */
10
13
  startOffset: number;
14
+ /** Inclusive offset of the matching `TABLE_ROW_END`. */
11
15
  endOffset: number;
12
16
  cells: IDocsTableCellOffsetRange[];
13
17
  }
@@ -19,7 +23,9 @@ export interface IDocsTableColumnOffsetRange {
19
23
  }
20
24
  export interface IDocsTableOffsetRange {
21
25
  tableId: string;
26
+ /** Inclusive offset of `TABLE_START`. */
22
27
  startOffset: number;
28
+ /** Exclusive offset immediately after `TABLE_END`. */
23
29
  endOffset: number;
24
30
  rowCount: number;
25
31
  columnCount: number;
@@ -42,6 +42,9 @@ export interface IDocsTableCellRange {
42
42
  startColumn: number;
43
43
  endColumn: number;
44
44
  }
45
+ export interface IDocsTableSegmentOptions {
46
+ segmentId?: string;
47
+ }
45
48
  export interface IDocsTableSelection extends IDocsTableCellRange {
46
49
  kind: DocsTableSelectionKind;
47
50
  unitId: string;
@@ -1,3 +1,4 @@
1
+ import type { ITableCellMargin } from '@univerjs/core';
1
2
  import type { FDocumentTable } from './f-document-table';
2
3
  import type { IDocsTableBorderOptions, IDocsTableCellContentRange } from './types';
3
4
  /**
@@ -88,6 +89,17 @@ export declare class FDocumentTableCell {
88
89
  * ```
89
90
  */
90
91
  getInsertOffset(): number | null;
92
+ /**
93
+ * Returns the effective margin used to lay out this cell.
94
+ * Cell overrides take precedence over the table default and the built-in fallback.
95
+ */
96
+ getMargin(): ITableCellMargin | null;
97
+ /** Returns this cell's explicit margin override, or `null` when it inherits. */
98
+ getMarginOverride(): ITableCellMargin | null;
99
+ /** Sets this cell's explicit margin override. */
100
+ setMargin(margin: ITableCellMargin): boolean;
101
+ /** Removes this cell's explicit margin override so it inherits from the table. */
102
+ clearMarginOverride(): boolean;
91
103
  /**
92
104
  * Replaces the cell text.
93
105
  * @param {string} text The new cell text.