@univerjs/sheets 0.5.2 → 0.5.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 (35) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +3 -3
  3. package/lib/es/facade.js +525 -344
  4. package/lib/es/index.js +4605 -3763
  5. package/lib/types/basics/interfaces/mutation-interface.d.ts +7 -0
  6. package/lib/types/commands/commands/__tests__/range-template-command.sepc.d.ts +16 -0
  7. package/lib/types/commands/commands/add-worksheet-merge.command.d.ts +1 -1
  8. package/lib/types/commands/commands/add-worksheet-range-theme.command.d.ts +2 -0
  9. package/lib/types/commands/commands/delete-worksheet-range-theme.command.d.ts +2 -0
  10. package/lib/types/commands/commands/insert-row-col.command.d.ts +2 -0
  11. package/lib/types/commands/commands/register-range-theme.command.d.ts +7 -0
  12. package/lib/types/commands/commands/remove-row-col.command.d.ts +12 -0
  13. package/lib/types/commands/commands/unregister-range-theme.command.d.ts +6 -0
  14. package/lib/types/commands/mutations/add-worksheet-range-theme.mutation.d.ts +9 -0
  15. package/lib/types/commands/mutations/delete-worksheet-range-theme.mutation.d.ts +9 -0
  16. package/lib/types/commands/mutations/register-range-theme.mutation.d.ts +8 -0
  17. package/lib/types/commands/mutations/unregister-range-theme-style.mutation.d.ts +6 -0
  18. package/lib/types/facade/f-event.d.ts +30 -0
  19. package/lib/types/facade/f-range.d.ts +56 -15
  20. package/lib/types/facade/f-selection.d.ts +1 -1
  21. package/lib/types/facade/f-univer.d.ts +22 -6
  22. package/lib/types/facade/f-workbook.d.ts +52 -16
  23. package/lib/types/facade/f-worksheet.d.ts +59 -59
  24. package/lib/types/facade/index.d.ts +2 -1
  25. package/lib/types/index.d.ts +15 -3
  26. package/lib/types/model/range-theme-model.d.ts +66 -0
  27. package/lib/types/model/range-theme-util.d.ts +97 -0
  28. package/lib/types/model/range-themes/build-in-theme.factory.d.ts +5 -0
  29. package/lib/types/model/range-themes/default.d.ts +2 -0
  30. package/lib/types/services/range-theme-service.d.ts +34 -0
  31. package/lib/types/services/sheet-interceptor/interceptor-const.d.ts +2 -0
  32. package/lib/types/services/sheet-interceptor/sheet-interceptor.service.d.ts +5 -3
  33. package/lib/umd/facade.js +1 -1
  34. package/lib/umd/index.js +3 -3
  35. package/package.json +8 -31
@@ -64,3 +64,10 @@ export interface IAddWorksheetMergeMutationParams {
64
64
  subUnitId: string;
65
65
  ranges: IRange[];
66
66
  }
67
+ /** Params of AddWorksheetMergeMutation */
68
+ export interface IWorksheetRangeThemeStyleMutationParams {
69
+ unitId: string;
70
+ subUnitId: string;
71
+ range: IRange;
72
+ themeName: string;
73
+ }
@@ -0,0 +1,16 @@
1
+ /**
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.
15
+ */
16
+ export {};
@@ -9,4 +9,4 @@ export declare const AddWorksheetMergeCommand: ICommand;
9
9
  export declare const AddWorksheetMergeAllCommand: ICommand;
10
10
  export declare const AddWorksheetMergeVerticalCommand: ICommand;
11
11
  export declare const AddWorksheetMergeHorizontalCommand: ICommand;
