@univerjs/sheets 0.24.0 → 0.25.0-insiders.20260608-e4336f7
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 +641 -466
- package/lib/cjs/index.js +146 -128
- package/lib/cjs/locale/ar-SA.js +52 -0
- package/lib/cjs/locale/ca-ES.js +36 -1
- package/lib/cjs/locale/de-DE.js +52 -0
- package/lib/cjs/locale/en-US.js +36 -1
- package/lib/cjs/locale/es-ES.js +36 -1
- package/lib/cjs/locale/fa-IR.js +36 -1
- package/lib/cjs/locale/fr-FR.js +36 -1
- package/lib/cjs/locale/id-ID.js +52 -0
- package/lib/cjs/locale/it-IT.js +52 -0
- package/lib/cjs/locale/ja-JP.js +36 -1
- package/lib/cjs/locale/ko-KR.js +36 -1
- package/lib/cjs/locale/pl-PL.js +52 -0
- package/lib/cjs/locale/pt-BR.js +52 -0
- package/lib/cjs/locale/ru-RU.js +36 -1
- package/lib/cjs/locale/sk-SK.js +36 -1
- package/lib/cjs/locale/vi-VN.js +36 -1
- package/lib/cjs/locale/zh-CN.js +36 -1
- package/lib/cjs/locale/zh-HK.js +52 -0
- package/lib/cjs/locale/zh-TW.js +36 -1
- package/lib/es/facade.js +642 -461
- package/lib/es/index.js +139 -129
- package/lib/es/locale/ar-SA.js +51 -0
- package/lib/es/locale/ca-ES.js +36 -1
- package/lib/es/locale/de-DE.js +51 -0
- package/lib/es/locale/en-US.js +36 -1
- package/lib/es/locale/es-ES.js +36 -1
- package/lib/es/locale/fa-IR.js +36 -1
- package/lib/es/locale/fr-FR.js +36 -1
- package/lib/es/locale/id-ID.js +51 -0
- package/lib/es/locale/it-IT.js +51 -0
- package/lib/es/locale/ja-JP.js +36 -1
- package/lib/es/locale/ko-KR.js +36 -1
- package/lib/es/locale/pl-PL.js +51 -0
- package/lib/es/locale/pt-BR.js +51 -0
- package/lib/es/locale/ru-RU.js +36 -1
- package/lib/es/locale/sk-SK.js +36 -1
- package/lib/es/locale/vi-VN.js +36 -1
- package/lib/es/locale/zh-CN.js +36 -1
- package/lib/es/locale/zh-HK.js +51 -0
- package/lib/es/locale/zh-TW.js +36 -1
- package/lib/facade.js +642 -461
- package/lib/index.js +139 -129
- package/lib/locale/ar-SA.js +51 -0
- package/lib/locale/ca-ES.js +36 -1
- package/lib/locale/de-DE.js +51 -0
- package/lib/locale/en-US.js +36 -1
- package/lib/locale/es-ES.js +36 -1
- package/lib/locale/fa-IR.js +36 -1
- package/lib/locale/fr-FR.js +36 -1
- package/lib/locale/id-ID.js +51 -0
- package/lib/locale/it-IT.js +51 -0
- package/lib/locale/ja-JP.js +36 -1
- package/lib/locale/ko-KR.js +36 -1
- package/lib/locale/pl-PL.js +51 -0
- package/lib/locale/pt-BR.js +51 -0
- package/lib/locale/ru-RU.js +36 -1
- package/lib/locale/sk-SK.js +36 -1
- package/lib/locale/vi-VN.js +36 -1
- package/lib/locale/zh-CN.js +36 -1
- package/lib/locale/zh-HK.js +51 -0
- package/lib/locale/zh-TW.js +36 -1
- package/lib/types/basics/utils.d.ts +2 -0
- package/lib/types/commands/commands/add-range-protection.command.d.ts +1 -1
- package/lib/types/commands/commands/delete-range-protection.command.d.ts +1 -1
- package/lib/types/commands/commands/register-range-theme.command.d.ts +1 -1
- package/lib/types/commands/commands/set-protection.command.d.ts +1 -1
- package/lib/types/commands/mutations/add-range-protection.mutation.d.ts +1 -1
- package/lib/types/commands/mutations/add-range-theme.mutation.d.ts +1 -1
- package/lib/types/commands/mutations/register-range-theme.mutation.d.ts +1 -1
- package/lib/types/commands/mutations/set-range-protection.mutation.d.ts +1 -1
- package/lib/types/commands/mutations/set-range-theme.mutation.d.ts +1 -1
- package/lib/types/controllers/permission/sheet-permission-check.controller.d.ts +1 -1
- package/lib/types/controllers/permission/sheet-permission-init.controller.d.ts +1 -1
- package/lib/types/controllers/permission/sheet-permission-view-model.controller.d.ts +1 -1
- package/lib/types/controllers/zebar-crossing.controller.d.ts +1 -1
- package/lib/types/facade/{f-sheet-hooks.d.ts → const.d.ts} +1 -9
- package/lib/types/facade/f-range.d.ts +187 -94
- package/lib/types/facade/f-selection.d.ts +15 -8
- package/lib/types/facade/f-univer.d.ts +33 -64
- package/lib/types/facade/f-workbook.d.ts +15 -50
- package/lib/types/facade/f-worksheet.d.ts +202 -101
- package/lib/types/facade/index.d.ts +0 -1
- package/lib/types/facade/permission/f-range-permission.d.ts +8 -4
- package/lib/types/facade/permission/f-range-protection-rule.d.ts +18 -9
- package/lib/types/facade/permission/f-worksheet-permission.d.ts +36 -18
- package/lib/types/index.d.ts +9 -8
- package/lib/types/locale/ar-SA.d.ts +18 -0
- package/lib/types/locale/de-DE.d.ts +18 -0
- package/lib/types/locale/en-US.d.ts +39 -0
- package/lib/types/locale/id-ID.d.ts +18 -0
- package/lib/types/locale/it-IT.d.ts +18 -0
- package/lib/types/locale/pl-PL.d.ts +18 -0
- package/lib/types/locale/pt-BR.d.ts +18 -0
- package/lib/types/locale/zh-HK.d.ts +18 -0
- package/lib/types/services/permission/range-permission/range-protection.ref-range.d.ts +3 -3
- package/lib/types/services/permission/range-permission/range-protection.service.d.ts +2 -2
- package/lib/types/services/permission/type.d.ts +1 -1
- package/lib/types/services/permission/workbook-permission/workbook-permission.service.d.ts +1 -1
- package/lib/types/services/permission/worksheet-permission/worksheet-permission.service.d.ts +1 -1
- package/lib/types/services/range-theme.service.d.ts +3 -3
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +2 -2
- package/lib/umd/locale/ar-SA.js +1 -0
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -0
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.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/id-ID.js +1 -0
- package/lib/umd/locale/it-IT.js +1 -0
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -0
- package/lib/umd/locale/pt-BR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.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-HK.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +9 -9
- package/LICENSE +0 -176
- /package/lib/types/{model → models}/range-protection-render.model.d.ts +0 -0
- /package/lib/types/{model → models}/range-protection-rule.model.d.ts +0 -0
- /package/lib/types/{model → models}/range-protection.cache.d.ts +0 -0
- /package/lib/types/{model → models}/range-theme-model.d.ts +0 -0
- /package/lib/types/{model → models}/range-theme-util.d.ts +0 -0
- /package/lib/types/{model → models}/range-themes/build-in-theme.factory.d.ts +0 -0
- /package/lib/types/{model → models}/range-themes/default.d.ts +0 -0
- /package/lib/types/{model → models}/zebra-crossing-cache.d.ts +0 -0
|
@@ -24,7 +24,8 @@ import { FWorksheet } from './f-worksheet';
|
|
|
24
24
|
* @example
|
|
25
25
|
* ```ts
|
|
26
26
|
* const fWorkbook = univerAPI.getActiveWorkbook()
|
|
27
|
-
* const fWorksheet = fWorkbook.
|
|
27
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1')
|
|
28
|
+
* if (!fWorksheet) return;
|
|
28
29
|
* const fSelection = fWorksheet.getSelection();
|
|
29
30
|
* const activeRange = fSelection.getActiveRange();
|
|
30
31
|
* console.log(activeRange);
|
|
@@ -43,7 +44,8 @@ export declare class FSelection {
|
|
|
43
44
|
* @example
|
|
44
45
|
* ```ts
|
|
45
46
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
46
|
-
* const fWorksheet = fWorkbook.
|
|
47
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
48
|
+
* if (!fWorksheet) return;
|
|
47
49
|
* const fRange = fWorksheet.getRange('A10:B11');
|
|
48
50
|
* fRange.activate();
|
|
49
51
|
* const fSelection = fWorksheet.getSelection();
|
|
@@ -57,7 +59,8 @@ export declare class FSelection {
|
|
|
57
59
|
* @example
|
|
58
60
|
* ```ts
|
|
59
61
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
60
|
-
* const fWorksheet = fWorkbook.
|
|
62
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
63
|
+
* if (!fWorksheet) return;
|
|
61
64
|
* const fSelection = fWorksheet.getSelection();
|
|
62
65
|
* const activeRangeList = fSelection.getActiveRangeList();
|
|
63
66
|
* activeRangeList.forEach((range) => {
|
|
@@ -72,7 +75,8 @@ export declare class FSelection {
|
|
|
72
75
|
* @example
|
|
73
76
|
* ```ts
|
|
74
77
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
75
|
-
* const fWorksheet = fWorkbook.
|
|
78
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
79
|
+
* if (!fWorksheet) return;
|
|
76
80
|
* const fRange = fWorksheet.getRange('A10:B11');
|
|
77
81
|
* fRange.activate();
|
|
78
82
|
* const fSelection = fWorksheet.getSelection();
|
|
@@ -89,10 +93,11 @@ export declare class FSelection {
|
|
|
89
93
|
* @example
|
|
90
94
|
* ```ts
|
|
91
95
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
92
|
-
* const fWorksheet = fWorkbook.
|
|
96
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
97
|
+
* if (!fWorksheet) return;
|
|
93
98
|
* const fSelection = fWorksheet.getSelection();
|
|
94
99
|
* const activeSheet = fSelection.getActiveSheet();
|
|
95
|
-
* console.log(activeSheet.equalTo(fWorksheet));
|
|
100
|
+
* console.log(activeSheet.equalTo(fWorksheet));
|
|
96
101
|
* ```
|
|
97
102
|
*/
|
|
98
103
|
getActiveSheet(): FWorksheet;
|
|
@@ -103,7 +108,8 @@ export declare class FSelection {
|
|
|
103
108
|
* @example
|
|
104
109
|
* ```ts
|
|
105
110
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
106
|
-
* const fWorksheet = fWorkbook.
|
|
111
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
112
|
+
* if (!fWorksheet) return;
|
|
107
113
|
* const fRange = fWorksheet.getRange('A10:B11');
|
|
108
114
|
* fRange.activate();
|
|
109
115
|
* const cell = fWorksheet.getRange('B11');
|
|
@@ -127,7 +133,8 @@ export declare class FSelection {
|
|
|
127
133
|
* @example
|
|
128
134
|
* ```ts
|
|
129
135
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
130
|
-
* const fWorksheet = fWorkbook.
|
|
136
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
137
|
+
* if (!fWorksheet) return;
|
|
131
138
|
* // make sure the active cell is A1 and selection is A1:B2
|
|
132
139
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
133
140
|
* fRange.activate();
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type {
|
|
16
|
+
import type { ICreateUnitOptions, Injector, IWorkbookData } from '@univerjs/core';
|
|
17
17
|
import type { FWorksheet } from './f-worksheet';
|
|
18
18
|
import { FUniver } from '@univerjs/core/facade';
|
|
19
19
|
import { FWorkbook } from './f-workbook';
|
|
@@ -21,31 +21,27 @@ import { FWorkbook } from './f-workbook';
|
|
|
21
21
|
* @ignore
|
|
22
22
|
*/
|
|
23
23
|
export interface IFUniverSheetsMixin {
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated use `univerAPI.createWorkbook` instead.
|
|
26
|
-
*/
|
|
27
|
-
createUniverSheet(data: Partial<IWorkbookData>): FWorkbook;
|
|
28
24
|
/**
|
|
29
25
|
* Create a new spreadsheet and get the API handler of that spreadsheet.
|
|
30
26
|
* @param {Partial<IWorkbookData>} data The snapshot of the spreadsheet.
|
|
31
27
|
* @param {ICreateUnitOptions} options The options of creating the spreadsheet.
|
|
32
|
-
* @returns {FWorkbook}
|
|
28
|
+
* @returns {FWorkbook} The spreadsheet API instance.
|
|
33
29
|
* @example
|
|
34
30
|
* ```ts
|
|
35
|
-
* const fWorkbook = univerAPI.createWorkbook({ id: '
|
|
31
|
+
* const fWorkbook = univerAPI.createWorkbook({ id: 'workbook-01', name: 'Workbook1' });
|
|
36
32
|
* console.log(fWorkbook);
|
|
37
33
|
* ```
|
|
38
34
|
*
|
|
39
35
|
* Add you can make the workbook not as the active workbook by setting options:
|
|
40
36
|
* ```ts
|
|
41
|
-
* const fWorkbook = univerAPI.createWorkbook({ id: '
|
|
37
|
+
* const fWorkbook = univerAPI.createWorkbook({ id: 'workbook-01', name: 'Workbook1' }, { makeCurrent: false });
|
|
42
38
|
* console.log(fWorkbook);
|
|
43
39
|
* ```
|
|
44
40
|
*/
|
|
45
41
|
createWorkbook(data: Partial<IWorkbookData>, options?: ICreateUnitOptions): FWorkbook;
|
|
46
42
|
/**
|
|
47
43
|
* Get the currently focused Univer spreadsheet.
|
|
48
|
-
* @returns {FWorkbook | null} The currently focused Univer spreadsheet.
|
|
44
|
+
* @returns {FWorkbook | null} The currently focused Univer spreadsheet API instance, or null if there is no active spreadsheet.
|
|
49
45
|
* @example
|
|
50
46
|
* ```ts
|
|
51
47
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -53,49 +49,18 @@ export interface IFUniverSheetsMixin {
|
|
|
53
49
|
* ```
|
|
54
50
|
*/
|
|
55
51
|
getActiveWorkbook(): FWorkbook | null;
|
|
56
|
-
/**
|
|
57
|
-
* @deprecated use `univerAPI.getActiveWorkbook` instead
|
|
58
|
-
*/
|
|
59
|
-
getActiveUniverSheet(): FWorkbook | null;
|
|
60
52
|
/**
|
|
61
53
|
* Get the spreadsheet API handler by the spreadsheet id.
|
|
62
54
|
* @param {string} id The spreadsheet id.
|
|
63
|
-
* @returns {FWorkbook | null} The spreadsheet API instance.
|
|
55
|
+
* @returns {FWorkbook | null} The spreadsheet API instance corresponding to the spreadsheet id, or null if not found.
|
|
64
56
|
*
|
|
65
57
|
* @example
|
|
66
58
|
* ```ts
|
|
67
|
-
* const fWorkbook = univerAPI.
|
|
68
|
-
* console.log(fWorkbook);
|
|
69
|
-
*
|
|
70
|
-
* const fWorkbook = univerAPI.getWorkbook('Sheet1');
|
|
59
|
+
* const fWorkbook = univerAPI.getWorkbook('workbook-01');
|
|
71
60
|
* console.log(fWorkbook);
|
|
72
61
|
* ```
|
|
73
62
|
*/
|
|
74
|
-
getUniverSheet(id: string): FWorkbook | null;
|
|
75
63
|
getWorkbook(id: string): FWorkbook | null;
|
|
76
|
-
/**
|
|
77
|
-
* @deprecated Use `univerAPI.addEvent(univerAPI.Event.UnitCreated, () => {})`
|
|
78
|
-
*/
|
|
79
|
-
onUniverSheetCreated(callback: (workbook: FWorkbook) => void): IDisposable;
|
|
80
|
-
/**
|
|
81
|
-
* Get the target of the sheet.
|
|
82
|
-
* @param {string} unitId - The unitId of the sheet.
|
|
83
|
-
* @param {string} subUnitId - The subUnitId of the sheet.
|
|
84
|
-
* @returns {Nullable<{ workbook: FWorkbook; worksheet: FWorksheet }>} - The target of the sheet.
|
|
85
|
-
* @example
|
|
86
|
-
* ```ts
|
|
87
|
-
* const unitId = 'workbook-01';
|
|
88
|
-
* const subUnitId = 'sheet-0001';
|
|
89
|
-
* const target = univerAPI.getSheetTarget(unitId, subUnitId);
|
|
90
|
-
* if (!target) return;
|
|
91
|
-
* const { workbook, worksheet } = target;
|
|
92
|
-
* console.log(workbook, worksheet);
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
getSheetTarget(unitId: string, subUnitId: string): Nullable<{
|
|
96
|
-
workbook: FWorkbook;
|
|
97
|
-
worksheet: FWorksheet;
|
|
98
|
-
}>;
|
|
99
64
|
/**
|
|
100
65
|
* Get the target of the sheet.
|
|
101
66
|
* @param {ICommandInfo<object>} commandInfo - The commandInfo of the command.
|
|
@@ -104,17 +69,23 @@ export interface IFUniverSheetsMixin {
|
|
|
104
69
|
* ```ts
|
|
105
70
|
* univerAPI.addEvent(univerAPI.Event.CommandExecuted, (event) => {
|
|
106
71
|
* const { options, ...commandInfo } = event;
|
|
107
|
-
* const target = univerAPI.
|
|
72
|
+
* const target = univerAPI.getSheetCommandTarget(commandInfo.params);
|
|
108
73
|
* if (!target) return;
|
|
109
74
|
* const { workbook, worksheet } = target;
|
|
110
75
|
* console.log(workbook, worksheet);
|
|
111
76
|
* });
|
|
112
77
|
* ```
|
|
113
78
|
*/
|
|
114
|
-
|
|
79
|
+
getSheetCommandTarget(params?: {
|
|
80
|
+
unitId?: string;
|
|
81
|
+
subUnitId?: string;
|
|
82
|
+
sheetId?: string;
|
|
83
|
+
}): {
|
|
115
84
|
workbook: FWorkbook;
|
|
116
85
|
worksheet: FWorksheet;
|
|
117
|
-
|
|
86
|
+
unitId: string;
|
|
87
|
+
subUnitId: string;
|
|
88
|
+
} | null;
|
|
118
89
|
/**
|
|
119
90
|
* Get the active sheet.
|
|
120
91
|
* @returns {Nullable<{ workbook: FWorkbook; worksheet: FWorksheet }>} The active sheet.
|
|
@@ -126,10 +97,10 @@ export interface IFUniverSheetsMixin {
|
|
|
126
97
|
* console.log(workbook, worksheet);
|
|
127
98
|
* ```
|
|
128
99
|
*/
|
|
129
|
-
getActiveSheet():
|
|
100
|
+
getActiveSheet(): {
|
|
130
101
|
workbook: FWorkbook;
|
|
131
102
|
worksheet: FWorksheet;
|
|
132
|
-
}
|
|
103
|
+
} | null;
|
|
133
104
|
/**
|
|
134
105
|
* Set whether to enable synchronize the frozen state to other users in real-time collaboration.
|
|
135
106
|
* @param {boolean} enabled - Whether to enable freeze sync. Default is true.
|
|
@@ -142,31 +113,29 @@ export interface IFUniverSheetsMixin {
|
|
|
142
113
|
setFreezeSync(enabled: boolean): void;
|
|
143
114
|
}
|
|
144
115
|
export declare class FUniverSheetsMixin extends FUniver implements IFUniverSheetsMixin {
|
|
145
|
-
|
|
116
|
+
createWorkbook(data: Partial<IWorkbookData>, options?: ICreateUnitOptions): FWorkbook;
|
|
117
|
+
getActiveWorkbook(): FWorkbook | null;
|
|
118
|
+
getWorkbook(id: string): FWorkbook | null;
|
|
119
|
+
getSheetCommandTarget(params?: {
|
|
120
|
+
unitId?: string;
|
|
121
|
+
subUnitId?: string;
|
|
122
|
+
sheetId?: string;
|
|
123
|
+
}): {
|
|
146
124
|
workbook: FWorkbook;
|
|
147
125
|
worksheet: FWorksheet;
|
|
148
|
-
|
|
149
|
-
|
|
126
|
+
unitId: string;
|
|
127
|
+
subUnitId: string;
|
|
128
|
+
} | null;
|
|
129
|
+
getActiveSheet(): {
|
|
150
130
|
workbook: FWorkbook;
|
|
151
131
|
worksheet: FWorksheet;
|
|
152
|
-
}
|
|
153
|
-
|
|
132
|
+
} | null;
|
|
133
|
+
setFreezeSync(enabled: boolean): void;
|
|
154
134
|
/**
|
|
155
135
|
* @ignore
|
|
156
136
|
*/
|
|
157
137
|
_initialize(injector: Injector): void;
|
|
158
|
-
|
|
159
|
-
createWorkbook(data: Partial<IWorkbookData>, options?: ICreateUnitOptions): FWorkbook;
|
|
160
|
-
getActiveWorkbook(): FWorkbook | null;
|
|
161
|
-
getActiveUniverSheet(): FWorkbook | null;
|
|
162
|
-
getUniverSheet(id: string): FWorkbook | null;
|
|
163
|
-
getWorkbook(id: string): FWorkbook | null;
|
|
164
|
-
onUniverSheetCreated(callback: (workbook: FWorkbook) => void): IDisposable;
|
|
165
|
-
getActiveSheet(): Nullable<{
|
|
166
|
-
workbook: FWorkbook;
|
|
167
|
-
worksheet: FWorksheet;
|
|
168
|
-
}>;
|
|
169
|
-
setFreezeSync(enabled: boolean): void;
|
|
138
|
+
private _initWorkbookEvent;
|
|
170
139
|
}
|
|
171
140
|
declare module '@univerjs/core/facade' {
|
|
172
141
|
interface FUniver extends IFUniverSheetsMixin {
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { CommandListener, CustomData, IDisposable, IRange, IStyleData, IWorkbookData, IWorksheetData,
|
|
16
|
+
import type { CommandListener, CustomData, IDisposable, IRange, IStyleData, IWorkbookData, IWorksheetData, Workbook } from '@univerjs/core';
|
|
17
17
|
import type { ISetDefinedNameMutationParam } from '@univerjs/engine-formula';
|
|
18
18
|
import type { IRangeThemeStyleJSON } from '@univerjs/sheets';
|
|
19
19
|
import type { FontLine as _FontLine } from './f-range';
|
|
20
|
-
import { ICommandService, ILogService, Injector, IPermissionService, IResourceLoaderService, IUniverInstanceService
|
|
20
|
+
import { ICommandService, ILogService, Injector, IPermissionService, IResourceLoaderService, IUniverInstanceService } from '@univerjs/core';
|
|
21
21
|
import { FBaseInitialable } from '@univerjs/core/facade';
|
|
22
22
|
import { IDefinedNamesService } from '@univerjs/engine-formula';
|
|
23
23
|
import { RangeThemeStyle, SheetsSelectionsService } from '@univerjs/sheets';
|
|
@@ -38,10 +38,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
38
38
|
protected readonly _commandService: ICommandService;
|
|
39
39
|
protected readonly _permissionService: IPermissionService;
|
|
40
40
|
protected readonly _logService: ILogService;
|
|
41
|
-
protected readonly _localeService: LocaleService;
|
|
42
41
|
protected readonly _definedNamesService: IDefinedNamesService;
|
|
43
42
|
readonly id: string;
|
|
44
|
-
constructor(_workbook: Workbook, _injector: Injector, _resourceLoaderService: IResourceLoaderService, _selectionManagerService: SheetsSelectionsService, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService, _permissionService: IPermissionService, _logService: ILogService,
|
|
43
|
+
constructor(_workbook: Workbook, _injector: Injector, _resourceLoaderService: IResourceLoaderService, _selectionManagerService: SheetsSelectionsService, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService, _permissionService: IPermissionService, _logService: ILogService, _definedNamesService: IDefinedNamesService);
|
|
45
44
|
/**
|
|
46
45
|
* Get the Workbook instance.
|
|
47
46
|
* @returns {Workbook} The Workbook instance.
|
|
@@ -102,18 +101,6 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
102
101
|
* ```
|
|
103
102
|
*/
|
|
104
103
|
save(): IWorkbookData;
|
|
105
|
-
/**
|
|
106
|
-
* @deprecated use 'save' instead.
|
|
107
|
-
* @returns {IWorkbookData} Workbook snapshot data
|
|
108
|
-
* @memberof FWorkbook
|
|
109
|
-
* @example
|
|
110
|
-
* ```ts
|
|
111
|
-
* // The code below saves the workbook snapshot data
|
|
112
|
-
* const activeSpreadsheet = univerAPI.getActiveWorkbook();
|
|
113
|
-
* const snapshot = activeSpreadsheet.getSnapshot();
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
getSnapshot(): IWorkbookData;
|
|
117
104
|
/**
|
|
118
105
|
* Get the active sheet of the workbook.
|
|
119
106
|
* @returns {FWorksheet} The active sheet of the workbook
|
|
@@ -122,6 +109,7 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
122
109
|
* // The code below gets the active sheet of the workbook
|
|
123
110
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
124
111
|
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
112
|
+
* if (!fWorksheet) return;
|
|
125
113
|
* console.log(fWorksheet);
|
|
126
114
|
* ```
|
|
127
115
|
*/
|
|
@@ -374,7 +362,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
374
362
|
* @example
|
|
375
363
|
* ```ts
|
|
376
364
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
377
|
-
* const
|
|
365
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
366
|
+
* if (!fWorksheet) return;
|
|
367
|
+
* const range = fWorksheet.getRange('A10:B10');
|
|
378
368
|
* fWorkbook.setActiveRange(range);
|
|
379
369
|
* ```
|
|
380
370
|
*/
|
|
@@ -418,7 +408,8 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
418
408
|
* ```ts
|
|
419
409
|
* // The code below duplicates the given worksheet
|
|
420
410
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
421
|
-
* const activeSheet = fWorkbook.
|
|
411
|
+
* const activeSheet = fWorkbook.getSheetByName('Sheet1');
|
|
412
|
+
* if (!activeSheet) return;
|
|
422
413
|
* const duplicatedSheet = fWorkbook.duplicateSheet(activeSheet);
|
|
423
414
|
* console.log(duplicatedSheet);
|
|
424
415
|
* ```
|
|
@@ -446,35 +437,6 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
446
437
|
* ```
|
|
447
438
|
*/
|
|
448
439
|
getNumSheets(): number;
|
|
449
|
-
/**
|
|
450
|
-
* Get the locale of the workbook.
|
|
451
|
-
* @returns {LocaleType} The locale of the workbook
|
|
452
|
-
* @example
|
|
453
|
-
* ```ts
|
|
454
|
-
* // The code below gets the locale of the workbook
|
|
455
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
456
|
-
* console.log(fWorkbook.getLocale());
|
|
457
|
-
* ```
|
|
458
|
-
*/
|
|
459
|
-
getLocale(): LocaleType;
|
|
460
|
-
/**
|
|
461
|
-
* @deprecated use `setSpreadsheetLocale` instead.
|
|
462
|
-
* @param {LocaleType} locale - The locale to set
|
|
463
|
-
*/
|
|
464
|
-
setLocale(locale: LocaleType): void;
|
|
465
|
-
/**
|
|
466
|
-
* Set the locale of the workbook.
|
|
467
|
-
* @param {LocaleType} locale The locale to set
|
|
468
|
-
* @returns {FWorkbook} This workbook, for chaining
|
|
469
|
-
* @example
|
|
470
|
-
* ```ts
|
|
471
|
-
* // The code below sets the locale of the workbook
|
|
472
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
473
|
-
* fWorkbook.setSpreadsheetLocale(univerAPI.Enum.LocaleType.EN_US);
|
|
474
|
-
* console.log(fWorkbook.getLocale());
|
|
475
|
-
* ```
|
|
476
|
-
*/
|
|
477
|
-
setSpreadsheetLocale(locale: LocaleType): FWorkbook;
|
|
478
440
|
/**
|
|
479
441
|
* Get the URL of the workbook.
|
|
480
442
|
* @returns {string} The URL of the workbook
|
|
@@ -496,7 +458,8 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
496
458
|
* ```ts
|
|
497
459
|
* // The code below moves the sheet to the specified index
|
|
498
460
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
499
|
-
* const sheet = fWorkbook.
|
|
461
|
+
* const sheet = fWorkbook.getSheetByName('Sheet1');
|
|
462
|
+
* if (!sheet) return;
|
|
500
463
|
* fWorkbook.moveSheet(sheet, 1);
|
|
501
464
|
* ```
|
|
502
465
|
*/
|
|
@@ -750,7 +713,8 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
750
713
|
* fWorkbook.addStyles(styles);
|
|
751
714
|
*
|
|
752
715
|
* // Set values with the new styles
|
|
753
|
-
* const fWorksheet = fWorkbook.
|
|
716
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
717
|
+
* if (!fWorksheet) return;
|
|
754
718
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
755
719
|
* fRange.setValues([
|
|
756
720
|
* [{ v: 'Hello', s: 'custom-style-1' }, { v: 'Univer', s: 'custom-style-1' }],
|
|
@@ -783,7 +747,8 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
783
747
|
* fWorkbook.addStyles(styles);
|
|
784
748
|
*
|
|
785
749
|
* // Set values with the new styles
|
|
786
|
-
* const fWorksheet = fWorkbook.
|
|
750
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
751
|
+
* if (!fWorksheet) return;
|
|
787
752
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
788
753
|
* fRange.setValues([
|
|
789
754
|
* [{ v: 'Hello', s: 'custom-style-1' }, { v: 'Univer', s: 'custom-style-1' }],
|