@univerjs/sheets 0.5.4 → 0.5.5-nightly.202501201336

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.
@@ -1,20 +1,156 @@
1
+ import { IMoveRangeMutationParams } from '../../commands/mutations/move-range.mutation';
2
+ import { IMoveColumnsMutationParams, IMoveRowsMutationParams } from '../../commands/mutations/move-rows-cols.mutation';
3
+ import { IReorderRangeMutationParams } from '../../commands/mutations/reorder-range.mutation';
4
+ import { ISetColDataMutationParams } from '../../commands/mutations/set-col-data.mutation';
5
+ import { ISetColHiddenMutationParams, ISetColVisibleMutationParams } from '../../commands/mutations/set-col-visible.mutation';
6
+ import { ISetGridlinesColorMutationParams } from '../../commands/mutations/set-gridlines-color.mutation';
7
+ import { ISetRangeValuesMutationParams } from '../../commands/mutations/set-range-values.mutation';
8
+ import { ISetRowDataMutationParams } from '../../commands/mutations/set-row-data.mutation';
9
+ import { ISetRowHiddenMutationParams, ISetRowVisibleMutationParams } from '../../commands/mutations/set-row-visible.mutation';
10
+ import { ISetWorksheetColWidthMutationParams } from '../../commands/mutations/set-worksheet-col-width.mutation';
11
+ import { ISetWorksheetDefaultStyleMutationParams } from '../../commands/mutations/set-worksheet-default-style.mutation';
12
+ import { ISetWorksheetRowAutoHeightMutationParams, ISetWorksheetRowHeightMutationParams, ISetWorksheetRowIsAutoHeightMutationParams } from '../../commands/mutations/set-worksheet-row-height.mutation';
13
+ import { IToggleGridlinesMutationParams } from '../../commands/mutations/toggle-gridlines.mutation';
14
+ import { ISetWorksheetActiveOperationParams } from '../../commands/operations/set-worksheet-active.operation';
15
+ import { IAddWorksheetMergeMutationParams, IInsertColMutationParams, IInsertRowMutationParams, IRemoveColMutationParams, IRemoveRowsMutationParams, IRemoveWorksheetMergeMutationParams, IWorksheetRangeThemeStyleMutationParams } from '../interfaces';
16
+ import { ICommandInfo, IRange } from '@univerjs/core';
1
17
  /**
2
- * Copyright 2023-present DreamNum Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
18
+ * Enum for all skeleton change command IDs
15
19
  */
20
+ export declare enum SheetSkeletonChangeType {
21
+ SET_WORKSHEET_ROW_HEIGHT = "sheet.mutation.set-worksheet-row-height",
22
+ SET_WORKSHEET_ROW_IS_AUTO_HEIGHT = "sheet.mutation.set-worksheet-row-is-auto-height",
23
+ SET_WORKSHEET_ROW_AUTO_HEIGHT = "sheet.mutation.set-worksheet-row-auto-height",
24
+ SET_WORKSHEET_COL_WIDTH = "sheet.mutation.set-worksheet-col-width",
25
+ SET_WORKSHEET_ACTIVE = "sheet.operation.set-worksheet-active",
26
+ MOVE_ROWS = "sheet.mutation.move-rows",
27
+ MOVE_COLUMNS = "sheet.mutation.move-columns",
28
+ SET_COL_HIDDEN = "sheet.mutation.set-col-hidden",
29
+ SET_COL_VISIBLE = "sheet.mutation.set-col-visible",
30
+ SET_ROW_HIDDEN = "sheet.mutation.set-row-hidden",
31
+ SET_ROW_VISIBLE = "sheet.mutation.set-row-visible",
32
+ INSERT_COL = "sheet.mutation.insert-col",
33
+ INSERT_ROW = "sheet.mutation.insert-row",
34
+ REMOVE_COL = "sheet.mutation.remove-col",
35
+ REMOVE_ROW = "sheet.mutation.remove-row",
36
+ TOGGLE_GRIDLINES = "sheet.mutation.toggle-gridlines",
37
+ SET_GRIDLINES_COLOR = "sheet.mutation.set-gridlines-color"
38
+ }
39
+ /**
40
+ * Enum for all value change command IDs
41
+ */
42
+ export declare enum SheetValueChangeType {
43
+ SET_RANGE_VALUES = "sheet.mutation.set-range-values",
44
+ MOVE_RANGE = "sheet.mutation.move-range",
45
+ REMOVE_WORKSHEET_MERGE = "sheet.mutation.remove-worksheet-merge",
46
+ ADD_WORKSHEET_MERGE = "sheet.mutation.add-worksheet-merge",
47
+ REORDER_RANGE = "sheet.mutation.reorder-range",
48
+ SET_WORKSHEET_DEFAULT_STYLE = "sheet.mutation.set-worksheet-default-style",
49
+ SET_ROW_DATA = "sheet.mutation.set-row-data",
50
+ SET_COL_DATA = "sheet.mutation.set-col-data",
51
+ SET_WORKSHEET_RANGE_THEME_STYLE = "sheet.mutation.set-worksheet-range-theme-style",
52
+ DELETE_WORKSHEET_RANGE_THEME_STYLE = "sheet.mutation.delete-worksheet-range-theme-style"
53
+ }
16
54
  /**
17
55
  * Mutations those will trigger the skeleton change.
18
56
  */
