@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
package/lib/facade.js
CHANGED
|
@@ -4,7 +4,26 @@ import { AddRangeProtectionMutation, AddWorksheetProtectionMutation, AppendRowCo
|
|
|
4
4
|
import { FormulaDataModel, IDefinedNamesService, IFunctionService, ISuperTableService, deserializeRangeWithSheet, serializeRange, serializeRangeWithSheet } from "@univerjs/engine-formula";
|
|
5
5
|
import { ObjectScope, UnitAction, UnitObject as UnitObject$1, UnitRole } from "@univerjs/protocol";
|
|
6
6
|
|
|
7
|
-
//#region
|
|
7
|
+
//#region src/facade/const.ts
|
|
8
|
+
/**
|
|
9
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
23
|
+
const SHEETS_CUSTOM_FIELD_WARNING_MESSAGE = "[Facade]: The sheets custom field is not recommended for external use. Use it at your own risk.";
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/typeof.js
|
|
8
27
|
function _typeof(o) {
|
|
9
28
|
"@babel/helpers - typeof";
|
|
10
29
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -15,7 +34,7 @@ function _typeof(o) {
|
|
|
15
34
|
}
|
|
16
35
|
|
|
17
36
|
//#endregion
|
|
18
|
-
//#region \0@oxc-project+runtime@0.
|
|
37
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPrimitive.js
|
|
19
38
|
function toPrimitive(t, r) {
|
|
20
39
|
if ("object" != _typeof(t) || !t) return t;
|
|
21
40
|
var e = t[Symbol.toPrimitive];
|
|
@@ -28,14 +47,14 @@ function toPrimitive(t, r) {
|
|
|
28
47
|
}
|
|
29
48
|
|
|
30
49
|
//#endregion
|
|
31
|
-
//#region \0@oxc-project+runtime@0.
|
|
50
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPropertyKey.js
|
|
32
51
|
function toPropertyKey(t) {
|
|
33
52
|
var i = toPrimitive(t, "string");
|
|
34
53
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
35
54
|
}
|
|
36
55
|
|
|
37
56
|
//#endregion
|
|
38
|
-
//#region \0@oxc-project+runtime@0.
|
|
57
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/defineProperty.js
|
|
39
58
|
function _defineProperty(e, r, t) {
|
|
40
59
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
41
60
|
value: t,
|
|
@@ -46,7 +65,7 @@ function _defineProperty(e, r, t) {
|
|
|
46
65
|
}
|
|
47
66
|
|
|
48
67
|
//#endregion
|
|
49
|
-
//#region \0@oxc-project+runtime@0.
|
|
68
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/decorateParam.js
|
|
50
69
|
function __decorateParam(paramIndex, decorator) {
|
|
51
70
|
return function(target, key) {
|
|
52
71
|
decorator(target, key, paramIndex);
|
|
@@ -54,7 +73,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
54
73
|
}
|
|
55
74
|
|
|
56
75
|
//#endregion
|
|
57
|
-
//#region \0@oxc-project+runtime@0.
|
|
76
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/decorate.js
|
|
58
77
|
function __decorate(decorators, target, key, desc) {
|
|
59
78
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
60
79
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -73,13 +92,13 @@ function __decorate(decorators, target, key, desc) {
|
|
|
73
92
|
*/
|
|
74
93
|
function getDefinedNameFieldName(unitId, localeService, definedNamesService) {
|
|
75
94
|
const definedNameMap = definedNamesService.getDefinedNameMap(unitId);
|
|
76
|
-
if (definedNameMap == null) return localeService.t("definedName.defaultName") + 1;
|
|
95
|
+
if (definedNameMap == null) return localeService.t("sheets.definedName.defaultName") + 1;
|
|
77
96
|
const count = Array.from(Object.values(definedNameMap)).length + 1;
|
|
78
|
-
const name = localeService.t("definedName.defaultName") + count;
|
|
97
|
+
const name = localeService.t("sheets.definedName.defaultName") + count;
|
|
79
98
|
if (definedNamesService.getValueByName(unitId, name) == null) return name;
|
|
80
99
|
let i = count + 1;
|
|
81
100
|
while (true) {
|
|
82
|
-
const newName = localeService.t("definedName.defaultName") + i;
|
|
101
|
+
const newName = localeService.t("sheets.definedName.defaultName") + i;
|
|
83
102
|
if (definedNamesService.getValueByName(unitId, newName) == null) return newName;
|
|
84
103
|
i++;
|
|
85
104
|
}
|
|
@@ -579,7 +598,8 @@ let FSelection = _FSelection = class FSelection {
|
|
|
579
598
|
* @example
|
|
580
599
|
* ```ts
|
|
581
600
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
582
|
-
* const fWorksheet = fWorkbook.
|
|
601
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
602
|
+
* if (!fWorksheet) return;
|
|
583
603
|
* const fRange = fWorksheet.getRange('A10:B11');
|
|
584
604
|
* fRange.activate();
|
|
585
605
|
* const fSelection = fWorksheet.getSelection();
|
|
@@ -597,7 +617,8 @@ let FSelection = _FSelection = class FSelection {
|
|
|
597
617
|
* @example
|
|
598
618
|
* ```ts
|
|
599
619
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
600
|
-
* const fWorksheet = fWorkbook.
|
|
620
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
621
|
+
* if (!fWorksheet) return;
|
|
601
622
|
* const fSelection = fWorksheet.getSelection();
|
|
602
623
|
* const activeRangeList = fSelection.getActiveRangeList();
|
|
603
624
|
* activeRangeList.forEach((range) => {
|
|
@@ -616,7 +637,8 @@ let FSelection = _FSelection = class FSelection {
|
|
|
616
637
|
* @example
|
|
617
638
|
* ```ts
|
|
618
639
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
619
|
-
* const fWorksheet = fWorkbook.
|
|
640
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
641
|
+
* if (!fWorksheet) return;
|
|
620
642
|
* const fRange = fWorksheet.getRange('A10:B11');
|
|
621
643
|
* fRange.activate();
|
|
622
644
|
* const fSelection = fWorksheet.getSelection();
|
|
@@ -637,10 +659,11 @@ let FSelection = _FSelection = class FSelection {
|
|
|
637
659
|
* @example
|
|
638
660
|
* ```ts
|
|
639
661
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
640
|
-
* const fWorksheet = fWorkbook.
|
|
662
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
663
|
+
* if (!fWorksheet) return;
|
|
641
664
|
* const fSelection = fWorksheet.getSelection();
|
|
642
665
|
* const activeSheet = fSelection.getActiveSheet();
|
|
643
|
-
* console.log(activeSheet.equalTo(fWorksheet));
|
|
666
|
+
* console.log(activeSheet.equalTo(fWorksheet));
|
|
644
667
|
* ```
|
|
645
668
|
*/
|
|
646
669
|
getActiveSheet() {
|
|
@@ -654,7 +677,8 @@ let FSelection = _FSelection = class FSelection {
|
|
|
654
677
|
* @example
|
|
655
678
|
* ```ts
|
|
656
679
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
657
|
-
* const fWorksheet = fWorkbook.
|
|
680
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
681
|
+
* if (!fWorksheet) return;
|
|
658
682
|
* const fRange = fWorksheet.getRange('A10:B11');
|
|
659
683
|
* fRange.activate();
|
|
660
684
|
* const cell = fWorksheet.getRange('B11');
|
|
@@ -705,7 +729,8 @@ let FSelection = _FSelection = class FSelection {
|
|
|
705
729
|
* @example
|
|
706
730
|
* ```ts
|
|
707
731
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
708
|
-
* const fWorksheet = fWorkbook.
|
|
732
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
733
|
+
* if (!fWorksheet) return;
|
|
709
734
|
* // make sure the active cell is A1 and selection is A1:B2
|
|
710
735
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
711
736
|
* fRange.activate();
|
|
@@ -1050,7 +1075,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
|
|
|
1050
1075
|
* @example
|
|
1051
1076
|
* ```ts
|
|
1052
1077
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1053
|
-
* const fWorksheet = fWorkbook.
|
|
1078
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1079
|
+
* if (!fWorksheet) return;
|
|
1054
1080
|
* const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
|
|
1055
1081
|
* // Update the ranges to A1:C3 for the first rule
|
|
1056
1082
|
* if (rules.length > 0) {
|
|
@@ -1086,7 +1112,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
|
|
|
1086
1112
|
* @example
|
|
1087
1113
|
* ```ts
|
|
1088
1114
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1089
|
-
* const fWorksheet = fWorkbook.
|
|
1115
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1116
|
+
* if (!fWorksheet) return;
|
|
1090
1117
|
* const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
|
|
1091
1118
|
* // Remove the first protection rule
|
|
1092
1119
|
* if (rules.length > 0) {
|
|
@@ -1125,7 +1152,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
|
|
|
1125
1152
|
* @example
|
|
1126
1153
|
* ```ts
|
|
1127
1154
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1128
|
-
* const fWorksheet = fWorkbook.
|
|
1155
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1156
|
+
* if (!fWorksheet) return;
|
|
1129
1157
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
1130
1158
|
* // First, create a protection rule
|
|
1131
1159
|
* const rule = await fRange.getRangePermission().protect({ name: 'My Range', allowEdit: true });
|
|
@@ -1163,7 +1191,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
|
|
|
1163
1191
|
* @example
|
|
1164
1192
|
* ```ts
|
|
1165
1193
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1166
|
-
* const fWorksheet = fWorkbook.
|
|
1194
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1195
|
+
* if (!fWorksheet) return;
|
|
1167
1196
|
* const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
|
|
1168
1197
|
* // Check if the first rule allows editing
|
|
1169
1198
|
* if (rules.length > 0) {
|
|
@@ -1190,7 +1219,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
|
|
|
1190
1219
|
* @example
|
|
1191
1220
|
* ```ts
|
|
1192
1221
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1193
|
-
* const fWorksheet = fWorkbook.
|
|
1222
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1223
|
+
* if (!fWorksheet) return;
|
|
1194
1224
|
* const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
|
|
1195
1225
|
* // Check if the first rule allows editing
|
|
1196
1226
|
* const rule = rules[0];
|
|
@@ -1208,7 +1238,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
|
|
|
1208
1238
|
* @example
|
|
1209
1239
|
* ```ts
|
|
1210
1240
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1211
|
-
* const fWorksheet = fWorkbook.
|
|
1241
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1242
|
+
* if (!fWorksheet) return;
|
|
1212
1243
|
* const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
|
|
1213
1244
|
* // Check if the first rule allows viewing
|
|
1214
1245
|
* const rule = rules[0];
|
|
@@ -1226,7 +1257,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
|
|
|
1226
1257
|
* @example
|
|
1227
1258
|
* ```ts
|
|
1228
1259
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1229
|
-
* const fWorksheet = fWorkbook.
|
|
1260
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1261
|
+
* if (!fWorksheet) return;
|
|
1230
1262
|
* const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
|
|
1231
1263
|
* // Check if the first rule allows managing collaborators
|
|
1232
1264
|
* const rule = rules[0];
|
|
@@ -1244,7 +1276,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
|
|
|
1244
1276
|
* @example
|
|
1245
1277
|
* ```ts
|
|
1246
1278
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1247
|
-
* const fWorksheet = fWorkbook.
|
|
1279
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1280
|
+
* if (!fWorksheet) return;
|
|
1248
1281
|
* const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
|
|
1249
1282
|
* // Check if the first rule allows deleting the rule
|
|
1250
1283
|
* const rule = rules[0];
|
|
@@ -1262,7 +1295,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
|
|
|
1262
1295
|
* @example
|
|
1263
1296
|
* ```ts
|
|
1264
1297
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1265
|
-
* const fWorksheet = fWorkbook.
|
|
1298
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1299
|
+
* if (!fWorksheet) return;
|
|
1266
1300
|
* const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
|
|
1267
1301
|
* // Get the permission snapshot of the first rule
|
|
1268
1302
|
* if (rules.length > 0) {
|
|
@@ -1312,7 +1346,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1312
1346
|
* @example
|
|
1313
1347
|
* ```ts
|
|
1314
1348
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1315
|
-
* const fWorksheet = fWorkbook.
|
|
1349
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1350
|
+
* if (!fWorksheet) return;
|
|
1316
1351
|
* if (fWorksheet.getWorksheetPermission().isProtected()) {
|
|
1317
1352
|
* console.log('Worksheet is protected');
|
|
1318
1353
|
* }
|
|
@@ -1329,7 +1364,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1329
1364
|
* @example
|
|
1330
1365
|
* ```ts
|
|
1331
1366
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1332
|
-
* const fWorksheet = fWorkbook.
|
|
1367
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1368
|
+
* if (!fWorksheet) return;
|
|
1333
1369
|
* const permission = fWorksheet.getWorksheetPermission();
|
|
1334
1370
|
*
|
|
1335
1371
|
* // Create worksheet protection with collaborators
|
|
@@ -1407,7 +1443,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1407
1443
|
* @example
|
|
1408
1444
|
* ```ts
|
|
1409
1445
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1410
|
-
* const fWorksheet = fWorkbook.
|
|
1446
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1447
|
+
* if (!fWorksheet) return;
|
|
1411
1448
|
* await fWorksheet.getWorksheetPermission().unprotect();
|
|
1412
1449
|
* ```
|
|
1413
1450
|
*/
|
|
@@ -1432,7 +1469,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1432
1469
|
* @example
|
|
1433
1470
|
* ```ts
|
|
1434
1471
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1435
|
-
* const fWorksheet = fWorkbook.
|
|
1472
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1473
|
+
* if (!fWorksheet) return;
|
|
1436
1474
|
* await fWorksheet.getWorksheetPermission().setMode('readOnly');
|
|
1437
1475
|
* ```
|
|
1438
1476
|
*/
|
|
@@ -1472,7 +1510,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1472
1510
|
* @example
|
|
1473
1511
|
* ```ts
|
|
1474
1512
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1475
|
-
* const fWorksheet = fWorkbook.
|
|
1513
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1514
|
+
* if (!fWorksheet) return;
|
|
1476
1515
|
* await fWorksheet.getWorksheetPermission().setReadOnly();
|
|
1477
1516
|
* ```
|
|
1478
1517
|
*/
|
|
@@ -1485,7 +1524,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1485
1524
|
* @example
|
|
1486
1525
|
* ```ts
|
|
1487
1526
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1488
|
-
* const fWorksheet = fWorkbook.
|
|
1527
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1528
|
+
* if (!fWorksheet) return;
|
|
1489
1529
|
* await fWorksheet.getWorksheetPermission().setEditable();
|
|
1490
1530
|
* ```
|
|
1491
1531
|
*/
|
|
@@ -1501,7 +1541,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1501
1541
|
* @example
|
|
1502
1542
|
* ```ts
|
|
1503
1543
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1504
|
-
* const fWorksheet = fWorkbook.
|
|
1544
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1545
|
+
* if (!fWorksheet) return;
|
|
1505
1546
|
* const permission = fWorksheet.getWorksheetPermission();
|
|
1506
1547
|
* await permission.setPoint(univerAPI.Enum.WorksheetPermissionPoint.InsertRow, false);
|
|
1507
1548
|
* ```
|
|
@@ -1536,7 +1577,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1536
1577
|
* @example
|
|
1537
1578
|
* ```ts
|
|
1538
1579
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1539
|
-
* const fWorksheet = fWorkbook.
|
|
1580
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1581
|
+
* if (!fWorksheet) return;
|
|
1540
1582
|
* if (fWorksheet.getWorksheetPermission().canEdit()) {
|
|
1541
1583
|
* console.log('Worksheet is editable');
|
|
1542
1584
|
* }
|
|
@@ -1553,7 +1595,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1553
1595
|
* @example
|
|
1554
1596
|
* ```ts
|
|
1555
1597
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1556
|
-
* const fWorksheet = fWorkbook.
|
|
1598
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1599
|
+
* if (!fWorksheet) return;
|
|
1557
1600
|
* // Check if cell C3 can be edited
|
|
1558
1601
|
* const fRange = fWorksheet.getRange('C3');
|
|
1559
1602
|
* const canEdit = fWorksheet.getWorksheetPermission().canEditCell(fRange.getRow(), fRange.getColumn());
|
|
@@ -1577,7 +1620,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1577
1620
|
* @example
|
|
1578
1621
|
* ```ts
|
|
1579
1622
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1580
|
-
* const fWorksheet = fWorkbook.
|
|
1623
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1624
|
+
* if (!fWorksheet) return;
|
|
1581
1625
|
* if (fWorksheet.getWorksheetPermission().canView()) {
|
|
1582
1626
|
* console.log('Worksheet is viewable');
|
|
1583
1627
|
* }
|
|
@@ -1593,7 +1637,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1593
1637
|
* @example
|
|
1594
1638
|
* ```ts
|
|
1595
1639
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1596
|
-
* const fWorksheet = fWorkbook.
|
|
1640
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1641
|
+
* if (!fWorksheet) return;
|
|
1597
1642
|
* // Check if cell C3 can be viewed
|
|
1598
1643
|
* const fRange = fWorksheet.getRange('C3');
|
|
1599
1644
|
* const canView = fWorksheet.getWorksheetPermission().canViewCell(fRange.getRow(), fRange.getColumn());
|
|
@@ -1618,7 +1663,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1618
1663
|
* @example
|
|
1619
1664
|
* ```ts
|
|
1620
1665
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1621
|
-
* const fWorksheet = fWorkbook.
|
|
1666
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1667
|
+
* if (!fWorksheet) return;
|
|
1622
1668
|
* const permission = fWorksheet.getWorksheetPermission();
|
|
1623
1669
|
* const canInsertRow = permission.getPoint(univerAPI.Enum.WorksheetPermissionPoint.InsertRow);
|
|
1624
1670
|
* console.log(canInsertRow);
|
|
@@ -1638,7 +1684,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1638
1684
|
* @example
|
|
1639
1685
|
* ```ts
|
|
1640
1686
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1641
|
-
* const fWorksheet = fWorkbook.
|
|
1687
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1688
|
+
* if (!fWorksheet) return;
|
|
1642
1689
|
* const snapshot = fWorksheet.getWorksheetPermission().getSnapshot();
|
|
1643
1690
|
* console.log(snapshot);
|
|
1644
1691
|
* ```
|
|
@@ -1657,7 +1704,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1657
1704
|
* @returns {Promise<void>} A promise that resolves when the configuration is applied.
|
|
1658
1705
|
* @example
|
|
1659
1706
|
* ```ts
|
|
1660
|
-
* const worksheet = univerAPI.getActiveWorkbook()?.
|
|
1707
|
+
* const worksheet = univerAPI.getActiveWorkbook()?.getSheetByName('Sheet1');
|
|
1708
|
+
* if (!worksheet) return;
|
|
1661
1709
|
* const permission = worksheet?.getWorksheetPermission();
|
|
1662
1710
|
* await permission?.applyConfig({
|
|
1663
1711
|
* mode: 'readOnly',
|
|
@@ -1688,7 +1736,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1688
1736
|
* @example
|
|
1689
1737
|
* ```ts
|
|
1690
1738
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1691
|
-
* const fWorksheet = fWorkbook.
|
|
1739
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1740
|
+
* if (!fWorksheet) return;
|
|
1692
1741
|
* const rules = await fWorksheet.getWorksheetPermission().protectRanges([
|
|
1693
1742
|
* {
|
|
1694
1743
|
* ranges: [fWorksheet.getRange('A1:B2')],
|
|
@@ -1777,7 +1826,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1777
1826
|
* @example
|
|
1778
1827
|
* ```ts
|
|
1779
1828
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1780
|
-
* const fWorksheet = fWorkbook.
|
|
1829
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1830
|
+
* if (!fWorksheet) return;
|
|
1781
1831
|
* const worksheetPermission = fWorksheet.getWorksheetPermission();
|
|
1782
1832
|
* const rules = await worksheetPermission.listRangeProtectionRules();
|
|
1783
1833
|
* // Unprotect the first rule as an example
|
|
@@ -1803,7 +1853,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1803
1853
|
* @example
|
|
1804
1854
|
* ```ts
|
|
1805
1855
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1806
|
-
* const fWorksheet = fWorkbook.
|
|
1856
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1857
|
+
* if (!fWorksheet) return;
|
|
1807
1858
|
* const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
|
|
1808
1859
|
* console.log(rules);
|
|
1809
1860
|
* ```
|
|
@@ -1822,7 +1873,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1822
1873
|
* @example
|
|
1823
1874
|
* ```ts
|
|
1824
1875
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1825
|
-
* const fWorksheet = fWorkbook.
|
|
1876
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1877
|
+
* if (!fWorksheet) return;
|
|
1826
1878
|
* // Get debug info for cell C3
|
|
1827
1879
|
* const fRange = fWorksheet.getRange('C3');
|
|
1828
1880
|
* const debugInfo = await fWorksheet.getWorksheetPermission().debugCellPermission(fRange.getRow(), fRange.getColumn());
|
|
@@ -1982,7 +2034,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
1982
2034
|
* @returns This sheet, for chaining
|
|
1983
2035
|
* @example
|
|
1984
2036
|
* ```ts
|
|
1985
|
-
* const fWorkSheet = univerAPI.getActiveWorkbook().
|
|
2037
|
+
* const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2038
|
+
* if (!fWorkSheet) return;
|
|
1986
2039
|
* fWorkSheet.setActiveSelection(fWorkSheet.getRange('A10:B10'));
|
|
1987
2040
|
* ```
|
|
1988
2041
|
*/
|
|
@@ -2001,7 +2054,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2001
2054
|
* @returns {Worksheet} The worksheet instance.
|
|
2002
2055
|
* @example
|
|
2003
2056
|
* ```typescript
|
|
2004
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2057
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2058
|
+
* if (!fWorksheet) return;
|
|
2005
2059
|
* const sheet = fWorksheet.getSheet();
|
|
2006
2060
|
* console.log(sheet);
|
|
2007
2061
|
* ```
|
|
@@ -2014,7 +2068,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2014
2068
|
* @returns {Injector} The injector instance.
|
|
2015
2069
|
* @example
|
|
2016
2070
|
* ```typescript
|
|
2017
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2071
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2072
|
+
* if (!fWorksheet) return;
|
|
2018
2073
|
* const injector = fWorksheet.getInject();
|
|
2019
2074
|
* console.log(injector);
|
|
2020
2075
|
* ```
|
|
@@ -2027,7 +2082,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2027
2082
|
* @returns {Workbook} The workbook instance.
|
|
2028
2083
|
* @example
|
|
2029
2084
|
* ```typescript
|
|
2030
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2085
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2086
|
+
* if (!fWorksheet) return;
|
|
2031
2087
|
* const workbook = fWorksheet.getWorkbook();
|
|
2032
2088
|
* console.log(workbook);
|
|
2033
2089
|
* ```
|
|
@@ -2040,7 +2096,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2040
2096
|
* @returns {string} The id of the worksheet.
|
|
2041
2097
|
* @example
|
|
2042
2098
|
* ```typescript
|
|
2043
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2099
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2100
|
+
* if (!fWorksheet) return;
|
|
2044
2101
|
* const sheetId = fWorksheet.getSheetId();
|
|
2045
2102
|
* console.log(sheetId);
|
|
2046
2103
|
* ```
|
|
@@ -2053,7 +2110,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2053
2110
|
* @returns {string} The name of the worksheet.
|
|
2054
2111
|
* @example
|
|
2055
2112
|
* ```typescript
|
|
2056
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2113
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2114
|
+
* if (!fWorksheet) return;
|
|
2057
2115
|
* const sheetName = fWorksheet.getSheetName();
|
|
2058
2116
|
* console.log(sheetName);
|
|
2059
2117
|
* ```
|
|
@@ -2066,7 +2124,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2066
2124
|
* @returns {FSelection} return the current selections of the worksheet or null if there is no selection.
|
|
2067
2125
|
* @example
|
|
2068
2126
|
* ```typescript
|
|
2069
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2127
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2128
|
+
* if (!fWorksheet) return;
|
|
2070
2129
|
* const selection = fWorksheet.getSelection();
|
|
2071
2130
|
* console.log(selection);
|
|
2072
2131
|
* ```
|
|
@@ -2081,7 +2140,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2081
2140
|
* @returns {IStyleData} Default style of the worksheet.
|
|
2082
2141
|
* @example
|
|
2083
2142
|
* ```typescript
|
|
2084
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2143
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2144
|
+
* if (!fWorksheet) return;
|
|
2085
2145
|
* const defaultStyle = fWorksheet.getDefaultStyle();
|
|
2086
2146
|
* console.log(defaultStyle);
|
|
2087
2147
|
* ```
|
|
@@ -2096,7 +2156,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2096
2156
|
* @returns {(Nullable<IStyleData> | string)} The default style of the worksheet row name or style data
|
|
2097
2157
|
* @example
|
|
2098
2158
|
* ```typescript
|
|
2099
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2159
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2160
|
+
* if (!fWorksheet) return;
|
|
2100
2161
|
* // Get default style for row 0 (1)
|
|
2101
2162
|
* const rowStyle = fWorksheet.getRowDefaultStyle(0);
|
|
2102
2163
|
* console.log(rowStyle);
|
|
@@ -2115,7 +2176,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2115
2176
|
* @returns {(Nullable<IStyleData> | string)} The default style of the worksheet column name or style data
|
|
2116
2177
|
* @example
|
|
2117
2178
|
* ```typescript
|
|
2118
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2179
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2180
|
+
* if (!fWorksheet) return;
|
|
2119
2181
|
* // Get default style for column 0 (A)
|
|
2120
2182
|
* const colStyle = fWorksheet.getColumnDefaultStyle(0);
|
|
2121
2183
|
* console.log(colStyle);
|
|
@@ -2133,7 +2195,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2133
2195
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
2134
2196
|
* @example
|
|
2135
2197
|
* ```typescript
|
|
2136
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2198
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2199
|
+
* if (!fWorksheet) return;
|
|
2137
2200
|
* fWorksheet.setDefaultStyle('default');
|
|
2138
2201
|
* // or
|
|
2139
2202
|
* // fWorksheet.setDefaultStyle({fs: 12, ff: 'Arial'});
|
|
@@ -2158,7 +2221,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2158
2221
|
* @example
|
|
2159
2222
|
* ```ts
|
|
2160
2223
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
2161
|
-
* const fWorksheet = fWorkbook.
|
|
2224
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
2225
|
+
* if (!fWorksheet) return;
|
|
2162
2226
|
* fWorksheet.setColumnDefaultStyle(0, 'default');
|
|
2163
2227
|
* // or
|
|
2164
2228
|
* // fWorksheet.setColumnDefaultStyle(0, {fs: 12, ff: 'Arial'});
|
|
@@ -2181,7 +2245,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2181
2245
|
* @example
|
|
2182
2246
|
* ```ts
|
|
2183
2247
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
2184
|
-
* const fWorksheet = fWorkbook.
|
|
2248
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
2249
|
+
* if (!fWorksheet) return;
|
|
2185
2250
|
* fWorksheet.setRowDefaultStyle(0, 'default');
|
|
2186
2251
|
* // or
|
|
2187
2252
|
* // fWorksheet.setRowDefaultStyle(0, {fs: 12, ff: 'Arial'});
|
|
@@ -2235,7 +2300,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2235
2300
|
* @returns {number} The maximum columns count of the sheet
|
|
2236
2301
|
* @example
|
|
2237
2302
|
* ```typescript
|
|
2238
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2303
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2304
|
+
* if (!fWorksheet) return;
|
|
2239
2305
|
* const totalColumns = fWorksheet.getMaxColumns();
|
|
2240
2306
|
* console.log(`Sheet has ${totalColumns} columns`);
|
|
2241
2307
|
* ```
|
|
@@ -2248,7 +2314,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2248
2314
|
* @returns {number}The maximum rows count of the sheet
|
|
2249
2315
|
* @example
|
|
2250
2316
|
* ```typescript
|
|
2251
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2317
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2318
|
+
* if (!fWorksheet) return;
|
|
2252
2319
|
* const totalRows = fWorksheet.getMaxRows();
|
|
2253
2320
|
* console.log(`Sheet has ${totalRows} rows`);
|
|
2254
2321
|
* ```
|
|
@@ -2262,7 +2329,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2262
2329
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
2263
2330
|
* @example
|
|
2264
2331
|
* ```typescript
|
|
2265
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2332
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2333
|
+
* if (!fWorksheet) return;
|
|
2266
2334
|
* // Insert a row after the third row
|
|
2267
2335
|
* fWorksheet.insertRowAfter(2);
|
|
2268
2336
|
* // Insert a row after the first row
|
|
@@ -2278,7 +2346,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2278
2346
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
2279
2347
|
* @example
|
|
2280
2348
|
* ```typescript
|
|
2281
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2349
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2350
|
+
* if (!fWorksheet) return;
|
|
2282
2351
|
* // Insert a row before the third row
|
|
2283
2352
|
* fWorksheet.insertRowBefore(2);
|
|
2284
2353
|
* // Insert a row before the first row
|
|
@@ -2295,7 +2364,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2295
2364
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
2296
2365
|
* @example
|
|
2297
2366
|
* ```typescript
|
|
2298
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2367
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2368
|
+
* if (!fWorksheet) return;
|
|
2299
2369
|
* // Insert 3 rows before the third row
|
|
2300
2370
|
* fWorksheet.insertRows(2, 3);
|
|
2301
2371
|
* // Insert 1 row before the first row
|
|
@@ -2312,7 +2382,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2312
2382
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
2313
2383
|
* @example
|
|
2314
2384
|
* ```typescript
|
|
2315
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2385
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2386
|
+
* if (!fWorksheet) return;
|
|
2316
2387
|
* // Insert 3 rows after the third row
|
|
2317
2388
|
* fWorksheet.insertRowsAfter(2, 3);
|
|
2318
2389
|
* // Insert 1 row after the first row
|
|
@@ -2349,7 +2420,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2349
2420
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
2350
2421
|
* @example
|
|
2351
2422
|
* ```typescript
|
|
2352
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2423
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2424
|
+
* if (!fWorksheet) return;
|
|
2353
2425
|
* // Insert 3 rows before the third row
|
|
2354
2426
|
* fWorksheet.insertRowsBefore(2, 3);
|
|
2355
2427
|
* // Insert 1 row before the first row
|
|
@@ -2385,7 +2457,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2385
2457
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
2386
2458
|
* @example
|
|
2387
2459
|
* ```typescript
|
|
2388
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2460
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2461
|
+
* if (!fWorksheet) return;
|
|
2389
2462
|
* // Delete the third row
|
|
2390
2463
|
* fWorksheet.deleteRow(2);
|
|
2391
2464
|
* // Delete the first row
|
|
@@ -2402,7 +2475,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2402
2475
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
2403
2476
|
* @example
|
|
2404
2477
|
* ```typescript
|
|
2405
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2478
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2479
|
+
* if (!fWorksheet) return;
|
|
2406
2480
|
* // Delete 3 rows at row index 2 (rows 3-5)
|
|
2407
2481
|
* fWorksheet.deleteRows(2, 3);
|
|
2408
2482
|
* // Delete 1 row at row index 0 (first row)
|
|
@@ -2429,7 +2503,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2429
2503
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
2430
2504
|
* @example
|
|
2431
2505
|
* ```typescript
|
|
2432
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2506
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2507
|
+
* if (!fWorksheet) return;
|
|
2433
2508
|
* // Delete rows at index 2, and range from index 4 to 6 (rows 3, 5-7)
|
|
2434
2509
|
* fWorksheet.deleteRowsByPoints([2, [4, 6]]);
|
|
2435
2510
|
* ```
|
|
@@ -2447,7 +2522,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2447
2522
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
2448
2523
|
* @example
|
|
2449
2524
|
* ```typescript
|
|
2450
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2525
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2526
|
+
* if (!fWorksheet) return;
|
|
2451
2527
|
* // Move 3 rows at row index 2 (rows 3-5) to row index 0
|
|
2452
2528
|
* const rowSpec1 = fWorksheet.getRange('3:5');
|
|
2453
2529
|
* fWorksheet.moveRows(rowSpec1, 0);
|
|
@@ -2482,7 +2558,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2482
2558
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
2483
2559
|
* @example
|
|
2484
2560
|
* ```typescript
|
|
2485
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2561
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2562
|
+
* if (!fWorksheet) return;
|
|
2486
2563
|
* // Hide 3 rows starting from row index 1 (rows 2-4)
|
|
2487
2564
|
* const row1 = fWorksheet.getRange('2:4');
|
|
2488
2565
|
* fWorksheet.hideRow(row1);
|
|
@@ -2509,7 +2586,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2509
2586
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
2510
2587
|
* @example
|
|
2511
2588
|
* ```typescript
|
|
2512
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2589
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2590
|
+
* if (!fWorksheet) return;
|
|
2513
2591
|
* // Hide 3 rows starting from row index 1 (rows 2-4)
|
|
2514
2592
|
* fWorksheet.hideRows(1, 3);
|
|
2515
2593
|
* // Hide single row at index 0 (first row)
|
|
@@ -2539,7 +2617,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2539
2617
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
2540
2618
|
* @example
|
|
2541
2619
|
* ```typescript
|
|
2542
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2620
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2621
|
+
* if (!fWorksheet) return;
|
|
2543
2622
|
* // Unhide 3 rows starting from row index 1 (rows 2-4)
|
|
2544
2623
|
* const row1 = fWorksheet.getRange('2:4');
|
|
2545
2624
|
* fWorksheet.unhideRow(row1);
|
|
@@ -2566,7 +2645,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2566
2645
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
2567
2646
|
* @example
|
|
2568
2647
|
* ```typescript
|
|
2569
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2648
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2649
|
+
* if (!fWorksheet) return;
|
|
2570
2650
|
* // Show 3 rows starting from row index 1 (rows 2-4)
|
|
2571
2651
|
* fWorksheet.showRows(1, 3);
|
|
2572
2652
|
* // Show single row at index 0 (first row)
|
|
@@ -2597,7 +2677,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2597
2677
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
2598
2678
|
* @example
|
|
2599
2679
|
* ```typescript
|
|
2600
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2680
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2681
|
+
* if (!fWorksheet) return;
|
|
2601
2682
|
* // Set the height of the second row to 30 pixels
|
|
2602
2683
|
* fWorksheet.setRowHeight(1, 30);
|
|
2603
2684
|
* // Set the height of the first row to 20 pixels
|
|
@@ -2614,7 +2695,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2614
2695
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
2615
2696
|
* @example
|
|
2616
2697
|
* ```ts
|
|
2617
|
-
* const fWorkSheet = univerAPI.getActiveWorkbook().
|
|
2698
|
+
* const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2699
|
+
* if (!fWorkSheet) return;
|
|
2618
2700
|
* fWorkSheet.autoFitRow(24);
|
|
2619
2701
|
* ```
|
|
2620
2702
|
*/
|
|
@@ -2650,7 +2732,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2650
2732
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
2651
2733
|
* @example
|
|
2652
2734
|
* ```typescript
|
|
2653
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2735
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2736
|
+
* if (!fWorksheet) return;
|
|
2654
2737
|
* fWorksheet.setRowHeights(1, 10, 30);
|
|
2655
2738
|
* ```
|
|
2656
2739
|
*/
|
|
@@ -2692,7 +2775,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2692
2775
|
* @example
|
|
2693
2776
|
* ```typescript
|
|
2694
2777
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
2695
|
-
* const fWorksheet = fWorkbook.
|
|
2778
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
2779
|
+
* if (!fWorksheet) return;
|
|
2696
2780
|
*
|
|
2697
2781
|
* // Set the value of the cell A1 to 'Hello, Univer!', set the font size to 30 and font weight to bold
|
|
2698
2782
|
* const fRange = fWorksheet.getRange('A1');
|
|
@@ -2712,7 +2796,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2712
2796
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
2713
2797
|
* @example
|
|
2714
2798
|
* ```typescript
|
|
2715
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2799
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2800
|
+
* if (!fWorksheet) return;
|
|
2716
2801
|
* fWorksheet.setRowAutoHeight(1, 10);
|
|
2717
2802
|
* ```
|
|
2718
2803
|
*/
|
|
@@ -2738,7 +2823,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2738
2823
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
2739
2824
|
* @example
|
|
2740
2825
|
* ```typescript
|
|
2741
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2826
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2827
|
+
* if (!fWorksheet) return;
|
|
2742
2828
|
* const ranges = [
|
|
2743
2829
|
* { startRow: 1, endRow: 10, startColumn: 0, endColumn: 10 },
|
|
2744
2830
|
* { startRow: 11, endRow: 20, startColumn: 0, endColumn: 10 },
|
|
@@ -2764,7 +2850,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2764
2850
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
2765
2851
|
* @example
|
|
2766
2852
|
* ```typescript
|
|
2767
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2853
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2854
|
+
* if (!fWorksheet) return;
|
|
2768
2855
|
* fWorksheet.setRowHeightsForced(1, 10, 30);
|
|
2769
2856
|
* ```
|
|
2770
2857
|
*/
|
|
@@ -2791,11 +2878,13 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2791
2878
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
2792
2879
|
* @example
|
|
2793
2880
|
* ```typescript
|
|
2794
|
-
* const fWorkSheet = univerAPI.getActiveWorkbook().
|
|
2881
|
+
* const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2882
|
+
* if (!fWorkSheet) return;
|
|
2795
2883
|
* fWorkSheet.setRowCustom({ 0: { key: 'value' } });
|
|
2796
2884
|
* ```
|
|
2797
2885
|
*/
|
|
2798
2886
|
setRowCustom(custom) {
|
|
2887
|
+
this._logService.warn(SHEETS_CUSTOM_FIELD_WARNING_MESSAGE);
|
|
2799
2888
|
const unitId = this._workbook.getUnitId();
|
|
2800
2889
|
const subUnitId = this._worksheet.getSheetId();
|
|
2801
2890
|
const rowData = {};
|
|
@@ -2814,7 +2903,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2814
2903
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
2815
2904
|
* @example
|
|
2816
2905
|
* ```typescript
|
|
2817
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2906
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2907
|
+
* if (!fWorksheet) return;
|
|
2818
2908
|
* // Insert a column after column C
|
|
2819
2909
|
* fWorksheet.insertColumnAfter(2);
|
|
2820
2910
|
* // Insert a column after column A
|
|
@@ -2830,7 +2920,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2830
2920
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
2831
2921
|
* @example
|
|
2832
2922
|
* ```typescript
|
|
2833
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2923
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2924
|
+
* if (!fWorksheet) return;
|
|
2834
2925
|
* // Insert a column before column C
|
|
2835
2926
|
* fWorksheet.insertColumnBefore(2);
|
|
2836
2927
|
* // Insert a column before column A
|
|
@@ -2847,7 +2938,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2847
2938
|
* @returns {FWorksheet} This sheet, for chaining
|
|
2848
2939
|
* @example
|
|
2849
2940
|
* ```typescript
|
|
2850
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2941
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2942
|
+
* if (!fWorksheet) return;
|
|
2851
2943
|
* // Insert 3 columns before column C
|
|
2852
2944
|
* fWorksheet.insertColumns(2, 3);
|
|
2853
2945
|
* // Insert 1 column before column A
|
|
@@ -2864,7 +2956,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2864
2956
|
* @returns {FWorksheet} This sheet, for chaining
|
|
2865
2957
|
* @example
|
|
2866
2958
|
* ```typescript
|
|
2867
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2959
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2960
|
+
* if (!fWorksheet) return;
|
|
2868
2961
|
* // Insert 3 columns after column C
|
|
2869
2962
|
* fWorksheet.insertColumnsAfter(2, 3);
|
|
2870
2963
|
* // Insert 1 column after column A
|
|
@@ -2901,7 +2994,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2901
2994
|
* @returns {FWorksheet} This sheet, for chaining
|
|
2902
2995
|
* @example
|
|
2903
2996
|
* ```typescript
|
|
2904
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
2997
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
2998
|
+
* if (!fWorksheet) return;
|
|
2905
2999
|
* // Insert 3 columns before column C
|
|
2906
3000
|
* fWorksheet.insertColumnsBefore(2, 3);
|
|
2907
3001
|
* // Insert 1 column before column A
|
|
@@ -2937,7 +3031,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2937
3031
|
* @returns {FWorksheet} This sheet, for chaining
|
|
2938
3032
|
* @example
|
|
2939
3033
|
* ```typescript
|
|
2940
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
3034
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3035
|
+
* if (!fWorksheet) return;
|
|
2941
3036
|
* // Delete column C
|
|
2942
3037
|
* fWorksheet.deleteColumn(2);
|
|
2943
3038
|
* // Delete column A
|
|
@@ -2954,7 +3049,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2954
3049
|
* @returns {FWorksheet} This sheet, for chaining
|
|
2955
3050
|
* @example
|
|
2956
3051
|
* ```typescript
|
|
2957
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
3052
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3053
|
+
* if (!fWorksheet) return;
|
|
2958
3054
|
* // Delete 3 columns at column index 2 (columns C, D, E)
|
|
2959
3055
|
* fWorksheet.deleteColumns(2, 3);
|
|
2960
3056
|
* // Delete 1 column at column index 0 (column A)
|
|
@@ -2981,7 +3077,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2981
3077
|
* @returns {FWorksheet} This sheet, for chaining
|
|
2982
3078
|
* @example
|
|
2983
3079
|
* ```typescript
|
|
2984
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
3080
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3081
|
+
* if (!fWorksheet) return;
|
|
2985
3082
|
* // Delete columns at index 2, and range from index 4 to 6 (columns C, E-G)
|
|
2986
3083
|
* fWorksheet.deleteColumnsByPoints([2, [4, 6]]);
|
|
2987
3084
|
* ```
|
|
@@ -2999,7 +3096,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2999
3096
|
* @returns {FWorksheet} This sheet, for chaining
|
|
3000
3097
|
* @example
|
|
3001
3098
|
* ```typescript
|
|
3002
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
3099
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3100
|
+
* if (!fWorksheet) return;
|
|
3003
3101
|
* // Move columns C, D, E to column index 2 (columns B, C, D)
|
|
3004
3102
|
* const columnSpec1 = fWorksheet.getRange('C:E');
|
|
3005
3103
|
* fWorksheet.moveColumns(columnSpec1, 1);
|
|
@@ -3034,7 +3132,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3034
3132
|
* @returns {FWorksheet} This sheet, for chaining
|
|
3035
3133
|
* @example
|
|
3036
3134
|
* ```typescript
|
|
3037
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
3135
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3136
|
+
* if (!fWorksheet) return;
|
|
3038
3137
|
* // Hide columns C, D, E
|
|
3039
3138
|
* const column1 = fWorksheet.getRange('C:E');
|
|
3040
3139
|
* fWorksheet.hideColumn(column1);
|
|
@@ -3061,7 +3160,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3061
3160
|
* @returns {FWorksheet} This sheet, for chaining
|
|
3062
3161
|
* @example
|
|
3063
3162
|
* ```typescript
|
|
3064
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
3163
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3164
|
+
* if (!fWorksheet) return;
|
|
3065
3165
|
* // Hide columns C, D, E
|
|
3066
3166
|
* fWorksheet.hideColumns(2, 3);
|
|
3067
3167
|
* // Hide column A
|
|
@@ -3091,7 +3191,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3091
3191
|
* @returns {FWorksheet} This sheet, for chaining
|
|
3092
3192
|
* @example
|
|
3093
3193
|
* ```typescript
|
|
3094
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
3194
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3195
|
+
* if (!fWorksheet) return;
|
|
3095
3196
|
* // Unhide columns C, D, E
|
|
3096
3197
|
* const column1 = fWorksheet.getRange('C:E');
|
|
3097
3198
|
* fWorksheet.unhideColumn(column1);
|
|
@@ -3118,7 +3219,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3118
3219
|
* @returns {FWorksheet} This sheet, for chaining
|
|
3119
3220
|
* @example
|
|
3120
3221
|
* ```typescript
|
|
3121
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
3222
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3223
|
+
* if (!fWorksheet) return;
|
|
3122
3224
|
* // Unhide columns C, D, E
|
|
3123
3225
|
* fWorksheet.showColumns(2, 3);
|
|
3124
3226
|
* // Unhide column A
|
|
@@ -3149,7 +3251,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3149
3251
|
* @returns {FWorksheet} This sheet, for chaining
|
|
3150
3252
|
* @example
|
|
3151
3253
|
* ```typescript
|
|
3152
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
3254
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3255
|
+
* if (!fWorksheet) return;
|
|
3153
3256
|
* // Set width of column B to 100 pixels
|
|
3154
3257
|
* fWorksheet.setColumnWidth(1, 100);
|
|
3155
3258
|
* ```
|
|
@@ -3165,7 +3268,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3165
3268
|
* @returns {FWorksheet} This sheet, for chaining
|
|
3166
3269
|
* @example
|
|
3167
3270
|
* ```typescript
|
|
3168
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
3271
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3272
|
+
* if (!fWorksheet) return;
|
|
3169
3273
|
* // Set width of columns B-D (index 1-3) to 100 pixels
|
|
3170
3274
|
* fWorksheet.setColumnWidths(1, 3, 100);
|
|
3171
3275
|
* ```
|
|
@@ -3194,7 +3298,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3194
3298
|
* @example
|
|
3195
3299
|
* ```typescript
|
|
3196
3300
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3197
|
-
* const fWorksheet = fWorkbook.
|
|
3301
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
3302
|
+
* if (!fWorksheet) return;
|
|
3198
3303
|
*
|
|
3199
3304
|
* // Set the long text value in cell A1
|
|
3200
3305
|
* const fRange = fWorksheet.getRange('A1');
|
|
@@ -3216,11 +3321,13 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3216
3321
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
3217
3322
|
* @example
|
|
3218
3323
|
* ```ts
|
|
3219
|
-
* const fWorkSheet = univerAPI.getActiveWorkbook().
|
|
3324
|
+
* const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3325
|
+
* if (!fWorkSheet) return;
|
|
3220
3326
|
* fWorkSheet.setColumnCustom({ 0: { key: 'value' } });
|
|
3221
3327
|
* ```
|
|
3222
3328
|
*/
|
|
3223
3329
|
setColumnCustom(custom) {
|
|
3330
|
+
this._logService.warn(SHEETS_CUSTOM_FIELD_WARNING_MESSAGE);
|
|
3224
3331
|
const unitId = this._workbook.getUnitId();
|
|
3225
3332
|
const subUnitId = this._worksheet.getSheetId();
|
|
3226
3333
|
const columnData = {};
|
|
@@ -3238,7 +3345,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3238
3345
|
* @returns {FRange[]} All the merged cells in the worksheet
|
|
3239
3346
|
* @example
|
|
3240
3347
|
* ```ts
|
|
3241
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
3348
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3349
|
+
* if (!fWorksheet) return;
|
|
3242
3350
|
* // Get all merged ranges in the sheet
|
|
3243
3351
|
* const mergedData = fWorksheet.getMergeData();
|
|
3244
3352
|
* // Process each merged range
|
|
@@ -3255,7 +3363,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3255
3363
|
* @returns {FRange[]} all merged cells
|
|
3256
3364
|
* @example
|
|
3257
3365
|
* ```typescript
|
|
3258
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
3366
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3367
|
+
* if (!fWorksheet) return;
|
|
3259
3368
|
* // Get all merged ranges in the sheet
|
|
3260
3369
|
* const mergedRanges = fWorksheet.getMergedRanges();
|
|
3261
3370
|
* // Process each merged range
|
|
@@ -3274,7 +3383,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3274
3383
|
* @returns {FRange|undefined} The merged cell data, or undefined if the cell is not merged
|
|
3275
3384
|
* @example
|
|
3276
3385
|
* ```ts
|
|
3277
|
-
* const fWorkSheet = univerAPI.getActiveWorkbook().
|
|
3386
|
+
* const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3387
|
+
* if (!fWorkSheet) return;
|
|
3278
3388
|
* const merge = fWorkSheet.getCellMergeData(0, 0);
|
|
3279
3389
|
* if (merge) {
|
|
3280
3390
|
* console.log('Merged range:', merge.getA1Notation());
|
|
@@ -3290,7 +3400,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3290
3400
|
* @returns {FRange | null} the active range
|
|
3291
3401
|
* @example
|
|
3292
3402
|
* ```typescript
|
|
3293
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
3403
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3404
|
+
* if (!fWorksheet) return;
|
|
3294
3405
|
* // Get the currently active range
|
|
3295
3406
|
* const activeRange = fWorksheet.getActiveRange();
|
|
3296
3407
|
* if (activeRange) {
|
|
@@ -3307,7 +3418,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3307
3418
|
* @returns {FWorksheet} This sheet, for chaining
|
|
3308
3419
|
* @example
|
|
3309
3420
|
* ```ts
|
|
3310
|
-
* const fWorkSheet = univerAPI.getActiveWorkbook().
|
|
3421
|
+
* const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3422
|
+
* if (!fWorkSheet) return;
|
|
3311
3423
|
* fWorkSheet.setActiveRange(fWorkSheet.getRange('A10:B10'));
|
|
3312
3424
|
* ```
|
|
3313
3425
|
*/
|
|
@@ -3322,7 +3434,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3322
3434
|
* @returns {FRange | null} The active cell
|
|
3323
3435
|
* @example
|
|
3324
3436
|
* ```typescript
|
|
3325
|
-
* const fWorkSheet = univerAPI.getActiveWorkbook().
|
|
3437
|
+
* const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3438
|
+
* if (!fWorkSheet) return;
|
|
3326
3439
|
* console.log(fWorkSheet.getActiveCell().getA1Notation());
|
|
3327
3440
|
* ```
|
|
3328
3441
|
*/
|
|
@@ -3336,7 +3449,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3336
3449
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
3337
3450
|
* @example
|
|
3338
3451
|
* ```typescript
|
|
3339
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
3452
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3453
|
+
* if (!fWorksheet) return;
|
|
3340
3454
|
* // Freeze first 3 rows and 2 columns
|
|
3341
3455
|
* fWorksheet.setFreeze({
|
|
3342
3456
|
* startRow: 3,
|
|
@@ -3359,7 +3473,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3359
3473
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
3360
3474
|
* @example
|
|
3361
3475
|
* ```typescript
|
|
3362
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
3476
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3477
|
+
* if (!fWorksheet) return;
|
|
3363
3478
|
* // Cancel freeze
|
|
3364
3479
|
* fWorksheet.cancelFreeze();
|
|
3365
3480
|
* ```
|
|
@@ -3376,7 +3491,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3376
3491
|
* @returns {IFreeze} The freeze state of the current sheet
|
|
3377
3492
|
* @example
|
|
3378
3493
|
* ```typescript
|
|
3379
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
3494
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3495
|
+
* if (!fWorksheet) return;
|
|
3380
3496
|
* // Get the freeze state of the current sheet
|
|
3381
3497
|
* const freeze = fWorksheet.getFreeze();
|
|
3382
3498
|
* console.log(freeze);
|
|
@@ -3436,7 +3552,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3436
3552
|
* @returns {number} The number of frozen columns, returns 0 if no columns are frozen.
|
|
3437
3553
|
* @example
|
|
3438
3554
|
* ```typescript
|
|
3439
|
-
* const fWorkSheet = univerAPI.getActiveWorkbook().
|
|
3555
|
+
* const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3556
|
+
* if (!fWorkSheet) return;
|
|
3440
3557
|
* // Get the number of frozen columns
|
|
3441
3558
|
* const frozenColumns = fWorkSheet.getFrozenColumns();
|
|
3442
3559
|
* console.log(frozenColumns);
|
|
@@ -3452,7 +3569,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3452
3569
|
* @returns {number} The number of frozen rows. returns 0 if no rows are frozen.
|
|
3453
3570
|
* @example
|
|
3454
3571
|
* ```typescript
|
|
3455
|
-
* const fWorkSheet = univerAPI.getActiveWorkbook().
|
|
3572
|
+
* const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3573
|
+
* if (!fWorkSheet) return;
|
|
3456
3574
|
* // Get the number of frozen rows
|
|
3457
3575
|
* const frozenRows = fWorkSheet.getFrozenRows();
|
|
3458
3576
|
* console.log(frozenRows);
|
|
@@ -3468,7 +3586,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3468
3586
|
* @returns {IRowRange} The range of the frozen rows.
|
|
3469
3587
|
* @example
|
|
3470
3588
|
* ```ts
|
|
3471
|
-
* const fWorkSheet = univerAPI.getActiveWorkbook().
|
|
3589
|
+
* const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3590
|
+
* if (!fWorkSheet) return;
|
|
3472
3591
|
* // Get the range of the frozen rows
|
|
3473
3592
|
* const frozenRows = fWorkSheet.getFrozenRowRange();
|
|
3474
3593
|
* console.log(frozenRows);
|
|
@@ -3486,7 +3605,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3486
3605
|
* @returns {IColumnRange} The range of the frozen columns.
|
|
3487
3606
|
* @example
|
|
3488
3607
|
* ```ts
|
|
3489
|
-
* const fWorkSheet = univerAPI.getActiveWorkbook().
|
|
3608
|
+
* const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3609
|
+
* if (!fWorkSheet) return;
|
|
3490
3610
|
* // Get the range of the frozen columns
|
|
3491
3611
|
* const frozenColumns = fWorkSheet.getFrozenColumnRange();
|
|
3492
3612
|
* console.log(frozenColumns);
|
|
@@ -3504,7 +3624,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3504
3624
|
* @returns {boolean} True if the sheet's gridlines are hidden; otherwise false.
|
|
3505
3625
|
* @example
|
|
3506
3626
|
* ```ts
|
|
3507
|
-
* const fWorkSheet = univerAPI.getActiveWorkbook().
|
|
3627
|
+
* const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3628
|
+
* if (!fWorkSheet) return;
|
|
3508
3629
|
* // check if the gridlines are hidden
|
|
3509
3630
|
* if (fWorkSheet.hasHiddenGridLines()) {
|
|
3510
3631
|
* console.log('Gridlines are hidden');
|
|
@@ -3520,7 +3641,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3520
3641
|
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
3521
3642
|
* @example
|
|
3522
3643
|
* ``` ts
|
|
3523
|
-
* const fWorkSheet = univerAPI.getActiveWorkbook().
|
|
3644
|
+
* const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3645
|
+
* if (!fWorkSheet) return;
|
|
3524
3646
|
* // hide the gridlines
|
|
3525
3647
|
* fWorkSheet.setHiddenGridlines(true);
|
|
3526
3648
|
* ```
|
|
@@ -3539,7 +3661,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3539
3661
|
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
3540
3662
|
* @example
|
|
3541
3663
|
* ```ts
|
|
3542
|
-
* const fWorkSheet = univerAPI.getActiveWorkbook().
|
|
3664
|
+
* const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
3665
|
+
* if (!fWorkSheet) return;
|
|
3543
3666
|
* // set the gridlines color to red
|
|
3544
3667
|
* fWorkSheet.setGridLinesColor('#ff0000');
|
|
3545
3668
|
* ```
|
|
@@ -3558,7 +3681,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3558
3681
|
* @example
|
|
3559
3682
|
* ```ts
|
|
3560
3683
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3561
|
-
* const fWorkSheet = fWorkbook.
|
|
3684
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
3685
|
+
* if (!fWorkSheet) return;
|
|
3562
3686
|
* // get the gridlines color of the sheet
|
|
3563
3687
|
* console.log(fWorkSheet.getGridLinesColor());
|
|
3564
3688
|
* ```
|
|
@@ -3573,7 +3697,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3573
3697
|
* @example
|
|
3574
3698
|
* ```ts
|
|
3575
3699
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3576
|
-
* const fWorkSheet = fWorkbook.
|
|
3700
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
3701
|
+
* if (!fWorkSheet) return;
|
|
3577
3702
|
* // set the tab color to red
|
|
3578
3703
|
* fWorkSheet.setTabColor('#ff0000');
|
|
3579
3704
|
* ```
|
|
@@ -3593,7 +3718,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3593
3718
|
* @example
|
|
3594
3719
|
* ```ts
|
|
3595
3720
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3596
|
-
* const fWorkSheet = fWorkbook.
|
|
3721
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
3722
|
+
* if (!fWorkSheet) return;
|
|
3597
3723
|
* // get the tab color of the sheet
|
|
3598
3724
|
* console.log(fWorkSheet.getTabColor());
|
|
3599
3725
|
* ```
|
|
@@ -3607,7 +3733,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3607
3733
|
* @example
|
|
3608
3734
|
* ```ts
|
|
3609
3735
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3610
|
-
* const fWorkSheet = fWorkbook.
|
|
3736
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
3737
|
+
* if (!fWorkSheet) return;
|
|
3611
3738
|
* // hide the active sheet
|
|
3612
3739
|
* fWorkSheet.hideSheet();
|
|
3613
3740
|
* ```
|
|
@@ -3660,7 +3787,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3660
3787
|
* @example
|
|
3661
3788
|
* ```ts
|
|
3662
3789
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3663
|
-
* const fWorkSheet = fWorkbook.
|
|
3790
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
3791
|
+
* if (!fWorkSheet) return;
|
|
3664
3792
|
* // set the sheet name to 'Sheet1'
|
|
3665
3793
|
* fWorkSheet.setName('NewSheet1');
|
|
3666
3794
|
* ```
|
|
@@ -3694,7 +3822,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3694
3822
|
* @example
|
|
3695
3823
|
* ```ts
|
|
3696
3824
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3697
|
-
* const fWorkSheet = fWorkbook.
|
|
3825
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
3826
|
+
* if (!fWorkSheet) return;
|
|
3698
3827
|
* // get the position of the active sheet
|
|
3699
3828
|
* const position = fWorkSheet.getIndex();
|
|
3700
3829
|
* console.log(position);
|
|
@@ -3712,7 +3841,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3712
3841
|
* @example
|
|
3713
3842
|
* ```ts
|
|
3714
3843
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3715
|
-
* const fWorkSheet = fWorkbook.
|
|
3844
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
3845
|
+
* if (!fWorkSheet) return;
|
|
3716
3846
|
* // clear the sheet of content and formatting information
|
|
3717
3847
|
* fWorkSheet.clear();
|
|
3718
3848
|
* // clear the sheet of content only
|
|
@@ -3745,7 +3875,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3745
3875
|
* @example
|
|
3746
3876
|
* ```typescript
|
|
3747
3877
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3748
|
-
* const fWorkSheet = fWorkbook.
|
|
3878
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
3879
|
+
* if (!fWorkSheet) return;
|
|
3749
3880
|
* // clear the sheet of content only
|
|
3750
3881
|
* fWorkSheet.clearContents();
|
|
3751
3882
|
* ```
|
|
@@ -3773,7 +3904,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3773
3904
|
* @example
|
|
3774
3905
|
* ```typescript
|
|
3775
3906
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3776
|
-
* const fWorkSheet = fWorkbook.
|
|
3907
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
3908
|
+
* if (!fWorkSheet) return;
|
|
3777
3909
|
* // clear the sheet of formatting only
|
|
3778
3910
|
* fWorkSheet.clearFormats();
|
|
3779
3911
|
* ```
|
|
@@ -3802,7 +3934,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3802
3934
|
* @example
|
|
3803
3935
|
* ```ts
|
|
3804
3936
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3805
|
-
* const fWorkSheet = fWorkbook.
|
|
3937
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
3938
|
+
* if (!fWorkSheet) return;
|
|
3806
3939
|
* // Assume the sheet is a empty sheet
|
|
3807
3940
|
* const cellRange = fWorkSheet.getRange('J50');
|
|
3808
3941
|
* cellRange.setValue('Hello World');
|
|
@@ -3819,7 +3952,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3819
3952
|
* @example
|
|
3820
3953
|
* ```ts
|
|
3821
3954
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3822
|
-
* const fWorkSheet = fWorkbook.
|
|
3955
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
3956
|
+
* if (!fWorkSheet) return;
|
|
3823
3957
|
* // Assume the sheet is a empty sheet
|
|
3824
3958
|
* const cellRange = fWorkSheet.getRange('J50');
|
|
3825
3959
|
* cellRange.setValue('Hello World');
|
|
@@ -3835,7 +3969,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3835
3969
|
* @example
|
|
3836
3970
|
* ```ts
|
|
3837
3971
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3838
|
-
* const fWorkSheet = fWorkbook.
|
|
3972
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
3973
|
+
* if (!fWorkSheet) return;
|
|
3839
3974
|
* // Assume the sheet is a empty sheet
|
|
3840
3975
|
* const cellRange = fWorkSheet.getRange('J50');
|
|
3841
3976
|
* cellRange.setValue('Hello World');
|
|
@@ -3853,7 +3988,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3853
3988
|
* ```ts
|
|
3854
3989
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3855
3990
|
* const sheets = fWorkbook.getSheets();
|
|
3856
|
-
* const fWorkSheet = fWorkbook.
|
|
3991
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
3992
|
+
* if (!fWorkSheet) return;
|
|
3857
3993
|
* console.log(fWorkSheet.equalTo(sheets[0])); // true, if the active sheet is the first sheet.
|
|
3858
3994
|
* ```
|
|
3859
3995
|
*/
|
|
@@ -3868,7 +4004,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3868
4004
|
* @example
|
|
3869
4005
|
* ```ts
|
|
3870
4006
|
* // The code below inserts a defined name
|
|
3871
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
4007
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
4008
|
+
* if (!fWorksheet) return;
|
|
3872
4009
|
* fWorksheet.insertDefinedName('MyDefinedName', 'Sheet1!$A$1');
|
|
3873
4010
|
* ```
|
|
3874
4011
|
*/
|
|
@@ -3882,7 +4019,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3882
4019
|
* @example
|
|
3883
4020
|
* ```ts
|
|
3884
4021
|
* // The code below gets all the defined names in the worksheet
|
|
3885
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
4022
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
4023
|
+
* if (!fWorksheet) return;
|
|
3886
4024
|
* const definedNames = fWorksheet.getDefinedNames();
|
|
3887
4025
|
* console.log(definedNames, definedNames[0]?.getFormulaOrRefString());
|
|
3888
4026
|
* ```
|
|
@@ -3897,11 +4035,13 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3897
4035
|
* @example
|
|
3898
4036
|
* ```ts
|
|
3899
4037
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3900
|
-
* const fWorkSheet = fWorkbook.
|
|
4038
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
4039
|
+
* if (!fWorkSheet) return;
|
|
3901
4040
|
* fWorkSheet.setCustomMetadata({ key: 'value' });
|
|
3902
4041
|
* ```
|
|
3903
4042
|
*/
|
|
3904
4043
|
setCustomMetadata(custom) {
|
|
4044
|
+
this._logService.warn(SHEETS_CUSTOM_FIELD_WARNING_MESSAGE);
|
|
3905
4045
|
this._worksheet.setCustomMetadata(custom);
|
|
3906
4046
|
return this;
|
|
3907
4047
|
}
|
|
@@ -3911,12 +4051,14 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3911
4051
|
* @example
|
|
3912
4052
|
* ```ts
|
|
3913
4053
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3914
|
-
* const fWorkSheet = fWorkbook.
|
|
4054
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
4055
|
+
* if (!fWorkSheet) return;
|
|
3915
4056
|
* const custom = fWorkSheet.getCustomMetadata();
|
|
3916
4057
|
* console.log(custom);
|
|
3917
4058
|
* ```
|
|
3918
4059
|
*/
|
|
3919
4060
|
getCustomMetadata() {
|
|
4061
|
+
this._logService.warn(SHEETS_CUSTOM_FIELD_WARNING_MESSAGE);
|
|
3920
4062
|
return this._worksheet.getCustomMetadata();
|
|
3921
4063
|
}
|
|
3922
4064
|
/**
|
|
@@ -3927,11 +4069,13 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3927
4069
|
* @example
|
|
3928
4070
|
* ```ts
|
|
3929
4071
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3930
|
-
* const fWorkSheet = fWorkbook.
|
|
4072
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
4073
|
+
* if (!fWorkSheet) return;
|
|
3931
4074
|
* fWorkSheet.setRowCustomMetadata(0, { key: 'value' });
|
|
3932
4075
|
* ```
|
|
3933
4076
|
*/
|
|
3934
4077
|
setRowCustomMetadata(index, custom) {
|
|
4078
|
+
this._logService.warn(SHEETS_CUSTOM_FIELD_WARNING_MESSAGE);
|
|
3935
4079
|
this._worksheet.getRowManager().setCustomMetadata(index, custom);
|
|
3936
4080
|
return this;
|
|
3937
4081
|
}
|
|
@@ -3943,11 +4087,13 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3943
4087
|
* @example
|
|
3944
4088
|
* ```ts
|
|
3945
4089
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3946
|
-
* const fWorkSheet = fWorkbook.
|
|
4090
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
4091
|
+
* if (!fWorkSheet) return;
|
|
3947
4092
|
* fWorkSheet.setColumnCustomMetadata(0, { key: 'value' });
|
|
3948
4093
|
* ```
|
|
3949
4094
|
*/
|
|
3950
4095
|
setColumnCustomMetadata(index, custom) {
|
|
4096
|
+
this._logService.warn(SHEETS_CUSTOM_FIELD_WARNING_MESSAGE);
|
|
3951
4097
|
this._worksheet.getColumnManager().setCustomMetadata(index, custom);
|
|
3952
4098
|
return this;
|
|
3953
4099
|
}
|
|
@@ -3958,12 +4104,14 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3958
4104
|
* @example
|
|
3959
4105
|
* ```ts
|
|
3960
4106
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3961
|
-
* const fWorkSheet = fWorkbook.
|
|
4107
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
4108
|
+
* if (!fWorkSheet) return;
|
|
3962
4109
|
* const custom = fWorkSheet.getRowCustomMetadata(0);
|
|
3963
4110
|
* console.log(custom);
|
|
3964
4111
|
* ```
|
|
3965
4112
|
*/
|
|
3966
4113
|
getRowCustomMetadata(index) {
|
|
4114
|
+
this._logService.warn(SHEETS_CUSTOM_FIELD_WARNING_MESSAGE);
|
|
3967
4115
|
return this._worksheet.getRowManager().getCustomMetadata(index);
|
|
3968
4116
|
}
|
|
3969
4117
|
/**
|
|
@@ -3973,12 +4121,14 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3973
4121
|
* @example
|
|
3974
4122
|
* ```ts
|
|
3975
4123
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3976
|
-
* const fWorkSheet = fWorkbook.
|
|
4124
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
4125
|
+
* if (!fWorkSheet) return;
|
|
3977
4126
|
* const custom = fWorkSheet.getColumnCustomMetadata(0);
|
|
3978
4127
|
* console.log(custom);
|
|
3979
4128
|
* ```
|
|
3980
4129
|
*/
|
|
3981
4130
|
getColumnCustomMetadata(index) {
|
|
4131
|
+
this._logService.warn(SHEETS_CUSTOM_FIELD_WARNING_MESSAGE);
|
|
3982
4132
|
return this._worksheet.getColumnManager().getCustomMetadata(index);
|
|
3983
4133
|
}
|
|
3984
4134
|
/**
|
|
@@ -3990,7 +4140,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3990
4140
|
* // Appends a new row with 4 columns to the bottom of the current
|
|
3991
4141
|
* // data region in the sheet containing the values in the array.
|
|
3992
4142
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3993
|
-
* const fWorkSheet = fWorkbook.
|
|
4143
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
4144
|
+
* if (!fWorkSheet) return;
|
|
3994
4145
|
* fWorkSheet.appendRow([1, 'Hello Univer', true, '=A1']);
|
|
3995
4146
|
* ```
|
|
3996
4147
|
*/
|
|
@@ -4020,7 +4171,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
4020
4171
|
* @example
|
|
4021
4172
|
* ```ts
|
|
4022
4173
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4023
|
-
* const fWorkSheet = fWorkbook.
|
|
4174
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
4175
|
+
* if (!fWorkSheet) return;
|
|
4024
4176
|
*
|
|
4025
4177
|
* // Set the number of rows in the worksheet to 40
|
|
4026
4178
|
* fWorkSheet.setRowCount(40);
|
|
@@ -4041,7 +4193,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
4041
4193
|
* @example
|
|
4042
4194
|
* ```ts
|
|
4043
4195
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4044
|
-
* const fWorkSheet = fWorkbook.
|
|
4196
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
4197
|
+
* if (!fWorkSheet) return;
|
|
4045
4198
|
*
|
|
4046
4199
|
* // Set the number of columns in the worksheet to 10
|
|
4047
4200
|
* fWorkSheet.setColumnCount(10);
|
|
@@ -4061,7 +4214,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
4061
4214
|
* @returns {FWorksheetPermission} - The WorksheetPermission instance.
|
|
4062
4215
|
* @example
|
|
4063
4216
|
* ```ts
|
|
4064
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
4217
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
4218
|
+
* if (!fWorksheet) return;
|
|
4065
4219
|
* const permission = fWorksheet.getWorksheetPermission();
|
|
4066
4220
|
*
|
|
4067
4221
|
* // Set worksheet to read-only mode
|
|
@@ -4115,7 +4269,8 @@ let FRangePermission = class FRangePermission extends FBase {
|
|
|
4115
4269
|
* @example
|
|
4116
4270
|
* ```ts
|
|
4117
4271
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4118
|
-
* const fWorksheet = fWorkbook.
|
|
4272
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4273
|
+
* if (!fWorksheet) return;
|
|
4119
4274
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4120
4275
|
* // Check if the A1:B2 range is protected
|
|
4121
4276
|
* const isProtected = fRange.getRangePermission().isProtected();
|
|
@@ -4132,7 +4287,8 @@ let FRangePermission = class FRangePermission extends FBase {
|
|
|
4132
4287
|
* @example
|
|
4133
4288
|
* ```ts
|
|
4134
4289
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4135
|
-
* const fWorksheet = fWorkbook.
|
|
4290
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4291
|
+
* if (!fWorksheet) return;
|
|
4136
4292
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4137
4293
|
* const rule = await fRange.getRangePermission().protect({
|
|
4138
4294
|
* name: 'My protected range',
|
|
@@ -4202,7 +4358,8 @@ let FRangePermission = class FRangePermission extends FBase {
|
|
|
4202
4358
|
* @example
|
|
4203
4359
|
* ```ts
|
|
4204
4360
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4205
|
-
* const fWorksheet = fWorkbook.
|
|
4361
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4362
|
+
* if (!fWorksheet) return;
|
|
4206
4363
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4207
4364
|
* const result = await fRange.getRangePermission().unprotect();
|
|
4208
4365
|
* console.log(result);
|
|
@@ -4224,7 +4381,8 @@ let FRangePermission = class FRangePermission extends FBase {
|
|
|
4224
4381
|
* @example
|
|
4225
4382
|
* ```ts
|
|
4226
4383
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4227
|
-
* const fWorksheet = fWorkbook.
|
|
4384
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4385
|
+
* if (!fWorksheet) return;
|
|
4228
4386
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4229
4387
|
* const rules = await fRange.getRangePermission().listRules();
|
|
4230
4388
|
* console.log(rules);
|
|
@@ -4249,7 +4407,7 @@ FRangePermission = __decorate([
|
|
|
4249
4407
|
//#region src/facade/f-range.ts
|
|
4250
4408
|
var _FRange, _FRange2;
|
|
4251
4409
|
let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
4252
|
-
constructor(_workbook, _worksheet, _range, _injector, _commandService, _formulaDataModel) {
|
|
4410
|
+
constructor(_workbook, _worksheet, _range, _injector, _commandService, _formulaDataModel, _logService) {
|
|
4253
4411
|
super(_injector);
|
|
4254
4412
|
this._workbook = _workbook;
|
|
4255
4413
|
this._worksheet = _worksheet;
|
|
@@ -4257,6 +4415,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4257
4415
|
this._injector = _injector;
|
|
4258
4416
|
this._commandService = _commandService;
|
|
4259
4417
|
this._formulaDataModel = _formulaDataModel;
|
|
4418
|
+
this._logService = _logService;
|
|
4260
4419
|
const maxRows = this._worksheet.getRowCount();
|
|
4261
4420
|
const maxColumns = this._worksheet.getColumnCount();
|
|
4262
4421
|
if (this._range.startRow < 0 || this._range.startColumn < 0 || this._range.endRow >= maxRows || this._range.endColumn >= maxColumns) throw new Error(`Range is out of bounds. Max rows: ${maxRows}, Max columns: ${maxColumns}, Given range: ${JSON.stringify(this._range)}`);
|
|
@@ -4268,7 +4427,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4268
4427
|
* @example
|
|
4269
4428
|
* ```ts
|
|
4270
4429
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4271
|
-
* const fWorksheet = fWorkbook.
|
|
4430
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4431
|
+
* if (!fWorksheet) return;
|
|
4272
4432
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4273
4433
|
* console.log(fRange.getUnitId());
|
|
4274
4434
|
* ```
|
|
@@ -4282,7 +4442,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4282
4442
|
* @example
|
|
4283
4443
|
* ```ts
|
|
4284
4444
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4285
|
-
* const fWorksheet = fWorkbook.
|
|
4445
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4446
|
+
* if (!fWorksheet) return;
|
|
4286
4447
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4287
4448
|
* console.log(fRange.getSheetName());
|
|
4288
4449
|
* ```
|
|
@@ -4296,7 +4457,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4296
4457
|
* @example
|
|
4297
4458
|
* ```ts
|
|
4298
4459
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4299
|
-
* const fWorksheet = fWorkbook.
|
|
4460
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4461
|
+
* if (!fWorksheet) return;
|
|
4300
4462
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4301
4463
|
* console.log(fRange.getSheetId());
|
|
4302
4464
|
* ```
|
|
@@ -4310,7 +4472,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4310
4472
|
* @example
|
|
4311
4473
|
* ```ts
|
|
4312
4474
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4313
|
-
* const fWorksheet = fWorkbook.
|
|
4475
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4476
|
+
* if (!fWorksheet) return;
|
|
4314
4477
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4315
4478
|
* const range = fRange.getRange();
|
|
4316
4479
|
* const { startRow, startColumn, endRow, endColumn } = range;
|
|
@@ -4326,7 +4489,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4326
4489
|
* @example
|
|
4327
4490
|
* ```ts
|
|
4328
4491
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4329
|
-
* const fWorksheet = fWorkbook.
|
|
4492
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4493
|
+
* if (!fWorksheet) return;
|
|
4330
4494
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4331
4495
|
* console.log(fRange.getRow()); // 0
|
|
4332
4496
|
* ```
|
|
@@ -4340,7 +4504,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4340
4504
|
* @example
|
|
4341
4505
|
* ```ts
|
|
4342
4506
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4343
|
-
* const fWorksheet = fWorkbook.
|
|
4507
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4508
|
+
* if (!fWorksheet) return;
|
|
4344
4509
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4345
4510
|
* console.log(fRange.getLastRow()); // 1
|
|
4346
4511
|
* ```
|
|
@@ -4354,7 +4519,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4354
4519
|
* @example
|
|
4355
4520
|
* ```ts
|
|
4356
4521
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4357
|
-
* const fWorksheet = fWorkbook.
|
|
4522
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4523
|
+
* if (!fWorksheet) return;
|
|
4358
4524
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4359
4525
|
* console.log(fRange.getColumn()); // 0
|
|
4360
4526
|
* ```
|
|
@@ -4368,7 +4534,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4368
4534
|
* @example
|
|
4369
4535
|
* ```ts
|
|
4370
4536
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4371
|
-
* const fWorksheet = fWorkbook.
|
|
4537
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4538
|
+
* if (!fWorksheet) return;
|
|
4372
4539
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4373
4540
|
* console.log(fRange.getLastColumn()); // 1
|
|
4374
4541
|
* ```
|
|
@@ -4382,7 +4549,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4382
4549
|
* @example
|
|
4383
4550
|
* ```ts
|
|
4384
4551
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4385
|
-
* const fWorksheet = fWorkbook.
|
|
4552
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4553
|
+
* if (!fWorksheet) return;
|
|
4386
4554
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4387
4555
|
* console.log(fRange.getWidth());
|
|
4388
4556
|
* ```
|
|
@@ -4396,7 +4564,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4396
4564
|
* @example
|
|
4397
4565
|
* ```ts
|
|
4398
4566
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4399
|
-
* const fWorksheet = fWorkbook.
|
|
4567
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4568
|
+
* if (!fWorksheet) return;
|
|
4400
4569
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4401
4570
|
* console.log(fRange.getHeight());
|
|
4402
4571
|
* ```
|
|
@@ -4410,7 +4579,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4410
4579
|
* @example
|
|
4411
4580
|
* ```ts
|
|
4412
4581
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4413
|
-
* const fWorksheet = fWorkbook.
|
|
4582
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4583
|
+
* if (!fWorksheet) return;
|
|
4414
4584
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4415
4585
|
* console.log(fRange.isMerged());
|
|
4416
4586
|
* // merge cells A1:B2
|
|
@@ -4435,7 +4605,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4435
4605
|
* @example
|
|
4436
4606
|
* ```ts
|
|
4437
4607
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4438
|
-
* const fWorksheet = fWorkbook.
|
|
4608
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4609
|
+
* if (!fWorksheet) return;
|
|
4439
4610
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4440
4611
|
* console.log(fRange.getCellStyleData());
|
|
4441
4612
|
* ```
|
|
@@ -4456,7 +4627,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4456
4627
|
* @example
|
|
4457
4628
|
* ```ts
|
|
4458
4629
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4459
|
-
* const fWorksheet = fWorkbook.
|
|
4630
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4631
|
+
* if (!fWorksheet) return;
|
|
4460
4632
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4461
4633
|
* console.log(fRange.getFontFamily());
|
|
4462
4634
|
* ```
|
|
@@ -4477,7 +4649,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4477
4649
|
* @example
|
|
4478
4650
|
* ```ts
|
|
4479
4651
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4480
|
-
* const fWorksheet = fWorkbook.
|
|
4652
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4653
|
+
* if (!fWorksheet) return;
|
|
4481
4654
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4482
4655
|
* console.log(fRange.getFontSize());
|
|
4483
4656
|
* ```
|
|
@@ -4498,7 +4671,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4498
4671
|
* @example
|
|
4499
4672
|
* ```ts
|
|
4500
4673
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4501
|
-
* const fWorksheet = fWorkbook.
|
|
4674
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4675
|
+
* if (!fWorksheet) return;
|
|
4502
4676
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4503
4677
|
* console.log(fRange.getCellStyle());
|
|
4504
4678
|
* ```
|
|
@@ -4519,7 +4693,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4519
4693
|
* @example
|
|
4520
4694
|
* ```ts
|
|
4521
4695
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4522
|
-
* const fWorksheet = fWorkbook.
|
|
4696
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4697
|
+
* if (!fWorksheet) return;
|
|
4523
4698
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4524
4699
|
* console.log(fRange.getCellStyles());
|
|
4525
4700
|
* ```
|
|
@@ -4542,7 +4717,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4542
4717
|
* @example
|
|
4543
4718
|
* ```ts
|
|
4544
4719
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4545
|
-
* const fWorksheet = fWorkbook.
|
|
4720
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4721
|
+
* if (!fWorksheet) return;
|
|
4546
4722
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4547
4723
|
* fRange.setValueForCell({
|
|
4548
4724
|
* v: 0.2,
|
|
@@ -4567,7 +4743,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4567
4743
|
* @example
|
|
4568
4744
|
* ```ts
|
|
4569
4745
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4570
|
-
* const fWorksheet = fWorkbook.
|
|
4746
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4747
|
+
* if (!fWorksheet) return;
|
|
4571
4748
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4572
4749
|
* fRange.setValueForCell({
|
|
4573
4750
|
* v: 0.2,
|
|
@@ -4606,7 +4783,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4606
4783
|
* @example
|
|
4607
4784
|
* ```ts
|
|
4608
4785
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4609
|
-
* const fWorksheet = fWorkbook.
|
|
4786
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4787
|
+
* if (!fWorksheet) return;
|
|
4610
4788
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4611
4789
|
* fRange.setValues([
|
|
4612
4790
|
* [
|
|
@@ -4667,7 +4845,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4667
4845
|
* @example
|
|
4668
4846
|
* ```ts
|
|
4669
4847
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4670
|
-
* const fWorksheet = fWorkbook.
|
|
4848
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4849
|
+
* if (!fWorksheet) return;
|
|
4671
4850
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4672
4851
|
* fRange.setValues([
|
|
4673
4852
|
* [
|
|
@@ -4727,7 +4906,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4727
4906
|
* @example
|
|
4728
4907
|
* ```ts
|
|
4729
4908
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4730
|
-
* const fWorksheet = fWorkbook.
|
|
4909
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4910
|
+
* if (!fWorksheet) return;
|
|
4731
4911
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4732
4912
|
* console.log(fRange.getCellData());
|
|
4733
4913
|
* ```
|
|
@@ -4742,7 +4922,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4742
4922
|
* @example
|
|
4743
4923
|
* ```ts
|
|
4744
4924
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4745
|
-
* const fWorksheet = fWorkbook.
|
|
4925
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4926
|
+
* if (!fWorksheet) return;
|
|
4746
4927
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4747
4928
|
* console.log(fRange.getCellDatas());
|
|
4748
4929
|
* ```
|
|
@@ -4756,7 +4937,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4756
4937
|
* @example
|
|
4757
4938
|
* ```ts
|
|
4758
4939
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4759
|
-
* const fWorksheet = fWorkbook.
|
|
4940
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4941
|
+
* if (!fWorksheet) return;
|
|
4760
4942
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4761
4943
|
* console.log(fRange.getCellDataGrid());
|
|
4762
4944
|
* ```
|
|
@@ -4779,7 +4961,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4779
4961
|
* @example
|
|
4780
4962
|
* ```ts
|
|
4781
4963
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4782
|
-
* const fWorksheet = fWorkbook.
|
|
4964
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4965
|
+
* if (!fWorksheet) return;
|
|
4783
4966
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4784
4967
|
* console.log(fRange.getRichTextValue());
|
|
4785
4968
|
* ```
|
|
@@ -4797,7 +4980,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4797
4980
|
* @example
|
|
4798
4981
|
* ```ts
|
|
4799
4982
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4800
|
-
* const fWorksheet = fWorkbook.
|
|
4983
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
4984
|
+
* if (!fWorksheet) return;
|
|
4801
4985
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4802
4986
|
* console.log(fRange.getRichTextValues());
|
|
4803
4987
|
* ```
|
|
@@ -4813,7 +4997,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4813
4997
|
* @example
|
|
4814
4998
|
* ```ts
|
|
4815
4999
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4816
|
-
* const fWorksheet = fWorkbook.
|
|
5000
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5001
|
+
* if (!fWorksheet) return;
|
|
4817
5002
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4818
5003
|
* console.log(fRange.getValueAndRichTextValue());
|
|
4819
5004
|
* ```
|
|
@@ -4828,7 +5013,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4828
5013
|
* @example
|
|
4829
5014
|
* ```ts
|
|
4830
5015
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4831
|
-
* const fWorksheet = fWorkbook.
|
|
5016
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5017
|
+
* if (!fWorksheet) return;
|
|
4832
5018
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4833
5019
|
* console.log(fRange.getValueAndRichTextValues());
|
|
4834
5020
|
* ```
|
|
@@ -4842,7 +5028,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4842
5028
|
* @example
|
|
4843
5029
|
* ```ts
|
|
4844
5030
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4845
|
-
* const fWorksheet = fWorkbook.
|
|
5031
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5032
|
+
* if (!fWorksheet) return;
|
|
4846
5033
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4847
5034
|
* console.log(fRange.getFormula());
|
|
4848
5035
|
* ```
|
|
@@ -4857,7 +5044,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4857
5044
|
* @example
|
|
4858
5045
|
* ```ts
|
|
4859
5046
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4860
|
-
* const fWorksheet = fWorkbook.
|
|
5047
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5048
|
+
* if (!fWorksheet) return;
|
|
4861
5049
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4862
5050
|
* console.log(fRange.getFormulas());
|
|
4863
5051
|
* ```
|
|
@@ -4883,7 +5071,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4883
5071
|
* @example
|
|
4884
5072
|
* ```ts
|
|
4885
5073
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4886
|
-
* const fWorksheet = fWorkbook.
|
|
5074
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5075
|
+
* if (!fWorksheet) return;
|
|
4887
5076
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4888
5077
|
* console.log(fRange.getWrap());
|
|
4889
5078
|
* ```
|
|
@@ -4897,7 +5086,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4897
5086
|
* @example
|
|
4898
5087
|
* ```ts
|
|
4899
5088
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4900
|
-
* const fWorksheet = fWorkbook.
|
|
5089
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5090
|
+
* if (!fWorksheet) return;
|
|
4901
5091
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4902
5092
|
* console.log(fRange.getWraps());
|
|
4903
5093
|
*/
|
|
@@ -4915,7 +5105,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4915
5105
|
* @example
|
|
4916
5106
|
* ```ts
|
|
4917
5107
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4918
|
-
* const fWorksheet = fWorkbook.
|
|
5108
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5109
|
+
* if (!fWorksheet) return;
|
|
4919
5110
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4920
5111
|
* console.log(fRange.getWrapStrategy());
|
|
4921
5112
|
* ```
|
|
@@ -4929,7 +5120,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4929
5120
|
* @example
|
|
4930
5121
|
* ```ts
|
|
4931
5122
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4932
|
-
* const fWorksheet = fWorkbook.
|
|
5123
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5124
|
+
* if (!fWorksheet) return;
|
|
4933
5125
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4934
5126
|
* console.log(fRange.getHorizontalAlignment());
|
|
4935
5127
|
* ```
|
|
@@ -4943,7 +5135,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4943
5135
|
* @example
|
|
4944
5136
|
* ```ts
|
|
4945
5137
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4946
|
-
* const fWorksheet = fWorkbook.
|
|
5138
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5139
|
+
* if (!fWorksheet) return;
|
|
4947
5140
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4948
5141
|
* console.log(fRange.getHorizontalAlignments());
|
|
4949
5142
|
* ```
|
|
@@ -4957,7 +5150,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4957
5150
|
* @example
|
|
4958
5151
|
* ```ts
|
|
4959
5152
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4960
|
-
* const fWorksheet = fWorkbook.
|
|
5153
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5154
|
+
* if (!fWorksheet) return;
|
|
4961
5155
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4962
5156
|
* console.log(fRange.getVerticalAlignment());
|
|
4963
5157
|
* ```
|
|
@@ -4971,7 +5165,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4971
5165
|
* @example
|
|
4972
5166
|
* ```ts
|
|
4973
5167
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4974
|
-
* const fWorksheet = fWorkbook.
|
|
5168
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5169
|
+
* if (!fWorksheet) return;
|
|
4975
5170
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4976
5171
|
* console.log(fRange.getVerticalAlignments());
|
|
4977
5172
|
* ```
|
|
@@ -4985,13 +5180,15 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4985
5180
|
* @returns {FRange} This range, for chaining
|
|
4986
5181
|
* ```ts
|
|
4987
5182
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4988
|
-
* const fWorksheet = fWorkbook.
|
|
5183
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5184
|
+
* if (!fWorksheet) return;
|
|
4989
5185
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
4990
5186
|
* fRange.setCustomMetaData({ key: 'value' });
|
|
4991
5187
|
* console.log(fRange.getCustomMetaData());
|
|
4992
5188
|
* ```
|
|
4993
5189
|
*/
|
|
4994
5190
|
setCustomMetaData(data) {
|
|
5191
|
+
this._logService.warn(SHEETS_CUSTOM_FIELD_WARNING_MESSAGE);
|
|
4995
5192
|
const params = {
|
|
4996
5193
|
unitId: this._workbook.getUnitId(),
|
|
4997
5194
|
subUnitId: this._worksheet.getSheetId(),
|
|
@@ -5007,7 +5204,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5007
5204
|
* @returns {FRange} This range, for chaining
|
|
5008
5205
|
* ```ts
|
|
5009
5206
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5010
|
-
* const fWorksheet = fWorkbook.
|
|
5207
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5208
|
+
* if (!fWorksheet) return;
|
|
5011
5209
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5012
5210
|
* fRange.setCustomMetaDatas([
|
|
5013
5211
|
* [{ key: 'value' }, { key: 'value2' }],
|
|
@@ -5017,6 +5215,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5017
5215
|
* ```
|
|
5018
5216
|
*/
|
|
5019
5217
|
setCustomMetaDatas(datas) {
|
|
5218
|
+
this._logService.warn(SHEETS_CUSTOM_FIELD_WARNING_MESSAGE);
|
|
5020
5219
|
const params = {
|
|
5021
5220
|
unitId: this._workbook.getUnitId(),
|
|
5022
5221
|
subUnitId: this._worksheet.getSheetId(),
|
|
@@ -5032,13 +5231,15 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5032
5231
|
* @example
|
|
5033
5232
|
* ```
|
|
5034
5233
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5035
|
-
* const fWorksheet = fWorkbook.
|
|
5234
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5235
|
+
* if (!fWorksheet) return;
|
|
5036
5236
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5037
5237
|
* console.log(fRange.getCustomMetaData());
|
|
5038
5238
|
* ```
|
|
5039
5239
|
*/
|
|
5040
5240
|
getCustomMetaData() {
|
|
5041
5241
|
var _cell$custom;
|
|
5242
|
+
this._logService.warn(SHEETS_CUSTOM_FIELD_WARNING_MESSAGE);
|
|
5042
5243
|
const cell = this.getCellData();
|
|
5043
5244
|
return (_cell$custom = cell === null || cell === void 0 ? void 0 : cell.custom) !== null && _cell$custom !== void 0 ? _cell$custom : null;
|
|
5044
5245
|
}
|
|
@@ -5048,12 +5249,14 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5048
5249
|
* @example
|
|
5049
5250
|
* ```
|
|
5050
5251
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5051
|
-
* const fWorksheet = fWorkbook.
|
|
5252
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5253
|
+
* if (!fWorksheet) return;
|
|
5052
5254
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5053
5255
|
* console.log(fRange.getCustomMetaDatas());
|
|
5054
5256
|
* ```
|
|
5055
5257
|
*/
|
|
5056
5258
|
getCustomMetaDatas() {
|
|
5259
|
+
this._logService.warn(SHEETS_CUSTOM_FIELD_WARNING_MESSAGE);
|
|
5057
5260
|
return this.getCellDataGrid().map((row) => row.map((data) => {
|
|
5058
5261
|
var _data$custom;
|
|
5059
5262
|
return (_data$custom = data === null || data === void 0 ? void 0 : data.custom) !== null && _data$custom !== void 0 ? _data$custom : null;
|
|
@@ -5068,7 +5271,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5068
5271
|
* @example
|
|
5069
5272
|
* ```ts
|
|
5070
5273
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5071
|
-
* const fWorksheet = fWorkbook.
|
|
5274
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5275
|
+
* if (!fWorksheet) return;
|
|
5072
5276
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5073
5277
|
* fRange.setBorder(univerAPI.Enum.BorderType.ALL, univerAPI.Enum.BorderStyleTypes.THIN, '#ff0000');
|
|
5074
5278
|
* ```
|
|
@@ -5092,7 +5296,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5092
5296
|
* @example
|
|
5093
5297
|
* ```ts
|
|
5094
5298
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5095
|
-
* const fWorksheet = fWorkbook.
|
|
5299
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5300
|
+
* if (!fWorksheet) return;
|
|
5096
5301
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5097
5302
|
* console.log(fRange.getBackground());
|
|
5098
5303
|
* ```
|
|
@@ -5108,7 +5313,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5108
5313
|
* @example
|
|
5109
5314
|
* ```ts
|
|
5110
5315
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5111
|
-
* const fWorksheet = fWorkbook.
|
|
5316
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5317
|
+
* if (!fWorksheet) return;
|
|
5112
5318
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5113
5319
|
* console.log(fRange.getBackgrounds());
|
|
5114
5320
|
* ```
|
|
@@ -5126,7 +5332,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5126
5332
|
* @example
|
|
5127
5333
|
* ```ts
|
|
5128
5334
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5129
|
-
* const fWorksheet = fWorkbook.
|
|
5335
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5336
|
+
* if (!fWorksheet) return;
|
|
5130
5337
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5131
5338
|
* fRange.setBackgroundColor('red');
|
|
5132
5339
|
* ```
|
|
@@ -5150,7 +5357,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5150
5357
|
* @example
|
|
5151
5358
|
* ```typescript
|
|
5152
5359
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5153
|
-
* const fWorksheet = fWorkbook.
|
|
5360
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5361
|
+
* if (!fWorksheet) return;
|
|
5154
5362
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5155
5363
|
* fRange.setBackground('red');
|
|
5156
5364
|
* ```
|
|
@@ -5166,7 +5374,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5166
5374
|
* @example
|
|
5167
5375
|
* ```typescript
|
|
5168
5376
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5169
|
-
* const fWorksheet = fWorkbook.
|
|
5377
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5378
|
+
* if (!fWorksheet) return;
|
|
5170
5379
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5171
5380
|
* fRange.setTextRotation(45);
|
|
5172
5381
|
* ```
|
|
@@ -5186,7 +5395,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5186
5395
|
* @returns {FRange} This range, for chaining
|
|
5187
5396
|
* ```ts
|
|
5188
5397
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5189
|
-
* const fWorksheet = fWorkbook.
|
|
5398
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5399
|
+
* if (!fWorksheet) return;
|
|
5190
5400
|
* const fRange = fWorksheet.getRange('B2');
|
|
5191
5401
|
* fRange.setValue(123);
|
|
5192
5402
|
*
|
|
@@ -5211,7 +5421,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5211
5421
|
* @returns {FRange} This range, for chaining
|
|
5212
5422
|
* ```ts
|
|
5213
5423
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5214
|
-
* const fWorksheet = fWorkbook.
|
|
5424
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5425
|
+
* if (!fWorksheet) return;
|
|
5215
5426
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5216
5427
|
* fRange.setValueForCell(123);
|
|
5217
5428
|
*
|
|
@@ -5242,7 +5453,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5242
5453
|
* @example
|
|
5243
5454
|
* ```
|
|
5244
5455
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5245
|
-
* const fWorksheet = fWorkbook.
|
|
5456
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5457
|
+
* if (!fWorksheet) return;
|
|
5246
5458
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5247
5459
|
* console.log(fRange.getValue(true));
|
|
5248
5460
|
*
|
|
@@ -5278,7 +5490,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5278
5490
|
* @example
|
|
5279
5491
|
* ```ts
|
|
5280
5492
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5281
|
-
* const fWorksheet = fWorkbook.
|
|
5493
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5494
|
+
* if (!fWorksheet) return;
|
|
5282
5495
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5283
5496
|
* console.log(fRange.getValue(true));
|
|
5284
5497
|
*
|
|
@@ -5313,7 +5526,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5313
5526
|
* @example
|
|
5314
5527
|
* ```ts
|
|
5315
5528
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5316
|
-
* const fWorksheet = fWorkbook.
|
|
5529
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5530
|
+
* if (!fWorksheet) return;
|
|
5317
5531
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5318
5532
|
* fRange.setWrap(true);
|
|
5319
5533
|
* console.log(fRange.getWrap());
|
|
@@ -5335,7 +5549,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5335
5549
|
* @example
|
|
5336
5550
|
* ```ts
|
|
5337
5551
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5338
|
-
* const fWorksheet = fWorkbook.
|
|
5552
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5553
|
+
* if (!fWorksheet) return;
|
|
5339
5554
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5340
5555
|
* fRange.setWrapStrategy(univerAPI.Enum.WrapStrategy.WRAP);
|
|
5341
5556
|
* console.log(fRange.getWrapStrategy());
|
|
@@ -5357,7 +5572,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5357
5572
|
* @example
|
|
5358
5573
|
* ```ts
|
|
5359
5574
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5360
|
-
* const fWorksheet = fWorkbook.
|
|
5575
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5576
|
+
* if (!fWorksheet) return;
|
|
5361
5577
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5362
5578
|
* fRange.setVerticalAlignment('top');
|
|
5363
5579
|
* ```
|
|
@@ -5378,7 +5594,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5378
5594
|
* @example
|
|
5379
5595
|
* ```ts
|
|
5380
5596
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5381
|
-
* const fWorksheet = fWorkbook.
|
|
5597
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5598
|
+
* if (!fWorksheet) return;
|
|
5382
5599
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5383
5600
|
* fRange.setHorizontalAlignment('left');
|
|
5384
5601
|
* ```
|
|
@@ -5399,7 +5616,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5399
5616
|
* @example
|
|
5400
5617
|
* ```ts
|
|
5401
5618
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5402
|
-
* const fWorksheet = fWorkbook.
|
|
5619
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5620
|
+
* if (!fWorksheet) return;
|
|
5403
5621
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5404
5622
|
* fRange.setValues([
|
|
5405
5623
|
* [1, { v: 2, s: { bg: { rgb: '#ff0000' } } }],
|
|
@@ -5424,7 +5642,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5424
5642
|
* @example
|
|
5425
5643
|
* ```ts
|
|
5426
5644
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5427
|
-
* const fWorksheet = fWorkbook.
|
|
5645
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5646
|
+
* if (!fWorksheet) return;
|
|
5428
5647
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5429
5648
|
* fRange.setFontWeight('bold');
|
|
5430
5649
|
* ```
|
|
@@ -5455,7 +5674,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5455
5674
|
* @example
|
|
5456
5675
|
* ```ts
|
|
5457
5676
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5458
|
-
* const fWorksheet = fWorkbook.
|
|
5677
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5678
|
+
* if (!fWorksheet) return;
|
|
5459
5679
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5460
5680
|
* fRange.setFontStyle('italic');
|
|
5461
5681
|
* ```
|
|
@@ -5486,7 +5706,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5486
5706
|
* @example
|
|
5487
5707
|
* ```ts
|
|
5488
5708
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5489
|
-
* const fWorksheet = fWorkbook.
|
|
5709
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5710
|
+
* if (!fWorksheet) return;
|
|
5490
5711
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5491
5712
|
* fRange.setFontLine('underline');
|
|
5492
5713
|
* ```
|
|
@@ -5546,7 +5767,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5546
5767
|
* @example
|
|
5547
5768
|
* ```ts
|
|
5548
5769
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5549
|
-
* const fWorksheet = fWorkbook.
|
|
5770
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5771
|
+
* if (!fWorksheet) return;
|
|
5550
5772
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5551
5773
|
* fRange.setFontFamily('Arial');
|
|
5552
5774
|
* ```
|
|
@@ -5572,7 +5794,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5572
5794
|
* @example
|
|
5573
5795
|
* ```ts
|
|
5574
5796
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5575
|
-
* const fWorksheet = fWorkbook.
|
|
5797
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5798
|
+
* if (!fWorksheet) return;
|
|
5576
5799
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5577
5800
|
* fRange.setFontSize(24);
|
|
5578
5801
|
* ```
|
|
@@ -5598,7 +5821,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5598
5821
|
* @example
|
|
5599
5822
|
* ```ts
|
|
5600
5823
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5601
|
-
* const fWorksheet = fWorkbook.
|
|
5824
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5825
|
+
* if (!fWorksheet) return;
|
|
5602
5826
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5603
5827
|
* fRange.setFontColor('#ff0000');
|
|
5604
5828
|
* ```
|
|
@@ -5626,7 +5850,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5626
5850
|
* @example
|
|
5627
5851
|
* ```ts
|
|
5628
5852
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5629
|
-
* const fWorksheet = fWorkbook.
|
|
5853
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5854
|
+
* if (!fWorksheet) return;
|
|
5630
5855
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5631
5856
|
* fRange.merge();
|
|
5632
5857
|
* console.log(fRange.isMerged());
|
|
@@ -5634,7 +5859,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5634
5859
|
*
|
|
5635
5860
|
* ```ts
|
|
5636
5861
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5637
|
-
* const fWorksheet = fWorkbook.
|
|
5862
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5863
|
+
* if (!fWorksheet) return;
|
|
5638
5864
|
* const fRange = fWorksheet.getRange('B1:C2');
|
|
5639
5865
|
* // Assume A1:B2 is already merged.
|
|
5640
5866
|
* fRange.merge({ isForceMerge: true });
|
|
@@ -5656,7 +5882,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5656
5882
|
* ```ts
|
|
5657
5883
|
* // Assume the active sheet is a new sheet with no merged cells.
|
|
5658
5884
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5659
|
-
* const fWorksheet = fWorkbook.
|
|
5885
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5886
|
+
* if (!fWorksheet) return;
|
|
5660
5887
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5661
5888
|
* fRange.mergeAcross();
|
|
5662
5889
|
* // There will be two merged cells. A1:B1 and A2:B2.
|
|
@@ -5668,7 +5895,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5668
5895
|
*
|
|
5669
5896
|
* ```ts
|
|
5670
5897
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5671
|
-
* const fWorksheet = fWorkbook.
|
|
5898
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5899
|
+
* if (!fWorksheet) return;
|
|
5672
5900
|
* const fRange = fWorksheet.getRange('B1:C2');
|
|
5673
5901
|
* // Assume A1:B2 is already merged.
|
|
5674
5902
|
* fRange.mergeAcross({ isForceMerge: true });
|
|
@@ -5691,7 +5919,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5691
5919
|
* ```ts
|
|
5692
5920
|
* // Assume the active sheet is a new sheet with no merged cells.
|
|
5693
5921
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5694
|
-
* const fWorksheet = fWorkbook.
|
|
5922
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5923
|
+
* if (!fWorksheet) return;
|
|
5695
5924
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5696
5925
|
* fRange.mergeVertically();
|
|
5697
5926
|
* // There will be two merged cells. A1:A2 and B1:B2.
|
|
@@ -5703,7 +5932,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5703
5932
|
*
|
|
5704
5933
|
* ```ts
|
|
5705
5934
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5706
|
-
* const fWorksheet = fWorkbook.
|
|
5935
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5936
|
+
* if (!fWorksheet) return;
|
|
5707
5937
|
* const fRange = fWorksheet.getRange('B1:C2');
|
|
5708
5938
|
* // Assume A1:B2 is already merged.
|
|
5709
5939
|
* fRange.mergeVertically({ isForceMerge: true });
|
|
@@ -5722,7 +5952,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5722
5952
|
* @example
|
|
5723
5953
|
* ```ts
|
|
5724
5954
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5725
|
-
* const fWorksheet = fWorkbook.
|
|
5955
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5956
|
+
* if (!fWorksheet) return;
|
|
5726
5957
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5727
5958
|
* fRange.merge();
|
|
5728
5959
|
* const anchor = fWorksheet.getRange('A1');
|
|
@@ -5739,7 +5970,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5739
5970
|
* @example
|
|
5740
5971
|
* ```ts
|
|
5741
5972
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5742
|
-
* const fWorksheet = fWorkbook.
|
|
5973
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5974
|
+
* if (!fWorksheet) return;
|
|
5743
5975
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5744
5976
|
* fRange.merge();
|
|
5745
5977
|
* const anchor = fWorksheet.getRange('A1');
|
|
@@ -5764,7 +5996,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5764
5996
|
* @param {ICellData} callback.cell the cell data
|
|
5765
5997
|
* ```ts
|
|
5766
5998
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5767
|
-
* const fWorksheet = fWorkbook.
|
|
5999
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
6000
|
+
* if (!fWorksheet) return;
|
|
5768
6001
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5769
6002
|
* fRange.forEach((row, col, cell) => {
|
|
5770
6003
|
* console.log(row, col, cell);
|
|
@@ -5785,7 +6018,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5785
6018
|
* @returns {string} The A1 notation of the range.
|
|
5786
6019
|
* ```ts
|
|
5787
6020
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5788
|
-
* const fWorksheet = fWorkbook.
|
|
6021
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
6022
|
+
* if (!fWorksheet) return;
|
|
5789
6023
|
*
|
|
5790
6024
|
* // By default, the A1 notation is returned without the sheet name and without absolute reference types.
|
|
5791
6025
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
@@ -5823,7 +6057,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5823
6057
|
* @example
|
|
5824
6058
|
* ```ts
|
|
5825
6059
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5826
|
-
* const fWorksheet = fWorkbook.
|
|
6060
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
6061
|
+
* if (!fWorksheet) return;
|
|
5827
6062
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5828
6063
|
* fRange.activate(); // the active cell will be A1
|
|
5829
6064
|
* ```
|
|
@@ -5841,7 +6076,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5841
6076
|
* @example
|
|
5842
6077
|
* ```ts
|
|
5843
6078
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5844
|
-
* const fWorksheet = fWorkbook.
|
|
6079
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
6080
|
+
* if (!fWorksheet) return;
|
|
5845
6081
|
*
|
|
5846
6082
|
* // Set the range A1:B2 as the active range, default active cell is A1
|
|
5847
6083
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
@@ -5893,7 +6129,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5893
6129
|
* @example Show how to split text to columns with custom delimiter
|
|
5894
6130
|
* ```ts
|
|
5895
6131
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5896
|
-
* const fWorksheet = fWorkbook.
|
|
6132
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
6133
|
+
* if (!fWorksheet) return;
|
|
5897
6134
|
*
|
|
5898
6135
|
* // A1:A3 has following values:
|
|
5899
6136
|
* // A |
|
|
@@ -5935,7 +6172,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5935
6172
|
* @example
|
|
5936
6173
|
* ```ts
|
|
5937
6174
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5938
|
-
* const fWorksheet = fWorkbook.
|
|
6175
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
6176
|
+
* if (!fWorksheet) return;
|
|
5939
6177
|
* const fRange = fWorksheet.getRange('A1:E20');
|
|
5940
6178
|
* fRange.useThemeStyle('default');
|
|
5941
6179
|
* ```
|
|
@@ -5957,7 +6195,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5957
6195
|
* @example
|
|
5958
6196
|
* ```ts
|
|
5959
6197
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5960
|
-
* const fWorksheet = fWorkbook.
|
|
6198
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
6199
|
+
* if (!fWorksheet) return;
|
|
5961
6200
|
* const fRange = fWorksheet.getRange('A1:E20');
|
|
5962
6201
|
* fRange.removeThemeStyle('default');
|
|
5963
6202
|
* ```
|
|
@@ -5976,7 +6215,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5976
6215
|
* @example
|
|
5977
6216
|
* ```ts
|
|
5978
6217
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5979
|
-
* const fWorksheet = fWorkbook.
|
|
6218
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
6219
|
+
* if (!fWorksheet) return;
|
|
5980
6220
|
* const fRange = fWorksheet.getRange('A1:E20');
|
|
5981
6221
|
* console.log(fRange.getUsedThemeStyle()); // undefined
|
|
5982
6222
|
* fRange.useThemeStyle('default');
|
|
@@ -5999,7 +6239,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5999
6239
|
* @example
|
|
6000
6240
|
* ```ts
|
|
6001
6241
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
6002
|
-
* const fWorkSheet = fWorkbook.
|
|
6242
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
6243
|
+
* if (!fWorkSheet) return;
|
|
6003
6244
|
* const fRange = fWorkSheet.getRange('A1:D10');
|
|
6004
6245
|
*
|
|
6005
6246
|
* // clear the content and format of the range A1:D10
|
|
@@ -6026,7 +6267,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
6026
6267
|
* @example
|
|
6027
6268
|
* ```typescript
|
|
6028
6269
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
6029
|
-
* const fWorkSheet = fWorkbook.
|
|
6270
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
6271
|
+
* if (!fWorkSheet) return;
|
|
6030
6272
|
* const fRange = fWorkSheet.getRange('A1:D10');
|
|
6031
6273
|
*
|
|
6032
6274
|
* // clear the content only of the range A1:D10
|
|
@@ -6047,7 +6289,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
6047
6289
|
* @example
|
|
6048
6290
|
* ```typescript
|
|
6049
6291
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
6050
|
-
* const fWorkSheet = fWorkbook.
|
|
6292
|
+
* const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
|
|
6293
|
+
* if (!fWorkSheet) return;
|
|
6051
6294
|
* const fRange = fWorkSheet.getRange('A1:D10');
|
|
6052
6295
|
* // clear the format only of the range A1:D10
|
|
6053
6296
|
* fRange.clearFormat();
|
|
@@ -6068,7 +6311,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
6068
6311
|
* ```ts
|
|
6069
6312
|
* // Assume the active sheet empty sheet.
|
|
6070
6313
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
6071
|
-
* const fWorksheet = fWorkbook.
|
|
6314
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
6315
|
+
* if (!fWorksheet) return;
|
|
6072
6316
|
* const values = [
|
|
6073
6317
|
* [1, 2, 3, 4],
|
|
6074
6318
|
* [2, 3, 4, 5],
|
|
@@ -6127,7 +6371,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
6127
6371
|
* ```ts
|
|
6128
6372
|
* // Assume the active sheet empty sheet.
|
|
6129
6373
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
6130
|
-
* const fWorksheet = fWorkbook.
|
|
6374
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
6375
|
+
* if (!fWorksheet) return;
|
|
6131
6376
|
* const values = [
|
|
6132
6377
|
* [1, 2, 3, 4],
|
|
6133
6378
|
* [2, 3, 4, 5],
|
|
@@ -6190,7 +6435,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
6190
6435
|
* ```ts
|
|
6191
6436
|
* // Assume the active sheet is a new sheet with no data.
|
|
6192
6437
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
6193
|
-
* const fWorksheet = fWorkbook.
|
|
6438
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
6439
|
+
* if (!fWorksheet) return;
|
|
6194
6440
|
*
|
|
6195
6441
|
* // Set the range A1:D4 with some values, the range A1:D4 will be:
|
|
6196
6442
|
* // | | |
|
|
@@ -6260,7 +6506,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
6260
6506
|
* ```ts
|
|
6261
6507
|
* // Assume the active sheet is a new sheet with no data.
|
|
6262
6508
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
6263
|
-
* const fWorksheet = fWorkbook.
|
|
6509
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
6510
|
+
* if (!fWorksheet) return;
|
|
6264
6511
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
6265
6512
|
* console.log(fRange.isBlank()); // true
|
|
6266
6513
|
*
|
|
@@ -6292,7 +6539,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
6292
6539
|
* @example
|
|
6293
6540
|
* ```ts
|
|
6294
6541
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
6295
|
-
* const fWorksheet = fWorkbook.
|
|
6542
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
6543
|
+
* if (!fWorksheet) return;
|
|
6296
6544
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
6297
6545
|
* console.log(fRange.getA1Notation()); // A1:B2
|
|
6298
6546
|
*
|
|
@@ -6322,7 +6570,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
6322
6570
|
* @example
|
|
6323
6571
|
* ```ts
|
|
6324
6572
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
6325
|
-
* const fWorksheet = fWorkbook.
|
|
6573
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
6574
|
+
* if (!fWorksheet) return;
|
|
6326
6575
|
* const fRange = fWorksheet.getRange('A1');
|
|
6327
6576
|
* fRange.setFormula('=SUM(A2:A5)');
|
|
6328
6577
|
* console.log(fRange.getFormula()); // '=SUM(A2:A5)'
|
|
@@ -6338,7 +6587,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
6338
6587
|
* @example
|
|
6339
6588
|
* ```ts
|
|
6340
6589
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
6341
|
-
* const fWorksheet = fWorkbook.
|
|
6590
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
6591
|
+
* if (!fWorksheet) return;
|
|
6342
6592
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
6343
6593
|
* fRange.setFormulas([
|
|
6344
6594
|
* ['=SUM(A2:A5)', '=SUM(B2:B5)'],
|
|
@@ -6356,7 +6606,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
6356
6606
|
* @returns {FRangePermission} - The RangePermission instance.
|
|
6357
6607
|
* @example
|
|
6358
6608
|
* ```ts
|
|
6359
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().
|
|
6609
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
6610
|
+
* if (!fWorksheet) return;
|
|
6360
6611
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
6361
6612
|
* const permission = fRange.getRangePermission();
|
|
6362
6613
|
*
|
|
@@ -6391,7 +6642,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
6391
6642
|
* ```ts
|
|
6392
6643
|
* // Auto-fill the range D1:D10 based on the data in the range C1:C2
|
|
6393
6644
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
6394
|
-
* const fWorksheet = fWorkbook.
|
|
6645
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
6646
|
+
* if (!fWorksheet) return;
|
|
6395
6647
|
* const fRange = fWorksheet.getRange('A1:A4');
|
|
6396
6648
|
*
|
|
6397
6649
|
* // Auto-fill without specifying applyType (default behavior)
|
|
@@ -6443,7 +6695,8 @@ _FRange2._enableManualInit();
|
|
|
6443
6695
|
FRange = _FRange = __decorate([
|
|
6444
6696
|
__decorateParam(3, Inject(Injector)),
|
|
6445
6697
|
__decorateParam(4, ICommandService),
|
|
6446
|
-
__decorateParam(5, Inject(FormulaDataModel))
|
|
6698
|
+
__decorateParam(5, Inject(FormulaDataModel)),
|
|
6699
|
+
__decorateParam(6, ILogService)
|
|
6447
6700
|
], FRange);
|
|
6448
6701
|
|
|
6449
6702
|
//#endregion
|
|
@@ -6779,7 +7032,7 @@ FWorkbookPermission = __decorate([
|
|
|
6779
7032
|
//#endregion
|
|
6780
7033
|
//#region src/facade/f-workbook.ts
|
|
6781
7034
|
let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
6782
|
-
constructor(_workbook, _injector, _resourceLoaderService, _selectionManagerService, _univerInstanceService, _commandService, _permissionService, _logService,
|
|
7035
|
+
constructor(_workbook, _injector, _resourceLoaderService, _selectionManagerService, _univerInstanceService, _commandService, _permissionService, _logService, _definedNamesService) {
|
|
6783
7036
|
super(_injector);
|
|
6784
7037
|
this._workbook = _workbook;
|
|
6785
7038
|
this._injector = _injector;
|
|
@@ -6789,7 +7042,6 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
6789
7042
|
this._commandService = _commandService;
|
|
6790
7043
|
this._permissionService = _permissionService;
|
|
6791
7044
|
this._logService = _logService;
|
|
6792
|
-
this._localeService = _localeService;
|
|
6793
7045
|
this._definedNamesService = _definedNamesService;
|
|
6794
7046
|
_defineProperty(this, "id", void 0);
|
|
6795
7047
|
this.id = this._workbook.getUnitId();
|
|
@@ -6872,21 +7124,6 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
6872
7124
|
return this._resourceLoaderService.saveUnit(this._workbook.getUnitId());
|
|
6873
7125
|
}
|
|
6874
7126
|
/**
|
|
6875
|
-
* @deprecated use 'save' instead.
|
|
6876
|
-
* @returns {IWorkbookData} Workbook snapshot data
|
|
6877
|
-
* @memberof FWorkbook
|
|
6878
|
-
* @example
|
|
6879
|
-
* ```ts
|
|
6880
|
-
* // The code below saves the workbook snapshot data
|
|
6881
|
-
* const activeSpreadsheet = univerAPI.getActiveWorkbook();
|
|
6882
|
-
* const snapshot = activeSpreadsheet.getSnapshot();
|
|
6883
|
-
* ```
|
|
6884
|
-
*/
|
|
6885
|
-
getSnapshot() {
|
|
6886
|
-
this._logService.warn("use 'save' instead of 'getSnapshot'");
|
|
6887
|
-
return this.save();
|
|
6888
|
-
}
|
|
6889
|
-
/**
|
|
6890
7127
|
* Get the active sheet of the workbook.
|
|
6891
7128
|
* @returns {FWorksheet} The active sheet of the workbook
|
|
6892
7129
|
* @example
|
|
@@ -6894,6 +7131,7 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
6894
7131
|
* // The code below gets the active sheet of the workbook
|
|
6895
7132
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
6896
7133
|
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
7134
|
+
* if (!fWorksheet) return;
|
|
6897
7135
|
* console.log(fWorksheet);
|
|
6898
7136
|
* ```
|
|
6899
7137
|
*/
|
|
@@ -7238,7 +7476,9 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
7238
7476
|
* @example
|
|
7239
7477
|
* ```ts
|
|
7240
7478
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
7241
|
-
* const
|
|
7479
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
7480
|
+
* if (!fWorksheet) return;
|
|
7481
|
+
* const range = fWorksheet.getRange('A10:B10');
|
|
7242
7482
|
* fWorkbook.setActiveRange(range);
|
|
7243
7483
|
* ```
|
|
7244
7484
|
*/
|
|
@@ -7316,7 +7556,8 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
7316
7556
|
* ```ts
|
|
7317
7557
|
* // The code below duplicates the given worksheet
|
|
7318
7558
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
7319
|
-
* const activeSheet = fWorkbook.
|
|
7559
|
+
* const activeSheet = fWorkbook.getSheetByName('Sheet1');
|
|
7560
|
+
* if (!activeSheet) return;
|
|
7320
7561
|
* const duplicatedSheet = fWorkbook.duplicateSheet(activeSheet);
|
|
7321
7562
|
* console.log(duplicatedSheet);
|
|
7322
7563
|
* ```
|
|
@@ -7356,42 +7597,6 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
7356
7597
|
return this._workbook.getSheets().length;
|
|
7357
7598
|
}
|
|
7358
7599
|
/**
|
|
7359
|
-
* Get the locale of the workbook.
|
|
7360
|
-
* @returns {LocaleType} The locale of the workbook
|
|
7361
|
-
* @example
|
|
7362
|
-
* ```ts
|
|
7363
|
-
* // The code below gets the locale of the workbook
|
|
7364
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
7365
|
-
* console.log(fWorkbook.getLocale());
|
|
7366
|
-
* ```
|
|
7367
|
-
*/
|
|
7368
|
-
getLocale() {
|
|
7369
|
-
return this._localeService.getCurrentLocale();
|
|
7370
|
-
}
|
|
7371
|
-
/**
|
|
7372
|
-
* @deprecated use `setSpreadsheetLocale` instead.
|
|
7373
|
-
* @param {LocaleType} locale - The locale to set
|
|
7374
|
-
*/
|
|
7375
|
-
setLocale(locale) {
|
|
7376
|
-
this._localeService.setLocale(locale);
|
|
7377
|
-
}
|
|
7378
|
-
/**
|
|
7379
|
-
* Set the locale of the workbook.
|
|
7380
|
-
* @param {LocaleType} locale The locale to set
|
|
7381
|
-
* @returns {FWorkbook} This workbook, for chaining
|
|
7382
|
-
* @example
|
|
7383
|
-
* ```ts
|
|
7384
|
-
* // The code below sets the locale of the workbook
|
|
7385
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
7386
|
-
* fWorkbook.setSpreadsheetLocale(univerAPI.Enum.LocaleType.EN_US);
|
|
7387
|
-
* console.log(fWorkbook.getLocale());
|
|
7388
|
-
* ```
|
|
7389
|
-
*/
|
|
7390
|
-
setSpreadsheetLocale(locale) {
|
|
7391
|
-
this._localeService.setLocale(locale);
|
|
7392
|
-
return this;
|
|
7393
|
-
}
|
|
7394
|
-
/**
|
|
7395
7600
|
* Get the URL of the workbook.
|
|
7396
7601
|
* @returns {string} The URL of the workbook
|
|
7397
7602
|
* @example
|
|
@@ -7414,7 +7619,8 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
7414
7619
|
* ```ts
|
|
7415
7620
|
* // The code below moves the sheet to the specified index
|
|
7416
7621
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
7417
|
-
* const sheet = fWorkbook.
|
|
7622
|
+
* const sheet = fWorkbook.getSheetByName('Sheet1');
|
|
7623
|
+
* if (!sheet) return;
|
|
7418
7624
|
* fWorkbook.moveSheet(sheet, 1);
|
|
7419
7625
|
* ```
|
|
7420
7626
|
*/
|
|
@@ -7695,6 +7901,7 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
7695
7901
|
* ```
|
|
7696
7902
|
*/
|
|
7697
7903
|
setCustomMetadata(custom) {
|
|
7904
|
+
this._logService.warn(SHEETS_CUSTOM_FIELD_WARNING_MESSAGE);
|
|
7698
7905
|
this._workbook.setCustomMetadata(custom);
|
|
7699
7906
|
return this;
|
|
7700
7907
|
}
|
|
@@ -7709,6 +7916,7 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
7709
7916
|
* ```
|
|
7710
7917
|
*/
|
|
7711
7918
|
getCustomMetadata() {
|
|
7919
|
+
this._logService.warn(SHEETS_CUSTOM_FIELD_WARNING_MESSAGE);
|
|
7712
7920
|
return this._workbook.getCustomMetadata();
|
|
7713
7921
|
}
|
|
7714
7922
|
/**
|
|
@@ -7735,7 +7943,8 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
7735
7943
|
* fWorkbook.addStyles(styles);
|
|
7736
7944
|
*
|
|
7737
7945
|
* // Set values with the new styles
|
|
7738
|
-
* const fWorksheet = fWorkbook.
|
|
7946
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
7947
|
+
* if (!fWorksheet) return;
|
|
7739
7948
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
7740
7949
|
* fRange.setValues([
|
|
7741
7950
|
* [{ v: 'Hello', s: 'custom-style-1' }, { v: 'Univer', s: 'custom-style-1' }],
|
|
@@ -7770,7 +7979,8 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
7770
7979
|
* fWorkbook.addStyles(styles);
|
|
7771
7980
|
*
|
|
7772
7981
|
* // Set values with the new styles
|
|
7773
|
-
* const fWorksheet = fWorkbook.
|
|
7982
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
7983
|
+
* if (!fWorksheet) return;
|
|
7774
7984
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
7775
7985
|
* fRange.setValues([
|
|
7776
7986
|
* [{ v: 'Hello', s: 'custom-style-1' }, { v: 'Univer', s: 'custom-style-1' }],
|
|
@@ -7796,62 +8006,52 @@ FWorkbook = __decorate([
|
|
|
7796
8006
|
__decorateParam(5, ICommandService),
|
|
7797
8007
|
__decorateParam(6, IPermissionService),
|
|
7798
8008
|
__decorateParam(7, ILogService),
|
|
7799
|
-
__decorateParam(8,
|
|
7800
|
-
__decorateParam(9, IDefinedNamesService)
|
|
8009
|
+
__decorateParam(8, IDefinedNamesService)
|
|
7801
8010
|
], FWorkbook);
|
|
7802
8011
|
|
|
7803
8012
|
//#endregion
|
|
7804
8013
|
//#region src/facade/f-univer.ts
|
|
7805
8014
|
var FUniverSheetsMixin = class extends FUniver {
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
8015
|
+
createWorkbook(data, options) {
|
|
8016
|
+
const workbook = this._injector.get(IUniverInstanceService).createUnit(UniverInstanceType.UNIVER_SHEET, data, options);
|
|
8017
|
+
return this._injector.createInstance(FWorkbook, workbook);
|
|
8018
|
+
}
|
|
8019
|
+
getActiveWorkbook() {
|
|
8020
|
+
const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
8021
|
+
if (!workbook) return null;
|
|
8022
|
+
return this._injector.createInstance(FWorkbook, workbook);
|
|
8023
|
+
}
|
|
8024
|
+
getWorkbook(id) {
|
|
8025
|
+
const workbook = this._univerInstanceService.getUnit(id, UniverInstanceType.UNIVER_SHEET);
|
|
8026
|
+
if (!workbook) return null;
|
|
8027
|
+
return this._injector.createInstance(FWorkbook, workbook);
|
|
8028
|
+
}
|
|
8029
|
+
getSheetCommandTarget(params = {}) {
|
|
8030
|
+
const { unitId, subUnitId, sheetId } = params;
|
|
8031
|
+
const workbook = unitId ? this.getWorkbook(unitId) : this.getActiveWorkbook();
|
|
8032
|
+
if (!workbook) return null;
|
|
8033
|
+
const sheetIdToFind = subUnitId || sheetId;
|
|
8034
|
+
const worksheet = sheetIdToFind ? workbook.getSheetBySheetId(sheetIdToFind) : workbook.getActiveSheet();
|
|
8035
|
+
if (!worksheet) return null;
|
|
7814
8036
|
return {
|
|
7815
8037
|
workbook,
|
|
7816
|
-
worksheet
|
|
8038
|
+
worksheet,
|
|
8039
|
+
unitId: workbook.getId(),
|
|
8040
|
+
subUnitId: worksheet.getSheetId()
|
|
7817
8041
|
};
|
|
7818
8042
|
}
|
|
7819
|
-
|
|
7820
|
-
const workbook = this.
|
|
7821
|
-
if (!workbook) return;
|
|
7822
|
-
const worksheet = workbook.
|
|
7823
|
-
if (!worksheet) return;
|
|
8043
|
+
getActiveSheet() {
|
|
8044
|
+
const workbook = this.getActiveWorkbook();
|
|
8045
|
+
if (!workbook) return null;
|
|
8046
|
+
const worksheet = workbook.getActiveSheet();
|
|
8047
|
+
if (!worksheet) return null;
|
|
7824
8048
|
return {
|
|
7825
8049
|
workbook,
|
|
7826
8050
|
worksheet
|
|
7827
8051
|
};
|
|
7828
8052
|
}
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
this.disposeWithMe(this.registerEventHandler(this.Event.WorkbookDisposed, () => univerInstanceService.unitDisposed$.subscribe((unit) => {
|
|
7832
|
-
if (unit.type === UniverInstanceType.UNIVER_SHEET) {
|
|
7833
|
-
const eventParams = {
|
|
7834
|
-
unitId: unit.getUnitId(),
|
|
7835
|
-
unitType: unit.type,
|
|
7836
|
-
snapshot: unit.getSnapshot()
|
|
7837
|
-
};
|
|
7838
|
-
this.fireEvent(this.Event.WorkbookDisposed, eventParams);
|
|
7839
|
-
}
|
|
7840
|
-
})));
|
|
7841
|
-
this.disposeWithMe(this.registerEventHandler(this.Event.WorkbookCreated, () => univerInstanceService.unitAdded$.subscribe((event) => {
|
|
7842
|
-
const { unit } = event;
|
|
7843
|
-
if (unit.type === UniverInstanceType.UNIVER_SHEET) {
|
|
7844
|
-
const workbook = unit;
|
|
7845
|
-
const workbookUnit = injector.createInstance(FWorkbook, workbook);
|
|
7846
|
-
const eventParams = {
|
|
7847
|
-
unitId: unit.getUnitId(),
|
|
7848
|
-
type: unit.type,
|
|
7849
|
-
workbook: workbookUnit,
|
|
7850
|
-
unit: workbookUnit
|
|
7851
|
-
};
|
|
7852
|
-
this.fireEvent(this.Event.WorkbookCreated, eventParams);
|
|
7853
|
-
}
|
|
7854
|
-
})));
|
|
8053
|
+
setFreezeSync(enabled) {
|
|
8054
|
+
this._injector.get(SheetsFreezeSyncController).setEnabled(enabled);
|
|
7855
8055
|
}
|
|
7856
8056
|
/**
|
|
7857
8057
|
* @ignore
|
|
@@ -7861,9 +8061,8 @@ var FUniverSheetsMixin = class extends FUniver {
|
|
|
7861
8061
|
const commandService = injector.get(ICommandService);
|
|
7862
8062
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetCreate, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
7863
8063
|
if (commandInfo.id === InsertSheetCommand.id) {
|
|
7864
|
-
var _this$getActiveWorkbo2;
|
|
7865
8064
|
const { unitId, index, sheet } = commandInfo.params || {};
|
|
7866
|
-
const workbook = unitId ? this.
|
|
8065
|
+
const workbook = unitId ? this.getWorkbook(unitId) : this.getActiveWorkbook();
|
|
7867
8066
|
if (!workbook) return;
|
|
7868
8067
|
const eventParams = {
|
|
7869
8068
|
workbook,
|
|
@@ -7876,11 +8075,10 @@ var FUniverSheetsMixin = class extends FUniver {
|
|
|
7876
8075
|
})));
|
|
7877
8076
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeActiveSheetChange, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
7878
8077
|
if (commandInfo.id === SetWorksheetActiveOperation.id) {
|
|
7879
|
-
|
|
7880
|
-
const
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
const activeSheet = workbook.getSheetBySheetId(sheetId);
|
|
8078
|
+
const params = commandInfo.params;
|
|
8079
|
+
const target = this.getSheetCommandTarget(params);
|
|
8080
|
+
if (!target) return;
|
|
8081
|
+
const { workbook, worksheet: activeSheet } = target;
|
|
7884
8082
|
const oldActiveSheet = workbook.getActiveSheet();
|
|
7885
8083
|
if (!activeSheet || !oldActiveSheet) return;
|
|
7886
8084
|
const eventParams = {
|
|
@@ -7894,7 +8092,8 @@ var FUniverSheetsMixin = class extends FUniver {
|
|
|
7894
8092
|
})));
|
|
7895
8093
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDelete, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
7896
8094
|
if (commandInfo.id === RemoveSheetCommand.id) {
|
|
7897
|
-
const
|
|
8095
|
+
const params = commandInfo.params;
|
|
8096
|
+
const target = this.getSheetCommandTarget(params);
|
|
7898
8097
|
if (!target) return;
|
|
7899
8098
|
const { workbook, worksheet } = target;
|
|
7900
8099
|
const eventParams = {
|
|
@@ -7907,14 +8106,16 @@ var FUniverSheetsMixin = class extends FUniver {
|
|
|
7907
8106
|
})));
|
|
7908
8107
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetMove, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
7909
8108
|
if (commandInfo.id === SetWorksheetOrderMutation.id) {
|
|
7910
|
-
const
|
|
7911
|
-
const target = this.
|
|
8109
|
+
const params = commandInfo.params;
|
|
8110
|
+
const target = this.getSheetCommandTarget(params);
|
|
7912
8111
|
if (!target) return;
|
|
8112
|
+
const { workbook, worksheet } = target;
|
|
8113
|
+
const { fromOrder: oldIndex, toOrder: newIndex } = params;
|
|
7913
8114
|
const eventParams = {
|
|
7914
|
-
workbook
|
|
7915
|
-
worksheet
|
|
7916
|
-
newIndex
|
|
7917
|
-
oldIndex
|
|
8115
|
+
workbook,
|
|
8116
|
+
worksheet,
|
|
8117
|
+
newIndex,
|
|
8118
|
+
oldIndex
|
|
7918
8119
|
};
|
|
7919
8120
|
this.fireEvent(this.Event.BeforeSheetMove, eventParams);
|
|
7920
8121
|
if (eventParams.cancel) throw new CanceledError();
|
|
@@ -7922,14 +8123,17 @@ var FUniverSheetsMixin = class extends FUniver {
|
|
|
7922
8123
|
})));
|
|
7923
8124
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNameChange, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
7924
8125
|
if (commandInfo.id === SetWorksheetNameCommand.id) {
|
|
7925
|
-
const
|
|
7926
|
-
const target = this.
|
|
8126
|
+
const params = commandInfo.params;
|
|
8127
|
+
const target = this.getSheetCommandTarget(params);
|
|
7927
8128
|
if (!target) return;
|
|
8129
|
+
const { workbook, worksheet } = target;
|
|
8130
|
+
const oldName = worksheet.getSheetName();
|
|
8131
|
+
const { name: newName } = params;
|
|
7928
8132
|
const eventParams = {
|
|
7929
|
-
workbook
|
|
7930
|
-
worksheet
|
|
7931
|
-
newName
|
|
7932
|
-
oldName
|
|
8133
|
+
workbook,
|
|
8134
|
+
worksheet,
|
|
8135
|
+
newName,
|
|
8136
|
+
oldName
|
|
7933
8137
|
};
|
|
7934
8138
|
this.fireEvent(this.Event.BeforeSheetNameChange, eventParams);
|
|
7935
8139
|
if (eventParams.cancel) throw new CanceledError();
|
|
@@ -7937,14 +8141,17 @@ var FUniverSheetsMixin = class extends FUniver {
|
|
|
7937
8141
|
})));
|
|
7938
8142
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetTabColorChange, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
7939
8143
|
if (commandInfo.id === SetTabColorMutation.id) {
|
|
7940
|
-
const
|
|
7941
|
-
const target = this.
|
|
8144
|
+
const params = commandInfo.params;
|
|
8145
|
+
const target = this.getSheetCommandTarget(params);
|
|
7942
8146
|
if (!target) return;
|
|
8147
|
+
const { workbook, worksheet } = target;
|
|
8148
|
+
const oldColor = worksheet.getTabColor();
|
|
8149
|
+
const { color: newColor } = params;
|
|
7943
8150
|
const eventParams = {
|
|
7944
|
-
workbook
|
|
7945
|
-
worksheet
|
|
7946
|
-
newColor
|
|
7947
|
-
oldColor
|
|
8151
|
+
workbook,
|
|
8152
|
+
worksheet,
|
|
8153
|
+
newColor,
|
|
8154
|
+
oldColor
|
|
7948
8155
|
};
|
|
7949
8156
|
this.fireEvent(this.Event.BeforeSheetTabColorChange, eventParams);
|
|
7950
8157
|
if (eventParams.cancel) throw new CanceledError();
|
|
@@ -7952,12 +8159,14 @@ var FUniverSheetsMixin = class extends FUniver {
|
|
|
7952
8159
|
})));
|
|
7953
8160
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetHideChange, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
7954
8161
|
if (commandInfo.id === SetWorksheetHideMutation.id) {
|
|
7955
|
-
const
|
|
7956
|
-
const target = this.
|
|
8162
|
+
const params = commandInfo.params;
|
|
8163
|
+
const target = this.getSheetCommandTarget(params);
|
|
7957
8164
|
if (!target) return;
|
|
8165
|
+
const { workbook, worksheet } = target;
|
|
8166
|
+
const { hidden } = params;
|
|
7958
8167
|
const eventParams = {
|
|
7959
|
-
workbook
|
|
7960
|
-
worksheet
|
|
8168
|
+
workbook,
|
|
8169
|
+
worksheet,
|
|
7961
8170
|
hidden: Boolean(hidden)
|
|
7962
8171
|
};
|
|
7963
8172
|
this.fireEvent(this.Event.BeforeSheetHideChange, eventParams);
|
|
@@ -7966,12 +8175,15 @@ var FUniverSheetsMixin = class extends FUniver {
|
|
|
7966
8175
|
})));
|
|
7967
8176
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeGridlineColorChange, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
7968
8177
|
if (commandInfo.id === SetGridlinesColorCommand.id) {
|
|
7969
|
-
|
|
7970
|
-
const target = this.
|
|
8178
|
+
const params = commandInfo.params;
|
|
8179
|
+
const target = this.getSheetCommandTarget(params);
|
|
7971
8180
|
if (!target) return;
|
|
8181
|
+
const { workbook, worksheet } = target;
|
|
8182
|
+
const { color } = params;
|
|
7972
8183
|
const eventParams = {
|
|
7973
|
-
|
|
7974
|
-
|
|
8184
|
+
workbook,
|
|
8185
|
+
worksheet,
|
|
8186
|
+
color
|
|
7975
8187
|
};
|
|
7976
8188
|
this.fireEvent(this.Event.BeforeGridlineColorChange, eventParams);
|
|
7977
8189
|
if (eventParams.cancel) throw new CanceledError();
|
|
@@ -7979,12 +8191,15 @@ var FUniverSheetsMixin = class extends FUniver {
|
|
|
7979
8191
|
})));
|
|
7980
8192
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeGridlineEnableChange, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
7981
8193
|
if (commandInfo.id === ToggleGridlinesCommand.id) {
|
|
7982
|
-
var
|
|
7983
|
-
const
|
|
8194
|
+
var _params$showGridlines;
|
|
8195
|
+
const params = commandInfo.params;
|
|
8196
|
+
const target = this.getSheetCommandTarget(params);
|
|
7984
8197
|
if (!target) return;
|
|
7985
|
-
const
|
|
8198
|
+
const { workbook, worksheet } = target;
|
|
8199
|
+
const showGridlines = (_params$showGridlines = params.showGridlines) !== null && _params$showGridlines !== void 0 ? _params$showGridlines : !worksheet.hasHiddenGridLines();
|
|
7986
8200
|
const eventParams = {
|
|
7987
|
-
|
|
8201
|
+
workbook,
|
|
8202
|
+
worksheet,
|
|
7988
8203
|
enabled: Boolean(showGridlines)
|
|
7989
8204
|
};
|
|
7990
8205
|
this.fireEvent(this.Event.BeforeGridlineEnableChange, eventParams);
|
|
@@ -8008,12 +8223,10 @@ var FUniverSheetsMixin = class extends FUniver {
|
|
|
8008
8223
|
})));
|
|
8009
8224
|
this.disposeWithMe(this.registerEventHandler(this.Event.SheetCreated, () => commandService.onCommandExecuted((commandInfo) => {
|
|
8010
8225
|
if (commandInfo.id === InsertSheetCommand.id) {
|
|
8011
|
-
|
|
8012
|
-
const
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
const worksheet = workbook.getActiveSheet();
|
|
8016
|
-
if (!worksheet) return;
|
|
8226
|
+
const params = commandInfo.params;
|
|
8227
|
+
const target = this.getSheetCommandTarget(params);
|
|
8228
|
+
if (!target) return;
|
|
8229
|
+
const { workbook, worksheet } = target;
|
|
8017
8230
|
const eventParams = {
|
|
8018
8231
|
workbook,
|
|
8019
8232
|
worksheet
|
|
@@ -8023,7 +8236,8 @@ var FUniverSheetsMixin = class extends FUniver {
|
|
|
8023
8236
|
})));
|
|
8024
8237
|
this.disposeWithMe(this.registerEventHandler(this.Event.ActiveSheetChanged, () => commandService.onCommandExecuted((commandInfo) => {
|
|
8025
8238
|
if (commandInfo.id === SetWorksheetActiveOperation.id) {
|
|
8026
|
-
const
|
|
8239
|
+
const params = commandInfo.params;
|
|
8240
|
+
const target = this.getSheetCommandTarget(params);
|
|
8027
8241
|
if (!target) return;
|
|
8028
8242
|
const { workbook, worksheet: activeSheet } = target;
|
|
8029
8243
|
const eventParams = {
|
|
@@ -8035,9 +8249,8 @@ var FUniverSheetsMixin = class extends FUniver {
|
|
|
8035
8249
|
})));
|
|
8036
8250
|
this.disposeWithMe(this.registerEventHandler(this.Event.SheetDeleted, () => commandService.onCommandExecuted((commandInfo) => {
|
|
8037
8251
|
if (commandInfo.id === RemoveSheetCommand.id) {
|
|
8038
|
-
|
|
8039
|
-
const
|
|
8040
|
-
const workbook = unitId ? this.getUniverSheet(unitId) : (_this$getActiveWorkbo5 = this.getActiveWorkbook) === null || _this$getActiveWorkbo5 === void 0 ? void 0 : _this$getActiveWorkbo5.call(this);
|
|
8252
|
+
const { unitId, subUnitId: sheetId } = commandInfo.params;
|
|
8253
|
+
const workbook = unitId ? this.getWorkbook(unitId) : this.getActiveWorkbook();
|
|
8041
8254
|
if (!workbook || !sheetId) return;
|
|
8042
8255
|
const eventParams = {
|
|
8043
8256
|
workbook,
|
|
@@ -8048,52 +8261,56 @@ var FUniverSheetsMixin = class extends FUniver {
|
|
|
8048
8261
|
})));
|
|
8049
8262
|
this.disposeWithMe(this.registerEventHandler(this.Event.SheetMoved, () => commandService.onCommandExecuted((commandInfo) => {
|
|
8050
8263
|
if (commandInfo.id === SetWorksheetOrderMutation.id) {
|
|
8051
|
-
const
|
|
8052
|
-
const target = this.
|
|
8264
|
+
const params = commandInfo.params;
|
|
8265
|
+
const target = this.getSheetCommandTarget(params);
|
|
8053
8266
|
if (!target) return;
|
|
8054
8267
|
const { workbook, worksheet } = target;
|
|
8268
|
+
const { toOrder: newIndex } = params;
|
|
8055
8269
|
const eventParams = {
|
|
8056
8270
|
workbook,
|
|
8057
8271
|
worksheet,
|
|
8058
|
-
newIndex
|
|
8272
|
+
newIndex
|
|
8059
8273
|
};
|
|
8060
8274
|
this.fireEvent(this.Event.SheetMoved, eventParams);
|
|
8061
8275
|
}
|
|
8062
8276
|
})));
|
|
8063
8277
|
this.disposeWithMe(this.registerEventHandler(this.Event.SheetNameChanged, () => commandService.onCommandExecuted((commandInfo) => {
|
|
8064
8278
|
if (commandInfo.id === SetWorksheetNameCommand.id) {
|
|
8065
|
-
const
|
|
8066
|
-
const target = this.
|
|
8279
|
+
const params = commandInfo.params;
|
|
8280
|
+
const target = this.getSheetCommandTarget(params);
|
|
8067
8281
|
if (!target) return;
|
|
8068
8282
|
const { workbook, worksheet } = target;
|
|
8283
|
+
const { name: newName } = params;
|
|
8069
8284
|
const eventParams = {
|
|
8070
8285
|
workbook,
|
|
8071
8286
|
worksheet,
|
|
8072
|
-
newName
|
|
8287
|
+
newName
|
|
8073
8288
|
};
|
|
8074
8289
|
this.fireEvent(this.Event.SheetNameChanged, eventParams);
|
|
8075
8290
|
}
|
|
8076
8291
|
})));
|
|
8077
8292
|
this.disposeWithMe(this.registerEventHandler(this.Event.SheetTabColorChanged, () => commandService.onCommandExecuted((commandInfo) => {
|
|
8078
8293
|
if (commandInfo.id === SetTabColorMutation.id) {
|
|
8079
|
-
const
|
|
8080
|
-
const target = this.
|
|
8294
|
+
const params = commandInfo.params;
|
|
8295
|
+
const target = this.getSheetCommandTarget(params);
|
|
8081
8296
|
if (!target) return;
|
|
8082
8297
|
const { workbook, worksheet } = target;
|
|
8298
|
+
const { color: newColor } = params;
|
|
8083
8299
|
const eventParams = {
|
|
8084
8300
|
workbook,
|
|
8085
8301
|
worksheet,
|
|
8086
|
-
newColor
|
|
8302
|
+
newColor
|
|
8087
8303
|
};
|
|
8088
8304
|
this.fireEvent(this.Event.SheetTabColorChanged, eventParams);
|
|
8089
8305
|
}
|
|
8090
8306
|
})));
|
|
8091
8307
|
this.disposeWithMe(this.registerEventHandler(this.Event.SheetHideChanged, () => commandService.onCommandExecuted((commandInfo) => {
|
|
8092
8308
|
if (commandInfo.id === SetWorksheetHideMutation.id) {
|
|
8093
|
-
const
|
|
8094
|
-
const target = this.
|
|
8309
|
+
const params = commandInfo.params;
|
|
8310
|
+
const target = this.getSheetCommandTarget(params);
|
|
8095
8311
|
if (!target) return;
|
|
8096
8312
|
const { workbook, worksheet } = target;
|
|
8313
|
+
const { hidden } = params;
|
|
8097
8314
|
const eventParams = {
|
|
8098
8315
|
workbook,
|
|
8099
8316
|
worksheet,
|
|
@@ -8104,58 +8321,47 @@ var FUniverSheetsMixin = class extends FUniver {
|
|
|
8104
8321
|
})));
|
|
8105
8322
|
this.disposeWithMe(this.registerEventHandler(this.Event.GridlineChanged, () => commandService.onCommandExecuted((commandInfo) => {
|
|
8106
8323
|
if (commandInfo.id === SetGridlinesColorCommand.id || commandInfo.id === ToggleGridlinesCommand.id) {
|
|
8107
|
-
const
|
|
8324
|
+
const params = commandInfo.params;
|
|
8325
|
+
const target = this.getSheetCommandTarget(params);
|
|
8108
8326
|
if (!target) return;
|
|
8327
|
+
const { workbook, worksheet } = target;
|
|
8109
8328
|
const eventParams = {
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8329
|
+
workbook,
|
|
8330
|
+
worksheet,
|
|
8331
|
+
enabled: !worksheet.hasHiddenGridLines(),
|
|
8332
|
+
color: worksheet.getGridLinesColor()
|
|
8113
8333
|
};
|
|
8114
8334
|
this.fireEvent(this.Event.GridlineChanged, eventParams);
|
|
8115
8335
|
}
|
|
8116
8336
|
})));
|
|
8117
8337
|
this._initWorkbookEvent(injector);
|
|
8118
8338
|
}
|
|
8119
|
-
|
|
8120
|
-
const
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
}));
|
|
8146
|
-
}
|
|
8147
|
-
getActiveSheet() {
|
|
8148
|
-
const workbook = this.getActiveWorkbook();
|
|
8149
|
-
if (!workbook) return null;
|
|
8150
|
-
const worksheet = workbook.getActiveSheet();
|
|
8151
|
-
if (!worksheet) return null;
|
|
8152
|
-
return {
|
|
8153
|
-
workbook,
|
|
8154
|
-
worksheet
|
|
8155
|
-
};
|
|
8156
|
-
}
|
|
8157
|
-
setFreezeSync(enabled) {
|
|
8158
|
-
this._injector.get(SheetsFreezeSyncController).setEnabled(enabled);
|
|
8339
|
+
_initWorkbookEvent(injector) {
|
|
8340
|
+
const univerInstanceService = injector.get(IUniverInstanceService);
|
|
8341
|
+
this.disposeWithMe(this.registerEventHandler(this.Event.WorkbookDisposed, () => univerInstanceService.unitDisposed$.subscribe((unit) => {
|
|
8342
|
+
if (unit.type === UniverInstanceType.UNIVER_SHEET) {
|
|
8343
|
+
const eventParams = {
|
|
8344
|
+
unitId: unit.getUnitId(),
|
|
8345
|
+
unitType: unit.type,
|
|
8346
|
+
snapshot: unit.getSnapshot()
|
|
8347
|
+
};
|
|
8348
|
+
this.fireEvent(this.Event.WorkbookDisposed, eventParams);
|
|
8349
|
+
}
|
|
8350
|
+
})));
|
|
8351
|
+
this.disposeWithMe(this.registerEventHandler(this.Event.WorkbookCreated, () => univerInstanceService.unitAdded$.subscribe((event) => {
|
|
8352
|
+
const { unit } = event;
|
|
8353
|
+
if (unit.type === UniverInstanceType.UNIVER_SHEET) {
|
|
8354
|
+
const workbook = unit;
|
|
8355
|
+
const workbookUnit = injector.createInstance(FWorkbook, workbook);
|
|
8356
|
+
const eventParams = {
|
|
8357
|
+
unitId: unit.getUnitId(),
|
|
8358
|
+
type: unit.type,
|
|
8359
|
+
workbook: workbookUnit,
|
|
8360
|
+
unit: workbookUnit
|
|
8361
|
+
};
|
|
8362
|
+
this.fireEvent(this.Event.WorkbookCreated, eventParams);
|
|
8363
|
+
}
|
|
8364
|
+
})));
|
|
8159
8365
|
}
|
|
8160
8366
|
};
|
|
8161
8367
|
FUniver.extend(FUniverSheetsMixin);
|
|
@@ -8269,29 +8475,4 @@ var FSheetsEventNameMixin = class extends FEventName {
|
|
|
8269
8475
|
FEventName.extend(FSheetsEventNameMixin);
|
|
8270
8476
|
|
|
8271
8477
|
//#endregion
|
|
8272
|
-
|
|
8273
|
-
/**
|
|
8274
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
8275
|
-
*
|
|
8276
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8277
|
-
* you may not use this file except in compliance with the License.
|
|
8278
|
-
* You may obtain a copy of the License at
|
|
8279
|
-
*
|
|
8280
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8281
|
-
*
|
|
8282
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
8283
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
8284
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8285
|
-
* See the License for the specific language governing permissions and
|
|
8286
|
-
* limitations under the License.
|
|
8287
|
-
*/
|
|
8288
|
-
let FSheetHooks = class FSheetHooks extends FBase {
|
|
8289
|
-
constructor(_injector) {
|
|
8290
|
-
super();
|
|
8291
|
-
this._injector = _injector;
|
|
8292
|
-
}
|
|
8293
|
-
};
|
|
8294
|
-
FSheetHooks = __decorate([__decorateParam(0, Inject(Injector))], FSheetHooks);
|
|
8295
|
-
|
|
8296
|
-
//#endregion
|
|
8297
|
-
export { FRange, FSelection, FSheetHooks, FSheetsEnumMixin, FSheetsEventNameMixin, FWorkbook, FWorkbookPermission, FWorksheet };
|
|
8478
|
+
export { FRange, FSelection, FSheetsEnumMixin, FSheetsEventNameMixin, FWorkbook, FWorkbookPermission, FWorksheet };
|