@univerjs/sheets 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +3 -3
- package/lib/es/facade.js +748 -748
- package/lib/es/index.js +1034 -981
- package/lib/facade.js +748 -748
- package/lib/index.js +1034 -981
- package/lib/types/commands/mutations/set-worksheet-col-width.mutation.d.ts +5 -1
- package/lib/types/commands/mutations/set-worksheet-row-height.mutation.d.ts +5 -1
- package/lib/types/commands/utils/pack-number-map.d.ts +11 -0
- package/lib/types/facade/f-worksheet.d.ts +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +3 -3
- package/package.json +7 -7
package/lib/facade.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
var Dt = Object.defineProperty;
|
|
2
|
-
var Mt = (
|
|
3
|
-
var _ = (
|
|
4
|
-
import { Inject as l, Injector as p, ICommandService as S, IPermissionService as K, IAuthzIoService as ee, LocaleService as wt, generateRandomId as St, Rectangle as B, cellToRange as Wt, HorizontalAlign as L, VerticalAlign as z, RANGE_TYPE as f, ILogService as Ct, Direction as
|
|
2
|
+
var Mt = (s, e, t) => e in s ? Dt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var _ = (s, e, t) => Mt(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Inject as l, Injector as p, ICommandService as S, IPermissionService as K, IAuthzIoService as ee, LocaleService as wt, generateRandomId as St, Rectangle as B, cellToRange as Wt, HorizontalAlign as L, VerticalAlign as z, RANGE_TYPE as f, ILogService as Ct, Direction as ne, BooleanNumber as C, WrapStrategy as ae, ObjectMatrix as ke, covertCellValue as Ee, TextStyleValue as Ke, RichTextValue as F, DEFAULT_STYLES as Je, covertCellValues as qe, Dimension as H, isNullCell as J, mergeWorksheetSnapshotWithDefault as Ye, Tools as Ze, UndoCommand as Nt, RedoCommand as jt, toDisposable as kt, UniverInstanceType as T, IResourceLoaderService as Ot, IUniverInstanceService as Ue, CanceledError as y } from "@univerjs/core";
|
|
5
5
|
import { FBase as Be, FBaseInitialable as Fe, FUniver as bt, FEnum as Tt, FEventName as Vt } from "@univerjs/core/facade";
|
|
6
|
-
import { WorksheetProtectionRuleModel as It, RangeProtectionRuleModel as te, WorksheetProtectionPointModel as He, SetDefinedNameCommand as xe, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as X, RemoveDefinedNameCommand as At, WorkbookPermissionService as Bt, PermissionPointsDefinitions as Ft, WorkbookEditablePermission as $e, UnitObject as W, AddWorksheetProtectionMutation as Ht, DeleteWorksheetProtectionMutation as $t, getAllWorksheetPermissionPoint as Lt, getAllWorksheetPermissionPointByPointPanel as Qe, SetWorksheetPermissionPointsMutation as zt, AddRangeProtectionMutation as Le, DeleteRangeProtectionMutation as Se, SetRangeProtectionMutation as De, WorksheetEditPermission as ft, WorksheetViewPermission as vt, getPrimaryForRange as he, SetSelectionsOperation as ze, getNextPrimaryCell as Gt, WorkbookCopySheetPermission as Kt, WorkbookDeleteColumnPermission as Jt, WorkbookDeleteRowPermission as qt, WorkbookInsertColumnPermission as Yt, WorkbookInsertRowPermission as Zt, WorkbookCreateProtectPermission as Qt, WorkbookRecoverHistoryPermission as Xt, WorkbookHistoryPermission as
|
|
7
|
-
import { IDefinedNamesService as Ut, serializeRange as Ge, deserializeRangeWithSheet as
|
|
8
|
-
import { BehaviorSubject as de, Subject as
|
|
6
|
+
import { WorksheetProtectionRuleModel as It, RangeProtectionRuleModel as te, WorksheetProtectionPointModel as He, SetDefinedNameCommand as xe, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as X, RemoveDefinedNameCommand as At, WorkbookPermissionService as Bt, PermissionPointsDefinitions as Ft, WorkbookEditablePermission as $e, UnitObject as W, AddWorksheetProtectionMutation as Ht, DeleteWorksheetProtectionMutation as $t, getAllWorksheetPermissionPoint as Lt, getAllWorksheetPermissionPointByPointPanel as Qe, SetWorksheetPermissionPointsMutation as zt, AddRangeProtectionMutation as Le, DeleteRangeProtectionMutation as Se, SetRangeProtectionMutation as De, WorksheetEditPermission as ft, WorksheetViewPermission as vt, getPrimaryForRange as he, SetSelectionsOperation as ze, getNextPrimaryCell as Gt, WorkbookCopySheetPermission as Kt, WorkbookDeleteColumnPermission as Jt, WorkbookDeleteRowPermission as qt, WorkbookInsertColumnPermission as Yt, WorkbookInsertRowPermission as Zt, WorkbookCreateProtectPermission as Qt, WorkbookRecoverHistoryPermission as Xt, WorkbookHistoryPermission as en, WorkbookViewHistoryPermission as tn, WorkbookHideSheetPermission as nn, WorkbookMoveSheetPermission as sn, WorkbookRenameSheetPermission as rn, WorkbookDeleteSheetPermission as on, WorkbookCreateSheetPermission as an, WorkbookManageCollaboratorPermission as hn, WorkbookCommentPermission as cn, WorkbookDuplicatePermission as dn, WorkbookCopyPermission as un, WorkbookSharePermission as ln, WorkbookExportPermission as mn, WorkbookPrintPermission as gn, WorkbookViewPermission as _n, WorksheetSelectUnProtectedCellsPermission as wn, WorksheetSelectProtectedCellsPermission as Sn, WorksheetDeleteProtectionPermission as Cn, WorksheetManageCollaboratorPermission as kn, WorksheetEditExtraObjectPermission as bn, WorksheetInsertHyperlinkPermission as In, WorksheetPivotTablePermission as fn, WorksheetFilterPermission as vn, WorksheetSortPermission as pn, WorksheetDeleteColumnPermission as Rn, WorksheetDeleteRowPermission as Pn, WorksheetInsertColumnPermission as yn, WorksheetInsertRowPermission as En, WorksheetSetColumnStylePermission as Un, WorksheetSetRowStylePermission as xn, WorksheetSetCellStylePermission as Dn, WorksheetSetCellValuePermission as Mn, WorksheetCopyPermission as Wn, RangeProtectionPermissionDeleteProtectionPoint as Nn, RangeProtectionPermissionManageCollaPoint as jn, RangeProtectionPermissionViewPoint as On, RangeProtectionPermissionEditPoint as Tn, ViewStateEnum as V, EditStateEnum as A, SheetsSelectionsService as pt, SetWorksheetDefaultStyleMutation as Vn, SetColDataCommand as Xe, SetRowDataCommand as et, copyRangeStyles as se, InsertRowByRangeCommand as tt, RemoveRowByRangeCommand as An, MoveRowsCommand as Bn, SetRowHiddenCommand as nt, SetSpecificRowsVisibleCommand as st, SetTextWrapCommand as Me, SetWorksheetRowIsAutoHeightMutation as Fn, SetRowHeightCommand as it, SetWorksheetRowIsAutoHeightCommand as be, InsertColByRangeCommand as rt, RemoveColByRangeCommand as Hn, MoveColsCommand as $n, SetColHiddenCommand as ot, SetSpecificColsVisibleCommand as at, SetColWidthCommand as Ln, SetFrozenCommand as Ie, CancelFrozenCommand as zn, ToggleGridlinesCommand as We, SetGridlinesColorCommand as Ne, SetTabColorCommand as Gn, SetRangeValuesMutation as ht, SetWorksheetHideCommand as Kn, SetWorksheetShowCommand as Jn, SetWorksheetNameCommand as je, ClearSelectionAllCommand as Rt, ClearSelectionContentCommand as Pt, ClearSelectionFormatCommand as yt, AppendRowCommand as qn, SetWorksheetRowCountCommand as Yn, SetWorksheetColumnCountCommand as Zn, SetBorderBasicCommand as Qn, SetStyleCommand as D, SetTextRotationCommand as Xn, SetRangeValuesCommand as q, SetVerticalTextAlignCommand as es, SetHorizontalTextAlignCommand as ts, addMergeCellsUtil as fe, getAddMergeMutationRangeByType as ct, RemoveWorksheetMergeCommand as ns, SplitTextToColumnsCommand as ss, SetWorksheetRangeThemeStyleCommand as is, DeleteWorksheetRangeThemeStyleCommand as rs, SheetRangeThemeService as Et, InsertRangeMoveDownCommand as os, InsertRangeMoveRightCommand as as, DeleteRangeMoveUpCommand as hs, DeleteRangeMoveLeftCommand as cs, SetWorkbookNameCommand as ds, InsertSheetCommand as ce, SetWorksheetActiveOperation as Z, RemoveSheetCommand as Oe, CopySheetCommand as us, SetWorksheetOrderCommand as ls, RegisterWorksheetRangeThemeStyleCommand as ms, UnregisterWorksheetRangeThemeStyleCommand as gs, RangeThemeStyle as _s, SetWorksheetOrderMutation as dt, SetTabColorMutation as ut, SetWorksheetHideMutation as lt, COMMAND_LISTENER_VALUE_CHANGE as ws, getValueChangedEffectedRange as Ss, SheetsFreezeSyncController as Cs, SheetValueChangeType as ks, SheetSkeletonChangeType as bs, SplitDelimiterEnum as Is } from "@univerjs/sheets";
|
|
7
|
+
import { IDefinedNamesService as Ut, serializeRange as Ge, deserializeRangeWithSheet as fs, serializeRangeWithSheet as vs, FormulaDataModel as ps } from "@univerjs/engine-formula";
|
|
8
|
+
import { BehaviorSubject as de, Subject as Rs } from "rxjs";
|
|
9
9
|
import { filter as R, distinctUntilChanged as ue, shareReplay as x, map as le } from "rxjs/operators";
|
|
10
|
-
var
|
|
11
|
-
for (var i =
|
|
12
|
-
(o =
|
|
10
|
+
var Ps = Object.getOwnPropertyDescriptor, ys = (s, e, t, n) => {
|
|
11
|
+
for (var i = n > 1 ? void 0 : n ? Ps(e, t) : e, r = s.length - 1, o; r >= 0; r--)
|
|
12
|
+
(o = s[r]) && (i = o(i) || i);
|
|
13
13
|
return i;
|
|
14
|
-
}, E = (
|
|
15
|
-
function
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
14
|
+
}, E = (s, e) => (t, n) => e(t, n, s);
|
|
15
|
+
function Es(s, e, t) {
|
|
16
|
+
const n = t.getDefinedNameMap(s);
|
|
17
|
+
if (n == null)
|
|
18
18
|
return e.t("definedName.defaultName") + 1;
|
|
19
|
-
const r = Array.from(Object.values(
|
|
20
|
-
if (t.getValueByName(
|
|
19
|
+
const r = Array.from(Object.values(n)).length + 1, o = e.t("definedName.defaultName") + r;
|
|
20
|
+
if (t.getValueByName(s, o) == null)
|
|
21
21
|
return o;
|
|
22
22
|
let a = r + 1;
|
|
23
23
|
for (; ; ) {
|
|
24
24
|
const h = e.t("definedName.defaultName") + a;
|
|
25
|
-
if (t.getValueByName(
|
|
25
|
+
if (t.getValueByName(s, h) == null)
|
|
26
26
|
return h;
|
|
27
27
|
a++;
|
|
28
28
|
}
|
|
@@ -106,10 +106,10 @@ class Ce {
|
|
|
106
106
|
* fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
|
|
107
107
|
* ```
|
|
108
108
|
*/
|
|
109
|
-
setRefByRange(e, t,
|
|
109
|
+
setRefByRange(e, t, n, i) {
|
|
110
110
|
return this._definedNameParam.formulaOrRefString = Ge({
|
|
111
111
|
startRow: e,
|
|
112
|
-
endRow: e + (
|
|
112
|
+
endRow: e + (n != null ? n : 1) - 1,
|
|
113
113
|
startColumn: t,
|
|
114
114
|
endColumn: t + (i != null ? i : 1) - 1
|
|
115
115
|
}), this;
|
|
@@ -231,11 +231,11 @@ class Ce {
|
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
let me = class extends Be {
|
|
234
|
-
constructor(
|
|
235
|
-
super(), this._definedNameParam =
|
|
234
|
+
constructor(s, e, t, n, i, r, o, a, h, c) {
|
|
235
|
+
super(), this._definedNameParam = s, this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = i, this._rangeProtectionRuleModel = r, this._worksheetProtectionPointRuleModel = o, this._authzIoService = a, this._localeService = h, this._definedNamesService = c;
|
|
236
236
|
}
|
|
237
237
|
_apply() {
|
|
238
|
-
this._definedNameParam.name === "" && (this._definedNameParam.name =
|
|
238
|
+
this._definedNameParam.name === "" && (this._definedNameParam.name = Es(this._definedNameParam.unitId, this._localeService, this._definedNamesService)), this._commandService.syncExecuteCommand(xe.id, this._definedNameParam);
|
|
239
239
|
}
|
|
240
240
|
/**
|
|
241
241
|
* Gets the name of the defined name.
|
|
@@ -260,8 +260,8 @@ let me = class extends Be {
|
|
|
260
260
|
* definedName?.setName('NewDefinedName');
|
|
261
261
|
* ```
|
|
262
262
|
*/
|
|
263
|
-
setName(
|
|
264
|
-
this._definedNameParam.name =
|
|
263
|
+
setName(s) {
|
|
264
|
+
this._definedNameParam.name = s, this._apply();
|
|
265
265
|
}
|
|
266
266
|
/**
|
|
267
267
|
* Sets the formula of the defined name.
|
|
@@ -273,8 +273,8 @@ let me = class extends Be {
|
|
|
273
273
|
* definedName?.setFormula('SUM(Sheet1!$A$1)');
|
|
274
274
|
* ```
|
|
275
275
|
*/
|
|
276
|
-
setFormula(
|
|
277
|
-
this._definedNameParam.formulaOrRefString = `=${
|
|
276
|
+
setFormula(s) {
|
|
277
|
+
this._definedNameParam.formulaOrRefString = `=${s}`, this._apply();
|
|
278
278
|
}
|
|
279
279
|
/**
|
|
280
280
|
* Sets the reference of the defined name.
|
|
@@ -286,8 +286,8 @@ let me = class extends Be {
|
|
|
286
286
|
* definedName?.setRef('Sheet1!$A$1');
|
|
287
287
|
* ```
|
|
288
288
|
*/
|
|
289
|
-
setRef(
|
|
290
|
-
this._definedNameParam.formulaOrRefString =
|
|
289
|
+
setRef(s) {
|
|
290
|
+
this._definedNameParam.formulaOrRefString = s, this._apply();
|
|
291
291
|
}
|
|
292
292
|
/**
|
|
293
293
|
* Gets the formula or reference string of the defined name.
|
|
@@ -315,12 +315,12 @@ let me = class extends Be {
|
|
|
315
315
|
* definedName?.setRefByRange(1, 3, 2, 5); // D2:H3
|
|
316
316
|
* ```
|
|
317
317
|
*/
|
|
318
|
-
setRefByRange(
|
|
318
|
+
setRefByRange(s, e, t, n) {
|
|
319
319
|
this._definedNameParam.formulaOrRefString = Ge({
|
|
320
|
-
startRow:
|
|
321
|
-
endRow:
|
|
320
|
+
startRow: s,
|
|
321
|
+
endRow: s + (t != null ? t : 1) - 1,
|
|
322
322
|
startColumn: e,
|
|
323
|
-
endColumn: e + (
|
|
323
|
+
endColumn: e + (n != null ? n : 1) - 1
|
|
324
324
|
}), this._apply();
|
|
325
325
|
}
|
|
326
326
|
/**
|
|
@@ -346,8 +346,8 @@ let me = class extends Be {
|
|
|
346
346
|
* definedName?.setComment('This is a comment');
|
|
347
347
|
* ```
|
|
348
348
|
*/
|
|
349
|
-
setComment(
|
|
350
|
-
this._definedNameParam.comment =
|
|
349
|
+
setComment(s) {
|
|
350
|
+
this._definedNameParam.comment = s, this._apply();
|
|
351
351
|
}
|
|
352
352
|
/**
|
|
353
353
|
* Sets the scope of the defined name to the worksheet.
|
|
@@ -362,8 +362,8 @@ let me = class extends Be {
|
|
|
362
362
|
* definedName?.setScopeToWorksheet(sheets[1]);
|
|
363
363
|
* ```
|
|
364
364
|
*/
|
|
365
|
-
setScopeToWorksheet(
|
|
366
|
-
this._definedNameParam.localSheetId =
|
|
365
|
+
setScopeToWorksheet(s) {
|
|
366
|
+
this._definedNameParam.localSheetId = s.getSheetId(), this._apply();
|
|
367
367
|
}
|
|
368
368
|
/**
|
|
369
369
|
* Sets the scope of the defined name to the workbook.
|
|
@@ -387,8 +387,8 @@ let me = class extends Be {
|
|
|
387
387
|
* definedName?.setHidden(true);
|
|
388
388
|
* ```
|
|
389
389
|
*/
|
|
390
|
-
setHidden(
|
|
391
|
-
this._definedNameParam.hidden =
|
|
390
|
+
setHidden(s) {
|
|
391
|
+
this._definedNameParam.hidden = s, this._apply();
|
|
392
392
|
}
|
|
393
393
|
/**
|
|
394
394
|
* Deletes the defined name.
|
|
@@ -445,11 +445,11 @@ let me = class extends Be {
|
|
|
445
445
|
* ```
|
|
446
446
|
*/
|
|
447
447
|
toBuilder() {
|
|
448
|
-
const
|
|
449
|
-
return
|
|
448
|
+
const s = this._injector.createInstance(Ce);
|
|
449
|
+
return s.load(this._definedNameParam), s;
|
|
450
450
|
}
|
|
451
451
|
};
|
|
452
|
-
me =
|
|
452
|
+
me = ys([
|
|
453
453
|
E(1, l(p)),
|
|
454
454
|
E(2, S),
|
|
455
455
|
E(3, K),
|
|
@@ -460,13 +460,13 @@ me = yn([
|
|
|
460
460
|
E(8, l(wt)),
|
|
461
461
|
E(9, Ut)
|
|
462
462
|
], me);
|
|
463
|
-
var
|
|
464
|
-
for (var i =
|
|
465
|
-
(o =
|
|
463
|
+
var Us = Object.getOwnPropertyDescriptor, xs = (s, e, t, n) => {
|
|
464
|
+
for (var i = n > 1 ? void 0 : n ? Us(e, t) : e, r = s.length - 1, o; r >= 0; r--)
|
|
465
|
+
(o = s[r]) && (i = o(i) || i);
|
|
466
466
|
return i;
|
|
467
|
-
}, M = (
|
|
467
|
+
}, M = (s, e) => (t, n) => e(t, n, s);
|
|
468
468
|
let ge = class extends Be {
|
|
469
|
-
constructor(e, t,
|
|
469
|
+
constructor(e, t, n, i, r, o, a, h) {
|
|
470
470
|
super();
|
|
471
471
|
/**
|
|
472
472
|
* Permission point definition, can read the point constructor want to modify from here
|
|
@@ -484,7 +484,7 @@ let ge = class extends Be {
|
|
|
484
484
|
* An observable object used to monitor the initialization state changes of unit permissions.
|
|
485
485
|
*/
|
|
486
486
|
_(this, "unitPermissionInitStateChange$");
|
|
487
|
-
this._injector = e, this._commandService = t, this._permissionService =
|
|
487
|
+
this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = i, this._rangeProtectionRuleModel = r, this._worksheetProtectionPointRuleModel = o, this._workbookPermissionService = a, this._authzIoService = h, this.rangeRuleChangedAfterAuth$ = this._rangeProtectionRuleModel.ruleRefresh$, this.sheetRuleChangedAfterAuth$ = this._worksheetProtectionRuleModel.ruleRefresh$, this.unitPermissionInitStateChange$ = this._workbookPermissionService.unitPermissionInitStateChange$;
|
|
488
488
|
}
|
|
489
489
|
/**
|
|
490
490
|
* Configures a specific permission point for a workbook.
|
|
@@ -502,9 +502,9 @@ let ge = class extends Be {
|
|
|
502
502
|
* permission.setWorkbookPermissionPoint(unitId, permission.permissionPointsDefinition.WorkbookEditablePermission, false)
|
|
503
503
|
* ```
|
|
504
504
|
*/
|
|
505
|
-
setWorkbookPermissionPoint(e, t,
|
|
505
|
+
setWorkbookPermissionPoint(e, t, n) {
|
|
506
506
|
const i = new t(e);
|
|
507
|
-
this._permissionService.getPermissionPoint(i.id) || this._permissionService.addPermissionPoint(i), this._permissionService.updatePermissionPoint(i.id,
|
|
507
|
+
this._permissionService.getPermissionPoint(i.id) || this._permissionService.addPermissionPoint(i), this._permissionService.updatePermissionPoint(i.id, n);
|
|
508
508
|
}
|
|
509
509
|
/**
|
|
510
510
|
* Check if a specific permission point is enabled for a workbook.
|
|
@@ -522,7 +522,7 @@ let ge = class extends Be {
|
|
|
522
522
|
* ```
|
|
523
523
|
*/
|
|
524
524
|
checkWorkbookPermissionPoint(e, t) {
|
|
525
|
-
const
|
|
525
|
+
const n = new t(e), i = this._permissionService.getPermissionPoint(n.id);
|
|
526
526
|
if (i)
|
|
527
527
|
return i.value;
|
|
528
528
|
}
|
|
@@ -608,8 +608,8 @@ let ge = class extends Be {
|
|
|
608
608
|
this._commandService.syncExecuteCommand($t.id, {
|
|
609
609
|
unitId: e,
|
|
610
610
|
subUnitId: t
|
|
611
|
-
}), [...Lt(), ...Qe()].forEach((
|
|
612
|
-
const i = new
|
|
611
|
+
}), [...Lt(), ...Qe()].forEach((n) => {
|
|
612
|
+
const i = new n(e, t);
|
|
613
613
|
this._permissionService.updatePermissionPoint(i.id, !0);
|
|
614
614
|
}), this._worksheetProtectionPointRuleModel.deleteRule(e, t);
|
|
615
615
|
}
|
|
@@ -635,10 +635,10 @@ let ge = class extends Be {
|
|
|
635
635
|
* permission.setWorksheetPermissionPoint(unitId, subUnitId, permission.permissionPointsDefinition.WorksheetEditPermission, false);
|
|
636
636
|
* ```
|
|
637
637
|
*/
|
|
638
|
-
async setWorksheetPermissionPoint(e, t,
|
|
638
|
+
async setWorksheetPermissionPoint(e, t, n, i) {
|
|
639
639
|
const r = this._worksheetProtectionRuleModel.getRule(e, t);
|
|
640
640
|
let o;
|
|
641
|
-
if (
|
|
641
|
+
if (n === ft || n === vt)
|
|
642
642
|
if (r)
|
|
643
643
|
o = r.permissionId;
|
|
644
644
|
else {
|
|
@@ -659,7 +659,7 @@ let ge = class extends Be {
|
|
|
659
659
|
}
|
|
660
660
|
}), this._commandService.syncExecuteCommand(zt.id, { unitId: e, subUnitId: t, rule: { unitId: e, subUnitId: t, permissionId: o } }));
|
|
661
661
|
}
|
|
662
|
-
const h = new
|
|
662
|
+
const h = new n(e, t);
|
|
663
663
|
return this._permissionService.getPermissionPoint(h.id) || this._permissionService.addPermissionPoint(h), this._permissionService.updatePermissionPoint(h.id, i), o;
|
|
664
664
|
}
|
|
665
665
|
/**
|
|
@@ -681,8 +681,8 @@ let ge = class extends Be {
|
|
|
681
681
|
* console.log('Worksheet is editable:', isEditable);
|
|
682
682
|
* ```
|
|
683
683
|
*/
|
|
684
|
-
checkWorksheetPermissionPoint(e, t,
|
|
685
|
-
const i = new
|
|
684
|
+
checkWorksheetPermissionPoint(e, t, n) {
|
|
685
|
+
const i = new n(e, t), r = this._permissionService.getPermissionPoint(i.id);
|
|
686
686
|
if (r)
|
|
687
687
|
return r.value;
|
|
688
688
|
}
|
|
@@ -721,7 +721,7 @@ let ge = class extends Be {
|
|
|
721
721
|
* }]);
|
|
722
722
|
* ```
|
|
723
723
|
*/
|
|
724
|
-
async addRangeBaseProtection(e, t,
|
|
724
|
+
async addRangeBaseProtection(e, t, n) {
|
|
725
725
|
const i = await this._authzIoService.create({
|
|
726
726
|
objectType: W.SelectRange,
|
|
727
727
|
selectRangeObject: {
|
|
@@ -733,7 +733,7 @@ let ge = class extends Be {
|
|
|
733
733
|
}), r = `ruleId_${St(6)}`;
|
|
734
734
|
if (this._worksheetProtectionRuleModel.getRule(e, t))
|
|
735
735
|
throw new Error("sheet protection cannot intersect with range protection");
|
|
736
|
-
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((d) => d.ranges.some((w) =>
|
|
736
|
+
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((d) => d.ranges.some((w) => n.some((g) => B.intersects(g.getRange(), w)))))
|
|
737
737
|
throw new Error("range protection cannot intersect");
|
|
738
738
|
if (this._commandService.syncExecuteCommand(Le.id, {
|
|
739
739
|
unitId: e,
|
|
@@ -743,7 +743,7 @@ let ge = class extends Be {
|
|
|
743
743
|
unitType: W.SelectRange,
|
|
744
744
|
unitId: e,
|
|
745
745
|
subUnitId: t,
|
|
746
|
-
ranges:
|
|
746
|
+
ranges: n.map((d) => d.getRange()),
|
|
747
747
|
id: r
|
|
748
748
|
}]
|
|
749
749
|
}))
|
|
@@ -780,11 +780,11 @@ let ge = class extends Be {
|
|
|
780
780
|
* await permission.unprotectRules([ruleId]);
|
|
781
781
|
* ```
|
|
782
782
|
*/
|
|
783
|
-
removeRangeProtection(e, t,
|
|
783
|
+
removeRangeProtection(e, t, n) {
|
|
784
784
|
this._commandService.syncExecuteCommand(Se.id, {
|
|
785
785
|
unitId: e,
|
|
786
786
|
subUnitId: t,
|
|
787
|
-
ruleIds:
|
|
787
|
+
ruleIds: n
|
|
788
788
|
}) && this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length === 0 && (this._worksheetProtectionPointRuleModel.deleteRule(e, t), [...Qe()].forEach((o) => {
|
|
789
789
|
const a = new o(e, t);
|
|
790
790
|
this._permissionService.updatePermissionPoint(a.id, a.value);
|
|
@@ -817,8 +817,8 @@ let ge = class extends Be {
|
|
|
817
817
|
* permission.setRangeProtectionPermissionPoint(unitId,subUnitId,permissionId, permission.permissionPointsDefinition.RangeProtectionPermissionEditPoint, false);
|
|
818
818
|
* ```
|
|
819
819
|
*/
|
|
820
|
-
setRangeProtectionPermissionPoint(e, t,
|
|
821
|
-
const o = new i(e, t,
|
|
820
|
+
setRangeProtectionPermissionPoint(e, t, n, i, r) {
|
|
821
|
+
const o = new i(e, t, n);
|
|
822
822
|
this._permissionService.getPermissionPoint(o.id) || this._permissionService.addPermissionPoint(o), this._permissionService.updatePermissionPoint(o.id, r);
|
|
823
823
|
}
|
|
824
824
|
/**
|
|
@@ -848,15 +848,15 @@ let ge = class extends Be {
|
|
|
848
848
|
* permission.setRangeProtectionRanges(unitId, subUnitId, ruleId, [newRange]);
|
|
849
849
|
* ```
|
|
850
850
|
*/
|
|
851
|
-
setRangeProtectionRanges(e, t,
|
|
852
|
-
const r = this._rangeProtectionRuleModel.getRule(e, t,
|
|
851
|
+
setRangeProtectionRanges(e, t, n, i) {
|
|
852
|
+
const r = this._rangeProtectionRuleModel.getRule(e, t, n);
|
|
853
853
|
if (r) {
|
|
854
|
-
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !==
|
|
854
|
+
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !== n).some((h) => h.ranges.some((c) => i.some((d) => B.intersects(d.getRange(), c)))))
|
|
855
855
|
throw new Error("range protection cannot intersect");
|
|
856
856
|
this._commandService.syncExecuteCommand(De.id, {
|
|
857
857
|
unitId: e,
|
|
858
858
|
subUnitId: t,
|
|
859
|
-
ruleId:
|
|
859
|
+
ruleId: n,
|
|
860
860
|
rule: {
|
|
861
861
|
...r,
|
|
862
862
|
ranges: i.map((h) => h.getRange())
|
|
@@ -901,8 +901,8 @@ let ge = class extends Be {
|
|
|
901
901
|
* }
|
|
902
902
|
* ```
|
|
903
903
|
*/
|
|
904
|
-
getPermissionInfoWithCell(e, t,
|
|
905
|
-
const r = Wt(
|
|
904
|
+
getPermissionInfoWithCell(e, t, n, i) {
|
|
905
|
+
const r = Wt(n, i), o = this._rangeProtectionRuleModel.getSubunitRuleList(e, t).find((a) => a.ranges.some((c) => B.intersects(r, c)));
|
|
906
906
|
if (o)
|
|
907
907
|
return {
|
|
908
908
|
permissionId: o.permissionId,
|
|
@@ -910,7 +910,7 @@ let ge = class extends Be {
|
|
|
910
910
|
};
|
|
911
911
|
}
|
|
912
912
|
};
|
|
913
|
-
ge =
|
|
913
|
+
ge = xs([
|
|
914
914
|
M(0, l(p)),
|
|
915
915
|
M(1, S),
|
|
916
916
|
M(2, K),
|
|
@@ -920,14 +920,14 @@ ge = xn([
|
|
|
920
920
|
M(6, l(Bt)),
|
|
921
921
|
M(7, l(ee))
|
|
922
922
|
], ge);
|
|
923
|
-
var
|
|
924
|
-
for (var i =
|
|
925
|
-
(o =
|
|
923
|
+
var Ds = Object.getOwnPropertyDescriptor, Ms = (s, e, t, n) => {
|
|
924
|
+
for (var i = n > 1 ? void 0 : n ? Ds(e, t) : e, r = s.length - 1, o; r >= 0; r--)
|
|
925
|
+
(o = s[r]) && (i = o(i) || i);
|
|
926
926
|
return i;
|
|
927
|
-
},
|
|
927
|
+
}, Ws = (s, e) => (t, n) => e(t, n, s);
|
|
928
928
|
let _e = class {
|
|
929
|
-
constructor(
|
|
930
|
-
this._workbook =
|
|
929
|
+
constructor(s, e, t, n) {
|
|
930
|
+
this._workbook = s, this._worksheet = e, this._selections = t, this._injector = n;
|
|
931
931
|
}
|
|
932
932
|
/**
|
|
933
933
|
* Represents the active selection in the sheet. Which means the selection contains the active cell.
|
|
@@ -943,8 +943,8 @@ let _e = class {
|
|
|
943
943
|
* ```
|
|
944
944
|
*/
|
|
945
945
|
getActiveRange() {
|
|
946
|
-
const
|
|
947
|
-
return
|
|
946
|
+
const s = this._selections.find((e) => !!e.primary);
|
|
947
|
+
return s ? this._injector.createInstance(I, this._workbook, this._worksheet, s.range) : null;
|
|
948
948
|
}
|
|
949
949
|
/**
|
|
950
950
|
* Represents the active selection list in the sheet.
|
|
@@ -961,7 +961,7 @@ let _e = class {
|
|
|
961
961
|
* ```
|
|
962
962
|
*/
|
|
963
963
|
getActiveRangeList() {
|
|
964
|
-
return this._selections.map((
|
|
964
|
+
return this._selections.map((s) => this._injector.createInstance(I, this._workbook, this._worksheet, s.range));
|
|
965
965
|
}
|
|
966
966
|
/**
|
|
967
967
|
* Represents the current select cell in the sheet.
|
|
@@ -980,8 +980,8 @@ let _e = class {
|
|
|
980
980
|
* ```
|
|
981
981
|
*/
|
|
982
982
|
getCurrentCell() {
|
|
983
|
-
const
|
|
984
|
-
return
|
|
983
|
+
const s = this._selections.find((e) => !!e.primary);
|
|
984
|
+
return s ? s.primary : null;
|
|
985
985
|
}
|
|
986
986
|
/**
|
|
987
987
|
* Returns the active sheet in the spreadsheet.
|
|
@@ -996,8 +996,8 @@ let _e = class {
|
|
|
996
996
|
* ```
|
|
997
997
|
*/
|
|
998
998
|
getActiveSheet() {
|
|
999
|
-
const
|
|
1000
|
-
return this._injector.createInstance(b,
|
|
999
|
+
const s = this._injector.createInstance(v, this._workbook);
|
|
1000
|
+
return this._injector.createInstance(b, s, this._workbook, this._worksheet);
|
|
1001
1001
|
}
|
|
1002
1002
|
/**
|
|
1003
1003
|
* 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.
|
|
@@ -1020,23 +1020,23 @@ let _e = class {
|
|
|
1020
1020
|
* console.log(`actualRow: ${actualRow}, actualColumn: ${actualColumn}`); // actualRow: 10, actualColumn: 1
|
|
1021
1021
|
* ```
|
|
1022
1022
|
*/
|
|
1023
|
-
updatePrimaryCell(
|
|
1023
|
+
updatePrimaryCell(s) {
|
|
1024
1024
|
const e = this._injector.get(S);
|
|
1025
|
-
let t = [],
|
|
1025
|
+
let t = [], n = !1;
|
|
1026
1026
|
for (const { range: r, style: o } of this._selections)
|
|
1027
|
-
B.contains(r,
|
|
1027
|
+
B.contains(r, s.getRange()) ? (t.push({
|
|
1028
1028
|
range: r,
|
|
1029
|
-
primary: he(
|
|
1029
|
+
primary: he(s.getRange(), this._worksheet),
|
|
1030
1030
|
style: o
|
|
1031
|
-
}),
|
|
1031
|
+
}), n = !0) : t.push({
|
|
1032
1032
|
range: r,
|
|
1033
1033
|
primary: null,
|
|
1034
1034
|
style: o
|
|
1035
1035
|
});
|
|
1036
|
-
|
|
1036
|
+
n || (t = [
|
|
1037
1037
|
{
|
|
1038
|
-
range:
|
|
1039
|
-
primary: he(
|
|
1038
|
+
range: s.getRange(),
|
|
1039
|
+
primary: he(s.getRange(), this._worksheet)
|
|
1040
1040
|
}
|
|
1041
1041
|
]);
|
|
1042
1042
|
const i = {
|
|
@@ -1071,24 +1071,24 @@ let _e = class {
|
|
|
1071
1071
|
* console.log(nextCell2?.getA1Notation()); // A2
|
|
1072
1072
|
* ```
|
|
1073
1073
|
*/
|
|
1074
|
-
getNextDataRange(
|
|
1075
|
-
if (!this._selections.find((
|
|
1074
|
+
getNextDataRange(s) {
|
|
1075
|
+
if (!this._selections.find((n) => !!n.primary))
|
|
1076
1076
|
return null;
|
|
1077
|
-
const t = Gt(this._selections.concat(),
|
|
1077
|
+
const t = Gt(this._selections.concat(), s, this._worksheet);
|
|
1078
1078
|
return t ? this._injector.createInstance(I, this._workbook, this._worksheet, t) : null;
|
|
1079
1079
|
}
|
|
1080
1080
|
};
|
|
1081
|
-
_e =
|
|
1082
|
-
|
|
1081
|
+
_e = Ms([
|
|
1082
|
+
Ws(3, l(p))
|
|
1083
1083
|
], _e);
|
|
1084
|
-
var we = /* @__PURE__ */ ((
|
|
1085
|
-
for (var i =
|
|
1086
|
-
(o =
|
|
1084
|
+
var we = /* @__PURE__ */ ((s) => (s[s.Reader = 0] = "Reader", s[s.Editor = 1] = "Editor", s[s.Owner = 2] = "Owner", s[s.UNRECOGNIZED = -1] = "UNRECOGNIZED", s))(we || {}), Ns = Object.getOwnPropertyDescriptor, js = (s, e, t, n) => {
|
|
1085
|
+
for (var i = n > 1 ? void 0 : n ? Ns(e, t) : e, r = s.length - 1, o; r >= 0; r--)
|
|
1086
|
+
(o = s[r]) && (i = o(i) || i);
|
|
1087
1087
|
return i;
|
|
1088
|
-
}, ve = (
|
|
1088
|
+
}, ve = (s, e) => (t, n) => e(t, n, s);
|
|
1089
1089
|
let N = class {
|
|
1090
|
-
constructor(
|
|
1091
|
-
this._unitId =
|
|
1090
|
+
constructor(s, e, t, n, i, r, o, a, h) {
|
|
1091
|
+
this._unitId = s, this._subUnitId = e, this._ruleId = t, this._permissionId = n, this._ranges = i, this._options = r, this._injector = o, this._commandService = a, this._rangeProtectionRuleModel = h;
|
|
1092
1092
|
}
|
|
1093
1093
|
/**
|
|
1094
1094
|
* Get the rule ID.
|
|
@@ -1148,15 +1148,15 @@ let N = class {
|
|
|
1148
1148
|
* await rule?.updateRanges([worksheet.getRange('A1:C3')]);
|
|
1149
1149
|
* ```
|
|
1150
1150
|
*/
|
|
1151
|
-
async updateRanges(
|
|
1152
|
-
if (!
|
|
1151
|
+
async updateRanges(s) {
|
|
1152
|
+
if (!s || s.length === 0)
|
|
1153
1153
|
throw new Error("Ranges cannot be empty");
|
|
1154
1154
|
const e = this._rangeProtectionRuleModel.getRule(this._unitId, this._subUnitId, this._ruleId);
|
|
1155
1155
|
if (!e)
|
|
1156
1156
|
throw new Error(`Rule ${this._ruleId} not found`);
|
|
1157
1157
|
if (this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId, this._subUnitId).filter((i) => i.id !== this._ruleId).some(
|
|
1158
1158
|
(i) => i.ranges.some(
|
|
1159
|
-
(r) =>
|
|
1159
|
+
(r) => s.some((o) => {
|
|
1160
1160
|
const a = o.getRange();
|
|
1161
1161
|
return this._rangesIntersect(a, r);
|
|
1162
1162
|
})
|
|
@@ -1169,9 +1169,9 @@ let N = class {
|
|
|
1169
1169
|
ruleId: this._ruleId,
|
|
1170
1170
|
rule: {
|
|
1171
1171
|
...e,
|
|
1172
|
-
ranges:
|
|
1172
|
+
ranges: s.map((i) => i.getRange())
|
|
1173
1173
|
}
|
|
1174
|
-
}), this._ranges.length = 0, this._ranges.push(...
|
|
1174
|
+
}), this._ranges.length = 0, this._ranges.push(...s);
|
|
1175
1175
|
}
|
|
1176
1176
|
/**
|
|
1177
1177
|
* Update protection options.
|
|
@@ -1186,11 +1186,11 @@ let N = class {
|
|
|
1186
1186
|
* await rule?.updateOptions({ name: 'New Protection Name', allowEdit: true });
|
|
1187
1187
|
* ```
|
|
1188
1188
|
*/
|
|
1189
|
-
async updateOptions(
|
|
1189
|
+
async updateOptions(s) {
|
|
1190
1190
|
const e = this._rangeProtectionRuleModel.getRule(this._unitId, this._subUnitId, this._ruleId);
|
|
1191
1191
|
if (!e)
|
|
1192
1192
|
throw new Error(`Rule ${this._ruleId} not found`);
|
|
1193
|
-
const t = { ...this._options, ...
|
|
1193
|
+
const t = { ...this._options, ...s };
|
|
1194
1194
|
await this._commandService.executeCommand(De.id, {
|
|
1195
1195
|
unitId: this._unitId,
|
|
1196
1196
|
subUnitId: this._subUnitId,
|
|
@@ -1227,33 +1227,33 @@ let N = class {
|
|
|
1227
1227
|
* @returns true if ranges intersect, false otherwise
|
|
1228
1228
|
* @private
|
|
1229
1229
|
*/
|
|
1230
|
-
_rangesIntersect(
|
|
1231
|
-
return !(
|
|
1230
|
+
_rangesIntersect(s, e) {
|
|
1231
|
+
return !(s.endRow < e.startRow || s.startRow > e.endRow || s.endColumn < e.startColumn || s.startColumn > e.endColumn);
|
|
1232
1232
|
}
|
|
1233
1233
|
};
|
|
1234
|
-
N =
|
|
1234
|
+
N = js([
|
|
1235
1235
|
ve(6, l(p)),
|
|
1236
1236
|
ve(7, l(S)),
|
|
1237
1237
|
ve(8, l(te))
|
|
1238
1238
|
], N);
|
|
1239
|
-
var xt = /* @__PURE__ */ ((
|
|
1239
|
+
var xt = /* @__PURE__ */ ((s) => (s[s.Reader = 0] = "Reader", s[s.Editor = 1] = "Editor", s[s.Owner = 2] = "Owner", s))(xt || {}), u = /* @__PURE__ */ ((s) => (s.Edit = "WorkbookEdit", s.View = "WorkbookView", s.Print = "WorkbookPrint", s.Export = "WorkbookExport", s.Share = "WorkbookShare", s.CopyContent = "WorkbookCopy", s.DuplicateFile = "WorkbookDuplicate", s.Comment = "WorkbookComment", s.ManageCollaborator = "WorkbookManageCollaborator", s.CreateSheet = "WorkbookCreateSheet", s.DeleteSheet = "WorkbookDeleteSheet", s.RenameSheet = "WorkbookRenameSheet", s.MoveSheet = "WorkbookMoveSheet", s.HideSheet = "WorkbookHideSheet", s.ViewHistory = "WorkbookViewHistory", s.ManageHistory = "WorkbookHistory", s.RecoverHistory = "WorkbookRecoverHistory", s.CreateProtection = "WorkbookCreateProtect", s.InsertRow = "WorkbookInsertRow", s.InsertColumn = "WorkbookInsertColumn", s.DeleteRow = "WorkbookDeleteRow", s.DeleteColumn = "WorkbookDeleteColumn", s.CopySheet = "WorkbookCopySheet", s))(u || {}), m = /* @__PURE__ */ ((s) => (s.Edit = "WorksheetEdit", s.View = "WorksheetView", s.Copy = "WorksheetCopy", s.SetCellValue = "WorksheetSetCellValue", s.SetCellStyle = "WorksheetSetCellStyle", s.SetRowStyle = "WorksheetSetRowStyle", s.SetColumnStyle = "WorksheetSetColumnStyle", s.InsertRow = "WorksheetInsertRow", s.InsertColumn = "WorksheetInsertColumn", s.DeleteRow = "WorksheetDeleteRow", s.DeleteColumn = "WorksheetDeleteColumn", s.Sort = "WorksheetSort", s.Filter = "WorksheetFilter", s.PivotTable = "WorksheetPivotTable", s.InsertHyperlink = "WorksheetInsertHyperlink", s.EditExtraObject = "WorksheetEditExtraObject", s.ManageCollaborator = "WorksheetManageCollaborator", s.DeleteProtection = "WorksheetDeleteProtection", s.SelectProtectedCells = "WorksheetSelectProtectedCells", s.SelectUnProtectedCells = "WorksheetSelectUnProtectedCells", s))(m || {}), k = /* @__PURE__ */ ((s) => (s.Edit = "RangeEdit", s.View = "RangeView", s.ManageCollaborator = "RangeManageCollaborator", s.Delete = "RangeDeleteProtection", s))(k || {});
|
|
1240
1240
|
const ie = {
|
|
1241
1241
|
[u.Edit]: $e,
|
|
1242
|
-
[u.View]:
|
|
1243
|
-
[u.Print]:
|
|
1244
|
-
[u.Export]:
|
|
1245
|
-
[u.Share]:
|
|
1246
|
-
[u.CopyContent]:
|
|
1247
|
-
[u.DuplicateFile]:
|
|
1248
|
-
[u.Comment]:
|
|
1249
|
-
[u.ManageCollaborator]:
|
|
1250
|
-
[u.CreateSheet]:
|
|
1251
|
-
[u.DeleteSheet]:
|
|
1252
|
-
[u.RenameSheet]:
|
|
1253
|
-
[u.MoveSheet]:
|
|
1254
|
-
[u.HideSheet]:
|
|
1255
|
-
[u.ViewHistory]:
|
|
1256
|
-
[u.ManageHistory]:
|
|
1242
|
+
[u.View]: _n,
|
|
1243
|
+
[u.Print]: gn,
|
|
1244
|
+
[u.Export]: mn,
|
|
1245
|
+
[u.Share]: ln,
|
|
1246
|
+
[u.CopyContent]: un,
|
|
1247
|
+
[u.DuplicateFile]: dn,
|
|
1248
|
+
[u.Comment]: cn,
|
|
1249
|
+
[u.ManageCollaborator]: hn,
|
|
1250
|
+
[u.CreateSheet]: an,
|
|
1251
|
+
[u.DeleteSheet]: on,
|
|
1252
|
+
[u.RenameSheet]: rn,
|
|
1253
|
+
[u.MoveSheet]: sn,
|
|
1254
|
+
[u.HideSheet]: nn,
|
|
1255
|
+
[u.ViewHistory]: tn,
|
|
1256
|
+
[u.ManageHistory]: en,
|
|
1257
1257
|
[u.RecoverHistory]: Xt,
|
|
1258
1258
|
[u.CreateProtection]: Qt,
|
|
1259
1259
|
[u.InsertRow]: Zt,
|
|
@@ -1264,37 +1264,37 @@ const ie = {
|
|
|
1264
1264
|
}, re = {
|
|
1265
1265
|
[m.Edit]: ft,
|
|
1266
1266
|
[m.View]: vt,
|
|
1267
|
-
[m.Copy]:
|
|
1268
|
-
[m.SetCellValue]:
|
|
1269
|
-
[m.SetCellStyle]:
|
|
1270
|
-
[m.SetRowStyle]:
|
|
1271
|
-
[m.SetColumnStyle]:
|
|
1272
|
-
[m.InsertRow]:
|
|
1273
|
-
[m.InsertColumn]:
|
|
1274
|
-
[m.DeleteRow]:
|
|
1275
|
-
[m.DeleteColumn]:
|
|
1276
|
-
[m.Sort]:
|
|
1277
|
-
[m.Filter]:
|
|
1278
|
-
[m.PivotTable]:
|
|
1279
|
-
[m.InsertHyperlink]:
|
|
1280
|
-
[m.EditExtraObject]:
|
|
1281
|
-
[m.ManageCollaborator]:
|
|
1282
|
-
[m.DeleteProtection]:
|
|
1283
|
-
[m.SelectProtectedCells]:
|
|
1284
|
-
[m.SelectUnProtectedCells]:
|
|
1267
|
+
[m.Copy]: Wn,
|
|
1268
|
+
[m.SetCellValue]: Mn,
|
|
1269
|
+
[m.SetCellStyle]: Dn,
|
|
1270
|
+
[m.SetRowStyle]: xn,
|
|
1271
|
+
[m.SetColumnStyle]: Un,
|
|
1272
|
+
[m.InsertRow]: En,
|
|
1273
|
+
[m.InsertColumn]: yn,
|
|
1274
|
+
[m.DeleteRow]: Pn,
|
|
1275
|
+
[m.DeleteColumn]: Rn,
|
|
1276
|
+
[m.Sort]: pn,
|
|
1277
|
+
[m.Filter]: vn,
|
|
1278
|
+
[m.PivotTable]: fn,
|
|
1279
|
+
[m.InsertHyperlink]: In,
|
|
1280
|
+
[m.EditExtraObject]: bn,
|
|
1281
|
+
[m.ManageCollaborator]: kn,
|
|
1282
|
+
[m.DeleteProtection]: Cn,
|
|
1283
|
+
[m.SelectProtectedCells]: Sn,
|
|
1284
|
+
[m.SelectUnProtectedCells]: wn
|
|
1285
1285
|
}, Q = {
|
|
1286
|
-
[k.Edit]:
|
|
1287
|
-
[k.View]:
|
|
1288
|
-
[k.ManageCollaborator]:
|
|
1289
|
-
[k.Delete]:
|
|
1286
|
+
[k.Edit]: Tn,
|
|
1287
|
+
[k.View]: On,
|
|
1288
|
+
[k.ManageCollaborator]: jn,
|
|
1289
|
+
[k.Delete]: Nn
|
|
1290
1290
|
};
|
|
1291
|
-
var
|
|
1292
|
-
for (var i =
|
|
1293
|
-
(o =
|
|
1291
|
+
var Os = Object.getOwnPropertyDescriptor, Ts = (s, e, t, n) => {
|
|
1292
|
+
for (var i = n > 1 ? void 0 : n ? Os(e, t) : e, r = s.length - 1, o; r >= 0; r--)
|
|
1293
|
+
(o = s[r]) && (i = o(i) || i);
|
|
1294
1294
|
return i;
|
|
1295
|
-
}, $ = (
|
|
1295
|
+
}, $ = (s, e) => (t, n) => e(t, n, s);
|
|
1296
1296
|
let Te = class {
|
|
1297
|
-
constructor(
|
|
1297
|
+
constructor(s, e, t, n, i, r, o) {
|
|
1298
1298
|
_(this, "_permissionSubject");
|
|
1299
1299
|
_(this, "_rangeRulesSubject");
|
|
1300
1300
|
/**
|
|
@@ -1320,19 +1320,19 @@ let Te = class {
|
|
|
1320
1320
|
_(this, "_unitId");
|
|
1321
1321
|
_(this, "_subUnitId");
|
|
1322
1322
|
_(this, "_subscriptions", []);
|
|
1323
|
-
this._worksheet =
|
|
1323
|
+
this._worksheet = s, this._injector = e, this._permissionService = t, this._authzIoService = n, this._commandService = i, this._rangeProtectionRuleModel = r, this._worksheetProtectionPointModel = o, this._unitId = this._worksheet.getWorkbook().getUnitId(), this._subUnitId = this._worksheet.getSheetId(), this._permissionSubject = new de(this._buildSnapshot()), this._rangeRulesSubject = new de(this._buildRangeProtectionRules()), this.permission$ = this._createPermissionStream(), this.pointChange$ = this._createPointChangeStream(), this.rangeProtectionChange$ = this._createRangeProtectionChangeStream(), this.rangeProtectionRules$ = this._createRangeProtectionRulesStream();
|
|
1324
1324
|
}
|
|
1325
1325
|
/**
|
|
1326
1326
|
* Create permission snapshot stream from IPermissionService
|
|
1327
1327
|
* @private
|
|
1328
1328
|
*/
|
|
1329
1329
|
_createPermissionStream() {
|
|
1330
|
-
const
|
|
1330
|
+
const s = this._permissionService.permissionPointUpdate$.pipe(
|
|
1331
1331
|
R((e) => e.id.includes(this._unitId) && e.id.includes(this._subUnitId))
|
|
1332
1332
|
).subscribe(() => {
|
|
1333
1333
|
this._permissionSubject.next(this._buildSnapshot());
|
|
1334
1334
|
});
|
|
1335
|
-
return this._subscriptions.push(
|
|
1335
|
+
return this._subscriptions.push(s), this._permissionSubject.asObservable().pipe(
|
|
1336
1336
|
ue((e, t) => JSON.stringify(e) === JSON.stringify(t)),
|
|
1337
1337
|
x({ bufferSize: 1, refCount: !0 })
|
|
1338
1338
|
);
|
|
@@ -1343,17 +1343,17 @@ let Te = class {
|
|
|
1343
1343
|
*/
|
|
1344
1344
|
_createPointChangeStream() {
|
|
1345
1345
|
return this._permissionService.permissionPointUpdate$.pipe(
|
|
1346
|
-
R((
|
|
1347
|
-
le((
|
|
1348
|
-
var t,
|
|
1349
|
-
const e = this._extractWorksheetPointType(
|
|
1346
|
+
R((s) => s.id.includes(this._unitId) && s.id.includes(this._subUnitId)),
|
|
1347
|
+
le((s) => {
|
|
1348
|
+
var t, n;
|
|
1349
|
+
const e = this._extractWorksheetPointType(s.id);
|
|
1350
1350
|
return e ? {
|
|
1351
1351
|
point: e,
|
|
1352
|
-
value: (t =
|
|
1353
|
-
oldValue: !((
|
|
1352
|
+
value: (t = s.value) != null ? t : !1,
|
|
1353
|
+
oldValue: !((n = s.value) != null && n)
|
|
1354
1354
|
} : null;
|
|
1355
1355
|
}),
|
|
1356
|
-
R((
|
|
1356
|
+
R((s) => s !== null),
|
|
1357
1357
|
x({ bufferSize: 1, refCount: !0 })
|
|
1358
1358
|
);
|
|
1359
1359
|
}
|
|
@@ -1363,10 +1363,10 @@ let Te = class {
|
|
|
1363
1363
|
*/
|
|
1364
1364
|
_createRangeProtectionChangeStream() {
|
|
1365
1365
|
return this._rangeProtectionRuleModel.ruleChange$.pipe(
|
|
1366
|
-
R((
|
|
1367
|
-
le((
|
|
1366
|
+
R((s) => s.unitId === this._unitId && s.subUnitId === this._subUnitId),
|
|
1367
|
+
le((s) => {
|
|
1368
1368
|
const e = this._buildRangeProtectionRules();
|
|
1369
|
-
return { type:
|
|
1369
|
+
return { type: s.type === "delete" ? "delete" : s.type === "set" ? "update" : "add", rules: e };
|
|
1370
1370
|
}),
|
|
1371
1371
|
x({ bufferSize: 1, refCount: !0 })
|
|
1372
1372
|
);
|
|
@@ -1376,13 +1376,13 @@ let Te = class {
|
|
|
1376
1376
|
* @private
|
|
1377
1377
|
*/
|
|
1378
1378
|
_createRangeProtectionRulesStream() {
|
|
1379
|
-
const
|
|
1379
|
+
const s = this._rangeProtectionRuleModel.ruleChange$.pipe(
|
|
1380
1380
|
R((e) => e.unitId === this._unitId && e.subUnitId === this._subUnitId)
|
|
1381
1381
|
).subscribe(() => {
|
|
1382
1382
|
this._rangeRulesSubject.next(this._buildRangeProtectionRules());
|
|
1383
1383
|
});
|
|
1384
|
-
return this._subscriptions.push(
|
|
1385
|
-
ue((e, t) => e.length !== t.length ? !1 : e.every((
|
|
1384
|
+
return this._subscriptions.push(s), this._rangeRulesSubject.asObservable().pipe(
|
|
1385
|
+
ue((e, t) => e.length !== t.length ? !1 : e.every((n, i) => n.id === t[i].id)),
|
|
1386
1386
|
x({ bufferSize: 1, refCount: !0 })
|
|
1387
1387
|
);
|
|
1388
1388
|
}
|
|
@@ -1390,16 +1390,16 @@ let Te = class {
|
|
|
1390
1390
|
* Extract WorksheetPermissionPoint type from permission point ID
|
|
1391
1391
|
* @private
|
|
1392
1392
|
*/
|
|
1393
|
-
_extractWorksheetPointType(
|
|
1393
|
+
_extractWorksheetPointType(s) {
|
|
1394
1394
|
for (const [e, t] of Object.entries(re))
|
|
1395
|
-
if (new t(this._unitId, this._subUnitId).id ===
|
|
1395
|
+
if (new t(this._unitId, this._subUnitId).id === s)
|
|
1396
1396
|
return e;
|
|
1397
1397
|
return null;
|
|
1398
1398
|
}
|
|
1399
1399
|
/**
|
|
1400
1400
|
* Read the actual edit permission from a rule's permissionId
|
|
1401
1401
|
*/
|
|
1402
|
-
_getRuleEditPermission(
|
|
1402
|
+
_getRuleEditPermission(s) {
|
|
1403
1403
|
var i;
|
|
1404
1404
|
const e = Q[k.Edit];
|
|
1405
1405
|
if (!e)
|
|
@@ -1407,20 +1407,20 @@ let Te = class {
|
|
|
1407
1407
|
const t = new e(
|
|
1408
1408
|
this._unitId,
|
|
1409
1409
|
this._subUnitId,
|
|
1410
|
-
|
|
1411
|
-
),
|
|
1412
|
-
return (i =
|
|
1410
|
+
s.permissionId
|
|
1411
|
+
), n = this._permissionService.getPermissionPoint(t.id);
|
|
1412
|
+
return (i = n == null ? void 0 : n.value) != null ? i : !1;
|
|
1413
1413
|
}
|
|
1414
1414
|
/**
|
|
1415
1415
|
* Build permission snapshot
|
|
1416
1416
|
*/
|
|
1417
1417
|
_buildSnapshot() {
|
|
1418
|
-
const
|
|
1418
|
+
const s = {};
|
|
1419
1419
|
for (const e in m) {
|
|
1420
1420
|
const t = m[e];
|
|
1421
|
-
|
|
1421
|
+
s[t] = this.getPoint(t);
|
|
1422
1422
|
}
|
|
1423
|
-
return
|
|
1423
|
+
return s;
|
|
1424
1424
|
}
|
|
1425
1425
|
/**
|
|
1426
1426
|
* Build range protection rules list
|
|
@@ -1428,11 +1428,11 @@ let Te = class {
|
|
|
1428
1428
|
_buildRangeProtectionRules() {
|
|
1429
1429
|
return this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId, this._subUnitId).map((e) => {
|
|
1430
1430
|
const t = e.ranges.map(
|
|
1431
|
-
(
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1431
|
+
(n) => this._worksheet.getRange(
|
|
1432
|
+
n.startRow,
|
|
1433
|
+
n.startColumn,
|
|
1434
|
+
n.endRow - n.startRow + 1,
|
|
1435
|
+
n.endColumn - n.startColumn + 1
|
|
1436
1436
|
)
|
|
1437
1437
|
);
|
|
1438
1438
|
return this._injector.createInstance(
|
|
@@ -1460,19 +1460,19 @@ let Te = class {
|
|
|
1460
1460
|
* await permission?.setMode('readOnly');
|
|
1461
1461
|
* ```
|
|
1462
1462
|
*/
|
|
1463
|
-
async setMode(
|
|
1464
|
-
const e = this._getModePermissions(
|
|
1463
|
+
async setMode(s) {
|
|
1464
|
+
const e = this._getModePermissions(s);
|
|
1465
1465
|
await this._batchSetPermissionPoints(e);
|
|
1466
1466
|
}
|
|
1467
1467
|
/**
|
|
1468
1468
|
* Get permission configuration for a specific mode
|
|
1469
1469
|
* @private
|
|
1470
1470
|
*/
|
|
1471
|
-
_getModePermissions(
|
|
1471
|
+
_getModePermissions(s) {
|
|
1472
1472
|
const e = {};
|
|
1473
1473
|
switch (Object.values(m).forEach((t) => {
|
|
1474
1474
|
e[t] = !1;
|
|
1475
|
-
}),
|
|
1475
|
+
}), s) {
|
|
1476
1476
|
case "editable":
|
|
1477
1477
|
Object.values(m).forEach((t) => {
|
|
1478
1478
|
e[t] = !0;
|
|
@@ -1491,17 +1491,17 @@ let Te = class {
|
|
|
1491
1491
|
* Batch set multiple permission points efficiently
|
|
1492
1492
|
* @private
|
|
1493
1493
|
*/
|
|
1494
|
-
async _batchSetPermissionPoints(
|
|
1494
|
+
async _batchSetPermissionPoints(s) {
|
|
1495
1495
|
const e = [];
|
|
1496
|
-
for (const [t,
|
|
1496
|
+
for (const [t, n] of Object.entries(s)) {
|
|
1497
1497
|
const i = t, r = re[i];
|
|
1498
1498
|
if (!r)
|
|
1499
1499
|
throw new Error(`Unknown worksheet permission point: ${i}`);
|
|
1500
1500
|
const o = this.getPoint(i);
|
|
1501
|
-
if (o ===
|
|
1501
|
+
if (o === n)
|
|
1502
1502
|
continue;
|
|
1503
1503
|
const a = new r(this._unitId, this._subUnitId);
|
|
1504
|
-
this._permissionService.getPermissionPoint(a.id) || this._permissionService.addPermissionPoint(a), this._permissionService.updatePermissionPoint(a.id,
|
|
1504
|
+
this._permissionService.getPermissionPoint(a.id) || this._permissionService.addPermissionPoint(a), this._permissionService.updatePermissionPoint(a.id, n), e.push({ point: i, value: n, oldValue: o });
|
|
1505
1505
|
}
|
|
1506
1506
|
if (e.length > 0) {
|
|
1507
1507
|
const t = this._buildSnapshot();
|
|
@@ -1562,14 +1562,14 @@ let Te = class {
|
|
|
1562
1562
|
* console.log(canEdit);
|
|
1563
1563
|
* ```
|
|
1564
1564
|
*/
|
|
1565
|
-
canEditCell(
|
|
1565
|
+
canEditCell(s, e) {
|
|
1566
1566
|
if (!this.canEdit())
|
|
1567
1567
|
return !1;
|
|
1568
1568
|
const t = this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId, this._subUnitId);
|
|
1569
|
-
for (const
|
|
1570
|
-
for (const i of
|
|
1571
|
-
if (
|
|
1572
|
-
return this._getRuleEditPermission(
|
|
1569
|
+
for (const n of t)
|
|
1570
|
+
for (const i of n.ranges)
|
|
1571
|
+
if (s >= i.startRow && s <= i.endRow && e >= i.startColumn && e <= i.endColumn)
|
|
1572
|
+
return this._getRuleEditPermission(n);
|
|
1573
1573
|
return !0;
|
|
1574
1574
|
}
|
|
1575
1575
|
/**
|
|
@@ -1585,7 +1585,7 @@ let Te = class {
|
|
|
1585
1585
|
* console.log(canView);
|
|
1586
1586
|
* ```
|
|
1587
1587
|
*/
|
|
1588
|
-
canViewCell(
|
|
1588
|
+
canViewCell(s, e) {
|
|
1589
1589
|
return this.getPoint(m.View);
|
|
1590
1590
|
}
|
|
1591
1591
|
/**
|
|
@@ -1601,11 +1601,11 @@ let Te = class {
|
|
|
1601
1601
|
* console.log(debugInfo);
|
|
1602
1602
|
* ```
|
|
1603
1603
|
*/
|
|
1604
|
-
debugCellPermission(
|
|
1605
|
-
const t = [],
|
|
1606
|
-
for (const i of
|
|
1604
|
+
debugCellPermission(s, e) {
|
|
1605
|
+
const t = [], n = this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId, this._subUnitId);
|
|
1606
|
+
for (const i of n)
|
|
1607
1607
|
for (const r of i.ranges)
|
|
1608
|
-
if (
|
|
1608
|
+
if (s >= r.startRow && s <= r.endRow && e >= r.startColumn && e <= r.endColumn) {
|
|
1609
1609
|
t.push({
|
|
1610
1610
|
ruleId: i.id,
|
|
1611
1611
|
rangeRefs: i.ranges.map(
|
|
@@ -1619,7 +1619,7 @@ let Te = class {
|
|
|
1619
1619
|
break;
|
|
1620
1620
|
}
|
|
1621
1621
|
return t.length === 0 ? null : {
|
|
1622
|
-
row:
|
|
1622
|
+
row: s,
|
|
1623
1623
|
col: e,
|
|
1624
1624
|
hitRules: t
|
|
1625
1625
|
};
|
|
@@ -1636,11 +1636,11 @@ let Te = class {
|
|
|
1636
1636
|
* await permission?.setPoint(WorksheetPermissionPoint.InsertRow, false);
|
|
1637
1637
|
* ```
|
|
1638
1638
|
*/
|
|
1639
|
-
async setPoint(
|
|
1640
|
-
const t = re[
|
|
1639
|
+
async setPoint(s, e) {
|
|
1640
|
+
const t = re[s];
|
|
1641
1641
|
if (!t)
|
|
1642
|
-
throw new Error(`Unknown worksheet permission point: ${
|
|
1643
|
-
if (this.getPoint(
|
|
1642
|
+
throw new Error(`Unknown worksheet permission point: ${s}`);
|
|
1643
|
+
if (this.getPoint(s) === e)
|
|
1644
1644
|
return;
|
|
1645
1645
|
const i = new t(this._unitId, this._subUnitId);
|
|
1646
1646
|
this._permissionService.getPermissionPoint(i.id) || this._permissionService.addPermissionPoint(i), this._permissionService.updatePermissionPoint(i.id, e);
|
|
@@ -1659,13 +1659,13 @@ let Te = class {
|
|
|
1659
1659
|
* console.log(canInsertRow);
|
|
1660
1660
|
* ```
|
|
1661
1661
|
*/
|
|
1662
|
-
getPoint(
|
|
1662
|
+
getPoint(s) {
|
|
1663
1663
|
var i;
|
|
1664
|
-
const e = re[
|
|
1664
|
+
const e = re[s];
|
|
1665
1665
|
if (!e)
|
|
1666
|
-
throw new Error(`Unknown worksheet permission point: ${
|
|
1667
|
-
const t = new e(this._unitId, this._subUnitId),
|
|
1668
|
-
return (i =
|
|
1666
|
+
throw new Error(`Unknown worksheet permission point: ${s}`);
|
|
1667
|
+
const t = new e(this._unitId, this._subUnitId), n = this._permissionService.getPermissionPoint(t.id);
|
|
1668
|
+
return (i = n == null ? void 0 : n.value) != null ? i : !0;
|
|
1669
1669
|
}
|
|
1670
1670
|
/**
|
|
1671
1671
|
* Get a snapshot of all permission points.
|
|
@@ -1698,13 +1698,13 @@ let Te = class {
|
|
|
1698
1698
|
* });
|
|
1699
1699
|
* ```
|
|
1700
1700
|
*/
|
|
1701
|
-
async applyConfig(
|
|
1702
|
-
if (
|
|
1703
|
-
for (const [e, t] of Object.entries(
|
|
1701
|
+
async applyConfig(s) {
|
|
1702
|
+
if (s.mode && await this.setMode(s.mode), s.points)
|
|
1703
|
+
for (const [e, t] of Object.entries(s.points))
|
|
1704
1704
|
typeof t == "boolean" && await this.setPoint(e, t);
|
|
1705
|
-
if (
|
|
1706
|
-
const e =
|
|
1707
|
-
ranges: t.rangeRefs.map((
|
|
1705
|
+
if (s.rangeProtections && s.rangeProtections.length > 0) {
|
|
1706
|
+
const e = s.rangeProtections.map((t) => ({
|
|
1707
|
+
ranges: t.rangeRefs.map((n) => this._worksheet.getRange(n)),
|
|
1708
1708
|
options: t.options
|
|
1709
1709
|
}));
|
|
1710
1710
|
await this.protectRanges(e);
|
|
@@ -1731,11 +1731,11 @@ let Te = class {
|
|
|
1731
1731
|
* console.log(rules);
|
|
1732
1732
|
* ```
|
|
1733
1733
|
*/
|
|
1734
|
-
async protectRanges(
|
|
1735
|
-
if (!
|
|
1734
|
+
async protectRanges(s) {
|
|
1735
|
+
if (!s || s.length === 0)
|
|
1736
1736
|
throw new Error("Configs cannot be empty");
|
|
1737
1737
|
const e = await Promise.all(
|
|
1738
|
-
|
|
1738
|
+
s.map(
|
|
1739
1739
|
(r) => {
|
|
1740
1740
|
var o, a, h, c;
|
|
1741
1741
|
return this._authzIoService.create({
|
|
@@ -1749,7 +1749,7 @@ let Te = class {
|
|
|
1749
1749
|
});
|
|
1750
1750
|
}
|
|
1751
1751
|
)
|
|
1752
|
-
), t =
|
|
1752
|
+
), t = s.map((r, o) => {
|
|
1753
1753
|
var c;
|
|
1754
1754
|
const a = this._determineViewState(r.options), h = this._determineEditState(r.options);
|
|
1755
1755
|
return {
|
|
@@ -1771,7 +1771,7 @@ let Te = class {
|
|
|
1771
1771
|
}))
|
|
1772
1772
|
throw new Error("Failed to create range protection rules");
|
|
1773
1773
|
return await Promise.all(
|
|
1774
|
-
|
|
1774
|
+
s.map((r, o) => this._setPermissionPoints(e[o], r.options))
|
|
1775
1775
|
), t.map(
|
|
1776
1776
|
(r, o) => this._injector.createInstance(
|
|
1777
1777
|
N,
|
|
@@ -1779,8 +1779,8 @@ let Te = class {
|
|
|
1779
1779
|
this._subUnitId,
|
|
1780
1780
|
r.id,
|
|
1781
1781
|
r.permissionId,
|
|
1782
|
-
|
|
1783
|
-
|
|
1782
|
+
s[o].ranges,
|
|
1783
|
+
s[o].options || {}
|
|
1784
1784
|
)
|
|
1785
1785
|
);
|
|
1786
1786
|
}
|
|
@@ -1788,36 +1788,36 @@ let Te = class {
|
|
|
1788
1788
|
* Determine view state from options
|
|
1789
1789
|
* @private
|
|
1790
1790
|
*/
|
|
1791
|
-
_determineViewState(
|
|
1792
|
-
return (
|
|
1791
|
+
_determineViewState(s) {
|
|
1792
|
+
return (s == null ? void 0 : s.allowViewByOthers) === !1 ? V.NoOneElseCanView : V.OthersCanView;
|
|
1793
1793
|
}
|
|
1794
1794
|
/**
|
|
1795
1795
|
* Determine edit state from options
|
|
1796
1796
|
* @private
|
|
1797
1797
|
*/
|
|
1798
|
-
_determineEditState(
|
|
1798
|
+
_determineEditState(s) {
|
|
1799
1799
|
var e;
|
|
1800
|
-
return (
|
|
1800
|
+
return (s == null ? void 0 : s.allowEdit) === !0 && ((e = s == null ? void 0 : s.allowedUsers) != null && e.length) ? A.DesignedUserCanEdit : A.OnlyMe;
|
|
1801
1801
|
}
|
|
1802
1802
|
/**
|
|
1803
1803
|
* Set permission points based on options (for local runtime control)
|
|
1804
1804
|
* @private
|
|
1805
1805
|
*/
|
|
1806
|
-
async _setPermissionPoints(
|
|
1806
|
+
async _setPermissionPoints(s, e) {
|
|
1807
1807
|
if (!e)
|
|
1808
1808
|
return;
|
|
1809
|
-
const t = (
|
|
1810
|
-
await this._setPermissionPoint(
|
|
1809
|
+
const t = (n, i) => n === void 0 ? i : typeof n == "boolean" ? n : !0;
|
|
1810
|
+
await this._setPermissionPoint(s, k.Edit, t(e.allowEdit, !1)), await this._setPermissionPoint(s, k.View, t(e.allowViewByOthers, !0));
|
|
1811
1811
|
}
|
|
1812
1812
|
/**
|
|
1813
1813
|
* Set a single permission point
|
|
1814
1814
|
* @private
|
|
1815
1815
|
*/
|
|
1816
|
-
async _setPermissionPoint(
|
|
1817
|
-
const
|
|
1818
|
-
if (!
|
|
1816
|
+
async _setPermissionPoint(s, e, t) {
|
|
1817
|
+
const n = Q[e];
|
|
1818
|
+
if (!n)
|
|
1819
1819
|
return;
|
|
1820
|
-
const i = new
|
|
1820
|
+
const i = new n(this._unitId, this._subUnitId, s);
|
|
1821
1821
|
this._permissionService.getPermissionPoint(i.id) || this._permissionService.addPermissionPoint(i), this._permissionService.updatePermissionPoint(i.id, t);
|
|
1822
1822
|
}
|
|
1823
1823
|
/**
|
|
@@ -1831,11 +1831,11 @@ let Te = class {
|
|
|
1831
1831
|
* await permission?.unprotectRules(['rule1', 'rule2']);
|
|
1832
1832
|
* ```
|
|
1833
1833
|
*/
|
|
1834
|
-
async unprotectRules(
|
|
1835
|
-
!
|
|
1834
|
+
async unprotectRules(s) {
|
|
1835
|
+
!s || s.length === 0 || await this._commandService.executeCommand(Se.id, {
|
|
1836
1836
|
unitId: this._unitId,
|
|
1837
1837
|
subUnitId: this._subUnitId,
|
|
1838
|
-
ruleIds:
|
|
1838
|
+
ruleIds: s
|
|
1839
1839
|
});
|
|
1840
1840
|
}
|
|
1841
1841
|
/**
|
|
@@ -1867,18 +1867,18 @@ let Te = class {
|
|
|
1867
1867
|
* unsubscribe?.();
|
|
1868
1868
|
* ```
|
|
1869
1869
|
*/
|
|
1870
|
-
subscribe(
|
|
1871
|
-
const e = this.permission$.subscribe(
|
|
1870
|
+
subscribe(s) {
|
|
1871
|
+
const e = this.permission$.subscribe(s);
|
|
1872
1872
|
return () => e.unsubscribe();
|
|
1873
1873
|
}
|
|
1874
1874
|
/**
|
|
1875
1875
|
* Clean up resources
|
|
1876
1876
|
*/
|
|
1877
1877
|
dispose() {
|
|
1878
|
-
this._subscriptions.forEach((
|
|
1878
|
+
this._subscriptions.forEach((s) => s.unsubscribe()), this._permissionSubject.complete(), this._rangeRulesSubject.complete();
|
|
1879
1879
|
}
|
|
1880
1880
|
};
|
|
1881
|
-
Te =
|
|
1881
|
+
Te = Ts([
|
|
1882
1882
|
$(1, l(p)),
|
|
1883
1883
|
$(2, K),
|
|
1884
1884
|
$(3, ee),
|
|
@@ -1886,8 +1886,8 @@ Te = Tn([
|
|
|
1886
1886
|
$(5, l(te)),
|
|
1887
1887
|
$(6, l(He))
|
|
1888
1888
|
], Te);
|
|
1889
|
-
function
|
|
1890
|
-
switch (
|
|
1889
|
+
function Vs(s) {
|
|
1890
|
+
switch (s) {
|
|
1891
1891
|
case "left":
|
|
1892
1892
|
return L.LEFT;
|
|
1893
1893
|
case "center":
|
|
@@ -1895,11 +1895,11 @@ function Vn(n) {
|
|
|
1895
1895
|
case "normal":
|
|
1896
1896
|
return L.RIGHT;
|
|
1897
1897
|
default:
|
|
1898
|
-
throw new Error(`Invalid horizontal alignment: ${
|
|
1898
|
+
throw new Error(`Invalid horizontal alignment: ${s}`);
|
|
1899
1899
|
}
|
|
1900
1900
|
}
|
|
1901
|
-
function mt(
|
|
1902
|
-
switch (
|
|
1901
|
+
function mt(s) {
|
|
1902
|
+
switch (s) {
|
|
1903
1903
|
case L.LEFT:
|
|
1904
1904
|
return "left";
|
|
1905
1905
|
case L.CENTER:
|
|
@@ -1910,8 +1910,8 @@ function mt(n) {
|
|
|
1910
1910
|
return "general";
|
|
1911
1911
|
}
|
|
1912
1912
|
}
|
|
1913
|
-
function
|
|
1914
|
-
switch (
|
|
1913
|
+
function As(s) {
|
|
1914
|
+
switch (s) {
|
|
1915
1915
|
case "top":
|
|
1916
1916
|
return z.TOP;
|
|
1917
1917
|
case "middle":
|
|
@@ -1919,11 +1919,11 @@ function An(n) {
|
|
|
1919
1919
|
case "bottom":
|
|
1920
1920
|
return z.BOTTOM;
|
|
1921
1921
|
default:
|
|
1922
|
-
throw new Error(`Invalid vertical alignment: ${
|
|
1922
|
+
throw new Error(`Invalid vertical alignment: ${s}`);
|
|
1923
1923
|
}
|
|
1924
1924
|
}
|
|
1925
|
-
function gt(
|
|
1926
|
-
switch (
|
|
1925
|
+
function gt(s) {
|
|
1926
|
+
switch (s) {
|
|
1927
1927
|
case z.TOP:
|
|
1928
1928
|
return "top";
|
|
1929
1929
|
case z.MIDDLE:
|
|
@@ -1934,29 +1934,29 @@ function gt(n) {
|
|
|
1934
1934
|
return "general";
|
|
1935
1935
|
}
|
|
1936
1936
|
}
|
|
1937
|
-
function pe(
|
|
1937
|
+
function pe(s, e) {
|
|
1938
1938
|
return {
|
|
1939
|
-
startRow:
|
|
1940
|
-
endRow:
|
|
1939
|
+
startRow: s.startRow,
|
|
1940
|
+
endRow: s.endRow,
|
|
1941
1941
|
startColumn: 0,
|
|
1942
1942
|
endColumn: e.getColumnCount() - 1,
|
|
1943
1943
|
rangeType: f.ROW
|
|
1944
1944
|
};
|
|
1945
1945
|
}
|
|
1946
|
-
function Re(
|
|
1946
|
+
function Re(s, e) {
|
|
1947
1947
|
return {
|
|
1948
1948
|
startRow: 0,
|
|
1949
1949
|
endRow: e.getRowCount() - 1,
|
|
1950
|
-
startColumn:
|
|
1951
|
-
endColumn:
|
|
1950
|
+
startColumn: s.startColumn,
|
|
1951
|
+
endColumn: s.endColumn,
|
|
1952
1952
|
rangeType: f.COLUMN
|
|
1953
1953
|
};
|
|
1954
1954
|
}
|
|
1955
|
-
var
|
|
1956
|
-
for (var i =
|
|
1957
|
-
(o =
|
|
1955
|
+
var Bs = Object.getOwnPropertyDescriptor, Fs = (s, e, t, n) => {
|
|
1956
|
+
for (var i = n > 1 ? void 0 : n ? Bs(e, t) : e, r = s.length - 1, o; r >= 0; r--)
|
|
1957
|
+
(o = s[r]) && (i = o(i) || i);
|
|
1958
1958
|
return i;
|
|
1959
|
-
}, oe = (
|
|
1959
|
+
}, oe = (s, e) => (t, n) => e(t, n, s);
|
|
1960
1960
|
let b = class extends Fe {
|
|
1961
1961
|
/**
|
|
1962
1962
|
* Creates a new worksheet facade instance
|
|
@@ -1968,7 +1968,7 @@ let b = class extends Fe {
|
|
|
1968
1968
|
* @param {ILogService} _logService - The log service
|
|
1969
1969
|
* @param {ICommandService} _commandService - The command service
|
|
1970
1970
|
*/
|
|
1971
|
-
constructor(e, t,
|
|
1971
|
+
constructor(e, t, n, i, r, o, a) {
|
|
1972
1972
|
super(i);
|
|
1973
1973
|
/**
|
|
1974
1974
|
* Sets the active selection region for this sheet.
|
|
@@ -1981,7 +1981,7 @@ let b = class extends Fe {
|
|
|
1981
1981
|
* ```
|
|
1982
1982
|
*/
|
|
1983
1983
|
_(this, "setActiveSelection", this.setActiveRange);
|
|
1984
|
-
this._fWorkbook = e, this._workbook = t, this._worksheet =
|
|
1984
|
+
this._fWorkbook = e, this._workbook = t, this._worksheet = n, this._injector = i, this._selectionManagerService = r, this._logService = o, this._commandService = a;
|
|
1985
1985
|
}
|
|
1986
1986
|
dispose() {
|
|
1987
1987
|
super.dispose(), delete this._fWorkbook, delete this._workbook, delete this._worksheet;
|
|
@@ -2131,10 +2131,10 @@ let b = class extends Fe {
|
|
|
2131
2131
|
* ```
|
|
2132
2132
|
*/
|
|
2133
2133
|
setDefaultStyle(e) {
|
|
2134
|
-
const t = this._workbook.getUnitId(),
|
|
2135
|
-
return this._commandService.syncExecuteCommand(
|
|
2134
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
|
|
2135
|
+
return this._commandService.syncExecuteCommand(Vn.id, {
|
|
2136
2136
|
unitId: t,
|
|
2137
|
-
subUnitId:
|
|
2137
|
+
subUnitId: n,
|
|
2138
2138
|
defaultStyle: e
|
|
2139
2139
|
}), this._worksheet.setDefaultCellStyle(e), this;
|
|
2140
2140
|
}
|
|
@@ -2153,8 +2153,8 @@ let b = class extends Fe {
|
|
|
2153
2153
|
* ```
|
|
2154
2154
|
*/
|
|
2155
2155
|
setColumnDefaultStyle(e, t) {
|
|
2156
|
-
const
|
|
2157
|
-
unitId:
|
|
2156
|
+
const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), r = {
|
|
2157
|
+
unitId: n,
|
|
2158
2158
|
subUnitId: i,
|
|
2159
2159
|
columnData: {
|
|
2160
2160
|
[e]: {
|
|
@@ -2179,8 +2179,8 @@ let b = class extends Fe {
|
|
|
2179
2179
|
* ```
|
|
2180
2180
|
*/
|
|
2181
2181
|
setRowDefaultStyle(e, t) {
|
|
2182
|
-
const
|
|
2183
|
-
unitId:
|
|
2182
|
+
const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), r = {
|
|
2183
|
+
unitId: n,
|
|
2184
2184
|
subUnitId: i,
|
|
2185
2185
|
rowData: {
|
|
2186
2186
|
[e]: {
|
|
@@ -2190,12 +2190,12 @@ let b = class extends Fe {
|
|
|
2190
2190
|
};
|
|
2191
2191
|
return this._commandService.syncExecuteCommand(et.id, r), this;
|
|
2192
2192
|
}
|
|
2193
|
-
getRange(e, t,
|
|
2193
|
+
getRange(e, t, n, i) {
|
|
2194
2194
|
let r, o;
|
|
2195
2195
|
if (typeof e == "object")
|
|
2196
2196
|
r = e, o = this._worksheet;
|
|
2197
2197
|
else if (typeof e == "string") {
|
|
2198
|
-
const { range: a, sheetName: h } =
|
|
2198
|
+
const { range: a, sheetName: h } = fs(e), c = h ? this._workbook.getSheetBySheetName(h) : this._worksheet;
|
|
2199
2199
|
if (!c)
|
|
2200
2200
|
throw new Error("Range not found");
|
|
2201
2201
|
o = c, r = {
|
|
@@ -2213,7 +2213,7 @@ let b = class extends Fe {
|
|
|
2213
2213
|
} else if (typeof e == "number" && t !== void 0)
|
|
2214
2214
|
o = this._worksheet, r = {
|
|
2215
2215
|
startRow: e,
|
|
2216
|
-
endRow: e + (
|
|
2216
|
+
endRow: e + (n != null ? n : 1) - 1,
|
|
2217
2217
|
startColumn: t,
|
|
2218
2218
|
endColumn: t + (i != null ? i : 1) - 1,
|
|
2219
2219
|
unitId: this._workbook.getUnitId(),
|
|
@@ -2313,9 +2313,9 @@ let b = class extends Fe {
|
|
|
2313
2313
|
* ```
|
|
2314
2314
|
*/
|
|
2315
2315
|
insertRowsAfter(e, t) {
|
|
2316
|
-
const
|
|
2316
|
+
const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), r = ne.DOWN, o = e + 1, a = e + t, h = 0, c = this._worksheet.getColumnCount() - 1, d = se(this._worksheet, o, a, h, c, !0, e);
|
|
2317
2317
|
return this._commandService.syncExecuteCommand(tt.id, {
|
|
2318
|
-
unitId:
|
|
2318
|
+
unitId: n,
|
|
2319
2319
|
subUnitId: i,
|
|
2320
2320
|
direction: r,
|
|
2321
2321
|
range: {
|
|
@@ -2342,9 +2342,9 @@ let b = class extends Fe {
|
|
|
2342
2342
|
* ```
|
|
2343
2343
|
*/
|
|
2344
2344
|
insertRowsBefore(e, t) {
|
|
2345
|
-
const
|
|
2345
|
+
const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), r = ne.UP, o = e, a = e + t - 1, h = 0, c = this._worksheet.getColumnCount() - 1, d = se(this._worksheet, o, a, h, c, !0, e - 1);
|
|
2346
2346
|
return this._commandService.syncExecuteCommand(tt.id, {
|
|
2347
|
-
unitId:
|
|
2347
|
+
unitId: n,
|
|
2348
2348
|
subUnitId: i,
|
|
2349
2349
|
direction: r,
|
|
2350
2350
|
range: {
|
|
@@ -2387,14 +2387,14 @@ let b = class extends Fe {
|
|
|
2387
2387
|
* ```
|
|
2388
2388
|
*/
|
|
2389
2389
|
deleteRows(e, t) {
|
|
2390
|
-
const
|
|
2390
|
+
const n = {
|
|
2391
2391
|
startRow: e,
|
|
2392
2392
|
endRow: e + t - 1,
|
|
2393
2393
|
startColumn: 0,
|
|
2394
2394
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2395
2395
|
};
|
|
2396
|
-
return this._commandService.syncExecuteCommand(
|
|
2397
|
-
range:
|
|
2396
|
+
return this._commandService.syncExecuteCommand(An.id, {
|
|
2397
|
+
range: n,
|
|
2398
2398
|
unitId: this._workbook.getUnitId(),
|
|
2399
2399
|
subUnitId: this._worksheet.getSheetId()
|
|
2400
2400
|
}), this;
|
|
@@ -2416,14 +2416,14 @@ let b = class extends Fe {
|
|
|
2416
2416
|
* ```
|
|
2417
2417
|
*/
|
|
2418
2418
|
moveRows(e, t) {
|
|
2419
|
-
const
|
|
2419
|
+
const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), r = pe(e.getRange(), this._worksheet), o = r, a = {
|
|
2420
2420
|
startRow: t,
|
|
2421
2421
|
endRow: t,
|
|
2422
2422
|
startColumn: r.startColumn,
|
|
2423
2423
|
endColumn: r.endColumn
|
|
2424
2424
|
};
|
|
2425
|
-
return this._commandService.syncExecuteCommand(
|
|
2426
|
-
unitId:
|
|
2425
|
+
return this._commandService.syncExecuteCommand(Bn.id, {
|
|
2426
|
+
unitId: n,
|
|
2427
2427
|
subUnitId: i,
|
|
2428
2428
|
range: r,
|
|
2429
2429
|
fromRange: o,
|
|
@@ -2446,10 +2446,10 @@ let b = class extends Fe {
|
|
|
2446
2446
|
* ```
|
|
2447
2447
|
*/
|
|
2448
2448
|
hideRow(e) {
|
|
2449
|
-
const t = this._workbook.getUnitId(),
|
|
2450
|
-
return this._commandService.syncExecuteCommand(
|
|
2449
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = pe(e.getRange(), this._worksheet);
|
|
2450
|
+
return this._commandService.syncExecuteCommand(nt.id, {
|
|
2451
2451
|
unitId: t,
|
|
2452
|
-
subUnitId:
|
|
2452
|
+
subUnitId: n,
|
|
2453
2453
|
ranges: [i]
|
|
2454
2454
|
}), this;
|
|
2455
2455
|
}
|
|
@@ -2468,15 +2468,15 @@ let b = class extends Fe {
|
|
|
2468
2468
|
* ```
|
|
2469
2469
|
*/
|
|
2470
2470
|
hideRows(e, t = 1) {
|
|
2471
|
-
const
|
|
2471
|
+
const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), r = {
|
|
2472
2472
|
startRow: e,
|
|
2473
2473
|
endRow: e + t - 1,
|
|
2474
2474
|
startColumn: 0,
|
|
2475
2475
|
endColumn: this._worksheet.getColumnCount() - 1,
|
|
2476
2476
|
rangeType: f.ROW
|
|
2477
2477
|
};
|
|
2478
|
-
return this._commandService.syncExecuteCommand(
|
|
2479
|
-
unitId:
|
|
2478
|
+
return this._commandService.syncExecuteCommand(nt.id, {
|
|
2479
|
+
unitId: n,
|
|
2480
2480
|
subUnitId: i,
|
|
2481
2481
|
ranges: [r]
|
|
2482
2482
|
}), this;
|
|
@@ -2497,10 +2497,10 @@ let b = class extends Fe {
|
|
|
2497
2497
|
* ```
|
|
2498
2498
|
*/
|
|
2499
2499
|
unhideRow(e) {
|
|
2500
|
-
const t = this._workbook.getUnitId(),
|
|
2501
|
-
return this._commandService.syncExecuteCommand(
|
|
2500
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = pe(e.getRange(), this._worksheet);
|
|
2501
|
+
return this._commandService.syncExecuteCommand(st.id, {
|
|
2502
2502
|
unitId: t,
|
|
2503
|
-
subUnitId:
|
|
2503
|
+
subUnitId: n,
|
|
2504
2504
|
ranges: [i]
|
|
2505
2505
|
}), this;
|
|
2506
2506
|
}
|
|
@@ -2519,15 +2519,15 @@ let b = class extends Fe {
|
|
|
2519
2519
|
* ```
|
|
2520
2520
|
*/
|
|
2521
2521
|
showRows(e, t = 1) {
|
|
2522
|
-
const
|
|
2522
|
+
const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), r = {
|
|
2523
2523
|
startRow: e,
|
|
2524
2524
|
endRow: e + t - 1,
|
|
2525
2525
|
startColumn: 0,
|
|
2526
2526
|
endColumn: this._worksheet.getColumnCount() - 1,
|
|
2527
2527
|
rangeType: f.ROW
|
|
2528
2528
|
};
|
|
2529
|
-
return this._commandService.syncExecuteCommand(
|
|
2530
|
-
unitId:
|
|
2529
|
+
return this._commandService.syncExecuteCommand(st.id, {
|
|
2530
|
+
unitId: n,
|
|
2531
2531
|
subUnitId: i,
|
|
2532
2532
|
ranges: [r]
|
|
2533
2533
|
}), this;
|
|
@@ -2561,7 +2561,7 @@ let b = class extends Fe {
|
|
|
2561
2561
|
* ```
|
|
2562
2562
|
*/
|
|
2563
2563
|
autoFitRow(e, t = C.TRUE) {
|
|
2564
|
-
const
|
|
2564
|
+
const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), r = [{
|
|
2565
2565
|
startRow: e,
|
|
2566
2566
|
endRow: e,
|
|
2567
2567
|
startColumn: 0,
|
|
@@ -2572,8 +2572,8 @@ let b = class extends Fe {
|
|
|
2572
2572
|
subUnitId: this._worksheet.getSheetId(),
|
|
2573
2573
|
range: r[0],
|
|
2574
2574
|
value: ae.WRAP
|
|
2575
|
-
}), this._commandService.syncExecuteCommand(
|
|
2576
|
-
unitId:
|
|
2575
|
+
}), this._commandService.syncExecuteCommand(Fn.id, {
|
|
2576
|
+
unitId: n,
|
|
2577
2577
|
subUnitId: i,
|
|
2578
2578
|
ranges: r,
|
|
2579
2579
|
autoHeightInfo: t
|
|
@@ -2592,7 +2592,7 @@ let b = class extends Fe {
|
|
|
2592
2592
|
* fWorksheet.setRowHeights(1, 10, 30);
|
|
2593
2593
|
* ```
|
|
2594
2594
|
*/
|
|
2595
|
-
setRowHeights(e, t,
|
|
2595
|
+
setRowHeights(e, t, n) {
|
|
2596
2596
|
var c;
|
|
2597
2597
|
const i = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = this._worksheet.getRowManager(), a = [], h = [];
|
|
2598
2598
|
for (let d = e; d < e + t; d++) {
|
|
@@ -2602,13 +2602,13 @@ let b = class extends Fe {
|
|
|
2602
2602
|
startColumn: 0,
|
|
2603
2603
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2604
2604
|
};
|
|
2605
|
-
|
|
2605
|
+
n <= w ? a.push(g) : h.push(g);
|
|
2606
2606
|
}
|
|
2607
2607
|
return h.length > 0 && this._commandService.syncExecuteCommand(it.id, {
|
|
2608
2608
|
unitId: i,
|
|
2609
2609
|
subUnitId: r,
|
|
2610
2610
|
ranges: h,
|
|
2611
|
-
value:
|
|
2611
|
+
value: n
|
|
2612
2612
|
}), a.length > 0 && this._commandService.syncExecuteCommand(be.id, {
|
|
2613
2613
|
unitId: i,
|
|
2614
2614
|
subUnitId: r,
|
|
@@ -2647,7 +2647,7 @@ let b = class extends Fe {
|
|
|
2647
2647
|
* ```
|
|
2648
2648
|
*/
|
|
2649
2649
|
setRowAutoHeight(e, t) {
|
|
2650
|
-
const
|
|
2650
|
+
const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), r = [
|
|
2651
2651
|
{
|
|
2652
2652
|
startRow: e,
|
|
2653
2653
|
endRow: e + t - 1,
|
|
@@ -2656,7 +2656,7 @@ let b = class extends Fe {
|
|
|
2656
2656
|
}
|
|
2657
2657
|
];
|
|
2658
2658
|
return this._commandService.syncExecuteCommand(be.id, {
|
|
2659
|
-
unitId:
|
|
2659
|
+
unitId: n,
|
|
2660
2660
|
subUnitId: i,
|
|
2661
2661
|
ranges: r
|
|
2662
2662
|
}), this;
|
|
@@ -2676,10 +2676,10 @@ let b = class extends Fe {
|
|
|
2676
2676
|
* ```
|
|
2677
2677
|
*/
|
|
2678
2678
|
setRangesAutoHeight(e) {
|
|
2679
|
-
const t = this._workbook.getUnitId(),
|
|
2679
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
|
|
2680
2680
|
return this._commandService.syncExecuteCommand(be.id, {
|
|
2681
2681
|
unitId: t,
|
|
2682
|
-
subUnitId:
|
|
2682
|
+
subUnitId: n,
|
|
2683
2683
|
ranges: e
|
|
2684
2684
|
}), this;
|
|
2685
2685
|
}
|
|
@@ -2695,7 +2695,7 @@ let b = class extends Fe {
|
|
|
2695
2695
|
* fWorksheet.setRowHeightsForced(1, 10, 30);
|
|
2696
2696
|
* ```
|
|
2697
2697
|
*/
|
|
2698
|
-
setRowHeightsForced(e, t,
|
|
2698
|
+
setRowHeightsForced(e, t, n) {
|
|
2699
2699
|
const i = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = [
|
|
2700
2700
|
{
|
|
2701
2701
|
startRow: e,
|
|
@@ -2708,7 +2708,7 @@ let b = class extends Fe {
|
|
|
2708
2708
|
unitId: i,
|
|
2709
2709
|
subUnitId: r,
|
|
2710
2710
|
ranges: o,
|
|
2711
|
-
value:
|
|
2711
|
+
value: n
|
|
2712
2712
|
}), this;
|
|
2713
2713
|
}
|
|
2714
2714
|
// #endregion
|
|
@@ -2723,14 +2723,14 @@ let b = class extends Fe {
|
|
|
2723
2723
|
* ```
|
|
2724
2724
|
*/
|
|
2725
2725
|
setRowCustom(e) {
|
|
2726
|
-
const t = this._workbook.getUnitId(),
|
|
2726
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = {};
|
|
2727
2727
|
for (const [o, a] of Object.entries(e))
|
|
2728
2728
|
i[Number(o)] = {
|
|
2729
2729
|
custom: a
|
|
2730
2730
|
};
|
|
2731
2731
|
const r = {
|
|
2732
2732
|
unitId: t,
|
|
2733
|
-
subUnitId:
|
|
2733
|
+
subUnitId: n,
|
|
2734
2734
|
rowData: i
|
|
2735
2735
|
};
|
|
2736
2736
|
return this._commandService.syncExecuteCommand(et.id, r), this;
|
|
@@ -2800,9 +2800,9 @@ let b = class extends Fe {
|
|
|
2800
2800
|
* ```
|
|
2801
2801
|
*/
|
|
2802
2802
|
insertColumnsAfter(e, t) {
|
|
2803
|
-
const
|
|
2803
|
+
const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), r = ne.RIGHT, o = 0, a = this._worksheet.getRowCount() - 1, h = e + 1, c = e + t, d = se(this._worksheet, o, a, h, c, !1, e);
|
|
2804
2804
|
return this._commandService.syncExecuteCommand(rt.id, {
|
|
2805
|
-
unitId:
|
|
2805
|
+
unitId: n,
|
|
2806
2806
|
subUnitId: i,
|
|
2807
2807
|
direction: r,
|
|
2808
2808
|
range: {
|
|
@@ -2829,9 +2829,9 @@ let b = class extends Fe {
|
|
|
2829
2829
|
* ```
|
|
2830
2830
|
*/
|
|
2831
2831
|
insertColumnsBefore(e, t) {
|
|
2832
|
-
const
|
|
2832
|
+
const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), r = ne.LEFT, o = 0, a = this._worksheet.getRowCount() - 1, h = e, c = e + t - 1, d = se(this._worksheet, o, a, h, c, !1, e - 1);
|
|
2833
2833
|
return this._commandService.syncExecuteCommand(rt.id, {
|
|
2834
|
-
unitId:
|
|
2834
|
+
unitId: n,
|
|
2835
2835
|
subUnitId: i,
|
|
2836
2836
|
direction: r,
|
|
2837
2837
|
range: {
|
|
@@ -2874,14 +2874,14 @@ let b = class extends Fe {
|
|
|
2874
2874
|
* ```
|
|
2875
2875
|
*/
|
|
2876
2876
|
deleteColumns(e, t) {
|
|
2877
|
-
const
|
|
2877
|
+
const n = {
|
|
2878
2878
|
startRow: 0,
|
|
2879
2879
|
endRow: this._worksheet.getRowCount() - 1,
|
|
2880
2880
|
startColumn: e,
|
|
2881
2881
|
endColumn: e + t - 1
|
|
2882
2882
|
};
|
|
2883
|
-
return this._commandService.syncExecuteCommand(
|
|
2884
|
-
range:
|
|
2883
|
+
return this._commandService.syncExecuteCommand(Hn.id, {
|
|
2884
|
+
range: n,
|
|
2885
2885
|
unitId: this._workbook.getUnitId(),
|
|
2886
2886
|
subUnitId: this._worksheet.getSheetId()
|
|
2887
2887
|
}), this;
|
|
@@ -2903,14 +2903,14 @@ let b = class extends Fe {
|
|
|
2903
2903
|
* ```
|
|
2904
2904
|
*/
|
|
2905
2905
|
moveColumns(e, t) {
|
|
2906
|
-
const
|
|
2906
|
+
const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), r = Re(e.getRange(), this._worksheet), o = r, a = {
|
|
2907
2907
|
startRow: 0,
|
|
2908
2908
|
endRow: this._worksheet.getRowCount() - 1,
|
|
2909
2909
|
startColumn: t,
|
|
2910
2910
|
endColumn: t
|
|
2911
2911
|
};
|
|
2912
|
-
return this._commandService.syncExecuteCommand(
|
|
2913
|
-
unitId:
|
|
2912
|
+
return this._commandService.syncExecuteCommand($n.id, {
|
|
2913
|
+
unitId: n,
|
|
2914
2914
|
subUnitId: i,
|
|
2915
2915
|
range: r,
|
|
2916
2916
|
fromRange: o,
|
|
@@ -2933,10 +2933,10 @@ let b = class extends Fe {
|
|
|
2933
2933
|
* ```
|
|
2934
2934
|
*/
|
|
2935
2935
|
hideColumn(e) {
|
|
2936
|
-
const t = this._workbook.getUnitId(),
|
|
2936
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = Re(e.getRange(), this._worksheet);
|
|
2937
2937
|
return this._commandService.syncExecuteCommand(ot.id, {
|
|
2938
2938
|
unitId: t,
|
|
2939
|
-
subUnitId:
|
|
2939
|
+
subUnitId: n,
|
|
2940
2940
|
ranges: [i]
|
|
2941
2941
|
}), this;
|
|
2942
2942
|
}
|
|
@@ -2955,7 +2955,7 @@ let b = class extends Fe {
|
|
|
2955
2955
|
* ```
|
|
2956
2956
|
*/
|
|
2957
2957
|
hideColumns(e, t = 1) {
|
|
2958
|
-
const
|
|
2958
|
+
const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), r = {
|
|
2959
2959
|
startRow: 0,
|
|
2960
2960
|
endRow: this._worksheet.getRowCount() - 1,
|
|
2961
2961
|
startColumn: e,
|
|
@@ -2963,7 +2963,7 @@ let b = class extends Fe {
|
|
|
2963
2963
|
rangeType: f.COLUMN
|
|
2964
2964
|
};
|
|
2965
2965
|
return this._commandService.syncExecuteCommand(ot.id, {
|
|
2966
|
-
unitId:
|
|
2966
|
+
unitId: n,
|
|
2967
2967
|
subUnitId: i,
|
|
2968
2968
|
ranges: [r]
|
|
2969
2969
|
}), this;
|
|
@@ -2984,10 +2984,10 @@ let b = class extends Fe {
|
|
|
2984
2984
|
* ```
|
|
2985
2985
|
*/
|
|
2986
2986
|
unhideColumn(e) {
|
|
2987
|
-
const t = this._workbook.getUnitId(),
|
|
2987
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = Re(e.getRange(), this._worksheet);
|
|
2988
2988
|
return this._commandService.syncExecuteCommand(at.id, {
|
|
2989
2989
|
unitId: t,
|
|
2990
|
-
subUnitId:
|
|
2990
|
+
subUnitId: n,
|
|
2991
2991
|
ranges: [i]
|
|
2992
2992
|
}), this;
|
|
2993
2993
|
}
|
|
@@ -3006,7 +3006,7 @@ let b = class extends Fe {
|
|
|
3006
3006
|
* ```
|
|
3007
3007
|
*/
|
|
3008
3008
|
showColumns(e, t = 1) {
|
|
3009
|
-
const
|
|
3009
|
+
const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), r = {
|
|
3010
3010
|
startRow: 0,
|
|
3011
3011
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3012
3012
|
startColumn: e,
|
|
@@ -3014,7 +3014,7 @@ let b = class extends Fe {
|
|
|
3014
3014
|
rangeType: f.COLUMN
|
|
3015
3015
|
};
|
|
3016
3016
|
return this._commandService.syncExecuteCommand(at.id, {
|
|
3017
|
-
unitId:
|
|
3017
|
+
unitId: n,
|
|
3018
3018
|
subUnitId: i,
|
|
3019
3019
|
ranges: [r]
|
|
3020
3020
|
}), this;
|
|
@@ -3047,7 +3047,7 @@ let b = class extends Fe {
|
|
|
3047
3047
|
* fWorksheet.setColumnWidths(1, 3, 100);
|
|
3048
3048
|
* ```
|
|
3049
3049
|
*/
|
|
3050
|
-
setColumnWidths(e, t,
|
|
3050
|
+
setColumnWidths(e, t, n) {
|
|
3051
3051
|
const i = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = [
|
|
3052
3052
|
{
|
|
3053
3053
|
startColumn: e,
|
|
@@ -3056,11 +3056,11 @@ let b = class extends Fe {
|
|
|
3056
3056
|
endRow: this._worksheet.getRowCount() - 1
|
|
3057
3057
|
}
|
|
3058
3058
|
];
|
|
3059
|
-
return this._commandService.syncExecuteCommand(
|
|
3059
|
+
return this._commandService.syncExecuteCommand(Ln.id, {
|
|
3060
3060
|
unitId: i,
|
|
3061
3061
|
subUnitId: r,
|
|
3062
3062
|
ranges: o,
|
|
3063
|
-
value:
|
|
3063
|
+
value: n
|
|
3064
3064
|
}), this;
|
|
3065
3065
|
}
|
|
3066
3066
|
/**
|
|
@@ -3098,14 +3098,14 @@ let b = class extends Fe {
|
|
|
3098
3098
|
* ```
|
|
3099
3099
|
*/
|
|
3100
3100
|
setColumnCustom(e) {
|
|
3101
|
-
const t = this._workbook.getUnitId(),
|
|
3101
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = {};
|
|
3102
3102
|
for (const [o, a] of Object.entries(e))
|
|
3103
3103
|
i[Number(o)] = {
|
|
3104
3104
|
custom: a
|
|
3105
3105
|
};
|
|
3106
3106
|
const r = {
|
|
3107
3107
|
unitId: t,
|
|
3108
|
-
subUnitId:
|
|
3108
|
+
subUnitId: n,
|
|
3109
3109
|
columnData: i
|
|
3110
3110
|
};
|
|
3111
3111
|
return this._commandService.syncExecuteCommand(Xe.id, r), this;
|
|
@@ -3192,8 +3192,8 @@ let b = class extends Fe {
|
|
|
3192
3192
|
* ```
|
|
3193
3193
|
*/
|
|
3194
3194
|
setActiveRange(e) {
|
|
3195
|
-
const { unitId: t, sheetId:
|
|
3196
|
-
if (t !== this._workbook.getUnitId() ||
|
|
3195
|
+
const { unitId: t, sheetId: n } = e.getRange();
|
|
3196
|
+
if (t !== this._workbook.getUnitId() || n !== this._worksheet.getSheetId())
|
|
3197
3197
|
throw new Error("Specified range must be part of the sheet.");
|
|
3198
3198
|
return this._fWorkbook.setActiveRange(e), this;
|
|
3199
3199
|
}
|
|
@@ -3245,7 +3245,7 @@ let b = class extends Fe {
|
|
|
3245
3245
|
* ```
|
|
3246
3246
|
*/
|
|
3247
3247
|
cancelFreeze() {
|
|
3248
|
-
return this._commandService.syncExecuteCommand(
|
|
3248
|
+
return this._commandService.syncExecuteCommand(zn.id, {
|
|
3249
3249
|
unitId: this._workbook.getUnitId(),
|
|
3250
3250
|
subUnitId: this.getSheetId()
|
|
3251
3251
|
}), this;
|
|
@@ -3267,17 +3267,17 @@ let b = class extends Fe {
|
|
|
3267
3267
|
setFrozenColumns(...e) {
|
|
3268
3268
|
const t = this.getFreeze();
|
|
3269
3269
|
if (arguments.length === 1) {
|
|
3270
|
-
const
|
|
3270
|
+
const n = e[0];
|
|
3271
3271
|
this.setFreeze({
|
|
3272
3272
|
...t,
|
|
3273
|
-
startColumn:
|
|
3274
|
-
xSplit:
|
|
3273
|
+
startColumn: n > 0 ? n : -1,
|
|
3274
|
+
xSplit: n
|
|
3275
3275
|
});
|
|
3276
3276
|
} else if (arguments.length === 2) {
|
|
3277
|
-
let [
|
|
3278
|
-
|
|
3277
|
+
let [n = 0, i = 0] = e;
|
|
3278
|
+
n > i && ([n, i] = [i, n]), this._commandService.syncExecuteCommand(Ie.id, {
|
|
3279
3279
|
startColumn: i + 1,
|
|
3280
|
-
xSplit: i -
|
|
3280
|
+
xSplit: i - n + 1,
|
|
3281
3281
|
startRow: t.startRow,
|
|
3282
3282
|
ySplit: t.ySplit,
|
|
3283
3283
|
unitId: this._workbook.getUnitId(),
|
|
@@ -3289,17 +3289,17 @@ let b = class extends Fe {
|
|
|
3289
3289
|
setFrozenRows(...e) {
|
|
3290
3290
|
const t = this.getFreeze();
|
|
3291
3291
|
if (arguments.length === 1) {
|
|
3292
|
-
const
|
|
3292
|
+
const n = e[0];
|
|
3293
3293
|
this.setFreeze({
|
|
3294
3294
|
...t,
|
|
3295
|
-
startRow:
|
|
3296
|
-
ySplit:
|
|
3295
|
+
startRow: n > 0 ? n : -1,
|
|
3296
|
+
ySplit: n
|
|
3297
3297
|
});
|
|
3298
3298
|
} else if (arguments.length === 2) {
|
|
3299
|
-
let [
|
|
3300
|
-
|
|
3299
|
+
let [n = 0, i = 0] = e;
|
|
3300
|
+
n > i && ([n, i] = [i, n]), this._commandService.syncExecuteCommand(Ie.id, {
|
|
3301
3301
|
startRow: i + 1,
|
|
3302
|
-
ySplit: i -
|
|
3302
|
+
ySplit: i - n + 1,
|
|
3303
3303
|
startColumn: t.startColumn,
|
|
3304
3304
|
xSplit: t.xSplit,
|
|
3305
3305
|
unitId: this._workbook.getUnitId(),
|
|
@@ -3452,7 +3452,7 @@ let b = class extends Fe {
|
|
|
3452
3452
|
* ```
|
|
3453
3453
|
*/
|
|
3454
3454
|
setTabColor(e) {
|
|
3455
|
-
return this._commandService.syncExecuteCommand(
|
|
3455
|
+
return this._commandService.syncExecuteCommand(Gn.id, {
|
|
3456
3456
|
unitId: this._workbook.getUnitId(),
|
|
3457
3457
|
subUnitId: this._worksheet.getSheetId(),
|
|
3458
3458
|
value: e
|
|
@@ -3477,9 +3477,9 @@ let b = class extends Fe {
|
|
|
3477
3477
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.SheetValueChanged, (params) => {})` instead
|
|
3478
3478
|
*/
|
|
3479
3479
|
onCellDataChange(e) {
|
|
3480
|
-
return this._injector.get(S).onCommandExecuted((
|
|
3481
|
-
if (
|
|
3482
|
-
const i =
|
|
3480
|
+
return this._injector.get(S).onCommandExecuted((n) => {
|
|
3481
|
+
if (n.id === ht.id) {
|
|
3482
|
+
const i = n.params;
|
|
3483
3483
|
i.unitId === this._workbook.getUnitId() && i.subUnitId === this._worksheet.getSheetId() && i.cellValue && e(new ke(i.cellValue));
|
|
3484
3484
|
}
|
|
3485
3485
|
});
|
|
@@ -3488,9 +3488,9 @@ let b = class extends Fe {
|
|
|
3488
3488
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeSheetEditEnd, (params) => {})` instead
|
|
3489
3489
|
*/
|
|
3490
3490
|
onBeforeCellDataChange(e) {
|
|
3491
|
-
return this._injector.get(S).beforeCommandExecuted((
|
|
3492
|
-
if (
|
|
3493
|
-
const i =
|
|
3491
|
+
return this._injector.get(S).beforeCommandExecuted((n) => {
|
|
3492
|
+
if (n.id === ht.id) {
|
|
3493
|
+
const i = n.params;
|
|
3494
3494
|
i.unitId === this._workbook.getUnitId() && i.subUnitId === this._worksheet.getSheetId() && i.cellValue && e(new ke(i.cellValue));
|
|
3495
3495
|
}
|
|
3496
3496
|
});
|
|
@@ -3510,7 +3510,7 @@ let b = class extends Fe {
|
|
|
3510
3510
|
const e = this._injector.get(S);
|
|
3511
3511
|
if (this._workbook.getSheets().filter((r) => r.isSheetHidden() !== C.TRUE).length <= 1)
|
|
3512
3512
|
throw new Error("Cannot hide the only visible sheet");
|
|
3513
|
-
return e.syncExecuteCommand(
|
|
3513
|
+
return e.syncExecuteCommand(Kn.id, {
|
|
3514
3514
|
unitId: this._workbook.getUnitId(),
|
|
3515
3515
|
subUnitId: this._worksheet.getSheetId()
|
|
3516
3516
|
}), this;
|
|
@@ -3527,7 +3527,7 @@ let b = class extends Fe {
|
|
|
3527
3527
|
* ```
|
|
3528
3528
|
*/
|
|
3529
3529
|
showSheet() {
|
|
3530
|
-
return this._injector.get(S).syncExecuteCommand(
|
|
3530
|
+
return this._injector.get(S).syncExecuteCommand(Jn.id, {
|
|
3531
3531
|
unitId: this._workbook.getUnitId(),
|
|
3532
3532
|
subUnitId: this._worksheet.getSheetId()
|
|
3533
3533
|
}), this;
|
|
@@ -3615,7 +3615,7 @@ let b = class extends Fe {
|
|
|
3615
3615
|
return this.clearContents();
|
|
3616
3616
|
if (e && e.formatOnly && !e.contentsOnly)
|
|
3617
3617
|
return this.clearFormats();
|
|
3618
|
-
const t = this._workbook.getUnitId(),
|
|
3618
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = this._injector.get(S), r = {
|
|
3619
3619
|
startRow: 0,
|
|
3620
3620
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3621
3621
|
startColumn: 0,
|
|
@@ -3623,7 +3623,7 @@ let b = class extends Fe {
|
|
|
3623
3623
|
};
|
|
3624
3624
|
return i.syncExecuteCommand(Rt.id, {
|
|
3625
3625
|
unitId: t,
|
|
3626
|
-
subUnitId:
|
|
3626
|
+
subUnitId: n,
|
|
3627
3627
|
ranges: [r],
|
|
3628
3628
|
options: e
|
|
3629
3629
|
}), this;
|
|
@@ -3640,13 +3640,13 @@ let b = class extends Fe {
|
|
|
3640
3640
|
* ```
|
|
3641
3641
|
*/
|
|
3642
3642
|
clearContents() {
|
|
3643
|
-
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(),
|
|
3643
|
+
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), n = this._injector.get(S), i = {
|
|
3644
3644
|
startRow: 0,
|
|
3645
3645
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3646
3646
|
startColumn: 0,
|
|
3647
3647
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
3648
3648
|
};
|
|
3649
|
-
return
|
|
3649
|
+
return n.syncExecuteCommand(Pt.id, {
|
|
3650
3650
|
unitId: e,
|
|
3651
3651
|
subUnitId: t,
|
|
3652
3652
|
ranges: [i]
|
|
@@ -3664,13 +3664,13 @@ let b = class extends Fe {
|
|
|
3664
3664
|
* ```
|
|
3665
3665
|
*/
|
|
3666
3666
|
clearFormats() {
|
|
3667
|
-
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(),
|
|
3667
|
+
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), n = this._injector.get(S), i = {
|
|
3668
3668
|
startRow: 0,
|
|
3669
3669
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3670
3670
|
startColumn: 0,
|
|
3671
3671
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
3672
3672
|
};
|
|
3673
|
-
return
|
|
3673
|
+
return n.syncExecuteCommand(yt.id, {
|
|
3674
3674
|
unitId: e,
|
|
3675
3675
|
subUnitId: t,
|
|
3676
3676
|
ranges: [i]
|
|
@@ -3678,7 +3678,7 @@ let b = class extends Fe {
|
|
|
3678
3678
|
}
|
|
3679
3679
|
/**
|
|
3680
3680
|
* Returns a Range corresponding to the dimensions in which data is present.
|
|
3681
|
-
* This is functionally equivalent to creating a Range bounded by A1 and (Sheet.
|
|
3681
|
+
* This is functionally equivalent to creating a Range bounded by A1 and (Sheet.getLastColumn(), Sheet.getLastRow()).
|
|
3682
3682
|
* @returns {FRange} The range of the data in the sheet.
|
|
3683
3683
|
* @example
|
|
3684
3684
|
* ```ts
|
|
@@ -3691,8 +3691,8 @@ let b = class extends Fe {
|
|
|
3691
3691
|
* ```
|
|
3692
3692
|
*/
|
|
3693
3693
|
getDataRange() {
|
|
3694
|
-
const
|
|
3695
|
-
return this.getRange(
|
|
3694
|
+
const { startRow: e, endRow: t, startColumn: n, endColumn: i } = this._worksheet.getDataRealRange();
|
|
3695
|
+
return this.getRange(e, n, t - e + 1, i - n + 1);
|
|
3696
3696
|
}
|
|
3697
3697
|
/**
|
|
3698
3698
|
* @deprecated use `getLastColumn` instead.
|
|
@@ -3888,10 +3888,10 @@ let b = class extends Fe {
|
|
|
3888
3888
|
* ```
|
|
3889
3889
|
*/
|
|
3890
3890
|
appendRow(e) {
|
|
3891
|
-
const t = this._worksheet.getCellMatrix().hasValue(),
|
|
3891
|
+
const t = this._worksheet.getCellMatrix().hasValue(), n = this._worksheet.getLastRowWithContent(), i = this._worksheet.getRowCount(), r = this._worksheet.getColumnCount(), o = t ? n + 1 : n, a = new ke();
|
|
3892
3892
|
for (let h = 0; h < e.length; h++)
|
|
3893
3893
|
a.setValue(o, h, Ee(e[h]));
|
|
3894
|
-
return this._commandService.syncExecuteCommand(
|
|
3894
|
+
return this._commandService.syncExecuteCommand(qn.id, {
|
|
3895
3895
|
unitId: this._workbook.getUnitId(),
|
|
3896
3896
|
subUnitId: this._worksheet.getSheetId(),
|
|
3897
3897
|
cellValue: a.getMatrix(),
|
|
@@ -3915,7 +3915,7 @@ let b = class extends Fe {
|
|
|
3915
3915
|
* ```
|
|
3916
3916
|
*/
|
|
3917
3917
|
setRowCount(e) {
|
|
3918
|
-
return this._commandService.syncExecuteCommand(
|
|
3918
|
+
return this._commandService.syncExecuteCommand(Yn.id, {
|
|
3919
3919
|
unitId: this._workbook.getUnitId(),
|
|
3920
3920
|
subUnitId: this._worksheet.getSheetId(),
|
|
3921
3921
|
rowCount: e
|
|
@@ -3935,7 +3935,7 @@ let b = class extends Fe {
|
|
|
3935
3935
|
* ```
|
|
3936
3936
|
*/
|
|
3937
3937
|
setColumnCount(e) {
|
|
3938
|
-
return this._commandService.syncExecuteCommand(
|
|
3938
|
+
return this._commandService.syncExecuteCommand(Zn.id, {
|
|
3939
3939
|
unitId: this._workbook.getUnitId(),
|
|
3940
3940
|
subUnitId: this._worksheet.getSheetId(),
|
|
3941
3941
|
columnCount: e
|
|
@@ -3977,19 +3977,19 @@ let b = class extends Fe {
|
|
|
3977
3977
|
);
|
|
3978
3978
|
}
|
|
3979
3979
|
};
|
|
3980
|
-
b =
|
|
3980
|
+
b = Fs([
|
|
3981
3981
|
oe(3, l(p)),
|
|
3982
3982
|
oe(4, l(pt)),
|
|
3983
3983
|
oe(5, l(Ct)),
|
|
3984
3984
|
oe(6, S)
|
|
3985
3985
|
], b);
|
|
3986
|
-
var
|
|
3987
|
-
for (var i =
|
|
3988
|
-
(o =
|
|
3986
|
+
var Hs = Object.getOwnPropertyDescriptor, $s = (s, e, t, n) => {
|
|
3987
|
+
for (var i = n > 1 ? void 0 : n ? Hs(e, t) : e, r = s.length - 1, o; r >= 0; r--)
|
|
3988
|
+
(o = s[r]) && (i = o(i) || i);
|
|
3989
3989
|
return i;
|
|
3990
|
-
}, Y = (
|
|
3990
|
+
}, Y = (s, e) => (t, n) => e(t, n, s);
|
|
3991
3991
|
let Ve = class {
|
|
3992
|
-
constructor(
|
|
3992
|
+
constructor(s, e, t, n, i, r, o, a, h) {
|
|
3993
3993
|
_(this, "_permissionSubject");
|
|
3994
3994
|
_(this, "_subscriptions", []);
|
|
3995
3995
|
/**
|
|
@@ -4002,14 +4002,14 @@ let Ve = class {
|
|
|
4002
4002
|
* @returns Observable that emits when protection state changes
|
|
4003
4003
|
*/
|
|
4004
4004
|
_(this, "protectionChange$");
|
|
4005
|
-
this._unitId =
|
|
4005
|
+
this._unitId = s, this._subUnitId = e, this._range = t, this._worksheet = n, this._injector = i, this._permissionService = r, this._authzIoService = o, this._commandService = a, this._rangeProtectionRuleModel = h, this._permissionSubject = new de(this._buildSnapshot()), this.permission$ = this._createPermissionStream(), this.protectionChange$ = this._createProtectionChangeStream();
|
|
4006
4006
|
}
|
|
4007
4007
|
/**
|
|
4008
4008
|
* Create permission snapshot stream from IPermissionService
|
|
4009
4009
|
* @private
|
|
4010
4010
|
*/
|
|
4011
4011
|
_createPermissionStream() {
|
|
4012
|
-
const
|
|
4012
|
+
const s = this._permissionService.permissionPointUpdate$.pipe(
|
|
4013
4013
|
R((e) => {
|
|
4014
4014
|
const t = e.id;
|
|
4015
4015
|
return t.includes(this._unitId) && t.includes(this._subUnitId);
|
|
@@ -4017,7 +4017,7 @@ let Ve = class {
|
|
|
4017
4017
|
).subscribe(() => {
|
|
4018
4018
|
this._permissionSubject.next(this._buildSnapshot());
|
|
4019
4019
|
});
|
|
4020
|
-
return this._subscriptions.push(
|
|
4020
|
+
return this._subscriptions.push(s), this._permissionSubject.asObservable().pipe(
|
|
4021
4021
|
ue((e, t) => JSON.stringify(e) === JSON.stringify(t)),
|
|
4022
4022
|
x({ bufferSize: 1, refCount: !0 })
|
|
4023
4023
|
);
|
|
@@ -4028,13 +4028,13 @@ let Ve = class {
|
|
|
4028
4028
|
*/
|
|
4029
4029
|
_createProtectionChangeStream() {
|
|
4030
4030
|
return this._rangeProtectionRuleModel.ruleChange$.pipe(
|
|
4031
|
-
R((
|
|
4032
|
-
le((
|
|
4031
|
+
R((s) => s.unitId !== this._unitId || s.subUnitId !== this._subUnitId ? !1 : s.type === "delete" ? this._rangeMatches(s.rule) : s.type === "add" ? this._rangeMatches(s.rule) : !1),
|
|
4032
|
+
le((s) => (this._permissionSubject.next(this._buildSnapshot()), s.type === "delete" ? {
|
|
4033
4033
|
type: "unprotected",
|
|
4034
|
-
ruleId:
|
|
4034
|
+
ruleId: s.rule.id
|
|
4035
4035
|
} : {
|
|
4036
4036
|
type: "protected",
|
|
4037
|
-
rule: this._createFacadeRule(
|
|
4037
|
+
rule: this._createFacadeRule(s.rule)
|
|
4038
4038
|
})),
|
|
4039
4039
|
x({ bufferSize: 1, refCount: !0 })
|
|
4040
4040
|
);
|
|
@@ -4042,34 +4042,34 @@ let Ve = class {
|
|
|
4042
4042
|
/**
|
|
4043
4043
|
* Check if a protection rule matches this range
|
|
4044
4044
|
*/
|
|
4045
|
-
_rangeMatches(
|
|
4045
|
+
_rangeMatches(s) {
|
|
4046
4046
|
const e = this._range.getRange();
|
|
4047
|
-
return
|
|
4047
|
+
return s.ranges.some(
|
|
4048
4048
|
(t) => e.startRow === t.startRow && e.startColumn === t.startColumn && e.endRow === t.endRow && e.endColumn === t.endColumn
|
|
4049
4049
|
);
|
|
4050
4050
|
}
|
|
4051
4051
|
/**
|
|
4052
4052
|
* Create a Facade rule from internal rule
|
|
4053
4053
|
*/
|
|
4054
|
-
_createFacadeRule(
|
|
4055
|
-
const e =
|
|
4056
|
-
(
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4054
|
+
_createFacadeRule(s) {
|
|
4055
|
+
const e = s.ranges.map(
|
|
4056
|
+
(n) => this._worksheet.getRange(
|
|
4057
|
+
n.startRow,
|
|
4058
|
+
n.startColumn,
|
|
4059
|
+
n.endRow - n.startRow + 1,
|
|
4060
|
+
n.endColumn - n.startColumn + 1
|
|
4061
4061
|
)
|
|
4062
4062
|
), t = {
|
|
4063
|
-
name:
|
|
4064
|
-
allowViewByOthers:
|
|
4065
|
-
allowEdit:
|
|
4063
|
+
name: s.description || "",
|
|
4064
|
+
allowViewByOthers: s.viewState !== V.NoOneElseCanView,
|
|
4065
|
+
allowEdit: s.editState === A.DesignedUserCanEdit
|
|
4066
4066
|
};
|
|
4067
4067
|
return this._injector.createInstance(
|
|
4068
4068
|
N,
|
|
4069
4069
|
this._unitId,
|
|
4070
4070
|
this._subUnitId,
|
|
4071
|
-
|
|
4072
|
-
|
|
4071
|
+
s.id,
|
|
4072
|
+
s.permissionId,
|
|
4073
4073
|
e,
|
|
4074
4074
|
t
|
|
4075
4075
|
);
|
|
@@ -4086,17 +4086,17 @@ let Ve = class {
|
|
|
4086
4086
|
* console.log(canEdit);
|
|
4087
4087
|
* ```
|
|
4088
4088
|
*/
|
|
4089
|
-
getPoint(
|
|
4090
|
-
const e = Q[
|
|
4089
|
+
getPoint(s) {
|
|
4090
|
+
const e = Q[s];
|
|
4091
4091
|
if (!e)
|
|
4092
|
-
return console.warn(`Unknown permission point: ${
|
|
4092
|
+
return console.warn(`Unknown permission point: ${s}`), !1;
|
|
4093
4093
|
const t = this._getProtectionRule();
|
|
4094
4094
|
if (t) {
|
|
4095
4095
|
const o = new e(this._unitId, this._subUnitId, t.permissionId), a = this._permissionService.getPermissionPoint(o.id);
|
|
4096
4096
|
if (a)
|
|
4097
4097
|
return a.value;
|
|
4098
4098
|
}
|
|
4099
|
-
const
|
|
4099
|
+
const n = this._getLocalPermissionId(), i = new e(this._unitId, this._subUnitId, n), r = this._permissionService.getPermissionPoint(i.id);
|
|
4100
4100
|
return r ? r.value : !0;
|
|
4101
4101
|
}
|
|
4102
4102
|
/**
|
|
@@ -4203,11 +4203,11 @@ let Ve = class {
|
|
|
4203
4203
|
* await permission?.setPoint(RangePermissionPoint.View, true); // Enable view
|
|
4204
4204
|
* ```
|
|
4205
4205
|
*/
|
|
4206
|
-
async setPoint(
|
|
4207
|
-
const t = Q[
|
|
4206
|
+
async setPoint(s, e) {
|
|
4207
|
+
const t = Q[s];
|
|
4208
4208
|
if (!t)
|
|
4209
|
-
throw new Error(`Unknown permission point: ${
|
|
4210
|
-
if (this.getPoint(
|
|
4209
|
+
throw new Error(`Unknown permission point: ${s}`);
|
|
4210
|
+
if (this.getPoint(s) === e)
|
|
4211
4211
|
return;
|
|
4212
4212
|
const i = this._getProtectionRule(), r = (i == null ? void 0 : i.permissionId) || this._getLocalPermissionId(), o = new t(this._unitId, this._subUnitId, r);
|
|
4213
4213
|
this._permissionService.getPermissionPoint(o.id) || this._permissionService.addPermissionPoint(o), this._permissionService.updatePermissionPoint(o.id, e), this._permissionSubject.next(this._buildSnapshot());
|
|
@@ -4217,8 +4217,8 @@ let Ve = class {
|
|
|
4217
4217
|
* @private
|
|
4218
4218
|
*/
|
|
4219
4219
|
_getLocalPermissionId() {
|
|
4220
|
-
const
|
|
4221
|
-
return `local-${this._unitId}-${this._subUnitId}-${
|
|
4220
|
+
const s = this._range.getRange();
|
|
4221
|
+
return `local-${this._unitId}-${this._subUnitId}-${s.startRow}-${s.startColumn}-${s.endRow}-${s.endColumn}`;
|
|
4222
4222
|
}
|
|
4223
4223
|
/**
|
|
4224
4224
|
* Protect the current range.
|
|
@@ -4238,19 +4238,19 @@ let Ve = class {
|
|
|
4238
4238
|
* console.log(rule);
|
|
4239
4239
|
* ```
|
|
4240
4240
|
*/
|
|
4241
|
-
async protect(
|
|
4241
|
+
async protect(s) {
|
|
4242
4242
|
var a, h;
|
|
4243
4243
|
if (this.isProtected())
|
|
4244
4244
|
throw new Error("Range is already protected");
|
|
4245
4245
|
const e = await this._authzIoService.create({
|
|
4246
4246
|
objectType: W.SelectRange,
|
|
4247
4247
|
selectRangeObject: {
|
|
4248
|
-
collaborators: (h = (a =
|
|
4248
|
+
collaborators: (h = (a = s == null ? void 0 : s.allowedUsers) == null ? void 0 : a.map((c) => ({ id: c, role: we.Editor, subject: void 0 }))) != null ? h : [],
|
|
4249
4249
|
unitID: this._unitId,
|
|
4250
|
-
name: (
|
|
4250
|
+
name: (s == null ? void 0 : s.name) || "",
|
|
4251
4251
|
scope: void 0
|
|
4252
4252
|
}
|
|
4253
|
-
}), t = this._rangeProtectionRuleModel.createRuleId(this._unitId, this._subUnitId),
|
|
4253
|
+
}), t = this._rangeProtectionRuleModel.createRuleId(this._unitId, this._subUnitId), n = this._range.getRange(), i = this._determineViewState(s), r = this._determineEditState(s);
|
|
4254
4254
|
return await this._commandService.executeCommand(Le.id, {
|
|
4255
4255
|
unitId: this._unitId,
|
|
4256
4256
|
subUnitId: this._subUnitId,
|
|
@@ -4261,55 +4261,55 @@ let Ve = class {
|
|
|
4261
4261
|
// UnitObject.SelectRange
|
|
4262
4262
|
unitId: this._unitId,
|
|
4263
4263
|
subUnitId: this._subUnitId,
|
|
4264
|
-
ranges: [
|
|
4265
|
-
description:
|
|
4264
|
+
ranges: [n],
|
|
4265
|
+
description: s == null ? void 0 : s.name,
|
|
4266
4266
|
viewState: i,
|
|
4267
4267
|
editState: r
|
|
4268
4268
|
}]
|
|
4269
|
-
}), await this._setPermissionPoints(e,
|
|
4269
|
+
}), await this._setPermissionPoints(e, s), this._injector.createInstance(
|
|
4270
4270
|
N,
|
|
4271
4271
|
this._unitId,
|
|
4272
4272
|
this._subUnitId,
|
|
4273
4273
|
t,
|
|
4274
4274
|
e,
|
|
4275
4275
|
[this._range],
|
|
4276
|
-
|
|
4276
|
+
s || {}
|
|
4277
4277
|
);
|
|
4278
4278
|
}
|
|
4279
4279
|
/**
|
|
4280
4280
|
* Determine view state from options
|
|
4281
4281
|
* @private
|
|
4282
4282
|
*/
|
|
4283
|
-
_determineViewState(
|
|
4284
|
-
return (
|
|
4283
|
+
_determineViewState(s) {
|
|
4284
|
+
return (s == null ? void 0 : s.allowViewByOthers) === !1 ? V.NoOneElseCanView : V.OthersCanView;
|
|
4285
4285
|
}
|
|
4286
4286
|
/**
|
|
4287
4287
|
* Determine edit state from options
|
|
4288
4288
|
* @private
|
|
4289
4289
|
*/
|
|
4290
|
-
_determineEditState(
|
|
4290
|
+
_determineEditState(s) {
|
|
4291
4291
|
var e;
|
|
4292
|
-
return (
|
|
4292
|
+
return (s == null ? void 0 : s.allowEdit) === !0 && ((e = s == null ? void 0 : s.allowedUsers) != null && e.length) ? A.DesignedUserCanEdit : A.OnlyMe;
|
|
4293
4293
|
}
|
|
4294
4294
|
/**
|
|
4295
4295
|
* Set permission points based on options (for local runtime control)
|
|
4296
4296
|
* @private
|
|
4297
4297
|
*/
|
|
4298
|
-
async _setPermissionPoints(
|
|
4298
|
+
async _setPermissionPoints(s, e) {
|
|
4299
4299
|
if (!e)
|
|
4300
4300
|
return;
|
|
4301
|
-
const t = (
|
|
4302
|
-
await this._setPermissionPoint(
|
|
4301
|
+
const t = (n, i) => n === void 0 ? i : typeof n == "boolean" ? n : !0;
|
|
4302
|
+
await this._setPermissionPoint(s, k.Edit, t(e.allowEdit, !1)), await this._setPermissionPoint(s, k.View, t(e.allowViewByOthers, !0));
|
|
4303
4303
|
}
|
|
4304
4304
|
/**
|
|
4305
4305
|
* Set a single permission point
|
|
4306
4306
|
* @private
|
|
4307
4307
|
*/
|
|
4308
|
-
async _setPermissionPoint(
|
|
4309
|
-
const
|
|
4310
|
-
if (!
|
|
4308
|
+
async _setPermissionPoint(s, e, t) {
|
|
4309
|
+
const n = Q[e];
|
|
4310
|
+
if (!n)
|
|
4311
4311
|
return;
|
|
4312
|
-
const i = new
|
|
4312
|
+
const i = new n(this._unitId, this._subUnitId, s);
|
|
4313
4313
|
this._permissionService.getPermissionPoint(i.id) || this._permissionService.addPermissionPoint(i), this._permissionService.updatePermissionPoint(i.id, t);
|
|
4314
4314
|
}
|
|
4315
4315
|
/**
|
|
@@ -4323,10 +4323,10 @@ let Ve = class {
|
|
|
4323
4323
|
* ```
|
|
4324
4324
|
*/
|
|
4325
4325
|
async unprotect() {
|
|
4326
|
-
const
|
|
4327
|
-
if (!
|
|
4326
|
+
const s = this._getProtectionRule();
|
|
4327
|
+
if (!s)
|
|
4328
4328
|
return;
|
|
4329
|
-
const e =
|
|
4329
|
+
const e = s.id;
|
|
4330
4330
|
await this._commandService.executeCommand(Se.id, {
|
|
4331
4331
|
unitId: this._unitId,
|
|
4332
4332
|
subUnitId: this._subUnitId,
|
|
@@ -4362,18 +4362,18 @@ let Ve = class {
|
|
|
4362
4362
|
* unsubscribe?.();
|
|
4363
4363
|
* ```
|
|
4364
4364
|
*/
|
|
4365
|
-
subscribe(
|
|
4366
|
-
const e = this.permission$.subscribe(
|
|
4365
|
+
subscribe(s) {
|
|
4366
|
+
const e = this.permission$.subscribe(s);
|
|
4367
4367
|
return () => e.unsubscribe();
|
|
4368
4368
|
}
|
|
4369
4369
|
/**
|
|
4370
4370
|
* Get the protection rule for the current range
|
|
4371
4371
|
*/
|
|
4372
4372
|
_getProtectionRule() {
|
|
4373
|
-
const
|
|
4374
|
-
for (const t of
|
|
4375
|
-
for (const
|
|
4376
|
-
if (e.startRow ===
|
|
4373
|
+
const s = this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId, this._subUnitId), e = this._range.getRange();
|
|
4374
|
+
for (const t of s)
|
|
4375
|
+
for (const n of t.ranges)
|
|
4376
|
+
if (e.startRow === n.startRow && e.startColumn === n.startColumn && e.endRow === n.endRow && e.endColumn === n.endColumn)
|
|
4377
4377
|
return t;
|
|
4378
4378
|
return null;
|
|
4379
4379
|
}
|
|
@@ -4389,18 +4389,18 @@ let Ve = class {
|
|
|
4389
4389
|
i.endRow - i.startRow + 1,
|
|
4390
4390
|
i.endColumn - i.startColumn + 1
|
|
4391
4391
|
)
|
|
4392
|
-
),
|
|
4392
|
+
), n = {
|
|
4393
4393
|
name: e.description || "",
|
|
4394
4394
|
allowViewByOthers: e.viewState !== V.NoOneElseCanView
|
|
4395
4395
|
};
|
|
4396
|
-
return e.editState === A.DesignedUserCanEdit ?
|
|
4396
|
+
return e.editState === A.DesignedUserCanEdit ? n.allowEdit = !0 : n.allowEdit = !1, this._injector.createInstance(
|
|
4397
4397
|
N,
|
|
4398
4398
|
this._unitId,
|
|
4399
4399
|
this._subUnitId,
|
|
4400
4400
|
e.id,
|
|
4401
4401
|
e.permissionId,
|
|
4402
4402
|
t,
|
|
4403
|
-
|
|
4403
|
+
n
|
|
4404
4404
|
);
|
|
4405
4405
|
});
|
|
4406
4406
|
}
|
|
@@ -4409,10 +4409,10 @@ let Ve = class {
|
|
|
4409
4409
|
* @private
|
|
4410
4410
|
*/
|
|
4411
4411
|
async _buildProtectionRulesAsync() {
|
|
4412
|
-
const
|
|
4412
|
+
const s = this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId, this._subUnitId);
|
|
4413
4413
|
return (await Promise.all(
|
|
4414
|
-
|
|
4415
|
-
const
|
|
4414
|
+
s.map(async (t) => {
|
|
4415
|
+
const n = t.ranges.map(
|
|
4416
4416
|
(r) => this._worksheet.getRange(
|
|
4417
4417
|
r.startRow,
|
|
4418
4418
|
r.startColumn,
|
|
@@ -4440,18 +4440,18 @@ let Ve = class {
|
|
|
4440
4440
|
i.allowEdit = !1;
|
|
4441
4441
|
return {
|
|
4442
4442
|
rule: t,
|
|
4443
|
-
ranges:
|
|
4443
|
+
ranges: n,
|
|
4444
4444
|
options: i
|
|
4445
4445
|
};
|
|
4446
4446
|
})
|
|
4447
4447
|
)).map(
|
|
4448
|
-
({ rule: t, ranges:
|
|
4448
|
+
({ rule: t, ranges: n, options: i }) => this._injector.createInstance(
|
|
4449
4449
|
N,
|
|
4450
4450
|
this._unitId,
|
|
4451
4451
|
this._subUnitId,
|
|
4452
4452
|
t.id,
|
|
4453
4453
|
t.permissionId,
|
|
4454
|
-
|
|
4454
|
+
n,
|
|
4455
4455
|
i
|
|
4456
4456
|
)
|
|
4457
4457
|
);
|
|
@@ -4460,33 +4460,33 @@ let Ve = class {
|
|
|
4460
4460
|
* Build permission snapshot
|
|
4461
4461
|
*/
|
|
4462
4462
|
_buildSnapshot() {
|
|
4463
|
-
const
|
|
4463
|
+
const s = {};
|
|
4464
4464
|
return Object.values(k).forEach((e) => {
|
|
4465
|
-
|
|
4466
|
-
}),
|
|
4465
|
+
s[e] = this.getPoint(e);
|
|
4466
|
+
}), s;
|
|
4467
4467
|
}
|
|
4468
4468
|
/**
|
|
4469
4469
|
* Clean up resources
|
|
4470
4470
|
*/
|
|
4471
4471
|
dispose() {
|
|
4472
|
-
this._subscriptions.forEach((
|
|
4472
|
+
this._subscriptions.forEach((s) => s.unsubscribe()), this._permissionSubject.complete();
|
|
4473
4473
|
}
|
|
4474
4474
|
};
|
|
4475
|
-
Ve = $
|
|
4475
|
+
Ve = $s([
|
|
4476
4476
|
Y(4, l(p)),
|
|
4477
4477
|
Y(5, l(K)),
|
|
4478
4478
|
Y(6, l(ee)),
|
|
4479
4479
|
Y(7, l(S)),
|
|
4480
4480
|
Y(8, l(te))
|
|
4481
4481
|
], Ve);
|
|
4482
|
-
var
|
|
4483
|
-
for (var i =
|
|
4484
|
-
(o =
|
|
4482
|
+
var Ls = Object.getOwnPropertyDescriptor, zs = (s, e, t, n) => {
|
|
4483
|
+
for (var i = n > 1 ? void 0 : n ? Ls(e, t) : e, r = s.length - 1, o; r >= 0; r--)
|
|
4484
|
+
(o = s[r]) && (i = o(i) || i);
|
|
4485
4485
|
return i;
|
|
4486
|
-
}, Pe = (
|
|
4486
|
+
}, Pe = (s, e) => (t, n) => e(t, n, s), G;
|
|
4487
4487
|
let I = (G = class extends Fe {
|
|
4488
|
-
constructor(e, t,
|
|
4489
|
-
super(i), this._workbook = e, this._worksheet = t, this._range =
|
|
4488
|
+
constructor(e, t, n, i, r, o) {
|
|
4489
|
+
super(i), this._workbook = e, this._worksheet = t, this._range = n, this._injector = i, this._commandService = r, this._formulaDataModel = o, this._runInitializers(
|
|
4490
4490
|
this._injector,
|
|
4491
4491
|
this._workbook,
|
|
4492
4492
|
this._worksheet,
|
|
@@ -4652,8 +4652,8 @@ let I = (G = class extends Fe {
|
|
|
4652
4652
|
* ```
|
|
4653
4653
|
*/
|
|
4654
4654
|
isMerged() {
|
|
4655
|
-
const { startColumn: e, startRow: t, endColumn:
|
|
4656
|
-
return this._worksheet.getMergedCellRange(t, e, i,
|
|
4655
|
+
const { startColumn: e, startRow: t, endColumn: n, endRow: i } = this._range;
|
|
4656
|
+
return this._worksheet.getMergedCellRange(t, e, i, n).some((o) => B.equals(o, this._range));
|
|
4657
4657
|
}
|
|
4658
4658
|
/**
|
|
4659
4659
|
* Return first cell style data in this range. Please note that if there are row styles, col styles and (or)
|
|
@@ -4694,8 +4694,8 @@ let I = (G = class extends Fe {
|
|
|
4694
4694
|
* ```
|
|
4695
4695
|
*/
|
|
4696
4696
|
getFontFamily(e = "row") {
|
|
4697
|
-
var t,
|
|
4698
|
-
return (
|
|
4697
|
+
var t, n;
|
|
4698
|
+
return (n = (t = this.getCellStyleData(e)) == null ? void 0 : t.ff) != null ? n : null;
|
|
4699
4699
|
}
|
|
4700
4700
|
/**
|
|
4701
4701
|
* Get the font size of the cell.
|
|
@@ -4715,8 +4715,8 @@ let I = (G = class extends Fe {
|
|
|
4715
4715
|
* ```
|
|
4716
4716
|
*/
|
|
4717
4717
|
getFontSize(e = "row") {
|
|
4718
|
-
var t,
|
|
4719
|
-
return (
|
|
4718
|
+
var t, n;
|
|
4719
|
+
return (n = (t = this.getCellStyleData(e)) == null ? void 0 : t.fs) != null ? n : null;
|
|
4720
4720
|
}
|
|
4721
4721
|
/**
|
|
4722
4722
|
* Return first cell style in this range.
|
|
@@ -4757,15 +4757,15 @@ let I = (G = class extends Fe {
|
|
|
4757
4757
|
* ```
|
|
4758
4758
|
*/
|
|
4759
4759
|
getCellStyles(e = "row") {
|
|
4760
|
-
return this.getCellDatas().map((
|
|
4760
|
+
return this.getCellDatas().map((n, i) => n.map((r, o) => {
|
|
4761
4761
|
if (!r) return null;
|
|
4762
4762
|
const a = e !== "cell" ? this._worksheet.getComposedCellStyle(i + this._range.startRow, o + this._range.startColumn, e === "row") : this._worksheet.getCellStyle(i + this._range.startRow, o + this._range.startColumn);
|
|
4763
4763
|
return a ? Ke.create(a) : null;
|
|
4764
4764
|
}));
|
|
4765
4765
|
}
|
|
4766
4766
|
getValue(e) {
|
|
4767
|
-
var t,
|
|
4768
|
-
return e ? this.getValueAndRichTextValue() : (
|
|
4767
|
+
var t, n;
|
|
4768
|
+
return e ? this.getValueAndRichTextValue() : (n = (t = this._worksheet.getCell(this._range.startRow, this._range.startColumn)) == null ? void 0 : t.v) != null ? n : null;
|
|
4769
4769
|
}
|
|
4770
4770
|
/**
|
|
4771
4771
|
* Returns the raw value of the top-left cell in the range. Empty cells return `null`.
|
|
@@ -4787,9 +4787,9 @@ let I = (G = class extends Fe {
|
|
|
4787
4787
|
* ```
|
|
4788
4788
|
*/
|
|
4789
4789
|
getRawValue() {
|
|
4790
|
-
var t,
|
|
4790
|
+
var t, n;
|
|
4791
4791
|
const e = this._worksheet.getCellMatrix().getValue(this._range.startRow, this._range.startColumn);
|
|
4792
|
-
return e != null && e.p && ((t = e.p.body) != null && t.dataStream) ? e.p.body.dataStream : (
|
|
4792
|
+
return e != null && e.p && ((t = e.p.body) != null && t.dataStream) ? e.p.body.dataStream : (n = e == null ? void 0 : e.v) != null ? n : null;
|
|
4793
4793
|
}
|
|
4794
4794
|
/**
|
|
4795
4795
|
* Returns the displayed value of the top-left cell in the range. The value is a String. Empty cells return an empty string.
|
|
@@ -4811,16 +4811,16 @@ let I = (G = class extends Fe {
|
|
|
4811
4811
|
* ```
|
|
4812
4812
|
*/
|
|
4813
4813
|
getDisplayValue() {
|
|
4814
|
-
var t,
|
|
4814
|
+
var t, n, i;
|
|
4815
4815
|
const e = this._worksheet.getCell(this._range.startRow, this._range.startColumn);
|
|
4816
|
-
return e != null && e.p && ((t = e.p.body) != null && t.dataStream) ? e.p.body.dataStream : (i = (
|
|
4816
|
+
return e != null && e.p && ((t = e.p.body) != null && t.dataStream) ? e.p.body.dataStream : (i = (n = e == null ? void 0 : e.v) == null ? void 0 : n.toString()) != null ? i : "";
|
|
4817
4817
|
}
|
|
4818
4818
|
getValues(e) {
|
|
4819
4819
|
var a, h;
|
|
4820
4820
|
if (e)
|
|
4821
4821
|
return this.getValueAndRichTextValues();
|
|
4822
|
-
const { startRow: t, endRow:
|
|
4823
|
-
for (let c = t; c <=
|
|
4822
|
+
const { startRow: t, endRow: n, startColumn: i, endColumn: r } = this._range, o = [];
|
|
4823
|
+
for (let c = t; c <= n; c++) {
|
|
4824
4824
|
const d = [];
|
|
4825
4825
|
for (let w = i; w <= r; w++)
|
|
4826
4826
|
d.push((h = (a = this._worksheet.getCell(c, w)) == null ? void 0 : a.v) != null ? h : null);
|
|
@@ -4872,8 +4872,8 @@ let I = (G = class extends Fe {
|
|
|
4872
4872
|
*/
|
|
4873
4873
|
getRawValues() {
|
|
4874
4874
|
var a, h;
|
|
4875
|
-
const e = this._worksheet.getCellMatrix(), { startRow: t, endRow:
|
|
4876
|
-
for (let c = t; c <=
|
|
4875
|
+
const e = this._worksheet.getCellMatrix(), { startRow: t, endRow: n, startColumn: i, endColumn: r } = this._range, o = [];
|
|
4876
|
+
for (let c = t; c <= n; c++) {
|
|
4877
4877
|
const d = [];
|
|
4878
4878
|
for (let w = i; w <= r; w++) {
|
|
4879
4879
|
const g = e.getValue(c, w);
|
|
@@ -4927,10 +4927,10 @@ let I = (G = class extends Fe {
|
|
|
4927
4927
|
*/
|
|
4928
4928
|
getDisplayValues() {
|
|
4929
4929
|
var o, a, h;
|
|
4930
|
-
const { startRow: e, endRow: t, startColumn:
|
|
4930
|
+
const { startRow: e, endRow: t, startColumn: n, endColumn: i } = this._range, r = [];
|
|
4931
4931
|
for (let c = e; c <= t; c++) {
|
|
4932
4932
|
const d = [];
|
|
4933
|
-
for (let w =
|
|
4933
|
+
for (let w = n; w <= i; w++) {
|
|
4934
4934
|
const g = this._worksheet.getCell(c, w);
|
|
4935
4935
|
g != null && g.p && ((o = g.p.body) != null && o.dataStream) ? d.push(g.p.body.dataStream) : d.push((h = (a = g == null ? void 0 : g.v) == null ? void 0 : a.toString()) != null ? h : "");
|
|
4936
4936
|
}
|
|
@@ -4979,10 +4979,10 @@ let I = (G = class extends Fe {
|
|
|
4979
4979
|
* ```
|
|
4980
4980
|
*/
|
|
4981
4981
|
getCellDataGrid() {
|
|
4982
|
-
const { startRow: e, endRow: t, startColumn:
|
|
4982
|
+
const { startRow: e, endRow: t, startColumn: n, endColumn: i } = this._range, r = [];
|
|
4983
4983
|
for (let o = e; o <= t; o++) {
|
|
4984
4984
|
const a = [];
|
|
4985
|
-
for (let h =
|
|
4985
|
+
for (let h = n; h <= i; h++)
|
|
4986
4986
|
a.push(this._worksheet.getCellRaw(o, h));
|
|
4987
4987
|
r.push(a);
|
|
4988
4988
|
}
|
|
@@ -5019,7 +5019,7 @@ let I = (G = class extends Fe {
|
|
|
5019
5019
|
* ```
|
|
5020
5020
|
*/
|
|
5021
5021
|
getRichTextValues() {
|
|
5022
|
-
return this.getCellDataGrid().map((t) => t.map((
|
|
5022
|
+
return this.getCellDataGrid().map((t) => t.map((n) => n != null && n.p ? new F(n.p) : null));
|
|
5023
5023
|
}
|
|
5024
5024
|
/**
|
|
5025
5025
|
* Returns the value and rich text value for the cell at the start of this range.
|
|
@@ -5050,7 +5050,7 @@ let I = (G = class extends Fe {
|
|
|
5050
5050
|
* ```
|
|
5051
5051
|
*/
|
|
5052
5052
|
getValueAndRichTextValues() {
|
|
5053
|
-
return this.getCellDatas().map((t) => t.map((
|
|
5053
|
+
return this.getCellDatas().map((t) => t.map((n) => n != null && n.p ? new F(n.p) : n == null ? void 0 : n.v));
|
|
5054
5054
|
}
|
|
5055
5055
|
/**
|
|
5056
5056
|
* 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.
|
|
@@ -5084,8 +5084,8 @@ let I = (G = class extends Fe {
|
|
|
5084
5084
|
* ```
|
|
5085
5085
|
*/
|
|
5086
5086
|
getFormulas() {
|
|
5087
|
-
const e = [], { startRow: t, endRow:
|
|
5088
|
-
for (let h = t; h <=
|
|
5087
|
+
const e = [], { startRow: t, endRow: n, startColumn: i, endColumn: r } = this._range, o = this._worksheet.getSheetId(), a = this._workbook.getUnitId();
|
|
5088
|
+
for (let h = t; h <= n; h++) {
|
|
5089
5089
|
const c = [];
|
|
5090
5090
|
for (let d = i; d <= r; d++) {
|
|
5091
5091
|
const w = this._formulaDataModel.getFormulaStringByCell(h, d, o, a);
|
|
@@ -5121,7 +5121,7 @@ let I = (G = class extends Fe {
|
|
|
5121
5121
|
*/
|
|
5122
5122
|
getWraps() {
|
|
5123
5123
|
const e = this.getCellDatas(), t = this._workbook.getStyles();
|
|
5124
|
-
return e.map((
|
|
5124
|
+
return e.map((n) => n.map((i) => {
|
|
5125
5125
|
var r;
|
|
5126
5126
|
return ((r = t.getStyleByCell(i)) == null ? void 0 : r.tb) === ae.WRAP;
|
|
5127
5127
|
}));
|
|
@@ -5167,7 +5167,7 @@ let I = (G = class extends Fe {
|
|
|
5167
5167
|
* ```
|
|
5168
5168
|
*/
|
|
5169
5169
|
getHorizontalAlignments() {
|
|
5170
|
-
return this._worksheet.getRange(this._range).getHorizontalAlignments().map((t) => t.map((
|
|
5170
|
+
return this._worksheet.getRange(this._range).getHorizontalAlignments().map((t) => t.map((n) => mt(n)));
|
|
5171
5171
|
}
|
|
5172
5172
|
/**
|
|
5173
5173
|
* Returns the vertical alignment (top/middle/bottom) of the top-left cell in the range.
|
|
@@ -5195,7 +5195,7 @@ let I = (G = class extends Fe {
|
|
|
5195
5195
|
* ```
|
|
5196
5196
|
*/
|
|
5197
5197
|
getVerticalAlignments() {
|
|
5198
|
-
return this._worksheet.getRange(this._range).getVerticalAlignments().map((t) => t.map((
|
|
5198
|
+
return this._worksheet.getRange(this._range).getVerticalAlignments().map((t) => t.map((n) => gt(n)));
|
|
5199
5199
|
}
|
|
5200
5200
|
/**
|
|
5201
5201
|
* Set custom meta data for first cell in current range.
|
|
@@ -5230,7 +5230,7 @@ let I = (G = class extends Fe {
|
|
|
5230
5230
|
* ```
|
|
5231
5231
|
*/
|
|
5232
5232
|
setCustomMetaDatas(e) {
|
|
5233
|
-
return this.setValues(e.map((t) => t.map((
|
|
5233
|
+
return this.setValues(e.map((t) => t.map((n) => ({ custom: n }))));
|
|
5234
5234
|
}
|
|
5235
5235
|
/**
|
|
5236
5236
|
* Returns the custom meta data for the cell at the start of this range.
|
|
@@ -5260,9 +5260,9 @@ let I = (G = class extends Fe {
|
|
|
5260
5260
|
* ```
|
|
5261
5261
|
*/
|
|
5262
5262
|
getCustomMetaDatas() {
|
|
5263
|
-
return this.getCellDataGrid().map((t) => t.map((
|
|
5263
|
+
return this.getCellDataGrid().map((t) => t.map((n) => {
|
|
5264
5264
|
var i;
|
|
5265
|
-
return (i =
|
|
5265
|
+
return (i = n == null ? void 0 : n.custom) != null ? i : null;
|
|
5266
5266
|
}));
|
|
5267
5267
|
}
|
|
5268
5268
|
/**
|
|
@@ -5279,15 +5279,15 @@ let I = (G = class extends Fe {
|
|
|
5279
5279
|
* fRange.setBorder(univerAPI.Enum.BorderType.ALL, univerAPI.Enum.BorderStyleTypes.THIN, '#ff0000');
|
|
5280
5280
|
* ```
|
|
5281
5281
|
*/
|
|
5282
|
-
setBorder(e, t,
|
|
5283
|
-
return this._commandService.syncExecuteCommand(
|
|
5282
|
+
setBorder(e, t, n) {
|
|
5283
|
+
return this._commandService.syncExecuteCommand(Qn.id, {
|
|
5284
5284
|
unitId: this._workbook.getUnitId(),
|
|
5285
5285
|
subUnitId: this._worksheet.getSheetId(),
|
|
5286
5286
|
ranges: [this._range],
|
|
5287
5287
|
value: {
|
|
5288
5288
|
type: e,
|
|
5289
5289
|
style: t,
|
|
5290
|
-
color:
|
|
5290
|
+
color: n
|
|
5291
5291
|
}
|
|
5292
5292
|
}), this;
|
|
5293
5293
|
}
|
|
@@ -5304,9 +5304,9 @@ let I = (G = class extends Fe {
|
|
|
5304
5304
|
* ```
|
|
5305
5305
|
*/
|
|
5306
5306
|
getBackground() {
|
|
5307
|
-
var t,
|
|
5307
|
+
var t, n;
|
|
5308
5308
|
const e = this.getCellStyle();
|
|
5309
|
-
return (
|
|
5309
|
+
return (n = (t = e == null ? void 0 : e.background) == null ? void 0 : t.rgb) != null ? n : Je.bg.rgb;
|
|
5310
5310
|
}
|
|
5311
5311
|
/**
|
|
5312
5312
|
* Returns the background colors of the cells in the range.
|
|
@@ -5320,9 +5320,9 @@ let I = (G = class extends Fe {
|
|
|
5320
5320
|
* ```
|
|
5321
5321
|
*/
|
|
5322
5322
|
getBackgrounds() {
|
|
5323
|
-
return this.getCellStyles().map((t) => t.map((
|
|
5323
|
+
return this.getCellStyles().map((t) => t.map((n) => {
|
|
5324
5324
|
var i, r;
|
|
5325
|
-
return (r = (i =
|
|
5325
|
+
return (r = (i = n == null ? void 0 : n.background) == null ? void 0 : i.rgb) != null ? r : Je.bg.rgb;
|
|
5326
5326
|
}));
|
|
5327
5327
|
}
|
|
5328
5328
|
/**
|
|
@@ -5378,7 +5378,7 @@ let I = (G = class extends Fe {
|
|
|
5378
5378
|
* ```
|
|
5379
5379
|
*/
|
|
5380
5380
|
setTextRotation(e) {
|
|
5381
|
-
return this._commandService.syncExecuteCommand(
|
|
5381
|
+
return this._commandService.syncExecuteCommand(Xn.id, {
|
|
5382
5382
|
unitId: this._workbook.getUnitId(),
|
|
5383
5383
|
subUnitId: this._worksheet.getSheetId(),
|
|
5384
5384
|
range: this._range,
|
|
@@ -5461,7 +5461,7 @@ let I = (G = class extends Fe {
|
|
|
5461
5461
|
* ```
|
|
5462
5462
|
*/
|
|
5463
5463
|
setRichTextValueForCell(e) {
|
|
5464
|
-
const t = e instanceof F ? e.getData() : e,
|
|
5464
|
+
const t = e instanceof F ? e.getData() : e, n = {
|
|
5465
5465
|
unitId: this._workbook.getUnitId(),
|
|
5466
5466
|
subUnitId: this._worksheet.getSheetId(),
|
|
5467
5467
|
range: {
|
|
@@ -5472,7 +5472,7 @@ let I = (G = class extends Fe {
|
|
|
5472
5472
|
},
|
|
5473
5473
|
value: { p: t }
|
|
5474
5474
|
};
|
|
5475
|
-
return this._commandService.syncExecuteCommand(q.id,
|
|
5475
|
+
return this._commandService.syncExecuteCommand(q.id, n), this;
|
|
5476
5476
|
}
|
|
5477
5477
|
/**
|
|
5478
5478
|
* Set the rich text value for the cells in the range.
|
|
@@ -5498,11 +5498,11 @@ let I = (G = class extends Fe {
|
|
|
5498
5498
|
* ```
|
|
5499
5499
|
*/
|
|
5500
5500
|
setRichTextValues(e) {
|
|
5501
|
-
const t = e.map((r) => r.map((o) => o && { p: o instanceof F ? o.getData() : o })),
|
|
5501
|
+
const t = e.map((r) => r.map((o) => o && { p: o instanceof F ? o.getData() : o })), n = qe(t, this._range), i = {
|
|
5502
5502
|
unitId: this._workbook.getUnitId(),
|
|
5503
5503
|
subUnitId: this._worksheet.getSheetId(),
|
|
5504
5504
|
range: this._range,
|
|
5505
|
-
value:
|
|
5505
|
+
value: n
|
|
5506
5506
|
};
|
|
5507
5507
|
return this._commandService.syncExecuteCommand(q.id, i), this;
|
|
5508
5508
|
}
|
|
@@ -5562,11 +5562,11 @@ let I = (G = class extends Fe {
|
|
|
5562
5562
|
* ```
|
|
5563
5563
|
*/
|
|
5564
5564
|
setVerticalAlignment(e) {
|
|
5565
|
-
return this._commandService.syncExecuteCommand(
|
|
5565
|
+
return this._commandService.syncExecuteCommand(es.id, {
|
|
5566
5566
|
unitId: this._workbook.getUnitId(),
|
|
5567
5567
|
subUnitId: this._worksheet.getSheetId(),
|
|
5568
5568
|
range: this._range,
|
|
5569
|
-
value:
|
|
5569
|
+
value: As(e)
|
|
5570
5570
|
}), this;
|
|
5571
5571
|
}
|
|
5572
5572
|
/**
|
|
@@ -5582,11 +5582,11 @@ let I = (G = class extends Fe {
|
|
|
5582
5582
|
* ```
|
|
5583
5583
|
*/
|
|
5584
5584
|
setHorizontalAlignment(e) {
|
|
5585
|
-
return this._commandService.syncExecuteCommand(
|
|
5585
|
+
return this._commandService.syncExecuteCommand(ts.id, {
|
|
5586
5586
|
unitId: this._workbook.getUnitId(),
|
|
5587
5587
|
subUnitId: this._worksheet.getSheetId(),
|
|
5588
5588
|
range: this._range,
|
|
5589
|
-
value:
|
|
5589
|
+
value: Vs(e)
|
|
5590
5590
|
}), this;
|
|
5591
5591
|
}
|
|
5592
5592
|
/**
|
|
@@ -5635,14 +5635,14 @@ let I = (G = class extends Fe {
|
|
|
5635
5635
|
t = null;
|
|
5636
5636
|
else
|
|
5637
5637
|
throw new Error("Invalid fontWeight");
|
|
5638
|
-
const
|
|
5638
|
+
const n = {
|
|
5639
5639
|
type: "bl",
|
|
5640
5640
|
value: t
|
|
5641
5641
|
}, i = {
|
|
5642
5642
|
unitId: this._workbook.getUnitId(),
|
|
5643
5643
|
subUnitId: this._worksheet.getSheetId(),
|
|
5644
5644
|
range: this._range,
|
|
5645
|
-
style:
|
|
5645
|
+
style: n
|
|
5646
5646
|
};
|
|
5647
5647
|
return this._commandService.syncExecuteCommand(D.id, i), this;
|
|
5648
5648
|
}
|
|
@@ -5668,14 +5668,14 @@ let I = (G = class extends Fe {
|
|
|
5668
5668
|
t = null;
|
|
5669
5669
|
else
|
|
5670
5670
|
throw new Error("Invalid fontStyle");
|
|
5671
|
-
const
|
|
5671
|
+
const n = {
|
|
5672
5672
|
type: "it",
|
|
5673
5673
|
value: t
|
|
5674
5674
|
}, i = {
|
|
5675
5675
|
unitId: this._workbook.getUnitId(),
|
|
5676
5676
|
subUnitId: this._worksheet.getSheetId(),
|
|
5677
5677
|
range: this._range,
|
|
5678
|
-
style:
|
|
5678
|
+
style: n
|
|
5679
5679
|
};
|
|
5680
5680
|
return this._commandService.syncExecuteCommand(D.id, i), this;
|
|
5681
5681
|
}
|
|
@@ -5721,13 +5721,13 @@ let I = (G = class extends Fe {
|
|
|
5721
5721
|
const t = {
|
|
5722
5722
|
type: "ul",
|
|
5723
5723
|
value: e
|
|
5724
|
-
},
|
|
5724
|
+
}, n = {
|
|
5725
5725
|
unitId: this._workbook.getUnitId(),
|
|
5726
5726
|
subUnitId: this._worksheet.getSheetId(),
|
|
5727
5727
|
range: this._range,
|
|
5728
5728
|
style: t
|
|
5729
5729
|
};
|
|
5730
|
-
this._commandService.syncExecuteCommand(D.id,
|
|
5730
|
+
this._commandService.syncExecuteCommand(D.id, n);
|
|
5731
5731
|
}
|
|
5732
5732
|
/**
|
|
5733
5733
|
* Sets the font strikethrough style of the given ITextDecoration
|
|
@@ -5738,13 +5738,13 @@ let I = (G = class extends Fe {
|
|
|
5738
5738
|
const t = {
|
|
5739
5739
|
type: "st",
|
|
5740
5740
|
value: e
|
|
5741
|
-
},
|
|
5741
|
+
}, n = {
|
|
5742
5742
|
unitId: this._workbook.getUnitId(),
|
|
5743
5743
|
subUnitId: this._worksheet.getSheetId(),
|
|
5744
5744
|
range: this._range,
|
|
5745
5745
|
style: t
|
|
5746
5746
|
};
|
|
5747
|
-
this._commandService.syncExecuteCommand(D.id,
|
|
5747
|
+
this._commandService.syncExecuteCommand(D.id, n);
|
|
5748
5748
|
}
|
|
5749
5749
|
/**
|
|
5750
5750
|
* Sets the font family, such as "Arial" or "Helvetica".
|
|
@@ -5762,13 +5762,13 @@ let I = (G = class extends Fe {
|
|
|
5762
5762
|
const t = {
|
|
5763
5763
|
type: "ff",
|
|
5764
5764
|
value: e
|
|
5765
|
-
},
|
|
5765
|
+
}, n = {
|
|
5766
5766
|
unitId: this._workbook.getUnitId(),
|
|
5767
5767
|
subUnitId: this._worksheet.getSheetId(),
|
|
5768
5768
|
range: this._range,
|
|
5769
5769
|
style: t
|
|
5770
5770
|
};
|
|
5771
|
-
return this._commandService.syncExecuteCommand(D.id,
|
|
5771
|
+
return this._commandService.syncExecuteCommand(D.id, n), this;
|
|
5772
5772
|
}
|
|
5773
5773
|
/**
|
|
5774
5774
|
* Sets the font size, with the size being the point size to use.
|
|
@@ -5786,13 +5786,13 @@ let I = (G = class extends Fe {
|
|
|
5786
5786
|
const t = {
|
|
5787
5787
|
type: "fs",
|
|
5788
5788
|
value: e
|
|
5789
|
-
},
|
|
5789
|
+
}, n = {
|
|
5790
5790
|
unitId: this._workbook.getUnitId(),
|
|
5791
5791
|
subUnitId: this._worksheet.getSheetId(),
|
|
5792
5792
|
range: this._range,
|
|
5793
5793
|
style: t
|
|
5794
5794
|
};
|
|
5795
|
-
return this._commandService.syncExecuteCommand(D.id,
|
|
5795
|
+
return this._commandService.syncExecuteCommand(D.id, n), this;
|
|
5796
5796
|
}
|
|
5797
5797
|
/**
|
|
5798
5798
|
* Sets the font color in CSS notation (such as '#ffffff' or 'white').
|
|
@@ -5807,14 +5807,14 @@ let I = (G = class extends Fe {
|
|
|
5807
5807
|
* ```
|
|
5808
5808
|
*/
|
|
5809
5809
|
setFontColor(e) {
|
|
5810
|
-
const
|
|
5810
|
+
const n = {
|
|
5811
5811
|
type: "cl",
|
|
5812
5812
|
value: e === null ? null : { rgb: e }
|
|
5813
5813
|
}, i = {
|
|
5814
5814
|
unitId: this._workbook.getUnitId(),
|
|
5815
5815
|
subUnitId: this._worksheet.getSheetId(),
|
|
5816
5816
|
range: this._range,
|
|
5817
|
-
style:
|
|
5817
|
+
style: n
|
|
5818
5818
|
};
|
|
5819
5819
|
return this._commandService.syncExecuteCommand(D.id, i), this;
|
|
5820
5820
|
}
|
|
@@ -5834,8 +5834,8 @@ let I = (G = class extends Fe {
|
|
|
5834
5834
|
* ```
|
|
5835
5835
|
*/
|
|
5836
5836
|
merge(e = !0) {
|
|
5837
|
-
const t = this._workbook.getUnitId(),
|
|
5838
|
-
return fe(this._injector, t,
|
|
5837
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
|
|
5838
|
+
return fe(this._injector, t, n, [this._range], e), this;
|
|
5839
5839
|
}
|
|
5840
5840
|
/**
|
|
5841
5841
|
* Merges cells in a range horizontally.
|
|
@@ -5856,8 +5856,8 @@ let I = (G = class extends Fe {
|
|
|
5856
5856
|
* ```
|
|
5857
5857
|
*/
|
|
5858
5858
|
mergeAcross(e = !0) {
|
|
5859
|
-
const t = ct([this._range], H.ROWS),
|
|
5860
|
-
return fe(this._injector,
|
|
5859
|
+
const t = ct([this._range], H.ROWS), n = this._workbook.getUnitId(), i = this._worksheet.getSheetId();
|
|
5860
|
+
return fe(this._injector, n, i, t, e), this;
|
|
5861
5861
|
}
|
|
5862
5862
|
/**
|
|
5863
5863
|
* Merges cells in a range vertically.
|
|
@@ -5878,8 +5878,8 @@ let I = (G = class extends Fe {
|
|
|
5878
5878
|
* ```
|
|
5879
5879
|
*/
|
|
5880
5880
|
mergeVertically(e = !0) {
|
|
5881
|
-
const t = ct([this._range], H.COLUMNS),
|
|
5882
|
-
return fe(this._injector,
|
|
5881
|
+
const t = ct([this._range], H.COLUMNS), n = this._workbook.getUnitId(), i = this._worksheet.getSheetId();
|
|
5882
|
+
return fe(this._injector, n, i, t, e), this;
|
|
5883
5883
|
}
|
|
5884
5884
|
/**
|
|
5885
5885
|
* Returns true if cells in the current range overlap a merged cell.
|
|
@@ -5895,8 +5895,8 @@ let I = (G = class extends Fe {
|
|
|
5895
5895
|
* ```
|
|
5896
5896
|
*/
|
|
5897
5897
|
isPartOfMerge() {
|
|
5898
|
-
const { startRow: e, startColumn: t, endRow:
|
|
5899
|
-
return this._worksheet.getMergedCellRange(e, t,
|
|
5898
|
+
const { startRow: e, startColumn: t, endRow: n, endColumn: i } = this._range;
|
|
5899
|
+
return this._worksheet.getMergedCellRange(e, t, n, i).length > 0;
|
|
5900
5900
|
}
|
|
5901
5901
|
/**
|
|
5902
5902
|
* Break all horizontally- or vertically-merged cells contained within the range list into individual cells again.
|
|
@@ -5914,7 +5914,7 @@ let I = (G = class extends Fe {
|
|
|
5914
5914
|
* ```
|
|
5915
5915
|
*/
|
|
5916
5916
|
breakApart() {
|
|
5917
|
-
return this._commandService.syncExecuteCommand(
|
|
5917
|
+
return this._commandService.syncExecuteCommand(ns.id, { ranges: [this._range] }), this;
|
|
5918
5918
|
}
|
|
5919
5919
|
//#endregion
|
|
5920
5920
|
/**
|
|
@@ -5933,8 +5933,8 @@ let I = (G = class extends Fe {
|
|
|
5933
5933
|
* ```
|
|
5934
5934
|
*/
|
|
5935
5935
|
forEach(e) {
|
|
5936
|
-
const { startColumn: t, startRow:
|
|
5937
|
-
this._worksheet.getMatrixWithMergedCells(
|
|
5936
|
+
const { startColumn: t, startRow: n, endColumn: i, endRow: r } = this._range;
|
|
5937
|
+
this._worksheet.getMatrixWithMergedCells(n, t, r, i).forValue((o, a, h) => {
|
|
5938
5938
|
e(o, a, h);
|
|
5939
5939
|
});
|
|
5940
5940
|
}
|
|
@@ -5970,13 +5970,13 @@ let I = (G = class extends Fe {
|
|
|
5970
5970
|
* console.log(fRange.getA1Notation(true, univerAPI.Enum.AbsoluteRefType.ALL, univerAPI.Enum.AbsoluteRefType.ALL)); // Sheet1!$A$1:$B$2
|
|
5971
5971
|
* ```
|
|
5972
5972
|
*/
|
|
5973
|
-
getA1Notation(e, t,
|
|
5973
|
+
getA1Notation(e, t, n) {
|
|
5974
5974
|
const i = {
|
|
5975
5975
|
...this._range,
|
|
5976
5976
|
startAbsoluteRefType: t,
|
|
5977
|
-
endAbsoluteRefType:
|
|
5977
|
+
endAbsoluteRefType: n
|
|
5978
5978
|
};
|
|
5979
|
-
return e ?
|
|
5979
|
+
return e ? vs(this._worksheet.getName(), i) : Ge(i);
|
|
5980
5980
|
}
|
|
5981
5981
|
/**
|
|
5982
5982
|
* Sets the specified range as the active range, with the top left cell in the range as the current cell.
|
|
@@ -6082,13 +6082,13 @@ let I = (G = class extends Fe {
|
|
|
6082
6082
|
* fRange.splitTextToColumns(true, univerAPI.Enum.SplitDelimiterType.Custom, '#');
|
|
6083
6083
|
* ```
|
|
6084
6084
|
*/
|
|
6085
|
-
splitTextToColumns(e, t,
|
|
6086
|
-
this._commandService.syncExecuteCommand(
|
|
6085
|
+
splitTextToColumns(e, t, n) {
|
|
6086
|
+
this._commandService.syncExecuteCommand(ss.id, {
|
|
6087
6087
|
unitId: this._workbook.getUnitId(),
|
|
6088
6088
|
subUnitId: this._worksheet.getSheetId(),
|
|
6089
6089
|
range: this._range,
|
|
6090
6090
|
delimiter: t,
|
|
6091
|
-
customDelimiter:
|
|
6091
|
+
customDelimiter: n,
|
|
6092
6092
|
treatMultipleDelimitersAsOne: e
|
|
6093
6093
|
});
|
|
6094
6094
|
}
|
|
@@ -6108,7 +6108,7 @@ let I = (G = class extends Fe {
|
|
|
6108
6108
|
const t = this.getUsedThemeStyle();
|
|
6109
6109
|
t && this.removeThemeStyle(t);
|
|
6110
6110
|
} else
|
|
6111
|
-
this._commandService.syncExecuteCommand(
|
|
6111
|
+
this._commandService.syncExecuteCommand(is.id, {
|
|
6112
6112
|
unitId: this._workbook.getUnitId(),
|
|
6113
6113
|
subUnitId: this._worksheet.getSheetId(),
|
|
6114
6114
|
range: this._range,
|
|
@@ -6127,7 +6127,7 @@ let I = (G = class extends Fe {
|
|
|
6127
6127
|
* ```
|
|
6128
6128
|
*/
|
|
6129
6129
|
removeThemeStyle(e) {
|
|
6130
|
-
this._commandService.syncExecuteCommand(
|
|
6130
|
+
this._commandService.syncExecuteCommand(rs.id, {
|
|
6131
6131
|
unitId: this._workbook.getUnitId(),
|
|
6132
6132
|
subUnitId: this._worksheet.getSheetId(),
|
|
6133
6133
|
range: this._range,
|
|
@@ -6276,9 +6276,9 @@ let I = (G = class extends Fe {
|
|
|
6276
6276
|
* ```
|
|
6277
6277
|
*/
|
|
6278
6278
|
insertCells(e) {
|
|
6279
|
-
e === H.ROWS ? this._commandService.executeCommand(
|
|
6279
|
+
e === H.ROWS ? this._commandService.executeCommand(os.id, {
|
|
6280
6280
|
range: this._range
|
|
6281
|
-
}) : this._commandService.executeCommand(
|
|
6281
|
+
}) : this._commandService.executeCommand(as.id, {
|
|
6282
6282
|
range: this._range
|
|
6283
6283
|
});
|
|
6284
6284
|
}
|
|
@@ -6338,9 +6338,9 @@ let I = (G = class extends Fe {
|
|
|
6338
6338
|
* ```
|
|
6339
6339
|
*/
|
|
6340
6340
|
deleteCells(e) {
|
|
6341
|
-
e === H.ROWS ? this._commandService.executeCommand(
|
|
6341
|
+
e === H.ROWS ? this._commandService.executeCommand(hs.id, {
|
|
6342
6342
|
range: this._range
|
|
6343
|
-
}) : this._commandService.executeCommand(
|
|
6343
|
+
}) : this._commandService.executeCommand(cs.id, {
|
|
6344
6344
|
range: this._range
|
|
6345
6345
|
});
|
|
6346
6346
|
}
|
|
@@ -6382,19 +6382,19 @@ let I = (G = class extends Fe {
|
|
|
6382
6382
|
*/
|
|
6383
6383
|
// eslint-disable-next-line complexity
|
|
6384
6384
|
getDataRegion(e) {
|
|
6385
|
-
const { startRow: t, startColumn:
|
|
6386
|
-
let c = t, d =
|
|
6385
|
+
const { startRow: t, startColumn: n, endRow: i, endColumn: r } = this._range, o = this._worksheet.getMaxRows(), a = this._worksheet.getMaxColumns(), h = this._worksheet.getCellMatrix();
|
|
6386
|
+
let c = t, d = n, w = i, g = r;
|
|
6387
6387
|
if (e !== H.COLUMNS) {
|
|
6388
6388
|
let j = !1, O = !1;
|
|
6389
|
-
for (let P =
|
|
6389
|
+
for (let P = n; P <= r && (t > 0 && !J(h.getValue(t - 1, P)) && (j = !0), i < o - 1 && !J(h.getValue(i + 1, P)) && (O = !0), !(j && O)); P++)
|
|
6390
6390
|
;
|
|
6391
6391
|
j && (c = t - 1), O && (w = i + 1);
|
|
6392
6392
|
}
|
|
6393
6393
|
if (e !== H.ROWS) {
|
|
6394
6394
|
let j = !1, O = !1;
|
|
6395
|
-
for (let P = t; P <= i && (
|
|
6395
|
+
for (let P = t; P <= i && (n > 0 && !J(h.getValue(P, n - 1)) && (j = !0), r < a - 1 && !J(h.getValue(P, r + 1)) && (O = !0), !(j && O)); P++)
|
|
6396
6396
|
;
|
|
6397
|
-
j && (d =
|
|
6397
|
+
j && (d = n - 1), O && (g = r + 1);
|
|
6398
6398
|
}
|
|
6399
6399
|
return this._injector.createInstance(I, this._workbook, this._worksheet, {
|
|
6400
6400
|
startRow: c,
|
|
@@ -6420,10 +6420,10 @@ let I = (G = class extends Fe {
|
|
|
6420
6420
|
* ```
|
|
6421
6421
|
*/
|
|
6422
6422
|
isBlank() {
|
|
6423
|
-
const e = this._worksheet.getCellMatrix(), { startRow: t, startColumn:
|
|
6423
|
+
const e = this._worksheet.getCellMatrix(), { startRow: t, startColumn: n, endRow: i, endColumn: r } = this._range;
|
|
6424
6424
|
let o = !0;
|
|
6425
6425
|
for (let a = t; a <= i; a++) {
|
|
6426
|
-
for (let h =
|
|
6426
|
+
for (let h = n; h <= r; h++)
|
|
6427
6427
|
if (!J(e.getValue(a, h))) {
|
|
6428
6428
|
o = !1;
|
|
6429
6429
|
break;
|
|
@@ -6452,8 +6452,8 @@ let I = (G = class extends Fe {
|
|
|
6452
6452
|
* console.log(newRange.getA1Notation()); // B2:D4
|
|
6453
6453
|
* ```
|
|
6454
6454
|
*/
|
|
6455
|
-
offset(e, t,
|
|
6456
|
-
const { startRow: r, startColumn: o, endRow: a, endColumn: h } = this._range, c = r + e, d = o + t, w =
|
|
6455
|
+
offset(e, t, n, i) {
|
|
6456
|
+
const { startRow: r, startColumn: o, endRow: a, endColumn: h } = this._range, c = r + e, d = o + t, w = n ? c + n - 1 : a + e, g = i ? d + i - 1 : h + t;
|
|
6457
6457
|
if (c < 0 || d < 0 || w < 0 || g < 0)
|
|
6458
6458
|
throw new Error("The row or column index is out of range");
|
|
6459
6459
|
return this._injector.createInstance(I, this._workbook, this._worksheet, {
|
|
@@ -6498,7 +6498,7 @@ let I = (G = class extends Fe {
|
|
|
6498
6498
|
* ```
|
|
6499
6499
|
*/
|
|
6500
6500
|
setFormulas(e) {
|
|
6501
|
-
return this.setValues(e.map((t) => t.map((
|
|
6501
|
+
return this.setValues(e.map((t) => t.map((n) => ({ f: n }))));
|
|
6502
6502
|
}
|
|
6503
6503
|
/**
|
|
6504
6504
|
* Get the RangePermission instance for managing range-level permissions.
|
|
@@ -6539,22 +6539,22 @@ let I = (G = class extends Fe {
|
|
|
6539
6539
|
);
|
|
6540
6540
|
}
|
|
6541
6541
|
}, G._enableManualInit(), G);
|
|
6542
|
-
I =
|
|
6542
|
+
I = zs([
|
|
6543
6543
|
Pe(3, l(p)),
|
|
6544
6544
|
Pe(4, S),
|
|
6545
|
-
Pe(5, l(
|
|
6545
|
+
Pe(5, l(ps))
|
|
6546
6546
|
], I);
|
|
6547
|
-
var
|
|
6548
|
-
for (var i =
|
|
6549
|
-
(o =
|
|
6547
|
+
var Gs = Object.getOwnPropertyDescriptor, Ks = (s, e, t, n) => {
|
|
6548
|
+
for (var i = n > 1 ? void 0 : n ? Gs(e, t) : e, r = s.length - 1, o; r >= 0; r--)
|
|
6549
|
+
(o = s[r]) && (i = o(i) || i);
|
|
6550
6550
|
return i;
|
|
6551
|
-
}, ye = (
|
|
6551
|
+
}, ye = (s, e) => (t, n) => e(t, n, s);
|
|
6552
6552
|
let Ae = class {
|
|
6553
|
-
constructor(
|
|
6553
|
+
constructor(s, e, t, n) {
|
|
6554
6554
|
_(this, "_permissionSubject");
|
|
6555
6555
|
// Collaborator changes are tracked manually since IAuthzIoService doesn't provide an observable
|
|
6556
6556
|
// TODO: If IAuthzIoService adds an observable in the future, migrate to use that
|
|
6557
|
-
_(this, "_collaboratorChangeSubject", new
|
|
6557
|
+
_(this, "_collaboratorChangeSubject", new Rs());
|
|
6558
6558
|
/**
|
|
6559
6559
|
* Observable stream of permission snapshot changes (BehaviorSubject)
|
|
6560
6560
|
* Emits immediately on subscription with current state, then on any permission point change
|
|
@@ -6571,7 +6571,7 @@ let Ae = class {
|
|
|
6571
6571
|
*/
|
|
6572
6572
|
_(this, "collaboratorChange$");
|
|
6573
6573
|
_(this, "_subscriptions", []);
|
|
6574
|
-
this._unitId =
|
|
6574
|
+
this._unitId = s, this._injector = e, this._permissionService = t, this._authzIoService = n, this._permissionSubject = new de(this._buildSnapshot()), this.permission$ = this._createPermissionStream(), this.pointChange$ = this._createPointChangeStream(), this.collaboratorChange$ = this._collaboratorChangeSubject.asObservable().pipe(
|
|
6575
6575
|
x({ bufferSize: 1, refCount: !0 })
|
|
6576
6576
|
);
|
|
6577
6577
|
}
|
|
@@ -6580,12 +6580,12 @@ let Ae = class {
|
|
|
6580
6580
|
* @private
|
|
6581
6581
|
*/
|
|
6582
6582
|
_createPermissionStream() {
|
|
6583
|
-
const
|
|
6583
|
+
const s = this._permissionService.permissionPointUpdate$.pipe(
|
|
6584
6584
|
R((e) => e.id.includes(this._unitId))
|
|
6585
6585
|
).subscribe(() => {
|
|
6586
6586
|
this._permissionSubject.next(this._buildSnapshot());
|
|
6587
6587
|
});
|
|
6588
|
-
return this._subscriptions.push(
|
|
6588
|
+
return this._subscriptions.push(s), this._permissionSubject.asObservable().pipe(
|
|
6589
6589
|
ue((e, t) => JSON.stringify(e) === JSON.stringify(t)),
|
|
6590
6590
|
x({ bufferSize: 1, refCount: !0 })
|
|
6591
6591
|
);
|
|
@@ -6595,18 +6595,18 @@ let Ae = class {
|
|
|
6595
6595
|
* @private
|
|
6596
6596
|
*/
|
|
6597
6597
|
_createPointChangeStream() {
|
|
6598
|
-
const
|
|
6598
|
+
const s = /* @__PURE__ */ new Map();
|
|
6599
6599
|
for (const e in u) {
|
|
6600
6600
|
const t = u[e];
|
|
6601
|
-
|
|
6601
|
+
s.set(t, this.getPoint(t));
|
|
6602
6602
|
}
|
|
6603
6603
|
return this._permissionService.permissionPointUpdate$.pipe(
|
|
6604
6604
|
R((e) => e.id.includes(this._unitId)),
|
|
6605
6605
|
le((e) => {
|
|
6606
6606
|
const t = this._extractWorkbookPointType(e.id);
|
|
6607
6607
|
if (!t) return null;
|
|
6608
|
-
const
|
|
6609
|
-
return
|
|
6608
|
+
const n = !!e.value, i = s.get(t);
|
|
6609
|
+
return s.set(t, n), i === n ? null : { point: t, value: n, oldValue: i };
|
|
6610
6610
|
}),
|
|
6611
6611
|
R((e) => e !== null),
|
|
6612
6612
|
x({ bufferSize: 1, refCount: !0 })
|
|
@@ -6616,11 +6616,11 @@ let Ae = class {
|
|
|
6616
6616
|
* Extract WorkbookPermissionPoint type from permission point ID
|
|
6617
6617
|
* @private
|
|
6618
6618
|
*/
|
|
6619
|
-
_extractWorkbookPointType(
|
|
6619
|
+
_extractWorkbookPointType(s) {
|
|
6620
6620
|
for (const e in u) {
|
|
6621
|
-
const t = u[e],
|
|
6622
|
-
if (!
|
|
6623
|
-
if (new
|
|
6621
|
+
const t = u[e], n = ie[t];
|
|
6622
|
+
if (!n) continue;
|
|
6623
|
+
if (new n(this._unitId).id === s)
|
|
6624
6624
|
return t;
|
|
6625
6625
|
}
|
|
6626
6626
|
return null;
|
|
@@ -6629,12 +6629,12 @@ let Ae = class {
|
|
|
6629
6629
|
* Build permission snapshot
|
|
6630
6630
|
*/
|
|
6631
6631
|
_buildSnapshot() {
|
|
6632
|
-
const
|
|
6632
|
+
const s = {};
|
|
6633
6633
|
for (const e in u) {
|
|
6634
6634
|
const t = u[e];
|
|
6635
|
-
|
|
6635
|
+
s[t] = this.getPoint(t);
|
|
6636
6636
|
}
|
|
6637
|
-
return
|
|
6637
|
+
return s;
|
|
6638
6638
|
}
|
|
6639
6639
|
/**
|
|
6640
6640
|
* Listen to permission point changes
|
|
@@ -6649,19 +6649,19 @@ let Ae = class {
|
|
|
6649
6649
|
* await permission?.setMode('editor');
|
|
6650
6650
|
* ```
|
|
6651
6651
|
*/
|
|
6652
|
-
async setMode(
|
|
6653
|
-
const e = this._getModePermissions(
|
|
6652
|
+
async setMode(s) {
|
|
6653
|
+
const e = this._getModePermissions(s);
|
|
6654
6654
|
await this._batchSetPermissionPoints(e);
|
|
6655
6655
|
}
|
|
6656
6656
|
/**
|
|
6657
6657
|
* Get permission configuration for a specific mode
|
|
6658
6658
|
* @private
|
|
6659
6659
|
*/
|
|
6660
|
-
_getModePermissions(
|
|
6660
|
+
_getModePermissions(s) {
|
|
6661
6661
|
const e = {};
|
|
6662
6662
|
switch (Object.values(u).forEach((t) => {
|
|
6663
6663
|
e[t] = !1;
|
|
6664
|
-
}),
|
|
6664
|
+
}), s) {
|
|
6665
6665
|
case "owner":
|
|
6666
6666
|
Object.values(u).forEach((t) => {
|
|
6667
6667
|
e[t] = !0;
|
|
@@ -6683,17 +6683,17 @@ let Ae = class {
|
|
|
6683
6683
|
* Batch set multiple permission points efficiently
|
|
6684
6684
|
* @private
|
|
6685
6685
|
*/
|
|
6686
|
-
async _batchSetPermissionPoints(
|
|
6686
|
+
async _batchSetPermissionPoints(s) {
|
|
6687
6687
|
const e = [];
|
|
6688
|
-
for (const [t,
|
|
6688
|
+
for (const [t, n] of Object.entries(s)) {
|
|
6689
6689
|
const i = t, r = ie[i];
|
|
6690
6690
|
if (!r)
|
|
6691
6691
|
throw new Error(`Unknown workbook permission point: ${i}`);
|
|
6692
6692
|
const o = this.getPoint(i);
|
|
6693
|
-
if (o ===
|
|
6693
|
+
if (o === n)
|
|
6694
6694
|
continue;
|
|
6695
6695
|
const a = new r(this._unitId);
|
|
6696
|
-
this._permissionService.getPermissionPoint(a.id) || this._permissionService.addPermissionPoint(a), this._permissionService.updatePermissionPoint(a.id,
|
|
6696
|
+
this._permissionService.getPermissionPoint(a.id) || this._permissionService.addPermissionPoint(a), this._permissionService.updatePermissionPoint(a.id, n), e.push({ point: i, value: n, oldValue: o });
|
|
6697
6697
|
}
|
|
6698
6698
|
if (e.length > 0) {
|
|
6699
6699
|
const t = this._buildSnapshot();
|
|
@@ -6753,11 +6753,11 @@ let Ae = class {
|
|
|
6753
6753
|
* await permission?.setPoint(WorkbookPermissionPoint.Print, false);
|
|
6754
6754
|
* ```
|
|
6755
6755
|
*/
|
|
6756
|
-
async setPoint(
|
|
6757
|
-
const t = ie[
|
|
6756
|
+
async setPoint(s, e) {
|
|
6757
|
+
const t = ie[s];
|
|
6758
6758
|
if (!t)
|
|
6759
|
-
throw new Error(`Unknown workbook permission point: ${
|
|
6760
|
-
if (this.getPoint(
|
|
6759
|
+
throw new Error(`Unknown workbook permission point: ${s}`);
|
|
6760
|
+
if (this.getPoint(s) === e)
|
|
6761
6761
|
return;
|
|
6762
6762
|
const i = new t(this._unitId);
|
|
6763
6763
|
this._permissionService.getPermissionPoint(i.id) || this._permissionService.addPermissionPoint(i), this._permissionService.updatePermissionPoint(i.id, e);
|
|
@@ -6776,13 +6776,13 @@ let Ae = class {
|
|
|
6776
6776
|
* console.log(canPrint);
|
|
6777
6777
|
* ```
|
|
6778
6778
|
*/
|
|
6779
|
-
getPoint(
|
|
6779
|
+
getPoint(s) {
|
|
6780
6780
|
var i;
|
|
6781
|
-
const e = ie[
|
|
6781
|
+
const e = ie[s];
|
|
6782
6782
|
if (!e)
|
|
6783
|
-
throw new Error(`Unknown workbook permission point: ${
|
|
6784
|
-
const t = new e(this._unitId),
|
|
6785
|
-
return (i =
|
|
6783
|
+
throw new Error(`Unknown workbook permission point: ${s}`);
|
|
6784
|
+
const t = new e(this._unitId), n = this._permissionService.getPermissionPoint(t.id);
|
|
6785
|
+
return (i = n == null ? void 0 : n.value) != null ? i : !0;
|
|
6786
6786
|
}
|
|
6787
6787
|
/**
|
|
6788
6788
|
* Get a snapshot of all permission points.
|
|
@@ -6818,8 +6818,8 @@ let Ae = class {
|
|
|
6818
6818
|
* ]);
|
|
6819
6819
|
* ```
|
|
6820
6820
|
*/
|
|
6821
|
-
async setCollaborators(
|
|
6822
|
-
const e =
|
|
6821
|
+
async setCollaborators(s) {
|
|
6822
|
+
const e = s.map((t) => ({
|
|
6823
6823
|
id: t.user.userID,
|
|
6824
6824
|
subject: t.user,
|
|
6825
6825
|
role: t.role
|
|
@@ -6828,7 +6828,7 @@ let Ae = class {
|
|
|
6828
6828
|
objectID: this._unitId,
|
|
6829
6829
|
unitID: this._unitId,
|
|
6830
6830
|
collaborators: e
|
|
6831
|
-
}),
|
|
6831
|
+
}), s.forEach((t) => {
|
|
6832
6832
|
this._collaboratorChangeSubject.next({
|
|
6833
6833
|
type: "add",
|
|
6834
6834
|
collaborator: {
|
|
@@ -6853,19 +6853,19 @@ let Ae = class {
|
|
|
6853
6853
|
* );
|
|
6854
6854
|
* ```
|
|
6855
6855
|
*/
|
|
6856
|
-
async addCollaborator(
|
|
6856
|
+
async addCollaborator(s, e) {
|
|
6857
6857
|
await this._authzIoService.createCollaborator({
|
|
6858
6858
|
objectID: this._unitId,
|
|
6859
6859
|
unitID: this._unitId,
|
|
6860
6860
|
collaborators: [{
|
|
6861
|
-
id:
|
|
6862
|
-
subject:
|
|
6861
|
+
id: s.userID,
|
|
6862
|
+
subject: s,
|
|
6863
6863
|
role: e
|
|
6864
6864
|
}]
|
|
6865
6865
|
}), this._collaboratorChangeSubject.next({
|
|
6866
6866
|
type: "add",
|
|
6867
6867
|
collaborator: {
|
|
6868
|
-
user: { id:
|
|
6868
|
+
user: { id: s.userID },
|
|
6869
6869
|
role: e
|
|
6870
6870
|
}
|
|
6871
6871
|
});
|
|
@@ -6885,19 +6885,19 @@ let Ae = class {
|
|
|
6885
6885
|
* );
|
|
6886
6886
|
* ```
|
|
6887
6887
|
*/
|
|
6888
|
-
async updateCollaborator(
|
|
6888
|
+
async updateCollaborator(s, e) {
|
|
6889
6889
|
await this._authzIoService.updateCollaborator({
|
|
6890
6890
|
objectID: this._unitId,
|
|
6891
6891
|
unitID: this._unitId,
|
|
6892
6892
|
collaborator: {
|
|
6893
|
-
id:
|
|
6894
|
-
subject:
|
|
6893
|
+
id: s.userID,
|
|
6894
|
+
subject: s,
|
|
6895
6895
|
role: e
|
|
6896
6896
|
}
|
|
6897
6897
|
}), this._collaboratorChangeSubject.next({
|
|
6898
6898
|
type: "update",
|
|
6899
6899
|
collaborator: {
|
|
6900
|
-
user: { id:
|
|
6900
|
+
user: { id: s.userID },
|
|
6901
6901
|
role: e
|
|
6902
6902
|
}
|
|
6903
6903
|
});
|
|
@@ -6913,15 +6913,15 @@ let Ae = class {
|
|
|
6913
6913
|
* await permission?.removeCollaborator('user1');
|
|
6914
6914
|
* ```
|
|
6915
6915
|
*/
|
|
6916
|
-
async removeCollaborator(
|
|
6916
|
+
async removeCollaborator(s) {
|
|
6917
6917
|
await this._authzIoService.deleteCollaborator({
|
|
6918
6918
|
objectID: this._unitId,
|
|
6919
6919
|
unitID: this._unitId,
|
|
6920
|
-
collaboratorID:
|
|
6920
|
+
collaboratorID: s
|
|
6921
6921
|
}), this._collaboratorChangeSubject.next({
|
|
6922
6922
|
type: "delete",
|
|
6923
6923
|
collaborator: {
|
|
6924
|
-
user: { id:
|
|
6924
|
+
user: { id: s },
|
|
6925
6925
|
role: xt.Reader
|
|
6926
6926
|
// Placeholder value
|
|
6927
6927
|
}
|
|
@@ -6938,8 +6938,8 @@ let Ae = class {
|
|
|
6938
6938
|
* await permission?.removeCollaborators(['user1', 'user2']);
|
|
6939
6939
|
* ```
|
|
6940
6940
|
*/
|
|
6941
|
-
async removeCollaborators(
|
|
6942
|
-
for (const e of
|
|
6941
|
+
async removeCollaborators(s) {
|
|
6942
|
+
for (const e of s)
|
|
6943
6943
|
await this.removeCollaborator(e);
|
|
6944
6944
|
}
|
|
6945
6945
|
/**
|
|
@@ -6958,11 +6958,11 @@ let Ae = class {
|
|
|
6958
6958
|
objectID: this._unitId,
|
|
6959
6959
|
unitID: this._unitId
|
|
6960
6960
|
})).map((e) => {
|
|
6961
|
-
var t,
|
|
6961
|
+
var t, n;
|
|
6962
6962
|
return {
|
|
6963
6963
|
user: {
|
|
6964
6964
|
id: ((t = e.subject) == null ? void 0 : t.userID) || e.id,
|
|
6965
|
-
displayName: ((
|
|
6965
|
+
displayName: ((n = e.subject) == null ? void 0 : n.name) || ""
|
|
6966
6966
|
},
|
|
6967
6967
|
role: e.role
|
|
6968
6968
|
// Type conversion: protocol UnitRole to our UnitRole
|
|
@@ -6984,32 +6984,32 @@ let Ae = class {
|
|
|
6984
6984
|
* unsubscribe?.();
|
|
6985
6985
|
* ```
|
|
6986
6986
|
*/
|
|
6987
|
-
subscribe(
|
|
6988
|
-
const e = this.permission$.subscribe(
|
|
6987
|
+
subscribe(s) {
|
|
6988
|
+
const e = this.permission$.subscribe(s);
|
|
6989
6989
|
return () => e.unsubscribe();
|
|
6990
6990
|
}
|
|
6991
6991
|
/**
|
|
6992
6992
|
* Clean up resources
|
|
6993
6993
|
*/
|
|
6994
6994
|
dispose() {
|
|
6995
|
-
this._subscriptions.forEach((
|
|
6995
|
+
this._subscriptions.forEach((s) => s.unsubscribe()), this._permissionSubject.complete(), this._collaboratorChangeSubject.complete();
|
|
6996
6996
|
}
|
|
6997
6997
|
};
|
|
6998
|
-
Ae =
|
|
6998
|
+
Ae = Ks([
|
|
6999
6999
|
ye(1, l(p)),
|
|
7000
7000
|
ye(2, K),
|
|
7001
7001
|
ye(3, ee)
|
|
7002
7002
|
], Ae);
|
|
7003
|
-
var
|
|
7004
|
-
for (var i =
|
|
7005
|
-
(o =
|
|
7003
|
+
var Js = Object.getOwnPropertyDescriptor, qs = (s, e, t, n) => {
|
|
7004
|
+
for (var i = n > 1 ? void 0 : n ? Js(e, t) : e, r = s.length - 1, o; r >= 0; r--)
|
|
7005
|
+
(o = s[r]) && (i = o(i) || i);
|
|
7006
7006
|
return i;
|
|
7007
|
-
}, U = (
|
|
7007
|
+
}, U = (s, e) => (t, n) => e(t, n, s);
|
|
7008
7008
|
let v = class extends Fe {
|
|
7009
|
-
constructor(e, t,
|
|
7009
|
+
constructor(e, t, n, i, r, o, a, h, c, d) {
|
|
7010
7010
|
super(t);
|
|
7011
7011
|
_(this, "id");
|
|
7012
|
-
this._workbook = e, this._injector = t, this._resourceLoaderService =
|
|
7012
|
+
this._workbook = e, this._injector = t, this._resourceLoaderService = n, this._selectionManagerService = i, this._univerInstanceService = r, this._commandService = o, this._permissionService = a, this._logService = h, this._localeService = c, this._definedNamesService = d, this.id = this._workbook.getUnitId();
|
|
7013
7013
|
}
|
|
7014
7014
|
/**
|
|
7015
7015
|
* Get the Workbook instance.
|
|
@@ -7067,7 +7067,7 @@ let v = class extends Fe {
|
|
|
7067
7067
|
* ```
|
|
7068
7068
|
*/
|
|
7069
7069
|
setName(e) {
|
|
7070
|
-
return this._commandService.syncExecuteCommand(
|
|
7070
|
+
return this._commandService.syncExecuteCommand(ds.id, {
|
|
7071
7071
|
unitId: this._workbook.getUnitId(),
|
|
7072
7072
|
name: e
|
|
7073
7073
|
}), this;
|
|
@@ -7165,10 +7165,10 @@ let v = class extends Fe {
|
|
|
7165
7165
|
* console.log(newSheetWithData);
|
|
7166
7166
|
* ```
|
|
7167
7167
|
*/
|
|
7168
|
-
create(e, t,
|
|
7168
|
+
create(e, t, n, i) {
|
|
7169
7169
|
var h, c, d;
|
|
7170
7170
|
const r = Ye(Ze.deepClone((h = i == null ? void 0 : i.sheet) != null ? h : {}));
|
|
7171
|
-
r.name = e, r.rowCount = t, r.columnCount =
|
|
7171
|
+
r.name = e, r.rowCount = t, r.columnCount = n, r.id = (c = i == null ? void 0 : i.sheet) == null ? void 0 : c.id;
|
|
7172
7172
|
const o = (d = i == null ? void 0 : i.index) != null ? d : this._workbook.getSheets().length;
|
|
7173
7173
|
this._commandService.syncExecuteCommand(ce.id, {
|
|
7174
7174
|
unitId: this.id,
|
|
@@ -7274,13 +7274,13 @@ let v = class extends Fe {
|
|
|
7274
7274
|
*/
|
|
7275
7275
|
insertSheet(e, t) {
|
|
7276
7276
|
var o, a, h;
|
|
7277
|
-
const
|
|
7278
|
-
|
|
7277
|
+
const n = Ye(Ze.deepClone((o = t == null ? void 0 : t.sheet) != null ? o : {}));
|
|
7278
|
+
n.name = e, n.id = (a = t == null ? void 0 : t.sheet) == null ? void 0 : a.id;
|
|
7279
7279
|
const i = (h = t == null ? void 0 : t.index) != null ? h : this._workbook.getSheets().length;
|
|
7280
7280
|
this._commandService.syncExecuteCommand(ce.id, {
|
|
7281
7281
|
unitId: this.id,
|
|
7282
7282
|
index: i,
|
|
7283
|
-
sheet:
|
|
7283
|
+
sheet: n
|
|
7284
7284
|
}), this._commandService.syncExecuteCommand(Z.id, {
|
|
7285
7285
|
unitId: this.id,
|
|
7286
7286
|
subUnitId: this._workbook.getSheets()[i].getSheetId()
|
|
@@ -7306,10 +7306,10 @@ let v = class extends Fe {
|
|
|
7306
7306
|
* ```
|
|
7307
7307
|
*/
|
|
7308
7308
|
deleteSheet(e) {
|
|
7309
|
-
const t = this.id,
|
|
7309
|
+
const t = this.id, n = typeof e == "string" ? e : e.getSheetId();
|
|
7310
7310
|
return this._commandService.syncExecuteCommand(Oe.id, {
|
|
7311
7311
|
unitId: t,
|
|
7312
|
-
subUnitId:
|
|
7312
|
+
subUnitId: n
|
|
7313
7313
|
});
|
|
7314
7314
|
}
|
|
7315
7315
|
// #region editing
|
|
@@ -7359,8 +7359,8 @@ let v = class extends Fe {
|
|
|
7359
7359
|
*/
|
|
7360
7360
|
onBeforeCommandExecute(e) {
|
|
7361
7361
|
return this._commandService.beforeCommandExecuted((t) => {
|
|
7362
|
-
var
|
|
7363
|
-
((
|
|
7362
|
+
var n;
|
|
7363
|
+
((n = t.params) == null ? void 0 : n.unitId) === this.id && e(t);
|
|
7364
7364
|
});
|
|
7365
7365
|
}
|
|
7366
7366
|
/**
|
|
@@ -7383,8 +7383,8 @@ let v = class extends Fe {
|
|
|
7383
7383
|
*/
|
|
7384
7384
|
onCommandExecuted(e) {
|
|
7385
7385
|
return this._commandService.onCommandExecuted((t) => {
|
|
7386
|
-
var
|
|
7387
|
-
((
|
|
7386
|
+
var n;
|
|
7387
|
+
((n = t.params) == null ? void 0 : n.unitId) === this.id && e(t);
|
|
7388
7388
|
});
|
|
7389
7389
|
}
|
|
7390
7390
|
/**
|
|
@@ -7408,7 +7408,7 @@ let v = class extends Fe {
|
|
|
7408
7408
|
onSelectionChange(e) {
|
|
7409
7409
|
return kt(
|
|
7410
7410
|
this._selectionManagerService.selectionMoveEnd$.subscribe((t) => {
|
|
7411
|
-
this._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET).getUnitId() === this.id && (t != null && t.length ? e(t.map((
|
|
7411
|
+
this._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET).getUnitId() === this.id && (t != null && t.length ? e(t.map((n) => n.range)) : e([]));
|
|
7412
7412
|
})
|
|
7413
7413
|
);
|
|
7414
7414
|
}
|
|
@@ -7439,13 +7439,13 @@ let v = class extends Fe {
|
|
|
7439
7439
|
* ```
|
|
7440
7440
|
*/
|
|
7441
7441
|
setActiveRange(e) {
|
|
7442
|
-
const t = this.getActiveSheet(),
|
|
7442
|
+
const t = this.getActiveSheet(), n = e.getRange().sheetId || t.getSheetId(), i = n ? this._workbook.getSheetBySheetId(n) : this._workbook.getActiveSheet(!0);
|
|
7443
7443
|
if (!i)
|
|
7444
7444
|
throw new Error("No active sheet found");
|
|
7445
7445
|
i.getSheetId() !== t.getSheetId() && this.setActiveSheet(this._injector.createInstance(b, this, this._workbook, i));
|
|
7446
7446
|
const r = {
|
|
7447
7447
|
unitId: this.getId(),
|
|
7448
|
-
subUnitId:
|
|
7448
|
+
subUnitId: n,
|
|
7449
7449
|
selections: [e].map((o) => ({ range: o.getRange(), primary: he(o.getRange(), i), style: null }))
|
|
7450
7450
|
};
|
|
7451
7451
|
return this._commandService.syncExecuteCommand(ze.id, r), this;
|
|
@@ -7462,8 +7462,8 @@ let v = class extends Fe {
|
|
|
7462
7462
|
*/
|
|
7463
7463
|
// could sheet have no active range ?
|
|
7464
7464
|
getActiveRange() {
|
|
7465
|
-
const e = this._workbook.getActiveSheet(),
|
|
7466
|
-
return
|
|
7465
|
+
const e = this._workbook.getActiveSheet(), n = this._selectionManagerService.getCurrentSelections().find((i) => !!i.primary);
|
|
7466
|
+
return n ? this._injector.createInstance(I, this._workbook, e, n.range) : null;
|
|
7467
7467
|
}
|
|
7468
7468
|
/**
|
|
7469
7469
|
* Returns the active cell in this spreadsheet.
|
|
@@ -7475,11 +7475,11 @@ let v = class extends Fe {
|
|
|
7475
7475
|
* ```
|
|
7476
7476
|
*/
|
|
7477
7477
|
getActiveCell() {
|
|
7478
|
-
const e = this._workbook.getActiveSheet(),
|
|
7479
|
-
if (!
|
|
7478
|
+
const e = this._workbook.getActiveSheet(), n = this._selectionManagerService.getCurrentSelections().find((r) => !!r.primary);
|
|
7479
|
+
if (!n)
|
|
7480
7480
|
return null;
|
|
7481
7481
|
const i = {
|
|
7482
|
-
...
|
|
7482
|
+
...n.primary,
|
|
7483
7483
|
rangeType: f.NORMAL
|
|
7484
7484
|
};
|
|
7485
7485
|
return this._injector.createInstance(I, this._workbook, e, i);
|
|
@@ -7511,7 +7511,7 @@ let v = class extends Fe {
|
|
|
7511
7511
|
* ```
|
|
7512
7512
|
*/
|
|
7513
7513
|
duplicateSheet(e) {
|
|
7514
|
-
return this._commandService.syncExecuteCommand(
|
|
7514
|
+
return this._commandService.syncExecuteCommand(us.id, {
|
|
7515
7515
|
unitId: e.getWorkbook().getUnitId(),
|
|
7516
7516
|
subUnitId: e.getSheetId()
|
|
7517
7517
|
}), this._injector.createInstance(b, this, this._workbook, this._workbook.getActiveSheet());
|
|
@@ -7606,10 +7606,10 @@ let v = class extends Fe {
|
|
|
7606
7606
|
* ```
|
|
7607
7607
|
*/
|
|
7608
7608
|
moveSheet(e, t) {
|
|
7609
|
-
let
|
|
7610
|
-
return
|
|
7609
|
+
let n = t;
|
|
7610
|
+
return n < 0 ? n = 0 : n > this._workbook.getSheets().length - 1 && (n = this._workbook.getSheets().length - 1), this._commandService.syncExecuteCommand(ls.id, {
|
|
7611
7611
|
unitId: e.getWorkbook().getUnitId(),
|
|
7612
|
-
order:
|
|
7612
|
+
order: n,
|
|
7613
7613
|
subUnitId: e.getSheetId()
|
|
7614
7614
|
}), this;
|
|
7615
7615
|
}
|
|
@@ -7811,7 +7811,7 @@ let v = class extends Fe {
|
|
|
7811
7811
|
* ```
|
|
7812
7812
|
*/
|
|
7813
7813
|
registerRangeTheme(e) {
|
|
7814
|
-
this._commandService.syncExecuteCommand(
|
|
7814
|
+
this._commandService.syncExecuteCommand(ms.id, {
|
|
7815
7815
|
unitId: this.getId(),
|
|
7816
7816
|
rangeThemeStyle: e
|
|
7817
7817
|
});
|
|
@@ -7827,7 +7827,7 @@ let v = class extends Fe {
|
|
|
7827
7827
|
* ```
|
|
7828
7828
|
*/
|
|
7829
7829
|
unregisterRangeTheme(e) {
|
|
7830
|
-
this._commandService.syncExecuteCommand(
|
|
7830
|
+
this._commandService.syncExecuteCommand(gs.id, {
|
|
7831
7831
|
unitId: this.getId(),
|
|
7832
7832
|
themeName: e
|
|
7833
7833
|
});
|
|
@@ -7851,7 +7851,7 @@ let v = class extends Fe {
|
|
|
7851
7851
|
* ```
|
|
7852
7852
|
*/
|
|
7853
7853
|
createRangeThemeStyle(e, t) {
|
|
7854
|
-
return new
|
|
7854
|
+
return new _s(e, t);
|
|
7855
7855
|
}
|
|
7856
7856
|
/**
|
|
7857
7857
|
* Set custom metadata of workbook
|
|
@@ -7956,7 +7956,7 @@ let v = class extends Fe {
|
|
|
7956
7956
|
this._workbook.removeStyles(e);
|
|
7957
7957
|
}
|
|
7958
7958
|
};
|
|
7959
|
-
v =
|
|
7959
|
+
v = qs([
|
|
7960
7960
|
U(1, l(p)),
|
|
7961
7961
|
U(2, l(Ot)),
|
|
7962
7962
|
U(3, l(pt)),
|
|
@@ -7967,45 +7967,45 @@ v = qn([
|
|
|
7967
7967
|
U(8, l(wt)),
|
|
7968
7968
|
U(9, Ut)
|
|
7969
7969
|
], v);
|
|
7970
|
-
class
|
|
7970
|
+
class Ys extends bt {
|
|
7971
7971
|
getCommandSheetTarget(e) {
|
|
7972
7972
|
var r;
|
|
7973
7973
|
const t = e.params;
|
|
7974
7974
|
if (!t) return this.getActiveSheet();
|
|
7975
|
-
const
|
|
7976
|
-
if (!
|
|
7975
|
+
const n = t.unitId ? this.getUniverSheet(t.unitId) : (r = this.getActiveWorkbook) == null ? void 0 : r.call(this);
|
|
7976
|
+
if (!n)
|
|
7977
7977
|
return;
|
|
7978
|
-
const i =
|
|
7978
|
+
const i = n.getSheetBySheetId(t.subUnitId || t.sheetId) || n.getActiveSheet();
|
|
7979
7979
|
if (i)
|
|
7980
|
-
return { workbook:
|
|
7980
|
+
return { workbook: n, worksheet: i };
|
|
7981
7981
|
}
|
|
7982
7982
|
getSheetTarget(e, t) {
|
|
7983
|
-
const
|
|
7984
|
-
if (!
|
|
7983
|
+
const n = this.getUniverSheet(e);
|
|
7984
|
+
if (!n)
|
|
7985
7985
|
return;
|
|
7986
|
-
const i =
|
|
7986
|
+
const i = n.getSheetBySheetId(t);
|
|
7987
7987
|
if (i)
|
|
7988
|
-
return { workbook:
|
|
7988
|
+
return { workbook: n, worksheet: i };
|
|
7989
7989
|
}
|
|
7990
7990
|
_initWorkbookEvent(e) {
|
|
7991
7991
|
const t = e.get(Ue);
|
|
7992
7992
|
this.registerEventHandler(
|
|
7993
7993
|
this.Event.WorkbookDisposed,
|
|
7994
|
-
() => t.unitDisposed$.subscribe((
|
|
7995
|
-
|
|
7996
|
-
unitId:
|
|
7997
|
-
unitType:
|
|
7998
|
-
snapshot:
|
|
7994
|
+
() => t.unitDisposed$.subscribe((n) => {
|
|
7995
|
+
n.type === T.UNIVER_SHEET && this.fireEvent(this.Event.WorkbookDisposed, {
|
|
7996
|
+
unitId: n.getUnitId(),
|
|
7997
|
+
unitType: n.type,
|
|
7998
|
+
snapshot: n.getSnapshot()
|
|
7999
7999
|
});
|
|
8000
8000
|
})
|
|
8001
8001
|
), this.registerEventHandler(
|
|
8002
8002
|
this.Event.WorkbookCreated,
|
|
8003
|
-
() => t.unitAdded$.subscribe((
|
|
8004
|
-
if (
|
|
8005
|
-
const i =
|
|
8003
|
+
() => t.unitAdded$.subscribe((n) => {
|
|
8004
|
+
if (n.type === T.UNIVER_SHEET) {
|
|
8005
|
+
const i = n, r = e.createInstance(v, i);
|
|
8006
8006
|
this.fireEvent(this.Event.WorkbookCreated, {
|
|
8007
|
-
unitId:
|
|
8008
|
-
type:
|
|
8007
|
+
unitId: n.getUnitId(),
|
|
8008
|
+
type: n.type,
|
|
8009
8009
|
workbook: r,
|
|
8010
8010
|
unit: r
|
|
8011
8011
|
});
|
|
@@ -8021,10 +8021,10 @@ class Yn extends bt {
|
|
|
8021
8021
|
const t = e.get(S);
|
|
8022
8022
|
this.registerEventHandler(
|
|
8023
8023
|
this.Event.BeforeSheetCreate,
|
|
8024
|
-
() => t.beforeCommandExecuted((
|
|
8024
|
+
() => t.beforeCommandExecuted((n) => {
|
|
8025
8025
|
var i;
|
|
8026
|
-
if (
|
|
8027
|
-
const r =
|
|
8026
|
+
if (n.id === ce.id) {
|
|
8027
|
+
const r = n.params, { unitId: o, index: a, sheet: h } = r || {}, c = o ? this.getUniverSheet(o) : (i = this.getActiveWorkbook) == null ? void 0 : i.call(this);
|
|
8028
8028
|
if (!c)
|
|
8029
8029
|
return;
|
|
8030
8030
|
const d = {
|
|
@@ -8038,10 +8038,10 @@ class Yn extends bt {
|
|
|
8038
8038
|
})
|
|
8039
8039
|
), this.registerEventHandler(
|
|
8040
8040
|
this.Event.BeforeActiveSheetChange,
|
|
8041
|
-
() => t.beforeCommandExecuted((
|
|
8041
|
+
() => t.beforeCommandExecuted((n) => {
|
|
8042
8042
|
var i;
|
|
8043
|
-
if (
|
|
8044
|
-
const { subUnitId: r, unitId: o } =
|
|
8043
|
+
if (n.id === Z.id) {
|
|
8044
|
+
const { subUnitId: r, unitId: o } = n.params, a = o ? this.getUniverSheet(o) : (i = this.getActiveWorkbook) == null ? void 0 : i.call(this);
|
|
8045
8045
|
if (!a || !r) return;
|
|
8046
8046
|
const h = a.getSheetBySheetId(r), c = a.getActiveSheet();
|
|
8047
8047
|
if (!h || !c) return;
|
|
@@ -8056,9 +8056,9 @@ class Yn extends bt {
|
|
|
8056
8056
|
})
|
|
8057
8057
|
), this.registerEventHandler(
|
|
8058
8058
|
this.Event.BeforeSheetDelete,
|
|
8059
|
-
() => t.beforeCommandExecuted((
|
|
8060
|
-
if (
|
|
8061
|
-
const i = this.getCommandSheetTarget(
|
|
8059
|
+
() => t.beforeCommandExecuted((n) => {
|
|
8060
|
+
if (n.id === Oe.id) {
|
|
8061
|
+
const i = this.getCommandSheetTarget(n);
|
|
8062
8062
|
if (!i) return;
|
|
8063
8063
|
const { workbook: r, worksheet: o } = i, a = {
|
|
8064
8064
|
workbook: r,
|
|
@@ -8070,9 +8070,9 @@ class Yn extends bt {
|
|
|
8070
8070
|
})
|
|
8071
8071
|
), this.registerEventHandler(
|
|
8072
8072
|
this.Event.BeforeSheetMove,
|
|
8073
|
-
() => t.beforeCommandExecuted((
|
|
8074
|
-
if (
|
|
8075
|
-
const { fromOrder: i, toOrder: r } =
|
|
8073
|
+
() => t.beforeCommandExecuted((n) => {
|
|
8074
|
+
if (n.id === dt.id) {
|
|
8075
|
+
const { fromOrder: i, toOrder: r } = n.params, o = this.getCommandSheetTarget(n);
|
|
8076
8076
|
if (!o) return;
|
|
8077
8077
|
const a = {
|
|
8078
8078
|
workbook: o.workbook,
|
|
@@ -8086,9 +8086,9 @@ class Yn extends bt {
|
|
|
8086
8086
|
})
|
|
8087
8087
|
), this.registerEventHandler(
|
|
8088
8088
|
this.Event.BeforeSheetNameChange,
|
|
8089
|
-
() => t.beforeCommandExecuted((
|
|
8090
|
-
if (
|
|
8091
|
-
const { name: i } =
|
|
8089
|
+
() => t.beforeCommandExecuted((n) => {
|
|
8090
|
+
if (n.id === je.id) {
|
|
8091
|
+
const { name: i } = n.params, r = this.getCommandSheetTarget(n);
|
|
8092
8092
|
if (!r) return;
|
|
8093
8093
|
const o = {
|
|
8094
8094
|
workbook: r.workbook,
|
|
@@ -8102,9 +8102,9 @@ class Yn extends bt {
|
|
|
8102
8102
|
})
|
|
8103
8103
|
), this.registerEventHandler(
|
|
8104
8104
|
this.Event.BeforeSheetTabColorChange,
|
|
8105
|
-
() => t.beforeCommandExecuted((
|
|
8106
|
-
if (
|
|
8107
|
-
const { color: i } =
|
|
8105
|
+
() => t.beforeCommandExecuted((n) => {
|
|
8106
|
+
if (n.id === ut.id) {
|
|
8107
|
+
const { color: i } = n.params, r = this.getCommandSheetTarget(n);
|
|
8108
8108
|
if (!r) return;
|
|
8109
8109
|
const o = {
|
|
8110
8110
|
workbook: r.workbook,
|
|
@@ -8118,9 +8118,9 @@ class Yn extends bt {
|
|
|
8118
8118
|
})
|
|
8119
8119
|
), this.registerEventHandler(
|
|
8120
8120
|
this.Event.BeforeSheetHideChange,
|
|
8121
|
-
() => t.beforeCommandExecuted((
|
|
8122
|
-
if (
|
|
8123
|
-
const { hidden: i } =
|
|
8121
|
+
() => t.beforeCommandExecuted((n) => {
|
|
8122
|
+
if (n.id === lt.id) {
|
|
8123
|
+
const { hidden: i } = n.params, r = this.getCommandSheetTarget(n);
|
|
8124
8124
|
if (!r) return;
|
|
8125
8125
|
const o = {
|
|
8126
8126
|
workbook: r.workbook,
|
|
@@ -8133,14 +8133,14 @@ class Yn extends bt {
|
|
|
8133
8133
|
})
|
|
8134
8134
|
), this.registerEventHandler(
|
|
8135
8135
|
this.Event.BeforeGridlineColorChange,
|
|
8136
|
-
() => t.beforeCommandExecuted((
|
|
8136
|
+
() => t.beforeCommandExecuted((n) => {
|
|
8137
8137
|
var i;
|
|
8138
|
-
if (
|
|
8139
|
-
const r = this.getCommandSheetTarget(
|
|
8138
|
+
if (n.id === Ne.id) {
|
|
8139
|
+
const r = this.getCommandSheetTarget(n);
|
|
8140
8140
|
if (!r) return;
|
|
8141
8141
|
const o = {
|
|
8142
8142
|
...r,
|
|
8143
|
-
color: (i =
|
|
8143
|
+
color: (i = n.params) == null ? void 0 : i.color
|
|
8144
8144
|
};
|
|
8145
8145
|
if (this.fireEvent(this.Event.BeforeGridlineColorChange, o), o.cancel)
|
|
8146
8146
|
throw new y();
|
|
@@ -8148,14 +8148,14 @@ class Yn extends bt {
|
|
|
8148
8148
|
})
|
|
8149
8149
|
), this.registerEventHandler(
|
|
8150
8150
|
this.Event.BeforeGridlineEnableChange,
|
|
8151
|
-
() => t.beforeCommandExecuted((
|
|
8151
|
+
() => t.beforeCommandExecuted((n) => {
|
|
8152
8152
|
var i;
|
|
8153
|
-
if (
|
|
8154
|
-
const r = this.getCommandSheetTarget(
|
|
8153
|
+
if (n.id === We.id) {
|
|
8154
|
+
const r = this.getCommandSheetTarget(n);
|
|
8155
8155
|
if (!r) return;
|
|
8156
8156
|
const o = {
|
|
8157
8157
|
...r,
|
|
8158
|
-
enabled: !!((i =
|
|
8158
|
+
enabled: !!((i = n.params) != null && i.showGridlines)
|
|
8159
8159
|
};
|
|
8160
8160
|
if (this.fireEvent(this.Event.BeforeGridlineEnableChange, o), o.cancel)
|
|
8161
8161
|
throw new y();
|
|
@@ -8163,10 +8163,10 @@ class Yn extends bt {
|
|
|
8163
8163
|
})
|
|
8164
8164
|
), this.registerEventHandler(
|
|
8165
8165
|
this.Event.SheetValueChanged,
|
|
8166
|
-
() => t.onCommandExecuted((
|
|
8167
|
-
if (
|
|
8166
|
+
() => t.onCommandExecuted((n) => {
|
|
8167
|
+
if (ws.indexOf(n.id) > -1) {
|
|
8168
8168
|
if (!this.getActiveSheet()) return;
|
|
8169
|
-
const r =
|
|
8169
|
+
const r = Ss(n).map(
|
|
8170
8170
|
(o) => {
|
|
8171
8171
|
var a, h;
|
|
8172
8172
|
return (h = (a = this.getWorkbook(o.unitId)) == null ? void 0 : a.getSheetBySheetId(o.subUnitId)) == null ? void 0 : h.getRange(o.range);
|
|
@@ -8174,17 +8174,17 @@ class Yn extends bt {
|
|
|
8174
8174
|
).filter(Boolean);
|
|
8175
8175
|
if (!r.length) return;
|
|
8176
8176
|
this.fireEvent(this.Event.SheetValueChanged, {
|
|
8177
|
-
payload:
|
|
8177
|
+
payload: n,
|
|
8178
8178
|
effectedRanges: r
|
|
8179
8179
|
});
|
|
8180
8180
|
}
|
|
8181
8181
|
})
|
|
8182
8182
|
), this.registerEventHandler(
|
|
8183
8183
|
this.Event.SheetCreated,
|
|
8184
|
-
() => t.onCommandExecuted((
|
|
8184
|
+
() => t.onCommandExecuted((n) => {
|
|
8185
8185
|
var i;
|
|
8186
|
-
if (
|
|
8187
|
-
const r =
|
|
8186
|
+
if (n.id === ce.id) {
|
|
8187
|
+
const r = n.params, { unitId: o } = r || {}, a = o ? this.getUniverSheet(o) : (i = this.getActiveWorkbook) == null ? void 0 : i.call(this);
|
|
8188
8188
|
if (!a)
|
|
8189
8189
|
return;
|
|
8190
8190
|
const h = a.getActiveSheet();
|
|
@@ -8202,8 +8202,8 @@ class Yn extends bt {
|
|
|
8202
8202
|
})
|
|
8203
8203
|
), this.registerEventHandler(
|
|
8204
8204
|
this.Event.ActiveSheetChanged,
|
|
8205
|
-
() => t.onCommandExecuted((
|
|
8206
|
-
if (
|
|
8205
|
+
() => t.onCommandExecuted((n) => {
|
|
8206
|
+
if (n.id === Z.id) {
|
|
8207
8207
|
const i = this.getActiveSheet();
|
|
8208
8208
|
if (!i) return;
|
|
8209
8209
|
const { workbook: r, worksheet: o } = i;
|
|
@@ -8212,55 +8212,55 @@ class Yn extends bt {
|
|
|
8212
8212
|
})
|
|
8213
8213
|
), this.registerEventHandler(
|
|
8214
8214
|
this.Event.SheetDeleted,
|
|
8215
|
-
() => t.onCommandExecuted((
|
|
8215
|
+
() => t.onCommandExecuted((n) => {
|
|
8216
8216
|
var i;
|
|
8217
|
-
if (
|
|
8218
|
-
const { subUnitId: r, unitId: o } =
|
|
8217
|
+
if (n.id === Oe.id) {
|
|
8218
|
+
const { subUnitId: r, unitId: o } = n.params, a = o ? this.getUniverSheet(o) : (i = this.getActiveWorkbook) == null ? void 0 : i.call(this);
|
|
8219
8219
|
if (!a || !r) return;
|
|
8220
8220
|
this._fireSheetDeleted(a, r);
|
|
8221
8221
|
}
|
|
8222
8222
|
})
|
|
8223
8223
|
), this.registerEventHandler(
|
|
8224
8224
|
this.Event.SheetMoved,
|
|
8225
|
-
() => t.onCommandExecuted((
|
|
8226
|
-
if (
|
|
8227
|
-
const { toOrder: i } =
|
|
8225
|
+
() => t.onCommandExecuted((n) => {
|
|
8226
|
+
if (n.id === dt.id) {
|
|
8227
|
+
const { toOrder: i } = n.params, r = this.getCommandSheetTarget(n);
|
|
8228
8228
|
if (!r) return;
|
|
8229
8229
|
this._fireSheetMoved(r.workbook, r.worksheet, i);
|
|
8230
8230
|
}
|
|
8231
8231
|
})
|
|
8232
8232
|
), this.registerEventHandler(
|
|
8233
8233
|
this.Event.SheetNameChanged,
|
|
8234
|
-
() => t.onCommandExecuted((
|
|
8235
|
-
if (
|
|
8236
|
-
const { name: i } =
|
|
8234
|
+
() => t.onCommandExecuted((n) => {
|
|
8235
|
+
if (n.id === je.id) {
|
|
8236
|
+
const { name: i } = n.params, r = this.getCommandSheetTarget(n);
|
|
8237
8237
|
if (!r) return;
|
|
8238
8238
|
this._fireSheetNameChanged(r.workbook, r.worksheet, i);
|
|
8239
8239
|
}
|
|
8240
8240
|
})
|
|
8241
8241
|
), this.registerEventHandler(
|
|
8242
8242
|
this.Event.SheetTabColorChanged,
|
|
8243
|
-
() => t.onCommandExecuted((
|
|
8244
|
-
if (
|
|
8245
|
-
const { color: i } =
|
|
8243
|
+
() => t.onCommandExecuted((n) => {
|
|
8244
|
+
if (n.id === ut.id) {
|
|
8245
|
+
const { color: i } = n.params, r = this.getCommandSheetTarget(n);
|
|
8246
8246
|
if (!r) return;
|
|
8247
8247
|
this._fireSheetTabColorChanged(r.workbook, r.worksheet, i);
|
|
8248
8248
|
}
|
|
8249
8249
|
})
|
|
8250
8250
|
), this.registerEventHandler(
|
|
8251
8251
|
this.Event.SheetHideChanged,
|
|
8252
|
-
() => t.onCommandExecuted((
|
|
8253
|
-
if (
|
|
8254
|
-
const { hidden: i } =
|
|
8252
|
+
() => t.onCommandExecuted((n) => {
|
|
8253
|
+
if (n.id === lt.id) {
|
|
8254
|
+
const { hidden: i } = n.params, r = this.getCommandSheetTarget(n);
|
|
8255
8255
|
if (!r) return;
|
|
8256
8256
|
this._fireSheetHideChanged(r.workbook, r.worksheet, !!i);
|
|
8257
8257
|
}
|
|
8258
8258
|
})
|
|
8259
8259
|
), this.registerEventHandler(
|
|
8260
8260
|
this.Event.GridlineChanged,
|
|
8261
|
-
() => t.onCommandExecuted((
|
|
8262
|
-
if (
|
|
8263
|
-
const i = this.getCommandSheetTarget(
|
|
8261
|
+
() => t.onCommandExecuted((n) => {
|
|
8262
|
+
if (n.id === Ne.id || n.id === We.id) {
|
|
8263
|
+
const i = this.getCommandSheetTarget(n);
|
|
8264
8264
|
if (!i) return;
|
|
8265
8265
|
this.fireEvent(this.Event.GridlineChanged, {
|
|
8266
8266
|
...i,
|
|
@@ -8296,8 +8296,8 @@ class Yn extends bt {
|
|
|
8296
8296
|
return this._injector.createInstance(ge);
|
|
8297
8297
|
}
|
|
8298
8298
|
onUniverSheetCreated(e) {
|
|
8299
|
-
const t = this._univerInstanceService.getTypeOfUnitAdded$(T.UNIVER_SHEET).subscribe((
|
|
8300
|
-
const i = this._injector.createInstance(v,
|
|
8299
|
+
const t = this._univerInstanceService.getTypeOfUnitAdded$(T.UNIVER_SHEET).subscribe((n) => {
|
|
8300
|
+
const i = this._injector.createInstance(v, n);
|
|
8301
8301
|
e(i);
|
|
8302
8302
|
});
|
|
8303
8303
|
return kt(t);
|
|
@@ -8313,7 +8313,7 @@ class Yn extends bt {
|
|
|
8313
8313
|
return t ? { workbook: e, worksheet: t } : null;
|
|
8314
8314
|
}
|
|
8315
8315
|
setFreezeSync(e) {
|
|
8316
|
-
this._injector.get(
|
|
8316
|
+
this._injector.get(Cs).setEnabled(e);
|
|
8317
8317
|
}
|
|
8318
8318
|
_fireActiveSheetChanged(e, t) {
|
|
8319
8319
|
this.fireEvent(this.Event.ActiveSheetChanged, {
|
|
@@ -8327,49 +8327,49 @@ class Yn extends bt {
|
|
|
8327
8327
|
sheetId: t
|
|
8328
8328
|
});
|
|
8329
8329
|
}
|
|
8330
|
-
_fireSheetMoved(e, t,
|
|
8330
|
+
_fireSheetMoved(e, t, n) {
|
|
8331
8331
|
this.fireEvent(this.Event.SheetMoved, {
|
|
8332
8332
|
workbook: e,
|
|
8333
8333
|
worksheet: t,
|
|
8334
|
-
newIndex:
|
|
8334
|
+
newIndex: n
|
|
8335
8335
|
});
|
|
8336
8336
|
}
|
|
8337
|
-
_fireSheetNameChanged(e, t,
|
|
8337
|
+
_fireSheetNameChanged(e, t, n) {
|
|
8338
8338
|
this.fireEvent(this.Event.SheetNameChanged, {
|
|
8339
8339
|
workbook: e,
|
|
8340
8340
|
worksheet: t,
|
|
8341
|
-
newName:
|
|
8341
|
+
newName: n
|
|
8342
8342
|
});
|
|
8343
8343
|
}
|
|
8344
|
-
_fireSheetTabColorChanged(e, t,
|
|
8344
|
+
_fireSheetTabColorChanged(e, t, n) {
|
|
8345
8345
|
this.fireEvent(this.Event.SheetTabColorChanged, {
|
|
8346
8346
|
workbook: e,
|
|
8347
8347
|
worksheet: t,
|
|
8348
|
-
newColor:
|
|
8348
|
+
newColor: n
|
|
8349
8349
|
});
|
|
8350
8350
|
}
|
|
8351
|
-
_fireSheetHideChanged(e, t,
|
|
8351
|
+
_fireSheetHideChanged(e, t, n) {
|
|
8352
8352
|
this.fireEvent(this.Event.SheetHideChanged, {
|
|
8353
8353
|
workbook: e,
|
|
8354
8354
|
worksheet: t,
|
|
8355
|
-
hidden:
|
|
8355
|
+
hidden: n
|
|
8356
8356
|
});
|
|
8357
8357
|
}
|
|
8358
8358
|
}
|
|
8359
|
-
bt.extend(
|
|
8360
|
-
class
|
|
8359
|
+
bt.extend(Ys);
|
|
8360
|
+
class Zs {
|
|
8361
8361
|
get SheetValueChangeType() {
|
|
8362
|
-
return
|
|
8362
|
+
return ks;
|
|
8363
8363
|
}
|
|
8364
8364
|
get SheetSkeletonChangeType() {
|
|
8365
|
-
return
|
|
8365
|
+
return bs;
|
|
8366
8366
|
}
|
|
8367
8367
|
get SplitDelimiterType() {
|
|
8368
|
-
return
|
|
8368
|
+
return Is;
|
|
8369
8369
|
}
|
|
8370
8370
|
}
|
|
8371
|
-
Tt.extend(
|
|
8372
|
-
class
|
|
8371
|
+
Tt.extend(Zs);
|
|
8372
|
+
class Qs {
|
|
8373
8373
|
get SheetCreated() {
|
|
8374
8374
|
return "SheetCreated";
|
|
8375
8375
|
}
|
|
@@ -8431,15 +8431,15 @@ class Qn {
|
|
|
8431
8431
|
return "SheetValueChanged";
|
|
8432
8432
|
}
|
|
8433
8433
|
}
|
|
8434
|
-
Vt.extend(
|
|
8435
|
-
var
|
|
8436
|
-
for (var i =
|
|
8437
|
-
(o =
|
|
8434
|
+
Vt.extend(Qs);
|
|
8435
|
+
var Xs = Object.getOwnPropertyDescriptor, ei = (s, e, t, n) => {
|
|
8436
|
+
for (var i = n > 1 ? void 0 : n ? Xs(e, t) : e, r = s.length - 1, o; r >= 0; r--)
|
|
8437
|
+
(o = s[r]) && (i = o(i) || i);
|
|
8438
8438
|
return i;
|
|
8439
|
-
}, ti = (
|
|
8439
|
+
}, ti = (s, e) => (t, n) => e(t, n, s);
|
|
8440
8440
|
let _t = class extends Be {
|
|
8441
|
-
constructor(
|
|
8442
|
-
super(), this._injector =
|
|
8441
|
+
constructor(s) {
|
|
8442
|
+
super(), this._injector = s;
|
|
8443
8443
|
}
|
|
8444
8444
|
};
|
|
8445
8445
|
_t = ei([
|
|
@@ -8449,9 +8449,9 @@ export {
|
|
|
8449
8449
|
ge as FPermission,
|
|
8450
8450
|
I as FRange,
|
|
8451
8451
|
_e as FSelection,
|
|
8452
|
-
|
|
8452
|
+
Qs as FSheetEventName,
|
|
8453
8453
|
_t as FSheetHooks,
|
|
8454
|
-
|
|
8454
|
+
Zs as FSheetsEnum,
|
|
8455
8455
|
v as FWorkbook,
|
|
8456
8456
|
b as FWorksheet
|
|
8457
8457
|
};
|