19
57
  export declare const COMMAND_LISTENER_SKELETON_CHANGE: string[];
20
58
  export declare const COMMAND_LISTENER_VALUE_CHANGE: string[];
59
+ export type CommandListenerSkeletonChange = {
60
+ id: SheetSkeletonChangeType.SET_WORKSHEET_ROW_HEIGHT;
61
+ params: ISetWorksheetRowHeightMutationParams;
62
+ } | {
63
+ id: SheetSkeletonChangeType.SET_WORKSHEET_ROW_IS_AUTO_HEIGHT;
64
+ params: ISetWorksheetRowIsAutoHeightMutationParams;
65
+ } | {
66
+ id: SheetSkeletonChangeType.SET_WORKSHEET_ROW_AUTO_HEIGHT;
67
+ params: ISetWorksheetRowAutoHeightMutationParams;
68
+ } | {
69
+ id: SheetSkeletonChangeType.SET_WORKSHEET_COL_WIDTH;
70
+ params: ISetWorksheetColWidthMutationParams;
71
+ } | {
72
+ id: SheetSkeletonChangeType.SET_WORKSHEET_ACTIVE;
73
+ params: ISetWorksheetActiveOperationParams;
74
+ } | {
75
+ id: SheetSkeletonChangeType.MOVE_ROWS;
76
+ params: IMoveRowsMutationParams;
77
+ } | {
78
+ id: SheetSkeletonChangeType.MOVE_COLUMNS;
79
+ params: IMoveColumnsMutationParams;
80
+ } | {
81
+ id: SheetSkeletonChangeType.SET_COL_HIDDEN;
82
+ params: ISetColHiddenMutationParams;
83
+ } | {
84
+ id: SheetSkeletonChangeType.SET_COL_VISIBLE;
85
+ params: ISetColVisibleMutationParams;
86
+ } | {
87
+ id: SheetSkeletonChangeType.SET_ROW_HIDDEN;
88
+ params: ISetRowHiddenMutationParams;
89
+ } | {
90
+ id: SheetSkeletonChangeType.SET_ROW_VISIBLE;
91
+ params: ISetRowVisibleMutationParams;
92
+ } | {
93
+ id: SheetSkeletonChangeType.INSERT_COL;
94
+ params: IInsertColMutationParams;
95
+ } | {
96
+ id: SheetSkeletonChangeType.INSERT_ROW;
97
+ params: IInsertRowMutationParams;
98
+ } | {
99
+ id: SheetSkeletonChangeType.REMOVE_COL;
100
+ params: IRemoveColMutationParams;
101
+ } | {
102
+ id: SheetSkeletonChangeType.REMOVE_ROW;
103
+ params: IRemoveRowsMutationParams;
104
+ } | {
105
+ id: SheetSkeletonChangeType.TOGGLE_GRIDLINES;
106
+ params: IToggleGridlinesMutationParams;
107
+ } | {
108
+ id: SheetSkeletonChangeType.SET_GRIDLINES_COLOR;
109
+ params: ISetGridlinesColorMutationParams;
110
+ };
111
+ export type CommandListenerValueChange = {
112
+ id: SheetValueChangeType.SET_RANGE_VALUES;
113
+ params: ISetRangeValuesMutationParams;
114
+ } | {
115
+ id: SheetValueChangeType.MOVE_RANGE;
116
+ params: IMoveRangeMutationParams;
117
+ } | {
118
+ id: SheetValueChangeType.REMOVE_WORKSHEET_MERGE;
119
+ params: IRemoveWorksheetMergeMutationParams;
120
+ } | {
121
+ id: SheetValueChangeType.ADD_WORKSHEET_MERGE;
122
+ params: IAddWorksheetMergeMutationParams;
123
+ } | {
124
+ id: SheetValueChangeType.REORDER_RANGE;
125
+ params: IReorderRangeMutationParams;
126
+ } | {
127
+ id: SheetValueChangeType.SET_WORKSHEET_DEFAULT_STYLE;
128
+ params: ISetWorksheetDefaultStyleMutationParams;
129
+ } | {
130
+ id: SheetValueChangeType.SET_ROW_DATA;
131
+ params: ISetRowDataMutationParams;
132
+ } | {
133
+ id: SheetValueChangeType.SET_COL_DATA;
134
+ params: ISetColDataMutationParams;
135
+ } | {
136
+ id: SheetValueChangeType.SET_WORKSHEET_RANGE_THEME_STYLE;
137
+ params: IWorksheetRangeThemeStyleMutationParams;
138
+ } | {
139
+ id: SheetValueChangeType.DELETE_WORKSHEET_RANGE_THEME_STYLE;
140
+ params: IWorksheetRangeThemeStyleMutationParams;
141
+ };
142
+ export declare function getValueChangedEffectedRange(commandInfo: ICommandInfo): {
143
+ unitId: string;
144
+ subUnitId: string;
145
+ range: IRange;
146
+ }[];
147
+ /**
148
+ * Get the affected range for skeleton change commands
149
+ * @param {ICommandInfo} commandInfo The command information
150
+ * @returns {{ unitId: string; subUnitId: string; range: IRange }[]} Array of affected ranges
151
+ */
152
+ export declare function getSkeletonChangedEffectedRange(commandInfo: ICommandInfo): {
153
+ unitId: string;
154
+ subUnitId: string;
155
+ range: IRange;
156
+ }[];
@@ -1,7 +1,7 @@
1
1
  import { ICommand } from '@univerjs/core';
