@univerjs/sheets 0.14.0 → 0.15.0
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 +2 -2
- package/lib/es/facade.js +825 -741
- package/lib/es/index.js +654 -649
- package/lib/facade.js +825 -741
- package/lib/index.js +654 -649
- package/lib/types/services/selections/selection-data-model.d.ts +2 -0
- package/lib/types/services/selections/selection.service.d.ts +1 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +2 -2
- package/package.json +10 -10
package/lib/es/facade.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Nt = (n, e, t) => e in n ?
|
|
3
|
-
var
|
|
4
|
-
import { Inject as l, Injector as
|
|
5
|
-
import { FBase as
|
|
6
|
-
import { WorksheetProtectionRuleModel as
|
|
7
|
-
import { IDefinedNamesService as
|
|
8
|
-
import { BehaviorSubject as
|
|
9
|
-
import { filter as
|
|
10
|
-
var
|
|
11
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
1
|
+
var jt = Object.defineProperty;
|
|
2
|
+
var Nt = (n, e, t) => e in n ? jt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var w = (n, e, t) => Nt(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Inject as l, Injector as E, ICommandService as C, IPermissionService as Y, IAuthzIoService as re, LocaleService as kt, generateRandomId as Ct, Rectangle as $, cellToRange as Ot, HorizontalAlign as K, VerticalAlign as J, RANGE_TYPE as p, ILogService as bt, 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 Tt, RedoCommand as Vt, toDisposable as It, UniverInstanceType as F, IResourceLoaderService as At, IUniverInstanceService as De, CanceledError as M } from "@univerjs/core";
|
|
5
|
+
import { FBase as Fe, FBaseInitialable as He, FUniver as ft, FEnum as Bt, FEventName as Ft } 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 Ht, WorkbookPermissionService as $t, PermissionPointsDefinitions as zt, WorkbookEditablePermission as Le, UnitObject as A, AddWorksheetProtectionMutation as Lt, DeleteWorksheetProtectionMutation as Gt, getAllWorksheetPermissionPoint as Kt, getAllWorksheetPermissionPointByPointPanel as et, SetWorksheetPermissionPointsMutation as Jt, AddRangeProtectionMutation as vt, ViewStateEnum as U, EditStateEnum as x, DeleteRangeProtectionMutation as Rt, SetRangeProtectionMutation as pt, WorksheetEditPermission as yt, WorksheetViewPermission as Pt, getPrimaryForRange as le, SetSelectionsOperation as Ge, getNextPrimaryCell as qt, WorkbookCopySheetPermission as Yt, WorkbookDeleteColumnPermission as Zt, WorkbookDeleteRowPermission as Qt, WorkbookInsertColumnPermission as Xt, WorkbookInsertRowPermission as es, WorkbookCreateProtectPermission as ts, WorkbookRecoverHistoryPermission as ss, WorkbookHistoryPermission as ns, WorkbookViewHistoryPermission as rs, WorkbookHideSheetPermission as is, WorkbookMoveSheetPermission as os, WorkbookRenameSheetPermission as as, WorkbookDeleteSheetPermission as hs, WorkbookCreateSheetPermission as cs, WorkbookManageCollaboratorPermission as ds, WorkbookCommentPermission as us, WorkbookDuplicatePermission as ls, WorkbookCopyPermission as ms, WorkbookSharePermission as gs, WorkbookExportPermission as _s, WorkbookPrintPermission as ws, WorkbookViewPermission as Ss, WorksheetSelectUnProtectedCellsPermission as ks, WorksheetSelectProtectedCellsPermission as Cs, WorksheetDeleteProtectionPermission as bs, WorksheetManageCollaboratorPermission as Is, WorksheetEditExtraObjectPermission as fs, WorksheetInsertHyperlinkPermission as vs, WorksheetPivotTablePermission as Rs, WorksheetFilterPermission as ps, WorksheetSortPermission as ys, WorksheetDeleteColumnPermission as Ps, WorksheetDeleteRowPermission as Es, WorksheetInsertColumnPermission as Us, WorksheetInsertRowPermission as xs, WorksheetSetColumnStylePermission as Ds, WorksheetSetRowStylePermission as Ms, WorksheetSetCellStylePermission as Ws, WorksheetSetCellValuePermission as js, WorksheetCopyPermission as Ns, RangeProtectionPermissionDeleteProtectionPoint as Os, RangeProtectionPermissionManageCollaPoint as Ts, RangeProtectionPermissionViewPoint as Vs, RangeProtectionPermissionEditPoint as As, SheetsSelectionsService as Et, SetWorksheetDefaultStyleMutation as Bs, SetColDataCommand as tt, SetRowDataCommand as st, copyRangeStyles as ae, InsertRowByRangeCommand as nt, RemoveRowByRangeCommand as Fs, MoveRowsCommand as Hs, SetRowHiddenCommand as rt, SetSpecificRowsVisibleCommand as it, SetTextWrapCommand as We, SetWorksheetRowIsAutoHeightMutation as $s, SetRowHeightCommand as ot, SetWorksheetRowIsAutoHeightCommand as fe, InsertColByRangeCommand as at, RemoveColByRangeCommand as zs, MoveColsCommand as Ls, SetColHiddenCommand as ht, SetSpecificColsVisibleCommand as ct, SetColWidthCommand as Gs, SetFrozenCommand as ve, CancelFrozenCommand as Ks, ToggleGridlinesCommand as je, SetGridlinesColorCommand as Ne, SetTabColorCommand as Js, SetRangeValuesMutation as dt, SetWorksheetHideCommand as qs, SetWorksheetShowCommand as Ys, SetWorksheetNameCommand as Oe, ClearSelectionAllCommand as Ut, ClearSelectionContentCommand as xt, ClearSelectionFormatCommand as Dt, AppendRowCommand as Zs, SetWorksheetRowCountCommand as Qs, SetWorksheetColumnCountCommand as Xs, SetBorderBasicCommand as en, SetStyleCommand as T, SetTextRotationCommand as tn, SetRangeValuesCommand as X, SetVerticalTextAlignCommand as sn, SetHorizontalTextAlignCommand as nn, addMergeCellsUtil as Re, getAddMergeMutationRangeByType as ut, RemoveWorksheetMergeCommand as rn, SplitTextToColumnsCommand as on, SetWorksheetRangeThemeStyleCommand as an, DeleteWorksheetRangeThemeStyleCommand as hn, SheetRangeThemeService as Mt, InsertRangeMoveDownCommand as cn, InsertRangeMoveRightCommand as dn, DeleteRangeMoveUpCommand as un, DeleteRangeMoveLeftCommand as ln, SetWorkbookNameCommand as mn, InsertSheetCommand as me, SetWorksheetActiveOperation as te, RemoveSheetCommand as Te, CopySheetCommand as gn, SetWorksheetOrderCommand as _n, RegisterWorksheetRangeThemeStyleCommand as wn, UnregisterWorksheetRangeThemeStyleCommand as Sn, RangeThemeStyle as kn, SetWorksheetOrderMutation as lt, SetTabColorMutation as mt, SetWorksheetHideMutation as gt, COMMAND_LISTENER_VALUE_CHANGE as Cn, getValueChangedEffectedRange as bn, SheetsFreezeSyncController as In, SheetValueChangeType as fn, SheetSkeletonChangeType as vn, SplitDelimiterEnum as Rn } from "@univerjs/sheets";
|
|
7
|
+
import { IDefinedNamesService as Wt, serializeRange as Ke, deserializeRangeWithSheet as pn, serializeRangeWithSheet as yn, FormulaDataModel as Pn } from "@univerjs/engine-formula";
|
|
8
|
+
import { BehaviorSubject as ge, Subject as En } from "rxjs";
|
|
9
|
+
import { filter as D, distinctUntilChanged as _e, shareReplay as N, map as we } from "rxjs/operators";
|
|
10
|
+
var Un = Object.getOwnPropertyDescriptor, xn = (n, e, t, s) => {
|
|
11
|
+
for (var r = s > 1 ? void 0 : s ? Un(e, t) : e, i = n.length - 1, o; i >= 0; i--)
|
|
12
12
|
(o = n[i]) && (r = o(r) || r);
|
|
13
13
|
return r;
|
|
14
|
-
},
|
|
15
|
-
function
|
|
14
|
+
}, W = (n, e) => (t, s) => e(t, s, n);
|
|
15
|
+
function Dn(n, e, t) {
|
|
16
16
|
const s = t.getDefinedNameMap(n);
|
|
17
17
|
if (s == null)
|
|
18
18
|
return e.t("definedName.defaultName") + 1;
|
|
@@ -27,15 +27,15 @@ function xn(n, e, t) {
|
|
|
27
27
|
a++;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
class
|
|
30
|
+
class Ce {
|
|
31
31
|
constructor() {
|
|
32
|
-
|
|
32
|
+
w(this, "_definedNameParam");
|
|
33
33
|
this._definedNameParam = {
|
|
34
|
-
id:
|
|
34
|
+
id: Ct(10),
|
|
35
35
|
unitId: "",
|
|
36
36
|
name: "",
|
|
37
37
|
formulaOrRefString: "",
|
|
38
|
-
localSheetId:
|
|
38
|
+
localSheetId: ne
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
@@ -107,7 +107,7 @@ class Se {
|
|
|
107
107
|
* ```
|
|
108
108
|
*/
|
|
109
109
|
setRefByRange(e, t, s, r) {
|
|
110
|
-
return this._definedNameParam.formulaOrRefString =
|
|
110
|
+
return this._definedNameParam.formulaOrRefString = Ke({
|
|
111
111
|
startRow: e,
|
|
112
112
|
endRow: e + (s != null ? s : 1) - 1,
|
|
113
113
|
startColumn: t,
|
|
@@ -170,7 +170,7 @@ class Se {
|
|
|
170
170
|
* ```
|
|
171
171
|
*/
|
|
172
172
|
setScopeToWorkbook() {
|
|
173
|
-
return this._definedNameParam.localSheetId =
|
|
173
|
+
return this._definedNameParam.localSheetId = ne, this;
|
|
174
174
|
}
|
|
175
175
|
/**
|
|
176
176
|
* Sets the hidden status of the defined name builder.
|
|
@@ -230,12 +230,12 @@ class Se {
|
|
|
230
230
|
return this._definedNameParam = e, this;
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
let
|
|
234
|
-
constructor(n, e, t, s, r, i, o, a, h,
|
|
235
|
-
super(), this._definedNameParam = n, this._injector = e, this._commandService = t, this._permissionService = s, this._worksheetProtectionRuleModel = r, this._rangeProtectionRuleModel = i, this._worksheetProtectionPointRuleModel = o, this._authzIoService = a, this._localeService = h, this._definedNamesService =
|
|
233
|
+
let Se = class extends Fe {
|
|
234
|
+
constructor(n, e, t, s, r, i, o, a, h, d) {
|
|
235
|
+
super(), this._definedNameParam = n, this._injector = e, this._commandService = t, this._permissionService = s, this._worksheetProtectionRuleModel = r, this._rangeProtectionRuleModel = i, this._worksheetProtectionPointRuleModel = o, this._authzIoService = a, this._localeService = h, this._definedNamesService = d;
|
|
236
236
|
}
|
|
237
237
|
_apply() {
|
|
238
|
-
this._definedNameParam.name === "" && (this._definedNameParam.name =
|
|
238
|
+
this._definedNameParam.name === "" && (this._definedNameParam.name = Dn(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.
|
|
@@ -316,7 +316,7 @@ let _e = class extends Ve {
|
|
|
316
316
|
* ```
|
|
317
317
|
*/
|
|
318
318
|
setRefByRange(n, e, t, s) {
|
|
319
|
-
this._definedNameParam.formulaOrRefString =
|
|
319
|
+
this._definedNameParam.formulaOrRefString = Ke({
|
|
320
320
|
startRow: n,
|
|
321
321
|
endRow: n + (t != null ? t : 1) - 1,
|
|
322
322
|
startColumn: e,
|
|
@@ -375,7 +375,7 @@ let _e = class extends Ve {
|
|
|
375
375
|
* ```
|
|
376
376
|
*/
|
|
377
377
|
setScopeToWorkbook() {
|
|
378
|
-
this._definedNameParam.localSheetId =
|
|
378
|
+
this._definedNameParam.localSheetId = ne, this._apply();
|
|
379
379
|
}
|
|
380
380
|
/**
|
|
381
381
|
* Sets the hidden status of the defined name.
|
|
@@ -400,7 +400,7 @@ let _e = class extends Ve {
|
|
|
400
400
|
* ```
|
|
401
401
|
*/
|
|
402
402
|
delete() {
|
|
403
|
-
this._commandService.syncExecuteCommand(
|
|
403
|
+
this._commandService.syncExecuteCommand(Ht.id, this._definedNameParam);
|
|
404
404
|
}
|
|
405
405
|
/**
|
|
406
406
|
* Gets the local sheet id of the defined name.
|
|
@@ -426,7 +426,7 @@ let _e = class extends Ve {
|
|
|
426
426
|
* ```
|
|
427
427
|
*/
|
|
428
428
|
isWorkbookScope() {
|
|
429
|
-
return this._definedNameParam.localSheetId ===
|
|
429
|
+
return this._definedNameParam.localSheetId === ne;
|
|
430
430
|
}
|
|
431
431
|
/**
|
|
432
432
|
* Converts the defined name to a defined name builder.
|
|
@@ -445,45 +445,45 @@ let _e = class extends Ve {
|
|
|
445
445
|
* ```
|
|
446
446
|
*/
|
|
447
447
|
toBuilder() {
|
|
448
|
-
const n = this._injector.createInstance(
|
|
448
|
+
const n = this._injector.createInstance(Ce);
|
|
449
449
|
return n.load(this._definedNameParam), n;
|
|
450
450
|
}
|
|
451
451
|
};
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
],
|
|
463
|
-
var
|
|
464
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
452
|
+
Se = xn([
|
|
453
|
+
W(1, l(E)),
|
|
454
|
+
W(2, C),
|
|
455
|
+
W(3, Y),
|
|
456
|
+
W(4, l($e)),
|
|
457
|
+
W(5, l(ie)),
|
|
458
|
+
W(6, l(ze)),
|
|
459
|
+
W(7, l(re)),
|
|
460
|
+
W(8, l(kt)),
|
|
461
|
+
W(9, Wt)
|
|
462
|
+
], Se);
|
|
463
|
+
var H = /* @__PURE__ */ ((n) => (n[n.Reader = 0] = "Reader", n[n.Editor = 1] = "Editor", n[n.Owner = 2] = "Owner", n))(H || {}), u = /* @__PURE__ */ ((n) => (n.Edit = "WorkbookEdit", n.View = "WorkbookView", n.Print = "WorkbookPrint", n.Export = "WorkbookExport", n.Share = "WorkbookShare", n.CopyContent = "WorkbookCopy", n.DuplicateFile = "WorkbookDuplicate", n.Comment = "WorkbookComment", n.ManageCollaborator = "WorkbookManageCollaborator", n.CreateSheet = "WorkbookCreateSheet", n.DeleteSheet = "WorkbookDeleteSheet", n.RenameSheet = "WorkbookRenameSheet", n.MoveSheet = "WorkbookMoveSheet", n.HideSheet = "WorkbookHideSheet", n.ViewHistory = "WorkbookViewHistory", n.ManageHistory = "WorkbookHistory", n.RecoverHistory = "WorkbookRecoverHistory", n.CreateProtection = "WorkbookCreateProtect", n.InsertRow = "WorkbookInsertRow", n.InsertColumn = "WorkbookInsertColumn", n.DeleteRow = "WorkbookDeleteRow", n.DeleteColumn = "WorkbookDeleteColumn", n.CopySheet = "WorkbookCopySheet", n))(u || {}), _ = /* @__PURE__ */ ((n) => (n.Edit = "WorksheetEdit", n.View = "WorksheetView", n.Copy = "WorksheetCopy", n.SetCellValue = "WorksheetSetCellValue", n.SetCellStyle = "WorksheetSetCellStyle", n.SetRowStyle = "WorksheetSetRowStyle", n.SetColumnStyle = "WorksheetSetColumnStyle", n.InsertRow = "WorksheetInsertRow", n.InsertColumn = "WorksheetInsertColumn", n.DeleteRow = "WorksheetDeleteRow", n.DeleteColumn = "WorksheetDeleteColumn", n.Sort = "WorksheetSort", n.Filter = "WorksheetFilter", n.PivotTable = "WorksheetPivotTable", n.InsertHyperlink = "WorksheetInsertHyperlink", n.EditExtraObject = "WorksheetEditExtraObject", n.ManageCollaborator = "WorksheetManageCollaborator", n.DeleteProtection = "WorksheetDeleteProtection", n.SelectProtectedCells = "WorksheetSelectProtectedCells", n.SelectUnProtectedCells = "WorksheetSelectUnProtectedCells", n))(_ || {}), b = /* @__PURE__ */ ((n) => (n.Edit = "RangeEdit", n.View = "RangeView", n.ManageCollaborator = "RangeManageCollaborator", n.Delete = "RangeDeleteProtection", n))(b || {}), Mn = Object.getOwnPropertyDescriptor, Wn = (n, e, t, s) => {
|
|
464
|
+
for (var r = s > 1 ? void 0 : s ? Mn(e, t) : e, i = n.length - 1, o; i >= 0; i--)
|
|
465
465
|
(o = n[i]) && (r = o(r) || r);
|
|
466
466
|
return r;
|
|
467
|
-
},
|
|
468
|
-
let
|
|
467
|
+
}, V = (n, e) => (t, s) => e(t, s, n);
|
|
468
|
+
let z = class extends Fe {
|
|
469
469
|
constructor(e, t, s, r, 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
|
-
|
|
474
|
+
w(this, "permissionPointsDefinition", zt);
|
|
475
475
|
/**
|
|
476
476
|
* An observable object used to monitor permission change events within a range, thereby triggering corresponding subsequent processing.
|
|
477
477
|
*/
|
|
478
|
-
|
|
478
|
+
w(this, "rangeRuleChangedAfterAuth$");
|
|
479
479
|
/**
|
|
480
480
|
* An observable object used to monitor permission change events within a worksheet, thereby triggering corresponding subsequent processing.
|
|
481
481
|
*/
|
|
482
|
-
|
|
482
|
+
w(this, "sheetRuleChangedAfterAuth$");
|
|
483
483
|
/**
|
|
484
484
|
* An observable object used to monitor the initialization state changes of unit permissions.
|
|
485
485
|
*/
|
|
486
|
-
|
|
486
|
+
w(this, "unitPermissionInitStateChange$");
|
|
487
487
|
this._injector = e, this._commandService = t, this._permissionService = s, this._worksheetProtectionRuleModel = r, 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
|
/**
|
|
@@ -540,7 +540,7 @@ let H = class extends Ve {
|
|
|
540
540
|
* ```
|
|
541
541
|
*/
|
|
542
542
|
setWorkbookEditPermission(e, t) {
|
|
543
|
-
this.setWorkbookPermissionPoint(e,
|
|
543
|
+
this.setWorkbookPermissionPoint(e, Le, t);
|
|
544
544
|
}
|
|
545
545
|
/**
|
|
546
546
|
* This function is used to add a base permission for a worksheet.
|
|
@@ -570,9 +570,29 @@ let H = class extends Ve {
|
|
|
570
570
|
*/
|
|
571
571
|
async addWorksheetBasePermission(e, t, s) {
|
|
572
572
|
let r = [];
|
|
573
|
-
s != null && s.allowedUsers
|
|
573
|
+
if (s != null && s.allowedUsers) {
|
|
574
|
+
const a = await this._authzIoService.listCollaborators({
|
|
575
|
+
objectID: e,
|
|
576
|
+
unitID: e
|
|
577
|
+
}), h = new Set(s.allowedUsers);
|
|
578
|
+
r = a.filter((c) => {
|
|
579
|
+
var m;
|
|
580
|
+
return h.has(((m = c.subject) == null ? void 0 : m.userID) || c.id);
|
|
581
|
+
}).map((c) => ({
|
|
582
|
+
id: c.id,
|
|
583
|
+
role: H.Editor,
|
|
584
|
+
subject: c.subject
|
|
585
|
+
}));
|
|
586
|
+
const d = new Set(r.map((c) => {
|
|
587
|
+
var m;
|
|
588
|
+
return ((m = c.subject) == null ? void 0 : m.userID) || c.id;
|
|
589
|
+
}));
|
|
590
|
+
s.allowedUsers.forEach((c) => {
|
|
591
|
+
d.has(c) || console.error(`User ${c} not found in collaborators list`);
|
|
592
|
+
});
|
|
593
|
+
}
|
|
574
594
|
const i = await this._authzIoService.create({
|
|
575
|
-
objectType:
|
|
595
|
+
objectType: A.Worksheet,
|
|
576
596
|
worksheetObject: {
|
|
577
597
|
collaborators: r,
|
|
578
598
|
unitID: e,
|
|
@@ -581,12 +601,12 @@ let H = class extends Ve {
|
|
|
581
601
|
scope: void 0
|
|
582
602
|
}
|
|
583
603
|
});
|
|
584
|
-
if (this._commandService.syncExecuteCommand(
|
|
604
|
+
if (this._commandService.syncExecuteCommand(Lt.id, {
|
|
585
605
|
unitId: e,
|
|
586
606
|
subUnitId: t,
|
|
587
607
|
rule: {
|
|
588
608
|
permissionId: i,
|
|
589
|
-
unitType:
|
|
609
|
+
unitType: A.Worksheet,
|
|
590
610
|
unitId: e,
|
|
591
611
|
subUnitId: t
|
|
592
612
|
}
|
|
@@ -609,10 +629,10 @@ let H = class extends Ve {
|
|
|
609
629
|
* ```
|
|
610
630
|
*/
|
|
611
631
|
removeWorksheetPermission(e, t) {
|
|
612
|
-
this._commandService.syncExecuteCommand(
|
|
632
|
+
this._commandService.syncExecuteCommand(Gt.id, {
|
|
613
633
|
unitId: e,
|
|
614
634
|
subUnitId: t
|
|
615
|
-
}), [...
|
|
635
|
+
}), [...Kt(), ...et()].forEach((s) => {
|
|
616
636
|
const r = new s(e, t);
|
|
617
637
|
this._permissionService.updatePermissionPoint(r.id, !0);
|
|
618
638
|
}), this._worksheetProtectionPointRuleModel.deleteRule(e, t);
|
|
@@ -642,12 +662,12 @@ let H = class extends Ve {
|
|
|
642
662
|
async setWorksheetPermissionPoint(e, t, s, r) {
|
|
643
663
|
const i = this._worksheetProtectionRuleModel.getRule(e, t);
|
|
644
664
|
let o;
|
|
645
|
-
if (s ===
|
|
665
|
+
if (s === yt || s === Pt)
|
|
646
666
|
i ? o = i.permissionId : o = await this.addWorksheetBasePermission(e, t);
|
|
647
667
|
else {
|
|
648
|
-
const
|
|
649
|
-
|
|
650
|
-
objectType:
|
|
668
|
+
const c = this._worksheetProtectionPointRuleModel.getRule(e, t);
|
|
669
|
+
c ? o = c.permissionId : (o = await this._authzIoService.create({
|
|
670
|
+
objectType: A.Worksheet,
|
|
651
671
|
worksheetObject: {
|
|
652
672
|
collaborators: [],
|
|
653
673
|
unitID: e,
|
|
@@ -655,10 +675,26 @@ let H = class extends Ve {
|
|
|
655
675
|
name: "",
|
|
656
676
|
scope: void 0
|
|
657
677
|
}
|
|
658
|
-
}), this._commandService.syncExecuteCommand(
|
|
678
|
+
}), this._commandService.syncExecuteCommand(Jt.id, { unitId: e, subUnitId: t, rule: { unitId: e, subUnitId: t, permissionId: o } }));
|
|
659
679
|
}
|
|
660
680
|
const h = new s(e, t);
|
|
661
|
-
|
|
681
|
+
if (this._permissionService.getPermissionPoint(h.id) || this._permissionService.addPermissionPoint(h), o) {
|
|
682
|
+
const c = h.subType;
|
|
683
|
+
await this._authzIoService.update({
|
|
684
|
+
objectType: A.Worksheet,
|
|
685
|
+
objectID: o,
|
|
686
|
+
strategies: [{
|
|
687
|
+
action: c,
|
|
688
|
+
role: r ? H.Owner : H.Reader
|
|
689
|
+
}],
|
|
690
|
+
unitID: e,
|
|
691
|
+
share: void 0,
|
|
692
|
+
name: "",
|
|
693
|
+
scope: void 0,
|
|
694
|
+
collaborators: void 0
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
return this._permissionService.updatePermissionPoint(h.id, r), o;
|
|
662
698
|
}
|
|
663
699
|
/**
|
|
664
700
|
* Check if a specific permission point is enabled for a worksheet.
|
|
@@ -723,38 +759,60 @@ let H = class extends Ve {
|
|
|
723
759
|
* }]);
|
|
724
760
|
* ```
|
|
725
761
|
*/
|
|
762
|
+
// eslint-disable-next-line max-lines-per-function
|
|
726
763
|
async addRangeBaseProtection(e, t, s, r) {
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
764
|
+
let i = [];
|
|
765
|
+
if (r != null && r.allowedUsers) {
|
|
766
|
+
const k = await this._authzIoService.listCollaborators({
|
|
767
|
+
objectID: e,
|
|
768
|
+
unitID: e
|
|
769
|
+
}), f = new Set(r.allowedUsers);
|
|
770
|
+
i = k.filter((y) => {
|
|
771
|
+
var Z;
|
|
772
|
+
return f.has(((Z = y.subject) == null ? void 0 : Z.userID) || y.id);
|
|
773
|
+
}).map((y) => ({
|
|
774
|
+
id: y.id,
|
|
775
|
+
role: H.Editor,
|
|
776
|
+
subject: y.subject
|
|
777
|
+
}));
|
|
778
|
+
const be = new Set(i.map((y) => {
|
|
779
|
+
var Z;
|
|
780
|
+
return ((Z = y.subject) == null ? void 0 : Z.userID) || y.id;
|
|
781
|
+
}));
|
|
782
|
+
r.allowedUsers.forEach((y) => {
|
|
783
|
+
be.has(y) || console.error(`User ${y} not found in collaborators list`);
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
const o = await this._authzIoService.create({
|
|
787
|
+
objectType: A.SelectRange,
|
|
730
788
|
selectRangeObject: {
|
|
731
|
-
collaborators:
|
|
789
|
+
collaborators: i,
|
|
732
790
|
unitID: e,
|
|
733
791
|
name: (r == null ? void 0 : r.name) || "",
|
|
734
792
|
scope: void 0
|
|
735
793
|
}
|
|
736
|
-
}),
|
|
737
|
-
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((
|
|
794
|
+
}), a = `ruleId_${Ct(6)}`;
|
|
795
|
+
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((k) => k.ranges.some((f) => s.some((be) => $.intersects(be.getRange(), f)))))
|
|
738
796
|
throw new Error("range protection cannot intersect");
|
|
739
|
-
const c = this._determineRangeViewState(r),
|
|
797
|
+
const c = this._determineRangeViewState(r), m = this._determineRangeEditState(r), g = {
|
|
740
798
|
unitId: e,
|
|
741
799
|
subUnitId: t,
|
|
742
800
|
rules: [{
|
|
743
|
-
permissionId:
|
|
744
|
-
unitType:
|
|
801
|
+
permissionId: o,
|
|
802
|
+
unitType: A.SelectRange,
|
|
745
803
|
unitId: e,
|
|
746
804
|
subUnitId: t,
|
|
747
|
-
ranges: s.map((
|
|
748
|
-
id:
|
|
805
|
+
ranges: s.map((k) => k.getRange()),
|
|
806
|
+
id: a,
|
|
749
807
|
description: r == null ? void 0 : r.name,
|
|
750
808
|
viewState: c,
|
|
751
|
-
editState:
|
|
809
|
+
editState: m
|
|
752
810
|
}]
|
|
753
811
|
};
|
|
754
|
-
if (this._commandService.syncExecuteCommand(
|
|
812
|
+
if (this._commandService.syncExecuteCommand(vt.id, g))
|
|
755
813
|
return {
|
|
756
|
-
permissionId:
|
|
757
|
-
ruleId:
|
|
814
|
+
permissionId: o,
|
|
815
|
+
ruleId: a
|
|
758
816
|
};
|
|
759
817
|
}
|
|
760
818
|
/**
|
|
@@ -762,7 +820,7 @@ let H = class extends Ve {
|
|
|
762
820
|
* @private
|
|
763
821
|
*/
|
|
764
822
|
_determineRangeViewState(e) {
|
|
765
|
-
return (e == null ? void 0 : e.allowViewByOthers) === !1 ?
|
|
823
|
+
return (e == null ? void 0 : e.allowViewByOthers) === !1 ? U.NoOneElseCanView : U.OthersCanView;
|
|
766
824
|
}
|
|
767
825
|
/**
|
|
768
826
|
* Determine edit state from range protection options
|
|
@@ -770,7 +828,7 @@ let H = class extends Ve {
|
|
|
770
828
|
*/
|
|
771
829
|
_determineRangeEditState(e) {
|
|
772
830
|
var t;
|
|
773
|
-
return (e == null ? void 0 : e.allowEdit) === !0 && ((t = e == null ? void 0 : e.allowedUsers) != null && t.length) ?
|
|
831
|
+
return (e == null ? void 0 : e.allowEdit) === !0 && ((t = e == null ? void 0 : e.allowedUsers) != null && t.length) ? x.DesignedUserCanEdit : x.OnlyMe;
|
|
774
832
|
}
|
|
775
833
|
/**
|
|
776
834
|
* Removes the range protection from the worksheet.
|
|
@@ -801,11 +859,11 @@ let H = class extends Ve {
|
|
|
801
859
|
* ```
|
|
802
860
|
*/
|
|
803
861
|
removeRangeProtection(e, t, s) {
|
|
804
|
-
this._commandService.syncExecuteCommand(
|
|
862
|
+
this._commandService.syncExecuteCommand(Rt.id, {
|
|
805
863
|
unitId: e,
|
|
806
864
|
subUnitId: t,
|
|
807
865
|
ruleIds: s
|
|
808
|
-
}) && this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length === 0 && (this._worksheetProtectionPointRuleModel.deleteRule(e, t), [...
|
|
866
|
+
}) && this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length === 0 && (this._worksheetProtectionPointRuleModel.deleteRule(e, t), [...et()].forEach((o) => {
|
|
809
867
|
const a = new o(e, t);
|
|
810
868
|
this._permissionService.updatePermissionPoint(a.id, a.value);
|
|
811
869
|
}));
|
|
@@ -871,9 +929,9 @@ let H = class extends Ve {
|
|
|
871
929
|
setRangeProtectionRanges(e, t, s, r) {
|
|
872
930
|
const i = this._rangeProtectionRuleModel.getRule(e, t, s);
|
|
873
931
|
if (i) {
|
|
874
|
-
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((d) => r.some((c) => $.intersects(c.getRange(), d)))))
|
|
875
933
|
throw new Error("range protection cannot intersect");
|
|
876
|
-
this._commandService.syncExecuteCommand(
|
|
934
|
+
this._commandService.syncExecuteCommand(pt.id, {
|
|
877
935
|
unitId: e,
|
|
878
936
|
subUnitId: t,
|
|
879
937
|
ruleId: s,
|
|
@@ -922,7 +980,7 @@ let H = class extends Ve {
|
|
|
922
980
|
* ```
|
|
923
981
|
*/
|
|
924
982
|
getPermissionInfoWithCell(e, t, s, r) {
|
|
925
|
-
const i =
|
|
983
|
+
const i = Ot(s, r), o = this._rangeProtectionRuleModel.getSubunitRuleList(e, t).find((a) => a.ranges.some((d) => $.intersects(i, d)));
|
|
926
984
|
if (o)
|
|
927
985
|
return {
|
|
928
986
|
permissionId: o.permissionId,
|
|
@@ -930,22 +988,22 @@ let H = class extends Ve {
|
|
|
930
988
|
};
|
|
931
989
|
}
|
|
932
990
|
};
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
],
|
|
943
|
-
var
|
|
944
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
991
|
+
z = Wn([
|
|
992
|
+
V(0, l(E)),
|
|
993
|
+
V(1, C),
|
|
994
|
+
V(2, Y),
|
|
995
|
+
V(3, l($e)),
|
|
996
|
+
V(4, l(ie)),
|
|
997
|
+
V(5, l(ze)),
|
|
998
|
+
V(6, l($t)),
|
|
999
|
+
V(7, l(re))
|
|
1000
|
+
], z);
|
|
1001
|
+
var jn = Object.getOwnPropertyDescriptor, Nn = (n, e, t, s) => {
|
|
1002
|
+
for (var r = s > 1 ? void 0 : s ? jn(e, t) : e, i = n.length - 1, o; i >= 0; i--)
|
|
945
1003
|
(o = n[i]) && (r = o(r) || r);
|
|
946
1004
|
return r;
|
|
947
|
-
},
|
|
948
|
-
let
|
|
1005
|
+
}, On = (n, e) => (t, s) => e(t, s, n);
|
|
1006
|
+
let ke = class {
|
|
949
1007
|
constructor(n, e, t, s) {
|
|
950
1008
|
this._workbook = n, this._worksheet = e, this._selections = t, this._injector = s;
|
|
951
1009
|
}
|
|
@@ -964,7 +1022,7 @@ let we = class {
|
|
|
964
1022
|
*/
|
|
965
1023
|
getActiveRange() {
|
|
966
1024
|
const n = this._selections.find((e) => !!e.primary);
|
|
967
|
-
return n ? this._injector.createInstance(
|
|
1025
|
+
return n ? this._injector.createInstance(R, this._workbook, this._worksheet, n.range) : null;
|
|
968
1026
|
}
|
|
969
1027
|
/**
|
|
970
1028
|
* Represents the active selection list in the sheet.
|
|
@@ -981,7 +1039,7 @@ let we = class {
|
|
|
981
1039
|
* ```
|
|
982
1040
|
*/
|
|
983
1041
|
getActiveRangeList() {
|
|
984
|
-
return this._selections.map((n) => this._injector.createInstance(
|
|
1042
|
+
return this._selections.map((n) => this._injector.createInstance(R, this._workbook, this._worksheet, n.range));
|
|
985
1043
|
}
|
|
986
1044
|
/**
|
|
987
1045
|
* Represents the current select cell in the sheet.
|
|
@@ -1016,8 +1074,8 @@ let we = class {
|
|
|
1016
1074
|
* ```
|
|
1017
1075
|
*/
|
|
1018
1076
|
getActiveSheet() {
|
|
1019
|
-
const n = this._injector.createInstance(
|
|
1020
|
-
return this._injector.createInstance(
|
|
1077
|
+
const n = this._injector.createInstance(P, this._workbook);
|
|
1078
|
+
return this._injector.createInstance(v, n, this._workbook, this._worksheet);
|
|
1021
1079
|
}
|
|
1022
1080
|
/**
|
|
1023
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.
|
|
@@ -1041,12 +1099,12 @@ let we = class {
|
|
|
1041
1099
|
* ```
|
|
1042
1100
|
*/
|
|
1043
1101
|
updatePrimaryCell(n) {
|
|
1044
|
-
const e = this._injector.get(
|
|
1102
|
+
const e = this._injector.get(C);
|
|
1045
1103
|
let t = [], s = !1;
|
|
1046
1104
|
for (const { range: i, style: o } of this._selections)
|
|
1047
|
-
|
|
1105
|
+
$.contains(i, n.getRange()) ? (t.push({
|
|
1048
1106
|
range: i,
|
|
1049
|
-
primary:
|
|
1107
|
+
primary: le(n.getRange(), this._worksheet),
|
|
1050
1108
|
style: o
|
|
1051
1109
|
}), s = !0) : t.push({
|
|
1052
1110
|
range: i,
|
|
@@ -1056,7 +1114,7 @@ let we = class {
|
|
|
1056
1114
|
s || (t = [
|
|
1057
1115
|
{
|
|
1058
1116
|
range: n.getRange(),
|
|
1059
|
-
primary:
|
|
1117
|
+
primary: le(n.getRange(), this._worksheet)
|
|
1060
1118
|
}
|
|
1061
1119
|
]);
|
|
1062
1120
|
const r = {
|
|
@@ -1064,7 +1122,7 @@ let we = class {
|
|
|
1064
1122
|
subUnitId: this._worksheet.getSheetId(),
|
|
1065
1123
|
selections: t
|
|
1066
1124
|
};
|
|
1067
|
-
return e.syncExecuteCommand(
|
|
1125
|
+
return e.syncExecuteCommand(Ge.id, r), new ke(this._workbook, this._worksheet, t, this._injector);
|
|
1068
1126
|
}
|
|
1069
1127
|
/**
|
|
1070
1128
|
* Get the next primary cell in the specified direction. If the primary cell not exists in selections, return null.
|
|
@@ -1094,19 +1152,19 @@ let we = class {
|
|
|
1094
1152
|
getNextDataRange(n) {
|
|
1095
1153
|
if (!this._selections.find((s) => !!s.primary))
|
|
1096
1154
|
return null;
|
|
1097
|
-
const t =
|
|
1098
|
-
return t ? this._injector.createInstance(
|
|
1155
|
+
const t = qt(this._selections.concat(), n, this._worksheet);
|
|
1156
|
+
return t ? this._injector.createInstance(R, this._workbook, this._worksheet, t) : null;
|
|
1099
1157
|
}
|
|
1100
1158
|
};
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
],
|
|
1104
|
-
var
|
|
1105
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
1159
|
+
ke = Nn([
|
|
1160
|
+
On(3, l(E))
|
|
1161
|
+
], ke);
|
|
1162
|
+
var Je = /* @__PURE__ */ ((n) => (n[n.Reader = 0] = "Reader", n[n.Editor = 1] = "Editor", n[n.Owner = 2] = "Owner", n[n.UNRECOGNIZED = -1] = "UNRECOGNIZED", n))(Je || {}), Tn = Object.getOwnPropertyDescriptor, Vn = (n, e, t, s) => {
|
|
1163
|
+
for (var r = s > 1 ? void 0 : s ? Tn(e, t) : e, i = n.length - 1, o; i >= 0; i--)
|
|
1106
1164
|
(o = n[i]) && (r = o(r) || r);
|
|
1107
1165
|
return r;
|
|
1108
|
-
},
|
|
1109
|
-
let
|
|
1166
|
+
}, pe = (n, e) => (t, s) => e(t, s, n);
|
|
1167
|
+
let O = class {
|
|
1110
1168
|
constructor(n, e, t, s, r, i, o, a, h) {
|
|
1111
1169
|
this._unitId = n, this._subUnitId = e, this._ruleId = t, this._permissionId = s, this._ranges = r, this._options = i, this._injector = o, this._commandService = a, this._rangeProtectionRuleModel = h;
|
|
1112
1170
|
}
|
|
@@ -1183,7 +1241,7 @@ let j = class {
|
|
|
1183
1241
|
)
|
|
1184
1242
|
))
|
|
1185
1243
|
throw new Error("Range protection cannot intersect with other protection rules");
|
|
1186
|
-
await this._commandService.executeCommand(
|
|
1244
|
+
await this._commandService.executeCommand(pt.id, {
|
|
1187
1245
|
unitId: this._unitId,
|
|
1188
1246
|
subUnitId: this._subUnitId,
|
|
1189
1247
|
ruleId: this._ruleId,
|
|
@@ -1206,7 +1264,7 @@ let j = class {
|
|
|
1206
1264
|
* ```
|
|
1207
1265
|
*/
|
|
1208
1266
|
async remove() {
|
|
1209
|
-
await this._commandService.executeCommand(
|
|
1267
|
+
await this._commandService.executeCommand(Rt.id, {
|
|
1210
1268
|
unitId: this._unitId,
|
|
1211
1269
|
subUnitId: this._subUnitId,
|
|
1212
1270
|
ruleIds: [this._ruleId]
|
|
@@ -1221,96 +1279,96 @@ let j = class {
|
|
|
1221
1279
|
return !(n.endRow < e.startRow || n.startRow > e.endRow || n.endColumn < e.startColumn || n.startColumn > e.endColumn);
|
|
1222
1280
|
}
|
|
1223
1281
|
};
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
],
|
|
1229
|
-
const
|
|
1230
|
-
[u.Edit]:
|
|
1231
|
-
[u.View]:
|
|
1232
|
-
[u.Print]:
|
|
1233
|
-
[u.Export]:
|
|
1234
|
-
[u.Share]:
|
|
1235
|
-
[u.CopyContent]:
|
|
1236
|
-
[u.DuplicateFile]:
|
|
1237
|
-
[u.Comment]:
|
|
1238
|
-
[u.ManageCollaborator]:
|
|
1239
|
-
[u.CreateSheet]:
|
|
1240
|
-
[u.DeleteSheet]:
|
|
1241
|
-
[u.RenameSheet]:
|
|
1242
|
-
[u.MoveSheet]:
|
|
1243
|
-
[u.HideSheet]:
|
|
1244
|
-
[u.ViewHistory]:
|
|
1245
|
-
[u.ManageHistory]:
|
|
1246
|
-
[u.RecoverHistory]:
|
|
1247
|
-
[u.CreateProtection]:
|
|
1248
|
-
[u.InsertRow]:
|
|
1249
|
-
[u.InsertColumn]:
|
|
1250
|
-
[u.DeleteRow]:
|
|
1251
|
-
[u.DeleteColumn]:
|
|
1252
|
-
[u.CopySheet]:
|
|
1253
|
-
},
|
|
1254
|
-
[
|
|
1255
|
-
[
|
|
1256
|
-
[
|
|
1257
|
-
[
|
|
1258
|
-
[
|
|
1259
|
-
[
|
|
1260
|
-
[
|
|
1261
|
-
[
|
|
1262
|
-
[
|
|
1263
|
-
[
|
|
1264
|
-
[
|
|
1265
|
-
[
|
|
1266
|
-
[
|
|
1267
|
-
[
|
|
1268
|
-
[
|
|
1269
|
-
[
|
|
1270
|
-
[
|
|
1271
|
-
[
|
|
1272
|
-
[
|
|
1273
|
-
[
|
|
1274
|
-
},
|
|
1275
|
-
[
|
|
1276
|
-
[
|
|
1277
|
-
[
|
|
1278
|
-
[
|
|
1282
|
+
O = Vn([
|
|
1283
|
+
pe(6, l(E)),
|
|
1284
|
+
pe(7, l(C)),
|
|
1285
|
+
pe(8, l(ie))
|
|
1286
|
+
], O);
|
|
1287
|
+
const he = {
|
|
1288
|
+
[u.Edit]: Le,
|
|
1289
|
+
[u.View]: Ss,
|
|
1290
|
+
[u.Print]: ws,
|
|
1291
|
+
[u.Export]: _s,
|
|
1292
|
+
[u.Share]: gs,
|
|
1293
|
+
[u.CopyContent]: ms,
|
|
1294
|
+
[u.DuplicateFile]: ls,
|
|
1295
|
+
[u.Comment]: us,
|
|
1296
|
+
[u.ManageCollaborator]: ds,
|
|
1297
|
+
[u.CreateSheet]: cs,
|
|
1298
|
+
[u.DeleteSheet]: hs,
|
|
1299
|
+
[u.RenameSheet]: as,
|
|
1300
|
+
[u.MoveSheet]: os,
|
|
1301
|
+
[u.HideSheet]: is,
|
|
1302
|
+
[u.ViewHistory]: rs,
|
|
1303
|
+
[u.ManageHistory]: ns,
|
|
1304
|
+
[u.RecoverHistory]: ss,
|
|
1305
|
+
[u.CreateProtection]: ts,
|
|
1306
|
+
[u.InsertRow]: es,
|
|
1307
|
+
[u.InsertColumn]: Xt,
|
|
1308
|
+
[u.DeleteRow]: Qt,
|
|
1309
|
+
[u.DeleteColumn]: Zt,
|
|
1310
|
+
[u.CopySheet]: Yt
|
|
1311
|
+
}, ce = {
|
|
1312
|
+
[_.Edit]: yt,
|
|
1313
|
+
[_.View]: Pt,
|
|
1314
|
+
[_.Copy]: Ns,
|
|
1315
|
+
[_.SetCellValue]: js,
|
|
1316
|
+
[_.SetCellStyle]: Ws,
|
|
1317
|
+
[_.SetRowStyle]: Ms,
|
|
1318
|
+
[_.SetColumnStyle]: Ds,
|
|
1319
|
+
[_.InsertRow]: xs,
|
|
1320
|
+
[_.InsertColumn]: Us,
|
|
1321
|
+
[_.DeleteRow]: Es,
|
|
1322
|
+
[_.DeleteColumn]: Ps,
|
|
1323
|
+
[_.Sort]: ys,
|
|
1324
|
+
[_.Filter]: ps,
|
|
1325
|
+
[_.PivotTable]: Rs,
|
|
1326
|
+
[_.InsertHyperlink]: vs,
|
|
1327
|
+
[_.EditExtraObject]: fs,
|
|
1328
|
+
[_.ManageCollaborator]: Is,
|
|
1329
|
+
[_.DeleteProtection]: bs,
|
|
1330
|
+
[_.SelectProtectedCells]: Cs,
|
|
1331
|
+
[_.SelectUnProtectedCells]: ks
|
|
1332
|
+
}, se = {
|
|
1333
|
+
[b.Edit]: As,
|
|
1334
|
+
[b.View]: Vs,
|
|
1335
|
+
[b.ManageCollaborator]: Ts,
|
|
1336
|
+
[b.Delete]: Os
|
|
1279
1337
|
};
|
|
1280
|
-
var
|
|
1281
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
1338
|
+
var An = Object.getOwnPropertyDescriptor, Bn = (n, e, t, s) => {
|
|
1339
|
+
for (var r = s > 1 ? void 0 : s ? An(e, t) : e, i = n.length - 1, o; i >= 0; i--)
|
|
1282
1340
|
(o = n[i]) && (r = o(r) || r);
|
|
1283
1341
|
return r;
|
|
1284
|
-
},
|
|
1285
|
-
let
|
|
1342
|
+
}, B = (n, e) => (t, s) => e(t, s, n);
|
|
1343
|
+
let Ve = class {
|
|
1286
1344
|
constructor(n, e, t, s, r, i, o, a) {
|
|
1287
|
-
|
|
1288
|
-
|
|
1345
|
+
w(this, "_permissionSubject");
|
|
1346
|
+
w(this, "_rangeRulesSubject");
|
|
1289
1347
|
/**
|
|
1290
1348
|
* Observable stream of permission snapshot changes (BehaviorSubject)
|
|
1291
1349
|
* Emits immediately on subscription with current state, then on any permission point change
|
|
1292
1350
|
*/
|
|
1293
|
-
|
|
1351
|
+
w(this, "permission$");
|
|
1294
1352
|
/**
|
|
1295
1353
|
* Observable stream of individual permission point changes
|
|
1296
1354
|
* Emits when a specific permission point value changes
|
|
1297
1355
|
*/
|
|
1298
|
-
|
|
1356
|
+
w(this, "pointChange$");
|
|
1299
1357
|
/**
|
|
1300
1358
|
* Observable stream of range protection rule changes
|
|
1301
1359
|
* Emits when protection rules are added, updated, or deleted
|
|
1302
1360
|
*/
|
|
1303
|
-
|
|
1361
|
+
w(this, "rangeProtectionChange$");
|
|
1304
1362
|
/**
|
|
1305
1363
|
* Observable stream of current range protection rules list (BehaviorSubject)
|
|
1306
1364
|
* Emits immediately on subscription with current rules, then auto-updates when rules change
|
|
1307
1365
|
*/
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
this._worksheet = n, this._injector = e, this._permissionService = t, this._authzIoService = s, this._commandService = r, 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(
|
|
1366
|
+
w(this, "rangeProtectionRules$");
|
|
1367
|
+
w(this, "_unitId");
|
|
1368
|
+
w(this, "_subUnitId");
|
|
1369
|
+
w(this, "_subscriptions", []);
|
|
1370
|
+
w(this, "_fPermission");
|
|
1371
|
+
this._worksheet = n, this._injector = e, this._permissionService = t, this._authzIoService = s, this._commandService = r, 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();
|
|
1314
1372
|
}
|
|
1315
1373
|
/**
|
|
1316
1374
|
* Create permission snapshot stream from IPermissionService
|
|
@@ -1318,12 +1376,12 @@ let je = class {
|
|
|
1318
1376
|
*/
|
|
1319
1377
|
_createPermissionStream() {
|
|
1320
1378
|
const n = this._permissionService.permissionPointUpdate$.pipe(
|
|
1321
|
-
|
|
1379
|
+
D((e) => e.id.includes(this._unitId) && e.id.includes(this._subUnitId))
|
|
1322
1380
|
).subscribe(() => {
|
|
1323
1381
|
this._permissionSubject.next(this._buildSnapshot());
|
|
1324
1382
|
});
|
|
1325
1383
|
return this._subscriptions.push(n), this._permissionSubject.asObservable().pipe(
|
|
1326
|
-
|
|
1384
|
+
_e((e, t) => JSON.stringify(e) === JSON.stringify(t)),
|
|
1327
1385
|
N({ bufferSize: 1, refCount: !0 })
|
|
1328
1386
|
);
|
|
1329
1387
|
}
|
|
@@ -1333,8 +1391,8 @@ let je = class {
|
|
|
1333
1391
|
*/
|
|
1334
1392
|
_createPointChangeStream() {
|
|
1335
1393
|
return this._permissionService.permissionPointUpdate$.pipe(
|
|
1336
|
-
|
|
1337
|
-
|
|
1394
|
+
D((n) => n.id.includes(this._unitId) && n.id.includes(this._subUnitId)),
|
|
1395
|
+
we((n) => {
|
|
1338
1396
|
var t, s;
|
|
1339
1397
|
const e = this._extractWorksheetPointType(n.id);
|
|
1340
1398
|
return e ? {
|
|
@@ -1343,7 +1401,7 @@ let je = class {
|
|
|
1343
1401
|
oldValue: !((s = n.value) != null && s)
|
|
1344
1402
|
} : null;
|
|
1345
1403
|
}),
|
|
1346
|
-
|
|
1404
|
+
D((n) => n !== null),
|
|
1347
1405
|
N({ bufferSize: 1, refCount: !0 })
|
|
1348
1406
|
);
|
|
1349
1407
|
}
|
|
@@ -1353,8 +1411,8 @@ let je = class {
|
|
|
1353
1411
|
*/
|
|
1354
1412
|
_createRangeProtectionChangeStream() {
|
|
1355
1413
|
return this._rangeProtectionRuleModel.ruleChange$.pipe(
|
|
1356
|
-
|
|
1357
|
-
|
|
1414
|
+
D((n) => n.unitId === this._unitId && n.subUnitId === this._subUnitId),
|
|
1415
|
+
we((n) => {
|
|
1358
1416
|
const e = this._buildRangeProtectionRules();
|
|
1359
1417
|
return { type: n.type === "delete" ? "delete" : n.type === "set" ? "update" : "add", rules: e };
|
|
1360
1418
|
}),
|
|
@@ -1367,12 +1425,12 @@ let je = class {
|
|
|
1367
1425
|
*/
|
|
1368
1426
|
_createRangeProtectionRulesStream() {
|
|
1369
1427
|
const n = this._rangeProtectionRuleModel.ruleChange$.pipe(
|
|
1370
|
-
|
|
1428
|
+
D((e) => e.unitId === this._unitId && e.subUnitId === this._subUnitId)
|
|
1371
1429
|
).subscribe(() => {
|
|
1372
1430
|
this._rangeRulesSubject.next(this._buildRangeProtectionRules());
|
|
1373
1431
|
});
|
|
1374
1432
|
return this._subscriptions.push(n), this._rangeRulesSubject.asObservable().pipe(
|
|
1375
|
-
|
|
1433
|
+
_e((e, t) => e.length !== t.length ? !1 : e.every((s, r) => s.id === t[r].id)),
|
|
1376
1434
|
N({ bufferSize: 1, refCount: !0 })
|
|
1377
1435
|
);
|
|
1378
1436
|
}
|
|
@@ -1381,7 +1439,7 @@ let je = class {
|
|
|
1381
1439
|
* @private
|
|
1382
1440
|
*/
|
|
1383
1441
|
_extractWorksheetPointType(n) {
|
|
1384
|
-
for (const [e, t] of Object.entries(
|
|
1442
|
+
for (const [e, t] of Object.entries(ce))
|
|
1385
1443
|
if (new t(this._unitId, this._subUnitId).id === n)
|
|
1386
1444
|
return e;
|
|
1387
1445
|
return null;
|
|
@@ -1391,7 +1449,7 @@ let je = class {
|
|
|
1391
1449
|
*/
|
|
1392
1450
|
_getRuleEditPermission(n) {
|
|
1393
1451
|
var r;
|
|
1394
|
-
const e =
|
|
1452
|
+
const e = se[b.Edit];
|
|
1395
1453
|
if (!e)
|
|
1396
1454
|
return !1;
|
|
1397
1455
|
const t = new e(
|
|
@@ -1406,8 +1464,8 @@ let je = class {
|
|
|
1406
1464
|
*/
|
|
1407
1465
|
_buildSnapshot() {
|
|
1408
1466
|
const n = {};
|
|
1409
|
-
for (const e in
|
|
1410
|
-
const t =
|
|
1467
|
+
for (const e in _) {
|
|
1468
|
+
const t = _[e];
|
|
1411
1469
|
n[t] = this.getPoint(t);
|
|
1412
1470
|
}
|
|
1413
1471
|
return n;
|
|
@@ -1426,7 +1484,7 @@ let je = class {
|
|
|
1426
1484
|
)
|
|
1427
1485
|
);
|
|
1428
1486
|
return this._injector.createInstance(
|
|
1429
|
-
|
|
1487
|
+
O,
|
|
1430
1488
|
this._unitId,
|
|
1431
1489
|
this._subUnitId,
|
|
1432
1490
|
e.id,
|
|
@@ -1447,10 +1505,10 @@ let je = class {
|
|
|
1447
1505
|
(s) => this._worksheet.getRange(s)
|
|
1448
1506
|
), t = {
|
|
1449
1507
|
name: n.description || "",
|
|
1450
|
-
allowViewByOthers: n.viewState !==
|
|
1508
|
+
allowViewByOthers: n.viewState !== U.NoOneElseCanView
|
|
1451
1509
|
};
|
|
1452
|
-
return n.editState ===
|
|
1453
|
-
|
|
1510
|
+
return n.editState === x.DesignedUserCanEdit ? t.allowEdit = !0 : t.allowEdit = !1, this._injector.createInstance(
|
|
1511
|
+
O,
|
|
1454
1512
|
this._unitId,
|
|
1455
1513
|
this._subUnitId,
|
|
1456
1514
|
n.id,
|
|
@@ -1563,19 +1621,19 @@ let je = class {
|
|
|
1563
1621
|
*/
|
|
1564
1622
|
_getModePermissions(n) {
|
|
1565
1623
|
const e = {};
|
|
1566
|
-
switch (Object.values(
|
|
1624
|
+
switch (Object.values(_).forEach((t) => {
|
|
1567
1625
|
e[t] = !1;
|
|
1568
1626
|
}), n) {
|
|
1569
1627
|
case "editable":
|
|
1570
|
-
Object.values(
|
|
1628
|
+
Object.values(_).forEach((t) => {
|
|
1571
1629
|
e[t] = !0;
|
|
1572
1630
|
});
|
|
1573
1631
|
break;
|
|
1574
1632
|
case "readOnly":
|
|
1575
|
-
e[
|
|
1633
|
+
e[_.View] = !0;
|
|
1576
1634
|
break;
|
|
1577
1635
|
case "filterOnly":
|
|
1578
|
-
e[
|
|
1636
|
+
e[_.View] = !0, e[_.Sort] = !0, e[_.Filter] = !0;
|
|
1579
1637
|
break;
|
|
1580
1638
|
}
|
|
1581
1639
|
return e;
|
|
@@ -1587,7 +1645,7 @@ let je = class {
|
|
|
1587
1645
|
async _batchSetPermissionPoints(n) {
|
|
1588
1646
|
const e = [];
|
|
1589
1647
|
for (const [t, s] of Object.entries(n)) {
|
|
1590
|
-
const r = t, i =
|
|
1648
|
+
const r = t, i = ce[r];
|
|
1591
1649
|
if (!i)
|
|
1592
1650
|
throw new Error(`Unknown worksheet permission point: ${r}`);
|
|
1593
1651
|
const o = this.getPoint(r);
|
|
@@ -1637,7 +1695,7 @@ let je = class {
|
|
|
1637
1695
|
* ```
|
|
1638
1696
|
*/
|
|
1639
1697
|
canEdit() {
|
|
1640
|
-
return this.getPoint(
|
|
1698
|
+
return this.getPoint(_.Edit);
|
|
1641
1699
|
}
|
|
1642
1700
|
/**
|
|
1643
1701
|
* Check if a specific cell can be edited.
|
|
@@ -1676,7 +1734,7 @@ let je = class {
|
|
|
1676
1734
|
* ```
|
|
1677
1735
|
*/
|
|
1678
1736
|
canViewCell(n, e) {
|
|
1679
|
-
return this.getPoint(
|
|
1737
|
+
return this.getPoint(_.View);
|
|
1680
1738
|
}
|
|
1681
1739
|
/**
|
|
1682
1740
|
* Set a specific permission point for the worksheet.
|
|
@@ -1692,7 +1750,7 @@ let je = class {
|
|
|
1692
1750
|
* ```
|
|
1693
1751
|
*/
|
|
1694
1752
|
async setPoint(n, e) {
|
|
1695
|
-
const t =
|
|
1753
|
+
const t = ce[n];
|
|
1696
1754
|
if (!t)
|
|
1697
1755
|
throw new Error(`Unknown worksheet permission point: ${n}`);
|
|
1698
1756
|
if (this.getPoint(n) === e)
|
|
@@ -1715,7 +1773,7 @@ let je = class {
|
|
|
1715
1773
|
*/
|
|
1716
1774
|
getPoint(n) {
|
|
1717
1775
|
var r;
|
|
1718
|
-
const e =
|
|
1776
|
+
const e = ce[n];
|
|
1719
1777
|
if (!e)
|
|
1720
1778
|
throw new Error(`Unknown worksheet permission point: ${n}`);
|
|
1721
1779
|
const t = new e(this._unitId, this._subUnitId), s = this._permissionService.getPermissionPoint(t.id);
|
|
@@ -1785,56 +1843,82 @@ let je = class {
|
|
|
1785
1843
|
* console.log(rules);
|
|
1786
1844
|
* ```
|
|
1787
1845
|
*/
|
|
1846
|
+
// eslint-disable-next-line max-lines-per-function
|
|
1788
1847
|
async protectRanges(n) {
|
|
1789
1848
|
if (!n || n.length === 0)
|
|
1790
1849
|
throw new Error("Configs cannot be empty");
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1850
|
+
let e = [];
|
|
1851
|
+
n.some((a) => {
|
|
1852
|
+
var h, d;
|
|
1853
|
+
return (d = (h = a.options) == null ? void 0 : h.allowedUsers) == null ? void 0 : d.length;
|
|
1854
|
+
}) && (e = await this._authzIoService.listCollaborators({
|
|
1855
|
+
objectID: this._unitId,
|
|
1856
|
+
unitID: this._unitId
|
|
1857
|
+
}));
|
|
1858
|
+
const s = await Promise.all(
|
|
1859
|
+
n.map((a) => {
|
|
1860
|
+
var d, c;
|
|
1861
|
+
let h = [];
|
|
1862
|
+
if ((d = a.options) != null && d.allowedUsers) {
|
|
1863
|
+
const m = new Set(a.options.allowedUsers);
|
|
1864
|
+
h = e.filter((S) => {
|
|
1865
|
+
var k;
|
|
1866
|
+
return m.has(((k = S.subject) == null ? void 0 : k.userID) || S.id);
|
|
1867
|
+
}).map((S) => ({
|
|
1868
|
+
id: S.id,
|
|
1869
|
+
role: Je.Editor,
|
|
1870
|
+
subject: S.subject
|
|
1871
|
+
}));
|
|
1872
|
+
const g = new Set(h.map((S) => {
|
|
1873
|
+
var k;
|
|
1874
|
+
return ((k = S.subject) == null ? void 0 : k.userID) || S.id;
|
|
1875
|
+
}));
|
|
1876
|
+
a.options.allowedUsers.forEach((S) => {
|
|
1877
|
+
g.has(S) || console.error(`User ${S} not found in collaborators list`);
|
|
1803
1878
|
});
|
|
1804
1879
|
}
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1880
|
+
return this._authzIoService.create({
|
|
1881
|
+
objectType: A.SelectRange,
|
|
1882
|
+
selectRangeObject: {
|
|
1883
|
+
collaborators: h,
|
|
1884
|
+
unitID: this._unitId,
|
|
1885
|
+
name: ((c = a.options) == null ? void 0 : c.name) || "",
|
|
1886
|
+
scope: void 0
|
|
1887
|
+
}
|
|
1888
|
+
});
|
|
1889
|
+
})
|
|
1890
|
+
), r = n.map((a, h) => {
|
|
1891
|
+
var m;
|
|
1892
|
+
const d = this._determineViewState(a.options), c = this._determineEditState(a.options);
|
|
1809
1893
|
return {
|
|
1810
|
-
permissionId:
|
|
1811
|
-
unitType:
|
|
1894
|
+
permissionId: s[h],
|
|
1895
|
+
unitType: A.SelectRange,
|
|
1812
1896
|
unitId: this._unitId,
|
|
1813
1897
|
subUnitId: this._subUnitId,
|
|
1814
|
-
ranges:
|
|
1898
|
+
ranges: a.ranges.map((g) => g.getRange()),
|
|
1815
1899
|
id: this._rangeProtectionRuleModel.createRuleId(this._unitId, this._subUnitId),
|
|
1816
|
-
description: ((
|
|
1817
|
-
viewState:
|
|
1818
|
-
editState:
|
|
1900
|
+
description: ((m = a.options) == null ? void 0 : m.name) || "",
|
|
1901
|
+
viewState: d,
|
|
1902
|
+
editState: c
|
|
1819
1903
|
};
|
|
1820
1904
|
});
|
|
1821
|
-
if (!await this._commandService.executeCommand(
|
|
1905
|
+
if (!await this._commandService.executeCommand(vt.id, {
|
|
1822
1906
|
unitId: this._unitId,
|
|
1823
1907
|
subUnitId: this._subUnitId,
|
|
1824
|
-
rules:
|
|
1908
|
+
rules: r
|
|
1825
1909
|
}))
|
|
1826
1910
|
throw new Error("Failed to create range protection rules");
|
|
1827
1911
|
return await Promise.all(
|
|
1828
|
-
n.map((
|
|
1829
|
-
),
|
|
1830
|
-
(
|
|
1831
|
-
|
|
1912
|
+
n.map((a, h) => this._setPermissionPoints(s[h], a.options))
|
|
1913
|
+
), r.map(
|
|
1914
|
+
(a, h) => this._injector.createInstance(
|
|
1915
|
+
O,
|
|
1832
1916
|
this._unitId,
|
|
1833
1917
|
this._subUnitId,
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
n[
|
|
1837
|
-
n[
|
|
1918
|
+
a.id,
|
|
1919
|
+
a.permissionId,
|
|
1920
|
+
n[h].ranges,
|
|
1921
|
+
n[h].options || {}
|
|
1838
1922
|
)
|
|
1839
1923
|
);
|
|
1840
1924
|
}
|
|
@@ -1843,7 +1927,7 @@ let je = class {
|
|
|
1843
1927
|
* @private
|
|
1844
1928
|
*/
|
|
1845
1929
|
_determineViewState(n) {
|
|
1846
|
-
return (n == null ? void 0 : n.allowViewByOthers) === !1 ?
|
|
1930
|
+
return (n == null ? void 0 : n.allowViewByOthers) === !1 ? U.NoOneElseCanView : U.OthersCanView;
|
|
1847
1931
|
}
|
|
1848
1932
|
/**
|
|
1849
1933
|
* Determine edit state from options
|
|
@@ -1851,7 +1935,7 @@ let je = class {
|
|
|
1851
1935
|
*/
|
|
1852
1936
|
_determineEditState(n) {
|
|
1853
1937
|
var e;
|
|
1854
|
-
return (n == null ? void 0 : n.allowEdit) === !0 && ((e = n == null ? void 0 : n.allowedUsers) != null && e.length) ?
|
|
1938
|
+
return (n == null ? void 0 : n.allowEdit) === !0 && ((e = n == null ? void 0 : n.allowedUsers) != null && e.length) ? x.DesignedUserCanEdit : x.OnlyMe;
|
|
1855
1939
|
}
|
|
1856
1940
|
/**
|
|
1857
1941
|
* Set permission points based on options (for local runtime control)
|
|
@@ -1861,14 +1945,14 @@ let je = class {
|
|
|
1861
1945
|
if (!e)
|
|
1862
1946
|
return;
|
|
1863
1947
|
const t = (s, r) => s === void 0 ? r : typeof s == "boolean" ? s : !0;
|
|
1864
|
-
await this._setPermissionPoint(n,
|
|
1948
|
+
await this._setPermissionPoint(n, b.Edit, t(e.allowEdit, !1)), await this._setPermissionPoint(n, b.View, t(e.allowViewByOthers, !0));
|
|
1865
1949
|
}
|
|
1866
1950
|
/**
|
|
1867
1951
|
* Set a single permission point
|
|
1868
1952
|
* @private
|
|
1869
1953
|
*/
|
|
1870
1954
|
async _setPermissionPoint(n, e, t) {
|
|
1871
|
-
const s =
|
|
1955
|
+
const s = se[e];
|
|
1872
1956
|
s && this._fPermission.setRangeProtectionPermissionPoint(this._unitId, this._subUnitId, n, s, t);
|
|
1873
1957
|
}
|
|
1874
1958
|
/**
|
|
@@ -1925,87 +2009,87 @@ let je = class {
|
|
|
1925
2009
|
this._subscriptions.forEach((n) => n.unsubscribe()), this._permissionSubject.complete(), this._rangeRulesSubject.complete();
|
|
1926
2010
|
}
|
|
1927
2011
|
};
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
],
|
|
1937
|
-
function
|
|
2012
|
+
Ve = Bn([
|
|
2013
|
+
B(1, l(E)),
|
|
2014
|
+
B(2, Y),
|
|
2015
|
+
B(3, re),
|
|
2016
|
+
B(4, C),
|
|
2017
|
+
B(5, l(ie)),
|
|
2018
|
+
B(6, l(ze)),
|
|
2019
|
+
B(7, l($e))
|
|
2020
|
+
], Ve);
|
|
2021
|
+
function Fn(n) {
|
|
1938
2022
|
switch (n) {
|
|
1939
2023
|
case "left":
|
|
1940
|
-
return
|
|
2024
|
+
return K.LEFT;
|
|
1941
2025
|
case "center":
|
|
1942
|
-
return
|
|
2026
|
+
return K.CENTER;
|
|
1943
2027
|
case "normal":
|
|
1944
|
-
return
|
|
2028
|
+
return K.RIGHT;
|
|
1945
2029
|
default:
|
|
1946
2030
|
throw new Error(`Invalid horizontal alignment: ${n}`);
|
|
1947
2031
|
}
|
|
1948
2032
|
}
|
|
1949
|
-
function
|
|
2033
|
+
function _t(n) {
|
|
1950
2034
|
switch (n) {
|
|
1951
|
-
case
|
|
2035
|
+
case K.LEFT:
|
|
1952
2036
|
return "left";
|
|
1953
|
-
case
|
|
2037
|
+
case K.CENTER:
|
|
1954
2038
|
return "center";
|
|
1955
|
-
case
|
|
2039
|
+
case K.RIGHT:
|
|
1956
2040
|
return "normal";
|
|
1957
2041
|
default:
|
|
1958
2042
|
return "general";
|
|
1959
2043
|
}
|
|
1960
2044
|
}
|
|
1961
|
-
function
|
|
2045
|
+
function Hn(n) {
|
|
1962
2046
|
switch (n) {
|
|
1963
2047
|
case "top":
|
|
1964
|
-
return
|
|
2048
|
+
return J.TOP;
|
|
1965
2049
|
case "middle":
|
|
1966
|
-
return
|
|
2050
|
+
return J.MIDDLE;
|
|
1967
2051
|
case "bottom":
|
|
1968
|
-
return
|
|
2052
|
+
return J.BOTTOM;
|
|
1969
2053
|
default:
|
|
1970
2054
|
throw new Error(`Invalid vertical alignment: ${n}`);
|
|
1971
2055
|
}
|
|
1972
2056
|
}
|
|
1973
|
-
function
|
|
2057
|
+
function wt(n) {
|
|
1974
2058
|
switch (n) {
|
|
1975
|
-
case
|
|
2059
|
+
case J.TOP:
|
|
1976
2060
|
return "top";
|
|
1977
|
-
case
|
|
2061
|
+
case J.MIDDLE:
|
|
1978
2062
|
return "middle";
|
|
1979
|
-
case
|
|
2063
|
+
case J.BOTTOM:
|
|
1980
2064
|
return "bottom";
|
|
1981
2065
|
default:
|
|
1982
2066
|
return "general";
|
|
1983
2067
|
}
|
|
1984
2068
|
}
|
|
1985
|
-
function
|
|
2069
|
+
function ye(n, e) {
|
|
1986
2070
|
return {
|
|
1987
2071
|
startRow: n.startRow,
|
|
1988
2072
|
endRow: n.endRow,
|
|
1989
2073
|
startColumn: 0,
|
|
1990
2074
|
endColumn: e.getColumnCount() - 1,
|
|
1991
|
-
rangeType:
|
|
2075
|
+
rangeType: p.ROW
|
|
1992
2076
|
};
|
|
1993
2077
|
}
|
|
1994
|
-
function
|
|
2078
|
+
function Pe(n, e) {
|
|
1995
2079
|
return {
|
|
1996
2080
|
startRow: 0,
|
|
1997
2081
|
endRow: e.getRowCount() - 1,
|
|
1998
2082
|
startColumn: n.startColumn,
|
|
1999
2083
|
endColumn: n.endColumn,
|
|
2000
|
-
rangeType:
|
|
2084
|
+
rangeType: p.COLUMN
|
|
2001
2085
|
};
|
|
2002
2086
|
}
|
|
2003
|
-
var
|
|
2004
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
2087
|
+
var $n = Object.getOwnPropertyDescriptor, zn = (n, e, t, s) => {
|
|
2088
|
+
for (var r = s > 1 ? void 0 : s ? $n(e, t) : e, i = n.length - 1, o; i >= 0; i--)
|
|
2005
2089
|
(o = n[i]) && (r = o(r) || r);
|
|
2006
2090
|
return r;
|
|
2007
|
-
},
|
|
2008
|
-
let
|
|
2091
|
+
}, de = (n, e) => (t, s) => e(t, s, n);
|
|
2092
|
+
let v = class extends He {
|
|
2009
2093
|
/**
|
|
2010
2094
|
* Creates a new worksheet facade instance
|
|
2011
2095
|
* @param {FWorkbook} _fWorkbook - The facade workbook instance
|
|
@@ -2028,7 +2112,7 @@ let I = class extends Ae {
|
|
|
2028
2112
|
* fWorkSheet.setActiveSelection(fWorkSheet.getRange('A10:B10'));
|
|
2029
2113
|
* ```
|
|
2030
2114
|
*/
|
|
2031
|
-
|
|
2115
|
+
w(this, "setActiveSelection", this.setActiveRange);
|
|
2032
2116
|
this._fWorkbook = e, this._workbook = t, this._worksheet = s, this._injector = r, this._selectionManagerService = i, this._logService = o, this._commandService = a;
|
|
2033
2117
|
}
|
|
2034
2118
|
dispose() {
|
|
@@ -2111,7 +2195,7 @@ let I = class extends Ae {
|
|
|
2111
2195
|
*/
|
|
2112
2196
|
getSelection() {
|
|
2113
2197
|
const e = this._selectionManagerService.getCurrentSelections();
|
|
2114
|
-
return e ? this._injector.createInstance(
|
|
2198
|
+
return e ? this._injector.createInstance(ke, this._workbook, this._worksheet, e) : null;
|
|
2115
2199
|
}
|
|
2116
2200
|
// #region rows
|
|
2117
2201
|
// #region default style
|
|
@@ -2180,7 +2264,7 @@ let I = class extends Ae {
|
|
|
2180
2264
|
*/
|
|
2181
2265
|
setDefaultStyle(e) {
|
|
2182
2266
|
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId();
|
|
2183
|
-
return this._commandService.syncExecuteCommand(
|
|
2267
|
+
return this._commandService.syncExecuteCommand(Bs.id, {
|
|
2184
2268
|
unitId: t,
|
|
2185
2269
|
subUnitId: s,
|
|
2186
2270
|
defaultStyle: e
|
|
@@ -2210,7 +2294,7 @@ let I = class extends Ae {
|
|
|
2210
2294
|
}
|
|
2211
2295
|
}
|
|
2212
2296
|
};
|
|
2213
|
-
return this._commandService.syncExecuteCommand(
|
|
2297
|
+
return this._commandService.syncExecuteCommand(tt.id, i), this;
|
|
2214
2298
|
}
|
|
2215
2299
|
/**
|
|
2216
2300
|
* Set the default style of the worksheet column
|
|
@@ -2236,27 +2320,27 @@ let I = class extends Ae {
|
|
|
2236
2320
|
}
|
|
2237
2321
|
}
|
|
2238
2322
|
};
|
|
2239
|
-
return this._commandService.syncExecuteCommand(
|
|
2323
|
+
return this._commandService.syncExecuteCommand(st.id, i), this;
|
|
2240
2324
|
}
|
|
2241
2325
|
getRange(e, t, s, r) {
|
|
2242
2326
|
let i, o;
|
|
2243
2327
|
if (typeof e == "object")
|
|
2244
2328
|
i = e, o = this._worksheet;
|
|
2245
2329
|
else if (typeof e == "string") {
|
|
2246
|
-
const { range: a, sheetName: h } =
|
|
2247
|
-
if (!
|
|
2330
|
+
const { range: a, sheetName: h } = pn(e), d = h ? this._workbook.getSheetBySheetName(h) : this._worksheet;
|
|
2331
|
+
if (!d)
|
|
2248
2332
|
throw new Error("Range not found");
|
|
2249
|
-
o =
|
|
2333
|
+
o = d, i = {
|
|
2250
2334
|
...a,
|
|
2251
2335
|
unitId: this._workbook.getUnitId(),
|
|
2252
2336
|
sheetId: o.getSheetId(),
|
|
2253
2337
|
// Use the current range instead of the future actual range to match Apps Script behavior.
|
|
2254
2338
|
// Users can create the latest range in real time when needed.
|
|
2255
|
-
rangeType:
|
|
2256
|
-
startRow: a.rangeType ===
|
|
2257
|
-
endRow: a.rangeType ===
|
|
2258
|
-
startColumn: a.rangeType ===
|
|
2259
|
-
endColumn: a.rangeType ===
|
|
2339
|
+
rangeType: p.NORMAL,
|
|
2340
|
+
startRow: a.rangeType === p.COLUMN ? 0 : a.startRow,
|
|
2341
|
+
endRow: a.rangeType === p.COLUMN ? o.getMaxRows() - 1 : a.endRow,
|
|
2342
|
+
startColumn: a.rangeType === p.ROW ? 0 : a.startColumn,
|
|
2343
|
+
endColumn: a.rangeType === p.ROW ? o.getMaxColumns() - 1 : a.endColumn
|
|
2260
2344
|
};
|
|
2261
2345
|
} else if (typeof e == "number" && t !== void 0)
|
|
2262
2346
|
o = this._worksheet, i = {
|
|
@@ -2269,7 +2353,7 @@ let I = class extends Ae {
|
|
|
2269
2353
|
};
|
|
2270
2354
|
else
|
|
2271
2355
|
throw new Error("Invalid range specification");
|
|
2272
|
-
return this._injector.createInstance(
|
|
2356
|
+
return this._injector.createInstance(R, this._workbook, o, i);
|
|
2273
2357
|
}
|
|
2274
2358
|
/**
|
|
2275
2359
|
* Returns the current number of columns in the sheet, regardless of content.
|
|
@@ -2361,8 +2445,8 @@ let I = class extends Ae {
|
|
|
2361
2445
|
* ```
|
|
2362
2446
|
*/
|
|
2363
2447
|
insertRowsAfter(e, t) {
|
|
2364
|
-
const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i =
|
|
2365
|
-
return this._commandService.syncExecuteCommand(
|
|
2448
|
+
const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i = oe.DOWN, o = e + 1, a = e + t, h = 0, d = this._worksheet.getColumnCount() - 1, c = ae(this._worksheet, o, a, h, d, !0, e);
|
|
2449
|
+
return this._commandService.syncExecuteCommand(nt.id, {
|
|
2366
2450
|
unitId: s,
|
|
2367
2451
|
subUnitId: r,
|
|
2368
2452
|
direction: i,
|
|
@@ -2370,9 +2454,9 @@ let I = class extends Ae {
|
|
|
2370
2454
|
startRow: o,
|
|
2371
2455
|
endRow: a,
|
|
2372
2456
|
startColumn: h,
|
|
2373
|
-
endColumn:
|
|
2457
|
+
endColumn: d
|
|
2374
2458
|
},
|
|
2375
|
-
cellValue:
|
|
2459
|
+
cellValue: c
|
|
2376
2460
|
}), this;
|
|
2377
2461
|
}
|
|
2378
2462
|
/**
|
|
@@ -2390,8 +2474,8 @@ let I = class extends Ae {
|
|
|
2390
2474
|
* ```
|
|
2391
2475
|
*/
|
|
2392
2476
|
insertRowsBefore(e, t) {
|
|
2393
|
-
const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i =
|
|
2394
|
-
return this._commandService.syncExecuteCommand(
|
|
2477
|
+
const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i = oe.UP, o = e, a = e + t - 1, h = 0, d = this._worksheet.getColumnCount() - 1, c = ae(this._worksheet, o, a, h, d, !0, e - 1);
|
|
2478
|
+
return this._commandService.syncExecuteCommand(nt.id, {
|
|
2395
2479
|
unitId: s,
|
|
2396
2480
|
subUnitId: r,
|
|
2397
2481
|
direction: i,
|
|
@@ -2399,9 +2483,9 @@ let I = class extends Ae {
|
|
|
2399
2483
|
startRow: o,
|
|
2400
2484
|
endRow: a,
|
|
2401
2485
|
startColumn: h,
|
|
2402
|
-
endColumn:
|
|
2486
|
+
endColumn: d
|
|
2403
2487
|
},
|
|
2404
|
-
cellValue:
|
|
2488
|
+
cellValue: c
|
|
2405
2489
|
}), this;
|
|
2406
2490
|
}
|
|
2407
2491
|
/**
|
|
@@ -2441,7 +2525,7 @@ let I = class extends Ae {
|
|
|
2441
2525
|
startColumn: 0,
|
|
2442
2526
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2443
2527
|
};
|
|
2444
|
-
return this._commandService.syncExecuteCommand(
|
|
2528
|
+
return this._commandService.syncExecuteCommand(Fs.id, {
|
|
2445
2529
|
range: s,
|
|
2446
2530
|
unitId: this._workbook.getUnitId(),
|
|
2447
2531
|
subUnitId: this._worksheet.getSheetId()
|
|
@@ -2464,13 +2548,13 @@ let I = class extends Ae {
|
|
|
2464
2548
|
* ```
|
|
2465
2549
|
*/
|
|
2466
2550
|
moveRows(e, t) {
|
|
2467
|
-
const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i =
|
|
2551
|
+
const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i = ye(e.getRange(), this._worksheet), o = i, a = {
|
|
2468
2552
|
startRow: t,
|
|
2469
2553
|
endRow: t,
|
|
2470
2554
|
startColumn: i.startColumn,
|
|
2471
2555
|
endColumn: i.endColumn
|
|
2472
2556
|
};
|
|
2473
|
-
return this._commandService.syncExecuteCommand(
|
|
2557
|
+
return this._commandService.syncExecuteCommand(Hs.id, {
|
|
2474
2558
|
unitId: s,
|
|
2475
2559
|
subUnitId: r,
|
|
2476
2560
|
range: i,
|
|
@@ -2494,8 +2578,8 @@ let I = class extends Ae {
|
|
|
2494
2578
|
* ```
|
|
2495
2579
|
*/
|
|
2496
2580
|
hideRow(e) {
|
|
2497
|
-
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r =
|
|
2498
|
-
return this._commandService.syncExecuteCommand(
|
|
2581
|
+
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = ye(e.getRange(), this._worksheet);
|
|
2582
|
+
return this._commandService.syncExecuteCommand(rt.id, {
|
|
2499
2583
|
unitId: t,
|
|
2500
2584
|
subUnitId: s,
|
|
2501
2585
|
ranges: [r]
|
|
@@ -2521,9 +2605,9 @@ let I = class extends Ae {
|
|
|
2521
2605
|
endRow: e + t - 1,
|
|
2522
2606
|
startColumn: 0,
|
|
2523
2607
|
endColumn: this._worksheet.getColumnCount() - 1,
|
|
2524
|
-
rangeType:
|
|
2608
|
+
rangeType: p.ROW
|
|
2525
2609
|
};
|
|
2526
|
-
return this._commandService.syncExecuteCommand(
|
|
2610
|
+
return this._commandService.syncExecuteCommand(rt.id, {
|
|
2527
2611
|
unitId: s,
|
|
2528
2612
|
subUnitId: r,
|
|
2529
2613
|
ranges: [i]
|
|
@@ -2545,8 +2629,8 @@ let I = class extends Ae {
|
|
|
2545
2629
|
* ```
|
|
2546
2630
|
*/
|
|
2547
2631
|
unhideRow(e) {
|
|
2548
|
-
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r =
|
|
2549
|
-
return this._commandService.syncExecuteCommand(
|
|
2632
|
+
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = ye(e.getRange(), this._worksheet);
|
|
2633
|
+
return this._commandService.syncExecuteCommand(it.id, {
|
|
2550
2634
|
unitId: t,
|
|
2551
2635
|
subUnitId: s,
|
|
2552
2636
|
ranges: [r]
|
|
@@ -2572,9 +2656,9 @@ let I = class extends Ae {
|
|
|
2572
2656
|
endRow: e + t - 1,
|
|
2573
2657
|
startColumn: 0,
|
|
2574
2658
|
endColumn: this._worksheet.getColumnCount() - 1,
|
|
2575
|
-
rangeType:
|
|
2659
|
+
rangeType: p.ROW
|
|
2576
2660
|
};
|
|
2577
|
-
return this._commandService.syncExecuteCommand(
|
|
2661
|
+
return this._commandService.syncExecuteCommand(it.id, {
|
|
2578
2662
|
unitId: s,
|
|
2579
2663
|
subUnitId: r,
|
|
2580
2664
|
ranges: [i]
|
|
@@ -2608,19 +2692,19 @@ let I = class extends Ae {
|
|
|
2608
2692
|
* fWorkSheet.autoFitRow(24);
|
|
2609
2693
|
* ```
|
|
2610
2694
|
*/
|
|
2611
|
-
autoFitRow(e, t =
|
|
2695
|
+
autoFitRow(e, t = I.TRUE) {
|
|
2612
2696
|
const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i = [{
|
|
2613
2697
|
startRow: e,
|
|
2614
2698
|
endRow: e,
|
|
2615
2699
|
startColumn: 0,
|
|
2616
2700
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2617
2701
|
}];
|
|
2618
|
-
return this._commandService.syncExecuteCommand(
|
|
2702
|
+
return this._commandService.syncExecuteCommand(We.id, {
|
|
2619
2703
|
unitId: this._workbook.getUnitId(),
|
|
2620
2704
|
subUnitId: this._worksheet.getSheetId(),
|
|
2621
2705
|
range: i[0],
|
|
2622
|
-
value:
|
|
2623
|
-
}), this._commandService.syncExecuteCommand(
|
|
2706
|
+
value: ue.WRAP
|
|
2707
|
+
}), this._commandService.syncExecuteCommand($s.id, {
|
|
2624
2708
|
unitId: s,
|
|
2625
2709
|
subUnitId: r,
|
|
2626
2710
|
ranges: i,
|
|
@@ -2641,23 +2725,23 @@ let I = class extends Ae {
|
|
|
2641
2725
|
* ```
|
|
2642
2726
|
*/
|
|
2643
2727
|
setRowHeights(e, t, s) {
|
|
2644
|
-
var
|
|
2728
|
+
var d;
|
|
2645
2729
|
const r = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = this._worksheet.getRowManager(), a = [], h = [];
|
|
2646
|
-
for (let
|
|
2647
|
-
const
|
|
2648
|
-
startRow:
|
|
2649
|
-
endRow:
|
|
2730
|
+
for (let c = e; c < e + t; c++) {
|
|
2731
|
+
const m = ((d = o.getRow(c)) == null ? void 0 : d.ah) || this._worksheet.getConfig().defaultRowHeight, g = {
|
|
2732
|
+
startRow: c,
|
|
2733
|
+
endRow: c,
|
|
2650
2734
|
startColumn: 0,
|
|
2651
2735
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2652
2736
|
};
|
|
2653
|
-
s <=
|
|
2737
|
+
s <= m ? a.push(g) : h.push(g);
|
|
2654
2738
|
}
|
|
2655
|
-
return h.length > 0 && this._commandService.syncExecuteCommand(
|
|
2739
|
+
return h.length > 0 && this._commandService.syncExecuteCommand(ot.id, {
|
|
2656
2740
|
unitId: r,
|
|
2657
2741
|
subUnitId: i,
|
|
2658
2742
|
ranges: h,
|
|
2659
2743
|
value: s
|
|
2660
|
-
}), a.length > 0 && this._commandService.syncExecuteCommand(
|
|
2744
|
+
}), a.length > 0 && this._commandService.syncExecuteCommand(fe.id, {
|
|
2661
2745
|
unitId: r,
|
|
2662
2746
|
subUnitId: i,
|
|
2663
2747
|
ranges: a
|
|
@@ -2703,7 +2787,7 @@ let I = class extends Ae {
|
|
|
2703
2787
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2704
2788
|
}
|
|
2705
2789
|
];
|
|
2706
|
-
return this._commandService.syncExecuteCommand(
|
|
2790
|
+
return this._commandService.syncExecuteCommand(fe.id, {
|
|
2707
2791
|
unitId: s,
|
|
2708
2792
|
subUnitId: r,
|
|
2709
2793
|
ranges: i
|
|
@@ -2725,7 +2809,7 @@ let I = class extends Ae {
|
|
|
2725
2809
|
*/
|
|
2726
2810
|
setRangesAutoHeight(e) {
|
|
2727
2811
|
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId();
|
|
2728
|
-
return this._commandService.syncExecuteCommand(
|
|
2812
|
+
return this._commandService.syncExecuteCommand(fe.id, {
|
|
2729
2813
|
unitId: t,
|
|
2730
2814
|
subUnitId: s,
|
|
2731
2815
|
ranges: e
|
|
@@ -2752,7 +2836,7 @@ let I = class extends Ae {
|
|
|
2752
2836
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2753
2837
|
}
|
|
2754
2838
|
];
|
|
2755
|
-
return this._commandService.syncExecuteCommand(
|
|
2839
|
+
return this._commandService.syncExecuteCommand(ot.id, {
|
|
2756
2840
|
unitId: r,
|
|
2757
2841
|
subUnitId: i,
|
|
2758
2842
|
ranges: o,
|
|
@@ -2781,7 +2865,7 @@ let I = class extends Ae {
|
|
|
2781
2865
|
subUnitId: s,
|
|
2782
2866
|
rowData: r
|
|
2783
2867
|
};
|
|
2784
|
-
return this._commandService.syncExecuteCommand(
|
|
2868
|
+
return this._commandService.syncExecuteCommand(st.id, i), this;
|
|
2785
2869
|
}
|
|
2786
2870
|
// #region Column
|
|
2787
2871
|
/**
|
|
@@ -2848,8 +2932,8 @@ let I = class extends Ae {
|
|
|
2848
2932
|
* ```
|
|
2849
2933
|
*/
|
|
2850
2934
|
insertColumnsAfter(e, t) {
|
|
2851
|
-
const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i =
|
|
2852
|
-
return this._commandService.syncExecuteCommand(
|
|
2935
|
+
const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i = oe.RIGHT, o = 0, a = this._worksheet.getRowCount() - 1, h = e + 1, d = e + t, c = ae(this._worksheet, o, a, h, d, !1, e);
|
|
2936
|
+
return this._commandService.syncExecuteCommand(at.id, {
|
|
2853
2937
|
unitId: s,
|
|
2854
2938
|
subUnitId: r,
|
|
2855
2939
|
direction: i,
|
|
@@ -2857,9 +2941,9 @@ let I = class extends Ae {
|
|
|
2857
2941
|
startRow: o,
|
|
2858
2942
|
endRow: a,
|
|
2859
2943
|
startColumn: h,
|
|
2860
|
-
endColumn:
|
|
2944
|
+
endColumn: d
|
|
2861
2945
|
},
|
|
2862
|
-
cellValue:
|
|
2946
|
+
cellValue: c
|
|
2863
2947
|
}), this;
|
|
2864
2948
|
}
|
|
2865
2949
|
/**
|
|
@@ -2877,8 +2961,8 @@ let I = class extends Ae {
|
|
|
2877
2961
|
* ```
|
|
2878
2962
|
*/
|
|
2879
2963
|
insertColumnsBefore(e, t) {
|
|
2880
|
-
const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i =
|
|
2881
|
-
return this._commandService.syncExecuteCommand(
|
|
2964
|
+
const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i = oe.LEFT, o = 0, a = this._worksheet.getRowCount() - 1, h = e, d = e + t - 1, c = ae(this._worksheet, o, a, h, d, !1, e - 1);
|
|
2965
|
+
return this._commandService.syncExecuteCommand(at.id, {
|
|
2882
2966
|
unitId: s,
|
|
2883
2967
|
subUnitId: r,
|
|
2884
2968
|
direction: i,
|
|
@@ -2886,9 +2970,9 @@ let I = class extends Ae {
|
|
|
2886
2970
|
startRow: o,
|
|
2887
2971
|
endRow: a,
|
|
2888
2972
|
startColumn: h,
|
|
2889
|
-
endColumn:
|
|
2973
|
+
endColumn: d
|
|
2890
2974
|
},
|
|
2891
|
-
cellValue:
|
|
2975
|
+
cellValue: c
|
|
2892
2976
|
}), this;
|
|
2893
2977
|
}
|
|
2894
2978
|
/**
|
|
@@ -2928,7 +3012,7 @@ let I = class extends Ae {
|
|
|
2928
3012
|
startColumn: e,
|
|
2929
3013
|
endColumn: e + t - 1
|
|
2930
3014
|
};
|
|
2931
|
-
return this._commandService.syncExecuteCommand(
|
|
3015
|
+
return this._commandService.syncExecuteCommand(zs.id, {
|
|
2932
3016
|
range: s,
|
|
2933
3017
|
unitId: this._workbook.getUnitId(),
|
|
2934
3018
|
subUnitId: this._worksheet.getSheetId()
|
|
@@ -2951,13 +3035,13 @@ let I = class extends Ae {
|
|
|
2951
3035
|
* ```
|
|
2952
3036
|
*/
|
|
2953
3037
|
moveColumns(e, t) {
|
|
2954
|
-
const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i =
|
|
3038
|
+
const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i = Pe(e.getRange(), this._worksheet), o = i, a = {
|
|
2955
3039
|
startRow: 0,
|
|
2956
3040
|
endRow: this._worksheet.getRowCount() - 1,
|
|
2957
3041
|
startColumn: t,
|
|
2958
3042
|
endColumn: t
|
|
2959
3043
|
};
|
|
2960
|
-
return this._commandService.syncExecuteCommand(
|
|
3044
|
+
return this._commandService.syncExecuteCommand(Ls.id, {
|
|
2961
3045
|
unitId: s,
|
|
2962
3046
|
subUnitId: r,
|
|
2963
3047
|
range: i,
|
|
@@ -2981,8 +3065,8 @@ let I = class extends Ae {
|
|
|
2981
3065
|
* ```
|
|
2982
3066
|
*/
|
|
2983
3067
|
hideColumn(e) {
|
|
2984
|
-
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r =
|
|
2985
|
-
return this._commandService.syncExecuteCommand(
|
|
3068
|
+
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = Pe(e.getRange(), this._worksheet);
|
|
3069
|
+
return this._commandService.syncExecuteCommand(ht.id, {
|
|
2986
3070
|
unitId: t,
|
|
2987
3071
|
subUnitId: s,
|
|
2988
3072
|
ranges: [r]
|
|
@@ -3008,9 +3092,9 @@ let I = class extends Ae {
|
|
|
3008
3092
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3009
3093
|
startColumn: e,
|
|
3010
3094
|
endColumn: e + t - 1,
|
|
3011
|
-
rangeType:
|
|
3095
|
+
rangeType: p.COLUMN
|
|
3012
3096
|
};
|
|
3013
|
-
return this._commandService.syncExecuteCommand(
|
|
3097
|
+
return this._commandService.syncExecuteCommand(ht.id, {
|
|
3014
3098
|
unitId: s,
|
|
3015
3099
|
subUnitId: r,
|
|
3016
3100
|
ranges: [i]
|
|
@@ -3032,8 +3116,8 @@ let I = class extends Ae {
|
|
|
3032
3116
|
* ```
|
|
3033
3117
|
*/
|
|
3034
3118
|
unhideColumn(e) {
|
|
3035
|
-
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r =
|
|
3036
|
-
return this._commandService.syncExecuteCommand(
|
|
3119
|
+
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = Pe(e.getRange(), this._worksheet);
|
|
3120
|
+
return this._commandService.syncExecuteCommand(ct.id, {
|
|
3037
3121
|
unitId: t,
|
|
3038
3122
|
subUnitId: s,
|
|
3039
3123
|
ranges: [r]
|
|
@@ -3059,9 +3143,9 @@ let I = class extends Ae {
|
|
|
3059
3143
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3060
3144
|
startColumn: e,
|
|
3061
3145
|
endColumn: e + t - 1,
|
|
3062
|
-
rangeType:
|
|
3146
|
+
rangeType: p.COLUMN
|
|
3063
3147
|
};
|
|
3064
|
-
return this._commandService.syncExecuteCommand(
|
|
3148
|
+
return this._commandService.syncExecuteCommand(ct.id, {
|
|
3065
3149
|
unitId: s,
|
|
3066
3150
|
subUnitId: r,
|
|
3067
3151
|
ranges: [i]
|
|
@@ -3104,7 +3188,7 @@ let I = class extends Ae {
|
|
|
3104
3188
|
endRow: this._worksheet.getRowCount() - 1
|
|
3105
3189
|
}
|
|
3106
3190
|
];
|
|
3107
|
-
return this._commandService.syncExecuteCommand(
|
|
3191
|
+
return this._commandService.syncExecuteCommand(Gs.id, {
|
|
3108
3192
|
unitId: r,
|
|
3109
3193
|
subUnitId: i,
|
|
3110
3194
|
ranges: o,
|
|
@@ -3156,7 +3240,7 @@ let I = class extends Ae {
|
|
|
3156
3240
|
subUnitId: s,
|
|
3157
3241
|
columnData: r
|
|
3158
3242
|
};
|
|
3159
|
-
return this._commandService.syncExecuteCommand(
|
|
3243
|
+
return this._commandService.syncExecuteCommand(tt.id, i), this;
|
|
3160
3244
|
}
|
|
3161
3245
|
// #region merge cells
|
|
3162
3246
|
/**
|
|
@@ -3174,7 +3258,7 @@ let I = class extends Ae {
|
|
|
3174
3258
|
* ```
|
|
3175
3259
|
*/
|
|
3176
3260
|
getMergeData() {
|
|
3177
|
-
return this._worksheet.getMergeData().map((e) => this._injector.createInstance(
|
|
3261
|
+
return this._worksheet.getMergeData().map((e) => this._injector.createInstance(R, this._workbook, this._worksheet, e));
|
|
3178
3262
|
}
|
|
3179
3263
|
/**
|
|
3180
3264
|
* Get all merged cells in the current sheet
|
|
@@ -3191,7 +3275,7 @@ let I = class extends Ae {
|
|
|
3191
3275
|
* ```
|
|
3192
3276
|
*/
|
|
3193
3277
|
getMergedRanges() {
|
|
3194
|
-
return this._worksheet.getSnapshot().mergeData.map((t) => this._injector.createInstance(
|
|
3278
|
+
return this._worksheet.getSnapshot().mergeData.map((t) => this._injector.createInstance(R, this._workbook, this._worksheet, t));
|
|
3195
3279
|
}
|
|
3196
3280
|
/**
|
|
3197
3281
|
* Get the merged cell data of the specified row and column.
|
|
@@ -3210,7 +3294,7 @@ let I = class extends Ae {
|
|
|
3210
3294
|
getCellMergeData(e, t) {
|
|
3211
3295
|
const r = this._worksheet.getMergedCell(e, t);
|
|
3212
3296
|
if (r)
|
|
3213
|
-
return this._injector.createInstance(
|
|
3297
|
+
return this._injector.createInstance(R, this._workbook, this._worksheet, r);
|
|
3214
3298
|
}
|
|
3215
3299
|
// #endregion
|
|
3216
3300
|
/**
|
|
@@ -3276,7 +3360,7 @@ let I = class extends Ae {
|
|
|
3276
3360
|
* ```
|
|
3277
3361
|
*/
|
|
3278
3362
|
setFreeze(e) {
|
|
3279
|
-
return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"), this._commandService.syncExecuteCommand(
|
|
3363
|
+
return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"), this._commandService.syncExecuteCommand(ve.id, {
|
|
3280
3364
|
...e,
|
|
3281
3365
|
unitId: this._workbook.getUnitId(),
|
|
3282
3366
|
subUnitId: this.getSheetId()
|
|
@@ -3293,7 +3377,7 @@ let I = class extends Ae {
|
|
|
3293
3377
|
* ```
|
|
3294
3378
|
*/
|
|
3295
3379
|
cancelFreeze() {
|
|
3296
|
-
return this._commandService.syncExecuteCommand(
|
|
3380
|
+
return this._commandService.syncExecuteCommand(Ks.id, {
|
|
3297
3381
|
unitId: this._workbook.getUnitId(),
|
|
3298
3382
|
subUnitId: this.getSheetId()
|
|
3299
3383
|
}), this;
|
|
@@ -3323,7 +3407,7 @@ let I = class extends Ae {
|
|
|
3323
3407
|
});
|
|
3324
3408
|
} else if (arguments.length === 2) {
|
|
3325
3409
|
let [s = 0, r = 0] = e;
|
|
3326
|
-
s > r && ([s, r] = [r, s]), this._commandService.syncExecuteCommand(
|
|
3410
|
+
s > r && ([s, r] = [r, s]), this._commandService.syncExecuteCommand(ve.id, {
|
|
3327
3411
|
startColumn: r + 1,
|
|
3328
3412
|
xSplit: r - s + 1,
|
|
3329
3413
|
startRow: t.startRow,
|
|
@@ -3345,7 +3429,7 @@ let I = class extends Ae {
|
|
|
3345
3429
|
});
|
|
3346
3430
|
} else if (arguments.length === 2) {
|
|
3347
3431
|
let [s = 0, r = 0] = e;
|
|
3348
|
-
s > r && ([s, r] = [r, s]), this._commandService.syncExecuteCommand(
|
|
3432
|
+
s > r && ([s, r] = [r, s]), this._commandService.syncExecuteCommand(ve.id, {
|
|
3349
3433
|
startRow: r + 1,
|
|
3350
3434
|
ySplit: r - s + 1,
|
|
3351
3435
|
startColumn: t.startColumn,
|
|
@@ -3435,7 +3519,7 @@ let I = class extends Ae {
|
|
|
3435
3519
|
* ```
|
|
3436
3520
|
*/
|
|
3437
3521
|
hasHiddenGridLines() {
|
|
3438
|
-
return this._worksheet.getConfig().showGridlines ===
|
|
3522
|
+
return this._worksheet.getConfig().showGridlines === I.FALSE;
|
|
3439
3523
|
}
|
|
3440
3524
|
/**
|
|
3441
3525
|
* Hides or reveals the sheet gridlines.
|
|
@@ -3449,10 +3533,10 @@ let I = class extends Ae {
|
|
|
3449
3533
|
* ```
|
|
3450
3534
|
*/
|
|
3451
3535
|
setHiddenGridlines(e) {
|
|
3452
|
-
return this._commandService.syncExecuteCommand(
|
|
3536
|
+
return this._commandService.syncExecuteCommand(je.id, {
|
|
3453
3537
|
unitId: this._workbook.getUnitId(),
|
|
3454
3538
|
subUnitId: this._worksheet.getSheetId(),
|
|
3455
|
-
showGridlines: e ?
|
|
3539
|
+
showGridlines: e ? I.FALSE : I.TRUE
|
|
3456
3540
|
}), this;
|
|
3457
3541
|
}
|
|
3458
3542
|
/**
|
|
@@ -3467,7 +3551,7 @@ let I = class extends Ae {
|
|
|
3467
3551
|
* ```
|
|
3468
3552
|
*/
|
|
3469
3553
|
setGridLinesColor(e) {
|
|
3470
|
-
return this._commandService.syncExecuteCommand(
|
|
3554
|
+
return this._commandService.syncExecuteCommand(Ne.id, {
|
|
3471
3555
|
unitId: this._workbook.getUnitId(),
|
|
3472
3556
|
subUnitId: this._worksheet.getSheetId(),
|
|
3473
3557
|
color: e
|
|
@@ -3500,7 +3584,7 @@ let I = class extends Ae {
|
|
|
3500
3584
|
* ```
|
|
3501
3585
|
*/
|
|
3502
3586
|
setTabColor(e) {
|
|
3503
|
-
return this._commandService.syncExecuteCommand(
|
|
3587
|
+
return this._commandService.syncExecuteCommand(Js.id, {
|
|
3504
3588
|
unitId: this._workbook.getUnitId(),
|
|
3505
3589
|
subUnitId: this._worksheet.getSheetId(),
|
|
3506
3590
|
value: e
|
|
@@ -3525,10 +3609,10 @@ let I = class extends Ae {
|
|
|
3525
3609
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.SheetValueChanged, (params) => {})` instead
|
|
3526
3610
|
*/
|
|
3527
3611
|
onCellDataChange(e) {
|
|
3528
|
-
return this._injector.get(
|
|
3529
|
-
if (s.id ===
|
|
3612
|
+
return this._injector.get(C).onCommandExecuted((s) => {
|
|
3613
|
+
if (s.id === dt.id) {
|
|
3530
3614
|
const r = s.params;
|
|
3531
|
-
r.unitId === this._workbook.getUnitId() && r.subUnitId === this._worksheet.getSheetId() && r.cellValue && e(new
|
|
3615
|
+
r.unitId === this._workbook.getUnitId() && r.subUnitId === this._worksheet.getSheetId() && r.cellValue && e(new Ie(r.cellValue));
|
|
3532
3616
|
}
|
|
3533
3617
|
});
|
|
3534
3618
|
}
|
|
@@ -3536,10 +3620,10 @@ let I = class extends Ae {
|
|
|
3536
3620
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeSheetEditEnd, (params) => {})` instead
|
|
3537
3621
|
*/
|
|
3538
3622
|
onBeforeCellDataChange(e) {
|
|
3539
|
-
return this._injector.get(
|
|
3540
|
-
if (s.id ===
|
|
3623
|
+
return this._injector.get(C).beforeCommandExecuted((s) => {
|
|
3624
|
+
if (s.id === dt.id) {
|
|
3541
3625
|
const r = s.params;
|
|
3542
|
-
r.unitId === this._workbook.getUnitId() && r.subUnitId === this._worksheet.getSheetId() && r.cellValue && e(new
|
|
3626
|
+
r.unitId === this._workbook.getUnitId() && r.subUnitId === this._worksheet.getSheetId() && r.cellValue && e(new Ie(r.cellValue));
|
|
3543
3627
|
}
|
|
3544
3628
|
});
|
|
3545
3629
|
}
|
|
@@ -3555,10 +3639,10 @@ let I = class extends Ae {
|
|
|
3555
3639
|
* ```
|
|
3556
3640
|
*/
|
|
3557
3641
|
hideSheet() {
|
|
3558
|
-
const e = this._injector.get(
|
|
3559
|
-
if (this._workbook.getSheets().filter((i) => i.isSheetHidden() !==
|
|
3642
|
+
const e = this._injector.get(C);
|
|
3643
|
+
if (this._workbook.getSheets().filter((i) => i.isSheetHidden() !== I.TRUE).length <= 1)
|
|
3560
3644
|
throw new Error("Cannot hide the only visible sheet");
|
|
3561
|
-
return e.syncExecuteCommand(
|
|
3645
|
+
return e.syncExecuteCommand(qs.id, {
|
|
3562
3646
|
unitId: this._workbook.getUnitId(),
|
|
3563
3647
|
subUnitId: this._worksheet.getSheetId()
|
|
3564
3648
|
}), this;
|
|
@@ -3575,7 +3659,7 @@ let I = class extends Ae {
|
|
|
3575
3659
|
* ```
|
|
3576
3660
|
*/
|
|
3577
3661
|
showSheet() {
|
|
3578
|
-
return this._injector.get(
|
|
3662
|
+
return this._injector.get(C).syncExecuteCommand(Ys.id, {
|
|
3579
3663
|
unitId: this._workbook.getUnitId(),
|
|
3580
3664
|
subUnitId: this._worksheet.getSheetId()
|
|
3581
3665
|
}), this;
|
|
@@ -3592,7 +3676,7 @@ let I = class extends Ae {
|
|
|
3592
3676
|
* ```
|
|
3593
3677
|
*/
|
|
3594
3678
|
isSheetHidden() {
|
|
3595
|
-
return this._worksheet.isSheetHidden() ===
|
|
3679
|
+
return this._worksheet.isSheetHidden() === I.TRUE;
|
|
3596
3680
|
}
|
|
3597
3681
|
/**
|
|
3598
3682
|
* Sets the sheet name.
|
|
@@ -3607,7 +3691,7 @@ let I = class extends Ae {
|
|
|
3607
3691
|
* ```
|
|
3608
3692
|
*/
|
|
3609
3693
|
setName(e) {
|
|
3610
|
-
return this._commandService.syncExecuteCommand(
|
|
3694
|
+
return this._commandService.syncExecuteCommand(Oe.id, {
|
|
3611
3695
|
unitId: this._workbook.getUnitId(),
|
|
3612
3696
|
subUnitId: this._worksheet.getSheetId(),
|
|
3613
3697
|
name: e
|
|
@@ -3663,13 +3747,13 @@ let I = class extends Ae {
|
|
|
3663
3747
|
return this.clearContents();
|
|
3664
3748
|
if (e && e.formatOnly && !e.contentsOnly)
|
|
3665
3749
|
return this.clearFormats();
|
|
3666
|
-
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = this._injector.get(
|
|
3750
|
+
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = this._injector.get(C), i = {
|
|
3667
3751
|
startRow: 0,
|
|
3668
3752
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3669
3753
|
startColumn: 0,
|
|
3670
3754
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
3671
3755
|
};
|
|
3672
|
-
return r.syncExecuteCommand(
|
|
3756
|
+
return r.syncExecuteCommand(Ut.id, {
|
|
3673
3757
|
unitId: t,
|
|
3674
3758
|
subUnitId: s,
|
|
3675
3759
|
ranges: [i],
|
|
@@ -3688,13 +3772,13 @@ let I = class extends Ae {
|
|
|
3688
3772
|
* ```
|
|
3689
3773
|
*/
|
|
3690
3774
|
clearContents() {
|
|
3691
|
-
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), s = this._injector.get(
|
|
3775
|
+
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), s = this._injector.get(C), r = {
|
|
3692
3776
|
startRow: 0,
|
|
3693
3777
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3694
3778
|
startColumn: 0,
|
|
3695
3779
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
3696
3780
|
};
|
|
3697
|
-
return s.syncExecuteCommand(
|
|
3781
|
+
return s.syncExecuteCommand(xt.id, {
|
|
3698
3782
|
unitId: e,
|
|
3699
3783
|
subUnitId: t,
|
|
3700
3784
|
ranges: [r]
|
|
@@ -3712,13 +3796,13 @@ let I = class extends Ae {
|
|
|
3712
3796
|
* ```
|
|
3713
3797
|
*/
|
|
3714
3798
|
clearFormats() {
|
|
3715
|
-
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), s = this._injector.get(
|
|
3799
|
+
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), s = this._injector.get(C), r = {
|
|
3716
3800
|
startRow: 0,
|
|
3717
3801
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3718
3802
|
startColumn: 0,
|
|
3719
3803
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
3720
3804
|
};
|
|
3721
|
-
return s.syncExecuteCommand(
|
|
3805
|
+
return s.syncExecuteCommand(Dt.id, {
|
|
3722
3806
|
unitId: e,
|
|
3723
3807
|
subUnitId: t,
|
|
3724
3808
|
ranges: [r]
|
|
@@ -3803,7 +3887,7 @@ let I = class extends Ae {
|
|
|
3803
3887
|
* ```
|
|
3804
3888
|
*/
|
|
3805
3889
|
equalTo(e) {
|
|
3806
|
-
return e instanceof
|
|
3890
|
+
return e instanceof v ? this._worksheet.getSheetId() === e.getSheetId() && this._workbook.getUnitId() === e.getWorkbook().getUnitId() : !1;
|
|
3807
3891
|
}
|
|
3808
3892
|
/**
|
|
3809
3893
|
* Insert a defined name for worksheet.
|
|
@@ -3817,7 +3901,7 @@ let I = class extends Ae {
|
|
|
3817
3901
|
* ```
|
|
3818
3902
|
*/
|
|
3819
3903
|
insertDefinedName(e, t) {
|
|
3820
|
-
const r = this._injector.createInstance(
|
|
3904
|
+
const r = this._injector.createInstance(Ce).setName(e).setRef(t).build();
|
|
3821
3905
|
r.localSheetId = this.getSheetId(), this._fWorkbook.insertDefinedNameBuilder(r);
|
|
3822
3906
|
}
|
|
3823
3907
|
/**
|
|
@@ -3936,10 +4020,10 @@ let I = class extends Ae {
|
|
|
3936
4020
|
* ```
|
|
3937
4021
|
*/
|
|
3938
4022
|
appendRow(e) {
|
|
3939
|
-
const t = this._worksheet.getCellMatrix().hasValue(), s = this._worksheet.getLastRowWithContent(), r = this._worksheet.getRowCount(), i = this._worksheet.getColumnCount(), o = t ? s + 1 : s, a = new
|
|
4023
|
+
const t = this._worksheet.getCellMatrix().hasValue(), s = this._worksheet.getLastRowWithContent(), r = this._worksheet.getRowCount(), i = this._worksheet.getColumnCount(), o = t ? s + 1 : s, a = new Ie();
|
|
3940
4024
|
for (let h = 0; h < e.length; h++)
|
|
3941
|
-
a.setValue(o, h,
|
|
3942
|
-
return this._commandService.syncExecuteCommand(
|
|
4025
|
+
a.setValue(o, h, xe(e[h]));
|
|
4026
|
+
return this._commandService.syncExecuteCommand(Zs.id, {
|
|
3943
4027
|
unitId: this._workbook.getUnitId(),
|
|
3944
4028
|
subUnitId: this._worksheet.getSheetId(),
|
|
3945
4029
|
cellValue: a.getMatrix(),
|
|
@@ -3963,7 +4047,7 @@ let I = class extends Ae {
|
|
|
3963
4047
|
* ```
|
|
3964
4048
|
*/
|
|
3965
4049
|
setRowCount(e) {
|
|
3966
|
-
return this._commandService.syncExecuteCommand(
|
|
4050
|
+
return this._commandService.syncExecuteCommand(Qs.id, {
|
|
3967
4051
|
unitId: this._workbook.getUnitId(),
|
|
3968
4052
|
subUnitId: this._worksheet.getSheetId(),
|
|
3969
4053
|
rowCount: e
|
|
@@ -3983,7 +4067,7 @@ let I = class extends Ae {
|
|
|
3983
4067
|
* ```
|
|
3984
4068
|
*/
|
|
3985
4069
|
setColumnCount(e) {
|
|
3986
|
-
return this._commandService.syncExecuteCommand(
|
|
4070
|
+
return this._commandService.syncExecuteCommand(Xs.id, {
|
|
3987
4071
|
unitId: this._workbook.getUnitId(),
|
|
3988
4072
|
subUnitId: this._worksheet.getSheetId(),
|
|
3989
4073
|
columnCount: e
|
|
@@ -4020,38 +4104,38 @@ let I = class extends Ae {
|
|
|
4020
4104
|
*/
|
|
4021
4105
|
getWorksheetPermission() {
|
|
4022
4106
|
return this._injector.createInstance(
|
|
4023
|
-
|
|
4107
|
+
Ve,
|
|
4024
4108
|
this
|
|
4025
4109
|
);
|
|
4026
4110
|
}
|
|
4027
4111
|
};
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
],
|
|
4034
|
-
var
|
|
4035
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
4112
|
+
v = zn([
|
|
4113
|
+
de(3, l(E)),
|
|
4114
|
+
de(4, l(Et)),
|
|
4115
|
+
de(5, l(bt)),
|
|
4116
|
+
de(6, C)
|
|
4117
|
+
], v);
|
|
4118
|
+
var Ln = Object.getOwnPropertyDescriptor, Gn = (n, e, t, s) => {
|
|
4119
|
+
for (var r = s > 1 ? void 0 : s ? Ln(e, t) : e, i = n.length - 1, o; i >= 0; i--)
|
|
4036
4120
|
(o = n[i]) && (r = o(r) || r);
|
|
4037
4121
|
return r;
|
|
4038
|
-
},
|
|
4039
|
-
let
|
|
4122
|
+
}, ee = (n, e) => (t, s) => e(t, s, n);
|
|
4123
|
+
let Ae = class {
|
|
4040
4124
|
constructor(n, e, t, s, r, i, o, a, h) {
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4125
|
+
w(this, "_permissionSubject");
|
|
4126
|
+
w(this, "_subscriptions", []);
|
|
4127
|
+
w(this, "_fPermission");
|
|
4044
4128
|
/**
|
|
4045
4129
|
* Observable stream of permission snapshot changes
|
|
4046
4130
|
* @returns Observable that emits when permission snapshot changes
|
|
4047
4131
|
*/
|
|
4048
|
-
|
|
4132
|
+
w(this, "permission$");
|
|
4049
4133
|
/**
|
|
4050
4134
|
* Observable stream of protection state changes
|
|
4051
4135
|
* @returns Observable that emits when protection state changes
|
|
4052
4136
|
*/
|
|
4053
|
-
|
|
4054
|
-
this._unitId = n, this._subUnitId = e, this._range = t, this._worksheet = s, this._injector = r, this._permissionService = i, this._authzIoService = o, this._commandService = a, this._rangeProtectionRuleModel = h, this._fPermission = this._injector.createInstance(
|
|
4137
|
+
w(this, "protectionChange$");
|
|
4138
|
+
this._unitId = n, this._subUnitId = e, this._range = t, this._worksheet = s, this._injector = r, 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();
|
|
4055
4139
|
}
|
|
4056
4140
|
/**
|
|
4057
4141
|
* Create permission snapshot stream from IPermissionService
|
|
@@ -4059,7 +4143,7 @@ let Oe = class {
|
|
|
4059
4143
|
*/
|
|
4060
4144
|
_createPermissionStream() {
|
|
4061
4145
|
const n = this._permissionService.permissionPointUpdate$.pipe(
|
|
4062
|
-
|
|
4146
|
+
D((e) => {
|
|
4063
4147
|
const t = e.id;
|
|
4064
4148
|
return t.includes(this._unitId) && t.includes(this._subUnitId);
|
|
4065
4149
|
})
|
|
@@ -4067,7 +4151,7 @@ let Oe = class {
|
|
|
4067
4151
|
this._permissionSubject.next(this._buildSnapshot());
|
|
4068
4152
|
});
|
|
4069
4153
|
return this._subscriptions.push(n), this._permissionSubject.asObservable().pipe(
|
|
4070
|
-
|
|
4154
|
+
_e((e, t) => JSON.stringify(e) === JSON.stringify(t)),
|
|
4071
4155
|
N({ bufferSize: 1, refCount: !0 })
|
|
4072
4156
|
);
|
|
4073
4157
|
}
|
|
@@ -4077,8 +4161,8 @@ let Oe = class {
|
|
|
4077
4161
|
*/
|
|
4078
4162
|
_createProtectionChangeStream() {
|
|
4079
4163
|
return this._rangeProtectionRuleModel.ruleChange$.pipe(
|
|
4080
|
-
|
|
4081
|
-
|
|
4164
|
+
D((n) => n.unitId !== this._unitId || n.subUnitId !== this._subUnitId ? !1 : n.type === "delete" ? this._rangeMatches(n.rule) : n.type === "add" ? this._rangeMatches(n.rule) : !1),
|
|
4165
|
+
we((n) => (this._permissionSubject.next(this._buildSnapshot()), n.type === "delete" ? {
|
|
4082
4166
|
type: "unprotected",
|
|
4083
4167
|
ruleId: n.rule.id
|
|
4084
4168
|
} : {
|
|
@@ -4110,11 +4194,11 @@ let Oe = class {
|
|
|
4110
4194
|
)
|
|
4111
4195
|
), t = {
|
|
4112
4196
|
name: n.description || "",
|
|
4113
|
-
allowViewByOthers: n.viewState !==
|
|
4114
|
-
allowEdit: n.editState ===
|
|
4197
|
+
allowViewByOthers: n.viewState !== U.NoOneElseCanView,
|
|
4198
|
+
allowEdit: n.editState === x.DesignedUserCanEdit
|
|
4115
4199
|
};
|
|
4116
4200
|
return this._injector.createInstance(
|
|
4117
|
-
|
|
4201
|
+
O,
|
|
4118
4202
|
this._unitId,
|
|
4119
4203
|
this._subUnitId,
|
|
4120
4204
|
n.id,
|
|
@@ -4136,7 +4220,7 @@ let Oe = class {
|
|
|
4136
4220
|
* ```
|
|
4137
4221
|
*/
|
|
4138
4222
|
getPoint(n) {
|
|
4139
|
-
const e =
|
|
4223
|
+
const e = se[n];
|
|
4140
4224
|
if (!e)
|
|
4141
4225
|
return console.warn(`Unknown permission point: ${n}`), !1;
|
|
4142
4226
|
const t = this._getProtectionRule();
|
|
@@ -4188,7 +4272,7 @@ let Oe = class {
|
|
|
4188
4272
|
* ```
|
|
4189
4273
|
*/
|
|
4190
4274
|
canEdit() {
|
|
4191
|
-
return this.getPoint(
|
|
4275
|
+
return this.getPoint(b.Edit);
|
|
4192
4276
|
}
|
|
4193
4277
|
/**
|
|
4194
4278
|
* Check if the current user can view this range.
|
|
@@ -4203,7 +4287,7 @@ let Oe = class {
|
|
|
4203
4287
|
* ```
|
|
4204
4288
|
*/
|
|
4205
4289
|
canView() {
|
|
4206
|
-
return this.getPoint(
|
|
4290
|
+
return this.getPoint(b.View);
|
|
4207
4291
|
}
|
|
4208
4292
|
/**
|
|
4209
4293
|
* Check if the current user can manage collaborators for this range.
|
|
@@ -4218,7 +4302,7 @@ let Oe = class {
|
|
|
4218
4302
|
* ```
|
|
4219
4303
|
*/
|
|
4220
4304
|
canManageCollaborator() {
|
|
4221
|
-
return this.getPoint(
|
|
4305
|
+
return this.getPoint(b.ManageCollaborator);
|
|
4222
4306
|
}
|
|
4223
4307
|
/**
|
|
4224
4308
|
* Check if the current user can delete this protection rule.
|
|
@@ -4233,7 +4317,7 @@ let Oe = class {
|
|
|
4233
4317
|
* ```
|
|
4234
4318
|
*/
|
|
4235
4319
|
canDelete() {
|
|
4236
|
-
return this.getPoint(
|
|
4320
|
+
return this.getPoint(b.Delete);
|
|
4237
4321
|
}
|
|
4238
4322
|
/**
|
|
4239
4323
|
* Set a specific permission point for the range (low-level API).
|
|
@@ -4266,7 +4350,7 @@ let Oe = class {
|
|
|
4266
4350
|
* ```
|
|
4267
4351
|
*/
|
|
4268
4352
|
async setPoint(n, e) {
|
|
4269
|
-
const t =
|
|
4353
|
+
const t = se[n];
|
|
4270
4354
|
if (!t)
|
|
4271
4355
|
throw new Error(`Unknown permission point: ${n}`);
|
|
4272
4356
|
const s = this._getProtectionRule();
|
|
@@ -4307,7 +4391,7 @@ let Oe = class {
|
|
|
4307
4391
|
throw new Error("Failed to create range protection");
|
|
4308
4392
|
const { permissionId: t, ruleId: s } = e;
|
|
4309
4393
|
return await this._setPermissionPoints(t, n), this._injector.createInstance(
|
|
4310
|
-
|
|
4394
|
+
O,
|
|
4311
4395
|
this._unitId,
|
|
4312
4396
|
this._subUnitId,
|
|
4313
4397
|
s,
|
|
@@ -4321,7 +4405,7 @@ let Oe = class {
|
|
|
4321
4405
|
* @private
|
|
4322
4406
|
*/
|
|
4323
4407
|
_determineViewState(n) {
|
|
4324
|
-
return (n == null ? void 0 : n.allowViewByOthers) === !1 ?
|
|
4408
|
+
return (n == null ? void 0 : n.allowViewByOthers) === !1 ? U.NoOneElseCanView : U.OthersCanView;
|
|
4325
4409
|
}
|
|
4326
4410
|
/**
|
|
4327
4411
|
* Determine edit state from options
|
|
@@ -4329,7 +4413,7 @@ let Oe = class {
|
|
|
4329
4413
|
*/
|
|
4330
4414
|
_determineEditState(n) {
|
|
4331
4415
|
var e;
|
|
4332
|
-
return (n == null ? void 0 : n.allowEdit) === !0 && ((e = n == null ? void 0 : n.allowedUsers) != null && e.length) ?
|
|
4416
|
+
return (n == null ? void 0 : n.allowEdit) === !0 && ((e = n == null ? void 0 : n.allowedUsers) != null && e.length) ? x.DesignedUserCanEdit : x.OnlyMe;
|
|
4333
4417
|
}
|
|
4334
4418
|
/**
|
|
4335
4419
|
* Set permission points based on options (for local runtime control)
|
|
@@ -4339,14 +4423,14 @@ let Oe = class {
|
|
|
4339
4423
|
if (!e)
|
|
4340
4424
|
return;
|
|
4341
4425
|
const t = (s, r) => s === void 0 ? r : typeof s == "boolean" ? s : !0;
|
|
4342
|
-
await this._setPermissionPoint(n,
|
|
4426
|
+
await this._setPermissionPoint(n, b.Edit, t(e.allowEdit, !1)), await this._setPermissionPoint(n, b.View, t(e.allowViewByOthers, !0));
|
|
4343
4427
|
}
|
|
4344
4428
|
/**
|
|
4345
4429
|
* Set a single permission point
|
|
4346
4430
|
* @private
|
|
4347
4431
|
*/
|
|
4348
4432
|
async _setPermissionPoint(n, e, t) {
|
|
4349
|
-
const s =
|
|
4433
|
+
const s = se[e];
|
|
4350
4434
|
s && this._fPermission.setRangeProtectionPermissionPoint(this._unitId, this._subUnitId, n, s, t);
|
|
4351
4435
|
}
|
|
4352
4436
|
/**
|
|
@@ -4424,10 +4508,10 @@ let Oe = class {
|
|
|
4424
4508
|
)
|
|
4425
4509
|
), s = {
|
|
4426
4510
|
name: e.description || "",
|
|
4427
|
-
allowViewByOthers: e.viewState !==
|
|
4511
|
+
allowViewByOthers: e.viewState !== U.NoOneElseCanView
|
|
4428
4512
|
};
|
|
4429
|
-
return e.editState ===
|
|
4430
|
-
|
|
4513
|
+
return e.editState === x.DesignedUserCanEdit ? s.allowEdit = !0 : s.allowEdit = !1, this._injector.createInstance(
|
|
4514
|
+
O,
|
|
4431
4515
|
this._unitId,
|
|
4432
4516
|
this._subUnitId,
|
|
4433
4517
|
e.id,
|
|
@@ -4454,14 +4538,14 @@ let Oe = class {
|
|
|
4454
4538
|
)
|
|
4455
4539
|
), r = {
|
|
4456
4540
|
name: t.description || "",
|
|
4457
|
-
allowViewByOthers: t.viewState !==
|
|
4541
|
+
allowViewByOthers: t.viewState !== U.NoOneElseCanView
|
|
4458
4542
|
};
|
|
4459
|
-
if (t.editState ===
|
|
4543
|
+
if (t.editState === x.DesignedUserCanEdit)
|
|
4460
4544
|
try {
|
|
4461
4545
|
const o = (await this._authzIoService.listCollaborators({
|
|
4462
4546
|
objectID: t.permissionId,
|
|
4463
4547
|
unitID: this._unitId
|
|
4464
|
-
})).filter((a) => a.role ===
|
|
4548
|
+
})).filter((a) => a.role === Je.Editor).map((a) => {
|
|
4465
4549
|
var h;
|
|
4466
4550
|
return ((h = a.subject) == null ? void 0 : h.userID) || a.id;
|
|
4467
4551
|
});
|
|
@@ -4479,7 +4563,7 @@ let Oe = class {
|
|
|
4479
4563
|
})
|
|
4480
4564
|
)).map(
|
|
4481
4565
|
({ rule: t, ranges: s, options: r }) => this._injector.createInstance(
|
|
4482
|
-
|
|
4566
|
+
O,
|
|
4483
4567
|
this._unitId,
|
|
4484
4568
|
this._subUnitId,
|
|
4485
4569
|
t.id,
|
|
@@ -4494,7 +4578,7 @@ let Oe = class {
|
|
|
4494
4578
|
*/
|
|
4495
4579
|
_buildSnapshot() {
|
|
4496
4580
|
const n = {};
|
|
4497
|
-
return Object.values(
|
|
4581
|
+
return Object.values(b).forEach((e) => {
|
|
4498
4582
|
n[e] = this.getPoint(e);
|
|
4499
4583
|
}), n;
|
|
4500
4584
|
}
|
|
@@ -4505,19 +4589,19 @@ let Oe = class {
|
|
|
4505
4589
|
this._subscriptions.forEach((n) => n.unsubscribe()), this._permissionSubject.complete();
|
|
4506
4590
|
}
|
|
4507
4591
|
};
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
],
|
|
4515
|
-
var
|
|
4516
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
4592
|
+
Ae = Gn([
|
|
4593
|
+
ee(4, l(E)),
|
|
4594
|
+
ee(5, l(Y)),
|
|
4595
|
+
ee(6, l(re)),
|
|
4596
|
+
ee(7, l(C)),
|
|
4597
|
+
ee(8, l(ie))
|
|
4598
|
+
], Ae);
|
|
4599
|
+
var Kn = Object.getOwnPropertyDescriptor, Jn = (n, e, t, s) => {
|
|
4600
|
+
for (var r = s > 1 ? void 0 : s ? Kn(e, t) : e, i = n.length - 1, o; i >= 0; i--)
|
|
4517
4601
|
(o = n[i]) && (r = o(r) || r);
|
|
4518
4602
|
return r;
|
|
4519
|
-
},
|
|
4520
|
-
let
|
|
4603
|
+
}, Ee = (n, e) => (t, s) => e(t, s, n), q;
|
|
4604
|
+
let R = (q = class extends He {
|
|
4521
4605
|
constructor(e, t, s, r, i, o) {
|
|
4522
4606
|
super(r), this._workbook = e, this._worksheet = t, this._range = s, this._injector = r, this._commandService = i, this._formulaDataModel = o;
|
|
4523
4607
|
const a = this._worksheet.getRowCount(), h = this._worksheet.getColumnCount();
|
|
@@ -4690,7 +4774,7 @@ let f = (K = class extends Ae {
|
|
|
4690
4774
|
*/
|
|
4691
4775
|
isMerged() {
|
|
4692
4776
|
const { startColumn: e, startRow: t, endColumn: s, endRow: r } = this._range;
|
|
4693
|
-
return this._worksheet.getMergedCellRange(t, e, r, s).some((o) =>
|
|
4777
|
+
return this._worksheet.getMergedCellRange(t, e, r, s).some((o) => $.equals(o, this._range));
|
|
4694
4778
|
}
|
|
4695
4779
|
/**
|
|
4696
4780
|
* Return first cell style data in this range. Please note that if there are row styles, col styles and (or)
|
|
@@ -4774,7 +4858,7 @@ let f = (K = class extends Ae {
|
|
|
4774
4858
|
*/
|
|
4775
4859
|
getCellStyle(e = "row") {
|
|
4776
4860
|
const t = this.getCellStyleData(e);
|
|
4777
|
-
return t ?
|
|
4861
|
+
return t ? qe.create(t) : null;
|
|
4778
4862
|
}
|
|
4779
4863
|
/**
|
|
4780
4864
|
* Returns the cell styles for the cells in the range.
|
|
@@ -4797,7 +4881,7 @@ let f = (K = class extends Ae {
|
|
|
4797
4881
|
return this.getCellDatas().map((s, r) => s.map((i, o) => {
|
|
4798
4882
|
if (!i) return null;
|
|
4799
4883
|
const a = e !== "cell" ? this._worksheet.getComposedCellStyle(r + this._range.startRow, o + this._range.startColumn, e === "row") : this._worksheet.getCellStyle(r + this._range.startRow, o + this._range.startColumn);
|
|
4800
|
-
return a ?
|
|
4884
|
+
return a ? qe.create(a) : null;
|
|
4801
4885
|
}));
|
|
4802
4886
|
}
|
|
4803
4887
|
getValue(e) {
|
|
@@ -4857,11 +4941,11 @@ let f = (K = class extends Ae {
|
|
|
4857
4941
|
if (e)
|
|
4858
4942
|
return this.getValueAndRichTextValues();
|
|
4859
4943
|
const { startRow: t, endRow: s, startColumn: r, endColumn: i } = this._range, o = [];
|
|
4860
|
-
for (let
|
|
4861
|
-
const
|
|
4862
|
-
for (let
|
|
4863
|
-
|
|
4864
|
-
o.push(
|
|
4944
|
+
for (let d = t; d <= s; d++) {
|
|
4945
|
+
const c = [];
|
|
4946
|
+
for (let m = r; m <= i; m++)
|
|
4947
|
+
c.push((h = (a = this._worksheet.getCell(d, m)) == null ? void 0 : a.v) != null ? h : null);
|
|
4948
|
+
o.push(c);
|
|
4865
4949
|
}
|
|
4866
4950
|
return o;
|
|
4867
4951
|
}
|
|
@@ -4910,13 +4994,13 @@ let f = (K = class extends Ae {
|
|
|
4910
4994
|
getRawValues() {
|
|
4911
4995
|
var a, h;
|
|
4912
4996
|
const e = this._worksheet.getCellMatrix(), { startRow: t, endRow: s, startColumn: r, endColumn: i } = this._range, o = [];
|
|
4913
|
-
for (let
|
|
4914
|
-
const
|
|
4915
|
-
for (let
|
|
4916
|
-
const
|
|
4917
|
-
|
|
4997
|
+
for (let d = t; d <= s; d++) {
|
|
4998
|
+
const c = [];
|
|
4999
|
+
for (let m = r; m <= i; m++) {
|
|
5000
|
+
const g = e.getValue(d, m);
|
|
5001
|
+
g != null && g.p && ((a = g.p.body) != null && a.dataStream) ? c.push(g.p.body.dataStream) : c.push((h = g == null ? void 0 : g.v) != null ? h : null);
|
|
4918
5002
|
}
|
|
4919
|
-
o.push(
|
|
5003
|
+
o.push(c);
|
|
4920
5004
|
}
|
|
4921
5005
|
return o;
|
|
4922
5006
|
}
|
|
@@ -4965,13 +5049,13 @@ let f = (K = class extends Ae {
|
|
|
4965
5049
|
getDisplayValues() {
|
|
4966
5050
|
var o, a, h;
|
|
4967
5051
|
const { startRow: e, endRow: t, startColumn: s, endColumn: r } = this._range, i = [];
|
|
4968
|
-
for (let
|
|
4969
|
-
const
|
|
4970
|
-
for (let
|
|
4971
|
-
const
|
|
4972
|
-
|
|
5052
|
+
for (let d = e; d <= t; d++) {
|
|
5053
|
+
const c = [];
|
|
5054
|
+
for (let m = s; m <= r; m++) {
|
|
5055
|
+
const g = this._worksheet.getCell(d, m);
|
|
5056
|
+
g != null && g.p && ((o = g.p.body) != null && o.dataStream) ? c.push(g.p.body.dataStream) : c.push((h = (a = g == null ? void 0 : g.v) == null ? void 0 : a.toString()) != null ? h : "");
|
|
4973
5057
|
}
|
|
4974
|
-
i.push(
|
|
5058
|
+
i.push(c);
|
|
4975
5059
|
}
|
|
4976
5060
|
return i;
|
|
4977
5061
|
}
|
|
@@ -5040,7 +5124,7 @@ let f = (K = class extends Ae {
|
|
|
5040
5124
|
*/
|
|
5041
5125
|
getRichTextValue() {
|
|
5042
5126
|
const e = this.getCellData();
|
|
5043
|
-
return e != null && e.p ? new
|
|
5127
|
+
return e != null && e.p ? new L(e.p) : null;
|
|
5044
5128
|
}
|
|
5045
5129
|
/**
|
|
5046
5130
|
* Returns the rich text value for the cells in the range.
|
|
@@ -5056,7 +5140,7 @@ let f = (K = class extends Ae {
|
|
|
5056
5140
|
* ```
|
|
5057
5141
|
*/
|
|
5058
5142
|
getRichTextValues() {
|
|
5059
|
-
return this.getCellDataGrid().map((t) => t.map((s) => s != null && s.p ? new
|
|
5143
|
+
return this.getCellDataGrid().map((t) => t.map((s) => s != null && s.p ? new L(s.p) : null));
|
|
5060
5144
|
}
|
|
5061
5145
|
/**
|
|
5062
5146
|
* Returns the value and rich text value for the cell at the start of this range.
|
|
@@ -5073,7 +5157,7 @@ let f = (K = class extends Ae {
|
|
|
5073
5157
|
*/
|
|
5074
5158
|
getValueAndRichTextValue() {
|
|
5075
5159
|
const e = this.getCellData();
|
|
5076
|
-
return e != null && e.p ? new
|
|
5160
|
+
return e != null && e.p ? new L(e.p) : e == null ? void 0 : e.v;
|
|
5077
5161
|
}
|
|
5078
5162
|
/**
|
|
5079
5163
|
* Returns the value and rich text value for the cells in the range.
|
|
@@ -5087,7 +5171,7 @@ let f = (K = class extends Ae {
|
|
|
5087
5171
|
* ```
|
|
5088
5172
|
*/
|
|
5089
5173
|
getValueAndRichTextValues() {
|
|
5090
|
-
return this.getCellDatas().map((t) => t.map((s) => s != null && s.p ? new
|
|
5174
|
+
return this.getCellDatas().map((t) => t.map((s) => s != null && s.p ? new L(s.p) : s == null ? void 0 : s.v));
|
|
5091
5175
|
}
|
|
5092
5176
|
/**
|
|
5093
5177
|
* Returns the formula (A1 notation) of the top-left cell in the range, or an empty string if the cell is empty or doesn't contain a formula.
|
|
@@ -5123,12 +5207,12 @@ let f = (K = class extends Ae {
|
|
|
5123
5207
|
getFormulas() {
|
|
5124
5208
|
const e = [], { startRow: t, endRow: s, startColumn: r, endColumn: i } = this._range, o = this._worksheet.getSheetId(), a = this._workbook.getUnitId();
|
|
5125
5209
|
for (let h = t; h <= s; h++) {
|
|
5126
|
-
const
|
|
5127
|
-
for (let
|
|
5128
|
-
const
|
|
5129
|
-
|
|
5210
|
+
const d = [];
|
|
5211
|
+
for (let c = r; c <= i; c++) {
|
|
5212
|
+
const m = this._formulaDataModel.getFormulaStringByCell(h, c, o, a);
|
|
5213
|
+
d.push(m || "");
|
|
5130
5214
|
}
|
|
5131
|
-
e.push(
|
|
5215
|
+
e.push(d);
|
|
5132
5216
|
}
|
|
5133
5217
|
return e;
|
|
5134
5218
|
}
|
|
@@ -5144,7 +5228,7 @@ let f = (K = class extends Ae {
|
|
|
5144
5228
|
* ```
|
|
5145
5229
|
*/
|
|
5146
5230
|
getWrap() {
|
|
5147
|
-
return this._worksheet.getRange(this._range).getWrap() ===
|
|
5231
|
+
return this._worksheet.getRange(this._range).getWrap() === I.TRUE;
|
|
5148
5232
|
}
|
|
5149
5233
|
/**
|
|
5150
5234
|
* Gets whether text wrapping is enabled for cells in the range.
|
|
@@ -5160,7 +5244,7 @@ let f = (K = class extends Ae {
|
|
|
5160
5244
|
const e = this.getCellDatas(), t = this._workbook.getStyles();
|
|
5161
5245
|
return e.map((s) => s.map((r) => {
|
|
5162
5246
|
var i;
|
|
5163
|
-
return ((i = t.getStyleByCell(r)) == null ? void 0 : i.tb) ===
|
|
5247
|
+
return ((i = t.getStyleByCell(r)) == null ? void 0 : i.tb) === ue.WRAP;
|
|
5164
5248
|
}));
|
|
5165
5249
|
}
|
|
5166
5250
|
/**
|
|
@@ -5190,7 +5274,7 @@ let f = (K = class extends Ae {
|
|
|
5190
5274
|
*/
|
|
5191
5275
|
getHorizontalAlignment() {
|
|
5192
5276
|
const e = this._worksheet.getRange(this._range).getHorizontalAlignment();
|
|
5193
|
-
return
|
|
5277
|
+
return _t(e);
|
|
5194
5278
|
}
|
|
5195
5279
|
/**
|
|
5196
5280
|
* Returns the horizontal alignments of the cells in the range.
|
|
@@ -5204,7 +5288,7 @@ let f = (K = class extends Ae {
|
|
|
5204
5288
|
* ```
|
|
5205
5289
|
*/
|
|
5206
5290
|
getHorizontalAlignments() {
|
|
5207
|
-
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) => _t(s)));
|
|
5208
5292
|
}
|
|
5209
5293
|
/**
|
|
5210
5294
|
* Returns the vertical alignment (top/middle/bottom) of the top-left cell in the range.
|
|
@@ -5218,7 +5302,7 @@ let f = (K = class extends Ae {
|
|
|
5218
5302
|
* ```
|
|
5219
5303
|
*/
|
|
5220
5304
|
getVerticalAlignment() {
|
|
5221
|
-
return
|
|
5305
|
+
return wt(this._worksheet.getRange(this._range).getVerticalAlignment());
|
|
5222
5306
|
}
|
|
5223
5307
|
/**
|
|
5224
5308
|
* Returns the vertical alignments of the cells in the range.
|
|
@@ -5232,7 +5316,7 @@ let f = (K = class extends Ae {
|
|
|
5232
5316
|
* ```
|
|
5233
5317
|
*/
|
|
5234
5318
|
getVerticalAlignments() {
|
|
5235
|
-
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) => wt(s)));
|
|
5236
5320
|
}
|
|
5237
5321
|
/**
|
|
5238
5322
|
* Set custom meta data for first cell in current range.
|
|
@@ -5317,7 +5401,7 @@ let f = (K = class extends Ae {
|
|
|
5317
5401
|
* ```
|
|
5318
5402
|
*/
|
|
5319
5403
|
setBorder(e, t, s) {
|
|
5320
|
-
return this._commandService.syncExecuteCommand(
|
|
5404
|
+
return this._commandService.syncExecuteCommand(en.id, {
|
|
5321
5405
|
unitId: this._workbook.getUnitId(),
|
|
5322
5406
|
subUnitId: this._worksheet.getSheetId(),
|
|
5323
5407
|
ranges: [this._range],
|
|
@@ -5343,7 +5427,7 @@ let f = (K = class extends Ae {
|
|
|
5343
5427
|
getBackground() {
|
|
5344
5428
|
var t, s;
|
|
5345
5429
|
const e = this.getCellStyle();
|
|
5346
|
-
return (s = (t = e == null ? void 0 : e.background) == null ? void 0 : t.rgb) != null ? s :
|
|
5430
|
+
return (s = (t = e == null ? void 0 : e.background) == null ? void 0 : t.rgb) != null ? s : Ye.bg.rgb;
|
|
5347
5431
|
}
|
|
5348
5432
|
/**
|
|
5349
5433
|
* Returns the background colors of the cells in the range.
|
|
@@ -5359,7 +5443,7 @@ let f = (K = class extends Ae {
|
|
|
5359
5443
|
getBackgrounds() {
|
|
5360
5444
|
return this.getCellStyles().map((t) => t.map((s) => {
|
|
5361
5445
|
var r, i;
|
|
5362
|
-
return (i = (r = s == null ? void 0 : s.background) == null ? void 0 : r.rgb) != null ? i :
|
|
5446
|
+
return (i = (r = s == null ? void 0 : s.background) == null ? void 0 : r.rgb) != null ? i : Ye.bg.rgb;
|
|
5363
5447
|
}));
|
|
5364
5448
|
}
|
|
5365
5449
|
/**
|
|
@@ -5375,7 +5459,7 @@ let f = (K = class extends Ae {
|
|
|
5375
5459
|
* ```
|
|
5376
5460
|
*/
|
|
5377
5461
|
setBackgroundColor(e) {
|
|
5378
|
-
return this._commandService.syncExecuteCommand(
|
|
5462
|
+
return this._commandService.syncExecuteCommand(T.id, {
|
|
5379
5463
|
unitId: this._workbook.getUnitId(),
|
|
5380
5464
|
subUnitId: this._worksheet.getSheetId(),
|
|
5381
5465
|
range: this._range,
|
|
@@ -5415,7 +5499,7 @@ let f = (K = class extends Ae {
|
|
|
5415
5499
|
* ```
|
|
5416
5500
|
*/
|
|
5417
5501
|
setTextRotation(e) {
|
|
5418
|
-
return this._commandService.syncExecuteCommand(
|
|
5502
|
+
return this._commandService.syncExecuteCommand(tn.id, {
|
|
5419
5503
|
unitId: this._workbook.getUnitId(),
|
|
5420
5504
|
subUnitId: this._worksheet.getSheetId(),
|
|
5421
5505
|
range: this._range,
|
|
@@ -5437,10 +5521,10 @@ let f = (K = class extends Ae {
|
|
|
5437
5521
|
* ```
|
|
5438
5522
|
*/
|
|
5439
5523
|
setValue(e) {
|
|
5440
|
-
const t =
|
|
5524
|
+
const t = xe(e);
|
|
5441
5525
|
if (!t)
|
|
5442
5526
|
throw new Error("Invalid value");
|
|
5443
|
-
return this._commandService.syncExecuteCommand(
|
|
5527
|
+
return this._commandService.syncExecuteCommand(X.id, {
|
|
5444
5528
|
unitId: this._workbook.getUnitId(),
|
|
5445
5529
|
subUnitId: this._worksheet.getSheetId(),
|
|
5446
5530
|
range: this._range,
|
|
@@ -5462,10 +5546,10 @@ let f = (K = class extends Ae {
|
|
|
5462
5546
|
* ```
|
|
5463
5547
|
*/
|
|
5464
5548
|
setValueForCell(e) {
|
|
5465
|
-
const t =
|
|
5549
|
+
const t = xe(e);
|
|
5466
5550
|
if (!t)
|
|
5467
5551
|
throw new Error("Invalid value");
|
|
5468
|
-
return this._commandService.syncExecuteCommand(
|
|
5552
|
+
return this._commandService.syncExecuteCommand(X.id, {
|
|
5469
5553
|
unitId: this._workbook.getUnitId(),
|
|
5470
5554
|
subUnitId: this._worksheet.getSheetId(),
|
|
5471
5555
|
range: {
|
|
@@ -5498,7 +5582,7 @@ let f = (K = class extends Ae {
|
|
|
5498
5582
|
* ```
|
|
5499
5583
|
*/
|
|
5500
5584
|
setRichTextValueForCell(e) {
|
|
5501
|
-
const t = e instanceof
|
|
5585
|
+
const t = e instanceof L ? e.getData() : e, s = {
|
|
5502
5586
|
unitId: this._workbook.getUnitId(),
|
|
5503
5587
|
subUnitId: this._worksheet.getSheetId(),
|
|
5504
5588
|
range: {
|
|
@@ -5509,7 +5593,7 @@ let f = (K = class extends Ae {
|
|
|
5509
5593
|
},
|
|
5510
5594
|
value: { p: t }
|
|
5511
5595
|
};
|
|
5512
|
-
return this._commandService.syncExecuteCommand(
|
|
5596
|
+
return this._commandService.syncExecuteCommand(X.id, s), this;
|
|
5513
5597
|
}
|
|
5514
5598
|
/**
|
|
5515
5599
|
* Set the rich text value for the cells in the range.
|
|
@@ -5535,13 +5619,13 @@ let f = (K = class extends Ae {
|
|
|
5535
5619
|
* ```
|
|
5536
5620
|
*/
|
|
5537
5621
|
setRichTextValues(e) {
|
|
5538
|
-
const t = e.map((i) => i.map((o) => o && { p: o instanceof
|
|
5622
|
+
const t = e.map((i) => i.map((o) => o && { p: o instanceof L ? o.getData() : o })), s = Ze(t, this._range), r = {
|
|
5539
5623
|
unitId: this._workbook.getUnitId(),
|
|
5540
5624
|
subUnitId: this._worksheet.getSheetId(),
|
|
5541
5625
|
range: this._range,
|
|
5542
5626
|
value: s
|
|
5543
5627
|
};
|
|
5544
|
-
return this._commandService.syncExecuteCommand(
|
|
5628
|
+
return this._commandService.syncExecuteCommand(X.id, r), this;
|
|
5545
5629
|
}
|
|
5546
5630
|
/**
|
|
5547
5631
|
* Set the cell wrap of the given range.
|
|
@@ -5558,11 +5642,11 @@ let f = (K = class extends Ae {
|
|
|
5558
5642
|
* ```
|
|
5559
5643
|
*/
|
|
5560
5644
|
setWrap(e) {
|
|
5561
|
-
return this._commandService.syncExecuteCommand(
|
|
5645
|
+
return this._commandService.syncExecuteCommand(We.id, {
|
|
5562
5646
|
unitId: this._workbook.getUnitId(),
|
|
5563
5647
|
subUnitId: this._worksheet.getSheetId(),
|
|
5564
5648
|
range: this._range,
|
|
5565
|
-
value: e ?
|
|
5649
|
+
value: e ? ue.WRAP : ue.UNSPECIFIED
|
|
5566
5650
|
}), this;
|
|
5567
5651
|
}
|
|
5568
5652
|
/**
|
|
@@ -5579,7 +5663,7 @@ let f = (K = class extends Ae {
|
|
|
5579
5663
|
* ```
|
|
5580
5664
|
*/
|
|
5581
5665
|
setWrapStrategy(e) {
|
|
5582
|
-
return this._commandService.syncExecuteCommand(
|
|
5666
|
+
return this._commandService.syncExecuteCommand(We.id, {
|
|
5583
5667
|
unitId: this._workbook.getUnitId(),
|
|
5584
5668
|
subUnitId: this._worksheet.getSheetId(),
|
|
5585
5669
|
range: this._range,
|
|
@@ -5599,11 +5683,11 @@ let f = (K = class extends Ae {
|
|
|
5599
5683
|
* ```
|
|
5600
5684
|
*/
|
|
5601
5685
|
setVerticalAlignment(e) {
|
|
5602
|
-
return this._commandService.syncExecuteCommand(
|
|
5686
|
+
return this._commandService.syncExecuteCommand(sn.id, {
|
|
5603
5687
|
unitId: this._workbook.getUnitId(),
|
|
5604
5688
|
subUnitId: this._worksheet.getSheetId(),
|
|
5605
5689
|
range: this._range,
|
|
5606
|
-
value:
|
|
5690
|
+
value: Hn(e)
|
|
5607
5691
|
}), this;
|
|
5608
5692
|
}
|
|
5609
5693
|
/**
|
|
@@ -5619,11 +5703,11 @@ let f = (K = class extends Ae {
|
|
|
5619
5703
|
* ```
|
|
5620
5704
|
*/
|
|
5621
5705
|
setHorizontalAlignment(e) {
|
|
5622
|
-
return this._commandService.syncExecuteCommand(
|
|
5706
|
+
return this._commandService.syncExecuteCommand(nn.id, {
|
|
5623
5707
|
unitId: this._workbook.getUnitId(),
|
|
5624
5708
|
subUnitId: this._worksheet.getSheetId(),
|
|
5625
5709
|
range: this._range,
|
|
5626
|
-
value:
|
|
5710
|
+
value: Fn(e)
|
|
5627
5711
|
}), this;
|
|
5628
5712
|
}
|
|
5629
5713
|
/**
|
|
@@ -5642,8 +5726,8 @@ let f = (K = class extends Ae {
|
|
|
5642
5726
|
* ```
|
|
5643
5727
|
*/
|
|
5644
5728
|
setValues(e) {
|
|
5645
|
-
const t =
|
|
5646
|
-
return this._commandService.syncExecuteCommand(
|
|
5729
|
+
const t = Ze(e, this._range);
|
|
5730
|
+
return this._commandService.syncExecuteCommand(X.id, {
|
|
5647
5731
|
unitId: this._workbook.getUnitId(),
|
|
5648
5732
|
subUnitId: this._worksheet.getSheetId(),
|
|
5649
5733
|
range: this._range,
|
|
@@ -5665,9 +5749,9 @@ let f = (K = class extends Ae {
|
|
|
5665
5749
|
setFontWeight(e) {
|
|
5666
5750
|
let t;
|
|
5667
5751
|
if (e === "bold")
|
|
5668
|
-
t =
|
|
5752
|
+
t = I.TRUE;
|
|
5669
5753
|
else if (e === "normal")
|
|
5670
|
-
t =
|
|
5754
|
+
t = I.FALSE;
|
|
5671
5755
|
else if (e === null)
|
|
5672
5756
|
t = null;
|
|
5673
5757
|
else
|
|
@@ -5681,7 +5765,7 @@ let f = (K = class extends Ae {
|
|
|
5681
5765
|
range: this._range,
|
|
5682
5766
|
style: s
|
|
5683
5767
|
};
|
|
5684
|
-
return this._commandService.syncExecuteCommand(
|
|
5768
|
+
return this._commandService.syncExecuteCommand(T.id, r), this;
|
|
5685
5769
|
}
|
|
5686
5770
|
/**
|
|
5687
5771
|
* Sets the font style for the given range ('italic' or 'normal').
|
|
@@ -5698,9 +5782,9 @@ let f = (K = class extends Ae {
|
|
|
5698
5782
|
setFontStyle(e) {
|
|
5699
5783
|
let t;
|
|
5700
5784
|
if (e === "italic")
|
|
5701
|
-
t =
|
|
5785
|
+
t = I.TRUE;
|
|
5702
5786
|
else if (e === "normal")
|
|
5703
|
-
t =
|
|
5787
|
+
t = I.FALSE;
|
|
5704
5788
|
else if (e === null)
|
|
5705
5789
|
t = null;
|
|
5706
5790
|
else
|
|
@@ -5714,7 +5798,7 @@ let f = (K = class extends Ae {
|
|
|
5714
5798
|
range: this._range,
|
|
5715
5799
|
style: s
|
|
5716
5800
|
};
|
|
5717
|
-
return this._commandService.syncExecuteCommand(
|
|
5801
|
+
return this._commandService.syncExecuteCommand(T.id, r), this;
|
|
5718
5802
|
}
|
|
5719
5803
|
/**
|
|
5720
5804
|
* Sets the font line style of the given range ('underline', 'line-through', or 'none').
|
|
@@ -5731,17 +5815,17 @@ let f = (K = class extends Ae {
|
|
|
5731
5815
|
setFontLine(e) {
|
|
5732
5816
|
if (e === "underline")
|
|
5733
5817
|
this._setFontUnderline({
|
|
5734
|
-
s:
|
|
5818
|
+
s: I.TRUE
|
|
5735
5819
|
});
|
|
5736
5820
|
else if (e === "line-through")
|
|
5737
5821
|
this._setFontStrikethrough({
|
|
5738
|
-
s:
|
|
5822
|
+
s: I.TRUE
|
|
5739
5823
|
});
|
|
5740
5824
|
else if (e === "none")
|
|
5741
5825
|
this._setFontUnderline({
|
|
5742
|
-
s:
|
|
5826
|
+
s: I.FALSE
|
|
5743
5827
|
}), this._setFontStrikethrough({
|
|
5744
|
-
s:
|
|
5828
|
+
s: I.FALSE
|
|
5745
5829
|
});
|
|
5746
5830
|
else if (e === null)
|
|
5747
5831
|
this._setFontUnderline(null), this._setFontStrikethrough(null);
|
|
@@ -5764,7 +5848,7 @@ let f = (K = class extends Ae {
|
|
|
5764
5848
|
range: this._range,
|
|
5765
5849
|
style: t
|
|
5766
5850
|
};
|
|
5767
|
-
this._commandService.syncExecuteCommand(
|
|
5851
|
+
this._commandService.syncExecuteCommand(T.id, s);
|
|
5768
5852
|
}
|
|
5769
5853
|
/**
|
|
5770
5854
|
* Sets the font strikethrough style of the given ITextDecoration
|
|
@@ -5781,7 +5865,7 @@ let f = (K = class extends Ae {
|
|
|
5781
5865
|
range: this._range,
|
|
5782
5866
|
style: t
|
|
5783
5867
|
};
|
|
5784
|
-
this._commandService.syncExecuteCommand(
|
|
5868
|
+
this._commandService.syncExecuteCommand(T.id, s);
|
|
5785
5869
|
}
|
|
5786
5870
|
/**
|
|
5787
5871
|
* Sets the font family, such as "Arial" or "Helvetica".
|
|
@@ -5805,7 +5889,7 @@ let f = (K = class extends Ae {
|
|
|
5805
5889
|
range: this._range,
|
|
5806
5890
|
style: t
|
|
5807
5891
|
};
|
|
5808
|
-
return this._commandService.syncExecuteCommand(
|
|
5892
|
+
return this._commandService.syncExecuteCommand(T.id, s), this;
|
|
5809
5893
|
}
|
|
5810
5894
|
/**
|
|
5811
5895
|
* Sets the font size, with the size being the point size to use.
|
|
@@ -5829,7 +5913,7 @@ let f = (K = class extends Ae {
|
|
|
5829
5913
|
range: this._range,
|
|
5830
5914
|
style: t
|
|
5831
5915
|
};
|
|
5832
|
-
return this._commandService.syncExecuteCommand(
|
|
5916
|
+
return this._commandService.syncExecuteCommand(T.id, s), this;
|
|
5833
5917
|
}
|
|
5834
5918
|
/**
|
|
5835
5919
|
* Sets the font color in CSS notation (such as '#ffffff' or 'white').
|
|
@@ -5853,7 +5937,7 @@ let f = (K = class extends Ae {
|
|
|
5853
5937
|
range: this._range,
|
|
5854
5938
|
style: s
|
|
5855
5939
|
};
|
|
5856
|
-
return this._commandService.syncExecuteCommand(
|
|
5940
|
+
return this._commandService.syncExecuteCommand(T.id, r), this;
|
|
5857
5941
|
}
|
|
5858
5942
|
// #endregion editing
|
|
5859
5943
|
//#region Merge cell
|
|
@@ -5872,7 +5956,7 @@ let f = (K = class extends Ae {
|
|
|
5872
5956
|
*/
|
|
5873
5957
|
merge(e = !0) {
|
|
5874
5958
|
const t = this._workbook.getUnitId(), s = this._worksheet.getSheetId();
|
|
5875
|
-
return
|
|
5959
|
+
return Re(this._injector, t, s, [this._range], e), this;
|
|
5876
5960
|
}
|
|
5877
5961
|
/**
|
|
5878
5962
|
* Merges cells in a range horizontally.
|
|
@@ -5893,8 +5977,8 @@ let f = (K = class extends Ae {
|
|
|
5893
5977
|
* ```
|
|
5894
5978
|
*/
|
|
5895
5979
|
mergeAcross(e = !0) {
|
|
5896
|
-
const t =
|
|
5897
|
-
return
|
|
5980
|
+
const t = ut([this._range], G.ROWS), s = this._workbook.getUnitId(), r = this._worksheet.getSheetId();
|
|
5981
|
+
return Re(this._injector, s, r, t, e), this;
|
|
5898
5982
|
}
|
|
5899
5983
|
/**
|
|
5900
5984
|
* Merges cells in a range vertically.
|
|
@@ -5915,8 +5999,8 @@ let f = (K = class extends Ae {
|
|
|
5915
5999
|
* ```
|
|
5916
6000
|
*/
|
|
5917
6001
|
mergeVertically(e = !0) {
|
|
5918
|
-
const t =
|
|
5919
|
-
return
|
|
6002
|
+
const t = ut([this._range], G.COLUMNS), s = this._workbook.getUnitId(), r = this._worksheet.getSheetId();
|
|
6003
|
+
return Re(this._injector, s, r, t, e), this;
|
|
5920
6004
|
}
|
|
5921
6005
|
/**
|
|
5922
6006
|
* Returns true if cells in the current range overlap a merged cell.
|
|
@@ -5951,7 +6035,7 @@ let f = (K = class extends Ae {
|
|
|
5951
6035
|
* ```
|
|
5952
6036
|
*/
|
|
5953
6037
|
breakApart() {
|
|
5954
|
-
return this._commandService.syncExecuteCommand(
|
|
6038
|
+
return this._commandService.syncExecuteCommand(rn.id, { ranges: [this._range] }), this;
|
|
5955
6039
|
}
|
|
5956
6040
|
//#endregion
|
|
5957
6041
|
/**
|
|
@@ -6013,7 +6097,7 @@ let f = (K = class extends Ae {
|
|
|
6013
6097
|
startAbsoluteRefType: t,
|
|
6014
6098
|
endAbsoluteRefType: s
|
|
6015
6099
|
};
|
|
6016
|
-
return e ?
|
|
6100
|
+
return e ? yn(this._worksheet.getName(), r) : Ke(r);
|
|
6017
6101
|
}
|
|
6018
6102
|
/**
|
|
6019
6103
|
* Sets the specified range as the active range, with the top left cell in the range as the current cell.
|
|
@@ -6027,7 +6111,7 @@ let f = (K = class extends Ae {
|
|
|
6027
6111
|
* ```
|
|
6028
6112
|
*/
|
|
6029
6113
|
activate() {
|
|
6030
|
-
return this._injector.createInstance(
|
|
6114
|
+
return this._injector.createInstance(P, this._workbook).setActiveRange(this), this;
|
|
6031
6115
|
}
|
|
6032
6116
|
/**
|
|
6033
6117
|
* Sets the specified cell as the current cell.
|
|
@@ -6063,23 +6147,23 @@ let f = (K = class extends Ae {
|
|
|
6063
6147
|
*/
|
|
6064
6148
|
activateAsCurrentCell() {
|
|
6065
6149
|
const e = this._worksheet.getMergedCell(this._range.startRow, this._range.startColumn);
|
|
6066
|
-
if (e &&
|
|
6067
|
-
const r = this._injector.createInstance(
|
|
6150
|
+
if (e && $.equals(e, this._range) || !e && this._range.startRow === this._range.endRow && this._range.startColumn === this._range.endColumn) {
|
|
6151
|
+
const r = this._injector.createInstance(P, this._workbook).getActiveRange();
|
|
6068
6152
|
if (!r || r.getUnitId() !== this.getUnitId() || r.getSheetId() !== this.getSheetId())
|
|
6069
6153
|
return this.activate();
|
|
6070
|
-
if (
|
|
6154
|
+
if ($.contains(r.getRange(), this._range)) {
|
|
6071
6155
|
const i = {
|
|
6072
6156
|
unitId: this.getUnitId(),
|
|
6073
6157
|
subUnitId: this.getSheetId(),
|
|
6074
6158
|
selections: [
|
|
6075
6159
|
{
|
|
6076
6160
|
range: r.getRange(),
|
|
6077
|
-
primary:
|
|
6161
|
+
primary: le(this.getRange(), this._worksheet),
|
|
6078
6162
|
style: null
|
|
6079
6163
|
}
|
|
6080
6164
|
]
|
|
6081
6165
|
};
|
|
6082
|
-
return this._commandService.syncExecuteCommand(
|
|
6166
|
+
return this._commandService.syncExecuteCommand(Ge.id, i), this;
|
|
6083
6167
|
}
|
|
6084
6168
|
return this.activate();
|
|
6085
6169
|
} else
|
|
@@ -6120,7 +6204,7 @@ let f = (K = class extends Ae {
|
|
|
6120
6204
|
* ```
|
|
6121
6205
|
*/
|
|
6122
6206
|
splitTextToColumns(e, t, s) {
|
|
6123
|
-
this._commandService.syncExecuteCommand(
|
|
6207
|
+
this._commandService.syncExecuteCommand(on.id, {
|
|
6124
6208
|
unitId: this._workbook.getUnitId(),
|
|
6125
6209
|
subUnitId: this._worksheet.getSheetId(),
|
|
6126
6210
|
range: this._range,
|
|
@@ -6145,7 +6229,7 @@ let f = (K = class extends Ae {
|
|
|
6145
6229
|
const t = this.getUsedThemeStyle();
|
|
6146
6230
|
t && this.removeThemeStyle(t);
|
|
6147
6231
|
} else
|
|
6148
|
-
this._commandService.syncExecuteCommand(
|
|
6232
|
+
this._commandService.syncExecuteCommand(an.id, {
|
|
6149
6233
|
unitId: this._workbook.getUnitId(),
|
|
6150
6234
|
subUnitId: this._worksheet.getSheetId(),
|
|
6151
6235
|
range: this._range,
|
|
@@ -6164,7 +6248,7 @@ let f = (K = class extends Ae {
|
|
|
6164
6248
|
* ```
|
|
6165
6249
|
*/
|
|
6166
6250
|
removeThemeStyle(e) {
|
|
6167
|
-
this._commandService.syncExecuteCommand(
|
|
6251
|
+
this._commandService.syncExecuteCommand(hn.id, {
|
|
6168
6252
|
unitId: this._workbook.getUnitId(),
|
|
6169
6253
|
subUnitId: this._worksheet.getSheetId(),
|
|
6170
6254
|
range: this._range,
|
|
@@ -6185,7 +6269,7 @@ let f = (K = class extends Ae {
|
|
|
6185
6269
|
* ```
|
|
6186
6270
|
*/
|
|
6187
6271
|
getUsedThemeStyle() {
|
|
6188
|
-
return this._injector.get(
|
|
6272
|
+
return this._injector.get(Mt).getAppliedRangeThemeStyle({
|
|
6189
6273
|
unitId: this._workbook.getUnitId(),
|
|
6190
6274
|
subUnitId: this._worksheet.getSheetId(),
|
|
6191
6275
|
range: this._range
|
|
@@ -6211,7 +6295,7 @@ let f = (K = class extends Ae {
|
|
|
6211
6295
|
* ```
|
|
6212
6296
|
*/
|
|
6213
6297
|
clear(e) {
|
|
6214
|
-
return e && e.contentsOnly && !e.formatOnly ? this.clearContent() : e && e.formatOnly && !e.contentsOnly ? this.clearFormat() : (this._commandService.syncExecuteCommand(
|
|
6298
|
+
return e && e.contentsOnly && !e.formatOnly ? this.clearContent() : e && e.formatOnly && !e.contentsOnly ? this.clearFormat() : (this._commandService.syncExecuteCommand(Ut.id, {
|
|
6215
6299
|
unitId: this._workbook.getUnitId(),
|
|
6216
6300
|
subUnitId: this._worksheet.getSheetId(),
|
|
6217
6301
|
ranges: [this._range],
|
|
@@ -6232,7 +6316,7 @@ let f = (K = class extends Ae {
|
|
|
6232
6316
|
* ```
|
|
6233
6317
|
*/
|
|
6234
6318
|
clearContent() {
|
|
6235
|
-
return this._commandService.syncExecuteCommand(
|
|
6319
|
+
return this._commandService.syncExecuteCommand(xt.id, {
|
|
6236
6320
|
unitId: this._workbook.getUnitId(),
|
|
6237
6321
|
subUnitId: this._worksheet.getSheetId(),
|
|
6238
6322
|
ranges: [this._range]
|
|
@@ -6251,7 +6335,7 @@ let f = (K = class extends Ae {
|
|
|
6251
6335
|
* ```
|
|
6252
6336
|
*/
|
|
6253
6337
|
clearFormat() {
|
|
6254
|
-
return this._commandService.syncExecuteCommand(
|
|
6338
|
+
return this._commandService.syncExecuteCommand(Dt.id, {
|
|
6255
6339
|
unitId: this._workbook.getUnitId(),
|
|
6256
6340
|
subUnitId: this._worksheet.getSheetId(),
|
|
6257
6341
|
ranges: [this._range]
|
|
@@ -6313,9 +6397,9 @@ let f = (K = class extends Ae {
|
|
|
6313
6397
|
* ```
|
|
6314
6398
|
*/
|
|
6315
6399
|
insertCells(e) {
|
|
6316
|
-
e ===
|
|
6400
|
+
e === G.ROWS ? this._commandService.executeCommand(cn.id, {
|
|
6317
6401
|
range: this._range
|
|
6318
|
-
}) : this._commandService.executeCommand(
|
|
6402
|
+
}) : this._commandService.executeCommand(dn.id, {
|
|
6319
6403
|
range: this._range
|
|
6320
6404
|
});
|
|
6321
6405
|
}
|
|
@@ -6375,9 +6459,9 @@ let f = (K = class extends Ae {
|
|
|
6375
6459
|
* ```
|
|
6376
6460
|
*/
|
|
6377
6461
|
deleteCells(e) {
|
|
6378
|
-
e ===
|
|
6462
|
+
e === G.ROWS ? this._commandService.executeCommand(un.id, {
|
|
6379
6463
|
range: this._range
|
|
6380
|
-
}) : this._commandService.executeCommand(
|
|
6464
|
+
}) : this._commandService.executeCommand(ln.id, {
|
|
6381
6465
|
range: this._range
|
|
6382
6466
|
});
|
|
6383
6467
|
}
|
|
@@ -6420,24 +6504,24 @@ let f = (K = class extends Ae {
|
|
|
6420
6504
|
// eslint-disable-next-line complexity
|
|
6421
6505
|
getDataRegion(e) {
|
|
6422
6506
|
const { startRow: t, startColumn: s, endRow: r, endColumn: i } = this._range, o = this._worksheet.getMaxRows(), a = this._worksheet.getMaxColumns(), h = this._worksheet.getCellMatrix();
|
|
6423
|
-
let
|
|
6424
|
-
if (e !==
|
|
6425
|
-
let
|
|
6426
|
-
for (let
|
|
6507
|
+
let d = t, c = s, m = r, g = i;
|
|
6508
|
+
if (e !== G.COLUMNS) {
|
|
6509
|
+
let S = !1, k = !1;
|
|
6510
|
+
for (let f = s; f <= i && (t > 0 && !Q(h.getValue(t - 1, f)) && (S = !0), r < o - 1 && !Q(h.getValue(r + 1, f)) && (k = !0), !(S && k)); f++)
|
|
6427
6511
|
;
|
|
6428
|
-
|
|
6512
|
+
S && (d = t - 1), k && (m = r + 1);
|
|
6429
6513
|
}
|
|
6430
|
-
if (e !==
|
|
6431
|
-
let
|
|
6432
|
-
for (let
|
|
6514
|
+
if (e !== G.ROWS) {
|
|
6515
|
+
let S = !1, k = !1;
|
|
6516
|
+
for (let f = t; f <= r && (s > 0 && !Q(h.getValue(f, s - 1)) && (S = !0), i < a - 1 && !Q(h.getValue(f, i + 1)) && (k = !0), !(S && k)); f++)
|
|
6433
6517
|
;
|
|
6434
|
-
|
|
6518
|
+
S && (c = s - 1), k && (g = i + 1);
|
|
6435
6519
|
}
|
|
6436
|
-
return this._injector.createInstance(
|
|
6437
|
-
startRow:
|
|
6438
|
-
startColumn:
|
|
6439
|
-
endRow:
|
|
6440
|
-
endColumn:
|
|
6520
|
+
return this._injector.createInstance(R, this._workbook, this._worksheet, {
|
|
6521
|
+
startRow: d,
|
|
6522
|
+
startColumn: c,
|
|
6523
|
+
endRow: m,
|
|
6524
|
+
endColumn: g
|
|
6441
6525
|
});
|
|
6442
6526
|
}
|
|
6443
6527
|
/**
|
|
@@ -6461,7 +6545,7 @@ let f = (K = class extends Ae {
|
|
|
6461
6545
|
let o = !0;
|
|
6462
6546
|
for (let a = t; a <= r; a++) {
|
|
6463
6547
|
for (let h = s; h <= i; h++)
|
|
6464
|
-
if (!
|
|
6548
|
+
if (!Q(e.getValue(a, h))) {
|
|
6465
6549
|
o = !1;
|
|
6466
6550
|
break;
|
|
6467
6551
|
}
|
|
@@ -6490,14 +6574,14 @@ let f = (K = class extends Ae {
|
|
|
6490
6574
|
* ```
|
|
6491
6575
|
*/
|
|
6492
6576
|
offset(e, t, s, r) {
|
|
6493
|
-
const { startRow: i, startColumn: o, endRow: a, endColumn: h } = this._range,
|
|
6494
|
-
if (
|
|
6577
|
+
const { startRow: i, startColumn: o, endRow: a, endColumn: h } = this._range, d = i + e, c = o + t, m = s ? d + s - 1 : a + e, g = r ? c + r - 1 : h + t;
|
|
6578
|
+
if (d < 0 || c < 0 || m < 0 || g < 0)
|
|
6495
6579
|
throw new Error("The row or column index is out of range");
|
|
6496
|
-
return this._injector.createInstance(
|
|
6497
|
-
startRow:
|
|
6498
|
-
startColumn:
|
|
6499
|
-
endRow:
|
|
6500
|
-
endColumn:
|
|
6580
|
+
return this._injector.createInstance(R, this._workbook, this._worksheet, {
|
|
6581
|
+
startRow: d,
|
|
6582
|
+
startColumn: c,
|
|
6583
|
+
endRow: m,
|
|
6584
|
+
endColumn: g
|
|
6501
6585
|
});
|
|
6502
6586
|
}
|
|
6503
6587
|
/**
|
|
@@ -6566,50 +6650,50 @@ let f = (K = class extends Ae {
|
|
|
6566
6650
|
* ```
|
|
6567
6651
|
*/
|
|
6568
6652
|
getRangePermission() {
|
|
6569
|
-
const e = this._injector.createInstance(
|
|
6653
|
+
const e = this._injector.createInstance(v, this._injector.createInstance(P, this._workbook), this._workbook, this._worksheet);
|
|
6570
6654
|
return this._injector.createInstance(
|
|
6571
|
-
|
|
6655
|
+
Ae,
|
|
6572
6656
|
this._workbook.getUnitId(),
|
|
6573
6657
|
this._worksheet.getSheetId(),
|
|
6574
6658
|
this,
|
|
6575
6659
|
e
|
|
6576
6660
|
);
|
|
6577
6661
|
}
|
|
6578
|
-
},
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
],
|
|
6584
|
-
var
|
|
6585
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
6662
|
+
}, q._enableManualInit(), q);
|
|
6663
|
+
R = Jn([
|
|
6664
|
+
Ee(3, l(E)),
|
|
6665
|
+
Ee(4, C),
|
|
6666
|
+
Ee(5, l(Pn))
|
|
6667
|
+
], R);
|
|
6668
|
+
var qn = Object.getOwnPropertyDescriptor, Yn = (n, e, t, s) => {
|
|
6669
|
+
for (var r = s > 1 ? void 0 : s ? qn(e, t) : e, i = n.length - 1, o; i >= 0; i--)
|
|
6586
6670
|
(o = n[i]) && (r = o(r) || r);
|
|
6587
6671
|
return r;
|
|
6588
|
-
},
|
|
6589
|
-
let
|
|
6672
|
+
}, Ue = (n, e) => (t, s) => e(t, s, n);
|
|
6673
|
+
let Be = class {
|
|
6590
6674
|
constructor(n, e, t, s) {
|
|
6591
|
-
|
|
6675
|
+
w(this, "_permissionSubject");
|
|
6592
6676
|
// Collaborator changes are tracked manually since IAuthzIoService doesn't provide an observable
|
|
6593
6677
|
// TODO: If IAuthzIoService adds an observable in the future, migrate to use that
|
|
6594
|
-
|
|
6678
|
+
w(this, "_collaboratorChangeSubject", new En());
|
|
6595
6679
|
/**
|
|
6596
6680
|
* Observable stream of permission snapshot changes (BehaviorSubject)
|
|
6597
6681
|
* Emits immediately on subscription with current state, then on any permission point change
|
|
6598
6682
|
*/
|
|
6599
|
-
|
|
6683
|
+
w(this, "permission$");
|
|
6600
6684
|
/**
|
|
6601
6685
|
* Observable stream of individual permission point changes
|
|
6602
6686
|
* Emits when a specific permission point value changes
|
|
6603
6687
|
*/
|
|
6604
|
-
|
|
6688
|
+
w(this, "pointChange$");
|
|
6605
6689
|
/**
|
|
6606
6690
|
* Observable stream of collaborator changes
|
|
6607
6691
|
* Emits when collaborators are added, updated, or removed
|
|
6608
6692
|
*/
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
this._unitId = n, this._injector = e, this._permissionService = t, this._authzIoService = s, this._fPermission = this._injector.createInstance(
|
|
6693
|
+
w(this, "collaboratorChange$");
|
|
6694
|
+
w(this, "_subscriptions", []);
|
|
6695
|
+
w(this, "_fPermission");
|
|
6696
|
+
this._unitId = n, 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(
|
|
6613
6697
|
N({ bufferSize: 1, refCount: !0 })
|
|
6614
6698
|
);
|
|
6615
6699
|
}
|
|
@@ -6619,12 +6703,12 @@ let Te = class {
|
|
|
6619
6703
|
*/
|
|
6620
6704
|
_createPermissionStream() {
|
|
6621
6705
|
const n = this._permissionService.permissionPointUpdate$.pipe(
|
|
6622
|
-
|
|
6706
|
+
D((e) => e.id.includes(this._unitId))
|
|
6623
6707
|
).subscribe(() => {
|
|
6624
6708
|
this._permissionSubject.next(this._buildSnapshot());
|
|
6625
6709
|
});
|
|
6626
6710
|
return this._subscriptions.push(n), this._permissionSubject.asObservable().pipe(
|
|
6627
|
-
|
|
6711
|
+
_e((e, t) => JSON.stringify(e) === JSON.stringify(t)),
|
|
6628
6712
|
N({ bufferSize: 1, refCount: !0 })
|
|
6629
6713
|
);
|
|
6630
6714
|
}
|
|
@@ -6639,14 +6723,14 @@ let Te = class {
|
|
|
6639
6723
|
n.set(t, this.getPoint(t));
|
|
6640
6724
|
}
|
|
6641
6725
|
return this._permissionService.permissionPointUpdate$.pipe(
|
|
6642
|
-
|
|
6643
|
-
|
|
6726
|
+
D((e) => e.id.includes(this._unitId)),
|
|
6727
|
+
we((e) => {
|
|
6644
6728
|
const t = this._extractWorkbookPointType(e.id);
|
|
6645
6729
|
if (!t) return null;
|
|
6646
6730
|
const s = !!e.value, r = n.get(t);
|
|
6647
6731
|
return n.set(t, s), r === s ? null : { point: t, value: s, oldValue: r };
|
|
6648
6732
|
}),
|
|
6649
|
-
|
|
6733
|
+
D((e) => e !== null),
|
|
6650
6734
|
N({ bufferSize: 1, refCount: !0 })
|
|
6651
6735
|
);
|
|
6652
6736
|
}
|
|
@@ -6656,7 +6740,7 @@ let Te = class {
|
|
|
6656
6740
|
*/
|
|
6657
6741
|
_extractWorkbookPointType(n) {
|
|
6658
6742
|
for (const e in u) {
|
|
6659
|
-
const t = u[e], s =
|
|
6743
|
+
const t = u[e], s = he[t];
|
|
6660
6744
|
if (!s) continue;
|
|
6661
6745
|
if (new s(this._unitId).id === n)
|
|
6662
6746
|
return t;
|
|
@@ -6724,7 +6808,7 @@ let Te = class {
|
|
|
6724
6808
|
async _batchSetPermissionPoints(n) {
|
|
6725
6809
|
const e = [];
|
|
6726
6810
|
for (const [t, s] of Object.entries(n)) {
|
|
6727
|
-
const r = t, i =
|
|
6811
|
+
const r = t, i = he[r];
|
|
6728
6812
|
if (!i)
|
|
6729
6813
|
throw new Error(`Unknown workbook permission point: ${r}`);
|
|
6730
6814
|
const o = this.getPoint(r);
|
|
@@ -6789,7 +6873,7 @@ let Te = class {
|
|
|
6789
6873
|
* ```
|
|
6790
6874
|
*/
|
|
6791
6875
|
async setPoint(n, e) {
|
|
6792
|
-
const t =
|
|
6876
|
+
const t = he[n];
|
|
6793
6877
|
if (!t)
|
|
6794
6878
|
throw new Error(`Unknown workbook permission point: ${n}`);
|
|
6795
6879
|
if (this.getPoint(n) === e)
|
|
@@ -6812,7 +6896,7 @@ let Te = class {
|
|
|
6812
6896
|
*/
|
|
6813
6897
|
getPoint(n) {
|
|
6814
6898
|
var r;
|
|
6815
|
-
const e =
|
|
6899
|
+
const e = he[n];
|
|
6816
6900
|
if (!e)
|
|
6817
6901
|
throw new Error(`Unknown workbook permission point: ${n}`);
|
|
6818
6902
|
const t = new e(this._unitId), s = this._permissionService.getPermissionPoint(t.id);
|
|
@@ -6956,7 +7040,7 @@ let Te = class {
|
|
|
6956
7040
|
type: "delete",
|
|
6957
7041
|
collaborator: {
|
|
6958
7042
|
user: { id: n },
|
|
6959
|
-
role:
|
|
7043
|
+
role: H.Reader
|
|
6960
7044
|
// Placeholder value
|
|
6961
7045
|
}
|
|
6962
7046
|
});
|
|
@@ -7029,21 +7113,21 @@ let Te = class {
|
|
|
7029
7113
|
this._subscriptions.forEach((n) => n.unsubscribe()), this._permissionSubject.complete(), this._collaboratorChangeSubject.complete();
|
|
7030
7114
|
}
|
|
7031
7115
|
};
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
],
|
|
7037
|
-
var
|
|
7038
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
7116
|
+
Be = Yn([
|
|
7117
|
+
Ue(1, l(E)),
|
|
7118
|
+
Ue(2, Y),
|
|
7119
|
+
Ue(3, re)
|
|
7120
|
+
], Be);
|
|
7121
|
+
var Zn = Object.getOwnPropertyDescriptor, Qn = (n, e, t, s) => {
|
|
7122
|
+
for (var r = s > 1 ? void 0 : s ? Zn(e, t) : e, i = n.length - 1, o; i >= 0; i--)
|
|
7039
7123
|
(o = n[i]) && (r = o(r) || r);
|
|
7040
7124
|
return r;
|
|
7041
|
-
},
|
|
7042
|
-
let
|
|
7043
|
-
constructor(e, t, s, r, i, o, a, h,
|
|
7125
|
+
}, j = (n, e) => (t, s) => e(t, s, n);
|
|
7126
|
+
let P = class extends He {
|
|
7127
|
+
constructor(e, t, s, r, i, o, a, h, d, c) {
|
|
7044
7128
|
super(t);
|
|
7045
|
-
|
|
7046
|
-
this._workbook = e, this._injector = t, this._resourceLoaderService = s, this._selectionManagerService = r, this._univerInstanceService = i, this._commandService = o, this._permissionService = a, this._logService = h, this._localeService =
|
|
7129
|
+
w(this, "id");
|
|
7130
|
+
this._workbook = e, this._injector = t, this._resourceLoaderService = s, this._selectionManagerService = r, this._univerInstanceService = i, this._commandService = o, this._permissionService = a, this._logService = h, this._localeService = d, this._definedNamesService = c, this.id = this._workbook.getUnitId();
|
|
7047
7131
|
}
|
|
7048
7132
|
/**
|
|
7049
7133
|
* Get the Workbook instance.
|
|
@@ -7101,7 +7185,7 @@ let R = class extends Ae {
|
|
|
7101
7185
|
* ```
|
|
7102
7186
|
*/
|
|
7103
7187
|
setName(e) {
|
|
7104
|
-
return this._commandService.syncExecuteCommand(
|
|
7188
|
+
return this._commandService.syncExecuteCommand(mn.id, {
|
|
7105
7189
|
unitId: this._workbook.getUnitId(),
|
|
7106
7190
|
name: e
|
|
7107
7191
|
}), this;
|
|
@@ -7147,7 +7231,7 @@ let R = class extends Ae {
|
|
|
7147
7231
|
*/
|
|
7148
7232
|
getActiveSheet() {
|
|
7149
7233
|
const e = this._workbook.getActiveSheet();
|
|
7150
|
-
return this._injector.createInstance(
|
|
7234
|
+
return this._injector.createInstance(v, this, this._workbook, e);
|
|
7151
7235
|
}
|
|
7152
7236
|
/**
|
|
7153
7237
|
* Gets all the worksheets in this workbook
|
|
@@ -7161,7 +7245,7 @@ let R = class extends Ae {
|
|
|
7161
7245
|
* ```
|
|
7162
7246
|
*/
|
|
7163
7247
|
getSheets() {
|
|
7164
|
-
return this._workbook.getSheets().map((e) => this._injector.createInstance(
|
|
7248
|
+
return this._workbook.getSheets().map((e) => this._injector.createInstance(v, this, this._workbook, e));
|
|
7165
7249
|
}
|
|
7166
7250
|
/**
|
|
7167
7251
|
* Create a new worksheet and returns a handle to it.
|
|
@@ -7200,22 +7284,22 @@ let R = class extends Ae {
|
|
|
7200
7284
|
* ```
|
|
7201
7285
|
*/
|
|
7202
7286
|
create(e, t, s, r) {
|
|
7203
|
-
var h,
|
|
7204
|
-
const i =
|
|
7205
|
-
i.name = this._workbook.uniqueSheetName(e), i.rowCount = t, i.columnCount = s, i.id = (
|
|
7206
|
-
const o = (
|
|
7207
|
-
this._commandService.syncExecuteCommand(
|
|
7287
|
+
var h, d, c;
|
|
7288
|
+
const i = Qe(Xe.deepClone((h = r == null ? void 0 : r.sheet) != null ? h : {}));
|
|
7289
|
+
i.name = this._workbook.uniqueSheetName(e), i.rowCount = t, i.columnCount = s, i.id = (d = r == null ? void 0 : r.sheet) == null ? void 0 : d.id;
|
|
7290
|
+
const o = (c = r == null ? void 0 : r.index) != null ? c : this._workbook.getSheets().length;
|
|
7291
|
+
this._commandService.syncExecuteCommand(me.id, {
|
|
7208
7292
|
unitId: this.id,
|
|
7209
7293
|
index: o,
|
|
7210
7294
|
sheet: i
|
|
7211
|
-
}), this._commandService.syncExecuteCommand(
|
|
7295
|
+
}), this._commandService.syncExecuteCommand(te.id, {
|
|
7212
7296
|
unitId: this.id,
|
|
7213
7297
|
subUnitId: this._workbook.getSheets()[o].getSheetId()
|
|
7214
7298
|
});
|
|
7215
7299
|
const a = this._workbook.getActiveSheet();
|
|
7216
7300
|
if (!a)
|
|
7217
7301
|
throw new Error("No active sheet found");
|
|
7218
|
-
return this._injector.createInstance(
|
|
7302
|
+
return this._injector.createInstance(v, this, this._workbook, a);
|
|
7219
7303
|
}
|
|
7220
7304
|
/**
|
|
7221
7305
|
* Get a worksheet by sheet id.
|
|
@@ -7231,7 +7315,7 @@ let R = class extends Ae {
|
|
|
7231
7315
|
*/
|
|
7232
7316
|
getSheetBySheetId(e) {
|
|
7233
7317
|
const t = this._workbook.getSheetBySheetId(e);
|
|
7234
|
-
return t ? this._injector.createInstance(
|
|
7318
|
+
return t ? this._injector.createInstance(v, this, this._workbook, t) : null;
|
|
7235
7319
|
}
|
|
7236
7320
|
/**
|
|
7237
7321
|
* Get a worksheet by sheet name.
|
|
@@ -7247,7 +7331,7 @@ let R = class extends Ae {
|
|
|
7247
7331
|
*/
|
|
7248
7332
|
getSheetByName(e) {
|
|
7249
7333
|
const t = this._workbook.getSheetBySheetName(e);
|
|
7250
|
-
return t ? this._injector.createInstance(
|
|
7334
|
+
return t ? this._injector.createInstance(v, this, this._workbook, t) : null;
|
|
7251
7335
|
}
|
|
7252
7336
|
/**
|
|
7253
7337
|
* Sets the given worksheet to be the active worksheet in the workbook.
|
|
@@ -7262,7 +7346,7 @@ let R = class extends Ae {
|
|
|
7262
7346
|
* ```
|
|
7263
7347
|
*/
|
|
7264
7348
|
setActiveSheet(e) {
|
|
7265
|
-
return this._commandService.syncExecuteCommand(
|
|
7349
|
+
return this._commandService.syncExecuteCommand(te.id, {
|
|
7266
7350
|
unitId: this.id,
|
|
7267
7351
|
subUnitId: typeof e == "string" ? e : e.getSheetId()
|
|
7268
7352
|
}), typeof e == "string" ? this.getSheetBySheetId(e) : e;
|
|
@@ -7308,21 +7392,21 @@ let R = class extends Ae {
|
|
|
7308
7392
|
*/
|
|
7309
7393
|
insertSheet(e, t) {
|
|
7310
7394
|
var o, a, h;
|
|
7311
|
-
const s =
|
|
7395
|
+
const s = Qe(Xe.deepClone((o = t == null ? void 0 : t.sheet) != null ? o : {}));
|
|
7312
7396
|
s.name = this._workbook.uniqueSheetName(e), s.id = (a = t == null ? void 0 : t.sheet) == null ? void 0 : a.id;
|
|
7313
7397
|
const r = (h = t == null ? void 0 : t.index) != null ? h : this._workbook.getSheets().length;
|
|
7314
|
-
this._commandService.syncExecuteCommand(
|
|
7398
|
+
this._commandService.syncExecuteCommand(me.id, {
|
|
7315
7399
|
unitId: this.id,
|
|
7316
7400
|
index: r,
|
|
7317
7401
|
sheet: s
|
|
7318
|
-
}), this._commandService.syncExecuteCommand(
|
|
7402
|
+
}), this._commandService.syncExecuteCommand(te.id, {
|
|
7319
7403
|
unitId: this.id,
|
|
7320
7404
|
subUnitId: this._workbook.getSheets()[r].getSheetId()
|
|
7321
7405
|
});
|
|
7322
7406
|
const i = this._workbook.getActiveSheet();
|
|
7323
7407
|
if (!i)
|
|
7324
7408
|
throw new Error("No active sheet found");
|
|
7325
|
-
return this._injector.createInstance(
|
|
7409
|
+
return this._injector.createInstance(v, this, this._workbook, i);
|
|
7326
7410
|
}
|
|
7327
7411
|
/**
|
|
7328
7412
|
* Deletes the specified worksheet.
|
|
@@ -7341,7 +7425,7 @@ let R = class extends Ae {
|
|
|
7341
7425
|
*/
|
|
7342
7426
|
deleteSheet(e) {
|
|
7343
7427
|
const t = this.id, s = typeof e == "string" ? e : e.getSheetId();
|
|
7344
|
-
return this._commandService.syncExecuteCommand(
|
|
7428
|
+
return this._commandService.syncExecuteCommand(Te.id, {
|
|
7345
7429
|
unitId: t,
|
|
7346
7430
|
subUnitId: s
|
|
7347
7431
|
});
|
|
@@ -7358,7 +7442,7 @@ let R = class extends Ae {
|
|
|
7358
7442
|
* ```
|
|
7359
7443
|
*/
|
|
7360
7444
|
undo() {
|
|
7361
|
-
return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(
|
|
7445
|
+
return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(Tt.id), this;
|
|
7362
7446
|
}
|
|
7363
7447
|
/**
|
|
7364
7448
|
* Redo the last undone action.
|
|
@@ -7371,7 +7455,7 @@ let R = class extends Ae {
|
|
|
7371
7455
|
* ```
|
|
7372
7456
|
*/
|
|
7373
7457
|
redo() {
|
|
7374
|
-
return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(
|
|
7458
|
+
return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(Vt.id), this;
|
|
7375
7459
|
}
|
|
7376
7460
|
/**
|
|
7377
7461
|
* Callback for command execution.
|
|
@@ -7440,9 +7524,9 @@ let R = class extends Ae {
|
|
|
7440
7524
|
* ```
|
|
7441
7525
|
*/
|
|
7442
7526
|
onSelectionChange(e) {
|
|
7443
|
-
return
|
|
7527
|
+
return It(
|
|
7444
7528
|
this._selectionManagerService.selectionMoveEnd$.subscribe((t) => {
|
|
7445
|
-
this._univerInstanceService.getCurrentUnitForType(
|
|
7529
|
+
this._univerInstanceService.getCurrentUnitForType(F.UNIVER_SHEET).getUnitId() === this.id && (t != null && t.length ? e(t.map((s) => s.range)) : e([]));
|
|
7446
7530
|
})
|
|
7447
7531
|
);
|
|
7448
7532
|
}
|
|
@@ -7458,7 +7542,7 @@ let R = class extends Ae {
|
|
|
7458
7542
|
* ```
|
|
7459
7543
|
*/
|
|
7460
7544
|
setEditable(e) {
|
|
7461
|
-
const t = new
|
|
7545
|
+
const t = new Le(this._workbook.getUnitId());
|
|
7462
7546
|
return this._permissionService.getPermissionPoint(t.id) || this._permissionService.addPermissionPoint(t), this._permissionService.updatePermissionPoint(t.id, e), this;
|
|
7463
7547
|
}
|
|
7464
7548
|
/**
|
|
@@ -7476,13 +7560,13 @@ let R = class extends Ae {
|
|
|
7476
7560
|
const t = this.getActiveSheet(), s = e.getRange().sheetId || t.getSheetId(), r = s ? this._workbook.getSheetBySheetId(s) : this._workbook.getActiveSheet(!0);
|
|
7477
7561
|
if (!r)
|
|
7478
7562
|
throw new Error("No active sheet found");
|
|
7479
|
-
r.getSheetId() !== t.getSheetId() && this.setActiveSheet(this._injector.createInstance(
|
|
7563
|
+
r.getSheetId() !== t.getSheetId() && this.setActiveSheet(this._injector.createInstance(v, this, this._workbook, r));
|
|
7480
7564
|
const i = {
|
|
7481
7565
|
unitId: this.getId(),
|
|
7482
7566
|
subUnitId: s,
|
|
7483
|
-
selections: [e].map((o) => ({ range: o.getRange(), primary:
|
|
7567
|
+
selections: [e].map((o) => ({ range: o.getRange(), primary: le(o.getRange(), r), style: null }))
|
|
7484
7568
|
};
|
|
7485
|
-
return this._commandService.syncExecuteCommand(
|
|
7569
|
+
return this._commandService.syncExecuteCommand(Ge.id, i), this;
|
|
7486
7570
|
}
|
|
7487
7571
|
/**
|
|
7488
7572
|
* Returns the selected range in the active sheet, or null if there is no active range.
|
|
@@ -7497,7 +7581,7 @@ let R = class extends Ae {
|
|
|
7497
7581
|
// could sheet have no active range ?
|
|
7498
7582
|
getActiveRange() {
|
|
7499
7583
|
const e = this._workbook.getActiveSheet(), s = this._selectionManagerService.getCurrentSelections().find((r) => !!r.primary);
|
|
7500
|
-
return s ? this._injector.createInstance(
|
|
7584
|
+
return s ? this._injector.createInstance(R, this._workbook, e, s.range) : null;
|
|
7501
7585
|
}
|
|
7502
7586
|
/**
|
|
7503
7587
|
* Returns the active cell in this spreadsheet.
|
|
@@ -7514,9 +7598,9 @@ let R = class extends Ae {
|
|
|
7514
7598
|
return null;
|
|
7515
7599
|
const r = {
|
|
7516
7600
|
...s.primary,
|
|
7517
|
-
rangeType:
|
|
7601
|
+
rangeType: p.NORMAL
|
|
7518
7602
|
};
|
|
7519
|
-
return this._injector.createInstance(
|
|
7603
|
+
return this._injector.createInstance(R, this._workbook, e, r);
|
|
7520
7604
|
}
|
|
7521
7605
|
/**
|
|
7522
7606
|
* Deletes the currently active sheet.
|
|
@@ -7545,10 +7629,10 @@ let R = class extends Ae {
|
|
|
7545
7629
|
* ```
|
|
7546
7630
|
*/
|
|
7547
7631
|
duplicateSheet(e) {
|
|
7548
|
-
return this._commandService.syncExecuteCommand(
|
|
7632
|
+
return this._commandService.syncExecuteCommand(gn.id, {
|
|
7549
7633
|
unitId: e.getWorkbook().getUnitId(),
|
|
7550
7634
|
subUnitId: e.getSheetId()
|
|
7551
|
-
}), this._injector.createInstance(
|
|
7635
|
+
}), this._injector.createInstance(v, this, this._workbook, this._workbook.getActiveSheet());
|
|
7552
7636
|
}
|
|
7553
7637
|
/**
|
|
7554
7638
|
* Duplicates the active sheet.
|
|
@@ -7641,7 +7725,7 @@ let R = class extends Ae {
|
|
|
7641
7725
|
*/
|
|
7642
7726
|
moveSheet(e, t) {
|
|
7643
7727
|
let s = t;
|
|
7644
|
-
return s < 0 ? s = 0 : s > this._workbook.getSheets().length - 1 && (s = this._workbook.getSheets().length - 1), this._commandService.syncExecuteCommand(
|
|
7728
|
+
return s < 0 ? s = 0 : s > this._workbook.getSheets().length - 1 && (s = this._workbook.getSheets().length - 1), this._commandService.syncExecuteCommand(_n.id, {
|
|
7645
7729
|
unitId: e.getWorkbook().getUnitId(),
|
|
7646
7730
|
order: s,
|
|
7647
7731
|
subUnitId: e.getSheetId()
|
|
@@ -7674,7 +7758,7 @@ let R = class extends Ae {
|
|
|
7674
7758
|
* ```
|
|
7675
7759
|
*/
|
|
7676
7760
|
getPermission() {
|
|
7677
|
-
return this._injector.createInstance(
|
|
7761
|
+
return this._injector.createInstance(z);
|
|
7678
7762
|
}
|
|
7679
7763
|
/**
|
|
7680
7764
|
* Get the WorkbookPermission instance for managing workbook-level permissions.
|
|
@@ -7702,7 +7786,7 @@ let R = class extends Ae {
|
|
|
7702
7786
|
* ```
|
|
7703
7787
|
*/
|
|
7704
7788
|
getWorkbookPermission() {
|
|
7705
|
-
return this._injector.createInstance(
|
|
7789
|
+
return this._injector.createInstance(Be, this._workbook.getUnitId());
|
|
7706
7790
|
}
|
|
7707
7791
|
/**
|
|
7708
7792
|
* Get the defined name by name.
|
|
@@ -7722,7 +7806,7 @@ let R = class extends Ae {
|
|
|
7722
7806
|
*/
|
|
7723
7807
|
getDefinedName(e) {
|
|
7724
7808
|
const t = this._definedNamesService.getValueByName(this.id, e);
|
|
7725
|
-
return t ? this._injector.createInstance(
|
|
7809
|
+
return t ? this._injector.createInstance(Se, { ...t, unitId: this.id }) : null;
|
|
7726
7810
|
}
|
|
7727
7811
|
/**
|
|
7728
7812
|
* Get all the defined names in the workbook.
|
|
@@ -7737,7 +7821,7 @@ let R = class extends Ae {
|
|
|
7737
7821
|
*/
|
|
7738
7822
|
getDefinedNames() {
|
|
7739
7823
|
const e = this._definedNamesService.getDefinedNameMap(this.id);
|
|
7740
|
-
return e ? Object.values(e).map((t) => this._injector.createInstance(
|
|
7824
|
+
return e ? Object.values(e).map((t) => this._injector.createInstance(Se, { ...t, unitId: this.id })) : [];
|
|
7741
7825
|
}
|
|
7742
7826
|
/**
|
|
7743
7827
|
* Insert a defined name.
|
|
@@ -7752,8 +7836,8 @@ let R = class extends Ae {
|
|
|
7752
7836
|
* ```
|
|
7753
7837
|
*/
|
|
7754
7838
|
insertDefinedName(e, t) {
|
|
7755
|
-
const r = this._injector.createInstance(
|
|
7756
|
-
return r.localSheetId =
|
|
7839
|
+
const r = this._injector.createInstance(Ce).setName(e).setRef(t).build();
|
|
7840
|
+
return r.localSheetId = ne, this.insertDefinedNameBuilder(r), this;
|
|
7757
7841
|
}
|
|
7758
7842
|
/**
|
|
7759
7843
|
* Delete the defined name with the given name.
|
|
@@ -7787,7 +7871,7 @@ let R = class extends Ae {
|
|
|
7787
7871
|
* ```
|
|
7788
7872
|
*/
|
|
7789
7873
|
insertDefinedNameBuilder(e) {
|
|
7790
|
-
e.unitId = this.getId(), this._commandService.syncExecuteCommand(
|
|
7874
|
+
e.unitId = this.getId(), this._commandService.syncExecuteCommand(Me.id, e);
|
|
7791
7875
|
}
|
|
7792
7876
|
/**
|
|
7793
7877
|
* Update the defined name with the given name.
|
|
@@ -7811,7 +7895,7 @@ let R = class extends Ae {
|
|
|
7811
7895
|
* ```
|
|
7812
7896
|
*/
|
|
7813
7897
|
updateDefinedNameBuilder(e) {
|
|
7814
|
-
this._commandService.syncExecuteCommand(
|
|
7898
|
+
this._commandService.syncExecuteCommand(Me.id, e);
|
|
7815
7899
|
}
|
|
7816
7900
|
/**
|
|
7817
7901
|
* Gets the registered range themes.
|
|
@@ -7825,7 +7909,7 @@ let R = class extends Ae {
|
|
|
7825
7909
|
* ```
|
|
7826
7910
|
*/
|
|
7827
7911
|
getRegisteredRangeThemes() {
|
|
7828
|
-
return this._injector.get(
|
|
7912
|
+
return this._injector.get(Mt).getRegisteredRangeThemes();
|
|
7829
7913
|
}
|
|
7830
7914
|
/**
|
|
7831
7915
|
* Register a custom range theme style.
|
|
@@ -7845,7 +7929,7 @@ let R = class extends Ae {
|
|
|
7845
7929
|
* ```
|
|
7846
7930
|
*/
|
|
7847
7931
|
registerRangeTheme(e) {
|
|
7848
|
-
this._commandService.syncExecuteCommand(
|
|
7932
|
+
this._commandService.syncExecuteCommand(wn.id, {
|
|
7849
7933
|
unitId: this.getId(),
|
|
7850
7934
|
rangeThemeStyle: e
|
|
7851
7935
|
});
|
|
@@ -7861,7 +7945,7 @@ let R = class extends Ae {
|
|
|
7861
7945
|
* ```
|
|
7862
7946
|
*/
|
|
7863
7947
|
unregisterRangeTheme(e) {
|
|
7864
|
-
this._commandService.syncExecuteCommand(
|
|
7948
|
+
this._commandService.syncExecuteCommand(Sn.id, {
|
|
7865
7949
|
unitId: this.getId(),
|
|
7866
7950
|
themeName: e
|
|
7867
7951
|
});
|
|
@@ -7885,7 +7969,7 @@ let R = class extends Ae {
|
|
|
7885
7969
|
* ```
|
|
7886
7970
|
*/
|
|
7887
7971
|
createRangeThemeStyle(e, t) {
|
|
7888
|
-
return new
|
|
7972
|
+
return new kn(e, t);
|
|
7889
7973
|
}
|
|
7890
7974
|
/**
|
|
7891
7975
|
* Set custom metadata of workbook
|
|
@@ -7990,18 +8074,18 @@ let R = class extends Ae {
|
|
|
7990
8074
|
this._workbook.removeStyles(e);
|
|
7991
8075
|
}
|
|
7992
8076
|
};
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
],
|
|
8004
|
-
class
|
|
8077
|
+
P = Qn([
|
|
8078
|
+
j(1, l(E)),
|
|
8079
|
+
j(2, l(At)),
|
|
8080
|
+
j(3, l(Et)),
|
|
8081
|
+
j(4, De),
|
|
8082
|
+
j(5, C),
|
|
8083
|
+
j(6, Y),
|
|
8084
|
+
j(7, bt),
|
|
8085
|
+
j(8, l(kt)),
|
|
8086
|
+
j(9, Wt)
|
|
8087
|
+
], P);
|
|
8088
|
+
class Xn extends ft {
|
|
8005
8089
|
getCommandSheetTarget(e) {
|
|
8006
8090
|
var i;
|
|
8007
8091
|
const t = e.params;
|
|
@@ -8022,11 +8106,11 @@ class Qn extends Ct {
|
|
|
8022
8106
|
return { workbook: s, worksheet: r };
|
|
8023
8107
|
}
|
|
8024
8108
|
_initWorkbookEvent(e) {
|
|
8025
|
-
const t = e.get(
|
|
8109
|
+
const t = e.get(De);
|
|
8026
8110
|
this.registerEventHandler(
|
|
8027
8111
|
this.Event.WorkbookDisposed,
|
|
8028
8112
|
() => t.unitDisposed$.subscribe((s) => {
|
|
8029
|
-
s.type ===
|
|
8113
|
+
s.type === F.UNIVER_SHEET && this.fireEvent(this.Event.WorkbookDisposed, {
|
|
8030
8114
|
unitId: s.getUnitId(),
|
|
8031
8115
|
unitType: s.type,
|
|
8032
8116
|
snapshot: s.getSnapshot()
|
|
@@ -8035,8 +8119,8 @@ class Qn extends Ct {
|
|
|
8035
8119
|
), this.registerEventHandler(
|
|
8036
8120
|
this.Event.WorkbookCreated,
|
|
8037
8121
|
() => t.unitAdded$.subscribe((s) => {
|
|
8038
|
-
if (s.type ===
|
|
8039
|
-
const r = s, i = e.createInstance(
|
|
8122
|
+
if (s.type === F.UNIVER_SHEET) {
|
|
8123
|
+
const r = s, i = e.createInstance(P, r);
|
|
8040
8124
|
this.fireEvent(this.Event.WorkbookCreated, {
|
|
8041
8125
|
unitId: s.getUnitId(),
|
|
8042
8126
|
type: s.type,
|
|
@@ -8052,46 +8136,46 @@ class Qn extends Ct {
|
|
|
8052
8136
|
*/
|
|
8053
8137
|
// eslint-disable-next-line max-lines-per-function
|
|
8054
8138
|
_initialize(e) {
|
|
8055
|
-
const t = e.get(
|
|
8139
|
+
const t = e.get(C);
|
|
8056
8140
|
this.registerEventHandler(
|
|
8057
8141
|
this.Event.BeforeSheetCreate,
|
|
8058
8142
|
() => t.beforeCommandExecuted((s) => {
|
|
8059
8143
|
var r;
|
|
8060
|
-
if (s.id ===
|
|
8061
|
-
const i = s.params, { unitId: o, index: a, sheet: h } = i || {},
|
|
8062
|
-
if (!
|
|
8144
|
+
if (s.id === me.id) {
|
|
8145
|
+
const i = s.params, { unitId: o, index: a, sheet: h } = i || {}, d = o ? this.getUniverSheet(o) : (r = this.getActiveWorkbook) == null ? void 0 : r.call(this);
|
|
8146
|
+
if (!d)
|
|
8063
8147
|
return;
|
|
8064
|
-
const
|
|
8065
|
-
workbook:
|
|
8148
|
+
const c = {
|
|
8149
|
+
workbook: d,
|
|
8066
8150
|
index: a,
|
|
8067
8151
|
sheet: h
|
|
8068
8152
|
};
|
|
8069
|
-
if (this.fireEvent(this.Event.BeforeSheetCreate,
|
|
8070
|
-
throw new
|
|
8153
|
+
if (this.fireEvent(this.Event.BeforeSheetCreate, c), c.cancel)
|
|
8154
|
+
throw new M();
|
|
8071
8155
|
}
|
|
8072
8156
|
})
|
|
8073
8157
|
), this.registerEventHandler(
|
|
8074
8158
|
this.Event.BeforeActiveSheetChange,
|
|
8075
8159
|
() => t.beforeCommandExecuted((s) => {
|
|
8076
8160
|
var r;
|
|
8077
|
-
if (s.id ===
|
|
8161
|
+
if (s.id === te.id) {
|
|
8078
8162
|
const { subUnitId: i, unitId: o } = s.params, a = o ? this.getUniverSheet(o) : (r = this.getActiveWorkbook) == null ? void 0 : r.call(this);
|
|
8079
8163
|
if (!a || !i) return;
|
|
8080
|
-
const h = a.getSheetBySheetId(i),
|
|
8081
|
-
if (!h || !
|
|
8082
|
-
const
|
|
8164
|
+
const h = a.getSheetBySheetId(i), d = a.getActiveSheet();
|
|
8165
|
+
if (!h || !d) return;
|
|
8166
|
+
const c = {
|
|
8083
8167
|
workbook: a,
|
|
8084
8168
|
activeSheet: h,
|
|
8085
|
-
oldActiveSheet:
|
|
8169
|
+
oldActiveSheet: d
|
|
8086
8170
|
};
|
|
8087
|
-
if (this.fireEvent(this.Event.BeforeActiveSheetChange,
|
|
8088
|
-
throw new
|
|
8171
|
+
if (this.fireEvent(this.Event.BeforeActiveSheetChange, c), c.cancel)
|
|
8172
|
+
throw new M();
|
|
8089
8173
|
}
|
|
8090
8174
|
})
|
|
8091
8175
|
), this.registerEventHandler(
|
|
8092
8176
|
this.Event.BeforeSheetDelete,
|
|
8093
8177
|
() => t.beforeCommandExecuted((s) => {
|
|
8094
|
-
if (s.id ===
|
|
8178
|
+
if (s.id === Te.id) {
|
|
8095
8179
|
const r = this.getCommandSheetTarget(s);
|
|
8096
8180
|
if (!r) return;
|
|
8097
8181
|
const { workbook: i, worksheet: o } = r, a = {
|
|
@@ -8099,13 +8183,13 @@ class Qn extends Ct {
|
|
|
8099
8183
|
worksheet: o
|
|
8100
8184
|
};
|
|
8101
8185
|
if (this.fireEvent(this.Event.BeforeSheetDelete, a), a.cancel)
|
|
8102
|
-
throw new
|
|
8186
|
+
throw new M();
|
|
8103
8187
|
}
|
|
8104
8188
|
})
|
|
8105
8189
|
), this.registerEventHandler(
|
|
8106
8190
|
this.Event.BeforeSheetMove,
|
|
8107
8191
|
() => t.beforeCommandExecuted((s) => {
|
|
8108
|
-
if (s.id ===
|
|
8192
|
+
if (s.id === lt.id) {
|
|
8109
8193
|
const { fromOrder: r, toOrder: i } = s.params, o = this.getCommandSheetTarget(s);
|
|
8110
8194
|
if (!o) return;
|
|
8111
8195
|
const a = {
|
|
@@ -8115,13 +8199,13 @@ class Qn extends Ct {
|
|
|
8115
8199
|
oldIndex: r
|
|
8116
8200
|
};
|
|
8117
8201
|
if (this.fireEvent(this.Event.BeforeSheetMove, a), a.cancel)
|
|
8118
|
-
throw new
|
|
8202
|
+
throw new M();
|
|
8119
8203
|
}
|
|
8120
8204
|
})
|
|
8121
8205
|
), this.registerEventHandler(
|
|
8122
8206
|
this.Event.BeforeSheetNameChange,
|
|
8123
8207
|
() => t.beforeCommandExecuted((s) => {
|
|
8124
|
-
if (s.id ===
|
|
8208
|
+
if (s.id === Oe.id) {
|
|
8125
8209
|
const { name: r } = s.params, i = this.getCommandSheetTarget(s);
|
|
8126
8210
|
if (!i) return;
|
|
8127
8211
|
const o = {
|
|
@@ -8131,13 +8215,13 @@ class Qn extends Ct {
|
|
|
8131
8215
|
oldName: i.worksheet.getSheetName()
|
|
8132
8216
|
};
|
|
8133
8217
|
if (this.fireEvent(this.Event.BeforeSheetNameChange, o), o.cancel)
|
|
8134
|
-
throw new
|
|
8218
|
+
throw new M();
|
|
8135
8219
|
}
|
|
8136
8220
|
})
|
|
8137
8221
|
), this.registerEventHandler(
|
|
8138
8222
|
this.Event.BeforeSheetTabColorChange,
|
|
8139
8223
|
() => t.beforeCommandExecuted((s) => {
|
|
8140
|
-
if (s.id ===
|
|
8224
|
+
if (s.id === mt.id) {
|
|
8141
8225
|
const { color: r } = s.params, i = this.getCommandSheetTarget(s);
|
|
8142
8226
|
if (!i) return;
|
|
8143
8227
|
const o = {
|
|
@@ -8147,13 +8231,13 @@ class Qn extends Ct {
|
|
|
8147
8231
|
oldColor: i.worksheet.getTabColor()
|
|
8148
8232
|
};
|
|
8149
8233
|
if (this.fireEvent(this.Event.BeforeSheetTabColorChange, o), o.cancel)
|
|
8150
|
-
throw new
|
|
8234
|
+
throw new M();
|
|
8151
8235
|
}
|
|
8152
8236
|
})
|
|
8153
8237
|
), this.registerEventHandler(
|
|
8154
8238
|
this.Event.BeforeSheetHideChange,
|
|
8155
8239
|
() => t.beforeCommandExecuted((s) => {
|
|
8156
|
-
if (s.id ===
|
|
8240
|
+
if (s.id === gt.id) {
|
|
8157
8241
|
const { hidden: r } = s.params, i = this.getCommandSheetTarget(s);
|
|
8158
8242
|
if (!i) return;
|
|
8159
8243
|
const o = {
|
|
@@ -8162,14 +8246,14 @@ class Qn extends Ct {
|
|
|
8162
8246
|
hidden: !!r
|
|
8163
8247
|
};
|
|
8164
8248
|
if (this.fireEvent(this.Event.BeforeSheetHideChange, o), o.cancel)
|
|
8165
|
-
throw new
|
|
8249
|
+
throw new M();
|
|
8166
8250
|
}
|
|
8167
8251
|
})
|
|
8168
8252
|
), this.registerEventHandler(
|
|
8169
8253
|
this.Event.BeforeGridlineColorChange,
|
|
8170
8254
|
() => t.beforeCommandExecuted((s) => {
|
|
8171
8255
|
var r;
|
|
8172
|
-
if (s.id ===
|
|
8256
|
+
if (s.id === Ne.id) {
|
|
8173
8257
|
const i = this.getCommandSheetTarget(s);
|
|
8174
8258
|
if (!i) return;
|
|
8175
8259
|
const o = {
|
|
@@ -8177,14 +8261,14 @@ class Qn extends Ct {
|
|
|
8177
8261
|
color: (r = s.params) == null ? void 0 : r.color
|
|
8178
8262
|
};
|
|
8179
8263
|
if (this.fireEvent(this.Event.BeforeGridlineColorChange, o), o.cancel)
|
|
8180
|
-
throw new
|
|
8264
|
+
throw new M();
|
|
8181
8265
|
}
|
|
8182
8266
|
})
|
|
8183
8267
|
), this.registerEventHandler(
|
|
8184
8268
|
this.Event.BeforeGridlineEnableChange,
|
|
8185
8269
|
() => t.beforeCommandExecuted((s) => {
|
|
8186
8270
|
var r;
|
|
8187
|
-
if (s.id ===
|
|
8271
|
+
if (s.id === je.id) {
|
|
8188
8272
|
const i = this.getCommandSheetTarget(s);
|
|
8189
8273
|
if (!i) return;
|
|
8190
8274
|
const o = {
|
|
@@ -8192,15 +8276,15 @@ class Qn extends Ct {
|
|
|
8192
8276
|
enabled: !!((r = s.params) != null && r.showGridlines)
|
|
8193
8277
|
};
|
|
8194
8278
|
if (this.fireEvent(this.Event.BeforeGridlineEnableChange, o), o.cancel)
|
|
8195
|
-
throw new
|
|
8279
|
+
throw new M();
|
|
8196
8280
|
}
|
|
8197
8281
|
})
|
|
8198
8282
|
), this.registerEventHandler(
|
|
8199
8283
|
this.Event.SheetValueChanged,
|
|
8200
8284
|
() => t.onCommandExecuted((s) => {
|
|
8201
|
-
if (
|
|
8285
|
+
if (Cn.indexOf(s.id) > -1) {
|
|
8202
8286
|
if (!this.getActiveSheet()) return;
|
|
8203
|
-
const i =
|
|
8287
|
+
const i = bn(s).map(
|
|
8204
8288
|
(o) => {
|
|
8205
8289
|
var a, h;
|
|
8206
8290
|
return (h = (a = this.getWorkbook(o.unitId)) == null ? void 0 : a.getSheetBySheetId(o.subUnitId)) == null ? void 0 : h.getRange(o.range);
|
|
@@ -8217,27 +8301,27 @@ class Qn extends Ct {
|
|
|
8217
8301
|
this.Event.SheetCreated,
|
|
8218
8302
|
() => t.onCommandExecuted((s) => {
|
|
8219
8303
|
var r;
|
|
8220
|
-
if (s.id ===
|
|
8304
|
+
if (s.id === me.id) {
|
|
8221
8305
|
const i = s.params, { unitId: o } = i || {}, a = o ? this.getUniverSheet(o) : (r = this.getActiveWorkbook) == null ? void 0 : r.call(this);
|
|
8222
8306
|
if (!a)
|
|
8223
8307
|
return;
|
|
8224
8308
|
const h = a.getActiveSheet();
|
|
8225
8309
|
if (!h)
|
|
8226
8310
|
return;
|
|
8227
|
-
const
|
|
8311
|
+
const d = {
|
|
8228
8312
|
workbook: a,
|
|
8229
8313
|
worksheet: h
|
|
8230
8314
|
};
|
|
8231
8315
|
this.fireEvent(
|
|
8232
8316
|
this.Event.SheetCreated,
|
|
8233
|
-
|
|
8317
|
+
d
|
|
8234
8318
|
);
|
|
8235
8319
|
}
|
|
8236
8320
|
})
|
|
8237
8321
|
), this.registerEventHandler(
|
|
8238
8322
|
this.Event.ActiveSheetChanged,
|
|
8239
8323
|
() => t.onCommandExecuted((s) => {
|
|
8240
|
-
if (s.id ===
|
|
8324
|
+
if (s.id === te.id) {
|
|
8241
8325
|
const r = this.getActiveSheet();
|
|
8242
8326
|
if (!r) return;
|
|
8243
8327
|
const { workbook: i, worksheet: o } = r;
|
|
@@ -8248,7 +8332,7 @@ class Qn extends Ct {
|
|
|
8248
8332
|
this.Event.SheetDeleted,
|
|
8249
8333
|
() => t.onCommandExecuted((s) => {
|
|
8250
8334
|
var r;
|
|
8251
|
-
if (s.id ===
|
|
8335
|
+
if (s.id === Te.id) {
|
|
8252
8336
|
const { subUnitId: i, unitId: o } = s.params, a = o ? this.getUniverSheet(o) : (r = this.getActiveWorkbook) == null ? void 0 : r.call(this);
|
|
8253
8337
|
if (!a || !i) return;
|
|
8254
8338
|
this._fireSheetDeleted(a, i);
|
|
@@ -8257,7 +8341,7 @@ class Qn extends Ct {
|
|
|
8257
8341
|
), this.registerEventHandler(
|
|
8258
8342
|
this.Event.SheetMoved,
|
|
8259
8343
|
() => t.onCommandExecuted((s) => {
|
|
8260
|
-
if (s.id ===
|
|
8344
|
+
if (s.id === lt.id) {
|
|
8261
8345
|
const { toOrder: r } = s.params, i = this.getCommandSheetTarget(s);
|
|
8262
8346
|
if (!i) return;
|
|
8263
8347
|
this._fireSheetMoved(i.workbook, i.worksheet, r);
|
|
@@ -8266,7 +8350,7 @@ class Qn extends Ct {
|
|
|
8266
8350
|
), this.registerEventHandler(
|
|
8267
8351
|
this.Event.SheetNameChanged,
|
|
8268
8352
|
() => t.onCommandExecuted((s) => {
|
|
8269
|
-
if (s.id ===
|
|
8353
|
+
if (s.id === Oe.id) {
|
|
8270
8354
|
const { name: r } = s.params, i = this.getCommandSheetTarget(s);
|
|
8271
8355
|
if (!i) return;
|
|
8272
8356
|
this._fireSheetNameChanged(i.workbook, i.worksheet, r);
|
|
@@ -8275,7 +8359,7 @@ class Qn extends Ct {
|
|
|
8275
8359
|
), this.registerEventHandler(
|
|
8276
8360
|
this.Event.SheetTabColorChanged,
|
|
8277
8361
|
() => t.onCommandExecuted((s) => {
|
|
8278
|
-
if (s.id ===
|
|
8362
|
+
if (s.id === mt.id) {
|
|
8279
8363
|
const { color: r } = s.params, i = this.getCommandSheetTarget(s);
|
|
8280
8364
|
if (!i) return;
|
|
8281
8365
|
this._fireSheetTabColorChanged(i.workbook, i.worksheet, r);
|
|
@@ -8284,7 +8368,7 @@ class Qn extends Ct {
|
|
|
8284
8368
|
), this.registerEventHandler(
|
|
8285
8369
|
this.Event.SheetHideChanged,
|
|
8286
8370
|
() => t.onCommandExecuted((s) => {
|
|
8287
|
-
if (s.id ===
|
|
8371
|
+
if (s.id === gt.id) {
|
|
8288
8372
|
const { hidden: r } = s.params, i = this.getCommandSheetTarget(s);
|
|
8289
8373
|
if (!i) return;
|
|
8290
8374
|
this._fireSheetHideChanged(i.workbook, i.worksheet, !!r);
|
|
@@ -8293,7 +8377,7 @@ class Qn extends Ct {
|
|
|
8293
8377
|
), this.registerEventHandler(
|
|
8294
8378
|
this.Event.GridlineChanged,
|
|
8295
8379
|
() => t.onCommandExecuted((s) => {
|
|
8296
|
-
if (s.id ===
|
|
8380
|
+
if (s.id === Ne.id || s.id === je.id) {
|
|
8297
8381
|
const r = this.getCommandSheetTarget(s);
|
|
8298
8382
|
if (!r) return;
|
|
8299
8383
|
this.fireEvent(this.Event.GridlineChanged, {
|
|
@@ -8306,38 +8390,38 @@ class Qn extends Ct {
|
|
|
8306
8390
|
), this._initWorkbookEvent(e);
|
|
8307
8391
|
}
|
|
8308
8392
|
createUniverSheet(e, t) {
|
|
8309
|
-
const r = this._injector.get(
|
|
8310
|
-
return this._injector.createInstance(
|
|
8393
|
+
const r = this._injector.get(De).createUnit(F.UNIVER_SHEET, e, t);
|
|
8394
|
+
return this._injector.createInstance(P, r);
|
|
8311
8395
|
}
|
|
8312
8396
|
createWorkbook(e, t) {
|
|
8313
8397
|
return this.createUniverSheet(e, t);
|
|
8314
8398
|
}
|
|
8315
8399
|
getActiveWorkbook() {
|
|
8316
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
8317
|
-
return e ? this._injector.createInstance(
|
|
8400
|
+
const e = this._univerInstanceService.getCurrentUnitForType(F.UNIVER_SHEET);
|
|
8401
|
+
return e ? this._injector.createInstance(P, e) : null;
|
|
8318
8402
|
}
|
|
8319
8403
|
getActiveUniverSheet() {
|
|
8320
8404
|
return this.getActiveWorkbook();
|
|
8321
8405
|
}
|
|
8322
8406
|
getUniverSheet(e) {
|
|
8323
|
-
const t = this._univerInstanceService.getUnit(e,
|
|
8324
|
-
return t ? this._injector.createInstance(
|
|
8407
|
+
const t = this._univerInstanceService.getUnit(e, F.UNIVER_SHEET);
|
|
8408
|
+
return t ? this._injector.createInstance(P, t) : null;
|
|
8325
8409
|
}
|
|
8326
8410
|
getWorkbook(e) {
|
|
8327
8411
|
return this.getUniverSheet(e);
|
|
8328
8412
|
}
|
|
8329
8413
|
getPermission() {
|
|
8330
|
-
return this._injector.createInstance(
|
|
8414
|
+
return this._injector.createInstance(z);
|
|
8331
8415
|
}
|
|
8332
8416
|
onUniverSheetCreated(e) {
|
|
8333
|
-
const t = this._univerInstanceService.getTypeOfUnitAdded$(
|
|
8334
|
-
const r = this._injector.createInstance(
|
|
8417
|
+
const t = this._univerInstanceService.getTypeOfUnitAdded$(F.UNIVER_SHEET).subscribe((s) => {
|
|
8418
|
+
const r = this._injector.createInstance(P, s);
|
|
8335
8419
|
e(r);
|
|
8336
8420
|
});
|
|
8337
|
-
return
|
|
8421
|
+
return It(t);
|
|
8338
8422
|
}
|
|
8339
8423
|
newDefinedName() {
|
|
8340
|
-
return this._injector.createInstance(
|
|
8424
|
+
return this._injector.createInstance(Ce);
|
|
8341
8425
|
}
|
|
8342
8426
|
getActiveSheet() {
|
|
8343
8427
|
const e = this.getActiveWorkbook();
|
|
@@ -8347,7 +8431,7 @@ class Qn extends Ct {
|
|
|
8347
8431
|
return t ? { workbook: e, worksheet: t } : null;
|
|
8348
8432
|
}
|
|
8349
8433
|
setFreezeSync(e) {
|
|
8350
|
-
this._injector.get(
|
|
8434
|
+
this._injector.get(In).setEnabled(e);
|
|
8351
8435
|
}
|
|
8352
8436
|
_fireActiveSheetChanged(e, t) {
|
|
8353
8437
|
this.fireEvent(this.Event.ActiveSheetChanged, {
|
|
@@ -8390,32 +8474,32 @@ class Qn extends Ct {
|
|
|
8390
8474
|
});
|
|
8391
8475
|
}
|
|
8392
8476
|
}
|
|
8393
|
-
|
|
8394
|
-
class
|
|
8477
|
+
ft.extend(Xn);
|
|
8478
|
+
class er {
|
|
8395
8479
|
get SheetValueChangeType() {
|
|
8396
|
-
return
|
|
8480
|
+
return fn;
|
|
8397
8481
|
}
|
|
8398
8482
|
get SheetSkeletonChangeType() {
|
|
8399
|
-
return
|
|
8483
|
+
return vn;
|
|
8400
8484
|
}
|
|
8401
8485
|
get SplitDelimiterType() {
|
|
8402
|
-
return
|
|
8486
|
+
return Rn;
|
|
8403
8487
|
}
|
|
8404
8488
|
get UnitRole() {
|
|
8405
|
-
return
|
|
8489
|
+
return H;
|
|
8406
8490
|
}
|
|
8407
8491
|
get WorkbookPermissionPoint() {
|
|
8408
8492
|
return u;
|
|
8409
8493
|
}
|
|
8410
8494
|
get WorksheetPermissionPoint() {
|
|
8411
|
-
return
|
|
8495
|
+
return _;
|
|
8412
8496
|
}
|
|
8413
8497
|
get RangePermissionPoint() {
|
|
8414
|
-
return
|
|
8498
|
+
return b;
|
|
8415
8499
|
}
|
|
8416
8500
|
}
|
|
8417
|
-
|
|
8418
|
-
class
|
|
8501
|
+
Bt.extend(er);
|
|
8502
|
+
class tr {
|
|
8419
8503
|
get SheetCreated() {
|
|
8420
8504
|
return "SheetCreated";
|
|
8421
8505
|
}
|
|
@@ -8477,27 +8561,27 @@ class er {
|
|
|
8477
8561
|
return "SheetValueChanged";
|
|
8478
8562
|
}
|
|
8479
8563
|
}
|
|
8480
|
-
|
|
8481
|
-
var
|
|
8482
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
8564
|
+
Ft.extend(tr);
|
|
8565
|
+
var sr = Object.getOwnPropertyDescriptor, nr = (n, e, t, s) => {
|
|
8566
|
+
for (var r = s > 1 ? void 0 : s ? sr(e, t) : e, i = n.length - 1, o; i >= 0; i--)
|
|
8483
8567
|
(o = n[i]) && (r = o(r) || r);
|
|
8484
8568
|
return r;
|
|
8485
|
-
},
|
|
8486
|
-
let
|
|
8569
|
+
}, rr = (n, e) => (t, s) => e(t, s, n);
|
|
8570
|
+
let St = class extends Fe {
|
|
8487
8571
|
constructor(n) {
|
|
8488
8572
|
super(), this._injector = n;
|
|
8489
8573
|
}
|
|
8490
8574
|
};
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
],
|
|
8575
|
+
St = nr([
|
|
8576
|
+
rr(0, l(E))
|
|
8577
|
+
], St);
|
|
8494
8578
|
export {
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8579
|
+
z as FPermission,
|
|
8580
|
+
R as FRange,
|
|
8581
|
+
ke as FSelection,
|
|
8582
|
+
tr as FSheetEventName,
|
|
8583
|
+
St as FSheetHooks,
|
|
8584
|
+
er as FSheetsEnum,
|
|
8585
|
+
P as FWorkbook,
|
|
8586
|
+
v as FWorksheet
|
|
8503
8587
|
};
|