12
- export declare function addMergeCellsUtil(injector: Injector, unitId: string, subUnitId: string, ranges: IRange[], defaultMerge: boolean): Promise<void>;
12
+ export declare function addMergeCellsUtil(injector: Injector, unitId: string, subUnitId: string, ranges: IRange[], defaultMerge: boolean): void;
@@ -0,0 +1,2 @@
1
+ import { ICommand } from '@univerjs/core';
2
+ export declare const SetWorksheetRangeThemeStyleCommand: ICommand;
@@ -0,0 +1,2 @@
1
+ import { ICommand } from '@univerjs/core';
2
+ export declare const DeleteWorksheetRangeThemeStyleCommand: ICommand;
@@ -21,6 +21,7 @@ export declare const InsertRowCommandId = "sheet.command.insert-row";
21
21
  * @internal
22
22
  */
23
23
  export declare const InsertRowCommand: ICommand;
24
+ export declare const InsertRowByRangeCommand: ICommand;
24
25
  export declare const InsertRowBeforeCommand: ICommand;
25
26
  export declare const InsertRowAfterCommand: ICommand;
26
27
  export interface IInsertColCommandParams {
@@ -32,5 +33,6 @@ export interface IInsertColCommandParams {
32
33
  }
33
34
  export declare const InsertColCommandId = "sheet.command.insert-col";
34
35
  export declare const InsertColCommand: ICommand<IInsertColCommandParams>;
36
+ export declare const InsertColByRangeCommand: ICommand<IInsertColCommandParams>;
35
37
  export declare const InsertColBeforeCommand: ICommand;
36
38
  export declare const InsertColAfterCommand: ICommand;
@@ -0,0 +1,7 @@
1
+ import { ICommand } from '@univerjs/core';
2
+ import { RangeThemeStyle } from '../../model/range-theme-util';
3
+ export interface IRegisterWorksheetRangeThemeStyleCommandParams {
4
+ unitId: string;
5
+ rangeThemeStyle: RangeThemeStyle;
6
+ }
7
+ export declare const RegisterWorksheetRangeThemeStyleCommand: ICommand<IRegisterWorksheetRangeThemeStyleCommandParams>;
@@ -5,12 +5,24 @@ export interface IRemoveRowColCommandParams {
5
5
  export interface IRemoveRowColCommandInterceptParams extends IRemoveRowColCommandParams {
6
6
  ranges?: IRange[];
7
7
  }
8
+ export interface IRemoveRowByRangeCommandParams {
9
+ range: IRange;
10
+ unitId: string;
11
+ subUnitId: string;
12
+ }
13
+ export interface IRemoveColByRangeCommandParams {
14
+ range: IRange;
15
+ unitId: string;
16
+ subUnitId: string;
17
+ }
8
18
  export declare const RemoveRowCommandId = "sheet.command.remove-row";
19
+ export declare const RemoveRowByRangeCommand: ICommand<IRemoveRowByRangeCommandParams>;
9
20
  /**
10
21
  * This command would remove the selected rows. These selected rows can be non-continuous.
11
22
  */
12
23
  export declare const RemoveRowCommand: ICommand<IRemoveRowColCommandParams>;
13
24
  export declare const RemoveColCommandId = "sheet.command.remove-col";
25
+ export declare const RemoveColByRangeCommand: ICommand<IRemoveColByRangeCommandParams>;
14
26
  /**
15
27
  * This command would remove the selected columns. These selected rows can be non-continuous.
16
28
  */
@@ -0,0 +1,6 @@
1
+ import { ICommand } from '@univerjs/core';
2
+ export interface IUnregisterWorksheetRangeThemeStyleCommandParams {
3
+ unitId: string;
4
+ themeName: string;
5
+ }
6
+ export declare const UnregisterWorksheetRangeThemeStyleCommand: ICommand<IUnregisterWorksheetRangeThemeStyleCommandParams>;
@@ -0,0 +1,9 @@
1
+ import { IAccessor, IMutation } from '@univerjs/core';
2
+ import { IWorksheetRangeThemeStyleMutationParams } from '../../basics/interfaces/mutation-interface';
3
+ export declare const SetWorksheetRangeThemeStyleMutation: IMutation<IWorksheetRangeThemeStyleMutationParams>;
4
+ export declare const SetWorksheetRangeThemeStyleMutationFactory: (accessor: IAccessor, params: IWorksheetRangeThemeStyleMutationParams) => {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ range: import('@univerjs/core').IRange;
8
+ themeName: string;
9
+ };
@@ -0,0 +1,9 @@
1
+ import { IAccessor, IMutation } from '@univerjs/core';
2
+ import { IWorksheetRangeThemeStyleMutationParams } from '../../basics/interfaces/mutation-interface';
3
+ export declare const DeleteWorksheetRangeThemeStyleMutation: IMutation<IWorksheetRangeThemeStyleMutationParams>;
4
+ export declare const DeleteWorksheetRangeThemeStyleMutationFactory: (accessor: IAccessor, params: IWorksheetRangeThemeStyleMutationParams) => {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ range: import('@univerjs/core').IRange;
8
+ themeName: string;
9
+ };
@@ -0,0 +1,8 @@
1
+ import { IMutation } from '@univerjs/core';
2
+ import { IRangeThemeStyleJSON } from '../../model/range-theme-util';
3
+ export interface IRegisterWorksheetRangeThemeStyleMutationParams {
4
+ unitId: string;
5
+ themeName: string;
6
+ rangeThemeStyleJson: IRangeThemeStyleJSON;
7
+ }
8
+ export declare const RegisterWorksheetRangeThemeStyleMutation: IMutation<IRegisterWorksheetRangeThemeStyleMutationParams>;
@@ -0,0 +1,6 @@
1
+ import { IMutation } from '@univerjs/core';
2
+ export interface IUnregisterWorksheetRangeThemeStyleMutationParams {
3
+ unitId: string;
4
+ themeName: string;
5
+ }
6
+ export declare const UnregisterWorksheetRangeThemeStyleMutation: IMutation<IUnregisterWorksheetRangeThemeStyleMutationParams>;
@@ -0,0 +1,30 @@
1
+ import { IEventBase, IWorksheetData, FEventName } from '@univerjs/core';
2
+ import { FWorkbook } from './f-workbook';
3
+ import { FWorksheet } from './f-worksheet';
4
+ export interface IFSheetEventMixin {
5
+ get SheetCreated(): 'SheetCreated';
6
+ get BeforeSheetCreate(): 'BeforeSheetCreate';
7
+ }
8
+ export declare class FSheetEventName extends FEventName implements IFSheetEventMixin {
9
+ get SheetCreated(): 'SheetCreated';
10
+ get BeforeSheetCreate(): 'BeforeSheetCreate';
11
+ }
12
+ export interface IBeforeSheetCreateEventParams extends IEventBase {
13
+ workbook: FWorkbook;
14
+ index?: number;
15
+ sheet?: IWorksheetData;
16
+ }
17
+ export interface ISheetCreatedEventParams extends IEventBase {
18
+ workbook: FWorkbook;
19
+ worksheet: FWorksheet;
20
+ }
21
+ export interface ISheetEventParamConfig {
22
+ SheetCreated: ISheetCreatedEventParams;
23
+ BeforeSheetCreate: IBeforeSheetCreateEventParams;
24
+ }
25
+ declare module '@univerjs/core' {
26
+ interface FEventName extends IFSheetEventMixin {
27
+ }
28
+ interface IEventParamConfig extends ISheetEventParamConfig {
29
+ }
30
+ }
@@ -1,11 +1,11 @@
1
- import { CellValue, ICellData, IObjectMatrixPrimitiveType, IRange, IStyleData, Nullable, Workbook, Worksheet, FBase, ICommandService, Injector, WrapStrategy } from '@univerjs/core';
1
+ import { CellValue, ICellData, IObjectMatrixPrimitiveType, IRange, IStyleData, Nullable, Workbook, Worksheet, FBaseInitialable, ICommandService, Injector, WrapStrategy } from '@univerjs/core';
2
2
  import { SplitDelimiterEnum } from '@univerjs/sheets';
3
3
  import { FHorizontalAlignment, FVerticalAlignment } from './utils';
4
4
  import { FormulaDataModel } from '@univerjs/engine-formula';
5
5
  export type FontLine = 'none' | 'underline' | 'line-through';
6
6
  export type FontStyle = 'normal' | 'italic';
7
7
  export type FontWeight = 'normal' | 'bold';
8
- export declare class FRange extends FBase {
8
+ export declare class FRange extends FBaseInitialable {
9
9
  protected readonly _workbook: Workbook;
10
10
  protected readonly _worksheet: Worksheet;
11
11
  protected readonly _range: IRange;
@@ -97,46 +97,49 @@ export declare class FRange extends FBase {
97
97
  getVerticalAlignment(): string;
98
98
  /**
99
99
  * Set background color for current range.
100
+ * @param color {string}
100
101
  * @example
101
102
  * ```
102
103
  * univerAPI.getActiveWorkbook().getActiveSheet().getActiveRange().setBackgroundColor('red')
103
104
  * ```
104
- * @param color {string}
105
105
  */
106
- setBackgroundColor(color: string): Promise<boolean>;
106
+ setBackgroundColor(color: string): FRange;
107
107
  /**
108
108
  * Set background color for current range.
109
- * e.g. `univerAPI.getActiveWorkbook().getActiveSheet().getActiveRange().setBackground('red')`
109
+ * @example
110
+ * ```
111
+ * univerAPI.getActiveWorkbook().getActiveSheet().getActiveRange().setBackground('red')
112
+ * ```
110
113
  * @param color {string}
111
114
  */
112
- setBackground(color: string): Promise<boolean>;
115
+ setBackground(color: string): FRange;
113
116
  /**
114
117
  * The value can be a number, string, boolean, or standard cell format. If it begins with `=`, it is interpreted as a formula. The value is tiled to all cells in the range.
115
118
  * @param value
116
119
  */
117
- setValue(value: CellValue | ICellData): Promise<boolean>;
120
+ setValue(value: CellValue | ICellData): FRange;
118
121
  /**
119
122
  * Set the cell wrap of the given range.
120
123
  * Cells with wrap enabled (the default) resize to display their full content. Cells with wrap disabled display as much as possible in the cell without resizing or running to multiple lines.
121
124
  */
122
- setWrap(isWrapEnabled: boolean): Promise<boolean>;
125
+ setWrap(isWrapEnabled: boolean): FRange;
123
126
  /**
124
127
  * Sets the text wrapping strategy for the cells in the range.
125
128
  */
126
- setWrapStrategy(strategy: WrapStrategy): Promise<boolean>;
129
+ setWrapStrategy(strategy: WrapStrategy): FRange;
127
130
  /**
128
131
  * Set the vertical (top to bottom) alignment for the given range (top/middle/bottom).
129
132
  */
130
- setVerticalAlignment(alignment: FVerticalAlignment): Promise<boolean>;
133
+ setVerticalAlignment(alignment: FVerticalAlignment): FRange;
131
134
  /**
132
135
  * Set the horizontal (left to right) alignment for the given range (left/center/right).
133
136
  */
134
- setHorizontalAlignment(alignment: FHorizontalAlignment): Promise<boolean>;
137
+ setHorizontalAlignment(alignment: FHorizontalAlignment): FRange;
135
138
  /**
136
139
  * Sets a different value for each cell in the range. The value can be a two-dimensional array or a standard range matrix (must match the dimensions of this range), consisting of numbers, strings, Boolean values or Composed of standard cell formats. If a value begins with `=`, it is interpreted as a formula.
137
140
  * @param value
138
141
  */
139
- setValues(value: CellValue[][] | IObjectMatrixPrimitiveType<CellValue> | ICellData[][] | IObjectMatrixPrimitiveType<ICellData>): Promise<boolean>;
142
+ setValues(value: CellValue[][] | IObjectMatrixPrimitiveType<CellValue> | ICellData[][] | IObjectMatrixPrimitiveType<ICellData>): FRange;
140
143
  /**
141
144
  * Sets the font weight for the given range (normal/bold),
142
145
  * @param fontWeight The font weight, either 'normal' or 'bold'; a null value resets the font weight.
@@ -182,7 +185,7 @@ export declare class FRange extends FBase {
182
185
  *
183
186
  * @returns This range, for chaining
184
187
  */
185
- merge(defaultMerge?: boolean): Promise<FRange>;
188
+ merge(defaultMerge?: boolean): FRange;
186
189
  /**
187
190
  * Merges cells in a range horizontally.
188
191
  *
@@ -190,7 +193,7 @@ export declare class FRange extends FBase {
190
193
  *
191
194
  * @returns This range, for chaining
192
195
  */
193
- mergeAcross(defaultMerge?: boolean): Promise<FRange>;
196
+ mergeAcross(defaultMerge?: boolean): FRange;
194
197
  /**
195
198
  * Merges cells in a range vertically.
196
199
  *
@@ -198,7 +201,7 @@ export declare class FRange extends FBase {
198
201
  *
199
202
  * @returns This range, for chaining
200
203
  */
201
- mergeVertically(defaultMerge?: boolean): Promise<FRange>;
204
+ mergeVertically(defaultMerge?: boolean): FRange;
202
205
  /**
203
206
  * Returns true if cells in the current range overlap a merged cell.
204
207
  * @returns {boolean} is overlap with a merged cell
@@ -281,4 +284,42 @@ export declare class FRange extends FBase {
281
284
  * @returns {void}
282
285
  */
283
286
  splitTextToColumns(treatMultipleDelimitersAsOne?: boolean, delimiter?: SplitDelimiterEnum): void;
287
+ /**
288
+ * Set the theme style for the range.
289
+ * @param {string|undefined} themeName The name of the theme style to apply.If a undefined value is passed, the theme style will be removed if it exist.
290
+ * @example
291
+ * ```ts
292
+ * const fWorkbook = univerAPI.getActiveWorkbook();
293
+ * const fWorksheet = fWorkbook.getActiveSheet();
294
+ * const fRange = fWorksheet.getRange('A1:E20');
295
+ * fRange.useThemeStyle('default');
296
+ * ```
297
+ */
298
+ useThemeStyle(themeName: string | undefined): void;
299
+ /**
300
+ * Remove the theme style for the range.
301
+ * @param {string} themeName The name of the theme style to remove.
302
+ * @example
303
+ * ```ts
304
+ * const fWorkbook = univerAPI.getActiveWorkbook();
305
+ * const fWorksheet = fWorkbook.getActiveSheet();
306
+ * const fRange = fWorksheet.getRange('A1:E20');
307
+ * fRange.removeThemeStyle('default');
308
+ * ```
309
+ */
310
+ removeThemeStyle(themeName: string): void;
311
+ /**
312
+ * Gets the theme style applied to the range.
313
+ * @returns {string | undefined} The name of the theme style applied to the range or not exist.
314
+ * @example
315
+ * ```ts
316
+ * const fWorkbook = univerAPI.getActiveWorkbook();
317
+ * const fWorksheet = fWorkbook.getActiveSheet();
318
+ * const fRange = fWorksheet.getRange('A1:E20');
319
+ * fRange.useThemeStyle('default');
320
+ * const themeStyle = fRange.getUsedThemeStyle();
321
+ * console.log(themeStyle); // 'default'
322
+ * ```
323
+ */
324
+ getUsedThemeStyle(): string | undefined;
284
325
  }
@@ -61,7 +61,7 @@ export declare class FSelection {
61
61
  * console.log(newSelection.getActiveRange().getA1Notation()); // A1
62
62
  * ```
63
63
  */
64
- updatePrimaryCell(cell: FRange): Promise<FSelection>;
64
+ updatePrimaryCell(cell: FRange): FSelection;
65
65
  /**
66
66
  *Get the next primary cell in the specified direction. If the primary cell not exists in selections, return null.
67
67
  * @param {Direction} direction The direction to move the primary cell.The enum value is maybe one of the following: UP(0),RIGHT(1), DOWN(2), LEFT(3).
@@ -1,4 +1,4 @@
1
- import { IDisposable, IWorkbookData, FUniver } from '@univerjs/core';
1
+ import { IDisposable, Injector, IWorkbookData, FUniver } from '@univerjs/core';
2
2
  import { FDefinedNameBuilder } from './f-defined-name';
3
3
  import { FPermission } from './f-permission';
4
4
  import { FWorkbook } from './f-workbook';
@@ -8,12 +8,23 @@ export interface IFUniverSheetsMixin {
8
8
  *
9
9
  * @param {Partial<IWorkbookData>} data The snapshot of the spreadsheet.
10
10
  * @returns {FWorkbook} FWorkbook API instance.
11
+ * @example
12
+ * ```ts
13
+ * univerAPI.createUniverSheet({ id: 'Sheet1', name: 'Sheet1' });
14
+ * ```
11
15
  */
12
16
  createUniverSheet(data: Partial<IWorkbookData>): FWorkbook;
13
17
  /**
14
18
  * Get the currently focused Univer spreadsheet.
15
- *
16
19
  * @returns {FWorkbook | null} The currently focused Univer spreadsheet.
20
+ * @example
21
+ * ```ts
22
+ * univerAPI.getActiveUniverSheet();
23
+ * ```
24
+ */
25
+ getActiveUniverSheet(): FWorkbook | null;
26
+ /**
27
+ * @deprecated use `getActiveUniverSheet` as instead.
17
28
  */
18
29
  getActiveWorkbook(): FWorkbook | null;
19
30
  /**
@@ -25,23 +36,28 @@ export interface IFUniverSheetsMixin {
25
36
  getUniverSheet(id: string): FWorkbook | null;
26
37
  /**
27
38
  * Get the PermissionInstance.
28
- * @deprecated This function is deprecated and will be removed in version 0.6.0.
29
- * Please use the function with the same name on the `FWorkbook` instance instead.
30
- * @returns {FPermission} - The PermissionInstance.
39
+ * @deprecated This function is deprecated and will be removed in version 0.6.0. Please use the function with the same name on the `FWorkbook` instance instead.
31
40
  */
32
41
  getPermission(): FPermission;
33
42
  /**
34
- * Register a callback that will be triggered when a Univer Sheet is created.
43
+ * @deprecated Use `univerAPI.addEvent(univerAPI.Event.UnitCreated, () => {})`
35
44
  */
36
45
  onUniverSheetCreated(callback: (workbook: FWorkbook) => void): IDisposable;
37
46
  /**
38
47
  * Create a new defined name builder.
39
48
  * @returns {FDefinedNameBuilder} - The defined name builder.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * univerAPI.newDefinedName();
53
+ * ```
40
54
  */
41
55
  newDefinedName(): FDefinedNameBuilder;
42
56
  }
43
57
  export declare class FUniverSheetsMixin extends FUniver implements IFUniverSheetsMixin {
58
+ _initialize(injector: Injector): void;
44
59
  createUniverSheet(data: Partial<IWorkbookData>): FWorkbook;
60
+ getActiveUniverSheet(): FWorkbook | null;
45
61
  getActiveWorkbook(): FWorkbook | null;
46
62
  getUniverSheet(id: string): FWorkbook | null;
47
63
  getPermission(): FPermission;
@@ -1,11 +1,11 @@
1
- import { CommandListener, IDisposable, IRange, IWorkbookData, LocaleType, Workbook, FBase, ICommandService, ILogService, Injector, IPermissionService, IResourceLoaderService, IUniverInstanceService, LocaleService } from '@univerjs/core';
1
+ import { CommandListener, IDisposable, IRange, IWorkbookData, LocaleType, Workbook, FBaseInitialable, ICommandService, ILogService, Injector, IPermissionService, IResourceLoaderService, IUniverInstanceService, LocaleService } from '@univerjs/core';
2
2
  import { ISetDefinedNameMutationParam, IDefinedNamesService } from '@univerjs/engine-formula';
3
- import { SheetsSelectionsService } from '@univerjs/sheets';
3
+ import { RangeThemeStyle, SheetsSelectionsService } from '@univerjs/sheets';
4
4
  import { FDefinedName } from './f-defined-name';
5
5
  import { FPermission } from './f-permission';
6
6
  import { FRange } from './f-range';
7
7
  import { FWorksheet } from './f-worksheet';
8
- export declare class FWorkbook extends FBase {
8
+ export declare class FWorkbook extends FBaseInitialable {
9
9
  protected readonly _workbook: Workbook;
10
10
  protected readonly _injector: Injector;
11
11
  protected readonly _resourceLoaderService: IResourceLoaderService;
@@ -169,7 +169,7 @@ export declare class FWorkbook extends FBase {
169
169
  * activeSpreadsheet.deleteSheet(sheet);
170
170
  * ```
171
171
  */
172
- deleteSheet(sheet: FWorksheet): Promise<boolean>;
172
+ deleteSheet(sheet: FWorksheet): boolean;
173
173
  /**
174
174
  * Undo the last action.
175
175
  * @returns A promise that resolves to true if the undo was successful, false otherwise.
@@ -180,7 +180,7 @@ export declare class FWorkbook extends FBase {
180
180
  * activeSpreadsheet.undo();
181
181
  * ```
182
182
  */
183
- undo(): Promise<boolean>;
183
+ undo(): FWorkbook;
184
184
  /**
185
185
  * Redo the last undone action.
186
186
  * @returns A promise that resolves to true if the redo was successful, false otherwise.
@@ -191,7 +191,7 @@ export declare class FWorkbook extends FBase {
191
191
  * activeSpreadsheet.redo();
192
192
  * ```
193
193
  */
194
- redo(): Promise<boolean>;
194
+ redo(): FWorkbook;
195
195
  /**
196
196
  * Callback for command execution.
197
197
  * @callback onBeforeCommandExecuteCallback
@@ -265,11 +265,11 @@ export declare class FWorkbook extends FBase {
265
265
  * const sheet = univerAPI.getActiveWorkbook().deleteActiveSheet();
266
266
  * ```
267
267
  */
268
- deleteActiveSheet(): Promise<boolean>;
268
+ deleteActiveSheet(): boolean;
269
269
  /**
270
270
  * Duplicates the given worksheet.
271
271
  * @param {FWorksheet} sheet The worksheet to duplicate.
272
- * @returns {Promise<boolean>} true if the sheet was duplicated, false otherwise
272
+ * @returns {FWorksheet} The duplicated worksheet
273
273
  * @example
274
274
  * ```ts
275
275
  * // The code below duplicates the given worksheet
@@ -278,10 +278,10 @@ export declare class FWorkbook extends FBase {
278
278
  * activeSpreadsheet.duplicateSheet(activeSheet);
279
279
  * ```
280
280
  */
281
- duplicateSheet(sheet: FWorksheet): Promise<boolean>;
281
+ duplicateSheet(sheet: FWorksheet): FWorksheet;
282
282
  /**
283
283
  * Duplicates the active sheet.
284
- * @returns {Promise<boolean>} true if the sheet was duplicated, false otherwise
284
+ * @returns {FWorksheet} The duplicated worksheet
285
285
  * @example
286
286
  * ```ts
287
287
  * // The code below duplicates the active sheet
@@ -289,7 +289,7 @@ export declare class FWorkbook extends FBase {
289
289
  * activeSpreadsheet.duplicateActiveSheet();
290
290
  * ```
291
291
  */
292
- duplicateActiveSheet(): Promise<boolean>;
292
+ duplicateActiveSheet(): FWorksheet;
293
293
  /**
294
294
  * Get the number of sheets in the workbook.
295
295
  * @returns The number of sheets in the workbook
@@ -338,7 +338,7 @@ export declare class FWorkbook extends FBase {
338
338
  * Move the sheet to the specified index.
339
339
  * @param {FWorksheet} sheet The sheet to move
340
340
  * @param {number} index The index to move the sheet to
341
- * @returns {Promise<boolean>} true if the sheet was moved, false otherwise
341
+ * @returns {FWorkbook} This workbook, for chaining
342
342
  * @example
343
343
  * ```ts
344
344
  * // The code below moves the sheet to the specified index
@@ -347,11 +347,11 @@ export declare class FWorkbook extends FBase {
347
347
  * activeSpreadsheet.moveSheet(sheet, 1);
348
348
  * ```
349
349
  */
350
- moveSheet(sheet: FWorksheet, index: number): Promise<boolean>;
350
+ moveSheet(sheet: FWorksheet, index: number): FWorkbook;
351
351
  /**
352
352
  * Move the active sheet to the specified index.
353
353
  * @param {number} index The index to move the active sheet to
354
- * @returns {Promise<boolean>} true if the sheet was moved, false otherwise
354
+ * @returns {FWorkbook} This workbook, for chaining
355
355
  * @example
356
356
  * ```ts
357
357
  * // The code below moves the active sheet to the specified index
@@ -359,7 +359,7 @@ export declare class FWorkbook extends FBase {
359
359
  * activeSpreadsheet.moveActiveSheet(1);
360
360
  * ```
361
361
  */
362
- moveActiveSheet(index: number): Promise<boolean>;
362
+ moveActiveSheet(index: number): FWorkbook;
363
363
  /**
364
364
  * Get the PermissionInstance.
365
365
  *
@@ -436,8 +436,44 @@ export declare class FWorkbook extends FBase {
436
436
  * const builder = activeSpreadsheet.getDefinedName('MyDefinedName').toBuilder();
437
437
  * builder.setRef('Sheet1!A2').setName('MyDefinedName1').build();
438
438
  * activeSpreadsheet.updateDefinedNameBuilder(param);
439
- *
440
439
  * ```
441
440
  */
442
441
  updateDefinedNameBuilder(param: ISetDefinedNameMutationParam): void;
442
+ /**
443
+ * Gets the registered range themes.
444
+ * @returns {string[]} The name list of registered range themes.
445
+ * @example
446
+ * ```ts
447
+ * // The code below gets the registered range themes
448
+ * const activeSpreadsheet = univerAPI.getActiveWorkbook();
449
+ * const themes = activeSpreadsheet.getRegisteredRangeThemes();
450
+ * console.log(themes);
451
+ * ```
452
+ */
453
+ getRegisteredRangeThemes(): string[];
454
+ /**
455
+ * Register a custom range theme style.
456
+ * @example
457
+ * ```ts
458
+ * // import {RangeThemeStyle} from '@univerjs/sheets';
459
+ * const fWorkbook = univerAPI.getActiveWorkbook();
460
+ * const rangeThemeStyle = new RangeThemeStyle('MyTheme');
461
+ * rangeThemeStyle.setSecondRowStyle({
462
+ * bg: {
463
+ * rgb: 'rgb(214,231,241)',
464
+ * },
465
+ * });
466
+ * fWorkbook.registerRangeTheme(rangeThemeStyle);
467
+ * ```
468
+ */
469
+ registerRangeTheme(rangeThemeStyle: RangeThemeStyle): void;
470
+ /**
471
+ * Unregister a custom range theme style.
472
+ * @example
473
+ * ```ts
474
+ * const fWorkbook = univerAPI.getActiveWorkbook();
475
+ * fWorkbook.unregisterRangeTheme('MyTheme');
476
+ * ```
477
+ */
478
+ unregisterRangeTheme(themeName: string): void;
443
479
  }