2
2
  export interface IRemoveSheetCommandParams {
3
3
  unitId?: string;
4
- subUnitId?: string;
4
+ subUnitId: string;
5
5
  }
6
6
  /**
7
7
  * The command to insert new worksheet
@@ -11,5 +11,5 @@ export interface ISplitTextToColumnsCommandParams {
11
11
  export declare const SplitTextToColumnsCommand: {
12
12
  type: CommandType;
13
13
  id: string;
14
- handler: (accessor: IAccessor, params: ISplitTextToColumnsCommandParams) => Promise<boolean>;
14
+ handler: (accessor: IAccessor, params: ISplitTextToColumnsCommandParams) => boolean;
15
15
  };
@@ -8,6 +8,7 @@ export interface ISetSelectionsOperationParams {
8
8
  type?: SelectionMoveType;
9
9
  /** If should scroll to the selected range. */
10
10
  reveal?: boolean;
11
+ extra?: string;
11
12
  }
12
13
  /**
13
14
  * Set selections to SelectionModel(WorkbookSelectionModel) by selectionManagerService.
@@ -1,3 +1,3 @@
1
1
  import { IAccessor } from '@univerjs/core';
2
2
  import { SheetsSelectionsService } from '../../services/selections/selection.service';
3
- export declare function getSelectionsService(accessor: IAccessor): SheetsSelectionsService;
3
+ export declare function getSelectionsService(accessor: IAccessor, fromCurrentSelection?: boolean): SheetsSelectionsService;
@@ -13,5 +13,9 @@ export interface IUniverSheetsConfig {
13
13
  * If the row style and column style be set both, and the row style should precede the column style or not.
14
14
  */
15
15
  isRowStylePrecedeColumnStyle?: boolean;
16
+ /**
17
+ * default false, auto height works for merged cells
18
+ */
19
+ autoHeightForMergedCells?: boolean;
16
20
  }
17
21
  export declare const defaultPluginConfig: IUniverSheetsConfig;
@@ -0,0 +1,21 @@
1
+ import { SheetSkeletonChangeType, SheetValueChangeType } from '@univerjs/sheets';
2
+ export interface IFSheetsEnum {
3
+ /**
4
+ * Sheet value change command types. These commands affect the content or style of cells.
5
+ * Includes operations like setting cell values, moving ranges, merging cells, and applying styles.
6
+ */
7
+ SheetValueChangeType: typeof SheetValueChangeType;
8
+ /**
9
+ * Sheet skeleton change command types. These commands affect the structure of the worksheet.
10
+ * Includes operations like changing row/column dimensions, visibility, and grid properties.
11
+ */
12
+ SheetSkeletonChangeType: typeof SheetSkeletonChangeType;
13
+ }
14
+ export declare class FSheetsEnum implements IFSheetsEnum {
15
+ get SheetValueChangeType(): typeof SheetValueChangeType;
16
+ get SheetSkeletonChangeType(): typeof SheetSkeletonChangeType;
17
+ }
18
+ declare module '@univerjs/core' {
19
+ interface FEnum extends IFSheetsEnum {
20
+ }
21
+ }