@univerjs/sheets 0.5.4 → 0.5.5-experimental.20250123-34738ff
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/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +3 -3
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/facade.js +2664 -1499
- package/lib/es/index.js +9211 -8683
- package/lib/es/locale/en-US.js +2 -2
- package/lib/es/locale/fa-IR.js +2 -2
- package/lib/es/locale/fr-FR.js +2 -2
- package/lib/es/locale/ru-RU.js +2 -2
- package/lib/es/locale/vi-VN.js +2 -2
- package/lib/es/locale/zh-CN.js +2 -2
- package/lib/es/locale/zh-TW.js +2 -2
- package/lib/types/basics/const/command-listener-const.d.ts +149 -13
- package/lib/types/commands/commands/remove-sheet.command.d.ts +1 -1
- package/lib/types/commands/commands/split-text-to-columns.command.d.ts +1 -1
- package/lib/types/commands/operations/selection.operation.d.ts +1 -0
- package/lib/types/commands/utils/selection-command-util.d.ts +1 -1
- package/lib/types/controllers/config.schema.d.ts +4 -0
- package/lib/types/facade/f-defined-name.d.ts +22 -16
- package/lib/types/facade/f-enum.d.ts +24 -0
- package/lib/types/facade/f-event.d.ts +474 -24
- package/lib/types/facade/f-permission.d.ts +141 -9
- package/lib/types/facade/f-range.d.ts +416 -98
- package/lib/types/facade/f-selection.d.ts +27 -1
- package/lib/types/facade/f-sheet-hooks.d.ts +3 -0
- package/lib/types/facade/f-univer.d.ts +39 -3
- package/lib/types/facade/f-workbook.d.ts +57 -60
- package/lib/types/facade/f-worksheet.d.ts +654 -209
- package/lib/types/facade/index.d.ts +2 -0
- package/lib/types/index.d.ts +2 -1
- package/lib/types/model/range-protection-rule.model.d.ts +1 -1
- package/lib/types/model/range-theme-util.d.ts +3 -3
- package/lib/types/services/permission/permission-point/const.d.ts +117 -4
- package/lib/types/services/permission/range-permission/range-protection.ref-range.d.ts +1 -1
- package/lib/types/services/permission/range-permission/range-protection.service.d.ts +1 -1
- package/lib/types/services/permission/worksheet-permission/worksheet-permission-rule.model.d.ts +1 -1
- package/lib/types/services/selections/selection-data-model.d.ts +7 -7
- package/lib/types/services/selections/selection.service.d.ts +4 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +3 -3
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +8 -8
- package/LICENSE +0 -176
- package/lib/types/basics/__tests__/cell-type.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/cell-value.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/expand.data.d.ts +0 -2
- package/lib/types/basics/__tests__/expand.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/rangeMerge.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/row-column-value.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/utils.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/add-merge-command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/clear-selection.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/copy-worksheet.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/create-command-test-bed.d.ts +0 -7
- package/lib/types/commands/commands/__tests__/delete-range.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/insert-range.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/insert-remove-rows-cols.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/move-range-commands.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/move-rows-cols.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/range-template-command.sepc.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/remove-rows-cols.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/remove-sheet.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-border.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-col-data.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-col-width.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-frozen.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-gridlines-command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-range-values.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-row-col-visible.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-row-data.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-row-height.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-style.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-tab-color.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-default-style.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-hide.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-name.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-order.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-show.command.spec.d.ts +0 -16
- package/lib/types/commands/mutations/__tests__/create-command-test-bed.d.ts +0 -8
- package/lib/types/commands/mutations/__tests__/move-rows-cols.mutation.spec.d.ts +0 -16
- package/lib/types/commands/mutations/__tests__/remove-row-col.mutation.spec.d.ts +0 -16
- package/lib/types/controllers/__tests__/util.d.ts +0 -13
- package/lib/types/facade/__tests__/utils.spec.d.ts +0 -16
- package/lib/types/services/__tests__/move-active-cell.spec.d.ts +0 -16
- package/lib/types/services/__tests__/numfmt.service.test.d.ts +0 -16
- package/lib/types/services/__tests__/ref-range.setvice.spec.d.ts +0 -16
- package/lib/types/services/__tests__/util.d.ts +0 -14
- package/lib/types/services/ref-range/__tests__/__testing__.d.ts +0 -14
- package/lib/types/services/ref-range/__tests__/ref-range.service.spec.d.ts +0 -13
- package/lib/types/services/ref-range/__tests__/utils.spec.d.ts +0 -16
- package/lib/types/services/ref-range/__tests__/watch-range.spec.d.ts +0 -16
- package/lib/types/services/sheet-interceptor/__tests__/create-core-test-bed.d.ts +0 -13
- package/lib/types/services/sheet-interceptor/__tests__/sheet-interceptor.service.spec.d.ts +0 -16
|
@@ -3,7 +3,8 @@ import { ISelectionWithStyle } from '@univerjs/sheets';
|
|
|
3
3
|
import { FRange } from './f-range';
|
|
4
4
|
import { FWorksheet } from './f-worksheet';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Represents the active selection in the sheet.
|
|
7
|
+
*
|
|
7
8
|
* @example
|
|
8
9
|
* ```ts
|
|
9
10
|
* const fWorkbook = univerAPI.getActiveWorkbook()
|
|
@@ -12,6 +13,7 @@ import { FWorksheet } from './f-worksheet';
|
|
|
12
13
|
* const activeRange = fSelection.getActiveRange();
|
|
13
14
|
* console.log(activeRange);
|
|
14
15
|
* ```
|
|
16
|
+
* @hideconstructor
|
|
15
17
|
*/
|
|
16
18
|
export declare class FSelection {
|
|
17
19
|
private readonly _workbook;
|
|
@@ -22,16 +24,40 @@ export declare class FSelection {
|
|
|
22
24
|
/**
|
|
23
25
|
* Represents the active selection in the sheet. Which means the selection contains the active cell.
|
|
24
26
|
* @returns {FRange | null} The active selection.
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
30
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
31
|
+
* const fSelection = fWorksheet.getSelection();
|
|
32
|
+
* const activeRange = fSelection.getActiveRange();
|
|
33
|
+
* console.log(activeRange);
|
|
34
|
+
* ```
|
|
25
35
|
*/
|
|
26
36
|
getActiveRange(): FRange | null;
|
|
27
37
|
/**
|
|
28
38
|
* Represents the active selection list in the sheet.
|
|
29
39
|
* @returns {FRange[]} The active selection list.
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
43
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
44
|
+
* const fSelection = fWorksheet.getSelection();
|
|
45
|
+
* const activeRangeList = fSelection.getActiveRangeList();
|
|
46
|
+
* console.log(activeRangeList);
|
|
47
|
+
* ```
|
|
30
48
|
*/
|
|
31
49
|
getActiveRangeList(): FRange[];
|
|
32
50
|
/**
|
|
33
51
|
* Represents the current select cell in the sheet.
|
|
34
52
|
* @returns {ISelectionCell} The current select cell info.Pay attention to the type of the return value.
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
56
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
57
|
+
* const fSelection = fWorksheet.getSelection();
|
|
58
|
+
* const currentCell = fSelection.getCurrentCell();
|
|
59
|
+
* console.log(currentCell);
|
|
60
|
+
* ```
|
|
35
61
|
*/
|
|
36
62
|
getCurrentCell(): Nullable<ISelectionCell>;
|
|
37
63
|
/**
|
|
@@ -3,6 +3,9 @@ import { FWorksheet } from './f-worksheet';
|
|
|
3
3
|
import { FDefinedNameBuilder } from './f-defined-name';
|
|
4
4
|
import { FPermission } from './f-permission';
|
|
5
5
|
import { FWorkbook } from './f-workbook';
|
|
6
|
+
/**
|
|
7
|
+
* @ignore
|
|
8
|
+
*/
|
|
6
9
|
export interface IFUniverSheetsMixin {
|
|
7
10
|
/**
|
|
8
11
|
* @deprecated use `univerAPI.createWorkbook` instead.
|
|
@@ -77,9 +80,9 @@ export interface IFUniverSheetsMixin {
|
|
|
77
80
|
* @example
|
|
78
81
|
* ```ts
|
|
79
82
|
* univerAPI.addEvent(univerAPI.event.CommandExecuted, (commandInfo) => {
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
+
* const target = univerAPI.getCommandSheetTarget(commandInfo);
|
|
84
|
+
* if (!target) return;
|
|
85
|
+
* const { workbook, worksheet } = target;
|
|
83
86
|
* });
|
|
84
87
|
* ```
|
|
85
88
|
*/
|
|
@@ -87,6 +90,20 @@ export interface IFUniverSheetsMixin {
|
|
|
87
90
|
workbook: FWorkbook;
|
|
88
91
|
worksheet: FWorksheet;
|
|
89
92
|
}>;
|
|
93
|
+
/**
|
|
94
|
+
* Get the active sheet.
|
|
95
|
+
* @returns {Nullable<{ workbook: FWorkbook; worksheet: FWorksheet }>} The active sheet.
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* const target = univerAPI.getActiveSheet();
|
|
99
|
+
* if (!target) return;
|
|
100
|
+
* const { workbook, worksheet } = target;
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
getActiveSheet(): Nullable<{
|
|
104
|
+
workbook: FWorkbook;
|
|
105
|
+
worksheet: FWorksheet;
|
|
106
|
+
}>;
|
|
90
107
|
}
|
|
91
108
|
export declare class FUniverSheetsMixin extends FUniver implements IFUniverSheetsMixin {
|
|
92
109
|
getCommandSheetTarget(commandInfo: ICommandInfo<object>): Nullable<{
|
|
@@ -98,6 +115,9 @@ export declare class FUniverSheetsMixin extends FUniver implements IFUniverSheet
|
|
|
98
115
|
worksheet: FWorksheet;
|
|
99
116
|
}>;
|
|
100
117
|
private _initWorkbookEvent;
|
|
118
|
+
/**
|
|
119
|
+
* @ignore
|
|
120
|
+
*/
|
|
101
121
|
_initialize(injector: Injector): void;
|
|
102
122
|
createUniverSheet(data: Partial<IWorkbookData>): FWorkbook;
|
|
103
123
|
createWorkbook(data: Partial<IWorkbookData>): FWorkbook;
|
|
@@ -108,6 +128,22 @@ export declare class FUniverSheetsMixin extends FUniver implements IFUniverSheet
|
|
|
108
128
|
getPermission(): FPermission;
|
|
109
129
|
onUniverSheetCreated(callback: (workbook: FWorkbook) => void): IDisposable;
|
|
110
130
|
newDefinedName(): FDefinedNameBuilder;
|
|
131
|
+
getActiveSheet(): Nullable<{
|
|
132
|
+
workbook: FWorkbook;
|
|
133
|
+
worksheet: FWorksheet;
|
|
134
|
+
}>;
|
|
135
|
+
private _fireBeforeActiveSheetChange;
|
|
136
|
+
private _fireActiveSheetChanged;
|
|
137
|
+
private _fireBeforeSheetDelete;
|
|
138
|
+
private _fireSheetDeleted;
|
|
139
|
+
private _fireBeforeSheetMove;
|
|
140
|
+
private _fireSheetMoved;
|
|
141
|
+
private _fireBeforeSheetNameChange;
|
|
142
|
+
private _fireSheetNameChanged;
|
|
143
|
+
private _fireBeforeSheetTabColorChange;
|
|
144
|
+
private _fireSheetTabColorChanged;
|
|
145
|
+
private _fireBeforeSheetHideChange;
|
|
146
|
+
private _fireSheetHideChanged;
|
|
111
147
|
}
|
|
112
148
|
declare module '@univerjs/core' {
|
|
113
149
|
interface FUniver extends IFUniverSheetsMixin {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { CommandListener, CustomData, IDisposable,
|
|
1
|
+
import { CommandListener, CustomData, 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 { RangeThemeStyle, SheetsSelectionsService } from '@univerjs/sheets';
|
|
3
|
+
import { IRangeThemeStyleJSON, RangeThemeStyle, SheetsSelectionsService } from '@univerjs/sheets';
|
|
4
4
|
import { FontLine as _FontLine, FRange } from './f-range';
|
|
5
5
|
import { FDefinedName } from './f-defined-name';
|
|
6
6
|
import { FPermission } from './f-permission';
|
|
7
7
|
import { FWorksheet } from './f-worksheet';
|
|
8
|
+
/**
|
|
9
|
+
* Facade API object bounded to a workbook. It provides a set of methods to interact with the workbook.
|
|
10
|
+
* @hideconstructor
|
|
11
|
+
*/
|
|
8
12
|
export declare class FWorkbook extends FBaseInitialable {
|
|
9
13
|
protected readonly _workbook: Workbook;
|
|
10
14
|
protected readonly _injector: Injector;
|
|
@@ -18,39 +22,17 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
18
22
|
protected readonly _definedNamesService: IDefinedNamesService;
|
|
19
23
|
readonly id: string;
|
|
20
24
|
constructor(_workbook: Workbook, _injector: Injector, _resourceLoaderService: IResourceLoaderService, _selectionManagerService: SheetsSelectionsService, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService, _permissionService: IPermissionService, _logService: ILogService, _localeService: LocaleService, _definedNamesService: IDefinedNamesService);
|
|
21
|
-
getWorkbook(): Workbook;
|
|
22
|
-
private _eventRegistry;
|
|
23
|
-
private _ensureEventRegistry;
|
|
24
|
-
/**
|
|
25
|
-
* Add an event listener
|
|
26
|
-
* @param event key of event
|
|
27
|
-
* @param callback callback when event triggered
|
|
28
|
-
* @returns {Disposable} The Disposable instance, for remove the listener
|
|
29
|
-
* @example
|
|
30
|
-
* ```ts
|
|
31
|
-
* univerAPI.addEvent(univerAPI.event.UnitCreated, (params) => {
|
|
32
|
-
* console.log('unit created', params);
|
|
33
|
-
* });
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
addEvent(event: keyof IEventParamConfig, callback: (params: IEventParamConfig[typeof event]) => void): IDisposable;
|
|
37
25
|
/**
|
|
38
|
-
*
|
|
39
|
-
* @
|
|
40
|
-
* @param params {any} params of event
|
|
41
|
-
* @returns {boolean} should cancel
|
|
26
|
+
* Get the Workbook instance.
|
|
27
|
+
* @returns {Workbook} The Workbook instance.
|
|
42
28
|
* @example
|
|
43
29
|
* ```ts
|
|
44
|
-
*
|
|
30
|
+
* // The code below gets the Workbook instance
|
|
31
|
+
* const activeSpreadsheet = univerAPI.getActiveWorkbook();
|
|
32
|
+
* const workbook = activeSpreadsheet.getWorkbook();
|
|
45
33
|
* ```
|
|
46
34
|
*/
|
|
47
|
-
|
|
48
|
-
addUIEvent(event: keyof IEventParamConfig, _callback: (params: IEventParamConfig[typeof event]) => void): void;
|
|
49
|
-
get Enum(): FEnum;
|
|
50
|
-
/**
|
|
51
|
-
* @returns {FEventName} The event name.
|
|
52
|
-
*/
|
|
53
|
-
get Event(): FEventName;
|
|
35
|
+
getWorkbook(): Workbook;
|
|
54
36
|
/**
|
|
55
37
|
* Get the id of the workbook.
|
|
56
38
|
* @returns {string} The id of the workbook.
|
|
@@ -76,6 +58,7 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
76
58
|
/**
|
|
77
59
|
* Set the name of the workbook.
|
|
78
60
|
* @param {string} name The new name of the workbook.
|
|
61
|
+
* @returns {void}
|
|
79
62
|
* @example
|
|
80
63
|
* ```ts
|
|
81
64
|
* // The code below sets the name of the workbook
|
|
@@ -97,8 +80,14 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
97
80
|
save(): IWorkbookData;
|
|
98
81
|
/**
|
|
99
82
|
* @deprecated use 'save' instead.
|
|
100
|
-
* @returns {
|
|
83
|
+
* @returns {IWorkbookData} Workbook snapshot data
|
|
101
84
|
* @memberof FWorkbook
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* // The code below saves the workbook snapshot data
|
|
88
|
+
* const activeSpreadsheet = univerAPI.getActiveWorkbook();
|
|
89
|
+
* const snapshot = activeSpreadsheet.getSnapshot();
|
|
90
|
+
* ```
|
|
102
91
|
*/
|
|
103
92
|
getSnapshot(): IWorkbookData;
|
|
104
93
|
/**
|
|
@@ -125,10 +114,10 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
125
114
|
getSheets(): FWorksheet[];
|
|
126
115
|
/**
|
|
127
116
|
* Create a new worksheet and returns a handle to it.
|
|
128
|
-
* @param name Name of the new sheet
|
|
129
|
-
* @param rows How
|
|
130
|
-
* @param column How many columns would the new sheet have
|
|
131
|
-
* @returns The new created sheet
|
|
117
|
+
* @param {string} name Name of the new sheet
|
|
118
|
+
* @param {number} rows How many rows would the new sheet have
|
|
119
|
+
* @param {number} column How many columns would the new sheet have
|
|
120
|
+
* @returns {FWorksheet} The new created sheet
|
|
132
121
|
* @example
|
|
133
122
|
* ```ts
|
|
134
123
|
* // The code below creates a new sheet
|
|
@@ -139,8 +128,8 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
139
128
|
create(name: string, rows: number, column: number): FWorksheet;
|
|
140
129
|
/**
|
|
141
130
|
* Get a worksheet by sheet id.
|
|
142
|
-
* @param sheetId The id of the sheet to get.
|
|
143
|
-
* @returns The worksheet with given sheet id
|
|
131
|
+
* @param {string} sheetId The id of the sheet to get.
|
|
132
|
+
* @returns {FWorksheet | null} The worksheet with given sheet id
|
|
144
133
|
* @example
|
|
145
134
|
* ```ts
|
|
146
135
|
* // The code below gets a worksheet by sheet id
|
|
@@ -151,8 +140,8 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
151
140
|
getSheetBySheetId(sheetId: string): FWorksheet | null;
|
|
152
141
|
/**
|
|
153
142
|
* Get a worksheet by sheet name.
|
|
154
|
-
* @param name The name of the sheet to get.
|
|
155
|
-
* @returns The worksheet with given sheet name
|
|
143
|
+
* @param {string} name The name of the sheet to get.
|
|
144
|
+
* @returns {FWorksheet | null} The worksheet with given sheet name
|
|
156
145
|
* @example
|
|
157
146
|
* ```ts
|
|
158
147
|
* // The code below gets a worksheet by sheet name
|
|
@@ -163,8 +152,8 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
163
152
|
getSheetByName(name: string): FWorksheet | null;
|
|
164
153
|
/**
|
|
165
154
|
* Sets the given worksheet to be the active worksheet in the workbook.
|
|
166
|
-
* @param sheet The worksheet to set as the active worksheet.
|
|
167
|
-
* @returns The active worksheet
|
|
155
|
+
* @param {FWorksheet | string} sheet The worksheet to set as the active worksheet.
|
|
156
|
+
* @returns {FWorksheet} The active worksheet
|
|
168
157
|
* @example
|
|
169
158
|
* ```ts
|
|
170
159
|
* // The code below sets the given worksheet to be the active worksheet
|
|
@@ -173,12 +162,12 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
173
162
|
* activeSpreadsheet.setActiveSheet(sheet);
|
|
174
163
|
* ```
|
|
175
164
|
*/
|
|
176
|
-
setActiveSheet(sheet: FWorksheet): FWorksheet;
|
|
165
|
+
setActiveSheet(sheet: FWorksheet | string): FWorksheet;
|
|
177
166
|
/**
|
|
178
167
|
* Inserts a new worksheet into the workbook.
|
|
179
168
|
* Using a default sheet name. The new sheet becomes the active sheet
|
|
180
|
-
* @param sheetName
|
|
181
|
-
* @returns The new sheet
|
|
169
|
+
* @param {string} [sheetName] The name of the new sheet
|
|
170
|
+
* @returns {FWorksheet} The new sheet
|
|
182
171
|
* @example
|
|
183
172
|
* ```ts
|
|
184
173
|
* // The code below inserts a new sheet into the workbook
|
|
@@ -193,7 +182,7 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
193
182
|
insertSheet(sheetName?: string): FWorksheet;
|
|
194
183
|
/**
|
|
195
184
|
* Deletes the specified worksheet.
|
|
196
|
-
* @param sheet The worksheet to delete.
|
|
185
|
+
* @param {FWorksheet | string} sheet The worksheet to delete.
|
|
197
186
|
* @returns {boolean} True if the worksheet was deleted, false otherwise.
|
|
198
187
|
* @example
|
|
199
188
|
* ```ts
|
|
@@ -203,7 +192,7 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
203
192
|
* activeSpreadsheet.deleteSheet(sheet);
|
|
204
193
|
* ```
|
|
205
194
|
*/
|
|
206
|
-
deleteSheet(sheet: FWorksheet): boolean;
|
|
195
|
+
deleteSheet(sheet: FWorksheet | string): boolean;
|
|
207
196
|
/**
|
|
208
197
|
* Undo the last action.
|
|
209
198
|
* @returns {FWorkbook} A promise that resolves to true if the undo was successful, false otherwise.
|
|
@@ -217,7 +206,7 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
217
206
|
undo(): FWorkbook;
|
|
218
207
|
/**
|
|
219
208
|
* Redo the last undone action.
|
|
220
|
-
* @returns A promise that resolves to true if the redo was successful, false otherwise.
|
|
209
|
+
* @returns {FWorkbook} A promise that resolves to true if the redo was successful, false otherwise.
|
|
221
210
|
* @example
|
|
222
211
|
* ```ts
|
|
223
212
|
* // The code below redoes the last undone action
|
|
@@ -234,13 +223,13 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
234
223
|
/**
|
|
235
224
|
* Register a callback that will be triggered before invoking a command targeting the Univer sheet.
|
|
236
225
|
* @param {onBeforeCommandExecuteCallback} callback the callback.
|
|
237
|
-
* @returns A function to dispose the listening.
|
|
226
|
+
* @returns {IDisposable} A function to dispose the listening.
|
|
238
227
|
* @example
|
|
239
228
|
* ```ts
|
|
240
229
|
* // The code below registers a callback that will be triggered before invoking a command targeting the Univer sheet
|
|
241
230
|
* const activeSpreadsheet = univerAPI.getActiveWorkbook();
|
|
242
231
|
* activeSpreadsheet.onBeforeCommandExecute((command) => {
|
|
243
|
-
*
|
|
232
|
+
* console.log('Command executed:', command);
|
|
244
233
|
* });
|
|
245
234
|
* ```
|
|
246
235
|
*/
|
|
@@ -253,7 +242,7 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
253
242
|
/**
|
|
254
243
|
* Register a callback that will be triggered when a command is invoked targeting the Univer sheet.
|
|
255
244
|
* @param {onCommandExecutedCallback} callback the callback.
|
|
256
|
-
* @returns A function to dispose the listening.
|
|
245
|
+
* @returns {IDisposable} A function to dispose the listening.
|
|
257
246
|
* @example
|
|
258
247
|
* ```ts
|
|
259
248
|
* // The code below registers a callback that will be triggered when a command is invoked targeting the Univer sheet
|
|
@@ -261,6 +250,7 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
261
250
|
* activeSpreadsheet.onCommandExecuted((command) => {
|
|
262
251
|
* console.log('Command executed:', command);
|
|
263
252
|
* });
|
|
253
|
+
* ```
|
|
264
254
|
*/
|
|
265
255
|
onCommandExecuted(callback: CommandListener): IDisposable;
|
|
266
256
|
/**
|
|
@@ -271,7 +261,7 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
271
261
|
/**
|
|
272
262
|
* Register a callback that will be triggered when the selection changes.
|
|
273
263
|
* @param {onSelectionChangeCallback} callback The callback.
|
|
274
|
-
* @returns A function to dispose the listening
|
|
264
|
+
* @returns {IDisposable} A function to dispose the listening
|
|
275
265
|
*/
|
|
276
266
|
onSelectionChange(callback: (selections: IRange[]) => void): IDisposable;
|
|
277
267
|
/**
|
|
@@ -282,13 +272,13 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
282
272
|
setEditable(value: boolean): FWorkbook;
|
|
283
273
|
/**
|
|
284
274
|
* Sets the selection region for active sheet.
|
|
285
|
-
* @param range The range to set as the active selection.
|
|
275
|
+
* @param {FRange} range The range to set as the active selection.
|
|
286
276
|
* @returns {FWorkbook} FWorkbook instance
|
|
287
277
|
*/
|
|
288
278
|
setActiveRange(range: FRange): FWorkbook;
|
|
289
279
|
/**
|
|
290
280
|
* Returns the selected range in the active sheet, or null if there is no active range.
|
|
291
|
-
* @returns
|
|
281
|
+
* @returns {FRange | null} The active range
|
|
292
282
|
*/
|
|
293
283
|
getActiveRange(): FRange | null;
|
|
294
284
|
/**
|
|
@@ -320,7 +310,6 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
320
310
|
* @returns {FWorksheet} The duplicated worksheet
|
|
321
311
|
* @example
|
|
322
312
|
* ```ts
|
|
323
|
-
* // The code below duplicates the active sheet
|
|
324
313
|
* const activeSpreadsheet = univerAPI.getActiveWorkbook();
|
|
325
314
|
* activeSpreadsheet.duplicateActiveSheet();
|
|
326
315
|
* ```
|
|
@@ -328,7 +317,7 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
328
317
|
duplicateActiveSheet(): FWorksheet;
|
|
329
318
|
/**
|
|
330
319
|
* Get the number of sheets in the workbook.
|
|
331
|
-
* @returns The number of sheets in the workbook
|
|
320
|
+
* @returns {number} The number of sheets in the workbook
|
|
332
321
|
* @example
|
|
333
322
|
* ```ts
|
|
334
323
|
* // The code below gets the number of sheets in the workbook
|
|
@@ -458,6 +447,7 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
458
447
|
/**
|
|
459
448
|
* Insert a defined name by builder param.
|
|
460
449
|
* @param {ISetDefinedNameMutationParam} param The param to insert the defined name
|
|
450
|
+
* @returns {void}
|
|
461
451
|
* @example
|
|
462
452
|
* ```ts
|
|
463
453
|
* // The code below inserts a defined name by builder param
|
|
@@ -471,6 +461,7 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
471
461
|
/**
|
|
472
462
|
* Update the defined name with the given name.
|
|
473
463
|
* @param {ISetDefinedNameMutationParam} param The param to insert the defined name
|
|
464
|
+
* @returns {void}
|
|
474
465
|
* @example
|
|
475
466
|
* ```ts
|
|
476
467
|
* // The code below updates the defined name with the given name
|
|
@@ -495,16 +486,17 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
495
486
|
getRegisteredRangeThemes(): string[];
|
|
496
487
|
/**
|
|
497
488
|
* Register a custom range theme style.
|
|
498
|
-
* @param rangeThemeStyle
|
|
489
|
+
* @param {RangeThemeStyle} rangeThemeStyle The range theme style to register
|
|
490
|
+
* @returns {void}
|
|
499
491
|
* @example
|
|
500
492
|
* ```ts
|
|
501
493
|
* // import {RangeThemeStyle} from '@univerjs/sheets';
|
|
502
494
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
503
495
|
* const rangeThemeStyle = new RangeThemeStyle('MyTheme');
|
|
504
496
|
* rangeThemeStyle.setSecondRowStyle({
|
|
505
|
-
*
|
|
506
|
-
*
|
|
507
|
-
*
|
|
497
|
+
* bg: {
|
|
498
|
+
* rgb: 'rgb(214,231,241)',
|
|
499
|
+
* },
|
|
508
500
|
* });
|
|
509
501
|
* fWorkbook.registerRangeTheme(rangeThemeStyle);
|
|
510
502
|
* ```
|
|
@@ -512,7 +504,8 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
512
504
|
registerRangeTheme(rangeThemeStyle: RangeThemeStyle): void;
|
|
513
505
|
/**
|
|
514
506
|
* Unregister a custom range theme style.
|
|
515
|
-
* @param themeName
|
|
507
|
+
* @param {string} themeName The name of the theme to unregister
|
|
508
|
+
* @returns {void}
|
|
516
509
|
* @example
|
|
517
510
|
* ```ts
|
|
518
511
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -520,6 +513,7 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
520
513
|
* ```
|
|
521
514
|
*/
|
|
522
515
|
unregisterRangeTheme(themeName: string): void;
|
|
516
|
+
createRangeThemeStyle(themeName: string, themeStyleJson?: Omit<IRangeThemeStyleJSON, 'name'>): RangeThemeStyle;
|
|
523
517
|
/**
|
|
524
518
|
* Set custom metadata of workbook
|
|
525
519
|
* @param {CustomData | undefined} custom custom metadata
|
|
@@ -542,6 +536,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
542
536
|
*/
|
|
543
537
|
getCustomMetadata(): CustomData | undefined;
|
|
544
538
|
}
|
|
539
|
+
/**
|
|
540
|
+
* @ignore
|
|
541
|
+
*/
|
|
545
542
|
export declare namespace FWorkbook {
|
|
546
543
|
type FontLine = _FontLine;
|
|
547
544
|
type FontStyle = _FontLine;
|