@univerjs/sheets
Version:
UniverSheet normal base-sheets
1,065 lines • 317 kB
JavaScript
var Ot = Object.defineProperty;
var Tt = (r, e, t) => e in r ? Ot(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
var w = (r, e, t) => Tt(r, typeof e != "symbol" ? e + "" : e, t);
import { Inject as g, Injector as P, ICommandService as k, IPermissionService as Y, IAuthzIoService as re, LocaleService as bt, generateRandomId as It, Rectangle as B, cellToRange as Vt, HorizontalAlign as K, VerticalAlign as J, RANGE_TYPE as p, ILogService as ft, Direction as oe, generateIntervalsByPoints as qe, BooleanNumber as I, WrapStrategy as ue, ObjectMatrix as fe, covertCellValue as Me, TextStyleValue as Ye, RichTextValue as L, DEFAULT_STYLES as Ze, covertCellValues as Qe, Dimension as G, isNullCell as Q, mergeWorksheetSnapshotWithDefault as Xe, Tools as et, UndoCommand as At, RedoCommand as Bt, toDisposable as vt, UniverInstanceType as H, IResourceLoaderService as Ft, IUniverInstanceService as le, CanceledError as D } from "@univerjs/core";
import { FBase as Fe, FBaseInitialable as He, FUniver as Rt, FEnum as Ht, FEventName as $t } from "@univerjs/core/facade";
import { WorksheetProtectionRuleModel as $e, RangeProtectionRuleModel as ie, WorksheetProtectionPointModel as ze, SetDefinedNameCommand as De, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as ne, RemoveDefinedNameCommand as zt, WorkbookPermissionService as Lt, PermissionPointsDefinitions as Gt, WorkbookEditablePermission as Le, UnitObject as A, AddWorksheetProtectionMutation as Kt, DeleteWorksheetProtectionMutation as Jt, getAllWorksheetPermissionPoint as qt, getAllWorksheetPermissionPointByPointPanel as tt, SetWorksheetPermissionPointsMutation as Yt, AddRangeProtectionMutation as pt, ViewStateEnum as U, EditStateEnum as x, DeleteRangeProtectionMutation as yt, SetRangeProtectionMutation as Et, WorksheetEditPermission as Pt, WorksheetViewPermission as Ut, getPrimaryForRange as me, SetSelectionsOperation as Ge, getNextPrimaryCell as Zt, WorkbookCopySheetPermission as Qt, WorkbookDeleteColumnPermission as Xt, WorkbookDeleteRowPermission as es, WorkbookInsertColumnPermission as ts, WorkbookInsertRowPermission as ss, WorkbookCreateProtectPermission as ns, WorkbookRecoverHistoryPermission as rs, WorkbookHistoryPermission as is, WorkbookViewHistoryPermission as os, WorkbookHideSheetPermission as as, WorkbookMoveSheetPermission as hs, WorkbookRenameSheetPermission as ds, WorkbookDeleteSheetPermission as cs, WorkbookCreateSheetPermission as us, WorkbookManageCollaboratorPermission as ls, WorkbookCommentPermission as ms, WorkbookDuplicatePermission as gs, WorkbookCopyPermission as _s, WorkbookSharePermission as ws, WorkbookExportPermission as Ss, WorkbookPrintPermission as Cs, WorkbookViewPermission as ks, WorksheetSelectUnProtectedCellsPermission as bs, WorksheetSelectProtectedCellsPermission as Is, WorksheetDeleteProtectionPermission as fs, WorksheetManageCollaboratorPermission as vs, WorksheetEditExtraObjectPermission as Rs, WorksheetInsertHyperlinkPermission as ps, WorksheetPivotTablePermission as ys, WorksheetFilterPermission as Es, WorksheetSortPermission as Ps, WorksheetDeleteColumnPermission as Us, WorksheetDeleteRowPermission as xs, WorksheetInsertColumnPermission as Ms, WorksheetInsertRowPermission as Ds, WorksheetSetColumnStylePermission as Ws, WorksheetSetRowStylePermission as js, WorksheetSetCellStylePermission as Ns, WorksheetSetCellValuePermission as Os, WorksheetCopyPermission as Ts, RangeProtectionPermissionDeleteProtectionPoint as Vs, RangeProtectionPermissionManageCollaPoint as As, RangeProtectionPermissionViewPoint as Bs, RangeProtectionPermissionEditPoint as Fs, SheetsSelectionsService as xt, SetWorksheetDefaultStyleMutation as Hs, SetColDataCommand as st, SetRowDataCommand as nt, copyRangeStyles as ae, InsertRowByRangeCommand as rt, RemoveRowByRangeCommand as $s, MoveRowsCommand as zs, SetRowHiddenCommand as it, SetSpecificRowsVisibleCommand as ot, SetTextWrapCommand as We, SetWorksheetRowIsAutoHeightMutation as Ls, SetRowHeightCommand as at, SetWorksheetRowIsAutoHeightCommand as ve, InsertColByRangeCommand as ht, RemoveColByRangeCommand as Gs, MoveColsCommand as Ks, SetColHiddenCommand as dt, SetSpecificColsVisibleCommand as ct, SetColWidthCommand as Js, SetFrozenCommand as Re, CancelFrozenCommand as qs, ToggleGridlinesCommand as je, SetGridlinesColorCommand as Ne, SetTabColorCommand as Ys, SetRangeValuesMutation as ut, SetWorksheetHideCommand as Zs, SetWorksheetShowCommand as Qs, SetWorksheetNameCommand as Oe, ClearSelectionAllCommand as Mt, ClearSelectionContentCommand as Dt, ClearSelectionFormatCommand as Wt, AppendRowCommand as Xs, SetWorksheetRowCountCommand as en, SetWorksheetColumnCountCommand as tn, SetRangeCustomMetadataCommand as lt, SetBorderBasicCommand as sn, SetStyleCommand as T, SetTextRotationCommand as nn, SetRangeValuesCommand as X, SetVerticalTextAlignCommand as rn, SetHorizontalTextAlignCommand as on, addMergeCellsUtil as pe, getAddMergeMutationRangeByType as mt, RemoveWorksheetMergeCommand as an, SplitTextToColumnsCommand as hn, SetWorksheetRangeThemeStyleCommand as dn, DeleteWorksheetRangeThemeStyleCommand as cn, SheetRangeThemeService as jt, InsertRangeMoveDownCommand as un, InsertRangeMoveRightCommand as ln, DeleteRangeMoveUpCommand as mn, DeleteRangeMoveLeftCommand as gn, AutoFillCommand as _n, SetWorkbookNameCommand as wn, InsertSheetCommand as ge, SetWorksheetActiveOperation as te, RemoveSheetCommand as Te, CopySheetCommand as Sn, SetWorksheetOrderCommand as Cn, RegisterWorksheetRangeThemeStyleCommand as kn, UnregisterWorksheetRangeThemeStyleCommand as bn, RangeThemeStyle as In, SetWorksheetOrderMutation as gt, SetTabColorMutation as _t, SetWorksheetHideMutation as wt, COMMAND_LISTENER_VALUE_CHANGE as fn, getValueChangedEffectedRange as vn, SheetsFreezeSyncController as Rn, SheetValueChangeType as pn, SheetSkeletonChangeType as yn, SplitDelimiterEnum as En } from "@univerjs/sheets";
import { IDefinedNamesService as Nt, serializeRange as Ke, deserializeRangeWithSheet as Pn, serializeRangeWithSheet as Un, FormulaDataModel as xn } from "@univerjs/engine-formula";
import { BehaviorSubject as _e, Subject as Mn } from "rxjs";
import { filter as M, distinctUntilChanged as we, shareReplay as N, map as Se } from "rxjs/operators";
var Dn = Object.getOwnPropertyDescriptor, Wn = (r, e, t, s) => {
for (var n = s > 1 ? void 0 : s ? Dn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
(o = r[i]) && (n = o(n) || n);
return n;
}, W = (r, e) => (t, s) => e(t, s, r);
function jn(r, e, t) {
const s = t.getDefinedNameMap(r);
if (s == null)
return e.t("definedName.defaultName") + 1;
const i = Array.from(Object.values(s)).length + 1, o = e.t("definedName.defaultName") + i;
if (t.getValueByName(r, o) == null)
return o;
let a = i + 1;
for (; ; ) {
const h = e.t("definedName.defaultName") + a;
if (t.getValueByName(r, h) == null)
return h;
a++;
}
}
class be {
constructor() {
w(this, "_definedNameParam");
this._definedNameParam = {
id: It(10),
unitId: "",
name: "",
formulaOrRefString: "",
localSheetId: ne
};
}
/**
* Sets the name of the defined name builder.
* @param {string} name The name of the defined name.
* @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedNameBuilder = univerAPI.newDefinedName()
* .setName('MyDefinedName')
* .setRef('Sheet1!$A$1')
* .build();
* fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
* ```
*/
setName(e) {
return this._definedNameParam.name = e, this;
}
/**
* Sets the formula of the defined name builder.
* @param {string }formula The formula of the defined name.
* @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedNameBuilder = univerAPI.newDefinedName()
* .setName('MyDefinedName')
* .setFormula('SUM(Sheet1!$A$1)')
* .build();
* fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
* ```
*/
setFormula(e) {
return this._definedNameParam.formulaOrRefString = `=${e}`, this;
}
/**
* Sets the reference of the defined name builder.
* @param {string} a1Notation The reference of the defined name.
* @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedNameBuilder = univerAPI.newDefinedName()
* .setName('MyDefinedName')
* .setRef('Sheet1!$A$1')
* .build();
* fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
* ```
*/
setRef(e) {
return this._definedNameParam.formulaOrRefString = e, this;
}
/**
* Sets the reference of the defined name builder by range .
* @param {number} row The start row index of the range. index start at 0.
* @param {number} column The start column index of the range. index start at 0.
* @param {number} numRows The number of rows in the range.
* @param {number} numColumns The number of columns in the range.
* @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedNameBuilder = univerAPI.newDefinedName()
* .setName('MyDefinedName')
* .setRefByRange(1, 3, 2, 5) // D2:H3
* .build();
* fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
* ```
*/
setRefByRange(e, t, s, n) {
return this._definedNameParam.formulaOrRefString = Ke({
startRow: e,
endRow: e + (s != null ? s : 1) - 1,
startColumn: t,
endColumn: t + (n != null ? n : 1) - 1
}), this;
}
/**
* Sets the comment of the defined name builder.
* @param {string} comment The comment of the defined name.
* @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedNameBuilder = univerAPI.newDefinedName()
* .setName('MyDefinedName')
* .setRef('Sheet1!$A$1')
* .setComment('A reference to A1 cell in Sheet1')
* .build();
* fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
* ```
*/
setComment(e) {
return this._definedNameParam.comment = e, this;
}
/**
* Sets the scope of the defined name to the worksheet.
* @param {FWorksheet} worksheet The worksheet to set the scope to.
* @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const sheets = fWorkbook.getSheets();
*
* // Create a defined name and make it available only in the second worksheet
* const definedNameBuilder = univerAPI.newDefinedName()
* .setName('MyDefinedName')
* .setRef('Sheet1!$A$1')
* .setScopeToWorksheet(sheets[1])
* .build();
* fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
* ```
*/
setScopeToWorksheet(e) {
return this._definedNameParam.localSheetId = e.getSheetId(), this;
}
/**
* Sets the scope of the defined name to the workbook.
* @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
*
* // Create a defined name and make it available in the entire workbook
* const definedNameBuilder = univerAPI.newDefinedName()
* .setName('MyDefinedName')
* .setRef('Sheet1!$A$1')
* .setScopeToWorkbook()
* .build();
* fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
* ```
*/
setScopeToWorkbook() {
return this._definedNameParam.localSheetId = ne, this;
}
/**
* Sets the hidden status of the defined name builder.
* @param {boolean} hidden The hidden status of the defined name.
* @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedNameBuilder = univerAPI.newDefinedName()
* .setName('MyDefinedName')
* .setRef('Sheet1!$A$1')
* .setHidden(true)
* .build();
* fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
* ```
*/
setHidden(e) {
return this._definedNameParam.hidden = e, this;
}
/**
* Builds the defined name parameter.
* @returns {ISetDefinedNameMutationParam} The defined name mutation parameter.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedNameBuilder = univerAPI.newDefinedName()
* .setName('MyDefinedName')
* .setRef('Sheet1!$A$1')
* .setComment('A reference to A1 cell in Sheet1')
* .build();
* fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
* ```
*/
build() {
return this._definedNameParam;
}
/**
* Loads the defined name mutation parameter.
* @param {ISetDefinedNameMutationParam} param - defined name mutation parameter
* @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedNameParam = {
* id: '4TMPceoqg8',
* unitId: fWorkbook.getId(),
* name: 'MyDefinedName',
* formulaOrRefString: 'Sheet1!$A$1',
* }
* const definedNameBuilder = univerAPI.newDefinedName()
* .load(definedNameParam)
* .build();
* fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
* ```
*/
load(e) {
return this._definedNameParam = e, this;
}
}
let Ce = class extends Fe {
constructor(r, e, t, s, n, i, o, a, h, d) {
super(), this._definedNameParam = r, this._injector = e, this._commandService = t, this._permissionService = s, this._worksheetProtectionRuleModel = n, this._rangeProtectionRuleModel = i, this._worksheetProtectionPointRuleModel = o, this._authzIoService = a, this._localeService = h, this._definedNamesService = d;
}
_apply() {
this._definedNameParam.name === "" && (this._definedNameParam.name = jn(this._definedNameParam.unitId, this._localeService, this._definedNamesService)), this._commandService.syncExecuteCommand(De.id, this._definedNameParam);
}
/**
* Gets the name of the defined name.
* @returns {string} The name of the defined name.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedName = fWorkbook.getDefinedNames()[0];
* console.log(definedName?.getName());
* ```
*/
getName() {
return this._definedNameParam.name;
}
/**
* Sets the name of the defined name.
* @param {string} name The name of the defined name.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedName = fWorkbook.getDefinedNames()[0];
* definedName?.setName('NewDefinedName');
* ```
*/
setName(r) {
this._definedNameParam.name = r, this._apply();
}
/**
* Sets the formula of the defined name.
* @param {string} formula The formula of the defined name.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedName = fWorkbook.getDefinedNames()[0];
* definedName?.setFormula('SUM(Sheet1!$A$1)');
* ```
*/
setFormula(r) {
this._definedNameParam.formulaOrRefString = `=${r}`, this._apply();
}
/**
* Sets the reference of the defined name.
* @param {string} refString The reference of the defined name.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedName = fWorkbook.getDefinedNames()[0];
* definedName?.setRef('Sheet1!$A$1');
* ```
*/
setRef(r) {
this._definedNameParam.formulaOrRefString = r, this._apply();
}
/**
* Gets the formula or reference string of the defined name.
* @returns {string} The formula or reference string of the defined name.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedName = fWorkbook.getDefinedNames()[0];
* console.log(definedName?.getFormulaOrRefString());
* ```
*/
getFormulaOrRefString() {
return this._definedNameParam.formulaOrRefString;
}
/**
* Sets the reference of the defined name by range.
* @param {number} row The start row of the range.
* @param {number} column The start column of the range.
* @param {number} numRows The number of rows in the range.
* @param {number} numColumns The number of columns in the range.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedName = fWorkbook.getDefinedNames()[0];
* definedName?.setRefByRange(1, 3, 2, 5); // D2:H3
* ```
*/
setRefByRange(r, e, t, s) {
this._definedNameParam.formulaOrRefString = Ke({
startRow: r,
endRow: r + (t != null ? t : 1) - 1,
startColumn: e,
endColumn: e + (s != null ? s : 1) - 1
}), this._apply();
}
/**
* Gets the comment of the defined name.
* @returns {string | undefined} The comment of the defined name.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedName = fWorkbook.getDefinedNames()[0];
* console.log(definedName?.getComment());
* ```
*/
getComment() {
return this._definedNameParam.comment;
}
/**
* Sets the comment of the defined name.
* @param {string} comment The comment of the defined name.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedName = fWorkbook.getDefinedNames()[0];
* definedName?.setComment('This is a comment');
* ```
*/
setComment(r) {
this._definedNameParam.comment = r, this._apply();
}
/**
* Sets the scope of the defined name to the worksheet.
* @param {FWorksheet} worksheet The worksheet to set the scope to.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const sheets = fWorkbook.getSheets();
*
* // Get the first defined name and make it available only in the second worksheet
* const definedName = fWorkbook.getDefinedNames()[0];
* definedName?.setScopeToWorksheet(sheets[1]);
* ```
*/
setScopeToWorksheet(r) {
this._definedNameParam.localSheetId = r.getSheetId(), this._apply();
}
/**
* Sets the scope of the defined name to the workbook.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedName = fWorkbook.getDefinedNames()[0];
* definedName?.setScopeToWorkbook();
* ```
*/
setScopeToWorkbook() {
this._definedNameParam.localSheetId = ne, this._apply();
}
/**
* Sets the hidden status of the defined name.
* @param {boolean} hidden The hidden status of the defined name.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedName = fWorkbook.getDefinedNames()[0];
* definedName?.setHidden(true);
* ```
*/
setHidden(r) {
this._definedNameParam.hidden = r, this._apply();
}
/**
* Deletes the defined name.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedName = fWorkbook.getDefinedNames()[0];
* definedName?.delete();
* ```
*/
delete() {
this._commandService.syncExecuteCommand(zt.id, this._definedNameParam);
}
/**
* Gets the local sheet id of the defined name.
* @returns {string | undefined} The local sheet id of the defined name.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedName = fWorkbook.getDefinedNames()[0];
* console.log(definedName?.getLocalSheetId());
* ```
*/
getLocalSheetId() {
return this._definedNameParam.localSheetId;
}
/**
* Checks if the defined name is in the workbook scope.
* @returns {boolean} True if the defined name is in the workbook scope, false otherwise.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedName = fWorkbook.getDefinedNames()[0];
* console.log(definedName?.isWorkbookScope());
* ```
*/
isWorkbookScope() {
return this._definedNameParam.localSheetId === ne;
}
/**
* Converts the defined name to a defined name builder.
* @returns {FDefinedNameBuilder} The defined name builder.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const definedName = fWorkbook.getDefinedNames()[0];
* if (!definedName) return;
* const definedNameBuilder = definedName
* .toBuilder()
* .setName('NewDefinedName')
* .setFormula('SUM(Sheet1!$A$1)')
* .build();
* fWorkbook.updateDefinedNameBuilder(definedNameBuilder);
* ```
*/
toBuilder() {
const r = this._injector.createInstance(be);
return r.load(this._definedNameParam), r;
}
};
Ce = Wn([
W(1, g(P)),
W(2, k),
W(3, Y),
W(4, g($e)),
W(5, g(ie)),
W(6, g(ze)),
W(7, g(re)),
W(8, g(bt)),
W(9, Nt)
], Ce);
var $ = /* @__PURE__ */ ((r) => (r[r.Reader = 0] = "Reader", r[r.Editor = 1] = "Editor", r[r.Owner = 2] = "Owner", r))($ || {}), u = /* @__PURE__ */ ((r) => (r.Edit = "WorkbookEdit", r.View = "WorkbookView", r.Print = "WorkbookPrint", r.Export = "WorkbookExport", r.Share = "WorkbookShare", r.CopyContent = "WorkbookCopy", r.DuplicateFile = "WorkbookDuplicate", r.Comment = "WorkbookComment", r.ManageCollaborator = "WorkbookManageCollaborator", r.CreateSheet = "WorkbookCreateSheet", r.DeleteSheet = "WorkbookDeleteSheet", r.RenameSheet = "WorkbookRenameSheet", r.MoveSheet = "WorkbookMoveSheet", r.HideSheet = "WorkbookHideSheet", r.ViewHistory = "WorkbookViewHistory", r.ManageHistory = "WorkbookHistory", r.RecoverHistory = "WorkbookRecoverHistory", r.CreateProtection = "WorkbookCreateProtect", r.InsertRow = "WorkbookInsertRow", r.InsertColumn = "WorkbookInsertColumn", r.DeleteRow = "WorkbookDeleteRow", r.DeleteColumn = "WorkbookDeleteColumn", r.CopySheet = "WorkbookCopySheet", r))(u || {}), _ = /* @__PURE__ */ ((r) => (r.Edit = "WorksheetEdit", r.View = "WorksheetView", r.Copy = "WorksheetCopy", r.SetCellValue = "WorksheetSetCellValue", r.SetCellStyle = "WorksheetSetCellStyle", r.SetRowStyle = "WorksheetSetRowStyle", r.SetColumnStyle = "WorksheetSetColumnStyle", r.InsertRow = "WorksheetInsertRow", r.InsertColumn = "WorksheetInsertColumn", r.DeleteRow = "WorksheetDeleteRow", r.DeleteColumn = "WorksheetDeleteColumn", r.Sort = "WorksheetSort", r.Filter = "WorksheetFilter", r.PivotTable = "WorksheetPivotTable", r.InsertHyperlink = "WorksheetInsertHyperlink", r.EditExtraObject = "WorksheetEditExtraObject", r.ManageCollaborator = "WorksheetManageCollaborator", r.DeleteProtection = "WorksheetDeleteProtection", r.SelectProtectedCells = "WorksheetSelectProtectedCells", r.SelectUnProtectedCells = "WorksheetSelectUnProtectedCells", r))(_ || {}), b = /* @__PURE__ */ ((r) => (r.Edit = "RangeEdit", r.View = "RangeView", r.ManageCollaborator = "RangeManageCollaborator", r.Delete = "RangeDeleteProtection", r))(b || {}), Nn = Object.getOwnPropertyDescriptor, On = (r, e, t, s) => {
for (var n = s > 1 ? void 0 : s ? Nn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
(o = r[i]) && (n = o(n) || n);
return n;
}, V = (r, e) => (t, s) => e(t, s, r);
let z = class extends Fe {
constructor(e, t, s, n, i, o, a, h) {
super();
/**
* Permission point definition, can read the point constructor want to modify from here
*/
w(this, "permissionPointsDefinition", Gt);
/**
* An observable object used to monitor permission change events within a range, thereby triggering corresponding subsequent processing.
*/
w(this, "rangeRuleChangedAfterAuth$");
/**
* An observable object used to monitor permission change events within a worksheet, thereby triggering corresponding subsequent processing.
*/
w(this, "sheetRuleChangedAfterAuth$");
/**
* An observable object used to monitor the initialization state changes of unit permissions.
*/
w(this, "unitPermissionInitStateChange$");
this._injector = e, this._commandService = t, this._permissionService = s, this._worksheetProtectionRuleModel = n, this._rangeProtectionRuleModel = i, this._worksheetProtectionPointRuleModel = o, this._workbookPermissionService = a, this._authzIoService = h, this.rangeRuleChangedAfterAuth$ = this._rangeProtectionRuleModel.ruleRefresh$, this.sheetRuleChangedAfterAuth$ = this._worksheetProtectionRuleModel.ruleRefresh$, this.unitPermissionInitStateChange$ = this._workbookPermissionService.unitPermissionInitStateChange$;
}
/**
* Configures a specific permission point for a workbook.
* This function sets or updates a permission point for a workbook identified by `unitId`.
* It creates a new permission point if it does not already exist, and updates the point with the provided value.
* @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
* @param {WorkbookPermissionPointConstructor} FPointClass - The constructor function for creating a permission point instance. Other point constructors can See the [permission-point documentation](https://github.com/dream-num/univer/tree/dev/packages/sheets/src/services/permission/permission-point) for more details.
* @param {boolean} value - The boolean value to determine whether the permission point is enabled or disabled.
*
* @example
* ```typescript
* const workbook = univerAPI.getActiveWorkbook();
* const permission = workbook.getPermission();
* const unitId = workbook.getId();
* permission.setWorkbookPermissionPoint(unitId, permission.permissionPointsDefinition.WorkbookEditablePermission, false)
* ```
*/
setWorkbookPermissionPoint(e, t, s) {
const n = new t(e);
this._permissionService.getPermissionPoint(n.id) || this._permissionService.addPermissionPoint(n), this._permissionService.updatePermissionPoint(n.id, s);
}
/**
* Check if a specific permission point is enabled for a workbook.
* @param unitId - The unique identifier of the workbook.
* @param FPointClass - The constructor for the permission point class.
* See the [permission-point documentation](https://github.com/dream-num/univer/tree/dev/packages/sheets/src/services/permission/permission-point) for more details.
* @example
* ```typescript
* const workbook = univerAPI.getActiveWorkbook();
* const permission = workbook.getPermission();
* const unitId = workbook.getId();
* // Check if the workbook is editable
* const isEditable = permission.checkWorkbookPermissionPoint(unitId, permission.permissionPointsDefinition.WorkbookEditablePermission);
* console.log('Workbook is editable:', isEditable);
* ```
*/
checkWorkbookPermissionPoint(e, t) {
const s = new t(e), n = this._permissionService.getPermissionPoint(s.id);
if (n)
return n.value;
}
/**
* This function is used to set whether the workbook can be edited
* @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
* @param {boolean} value - A value that controls whether the workbook can be edited
*
* @example
* ```typescript
* const workbook = univerAPI.getActiveWorkbook();
* const permission = workbook.getPermission();
* const unitId = workbook.getId();
* permission.setWorkbookEditPermission(unitId, false);
* ```
*/
setWorkbookEditPermission(e, t) {
this.setWorkbookPermissionPoint(e, Le, t);
}
/**
* This function is used to add a base permission for a worksheet.
* Note that after adding, only the background mask of the permission module will be rendered. If you want to modify the function permissions,
* you need to modify the permission points with the permissionId returned by this function.
* @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
* @param {string} subUnitId - The unique identifier of the worksheet for which the permission is being set.
* @param {IWorksheetProtectionOptions} options - Optional protection options including allowed users and name.
* @returns {Promise<string | undefined>} - Returns the `permissionId` if the permission is successfully added. If the operation fails or no result is returned, it resolves to `undefined`.
*
* @example
* ```typescript
* const workbook = univerAPI.getActiveWorkbook();
* const permission = workbook.getPermission();
* const unitId = workbook.getId();
* const worksheet = workbook.getActiveSheet();
* const subUnitId = worksheet.getSheetId();
* // Note that there will be no permission changes after this step is completed. It only returns an ID for subsequent permission changes.
* // For details, please see the example of the **`setWorksheetPermissionPoint`** API.
* const permissionId = await permission.addWorksheetBasePermission(unitId, subUnitId, {
* allowedUsers: ['user1', 'user2'],
* name: 'My Protection'
* })
* // Can still edit and read it.
* console.log('debugger', permissionId)
* ```
*/
async addWorksheetBasePermission(e, t, s) {
let n = [];
if (s != null && s.allowedUsers) {
const a = await this._authzIoService.listCollaborators({
objectID: e,
unitID: e
}), h = new Set(s.allowedUsers);
n = a.filter((c) => {
var l;
return h.has(((l = c.subject) == null ? void 0 : l.userID) || c.id);
}).map((c) => ({
id: c.id,
role: $.Editor,
subject: c.subject
}));
const d = new Set(n.map((c) => {
var l;
return ((l = c.subject) == null ? void 0 : l.userID) || c.id;
}));
s.allowedUsers.forEach((c) => {
d.has(c) || console.error(`User ${c} not found in collaborators list`);
});
}
const i = await this._authzIoService.create({
objectType: A.Worksheet,
worksheetObject: {
collaborators: n,
unitID: e,
strategies: [],
name: (s == null ? void 0 : s.name) || "",
scope: void 0
}
});
if (this._commandService.syncExecuteCommand(Kt.id, {
unitId: e,
subUnitId: t,
rule: {
permissionId: i,
unitType: A.Worksheet,
unitId: e,
subUnitId: t
}
}))
return i;
}
/**
* Delete the entire table protection set for the worksheet and reset the point permissions of the worksheet to true
* @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
* @param {string} subUnitId - The unique identifier of the worksheet for which the permission is being set.
*
* @example
* ```typescript
* const workbook = univerAPI.getActiveWorkbook();
* const permission = workbook.getPermission();
* const unitId = workbook.getId();
* const worksheet = workbook.getActiveSheet();
* const subUnitId = worksheet.getSheetId();
* permission.removeWorksheetPermission(unitId, subUnitId);
* ```
*/
removeWorksheetPermission(e, t) {
this._commandService.syncExecuteCommand(Jt.id, {
unitId: e,
subUnitId: t
}), [...qt(), ...tt()].forEach((s) => {
const n = new s(e, t);
this._permissionService.updatePermissionPoint(n.id, !0);
}), this._worksheetProtectionPointRuleModel.deleteRule(e, t);
}
/**
* Sets the worksheet permission point by updating or adding the permission point for the worksheet.
* If the worksheet doesn't have a base permission, it creates one to used render
* @param {string} unitId - The unique identifier of the workbook.
* @param {string} subUnitId - The unique identifier of the worksheet.
* @param {WorkSheetPermissionPointConstructor} FPointClass - The constructor for the permission point class.
* See the [permission-point documentation](https://github.com/dream-num/univer/tree/dev/packages/sheets/src/services/permission/permission-point) for more details.
* @param {boolean} value - The new permission value to be set for the worksheet.
* @returns {Promise<string | undefined>} - Returns the `permissionId` if the permission point is successfully set or created. If no permission is set, it resolves to `undefined`.
*
* @example
* ```typescript
* const workbook = univerAPI.getActiveWorkbook();
* const permission = workbook.getPermission();
* const unitId = workbook.getId();
* const worksheet = workbook.getActiveSheet();
* const subUnitId = worksheet.getSheetId();
* const permissionId = await permission.addWorksheetBasePermission(unitId, subUnitId)
* // After this line of code , the worksheet will no longer be editable
* permission.setWorksheetPermissionPoint(unitId, subUnitId, permission.permissionPointsDefinition.WorksheetEditPermission, false);
* ```
*/
async setWorksheetPermissionPoint(e, t, s, n) {
const i = this._worksheetProtectionRuleModel.getRule(e, t);
let o;
if (s === Pt || s === Ut)
i ? o = i.permissionId : o = await this.addWorksheetBasePermission(e, t);
else {
const c = this._worksheetProtectionPointRuleModel.getRule(e, t);
c ? o = c.permissionId : (o = await this._authzIoService.create({
objectType: A.Worksheet,
worksheetObject: {
collaborators: [],
unitID: e,
strategies: [],
name: "",
scope: void 0
}
}), this._commandService.syncExecuteCommand(Yt.id, { unitId: e, subUnitId: t, rule: { unitId: e, subUnitId: t, permissionId: o } }));
}
const h = new s(e, t);
if (this._permissionService.getPermissionPoint(h.id) || this._permissionService.addPermissionPoint(h), o) {
const c = h.subType;
await this._authzIoService.update({
objectType: A.Worksheet,
objectID: o,
strategies: [{
action: c,
role: n ? $.Owner : $.Reader
}],
unitID: e,
share: void 0,
name: "",
scope: void 0,
collaborators: void 0
});
}
return this._permissionService.updatePermissionPoint(h.id, n), o;
}
/**
* Check if a specific permission point is enabled for a worksheet.
* @param unitId - The unique identifier of the workbook.
* @param subUnitId - The unique identifier of the worksheet.
* @param FPointClass - The constructor for the permission point class.
* See the [permission-point documentation](https://github.com/dream-num/univer/tree/dev/packages/sheets/src/services/permission/permission-point) for more details.
* @returns {boolean | undefined} - Returns true if the permission point is enabled, false if it is disabled, or undefined if the permission point does not exist.
* @example
* ```typescript
* const workbook = univerAPI.getActiveWorkbook();
* const permission = workbook.getPermission();
* const unitId = workbook.getId();
* const worksheet = workbook.getActiveSheet();
* const subUnitId = worksheet.getSheetId();
* // Check if the worksheet is editable
* const isEditable = permission.checkWorksheetPermissionPoint(unitId, subUnitId, permission.permissionPointsDefinition.WorksheetEditPermission);
* console.log('Worksheet is editable:', isEditable);
* ```
*/
checkWorksheetPermissionPoint(e, t, s) {
const n = new s(e, t), i = this._permissionService.getPermissionPoint(n.id);
if (i)
return i.value;
}
/**
* Adds a range protection to the worksheet.
* Note that after adding, only the background mask of the permission module will be rendered. If you want to modify the function permissions,
* you need to modify the permission points with the permissionId returned by this function.
* @deprecated Use `worksheet.getWorksheetPermission().protectRanges()` instead
* @param {string} unitId - The unique identifier of the workbook.
* @param {string} subUnitId - The unique identifier of the worksheet.
* @param {FRange[]} ranges - The ranges to be protected.
* @param {IRangeProtectionOptions} options - Optional protection options including allowed users and name.
* @returns {Promise<{ permissionId: string, ruleId: string } | undefined>} - Returns an object containing the `permissionId` and `ruleId` if the range protection is successfully added. If the operation fails or no result is returned, it resolves to `undefined`. permissionId is used to stitch permission point ID,ruleId is used to store permission rules
*
* @example
* ```typescript
* // Old API
* const workbook = univerAPI.getActiveWorkbook();
* const permission = workbook.getPermission();
* const unitId = workbook.getId();
* const worksheet = workbook.getActiveSheet();
* const subUnitId = worksheet.getSheetId();
* const range = worksheet.getRange('A1:B2');
* const ranges = [];
* ranges.push(range);
* const res = await permission.addRangeBaseProtection(unitId, subUnitId, ranges, {
* name: 'Protected Area',
* allowEdit: false
* });
* const {permissionId, ruleId} = res;
* console.log('debugger', permissionId, ruleId);
*
* // New API (recommended)
* const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
* const permission = worksheet.getWorksheetPermission();
* const range = worksheet.getRange('A1:B2');
* await permission.protectRanges([{
* ranges: [range],
* options: { name: 'Protected Area', allowEdit: false }
* }]);
* ```
*/
// eslint-disable-next-line max-lines-per-function
async addRangeBaseProtection(e, t, s, n) {
let i = [];
if (n != null && n.allowedUsers) {
const C = await this._authzIoService.listCollaborators({
objectID: e,
unitID: e
}), f = new Set(n.allowedUsers);
i = C.filter((y) => {
var Z;
return f.has(((Z = y.subject) == null ? void 0 : Z.userID) || y.id);
}).map((y) => ({
id: y.id,
role: $.Editor,
subject: y.subject
}));
const Ie = new Set(i.map((y) => {
var Z;
return ((Z = y.subject) == null ? void 0 : Z.userID) || y.id;
}));
n.allowedUsers.forEach((y) => {
Ie.has(y) || console.error(`User ${y} not found in collaborators list`);
});
}
const o = await this._authzIoService.create({
objectType: A.SelectRange,
selectRangeObject: {
collaborators: i,
unitID: e,
name: (n == null ? void 0 : n.name) || "",
scope: void 0
}
}), a = `ruleId_${It(6)}`;
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((C) => C.ranges.some((f) => s.some((Ie) => B.intersects(Ie.getRange(), f)))))
throw new Error("range protection cannot intersect");
const c = this._determineRangeViewState(n), l = this._determineRangeEditState(n), m = {
unitId: e,
subUnitId: t,
rules: [{
permissionId: o,
unitType: A.SelectRange,
unitId: e,
subUnitId: t,
ranges: s.map((C) => C.getRange()),
id: a,
description: n == null ? void 0 : n.name,
viewState: c,
editState: l
}]
};
if (this._commandService.syncExecuteCommand(pt.id, m))
return {
permissionId: o,
ruleId: a
};
}
/**
* Determine view state from range protection options
* @private
*/
_determineRangeViewState(e) {
return (e == null ? void 0 : e.allowViewByOthers) === !1 ? U.NoOneElseCanView : U.OthersCanView;
}
/**
* Determine edit state from range protection options
* @private
*/
_determineRangeEditState(e) {
var t;
return (e == null ? void 0 : e.allowEdit) === !0 && ((t = e == null ? void 0 : e.allowedUsers) != null && t.length) ? x.DesignedUserCanEdit : x.OnlyMe;
}
/**
* Removes the range protection from the worksheet.
* @deprecated Use `worksheet.getWorksheetPermission().unprotectRules()` instead
* @param {string} unitId - The unique identifier of the workbook.
* @param {string} subUnitId - The unique identifier of the worksheet.
* @param {string[]} ruleIds - The rule IDs of the range protection to be removed.
*
* @example
* ```typescript
* // Old API
* const workbook = univerAPI.getActiveWorkbook();
* const permission = workbook.getPermission();
* const unitId = workbook.getId();
* const worksheet = workbook.getActiveSheet();
* const subUnitId = worksheet.getSheetId();
* const range = worksheet.getRange('A1:B2');
* const ranges = [];
* ranges.push(range);
* const res = await permission.addRangeBaseProtection(unitId, subUnitId, ranges);
* const ruleId = res.ruleId;
* permission.removeRangeProtection(unitId, subUnitId, [ruleId]);
*
* // New API (recommended)
* const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
* const permission = worksheet.getWorksheetPermission();
* await permission.unprotectRules([ruleId]);
* ```
*/
removeRangeProtection(e, t, s) {
this._commandService.syncExecuteCommand(yt.id, {
unitId: e,
subUnitId: t,
ruleIds: s
}) && this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length === 0 && (this._worksheetProtectionPointRuleModel.deleteRule(e, t), [...tt()].forEach((o) => {
const a = new o(e, t);
this._permissionService.updatePermissionPoint(a.id, a.value);
}));
}
/**
* Modify the permission points of a custom area
* @param {string} unitId - The unique identifier of the workbook.
* @param {string} subUnitId - The unique identifier of the worksheet within the workbook.
* @param {string} permissionId - The unique identifier of the permission that controls access to the range.
* @param {RangePermissionPointConstructor} FPointClass - The constructor for the range permission point class.
* See the [permission-point documentation](https://github.com/dream-num/univer/tree/dev/packages/sheets/src/services/permission/permission-point) for more details.
* @param {boolean} value - The new permission value to be set for the range (e.g., true for allowing access, false for restricting access).
*
* @example
* ```typescript
* const workbook = univerAPI.getActiveWorkbook();
* const permission = workbook.getPermission();
* const unitId = workbook.getId();
* const worksheet = workbook.getActiveSheet();
* const subUnitId = worksheet.getSheetId();
* const range = worksheet.getRange('A1:B2');
* const ranges = [];
* ranges.push(range);
* // Note that there will be no permission changes after this step is completed. It only returns an ID for subsequent permission changes.
* // For details, please see the example of the **`setRangeProtectionPermissionPoint`** API.
* const res = await permission.addRangeBaseProtection(unitId, subUnitId, ranges);
* const {permissionId, ruleId} = res;
* // After passing the following line of code, the range set above will become uneditable
* permission.setRangeProtectionPermissionPoint(unitId,subUnitId,permissionId, permission.permissionPointsDefinition.RangeProtectionPermissionEditPoint, false);
* ```
*/
setRangeProtectionPermissionPoint(e, t, s, n, i) {
const o = new n(e, t, s);
this._permissionService.getPermissionPoint(o.id) || this._permissionService.addPermissionPoint(o), this._permissionService.updatePermissionPoint(o.id, i);
}
/**
* Sets the ranges for range protection in a worksheet.
*
* This method finds the rule by unitId, subUnitId, and ruleId, and updates the rule with the provided ranges.
* It checks for overlaps with existing ranges in the same subunit and shows an error message if any overlap is detected.
* If no overlap is found, it executes the command to update the range protection with the new ranges.
* @param {string} unitId - The unique identifier of the workbook.
* @param {string} subUnitId - The unique identifier of the worksheet within the workbook.
* @param {string} ruleId - The ruleId of the range protection rule that is being updated.
* @param {FRange[]} ranges - The array of new ranges to be set for the range protection rule.
*
* @example
* ```typescript
* const workbook = univerAPI.getActiveWorkbook();
* const permission = workbook.getPermission();
* const unitId = workbook.getId();
* const worksheet = workbook.getActiveSheet();
* const subUnitId = worksheet.getSheetId();
* const range = worksheet.getRange('A1:B2');
* const ranges = [];
* ranges.push(range);
* const res = await permission.addRangeBaseProtection(unitId, subUnitId, ranges);
* const {permissionId, ruleId} = res;
* const newRange = worksheet.getRange('C1:D2');
* permission.setRangeProtectionRanges(unitId, subUnitId, ruleId, [newRange]);
* ```
*/
setRangeProtectionRanges(e, t, s, n) {
const i = this._rangeProtectionRuleModel.getRule(e, t, s);
if (i) {
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !== s).some((h) => h.ranges.some((d) => n.some((c) => B.intersects(c.getRange(), d)))))
throw new Error("range protection cannot intersect");
this._commandService.syncExecuteCommand(Et.id, {
unitId: e,
subUnitId: t,
ruleId: s,
rule: {
...i,
ranges: n.map((h) => h.getRange())
}
});
}
}
/**
* Get the permission information for a specific cell in a worksheet.
* @param {string} unitId - The unique identifier of the workbook.
* @param {string} subUnitId - The unique identifier of the worksheet within the workbook.
* @param {number} row - The row index of the cell.
* @param {number} column - The column index of the cell.
* @returns {{ permissionId: string, ruleId: string } | undefined} - Returns an object containing the `permissionId` and `ruleId` if the cell is protected by a range protection rule. If no protection is found, it returns `undefined`.
*
* @example
* ```typescript
* const fWorkbook = univerAPI.getActiveWorkbook();
* const fWorksheet = fWorkbook.getActiveSheet();
* const permission = fWorkbook.getPermission();
* const unitId = fWorkbook.getId();
* const subUnitId = fWorksheet.getSheetId();
*
* // Get the permission information for cell C3
* const cell = fWorksheet.getRange('C3');
* const permissionInfo = permission.getPermissionInfoWithCell(
* unitId,
* subUnitId,
* cell.getRow(),
* cell.getColumn()
* );
* console.log(permissionInfo);
*
* // If the cell is protected, you can remove the protection like this:
* if (permissionInfo) {
* const { ruleId } = permissionInfo;
*
* // After 2 seconds, remove the protection for the cell
* setTimeout(() => {
* permission.removeRangeProtection(unitId, subUnitId, [ruleId]);
* }, 2000);
* }
* ```
*/
getPermissionInfoWithCell(e, t, s, n) {
const i = Vt(s, n), o = this._rangeProtectionRuleModel.getSubunitRuleList(e, t).find((a) => a.ranges.some((d) => B.intersects(i, d)));
if (o)
return {
permissionId: o.permissionId,
ruleId: o.id
};
}
};
z = On([
V(0, g(P)),
V(1, k),
V(2, Y),
V(3, g($e)),
V(4, g(ie)),
V(5, g(ze)),
V(6, g(Lt)),
V(7, g(re))
], z);
var Tn = Object.getOwnPropertyDescriptor, Vn = (r, e, t, s) => {
for (var n = s > 1 ? void 0 : s ? Tn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
(o = r[i]) && (n = o(n) || n);
return n;
}, An = (r, e) => (t, s) => e(t, s, r);
let ke = class {
constructor(r, e, t, s) {
this._workbook = r, this._worksheet = e, this._selections = t, this._injector = s;
}
/**
* Represents the active selection in the sheet. Which means the selection contains the active cell.
* @returns {FRange | null} The active selection.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const fWorksheet = fWorkbook.getActiveSheet();
* const fRange = fWorksheet.getRange('A10:B11');
* fRange.activate();
* const fSelection = fWorksheet.getSelection();
* console.log(fSelection.getActiveRange().getA1Notation()); // A10:B11
* ```
*/
getActiveRange() {
const r = this._selections.find((e) => !!e.primary);
return r ? this._injector.createInstance(R, this._workbook, this._worksheet, r.range) : null;
}
/**
* Represents the active selection list in the sheet.
* @returns {FRange[]} The active selection list.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const fWorksheet = fWorkbook.getActiveSheet();
* const fSelection = fWorksheet.getSelection();
* const activeRangeList = fSelection.getActiveRangeList();
* activeRangeList.forEach((range) => {
* console.log(range.getA1Notation());
* });
* ```
*/
getActiveRangeList() {
return this._selections.map((r) => this._injector.createInstance(R, this._workbook, this._worksheet, r.range));
}
/**
* Represents the current select cell in the sheet.
* @returns {ISelectionCell} The current select cell info.Pay attention to the type of the return value.
* @example
* ```ts
* const fWorkbook = univerAPI.getActiveWorkbook();
* const fWorksheet = fWorkbook.getActiveSheet();
* const fRange = fWorksheet.getRange('A10:B11');
* fRange.activate();
* const fSelection = fWorksheet.getSelection();
* const currentCell = fSelection.getCurrentCell();
* const { actualRow, actualColumn } = currentCell;
* console.log(currentCell);
* console.log(`actualRow: ${actualRow}, actualColumn: ${actualColumn}`); // actualRow: 9, actualColumn: 0
* ```
*/
getCurrentCell() {
const r = this._selections.find((e) => !!e.primary);
return r ? r.primary : null;
}
/**
* Returns the active sheet