@univerjs/sheets 1.0.0-rc.0 → 1.0.1
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 +211 -110
- package/lib/cjs/index.js +350 -246
- package/lib/cjs/locale/ar-SA.js +0 -1
- package/lib/cjs/locale/ca-ES.js +0 -1
- package/lib/cjs/locale/de-DE.js +0 -1
- package/lib/cjs/locale/en-US.js +0 -1
- package/lib/cjs/locale/es-ES.js +0 -1
- package/lib/cjs/locale/fa-IR.js +0 -1
- package/lib/cjs/locale/fr-FR.js +0 -1
- package/lib/cjs/locale/id-ID.js +0 -1
- package/lib/cjs/locale/it-IT.js +0 -1
- package/lib/cjs/locale/ja-JP.js +0 -1
- package/lib/cjs/locale/ko-KR.js +0 -1
- package/lib/cjs/locale/pl-PL.js +0 -1
- package/lib/cjs/locale/pt-BR.js +0 -1
- package/lib/cjs/locale/ru-RU.js +0 -1
- package/lib/cjs/locale/sk-SK.js +0 -1
- package/lib/cjs/locale/vi-VN.js +0 -1
- package/lib/cjs/locale/zh-CN.js +0 -1
- package/lib/cjs/locale/zh-HK.js +0 -1
- package/lib/cjs/locale/zh-TW.js +0 -1
- package/lib/es/facade.js +212 -111
- package/lib/es/index.js +351 -248
- package/lib/facade.js +212 -111
- package/lib/index.js +351 -248
- package/lib/types/commands/commands/set-worksheet-hide.command.d.ts +4 -0
- package/lib/types/commands/mutations/set-range-values.mutation.d.ts +12 -1
- package/lib/types/commands/mutations/set-worksheet-hide.mutation.d.ts +2 -1
- package/lib/types/controllers/calculate-result-apply.controller.d.ts +1 -1
- package/lib/types/facade/f-defined-name.d.ts +2 -2
- package/lib/types/facade/f-range.d.ts +118 -45
- package/lib/types/facade/f-selection.d.ts +1 -1
- package/lib/types/facade/f-univer.d.ts +4 -5
- package/lib/types/facade/f-workbook.d.ts +8 -13
- package/lib/types/facade/f-worksheet.d.ts +43 -28
- package/lib/types/facade/permission/f-range-permission.d.ts +1 -1
- package/lib/types/facade/permission/f-range-protection-rule.d.ts +2 -2
- package/lib/types/facade/permission/f-workbook-permission.d.ts +3 -3
- package/lib/types/facade/permission/f-worksheet-permission.d.ts +5 -4
- package/lib/types/facade/utils.d.ts +1 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/services/auto-fill/tools.d.ts +2 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +2 -2
- package/package.json +9 -9
package/lib/facade.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BooleanNumber, CanceledError, DEFAULT_STYLES, Dimension, Direction, HorizontalAlign, IAuthzIoService, ICommandService, ILogService, IPermissionService, IResourceLoaderService, IUniverInstanceService, Inject, Injector, LocaleService, ObjectMatrix, RANGE_TYPE, Rectangle, RedoCommand, RichTextValue, TextStyleValue, Tools, UndoCommand, UniverInstanceType, VerticalAlign, WrapStrategy, cellToRange, covertCellValue, covertCellValues, generateIntervalsByPoints, generateRandomId, getDisplayValueFromCell, getOriginCellValue, isNullCell, mergeWorksheetSnapshotWithDefault, toDisposable } from "@univerjs/core";
|
|
1
|
+
import { BooleanNumber, CanceledError, DEFAULT_STYLES, Dimension, Direction, HorizontalAlign, IAuthzIoService, ICommandService, ILogService, IPermissionService, IResourceLoaderService, IUniverInstanceService, Inject, Injector, LocaleService, ObjectMatrix, RANGE_TYPE, Rectangle, RedoCommand, RichTextValue, TextStyleValue, Tools, UndoCommand, UniverInstanceType, VerticalAlign, WorksheetHiddenState, WrapStrategy, cellToRange, covertCellValue, covertCellValues, generateIntervalsByPoints, generateRandomId, getDisplayValueFromCell, getOriginCellValue, isNullCell, mergeWorksheetSnapshotWithDefault, toDisposable } from "@univerjs/core";
|
|
2
2
|
import { FBase, FBaseInitialable, FEnum, FEventName, FUniver } from "@univerjs/core/facade";
|
|
3
3
|
import { AddRangeProtectionMutation, AddWorksheetProtectionMutation, AppendRowCommand, AutoFillCommand, COMMAND_LISTENER_VALUE_CHANGE, CancelFrozenCommand, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, CopySheetCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeleteRangeProtectionMutation, DeleteWorksheetProtectionMutation, DeleteWorksheetRangeThemeStyleCommand, EditStateEnum, InsertColByRangeCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowByRangeCommand, InsertSheetCommand, MoveColsCommand, MoveRowsCommand, RangeProtectionPermissionDeleteProtectionPoint, RangeProtectionPermissionEditPoint, RangeProtectionPermissionManageCollaPoint, RangeProtectionPermissionViewPoint, RangeProtectionRuleModel, RangeThemeStyle, RegisterWorksheetRangeThemeStyleCommand, RemoveColByRangeCommand, RemoveDefinedNameCommand, RemoveRowByRangeCommand, RemoveSheetCommand, RemoveWorksheetMergeCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SetBorderBasicCommand, SetColDataCommand, SetColHiddenCommand, SetColWidthCommand, SetDefinedNameCommand, SetFrozenCommand, SetGridlinesColorCommand, SetHorizontalTextAlignCommand, SetRangeCustomMetadataCommand, SetRangeProtectionMutation, SetRangeValuesCommand, SetRowDataCommand, SetRowHeightCommand, SetRowHiddenCommand, SetSelectionsOperation, SetShrinkToFitCommand, SetSpecificColsVisibleCommand, SetSpecificRowsVisibleCommand, SetStyleCommand, SetTabColorCommand, SetTabColorMutation, SetTextRotationCommand, SetTextWrapCommand, SetVerticalTextAlignCommand, SetWorkbookNameCommand, SetWorksheetActiveOperation, SetWorksheetColumnCountCommand, SetWorksheetDefaultStyleMutation, SetWorksheetHideCommand, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetOrderCommand, SetWorksheetOrderMutation, SetWorksheetRangeThemeStyleCommand, SetWorksheetRowCountCommand, SetWorksheetRowIsAutoHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetWorksheetShowCommand, SheetRangeThemeService, SheetSkeletonChangeType, SheetValueChangeType, SheetsFreezeSyncController, SheetsSelectionsService, SplitDelimiterEnum, SplitTextToColumnsCommand, ToggleGridlinesCommand, UnregisterWorksheetRangeThemeStyleCommand, ViewStateEnum, WorkbookCommentPermission, WorkbookCopyPermission, WorkbookCopySheetPermission, WorkbookCreateProtectPermission, WorkbookCreateSheetPermission, WorkbookDeleteColumnPermission, WorkbookDeleteRowPermission, WorkbookDeleteSheetPermission, WorkbookDuplicatePermission, WorkbookEditablePermission, WorkbookExportPermission, WorkbookHideSheetPermission, WorkbookInsertColumnPermission, WorkbookInsertRowPermission, WorkbookManageCollaboratorPermission, WorkbookMoveSheetPermission, WorkbookPrintPermission, WorkbookRecoverHistoryPermission, WorkbookRenameSheetPermission, WorkbookSharePermission, WorkbookViewHistoryPermission, WorkbookViewPermission, WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditExtraObjectPermission, WorksheetEditPermission, WorksheetFilterPermission, WorksheetInsertColumnPermission, WorksheetInsertHyperlinkPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetPivotTablePermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetSelectProtectedCellsPermission, WorksheetSelectUnProtectedCellsPermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetSortPermission, WorksheetViewPermission, addMergeCellsUtil, copyRangeStyles, getAddMergeMutationRangeByType, getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel, getNextPrimaryCell, getPrimaryForRange, getValueChangedEffectedRange, validateDefinedName } from "@univerjs/sheets";
|
|
4
4
|
import { FormulaDataModel, IDefinedNamesService, IFunctionService, ISuperTableService, deserializeRangeWithSheet, serializeRange, serializeRangeWithSheet } from "@univerjs/engine-formula";
|
|
@@ -23,7 +23,7 @@ import { ObjectScope, UnitAction, UnitObject, UnitRole } from "@univerjs/protoco
|
|
|
23
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
24
|
|
|
25
25
|
//#endregion
|
|
26
|
-
//#region \0@oxc-project+runtime@0.
|
|
26
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
|
|
27
27
|
function _typeof(o) {
|
|
28
28
|
"@babel/helpers - typeof";
|
|
29
29
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -34,7 +34,7 @@ function _typeof(o) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
//#endregion
|
|
37
|
-
//#region \0@oxc-project+runtime@0.
|
|
37
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
|
|
38
38
|
function toPrimitive(t, r) {
|
|
39
39
|
if ("object" != _typeof(t) || !t) return t;
|
|
40
40
|
var e = t[Symbol.toPrimitive];
|
|
@@ -47,14 +47,14 @@ function toPrimitive(t, r) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
//#endregion
|
|
50
|
-
//#region \0@oxc-project+runtime@0.
|
|
50
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
|
|
51
51
|
function toPropertyKey(t) {
|
|
52
52
|
var i = toPrimitive(t, "string");
|
|
53
53
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
//#endregion
|
|
57
|
-
//#region \0@oxc-project+runtime@0.
|
|
57
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
|
|
58
58
|
function _defineProperty(e, r, t) {
|
|
59
59
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
60
60
|
value: t,
|
|
@@ -65,7 +65,7 @@ function _defineProperty(e, r, t) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
//#endregion
|
|
68
|
-
//#region \0@oxc-project+runtime@0.
|
|
68
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
|
|
69
69
|
function __decorateParam(paramIndex, decorator) {
|
|
70
70
|
return function(target, key) {
|
|
71
71
|
decorator(target, key, paramIndex);
|
|
@@ -73,7 +73,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
//#endregion
|
|
76
|
-
//#region \0@oxc-project+runtime@0.
|
|
76
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
|
|
77
77
|
function __decorate(decorators, target, key, desc) {
|
|
78
78
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
79
79
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -136,7 +136,7 @@ let FDefinedNameBuilder = class FDefinedNameBuilder {
|
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
138
|
* Sets the formula of the defined name builder.
|
|
139
|
-
* @param {string
|
|
139
|
+
* @param {string} formula The formula without the leading `=`; this method prepends it.
|
|
140
140
|
* @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
|
|
141
141
|
* @example
|
|
142
142
|
* ```ts
|
|
@@ -377,7 +377,7 @@ let FDefinedName = class FDefinedName extends FBase {
|
|
|
377
377
|
}
|
|
378
378
|
/**
|
|
379
379
|
* Sets the formula of the defined name.
|
|
380
|
-
* @param {string} formula The formula
|
|
380
|
+
* @param {string} formula The formula without the leading `=`; this method prepends it.
|
|
381
381
|
* @example
|
|
382
382
|
* ```ts
|
|
383
383
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -633,7 +633,7 @@ let FSelection = _FSelection = class FSelection {
|
|
|
633
633
|
}
|
|
634
634
|
/**
|
|
635
635
|
* Represents the current select cell in the sheet.
|
|
636
|
-
* @returns {ISelectionCell} The
|
|
636
|
+
* @returns {Nullable<ISelectionCell>} The primary cell of the current selection, or `null` when none exists.
|
|
637
637
|
* @example
|
|
638
638
|
* ```ts
|
|
639
639
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -1082,7 +1082,7 @@ let FRangeProtectionRule = class FRangeProtectionRule {
|
|
|
1082
1082
|
/**
|
|
1083
1083
|
* Update the protected ranges.
|
|
1084
1084
|
* @param {FRange[]} ranges New ranges to protect.
|
|
1085
|
-
* @returns {Promise<
|
|
1085
|
+
* @returns {Promise<boolean>} A promise resolving to whether the protected ranges were updated.
|
|
1086
1086
|
* @example
|
|
1087
1087
|
* ```ts
|
|
1088
1088
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -1119,7 +1119,7 @@ let FRangeProtectionRule = class FRangeProtectionRule {
|
|
|
1119
1119
|
}
|
|
1120
1120
|
/**
|
|
1121
1121
|
* Delete the current protection rule.
|
|
1122
|
-
* @returns {Promise<
|
|
1122
|
+
* @returns {Promise<boolean>} A promise resolving to whether the rule was removed.
|
|
1123
1123
|
* @example
|
|
1124
1124
|
* ```ts
|
|
1125
1125
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -1370,7 +1370,7 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1370
1370
|
/**
|
|
1371
1371
|
* Create worksheet protection with collaborators support.
|
|
1372
1372
|
* This must be called before setting permission points for collaboration to work.
|
|
1373
|
-
* @param {IWorksheetProtectionOptions} options Protection options including allowed users.
|
|
1373
|
+
* @param {IWorksheetProtectionOptions} [options] Protection options including allowed users.
|
|
1374
1374
|
* @returns {Promise<string>} The permissionId for the created protection.
|
|
1375
1375
|
* @example
|
|
1376
1376
|
* ```ts
|
|
@@ -1450,7 +1450,7 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1450
1450
|
/**
|
|
1451
1451
|
* Remove worksheet protection.
|
|
1452
1452
|
* This deletes the protection rule and resets all permission points to allowed.
|
|
1453
|
-
* @returns {Promise<
|
|
1453
|
+
* @returns {Promise<boolean>} A promise resolving to whether protection was removed; also resolves to `true` if already unprotected.
|
|
1454
1454
|
* @example
|
|
1455
1455
|
* ```ts
|
|
1456
1456
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -1511,7 +1511,6 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1511
1511
|
pointsToSet["WorksheetView"] = true;
|
|
1512
1512
|
pointsToSet["WorksheetSort"] = true;
|
|
1513
1513
|
pointsToSet["WorksheetFilter"] = true;
|
|
1514
|
-
break;
|
|
1515
1514
|
}
|
|
1516
1515
|
return pointsToSet;
|
|
1517
1516
|
}
|
|
@@ -1635,6 +1634,7 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1635
1634
|
* if (fWorksheet.getWorksheetPermission().canView()) {
|
|
1636
1635
|
* console.log('Worksheet is viewable');
|
|
1637
1636
|
* }
|
|
1637
|
+
* ```
|
|
1638
1638
|
*/
|
|
1639
1639
|
canView() {
|
|
1640
1640
|
return this.getPoint("WorksheetView");
|
|
@@ -1830,7 +1830,7 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1830
1830
|
/**
|
|
1831
1831
|
* Remove multiple protection rules at once.
|
|
1832
1832
|
* @param {string[]} ruleIds Array of rule IDs to remove.
|
|
1833
|
-
* @returns {Promise<
|
|
1833
|
+
* @returns {Promise<boolean>} A promise resolving to whether the rules were removed; also resolves to `true` for an empty ID list.
|
|
1834
1834
|
* @example
|
|
1835
1835
|
* ```ts
|
|
1836
1836
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -1879,7 +1879,7 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
|
|
|
1879
1879
|
* Debug cell permission information.
|
|
1880
1880
|
* @param {number} row Row index.
|
|
1881
1881
|
* @param {number} col Column index.
|
|
1882
|
-
* @returns {FRangeProtectionRule | undefined}
|
|
1882
|
+
* @returns {Promise<FRangeProtectionRule | undefined>} A promise resolving to the protection rule affecting this cell, or `undefined` if no range protection rule applies.
|
|
1883
1883
|
* @example
|
|
1884
1884
|
* ```ts
|
|
1885
1885
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -2058,6 +2058,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2058
2058
|
this.setActiveRange
|
|
2059
2059
|
);
|
|
2060
2060
|
}
|
|
2061
|
+
/** Releases this facade's resources. Use `univerAPI.disposeUnit()` to unload the owning unit. */
|
|
2061
2062
|
dispose() {
|
|
2062
2063
|
super.dispose();
|
|
2063
2064
|
delete this._fWorkbook;
|
|
@@ -2136,7 +2137,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2136
2137
|
}
|
|
2137
2138
|
/**
|
|
2138
2139
|
* Get the current selection of the worksheet.
|
|
2139
|
-
* @returns {FSelection}
|
|
2140
|
+
* @returns {FSelection | null} The current selections, or `null` when no selection data is available.
|
|
2140
2141
|
* @example
|
|
2141
2142
|
* ```typescript
|
|
2142
2143
|
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
@@ -2152,7 +2153,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2152
2153
|
}
|
|
2153
2154
|
/**
|
|
2154
2155
|
* Get the default style of the worksheet.
|
|
2155
|
-
* @returns {IStyleData}
|
|
2156
|
+
* @returns {Nullable<IStyleData> | string} The default style object or style ID, or a nullish value when no default style is set.
|
|
2156
2157
|
* @example
|
|
2157
2158
|
* ```typescript
|
|
2158
2159
|
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
@@ -2206,7 +2207,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2206
2207
|
}
|
|
2207
2208
|
/**
|
|
2208
2209
|
* Set the default style of the worksheet
|
|
2209
|
-
* @param {string} style -
|
|
2210
|
+
* @param {string | Nullable<IStyleData>} style - A style ID or style object, or `null` to clear the default style.
|
|
2210
2211
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
2211
2212
|
* @example
|
|
2212
2213
|
* ```typescript
|
|
@@ -2229,8 +2230,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2229
2230
|
return this;
|
|
2230
2231
|
}
|
|
2231
2232
|
/**
|
|
2232
|
-
* Set the default style of the worksheet
|
|
2233
|
-
* @param {number} index - The
|
|
2233
|
+
* Set the default style of the worksheet column
|
|
2234
|
+
* @param {number} index - The zero-based column index
|
|
2234
2235
|
* @param {string | Nullable<IStyleData>} style - The style name or style data
|
|
2235
2236
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
2236
2237
|
* @example
|
|
@@ -2253,8 +2254,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2253
2254
|
return this;
|
|
2254
2255
|
}
|
|
2255
2256
|
/**
|
|
2256
|
-
* Set the default style of the worksheet
|
|
2257
|
-
* @param {number} index - The
|
|
2257
|
+
* Set the default style of the worksheet row
|
|
2258
|
+
* @param {number} index - The zero-based row index
|
|
2258
2259
|
* @param {string | Nullable<IStyleData>} style - The style name or style data
|
|
2259
2260
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
2260
2261
|
* @example
|
|
@@ -2375,7 +2376,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2375
2376
|
/**
|
|
2376
2377
|
* Inserts one or more consecutive blank rows in a sheet starting at the specified location.
|
|
2377
2378
|
* @param {number} rowIndex - The existing row before which rows are inserted. The index is zero-based and must be between 0 and `getMaxRows() - 1`.
|
|
2378
|
-
* @param {number} numRows - The positive number of rows to insert.
|
|
2379
|
+
* @param {number} [numRows] - The positive number of rows to insert.
|
|
2379
2380
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
2380
2381
|
* @example
|
|
2381
2382
|
* ```typescript
|
|
@@ -2600,7 +2601,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2600
2601
|
/**
|
|
2601
2602
|
* Hides one or more consecutive rows starting at the given index. Use 0-index for this method
|
|
2602
2603
|
* @param {number} rowIndex - The starting index of the rows to hide
|
|
2603
|
-
* @param {number} numRow - The number of rows to hide
|
|
2604
|
+
* @param {number} [numRow] - The number of rows to hide
|
|
2604
2605
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
2605
2606
|
* @example
|
|
2606
2607
|
* ```typescript
|
|
@@ -2657,9 +2658,9 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2657
2658
|
return this;
|
|
2658
2659
|
}
|
|
2659
2660
|
/**
|
|
2660
|
-
*
|
|
2661
|
+
* Unhides one or more consecutive rows starting at the given zero-based index.
|
|
2661
2662
|
* @param {number} rowIndex - The starting index of the rows
|
|
2662
|
-
* @param {number} numRows - The number of rows
|
|
2663
|
+
* @param {number} [numRows] - The number of rows
|
|
2663
2664
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
2664
2665
|
* @example
|
|
2665
2666
|
* ```typescript
|
|
@@ -2709,7 +2710,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2709
2710
|
/**
|
|
2710
2711
|
* Make certain row wrap and auto height.
|
|
2711
2712
|
* @param {number} rowPosition - The row position to change.
|
|
2712
|
-
* @param {BooleanNumber} auto - Whether to auto fit the row height.
|
|
2713
|
+
* @param {BooleanNumber} [auto] - Whether to auto fit the row height.
|
|
2713
2714
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
2714
2715
|
* @example
|
|
2715
2716
|
* ```ts
|
|
@@ -2952,7 +2953,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
2952
2953
|
/**
|
|
2953
2954
|
* Inserts one or more consecutive blank columns in a sheet starting at the specified location.
|
|
2954
2955
|
* @param {number} columnIndex - The index indicating where to insert a column, starting at 0 for the first column
|
|
2955
|
-
* @param {number} numColumns - The number of columns to insert
|
|
2956
|
+
* @param {number} [numColumns] - The number of columns to insert
|
|
2956
2957
|
* @returns {FWorksheet} This sheet, for chaining
|
|
2957
2958
|
* @example
|
|
2958
2959
|
* ```typescript
|
|
@@ -3174,7 +3175,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3174
3175
|
/**
|
|
3175
3176
|
* Hides one or more consecutive columns starting at the given index. Use 0-index for this method
|
|
3176
3177
|
* @param {number} columnIndex - The starting index of the columns to hide
|
|
3177
|
-
* @param {number} numColumn - The number of columns to hide
|
|
3178
|
+
* @param {number} [numColumn] - The number of columns to hide
|
|
3178
3179
|
* @returns {FWorksheet} This sheet, for chaining
|
|
3179
3180
|
* @example
|
|
3180
3181
|
* ```typescript
|
|
@@ -3233,7 +3234,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3233
3234
|
/**
|
|
3234
3235
|
* Show one or more consecutive columns starting at the given index. Use 0-index for this method
|
|
3235
3236
|
* @param {number} columnIndex - The starting index of the columns to unhide
|
|
3236
|
-
* @param {number} numColumns - The number of columns to unhide
|
|
3237
|
+
* @param {number} [numColumns] - The number of columns to unhide
|
|
3237
3238
|
* @returns {FWorksheet} This sheet, for chaining
|
|
3238
3239
|
* @example
|
|
3239
3240
|
* ```typescript
|
|
@@ -3324,7 +3325,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3324
3325
|
* fRange.setValue('Whenever it is a damp, drizzly November in my soul...');
|
|
3325
3326
|
*
|
|
3326
3327
|
* // Set the column A to a width which fits the text
|
|
3327
|
-
* fWorksheet.
|
|
3328
|
+
* fWorksheet.autoResizeColumns(0);
|
|
3328
3329
|
*
|
|
3329
3330
|
* // Get the width of the column A
|
|
3330
3331
|
* console.log(fWorksheet.getColumnWidth(0));
|
|
@@ -3710,7 +3711,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3710
3711
|
}
|
|
3711
3712
|
/**
|
|
3712
3713
|
* Sets the sheet tab color.
|
|
3713
|
-
* @param {string
|
|
3714
|
+
* @param {string} color - A color in CSS notation, such as '#ffffff' or 'white'.
|
|
3714
3715
|
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
3715
3716
|
* @example
|
|
3716
3717
|
* ```ts
|
|
@@ -3731,8 +3732,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3731
3732
|
}
|
|
3732
3733
|
/**
|
|
3733
3734
|
* Get the tab color of the sheet.
|
|
3734
|
-
* @returns {string} The tab color
|
|
3735
|
-
* The default color is css style property 'unset'.
|
|
3735
|
+
* @returns {string | undefined} The tab color, or `undefined` when no color is set.
|
|
3736
3736
|
* @example
|
|
3737
3737
|
* ```ts
|
|
3738
3738
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -3758,13 +3758,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3758
3758
|
* ```
|
|
3759
3759
|
*/
|
|
3760
3760
|
hideSheet() {
|
|
3761
|
-
|
|
3762
|
-
if (this._workbook.getSheets().filter((sheet) => sheet.isSheetHidden() !== BooleanNumber.TRUE).length <= 1) throw new Error("Cannot hide the only visible sheet");
|
|
3763
|
-
commandService.syncExecuteCommand(SetWorksheetHideCommand.id, {
|
|
3764
|
-
unitId: this._workbook.getUnitId(),
|
|
3765
|
-
subUnitId: this._worksheet.getSheetId()
|
|
3766
|
-
});
|
|
3767
|
-
return this;
|
|
3761
|
+
return this.isSheetHidden() ? this : this.setHiddenState(WorksheetHiddenState.HIDDEN);
|
|
3768
3762
|
}
|
|
3769
3763
|
/**
|
|
3770
3764
|
* Shows this sheet. Has no effect if the sheet is already visible.
|
|
@@ -3785,7 +3779,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3785
3779
|
return this;
|
|
3786
3780
|
}
|
|
3787
3781
|
/**
|
|
3788
|
-
* Returns true
|
|
3782
|
+
* Returns true for both HIDDEN and VERY_HIDDEN sheets.
|
|
3789
3783
|
* @returns {boolean} True if the sheet is hidden; otherwise, false.
|
|
3790
3784
|
* @example
|
|
3791
3785
|
* ```ts
|
|
@@ -3799,6 +3793,33 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3799
3793
|
return Boolean(this._worksheet.isSheetHidden() === BooleanNumber.TRUE);
|
|
3800
3794
|
}
|
|
3801
3795
|
/**
|
|
3796
|
+
* Returns 0 (visible), 1 (hidden), or 2 (very hidden).
|
|
3797
|
+
* @example fWorksheet.getHiddenState() === univerAPI.Enum.WorksheetHiddenState.VERY_HIDDEN
|
|
3798
|
+
*/
|
|
3799
|
+
getHiddenState() {
|
|
3800
|
+
return this._worksheet.getHiddenState();
|
|
3801
|
+
}
|
|
3802
|
+
/**
|
|
3803
|
+
* Changes the persisted hiding state through an undoable command.
|
|
3804
|
+
* VERY_HIDDEN removes the sheet from Unhide UI; showSheet() can reveal it through the API.
|
|
3805
|
+
* The last visible sheet cannot be hidden. Existing isSheetHidden() stays a boolean predicate.
|
|
3806
|
+
* @example fWorksheet.setHiddenState(univerAPI.Enum.WorksheetHiddenState.VERY_HIDDEN)
|
|
3807
|
+
*/
|
|
3808
|
+
setHiddenState(hidden) {
|
|
3809
|
+
if (hidden === WorksheetHiddenState.VISIBLE) return this.showSheet();
|
|
3810
|
+
if (hidden !== WorksheetHiddenState.HIDDEN && hidden !== WorksheetHiddenState.VERY_HIDDEN) throw new RangeError(`Unsupported worksheet hidden state: ${String(hidden)}`);
|
|
3811
|
+
if (this._worksheet.getHiddenState() === hidden) return this;
|
|
3812
|
+
if (this._worksheet.getHiddenState() === WorksheetHiddenState.VISIBLE) {
|
|
3813
|
+
if (this._workbook.getSheets().filter((sheet) => !sheet.isSheetHidden()).length <= 1) throw new Error("Cannot hide the only visible sheet");
|
|
3814
|
+
}
|
|
3815
|
+
this._injector.get(ICommandService).syncExecuteCommand(SetWorksheetHideCommand.id, {
|
|
3816
|
+
unitId: this._workbook.getUnitId(),
|
|
3817
|
+
subUnitId: this._worksheet.getSheetId(),
|
|
3818
|
+
hidden
|
|
3819
|
+
});
|
|
3820
|
+
return this;
|
|
3821
|
+
}
|
|
3822
|
+
/**
|
|
3802
3823
|
* Sets the sheet name.
|
|
3803
3824
|
* @param {string} name - The new name for the sheet.
|
|
3804
3825
|
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
@@ -3851,10 +3872,11 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3851
3872
|
return this._workbook.getSheetIndex(this._worksheet);
|
|
3852
3873
|
}
|
|
3853
3874
|
/**
|
|
3854
|
-
* Clears the sheet
|
|
3875
|
+
* Clears the sheet content and formatting, or only one of them as specified by the options.
|
|
3876
|
+
* Both content and formatting are cleared when both flags are true or both are false.
|
|
3855
3877
|
* @param {IFacadeClearOptions} [options] - Options for clearing the sheet. If not provided, the contents and formatting are cleared both.
|
|
3856
|
-
* @param {boolean} [options.contentsOnly] - If true, the contents of the sheet are cleared.
|
|
3857
|
-
* @param {boolean} [options.formatOnly] -
|
|
3878
|
+
* @param {boolean} [options.contentsOnly] - If true, the contents of the sheet are cleared. Effective only when `formatOnly` is false. Defaults to false.
|
|
3879
|
+
* @param {boolean} [options.formatOnly] - Clears only formatting when true and `contentsOnly` is false. Defaults to false.
|
|
3858
3880
|
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
3859
3881
|
* @example
|
|
3860
3882
|
* ```ts
|
|
@@ -3965,8 +3987,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3965
3987
|
return this.getRange(startRow, startColumn, endRow - startRow + 1, endColumn - startColumn + 1);
|
|
3966
3988
|
}
|
|
3967
3989
|
/**
|
|
3968
|
-
* Returns the
|
|
3969
|
-
* @returns {number}
|
|
3990
|
+
* Returns the zero-based index of the last column with stored cell data, including formatting-only cells.
|
|
3991
|
+
* @returns {number} The last stored column index, or 0 for an empty sheet.
|
|
3970
3992
|
* @example
|
|
3971
3993
|
* ```ts
|
|
3972
3994
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -3982,8 +4004,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3982
4004
|
return this._worksheet.getLastColumnWithContent();
|
|
3983
4005
|
}
|
|
3984
4006
|
/**
|
|
3985
|
-
* Returns the
|
|
3986
|
-
* @returns {number}
|
|
4007
|
+
* Returns the zero-based index of the last row with stored cell data, including formatting-only cells.
|
|
4008
|
+
* @returns {number} The last stored row index, or 0 for an empty sheet.
|
|
3987
4009
|
* @example
|
|
3988
4010
|
* ```ts
|
|
3989
4011
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -4301,7 +4323,7 @@ let FRangePermission = class FRangePermission extends FBase {
|
|
|
4301
4323
|
}
|
|
4302
4324
|
/**
|
|
4303
4325
|
* Protect the current range.
|
|
4304
|
-
* @param {IRangeProtectionOptions} options Protection options.
|
|
4326
|
+
* @param {IRangeProtectionOptions} [options] Protection options.
|
|
4305
4327
|
* @returns {Promise<FRangeProtectionRule>} The created protection rule.
|
|
4306
4328
|
* @example
|
|
4307
4329
|
* ```ts
|
|
@@ -4566,8 +4588,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4566
4588
|
return this._range.endColumn;
|
|
4567
4589
|
}
|
|
4568
4590
|
/**
|
|
4569
|
-
*
|
|
4570
|
-
* @returns {number} The
|
|
4591
|
+
* Returns the number of columns in this range.
|
|
4592
|
+
* @returns {number} The column count, not a size in pixels.
|
|
4571
4593
|
* @example
|
|
4572
4594
|
* ```ts
|
|
4573
4595
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -4581,8 +4603,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4581
4603
|
return this._range.endColumn - this._range.startColumn + 1;
|
|
4582
4604
|
}
|
|
4583
4605
|
/**
|
|
4584
|
-
*
|
|
4585
|
-
* @returns {number} The
|
|
4606
|
+
* Returns the number of rows in this range.
|
|
4607
|
+
* @returns {number} The row count, not a size in pixels.
|
|
4586
4608
|
* @example
|
|
4587
4609
|
* ```ts
|
|
4588
4610
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -4596,8 +4618,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4596
4618
|
return this._range.endRow - this._range.startRow + 1;
|
|
4597
4619
|
}
|
|
4598
4620
|
/**
|
|
4599
|
-
*
|
|
4600
|
-
* @returns {boolean}
|
|
4621
|
+
* Checks whether this range exactly matches a merged cell range.
|
|
4622
|
+
* @returns {boolean} `true` only for an exact merged range match. Use `isPartOfMerge()` to check overlap.
|
|
4601
4623
|
* @example
|
|
4602
4624
|
* ```ts
|
|
4603
4625
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -4618,7 +4640,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4618
4640
|
* Return first cell style data in this range. Please note that if there are row styles, col styles and (or)
|
|
4619
4641
|
* worksheet style, they will be merged into the cell style. You can use `type` to specify the type of the style to get.
|
|
4620
4642
|
*
|
|
4621
|
-
* @param {GetStyleType} type - The type of the style to get. 'row' means get the composed style of row, col and
|
|
4643
|
+
* @param {GetStyleType} [type] - The type of the style to get. 'row' means get the composed style of row, col and
|
|
4622
4644
|
* default worksheet style. 'col' means get the composed style of col, row and default worksheet style.
|
|
4623
4645
|
* 'cell' means get the style of cell without merging row style, col style and default worksheet style.
|
|
4624
4646
|
* Default is 'row'.
|
|
@@ -4640,7 +4662,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4640
4662
|
/**
|
|
4641
4663
|
* Get the font family of the cell.
|
|
4642
4664
|
*
|
|
4643
|
-
* @param {GetStyleType} type - The type of the style to get. 'row' means get the composed style of row, col and
|
|
4665
|
+
* @param {GetStyleType} [type] - The type of the style to get. 'row' means get the composed style of row, col and
|
|
4644
4666
|
* default worksheet style. 'col' means get the composed style of col, row and default worksheet style.
|
|
4645
4667
|
* 'cell' means get the style of cell without merging row style, col style and default worksheet style.
|
|
4646
4668
|
* Default is 'row'.
|
|
@@ -4662,7 +4684,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4662
4684
|
/**
|
|
4663
4685
|
* Get the font size of the cell.
|
|
4664
4686
|
*
|
|
4665
|
-
* @param {GetStyleType} type - The type of the style to get. 'row' means get the composed style of row, col and
|
|
4687
|
+
* @param {GetStyleType} [type] - The type of the style to get. 'row' means get the composed style of row, col and
|
|
4666
4688
|
* default worksheet style. 'col' means get the composed style of col, row and default worksheet style.
|
|
4667
4689
|
* 'cell' means get the style of cell without merging row style, col style and default worksheet style.
|
|
4668
4690
|
* Default is 'row'.
|
|
@@ -4684,7 +4706,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4684
4706
|
/**
|
|
4685
4707
|
* Return first cell style in this range.
|
|
4686
4708
|
*
|
|
4687
|
-
* @param {GetStyleType} type - The type of the style to get. 'row' means get the composed style of row, col and
|
|
4709
|
+
* @param {GetStyleType} [type] - The type of the style to get. 'row' means get the composed style of row, col and
|
|
4688
4710
|
* default worksheet style. 'col' means get the composed style of col, row and default worksheet style.
|
|
4689
4711
|
* 'cell' means get the style of cell without merging row style, col style and default worksheet style.
|
|
4690
4712
|
* Default is 'row'.
|
|
@@ -4706,7 +4728,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4706
4728
|
/**
|
|
4707
4729
|
* Returns the cell styles for the cells in the range.
|
|
4708
4730
|
*
|
|
4709
|
-
* @param {GetStyleType} type - The type of the style to get. 'row' means get the composed style of row, col and
|
|
4731
|
+
* @param {GetStyleType} [type] - The type of the style to get. 'row' means get the composed style of row, col and
|
|
4710
4732
|
* default worksheet style. 'col' means get the composed style of col, row and default worksheet style.
|
|
4711
4733
|
* 'cell' means get the style of cell without merging row style, col style and default worksheet style.
|
|
4712
4734
|
* Default is 'row'.
|
|
@@ -4754,7 +4776,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4754
4776
|
* ```
|
|
4755
4777
|
*/
|
|
4756
4778
|
getRawValue() {
|
|
4757
|
-
|
|
4779
|
+
const cell = this._worksheet.getCellMatrix().getValue(this._range.startRow, this._range.startColumn);
|
|
4780
|
+
return getOriginCellValue(cell);
|
|
4758
4781
|
}
|
|
4759
4782
|
/**
|
|
4760
4783
|
* Returns the displayed value of the top-left cell in the range. The value is a String. Empty cells return an empty string.
|
|
@@ -4777,7 +4800,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4777
4800
|
* ```
|
|
4778
4801
|
*/
|
|
4779
4802
|
getDisplayValue() {
|
|
4780
|
-
|
|
4803
|
+
const cell = this._worksheet.getCell(this._range.startRow, this._range.startColumn);
|
|
4804
|
+
return getDisplayValueFromCell(cell);
|
|
4781
4805
|
}
|
|
4782
4806
|
getValues(includeRichText) {
|
|
4783
4807
|
if (includeRichText) return this.getValueAndRichTextValues();
|
|
@@ -4843,7 +4867,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4843
4867
|
for (let r = startRow; r <= endRow; r++) {
|
|
4844
4868
|
const row = [];
|
|
4845
4869
|
for (let c = startColumn; c <= endColumn; c++) {
|
|
4846
|
-
const
|
|
4870
|
+
const cell = cellMatrix.getValue(r, c);
|
|
4871
|
+
const rawValue = getOriginCellValue(cell);
|
|
4847
4872
|
row.push(rawValue);
|
|
4848
4873
|
}
|
|
4849
4874
|
values.push(row);
|
|
@@ -4899,7 +4924,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
4899
4924
|
for (let r = startRow; r <= endRow; r++) {
|
|
4900
4925
|
const row = [];
|
|
4901
4926
|
for (let c = startColumn; c <= endColumn; c++) {
|
|
4902
|
-
const
|
|
4927
|
+
const cell = this._worksheet.getCell(r, c);
|
|
4928
|
+
const displayValue = getDisplayValueFromCell(cell);
|
|
4903
4929
|
row.push(displayValue);
|
|
4904
4930
|
}
|
|
4905
4931
|
values.push(row);
|
|
@@ -5084,7 +5110,10 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5084
5110
|
getWrap() {
|
|
5085
5111
|
return this._worksheet.getRange(this._range).getWrap() === BooleanNumber.TRUE;
|
|
5086
5112
|
}
|
|
5087
|
-
/**
|
|
5113
|
+
/**
|
|
5114
|
+
* Gets whether the top-left cell shrinks its font size to fit the cell width.
|
|
5115
|
+
* @returns {boolean} Whether shrink-to-fit is enabled for the top-left cell.
|
|
5116
|
+
*/
|
|
5088
5117
|
getShrinkToFit() {
|
|
5089
5118
|
var _this$_worksheet$getC3;
|
|
5090
5119
|
const { startRow, startColumn } = this._range;
|
|
@@ -5100,6 +5129,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5100
5129
|
* if (!fWorksheet) return;
|
|
5101
5130
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5102
5131
|
* console.log(fRange.getWraps());
|
|
5132
|
+
* ```
|
|
5103
5133
|
*/
|
|
5104
5134
|
getWraps() {
|
|
5105
5135
|
const cells = this.getCellDatas();
|
|
@@ -5125,7 +5155,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5125
5155
|
return this._worksheet.getRange(this._range).getWrapStrategy();
|
|
5126
5156
|
}
|
|
5127
5157
|
/**
|
|
5128
|
-
* Returns the horizontal alignment of the
|
|
5158
|
+
* Returns the horizontal alignment of the top-left cell as `left`, `center`, or `normal` (right alignment).
|
|
5159
|
+
* Default and other core alignment values return `general`, which is not accepted by `setHorizontalAlignment()`.
|
|
5129
5160
|
* @returns {string} The horizontal alignment of the text in the cell.
|
|
5130
5161
|
* @example
|
|
5131
5162
|
* ```ts
|
|
@@ -5137,10 +5168,12 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5137
5168
|
* ```
|
|
5138
5169
|
*/
|
|
5139
5170
|
getHorizontalAlignment() {
|
|
5140
|
-
|
|
5171
|
+
const coreHorizontalAlignment = this._worksheet.getRange(this._range).getHorizontalAlignment();
|
|
5172
|
+
return transformCoreHorizontalAlignment(coreHorizontalAlignment);
|
|
5141
5173
|
}
|
|
5142
5174
|
/**
|
|
5143
|
-
* Returns
|
|
5175
|
+
* Returns a two-dimensional array of horizontal alignments: `left`, `center`, or `normal` (right alignment).
|
|
5176
|
+
* Default and other core alignment values return `general`, which is not accepted by `setHorizontalAlignment()`.
|
|
5144
5177
|
* @returns {string[][]} A two-dimensional array of horizontal alignments of text associated with cells in the range.
|
|
5145
5178
|
* @example
|
|
5146
5179
|
* ```ts
|
|
@@ -5155,7 +5188,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5155
5188
|
return this._worksheet.getRange(this._range).getHorizontalAlignments().map((row) => row.map((alignment) => transformCoreHorizontalAlignment(alignment)));
|
|
5156
5189
|
}
|
|
5157
5190
|
/**
|
|
5158
|
-
* Returns
|
|
5191
|
+
* Returns `top`, `middle`, or `bottom` for the top-left cell; unspecified alignment returns `general`.
|
|
5192
|
+
* `general` is a getter result and is not accepted by `setVerticalAlignment()`.
|
|
5159
5193
|
* @returns {string} The vertical alignment of the text in the cell.
|
|
5160
5194
|
* @example
|
|
5161
5195
|
* ```ts
|
|
@@ -5170,7 +5204,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5170
5204
|
return transformCoreVerticalAlignment(this._worksheet.getRange(this._range).getVerticalAlignment());
|
|
5171
5205
|
}
|
|
5172
5206
|
/**
|
|
5173
|
-
* Returns
|
|
5207
|
+
* Returns a two-dimensional array of `top`, `middle`, or `bottom` values; unspecified alignment returns `general`.
|
|
5208
|
+
* `general` is a getter result and is not accepted by `setVerticalAlignment()`.
|
|
5174
5209
|
* @returns {string[][]} A two-dimensional array of vertical alignments of text associated with cells in the range.
|
|
5175
5210
|
* @example
|
|
5176
5211
|
* ```ts
|
|
@@ -5188,6 +5223,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5188
5223
|
* Set custom meta data for first cell in current range.
|
|
5189
5224
|
* @param {CustomData} data The custom meta data
|
|
5190
5225
|
* @returns {FRange} This range, for chaining
|
|
5226
|
+
* @example
|
|
5191
5227
|
* ```ts
|
|
5192
5228
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5193
5229
|
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
@@ -5212,6 +5248,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5212
5248
|
* Set custom meta data for current range.
|
|
5213
5249
|
* @param {CustomData[][]} datas The custom meta data
|
|
5214
5250
|
* @returns {FRange} This range, for chaining
|
|
5251
|
+
* @example
|
|
5215
5252
|
* ```ts
|
|
5216
5253
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5217
5254
|
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
@@ -5239,7 +5276,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5239
5276
|
* Returns the custom meta data for the cell at the start of this range.
|
|
5240
5277
|
* @returns {CustomData | null} The custom meta data
|
|
5241
5278
|
* @example
|
|
5242
|
-
* ```
|
|
5279
|
+
* ```ts
|
|
5243
5280
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5244
5281
|
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5245
5282
|
* if (!fWorksheet) return;
|
|
@@ -5254,9 +5291,9 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5254
5291
|
}
|
|
5255
5292
|
/**
|
|
5256
5293
|
* Returns the custom meta data for the cells in the range.
|
|
5257
|
-
* @returns {CustomData[][]} A two-dimensional array of custom
|
|
5294
|
+
* @returns {Nullable<CustomData>[][]} A two-dimensional array of custom metadata, with `null` for cells without metadata.
|
|
5258
5295
|
* @example
|
|
5259
|
-
* ```
|
|
5296
|
+
* ```ts
|
|
5260
5297
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5261
5298
|
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5262
5299
|
* if (!fWorksheet) return;
|
|
@@ -5396,18 +5433,55 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5396
5433
|
return this;
|
|
5397
5434
|
}
|
|
5398
5435
|
/**
|
|
5399
|
-
* Sets the value
|
|
5400
|
-
*
|
|
5436
|
+
* Sets the value or specified cell properties for every cell in this range.
|
|
5437
|
+
*
|
|
5438
|
+
* There are two input modes:
|
|
5439
|
+
*
|
|
5440
|
+
* - `CellValue` (`number`, `string`, or `boolean`): replaces the cell content. A string starting
|
|
5441
|
+
* with `=` and containing at least one more character is written as a formula (`f`), clearing
|
|
5442
|
+
* the previous value (`v`) and rich text (`p`). Other values clear the previous formula and
|
|
5443
|
+
* rich text. Strings recognized as formatted numbers (for example, percentages, dates, or
|
|
5444
|
+
* currencies) are converted to numeric values and apply the parsed number format. Existing
|
|
5445
|
+
* formatting is otherwise preserved.
|
|
5446
|
+
* - `ICellData`: updates cell-data fields directly, for explicit control over `v` (value),
|
|
5447
|
+
* `f` (formula), `p` (rich text), `t` (value type), and `s` (style). The object bypasses the
|
|
5448
|
+
* formula and formatted-number parsing above: `{ v: '=SUM(A1:A2)' }` does not set a formula;
|
|
5449
|
+
* use `{ f: '=SUM(A1:A2)', v: null, p: null }` instead. Omitted content fields are not
|
|
5450
|
+
* automatically cleared, so use `f: null` and `p: null` when replacing a formula or rich text
|
|
5451
|
+
* with `v`. Use `v: null` to clear the stored value. Supplied style properties are merged into
|
|
5452
|
+
* the existing style; `s: null` clears the style.
|
|
5453
|
+
*
|
|
5454
|
+
* In both modes, the stored value is converted according to its cell type. Unless an `ICellData`
|
|
5455
|
+
* input supplies `t`, the type is inferred from the value, number format, and existing cell type.
|
|
5456
|
+
* Consequently, passing `{ v: '00123' }` alone does not guarantee that the value stays a string;
|
|
5457
|
+
* supply `t: CellValueType.STRING` to store it as text.
|
|
5458
|
+
*
|
|
5459
|
+
* @param {CellValue | ICellData} value The scalar content or cell-data update to apply throughout the range.
|
|
5401
5460
|
* @returns {FRange} This range, for chaining
|
|
5461
|
+
* @example
|
|
5402
5462
|
* ```ts
|
|
5403
5463
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5404
5464
|
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5405
5465
|
* if (!fWorksheet) return;
|
|
5406
|
-
* const fRange = fWorksheet.getRange('B2');
|
|
5466
|
+
* const fRange = fWorksheet.getRange('B2:B3');
|
|
5467
|
+
*
|
|
5468
|
+
* // Replace the content of both cells, preserving their formatting.
|
|
5407
5469
|
* fRange.setValue(123);
|
|
5408
5470
|
*
|
|
5409
|
-
* //
|
|
5410
|
-
* fRange.setValue(
|
|
5471
|
+
* // Parse a percentage and apply its number format to both cells.
|
|
5472
|
+
* fRange.setValue('25%');
|
|
5473
|
+
*
|
|
5474
|
+
* // Write the same formula to both cells.
|
|
5475
|
+
* fRange.setValue('=SUM(A1:A2)');
|
|
5476
|
+
*
|
|
5477
|
+
* // Explicitly replace content and update the background color.
|
|
5478
|
+
* fRange.setValue({ v: 234, f: null, p: null, s: { bg: { rgb: '#ff0000' } } });
|
|
5479
|
+
*
|
|
5480
|
+
* // Store numeric-looking text (CellValueType is imported from '@univerjs/core').
|
|
5481
|
+
* fRange.setValue({ v: '00123', t: CellValueType.STRING, f: null, p: null });
|
|
5482
|
+
*
|
|
5483
|
+
* // Clear value, formula, and rich text while preserving formatting.
|
|
5484
|
+
* fRange.setValue({ v: null, f: null, p: null });
|
|
5411
5485
|
* ```
|
|
5412
5486
|
*/
|
|
5413
5487
|
setValue(value) {
|
|
@@ -5422,9 +5496,11 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5422
5496
|
return this;
|
|
5423
5497
|
}
|
|
5424
5498
|
/**
|
|
5425
|
-
*
|
|
5426
|
-
*
|
|
5499
|
+
* Sets the value or specified cell properties of the top-left cell in this range.
|
|
5500
|
+
* Uses the same scalar parsing and cell-data update rules as {@link FRange.setValue}.
|
|
5501
|
+
* @param {CellValue | ICellData} value The scalar content or cell-data update to apply to the top-left cell only.
|
|
5427
5502
|
* @returns {FRange} This range, for chaining
|
|
5503
|
+
* @example
|
|
5428
5504
|
* ```ts
|
|
5429
5505
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5430
5506
|
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
@@ -5457,7 +5533,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5457
5533
|
* @param {RichTextValue | IDocumentData} value The rich text value
|
|
5458
5534
|
* @returns {FRange} The range
|
|
5459
5535
|
* @example
|
|
5460
|
-
* ```
|
|
5536
|
+
* ```ts
|
|
5461
5537
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5462
5538
|
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5463
5539
|
* if (!fWorksheet) return;
|
|
@@ -5491,7 +5567,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5491
5567
|
}
|
|
5492
5568
|
/**
|
|
5493
5569
|
* Set the rich text value for the cells in the range.
|
|
5494
|
-
* @param {RichTextValue[][]} values
|
|
5570
|
+
* @param {(RichTextValue | IDocumentData)[][]} values A two-dimensional array of rich-text values or document data matching this range's dimensions.
|
|
5495
5571
|
* @returns {FRange} The range
|
|
5496
5572
|
* @example
|
|
5497
5573
|
* ```ts
|
|
@@ -5508,13 +5584,14 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5508
5584
|
* .setStyle(6, 7, { bl: 1, cl: { rgb: '#c81e1e' } });
|
|
5509
5585
|
* fRange.setRichTextValues([
|
|
5510
5586
|
* [richText, richText],
|
|
5511
|
-
* [
|
|
5587
|
+
* [richText, richText]
|
|
5512
5588
|
* ]);
|
|
5513
5589
|
* console.log(fRange.getValue(true).toPlainText()); // Hello World
|
|
5514
5590
|
* ```
|
|
5515
5591
|
*/
|
|
5516
5592
|
setRichTextValues(values) {
|
|
5517
|
-
const
|
|
5593
|
+
const cellDatas = values.map((row) => row.map((item) => item && { p: item instanceof RichTextValue ? item.getData() : item }));
|
|
5594
|
+
const realValue = covertCellValues(cellDatas, this._range);
|
|
5518
5595
|
const params = {
|
|
5519
5596
|
unitId: this._workbook.getUnitId(),
|
|
5520
5597
|
subUnitId: this._worksheet.getSheetId(),
|
|
@@ -5526,7 +5603,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5526
5603
|
}
|
|
5527
5604
|
/**
|
|
5528
5605
|
* Set the cell wrap of the given range.
|
|
5529
|
-
*
|
|
5606
|
+
* Pass `true` to set `WrapStrategy.WRAP`, or `false` to reset to `WrapStrategy.UNSPECIFIED`.
|
|
5607
|
+
* Use `setWrapStrategy()` to explicitly select clipping or overflow behavior.
|
|
5530
5608
|
* @param {boolean} isWrapEnabled Whether to enable wrap
|
|
5531
5609
|
* @returns {FRange} this range, for chaining
|
|
5532
5610
|
* @example
|
|
@@ -5548,7 +5626,15 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5548
5626
|
});
|
|
5549
5627
|
return this;
|
|
5550
5628
|
}
|
|
5551
|
-
/**
|
|
5629
|
+
/**
|
|
5630
|
+
* Sets whether cells shrink their font size to fit the cell width.
|
|
5631
|
+
* @param {boolean} enabled Whether to enable shrink-to-fit for this range.
|
|
5632
|
+
* @returns {FRange} This range, for chaining.
|
|
5633
|
+
* @example
|
|
5634
|
+
* ```ts
|
|
5635
|
+
* univerAPI.getActiveWorkbook()?.getActiveSheet().getRange('A1:B2').setShrinkToFit(true);
|
|
5636
|
+
* ```
|
|
5637
|
+
*/
|
|
5552
5638
|
setShrinkToFit(enabled) {
|
|
5553
5639
|
this._commandService.syncExecuteCommand(SetShrinkToFitCommand.id, {
|
|
5554
5640
|
unitId: this._workbook.getUnitId(),
|
|
@@ -5583,7 +5669,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5583
5669
|
}
|
|
5584
5670
|
/**
|
|
5585
5671
|
* Set the vertical (top to bottom) alignment for the given range (top/middle/bottom).
|
|
5586
|
-
* @param {
|
|
5672
|
+
* @param {FVerticalAlignment} alignment The vertical alignment
|
|
5587
5673
|
* @returns {FRange} this range, for chaining
|
|
5588
5674
|
* @example
|
|
5589
5675
|
* ```ts
|
|
@@ -5604,8 +5690,9 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5604
5690
|
return this;
|
|
5605
5691
|
}
|
|
5606
5692
|
/**
|
|
5607
|
-
*
|
|
5608
|
-
*
|
|
5693
|
+
* Sets the horizontal alignment for the range using `left`, `center`, or `normal`.
|
|
5694
|
+
* These parameter names follow Google Apps Script. In Univer, `normal` means right alignment; `right` is not accepted.
|
|
5695
|
+
* @param {FHorizontalAlignment} alignment The horizontal alignment: `left`, `center`, or `normal` (right alignment).
|
|
5609
5696
|
* @returns {FRange} this range, for chaining
|
|
5610
5697
|
* @example
|
|
5611
5698
|
* ```ts
|
|
@@ -5613,7 +5700,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5613
5700
|
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
5614
5701
|
* if (!fWorksheet) return;
|
|
5615
5702
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
5616
|
-
* fRange.setHorizontalAlignment('
|
|
5703
|
+
* fRange.setHorizontalAlignment('normal'); // Align right
|
|
5617
5704
|
* ```
|
|
5618
5705
|
*/
|
|
5619
5706
|
setHorizontalAlignment(alignment) {
|
|
@@ -5626,8 +5713,13 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5626
5713
|
return this;
|
|
5627
5714
|
}
|
|
5628
5715
|
/**
|
|
5629
|
-
* Sets
|
|
5630
|
-
*
|
|
5716
|
+
* Sets cell values or specified cell properties using an array or a sparse matrix.
|
|
5717
|
+
* Each entry follows the scalar parsing and cell-data update rules of {@link FRange.setValue}.
|
|
5718
|
+
*
|
|
5719
|
+
* A two-dimensional array is relative to this range's top-left cell and must match its dimensions.
|
|
5720
|
+
* A sparse matrix uses absolute, zero-based worksheet row and column keys. Only supplied entries
|
|
5721
|
+
* are updated; matrix coordinates are not offset by or clipped to this range.
|
|
5722
|
+
* @param {CellValue[][] | IObjectMatrixPrimitiveType<CellValue> | ICellData[][] | IObjectMatrixPrimitiveType<ICellData>} value An array relative to this range, or a sparse matrix using absolute worksheet coordinates.
|
|
5631
5723
|
* @returns {FRange} This range, for chaining
|
|
5632
5724
|
* @example
|
|
5633
5725
|
* ```ts
|
|
@@ -5639,6 +5731,12 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
5639
5731
|
* [1, { v: 2, s: { bg: { rgb: '#ff0000' } } }],
|
|
5640
5732
|
* [3, 4]
|
|
5641
5733
|
* ]);
|
|
5734
|
+
*
|
|
5735
|
+
* // Update only B2 and C3 using absolute worksheet coordinates.
|
|
5736
|
+
* fWorksheet.getRange('B2:C3').setValues({
|
|
5737
|
+
* 1: { 1: 'B2' },
|
|
5738
|
+
* 2: { 2: { v: 10, f: null, p: null } },
|
|
5739
|
+
* });
|
|
5642
5740
|
* ```
|
|
5643
5741
|
*/
|
|
5644
5742
|
setValues(value) {
|
|
@@ -6010,6 +6108,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
6010
6108
|
* @param {number} callback.row the row number of the cell
|
|
6011
6109
|
* @param {number} callback.col the column number of the cell
|
|
6012
6110
|
* @param {ICellData} callback.cell the cell data
|
|
6111
|
+
* @example
|
|
6013
6112
|
* ```ts
|
|
6014
6113
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
6015
6114
|
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
@@ -6032,6 +6131,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
6032
6131
|
* @param {AbsoluteRefType} [startAbsoluteRefType] - The absolute reference type for the start cell.
|
|
6033
6132
|
* @param {AbsoluteRefType} [endAbsoluteRefType] - The absolute reference type for the end cell.
|
|
6034
6133
|
* @returns {string} The A1 notation of the range.
|
|
6134
|
+
* @example
|
|
6035
6135
|
* ```ts
|
|
6036
6136
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
6037
6137
|
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
@@ -6247,11 +6347,12 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
6247
6347
|
});
|
|
6248
6348
|
}
|
|
6249
6349
|
/**
|
|
6250
|
-
* Clears content and formatting
|
|
6350
|
+
* Clears the range content and formatting, or only one of them as specified by the options.
|
|
6351
|
+
* Both content and formatting are cleared when both flags are true or both are false.
|
|
6251
6352
|
* @param {IFacadeClearOptions} [options] - Options for clearing the range. If not provided, the contents and formatting are cleared both.
|
|
6252
|
-
* @param {boolean} [options.contentsOnly] - If true, the contents of the range are cleared.
|
|
6253
|
-
* @param {boolean} [options.formatOnly] -
|
|
6254
|
-
* @returns {
|
|
6353
|
+
* @param {boolean} [options.contentsOnly] - If true, the contents of the range are cleared. Effective only when `formatOnly` is false. Defaults to false.
|
|
6354
|
+
* @param {boolean} [options.formatOnly] - Clears only formatting when true and `contentsOnly` is false. Defaults to false.
|
|
6355
|
+
* @returns {FRange} This range, for chaining.
|
|
6255
6356
|
* @example
|
|
6256
6357
|
* ```ts
|
|
6257
6358
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -6279,7 +6380,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
6279
6380
|
}
|
|
6280
6381
|
/**
|
|
6281
6382
|
* Clears content of the range, while preserving formatting information.
|
|
6282
|
-
* @returns {
|
|
6383
|
+
* @returns {FRange} This range, for chaining.
|
|
6283
6384
|
* @example
|
|
6284
6385
|
* ```typescript
|
|
6285
6386
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -6301,7 +6402,7 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
6301
6402
|
}
|
|
6302
6403
|
/**
|
|
6303
6404
|
* Clears formatting information of the range, while preserving contents.
|
|
6304
|
-
* @returns {
|
|
6405
|
+
* @returns {FRange} This range, for chaining.
|
|
6305
6406
|
* @example
|
|
6306
6407
|
* ```typescript
|
|
6307
6408
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -6549,8 +6650,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
|
|
|
6549
6650
|
* Returns a new range that is relative to the current range, whose upper left point is offset from the current range by the given rows and columns, and with the given height and width in cells.
|
|
6550
6651
|
* @param {number} rowOffset - The number of rows down from the range's top-left cell; negative values represent rows up from the range's top-left cell.
|
|
6551
6652
|
* @param {number} columnOffset - The number of columns right from the range's top-left cell; negative values represent columns left from the range's top-left cell.
|
|
6552
|
-
* @param {number} numRows - The height in rows of the new range.
|
|
6553
|
-
* @param {number} numColumns - The width in columns of the new range.
|
|
6653
|
+
* @param {number} [numRows] - The height in rows of the new range.
|
|
6654
|
+
* @param {number} [numColumns] - The width in columns of the new range.
|
|
6554
6655
|
* @returns {FRange} The new range.
|
|
6555
6656
|
* @example
|
|
6556
6657
|
* ```ts
|
|
@@ -6781,7 +6882,6 @@ let FWorkbookPermission = class FWorkbookPermission extends FBase {
|
|
|
6781
6882
|
pointsToSet["WorkbookView"] = true;
|
|
6782
6883
|
pointsToSet["WorkbookComment"] = true;
|
|
6783
6884
|
pointsToSet["WorkbookPrint"] = true;
|
|
6784
|
-
break;
|
|
6785
6885
|
}
|
|
6786
6886
|
return pointsToSet;
|
|
6787
6887
|
}
|
|
@@ -6896,7 +6996,7 @@ let FWorkbookPermission = class FWorkbookPermission extends FBase {
|
|
|
6896
6996
|
}
|
|
6897
6997
|
/**
|
|
6898
6998
|
* Set multiple collaborators at once (replaces existing collaborators).
|
|
6899
|
-
* @param {Array<{ user:
|
|
6999
|
+
* @param {Array<{ user: ICollaboratorUser; role: UnitRole }>} collaborators Array of collaborators with user information and role.
|
|
6900
7000
|
* @returns {Promise<void>} A promise that resolves when the collaborators are set.
|
|
6901
7001
|
* @example
|
|
6902
7002
|
* ```ts
|
|
@@ -6928,7 +7028,7 @@ let FWorkbookPermission = class FWorkbookPermission extends FBase {
|
|
|
6928
7028
|
}
|
|
6929
7029
|
/**
|
|
6930
7030
|
* Add a single collaborator.
|
|
6931
|
-
* @param {
|
|
7031
|
+
* @param {ICollaboratorUser} user The user information (userID, name, avatar).
|
|
6932
7032
|
* @param {UnitRole} role The role to assign.
|
|
6933
7033
|
* @returns {Promise<void>} A promise that resolves when the collaborator is added.
|
|
6934
7034
|
* @example
|
|
@@ -6954,7 +7054,7 @@ let FWorkbookPermission = class FWorkbookPermission extends FBase {
|
|
|
6954
7054
|
}
|
|
6955
7055
|
/**
|
|
6956
7056
|
* Update an existing collaborator's role and information.
|
|
6957
|
-
* @param {
|
|
7057
|
+
* @param {ICollaboratorUser} user The updated user information (userID, name, avatar).
|
|
6958
7058
|
* @param {UnitRole} role The new role to assign.
|
|
6959
7059
|
* @returns {Promise<void>} A promise that resolves when the collaborator is updated.
|
|
6960
7060
|
* @example
|
|
@@ -7075,6 +7175,7 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
7075
7175
|
getWorkbook() {
|
|
7076
7176
|
return this._workbook;
|
|
7077
7177
|
}
|
|
7178
|
+
/** Releases this facade's resources. Use `univerAPI.disposeUnit()` to unload the owning unit. */
|
|
7078
7179
|
dispose() {
|
|
7079
7180
|
super.dispose();
|
|
7080
7181
|
this._workbook = null;
|
|
@@ -7365,7 +7466,7 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
7365
7466
|
}
|
|
7366
7467
|
/**
|
|
7367
7468
|
* Undo the last action.
|
|
7368
|
-
* @returns {FWorkbook}
|
|
7469
|
+
* @returns {FWorkbook} This workbook, for chaining.
|
|
7369
7470
|
* @example
|
|
7370
7471
|
* ```ts
|
|
7371
7472
|
* // The code below undoes the last action
|
|
@@ -7380,7 +7481,7 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
7380
7481
|
}
|
|
7381
7482
|
/**
|
|
7382
7483
|
* Redo the last undone action.
|
|
7383
|
-
* @returns {FWorkbook}
|
|
7484
|
+
* @returns {FWorkbook} This workbook, for chaining.
|
|
7384
7485
|
* @example
|
|
7385
7486
|
* ```ts
|
|
7386
7487
|
* // The code below redoes the last undone action
|
|
@@ -7744,7 +7845,7 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
7744
7845
|
* const definedNameParam = fWorkbook.newDefinedNameBuilder()
|
|
7745
7846
|
* .setRef('Sheet1!$A$1')
|
|
7746
7847
|
* .setName('MyDefinedName')
|
|
7747
|
-
* .setComment('This is a comment')
|
|
7848
|
+
* .setComment('This is a comment')
|
|
7748
7849
|
* .build();
|
|
7749
7850
|
* console.log(definedNameParam);
|
|
7750
7851
|
* fWorkbook.insertDefinedNameBuilder(definedNameParam);
|
|
@@ -7884,7 +7985,7 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
7884
7985
|
/**
|
|
7885
7986
|
* Create a range theme style.
|
|
7886
7987
|
* @param {string} themeName - The name of the theme to register
|
|
7887
|
-
* @param {Omit<IRangeThemeStyleJSON, 'name'>} themeStyleJson - The theme style json to register
|
|
7988
|
+
* @param {Omit<IRangeThemeStyleJSON, 'name'>} [themeStyleJson] - The theme style json to register
|
|
7888
7989
|
* @returns {RangeThemeStyle} - The created range theme style
|
|
7889
7990
|
* @example
|
|
7890
7991
|
* ```ts
|