@univerjs/sheets 0.15.0-insiders.20251227-c108ce3 → 0.15.0-insiders.20260107-3441c7a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +3 -3
- package/lib/es/facade.js +891 -845
- package/lib/es/index.js +1470 -1433
- package/lib/facade.js +891 -845
- package/lib/index.js +1470 -1433
- package/lib/types/commands/commands/add-worksheet-merge.command.d.ts +18 -4
- package/lib/types/commands/commands/set-range-custom-metadata.command.d.ts +14 -0
- package/lib/types/commands/commands/set-tab-color.command.d.ts +2 -1
- package/lib/types/facade/f-range.d.ts +37 -7
- package/lib/types/index.d.ts +2 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +3 -3
- package/package.json +6 -6
package/lib/es/facade.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var w = (
|
|
4
|
-
import { Inject as l, Injector as
|
|
5
|
-
import { FBase as Fe, FBaseInitialable as He, FUniver as
|
|
6
|
-
import { WorksheetProtectionRuleModel as $e, RangeProtectionRuleModel as ie, WorksheetProtectionPointModel as ze, SetDefinedNameCommand as Me, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as ne, RemoveDefinedNameCommand as
|
|
7
|
-
import { IDefinedNamesService as
|
|
8
|
-
import { BehaviorSubject as ge, Subject as
|
|
1
|
+
var Nt = Object.defineProperty;
|
|
2
|
+
var Ot = (r, e, t) => e in r ? Nt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var w = (r, e, t) => Ot(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Inject as l, Injector as P, ICommandService as C, IPermissionService as Y, IAuthzIoService as re, LocaleService as Ct, generateRandomId as bt, Rectangle as $, cellToRange as Tt, HorizontalAlign as K, VerticalAlign as J, RANGE_TYPE as p, ILogService as It, Direction as oe, BooleanNumber as I, WrapStrategy as ue, ObjectMatrix as Ie, covertCellValue as xe, TextStyleValue as qe, RichTextValue as L, DEFAULT_STYLES as Ye, covertCellValues as Ze, Dimension as G, isNullCell as Q, mergeWorksheetSnapshotWithDefault as Qe, Tools as Xe, UndoCommand as Vt, RedoCommand as At, toDisposable as ft, UniverInstanceType as F, IResourceLoaderService as Bt, IUniverInstanceService as De, CanceledError as M } from "@univerjs/core";
|
|
5
|
+
import { FBase as Fe, FBaseInitialable as He, FUniver as vt, FEnum as Ft, FEventName as Ht } from "@univerjs/core/facade";
|
|
6
|
+
import { WorksheetProtectionRuleModel as $e, RangeProtectionRuleModel as ie, WorksheetProtectionPointModel as ze, SetDefinedNameCommand as Me, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as ne, RemoveDefinedNameCommand as $t, WorkbookPermissionService as zt, PermissionPointsDefinitions as Lt, WorkbookEditablePermission as Le, UnitObject as A, AddWorksheetProtectionMutation as Gt, DeleteWorksheetProtectionMutation as Kt, getAllWorksheetPermissionPoint as Jt, getAllWorksheetPermissionPointByPointPanel as et, SetWorksheetPermissionPointsMutation as qt, AddRangeProtectionMutation as Rt, ViewStateEnum as U, EditStateEnum as x, DeleteRangeProtectionMutation as pt, SetRangeProtectionMutation as yt, WorksheetEditPermission as Et, WorksheetViewPermission as Pt, getPrimaryForRange as le, SetSelectionsOperation as Ge, getNextPrimaryCell as Yt, WorkbookCopySheetPermission as Zt, WorkbookDeleteColumnPermission as Qt, WorkbookDeleteRowPermission as Xt, WorkbookInsertColumnPermission as es, WorkbookInsertRowPermission as ts, WorkbookCreateProtectPermission as ss, WorkbookRecoverHistoryPermission as ns, WorkbookHistoryPermission as rs, WorkbookViewHistoryPermission as is, WorkbookHideSheetPermission as os, WorkbookMoveSheetPermission as as, WorkbookRenameSheetPermission as hs, WorkbookDeleteSheetPermission as ds, WorkbookCreateSheetPermission as cs, WorkbookManageCollaboratorPermission as us, WorkbookCommentPermission as ls, WorkbookDuplicatePermission as ms, WorkbookCopyPermission as gs, WorkbookSharePermission as _s, WorkbookExportPermission as ws, WorkbookPrintPermission as Ss, WorkbookViewPermission as ks, WorksheetSelectUnProtectedCellsPermission as Cs, WorksheetSelectProtectedCellsPermission as bs, WorksheetDeleteProtectionPermission as Is, WorksheetManageCollaboratorPermission as fs, WorksheetEditExtraObjectPermission as vs, WorksheetInsertHyperlinkPermission as Rs, WorksheetPivotTablePermission as ps, WorksheetFilterPermission as ys, WorksheetSortPermission as Es, WorksheetDeleteColumnPermission as Ps, WorksheetDeleteRowPermission as Us, WorksheetInsertColumnPermission as xs, WorksheetInsertRowPermission as Ds, WorksheetSetColumnStylePermission as Ms, WorksheetSetRowStylePermission as Ws, WorksheetSetCellStylePermission as js, WorksheetSetCellValuePermission as Ns, WorksheetCopyPermission as Os, RangeProtectionPermissionDeleteProtectionPoint as Ts, RangeProtectionPermissionManageCollaPoint as Vs, RangeProtectionPermissionViewPoint as As, RangeProtectionPermissionEditPoint as Bs, SheetsSelectionsService as Ut, SetWorksheetDefaultStyleMutation as Fs, SetColDataCommand as tt, SetRowDataCommand as st, copyRangeStyles as ae, InsertRowByRangeCommand as nt, RemoveRowByRangeCommand as Hs, MoveRowsCommand as $s, SetRowHiddenCommand as rt, SetSpecificRowsVisibleCommand as it, SetTextWrapCommand as We, SetWorksheetRowIsAutoHeightMutation as zs, SetRowHeightCommand as ot, SetWorksheetRowIsAutoHeightCommand as fe, InsertColByRangeCommand as at, RemoveColByRangeCommand as Ls, MoveColsCommand as Gs, SetColHiddenCommand as ht, SetSpecificColsVisibleCommand as dt, SetColWidthCommand as Ks, SetFrozenCommand as ve, CancelFrozenCommand as Js, ToggleGridlinesCommand as je, SetGridlinesColorCommand as Ne, SetTabColorCommand as qs, SetRangeValuesMutation as ct, SetWorksheetHideCommand as Ys, SetWorksheetShowCommand as Zs, SetWorksheetNameCommand as Oe, ClearSelectionAllCommand as xt, ClearSelectionContentCommand as Dt, ClearSelectionFormatCommand as Mt, AppendRowCommand as Qs, SetWorksheetRowCountCommand as Xs, SetWorksheetColumnCountCommand as en, SetRangeCustomMetadataCommand as ut, SetBorderBasicCommand as tn, SetStyleCommand as T, SetTextRotationCommand as sn, SetRangeValuesCommand as X, SetVerticalTextAlignCommand as nn, SetHorizontalTextAlignCommand as rn, addMergeCellsUtil as Re, getAddMergeMutationRangeByType as lt, RemoveWorksheetMergeCommand as on, SplitTextToColumnsCommand as an, SetWorksheetRangeThemeStyleCommand as hn, DeleteWorksheetRangeThemeStyleCommand as dn, SheetRangeThemeService as Wt, InsertRangeMoveDownCommand as cn, InsertRangeMoveRightCommand as un, DeleteRangeMoveUpCommand as ln, DeleteRangeMoveLeftCommand as mn, SetWorkbookNameCommand as gn, InsertSheetCommand as me, SetWorksheetActiveOperation as te, RemoveSheetCommand as Te, CopySheetCommand as _n, SetWorksheetOrderCommand as wn, RegisterWorksheetRangeThemeStyleCommand as Sn, UnregisterWorksheetRangeThemeStyleCommand as kn, RangeThemeStyle as Cn, SetWorksheetOrderMutation as mt, SetTabColorMutation as gt, SetWorksheetHideMutation as _t, COMMAND_LISTENER_VALUE_CHANGE as bn, getValueChangedEffectedRange as In, SheetsFreezeSyncController as fn, SheetValueChangeType as vn, SheetSkeletonChangeType as Rn, SplitDelimiterEnum as pn } from "@univerjs/sheets";
|
|
7
|
+
import { IDefinedNamesService as jt, serializeRange as Ke, deserializeRangeWithSheet as yn, serializeRangeWithSheet as En, FormulaDataModel as Pn } from "@univerjs/engine-formula";
|
|
8
|
+
import { BehaviorSubject as ge, Subject as Un } from "rxjs";
|
|
9
9
|
import { filter as D, distinctUntilChanged as _e, shareReplay as N, map as we } from "rxjs/operators";
|
|
10
|
-
var
|
|
11
|
-
for (var
|
|
12
|
-
(o =
|
|
13
|
-
return
|
|
14
|
-
}, W = (
|
|
15
|
-
function
|
|
16
|
-
const s = t.getDefinedNameMap(
|
|
10
|
+
var xn = Object.getOwnPropertyDescriptor, Dn = (r, e, t, s) => {
|
|
11
|
+
for (var n = s > 1 ? void 0 : s ? xn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
12
|
+
(o = r[i]) && (n = o(n) || n);
|
|
13
|
+
return n;
|
|
14
|
+
}, W = (r, e) => (t, s) => e(t, s, r);
|
|
15
|
+
function Mn(r, e, t) {
|
|
16
|
+
const s = t.getDefinedNameMap(r);
|
|
17
17
|
if (s == null)
|
|
18
18
|
return e.t("definedName.defaultName") + 1;
|
|
19
19
|
const i = Array.from(Object.values(s)).length + 1, o = e.t("definedName.defaultName") + i;
|
|
20
|
-
if (t.getValueByName(
|
|
20
|
+
if (t.getValueByName(r, o) == null)
|
|
21
21
|
return o;
|
|
22
22
|
let a = i + 1;
|
|
23
23
|
for (; ; ) {
|
|
24
24
|
const h = e.t("definedName.defaultName") + a;
|
|
25
|
-
if (t.getValueByName(
|
|
25
|
+
if (t.getValueByName(r, h) == null)
|
|
26
26
|
return h;
|
|
27
27
|
a++;
|
|
28
28
|
}
|
|
@@ -31,7 +31,7 @@ class Ce {
|
|
|
31
31
|
constructor() {
|
|
32
32
|
w(this, "_definedNameParam");
|
|
33
33
|
this._definedNameParam = {
|
|
34
|
-
id:
|
|
34
|
+
id: bt(10),
|
|
35
35
|
unitId: "",
|
|
36
36
|
name: "",
|
|
37
37
|
formulaOrRefString: "",
|
|
@@ -106,12 +106,12 @@ class Ce {
|
|
|
106
106
|
* fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
|
|
107
107
|
* ```
|
|
108
108
|
*/
|
|
109
|
-
setRefByRange(e, t, s,
|
|
109
|
+
setRefByRange(e, t, s, n) {
|
|
110
110
|
return this._definedNameParam.formulaOrRefString = Ke({
|
|
111
111
|
startRow: e,
|
|
112
112
|
endRow: e + (s != null ? s : 1) - 1,
|
|
113
113
|
startColumn: t,
|
|
114
|
-
endColumn: t + (
|
|
114
|
+
endColumn: t + (n != null ? n : 1) - 1
|
|
115
115
|
}), this;
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
@@ -231,11 +231,11 @@ class Ce {
|
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
let Se = class extends Fe {
|
|
234
|
-
constructor(
|
|
235
|
-
super(), this._definedNameParam =
|
|
234
|
+
constructor(r, e, t, s, n, i, o, a, h, c) {
|
|
235
|
+
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 = c;
|
|
236
236
|
}
|
|
237
237
|
_apply() {
|
|
238
|
-
this._definedNameParam.name === "" && (this._definedNameParam.name =
|
|
238
|
+
this._definedNameParam.name === "" && (this._definedNameParam.name = Mn(this._definedNameParam.unitId, this._localeService, this._definedNamesService)), this._commandService.syncExecuteCommand(Me.id, this._definedNameParam);
|
|
239
239
|
}
|
|
240
240
|
/**
|
|
241
241
|
* Gets the name of the defined name.
|
|
@@ -260,8 +260,8 @@ let Se = class extends Fe {
|
|
|
260
260
|
* definedName?.setName('NewDefinedName');
|
|
261
261
|
* ```
|
|
262
262
|
*/
|
|
263
|
-
setName(
|
|
264
|
-
this._definedNameParam.name =
|
|
263
|
+
setName(r) {
|
|
264
|
+
this._definedNameParam.name = r, this._apply();
|
|
265
265
|
}
|
|
266
266
|
/**
|
|
267
267
|
* Sets the formula of the defined name.
|
|
@@ -273,8 +273,8 @@ let Se = class extends Fe {
|
|
|
273
273
|
* definedName?.setFormula('SUM(Sheet1!$A$1)');
|
|
274
274
|
* ```
|
|
275
275
|
*/
|
|
276
|
-
setFormula(
|
|
277
|
-
this._definedNameParam.formulaOrRefString = `=${
|
|
276
|
+
setFormula(r) {
|
|
277
|
+
this._definedNameParam.formulaOrRefString = `=${r}`, this._apply();
|
|
278
278
|
}
|
|
279
279
|
/**
|
|
280
280
|
* Sets the reference of the defined name.
|
|
@@ -286,8 +286,8 @@ let Se = class extends Fe {
|
|
|
286
286
|
* definedName?.setRef('Sheet1!$A$1');
|
|
287
287
|
* ```
|
|
288
288
|
*/
|
|
289
|
-
setRef(
|
|
290
|
-
this._definedNameParam.formulaOrRefString =
|
|
289
|
+
setRef(r) {
|
|
290
|
+
this._definedNameParam.formulaOrRefString = r, this._apply();
|
|
291
291
|
}
|
|
292
292
|
/**
|
|
293
293
|
* Gets the formula or reference string of the defined name.
|
|
@@ -315,10 +315,10 @@ let Se = class extends Fe {
|
|
|
315
315
|
* definedName?.setRefByRange(1, 3, 2, 5); // D2:H3
|
|
316
316
|
* ```
|
|
317
317
|
*/
|
|
318
|
-
setRefByRange(
|
|
318
|
+
setRefByRange(r, e, t, s) {
|
|
319
319
|
this._definedNameParam.formulaOrRefString = Ke({
|
|
320
|
-
startRow:
|
|
321
|
-
endRow:
|
|
320
|
+
startRow: r,
|
|
321
|
+
endRow: r + (t != null ? t : 1) - 1,
|
|
322
322
|
startColumn: e,
|
|
323
323
|
endColumn: e + (s != null ? s : 1) - 1
|
|
324
324
|
}), this._apply();
|
|
@@ -346,8 +346,8 @@ let Se = class extends Fe {
|
|
|
346
346
|
* definedName?.setComment('This is a comment');
|
|
347
347
|
* ```
|
|
348
348
|
*/
|
|
349
|
-
setComment(
|
|
350
|
-
this._definedNameParam.comment =
|
|
349
|
+
setComment(r) {
|
|
350
|
+
this._definedNameParam.comment = r, this._apply();
|
|
351
351
|
}
|
|
352
352
|
/**
|
|
353
353
|
* Sets the scope of the defined name to the worksheet.
|
|
@@ -362,8 +362,8 @@ let Se = class extends Fe {
|
|
|
362
362
|
* definedName?.setScopeToWorksheet(sheets[1]);
|
|
363
363
|
* ```
|
|
364
364
|
*/
|
|
365
|
-
setScopeToWorksheet(
|
|
366
|
-
this._definedNameParam.localSheetId =
|
|
365
|
+
setScopeToWorksheet(r) {
|
|
366
|
+
this._definedNameParam.localSheetId = r.getSheetId(), this._apply();
|
|
367
367
|
}
|
|
368
368
|
/**
|
|
369
369
|
* Sets the scope of the defined name to the workbook.
|
|
@@ -387,8 +387,8 @@ let Se = class extends Fe {
|
|
|
387
387
|
* definedName?.setHidden(true);
|
|
388
388
|
* ```
|
|
389
389
|
*/
|
|
390
|
-
setHidden(
|
|
391
|
-
this._definedNameParam.hidden =
|
|
390
|
+
setHidden(r) {
|
|
391
|
+
this._definedNameParam.hidden = r, this._apply();
|
|
392
392
|
}
|
|
393
393
|
/**
|
|
394
394
|
* Deletes the defined name.
|
|
@@ -400,7 +400,7 @@ let Se = class extends Fe {
|
|
|
400
400
|
* ```
|
|
401
401
|
*/
|
|
402
402
|
delete() {
|
|
403
|
-
this._commandService.syncExecuteCommand(
|
|
403
|
+
this._commandService.syncExecuteCommand($t.id, this._definedNameParam);
|
|
404
404
|
}
|
|
405
405
|
/**
|
|
406
406
|
* Gets the local sheet id of the defined name.
|
|
@@ -445,33 +445,33 @@ let Se = class extends Fe {
|
|
|
445
445
|
* ```
|
|
446
446
|
*/
|
|
447
447
|
toBuilder() {
|
|
448
|
-
const
|
|
449
|
-
return
|
|
448
|
+
const r = this._injector.createInstance(Ce);
|
|
449
|
+
return r.load(this._definedNameParam), r;
|
|
450
450
|
}
|
|
451
451
|
};
|
|
452
|
-
Se =
|
|
453
|
-
W(1, l(
|
|
452
|
+
Se = Dn([
|
|
453
|
+
W(1, l(P)),
|
|
454
454
|
W(2, C),
|
|
455
455
|
W(3, Y),
|
|
456
456
|
W(4, l($e)),
|
|
457
457
|
W(5, l(ie)),
|
|
458
458
|
W(6, l(ze)),
|
|
459
459
|
W(7, l(re)),
|
|
460
|
-
W(8, l(
|
|
461
|
-
W(9,
|
|
460
|
+
W(8, l(Ct)),
|
|
461
|
+
W(9, jt)
|
|
462
462
|
], Se);
|
|
463
|
-
var H = /* @__PURE__ */ ((
|
|
464
|
-
for (var
|
|
465
|
-
(o =
|
|
466
|
-
return
|
|
467
|
-
}, V = (
|
|
463
|
+
var H = /* @__PURE__ */ ((r) => (r[r.Reader = 0] = "Reader", r[r.Editor = 1] = "Editor", r[r.Owner = 2] = "Owner", r))(H || {}), 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 || {}), Wn = Object.getOwnPropertyDescriptor, jn = (r, e, t, s) => {
|
|
464
|
+
for (var n = s > 1 ? void 0 : s ? Wn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
465
|
+
(o = r[i]) && (n = o(n) || n);
|
|
466
|
+
return n;
|
|
467
|
+
}, V = (r, e) => (t, s) => e(t, s, r);
|
|
468
468
|
let z = class extends Fe {
|
|
469
|
-
constructor(e, t, s,
|
|
469
|
+
constructor(e, t, s, n, i, o, a, h) {
|
|
470
470
|
super();
|
|
471
471
|
/**
|
|
472
472
|
* Permission point definition, can read the point constructor want to modify from here
|
|
473
473
|
*/
|
|
474
|
-
w(this, "permissionPointsDefinition",
|
|
474
|
+
w(this, "permissionPointsDefinition", Lt);
|
|
475
475
|
/**
|
|
476
476
|
* An observable object used to monitor permission change events within a range, thereby triggering corresponding subsequent processing.
|
|
477
477
|
*/
|
|
@@ -484,7 +484,7 @@ let z = class extends Fe {
|
|
|
484
484
|
* An observable object used to monitor the initialization state changes of unit permissions.
|
|
485
485
|
*/
|
|
486
486
|
w(this, "unitPermissionInitStateChange$");
|
|
487
|
-
this._injector = e, this._commandService = t, this._permissionService = s, this._worksheetProtectionRuleModel =
|
|
487
|
+
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$;
|
|
488
488
|
}
|
|
489
489
|
/**
|
|
490
490
|
* Configures a specific permission point for a workbook.
|
|
@@ -503,8 +503,8 @@ let z = class extends Fe {
|
|
|
503
503
|
* ```
|
|
504
504
|
*/
|
|
505
505
|
setWorkbookPermissionPoint(e, t, s) {
|
|
506
|
-
const
|
|
507
|
-
this._permissionService.getPermissionPoint(
|
|
506
|
+
const n = new t(e);
|
|
507
|
+
this._permissionService.getPermissionPoint(n.id) || this._permissionService.addPermissionPoint(n), this._permissionService.updatePermissionPoint(n.id, s);
|
|
508
508
|
}
|
|
509
509
|
/**
|
|
510
510
|
* Check if a specific permission point is enabled for a workbook.
|
|
@@ -522,9 +522,9 @@ let z = class extends Fe {
|
|
|
522
522
|
* ```
|
|
523
523
|
*/
|
|
524
524
|
checkWorkbookPermissionPoint(e, t) {
|
|
525
|
-
const s = new t(e),
|
|
526
|
-
if (
|
|
527
|
-
return
|
|
525
|
+
const s = new t(e), n = this._permissionService.getPermissionPoint(s.id);
|
|
526
|
+
if (n)
|
|
527
|
+
return n.value;
|
|
528
528
|
}
|
|
529
529
|
/**
|
|
530
530
|
* This function is used to set whether the workbook can be edited
|
|
@@ -569,39 +569,39 @@ let z = class extends Fe {
|
|
|
569
569
|
* ```
|
|
570
570
|
*/
|
|
571
571
|
async addWorksheetBasePermission(e, t, s) {
|
|
572
|
-
let
|
|
572
|
+
let n = [];
|
|
573
573
|
if (s != null && s.allowedUsers) {
|
|
574
574
|
const a = await this._authzIoService.listCollaborators({
|
|
575
575
|
objectID: e,
|
|
576
576
|
unitID: e
|
|
577
577
|
}), h = new Set(s.allowedUsers);
|
|
578
|
-
|
|
578
|
+
n = a.filter((d) => {
|
|
579
579
|
var m;
|
|
580
|
-
return h.has(((m =
|
|
581
|
-
}).map((
|
|
582
|
-
id:
|
|
580
|
+
return h.has(((m = d.subject) == null ? void 0 : m.userID) || d.id);
|
|
581
|
+
}).map((d) => ({
|
|
582
|
+
id: d.id,
|
|
583
583
|
role: H.Editor,
|
|
584
|
-
subject:
|
|
584
|
+
subject: d.subject
|
|
585
585
|
}));
|
|
586
|
-
const
|
|
586
|
+
const c = new Set(n.map((d) => {
|
|
587
587
|
var m;
|
|
588
|
-
return ((m =
|
|
588
|
+
return ((m = d.subject) == null ? void 0 : m.userID) || d.id;
|
|
589
589
|
}));
|
|
590
|
-
s.allowedUsers.forEach((
|
|
591
|
-
|
|
590
|
+
s.allowedUsers.forEach((d) => {
|
|
591
|
+
c.has(d) || console.error(`User ${d} not found in collaborators list`);
|
|
592
592
|
});
|
|
593
593
|
}
|
|
594
594
|
const i = await this._authzIoService.create({
|
|
595
595
|
objectType: A.Worksheet,
|
|
596
596
|
worksheetObject: {
|
|
597
|
-
collaborators:
|
|
597
|
+
collaborators: n,
|
|
598
598
|
unitID: e,
|
|
599
599
|
strategies: [],
|
|
600
600
|
name: (s == null ? void 0 : s.name) || "",
|
|
601
601
|
scope: void 0
|
|
602
602
|
}
|
|
603
603
|
});
|
|
604
|
-
if (this._commandService.syncExecuteCommand(
|
|
604
|
+
if (this._commandService.syncExecuteCommand(Gt.id, {
|
|
605
605
|
unitId: e,
|
|
606
606
|
subUnitId: t,
|
|
607
607
|
rule: {
|
|
@@ -629,12 +629,12 @@ let z = class extends Fe {
|
|
|
629
629
|
* ```
|
|
630
630
|
*/
|
|
631
631
|
removeWorksheetPermission(e, t) {
|
|
632
|
-
this._commandService.syncExecuteCommand(
|
|
632
|
+
this._commandService.syncExecuteCommand(Kt.id, {
|
|
633
633
|
unitId: e,
|
|
634
634
|
subUnitId: t
|
|
635
|
-
}), [...
|
|
636
|
-
const
|
|
637
|
-
this._permissionService.updatePermissionPoint(
|
|
635
|
+
}), [...Jt(), ...et()].forEach((s) => {
|
|
636
|
+
const n = new s(e, t);
|
|
637
|
+
this._permissionService.updatePermissionPoint(n.id, !0);
|
|
638
638
|
}), this._worksheetProtectionPointRuleModel.deleteRule(e, t);
|
|
639
639
|
}
|
|
640
640
|
/**
|
|
@@ -659,14 +659,14 @@ let z = class extends Fe {
|
|
|
659
659
|
* permission.setWorksheetPermissionPoint(unitId, subUnitId, permission.permissionPointsDefinition.WorksheetEditPermission, false);
|
|
660
660
|
* ```
|
|
661
661
|
*/
|
|
662
|
-
async setWorksheetPermissionPoint(e, t, s,
|
|
662
|
+
async setWorksheetPermissionPoint(e, t, s, n) {
|
|
663
663
|
const i = this._worksheetProtectionRuleModel.getRule(e, t);
|
|
664
664
|
let o;
|
|
665
|
-
if (s ===
|
|
665
|
+
if (s === Et || s === Pt)
|
|
666
666
|
i ? o = i.permissionId : o = await this.addWorksheetBasePermission(e, t);
|
|
667
667
|
else {
|
|
668
|
-
const
|
|
669
|
-
|
|
668
|
+
const d = this._worksheetProtectionPointRuleModel.getRule(e, t);
|
|
669
|
+
d ? o = d.permissionId : (o = await this._authzIoService.create({
|
|
670
670
|
objectType: A.Worksheet,
|
|
671
671
|
worksheetObject: {
|
|
672
672
|
collaborators: [],
|
|
@@ -675,17 +675,17 @@ let z = class extends Fe {
|
|
|
675
675
|
name: "",
|
|
676
676
|
scope: void 0
|
|
677
677
|
}
|
|
678
|
-
}), this._commandService.syncExecuteCommand(
|
|
678
|
+
}), this._commandService.syncExecuteCommand(qt.id, { unitId: e, subUnitId: t, rule: { unitId: e, subUnitId: t, permissionId: o } }));
|
|
679
679
|
}
|
|
680
680
|
const h = new s(e, t);
|
|
681
681
|
if (this._permissionService.getPermissionPoint(h.id) || this._permissionService.addPermissionPoint(h), o) {
|
|
682
|
-
const
|
|
682
|
+
const d = h.subType;
|
|
683
683
|
await this._authzIoService.update({
|
|
684
684
|
objectType: A.Worksheet,
|
|
685
685
|
objectID: o,
|
|
686
686
|
strategies: [{
|
|
687
|
-
action:
|
|
688
|
-
role:
|
|
687
|
+
action: d,
|
|
688
|
+
role: n ? H.Owner : H.Reader
|
|
689
689
|
}],
|
|
690
690
|
unitID: e,
|
|
691
691
|
share: void 0,
|
|
@@ -694,7 +694,7 @@ let z = class extends Fe {
|
|
|
694
694
|
collaborators: void 0
|
|
695
695
|
});
|
|
696
696
|
}
|
|
697
|
-
return this._permissionService.updatePermissionPoint(h.id,
|
|
697
|
+
return this._permissionService.updatePermissionPoint(h.id, n), o;
|
|
698
698
|
}
|
|
699
699
|
/**
|
|
700
700
|
* Check if a specific permission point is enabled for a worksheet.
|
|
@@ -716,7 +716,7 @@ let z = class extends Fe {
|
|
|
716
716
|
* ```
|
|
717
717
|
*/
|
|
718
718
|
checkWorksheetPermissionPoint(e, t, s) {
|
|
719
|
-
const
|
|
719
|
+
const n = new s(e, t), i = this._permissionService.getPermissionPoint(n.id);
|
|
720
720
|
if (i)
|
|
721
721
|
return i.value;
|
|
722
722
|
}
|
|
@@ -760,13 +760,13 @@ let z = class extends Fe {
|
|
|
760
760
|
* ```
|
|
761
761
|
*/
|
|
762
762
|
// eslint-disable-next-line max-lines-per-function
|
|
763
|
-
async addRangeBaseProtection(e, t, s,
|
|
763
|
+
async addRangeBaseProtection(e, t, s, n) {
|
|
764
764
|
let i = [];
|
|
765
|
-
if (
|
|
765
|
+
if (n != null && n.allowedUsers) {
|
|
766
766
|
const k = await this._authzIoService.listCollaborators({
|
|
767
767
|
objectID: e,
|
|
768
768
|
unitID: e
|
|
769
|
-
}), f = new Set(
|
|
769
|
+
}), f = new Set(n.allowedUsers);
|
|
770
770
|
i = k.filter((y) => {
|
|
771
771
|
var Z;
|
|
772
772
|
return f.has(((Z = y.subject) == null ? void 0 : Z.userID) || y.id);
|
|
@@ -779,7 +779,7 @@ let z = class extends Fe {
|
|
|
779
779
|
var Z;
|
|
780
780
|
return ((Z = y.subject) == null ? void 0 : Z.userID) || y.id;
|
|
781
781
|
}));
|
|
782
|
-
|
|
782
|
+
n.allowedUsers.forEach((y) => {
|
|
783
783
|
be.has(y) || console.error(`User ${y} not found in collaborators list`);
|
|
784
784
|
});
|
|
785
785
|
}
|
|
@@ -788,13 +788,13 @@ let z = class extends Fe {
|
|
|
788
788
|
selectRangeObject: {
|
|
789
789
|
collaborators: i,
|
|
790
790
|
unitID: e,
|
|
791
|
-
name: (
|
|
791
|
+
name: (n == null ? void 0 : n.name) || "",
|
|
792
792
|
scope: void 0
|
|
793
793
|
}
|
|
794
|
-
}), a = `ruleId_${
|
|
794
|
+
}), a = `ruleId_${bt(6)}`;
|
|
795
795
|
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((k) => k.ranges.some((f) => s.some((be) => $.intersects(be.getRange(), f)))))
|
|
796
796
|
throw new Error("range protection cannot intersect");
|
|
797
|
-
const
|
|
797
|
+
const d = this._determineRangeViewState(n), m = this._determineRangeEditState(n), g = {
|
|
798
798
|
unitId: e,
|
|
799
799
|
subUnitId: t,
|
|
800
800
|
rules: [{
|
|
@@ -804,12 +804,12 @@ let z = class extends Fe {
|
|
|
804
804
|
subUnitId: t,
|
|
805
805
|
ranges: s.map((k) => k.getRange()),
|
|
806
806
|
id: a,
|
|
807
|
-
description:
|
|
808
|
-
viewState:
|
|
807
|
+
description: n == null ? void 0 : n.name,
|
|
808
|
+
viewState: d,
|
|
809
809
|
editState: m
|
|
810
810
|
}]
|
|
811
811
|
};
|
|
812
|
-
if (this._commandService.syncExecuteCommand(
|
|
812
|
+
if (this._commandService.syncExecuteCommand(Rt.id, g))
|
|
813
813
|
return {
|
|
814
814
|
permissionId: o,
|
|
815
815
|
ruleId: a
|
|
@@ -859,7 +859,7 @@ let z = class extends Fe {
|
|
|
859
859
|
* ```
|
|
860
860
|
*/
|
|
861
861
|
removeRangeProtection(e, t, s) {
|
|
862
|
-
this._commandService.syncExecuteCommand(
|
|
862
|
+
this._commandService.syncExecuteCommand(pt.id, {
|
|
863
863
|
unitId: e,
|
|
864
864
|
subUnitId: t,
|
|
865
865
|
ruleIds: s
|
|
@@ -895,8 +895,8 @@ let z = class extends Fe {
|
|
|
895
895
|
* permission.setRangeProtectionPermissionPoint(unitId,subUnitId,permissionId, permission.permissionPointsDefinition.RangeProtectionPermissionEditPoint, false);
|
|
896
896
|
* ```
|
|
897
897
|
*/
|
|
898
|
-
setRangeProtectionPermissionPoint(e, t, s,
|
|
899
|
-
const o = new
|
|
898
|
+
setRangeProtectionPermissionPoint(e, t, s, n, i) {
|
|
899
|
+
const o = new n(e, t, s);
|
|
900
900
|
this._permissionService.getPermissionPoint(o.id) || this._permissionService.addPermissionPoint(o), this._permissionService.updatePermissionPoint(o.id, i);
|
|
901
901
|
}
|
|
902
902
|
/**
|
|
@@ -926,18 +926,18 @@ let z = class extends Fe {
|
|
|
926
926
|
* permission.setRangeProtectionRanges(unitId, subUnitId, ruleId, [newRange]);
|
|
927
927
|
* ```
|
|
928
928
|
*/
|
|
929
|
-
setRangeProtectionRanges(e, t, s,
|
|
929
|
+
setRangeProtectionRanges(e, t, s, n) {
|
|
930
930
|
const i = this._rangeProtectionRuleModel.getRule(e, t, s);
|
|
931
931
|
if (i) {
|
|
932
|
-
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !== s).some((h) => h.ranges.some((
|
|
932
|
+
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !== s).some((h) => h.ranges.some((c) => n.some((d) => $.intersects(d.getRange(), c)))))
|
|
933
933
|
throw new Error("range protection cannot intersect");
|
|
934
|
-
this._commandService.syncExecuteCommand(
|
|
934
|
+
this._commandService.syncExecuteCommand(yt.id, {
|
|
935
935
|
unitId: e,
|
|
936
936
|
subUnitId: t,
|
|
937
937
|
ruleId: s,
|
|
938
938
|
rule: {
|
|
939
939
|
...i,
|
|
940
|
-
ranges:
|
|
940
|
+
ranges: n.map((h) => h.getRange())
|
|
941
941
|
}
|
|
942
942
|
});
|
|
943
943
|
}
|
|
@@ -979,8 +979,8 @@ let z = class extends Fe {
|
|
|
979
979
|
* }
|
|
980
980
|
* ```
|
|
981
981
|
*/
|
|
982
|
-
getPermissionInfoWithCell(e, t, s,
|
|
983
|
-
const i =
|
|
982
|
+
getPermissionInfoWithCell(e, t, s, n) {
|
|
983
|
+
const i = Tt(s, n), o = this._rangeProtectionRuleModel.getSubunitRuleList(e, t).find((a) => a.ranges.some((c) => $.intersects(i, c)));
|
|
984
984
|
if (o)
|
|
985
985
|
return {
|
|
986
986
|
permissionId: o.permissionId,
|
|
@@ -988,24 +988,24 @@ let z = class extends Fe {
|
|
|
988
988
|
};
|
|
989
989
|
}
|
|
990
990
|
};
|
|
991
|
-
z =
|
|
992
|
-
V(0, l(
|
|
991
|
+
z = jn([
|
|
992
|
+
V(0, l(P)),
|
|
993
993
|
V(1, C),
|
|
994
994
|
V(2, Y),
|
|
995
995
|
V(3, l($e)),
|
|
996
996
|
V(4, l(ie)),
|
|
997
997
|
V(5, l(ze)),
|
|
998
|
-
V(6, l(
|
|
998
|
+
V(6, l(zt)),
|
|
999
999
|
V(7, l(re))
|
|
1000
1000
|
], z);
|
|
1001
|
-
var
|
|
1002
|
-
for (var
|
|
1003
|
-
(o =
|
|
1004
|
-
return
|
|
1005
|
-
},
|
|
1001
|
+
var Nn = Object.getOwnPropertyDescriptor, On = (r, e, t, s) => {
|
|
1002
|
+
for (var n = s > 1 ? void 0 : s ? Nn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
1003
|
+
(o = r[i]) && (n = o(n) || n);
|
|
1004
|
+
return n;
|
|
1005
|
+
}, Tn = (r, e) => (t, s) => e(t, s, r);
|
|
1006
1006
|
let ke = class {
|
|
1007
|
-
constructor(
|
|
1008
|
-
this._workbook =
|
|
1007
|
+
constructor(r, e, t, s) {
|
|
1008
|
+
this._workbook = r, this._worksheet = e, this._selections = t, this._injector = s;
|
|
1009
1009
|
}
|
|
1010
1010
|
/**
|
|
1011
1011
|
* Represents the active selection in the sheet. Which means the selection contains the active cell.
|
|
@@ -1021,8 +1021,8 @@ let ke = class {
|
|
|
1021
1021
|
* ```
|
|
1022
1022
|
*/
|
|
1023
1023
|
getActiveRange() {
|
|
1024
|
-
const
|
|
1025
|
-
return
|
|
1024
|
+
const r = this._selections.find((e) => !!e.primary);
|
|
1025
|
+
return r ? this._injector.createInstance(R, this._workbook, this._worksheet, r.range) : null;
|
|
1026
1026
|
}
|
|
1027
1027
|
/**
|
|
1028
1028
|
* Represents the active selection list in the sheet.
|
|
@@ -1039,7 +1039,7 @@ let ke = class {
|
|
|
1039
1039
|
* ```
|
|
1040
1040
|
*/
|
|
1041
1041
|
getActiveRangeList() {
|
|
1042
|
-
return this._selections.map((
|
|
1042
|
+
return this._selections.map((r) => this._injector.createInstance(R, this._workbook, this._worksheet, r.range));
|
|
1043
1043
|
}
|
|
1044
1044
|
/**
|
|
1045
1045
|
* Represents the current select cell in the sheet.
|
|
@@ -1058,8 +1058,8 @@ let ke = class {
|
|
|
1058
1058
|
* ```
|
|
1059
1059
|
*/
|
|
1060
1060
|
getCurrentCell() {
|
|
1061
|
-
const
|
|
1062
|
-
return
|
|
1061
|
+
const r = this._selections.find((e) => !!e.primary);
|
|
1062
|
+
return r ? r.primary : null;
|
|
1063
1063
|
}
|
|
1064
1064
|
/**
|
|
1065
1065
|
* Returns the active sheet in the spreadsheet.
|
|
@@ -1074,8 +1074,8 @@ let ke = class {
|
|
|
1074
1074
|
* ```
|
|
1075
1075
|
*/
|
|
1076
1076
|
getActiveSheet() {
|
|
1077
|
-
const
|
|
1078
|
-
return this._injector.createInstance(v,
|
|
1077
|
+
const r = this._injector.createInstance(E, this._workbook);
|
|
1078
|
+
return this._injector.createInstance(v, r, this._workbook, this._worksheet);
|
|
1079
1079
|
}
|
|
1080
1080
|
/**
|
|
1081
1081
|
* Update the primary cell in the selection. if the primary cell not exists in selections, add it to the selections and clear the old selections.
|
|
@@ -1098,13 +1098,13 @@ let ke = class {
|
|
|
1098
1098
|
* console.log(`actualRow: ${actualRow}, actualColumn: ${actualColumn}`); // actualRow: 10, actualColumn: 1
|
|
1099
1099
|
* ```
|
|
1100
1100
|
*/
|
|
1101
|
-
updatePrimaryCell(
|
|
1101
|
+
updatePrimaryCell(r) {
|
|
1102
1102
|
const e = this._injector.get(C);
|
|
1103
1103
|
let t = [], s = !1;
|
|
1104
1104
|
for (const { range: i, style: o } of this._selections)
|
|
1105
|
-
$.contains(i,
|
|
1105
|
+
$.contains(i, r.getRange()) ? (t.push({
|
|
1106
1106
|
range: i,
|
|
1107
|
-
primary: le(
|
|
1107
|
+
primary: le(r.getRange(), this._worksheet),
|
|
1108
1108
|
style: o
|
|
1109
1109
|
}), s = !0) : t.push({
|
|
1110
1110
|
range: i,
|
|
@@ -1113,16 +1113,16 @@ let ke = class {
|
|
|
1113
1113
|
});
|
|
1114
1114
|
s || (t = [
|
|
1115
1115
|
{
|
|
1116
|
-
range:
|
|
1117
|
-
primary: le(
|
|
1116
|
+
range: r.getRange(),
|
|
1117
|
+
primary: le(r.getRange(), this._worksheet)
|
|
1118
1118
|
}
|
|
1119
1119
|
]);
|
|
1120
|
-
const
|
|
1120
|
+
const n = {
|
|
1121
1121
|
unitId: this._workbook.getUnitId(),
|
|
1122
1122
|
subUnitId: this._worksheet.getSheetId(),
|
|
1123
1123
|
selections: t
|
|
1124
1124
|
};
|
|
1125
|
-
return e.syncExecuteCommand(Ge.id,
|
|
1125
|
+
return e.syncExecuteCommand(Ge.id, n), new ke(this._workbook, this._worksheet, t, this._injector);
|
|
1126
1126
|
}
|
|
1127
1127
|
/**
|
|
1128
1128
|
* Get the next primary cell in the specified direction. If the primary cell not exists in selections, return null.
|
|
@@ -1149,24 +1149,24 @@ let ke = class {
|
|
|
1149
1149
|
* console.log(nextCell2?.getA1Notation()); // A2
|
|
1150
1150
|
* ```
|
|
1151
1151
|
*/
|
|
1152
|
-
getNextDataRange(
|
|
1152
|
+
getNextDataRange(r) {
|
|
1153
1153
|
if (!this._selections.find((s) => !!s.primary))
|
|
1154
1154
|
return null;
|
|
1155
|
-
const t =
|
|
1155
|
+
const t = Yt(this._selections.concat(), r, this._worksheet);
|
|
1156
1156
|
return t ? this._injector.createInstance(R, this._workbook, this._worksheet, t) : null;
|
|
1157
1157
|
}
|
|
1158
1158
|
};
|
|
1159
|
-
ke =
|
|
1160
|
-
|
|
1159
|
+
ke = On([
|
|
1160
|
+
Tn(3, l(P))
|
|
1161
1161
|
], ke);
|
|
1162
|
-
var Je = /* @__PURE__ */ ((
|
|
1163
|
-
for (var
|
|
1164
|
-
(o =
|
|
1165
|
-
return
|
|
1166
|
-
}, pe = (
|
|
1162
|
+
var Je = /* @__PURE__ */ ((r) => (r[r.Reader = 0] = "Reader", r[r.Editor = 1] = "Editor", r[r.Owner = 2] = "Owner", r[r.UNRECOGNIZED = -1] = "UNRECOGNIZED", r))(Je || {}), Vn = Object.getOwnPropertyDescriptor, An = (r, e, t, s) => {
|
|
1163
|
+
for (var n = s > 1 ? void 0 : s ? Vn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
1164
|
+
(o = r[i]) && (n = o(n) || n);
|
|
1165
|
+
return n;
|
|
1166
|
+
}, pe = (r, e) => (t, s) => e(t, s, r);
|
|
1167
1167
|
let O = class {
|
|
1168
|
-
constructor(
|
|
1169
|
-
this._unitId =
|
|
1168
|
+
constructor(r, e, t, s, n, i, o, a, h) {
|
|
1169
|
+
this._unitId = r, this._subUnitId = e, this._ruleId = t, this._permissionId = s, this._ranges = n, this._options = i, this._injector = o, this._commandService = a, this._rangeProtectionRuleModel = h;
|
|
1170
1170
|
}
|
|
1171
1171
|
/**
|
|
1172
1172
|
* Get the rule ID.
|
|
@@ -1226,30 +1226,30 @@ let O = class {
|
|
|
1226
1226
|
* await rule?.updateRanges([worksheet.getRange('A1:C3')]);
|
|
1227
1227
|
* ```
|
|
1228
1228
|
*/
|
|
1229
|
-
async updateRanges(
|
|
1230
|
-
if (!
|
|
1229
|
+
async updateRanges(r) {
|
|
1230
|
+
if (!r || r.length === 0)
|
|
1231
1231
|
throw new Error("Ranges cannot be empty");
|
|
1232
1232
|
const e = this._rangeProtectionRuleModel.getRule(this._unitId, this._subUnitId, this._ruleId);
|
|
1233
1233
|
if (!e)
|
|
1234
1234
|
throw new Error(`Rule ${this._ruleId} not found`);
|
|
1235
|
-
if (this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId, this._subUnitId).filter((
|
|
1236
|
-
(
|
|
1237
|
-
(i) =>
|
|
1235
|
+
if (this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId, this._subUnitId).filter((n) => n.id !== this._ruleId).some(
|
|
1236
|
+
(n) => n.ranges.some(
|
|
1237
|
+
(i) => r.some((o) => {
|
|
1238
1238
|
const a = o.getRange();
|
|
1239
1239
|
return this._rangesIntersect(a, i);
|
|
1240
1240
|
})
|
|
1241
1241
|
)
|
|
1242
1242
|
))
|
|
1243
1243
|
throw new Error("Range protection cannot intersect with other protection rules");
|
|
1244
|
-
await this._commandService.executeCommand(
|
|
1244
|
+
await this._commandService.executeCommand(yt.id, {
|
|
1245
1245
|
unitId: this._unitId,
|
|
1246
1246
|
subUnitId: this._subUnitId,
|
|
1247
1247
|
ruleId: this._ruleId,
|
|
1248
1248
|
rule: {
|
|
1249
1249
|
...e,
|
|
1250
|
-
ranges:
|
|
1250
|
+
ranges: r.map((n) => n.getRange())
|
|
1251
1251
|
}
|
|
1252
|
-
}), this._ranges.length = 0, this._ranges.push(...
|
|
1252
|
+
}), this._ranges.length = 0, this._ranges.push(...r);
|
|
1253
1253
|
}
|
|
1254
1254
|
/**
|
|
1255
1255
|
* Delete the current protection rule.
|
|
@@ -1264,7 +1264,7 @@ let O = class {
|
|
|
1264
1264
|
* ```
|
|
1265
1265
|
*/
|
|
1266
1266
|
async remove() {
|
|
1267
|
-
await this._commandService.executeCommand(
|
|
1267
|
+
await this._commandService.executeCommand(pt.id, {
|
|
1268
1268
|
unitId: this._unitId,
|
|
1269
1269
|
subUnitId: this._subUnitId,
|
|
1270
1270
|
ruleIds: [this._ruleId]
|
|
@@ -1275,73 +1275,73 @@ let O = class {
|
|
|
1275
1275
|
* @returns true if ranges intersect, false otherwise
|
|
1276
1276
|
* @private
|
|
1277
1277
|
*/
|
|
1278
|
-
_rangesIntersect(
|
|
1279
|
-
return !(
|
|
1278
|
+
_rangesIntersect(r, e) {
|
|
1279
|
+
return !(r.endRow < e.startRow || r.startRow > e.endRow || r.endColumn < e.startColumn || r.startColumn > e.endColumn);
|
|
1280
1280
|
}
|
|
1281
1281
|
};
|
|
1282
|
-
O =
|
|
1283
|
-
pe(6, l(
|
|
1282
|
+
O = An([
|
|
1283
|
+
pe(6, l(P)),
|
|
1284
1284
|
pe(7, l(C)),
|
|
1285
1285
|
pe(8, l(ie))
|
|
1286
1286
|
], O);
|
|
1287
1287
|
const he = {
|
|
1288
1288
|
[u.Edit]: Le,
|
|
1289
|
-
[u.View]:
|
|
1290
|
-
[u.Print]:
|
|
1291
|
-
[u.Export]:
|
|
1292
|
-
[u.Share]:
|
|
1293
|
-
[u.CopyContent]:
|
|
1294
|
-
[u.DuplicateFile]:
|
|
1295
|
-
[u.Comment]:
|
|
1296
|
-
[u.ManageCollaborator]:
|
|
1289
|
+
[u.View]: ks,
|
|
1290
|
+
[u.Print]: Ss,
|
|
1291
|
+
[u.Export]: ws,
|
|
1292
|
+
[u.Share]: _s,
|
|
1293
|
+
[u.CopyContent]: gs,
|
|
1294
|
+
[u.DuplicateFile]: ms,
|
|
1295
|
+
[u.Comment]: ls,
|
|
1296
|
+
[u.ManageCollaborator]: us,
|
|
1297
1297
|
[u.CreateSheet]: cs,
|
|
1298
|
-
[u.DeleteSheet]:
|
|
1299
|
-
[u.RenameSheet]:
|
|
1300
|
-
[u.MoveSheet]:
|
|
1301
|
-
[u.HideSheet]:
|
|
1302
|
-
[u.ViewHistory]:
|
|
1303
|
-
[u.ManageHistory]:
|
|
1304
|
-
[u.RecoverHistory]:
|
|
1305
|
-
[u.CreateProtection]:
|
|
1306
|
-
[u.InsertRow]:
|
|
1307
|
-
[u.InsertColumn]:
|
|
1308
|
-
[u.DeleteRow]:
|
|
1309
|
-
[u.DeleteColumn]:
|
|
1310
|
-
[u.CopySheet]:
|
|
1311
|
-
},
|
|
1312
|
-
[_.Edit]:
|
|
1298
|
+
[u.DeleteSheet]: ds,
|
|
1299
|
+
[u.RenameSheet]: hs,
|
|
1300
|
+
[u.MoveSheet]: as,
|
|
1301
|
+
[u.HideSheet]: os,
|
|
1302
|
+
[u.ViewHistory]: is,
|
|
1303
|
+
[u.ManageHistory]: rs,
|
|
1304
|
+
[u.RecoverHistory]: ns,
|
|
1305
|
+
[u.CreateProtection]: ss,
|
|
1306
|
+
[u.InsertRow]: ts,
|
|
1307
|
+
[u.InsertColumn]: es,
|
|
1308
|
+
[u.DeleteRow]: Xt,
|
|
1309
|
+
[u.DeleteColumn]: Qt,
|
|
1310
|
+
[u.CopySheet]: Zt
|
|
1311
|
+
}, de = {
|
|
1312
|
+
[_.Edit]: Et,
|
|
1313
1313
|
[_.View]: Pt,
|
|
1314
|
-
[_.Copy]:
|
|
1315
|
-
[_.SetCellValue]:
|
|
1316
|
-
[_.SetCellStyle]:
|
|
1317
|
-
[_.SetRowStyle]:
|
|
1318
|
-
[_.SetColumnStyle]:
|
|
1319
|
-
[_.InsertRow]:
|
|
1320
|
-
[_.InsertColumn]:
|
|
1321
|
-
[_.DeleteRow]:
|
|
1314
|
+
[_.Copy]: Os,
|
|
1315
|
+
[_.SetCellValue]: Ns,
|
|
1316
|
+
[_.SetCellStyle]: js,
|
|
1317
|
+
[_.SetRowStyle]: Ws,
|
|
1318
|
+
[_.SetColumnStyle]: Ms,
|
|
1319
|
+
[_.InsertRow]: Ds,
|
|
1320
|
+
[_.InsertColumn]: xs,
|
|
1321
|
+
[_.DeleteRow]: Us,
|
|
1322
1322
|
[_.DeleteColumn]: Ps,
|
|
1323
|
-
[_.Sort]:
|
|
1324
|
-
[_.Filter]:
|
|
1325
|
-
[_.PivotTable]:
|
|
1326
|
-
[_.InsertHyperlink]:
|
|
1327
|
-
[_.EditExtraObject]:
|
|
1328
|
-
[_.ManageCollaborator]:
|
|
1329
|
-
[_.DeleteProtection]:
|
|
1330
|
-
[_.SelectProtectedCells]:
|
|
1331
|
-
[_.SelectUnProtectedCells]:
|
|
1323
|
+
[_.Sort]: Es,
|
|
1324
|
+
[_.Filter]: ys,
|
|
1325
|
+
[_.PivotTable]: ps,
|
|
1326
|
+
[_.InsertHyperlink]: Rs,
|
|
1327
|
+
[_.EditExtraObject]: vs,
|
|
1328
|
+
[_.ManageCollaborator]: fs,
|
|
1329
|
+
[_.DeleteProtection]: Is,
|
|
1330
|
+
[_.SelectProtectedCells]: bs,
|
|
1331
|
+
[_.SelectUnProtectedCells]: Cs
|
|
1332
1332
|
}, se = {
|
|
1333
|
-
[b.Edit]:
|
|
1334
|
-
[b.View]:
|
|
1335
|
-
[b.ManageCollaborator]:
|
|
1336
|
-
[b.Delete]:
|
|
1333
|
+
[b.Edit]: Bs,
|
|
1334
|
+
[b.View]: As,
|
|
1335
|
+
[b.ManageCollaborator]: Vs,
|
|
1336
|
+
[b.Delete]: Ts
|
|
1337
1337
|
};
|
|
1338
|
-
var
|
|
1339
|
-
for (var
|
|
1340
|
-
(o =
|
|
1341
|
-
return
|
|
1342
|
-
}, B = (
|
|
1338
|
+
var Bn = Object.getOwnPropertyDescriptor, Fn = (r, e, t, s) => {
|
|
1339
|
+
for (var n = s > 1 ? void 0 : s ? Bn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
1340
|
+
(o = r[i]) && (n = o(n) || n);
|
|
1341
|
+
return n;
|
|
1342
|
+
}, B = (r, e) => (t, s) => e(t, s, r);
|
|
1343
1343
|
let Ve = class {
|
|
1344
|
-
constructor(
|
|
1344
|
+
constructor(r, e, t, s, n, i, o, a) {
|
|
1345
1345
|
w(this, "_permissionSubject");
|
|
1346
1346
|
w(this, "_rangeRulesSubject");
|
|
1347
1347
|
/**
|
|
@@ -1368,19 +1368,19 @@ let Ve = class {
|
|
|
1368
1368
|
w(this, "_subUnitId");
|
|
1369
1369
|
w(this, "_subscriptions", []);
|
|
1370
1370
|
w(this, "_fPermission");
|
|
1371
|
-
this._worksheet =
|
|
1371
|
+
this._worksheet = r, this._injector = e, this._permissionService = t, this._authzIoService = s, this._commandService = n, this._rangeProtectionRuleModel = i, this._worksheetProtectionPointModel = o, this._worksheetProtectionRuleModel = a, this._unitId = this._worksheet.getWorkbook().getUnitId(), this._subUnitId = this._worksheet.getSheetId(), this._fPermission = this._injector.createInstance(z), this._permissionSubject = new ge(this._buildSnapshot()), this._rangeRulesSubject = new ge(this._buildRangeProtectionRules()), this.permission$ = this._createPermissionStream(), this.pointChange$ = this._createPointChangeStream(), this.rangeProtectionChange$ = this._createRangeProtectionChangeStream(), this.rangeProtectionRules$ = this._createRangeProtectionRulesStream();
|
|
1372
1372
|
}
|
|
1373
1373
|
/**
|
|
1374
1374
|
* Create permission snapshot stream from IPermissionService
|
|
1375
1375
|
* @private
|
|
1376
1376
|
*/
|
|
1377
1377
|
_createPermissionStream() {
|
|
1378
|
-
const
|
|
1378
|
+
const r = this._permissionService.permissionPointUpdate$.pipe(
|
|
1379
1379
|
D((e) => e.id.includes(this._unitId) && e.id.includes(this._subUnitId))
|
|
1380
1380
|
).subscribe(() => {
|
|
1381
1381
|
this._permissionSubject.next(this._buildSnapshot());
|
|
1382
1382
|
});
|
|
1383
|
-
return this._subscriptions.push(
|
|
1383
|
+
return this._subscriptions.push(r), this._permissionSubject.asObservable().pipe(
|
|
1384
1384
|
_e((e, t) => JSON.stringify(e) === JSON.stringify(t)),
|
|
1385
1385
|
N({ bufferSize: 1, refCount: !0 })
|
|
1386
1386
|
);
|
|
@@ -1391,17 +1391,17 @@ let Ve = class {
|
|
|
1391
1391
|
*/
|
|
1392
1392
|
_createPointChangeStream() {
|
|
1393
1393
|
return this._permissionService.permissionPointUpdate$.pipe(
|
|
1394
|
-
D((
|
|
1395
|
-
we((
|
|
1394
|
+
D((r) => r.id.includes(this._unitId) && r.id.includes(this._subUnitId)),
|
|
1395
|
+
we((r) => {
|
|
1396
1396
|
var t, s;
|
|
1397
|
-
const e = this._extractWorksheetPointType(
|
|
1397
|
+
const e = this._extractWorksheetPointType(r.id);
|
|
1398
1398
|
return e ? {
|
|
1399
1399
|
point: e,
|
|
1400
|
-
value: (t =
|
|
1401
|
-
oldValue: !((s =
|
|
1400
|
+
value: (t = r.value) != null ? t : !1,
|
|
1401
|
+
oldValue: !((s = r.value) != null && s)
|
|
1402
1402
|
} : null;
|
|
1403
1403
|
}),
|
|
1404
|
-
D((
|
|
1404
|
+
D((r) => r !== null),
|
|
1405
1405
|
N({ bufferSize: 1, refCount: !0 })
|
|
1406
1406
|
);
|
|
1407
1407
|
}
|
|
@@ -1411,10 +1411,10 @@ let Ve = class {
|
|
|
1411
1411
|
*/
|
|
1412
1412
|
_createRangeProtectionChangeStream() {
|
|
1413
1413
|
return this._rangeProtectionRuleModel.ruleChange$.pipe(
|
|
1414
|
-
D((
|
|
1415
|
-
we((
|
|
1414
|
+
D((r) => r.unitId === this._unitId && r.subUnitId === this._subUnitId),
|
|
1415
|
+
we((r) => {
|
|
1416
1416
|
const e = this._buildRangeProtectionRules();
|
|
1417
|
-
return { type:
|
|
1417
|
+
return { type: r.type === "delete" ? "delete" : r.type === "set" ? "update" : "add", rules: e };
|
|
1418
1418
|
}),
|
|
1419
1419
|
N({ bufferSize: 1, refCount: !0 })
|
|
1420
1420
|
);
|
|
@@ -1424,13 +1424,13 @@ let Ve = class {
|
|
|
1424
1424
|
* @private
|
|
1425
1425
|
*/
|
|
1426
1426
|
_createRangeProtectionRulesStream() {
|
|
1427
|
-
const
|
|
1427
|
+
const r = this._rangeProtectionRuleModel.ruleChange$.pipe(
|
|
1428
1428
|
D((e) => e.unitId === this._unitId && e.subUnitId === this._subUnitId)
|
|
1429
1429
|
).subscribe(() => {
|
|
1430
1430
|
this._rangeRulesSubject.next(this._buildRangeProtectionRules());
|
|
1431
1431
|
});
|
|
1432
|
-
return this._subscriptions.push(
|
|
1433
|
-
_e((e, t) => e.length !== t.length ? !1 : e.every((s,
|
|
1432
|
+
return this._subscriptions.push(r), this._rangeRulesSubject.asObservable().pipe(
|
|
1433
|
+
_e((e, t) => e.length !== t.length ? !1 : e.every((s, n) => s.id === t[n].id)),
|
|
1434
1434
|
N({ bufferSize: 1, refCount: !0 })
|
|
1435
1435
|
);
|
|
1436
1436
|
}
|
|
@@ -1438,37 +1438,37 @@ let Ve = class {
|
|
|
1438
1438
|
* Extract WorksheetPermissionPoint type from permission point ID
|
|
1439
1439
|
* @private
|
|
1440
1440
|
*/
|
|
1441
|
-
_extractWorksheetPointType(
|
|
1442
|
-
for (const [e, t] of Object.entries(
|
|
1443
|
-
if (new t(this._unitId, this._subUnitId).id ===
|
|
1441
|
+
_extractWorksheetPointType(r) {
|
|
1442
|
+
for (const [e, t] of Object.entries(de))
|
|
1443
|
+
if (new t(this._unitId, this._subUnitId).id === r)
|
|
1444
1444
|
return e;
|
|
1445
1445
|
return null;
|
|
1446
1446
|
}
|
|
1447
1447
|
/**
|
|
1448
1448
|
* Read the actual edit permission from a rule's permissionId
|
|
1449
1449
|
*/
|
|
1450
|
-
_getRuleEditPermission(
|
|
1451
|
-
var
|
|
1450
|
+
_getRuleEditPermission(r) {
|
|
1451
|
+
var n;
|
|
1452
1452
|
const e = se[b.Edit];
|
|
1453
1453
|
if (!e)
|
|
1454
1454
|
return !1;
|
|
1455
1455
|
const t = new e(
|
|
1456
1456
|
this._unitId,
|
|
1457
1457
|
this._subUnitId,
|
|
1458
|
-
|
|
1458
|
+
r.permissionId
|
|
1459
1459
|
), s = this._permissionService.getPermissionPoint(t.id);
|
|
1460
|
-
return (
|
|
1460
|
+
return (n = s == null ? void 0 : s.value) != null ? n : !1;
|
|
1461
1461
|
}
|
|
1462
1462
|
/**
|
|
1463
1463
|
* Build permission snapshot
|
|
1464
1464
|
*/
|
|
1465
1465
|
_buildSnapshot() {
|
|
1466
|
-
const
|
|
1466
|
+
const r = {};
|
|
1467
1467
|
for (const e in _) {
|
|
1468
1468
|
const t = _[e];
|
|
1469
|
-
|
|
1469
|
+
r[t] = this.getPoint(t);
|
|
1470
1470
|
}
|
|
1471
|
-
return
|
|
1471
|
+
return r;
|
|
1472
1472
|
}
|
|
1473
1473
|
/**
|
|
1474
1474
|
* Build range protection rules list
|
|
@@ -1500,19 +1500,19 @@ let Ve = class {
|
|
|
1500
1500
|
/**
|
|
1501
1501
|
* Build Facade objects for all protection rules
|
|
1502
1502
|
*/
|
|
1503
|
-
_buildProtectionRule(
|
|
1504
|
-
const e =
|
|
1503
|
+
_buildProtectionRule(r) {
|
|
1504
|
+
const e = r.ranges.map(
|
|
1505
1505
|
(s) => this._worksheet.getRange(s)
|
|
1506
1506
|
), t = {
|
|
1507
|
-
name:
|
|
1508
|
-
allowViewByOthers:
|
|
1507
|
+
name: r.description || "",
|
|
1508
|
+
allowViewByOthers: r.viewState !== U.NoOneElseCanView
|
|
1509
1509
|
};
|
|
1510
|
-
return
|
|
1510
|
+
return r.editState === x.DesignedUserCanEdit ? t.allowEdit = !0 : t.allowEdit = !1, this._injector.createInstance(
|
|
1511
1511
|
O,
|
|
1512
1512
|
this._unitId,
|
|
1513
1513
|
this._subUnitId,
|
|
1514
|
-
|
|
1515
|
-
|
|
1514
|
+
r.id,
|
|
1515
|
+
r.permissionId,
|
|
1516
1516
|
e,
|
|
1517
1517
|
t
|
|
1518
1518
|
);
|
|
@@ -1530,13 +1530,13 @@ let Ve = class {
|
|
|
1530
1530
|
* console.log(debugInfo);
|
|
1531
1531
|
* ```
|
|
1532
1532
|
*/
|
|
1533
|
-
debugCellPermission(
|
|
1534
|
-
const t = this._fPermission.getPermissionInfoWithCell(this._unitId, this._subUnitId,
|
|
1533
|
+
debugCellPermission(r, e) {
|
|
1534
|
+
const t = this._fPermission.getPermissionInfoWithCell(this._unitId, this._subUnitId, r, e);
|
|
1535
1535
|
if (!t)
|
|
1536
1536
|
return;
|
|
1537
|
-
const { ruleId: s } = t,
|
|
1538
|
-
if (
|
|
1539
|
-
return this._buildProtectionRule(
|
|
1537
|
+
const { ruleId: s } = t, n = this._rangeProtectionRuleModel.getRule(this._unitId, this._subUnitId, s);
|
|
1538
|
+
if (n)
|
|
1539
|
+
return this._buildProtectionRule(n);
|
|
1540
1540
|
}
|
|
1541
1541
|
/**
|
|
1542
1542
|
* Create worksheet protection with collaborators support.
|
|
@@ -1558,10 +1558,10 @@ let Ve = class {
|
|
|
1558
1558
|
* await permission?.setMode('readOnly');
|
|
1559
1559
|
* ```
|
|
1560
1560
|
*/
|
|
1561
|
-
async protect(
|
|
1561
|
+
async protect(r) {
|
|
1562
1562
|
if (this.isProtected())
|
|
1563
1563
|
throw new Error("Worksheet is already protected. Call unprotect() first.");
|
|
1564
|
-
const e = await this._fPermission.addWorksheetBasePermission(this._unitId, this._subUnitId,
|
|
1564
|
+
const e = await this._fPermission.addWorksheetBasePermission(this._unitId, this._subUnitId, r);
|
|
1565
1565
|
if (!e)
|
|
1566
1566
|
throw new Error("Failed to create worksheet protection");
|
|
1567
1567
|
return e;
|
|
@@ -1581,8 +1581,8 @@ let Ve = class {
|
|
|
1581
1581
|
if (!this.isProtected())
|
|
1582
1582
|
return;
|
|
1583
1583
|
this._fPermission.removeWorksheetPermission(this._unitId, this._subUnitId);
|
|
1584
|
-
const
|
|
1585
|
-
this._permissionSubject.next(
|
|
1584
|
+
const r = this._buildSnapshot();
|
|
1585
|
+
this._permissionSubject.next(r);
|
|
1586
1586
|
}
|
|
1587
1587
|
/**
|
|
1588
1588
|
* Check if worksheet is currently protected.
|
|
@@ -1611,19 +1611,19 @@ let Ve = class {
|
|
|
1611
1611
|
* await permission?.setMode('readOnly');
|
|
1612
1612
|
* ```
|
|
1613
1613
|
*/
|
|
1614
|
-
async setMode(
|
|
1615
|
-
const e = this._getModePermissions(
|
|
1614
|
+
async setMode(r) {
|
|
1615
|
+
const e = this._getModePermissions(r);
|
|
1616
1616
|
await this._batchSetPermissionPoints(e);
|
|
1617
1617
|
}
|
|
1618
1618
|
/**
|
|
1619
1619
|
* Get permission configuration for a specific mode
|
|
1620
1620
|
* @private
|
|
1621
1621
|
*/
|
|
1622
|
-
_getModePermissions(
|
|
1622
|
+
_getModePermissions(r) {
|
|
1623
1623
|
const e = {};
|
|
1624
1624
|
switch (Object.values(_).forEach((t) => {
|
|
1625
1625
|
e[t] = !1;
|
|
1626
|
-
}),
|
|
1626
|
+
}), r) {
|
|
1627
1627
|
case "editable":
|
|
1628
1628
|
Object.values(_).forEach((t) => {
|
|
1629
1629
|
e[t] = !0;
|
|
@@ -1642,14 +1642,14 @@ let Ve = class {
|
|
|
1642
1642
|
* Batch set multiple permission points efficiently
|
|
1643
1643
|
* @private
|
|
1644
1644
|
*/
|
|
1645
|
-
async _batchSetPermissionPoints(
|
|
1645
|
+
async _batchSetPermissionPoints(r) {
|
|
1646
1646
|
const e = [];
|
|
1647
|
-
for (const [t, s] of Object.entries(
|
|
1648
|
-
const
|
|
1647
|
+
for (const [t, s] of Object.entries(r)) {
|
|
1648
|
+
const n = t, i = de[n];
|
|
1649
1649
|
if (!i)
|
|
1650
|
-
throw new Error(`Unknown worksheet permission point: ${
|
|
1651
|
-
const o = this.getPoint(
|
|
1652
|
-
o !== s && (await this._fPermission.setWorksheetPermissionPoint(this._unitId, this._subUnitId, i, s), e.push({ point:
|
|
1650
|
+
throw new Error(`Unknown worksheet permission point: ${n}`);
|
|
1651
|
+
const o = this.getPoint(n);
|
|
1652
|
+
o !== s && (await this._fPermission.setWorksheetPermissionPoint(this._unitId, this._subUnitId, i, s), e.push({ point: n, value: s, oldValue: o }));
|
|
1653
1653
|
}
|
|
1654
1654
|
if (e.length > 0) {
|
|
1655
1655
|
const t = this._buildSnapshot();
|
|
@@ -1710,13 +1710,13 @@ let Ve = class {
|
|
|
1710
1710
|
* console.log(canEdit);
|
|
1711
1711
|
* ```
|
|
1712
1712
|
*/
|
|
1713
|
-
canEditCell(
|
|
1713
|
+
canEditCell(r, e) {
|
|
1714
1714
|
if (!this.canEdit())
|
|
1715
1715
|
return !1;
|
|
1716
1716
|
const t = this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId, this._subUnitId);
|
|
1717
1717
|
for (const s of t)
|
|
1718
|
-
for (const
|
|
1719
|
-
if (
|
|
1718
|
+
for (const n of s.ranges)
|
|
1719
|
+
if (r >= n.startRow && r <= n.endRow && e >= n.startColumn && e <= n.endColumn)
|
|
1720
1720
|
return this._getRuleEditPermission(s);
|
|
1721
1721
|
return !0;
|
|
1722
1722
|
}
|
|
@@ -1733,7 +1733,7 @@ let Ve = class {
|
|
|
1733
1733
|
* console.log(canView);
|
|
1734
1734
|
* ```
|
|
1735
1735
|
*/
|
|
1736
|
-
canViewCell(
|
|
1736
|
+
canViewCell(r, e) {
|
|
1737
1737
|
return this.getPoint(_.View);
|
|
1738
1738
|
}
|
|
1739
1739
|
/**
|
|
@@ -1749,15 +1749,15 @@ let Ve = class {
|
|
|
1749
1749
|
* await permission?.setPoint(univerAPI.Enum.WorksheetPermissionPoint.InsertRow, false);
|
|
1750
1750
|
* ```
|
|
1751
1751
|
*/
|
|
1752
|
-
async setPoint(
|
|
1753
|
-
const t =
|
|
1752
|
+
async setPoint(r, e) {
|
|
1753
|
+
const t = de[r];
|
|
1754
1754
|
if (!t)
|
|
1755
|
-
throw new Error(`Unknown worksheet permission point: ${
|
|
1756
|
-
if (this.getPoint(
|
|
1755
|
+
throw new Error(`Unknown worksheet permission point: ${r}`);
|
|
1756
|
+
if (this.getPoint(r) === e)
|
|
1757
1757
|
return;
|
|
1758
1758
|
await this._fPermission.setWorksheetPermissionPoint(this._unitId, this._subUnitId, t, e);
|
|
1759
|
-
const
|
|
1760
|
-
this._permissionSubject.next(
|
|
1759
|
+
const n = this._buildSnapshot();
|
|
1760
|
+
this._permissionSubject.next(n);
|
|
1761
1761
|
}
|
|
1762
1762
|
/**
|
|
1763
1763
|
* Get the value of a specific permission point.
|
|
@@ -1771,13 +1771,13 @@ let Ve = class {
|
|
|
1771
1771
|
* console.log(canInsertRow);
|
|
1772
1772
|
* ```
|
|
1773
1773
|
*/
|
|
1774
|
-
getPoint(
|
|
1775
|
-
var
|
|
1776
|
-
const e =
|
|
1774
|
+
getPoint(r) {
|
|
1775
|
+
var n;
|
|
1776
|
+
const e = de[r];
|
|
1777
1777
|
if (!e)
|
|
1778
|
-
throw new Error(`Unknown worksheet permission point: ${
|
|
1778
|
+
throw new Error(`Unknown worksheet permission point: ${r}`);
|
|
1779
1779
|
const t = new e(this._unitId, this._subUnitId), s = this._permissionService.getPermissionPoint(t.id);
|
|
1780
|
-
return (
|
|
1780
|
+
return (n = s == null ? void 0 : s.value) != null ? n : !0;
|
|
1781
1781
|
}
|
|
1782
1782
|
/**
|
|
1783
1783
|
* Get a snapshot of all permission points.
|
|
@@ -1810,12 +1810,12 @@ let Ve = class {
|
|
|
1810
1810
|
* });
|
|
1811
1811
|
* ```
|
|
1812
1812
|
*/
|
|
1813
|
-
async applyConfig(
|
|
1814
|
-
if (
|
|
1815
|
-
for (const [e, t] of Object.entries(
|
|
1813
|
+
async applyConfig(r) {
|
|
1814
|
+
if (r.mode && await this.setMode(r.mode), r.points)
|
|
1815
|
+
for (const [e, t] of Object.entries(r.points))
|
|
1816
1816
|
typeof t == "boolean" && await this.setPoint(e, t);
|
|
1817
|
-
if (
|
|
1818
|
-
const e =
|
|
1817
|
+
if (r.rangeProtections && r.rangeProtections.length > 0) {
|
|
1818
|
+
const e = r.rangeProtections.map((t) => ({
|
|
1819
1819
|
ranges: t.rangeRefs.map((s) => this._worksheet.getRange(s)),
|
|
1820
1820
|
options: t.options
|
|
1821
1821
|
}));
|
|
@@ -1844,22 +1844,22 @@ let Ve = class {
|
|
|
1844
1844
|
* ```
|
|
1845
1845
|
*/
|
|
1846
1846
|
// eslint-disable-next-line max-lines-per-function
|
|
1847
|
-
async protectRanges(
|
|
1848
|
-
if (!
|
|
1847
|
+
async protectRanges(r) {
|
|
1848
|
+
if (!r || r.length === 0)
|
|
1849
1849
|
throw new Error("Configs cannot be empty");
|
|
1850
1850
|
let e = [];
|
|
1851
|
-
|
|
1852
|
-
var h,
|
|
1853
|
-
return (
|
|
1851
|
+
r.some((a) => {
|
|
1852
|
+
var h, c;
|
|
1853
|
+
return (c = (h = a.options) == null ? void 0 : h.allowedUsers) == null ? void 0 : c.length;
|
|
1854
1854
|
}) && (e = await this._authzIoService.listCollaborators({
|
|
1855
1855
|
objectID: this._unitId,
|
|
1856
1856
|
unitID: this._unitId
|
|
1857
1857
|
}));
|
|
1858
1858
|
const s = await Promise.all(
|
|
1859
|
-
|
|
1860
|
-
var
|
|
1859
|
+
r.map((a) => {
|
|
1860
|
+
var c, d;
|
|
1861
1861
|
let h = [];
|
|
1862
|
-
if ((
|
|
1862
|
+
if ((c = a.options) != null && c.allowedUsers) {
|
|
1863
1863
|
const m = new Set(a.options.allowedUsers);
|
|
1864
1864
|
h = e.filter((S) => {
|
|
1865
1865
|
var k;
|
|
@@ -1882,14 +1882,14 @@ let Ve = class {
|
|
|
1882
1882
|
selectRangeObject: {
|
|
1883
1883
|
collaborators: h,
|
|
1884
1884
|
unitID: this._unitId,
|
|
1885
|
-
name: ((
|
|
1885
|
+
name: ((d = a.options) == null ? void 0 : d.name) || "",
|
|
1886
1886
|
scope: void 0
|
|
1887
1887
|
}
|
|
1888
1888
|
});
|
|
1889
1889
|
})
|
|
1890
|
-
),
|
|
1890
|
+
), n = r.map((a, h) => {
|
|
1891
1891
|
var m;
|
|
1892
|
-
const
|
|
1892
|
+
const c = this._determineViewState(a.options), d = this._determineEditState(a.options);
|
|
1893
1893
|
return {
|
|
1894
1894
|
permissionId: s[h],
|
|
1895
1895
|
unitType: A.SelectRange,
|
|
@@ -1898,27 +1898,27 @@ let Ve = class {
|
|
|
1898
1898
|
ranges: a.ranges.map((g) => g.getRange()),
|
|
1899
1899
|
id: this._rangeProtectionRuleModel.createRuleId(this._unitId, this._subUnitId),
|
|
1900
1900
|
description: ((m = a.options) == null ? void 0 : m.name) || "",
|
|
1901
|
-
viewState:
|
|
1902
|
-
editState:
|
|
1901
|
+
viewState: c,
|
|
1902
|
+
editState: d
|
|
1903
1903
|
};
|
|
1904
1904
|
});
|
|
1905
|
-
if (!await this._commandService.executeCommand(
|
|
1905
|
+
if (!await this._commandService.executeCommand(Rt.id, {
|
|
1906
1906
|
unitId: this._unitId,
|
|
1907
1907
|
subUnitId: this._subUnitId,
|
|
1908
|
-
rules:
|
|
1908
|
+
rules: n
|
|
1909
1909
|
}))
|
|
1910
1910
|
throw new Error("Failed to create range protection rules");
|
|
1911
1911
|
return await Promise.all(
|
|
1912
|
-
|
|
1913
|
-
),
|
|
1912
|
+
r.map((a, h) => this._setPermissionPoints(s[h], a.options))
|
|
1913
|
+
), n.map(
|
|
1914
1914
|
(a, h) => this._injector.createInstance(
|
|
1915
1915
|
O,
|
|
1916
1916
|
this._unitId,
|
|
1917
1917
|
this._subUnitId,
|
|
1918
1918
|
a.id,
|
|
1919
1919
|
a.permissionId,
|
|
1920
|
-
|
|
1921
|
-
|
|
1920
|
+
r[h].ranges,
|
|
1921
|
+
r[h].options || {}
|
|
1922
1922
|
)
|
|
1923
1923
|
);
|
|
1924
1924
|
}
|
|
@@ -1926,34 +1926,34 @@ let Ve = class {
|
|
|
1926
1926
|
* Determine view state from options
|
|
1927
1927
|
* @private
|
|
1928
1928
|
*/
|
|
1929
|
-
_determineViewState(
|
|
1930
|
-
return (
|
|
1929
|
+
_determineViewState(r) {
|
|
1930
|
+
return (r == null ? void 0 : r.allowViewByOthers) === !1 ? U.NoOneElseCanView : U.OthersCanView;
|
|
1931
1931
|
}
|
|
1932
1932
|
/**
|
|
1933
1933
|
* Determine edit state from options
|
|
1934
1934
|
* @private
|
|
1935
1935
|
*/
|
|
1936
|
-
_determineEditState(
|
|
1936
|
+
_determineEditState(r) {
|
|
1937
1937
|
var e;
|
|
1938
|
-
return (
|
|
1938
|
+
return (r == null ? void 0 : r.allowEdit) === !0 && ((e = r == null ? void 0 : r.allowedUsers) != null && e.length) ? x.DesignedUserCanEdit : x.OnlyMe;
|
|
1939
1939
|
}
|
|
1940
1940
|
/**
|
|
1941
1941
|
* Set permission points based on options (for local runtime control)
|
|
1942
1942
|
* @private
|
|
1943
1943
|
*/
|
|
1944
|
-
async _setPermissionPoints(
|
|
1944
|
+
async _setPermissionPoints(r, e) {
|
|
1945
1945
|
if (!e)
|
|
1946
1946
|
return;
|
|
1947
|
-
const t = (s,
|
|
1948
|
-
await this._setPermissionPoint(
|
|
1947
|
+
const t = (s, n) => s === void 0 ? n : typeof s == "boolean" ? s : !0;
|
|
1948
|
+
await this._setPermissionPoint(r, b.Edit, t(e.allowEdit, !1)), await this._setPermissionPoint(r, b.View, t(e.allowViewByOthers, !0));
|
|
1949
1949
|
}
|
|
1950
1950
|
/**
|
|
1951
1951
|
* Set a single permission point
|
|
1952
1952
|
* @private
|
|
1953
1953
|
*/
|
|
1954
|
-
async _setPermissionPoint(
|
|
1954
|
+
async _setPermissionPoint(r, e, t) {
|
|
1955
1955
|
const s = se[e];
|
|
1956
|
-
s && this._fPermission.setRangeProtectionPermissionPoint(this._unitId, this._subUnitId,
|
|
1956
|
+
s && this._fPermission.setRangeProtectionPermissionPoint(this._unitId, this._subUnitId, r, s, t);
|
|
1957
1957
|
}
|
|
1958
1958
|
/**
|
|
1959
1959
|
* Remove multiple protection rules at once.
|
|
@@ -1966,8 +1966,8 @@ let Ve = class {
|
|
|
1966
1966
|
* await permission?.unprotectRules(['rule1', 'rule2']);
|
|
1967
1967
|
* ```
|
|
1968
1968
|
*/
|
|
1969
|
-
async unprotectRules(
|
|
1970
|
-
!
|
|
1969
|
+
async unprotectRules(r) {
|
|
1970
|
+
!r || r.length === 0 || this._fPermission.removeRangeProtection(this._unitId, this._subUnitId, r);
|
|
1971
1971
|
}
|
|
1972
1972
|
/**
|
|
1973
1973
|
* List all range protection rules for the worksheet.
|
|
@@ -1998,19 +1998,19 @@ let Ve = class {
|
|
|
1998
1998
|
* unsubscribe?.();
|
|
1999
1999
|
* ```
|
|
2000
2000
|
*/
|
|
2001
|
-
subscribe(
|
|
2002
|
-
const e = this.permission$.subscribe(
|
|
2001
|
+
subscribe(r) {
|
|
2002
|
+
const e = this.permission$.subscribe(r);
|
|
2003
2003
|
return () => e.unsubscribe();
|
|
2004
2004
|
}
|
|
2005
2005
|
/**
|
|
2006
2006
|
* Clean up resources
|
|
2007
2007
|
*/
|
|
2008
2008
|
dispose() {
|
|
2009
|
-
this._subscriptions.forEach((
|
|
2009
|
+
this._subscriptions.forEach((r) => r.unsubscribe()), this._permissionSubject.complete(), this._rangeRulesSubject.complete();
|
|
2010
2010
|
}
|
|
2011
2011
|
};
|
|
2012
|
-
Ve =
|
|
2013
|
-
B(1, l(
|
|
2012
|
+
Ve = Fn([
|
|
2013
|
+
B(1, l(P)),
|
|
2014
2014
|
B(2, Y),
|
|
2015
2015
|
B(3, re),
|
|
2016
2016
|
B(4, C),
|
|
@@ -2018,8 +2018,8 @@ Ve = Bn([
|
|
|
2018
2018
|
B(6, l(ze)),
|
|
2019
2019
|
B(7, l($e))
|
|
2020
2020
|
], Ve);
|
|
2021
|
-
function
|
|
2022
|
-
switch (
|
|
2021
|
+
function Hn(r) {
|
|
2022
|
+
switch (r) {
|
|
2023
2023
|
case "left":
|
|
2024
2024
|
return K.LEFT;
|
|
2025
2025
|
case "center":
|
|
@@ -2027,11 +2027,11 @@ function Fn(n) {
|
|
|
2027
2027
|
case "normal":
|
|
2028
2028
|
return K.RIGHT;
|
|
2029
2029
|
default:
|
|
2030
|
-
throw new Error(`Invalid horizontal alignment: ${
|
|
2030
|
+
throw new Error(`Invalid horizontal alignment: ${r}`);
|
|
2031
2031
|
}
|
|
2032
2032
|
}
|
|
2033
|
-
function
|
|
2034
|
-
switch (
|
|
2033
|
+
function wt(r) {
|
|
2034
|
+
switch (r) {
|
|
2035
2035
|
case K.LEFT:
|
|
2036
2036
|
return "left";
|
|
2037
2037
|
case K.CENTER:
|
|
@@ -2042,8 +2042,8 @@ function _t(n) {
|
|
|
2042
2042
|
return "general";
|
|
2043
2043
|
}
|
|
2044
2044
|
}
|
|
2045
|
-
function
|
|
2046
|
-
switch (
|
|
2045
|
+
function $n(r) {
|
|
2046
|
+
switch (r) {
|
|
2047
2047
|
case "top":
|
|
2048
2048
|
return J.TOP;
|
|
2049
2049
|
case "middle":
|
|
@@ -2051,11 +2051,11 @@ function Hn(n) {
|
|
|
2051
2051
|
case "bottom":
|
|
2052
2052
|
return J.BOTTOM;
|
|
2053
2053
|
default:
|
|
2054
|
-
throw new Error(`Invalid vertical alignment: ${
|
|
2054
|
+
throw new Error(`Invalid vertical alignment: ${r}`);
|
|
2055
2055
|
}
|
|
2056
2056
|
}
|
|
2057
|
-
function
|
|
2058
|
-
switch (
|
|
2057
|
+
function St(r) {
|
|
2058
|
+
switch (r) {
|
|
2059
2059
|
case J.TOP:
|
|
2060
2060
|
return "top";
|
|
2061
2061
|
case J.MIDDLE:
|
|
@@ -2066,29 +2066,29 @@ function wt(n) {
|
|
|
2066
2066
|
return "general";
|
|
2067
2067
|
}
|
|
2068
2068
|
}
|
|
2069
|
-
function ye(
|
|
2069
|
+
function ye(r, e) {
|
|
2070
2070
|
return {
|
|
2071
|
-
startRow:
|
|
2072
|
-
endRow:
|
|
2071
|
+
startRow: r.startRow,
|
|
2072
|
+
endRow: r.endRow,
|
|
2073
2073
|
startColumn: 0,
|
|
2074
2074
|
endColumn: e.getColumnCount() - 1,
|
|
2075
2075
|
rangeType: p.ROW
|
|
2076
2076
|
};
|
|
2077
2077
|
}
|
|
2078
|
-
function
|
|
2078
|
+
function Ee(r, e) {
|
|
2079
2079
|
return {
|
|
2080
2080
|
startRow: 0,
|
|
2081
2081
|
endRow: e.getRowCount() - 1,
|
|
2082
|
-
startColumn:
|
|
2083
|
-
endColumn:
|
|
2082
|
+
startColumn: r.startColumn,
|
|
2083
|
+
endColumn: r.endColumn,
|
|
2084
2084
|
rangeType: p.COLUMN
|
|
2085
2085
|
};
|
|
2086
2086
|
}
|
|
2087
|
-
var
|
|
2088
|
-
for (var
|
|
2089
|
-
(o =
|
|
2090
|
-
return
|
|
2091
|
-
},
|
|
2087
|
+
var zn = Object.getOwnPropertyDescriptor, Ln = (r, e, t, s) => {
|
|
2088
|
+
for (var n = s > 1 ? void 0 : s ? zn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
2089
|
+
(o = r[i]) && (n = o(n) || n);
|
|
2090
|
+
return n;
|
|
2091
|
+
}, ce = (r, e) => (t, s) => e(t, s, r);
|
|
2092
2092
|
let v = class extends He {
|
|
2093
2093
|
/**
|
|
2094
2094
|
* Creates a new worksheet facade instance
|
|
@@ -2100,8 +2100,8 @@ let v = class extends He {
|
|
|
2100
2100
|
* @param {ILogService} _logService - The log service
|
|
2101
2101
|
* @param {ICommandService} _commandService - The command service
|
|
2102
2102
|
*/
|
|
2103
|
-
constructor(e, t, s,
|
|
2104
|
-
super(
|
|
2103
|
+
constructor(e, t, s, n, i, o, a) {
|
|
2104
|
+
super(n);
|
|
2105
2105
|
/**
|
|
2106
2106
|
* Sets the active selection region for this sheet.
|
|
2107
2107
|
* @param range - The range to set as the active selection
|
|
@@ -2113,7 +2113,7 @@ let v = class extends He {
|
|
|
2113
2113
|
* ```
|
|
2114
2114
|
*/
|
|
2115
2115
|
w(this, "setActiveSelection", this.setActiveRange);
|
|
2116
|
-
this._fWorkbook = e, this._workbook = t, this._worksheet = s, this._injector =
|
|
2116
|
+
this._fWorkbook = e, this._workbook = t, this._worksheet = s, this._injector = n, this._selectionManagerService = i, this._logService = o, this._commandService = a;
|
|
2117
2117
|
}
|
|
2118
2118
|
dispose() {
|
|
2119
2119
|
super.dispose(), delete this._fWorkbook, delete this._workbook, delete this._worksheet;
|
|
@@ -2264,7 +2264,7 @@ let v = class extends He {
|
|
|
2264
2264
|
*/
|
|
2265
2265
|
setDefaultStyle(e) {
|
|
2266
2266
|
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId();
|
|
2267
|
-
return this._commandService.syncExecuteCommand(
|
|
2267
|
+
return this._commandService.syncExecuteCommand(Fs.id, {
|
|
2268
2268
|
unitId: t,
|
|
2269
2269
|
subUnitId: s,
|
|
2270
2270
|
defaultStyle: e
|
|
@@ -2285,9 +2285,9 @@ let v = class extends He {
|
|
|
2285
2285
|
* ```
|
|
2286
2286
|
*/
|
|
2287
2287
|
setColumnDefaultStyle(e, t) {
|
|
2288
|
-
const s = this._workbook.getUnitId(),
|
|
2288
|
+
const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = {
|
|
2289
2289
|
unitId: s,
|
|
2290
|
-
subUnitId:
|
|
2290
|
+
subUnitId: n,
|
|
2291
2291
|
columnData: {
|
|
2292
2292
|
[e]: {
|
|
2293
2293
|
s: t
|
|
@@ -2311,9 +2311,9 @@ let v = class extends He {
|
|
|
2311
2311
|
* ```
|
|
2312
2312
|
*/
|
|
2313
2313
|
setRowDefaultStyle(e, t) {
|
|
2314
|
-
const s = this._workbook.getUnitId(),
|
|
2314
|
+
const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = {
|
|
2315
2315
|
unitId: s,
|
|
2316
|
-
subUnitId:
|
|
2316
|
+
subUnitId: n,
|
|
2317
2317
|
rowData: {
|
|
2318
2318
|
[e]: {
|
|
2319
2319
|
s: t
|
|
@@ -2322,15 +2322,15 @@ let v = class extends He {
|
|
|
2322
2322
|
};
|
|
2323
2323
|
return this._commandService.syncExecuteCommand(st.id, i), this;
|
|
2324
2324
|
}
|
|
2325
|
-
getRange(e, t, s,
|
|
2325
|
+
getRange(e, t, s, n) {
|
|
2326
2326
|
let i, o;
|
|
2327
2327
|
if (typeof e == "object")
|
|
2328
2328
|
i = e, o = this._worksheet;
|
|
2329
2329
|
else if (typeof e == "string") {
|
|
2330
|
-
const { range: a, sheetName: h } =
|
|
2331
|
-
if (!
|
|
2330
|
+
const { range: a, sheetName: h } = yn(e), c = h ? this._workbook.getSheetBySheetName(h) : this._worksheet;
|
|
2331
|
+
if (!c)
|
|
2332
2332
|
throw new Error("Range not found");
|
|
2333
|
-
o =
|
|
2333
|
+
o = c, i = {
|
|
2334
2334
|
...a,
|
|
2335
2335
|
unitId: this._workbook.getUnitId(),
|
|
2336
2336
|
sheetId: o.getSheetId(),
|
|
@@ -2347,7 +2347,7 @@ let v = class extends He {
|
|
|
2347
2347
|
startRow: e,
|
|
2348
2348
|
endRow: e + (s != null ? s : 1) - 1,
|
|
2349
2349
|
startColumn: t,
|
|
2350
|
-
endColumn: t + (
|
|
2350
|
+
endColumn: t + (n != null ? n : 1) - 1,
|
|
2351
2351
|
unitId: this._workbook.getUnitId(),
|
|
2352
2352
|
sheetId: this._worksheet.getSheetId()
|
|
2353
2353
|
};
|
|
@@ -2445,18 +2445,18 @@ let v = class extends He {
|
|
|
2445
2445
|
* ```
|
|
2446
2446
|
*/
|
|
2447
2447
|
insertRowsAfter(e, t) {
|
|
2448
|
-
const s = this._workbook.getUnitId(),
|
|
2448
|
+
const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = oe.DOWN, o = e + 1, a = e + t, h = 0, c = this._worksheet.getColumnCount() - 1, d = ae(this._worksheet, o, a, h, c, !0, e);
|
|
2449
2449
|
return this._commandService.syncExecuteCommand(nt.id, {
|
|
2450
2450
|
unitId: s,
|
|
2451
|
-
subUnitId:
|
|
2451
|
+
subUnitId: n,
|
|
2452
2452
|
direction: i,
|
|
2453
2453
|
range: {
|
|
2454
2454
|
startRow: o,
|
|
2455
2455
|
endRow: a,
|
|
2456
2456
|
startColumn: h,
|
|
2457
|
-
endColumn:
|
|
2457
|
+
endColumn: c
|
|
2458
2458
|
},
|
|
2459
|
-
cellValue:
|
|
2459
|
+
cellValue: d
|
|
2460
2460
|
}), this;
|
|
2461
2461
|
}
|
|
2462
2462
|
/**
|
|
@@ -2474,18 +2474,18 @@ let v = class extends He {
|
|
|
2474
2474
|
* ```
|
|
2475
2475
|
*/
|
|
2476
2476
|
insertRowsBefore(e, t) {
|
|
2477
|
-
const s = this._workbook.getUnitId(),
|
|
2477
|
+
const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = oe.UP, o = e, a = e + t - 1, h = 0, c = this._worksheet.getColumnCount() - 1, d = ae(this._worksheet, o, a, h, c, !0, e - 1);
|
|
2478
2478
|
return this._commandService.syncExecuteCommand(nt.id, {
|
|
2479
2479
|
unitId: s,
|
|
2480
|
-
subUnitId:
|
|
2480
|
+
subUnitId: n,
|
|
2481
2481
|
direction: i,
|
|
2482
2482
|
range: {
|
|
2483
2483
|
startRow: o,
|
|
2484
2484
|
endRow: a,
|
|
2485
2485
|
startColumn: h,
|
|
2486
|
-
endColumn:
|
|
2486
|
+
endColumn: c
|
|
2487
2487
|
},
|
|
2488
|
-
cellValue:
|
|
2488
|
+
cellValue: d
|
|
2489
2489
|
}), this;
|
|
2490
2490
|
}
|
|
2491
2491
|
/**
|
|
@@ -2525,7 +2525,7 @@ let v = class extends He {
|
|
|
2525
2525
|
startColumn: 0,
|
|
2526
2526
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2527
2527
|
};
|
|
2528
|
-
return this._commandService.syncExecuteCommand(
|
|
2528
|
+
return this._commandService.syncExecuteCommand(Hs.id, {
|
|
2529
2529
|
range: s,
|
|
2530
2530
|
unitId: this._workbook.getUnitId(),
|
|
2531
2531
|
subUnitId: this._worksheet.getSheetId()
|
|
@@ -2548,15 +2548,15 @@ let v = class extends He {
|
|
|
2548
2548
|
* ```
|
|
2549
2549
|
*/
|
|
2550
2550
|
moveRows(e, t) {
|
|
2551
|
-
const s = this._workbook.getUnitId(),
|
|
2551
|
+
const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = ye(e.getRange(), this._worksheet), o = i, a = {
|
|
2552
2552
|
startRow: t,
|
|
2553
2553
|
endRow: t,
|
|
2554
2554
|
startColumn: i.startColumn,
|
|
2555
2555
|
endColumn: i.endColumn
|
|
2556
2556
|
};
|
|
2557
|
-
return this._commandService.syncExecuteCommand(
|
|
2557
|
+
return this._commandService.syncExecuteCommand($s.id, {
|
|
2558
2558
|
unitId: s,
|
|
2559
|
-
subUnitId:
|
|
2559
|
+
subUnitId: n,
|
|
2560
2560
|
range: i,
|
|
2561
2561
|
fromRange: o,
|
|
2562
2562
|
toRange: a
|
|
@@ -2578,11 +2578,11 @@ let v = class extends He {
|
|
|
2578
2578
|
* ```
|
|
2579
2579
|
*/
|
|
2580
2580
|
hideRow(e) {
|
|
2581
|
-
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(),
|
|
2581
|
+
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), n = ye(e.getRange(), this._worksheet);
|
|
2582
2582
|
return this._commandService.syncExecuteCommand(rt.id, {
|
|
2583
2583
|
unitId: t,
|
|
2584
2584
|
subUnitId: s,
|
|
2585
|
-
ranges: [
|
|
2585
|
+
ranges: [n]
|
|
2586
2586
|
}), this;
|
|
2587
2587
|
}
|
|
2588
2588
|
/**
|
|
@@ -2600,7 +2600,7 @@ let v = class extends He {
|
|
|
2600
2600
|
* ```
|
|
2601
2601
|
*/
|
|
2602
2602
|
hideRows(e, t = 1) {
|
|
2603
|
-
const s = this._workbook.getUnitId(),
|
|
2603
|
+
const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = {
|
|
2604
2604
|
startRow: e,
|
|
2605
2605
|
endRow: e + t - 1,
|
|
2606
2606
|
startColumn: 0,
|
|
@@ -2609,7 +2609,7 @@ let v = class extends He {
|
|
|
2609
2609
|
};
|
|
2610
2610
|
return this._commandService.syncExecuteCommand(rt.id, {
|
|
2611
2611
|
unitId: s,
|
|
2612
|
-
subUnitId:
|
|
2612
|
+
subUnitId: n,
|
|
2613
2613
|
ranges: [i]
|
|
2614
2614
|
}), this;
|
|
2615
2615
|
}
|
|
@@ -2629,11 +2629,11 @@ let v = class extends He {
|
|
|
2629
2629
|
* ```
|
|
2630
2630
|
*/
|
|
2631
2631
|
unhideRow(e) {
|
|
2632
|
-
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(),
|
|
2632
|
+
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), n = ye(e.getRange(), this._worksheet);
|
|
2633
2633
|
return this._commandService.syncExecuteCommand(it.id, {
|
|
2634
2634
|
unitId: t,
|
|
2635
2635
|
subUnitId: s,
|
|
2636
|
-
ranges: [
|
|
2636
|
+
ranges: [n]
|
|
2637
2637
|
}), this;
|
|
2638
2638
|
}
|
|
2639
2639
|
/**
|
|
@@ -2651,7 +2651,7 @@ let v = class extends He {
|
|
|
2651
2651
|
* ```
|
|
2652
2652
|
*/
|
|
2653
2653
|
showRows(e, t = 1) {
|
|
2654
|
-
const s = this._workbook.getUnitId(),
|
|
2654
|
+
const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = {
|
|
2655
2655
|
startRow: e,
|
|
2656
2656
|
endRow: e + t - 1,
|
|
2657
2657
|
startColumn: 0,
|
|
@@ -2660,7 +2660,7 @@ let v = class extends He {
|
|
|
2660
2660
|
};
|
|
2661
2661
|
return this._commandService.syncExecuteCommand(it.id, {
|
|
2662
2662
|
unitId: s,
|
|
2663
|
-
subUnitId:
|
|
2663
|
+
subUnitId: n,
|
|
2664
2664
|
ranges: [i]
|
|
2665
2665
|
}), this;
|
|
2666
2666
|
}
|
|
@@ -2693,7 +2693,7 @@ let v = class extends He {
|
|
|
2693
2693
|
* ```
|
|
2694
2694
|
*/
|
|
2695
2695
|
autoFitRow(e, t = I.TRUE) {
|
|
2696
|
-
const s = this._workbook.getUnitId(),
|
|
2696
|
+
const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = [{
|
|
2697
2697
|
startRow: e,
|
|
2698
2698
|
endRow: e,
|
|
2699
2699
|
startColumn: 0,
|
|
@@ -2704,9 +2704,9 @@ let v = class extends He {
|
|
|
2704
2704
|
subUnitId: this._worksheet.getSheetId(),
|
|
2705
2705
|
range: i[0],
|
|
2706
2706
|
value: ue.WRAP
|
|
2707
|
-
}), this._commandService.syncExecuteCommand(
|
|
2707
|
+
}), this._commandService.syncExecuteCommand(zs.id, {
|
|
2708
2708
|
unitId: s,
|
|
2709
|
-
subUnitId:
|
|
2709
|
+
subUnitId: n,
|
|
2710
2710
|
ranges: i,
|
|
2711
2711
|
autoHeightInfo: t
|
|
2712
2712
|
}), this;
|
|
@@ -2725,24 +2725,24 @@ let v = class extends He {
|
|
|
2725
2725
|
* ```
|
|
2726
2726
|
*/
|
|
2727
2727
|
setRowHeights(e, t, s) {
|
|
2728
|
-
var
|
|
2729
|
-
const
|
|
2730
|
-
for (let
|
|
2731
|
-
const m = ((
|
|
2732
|
-
startRow:
|
|
2733
|
-
endRow:
|
|
2728
|
+
var c;
|
|
2729
|
+
const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = this._worksheet.getRowManager(), a = [], h = [];
|
|
2730
|
+
for (let d = e; d < e + t; d++) {
|
|
2731
|
+
const m = ((c = o.getRow(d)) == null ? void 0 : c.ah) || this._worksheet.getConfig().defaultRowHeight, g = {
|
|
2732
|
+
startRow: d,
|
|
2733
|
+
endRow: d,
|
|
2734
2734
|
startColumn: 0,
|
|
2735
2735
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2736
2736
|
};
|
|
2737
2737
|
s <= m ? a.push(g) : h.push(g);
|
|
2738
2738
|
}
|
|
2739
2739
|
return h.length > 0 && this._commandService.syncExecuteCommand(ot.id, {
|
|
2740
|
-
unitId:
|
|
2740
|
+
unitId: n,
|
|
2741
2741
|
subUnitId: i,
|
|
2742
2742
|
ranges: h,
|
|
2743
2743
|
value: s
|
|
2744
2744
|
}), a.length > 0 && this._commandService.syncExecuteCommand(fe.id, {
|
|
2745
|
-
unitId:
|
|
2745
|
+
unitId: n,
|
|
2746
2746
|
subUnitId: i,
|
|
2747
2747
|
ranges: a
|
|
2748
2748
|
}), this;
|
|
@@ -2779,7 +2779,7 @@ let v = class extends He {
|
|
|
2779
2779
|
* ```
|
|
2780
2780
|
*/
|
|
2781
2781
|
setRowAutoHeight(e, t) {
|
|
2782
|
-
const s = this._workbook.getUnitId(),
|
|
2782
|
+
const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = [
|
|
2783
2783
|
{
|
|
2784
2784
|
startRow: e,
|
|
2785
2785
|
endRow: e + t - 1,
|
|
@@ -2789,7 +2789,7 @@ let v = class extends He {
|
|
|
2789
2789
|
];
|
|
2790
2790
|
return this._commandService.syncExecuteCommand(fe.id, {
|
|
2791
2791
|
unitId: s,
|
|
2792
|
-
subUnitId:
|
|
2792
|
+
subUnitId: n,
|
|
2793
2793
|
ranges: i
|
|
2794
2794
|
}), this;
|
|
2795
2795
|
}
|
|
@@ -2828,7 +2828,7 @@ let v = class extends He {
|
|
|
2828
2828
|
* ```
|
|
2829
2829
|
*/
|
|
2830
2830
|
setRowHeightsForced(e, t, s) {
|
|
2831
|
-
const
|
|
2831
|
+
const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = [
|
|
2832
2832
|
{
|
|
2833
2833
|
startRow: e,
|
|
2834
2834
|
endRow: e + t - 1,
|
|
@@ -2837,7 +2837,7 @@ let v = class extends He {
|
|
|
2837
2837
|
}
|
|
2838
2838
|
];
|
|
2839
2839
|
return this._commandService.syncExecuteCommand(ot.id, {
|
|
2840
|
-
unitId:
|
|
2840
|
+
unitId: n,
|
|
2841
2841
|
subUnitId: i,
|
|
2842
2842
|
ranges: o,
|
|
2843
2843
|
value: s
|
|
@@ -2855,15 +2855,15 @@ let v = class extends He {
|
|
|
2855
2855
|
* ```
|
|
2856
2856
|
*/
|
|
2857
2857
|
setRowCustom(e) {
|
|
2858
|
-
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(),
|
|
2858
|
+
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), n = {};
|
|
2859
2859
|
for (const [o, a] of Object.entries(e))
|
|
2860
|
-
|
|
2860
|
+
n[Number(o)] = {
|
|
2861
2861
|
custom: a
|
|
2862
2862
|
};
|
|
2863
2863
|
const i = {
|
|
2864
2864
|
unitId: t,
|
|
2865
2865
|
subUnitId: s,
|
|
2866
|
-
rowData:
|
|
2866
|
+
rowData: n
|
|
2867
2867
|
};
|
|
2868
2868
|
return this._commandService.syncExecuteCommand(st.id, i), this;
|
|
2869
2869
|
}
|
|
@@ -2932,18 +2932,18 @@ let v = class extends He {
|
|
|
2932
2932
|
* ```
|
|
2933
2933
|
*/
|
|
2934
2934
|
insertColumnsAfter(e, t) {
|
|
2935
|
-
const s = this._workbook.getUnitId(),
|
|
2935
|
+
const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = oe.RIGHT, o = 0, a = this._worksheet.getRowCount() - 1, h = e + 1, c = e + t, d = ae(this._worksheet, o, a, h, c, !1, e);
|
|
2936
2936
|
return this._commandService.syncExecuteCommand(at.id, {
|
|
2937
2937
|
unitId: s,
|
|
2938
|
-
subUnitId:
|
|
2938
|
+
subUnitId: n,
|
|
2939
2939
|
direction: i,
|
|
2940
2940
|
range: {
|
|
2941
2941
|
startRow: o,
|
|
2942
2942
|
endRow: a,
|
|
2943
2943
|
startColumn: h,
|
|
2944
|
-
endColumn:
|
|
2944
|
+
endColumn: c
|
|
2945
2945
|
},
|
|
2946
|
-
cellValue:
|
|
2946
|
+
cellValue: d
|
|
2947
2947
|
}), this;
|
|
2948
2948
|
}
|
|
2949
2949
|
/**
|
|
@@ -2961,18 +2961,18 @@ let v = class extends He {
|
|
|
2961
2961
|
* ```
|
|
2962
2962
|
*/
|
|
2963
2963
|
insertColumnsBefore(e, t) {
|
|
2964
|
-
const s = this._workbook.getUnitId(),
|
|
2964
|
+
const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = oe.LEFT, o = 0, a = this._worksheet.getRowCount() - 1, h = e, c = e + t - 1, d = ae(this._worksheet, o, a, h, c, !1, e - 1);
|
|
2965
2965
|
return this._commandService.syncExecuteCommand(at.id, {
|
|
2966
2966
|
unitId: s,
|
|
2967
|
-
subUnitId:
|
|
2967
|
+
subUnitId: n,
|
|
2968
2968
|
direction: i,
|
|
2969
2969
|
range: {
|
|
2970
2970
|
startRow: o,
|
|
2971
2971
|
endRow: a,
|
|
2972
2972
|
startColumn: h,
|
|
2973
|
-
endColumn:
|
|
2973
|
+
endColumn: c
|
|
2974
2974
|
},
|
|
2975
|
-
cellValue:
|
|
2975
|
+
cellValue: d
|
|
2976
2976
|
}), this;
|
|
2977
2977
|
}
|
|
2978
2978
|
/**
|
|
@@ -3012,7 +3012,7 @@ let v = class extends He {
|
|
|
3012
3012
|
startColumn: e,
|
|
3013
3013
|
endColumn: e + t - 1
|
|
3014
3014
|
};
|
|
3015
|
-
return this._commandService.syncExecuteCommand(
|
|
3015
|
+
return this._commandService.syncExecuteCommand(Ls.id, {
|
|
3016
3016
|
range: s,
|
|
3017
3017
|
unitId: this._workbook.getUnitId(),
|
|
3018
3018
|
subUnitId: this._worksheet.getSheetId()
|
|
@@ -3035,15 +3035,15 @@ let v = class extends He {
|
|
|
3035
3035
|
* ```
|
|
3036
3036
|
*/
|
|
3037
3037
|
moveColumns(e, t) {
|
|
3038
|
-
const s = this._workbook.getUnitId(),
|
|
3038
|
+
const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = Ee(e.getRange(), this._worksheet), o = i, a = {
|
|
3039
3039
|
startRow: 0,
|
|
3040
3040
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3041
3041
|
startColumn: t,
|
|
3042
3042
|
endColumn: t
|
|
3043
3043
|
};
|
|
3044
|
-
return this._commandService.syncExecuteCommand(
|
|
3044
|
+
return this._commandService.syncExecuteCommand(Gs.id, {
|
|
3045
3045
|
unitId: s,
|
|
3046
|
-
subUnitId:
|
|
3046
|
+
subUnitId: n,
|
|
3047
3047
|
range: i,
|
|
3048
3048
|
fromRange: o,
|
|
3049
3049
|
toRange: a
|
|
@@ -3065,11 +3065,11 @@ let v = class extends He {
|
|
|
3065
3065
|
* ```
|
|
3066
3066
|
*/
|
|
3067
3067
|
hideColumn(e) {
|
|
3068
|
-
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(),
|
|
3068
|
+
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), n = Ee(e.getRange(), this._worksheet);
|
|
3069
3069
|
return this._commandService.syncExecuteCommand(ht.id, {
|
|
3070
3070
|
unitId: t,
|
|
3071
3071
|
subUnitId: s,
|
|
3072
|
-
ranges: [
|
|
3072
|
+
ranges: [n]
|
|
3073
3073
|
}), this;
|
|
3074
3074
|
}
|
|
3075
3075
|
/**
|
|
@@ -3087,7 +3087,7 @@ let v = class extends He {
|
|
|
3087
3087
|
* ```
|
|
3088
3088
|
*/
|
|
3089
3089
|
hideColumns(e, t = 1) {
|
|
3090
|
-
const s = this._workbook.getUnitId(),
|
|
3090
|
+
const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = {
|
|
3091
3091
|
startRow: 0,
|
|
3092
3092
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3093
3093
|
startColumn: e,
|
|
@@ -3096,7 +3096,7 @@ let v = class extends He {
|
|
|
3096
3096
|
};
|
|
3097
3097
|
return this._commandService.syncExecuteCommand(ht.id, {
|
|
3098
3098
|
unitId: s,
|
|
3099
|
-
subUnitId:
|
|
3099
|
+
subUnitId: n,
|
|
3100
3100
|
ranges: [i]
|
|
3101
3101
|
}), this;
|
|
3102
3102
|
}
|
|
@@ -3116,11 +3116,11 @@ let v = class extends He {
|
|
|
3116
3116
|
* ```
|
|
3117
3117
|
*/
|
|
3118
3118
|
unhideColumn(e) {
|
|
3119
|
-
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(),
|
|
3120
|
-
return this._commandService.syncExecuteCommand(
|
|
3119
|
+
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), n = Ee(e.getRange(), this._worksheet);
|
|
3120
|
+
return this._commandService.syncExecuteCommand(dt.id, {
|
|
3121
3121
|
unitId: t,
|
|
3122
3122
|
subUnitId: s,
|
|
3123
|
-
ranges: [
|
|
3123
|
+
ranges: [n]
|
|
3124
3124
|
}), this;
|
|
3125
3125
|
}
|
|
3126
3126
|
/**
|
|
@@ -3138,16 +3138,16 @@ let v = class extends He {
|
|
|
3138
3138
|
* ```
|
|
3139
3139
|
*/
|
|
3140
3140
|
showColumns(e, t = 1) {
|
|
3141
|
-
const s = this._workbook.getUnitId(),
|
|
3141
|
+
const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = {
|
|
3142
3142
|
startRow: 0,
|
|
3143
3143
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3144
3144
|
startColumn: e,
|
|
3145
3145
|
endColumn: e + t - 1,
|
|
3146
3146
|
rangeType: p.COLUMN
|
|
3147
3147
|
};
|
|
3148
|
-
return this._commandService.syncExecuteCommand(
|
|
3148
|
+
return this._commandService.syncExecuteCommand(dt.id, {
|
|
3149
3149
|
unitId: s,
|
|
3150
|
-
subUnitId:
|
|
3150
|
+
subUnitId: n,
|
|
3151
3151
|
ranges: [i]
|
|
3152
3152
|
}), this;
|
|
3153
3153
|
}
|
|
@@ -3180,7 +3180,7 @@ let v = class extends He {
|
|
|
3180
3180
|
* ```
|
|
3181
3181
|
*/
|
|
3182
3182
|
setColumnWidths(e, t, s) {
|
|
3183
|
-
const
|
|
3183
|
+
const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = [
|
|
3184
3184
|
{
|
|
3185
3185
|
startColumn: e,
|
|
3186
3186
|
endColumn: e + t - 1,
|
|
@@ -3188,8 +3188,8 @@ let v = class extends He {
|
|
|
3188
3188
|
endRow: this._worksheet.getRowCount() - 1
|
|
3189
3189
|
}
|
|
3190
3190
|
];
|
|
3191
|
-
return this._commandService.syncExecuteCommand(
|
|
3192
|
-
unitId:
|
|
3191
|
+
return this._commandService.syncExecuteCommand(Ks.id, {
|
|
3192
|
+
unitId: n,
|
|
3193
3193
|
subUnitId: i,
|
|
3194
3194
|
ranges: o,
|
|
3195
3195
|
value: s
|
|
@@ -3230,15 +3230,15 @@ let v = class extends He {
|
|
|
3230
3230
|
* ```
|
|
3231
3231
|
*/
|
|
3232
3232
|
setColumnCustom(e) {
|
|
3233
|
-
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(),
|
|
3233
|
+
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), n = {};
|
|
3234
3234
|
for (const [o, a] of Object.entries(e))
|
|
3235
|
-
|
|
3235
|
+
n[Number(o)] = {
|
|
3236
3236
|
custom: a
|
|
3237
3237
|
};
|
|
3238
3238
|
const i = {
|
|
3239
3239
|
unitId: t,
|
|
3240
3240
|
subUnitId: s,
|
|
3241
|
-
columnData:
|
|
3241
|
+
columnData: n
|
|
3242
3242
|
};
|
|
3243
3243
|
return this._commandService.syncExecuteCommand(tt.id, i), this;
|
|
3244
3244
|
}
|
|
@@ -3292,9 +3292,9 @@ let v = class extends He {
|
|
|
3292
3292
|
* ```
|
|
3293
3293
|
*/
|
|
3294
3294
|
getCellMergeData(e, t) {
|
|
3295
|
-
const
|
|
3296
|
-
if (
|
|
3297
|
-
return this._injector.createInstance(R, this._workbook, this._worksheet,
|
|
3295
|
+
const n = this._worksheet.getMergedCell(e, t);
|
|
3296
|
+
if (n)
|
|
3297
|
+
return this._injector.createInstance(R, this._workbook, this._worksheet, n);
|
|
3298
3298
|
}
|
|
3299
3299
|
// #endregion
|
|
3300
3300
|
/**
|
|
@@ -3377,7 +3377,7 @@ let v = class extends He {
|
|
|
3377
3377
|
* ```
|
|
3378
3378
|
*/
|
|
3379
3379
|
cancelFreeze() {
|
|
3380
|
-
return this._commandService.syncExecuteCommand(
|
|
3380
|
+
return this._commandService.syncExecuteCommand(Js.id, {
|
|
3381
3381
|
unitId: this._workbook.getUnitId(),
|
|
3382
3382
|
subUnitId: this.getSheetId()
|
|
3383
3383
|
}), this;
|
|
@@ -3406,10 +3406,10 @@ let v = class extends He {
|
|
|
3406
3406
|
xSplit: s
|
|
3407
3407
|
});
|
|
3408
3408
|
} else if (arguments.length === 2) {
|
|
3409
|
-
let [s = 0,
|
|
3410
|
-
s >
|
|
3411
|
-
startColumn:
|
|
3412
|
-
xSplit:
|
|
3409
|
+
let [s = 0, n = 0] = e;
|
|
3410
|
+
s > n && ([s, n] = [n, s]), this._commandService.syncExecuteCommand(ve.id, {
|
|
3411
|
+
startColumn: n + 1,
|
|
3412
|
+
xSplit: n - s + 1,
|
|
3413
3413
|
startRow: t.startRow,
|
|
3414
3414
|
ySplit: t.ySplit,
|
|
3415
3415
|
unitId: this._workbook.getUnitId(),
|
|
@@ -3428,10 +3428,10 @@ let v = class extends He {
|
|
|
3428
3428
|
ySplit: s
|
|
3429
3429
|
});
|
|
3430
3430
|
} else if (arguments.length === 2) {
|
|
3431
|
-
let [s = 0,
|
|
3432
|
-
s >
|
|
3433
|
-
startRow:
|
|
3434
|
-
ySplit:
|
|
3431
|
+
let [s = 0, n = 0] = e;
|
|
3432
|
+
s > n && ([s, n] = [n, s]), this._commandService.syncExecuteCommand(ve.id, {
|
|
3433
|
+
startRow: n + 1,
|
|
3434
|
+
ySplit: n - s + 1,
|
|
3435
3435
|
startColumn: t.startColumn,
|
|
3436
3436
|
xSplit: t.xSplit,
|
|
3437
3437
|
unitId: this._workbook.getUnitId(),
|
|
@@ -3584,7 +3584,7 @@ let v = class extends He {
|
|
|
3584
3584
|
* ```
|
|
3585
3585
|
*/
|
|
3586
3586
|
setTabColor(e) {
|
|
3587
|
-
return this._commandService.syncExecuteCommand(
|
|
3587
|
+
return this._commandService.syncExecuteCommand(qs.id, {
|
|
3588
3588
|
unitId: this._workbook.getUnitId(),
|
|
3589
3589
|
subUnitId: this._worksheet.getSheetId(),
|
|
3590
3590
|
value: e
|
|
@@ -3610,9 +3610,9 @@ let v = class extends He {
|
|
|
3610
3610
|
*/
|
|
3611
3611
|
onCellDataChange(e) {
|
|
3612
3612
|
return this._injector.get(C).onCommandExecuted((s) => {
|
|
3613
|
-
if (s.id ===
|
|
3614
|
-
const
|
|
3615
|
-
|
|
3613
|
+
if (s.id === ct.id) {
|
|
3614
|
+
const n = s.params;
|
|
3615
|
+
n.unitId === this._workbook.getUnitId() && n.subUnitId === this._worksheet.getSheetId() && n.cellValue && e(new Ie(n.cellValue));
|
|
3616
3616
|
}
|
|
3617
3617
|
});
|
|
3618
3618
|
}
|
|
@@ -3621,9 +3621,9 @@ let v = class extends He {
|
|
|
3621
3621
|
*/
|
|
3622
3622
|
onBeforeCellDataChange(e) {
|
|
3623
3623
|
return this._injector.get(C).beforeCommandExecuted((s) => {
|
|
3624
|
-
if (s.id ===
|
|
3625
|
-
const
|
|
3626
|
-
|
|
3624
|
+
if (s.id === ct.id) {
|
|
3625
|
+
const n = s.params;
|
|
3626
|
+
n.unitId === this._workbook.getUnitId() && n.subUnitId === this._worksheet.getSheetId() && n.cellValue && e(new Ie(n.cellValue));
|
|
3627
3627
|
}
|
|
3628
3628
|
});
|
|
3629
3629
|
}
|
|
@@ -3642,7 +3642,7 @@ let v = class extends He {
|
|
|
3642
3642
|
const e = this._injector.get(C);
|
|
3643
3643
|
if (this._workbook.getSheets().filter((i) => i.isSheetHidden() !== I.TRUE).length <= 1)
|
|
3644
3644
|
throw new Error("Cannot hide the only visible sheet");
|
|
3645
|
-
return e.syncExecuteCommand(
|
|
3645
|
+
return e.syncExecuteCommand(Ys.id, {
|
|
3646
3646
|
unitId: this._workbook.getUnitId(),
|
|
3647
3647
|
subUnitId: this._worksheet.getSheetId()
|
|
3648
3648
|
}), this;
|
|
@@ -3659,7 +3659,7 @@ let v = class extends He {
|
|
|
3659
3659
|
* ```
|
|
3660
3660
|
*/
|
|
3661
3661
|
showSheet() {
|
|
3662
|
-
return this._injector.get(C).syncExecuteCommand(
|
|
3662
|
+
return this._injector.get(C).syncExecuteCommand(Zs.id, {
|
|
3663
3663
|
unitId: this._workbook.getUnitId(),
|
|
3664
3664
|
subUnitId: this._worksheet.getSheetId()
|
|
3665
3665
|
}), this;
|
|
@@ -3747,13 +3747,13 @@ let v = class extends He {
|
|
|
3747
3747
|
return this.clearContents();
|
|
3748
3748
|
if (e && e.formatOnly && !e.contentsOnly)
|
|
3749
3749
|
return this.clearFormats();
|
|
3750
|
-
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(),
|
|
3750
|
+
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), n = this._injector.get(C), i = {
|
|
3751
3751
|
startRow: 0,
|
|
3752
3752
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3753
3753
|
startColumn: 0,
|
|
3754
3754
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
3755
3755
|
};
|
|
3756
|
-
return
|
|
3756
|
+
return n.syncExecuteCommand(xt.id, {
|
|
3757
3757
|
unitId: t,
|
|
3758
3758
|
subUnitId: s,
|
|
3759
3759
|
ranges: [i],
|
|
@@ -3772,16 +3772,16 @@ let v = class extends He {
|
|
|
3772
3772
|
* ```
|
|
3773
3773
|
*/
|
|
3774
3774
|
clearContents() {
|
|
3775
|
-
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), s = this._injector.get(C),
|
|
3775
|
+
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), s = this._injector.get(C), n = {
|
|
3776
3776
|
startRow: 0,
|
|
3777
3777
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3778
3778
|
startColumn: 0,
|
|
3779
3779
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
3780
3780
|
};
|
|
3781
|
-
return s.syncExecuteCommand(
|
|
3781
|
+
return s.syncExecuteCommand(Dt.id, {
|
|
3782
3782
|
unitId: e,
|
|
3783
3783
|
subUnitId: t,
|
|
3784
|
-
ranges: [
|
|
3784
|
+
ranges: [n]
|
|
3785
3785
|
}), this;
|
|
3786
3786
|
}
|
|
3787
3787
|
/**
|
|
@@ -3796,16 +3796,16 @@ let v = class extends He {
|
|
|
3796
3796
|
* ```
|
|
3797
3797
|
*/
|
|
3798
3798
|
clearFormats() {
|
|
3799
|
-
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), s = this._injector.get(C),
|
|
3799
|
+
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), s = this._injector.get(C), n = {
|
|
3800
3800
|
startRow: 0,
|
|
3801
3801
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3802
3802
|
startColumn: 0,
|
|
3803
3803
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
3804
3804
|
};
|
|
3805
|
-
return s.syncExecuteCommand(
|
|
3805
|
+
return s.syncExecuteCommand(Mt.id, {
|
|
3806
3806
|
unitId: e,
|
|
3807
3807
|
subUnitId: t,
|
|
3808
|
-
ranges: [
|
|
3808
|
+
ranges: [n]
|
|
3809
3809
|
}), this;
|
|
3810
3810
|
}
|
|
3811
3811
|
/**
|
|
@@ -3823,8 +3823,8 @@ let v = class extends He {
|
|
|
3823
3823
|
* ```
|
|
3824
3824
|
*/
|
|
3825
3825
|
getDataRange() {
|
|
3826
|
-
const { startRow: e, endRow: t, startColumn: s, endColumn:
|
|
3827
|
-
return this.getRange(e, s, t - e + 1,
|
|
3826
|
+
const { startRow: e, endRow: t, startColumn: s, endColumn: n } = this._worksheet.getDataRealRange();
|
|
3827
|
+
return this.getRange(e, s, t - e + 1, n - s + 1);
|
|
3828
3828
|
}
|
|
3829
3829
|
/**
|
|
3830
3830
|
* @deprecated use `getLastColumn` instead.
|
|
@@ -3901,8 +3901,8 @@ let v = class extends He {
|
|
|
3901
3901
|
* ```
|
|
3902
3902
|
*/
|
|
3903
3903
|
insertDefinedName(e, t) {
|
|
3904
|
-
const
|
|
3905
|
-
|
|
3904
|
+
const n = this._injector.createInstance(Ce).setName(e).setRef(t).build();
|
|
3905
|
+
n.localSheetId = this.getSheetId(), this._fWorkbook.insertDefinedNameBuilder(n);
|
|
3906
3906
|
}
|
|
3907
3907
|
/**
|
|
3908
3908
|
* Get all the defined names in the worksheet.
|
|
@@ -4020,16 +4020,16 @@ let v = class extends He {
|
|
|
4020
4020
|
* ```
|
|
4021
4021
|
*/
|
|
4022
4022
|
appendRow(e) {
|
|
4023
|
-
const t = this._worksheet.getCellMatrix().hasValue(), s = this._worksheet.getLastRowWithContent(),
|
|
4023
|
+
const t = this._worksheet.getCellMatrix().hasValue(), s = this._worksheet.getLastRowWithContent(), n = this._worksheet.getRowCount(), i = this._worksheet.getColumnCount(), o = t ? s + 1 : s, a = new Ie();
|
|
4024
4024
|
for (let h = 0; h < e.length; h++)
|
|
4025
4025
|
a.setValue(o, h, xe(e[h]));
|
|
4026
|
-
return this._commandService.syncExecuteCommand(
|
|
4026
|
+
return this._commandService.syncExecuteCommand(Qs.id, {
|
|
4027
4027
|
unitId: this._workbook.getUnitId(),
|
|
4028
4028
|
subUnitId: this._worksheet.getSheetId(),
|
|
4029
4029
|
cellValue: a.getMatrix(),
|
|
4030
|
-
insertRowNums: o >
|
|
4030
|
+
insertRowNums: o > n - 1 ? 1 : 0,
|
|
4031
4031
|
insertColumnNums: e.length > i ? e.length - i : 0,
|
|
4032
|
-
maxRows:
|
|
4032
|
+
maxRows: n,
|
|
4033
4033
|
maxColumns: i
|
|
4034
4034
|
}), this;
|
|
4035
4035
|
}
|
|
@@ -4047,7 +4047,7 @@ let v = class extends He {
|
|
|
4047
4047
|
* ```
|
|
4048
4048
|
*/
|
|
4049
4049
|
setRowCount(e) {
|
|
4050
|
-
return this._commandService.syncExecuteCommand(
|
|
4050
|
+
return this._commandService.syncExecuteCommand(Xs.id, {
|
|
4051
4051
|
unitId: this._workbook.getUnitId(),
|
|
4052
4052
|
subUnitId: this._worksheet.getSheetId(),
|
|
4053
4053
|
rowCount: e
|
|
@@ -4067,7 +4067,7 @@ let v = class extends He {
|
|
|
4067
4067
|
* ```
|
|
4068
4068
|
*/
|
|
4069
4069
|
setColumnCount(e) {
|
|
4070
|
-
return this._commandService.syncExecuteCommand(
|
|
4070
|
+
return this._commandService.syncExecuteCommand(en.id, {
|
|
4071
4071
|
unitId: this._workbook.getUnitId(),
|
|
4072
4072
|
subUnitId: this._worksheet.getSheetId(),
|
|
4073
4073
|
columnCount: e
|
|
@@ -4109,19 +4109,19 @@ let v = class extends He {
|
|
|
4109
4109
|
);
|
|
4110
4110
|
}
|
|
4111
4111
|
};
|
|
4112
|
-
v =
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4112
|
+
v = Ln([
|
|
4113
|
+
ce(3, l(P)),
|
|
4114
|
+
ce(4, l(Ut)),
|
|
4115
|
+
ce(5, l(It)),
|
|
4116
|
+
ce(6, C)
|
|
4117
4117
|
], v);
|
|
4118
|
-
var
|
|
4119
|
-
for (var
|
|
4120
|
-
(o =
|
|
4121
|
-
return
|
|
4122
|
-
}, ee = (
|
|
4118
|
+
var Gn = Object.getOwnPropertyDescriptor, Kn = (r, e, t, s) => {
|
|
4119
|
+
for (var n = s > 1 ? void 0 : s ? Gn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
4120
|
+
(o = r[i]) && (n = o(n) || n);
|
|
4121
|
+
return n;
|
|
4122
|
+
}, ee = (r, e) => (t, s) => e(t, s, r);
|
|
4123
4123
|
let Ae = class {
|
|
4124
|
-
constructor(
|
|
4124
|
+
constructor(r, e, t, s, n, i, o, a, h) {
|
|
4125
4125
|
w(this, "_permissionSubject");
|
|
4126
4126
|
w(this, "_subscriptions", []);
|
|
4127
4127
|
w(this, "_fPermission");
|
|
@@ -4135,14 +4135,14 @@ let Ae = class {
|
|
|
4135
4135
|
* @returns Observable that emits when protection state changes
|
|
4136
4136
|
*/
|
|
4137
4137
|
w(this, "protectionChange$");
|
|
4138
|
-
this._unitId =
|
|
4138
|
+
this._unitId = r, this._subUnitId = e, this._range = t, this._worksheet = s, this._injector = n, this._permissionService = i, this._authzIoService = o, this._commandService = a, this._rangeProtectionRuleModel = h, this._fPermission = this._injector.createInstance(z), this._permissionSubject = new ge(this._buildSnapshot()), this.permission$ = this._createPermissionStream(), this.protectionChange$ = this._createProtectionChangeStream();
|
|
4139
4139
|
}
|
|
4140
4140
|
/**
|
|
4141
4141
|
* Create permission snapshot stream from IPermissionService
|
|
4142
4142
|
* @private
|
|
4143
4143
|
*/
|
|
4144
4144
|
_createPermissionStream() {
|
|
4145
|
-
const
|
|
4145
|
+
const r = this._permissionService.permissionPointUpdate$.pipe(
|
|
4146
4146
|
D((e) => {
|
|
4147
4147
|
const t = e.id;
|
|
4148
4148
|
return t.includes(this._unitId) && t.includes(this._subUnitId);
|
|
@@ -4150,7 +4150,7 @@ let Ae = class {
|
|
|
4150
4150
|
).subscribe(() => {
|
|
4151
4151
|
this._permissionSubject.next(this._buildSnapshot());
|
|
4152
4152
|
});
|
|
4153
|
-
return this._subscriptions.push(
|
|
4153
|
+
return this._subscriptions.push(r), this._permissionSubject.asObservable().pipe(
|
|
4154
4154
|
_e((e, t) => JSON.stringify(e) === JSON.stringify(t)),
|
|
4155
4155
|
N({ bufferSize: 1, refCount: !0 })
|
|
4156
4156
|
);
|
|
@@ -4161,13 +4161,13 @@ let Ae = class {
|
|
|
4161
4161
|
*/
|
|
4162
4162
|
_createProtectionChangeStream() {
|
|
4163
4163
|
return this._rangeProtectionRuleModel.ruleChange$.pipe(
|
|
4164
|
-
D((
|
|
4165
|
-
we((
|
|
4164
|
+
D((r) => r.unitId !== this._unitId || r.subUnitId !== this._subUnitId ? !1 : r.type === "delete" ? this._rangeMatches(r.rule) : r.type === "add" ? this._rangeMatches(r.rule) : !1),
|
|
4165
|
+
we((r) => (this._permissionSubject.next(this._buildSnapshot()), r.type === "delete" ? {
|
|
4166
4166
|
type: "unprotected",
|
|
4167
|
-
ruleId:
|
|
4167
|
+
ruleId: r.rule.id
|
|
4168
4168
|
} : {
|
|
4169
4169
|
type: "protected",
|
|
4170
|
-
rule: this._createFacadeRule(
|
|
4170
|
+
rule: this._createFacadeRule(r.rule)
|
|
4171
4171
|
})),
|
|
4172
4172
|
N({ bufferSize: 1, refCount: !0 })
|
|
4173
4173
|
);
|
|
@@ -4175,17 +4175,17 @@ let Ae = class {
|
|
|
4175
4175
|
/**
|
|
4176
4176
|
* Check if a protection rule matches this range
|
|
4177
4177
|
*/
|
|
4178
|
-
_rangeMatches(
|
|
4178
|
+
_rangeMatches(r) {
|
|
4179
4179
|
const e = this._range.getRange();
|
|
4180
|
-
return
|
|
4180
|
+
return r.ranges.some(
|
|
4181
4181
|
(t) => e.startRow === t.startRow && e.startColumn === t.startColumn && e.endRow === t.endRow && e.endColumn === t.endColumn
|
|
4182
4182
|
);
|
|
4183
4183
|
}
|
|
4184
4184
|
/**
|
|
4185
4185
|
* Create a Facade rule from internal rule
|
|
4186
4186
|
*/
|
|
4187
|
-
_createFacadeRule(
|
|
4188
|
-
const e =
|
|
4187
|
+
_createFacadeRule(r) {
|
|
4188
|
+
const e = r.ranges.map(
|
|
4189
4189
|
(s) => this._worksheet.getRange(
|
|
4190
4190
|
s.startRow,
|
|
4191
4191
|
s.startColumn,
|
|
@@ -4193,16 +4193,16 @@ let Ae = class {
|
|
|
4193
4193
|
s.endColumn - s.startColumn + 1
|
|
4194
4194
|
)
|
|
4195
4195
|
), t = {
|
|
4196
|
-
name:
|
|
4197
|
-
allowViewByOthers:
|
|
4198
|
-
allowEdit:
|
|
4196
|
+
name: r.description || "",
|
|
4197
|
+
allowViewByOthers: r.viewState !== U.NoOneElseCanView,
|
|
4198
|
+
allowEdit: r.editState === x.DesignedUserCanEdit
|
|
4199
4199
|
};
|
|
4200
4200
|
return this._injector.createInstance(
|
|
4201
4201
|
O,
|
|
4202
4202
|
this._unitId,
|
|
4203
4203
|
this._subUnitId,
|
|
4204
|
-
|
|
4205
|
-
|
|
4204
|
+
r.id,
|
|
4205
|
+
r.permissionId,
|
|
4206
4206
|
e,
|
|
4207
4207
|
t
|
|
4208
4208
|
);
|
|
@@ -4219,15 +4219,15 @@ let Ae = class {
|
|
|
4219
4219
|
* console.log(canEdit);
|
|
4220
4220
|
* ```
|
|
4221
4221
|
*/
|
|
4222
|
-
getPoint(
|
|
4223
|
-
const e = se[
|
|
4222
|
+
getPoint(r) {
|
|
4223
|
+
const e = se[r];
|
|
4224
4224
|
if (!e)
|
|
4225
|
-
return console.warn(`Unknown permission point: ${
|
|
4225
|
+
return console.warn(`Unknown permission point: ${r}`), !1;
|
|
4226
4226
|
const t = this._getProtectionRule();
|
|
4227
4227
|
if (t) {
|
|
4228
|
-
const s = new e(this._unitId, this._subUnitId, t.permissionId),
|
|
4229
|
-
if (
|
|
4230
|
-
return
|
|
4228
|
+
const s = new e(this._unitId, this._subUnitId, t.permissionId), n = this._permissionService.getPermissionPoint(s.id);
|
|
4229
|
+
if (n)
|
|
4230
|
+
return n.value;
|
|
4231
4231
|
}
|
|
4232
4232
|
return !0;
|
|
4233
4233
|
}
|
|
@@ -4349,14 +4349,14 @@ let Ae = class {
|
|
|
4349
4349
|
* await permission?.setPoint(univerAPI.Enum.RangePermissionPoint.View, true); // Ensure view is enabled
|
|
4350
4350
|
* ```
|
|
4351
4351
|
*/
|
|
4352
|
-
async setPoint(
|
|
4353
|
-
const t = se[
|
|
4352
|
+
async setPoint(r, e) {
|
|
4353
|
+
const t = se[r];
|
|
4354
4354
|
if (!t)
|
|
4355
|
-
throw new Error(`Unknown permission point: ${
|
|
4355
|
+
throw new Error(`Unknown permission point: ${r}`);
|
|
4356
4356
|
const s = this._getProtectionRule();
|
|
4357
4357
|
if (!s)
|
|
4358
4358
|
throw new Error("Cannot set permission point: No protection rule exists for this range. Call protect() first.");
|
|
4359
|
-
if (this.getPoint(
|
|
4359
|
+
if (this.getPoint(r) === e)
|
|
4360
4360
|
return;
|
|
4361
4361
|
const i = s.permissionId;
|
|
4362
4362
|
this._fPermission.setRangeProtectionPermissionPoint(this._unitId, this._subUnitId, i, t, e), this._permissionSubject.next(this._buildSnapshot());
|
|
@@ -4378,60 +4378,60 @@ let Ae = class {
|
|
|
4378
4378
|
* console.log(rule);
|
|
4379
4379
|
* ```
|
|
4380
4380
|
*/
|
|
4381
|
-
async protect(
|
|
4381
|
+
async protect(r) {
|
|
4382
4382
|
if (this.isProtected())
|
|
4383
4383
|
throw new Error("Range is already protected");
|
|
4384
4384
|
const e = await this._fPermission.addRangeBaseProtection(
|
|
4385
4385
|
this._unitId,
|
|
4386
4386
|
this._subUnitId,
|
|
4387
4387
|
[this._range],
|
|
4388
|
-
|
|
4388
|
+
r
|
|
4389
4389
|
);
|
|
4390
4390
|
if (!e)
|
|
4391
4391
|
throw new Error("Failed to create range protection");
|
|
4392
4392
|
const { permissionId: t, ruleId: s } = e;
|
|
4393
|
-
return await this._setPermissionPoints(t,
|
|
4393
|
+
return await this._setPermissionPoints(t, r), this._injector.createInstance(
|
|
4394
4394
|
O,
|
|
4395
4395
|
this._unitId,
|
|
4396
4396
|
this._subUnitId,
|
|
4397
4397
|
s,
|
|
4398
4398
|
t,
|
|
4399
4399
|
[this._range],
|
|
4400
|
-
|
|
4400
|
+
r || {}
|
|
4401
4401
|
);
|
|
4402
4402
|
}
|
|
4403
4403
|
/**
|
|
4404
4404
|
* Determine view state from options
|
|
4405
4405
|
* @private
|
|
4406
4406
|
*/
|
|
4407
|
-
_determineViewState(
|
|
4408
|
-
return (
|
|
4407
|
+
_determineViewState(r) {
|
|
4408
|
+
return (r == null ? void 0 : r.allowViewByOthers) === !1 ? U.NoOneElseCanView : U.OthersCanView;
|
|
4409
4409
|
}
|
|
4410
4410
|
/**
|
|
4411
4411
|
* Determine edit state from options
|
|
4412
4412
|
* @private
|
|
4413
4413
|
*/
|
|
4414
|
-
_determineEditState(
|
|
4414
|
+
_determineEditState(r) {
|
|
4415
4415
|
var e;
|
|
4416
|
-
return (
|
|
4416
|
+
return (r == null ? void 0 : r.allowEdit) === !0 && ((e = r == null ? void 0 : r.allowedUsers) != null && e.length) ? x.DesignedUserCanEdit : x.OnlyMe;
|
|
4417
4417
|
}
|
|
4418
4418
|
/**
|
|
4419
4419
|
* Set permission points based on options (for local runtime control)
|
|
4420
4420
|
* @private
|
|
4421
4421
|
*/
|
|
4422
|
-
async _setPermissionPoints(
|
|
4422
|
+
async _setPermissionPoints(r, e) {
|
|
4423
4423
|
if (!e)
|
|
4424
4424
|
return;
|
|
4425
|
-
const t = (s,
|
|
4426
|
-
await this._setPermissionPoint(
|
|
4425
|
+
const t = (s, n) => s === void 0 ? n : typeof s == "boolean" ? s : !0;
|
|
4426
|
+
await this._setPermissionPoint(r, b.Edit, t(e.allowEdit, !1)), await this._setPermissionPoint(r, b.View, t(e.allowViewByOthers, !0));
|
|
4427
4427
|
}
|
|
4428
4428
|
/**
|
|
4429
4429
|
* Set a single permission point
|
|
4430
4430
|
* @private
|
|
4431
4431
|
*/
|
|
4432
|
-
async _setPermissionPoint(
|
|
4432
|
+
async _setPermissionPoint(r, e, t) {
|
|
4433
4433
|
const s = se[e];
|
|
4434
|
-
s && this._fPermission.setRangeProtectionPermissionPoint(this._unitId, this._subUnitId,
|
|
4434
|
+
s && this._fPermission.setRangeProtectionPermissionPoint(this._unitId, this._subUnitId, r, s, t);
|
|
4435
4435
|
}
|
|
4436
4436
|
/**
|
|
4437
4437
|
* Unprotect the current range.
|
|
@@ -4444,10 +4444,10 @@ let Ae = class {
|
|
|
4444
4444
|
* ```
|
|
4445
4445
|
*/
|
|
4446
4446
|
async unprotect() {
|
|
4447
|
-
const
|
|
4448
|
-
if (!
|
|
4447
|
+
const r = this._getProtectionRule();
|
|
4448
|
+
if (!r)
|
|
4449
4449
|
return;
|
|
4450
|
-
const e =
|
|
4450
|
+
const e = r.id;
|
|
4451
4451
|
this._fPermission.removeRangeProtection(this._unitId, this._subUnitId, [e]);
|
|
4452
4452
|
}
|
|
4453
4453
|
/**
|
|
@@ -4479,16 +4479,16 @@ let Ae = class {
|
|
|
4479
4479
|
* unsubscribe?.();
|
|
4480
4480
|
* ```
|
|
4481
4481
|
*/
|
|
4482
|
-
subscribe(
|
|
4483
|
-
const e = this.permission$.subscribe(
|
|
4482
|
+
subscribe(r) {
|
|
4483
|
+
const e = this.permission$.subscribe(r);
|
|
4484
4484
|
return () => e.unsubscribe();
|
|
4485
4485
|
}
|
|
4486
4486
|
/**
|
|
4487
4487
|
* Get the protection rule for the current range
|
|
4488
4488
|
*/
|
|
4489
4489
|
_getProtectionRule() {
|
|
4490
|
-
const
|
|
4491
|
-
for (const t of
|
|
4490
|
+
const r = this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId, this._subUnitId), e = this._range.getRange();
|
|
4491
|
+
for (const t of r)
|
|
4492
4492
|
for (const s of t.ranges)
|
|
4493
4493
|
if (e.startRow === s.startRow && e.startColumn === s.startColumn && e.endRow === s.endRow && e.endColumn === s.endColumn)
|
|
4494
4494
|
return t;
|
|
@@ -4500,11 +4500,11 @@ let Ae = class {
|
|
|
4500
4500
|
_buildProtectionRules() {
|
|
4501
4501
|
return this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId, this._subUnitId).map((e) => {
|
|
4502
4502
|
const t = e.ranges.map(
|
|
4503
|
-
(
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4503
|
+
(n) => this._worksheet.getRange(
|
|
4504
|
+
n.startRow,
|
|
4505
|
+
n.startColumn,
|
|
4506
|
+
n.endRow - n.startRow + 1,
|
|
4507
|
+
n.endColumn - n.startColumn + 1
|
|
4508
4508
|
)
|
|
4509
4509
|
), s = {
|
|
4510
4510
|
name: e.description || "",
|
|
@@ -4526,9 +4526,9 @@ let Ae = class {
|
|
|
4526
4526
|
* @private
|
|
4527
4527
|
*/
|
|
4528
4528
|
async _buildProtectionRulesAsync() {
|
|
4529
|
-
const
|
|
4529
|
+
const r = this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId, this._subUnitId);
|
|
4530
4530
|
return (await Promise.all(
|
|
4531
|
-
|
|
4531
|
+
r.map(async (t) => {
|
|
4532
4532
|
const s = t.ranges.map(
|
|
4533
4533
|
(i) => this._worksheet.getRange(
|
|
4534
4534
|
i.startRow,
|
|
@@ -4536,7 +4536,7 @@ let Ae = class {
|
|
|
4536
4536
|
i.endRow - i.startRow + 1,
|
|
4537
4537
|
i.endColumn - i.startColumn + 1
|
|
4538
4538
|
)
|
|
4539
|
-
),
|
|
4539
|
+
), n = {
|
|
4540
4540
|
name: t.description || "",
|
|
4541
4541
|
allowViewByOthers: t.viewState !== U.NoOneElseCanView
|
|
4542
4542
|
};
|
|
@@ -4549,27 +4549,27 @@ let Ae = class {
|
|
|
4549
4549
|
var h;
|
|
4550
4550
|
return ((h = a.subject) == null ? void 0 : h.userID) || a.id;
|
|
4551
4551
|
});
|
|
4552
|
-
|
|
4552
|
+
n.allowEdit = o.length > 0;
|
|
4553
4553
|
} catch (i) {
|
|
4554
|
-
console.warn(`Failed to fetch collaborators for rule ${t.id}:`, i),
|
|
4554
|
+
console.warn(`Failed to fetch collaborators for rule ${t.id}:`, i), n.allowEdit = !1;
|
|
4555
4555
|
}
|
|
4556
4556
|
else
|
|
4557
|
-
|
|
4557
|
+
n.allowEdit = !1;
|
|
4558
4558
|
return {
|
|
4559
4559
|
rule: t,
|
|
4560
4560
|
ranges: s,
|
|
4561
|
-
options:
|
|
4561
|
+
options: n
|
|
4562
4562
|
};
|
|
4563
4563
|
})
|
|
4564
4564
|
)).map(
|
|
4565
|
-
({ rule: t, ranges: s, options:
|
|
4565
|
+
({ rule: t, ranges: s, options: n }) => this._injector.createInstance(
|
|
4566
4566
|
O,
|
|
4567
4567
|
this._unitId,
|
|
4568
4568
|
this._subUnitId,
|
|
4569
4569
|
t.id,
|
|
4570
4570
|
t.permissionId,
|
|
4571
4571
|
s,
|
|
4572
|
-
|
|
4572
|
+
n
|
|
4573
4573
|
)
|
|
4574
4574
|
);
|
|
4575
4575
|
}
|
|
@@ -4577,33 +4577,33 @@ let Ae = class {
|
|
|
4577
4577
|
* Build permission snapshot
|
|
4578
4578
|
*/
|
|
4579
4579
|
_buildSnapshot() {
|
|
4580
|
-
const
|
|
4580
|
+
const r = {};
|
|
4581
4581
|
return Object.values(b).forEach((e) => {
|
|
4582
|
-
|
|
4583
|
-
}),
|
|
4582
|
+
r[e] = this.getPoint(e);
|
|
4583
|
+
}), r;
|
|
4584
4584
|
}
|
|
4585
4585
|
/**
|
|
4586
4586
|
* Clean up resources
|
|
4587
4587
|
*/
|
|
4588
4588
|
dispose() {
|
|
4589
|
-
this._subscriptions.forEach((
|
|
4589
|
+
this._subscriptions.forEach((r) => r.unsubscribe()), this._permissionSubject.complete();
|
|
4590
4590
|
}
|
|
4591
4591
|
};
|
|
4592
|
-
Ae =
|
|
4593
|
-
ee(4, l(
|
|
4592
|
+
Ae = Kn([
|
|
4593
|
+
ee(4, l(P)),
|
|
4594
4594
|
ee(5, l(Y)),
|
|
4595
4595
|
ee(6, l(re)),
|
|
4596
4596
|
ee(7, l(C)),
|
|
4597
4597
|
ee(8, l(ie))
|
|
4598
4598
|
], Ae);
|
|
4599
|
-
var
|
|
4600
|
-
for (var
|
|
4601
|
-
(o =
|
|
4602
|
-
return
|
|
4603
|
-
},
|
|
4599
|
+
var Jn = Object.getOwnPropertyDescriptor, qn = (r, e, t, s) => {
|
|
4600
|
+
for (var n = s > 1 ? void 0 : s ? Jn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
4601
|
+
(o = r[i]) && (n = o(n) || n);
|
|
4602
|
+
return n;
|
|
4603
|
+
}, Pe = (r, e) => (t, s) => e(t, s, r), q;
|
|
4604
4604
|
let R = (q = class extends He {
|
|
4605
|
-
constructor(e, t, s,
|
|
4606
|
-
super(
|
|
4605
|
+
constructor(e, t, s, n, i, o) {
|
|
4606
|
+
super(n), this._workbook = e, this._worksheet = t, this._range = s, this._injector = n, this._commandService = i, this._formulaDataModel = o;
|
|
4607
4607
|
const a = this._worksheet.getRowCount(), h = this._worksheet.getColumnCount();
|
|
4608
4608
|
if (this._range.startRow < 0 || this._range.startColumn < 0 || this._range.endRow >= a || this._range.endColumn >= h)
|
|
4609
4609
|
throw new Error(`Range is out of bounds. Max rows: ${a}, Max columns: ${h}, Given range: ${JSON.stringify(this._range)}`);
|
|
@@ -4773,8 +4773,8 @@ let R = (q = class extends He {
|
|
|
4773
4773
|
* ```
|
|
4774
4774
|
*/
|
|
4775
4775
|
isMerged() {
|
|
4776
|
-
const { startColumn: e, startRow: t, endColumn: s, endRow:
|
|
4777
|
-
return this._worksheet.getMergedCellRange(t, e,
|
|
4776
|
+
const { startColumn: e, startRow: t, endColumn: s, endRow: n } = this._range;
|
|
4777
|
+
return this._worksheet.getMergedCellRange(t, e, n, s).some((o) => $.equals(o, this._range));
|
|
4778
4778
|
}
|
|
4779
4779
|
/**
|
|
4780
4780
|
* Return first cell style data in this range. Please note that if there are row styles, col styles and (or)
|
|
@@ -4878,9 +4878,9 @@ let R = (q = class extends He {
|
|
|
4878
4878
|
* ```
|
|
4879
4879
|
*/
|
|
4880
4880
|
getCellStyles(e = "row") {
|
|
4881
|
-
return this.getCellDatas().map((s,
|
|
4881
|
+
return this.getCellDatas().map((s, n) => s.map((i, o) => {
|
|
4882
4882
|
if (!i) return null;
|
|
4883
|
-
const a = e !== "cell" ? this._worksheet.getComposedCellStyle(
|
|
4883
|
+
const a = e !== "cell" ? this._worksheet.getComposedCellStyle(n + this._range.startRow, o + this._range.startColumn, e === "row") : this._worksheet.getCellStyle(n + this._range.startRow, o + this._range.startColumn);
|
|
4884
4884
|
return a ? qe.create(a) : null;
|
|
4885
4885
|
}));
|
|
4886
4886
|
}
|
|
@@ -4932,20 +4932,20 @@ let R = (q = class extends He {
|
|
|
4932
4932
|
* ```
|
|
4933
4933
|
*/
|
|
4934
4934
|
getDisplayValue() {
|
|
4935
|
-
var t, s,
|
|
4935
|
+
var t, s, n;
|
|
4936
4936
|
const e = this._worksheet.getCell(this._range.startRow, this._range.startColumn);
|
|
4937
|
-
return e != null && e.p && ((t = e.p.body) != null && t.dataStream) ? e.p.body.dataStream : (
|
|
4937
|
+
return e != null && e.p && ((t = e.p.body) != null && t.dataStream) ? e.p.body.dataStream : (n = (s = e == null ? void 0 : e.v) == null ? void 0 : s.toString()) != null ? n : "";
|
|
4938
4938
|
}
|
|
4939
4939
|
getValues(e) {
|
|
4940
4940
|
var a, h;
|
|
4941
4941
|
if (e)
|
|
4942
4942
|
return this.getValueAndRichTextValues();
|
|
4943
|
-
const { startRow: t, endRow: s, startColumn:
|
|
4944
|
-
for (let
|
|
4945
|
-
const
|
|
4946
|
-
for (let m =
|
|
4947
|
-
|
|
4948
|
-
o.push(
|
|
4943
|
+
const { startRow: t, endRow: s, startColumn: n, endColumn: i } = this._range, o = [];
|
|
4944
|
+
for (let c = t; c <= s; c++) {
|
|
4945
|
+
const d = [];
|
|
4946
|
+
for (let m = n; m <= i; m++)
|
|
4947
|
+
d.push((h = (a = this._worksheet.getCell(c, m)) == null ? void 0 : a.v) != null ? h : null);
|
|
4948
|
+
o.push(d);
|
|
4949
4949
|
}
|
|
4950
4950
|
return o;
|
|
4951
4951
|
}
|
|
@@ -4993,14 +4993,14 @@ let R = (q = class extends He {
|
|
|
4993
4993
|
*/
|
|
4994
4994
|
getRawValues() {
|
|
4995
4995
|
var a, h;
|
|
4996
|
-
const e = this._worksheet.getCellMatrix(), { startRow: t, endRow: s, startColumn:
|
|
4997
|
-
for (let
|
|
4998
|
-
const
|
|
4999
|
-
for (let m =
|
|
5000
|
-
const g = e.getValue(
|
|
5001
|
-
g != null && g.p && ((a = g.p.body) != null && a.dataStream) ?
|
|
4996
|
+
const e = this._worksheet.getCellMatrix(), { startRow: t, endRow: s, startColumn: n, endColumn: i } = this._range, o = [];
|
|
4997
|
+
for (let c = t; c <= s; c++) {
|
|
4998
|
+
const d = [];
|
|
4999
|
+
for (let m = n; m <= i; m++) {
|
|
5000
|
+
const g = e.getValue(c, m);
|
|
5001
|
+
g != null && g.p && ((a = g.p.body) != null && a.dataStream) ? d.push(g.p.body.dataStream) : d.push((h = g == null ? void 0 : g.v) != null ? h : null);
|
|
5002
5002
|
}
|
|
5003
|
-
o.push(
|
|
5003
|
+
o.push(d);
|
|
5004
5004
|
}
|
|
5005
5005
|
return o;
|
|
5006
5006
|
}
|
|
@@ -5048,14 +5048,14 @@ let R = (q = class extends He {
|
|
|
5048
5048
|
*/
|
|
5049
5049
|
getDisplayValues() {
|
|
5050
5050
|
var o, a, h;
|
|
5051
|
-
const { startRow: e, endRow: t, startColumn: s, endColumn:
|
|
5052
|
-
for (let
|
|
5053
|
-
const
|
|
5054
|
-
for (let m = s; m <=
|
|
5055
|
-
const g = this._worksheet.getCell(
|
|
5056
|
-
g != null && g.p && ((o = g.p.body) != null && o.dataStream) ?
|
|
5051
|
+
const { startRow: e, endRow: t, startColumn: s, endColumn: n } = this._range, i = [];
|
|
5052
|
+
for (let c = e; c <= t; c++) {
|
|
5053
|
+
const d = [];
|
|
5054
|
+
for (let m = s; m <= n; m++) {
|
|
5055
|
+
const g = this._worksheet.getCell(c, m);
|
|
5056
|
+
g != null && g.p && ((o = g.p.body) != null && o.dataStream) ? d.push(g.p.body.dataStream) : d.push((h = (a = g == null ? void 0 : g.v) == null ? void 0 : a.toString()) != null ? h : "");
|
|
5057
5057
|
}
|
|
5058
|
-
i.push(
|
|
5058
|
+
i.push(d);
|
|
5059
5059
|
}
|
|
5060
5060
|
return i;
|
|
5061
5061
|
}
|
|
@@ -5100,10 +5100,10 @@ let R = (q = class extends He {
|
|
|
5100
5100
|
* ```
|
|
5101
5101
|
*/
|
|
5102
5102
|
getCellDataGrid() {
|
|
5103
|
-
const { startRow: e, endRow: t, startColumn: s, endColumn:
|
|
5103
|
+
const { startRow: e, endRow: t, startColumn: s, endColumn: n } = this._range, i = [];
|
|
5104
5104
|
for (let o = e; o <= t; o++) {
|
|
5105
5105
|
const a = [];
|
|
5106
|
-
for (let h = s; h <=
|
|
5106
|
+
for (let h = s; h <= n; h++)
|
|
5107
5107
|
a.push(this._worksheet.getCellRaw(o, h));
|
|
5108
5108
|
i.push(a);
|
|
5109
5109
|
}
|
|
@@ -5205,14 +5205,14 @@ let R = (q = class extends He {
|
|
|
5205
5205
|
* ```
|
|
5206
5206
|
*/
|
|
5207
5207
|
getFormulas() {
|
|
5208
|
-
const e = [], { startRow: t, endRow: s, startColumn:
|
|
5208
|
+
const e = [], { startRow: t, endRow: s, startColumn: n, endColumn: i } = this._range, o = this._worksheet.getSheetId(), a = this._workbook.getUnitId();
|
|
5209
5209
|
for (let h = t; h <= s; h++) {
|
|
5210
|
-
const
|
|
5211
|
-
for (let
|
|
5212
|
-
const m = this._formulaDataModel.getFormulaStringByCell(h,
|
|
5213
|
-
|
|
5210
|
+
const c = [];
|
|
5211
|
+
for (let d = n; d <= i; d++) {
|
|
5212
|
+
const m = this._formulaDataModel.getFormulaStringByCell(h, d, o, a);
|
|
5213
|
+
c.push(m || "");
|
|
5214
5214
|
}
|
|
5215
|
-
e.push(
|
|
5215
|
+
e.push(c);
|
|
5216
5216
|
}
|
|
5217
5217
|
return e;
|
|
5218
5218
|
}
|
|
@@ -5242,9 +5242,9 @@ let R = (q = class extends He {
|
|
|
5242
5242
|
*/
|
|
5243
5243
|
getWraps() {
|
|
5244
5244
|
const e = this.getCellDatas(), t = this._workbook.getStyles();
|
|
5245
|
-
return e.map((s) => s.map((
|
|
5245
|
+
return e.map((s) => s.map((n) => {
|
|
5246
5246
|
var i;
|
|
5247
|
-
return ((i = t.getStyleByCell(
|
|
5247
|
+
return ((i = t.getStyleByCell(n)) == null ? void 0 : i.tb) === ue.WRAP;
|
|
5248
5248
|
}));
|
|
5249
5249
|
}
|
|
5250
5250
|
/**
|
|
@@ -5274,7 +5274,7 @@ let R = (q = class extends He {
|
|
|
5274
5274
|
*/
|
|
5275
5275
|
getHorizontalAlignment() {
|
|
5276
5276
|
const e = this._worksheet.getRange(this._range).getHorizontalAlignment();
|
|
5277
|
-
return
|
|
5277
|
+
return wt(e);
|
|
5278
5278
|
}
|
|
5279
5279
|
/**
|
|
5280
5280
|
* Returns the horizontal alignments of the cells in the range.
|
|
@@ -5288,7 +5288,7 @@ let R = (q = class extends He {
|
|
|
5288
5288
|
* ```
|
|
5289
5289
|
*/
|
|
5290
5290
|
getHorizontalAlignments() {
|
|
5291
|
-
return this._worksheet.getRange(this._range).getHorizontalAlignments().map((t) => t.map((s) =>
|
|
5291
|
+
return this._worksheet.getRange(this._range).getHorizontalAlignments().map((t) => t.map((s) => wt(s)));
|
|
5292
5292
|
}
|
|
5293
5293
|
/**
|
|
5294
5294
|
* Returns the vertical alignment (top/middle/bottom) of the top-left cell in the range.
|
|
@@ -5302,7 +5302,7 @@ let R = (q = class extends He {
|
|
|
5302
5302
|
* ```
|
|
5303
5303
|
*/
|
|
5304
5304
|
getVerticalAlignment() {
|
|
5305
|
-
return
|
|
5305
|
+
return St(this._worksheet.getRange(this._range).getVerticalAlignment());
|
|
5306
5306
|
}
|
|
5307
5307
|
/**
|
|
5308
5308
|
* Returns the vertical alignments of the cells in the range.
|
|
@@ -5316,7 +5316,7 @@ let R = (q = class extends He {
|
|
|
5316
5316
|
* ```
|
|
5317
5317
|
*/
|
|
5318
5318
|
getVerticalAlignments() {
|
|
5319
|
-
return this._worksheet.getRange(this._range).getVerticalAlignments().map((t) => t.map((s) =>
|
|
5319
|
+
return this._worksheet.getRange(this._range).getVerticalAlignments().map((t) => t.map((s) => St(s)));
|
|
5320
5320
|
}
|
|
5321
5321
|
/**
|
|
5322
5322
|
* Set custom meta data for first cell in current range.
|
|
@@ -5331,9 +5331,15 @@ let R = (q = class extends He {
|
|
|
5331
5331
|
* ```
|
|
5332
5332
|
*/
|
|
5333
5333
|
setCustomMetaData(e) {
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5334
|
+
const t = {
|
|
5335
|
+
unitId: this._workbook.getUnitId(),
|
|
5336
|
+
subUnitId: this._worksheet.getSheetId(),
|
|
5337
|
+
range: this._range,
|
|
5338
|
+
customMetadata: {
|
|
5339
|
+
custom: e
|
|
5340
|
+
}
|
|
5341
|
+
};
|
|
5342
|
+
return this._commandService.syncExecuteCommand(ut.id, t), this;
|
|
5337
5343
|
}
|
|
5338
5344
|
/**
|
|
5339
5345
|
* Set custom meta data for current range.
|
|
@@ -5351,7 +5357,13 @@ let R = (q = class extends He {
|
|
|
5351
5357
|
* ```
|
|
5352
5358
|
*/
|
|
5353
5359
|
setCustomMetaDatas(e) {
|
|
5354
|
-
|
|
5360
|
+
const t = {
|
|
5361
|
+
unitId: this._workbook.getUnitId(),
|
|
5362
|
+
subUnitId: this._worksheet.getSheetId(),
|
|
5363
|
+
range: this._range,
|
|
5364
|
+
customMetadata: e.map((s) => s.map((n) => ({ custom: n })))
|
|
5365
|
+
};
|
|
5366
|
+
return this._commandService.syncExecuteCommand(ut.id, t), this;
|
|
5355
5367
|
}
|
|
5356
5368
|
/**
|
|
5357
5369
|
* Returns the custom meta data for the cell at the start of this range.
|
|
@@ -5382,8 +5394,8 @@ let R = (q = class extends He {
|
|
|
5382
5394
|
*/
|
|
5383
5395
|
getCustomMetaDatas() {
|
|
5384
5396
|
return this.getCellDataGrid().map((t) => t.map((s) => {
|
|
5385
|
-
var
|
|
5386
|
-
return (
|
|
5397
|
+
var n;
|
|
5398
|
+
return (n = s == null ? void 0 : s.custom) != null ? n : null;
|
|
5387
5399
|
}));
|
|
5388
5400
|
}
|
|
5389
5401
|
/**
|
|
@@ -5401,7 +5413,7 @@ let R = (q = class extends He {
|
|
|
5401
5413
|
* ```
|
|
5402
5414
|
*/
|
|
5403
5415
|
setBorder(e, t, s) {
|
|
5404
|
-
return this._commandService.syncExecuteCommand(
|
|
5416
|
+
return this._commandService.syncExecuteCommand(tn.id, {
|
|
5405
5417
|
unitId: this._workbook.getUnitId(),
|
|
5406
5418
|
subUnitId: this._worksheet.getSheetId(),
|
|
5407
5419
|
ranges: [this._range],
|
|
@@ -5442,8 +5454,8 @@ let R = (q = class extends He {
|
|
|
5442
5454
|
*/
|
|
5443
5455
|
getBackgrounds() {
|
|
5444
5456
|
return this.getCellStyles().map((t) => t.map((s) => {
|
|
5445
|
-
var
|
|
5446
|
-
return (i = (
|
|
5457
|
+
var n, i;
|
|
5458
|
+
return (i = (n = s == null ? void 0 : s.background) == null ? void 0 : n.rgb) != null ? i : Ye.bg.rgb;
|
|
5447
5459
|
}));
|
|
5448
5460
|
}
|
|
5449
5461
|
/**
|
|
@@ -5499,7 +5511,7 @@ let R = (q = class extends He {
|
|
|
5499
5511
|
* ```
|
|
5500
5512
|
*/
|
|
5501
5513
|
setTextRotation(e) {
|
|
5502
|
-
return this._commandService.syncExecuteCommand(
|
|
5514
|
+
return this._commandService.syncExecuteCommand(sn.id, {
|
|
5503
5515
|
unitId: this._workbook.getUnitId(),
|
|
5504
5516
|
subUnitId: this._worksheet.getSheetId(),
|
|
5505
5517
|
range: this._range,
|
|
@@ -5619,13 +5631,13 @@ let R = (q = class extends He {
|
|
|
5619
5631
|
* ```
|
|
5620
5632
|
*/
|
|
5621
5633
|
setRichTextValues(e) {
|
|
5622
|
-
const t = e.map((i) => i.map((o) => o && { p: o instanceof L ? o.getData() : o })), s = Ze(t, this._range),
|
|
5634
|
+
const t = e.map((i) => i.map((o) => o && { p: o instanceof L ? o.getData() : o })), s = Ze(t, this._range), n = {
|
|
5623
5635
|
unitId: this._workbook.getUnitId(),
|
|
5624
5636
|
subUnitId: this._worksheet.getSheetId(),
|
|
5625
5637
|
range: this._range,
|
|
5626
5638
|
value: s
|
|
5627
5639
|
};
|
|
5628
|
-
return this._commandService.syncExecuteCommand(X.id,
|
|
5640
|
+
return this._commandService.syncExecuteCommand(X.id, n), this;
|
|
5629
5641
|
}
|
|
5630
5642
|
/**
|
|
5631
5643
|
* Set the cell wrap of the given range.
|
|
@@ -5683,11 +5695,11 @@ let R = (q = class extends He {
|
|
|
5683
5695
|
* ```
|
|
5684
5696
|
*/
|
|
5685
5697
|
setVerticalAlignment(e) {
|
|
5686
|
-
return this._commandService.syncExecuteCommand(
|
|
5698
|
+
return this._commandService.syncExecuteCommand(nn.id, {
|
|
5687
5699
|
unitId: this._workbook.getUnitId(),
|
|
5688
5700
|
subUnitId: this._worksheet.getSheetId(),
|
|
5689
5701
|
range: this._range,
|
|
5690
|
-
value:
|
|
5702
|
+
value: $n(e)
|
|
5691
5703
|
}), this;
|
|
5692
5704
|
}
|
|
5693
5705
|
/**
|
|
@@ -5703,11 +5715,11 @@ let R = (q = class extends He {
|
|
|
5703
5715
|
* ```
|
|
5704
5716
|
*/
|
|
5705
5717
|
setHorizontalAlignment(e) {
|
|
5706
|
-
return this._commandService.syncExecuteCommand(
|
|
5718
|
+
return this._commandService.syncExecuteCommand(rn.id, {
|
|
5707
5719
|
unitId: this._workbook.getUnitId(),
|
|
5708
5720
|
subUnitId: this._worksheet.getSheetId(),
|
|
5709
5721
|
range: this._range,
|
|
5710
|
-
value:
|
|
5722
|
+
value: Hn(e)
|
|
5711
5723
|
}), this;
|
|
5712
5724
|
}
|
|
5713
5725
|
/**
|
|
@@ -5759,13 +5771,13 @@ let R = (q = class extends He {
|
|
|
5759
5771
|
const s = {
|
|
5760
5772
|
type: "bl",
|
|
5761
5773
|
value: t
|
|
5762
|
-
},
|
|
5774
|
+
}, n = {
|
|
5763
5775
|
unitId: this._workbook.getUnitId(),
|
|
5764
5776
|
subUnitId: this._worksheet.getSheetId(),
|
|
5765
5777
|
range: this._range,
|
|
5766
5778
|
style: s
|
|
5767
5779
|
};
|
|
5768
|
-
return this._commandService.syncExecuteCommand(T.id,
|
|
5780
|
+
return this._commandService.syncExecuteCommand(T.id, n), this;
|
|
5769
5781
|
}
|
|
5770
5782
|
/**
|
|
5771
5783
|
* Sets the font style for the given range ('italic' or 'normal').
|
|
@@ -5792,13 +5804,13 @@ let R = (q = class extends He {
|
|
|
5792
5804
|
const s = {
|
|
5793
5805
|
type: "it",
|
|
5794
5806
|
value: t
|
|
5795
|
-
},
|
|
5807
|
+
}, n = {
|
|
5796
5808
|
unitId: this._workbook.getUnitId(),
|
|
5797
5809
|
subUnitId: this._worksheet.getSheetId(),
|
|
5798
5810
|
range: this._range,
|
|
5799
5811
|
style: s
|
|
5800
5812
|
};
|
|
5801
|
-
return this._commandService.syncExecuteCommand(T.id,
|
|
5813
|
+
return this._commandService.syncExecuteCommand(T.id, n), this;
|
|
5802
5814
|
}
|
|
5803
5815
|
/**
|
|
5804
5816
|
* Sets the font line style of the given range ('underline', 'line-through', or 'none').
|
|
@@ -5931,19 +5943,21 @@ let R = (q = class extends He {
|
|
|
5931
5943
|
const s = {
|
|
5932
5944
|
type: "cl",
|
|
5933
5945
|
value: e === null ? null : { rgb: e }
|
|
5934
|
-
},
|
|
5946
|
+
}, n = {
|
|
5935
5947
|
unitId: this._workbook.getUnitId(),
|
|
5936
5948
|
subUnitId: this._worksheet.getSheetId(),
|
|
5937
5949
|
range: this._range,
|
|
5938
5950
|
style: s
|
|
5939
5951
|
};
|
|
5940
|
-
return this._commandService.syncExecuteCommand(T.id,
|
|
5952
|
+
return this._commandService.syncExecuteCommand(T.id, n), this;
|
|
5941
5953
|
}
|
|
5942
5954
|
// #endregion editing
|
|
5943
5955
|
//#region Merge cell
|
|
5944
5956
|
/**
|
|
5945
5957
|
* Merge cells in a range into one merged cell
|
|
5946
|
-
* @param {
|
|
5958
|
+
* @param {IMergeCellsUtilOptions} [options] - The options for merging cells.
|
|
5959
|
+
* @param {boolean} [options.defaultMerge] - If true, only the value in the upper left cell is retained. If false, a confirm dialog will be shown to the user. Default is true.
|
|
5960
|
+
* @param {boolean} [options.isForceMerge] - If true, the overlapping merged cells will be removed before performing the new merge. Default is false.
|
|
5947
5961
|
* @returns {FRange} This range, for chaining
|
|
5948
5962
|
* @example
|
|
5949
5963
|
* ```ts
|
|
@@ -5953,14 +5967,24 @@ let R = (q = class extends He {
|
|
|
5953
5967
|
* fRange.merge();
|
|
5954
5968
|
* console.log(fRange.isMerged());
|
|
5955
5969
|
* ```
|
|
5970
|
+
*
|
|
5971
|
+
* ```ts
|
|
5972
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
5973
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
5974
|
+
* const fRange = fWorksheet.getRange('B1:C2');
|
|
5975
|
+
* // Assume A1:B2 is already merged.
|
|
5976
|
+
* fRange.merge({ isForceMerge: true });
|
|
5977
|
+
* ```
|
|
5956
5978
|
*/
|
|
5957
|
-
merge(e
|
|
5979
|
+
merge(e) {
|
|
5958
5980
|
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId();
|
|
5959
5981
|
return Re(this._injector, t, s, [this._range], e), this;
|
|
5960
5982
|
}
|
|
5961
5983
|
/**
|
|
5962
5984
|
* Merges cells in a range horizontally.
|
|
5963
|
-
* @param {
|
|
5985
|
+
* @param {IMergeCellsUtilOptions} [options] - The options for merging cells.
|
|
5986
|
+
* @param {boolean} [options.defaultMerge] - If true, only the value in the upper left cell is retained. If false, a confirm dialog will be shown to the user. Default is true.
|
|
5987
|
+
* @param {boolean} [options.isForceMerge] - If true, the overlapping merged cells will be removed before performing the new merge. Default is false.
|
|
5964
5988
|
* @returns {FRange} This range, for chaining
|
|
5965
5989
|
* @example
|
|
5966
5990
|
* ```ts
|
|
@@ -5975,14 +5999,24 @@ let R = (q = class extends He {
|
|
|
5975
5999
|
* console.log(item.getA1Notation());
|
|
5976
6000
|
* });
|
|
5977
6001
|
* ```
|
|
6002
|
+
*
|
|
6003
|
+
* ```ts
|
|
6004
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
6005
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
6006
|
+
* const fRange = fWorksheet.getRange('B1:C2');
|
|
6007
|
+
* // Assume A1:B2 is already merged.
|
|
6008
|
+
* fRange.mergeAcross({ isForceMerge: true });
|
|
6009
|
+
* ```
|
|
5978
6010
|
*/
|
|
5979
|
-
mergeAcross(e
|
|
5980
|
-
const t =
|
|
5981
|
-
return Re(this._injector, s,
|
|
6011
|
+
mergeAcross(e) {
|
|
6012
|
+
const t = lt([this._range], G.ROWS), s = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
|
|
6013
|
+
return Re(this._injector, s, n, t, e), this;
|
|
5982
6014
|
}
|
|
5983
6015
|
/**
|
|
5984
6016
|
* Merges cells in a range vertically.
|
|
5985
|
-
* @param {
|
|
6017
|
+
* @param {IMergeCellsUtilOptions} [options] - The options for merging cells.
|
|
6018
|
+
* @param {boolean} [options.defaultMerge] - If true, only the value in the upper left cell is retained. If false, a confirm dialog will be shown to the user. Default is true.
|
|
6019
|
+
* @param {boolean} [options.isForceMerge] - If true, the overlapping merged cells will be removed before performing the new merge. Default is false.
|
|
5986
6020
|
* @returns {FRange} This range, for chaining
|
|
5987
6021
|
* @example
|
|
5988
6022
|
* ```ts
|
|
@@ -5997,10 +6031,18 @@ let R = (q = class extends He {
|
|
|
5997
6031
|
* console.log(item.getA1Notation());
|
|
5998
6032
|
* });
|
|
5999
6033
|
* ```
|
|
6034
|
+
*
|
|
6035
|
+
* ```ts
|
|
6036
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
6037
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
6038
|
+
* const fRange = fWorksheet.getRange('B1:C2');
|
|
6039
|
+
* // Assume A1:B2 is already merged.
|
|
6040
|
+
* fRange.mergeVertically({ isForceMerge: true });
|
|
6041
|
+
* ```
|
|
6000
6042
|
*/
|
|
6001
|
-
mergeVertically(e
|
|
6002
|
-
const t =
|
|
6003
|
-
return Re(this._injector, s,
|
|
6043
|
+
mergeVertically(e) {
|
|
6044
|
+
const t = lt([this._range], G.COLUMNS), s = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
|
|
6045
|
+
return Re(this._injector, s, n, t, e), this;
|
|
6004
6046
|
}
|
|
6005
6047
|
/**
|
|
6006
6048
|
* Returns true if cells in the current range overlap a merged cell.
|
|
@@ -6016,8 +6058,8 @@ let R = (q = class extends He {
|
|
|
6016
6058
|
* ```
|
|
6017
6059
|
*/
|
|
6018
6060
|
isPartOfMerge() {
|
|
6019
|
-
const { startRow: e, startColumn: t, endRow: s, endColumn:
|
|
6020
|
-
return this._worksheet.getMergedCellRange(e, t, s,
|
|
6061
|
+
const { startRow: e, startColumn: t, endRow: s, endColumn: n } = this._range;
|
|
6062
|
+
return this._worksheet.getMergedCellRange(e, t, s, n).length > 0;
|
|
6021
6063
|
}
|
|
6022
6064
|
/**
|
|
6023
6065
|
* Break all horizontally- or vertically-merged cells contained within the range list into individual cells again.
|
|
@@ -6035,7 +6077,11 @@ let R = (q = class extends He {
|
|
|
6035
6077
|
* ```
|
|
6036
6078
|
*/
|
|
6037
6079
|
breakApart() {
|
|
6038
|
-
return this._commandService.syncExecuteCommand(
|
|
6080
|
+
return this._commandService.syncExecuteCommand(on.id, {
|
|
6081
|
+
unitId: this._workbook.getUnitId(),
|
|
6082
|
+
subUnitId: this._worksheet.getSheetId(),
|
|
6083
|
+
ranges: [this._range]
|
|
6084
|
+
}), this;
|
|
6039
6085
|
}
|
|
6040
6086
|
//#endregion
|
|
6041
6087
|
/**
|
|
@@ -6054,8 +6100,8 @@ let R = (q = class extends He {
|
|
|
6054
6100
|
* ```
|
|
6055
6101
|
*/
|
|
6056
6102
|
forEach(e) {
|
|
6057
|
-
const { startColumn: t, startRow: s, endColumn:
|
|
6058
|
-
this._worksheet.getMatrixWithMergedCells(s, t, i,
|
|
6103
|
+
const { startColumn: t, startRow: s, endColumn: n, endRow: i } = this._range;
|
|
6104
|
+
this._worksheet.getMatrixWithMergedCells(s, t, i, n).forValue((o, a, h) => {
|
|
6059
6105
|
e(o, a, h);
|
|
6060
6106
|
});
|
|
6061
6107
|
}
|
|
@@ -6092,12 +6138,12 @@ let R = (q = class extends He {
|
|
|
6092
6138
|
* ```
|
|
6093
6139
|
*/
|
|
6094
6140
|
getA1Notation(e, t, s) {
|
|
6095
|
-
const
|
|
6141
|
+
const n = {
|
|
6096
6142
|
...this._range,
|
|
6097
6143
|
startAbsoluteRefType: t,
|
|
6098
6144
|
endAbsoluteRefType: s
|
|
6099
6145
|
};
|
|
6100
|
-
return e ?
|
|
6146
|
+
return e ? En(this._worksheet.getName(), n) : Ke(n);
|
|
6101
6147
|
}
|
|
6102
6148
|
/**
|
|
6103
6149
|
* Sets the specified range as the active range, with the top left cell in the range as the current cell.
|
|
@@ -6111,7 +6157,7 @@ let R = (q = class extends He {
|
|
|
6111
6157
|
* ```
|
|
6112
6158
|
*/
|
|
6113
6159
|
activate() {
|
|
6114
|
-
return this._injector.createInstance(
|
|
6160
|
+
return this._injector.createInstance(E, this._workbook).setActiveRange(this), this;
|
|
6115
6161
|
}
|
|
6116
6162
|
/**
|
|
6117
6163
|
* Sets the specified cell as the current cell.
|
|
@@ -6148,16 +6194,16 @@ let R = (q = class extends He {
|
|
|
6148
6194
|
activateAsCurrentCell() {
|
|
6149
6195
|
const e = this._worksheet.getMergedCell(this._range.startRow, this._range.startColumn);
|
|
6150
6196
|
if (e && $.equals(e, this._range) || !e && this._range.startRow === this._range.endRow && this._range.startColumn === this._range.endColumn) {
|
|
6151
|
-
const
|
|
6152
|
-
if (!
|
|
6197
|
+
const n = this._injector.createInstance(E, this._workbook).getActiveRange();
|
|
6198
|
+
if (!n || n.getUnitId() !== this.getUnitId() || n.getSheetId() !== this.getSheetId())
|
|
6153
6199
|
return this.activate();
|
|
6154
|
-
if ($.contains(
|
|
6200
|
+
if ($.contains(n.getRange(), this._range)) {
|
|
6155
6201
|
const i = {
|
|
6156
6202
|
unitId: this.getUnitId(),
|
|
6157
6203
|
subUnitId: this.getSheetId(),
|
|
6158
6204
|
selections: [
|
|
6159
6205
|
{
|
|
6160
|
-
range:
|
|
6206
|
+
range: n.getRange(),
|
|
6161
6207
|
primary: le(this.getRange(), this._worksheet),
|
|
6162
6208
|
style: null
|
|
6163
6209
|
}
|
|
@@ -6204,7 +6250,7 @@ let R = (q = class extends He {
|
|
|
6204
6250
|
* ```
|
|
6205
6251
|
*/
|
|
6206
6252
|
splitTextToColumns(e, t, s) {
|
|
6207
|
-
this._commandService.syncExecuteCommand(
|
|
6253
|
+
this._commandService.syncExecuteCommand(an.id, {
|
|
6208
6254
|
unitId: this._workbook.getUnitId(),
|
|
6209
6255
|
subUnitId: this._worksheet.getSheetId(),
|
|
6210
6256
|
range: this._range,
|
|
@@ -6229,7 +6275,7 @@ let R = (q = class extends He {
|
|
|
6229
6275
|
const t = this.getUsedThemeStyle();
|
|
6230
6276
|
t && this.removeThemeStyle(t);
|
|
6231
6277
|
} else
|
|
6232
|
-
this._commandService.syncExecuteCommand(
|
|
6278
|
+
this._commandService.syncExecuteCommand(hn.id, {
|
|
6233
6279
|
unitId: this._workbook.getUnitId(),
|
|
6234
6280
|
subUnitId: this._worksheet.getSheetId(),
|
|
6235
6281
|
range: this._range,
|
|
@@ -6248,7 +6294,7 @@ let R = (q = class extends He {
|
|
|
6248
6294
|
* ```
|
|
6249
6295
|
*/
|
|
6250
6296
|
removeThemeStyle(e) {
|
|
6251
|
-
this._commandService.syncExecuteCommand(
|
|
6297
|
+
this._commandService.syncExecuteCommand(dn.id, {
|
|
6252
6298
|
unitId: this._workbook.getUnitId(),
|
|
6253
6299
|
subUnitId: this._worksheet.getSheetId(),
|
|
6254
6300
|
range: this._range,
|
|
@@ -6269,7 +6315,7 @@ let R = (q = class extends He {
|
|
|
6269
6315
|
* ```
|
|
6270
6316
|
*/
|
|
6271
6317
|
getUsedThemeStyle() {
|
|
6272
|
-
return this._injector.get(
|
|
6318
|
+
return this._injector.get(Wt).getAppliedRangeThemeStyle({
|
|
6273
6319
|
unitId: this._workbook.getUnitId(),
|
|
6274
6320
|
subUnitId: this._worksheet.getSheetId(),
|
|
6275
6321
|
range: this._range
|
|
@@ -6295,7 +6341,7 @@ let R = (q = class extends He {
|
|
|
6295
6341
|
* ```
|
|
6296
6342
|
*/
|
|
6297
6343
|
clear(e) {
|
|
6298
|
-
return e && e.contentsOnly && !e.formatOnly ? this.clearContent() : e && e.formatOnly && !e.contentsOnly ? this.clearFormat() : (this._commandService.syncExecuteCommand(
|
|
6344
|
+
return e && e.contentsOnly && !e.formatOnly ? this.clearContent() : e && e.formatOnly && !e.contentsOnly ? this.clearFormat() : (this._commandService.syncExecuteCommand(xt.id, {
|
|
6299
6345
|
unitId: this._workbook.getUnitId(),
|
|
6300
6346
|
subUnitId: this._worksheet.getSheetId(),
|
|
6301
6347
|
ranges: [this._range],
|
|
@@ -6316,7 +6362,7 @@ let R = (q = class extends He {
|
|
|
6316
6362
|
* ```
|
|
6317
6363
|
*/
|
|
6318
6364
|
clearContent() {
|
|
6319
|
-
return this._commandService.syncExecuteCommand(
|
|
6365
|
+
return this._commandService.syncExecuteCommand(Dt.id, {
|
|
6320
6366
|
unitId: this._workbook.getUnitId(),
|
|
6321
6367
|
subUnitId: this._worksheet.getSheetId(),
|
|
6322
6368
|
ranges: [this._range]
|
|
@@ -6335,7 +6381,7 @@ let R = (q = class extends He {
|
|
|
6335
6381
|
* ```
|
|
6336
6382
|
*/
|
|
6337
6383
|
clearFormat() {
|
|
6338
|
-
return this._commandService.syncExecuteCommand(
|
|
6384
|
+
return this._commandService.syncExecuteCommand(Mt.id, {
|
|
6339
6385
|
unitId: this._workbook.getUnitId(),
|
|
6340
6386
|
subUnitId: this._worksheet.getSheetId(),
|
|
6341
6387
|
ranges: [this._range]
|
|
@@ -6399,7 +6445,7 @@ let R = (q = class extends He {
|
|
|
6399
6445
|
insertCells(e) {
|
|
6400
6446
|
e === G.ROWS ? this._commandService.executeCommand(cn.id, {
|
|
6401
6447
|
range: this._range
|
|
6402
|
-
}) : this._commandService.executeCommand(
|
|
6448
|
+
}) : this._commandService.executeCommand(un.id, {
|
|
6403
6449
|
range: this._range
|
|
6404
6450
|
});
|
|
6405
6451
|
}
|
|
@@ -6459,9 +6505,9 @@ let R = (q = class extends He {
|
|
|
6459
6505
|
* ```
|
|
6460
6506
|
*/
|
|
6461
6507
|
deleteCells(e) {
|
|
6462
|
-
e === G.ROWS ? this._commandService.executeCommand(
|
|
6508
|
+
e === G.ROWS ? this._commandService.executeCommand(ln.id, {
|
|
6463
6509
|
range: this._range
|
|
6464
|
-
}) : this._commandService.executeCommand(
|
|
6510
|
+
}) : this._commandService.executeCommand(mn.id, {
|
|
6465
6511
|
range: this._range
|
|
6466
6512
|
});
|
|
6467
6513
|
}
|
|
@@ -6503,23 +6549,23 @@ let R = (q = class extends He {
|
|
|
6503
6549
|
*/
|
|
6504
6550
|
// eslint-disable-next-line complexity
|
|
6505
6551
|
getDataRegion(e) {
|
|
6506
|
-
const { startRow: t, startColumn: s, endRow:
|
|
6507
|
-
let
|
|
6552
|
+
const { startRow: t, startColumn: s, endRow: n, endColumn: i } = this._range, o = this._worksheet.getMaxRows(), a = this._worksheet.getMaxColumns(), h = this._worksheet.getCellMatrix();
|
|
6553
|
+
let c = t, d = s, m = n, g = i;
|
|
6508
6554
|
if (e !== G.COLUMNS) {
|
|
6509
6555
|
let S = !1, k = !1;
|
|
6510
|
-
for (let f = s; f <= i && (t > 0 && !Q(h.getValue(t - 1, f)) && (S = !0),
|
|
6556
|
+
for (let f = s; f <= i && (t > 0 && !Q(h.getValue(t - 1, f)) && (S = !0), n < o - 1 && !Q(h.getValue(n + 1, f)) && (k = !0), !(S && k)); f++)
|
|
6511
6557
|
;
|
|
6512
|
-
S && (
|
|
6558
|
+
S && (c = t - 1), k && (m = n + 1);
|
|
6513
6559
|
}
|
|
6514
6560
|
if (e !== G.ROWS) {
|
|
6515
6561
|
let S = !1, k = !1;
|
|
6516
|
-
for (let f = t; f <=
|
|
6562
|
+
for (let f = t; f <= n && (s > 0 && !Q(h.getValue(f, s - 1)) && (S = !0), i < a - 1 && !Q(h.getValue(f, i + 1)) && (k = !0), !(S && k)); f++)
|
|
6517
6563
|
;
|
|
6518
|
-
S && (
|
|
6564
|
+
S && (d = s - 1), k && (g = i + 1);
|
|
6519
6565
|
}
|
|
6520
6566
|
return this._injector.createInstance(R, this._workbook, this._worksheet, {
|
|
6521
|
-
startRow:
|
|
6522
|
-
startColumn:
|
|
6567
|
+
startRow: c,
|
|
6568
|
+
startColumn: d,
|
|
6523
6569
|
endRow: m,
|
|
6524
6570
|
endColumn: g
|
|
6525
6571
|
});
|
|
@@ -6541,9 +6587,9 @@ let R = (q = class extends He {
|
|
|
6541
6587
|
* ```
|
|
6542
6588
|
*/
|
|
6543
6589
|
isBlank() {
|
|
6544
|
-
const e = this._worksheet.getCellMatrix(), { startRow: t, startColumn: s, endRow:
|
|
6590
|
+
const e = this._worksheet.getCellMatrix(), { startRow: t, startColumn: s, endRow: n, endColumn: i } = this._range;
|
|
6545
6591
|
let o = !0;
|
|
6546
|
-
for (let a = t; a <=
|
|
6592
|
+
for (let a = t; a <= n; a++) {
|
|
6547
6593
|
for (let h = s; h <= i; h++)
|
|
6548
6594
|
if (!Q(e.getValue(a, h))) {
|
|
6549
6595
|
o = !1;
|
|
@@ -6573,13 +6619,13 @@ let R = (q = class extends He {
|
|
|
6573
6619
|
* console.log(newRange.getA1Notation()); // B2:D4
|
|
6574
6620
|
* ```
|
|
6575
6621
|
*/
|
|
6576
|
-
offset(e, t, s,
|
|
6577
|
-
const { startRow: i, startColumn: o, endRow: a, endColumn: h } = this._range,
|
|
6578
|
-
if (
|
|
6622
|
+
offset(e, t, s, n) {
|
|
6623
|
+
const { startRow: i, startColumn: o, endRow: a, endColumn: h } = this._range, c = i + e, d = o + t, m = s ? c + s - 1 : a + e, g = n ? d + n - 1 : h + t;
|
|
6624
|
+
if (c < 0 || d < 0 || m < 0 || g < 0)
|
|
6579
6625
|
throw new Error("The row or column index is out of range");
|
|
6580
6626
|
return this._injector.createInstance(R, this._workbook, this._worksheet, {
|
|
6581
|
-
startRow:
|
|
6582
|
-
startColumn:
|
|
6627
|
+
startRow: c,
|
|
6628
|
+
startColumn: d,
|
|
6583
6629
|
endRow: m,
|
|
6584
6630
|
endColumn: g
|
|
6585
6631
|
});
|
|
@@ -6650,7 +6696,7 @@ let R = (q = class extends He {
|
|
|
6650
6696
|
* ```
|
|
6651
6697
|
*/
|
|
6652
6698
|
getRangePermission() {
|
|
6653
|
-
const e = this._injector.createInstance(v, this._injector.createInstance(
|
|
6699
|
+
const e = this._injector.createInstance(v, this._injector.createInstance(E, this._workbook), this._workbook, this._worksheet);
|
|
6654
6700
|
return this._injector.createInstance(
|
|
6655
6701
|
Ae,
|
|
6656
6702
|
this._workbook.getUnitId(),
|
|
@@ -6660,22 +6706,22 @@ let R = (q = class extends He {
|
|
|
6660
6706
|
);
|
|
6661
6707
|
}
|
|
6662
6708
|
}, q._enableManualInit(), q);
|
|
6663
|
-
R =
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6709
|
+
R = qn([
|
|
6710
|
+
Pe(3, l(P)),
|
|
6711
|
+
Pe(4, C),
|
|
6712
|
+
Pe(5, l(Pn))
|
|
6667
6713
|
], R);
|
|
6668
|
-
var
|
|
6669
|
-
for (var
|
|
6670
|
-
(o =
|
|
6671
|
-
return
|
|
6672
|
-
}, Ue = (
|
|
6714
|
+
var Yn = Object.getOwnPropertyDescriptor, Zn = (r, e, t, s) => {
|
|
6715
|
+
for (var n = s > 1 ? void 0 : s ? Yn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
6716
|
+
(o = r[i]) && (n = o(n) || n);
|
|
6717
|
+
return n;
|
|
6718
|
+
}, Ue = (r, e) => (t, s) => e(t, s, r);
|
|
6673
6719
|
let Be = class {
|
|
6674
|
-
constructor(
|
|
6720
|
+
constructor(r, e, t, s) {
|
|
6675
6721
|
w(this, "_permissionSubject");
|
|
6676
6722
|
// Collaborator changes are tracked manually since IAuthzIoService doesn't provide an observable
|
|
6677
6723
|
// TODO: If IAuthzIoService adds an observable in the future, migrate to use that
|
|
6678
|
-
w(this, "_collaboratorChangeSubject", new
|
|
6724
|
+
w(this, "_collaboratorChangeSubject", new Un());
|
|
6679
6725
|
/**
|
|
6680
6726
|
* Observable stream of permission snapshot changes (BehaviorSubject)
|
|
6681
6727
|
* Emits immediately on subscription with current state, then on any permission point change
|
|
@@ -6693,7 +6739,7 @@ let Be = class {
|
|
|
6693
6739
|
w(this, "collaboratorChange$");
|
|
6694
6740
|
w(this, "_subscriptions", []);
|
|
6695
6741
|
w(this, "_fPermission");
|
|
6696
|
-
this._unitId =
|
|
6742
|
+
this._unitId = r, this._injector = e, this._permissionService = t, this._authzIoService = s, this._fPermission = this._injector.createInstance(z), this._permissionSubject = new ge(this._buildSnapshot()), this.permission$ = this._createPermissionStream(), this.pointChange$ = this._createPointChangeStream(), this.collaboratorChange$ = this._collaboratorChangeSubject.asObservable().pipe(
|
|
6697
6743
|
N({ bufferSize: 1, refCount: !0 })
|
|
6698
6744
|
);
|
|
6699
6745
|
}
|
|
@@ -6702,12 +6748,12 @@ let Be = class {
|
|
|
6702
6748
|
* @private
|
|
6703
6749
|
*/
|
|
6704
6750
|
_createPermissionStream() {
|
|
6705
|
-
const
|
|
6751
|
+
const r = this._permissionService.permissionPointUpdate$.pipe(
|
|
6706
6752
|
D((e) => e.id.includes(this._unitId))
|
|
6707
6753
|
).subscribe(() => {
|
|
6708
6754
|
this._permissionSubject.next(this._buildSnapshot());
|
|
6709
6755
|
});
|
|
6710
|
-
return this._subscriptions.push(
|
|
6756
|
+
return this._subscriptions.push(r), this._permissionSubject.asObservable().pipe(
|
|
6711
6757
|
_e((e, t) => JSON.stringify(e) === JSON.stringify(t)),
|
|
6712
6758
|
N({ bufferSize: 1, refCount: !0 })
|
|
6713
6759
|
);
|
|
@@ -6717,18 +6763,18 @@ let Be = class {
|
|
|
6717
6763
|
* @private
|
|
6718
6764
|
*/
|
|
6719
6765
|
_createPointChangeStream() {
|
|
6720
|
-
const
|
|
6766
|
+
const r = /* @__PURE__ */ new Map();
|
|
6721
6767
|
for (const e in u) {
|
|
6722
6768
|
const t = u[e];
|
|
6723
|
-
|
|
6769
|
+
r.set(t, this.getPoint(t));
|
|
6724
6770
|
}
|
|
6725
6771
|
return this._permissionService.permissionPointUpdate$.pipe(
|
|
6726
6772
|
D((e) => e.id.includes(this._unitId)),
|
|
6727
6773
|
we((e) => {
|
|
6728
6774
|
const t = this._extractWorkbookPointType(e.id);
|
|
6729
6775
|
if (!t) return null;
|
|
6730
|
-
const s = !!e.value,
|
|
6731
|
-
return
|
|
6776
|
+
const s = !!e.value, n = r.get(t);
|
|
6777
|
+
return r.set(t, s), n === s ? null : { point: t, value: s, oldValue: n };
|
|
6732
6778
|
}),
|
|
6733
6779
|
D((e) => e !== null),
|
|
6734
6780
|
N({ bufferSize: 1, refCount: !0 })
|
|
@@ -6738,11 +6784,11 @@ let Be = class {
|
|
|
6738
6784
|
* Extract WorkbookPermissionPoint type from permission point ID
|
|
6739
6785
|
* @private
|
|
6740
6786
|
*/
|
|
6741
|
-
_extractWorkbookPointType(
|
|
6787
|
+
_extractWorkbookPointType(r) {
|
|
6742
6788
|
for (const e in u) {
|
|
6743
6789
|
const t = u[e], s = he[t];
|
|
6744
6790
|
if (!s) continue;
|
|
6745
|
-
if (new s(this._unitId).id ===
|
|
6791
|
+
if (new s(this._unitId).id === r)
|
|
6746
6792
|
return t;
|
|
6747
6793
|
}
|
|
6748
6794
|
return null;
|
|
@@ -6751,12 +6797,12 @@ let Be = class {
|
|
|
6751
6797
|
* Build permission snapshot
|
|
6752
6798
|
*/
|
|
6753
6799
|
_buildSnapshot() {
|
|
6754
|
-
const
|
|
6800
|
+
const r = {};
|
|
6755
6801
|
for (const e in u) {
|
|
6756
6802
|
const t = u[e];
|
|
6757
|
-
|
|
6803
|
+
r[t] = this.getPoint(t);
|
|
6758
6804
|
}
|
|
6759
|
-
return
|
|
6805
|
+
return r;
|
|
6760
6806
|
}
|
|
6761
6807
|
/**
|
|
6762
6808
|
* Listen to permission point changes
|
|
@@ -6771,19 +6817,19 @@ let Be = class {
|
|
|
6771
6817
|
* await permission?.setMode('editor');
|
|
6772
6818
|
* ```
|
|
6773
6819
|
*/
|
|
6774
|
-
async setMode(
|
|
6775
|
-
const e = this._getModePermissions(
|
|
6820
|
+
async setMode(r) {
|
|
6821
|
+
const e = this._getModePermissions(r);
|
|
6776
6822
|
await this._batchSetPermissionPoints(e);
|
|
6777
6823
|
}
|
|
6778
6824
|
/**
|
|
6779
6825
|
* Get permission configuration for a specific mode
|
|
6780
6826
|
* @private
|
|
6781
6827
|
*/
|
|
6782
|
-
_getModePermissions(
|
|
6828
|
+
_getModePermissions(r) {
|
|
6783
6829
|
const e = {};
|
|
6784
6830
|
switch (Object.values(u).forEach((t) => {
|
|
6785
6831
|
e[t] = !1;
|
|
6786
|
-
}),
|
|
6832
|
+
}), r) {
|
|
6787
6833
|
case "owner":
|
|
6788
6834
|
Object.values(u).forEach((t) => {
|
|
6789
6835
|
e[t] = !0;
|
|
@@ -6805,14 +6851,14 @@ let Be = class {
|
|
|
6805
6851
|
* Batch set multiple permission points efficiently
|
|
6806
6852
|
* @private
|
|
6807
6853
|
*/
|
|
6808
|
-
async _batchSetPermissionPoints(
|
|
6854
|
+
async _batchSetPermissionPoints(r) {
|
|
6809
6855
|
const e = [];
|
|
6810
|
-
for (const [t, s] of Object.entries(
|
|
6811
|
-
const
|
|
6856
|
+
for (const [t, s] of Object.entries(r)) {
|
|
6857
|
+
const n = t, i = he[n];
|
|
6812
6858
|
if (!i)
|
|
6813
|
-
throw new Error(`Unknown workbook permission point: ${
|
|
6814
|
-
const o = this.getPoint(
|
|
6815
|
-
o !== s && (this._fPermission.setWorkbookPermissionPoint(this._unitId, i, s), e.push({ point:
|
|
6859
|
+
throw new Error(`Unknown workbook permission point: ${n}`);
|
|
6860
|
+
const o = this.getPoint(n);
|
|
6861
|
+
o !== s && (this._fPermission.setWorkbookPermissionPoint(this._unitId, i, s), e.push({ point: n, value: s, oldValue: o }));
|
|
6816
6862
|
}
|
|
6817
6863
|
if (e.length > 0) {
|
|
6818
6864
|
const t = this._buildSnapshot();
|
|
@@ -6872,15 +6918,15 @@ let Be = class {
|
|
|
6872
6918
|
* await permission?.setPoint(univerAPI.Enum.WorkbookPermissionPoint.Print, false);
|
|
6873
6919
|
* ```
|
|
6874
6920
|
*/
|
|
6875
|
-
async setPoint(
|
|
6876
|
-
const t = he[
|
|
6921
|
+
async setPoint(r, e) {
|
|
6922
|
+
const t = he[r];
|
|
6877
6923
|
if (!t)
|
|
6878
|
-
throw new Error(`Unknown workbook permission point: ${
|
|
6879
|
-
if (this.getPoint(
|
|
6924
|
+
throw new Error(`Unknown workbook permission point: ${r}`);
|
|
6925
|
+
if (this.getPoint(r) === e)
|
|
6880
6926
|
return;
|
|
6881
6927
|
this._fPermission.setWorkbookPermissionPoint(this._unitId, t, e);
|
|
6882
|
-
const
|
|
6883
|
-
this._permissionSubject.next(
|
|
6928
|
+
const n = this._buildSnapshot();
|
|
6929
|
+
this._permissionSubject.next(n);
|
|
6884
6930
|
}
|
|
6885
6931
|
/**
|
|
6886
6932
|
* Get the value of a specific permission point.
|
|
@@ -6894,13 +6940,13 @@ let Be = class {
|
|
|
6894
6940
|
* console.log(canPrint);
|
|
6895
6941
|
* ```
|
|
6896
6942
|
*/
|
|
6897
|
-
getPoint(
|
|
6898
|
-
var
|
|
6899
|
-
const e = he[
|
|
6943
|
+
getPoint(r) {
|
|
6944
|
+
var n;
|
|
6945
|
+
const e = he[r];
|
|
6900
6946
|
if (!e)
|
|
6901
|
-
throw new Error(`Unknown workbook permission point: ${
|
|
6947
|
+
throw new Error(`Unknown workbook permission point: ${r}`);
|
|
6902
6948
|
const t = new e(this._unitId), s = this._permissionService.getPermissionPoint(t.id);
|
|
6903
|
-
return (
|
|
6949
|
+
return (n = s == null ? void 0 : s.value) != null ? n : !0;
|
|
6904
6950
|
}
|
|
6905
6951
|
/**
|
|
6906
6952
|
* Get a snapshot of all permission points.
|
|
@@ -6936,8 +6982,8 @@ let Be = class {
|
|
|
6936
6982
|
* ]);
|
|
6937
6983
|
* ```
|
|
6938
6984
|
*/
|
|
6939
|
-
async setCollaborators(
|
|
6940
|
-
const e =
|
|
6985
|
+
async setCollaborators(r) {
|
|
6986
|
+
const e = r.map((t) => ({
|
|
6941
6987
|
id: t.user.userID,
|
|
6942
6988
|
subject: t.user,
|
|
6943
6989
|
role: t.role
|
|
@@ -6946,7 +6992,7 @@ let Be = class {
|
|
|
6946
6992
|
objectID: this._unitId,
|
|
6947
6993
|
unitID: this._unitId,
|
|
6948
6994
|
collaborators: e
|
|
6949
|
-
}),
|
|
6995
|
+
}), r.forEach((t) => {
|
|
6950
6996
|
this._collaboratorChangeSubject.next({
|
|
6951
6997
|
type: "add",
|
|
6952
6998
|
collaborator: {
|
|
@@ -6971,19 +7017,19 @@ let Be = class {
|
|
|
6971
7017
|
* );
|
|
6972
7018
|
* ```
|
|
6973
7019
|
*/
|
|
6974
|
-
async addCollaborator(
|
|
7020
|
+
async addCollaborator(r, e) {
|
|
6975
7021
|
await this._authzIoService.createCollaborator({
|
|
6976
7022
|
objectID: this._unitId,
|
|
6977
7023
|
unitID: this._unitId,
|
|
6978
7024
|
collaborators: [{
|
|
6979
|
-
id:
|
|
6980
|
-
subject:
|
|
7025
|
+
id: r.userID,
|
|
7026
|
+
subject: r,
|
|
6981
7027
|
role: e
|
|
6982
7028
|
}]
|
|
6983
7029
|
}), this._collaboratorChangeSubject.next({
|
|
6984
7030
|
type: "add",
|
|
6985
7031
|
collaborator: {
|
|
6986
|
-
user: { id:
|
|
7032
|
+
user: { id: r.userID },
|
|
6987
7033
|
role: e
|
|
6988
7034
|
}
|
|
6989
7035
|
});
|
|
@@ -7003,19 +7049,19 @@ let Be = class {
|
|
|
7003
7049
|
* );
|
|
7004
7050
|
* ```
|
|
7005
7051
|
*/
|
|
7006
|
-
async updateCollaborator(
|
|
7052
|
+
async updateCollaborator(r, e) {
|
|
7007
7053
|
await this._authzIoService.updateCollaborator({
|
|
7008
7054
|
objectID: this._unitId,
|
|
7009
7055
|
unitID: this._unitId,
|
|
7010
7056
|
collaborator: {
|
|
7011
|
-
id:
|
|
7012
|
-
subject:
|
|
7057
|
+
id: r.userID,
|
|
7058
|
+
subject: r,
|
|
7013
7059
|
role: e
|
|
7014
7060
|
}
|
|
7015
7061
|
}), this._collaboratorChangeSubject.next({
|
|
7016
7062
|
type: "update",
|
|
7017
7063
|
collaborator: {
|
|
7018
|
-
user: { id:
|
|
7064
|
+
user: { id: r.userID },
|
|
7019
7065
|
role: e
|
|
7020
7066
|
}
|
|
7021
7067
|
});
|
|
@@ -7031,15 +7077,15 @@ let Be = class {
|
|
|
7031
7077
|
* await permission?.removeCollaborator('user1');
|
|
7032
7078
|
* ```
|
|
7033
7079
|
*/
|
|
7034
|
-
async removeCollaborator(
|
|
7080
|
+
async removeCollaborator(r) {
|
|
7035
7081
|
await this._authzIoService.deleteCollaborator({
|
|
7036
7082
|
objectID: this._unitId,
|
|
7037
7083
|
unitID: this._unitId,
|
|
7038
|
-
collaboratorID:
|
|
7084
|
+
collaboratorID: r
|
|
7039
7085
|
}), this._collaboratorChangeSubject.next({
|
|
7040
7086
|
type: "delete",
|
|
7041
7087
|
collaborator: {
|
|
7042
|
-
user: { id:
|
|
7088
|
+
user: { id: r },
|
|
7043
7089
|
role: H.Reader
|
|
7044
7090
|
// Placeholder value
|
|
7045
7091
|
}
|
|
@@ -7056,8 +7102,8 @@ let Be = class {
|
|
|
7056
7102
|
* await permission?.removeCollaborators(['user1', 'user2']);
|
|
7057
7103
|
* ```
|
|
7058
7104
|
*/
|
|
7059
|
-
async removeCollaborators(
|
|
7060
|
-
for (const e of
|
|
7105
|
+
async removeCollaborators(r) {
|
|
7106
|
+
for (const e of r)
|
|
7061
7107
|
await this.removeCollaborator(e);
|
|
7062
7108
|
}
|
|
7063
7109
|
/**
|
|
@@ -7102,32 +7148,32 @@ let Be = class {
|
|
|
7102
7148
|
* unsubscribe?.();
|
|
7103
7149
|
* ```
|
|
7104
7150
|
*/
|
|
7105
|
-
subscribe(
|
|
7106
|
-
const e = this.permission$.subscribe(
|
|
7151
|
+
subscribe(r) {
|
|
7152
|
+
const e = this.permission$.subscribe(r);
|
|
7107
7153
|
return () => e.unsubscribe();
|
|
7108
7154
|
}
|
|
7109
7155
|
/**
|
|
7110
7156
|
* Clean up resources
|
|
7111
7157
|
*/
|
|
7112
7158
|
dispose() {
|
|
7113
|
-
this._subscriptions.forEach((
|
|
7159
|
+
this._subscriptions.forEach((r) => r.unsubscribe()), this._permissionSubject.complete(), this._collaboratorChangeSubject.complete();
|
|
7114
7160
|
}
|
|
7115
7161
|
};
|
|
7116
|
-
Be =
|
|
7117
|
-
Ue(1, l(
|
|
7162
|
+
Be = Zn([
|
|
7163
|
+
Ue(1, l(P)),
|
|
7118
7164
|
Ue(2, Y),
|
|
7119
7165
|
Ue(3, re)
|
|
7120
7166
|
], Be);
|
|
7121
|
-
var
|
|
7122
|
-
for (var
|
|
7123
|
-
(o =
|
|
7124
|
-
return
|
|
7125
|
-
}, j = (
|
|
7126
|
-
let
|
|
7127
|
-
constructor(e, t, s,
|
|
7167
|
+
var Qn = Object.getOwnPropertyDescriptor, Xn = (r, e, t, s) => {
|
|
7168
|
+
for (var n = s > 1 ? void 0 : s ? Qn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
7169
|
+
(o = r[i]) && (n = o(n) || n);
|
|
7170
|
+
return n;
|
|
7171
|
+
}, j = (r, e) => (t, s) => e(t, s, r);
|
|
7172
|
+
let E = class extends He {
|
|
7173
|
+
constructor(e, t, s, n, i, o, a, h, c, d) {
|
|
7128
7174
|
super(t);
|
|
7129
7175
|
w(this, "id");
|
|
7130
|
-
this._workbook = e, this._injector = t, this._resourceLoaderService = s, this._selectionManagerService =
|
|
7176
|
+
this._workbook = e, this._injector = t, this._resourceLoaderService = s, this._selectionManagerService = n, this._univerInstanceService = i, this._commandService = o, this._permissionService = a, this._logService = h, this._localeService = c, this._definedNamesService = d, this.id = this._workbook.getUnitId();
|
|
7131
7177
|
}
|
|
7132
7178
|
/**
|
|
7133
7179
|
* Get the Workbook instance.
|
|
@@ -7185,7 +7231,7 @@ let P = class extends He {
|
|
|
7185
7231
|
* ```
|
|
7186
7232
|
*/
|
|
7187
7233
|
setName(e) {
|
|
7188
|
-
return this._commandService.syncExecuteCommand(
|
|
7234
|
+
return this._commandService.syncExecuteCommand(gn.id, {
|
|
7189
7235
|
unitId: this._workbook.getUnitId(),
|
|
7190
7236
|
name: e
|
|
7191
7237
|
}), this;
|
|
@@ -7283,11 +7329,11 @@ let P = class extends He {
|
|
|
7283
7329
|
* console.log(newSheetWithData);
|
|
7284
7330
|
* ```
|
|
7285
7331
|
*/
|
|
7286
|
-
create(e, t, s,
|
|
7287
|
-
var h,
|
|
7288
|
-
const i = Qe(Xe.deepClone((h =
|
|
7289
|
-
i.name = this._workbook.uniqueSheetName(e), i.rowCount = t, i.columnCount = s, i.id = (
|
|
7290
|
-
const o = (
|
|
7332
|
+
create(e, t, s, n) {
|
|
7333
|
+
var h, c, d;
|
|
7334
|
+
const i = Qe(Xe.deepClone((h = n == null ? void 0 : n.sheet) != null ? h : {}));
|
|
7335
|
+
i.name = this._workbook.uniqueSheetName(e), i.rowCount = t, i.columnCount = s, i.id = (c = n == null ? void 0 : n.sheet) == null ? void 0 : c.id;
|
|
7336
|
+
const o = (d = n == null ? void 0 : n.index) != null ? d : this._workbook.getSheets().length;
|
|
7291
7337
|
this._commandService.syncExecuteCommand(me.id, {
|
|
7292
7338
|
unitId: this.id,
|
|
7293
7339
|
index: o,
|
|
@@ -7394,14 +7440,14 @@ let P = class extends He {
|
|
|
7394
7440
|
var o, a, h;
|
|
7395
7441
|
const s = Qe(Xe.deepClone((o = t == null ? void 0 : t.sheet) != null ? o : {}));
|
|
7396
7442
|
s.name = this._workbook.uniqueSheetName(e), s.id = (a = t == null ? void 0 : t.sheet) == null ? void 0 : a.id;
|
|
7397
|
-
const
|
|
7443
|
+
const n = (h = t == null ? void 0 : t.index) != null ? h : this._workbook.getSheets().length;
|
|
7398
7444
|
this._commandService.syncExecuteCommand(me.id, {
|
|
7399
7445
|
unitId: this.id,
|
|
7400
|
-
index:
|
|
7446
|
+
index: n,
|
|
7401
7447
|
sheet: s
|
|
7402
7448
|
}), this._commandService.syncExecuteCommand(te.id, {
|
|
7403
7449
|
unitId: this.id,
|
|
7404
|
-
subUnitId: this._workbook.getSheets()[
|
|
7450
|
+
subUnitId: this._workbook.getSheets()[n].getSheetId()
|
|
7405
7451
|
});
|
|
7406
7452
|
const i = this._workbook.getActiveSheet();
|
|
7407
7453
|
if (!i)
|
|
@@ -7442,7 +7488,7 @@ let P = class extends He {
|
|
|
7442
7488
|
* ```
|
|
7443
7489
|
*/
|
|
7444
7490
|
undo() {
|
|
7445
|
-
return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(
|
|
7491
|
+
return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(Vt.id), this;
|
|
7446
7492
|
}
|
|
7447
7493
|
/**
|
|
7448
7494
|
* Redo the last undone action.
|
|
@@ -7455,7 +7501,7 @@ let P = class extends He {
|
|
|
7455
7501
|
* ```
|
|
7456
7502
|
*/
|
|
7457
7503
|
redo() {
|
|
7458
|
-
return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(
|
|
7504
|
+
return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(At.id), this;
|
|
7459
7505
|
}
|
|
7460
7506
|
/**
|
|
7461
7507
|
* Callback for command execution.
|
|
@@ -7524,7 +7570,7 @@ let P = class extends He {
|
|
|
7524
7570
|
* ```
|
|
7525
7571
|
*/
|
|
7526
7572
|
onSelectionChange(e) {
|
|
7527
|
-
return
|
|
7573
|
+
return ft(
|
|
7528
7574
|
this._selectionManagerService.selectionMoveEnd$.subscribe((t) => {
|
|
7529
7575
|
this._univerInstanceService.getCurrentUnitForType(F.UNIVER_SHEET).getUnitId() === this.id && (t != null && t.length ? e(t.map((s) => s.range)) : e([]));
|
|
7530
7576
|
})
|
|
@@ -7557,14 +7603,14 @@ let P = class extends He {
|
|
|
7557
7603
|
* ```
|
|
7558
7604
|
*/
|
|
7559
7605
|
setActiveRange(e) {
|
|
7560
|
-
const t = this.getActiveSheet(), s = e.getRange().sheetId || t.getSheetId(),
|
|
7561
|
-
if (!
|
|
7606
|
+
const t = this.getActiveSheet(), s = e.getRange().sheetId || t.getSheetId(), n = s ? this._workbook.getSheetBySheetId(s) : this._workbook.getActiveSheet(!0);
|
|
7607
|
+
if (!n)
|
|
7562
7608
|
throw new Error("No active sheet found");
|
|
7563
|
-
|
|
7609
|
+
n.getSheetId() !== t.getSheetId() && this.setActiveSheet(this._injector.createInstance(v, this, this._workbook, n));
|
|
7564
7610
|
const i = {
|
|
7565
7611
|
unitId: this.getId(),
|
|
7566
7612
|
subUnitId: s,
|
|
7567
|
-
selections: [e].map((o) => ({ range: o.getRange(), primary: le(o.getRange(),
|
|
7613
|
+
selections: [e].map((o) => ({ range: o.getRange(), primary: le(o.getRange(), n), style: null }))
|
|
7568
7614
|
};
|
|
7569
7615
|
return this._commandService.syncExecuteCommand(Ge.id, i), this;
|
|
7570
7616
|
}
|
|
@@ -7580,7 +7626,7 @@ let P = class extends He {
|
|
|
7580
7626
|
*/
|
|
7581
7627
|
// could sheet have no active range ?
|
|
7582
7628
|
getActiveRange() {
|
|
7583
|
-
const e = this._workbook.getActiveSheet(), s = this._selectionManagerService.getCurrentSelections().find((
|
|
7629
|
+
const e = this._workbook.getActiveSheet(), s = this._selectionManagerService.getCurrentSelections().find((n) => !!n.primary);
|
|
7584
7630
|
return s ? this._injector.createInstance(R, this._workbook, e, s.range) : null;
|
|
7585
7631
|
}
|
|
7586
7632
|
/**
|
|
@@ -7596,11 +7642,11 @@ let P = class extends He {
|
|
|
7596
7642
|
const e = this._workbook.getActiveSheet(), s = this._selectionManagerService.getCurrentSelections().find((i) => !!i.primary);
|
|
7597
7643
|
if (!s)
|
|
7598
7644
|
return null;
|
|
7599
|
-
const
|
|
7645
|
+
const n = {
|
|
7600
7646
|
...s.primary,
|
|
7601
7647
|
rangeType: p.NORMAL
|
|
7602
7648
|
};
|
|
7603
|
-
return this._injector.createInstance(R, this._workbook, e,
|
|
7649
|
+
return this._injector.createInstance(R, this._workbook, e, n);
|
|
7604
7650
|
}
|
|
7605
7651
|
/**
|
|
7606
7652
|
* Deletes the currently active sheet.
|
|
@@ -7629,7 +7675,7 @@ let P = class extends He {
|
|
|
7629
7675
|
* ```
|
|
7630
7676
|
*/
|
|
7631
7677
|
duplicateSheet(e) {
|
|
7632
|
-
return this._commandService.syncExecuteCommand(
|
|
7678
|
+
return this._commandService.syncExecuteCommand(_n.id, {
|
|
7633
7679
|
unitId: e.getWorkbook().getUnitId(),
|
|
7634
7680
|
subUnitId: e.getSheetId()
|
|
7635
7681
|
}), this._injector.createInstance(v, this, this._workbook, this._workbook.getActiveSheet());
|
|
@@ -7725,7 +7771,7 @@ let P = class extends He {
|
|
|
7725
7771
|
*/
|
|
7726
7772
|
moveSheet(e, t) {
|
|
7727
7773
|
let s = t;
|
|
7728
|
-
return s < 0 ? s = 0 : s > this._workbook.getSheets().length - 1 && (s = this._workbook.getSheets().length - 1), this._commandService.syncExecuteCommand(
|
|
7774
|
+
return s < 0 ? s = 0 : s > this._workbook.getSheets().length - 1 && (s = this._workbook.getSheets().length - 1), this._commandService.syncExecuteCommand(wn.id, {
|
|
7729
7775
|
unitId: e.getWorkbook().getUnitId(),
|
|
7730
7776
|
order: s,
|
|
7731
7777
|
subUnitId: e.getSheetId()
|
|
@@ -7836,8 +7882,8 @@ let P = class extends He {
|
|
|
7836
7882
|
* ```
|
|
7837
7883
|
*/
|
|
7838
7884
|
insertDefinedName(e, t) {
|
|
7839
|
-
const
|
|
7840
|
-
return
|
|
7885
|
+
const n = this._injector.createInstance(Ce).setName(e).setRef(t).build();
|
|
7886
|
+
return n.localSheetId = ne, this.insertDefinedNameBuilder(n), this;
|
|
7841
7887
|
}
|
|
7842
7888
|
/**
|
|
7843
7889
|
* Delete the defined name with the given name.
|
|
@@ -7909,7 +7955,7 @@ let P = class extends He {
|
|
|
7909
7955
|
* ```
|
|
7910
7956
|
*/
|
|
7911
7957
|
getRegisteredRangeThemes() {
|
|
7912
|
-
return this._injector.get(
|
|
7958
|
+
return this._injector.get(Wt).getRegisteredRangeThemes();
|
|
7913
7959
|
}
|
|
7914
7960
|
/**
|
|
7915
7961
|
* Register a custom range theme style.
|
|
@@ -7929,7 +7975,7 @@ let P = class extends He {
|
|
|
7929
7975
|
* ```
|
|
7930
7976
|
*/
|
|
7931
7977
|
registerRangeTheme(e) {
|
|
7932
|
-
this._commandService.syncExecuteCommand(
|
|
7978
|
+
this._commandService.syncExecuteCommand(Sn.id, {
|
|
7933
7979
|
unitId: this.getId(),
|
|
7934
7980
|
rangeThemeStyle: e
|
|
7935
7981
|
});
|
|
@@ -7945,7 +7991,7 @@ let P = class extends He {
|
|
|
7945
7991
|
* ```
|
|
7946
7992
|
*/
|
|
7947
7993
|
unregisterRangeTheme(e) {
|
|
7948
|
-
this._commandService.syncExecuteCommand(
|
|
7994
|
+
this._commandService.syncExecuteCommand(kn.id, {
|
|
7949
7995
|
unitId: this.getId(),
|
|
7950
7996
|
themeName: e
|
|
7951
7997
|
});
|
|
@@ -7969,7 +8015,7 @@ let P = class extends He {
|
|
|
7969
8015
|
* ```
|
|
7970
8016
|
*/
|
|
7971
8017
|
createRangeThemeStyle(e, t) {
|
|
7972
|
-
return new
|
|
8018
|
+
return new Cn(e, t);
|
|
7973
8019
|
}
|
|
7974
8020
|
/**
|
|
7975
8021
|
* Set custom metadata of workbook
|
|
@@ -8074,18 +8120,18 @@ let P = class extends He {
|
|
|
8074
8120
|
this._workbook.removeStyles(e);
|
|
8075
8121
|
}
|
|
8076
8122
|
};
|
|
8077
|
-
|
|
8078
|
-
j(1, l(
|
|
8079
|
-
j(2, l(
|
|
8080
|
-
j(3, l(
|
|
8123
|
+
E = Xn([
|
|
8124
|
+
j(1, l(P)),
|
|
8125
|
+
j(2, l(Bt)),
|
|
8126
|
+
j(3, l(Ut)),
|
|
8081
8127
|
j(4, De),
|
|
8082
8128
|
j(5, C),
|
|
8083
8129
|
j(6, Y),
|
|
8084
|
-
j(7,
|
|
8085
|
-
j(8, l(
|
|
8086
|
-
j(9,
|
|
8087
|
-
],
|
|
8088
|
-
class
|
|
8130
|
+
j(7, It),
|
|
8131
|
+
j(8, l(Ct)),
|
|
8132
|
+
j(9, jt)
|
|
8133
|
+
], E);
|
|
8134
|
+
class er extends vt {
|
|
8089
8135
|
getCommandSheetTarget(e) {
|
|
8090
8136
|
var i;
|
|
8091
8137
|
const t = e.params;
|
|
@@ -8093,17 +8139,17 @@ class Xn extends ft {
|
|
|
8093
8139
|
const s = t.unitId ? this.getUniverSheet(t.unitId) : (i = this.getActiveWorkbook) == null ? void 0 : i.call(this);
|
|
8094
8140
|
if (!s)
|
|
8095
8141
|
return;
|
|
8096
|
-
const
|
|
8097
|
-
if (
|
|
8098
|
-
return { workbook: s, worksheet:
|
|
8142
|
+
const n = s.getSheetBySheetId(t.subUnitId || t.sheetId) || s.getActiveSheet();
|
|
8143
|
+
if (n)
|
|
8144
|
+
return { workbook: s, worksheet: n };
|
|
8099
8145
|
}
|
|
8100
8146
|
getSheetTarget(e, t) {
|
|
8101
8147
|
const s = this.getUniverSheet(e);
|
|
8102
8148
|
if (!s)
|
|
8103
8149
|
return;
|
|
8104
|
-
const
|
|
8105
|
-
if (
|
|
8106
|
-
return { workbook: s, worksheet:
|
|
8150
|
+
const n = s.getSheetBySheetId(t);
|
|
8151
|
+
if (n)
|
|
8152
|
+
return { workbook: s, worksheet: n };
|
|
8107
8153
|
}
|
|
8108
8154
|
_initWorkbookEvent(e) {
|
|
8109
8155
|
const t = e.get(De);
|
|
@@ -8120,7 +8166,7 @@ class Xn extends ft {
|
|
|
8120
8166
|
this.Event.WorkbookCreated,
|
|
8121
8167
|
() => t.unitAdded$.subscribe((s) => {
|
|
8122
8168
|
if (s.type === F.UNIVER_SHEET) {
|
|
8123
|
-
const
|
|
8169
|
+
const n = s, i = e.createInstance(E, n);
|
|
8124
8170
|
this.fireEvent(this.Event.WorkbookCreated, {
|
|
8125
8171
|
unitId: s.getUnitId(),
|
|
8126
8172
|
type: s.type,
|
|
@@ -8140,35 +8186,35 @@ class Xn extends ft {
|
|
|
8140
8186
|
this.registerEventHandler(
|
|
8141
8187
|
this.Event.BeforeSheetCreate,
|
|
8142
8188
|
() => t.beforeCommandExecuted((s) => {
|
|
8143
|
-
var
|
|
8189
|
+
var n;
|
|
8144
8190
|
if (s.id === me.id) {
|
|
8145
|
-
const i = s.params, { unitId: o, index: a, sheet: h } = i || {},
|
|
8146
|
-
if (!
|
|
8191
|
+
const i = s.params, { unitId: o, index: a, sheet: h } = i || {}, c = o ? this.getUniverSheet(o) : (n = this.getActiveWorkbook) == null ? void 0 : n.call(this);
|
|
8192
|
+
if (!c)
|
|
8147
8193
|
return;
|
|
8148
|
-
const
|
|
8149
|
-
workbook:
|
|
8194
|
+
const d = {
|
|
8195
|
+
workbook: c,
|
|
8150
8196
|
index: a,
|
|
8151
8197
|
sheet: h
|
|
8152
8198
|
};
|
|
8153
|
-
if (this.fireEvent(this.Event.BeforeSheetCreate,
|
|
8199
|
+
if (this.fireEvent(this.Event.BeforeSheetCreate, d), d.cancel)
|
|
8154
8200
|
throw new M();
|
|
8155
8201
|
}
|
|
8156
8202
|
})
|
|
8157
8203
|
), this.registerEventHandler(
|
|
8158
8204
|
this.Event.BeforeActiveSheetChange,
|
|
8159
8205
|
() => t.beforeCommandExecuted((s) => {
|
|
8160
|
-
var
|
|
8206
|
+
var n;
|
|
8161
8207
|
if (s.id === te.id) {
|
|
8162
|
-
const { subUnitId: i, unitId: o } = s.params, a = o ? this.getUniverSheet(o) : (
|
|
8208
|
+
const { subUnitId: i, unitId: o } = s.params, a = o ? this.getUniverSheet(o) : (n = this.getActiveWorkbook) == null ? void 0 : n.call(this);
|
|
8163
8209
|
if (!a || !i) return;
|
|
8164
|
-
const h = a.getSheetBySheetId(i),
|
|
8165
|
-
if (!h || !
|
|
8166
|
-
const
|
|
8210
|
+
const h = a.getSheetBySheetId(i), c = a.getActiveSheet();
|
|
8211
|
+
if (!h || !c) return;
|
|
8212
|
+
const d = {
|
|
8167
8213
|
workbook: a,
|
|
8168
8214
|
activeSheet: h,
|
|
8169
|
-
oldActiveSheet:
|
|
8215
|
+
oldActiveSheet: c
|
|
8170
8216
|
};
|
|
8171
|
-
if (this.fireEvent(this.Event.BeforeActiveSheetChange,
|
|
8217
|
+
if (this.fireEvent(this.Event.BeforeActiveSheetChange, d), d.cancel)
|
|
8172
8218
|
throw new M();
|
|
8173
8219
|
}
|
|
8174
8220
|
})
|
|
@@ -8176,9 +8222,9 @@ class Xn extends ft {
|
|
|
8176
8222
|
this.Event.BeforeSheetDelete,
|
|
8177
8223
|
() => t.beforeCommandExecuted((s) => {
|
|
8178
8224
|
if (s.id === Te.id) {
|
|
8179
|
-
const
|
|
8180
|
-
if (!
|
|
8181
|
-
const { workbook: i, worksheet: o } =
|
|
8225
|
+
const n = this.getCommandSheetTarget(s);
|
|
8226
|
+
if (!n) return;
|
|
8227
|
+
const { workbook: i, worksheet: o } = n, a = {
|
|
8182
8228
|
workbook: i,
|
|
8183
8229
|
worksheet: o
|
|
8184
8230
|
};
|
|
@@ -8189,14 +8235,14 @@ class Xn extends ft {
|
|
|
8189
8235
|
), this.registerEventHandler(
|
|
8190
8236
|
this.Event.BeforeSheetMove,
|
|
8191
8237
|
() => t.beforeCommandExecuted((s) => {
|
|
8192
|
-
if (s.id ===
|
|
8193
|
-
const { fromOrder:
|
|
8238
|
+
if (s.id === mt.id) {
|
|
8239
|
+
const { fromOrder: n, toOrder: i } = s.params, o = this.getCommandSheetTarget(s);
|
|
8194
8240
|
if (!o) return;
|
|
8195
8241
|
const a = {
|
|
8196
8242
|
workbook: o.workbook,
|
|
8197
8243
|
worksheet: o.worksheet,
|
|
8198
8244
|
newIndex: i,
|
|
8199
|
-
oldIndex:
|
|
8245
|
+
oldIndex: n
|
|
8200
8246
|
};
|
|
8201
8247
|
if (this.fireEvent(this.Event.BeforeSheetMove, a), a.cancel)
|
|
8202
8248
|
throw new M();
|
|
@@ -8206,12 +8252,12 @@ class Xn extends ft {
|
|
|
8206
8252
|
this.Event.BeforeSheetNameChange,
|
|
8207
8253
|
() => t.beforeCommandExecuted((s) => {
|
|
8208
8254
|
if (s.id === Oe.id) {
|
|
8209
|
-
const { name:
|
|
8255
|
+
const { name: n } = s.params, i = this.getCommandSheetTarget(s);
|
|
8210
8256
|
if (!i) return;
|
|
8211
8257
|
const o = {
|
|
8212
8258
|
workbook: i.workbook,
|
|
8213
8259
|
worksheet: i.worksheet,
|
|
8214
|
-
newName:
|
|
8260
|
+
newName: n,
|
|
8215
8261
|
oldName: i.worksheet.getSheetName()
|
|
8216
8262
|
};
|
|
8217
8263
|
if (this.fireEvent(this.Event.BeforeSheetNameChange, o), o.cancel)
|
|
@@ -8221,13 +8267,13 @@ class Xn extends ft {
|
|
|
8221
8267
|
), this.registerEventHandler(
|
|
8222
8268
|
this.Event.BeforeSheetTabColorChange,
|
|
8223
8269
|
() => t.beforeCommandExecuted((s) => {
|
|
8224
|
-
if (s.id ===
|
|
8225
|
-
const { color:
|
|
8270
|
+
if (s.id === gt.id) {
|
|
8271
|
+
const { color: n } = s.params, i = this.getCommandSheetTarget(s);
|
|
8226
8272
|
if (!i) return;
|
|
8227
8273
|
const o = {
|
|
8228
8274
|
workbook: i.workbook,
|
|
8229
8275
|
worksheet: i.worksheet,
|
|
8230
|
-
newColor:
|
|
8276
|
+
newColor: n,
|
|
8231
8277
|
oldColor: i.worksheet.getTabColor()
|
|
8232
8278
|
};
|
|
8233
8279
|
if (this.fireEvent(this.Event.BeforeSheetTabColorChange, o), o.cancel)
|
|
@@ -8237,13 +8283,13 @@ class Xn extends ft {
|
|
|
8237
8283
|
), this.registerEventHandler(
|
|
8238
8284
|
this.Event.BeforeSheetHideChange,
|
|
8239
8285
|
() => t.beforeCommandExecuted((s) => {
|
|
8240
|
-
if (s.id ===
|
|
8241
|
-
const { hidden:
|
|
8286
|
+
if (s.id === _t.id) {
|
|
8287
|
+
const { hidden: n } = s.params, i = this.getCommandSheetTarget(s);
|
|
8242
8288
|
if (!i) return;
|
|
8243
8289
|
const o = {
|
|
8244
8290
|
workbook: i.workbook,
|
|
8245
8291
|
worksheet: i.worksheet,
|
|
8246
|
-
hidden: !!
|
|
8292
|
+
hidden: !!n
|
|
8247
8293
|
};
|
|
8248
8294
|
if (this.fireEvent(this.Event.BeforeSheetHideChange, o), o.cancel)
|
|
8249
8295
|
throw new M();
|
|
@@ -8252,13 +8298,13 @@ class Xn extends ft {
|
|
|
8252
8298
|
), this.registerEventHandler(
|
|
8253
8299
|
this.Event.BeforeGridlineColorChange,
|
|
8254
8300
|
() => t.beforeCommandExecuted((s) => {
|
|
8255
|
-
var
|
|
8301
|
+
var n;
|
|
8256
8302
|
if (s.id === Ne.id) {
|
|
8257
8303
|
const i = this.getCommandSheetTarget(s);
|
|
8258
8304
|
if (!i) return;
|
|
8259
8305
|
const o = {
|
|
8260
8306
|
...i,
|
|
8261
|
-
color: (
|
|
8307
|
+
color: (n = s.params) == null ? void 0 : n.color
|
|
8262
8308
|
};
|
|
8263
8309
|
if (this.fireEvent(this.Event.BeforeGridlineColorChange, o), o.cancel)
|
|
8264
8310
|
throw new M();
|
|
@@ -8267,13 +8313,13 @@ class Xn extends ft {
|
|
|
8267
8313
|
), this.registerEventHandler(
|
|
8268
8314
|
this.Event.BeforeGridlineEnableChange,
|
|
8269
8315
|
() => t.beforeCommandExecuted((s) => {
|
|
8270
|
-
var
|
|
8316
|
+
var n;
|
|
8271
8317
|
if (s.id === je.id) {
|
|
8272
8318
|
const i = this.getCommandSheetTarget(s);
|
|
8273
8319
|
if (!i) return;
|
|
8274
8320
|
const o = {
|
|
8275
8321
|
...i,
|
|
8276
|
-
enabled: !!((
|
|
8322
|
+
enabled: !!((n = s.params) != null && n.showGridlines)
|
|
8277
8323
|
};
|
|
8278
8324
|
if (this.fireEvent(this.Event.BeforeGridlineEnableChange, o), o.cancel)
|
|
8279
8325
|
throw new M();
|
|
@@ -8282,9 +8328,9 @@ class Xn extends ft {
|
|
|
8282
8328
|
), this.registerEventHandler(
|
|
8283
8329
|
this.Event.SheetValueChanged,
|
|
8284
8330
|
() => t.onCommandExecuted((s) => {
|
|
8285
|
-
if (
|
|
8331
|
+
if (bn.indexOf(s.id) > -1) {
|
|
8286
8332
|
if (!this.getActiveSheet()) return;
|
|
8287
|
-
const i =
|
|
8333
|
+
const i = In(s).map(
|
|
8288
8334
|
(o) => {
|
|
8289
8335
|
var a, h;
|
|
8290
8336
|
return (h = (a = this.getWorkbook(o.unitId)) == null ? void 0 : a.getSheetBySheetId(o.subUnitId)) == null ? void 0 : h.getRange(o.range);
|
|
@@ -8300,21 +8346,21 @@ class Xn extends ft {
|
|
|
8300
8346
|
), this.registerEventHandler(
|
|
8301
8347
|
this.Event.SheetCreated,
|
|
8302
8348
|
() => t.onCommandExecuted((s) => {
|
|
8303
|
-
var
|
|
8349
|
+
var n;
|
|
8304
8350
|
if (s.id === me.id) {
|
|
8305
|
-
const i = s.params, { unitId: o } = i || {}, a = o ? this.getUniverSheet(o) : (
|
|
8351
|
+
const i = s.params, { unitId: o } = i || {}, a = o ? this.getUniverSheet(o) : (n = this.getActiveWorkbook) == null ? void 0 : n.call(this);
|
|
8306
8352
|
if (!a)
|
|
8307
8353
|
return;
|
|
8308
8354
|
const h = a.getActiveSheet();
|
|
8309
8355
|
if (!h)
|
|
8310
8356
|
return;
|
|
8311
|
-
const
|
|
8357
|
+
const c = {
|
|
8312
8358
|
workbook: a,
|
|
8313
8359
|
worksheet: h
|
|
8314
8360
|
};
|
|
8315
8361
|
this.fireEvent(
|
|
8316
8362
|
this.Event.SheetCreated,
|
|
8317
|
-
|
|
8363
|
+
c
|
|
8318
8364
|
);
|
|
8319
8365
|
}
|
|
8320
8366
|
})
|
|
@@ -8322,18 +8368,18 @@ class Xn extends ft {
|
|
|
8322
8368
|
this.Event.ActiveSheetChanged,
|
|
8323
8369
|
() => t.onCommandExecuted((s) => {
|
|
8324
8370
|
if (s.id === te.id) {
|
|
8325
|
-
const
|
|
8326
|
-
if (!
|
|
8327
|
-
const { workbook: i, worksheet: o } =
|
|
8371
|
+
const n = this.getActiveSheet();
|
|
8372
|
+
if (!n) return;
|
|
8373
|
+
const { workbook: i, worksheet: o } = n;
|
|
8328
8374
|
this._fireActiveSheetChanged(i, o);
|
|
8329
8375
|
}
|
|
8330
8376
|
})
|
|
8331
8377
|
), this.registerEventHandler(
|
|
8332
8378
|
this.Event.SheetDeleted,
|
|
8333
8379
|
() => t.onCommandExecuted((s) => {
|
|
8334
|
-
var
|
|
8380
|
+
var n;
|
|
8335
8381
|
if (s.id === Te.id) {
|
|
8336
|
-
const { subUnitId: i, unitId: o } = s.params, a = o ? this.getUniverSheet(o) : (
|
|
8382
|
+
const { subUnitId: i, unitId: o } = s.params, a = o ? this.getUniverSheet(o) : (n = this.getActiveWorkbook) == null ? void 0 : n.call(this);
|
|
8337
8383
|
if (!a || !i) return;
|
|
8338
8384
|
this._fireSheetDeleted(a, i);
|
|
8339
8385
|
}
|
|
@@ -8341,71 +8387,71 @@ class Xn extends ft {
|
|
|
8341
8387
|
), this.registerEventHandler(
|
|
8342
8388
|
this.Event.SheetMoved,
|
|
8343
8389
|
() => t.onCommandExecuted((s) => {
|
|
8344
|
-
if (s.id ===
|
|
8345
|
-
const { toOrder:
|
|
8390
|
+
if (s.id === mt.id) {
|
|
8391
|
+
const { toOrder: n } = s.params, i = this.getCommandSheetTarget(s);
|
|
8346
8392
|
if (!i) return;
|
|
8347
|
-
this._fireSheetMoved(i.workbook, i.worksheet,
|
|
8393
|
+
this._fireSheetMoved(i.workbook, i.worksheet, n);
|
|
8348
8394
|
}
|
|
8349
8395
|
})
|
|
8350
8396
|
), this.registerEventHandler(
|
|
8351
8397
|
this.Event.SheetNameChanged,
|
|
8352
8398
|
() => t.onCommandExecuted((s) => {
|
|
8353
8399
|
if (s.id === Oe.id) {
|
|
8354
|
-
const { name:
|
|
8400
|
+
const { name: n } = s.params, i = this.getCommandSheetTarget(s);
|
|
8355
8401
|
if (!i) return;
|
|
8356
|
-
this._fireSheetNameChanged(i.workbook, i.worksheet,
|
|
8402
|
+
this._fireSheetNameChanged(i.workbook, i.worksheet, n);
|
|
8357
8403
|
}
|
|
8358
8404
|
})
|
|
8359
8405
|
), this.registerEventHandler(
|
|
8360
8406
|
this.Event.SheetTabColorChanged,
|
|
8361
8407
|
() => t.onCommandExecuted((s) => {
|
|
8362
|
-
if (s.id ===
|
|
8363
|
-
const { color:
|
|
8408
|
+
if (s.id === gt.id) {
|
|
8409
|
+
const { color: n } = s.params, i = this.getCommandSheetTarget(s);
|
|
8364
8410
|
if (!i) return;
|
|
8365
|
-
this._fireSheetTabColorChanged(i.workbook, i.worksheet,
|
|
8411
|
+
this._fireSheetTabColorChanged(i.workbook, i.worksheet, n);
|
|
8366
8412
|
}
|
|
8367
8413
|
})
|
|
8368
8414
|
), this.registerEventHandler(
|
|
8369
8415
|
this.Event.SheetHideChanged,
|
|
8370
8416
|
() => t.onCommandExecuted((s) => {
|
|
8371
|
-
if (s.id ===
|
|
8372
|
-
const { hidden:
|
|
8417
|
+
if (s.id === _t.id) {
|
|
8418
|
+
const { hidden: n } = s.params, i = this.getCommandSheetTarget(s);
|
|
8373
8419
|
if (!i) return;
|
|
8374
|
-
this._fireSheetHideChanged(i.workbook, i.worksheet, !!
|
|
8420
|
+
this._fireSheetHideChanged(i.workbook, i.worksheet, !!n);
|
|
8375
8421
|
}
|
|
8376
8422
|
})
|
|
8377
8423
|
), this.registerEventHandler(
|
|
8378
8424
|
this.Event.GridlineChanged,
|
|
8379
8425
|
() => t.onCommandExecuted((s) => {
|
|
8380
8426
|
if (s.id === Ne.id || s.id === je.id) {
|
|
8381
|
-
const
|
|
8382
|
-
if (!
|
|
8427
|
+
const n = this.getCommandSheetTarget(s);
|
|
8428
|
+
if (!n) return;
|
|
8383
8429
|
this.fireEvent(this.Event.GridlineChanged, {
|
|
8384
|
-
...
|
|
8385
|
-
enabled: !
|
|
8386
|
-
color:
|
|
8430
|
+
...n,
|
|
8431
|
+
enabled: !n.worksheet.hasHiddenGridLines(),
|
|
8432
|
+
color: n.worksheet.getGridLinesColor()
|
|
8387
8433
|
});
|
|
8388
8434
|
}
|
|
8389
8435
|
})
|
|
8390
8436
|
), this._initWorkbookEvent(e);
|
|
8391
8437
|
}
|
|
8392
8438
|
createUniverSheet(e, t) {
|
|
8393
|
-
const
|
|
8394
|
-
return this._injector.createInstance(
|
|
8439
|
+
const n = this._injector.get(De).createUnit(F.UNIVER_SHEET, e, t);
|
|
8440
|
+
return this._injector.createInstance(E, n);
|
|
8395
8441
|
}
|
|
8396
8442
|
createWorkbook(e, t) {
|
|
8397
8443
|
return this.createUniverSheet(e, t);
|
|
8398
8444
|
}
|
|
8399
8445
|
getActiveWorkbook() {
|
|
8400
8446
|
const e = this._univerInstanceService.getCurrentUnitForType(F.UNIVER_SHEET);
|
|
8401
|
-
return e ? this._injector.createInstance(
|
|
8447
|
+
return e ? this._injector.createInstance(E, e) : null;
|
|
8402
8448
|
}
|
|
8403
8449
|
getActiveUniverSheet() {
|
|
8404
8450
|
return this.getActiveWorkbook();
|
|
8405
8451
|
}
|
|
8406
8452
|
getUniverSheet(e) {
|
|
8407
8453
|
const t = this._univerInstanceService.getUnit(e, F.UNIVER_SHEET);
|
|
8408
|
-
return t ? this._injector.createInstance(
|
|
8454
|
+
return t ? this._injector.createInstance(E, t) : null;
|
|
8409
8455
|
}
|
|
8410
8456
|
getWorkbook(e) {
|
|
8411
8457
|
return this.getUniverSheet(e);
|
|
@@ -8415,10 +8461,10 @@ class Xn extends ft {
|
|
|
8415
8461
|
}
|
|
8416
8462
|
onUniverSheetCreated(e) {
|
|
8417
8463
|
const t = this._univerInstanceService.getTypeOfUnitAdded$(F.UNIVER_SHEET).subscribe((s) => {
|
|
8418
|
-
const
|
|
8419
|
-
e(
|
|
8464
|
+
const n = this._injector.createInstance(E, s);
|
|
8465
|
+
e(n);
|
|
8420
8466
|
});
|
|
8421
|
-
return
|
|
8467
|
+
return ft(t);
|
|
8422
8468
|
}
|
|
8423
8469
|
newDefinedName() {
|
|
8424
8470
|
return this._injector.createInstance(Ce);
|
|
@@ -8431,7 +8477,7 @@ class Xn extends ft {
|
|
|
8431
8477
|
return t ? { workbook: e, worksheet: t } : null;
|
|
8432
8478
|
}
|
|
8433
8479
|
setFreezeSync(e) {
|
|
8434
|
-
this._injector.get(
|
|
8480
|
+
this._injector.get(fn).setEnabled(e);
|
|
8435
8481
|
}
|
|
8436
8482
|
_fireActiveSheetChanged(e, t) {
|
|
8437
8483
|
this.fireEvent(this.Event.ActiveSheetChanged, {
|
|
@@ -8474,16 +8520,16 @@ class Xn extends ft {
|
|
|
8474
8520
|
});
|
|
8475
8521
|
}
|
|
8476
8522
|
}
|
|
8477
|
-
|
|
8478
|
-
class
|
|
8523
|
+
vt.extend(er);
|
|
8524
|
+
class tr {
|
|
8479
8525
|
get SheetValueChangeType() {
|
|
8480
|
-
return
|
|
8526
|
+
return vn;
|
|
8481
8527
|
}
|
|
8482
8528
|
get SheetSkeletonChangeType() {
|
|
8483
|
-
return
|
|
8529
|
+
return Rn;
|
|
8484
8530
|
}
|
|
8485
8531
|
get SplitDelimiterType() {
|
|
8486
|
-
return
|
|
8532
|
+
return pn;
|
|
8487
8533
|
}
|
|
8488
8534
|
get UnitRole() {
|
|
8489
8535
|
return H;
|
|
@@ -8498,8 +8544,8 @@ class er {
|
|
|
8498
8544
|
return b;
|
|
8499
8545
|
}
|
|
8500
8546
|
}
|
|
8501
|
-
|
|
8502
|
-
class
|
|
8547
|
+
Ft.extend(tr);
|
|
8548
|
+
class sr {
|
|
8503
8549
|
get SheetCreated() {
|
|
8504
8550
|
return "SheetCreated";
|
|
8505
8551
|
}
|
|
@@ -8561,27 +8607,27 @@ class tr {
|
|
|
8561
8607
|
return "SheetValueChanged";
|
|
8562
8608
|
}
|
|
8563
8609
|
}
|
|
8564
|
-
|
|
8565
|
-
var
|
|
8566
|
-
for (var
|
|
8567
|
-
(o =
|
|
8568
|
-
return
|
|
8569
|
-
},
|
|
8570
|
-
let
|
|
8571
|
-
constructor(
|
|
8572
|
-
super(), this._injector =
|
|
8610
|
+
Ht.extend(sr);
|
|
8611
|
+
var nr = Object.getOwnPropertyDescriptor, rr = (r, e, t, s) => {
|
|
8612
|
+
for (var n = s > 1 ? void 0 : s ? nr(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
8613
|
+
(o = r[i]) && (n = o(n) || n);
|
|
8614
|
+
return n;
|
|
8615
|
+
}, ir = (r, e) => (t, s) => e(t, s, r);
|
|
8616
|
+
let kt = class extends Fe {
|
|
8617
|
+
constructor(r) {
|
|
8618
|
+
super(), this._injector = r;
|
|
8573
8619
|
}
|
|
8574
8620
|
};
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
],
|
|
8621
|
+
kt = rr([
|
|
8622
|
+
ir(0, l(P))
|
|
8623
|
+
], kt);
|
|
8578
8624
|
export {
|
|
8579
8625
|
z as FPermission,
|
|
8580
8626
|
R as FRange,
|
|
8581
8627
|
ke as FSelection,
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8628
|
+
sr as FSheetEventName,
|
|
8629
|
+
kt as FSheetHooks,
|
|
8630
|
+
tr as FSheetsEnum,
|
|
8631
|
+
E as FWorkbook,
|
|
8586
8632
|
v as FWorksheet
|
|
8587
8633
|
};
|