@univerjs/sheets 0.2.8 → 0.2.10
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/index.js +3 -3
- package/lib/es/index.js +454 -277
- package/lib/types/basics/__tests__/expand.data.d.ts +2 -0
- package/lib/types/basics/__tests__/expand.spec.d.ts +16 -0
- package/lib/types/basics/expand-range.d.ts +15 -0
- package/lib/types/commands/commands/move-rows-cols.command.d.ts +6 -0
- package/lib/types/commands/commands/remove-row-col.command.d.ts +3 -0
- package/lib/types/commands/commands/set-col-visible.command.d.ts +5 -0
- package/lib/types/commands/commands/set-row-visible.command.d.ts +6 -1
- package/lib/types/commands/commands/set-worksheet-col-width.command.d.ts +4 -1
- package/lib/types/commands/commands/set-worksheet-row-height.command.d.ts +7 -2
- package/lib/types/commands/commands/utils/selection-utils.d.ts +13 -1
- package/lib/types/commands/mutations/add-range-protection.mutation.d.ts +1 -1
- package/lib/types/commands/mutations/set-range-values.mutation.d.ts +0 -1
- package/lib/types/index.d.ts +6 -4
- package/lib/types/model/range-protection-rule.model.d.ts +1 -0
- package/lib/types/services/permission/range-permission/range-protection.ref-range.d.ts +6 -1
- package/lib/types/services/permission/type.d.ts +1 -1
- package/lib/types/services/permission/worksheet-permission/worksheet-permission-point.model.d.ts +1 -0
- package/lib/types/services/permission/worksheet-permission/worksheet-permission-rule.model.d.ts +2 -1
- package/lib/types/services/ref-range/util.d.ts +5 -0
- package/lib/types/services/selections/selection-manager.service.d.ts +11 -6
- package/lib/types/services/sheet-interceptor/__tests__/create-core-test-bed.d.ts +1 -1
- package/lib/types/services/sheet-interceptor/interceptor-const.d.ts +4 -0
- package/lib/types/services/sheet-interceptor/sheet-interceptor.service.d.ts +3 -4
- package/lib/types/sheets-plugin.d.ts +2 -7
- package/lib/umd/index.js +3 -3
- package/package.json +13 -13
package/lib/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import { RxDisposable, UniverInstanceType, Disposable, IUniverInstanceService, createInterceptorKey,
|
|
5
|
+
import { RxDisposable, UniverInstanceType, Disposable, IUniverInstanceService, createInterceptorKey, toDisposable, remove, composeInterceptors, DisposableCollection, Tools, normalizeTextRuns, CellValueType, isSafeNumeric, isRealNum, isBooleanString, CommandType, ObjectMatrix, ICommandService, IUndoRedoService, sequenceExecute, LocaleService, createIdentifier, IContextService, selectionToArray, Rectangle, RANGE_TYPE, ErrorService, Range, cellToRange, PermissionStatus, IPermissionService, isICellData, Dimension, getArrayLength, insertMatrixArray, spliceArray, sliceMatrixArray, concatMatrixArray, BooleanNumber, Direction, mergeWorksheetSnapshotWithDefault, moveMatrixArray, BorderType, BorderStyleTypes, FontWeight, FontItalic, runOnLifecycle, LifecycleStages, OnLifecycle, Inject, Injector, IResourceManagerService, Optional, IConfigService, queryObjectMatrix, InterceptorManager, ILogService, LRUMap, DependentOn, Plugin, mergeOverrideWithDependencies, ColorKit, getCellInfoInMergeData, makeCellRangeToRangeData, createRowColIter } from "@univerjs/core";
|
|
6
6
|
import { SetDefinedNameMutation, RemoveDefinedNameMutation, SetFormulaCalculationResultMutation, handleNumfmtInCell, IDefinedNamesService, stripErrorMargin, UniverFormulaEnginePlugin } from "@univerjs/engine-formula";
|
|
7
7
|
import { DataSyncPrimaryController } from "@univerjs/rpc";
|
|
8
8
|
import { shareReplay, takeUntil, switchMap, of, Subject, BehaviorSubject, merge, map } from "rxjs";
|
|
@@ -29,13 +29,19 @@ let SheetsSelectionsService = (_a = class extends RxDisposable {
|
|
|
29
29
|
const worksheet = workbook.getActiveSheet();
|
|
30
30
|
return { unitId: workbook.getUnitId(), sheetId: worksheet.getSheetId() };
|
|
31
31
|
}
|
|
32
|
+
get currentSelectionParam() {
|
|
33
|
+
return this._currentSelectionPos;
|
|
34
|
+
}
|
|
32
35
|
_init() {
|
|
33
36
|
const c$ = this._instanceSrv.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).pipe(shareReplay(1), takeUntil(this.dispose$));
|
|
34
37
|
this.selectionMoveStart$ = c$.pipe(switchMap((workbook) => workbook ? this._ensureWorkbookSelection(workbook.getUnitId()).selectionMoveStart$ : of())), this.selectionMoving$ = c$.pipe(switchMap((workbook) => workbook ? this._ensureWorkbookSelection(workbook.getUnitId()).selectionMoving$ : of())), this.selectionMoveEnd$ = c$.pipe(switchMap((workbook) => workbook ? this._ensureWorkbookSelection(workbook.getUnitId()).selectionMoveEnd$ : of([]))), this._instanceSrv.getTypeOfUnitDisposed$(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((workbook) => {
|
|
35
38
|
this._removeWorkbookSelection(workbook.getUnitId());
|
|
36
39
|
});
|
|
37
40
|
}
|
|
38
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Clear all selections in all workbooks.
|
|
43
|
+
* invoked by prompt.controller
|
|
44
|
+
*/
|
|
39
45
|
clear() {
|
|
40
46
|
this._workbookSelections.forEach((wbSelection) => wbSelection.clear());
|
|
41
47
|
}
|
|
@@ -57,6 +63,14 @@ let SheetsSelectionsService = (_a = class extends RxDisposable {
|
|
|
57
63
|
const { unitId, sheetId } = current;
|
|
58
64
|
this._ensureWorkbookSelection(unitId).addSelections(sheetId, unitIdOrSelections);
|
|
59
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Set seleciton data to WorkbookSelections.
|
|
68
|
+
* If type is not specfied, this method would clear all existing selections.
|
|
69
|
+
* @param unitIdOrSelections
|
|
70
|
+
* @param worksheetIdOrType
|
|
71
|
+
* @param selectionDatas
|
|
72
|
+
* @param type
|
|
73
|
+
*/
|
|
60
74
|
setSelections(unitIdOrSelections, worksheetIdOrType, selectionDatas, type) {
|
|
61
75
|
if (typeof unitIdOrSelections == "string") {
|
|
62
76
|
this._ensureWorkbookSelection(unitIdOrSelections).setSelections(
|
|
@@ -145,13 +159,27 @@ const _WorkbookSelections = class _WorkbookSelections extends Disposable {
|
|
|
145
159
|
selections.push(...selectionDatas), this._emitOnEnd(selections);
|
|
146
160
|
}
|
|
147
161
|
/**
|
|
148
|
-
*
|
|
162
|
+
* Set selectionDatas to _worksheetSelections, and emit selectionDatas by type.
|
|
163
|
+
* If type is not specfied, this method would clear all existing selections.
|
|
149
164
|
* @param sheetId
|
|
150
165
|
* @param selectionDatas
|
|
151
166
|
* @param type
|
|
152
167
|
*/
|
|
153
|
-
setSelections(sheetId, selectionDatas, type
|
|
154
|
-
this._ensureSheetSelection(sheetId).length = 0, this._ensureSheetSelection(sheetId).push(...selectionDatas), type
|
|
168
|
+
setSelections(sheetId, selectionDatas, type) {
|
|
169
|
+
switch (this._ensureSheetSelection(sheetId).length = 0, this._ensureSheetSelection(sheetId).push(...selectionDatas), type) {
|
|
170
|
+
case 0:
|
|
171
|
+
this._selectionMoveStart$.next(selectionDatas);
|
|
172
|
+
break;
|
|
173
|
+
case 1:
|
|
174
|
+
this._selectionMoving$.next(selectionDatas);
|
|
175
|
+
break;
|
|
176
|
+
case 2:
|
|
177
|
+
this._emitOnEnd(selectionDatas);
|
|
178
|
+
break;
|
|
179
|
+
default:
|
|
180
|
+
this._emitOnEnd(selectionDatas);
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
155
183
|
}
|
|
156
184
|
getCurrentSelections() {
|
|
157
185
|
return this._getCurrentSelections();
|
|
@@ -167,7 +195,7 @@ const _WorkbookSelections = class _WorkbookSelections extends Disposable {
|
|
|
167
195
|
return selectionData[selectionData.length - 1];
|
|
168
196
|
}
|
|
169
197
|
/**
|
|
170
|
-
*
|
|
198
|
+
* Same as _getCurrentSelections(which return this._worksheetSelections), but this method would set [] if no selection.
|
|
171
199
|
* @param sheetId
|
|
172
200
|
* @returns this._worksheetSelections
|
|
173
201
|
*/
|
|
@@ -185,12 +213,13 @@ const DISABLE_NORMAL_SELECTIONS = "DISABLE_NORMAL_SELECTIONS", CELL_CONTENT = cr
|
|
|
185
213
|
CELL_CONTENT,
|
|
186
214
|
ROW_FILTERED
|
|
187
215
|
};
|
|
188
|
-
var __defProp$h = Object.defineProperty, __getOwnPropDesc$h = Object.getOwnPropertyDescriptor, __decorateClass$h = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
216
|
+
var InterceptCellContentPriority = /* @__PURE__ */ ((InterceptCellContentPriority2) => (InterceptCellContentPriority2[InterceptCellContentPriority2.DATA_VALIDATION = 9] = "DATA_VALIDATION", InterceptCellContentPriority2[InterceptCellContentPriority2.NUMFMT = 10] = "NUMFMT", InterceptCellContentPriority2))(InterceptCellContentPriority || {}), __defProp$h = Object.defineProperty, __getOwnPropDesc$h = Object.getOwnPropertyDescriptor, __decorateClass$h = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
189
217
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
190
218
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
191
219
|
return kind && result && __defProp$h(target, key, result), result;
|
|
192
220
|
}, "__decorateClass$h"), __decorateParam$e = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$e"), _a2;
|
|
193
221
|
let SheetInterceptorService = (_a2 = class extends Disposable {
|
|
222
|
+
/** @ignore */
|
|
194
223
|
constructor(_univerInstanceService) {
|
|
195
224
|
super();
|
|
196
225
|
__publicField(this, "_interceptorsByName", /* @__PURE__ */ new Map());
|
|
@@ -338,7 +367,7 @@ let SheetInterceptorService = (_a2 = class extends Disposable {
|
|
|
338
367
|
}));
|
|
339
368
|
});
|
|
340
369
|
}, "interceptViewModel");
|
|
341
|
-
workbook.getSheets().forEach((worksheet) => interceptViewModel(worksheet)), disposables.add(
|
|
370
|
+
workbook.getSheets().forEach((worksheet) => interceptViewModel(worksheet)), disposables.add(workbook.sheetCreated$.subscribe((worksheet) => interceptViewModel(worksheet))), disposables.add(toDisposable(() => workbook.getSheets().forEach((worksheet) => this._disposeSheetInterceptor(unitId, worksheet)))), disposables.add(workbook.sheetDisposed$.subscribe((worksheet) => this._disposeSheetInterceptor(unitId, worksheet))), this._workbookDisposables.set(unitId, disposables);
|
|
342
371
|
}
|
|
343
372
|
_disposeWorkbookInterceptor(workbook) {
|
|
344
373
|
const unitId = workbook.getUnitId(), disposable = this._workbookDisposables.get(unitId);
|
|
@@ -350,7 +379,6 @@ let SheetInterceptorService = (_a2 = class extends Disposable {
|
|
|
350
379
|
}
|
|
351
380
|
}, __name(_a2, "SheetInterceptorService"), _a2);
|
|
352
381
|
SheetInterceptorService = __decorateClass$h([
|
|
353
|
-
OnLifecycle(LifecycleStages.Starting, SheetInterceptorService),
|
|
354
382
|
__decorateParam$e(0, IUniverInstanceService)
|
|
355
383
|
], SheetInterceptorService);
|
|
356
384
|
function getWorksheetDisposableID(unitId, worksheet) {
|
|
@@ -395,7 +423,7 @@ function mergeStyle(oldStyle, newStyle, isRichText = !1) {
|
|
|
395
423
|
const backupStyle = Tools.deepClone(oldStyle) || {};
|
|
396
424
|
if (backupStyle) {
|
|
397
425
|
for (const k in newStyle)
|
|
398
|
-
isRichText && ["bd", "tr", "td", "ht", "vt", "tb", "pd"].includes(k) || (k in backupStyle && k === "bd" ? backupStyle[k] = Object.assign(backupStyle[k], newStyle[k]) : backupStyle[k] = newStyle[k]);
|
|
426
|
+
isRichText && ["bd", "tr", "td", "ht", "vt", "tb", "pd", "bg"].includes(k) || (k in backupStyle && k === "bd" ? backupStyle[k] = Object.assign(backupStyle[k], newStyle[k]) : backupStyle[k] = newStyle[k]);
|
|
399
427
|
return "cl" in backupStyle && ("ul" in backupStyle && backupStyle.ul && (backupStyle.ul.cl = backupStyle.cl), "ol" in backupStyle && backupStyle.ol && (backupStyle.ol.cl = backupStyle.cl), "st" in backupStyle && backupStyle.st && (backupStyle.st.cl = backupStyle.cl)), backupStyle;
|
|
400
428
|
}
|
|
401
429
|
}
|
|
@@ -552,73 +580,6 @@ const SetRangeValuesUndoMutationFactory = /* @__PURE__ */ __name((accessor, para
|
|
|
552
580
|
return _initValue++;
|
|
553
581
|
}, "getKey");
|
|
554
582
|
}, "createUniqueKey");
|
|
555
|
-
function cellHasValue(cell) {
|
|
556
|
-
return cell == null ? !1 : cell.v !== void 0 && cell.v !== null && cell.v !== "" || cell.p !== void 0;
|
|
557
|
-
}
|
|
558
|
-
__name(cellHasValue, "cellHasValue");
|
|
559
|
-
function expandToContinuousRange(startRange, directions, worksheet) {
|
|
560
|
-
const { left, right, up, down } = directions, maxRow = worksheet.getMaxRows(), maxColumn = worksheet.getMaxColumns();
|
|
561
|
-
let changed = !0;
|
|
562
|
-
const destRange = { ...startRange }, allMatrix = worksheet.getMatrixWithMergedCells(0, 0, maxRow - 1, maxColumn - 1);
|
|
563
|
-
for (; changed; ) {
|
|
564
|
-
if (changed = !1, up && destRange.startRow !== 0) {
|
|
565
|
-
const destRow = destRange.startRow - 1, checkRange = {
|
|
566
|
-
startRow: destRow,
|
|
567
|
-
startColumn: destRange.startColumn,
|
|
568
|
-
endRow: destRow,
|
|
569
|
-
endColumn: destRange.endColumn
|
|
570
|
-
};
|
|
571
|
-
for (let col = checkRange.startColumn; col <= checkRange.endColumn; col++) {
|
|
572
|
-
const cell = allMatrix.getValue(checkRange.startRow, col);
|
|
573
|
-
cellHasValue(cell) && (destRange.startRow = Math.min(checkRange.startRow, destRange.startRow), destRange.startColumn = Math.min(col, destRange.startColumn), destRange.endColumn = Math.max(col, destRange.endColumn), changed = !0);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
if (down && destRange.endRow !== maxRow - 1) {
|
|
577
|
-
const destRow = destRange.endRow + 1, checkRange = {
|
|
578
|
-
startRow: destRow,
|
|
579
|
-
startColumn: destRange.startColumn,
|
|
580
|
-
endRow: destRow,
|
|
581
|
-
endColumn: destRange.endColumn
|
|
582
|
-
};
|
|
583
|
-
for (let col = checkRange.startColumn; col <= checkRange.endColumn; col++) {
|
|
584
|
-
const cellValue = allMatrix.getValue(checkRange.startRow, col);
|
|
585
|
-
cellHasValue(cellValue) && (destRange.endRow = Math.max(checkRange.endRow, destRange.endRow), destRange.endRow = Math.max(
|
|
586
|
-
checkRange.endRow + (cellValue.rowSpan !== void 0 ? cellValue.rowSpan - 1 : 0),
|
|
587
|
-
destRange.endRow
|
|
588
|
-
), destRange.startColumn = Math.min(col, destRange.startColumn), destRange.endColumn = Math.max(col, destRange.endColumn), changed = !0);
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
if (left && destRange.startColumn !== 0) {
|
|
592
|
-
const destCol = destRange.startColumn - 1, checkRange = {
|
|
593
|
-
startRow: destRange.startRow,
|
|
594
|
-
startColumn: destCol,
|
|
595
|
-
endRow: destRange.endRow,
|
|
596
|
-
endColumn: destCol
|
|
597
|
-
};
|
|
598
|
-
for (let row = checkRange.startRow; row <= checkRange.endRow; row++) {
|
|
599
|
-
const cell = allMatrix.getValue(row, checkRange.startColumn);
|
|
600
|
-
cellHasValue(cell) && (destRange.startColumn = Math.min(checkRange.startColumn, destRange.startColumn), destRange.startRow = Math.min(row, destRange.startRow), destRange.endRow = Math.max(row, destRange.endRow), changed = !0);
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
if (right && destRange.endColumn !== maxColumn - 1) {
|
|
604
|
-
const destCol = destRange.endColumn + 1, checkRange = {
|
|
605
|
-
startRow: destRange.startRow,
|
|
606
|
-
startColumn: destCol,
|
|
607
|
-
endRow: destRange.endRow,
|
|
608
|
-
endColumn: destCol
|
|
609
|
-
};
|
|
610
|
-
for (let row = checkRange.startRow; row <= checkRange.endRow; row++) {
|
|
611
|
-
const cellValue = allMatrix.getValue(row, checkRange.endColumn);
|
|
612
|
-
cellHasValue(cellValue) && (destRange.endColumn = Math.max(
|
|
613
|
-
checkRange.endColumn + (cellValue.colSpan !== void 0 ? cellValue.colSpan - 1 : 0),
|
|
614
|
-
destRange.endColumn
|
|
615
|
-
), changed = !0);
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
return destRange;
|
|
620
|
-
}
|
|
621
|
-
__name(expandToContinuousRange, "expandToContinuousRange");
|
|
622
583
|
function generateNullCell(range) {
|
|
623
584
|
const cellValue = new ObjectMatrix();
|
|
624
585
|
return range.forEach((range2) => {
|
|
@@ -908,7 +869,7 @@ const SetSelectionsOperation = {
|
|
|
908
869
|
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
909
870
|
if (!params) return !1;
|
|
910
871
|
const { selections, type, unitId, subUnitId } = params;
|
|
911
|
-
return getSelectionsService(accessor).setSelections(unitId, subUnitId, selections, type), !0;
|
|
872
|
+
return getSelectionsService(accessor).setSelections(unitId, subUnitId, [...selections], type), !0;
|
|
912
873
|
}, "handler")
|
|
913
874
|
};
|
|
914
875
|
function alignToMergedCellsBorders(startRange, worksheet, shouldRecursive = !0) {
|
|
@@ -1011,6 +972,16 @@ function createRangeIteratorWithSkipFilteredRows(sheet) {
|
|
|
1011
972
|
};
|
|
1012
973
|
}
|
|
1013
974
|
__name(createRangeIteratorWithSkipFilteredRows, "createRangeIteratorWithSkipFilteredRows");
|
|
975
|
+
function copyRangeStyles(worksheet, startRow, endRow, startColumn, endColumn, isRow, styleRowOrColumn) {
|
|
976
|
+
const cellValue = {};
|
|
977
|
+
for (let row = startRow; row <= endRow; row++)
|
|
978
|
+
for (let column = startColumn; column <= endColumn; column++) {
|
|
979
|
+
const cell = isRow ? worksheet.getCell(styleRowOrColumn, column) : worksheet.getCell(row, styleRowOrColumn);
|
|
980
|
+
!cell || !cell.s || (cellValue[row] || (cellValue[row] = {}), cellValue[row][column] = { s: cell.s });
|
|
981
|
+
}
|
|
982
|
+
return cellValue;
|
|
983
|
+
}
|
|
984
|
+
__name(copyRangeStyles, "copyRangeStyles");
|
|
1014
985
|
const MoveRangeCommandId = "sheet.command.move-range", MoveRangeCommand = {
|
|
1015
986
|
type: CommandType.COMMAND,
|
|
1016
987
|
id: MoveRangeCommandId,
|
|
@@ -1111,11 +1082,11 @@ function getMoveRangeUndoRedoMutations(accessor, from, to, ignoreMerge = !1) {
|
|
|
1111
1082
|
};
|
|
1112
1083
|
}
|
|
1113
1084
|
__name(getMoveRangeUndoRedoMutations, "getMoveRangeUndoRedoMutations");
|
|
1114
|
-
var I = /* @__PURE__ */ ((E) => (E[E.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", E[E.UNIVER_DOC = 1] = "UNIVER_DOC", E[E.UNIVER_SHEET = 2] = "UNIVER_SHEET", E[E.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", E[E.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(I || {}), P = /* @__PURE__ */ ((E) => (E[E.View = 0] = "View", E[E.Edit = 1] = "Edit", E[E.ManageCollaborator = 2] = "ManageCollaborator", E[E.Print = 3] = "Print", E[E.Duplicate = 4] = "Duplicate", E[E.Comment = 5] = "Comment", E[E.Copy = 6] = "Copy", E[E.Share = 7] = "Share", E[E.Export = 8] = "Export", E[E.MoveWorksheet = 9] = "MoveWorksheet", E[E.DeleteWorksheet = 10] = "DeleteWorksheet", E[E.HideWorksheet = 11] = "HideWorksheet", E[E.RenameWorksheet = 12] = "RenameWorksheet", E[E.CreateWorksheet = 13] = "CreateWorksheet", E[E.SetWorksheetStyle = 14] = "SetWorksheetStyle", E[E.EditWorksheetCell = 15] = "EditWorksheetCell", E[E.InsertHyperlink = 16] = "InsertHyperlink", E[E.Sort = 17] = "Sort", E[E.Filter = 18] = "Filter", E[E.PivotTable = 19] = "PivotTable", E[E.FloatImg = 20] = "FloatImg", E[E.History = 21] = "History", E[E.RwHgtClWdt = 22] = "RwHgtClWdt", E[E.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", E[E.ViewFilter = 24] = "ViewFilter", E[E.MoveSheet = 25] = "MoveSheet", E[E.DeleteSheet = 26] = "DeleteSheet", E[E.HideSheet = 27] = "HideSheet", E[E.CopySheet = 28] = "CopySheet", E[E.RenameSheet = 29] = "RenameSheet", E[E.CreateSheet = 30] = "CreateSheet", E[E.SelectProtectedCells = 31] = "SelectProtectedCells", E[E.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", E[E.SetCellStyle = 33] = "SetCellStyle", E[E.SetCellValue = 34] = "SetCellValue", E[E.SetRowStyle = 35] = "SetRowStyle", E[E.SetColumnStyle = 36] = "SetColumnStyle", E[E.InsertRow = 37] = "InsertRow", E[E.InsertColumn = 38] = "InsertColumn", E[E.DeleteRow = 39] = "DeleteRow", E[E.DeleteColumn = 40] = "DeleteColumn", E[E.EditExtraObject = 41] = "EditExtraObject", E[E.Delete = 42] = "Delete", E[E.RecoverHistory = 43] = "RecoverHistory", E[E.ViewHistory = 44] = "ViewHistory", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(P || {}),
|
|
1085
|
+
var I = /* @__PURE__ */ ((E) => (E[E.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", E[E.UNIVER_DOC = 1] = "UNIVER_DOC", E[E.UNIVER_SHEET = 2] = "UNIVER_SHEET", E[E.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", E[E.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(I || {}), P = /* @__PURE__ */ ((E) => (E[E.View = 0] = "View", E[E.Edit = 1] = "Edit", E[E.ManageCollaborator = 2] = "ManageCollaborator", E[E.Print = 3] = "Print", E[E.Duplicate = 4] = "Duplicate", E[E.Comment = 5] = "Comment", E[E.Copy = 6] = "Copy", E[E.Share = 7] = "Share", E[E.Export = 8] = "Export", E[E.MoveWorksheet = 9] = "MoveWorksheet", E[E.DeleteWorksheet = 10] = "DeleteWorksheet", E[E.HideWorksheet = 11] = "HideWorksheet", E[E.RenameWorksheet = 12] = "RenameWorksheet", E[E.CreateWorksheet = 13] = "CreateWorksheet", E[E.SetWorksheetStyle = 14] = "SetWorksheetStyle", E[E.EditWorksheetCell = 15] = "EditWorksheetCell", E[E.InsertHyperlink = 16] = "InsertHyperlink", E[E.Sort = 17] = "Sort", E[E.Filter = 18] = "Filter", E[E.PivotTable = 19] = "PivotTable", E[E.FloatImg = 20] = "FloatImg", E[E.History = 21] = "History", E[E.RwHgtClWdt = 22] = "RwHgtClWdt", E[E.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", E[E.ViewFilter = 24] = "ViewFilter", E[E.MoveSheet = 25] = "MoveSheet", E[E.DeleteSheet = 26] = "DeleteSheet", E[E.HideSheet = 27] = "HideSheet", E[E.CopySheet = 28] = "CopySheet", E[E.RenameSheet = 29] = "RenameSheet", E[E.CreateSheet = 30] = "CreateSheet", E[E.SelectProtectedCells = 31] = "SelectProtectedCells", E[E.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", E[E.SetCellStyle = 33] = "SetCellStyle", E[E.SetCellValue = 34] = "SetCellValue", E[E.SetRowStyle = 35] = "SetRowStyle", E[E.SetColumnStyle = 36] = "SetColumnStyle", E[E.InsertRow = 37] = "InsertRow", E[E.InsertColumn = 38] = "InsertColumn", E[E.DeleteRow = 39] = "DeleteRow", E[E.DeleteColumn = 40] = "DeleteColumn", E[E.EditExtraObject = 41] = "EditExtraObject", E[E.Delete = 42] = "Delete", E[E.RecoverHistory = 43] = "RecoverHistory", E[E.ViewHistory = 44] = "ViewHistory", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(P || {}), M = /* @__PURE__ */ ((E) => (E[E.Unkonwn = 0] = "Unkonwn", E[E.Workbook = 1] = "Workbook", E[E.Worksheet = 2] = "Worksheet", E[E.SelectRange = 3] = "SelectRange", E[E.Document = 4] = "Document", E[E.Slide = 5] = "Slide", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(M || {});
|
|
1115
1086
|
const _WorksheetCopyPermission = class _WorksheetCopyPermission {
|
|
1116
1087
|
constructor(unitId, subUnitId) {
|
|
1117
1088
|
__publicField(this, "value", !0);
|
|
1118
|
-
__publicField(this, "type",
|
|
1089
|
+
__publicField(this, "type", M.Worksheet);
|
|
1119
1090
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1120
1091
|
__publicField(this, "id");
|
|
1121
1092
|
__publicField(this, "subType", P.Copy);
|
|
@@ -1127,7 +1098,7 @@ let WorksheetCopyPermission = _WorksheetCopyPermission;
|
|
|
1127
1098
|
const _WorksheetSelectProtectedCellsPermission = class _WorksheetSelectProtectedCellsPermission {
|
|
1128
1099
|
constructor(unitId, subUnitId) {
|
|
1129
1100
|
__publicField(this, "value", !0);
|
|
1130
|
-
__publicField(this, "type",
|
|
1101
|
+
__publicField(this, "type", M.Worksheet);
|
|
1131
1102
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1132
1103
|
__publicField(this, "id");
|
|
1133
1104
|
__publicField(this, "subType", P.SelectProtectedCells);
|
|
@@ -1139,7 +1110,7 @@ let WorksheetSelectProtectedCellsPermission = _WorksheetSelectProtectedCellsPerm
|
|
|
1139
1110
|
const _WorksheetSelectUnProtectedCellsPermission = class _WorksheetSelectUnProtectedCellsPermission {
|
|
1140
1111
|
constructor(unitId, subUnitId) {
|
|
1141
1112
|
__publicField(this, "value", !0);
|
|
1142
|
-
__publicField(this, "type",
|
|
1113
|
+
__publicField(this, "type", M.Worksheet);
|
|
1143
1114
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1144
1115
|
__publicField(this, "id");
|
|
1145
1116
|
__publicField(this, "subType", P.SelectUnProtectedCells);
|
|
@@ -1151,7 +1122,7 @@ let WorksheetSelectUnProtectedCellsPermission = _WorksheetSelectUnProtectedCells
|
|
|
1151
1122
|
const _WorksheetSetCellStylePermission = class _WorksheetSetCellStylePermission {
|
|
1152
1123
|
constructor(unitId, subUnitId) {
|
|
1153
1124
|
__publicField(this, "value", !0);
|
|
1154
|
-
__publicField(this, "type",
|
|
1125
|
+
__publicField(this, "type", M.Worksheet);
|
|
1155
1126
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1156
1127
|
__publicField(this, "id");
|
|
1157
1128
|
__publicField(this, "subType", P.SetCellStyle);
|
|
@@ -1163,7 +1134,7 @@ let WorksheetSetCellStylePermission = _WorksheetSetCellStylePermission;
|
|
|
1163
1134
|
const _WorksheetSetCellValuePermission = class _WorksheetSetCellValuePermission {
|
|
1164
1135
|
constructor(unitId, subUnitId) {
|
|
1165
1136
|
__publicField(this, "value", !0);
|
|
1166
|
-
__publicField(this, "type",
|
|
1137
|
+
__publicField(this, "type", M.Worksheet);
|
|
1167
1138
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1168
1139
|
__publicField(this, "id");
|
|
1169
1140
|
__publicField(this, "subType", P.SetCellValue);
|
|
@@ -1175,7 +1146,7 @@ let WorksheetSetCellValuePermission = _WorksheetSetCellValuePermission;
|
|
|
1175
1146
|
const _WorksheetViewPermission = class _WorksheetViewPermission {
|
|
1176
1147
|
constructor(unitId, subUnitId) {
|
|
1177
1148
|
__publicField(this, "value", !0);
|
|
1178
|
-
__publicField(this, "type",
|
|
1149
|
+
__publicField(this, "type", M.Worksheet);
|
|
1179
1150
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1180
1151
|
__publicField(this, "id");
|
|
1181
1152
|
__publicField(this, "subType", P.View);
|
|
@@ -1187,7 +1158,7 @@ let WorksheetViewPermission = _WorksheetViewPermission;
|
|
|
1187
1158
|
const _WorksheetSetRowStylePermission = class _WorksheetSetRowStylePermission {
|
|
1188
1159
|
constructor(unitId, subUnitId) {
|
|
1189
1160
|
__publicField(this, "value", !0);
|
|
1190
|
-
__publicField(this, "type",
|
|
1161
|
+
__publicField(this, "type", M.Worksheet);
|
|
1191
1162
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1192
1163
|
__publicField(this, "id");
|
|
1193
1164
|
__publicField(this, "subType", P.SetRowStyle);
|
|
@@ -1199,7 +1170,7 @@ let WorksheetSetRowStylePermission = _WorksheetSetRowStylePermission;
|
|
|
1199
1170
|
const _WorksheetSetColumnStylePermission = class _WorksheetSetColumnStylePermission {
|
|
1200
1171
|
constructor(unitId, subUnitId) {
|
|
1201
1172
|
__publicField(this, "value", !0);
|
|
1202
|
-
__publicField(this, "type",
|
|
1173
|
+
__publicField(this, "type", M.Worksheet);
|
|
1203
1174
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1204
1175
|
__publicField(this, "id");
|
|
1205
1176
|
__publicField(this, "subType", P.SetColumnStyle);
|
|
@@ -1211,7 +1182,7 @@ let WorksheetSetColumnStylePermission = _WorksheetSetColumnStylePermission;
|
|
|
1211
1182
|
const _WorksheetInsertRowPermission = class _WorksheetInsertRowPermission {
|
|
1212
1183
|
constructor(unitId, subUnitId) {
|
|
1213
1184
|
__publicField(this, "value", !0);
|
|
1214
|
-
__publicField(this, "type",
|
|
1185
|
+
__publicField(this, "type", M.Worksheet);
|
|
1215
1186
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1216
1187
|
__publicField(this, "id");
|
|
1217
1188
|
__publicField(this, "subType", P.InsertRow);
|
|
@@ -1223,7 +1194,7 @@ let WorksheetInsertRowPermission = _WorksheetInsertRowPermission;
|
|
|
1223
1194
|
const _WorksheetInsertColumnPermission = class _WorksheetInsertColumnPermission {
|
|
1224
1195
|
constructor(unitId, subUnitId) {
|
|
1225
1196
|
__publicField(this, "value", !0);
|
|
1226
|
-
__publicField(this, "type",
|
|
1197
|
+
__publicField(this, "type", M.Worksheet);
|
|
1227
1198
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1228
1199
|
__publicField(this, "id");
|
|
1229
1200
|
__publicField(this, "subType", P.InsertColumn);
|
|
@@ -1235,7 +1206,7 @@ let WorksheetInsertColumnPermission = _WorksheetInsertColumnPermission;
|
|
|
1235
1206
|
const _WorksheetInsertHyperlinkPermission = class _WorksheetInsertHyperlinkPermission {
|
|
1236
1207
|
constructor(unitId, subUnitId) {
|
|
1237
1208
|
__publicField(this, "value", !0);
|
|
1238
|
-
__publicField(this, "type",
|
|
1209
|
+
__publicField(this, "type", M.Worksheet);
|
|
1239
1210
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1240
1211
|
__publicField(this, "id");
|
|
1241
1212
|
__publicField(this, "subType", P.InsertHyperlink);
|
|
@@ -1247,7 +1218,7 @@ let WorksheetInsertHyperlinkPermission = _WorksheetInsertHyperlinkPermission;
|
|
|
1247
1218
|
const _WorksheetDeleteRowPermission = class _WorksheetDeleteRowPermission {
|
|
1248
1219
|
constructor(unitId, subUnitId) {
|
|
1249
1220
|
__publicField(this, "value", !0);
|
|
1250
|
-
__publicField(this, "type",
|
|
1221
|
+
__publicField(this, "type", M.Worksheet);
|
|
1251
1222
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1252
1223
|
__publicField(this, "id");
|
|
1253
1224
|
__publicField(this, "subType", P.DeleteRow);
|
|
@@ -1259,7 +1230,7 @@ let WorksheetDeleteRowPermission = _WorksheetDeleteRowPermission;
|
|
|
1259
1230
|
const _WorksheetDeleteColumnPermission = class _WorksheetDeleteColumnPermission {
|
|
1260
1231
|
constructor(unitId, subUnitId) {
|
|
1261
1232
|
__publicField(this, "value", !0);
|
|
1262
|
-
__publicField(this, "type",
|
|
1233
|
+
__publicField(this, "type", M.Worksheet);
|
|
1263
1234
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1264
1235
|
__publicField(this, "id");
|
|
1265
1236
|
__publicField(this, "subType", P.DeleteColumn);
|
|
@@ -1271,7 +1242,7 @@ let WorksheetDeleteColumnPermission = _WorksheetDeleteColumnPermission;
|
|
|
1271
1242
|
const _WorksheetSortPermission = class _WorksheetSortPermission {
|
|
1272
1243
|
constructor(unitId, subUnitId) {
|
|
1273
1244
|
__publicField(this, "value", !0);
|
|
1274
|
-
__publicField(this, "type",
|
|
1245
|
+
__publicField(this, "type", M.Worksheet);
|
|
1275
1246
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1276
1247
|
__publicField(this, "id");
|
|
1277
1248
|
__publicField(this, "subType", P.Sort);
|
|
@@ -1283,7 +1254,7 @@ let WorksheetSortPermission = _WorksheetSortPermission;
|
|
|
1283
1254
|
const _WorksheetFilterPermission = class _WorksheetFilterPermission {
|
|
1284
1255
|
constructor(unitId, subUnitId) {
|
|
1285
1256
|
__publicField(this, "value", !0);
|
|
1286
|
-
__publicField(this, "type",
|
|
1257
|
+
__publicField(this, "type", M.Worksheet);
|
|
1287
1258
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1288
1259
|
__publicField(this, "id");
|
|
1289
1260
|
__publicField(this, "subType", P.Filter);
|
|
@@ -1295,7 +1266,7 @@ let WorksheetFilterPermission = _WorksheetFilterPermission;
|
|
|
1295
1266
|
const _WorksheetPivotTablePermission = class _WorksheetPivotTablePermission {
|
|
1296
1267
|
constructor(unitId, subUnitId) {
|
|
1297
1268
|
__publicField(this, "value", !0);
|
|
1298
|
-
__publicField(this, "type",
|
|
1269
|
+
__publicField(this, "type", M.Worksheet);
|
|
1299
1270
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1300
1271
|
__publicField(this, "id");
|
|
1301
1272
|
__publicField(this, "subType", P.PivotTable);
|
|
@@ -1307,7 +1278,7 @@ let WorksheetPivotTablePermission = _WorksheetPivotTablePermission;
|
|
|
1307
1278
|
const _WorksheetEditExtraObjectPermission = class _WorksheetEditExtraObjectPermission {
|
|
1308
1279
|
constructor(unitId, subUnitId) {
|
|
1309
1280
|
__publicField(this, "value", !0);
|
|
1310
|
-
__publicField(this, "type",
|
|
1281
|
+
__publicField(this, "type", M.Worksheet);
|
|
1311
1282
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1312
1283
|
__publicField(this, "id");
|
|
1313
1284
|
__publicField(this, "subType", P.EditExtraObject);
|
|
@@ -1319,7 +1290,7 @@ let WorksheetEditExtraObjectPermission = _WorksheetEditExtraObjectPermission;
|
|
|
1319
1290
|
const _WorksheetManageCollaboratorPermission = class _WorksheetManageCollaboratorPermission {
|
|
1320
1291
|
constructor(unitId, subUnitId) {
|
|
1321
1292
|
__publicField(this, "value", !0);
|
|
1322
|
-
__publicField(this, "type",
|
|
1293
|
+
__publicField(this, "type", M.Worksheet);
|
|
1323
1294
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1324
1295
|
__publicField(this, "id");
|
|
1325
1296
|
__publicField(this, "subType", P.ManageCollaborator);
|
|
@@ -1331,7 +1302,7 @@ let WorksheetManageCollaboratorPermission = _WorksheetManageCollaboratorPermissi
|
|
|
1331
1302
|
const _WorksheetEditPermission = class _WorksheetEditPermission {
|
|
1332
1303
|
constructor(unitId, subUnitId) {
|
|
1333
1304
|
__publicField(this, "value", !0);
|
|
1334
|
-
__publicField(this, "type",
|
|
1305
|
+
__publicField(this, "type", M.Worksheet);
|
|
1335
1306
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1336
1307
|
__publicField(this, "id");
|
|
1337
1308
|
__publicField(this, "subType", P.Edit);
|
|
@@ -1344,7 +1315,7 @@ const _WorkbookCommentPermission = class _WorkbookCommentPermission {
|
|
|
1344
1315
|
constructor(unitId) {
|
|
1345
1316
|
__publicField(this, "id");
|
|
1346
1317
|
__publicField(this, "value", !0);
|
|
1347
|
-
__publicField(this, "type",
|
|
1318
|
+
__publicField(this, "type", M.Workbook);
|
|
1348
1319
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1349
1320
|
__publicField(this, "subType", P.Comment);
|
|
1350
1321
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.Comment}_${unitId}`;
|
|
@@ -1356,7 +1327,7 @@ const _WorkbookEditablePermission = class _WorkbookEditablePermission {
|
|
|
1356
1327
|
constructor(unitId) {
|
|
1357
1328
|
__publicField(this, "id");
|
|
1358
1329
|
__publicField(this, "value", !0);
|
|
1359
|
-
__publicField(this, "type",
|
|
1330
|
+
__publicField(this, "type", M.Workbook);
|
|
1360
1331
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1361
1332
|
__publicField(this, "subType", P.Edit);
|
|
1362
1333
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.Edit}_${unitId}`;
|
|
@@ -1368,7 +1339,7 @@ const _WorkbookDuplicatePermission = class _WorkbookDuplicatePermission {
|
|
|
1368
1339
|
constructor(unitId) {
|
|
1369
1340
|
__publicField(this, "id");
|
|
1370
1341
|
__publicField(this, "value", !0);
|
|
1371
|
-
__publicField(this, "type",
|
|
1342
|
+
__publicField(this, "type", M.Workbook);
|
|
1372
1343
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1373
1344
|
__publicField(this, "subType", P.Duplicate);
|
|
1374
1345
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.Duplicate}_${unitId}`;
|
|
@@ -1380,7 +1351,7 @@ const _WorkbookPrintPermission = class _WorkbookPrintPermission {
|
|
|
1380
1351
|
constructor(unitId) {
|
|
1381
1352
|
__publicField(this, "id");
|
|
1382
1353
|
__publicField(this, "value", !0);
|
|
1383
|
-
__publicField(this, "type",
|
|
1354
|
+
__publicField(this, "type", M.Workbook);
|
|
1384
1355
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1385
1356
|
__publicField(this, "subType", P.Print);
|
|
1386
1357
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.Print}_${unitId}`;
|
|
@@ -1392,7 +1363,7 @@ const _WorkbookExportPermission = class _WorkbookExportPermission {
|
|
|
1392
1363
|
constructor(unitId) {
|
|
1393
1364
|
__publicField(this, "id");
|
|
1394
1365
|
__publicField(this, "value", !0);
|
|
1395
|
-
__publicField(this, "type",
|
|
1366
|
+
__publicField(this, "type", M.Workbook);
|
|
1396
1367
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1397
1368
|
__publicField(this, "subType", P.Export);
|
|
1398
1369
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.Export}_${unitId}`;
|
|
@@ -1404,7 +1375,7 @@ const _WorkbookMoveSheetPermission = class _WorkbookMoveSheetPermission {
|
|
|
1404
1375
|
constructor(unitId) {
|
|
1405
1376
|
__publicField(this, "id");
|
|
1406
1377
|
__publicField(this, "value", !0);
|
|
1407
|
-
__publicField(this, "type",
|
|
1378
|
+
__publicField(this, "type", M.Workbook);
|
|
1408
1379
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1409
1380
|
__publicField(this, "subType", P.MoveSheet);
|
|
1410
1381
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.MoveSheet}_${unitId}`;
|
|
@@ -1416,7 +1387,7 @@ const _WorkbookDeleteSheetPermission = class _WorkbookDeleteSheetPermission {
|
|
|
1416
1387
|
constructor(unitId) {
|
|
1417
1388
|
__publicField(this, "id");
|
|
1418
1389
|
__publicField(this, "value", !0);
|
|
1419
|
-
__publicField(this, "type",
|
|
1390
|
+
__publicField(this, "type", M.Workbook);
|
|
1420
1391
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1421
1392
|
__publicField(this, "subType", P.DeleteSheet);
|
|
1422
1393
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.DeleteSheet}_${unitId}`;
|
|
@@ -1428,7 +1399,7 @@ const _WorkbookHideSheetPermission = class _WorkbookHideSheetPermission {
|
|
|
1428
1399
|
constructor(unitId) {
|
|
1429
1400
|
__publicField(this, "id");
|
|
1430
1401
|
__publicField(this, "value", !0);
|
|
1431
|
-
__publicField(this, "type",
|
|
1402
|
+
__publicField(this, "type", M.Workbook);
|
|
1432
1403
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1433
1404
|
__publicField(this, "subType", P.HideSheet);
|
|
1434
1405
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.HideSheet}_${unitId}`;
|
|
@@ -1440,7 +1411,7 @@ const _WorkbookRenameSheetPermission = class _WorkbookRenameSheetPermission {
|
|
|
1440
1411
|
constructor(unitId) {
|
|
1441
1412
|
__publicField(this, "id");
|
|
1442
1413
|
__publicField(this, "value", !0);
|
|
1443
|
-
__publicField(this, "type",
|
|
1414
|
+
__publicField(this, "type", M.Workbook);
|
|
1444
1415
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1445
1416
|
__publicField(this, "subType", P.RenameSheet);
|
|
1446
1417
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.RenameSheet}_${unitId}`;
|
|
@@ -1452,7 +1423,7 @@ const _WorkbookCreateSheetPermission = class _WorkbookCreateSheetPermission {
|
|
|
1452
1423
|
constructor(unitId) {
|
|
1453
1424
|
__publicField(this, "id");
|
|
1454
1425
|
__publicField(this, "value", !0);
|
|
1455
|
-
__publicField(this, "type",
|
|
1426
|
+
__publicField(this, "type", M.Workbook);
|
|
1456
1427
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1457
1428
|
__publicField(this, "subType", P.CreateSheet);
|
|
1458
1429
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.CreateSheet}_${unitId}`;
|
|
@@ -1464,7 +1435,7 @@ const _WorkbookHistoryPermission = class _WorkbookHistoryPermission {
|
|
|
1464
1435
|
constructor(unitId) {
|
|
1465
1436
|
__publicField(this, "id");
|
|
1466
1437
|
__publicField(this, "value", !0);
|
|
1467
|
-
__publicField(this, "type",
|
|
1438
|
+
__publicField(this, "type", M.Workbook);
|
|
1468
1439
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1469
1440
|
__publicField(this, "subType", P.History);
|
|
1470
1441
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.History}_${unitId}`;
|
|
@@ -1476,7 +1447,7 @@ const _WorkbookViewPermission = class _WorkbookViewPermission {
|
|
|
1476
1447
|
constructor(unitId) {
|
|
1477
1448
|
__publicField(this, "id");
|
|
1478
1449
|
__publicField(this, "value", !0);
|
|
1479
|
-
__publicField(this, "type",
|
|
1450
|
+
__publicField(this, "type", M.Workbook);
|
|
1480
1451
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1481
1452
|
__publicField(this, "subType", P.View);
|
|
1482
1453
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.View}_${unitId}`;
|
|
@@ -1488,7 +1459,7 @@ const _WorkbookSharePermission = class _WorkbookSharePermission {
|
|
|
1488
1459
|
constructor(unitId) {
|
|
1489
1460
|
__publicField(this, "id");
|
|
1490
1461
|
__publicField(this, "value", !0);
|
|
1491
|
-
__publicField(this, "type",
|
|
1462
|
+
__publicField(this, "type", M.Workbook);
|
|
1492
1463
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1493
1464
|
__publicField(this, "subType", P.Share);
|
|
1494
1465
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.Share}_${unitId}`;
|
|
@@ -1500,7 +1471,7 @@ const _WorkbookCopyPermission = class _WorkbookCopyPermission {
|
|
|
1500
1471
|
constructor(unitId) {
|
|
1501
1472
|
__publicField(this, "id");
|
|
1502
1473
|
__publicField(this, "value", !0);
|
|
1503
|
-
__publicField(this, "type",
|
|
1474
|
+
__publicField(this, "type", M.Workbook);
|
|
1504
1475
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1505
1476
|
__publicField(this, "subType", P.Copy);
|
|
1506
1477
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.Copy}_${unitId}`;
|
|
@@ -1512,7 +1483,7 @@ const _WorkbookCopySheetPermission = class _WorkbookCopySheetPermission {
|
|
|
1512
1483
|
constructor(unitId) {
|
|
1513
1484
|
__publicField(this, "id");
|
|
1514
1485
|
__publicField(this, "value", !0);
|
|
1515
|
-
__publicField(this, "type",
|
|
1486
|
+
__publicField(this, "type", M.Workbook);
|
|
1516
1487
|
__publicField(this, "subType", P.CopySheet);
|
|
1517
1488
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1518
1489
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.CopySheet}_${unitId}`;
|
|
@@ -1524,7 +1495,7 @@ const _WorkbookManageCollaboratorPermission = class _WorkbookManageCollaboratorP
|
|
|
1524
1495
|
constructor(unitId) {
|
|
1525
1496
|
__publicField(this, "id");
|
|
1526
1497
|
__publicField(this, "value", !0);
|
|
1527
|
-
__publicField(this, "type",
|
|
1498
|
+
__publicField(this, "type", M.Workbook);
|
|
1528
1499
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1529
1500
|
__publicField(this, "subType", P.ManageCollaborator);
|
|
1530
1501
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.ManageCollaborator}_${unitId}`;
|
|
@@ -1536,7 +1507,7 @@ const _WorkbookViewHistoryPermission = class _WorkbookViewHistoryPermission {
|
|
|
1536
1507
|
constructor(unitId) {
|
|
1537
1508
|
__publicField(this, "id");
|
|
1538
1509
|
__publicField(this, "value", !0);
|
|
1539
|
-
__publicField(this, "type",
|
|
1510
|
+
__publicField(this, "type", M.Workbook);
|
|
1540
1511
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1541
1512
|
__publicField(this, "subType", P.ViewHistory);
|
|
1542
1513
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.ViewHistory}_${unitId}`;
|
|
@@ -1548,7 +1519,7 @@ const _WorkbookRecoverHistoryPermission = class _WorkbookRecoverHistoryPermissio
|
|
|
1548
1519
|
constructor(unitId) {
|
|
1549
1520
|
__publicField(this, "id");
|
|
1550
1521
|
__publicField(this, "value", !0);
|
|
1551
|
-
__publicField(this, "type",
|
|
1522
|
+
__publicField(this, "type", M.Workbook);
|
|
1552
1523
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1553
1524
|
__publicField(this, "subType", P.RecoverHistory);
|
|
1554
1525
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.RecoverHistory}_${unitId}`;
|
|
@@ -1558,7 +1529,7 @@ __name(_WorkbookRecoverHistoryPermission, "WorkbookRecoverHistoryPermission");
|
|
|
1558
1529
|
let WorkbookRecoverHistoryPermission = _WorkbookRecoverHistoryPermission;
|
|
1559
1530
|
const _RangeProtectionPermissionEditPoint = class _RangeProtectionPermissionEditPoint {
|
|
1560
1531
|
constructor(unitId, subUnitId, permissionId) {
|
|
1561
|
-
__publicField(this, "type",
|
|
1532
|
+
__publicField(this, "type", M.SelectRange);
|
|
1562
1533
|
__publicField(this, "subType", P.Edit);
|
|
1563
1534
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1564
1535
|
__publicField(this, "value", !0);
|
|
@@ -1566,14 +1537,14 @@ const _RangeProtectionPermissionEditPoint = class _RangeProtectionPermissionEdit
|
|
|
1566
1537
|
__publicField(this, "unitId");
|
|
1567
1538
|
__publicField(this, "subUnitId");
|
|
1568
1539
|
__publicField(this, "permissionId");
|
|
1569
|
-
this.unitId = unitId, this.subUnitId = subUnitId, this.permissionId = permissionId, this.id = `${
|
|
1540
|
+
this.unitId = unitId, this.subUnitId = subUnitId, this.permissionId = permissionId, this.id = `${M.SelectRange}.${P.Edit}.${permissionId}`;
|
|
1570
1541
|
}
|
|
1571
1542
|
};
|
|
1572
1543
|
__name(_RangeProtectionPermissionEditPoint, "RangeProtectionPermissionEditPoint");
|
|
1573
1544
|
let RangeProtectionPermissionEditPoint = _RangeProtectionPermissionEditPoint;
|
|
1574
1545
|
const _RangeProtectionPermissionViewPoint = class _RangeProtectionPermissionViewPoint {
|
|
1575
1546
|
constructor(unitId, subUnitId, permissionId) {
|
|
1576
|
-
__publicField(this, "type",
|
|
1547
|
+
__publicField(this, "type", M.SelectRange);
|
|
1577
1548
|
__publicField(this, "subType", P.View);
|
|
1578
1549
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1579
1550
|
__publicField(this, "value", !0);
|
|
@@ -1581,7 +1552,7 @@ const _RangeProtectionPermissionViewPoint = class _RangeProtectionPermissionView
|
|
|
1581
1552
|
__publicField(this, "unitId");
|
|
1582
1553
|
__publicField(this, "subUnitId");
|
|
1583
1554
|
__publicField(this, "permissionId");
|
|
1584
|
-
this.unitId = unitId, this.subUnitId = subUnitId, this.permissionId = permissionId, this.id = `${
|
|
1555
|
+
this.unitId = unitId, this.subUnitId = subUnitId, this.permissionId = permissionId, this.id = `${M.SelectRange}.${P.View}.${permissionId}`;
|
|
1585
1556
|
}
|
|
1586
1557
|
};
|
|
1587
1558
|
__name(_RangeProtectionPermissionViewPoint, "RangeProtectionPermissionViewPoint");
|
|
@@ -2188,20 +2159,15 @@ const DeleteRangeMoveLeftCommandId = "sheet.command.delete-range-move-left", Del
|
|
|
2188
2159
|
const worksheet = workbook.getActiveSheet();
|
|
2189
2160
|
if (!worksheet)
|
|
2190
2161
|
return !1;
|
|
2191
|
-
const unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId(),
|
|
2192
|
-
Range.foreach(range, (row, col) => {
|
|
2193
|
-
const cell = worksheet.getCell(row, col);
|
|
2194
|
-
!cell || !cell.s || (cellValue[row] || (cellValue[row] = {}), cellValue[row][col] = { s: cell.s });
|
|
2195
|
-
});
|
|
2196
|
-
const insertRowParams = {
|
|
2162
|
+
const unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId(), { startRow, endRow } = range, startColumn = 0, endColumn = worksheet.getColumnCount() - 1, cellValue = copyRangeStyles(worksheet, startRow, endRow, startColumn, endColumn, !0, startRow - 1), insertRowParams = {
|
|
2197
2163
|
unitId,
|
|
2198
2164
|
subUnitId,
|
|
2199
2165
|
direction: Direction.UP,
|
|
2200
2166
|
range: {
|
|
2201
|
-
startRow
|
|
2202
|
-
endRow
|
|
2203
|
-
startColumn
|
|
2204
|
-
endColumn
|
|
2167
|
+
startRow,
|
|
2168
|
+
endRow,
|
|
2169
|
+
startColumn,
|
|
2170
|
+
endColumn
|
|
2205
2171
|
},
|
|
2206
2172
|
cellValue
|
|
2207
2173
|
};
|
|
@@ -2224,17 +2190,18 @@ const DeleteRangeMoveLeftCommandId = "sheet.command.delete-range-move-left", Del
|
|
|
2224
2190
|
const worksheet = workbook.getActiveSheet();
|
|
2225
2191
|
if (!worksheet)
|
|
2226
2192
|
return !1;
|
|
2227
|
-
const unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId(), count = range.endRow - range.startRow + 1, insertRowParams = {
|
|
2193
|
+
const unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId(), count = range.endRow - range.startRow + 1, startRow = range.endRow + 1, endRow = range.endRow + count, startColumn = 0, endColumn = worksheet.getColumnCount() - 1, cellValue = copyRangeStyles(worksheet, startRow, endRow, startColumn, endColumn, !0, range.endRow), insertRowParams = {
|
|
2228
2194
|
unitId,
|
|
2229
2195
|
subUnitId,
|
|
2230
2196
|
direction: Direction.DOWN,
|
|
2231
2197
|
range: {
|
|
2232
|
-
startRow
|
|
2233
|
-
endRow
|
|
2234
|
-
startColumn
|
|
2235
|
-
endColumn
|
|
2198
|
+
startRow,
|
|
2199
|
+
endRow,
|
|
2200
|
+
startColumn,
|
|
2201
|
+
endColumn,
|
|
2236
2202
|
rangeType: RANGE_TYPE.ROW
|
|
2237
|
-
}
|
|
2203
|
+
},
|
|
2204
|
+
cellValue
|
|
2238
2205
|
};
|
|
2239
2206
|
return accessor.get(ICommandService).executeCommand(InsertRowCommand.id, insertRowParams);
|
|
2240
2207
|
}, "handler")
|
|
@@ -2295,20 +2262,15 @@ const DeleteRangeMoveLeftCommandId = "sheet.command.delete-range-move-left", Del
|
|
|
2295
2262
|
const worksheet = workbook.getActiveSheet();
|
|
2296
2263
|
if (!worksheet)
|
|
2297
2264
|
return !1;
|
|
2298
|
-
const unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId(),
|
|
2299
|
-
Range.foreach(range, (row, col) => {
|
|
2300
|
-
const cell = worksheet.getCell(row, col);
|
|
2301
|
-
!cell || !cell.s || (cellValue[row] || (cellValue[row] = {}), cellValue[row][col] = { s: cell.s });
|
|
2302
|
-
});
|
|
2303
|
-
const insertColParams = {
|
|
2265
|
+
const unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId(), { startColumn, endColumn } = range, startRow = 0, endRow = worksheet.getRowCount() - 1, cellValue = copyRangeStyles(worksheet, startRow, endRow, startColumn, endColumn, !1, startColumn - 1), insertColParams = {
|
|
2304
2266
|
unitId,
|
|
2305
2267
|
subUnitId,
|
|
2306
2268
|
direction: Direction.LEFT,
|
|
2307
2269
|
range: {
|
|
2308
|
-
startColumn
|
|
2309
|
-
endColumn
|
|
2310
|
-
startRow
|
|
2311
|
-
endRow
|
|
2270
|
+
startColumn,
|
|
2271
|
+
endColumn,
|
|
2272
|
+
startRow,
|
|
2273
|
+
endRow,
|
|
2312
2274
|
rangeType: RANGE_TYPE.COLUMN
|
|
2313
2275
|
},
|
|
2314
2276
|
cellValue
|
|
@@ -2331,16 +2293,17 @@ const DeleteRangeMoveLeftCommandId = "sheet.command.delete-range-move-left", Del
|
|
|
2331
2293
|
const worksheet = workbook.getActiveSheet();
|
|
2332
2294
|
if (!worksheet)
|
|
2333
2295
|
return !1;
|
|
2334
|
-
const unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId(), count = range.endColumn - range.startColumn + 1, insertColParams = {
|
|
2296
|
+
const unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId(), count = range.endColumn - range.startColumn + 1, startColumn = range.endColumn + 1, endColumn = range.endColumn + count, startRow = 0, endRow = worksheet.getRowCount() - 1, cellValue = copyRangeStyles(worksheet, startRow, endRow, startColumn, endColumn, !1, range.endColumn), insertColParams = {
|
|
2335
2297
|
unitId,
|
|
2336
2298
|
subUnitId,
|
|
2337
2299
|
direction: Direction.RIGHT,
|
|
2338
2300
|
range: {
|
|
2339
|
-
startColumn
|
|
2340
|
-
endColumn
|
|
2341
|
-
startRow
|
|
2342
|
-
endRow
|
|
2343
|
-
}
|
|
2301
|
+
startColumn,
|
|
2302
|
+
endColumn,
|
|
2303
|
+
startRow,
|
|
2304
|
+
endRow
|
|
2305
|
+
},
|
|
2306
|
+
cellValue
|
|
2344
2307
|
};
|
|
2345
2308
|
return accessor.get(ICommandService).executeCommand(InsertColCommand.id, insertColParams);
|
|
2346
2309
|
}, "handler")
|
|
@@ -2455,23 +2418,21 @@ __name(columnAcrossMergedCell, "columnAcrossMergedCell");
|
|
|
2455
2418
|
const MoveRowsCommandId = "sheet.command.move-rows", MoveRowsCommand = {
|
|
2456
2419
|
id: MoveRowsCommandId,
|
|
2457
2420
|
type: CommandType.COMMAND,
|
|
2421
|
+
// eslint-disable-next-line max-lines-per-function
|
|
2458
2422
|
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
2459
2423
|
var _a20, _b;
|
|
2460
|
-
const
|
|
2424
|
+
const selectionManagerService = accessor.get(SheetsSelectionsService), {
|
|
2461
2425
|
fromRange: { startRow: fromRow },
|
|
2462
|
-
toRange: { startRow: toRow }
|
|
2463
|
-
|
|
2426
|
+
toRange: { startRow: toRow },
|
|
2427
|
+
range
|
|
2428
|
+
} = params, selections = range ? [covertRangeToSelection(range)] : selectionManagerService.getCurrentSelections(), filteredSelections = selections == null ? void 0 : selections.filter(
|
|
2464
2429
|
(selection) => selection.range.rangeType === RANGE_TYPE.ROW && selection.range.startRow <= fromRow && fromRow <= selection.range.endRow
|
|
2465
2430
|
);
|
|
2466
2431
|
if ((filteredSelections == null ? void 0 : filteredSelections.length) !== 1)
|
|
2467
2432
|
return !1;
|
|
2468
|
-
const sheetInterceptorService = accessor.get(SheetInterceptorService),
|
|
2469
|
-
if (!
|
|
2470
|
-
|
|
2471
|
-
const worksheet = workbook.getActiveSheet();
|
|
2472
|
-
if (!worksheet)
|
|
2473
|
-
return !1;
|
|
2474
|
-
const unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId(), errorService = accessor.get(ErrorService), localeService = accessor.get(LocaleService), rangeToMove = filteredSelections[0].range, beforePrimary = filteredSelections[0].primary, alignedRange = alignToMergedCellsBorders(rangeToMove, worksheet, !1);
|
|
2433
|
+
const sheetInterceptorService = accessor.get(SheetInterceptorService), univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService, params);
|
|
2434
|
+
if (!target) return !1;
|
|
2435
|
+
const { workbook, worksheet } = target, unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId(), errorService = accessor.get(ErrorService), localeService = accessor.get(LocaleService), rangeToMove = filteredSelections[0].range, beforePrimary = filteredSelections[0].primary, alignedRange = alignToMergedCellsBorders(rangeToMove, worksheet, !1);
|
|
2475
2436
|
if (!Rectangle.equals(rangeToMove, alignedRange))
|
|
2476
2437
|
return errorService.emit(localeService.t("sheets.info.partOfCell")), !1;
|
|
2477
2438
|
if (rowAcrossMergedCell(toRow, worksheet))
|
|
@@ -2485,30 +2446,30 @@ const MoveRowsCommandId = "sheet.command.move-rows", MoveRowsCommand = {
|
|
|
2485
2446
|
subUnitId,
|
|
2486
2447
|
sourceRange: rangeToMove,
|
|
2487
2448
|
targetRange: destinationRange
|
|
2488
|
-
}, undoMoveRowsParams = MoveRowsMutationUndoFactory(accessor, moveRowsParams),
|
|
2489
|
-
...destinationRange,
|
|
2490
|
-
startRow: destinationRange.startRow - count,
|
|
2491
|
-
endRow: destinationRange.endRow - count
|
|
2492
|
-
}, setSelectionsParam = {
|
|
2493
|
-
unitId,
|
|
2494
|
-
subUnitId,
|
|
2495
|
-
selections: [{ range: destSelection, primary: getPrimaryForRange(destSelection, worksheet), style: null }]
|
|
2496
|
-
}, undoSetSelectionsParam = {
|
|
2497
|
-
unitId,
|
|
2498
|
-
subUnitId,
|
|
2499
|
-
selections: [{ range: rangeToMove, primary: beforePrimary, style: null }]
|
|
2500
|
-
}, commandService = accessor.get(ICommandService), interceptorCommands = sheetInterceptorService.onCommandExecute({ id: MoveRowsCommand.id, params }), redos = [
|
|
2449
|
+
}, undoMoveRowsParams = MoveRowsMutationUndoFactory(accessor, moveRowsParams), commandService = accessor.get(ICommandService), interceptorCommands = sheetInterceptorService.onCommandExecute({ id: MoveRowsCommand.id, params }), redos = [
|
|
2501
2450
|
...(_a20 = interceptorCommands.preRedos) != null ? _a20 : [],
|
|
2502
|
-
{ id: MoveRowsMutation.id, params: moveRowsParams }
|
|
2503
|
-
{ id: SetSelectionsOperation.id, params: setSelectionsParam },
|
|
2504
|
-
...interceptorCommands.redos
|
|
2451
|
+
{ id: MoveRowsMutation.id, params: moveRowsParams }
|
|
2505
2452
|
], undos = [
|
|
2506
2453
|
...(_b = interceptorCommands.preUndos) != null ? _b : [],
|
|
2507
|
-
{ id: MoveRowsMutation.id, params: undoMoveRowsParams }
|
|
2508
|
-
{ id: SetSelectionsOperation.id, params: undoSetSelectionsParam },
|
|
2509
|
-
...interceptorCommands.undos
|
|
2454
|
+
{ id: MoveRowsMutation.id, params: undoMoveRowsParams }
|
|
2510
2455
|
];
|
|
2511
|
-
|
|
2456
|
+
if (beforePrimary) {
|
|
2457
|
+
const moveBackward = toRow - fromRow < 0, count = rangeToMove.endRow - rangeToMove.startRow + 1, destSelection = moveBackward ? destinationRange : {
|
|
2458
|
+
...destinationRange,
|
|
2459
|
+
startRow: destinationRange.startRow - count,
|
|
2460
|
+
endRow: destinationRange.endRow - count
|
|
2461
|
+
}, setSelectionsParam = {
|
|
2462
|
+
unitId,
|
|
2463
|
+
subUnitId,
|
|
2464
|
+
selections: [{ range: destSelection, primary: getPrimaryForRange(destSelection, worksheet), style: null }]
|
|
2465
|
+
}, undoSetSelectionsParam = {
|
|
2466
|
+
unitId,
|
|
2467
|
+
subUnitId,
|
|
2468
|
+
selections: [{ range: rangeToMove, primary: beforePrimary, style: null }]
|
|
2469
|
+
};
|
|
2470
|
+
redos.push({ id: SetSelectionsOperation.id, params: setSelectionsParam }), undos.push({ id: SetSelectionsOperation.id, params: undoSetSelectionsParam });
|
|
2471
|
+
}
|
|
2472
|
+
return redos.push(...interceptorCommands.redos), undos.push(...interceptorCommands.undos), sequenceExecute(redos, commandService).result ? (accessor.get(IUndoRedoService).pushUndoRedo({
|
|
2512
2473
|
unitID: unitId,
|
|
2513
2474
|
undoMutations: undos,
|
|
2514
2475
|
redoMutations: redos
|
|
@@ -2517,23 +2478,21 @@ const MoveRowsCommandId = "sheet.command.move-rows", MoveRowsCommand = {
|
|
|
2517
2478
|
}, MoveColsCommandId = "sheet.command.move-cols", MoveColsCommand = {
|
|
2518
2479
|
id: MoveColsCommandId,
|
|
2519
2480
|
type: CommandType.COMMAND,
|
|
2481
|
+
// eslint-disable-next-line max-lines-per-function
|
|
2520
2482
|
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
2521
2483
|
var _a20, _b;
|
|
2522
|
-
const
|
|
2484
|
+
const selectionManagerService = accessor.get(SheetsSelectionsService), {
|
|
2523
2485
|
fromRange: { startColumn: fromCol },
|
|
2524
|
-
toRange: { startColumn: toCol }
|
|
2525
|
-
|
|
2486
|
+
toRange: { startColumn: toCol },
|
|
2487
|
+
range
|
|
2488
|
+
} = params, selections = range ? [covertRangeToSelection(range)] : selectionManagerService.getCurrentSelections(), filteredSelections = selections == null ? void 0 : selections.filter(
|
|
2526
2489
|
(selection) => selection.range.rangeType === RANGE_TYPE.COLUMN && selection.range.startColumn <= fromCol && fromCol <= selection.range.endColumn
|
|
2527
2490
|
);
|
|
2528
2491
|
if ((filteredSelections == null ? void 0 : filteredSelections.length) !== 1)
|
|
2529
2492
|
return !1;
|
|
2530
|
-
const sheetInterceptorService = accessor.get(SheetInterceptorService),
|
|
2531
|
-
if (!
|
|
2532
|
-
|
|
2533
|
-
const worksheet = workbook.getActiveSheet();
|
|
2534
|
-
if (!worksheet)
|
|
2535
|
-
return !1;
|
|
2536
|
-
const unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId(), errorService = accessor.get(ErrorService), localeService = accessor.get(LocaleService), rangeToMove = filteredSelections[0].range, beforePrimary = filteredSelections[0].primary, alignedRange = alignToMergedCellsBorders(rangeToMove, worksheet, !1);
|
|
2493
|
+
const sheetInterceptorService = accessor.get(SheetInterceptorService), univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService, params);
|
|
2494
|
+
if (!target) return !1;
|
|
2495
|
+
const { workbook, worksheet } = target, unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId(), errorService = accessor.get(ErrorService), localeService = accessor.get(LocaleService), rangeToMove = filteredSelections[0].range, beforePrimary = filteredSelections[0].primary, alignedRange = alignToMergedCellsBorders(rangeToMove, worksheet, !1);
|
|
2537
2496
|
if (!Rectangle.equals(rangeToMove, alignedRange))
|
|
2538
2497
|
return errorService.emit(localeService.t("sheets.info.partOfCell")), !1;
|
|
2539
2498
|
if (columnAcrossMergedCell(toCol, worksheet))
|
|
@@ -2547,36 +2506,45 @@ const MoveRowsCommandId = "sheet.command.move-rows", MoveRowsCommand = {
|
|
|
2547
2506
|
subUnitId,
|
|
2548
2507
|
sourceRange: rangeToMove,
|
|
2549
2508
|
targetRange: destinationRange
|
|
2550
|
-
}, undoMoveColsParams = MoveColsMutationUndoFactory(accessor, moveColsParams),
|
|
2551
|
-
...destinationRange,
|
|
2552
|
-
startColumn: destinationRange.startColumn - count,
|
|
2553
|
-
endColumn: destinationRange.endColumn - count
|
|
2554
|
-
}, setSelectionsParam = {
|
|
2555
|
-
unitId,
|
|
2556
|
-
subUnitId,
|
|
2557
|
-
selections: [{ range: destSelection, primary: getPrimaryForRange(destSelection, worksheet), style: null }]
|
|
2558
|
-
}, undoSetSelectionsParam = {
|
|
2559
|
-
unitId,
|
|
2560
|
-
subUnitId,
|
|
2561
|
-
selections: [{ range: rangeToMove, primary: beforePrimary, style: null }]
|
|
2562
|
-
}, commandService = accessor.get(ICommandService), interceptorCommands = sheetInterceptorService.onCommandExecute({ id: MoveColsCommand.id, params }), redos = [
|
|
2509
|
+
}, undoMoveColsParams = MoveColsMutationUndoFactory(accessor, moveColsParams), commandService = accessor.get(ICommandService), interceptorCommands = sheetInterceptorService.onCommandExecute({ id: MoveColsCommand.id, params }), redos = [
|
|
2563
2510
|
...(_a20 = interceptorCommands.preRedos) != null ? _a20 : [],
|
|
2564
|
-
{ id: MoveColsMutation.id, params: moveColsParams }
|
|
2565
|
-
{ id: SetSelectionsOperation.id, params: setSelectionsParam },
|
|
2566
|
-
...interceptorCommands.redos
|
|
2511
|
+
{ id: MoveColsMutation.id, params: moveColsParams }
|
|
2567
2512
|
], undos = [
|
|
2568
2513
|
...(_b = interceptorCommands.preUndos) != null ? _b : [],
|
|
2569
|
-
{ id: MoveColsMutation.id, params: undoMoveColsParams }
|
|
2570
|
-
{ id: SetSelectionsOperation.id, params: undoSetSelectionsParam },
|
|
2571
|
-
...interceptorCommands.undos
|
|
2514
|
+
{ id: MoveColsMutation.id, params: undoMoveColsParams }
|
|
2572
2515
|
];
|
|
2573
|
-
|
|
2516
|
+
if (beforePrimary) {
|
|
2517
|
+
const count = rangeToMove.endColumn - rangeToMove.startColumn + 1, destSelection = toCol - fromCol < 0 ? destinationRange : {
|
|
2518
|
+
...destinationRange,
|
|
2519
|
+
startColumn: destinationRange.startColumn - count,
|
|
2520
|
+
endColumn: destinationRange.endColumn - count
|
|
2521
|
+
}, setSelectionsParam = {
|
|
2522
|
+
unitId,
|
|
2523
|
+
subUnitId,
|
|
2524
|
+
selections: [{ range: destSelection, primary: getPrimaryForRange(destSelection, worksheet), style: null }]
|
|
2525
|
+
}, undoSetSelectionsParam = {
|
|
2526
|
+
unitId,
|
|
2527
|
+
subUnitId,
|
|
2528
|
+
selections: [{ range: rangeToMove, primary: beforePrimary, style: null }]
|
|
2529
|
+
};
|
|
2530
|
+
redos.push({ id: SetSelectionsOperation.id, params: setSelectionsParam }), undos.push({ id: SetSelectionsOperation.id, params: undoSetSelectionsParam });
|
|
2531
|
+
}
|
|
2532
|
+
return redos.push(...interceptorCommands.redos), undos.push(...interceptorCommands.undos), sequenceExecute(redos, commandService).result && accessor.get(IUndoRedoService).pushUndoRedo({
|
|
2574
2533
|
unitID: unitId,
|
|
2575
2534
|
undoMutations: undos,
|
|
2576
2535
|
redoMutations: redos
|
|
2577
2536
|
}), !0;
|
|
2578
2537
|
}, "handler")
|
|
2579
|
-
}
|
|
2538
|
+
};
|
|
2539
|
+
function covertRangeToSelection(range) {
|
|
2540
|
+
return {
|
|
2541
|
+
range,
|
|
2542
|
+
primary: null,
|
|
2543
|
+
style: null
|
|
2544
|
+
};
|
|
2545
|
+
}
|
|
2546
|
+
__name(covertRangeToSelection, "covertRangeToSelection");
|
|
2547
|
+
const RemoveRowCommandId = "sheet.command.remove-row", RemoveRowCommand = {
|
|
2580
2548
|
type: CommandType.COMMAND,
|
|
2581
2549
|
id: RemoveRowCommandId,
|
|
2582
2550
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -2610,7 +2578,7 @@ const MoveRowsCommandId = "sheet.command.move-rows", MoveRowsCommand = {
|
|
|
2610
2578
|
ranges.push(totalRange);
|
|
2611
2579
|
if (!await sheetInterceptorService.beforeCommandExecute({
|
|
2612
2580
|
id: RemoveRowCommand.id,
|
|
2613
|
-
params: { range: totalRange }
|
|
2581
|
+
params: { range: totalRange, ranges }
|
|
2614
2582
|
}))
|
|
2615
2583
|
return !1;
|
|
2616
2584
|
const redos = [], undos = [];
|
|
@@ -2631,7 +2599,7 @@ const MoveRowsCommandId = "sheet.command.move-rows", MoveRowsCommand = {
|
|
|
2631
2599
|
});
|
|
2632
2600
|
const intercepted = sheetInterceptorService.onCommandExecute({
|
|
2633
2601
|
id: RemoveRowCommand.id,
|
|
2634
|
-
params: { range: totalRange }
|
|
2602
|
+
params: { range: totalRange, ranges }
|
|
2635
2603
|
}), commandService = accessor.get(ICommandService);
|
|
2636
2604
|
return sequenceExecute(
|
|
2637
2605
|
[
|
|
@@ -3308,12 +3276,12 @@ const SetBorderBasicCommand = {
|
|
|
3308
3276
|
}, SetColHiddenCommand = {
|
|
3309
3277
|
type: CommandType.COMMAND,
|
|
3310
3278
|
id: "sheet.command.set-col-hidden",
|
|
3311
|
-
handler: /* @__PURE__ */ __name(async (accessor) => {
|
|
3312
|
-
var _a20, _b, _c;
|
|
3279
|
+
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
3280
|
+
var _a20, _b, _c, _d;
|
|
3313
3281
|
const selectionManagerService = accessor.get(SheetsSelectionsService), sheetInterceptorService = accessor.get(SheetInterceptorService), univerInstanceService = accessor.get(IUniverInstanceService), commandService = accessor.get(ICommandService);
|
|
3314
|
-
let ranges = (_a20 = selectionManagerService.getCurrentSelections()) == null ? void 0 :
|
|
3282
|
+
let ranges = (_a20 = params == null ? void 0 : params.ranges) != null && _a20.length ? params.ranges : (_b = selectionManagerService.getCurrentSelections()) == null ? void 0 : _b.map((s) => s.range).filter((r) => r.rangeType === RANGE_TYPE.COLUMN);
|
|
3315
3283
|
if (!(ranges != null && ranges.length)) return !1;
|
|
3316
|
-
const target = getSheetCommandTarget(univerInstanceService);
|
|
3284
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
3317
3285
|
if (!target) return !1;
|
|
3318
3286
|
const { worksheet, unitId, subUnitId } = target;
|
|
3319
3287
|
ranges = divideRangesByHiddenCols(target.worksheet, ranges);
|
|
@@ -3345,10 +3313,10 @@ const SetBorderBasicCommand = {
|
|
|
3345
3313
|
undoMutations: [
|
|
3346
3314
|
{ id: SetColVisibleMutation.id, params: undoMutationParams },
|
|
3347
3315
|
{ id: SetSelectionsOperation.id, params: undoSetSelectionsOperationParams },
|
|
3348
|
-
...(
|
|
3316
|
+
...(_c = intercepted.undos) != null ? _c : []
|
|
3349
3317
|
],
|
|
3350
3318
|
redoMutations: [
|
|
3351
|
-
...(
|
|
3319
|
+
...(_d = intercepted.preRedos) != null ? _d : [],
|
|
3352
3320
|
{ id: SetColHiddenMutation.id, params: redoMutationParams },
|
|
3353
3321
|
{ id: SetSelectionsOperation.id, params: setSelectionOperationParams },
|
|
3354
3322
|
...intercepted.redos
|
|
@@ -3576,12 +3544,12 @@ const SetFrozenMutationFactory = /* @__PURE__ */ __name((accessor, params) => {
|
|
|
3576
3544
|
}, SetRowHiddenCommand = {
|
|
3577
3545
|
type: CommandType.COMMAND,
|
|
3578
3546
|
id: "sheet.command.set-rows-hidden",
|
|
3579
|
-
handler: /* @__PURE__ */ __name(async (accessor) => {
|
|
3580
|
-
var _a20, _b, _c, _d, _e;
|
|
3547
|
+
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
3548
|
+
var _a20, _b, _c, _d, _e, _f;
|
|
3581
3549
|
const selectionManagerService = accessor.get(SheetsSelectionsService), commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), univerInstanceService = accessor.get(IUniverInstanceService), sheetInterceptorService = accessor.get(SheetInterceptorService);
|
|
3582
|
-
let ranges = (_a20 = selectionManagerService.getCurrentSelections()) == null ? void 0 :
|
|
3550
|
+
let ranges = (_a20 = params == null ? void 0 : params.ranges) != null && _a20.length ? params.ranges : (_b = selectionManagerService.getCurrentSelections()) == null ? void 0 : _b.map((s) => s.range).filter((r) => r.rangeType === RANGE_TYPE.ROW);
|
|
3583
3551
|
if (!(ranges != null && ranges.length)) return !1;
|
|
3584
|
-
const target = getSheetCommandTarget(univerInstanceService);
|
|
3552
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
3585
3553
|
if (!target) return !1;
|
|
3586
3554
|
ranges = divideRangesByHiddenRows(target.worksheet, ranges);
|
|
3587
3555
|
const { unitId, subUnitId, worksheet } = target, redoMutationParams = { unitId, subUnitId, ranges }, setSelectionOperationParams = {
|
|
@@ -3602,20 +3570,20 @@ const SetFrozenMutationFactory = /* @__PURE__ */ __name((accessor, params) => {
|
|
|
3602
3570
|
}))
|
|
3603
3571
|
}, intercepted = sheetInterceptorService.onCommandExecute({ id: SetRowHiddenCommand.id, params: redoMutationParams });
|
|
3604
3572
|
return sequenceExecute([
|
|
3605
|
-
...(
|
|
3573
|
+
...(_c = intercepted.preRedos) != null ? _c : [],
|
|
3606
3574
|
{ id: SetRowHiddenMutation.id, params: redoMutationParams },
|
|
3607
3575
|
{ id: SetSelectionsOperation.id, params: setSelectionOperationParams },
|
|
3608
3576
|
...intercepted.redos
|
|
3609
3577
|
], commandService).result && undoRedoService.pushUndoRedo({
|
|
3610
3578
|
unitID: unitId,
|
|
3611
3579
|
undoMutations: [
|
|
3612
|
-
...(
|
|
3580
|
+
...(_d = intercepted.preUndos) != null ? _d : [],
|
|
3613
3581
|
{ id: SetRowVisibleMutation.id, params: undoMutationParams },
|
|
3614
3582
|
{ id: SetSelectionsOperation.id, params: undoSetSelectionsOperationParams },
|
|
3615
|
-
...(
|
|
3583
|
+
...(_e = intercepted.undos) != null ? _e : []
|
|
3616
3584
|
],
|
|
3617
3585
|
redoMutations: [
|
|
3618
|
-
...(
|
|
3586
|
+
...(_f = intercepted.preRedos) != null ? _f : [],
|
|
3619
3587
|
{ id: SetRowHiddenMutation.id, params: redoMutationParams },
|
|
3620
3588
|
{ id: SetSelectionsOperation.id, params: setSelectionOperationParams },
|
|
3621
3589
|
...intercepted.redos
|
|
@@ -4129,10 +4097,10 @@ const SetStyleCommand = {
|
|
|
4129
4097
|
type: CommandType.COMMAND,
|
|
4130
4098
|
id: "sheet.command.set-worksheet-col-width",
|
|
4131
4099
|
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
4132
|
-
var _a20, _b, _c;
|
|
4133
|
-
const selectionManagerService = accessor.get(SheetsSelectionsService), commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), sheetInterceptorService = accessor.get(SheetInterceptorService), selections = (_a20 = selectionManagerService.getCurrentSelections()) == null ? void 0 :
|
|
4100
|
+
var _a20, _b, _c, _d;
|
|
4101
|
+
const selectionManagerService = accessor.get(SheetsSelectionsService), commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), sheetInterceptorService = accessor.get(SheetInterceptorService), selections = (_a20 = params == null ? void 0 : params.ranges) != null && _a20.length ? params.ranges : (_b = selectionManagerService.getCurrentSelections()) == null ? void 0 : _b.map((s) => s.range);
|
|
4134
4102
|
if (!(selections != null && selections.length)) return !1;
|
|
4135
|
-
const target = getSheetCommandTarget(accessor.get(IUniverInstanceService));
|
|
4103
|
+
const target = getSheetCommandTarget(accessor.get(IUniverInstanceService), params);
|
|
4136
4104
|
if (!target) return !1;
|
|
4137
4105
|
const { subUnitId, unitId } = target, redoMutationParams = {
|
|
4138
4106
|
subUnitId,
|
|
@@ -4154,8 +4122,8 @@ const SetStyleCommand = {
|
|
|
4154
4122
|
}), result = sequenceExecute([...redos, ...intercepted.redos], commandService);
|
|
4155
4123
|
return setColWidthResult && result.result ? (undoRedoService.pushUndoRedo({
|
|
4156
4124
|
unitID: unitId,
|
|
4157
|
-
undoMutations: [...(
|
|
4158
|
-
redoMutations: [...(
|
|
4125
|
+
undoMutations: [...(_c = intercepted.preUndos) != null ? _c : [], { id: SetWorksheetColWidthMutation.id, params: undoMutationParams }, ...undos],
|
|
4126
|
+
redoMutations: [...(_d = intercepted.preRedos) != null ? _d : [], { id: SetWorksheetColWidthMutation.id, params: redoMutationParams }, ...redos]
|
|
4159
4127
|
}), !0) : !1;
|
|
4160
4128
|
}, "handler")
|
|
4161
4129
|
}, SetWorksheetHideMutationFactory = /* @__PURE__ */ __name((accessor, params) => {
|
|
@@ -4358,7 +4326,7 @@ const SetStyleCommand = {
|
|
|
4358
4326
|
for (const { startRow, endRow } of ranges)
|
|
4359
4327
|
for (let rowIndex = startRow; rowIndex <= endRow; rowIndex++) {
|
|
4360
4328
|
const row = manager.getRowOrCreate(rowIndex);
|
|
4361
|
-
typeof autoHeightInfo == "number" ? row.ia = autoHeightInfo : row.ia = (_a20 = autoHeightInfo[rowIndex
|
|
4329
|
+
typeof autoHeightInfo == "number" ? row.ia = autoHeightInfo : row.ia = (_a20 = autoHeightInfo[rowIndex]) != null ? _a20 : defaultRowIsAutoHeight;
|
|
4362
4330
|
}
|
|
4363
4331
|
return !0;
|
|
4364
4332
|
}, "handler")
|
|
@@ -4474,11 +4442,11 @@ const SetStyleCommand = {
|
|
|
4474
4442
|
id: "sheet.command.set-row-height",
|
|
4475
4443
|
// eslint-disable-next-line max-lines-per-function
|
|
4476
4444
|
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
4477
|
-
var _a20, _b, _c;
|
|
4478
|
-
const selectionManagerService = accessor.get(SheetsSelectionsService), commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), univerInstanceService = accessor.get(IUniverInstanceService), sheetInterceptorService = accessor.get(SheetInterceptorService), selections = (_a20 = selectionManagerService.getCurrentSelections()) == null ? void 0 :
|
|
4445
|
+
var _a20, _b, _c, _d;
|
|
4446
|
+
const selectionManagerService = accessor.get(SheetsSelectionsService), commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), univerInstanceService = accessor.get(IUniverInstanceService), sheetInterceptorService = accessor.get(SheetInterceptorService), selections = (_a20 = params == null ? void 0 : params.ranges) != null && _a20.length ? params.ranges : (_b = selectionManagerService.getCurrentSelections()) == null ? void 0 : _b.map((s) => s.range);
|
|
4479
4447
|
if (!(selections != null && selections.length))
|
|
4480
4448
|
return !1;
|
|
4481
|
-
const target = getSheetCommandTarget(univerInstanceService);
|
|
4449
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
4482
4450
|
if (!target) return !1;
|
|
4483
4451
|
const { unitId, subUnitId } = target, redoMutationParams = {
|
|
4484
4452
|
subUnitId,
|
|
@@ -4509,7 +4477,7 @@ const SetStyleCommand = {
|
|
|
4509
4477
|
return result.result && sheetInterceptorResult.result ? (undoRedoService.pushUndoRedo({
|
|
4510
4478
|
unitID: unitId,
|
|
4511
4479
|
undoMutations: [
|
|
4512
|
-
...(
|
|
4480
|
+
...(_c = intercepted.preRedos) != null ? _c : [],
|
|
4513
4481
|
{
|
|
4514
4482
|
id: SetWorksheetRowHeightMutation.id,
|
|
4515
4483
|
params: undoMutationParams
|
|
@@ -4521,7 +4489,7 @@ const SetStyleCommand = {
|
|
|
4521
4489
|
...intercepted.undos
|
|
4522
4490
|
],
|
|
4523
4491
|
redoMutations: [
|
|
4524
|
-
...(
|
|
4492
|
+
...(_d = intercepted.preRedos) != null ? _d : [],
|
|
4525
4493
|
{
|
|
4526
4494
|
id: SetWorksheetRowHeightMutation.id,
|
|
4527
4495
|
params: redoMutationParams
|
|
@@ -4538,17 +4506,10 @@ const SetStyleCommand = {
|
|
|
4538
4506
|
type: CommandType.COMMAND,
|
|
4539
4507
|
id: "sheet.command.set-row-is-auto-height",
|
|
4540
4508
|
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
4541
|
-
var _a20;
|
|
4542
|
-
const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), selectionManagerService = accessor.get(SheetsSelectionsService), univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService);
|
|
4509
|
+
var _a20, _b;
|
|
4510
|
+
const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), selectionManagerService = accessor.get(SheetsSelectionsService), univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService, params);
|
|
4543
4511
|
if (!target) return !1;
|
|
4544
|
-
const { unitId, subUnitId
|
|
4545
|
-
{
|
|
4546
|
-
startRow: anchorRow,
|
|
4547
|
-
endRow: anchorRow,
|
|
4548
|
-
startColumn: 0,
|
|
4549
|
-
endColumn: worksheet.getMaxColumns() - 1
|
|
4550
|
-
}
|
|
4551
|
-
] : (_a20 = selectionManagerService.getCurrentSelections()) == null ? void 0 : _a20.map((s) => s.range);
|
|
4512
|
+
const { unitId, subUnitId } = target, ranges = (_a20 = params == null ? void 0 : params.ranges) != null && _a20.length ? params.ranges : (_b = selectionManagerService.getCurrentSelections()) == null ? void 0 : _b.map((s) => s.range);
|
|
4552
4513
|
if (!(ranges != null && ranges.length))
|
|
4553
4514
|
return !1;
|
|
4554
4515
|
const redoMutationParams = {
|
|
@@ -4866,7 +4827,7 @@ let WorksheetProtectionRuleModel = (_a4 = class {
|
|
|
4866
4827
|
constructor() {
|
|
4867
4828
|
/**
|
|
4868
4829
|
*
|
|
4869
|
-
* Map<unitId, Map<subUnitId, Map<
|
|
4830
|
+
* Map<unitId, Map<subUnitId, Map<subUnitId, IWorksheetProtectionRule>>>
|
|
4870
4831
|
*/
|
|
4871
4832
|
__publicField(this, "_model", /* @__PURE__ */ new Map());
|
|
4872
4833
|
__publicField(this, "_ruleChange", new Subject());
|
|
@@ -4933,6 +4894,13 @@ let WorksheetProtectionRuleModel = (_a4 = class {
|
|
|
4933
4894
|
resetOrder() {
|
|
4934
4895
|
this._resetOrder.next(Math.random());
|
|
4935
4896
|
}
|
|
4897
|
+
getTargetByPermissionId(unitId, permissionId) {
|
|
4898
|
+
const subUnitMap = this._model.get(unitId);
|
|
4899
|
+
if (!subUnitMap) return null;
|
|
4900
|
+
for (const [subUnitId, rule] of subUnitMap)
|
|
4901
|
+
if (rule.permissionId === permissionId)
|
|
4902
|
+
return [unitId, subUnitId];
|
|
4903
|
+
}
|
|
4936
4904
|
}, __name(_a4, "WorksheetProtectionRuleModel"), _a4);
|
|
4937
4905
|
WorksheetProtectionRuleModel = __decorateClass$f([
|
|
4938
4906
|
OnLifecycle(LifecycleStages.Starting, WorksheetProtectionRuleModel)
|
|
@@ -5041,6 +5009,15 @@ let RangeProtectionRuleModel = (_a5 = class {
|
|
|
5041
5009
|
id = Tools.generateRandomId(4);
|
|
5042
5010
|
return id;
|
|
5043
5011
|
}
|
|
5012
|
+
getTargetByPermissionId(unitId, permissionId) {
|
|
5013
|
+
const subUnitMap = this._model.get(unitId);
|
|
5014
|
+
if (!subUnitMap) return null;
|
|
5015
|
+
for (const [subUnitId, ruleMap] of subUnitMap)
|
|
5016
|
+
for (const rule of ruleMap.values())
|
|
5017
|
+
if (rule.permissionId === permissionId)
|
|
5018
|
+
return [unitId, subUnitId];
|
|
5019
|
+
return null;
|
|
5020
|
+
}
|
|
5044
5021
|
}, __name(_a5, "RangeProtectionRuleModel"), _a5);
|
|
5045
5022
|
RangeProtectionRuleModel = __decorateClass$e([
|
|
5046
5023
|
OnLifecycle(LifecycleStages.Starting, RangeProtectionRuleModel)
|
|
@@ -5131,6 +5108,13 @@ let WorksheetProtectionPointModel = (_a6 = class {
|
|
|
5131
5108
|
let subUnitMap = this._model.get(unitId);
|
|
5132
5109
|
return subUnitMap || (subUnitMap = /* @__PURE__ */ new Map(), this._model.set(unitId, subUnitMap)), subUnitMap;
|
|
5133
5110
|
}
|
|
5111
|
+
getTargetByPermissionId(unitId, permissionId) {
|
|
5112
|
+
const subUnitMap = this._model.get(unitId);
|
|
5113
|
+
if (!subUnitMap) return null;
|
|
5114
|
+
for (const [subUnitId, rule] of subUnitMap)
|
|
5115
|
+
if (rule.permissionId === permissionId)
|
|
5116
|
+
return [unitId, subUnitId];
|
|
5117
|
+
}
|
|
5134
5118
|
}, __name(_a6, "WorksheetProtectionPointModel"), _a6);
|
|
5135
5119
|
WorksheetProtectionPointModel = __decorateClass$d([
|
|
5136
5120
|
OnLifecycle(LifecycleStages.Starting, WorksheetProtectionPointModel)
|
|
@@ -6143,7 +6127,16 @@ const handleInsertRow = /* @__PURE__ */ __name((param, targetRange) => {
|
|
|
6143
6127
|
matrix.setValue(row, col, 1);
|
|
6144
6128
|
});
|
|
6145
6129
|
}), queryObjectMatrix(matrix, (v) => v === 1);
|
|
6146
|
-
}, "handleDeleteRangeMoveUpCommon"),
|
|
6130
|
+
}, "handleDeleteRangeMoveUpCommon"), handleRemoveRowCommon = /* @__PURE__ */ __name((param, targetRange) => {
|
|
6131
|
+
var _a20;
|
|
6132
|
+
const ranges = (_a20 = param.ranges) != null ? _a20 : [param.range], matrix = new ObjectMatrix();
|
|
6133
|
+
return Range.foreach(targetRange, (row, col) => {
|
|
6134
|
+
matrix.setValue(row, col, 1);
|
|
6135
|
+
}), ranges.forEach((range) => {
|
|
6136
|
+
const startRow = range.startRow, count = range.endRow - startRow + 1;
|
|
6137
|
+
matrix.removeRows(startRow, count);
|
|
6138
|
+
}), queryObjectMatrix(matrix, (value) => value === 1);
|
|
6139
|
+
}, "handleRemoveRowCommon"), runRefRangeMutations = /* @__PURE__ */ __name((operators, range) => {
|
|
6147
6140
|
let result = { ...range };
|
|
6148
6141
|
return operators.forEach((operator) => {
|
|
6149
6142
|
switch (operator.type) {
|
|
@@ -6253,13 +6246,11 @@ const handleInsertRow = /* @__PURE__ */ __name((param, targetRange) => {
|
|
|
6253
6246
|
operator = handleIRemoveCol(commandInfo, range);
|
|
6254
6247
|
break;
|
|
6255
6248
|
}
|
|
6256
|
-
case EffectRefRangId.RemoveRowCommandId:
|
|
6257
|
-
|
|
6258
|
-
break;
|
|
6259
|
-
}
|
|
6249
|
+
case EffectRefRangId.RemoveRowCommandId:
|
|
6250
|
+
return handleRemoveRowCommon(commandInfo.params, range);
|
|
6260
6251
|
}
|
|
6261
6252
|
return runRefRangeMutations(operator, range);
|
|
6262
|
-
}, "handleCommonDefaultRangeChangeWithEffectRefCommands");
|
|
6253
|
+
}, "handleCommonDefaultRangeChangeWithEffectRefCommands"), handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests = /* @__PURE__ */ __name((range, commandInfo, deps) => [DeleteRangeMoveLeftCommand.id, DeleteRangeMoveUpCommand.id, InsertRangeMoveDownCommand.id, InsertRangeMoveRightCommandId].includes(commandInfo.id) || getEffectedRangesOnCommand(commandInfo, deps).some((effectRange) => Rectangle.intersects(effectRange, range)) ? handleCommonDefaultRangeChangeWithEffectRefCommands(range, commandInfo) : range, "handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests");
|
|
6263
6254
|
function adjustRangeOnMutation(range, mutation) {
|
|
6264
6255
|
const { id, params } = mutation;
|
|
6265
6256
|
let baseRangeOperator = {
|
|
@@ -7613,7 +7604,9 @@ const getAllWorkbookPermissionPoint = /* @__PURE__ */ __name(() => [
|
|
|
7613
7604
|
P.Duplicate,
|
|
7614
7605
|
P.Share,
|
|
7615
7606
|
P.MoveSheet,
|
|
7616
|
-
P.CopySheet
|
|
7607
|
+
P.CopySheet,
|
|
7608
|
+
P.RecoverHistory,
|
|
7609
|
+
P.ViewHistory
|
|
7617
7610
|
];
|
|
7618
7611
|
var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
7619
7612
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
@@ -7726,7 +7719,7 @@ let RangeProtectionRenderModel = (_a15 = class {
|
|
|
7726
7719
|
}
|
|
7727
7720
|
_init() {
|
|
7728
7721
|
this._permissionService.permissionPointUpdate$.pipe(
|
|
7729
|
-
filter((permission) => permission.type ===
|
|
7722
|
+
filter((permission) => permission.type === M.SelectRange),
|
|
7730
7723
|
filter((permission) => getAllRangePermissionPoint().some((F) => permission instanceof F)),
|
|
7731
7724
|
map$1((permission) => permission)
|
|
7732
7725
|
).subscribe((permission) => {
|
|
@@ -7816,8 +7809,8 @@ let RangeProtectionRefRangeService = (_a16 = class extends Disposable {
|
|
|
7816
7809
|
return;
|
|
7817
7810
|
registerRefRange(unitId, sheetId);
|
|
7818
7811
|
}
|
|
7819
|
-
if (commandInfo.id ===
|
|
7820
|
-
const params = commandInfo.params, subUnitId = params.
|
|
7812
|
+
if (commandInfo.id === SetRangeProtectionMutation.id || commandInfo.id === AddRangeProtectionMutation.id) {
|
|
7813
|
+
const params = commandInfo.params, subUnitId = params.subUnitId, unitId = params.unitId;
|
|
7821
7814
|
if (!subUnitId || !unitId)
|
|
7822
7815
|
return;
|
|
7823
7816
|
registerRefRange(unitId, subUnitId);
|
|
@@ -7862,7 +7855,7 @@ let RangeProtectionRefRangeService = (_a16 = class extends Disposable {
|
|
|
7862
7855
|
}
|
|
7863
7856
|
return p;
|
|
7864
7857
|
}, []);
|
|
7865
|
-
cloneRule.ranges = rangesByRemove, redoMutations.push({ id: SetRangeProtectionMutation.id, params: { unitId, subUnitId, rule: cloneRule, ruleId: rule.id } }), undoMutations.push({ id: SetRangeProtectionMutation.id, params: { unitId, subUnitId, rule, ruleId: rule.id } });
|
|
7858
|
+
cloneRule.ranges = rangesByRemove, cloneRule.ranges.length ? (redoMutations.push({ id: SetRangeProtectionMutation.id, params: { unitId, subUnitId, rule: cloneRule, ruleId: rule.id } }), undoMutations.push({ id: SetRangeProtectionMutation.id, params: { unitId, subUnitId, rule, ruleId: rule.id } })) : (redoMutations.push({ id: DeleteRangeProtectionMutation.id, params: { unitId, subUnitId, ruleIds: [rule.id] } }), undoMutations.push({ id: AddRangeProtectionMutation.id, params: { unitId, subUnitId, name: "", rules: [rule] } }));
|
|
7866
7859
|
}), { redos: redoMutations, undos: undoMutations };
|
|
7867
7860
|
}
|
|
7868
7861
|
return { undos: [], redos: [] };
|
|
@@ -7988,7 +7981,7 @@ let RangeProtectionRefRangeService = (_a16 = class extends Disposable {
|
|
|
7988
7981
|
}
|
|
7989
7982
|
}, __name(_a16, "RangeProtectionRefRangeService"), _a16);
|
|
7990
7983
|
RangeProtectionRefRangeService = __decorateClass$3([
|
|
7991
|
-
OnLifecycle(LifecycleStages.
|
|
7984
|
+
OnLifecycle(LifecycleStages.Ready, RangeProtectionRefRangeService),
|
|
7992
7985
|
__decorateParam$3(0, Inject(RangeProtectionRuleModel)),
|
|
7993
7986
|
__decorateParam$3(1, Inject(IUniverInstanceService)),
|
|
7994
7987
|
__decorateParam$3(2, ICommandService),
|
|
@@ -8066,7 +8059,7 @@ let RangeProtectionService = (_a17 = class extends Disposable {
|
|
|
8066
8059
|
allAllowedParams.push({
|
|
8067
8060
|
objectID: rule.permissionId,
|
|
8068
8061
|
unitID: unitId,
|
|
8069
|
-
objectType:
|
|
8062
|
+
objectType: M.SelectRange,
|
|
8070
8063
|
actions: [P.View, P.Edit]
|
|
8071
8064
|
});
|
|
8072
8065
|
}), list.forEach((rule) => {
|
|
@@ -8085,7 +8078,6 @@ let RangeProtectionService = (_a17 = class extends Disposable {
|
|
|
8085
8078
|
}
|
|
8086
8079
|
}, __name(_a17, "RangeProtectionService"), _a17);
|
|
8087
8080
|
RangeProtectionService = __decorateClass$2([
|
|
8088
|
-
OnLifecycle(LifecycleStages.Starting, RangeProtectionService),
|
|
8089
8081
|
__decorateParam$2(0, Inject(RangeProtectionRuleModel)),
|
|
8090
8082
|
__decorateParam$2(1, Inject(IPermissionService)),
|
|
8091
8083
|
__decorateParam$2(2, Inject(IResourceManagerService))
|
|
@@ -8130,8 +8122,8 @@ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnProperty
|
|
|
8130
8122
|
const PLUGIN_NAME = "SHEET_PLUGIN";
|
|
8131
8123
|
var _a19;
|
|
8132
8124
|
let UniverSheetsPlugin = (_a19 = class extends Plugin {
|
|
8133
|
-
constructor(_config,
|
|
8134
|
-
super(), this._config = _config, this.
|
|
8125
|
+
constructor(_config, _configService, _injector) {
|
|
8126
|
+
super(), this._config = _config, this._configService = _configService, this._injector = _injector, this._initConfig(), this._initDependencies(_injector);
|
|
8135
8127
|
}
|
|
8136
8128
|
onRendered() {
|
|
8137
8129
|
}
|
|
@@ -8164,21 +8156,17 @@ let UniverSheetsPlugin = (_a19 = class extends Plugin {
|
|
|
8164
8156
|
[RangeProtectionRefRangeService],
|
|
8165
8157
|
[RangeProtectionService]
|
|
8166
8158
|
];
|
|
8167
|
-
(_a20 = this._config) != null && _a20.notExecuteFormula || dependencies.push(
|
|
8168
|
-
[CalculateResultApplyController]
|
|
8169
|
-
), mergeOverrideWithDependencies(dependencies, (_b = this._config) == null ? void 0 : _b.override).forEach((d) => {
|
|
8159
|
+
(_a20 = this._config) != null && _a20.notExecuteFormula || dependencies.push([CalculateResultApplyController]), mergeOverrideWithDependencies(dependencies, (_b = this._config) == null ? void 0 : _b.override).forEach((d) => {
|
|
8170
8160
|
sheetInjector.add(d);
|
|
8171
|
-
});
|
|
8161
|
+
}), this._injector.get(SheetInterceptorService), this._injector.get(RangeProtectionService);
|
|
8172
8162
|
}
|
|
8173
8163
|
}, __name(_a19, "UniverSheetsPlugin"), _a19);
|
|
8174
8164
|
__publicField2(UniverSheetsPlugin, "pluginName", PLUGIN_NAME);
|
|
8175
8165
|
__publicField2(UniverSheetsPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
8176
8166
|
UniverSheetsPlugin = __decorateClass([
|
|
8177
8167
|
DependentOn(UniverFormulaEnginePlugin),
|
|
8178
|
-
__decorateParam(1,
|
|
8179
|
-
__decorateParam(2,
|
|
8180
|
-
__decorateParam(3, Inject(LocaleService)),
|
|
8181
|
-
__decorateParam(4, Inject(Injector))
|
|
8168
|
+
__decorateParam(1, IConfigService),
|
|
8169
|
+
__decorateParam(2, Inject(Injector))
|
|
8182
8170
|
], UniverSheetsPlugin);
|
|
8183
8171
|
const COMMAND_LISTENER_SKELETON_CHANGE = [
|
|
8184
8172
|
SetWorksheetRowHeightMutation.id,
|
|
@@ -8208,7 +8196,6 @@ function getNormalSelectionStyle(themeService) {
|
|
|
8208
8196
|
return {
|
|
8209
8197
|
strokeWidth: 1,
|
|
8210
8198
|
stroke: styleSheet.primaryColor,
|
|
8211
|
-
// strokeDash: 8,
|
|
8212
8199
|
fill,
|
|
8213
8200
|
// widgets: { tl: true, tc: true, tr: true, ml: true, mr: true, bl: true, bc: true, br: true },
|
|
8214
8201
|
widgets: {},
|
|
@@ -8326,7 +8313,193 @@ const AddMergeRedoSelectionsOperationFactory = /* @__PURE__ */ __name((accessor,
|
|
|
8326
8313
|
};
|
|
8327
8314
|
}
|
|
8328
8315
|
return null;
|
|
8329
|
-
}, "AddMergeUndoSelectionsOperationFactory")
|
|
8316
|
+
}, "AddMergeUndoSelectionsOperationFactory");
|
|
8317
|
+
function cellHasValue(cell) {
|
|
8318
|
+
return cell == null ? !1 : cell.v !== void 0 && cell.v !== null && cell.v !== "" || cell.p !== void 0;
|
|
8319
|
+
}
|
|
8320
|
+
__name(cellHasValue, "cellHasValue");
|
|
8321
|
+
function hasValueFromMatrixWithSpanInfo(cell, matrix) {
|
|
8322
|
+
return cell && cell.spanAnchor ? cellHasValue(matrix.getValue(cell.spanAnchor.startRow, cell.spanAnchor.startColumn)) : cellHasValue(cell);
|
|
8323
|
+
}
|
|
8324
|
+
__name(hasValueFromMatrixWithSpanInfo, "hasValueFromMatrixWithSpanInfo");
|
|
8325
|
+
function getMatrixWithSpanInfo(worksheet, startRow, startColumn, endRow, endColumn) {
|
|
8326
|
+
const matrix = worksheet.getCellMatrix(), mergedCellsInRange = worksheet.getSnapshot().mergeData.filter(
|
|
8327
|
+
(rect) => Rectangle.intersects({ startRow, startColumn, endRow, endColumn }, rect)
|
|
8328
|
+
), returnCellMatrix = new ObjectMatrix();
|
|
8329
|
+
return matrix.forValue((row, col) => {
|
|
8330
|
+
const v = matrix.getValue(row, col);
|
|
8331
|
+
v && returnCellMatrix.setValue(row, col, v);
|
|
8332
|
+
}), mergedCellsInRange.forEach((mergedCell) => {
|
|
8333
|
+
const { startColumn: startColumn2, startRow: startRow2, endColumn: endColumn2, endRow: endRow2 } = mergedCell;
|
|
8334
|
+
createRowColIter(startRow2, endRow2, startColumn2, endColumn2).forEach((row, col) => {
|
|
8335
|
+
row === startRow2 && col === startColumn2 && returnCellMatrix.setValue(row, col, {
|
|
8336
|
+
...matrix.getValue(row, col),
|
|
8337
|
+
spanAnchor: { startRow: startRow2, endRow: endRow2, startColumn: startColumn2, endColumn: endColumn2 }
|
|
8338
|
+
}), (row !== startRow2 || col !== startColumn2) && (returnCellMatrix.realDeleteValue(row, col), returnCellMatrix.setValue(row, col, {
|
|
8339
|
+
spanAnchor: { startRow: startRow2, endRow: endRow2, startColumn: startColumn2, endColumn: endColumn2 }
|
|
8340
|
+
}));
|
|
8341
|
+
});
|
|
8342
|
+
}), returnCellMatrix;
|
|
8343
|
+
}
|
|
8344
|
+
__name(getMatrixWithSpanInfo, "getMatrixWithSpanInfo");
|
|
8345
|
+
function getExpandedRangeLeft(range, allMatrixWithSpan, leftOffset, isWorksheetHasSpan) {
|
|
8346
|
+
const { startRow, startColumn, endRow } = range;
|
|
8347
|
+
let spanAnchor = null, hasValue = !1;
|
|
8348
|
+
for (let i = startRow; i <= endRow; i++) {
|
|
8349
|
+
const cell = allMatrixWithSpan.getValue(i, startColumn - leftOffset);
|
|
8350
|
+
if (hasValue = hasValue || hasValueFromMatrixWithSpanInfo(cell, allMatrixWithSpan), !isWorksheetHasSpan && hasValue)
|
|
8351
|
+
break;
|
|
8352
|
+
cell && cell.spanAnchor && (spanAnchor ? spanAnchor = {
|
|
8353
|
+
startRow: Math.min(cell.spanAnchor.startRow, spanAnchor.startRow),
|
|
8354
|
+
startColumn: Math.min(cell.spanAnchor.startColumn, spanAnchor.startColumn),
|
|
8355
|
+
endRow: Math.max(cell.spanAnchor.endRow, spanAnchor.endRow),
|
|
8356
|
+
endColumn: Math.max(cell.spanAnchor.endColumn, spanAnchor.endColumn)
|
|
8357
|
+
} : spanAnchor = {
|
|
8358
|
+
startRow: cell.spanAnchor.startRow,
|
|
8359
|
+
startColumn: cell.spanAnchor.startColumn,
|
|
8360
|
+
endRow: cell.spanAnchor.endRow,
|
|
8361
|
+
endColumn: cell.spanAnchor.endColumn
|
|
8362
|
+
});
|
|
8363
|
+
}
|
|
8364
|
+
return hasValue ? (range.startColumn = range.startColumn - leftOffset, {
|
|
8365
|
+
spanAnchor,
|
|
8366
|
+
hasValue: !0,
|
|
8367
|
+
range
|
|
8368
|
+
}) : {
|
|
8369
|
+
spanAnchor: null,
|
|
8370
|
+
hasValue: !1,
|
|
8371
|
+
range
|
|
8372
|
+
};
|
|
8373
|
+
}
|
|
8374
|
+
__name(getExpandedRangeLeft, "getExpandedRangeLeft");
|
|
8375
|
+
function getExpandedRangeRight(range, allMatrixWithSpan, rightOffset, isWorksheetHasSpan) {
|
|
8376
|
+
const { startRow, endColumn, endRow } = range;
|
|
8377
|
+
let spanAnchor = null, hasValue = !1;
|
|
8378
|
+
for (let i = startRow; i <= endRow; i++) {
|
|
8379
|
+
const cell = allMatrixWithSpan.getValue(i, endColumn + rightOffset);
|
|
8380
|
+
if (hasValue = hasValue || hasValueFromMatrixWithSpanInfo(cell, allMatrixWithSpan), !isWorksheetHasSpan && hasValue)
|
|
8381
|
+
break;
|
|
8382
|
+
cell && cell.spanAnchor && (spanAnchor ? spanAnchor = {
|
|
8383
|
+
startRow: Math.min(cell.spanAnchor.startRow, spanAnchor.startRow),
|
|
8384
|
+
startColumn: Math.min(cell.spanAnchor.startColumn, spanAnchor.startColumn),
|
|
8385
|
+
endRow: Math.max(cell.spanAnchor.endRow, spanAnchor.endRow),
|
|
8386
|
+
endColumn: Math.max(cell.spanAnchor.endColumn, spanAnchor.endColumn)
|
|
8387
|
+
} : spanAnchor = {
|
|
8388
|
+
startRow: cell.spanAnchor.startRow,
|
|
8389
|
+
startColumn: cell.spanAnchor.startColumn,
|
|
8390
|
+
endRow: cell.spanAnchor.endRow,
|
|
8391
|
+
endColumn: cell.spanAnchor.endColumn
|
|
8392
|
+
});
|
|
8393
|
+
}
|
|
8394
|
+
return hasValue ? (range.endColumn = range.endColumn + rightOffset, {
|
|
8395
|
+
spanAnchor,
|
|
8396
|
+
hasValue: !0,
|
|
8397
|
+
range
|
|
8398
|
+
}) : {
|
|
8399
|
+
spanAnchor: null,
|
|
8400
|
+
hasValue: !1,
|
|
8401
|
+
range
|
|
8402
|
+
};
|
|
8403
|
+
}
|
|
8404
|
+
__name(getExpandedRangeRight, "getExpandedRangeRight");
|
|
8405
|
+
function getExpandedRangeUp(range, allMatrixWithSpan, upOffset, isWorksheetHasSpan) {
|
|
8406
|
+
const { startRow, startColumn, endColumn } = range;
|
|
8407
|
+
let spanAnchor = null, hasValue = !1;
|
|
8408
|
+
for (let i = startColumn; i <= endColumn; i++) {
|
|
8409
|
+
const cell = allMatrixWithSpan.getValue(startRow - upOffset, i);
|
|
8410
|
+
if (hasValue = hasValue || hasValueFromMatrixWithSpanInfo(cell, allMatrixWithSpan), !isWorksheetHasSpan && hasValue)
|
|
8411
|
+
break;
|
|
8412
|
+
cell && cell.spanAnchor && (spanAnchor ? spanAnchor = {
|
|
8413
|
+
startRow: Math.min(cell.spanAnchor.startRow, spanAnchor.startRow),
|
|
8414
|
+
startColumn: Math.min(cell.spanAnchor.startColumn, spanAnchor.startColumn),
|
|
8415
|
+
endRow: Math.max(cell.spanAnchor.endRow, spanAnchor.endRow),
|
|
8416
|
+
endColumn: Math.max(cell.spanAnchor.endColumn, spanAnchor.endColumn)
|
|
8417
|
+
} : spanAnchor = {
|
|
8418
|
+
startRow: cell.spanAnchor.startRow,
|
|
8419
|
+
startColumn: cell.spanAnchor.startColumn,
|
|
8420
|
+
endRow: cell.spanAnchor.endRow,
|
|
8421
|
+
endColumn: cell.spanAnchor.endColumn
|
|
8422
|
+
});
|
|
8423
|
+
}
|
|
8424
|
+
return hasValue ? (range.startRow = range.startRow - upOffset, {
|
|
8425
|
+
spanAnchor,
|
|
8426
|
+
hasValue: !0,
|
|
8427
|
+
range
|
|
8428
|
+
}) : {
|
|
8429
|
+
spanAnchor: null,
|
|
8430
|
+
hasValue: !1,
|
|
8431
|
+
range
|
|
8432
|
+
};
|
|
8433
|
+
}
|
|
8434
|
+
__name(getExpandedRangeUp, "getExpandedRangeUp");
|
|
8435
|
+
function getExpandedRangeDown(range, allMatrixWithSpan, downOffset, isWorksheetHasSpan) {
|
|
8436
|
+
const { startColumn, endColumn, endRow } = range;
|
|
8437
|
+
let spanAnchor = null, hasValue = !1;
|
|
8438
|
+
for (let i = startColumn; i <= endColumn; i++) {
|
|
8439
|
+
const cell = allMatrixWithSpan.getValue(endRow + downOffset, i);
|
|
8440
|
+
if (hasValue = hasValue || hasValueFromMatrixWithSpanInfo(cell, allMatrixWithSpan), !isWorksheetHasSpan && hasValue)
|
|
8441
|
+
break;
|
|
8442
|
+
cell && cell.spanAnchor && (spanAnchor ? spanAnchor = {
|
|
8443
|
+
startRow: Math.min(cell.spanAnchor.startRow, spanAnchor.startRow),
|
|
8444
|
+
startColumn: Math.min(cell.spanAnchor.startColumn, spanAnchor.startColumn),
|
|
8445
|
+
endRow: Math.max(cell.spanAnchor.endRow, spanAnchor.endRow),
|
|
8446
|
+
endColumn: Math.max(cell.spanAnchor.endColumn, spanAnchor.endColumn)
|
|
8447
|
+
} : spanAnchor = {
|
|
8448
|
+
startRow: cell.spanAnchor.startRow,
|
|
8449
|
+
startColumn: cell.spanAnchor.startColumn,
|
|
8450
|
+
endRow: cell.spanAnchor.endRow,
|
|
8451
|
+
endColumn: cell.spanAnchor.endColumn
|
|
8452
|
+
});
|
|
8453
|
+
}
|
|
8454
|
+
return hasValue ? (range.endRow = range.endRow + downOffset, {
|
|
8455
|
+
spanAnchor,
|
|
8456
|
+
hasValue: !0,
|
|
8457
|
+
range
|
|
8458
|
+
}) : {
|
|
8459
|
+
spanAnchor: null,
|
|
8460
|
+
hasValue: !1,
|
|
8461
|
+
range
|
|
8462
|
+
};
|
|
8463
|
+
}
|
|
8464
|
+
__name(getExpandedRangeDown, "getExpandedRangeDown");
|
|
8465
|
+
function expandToContinuousRange(startRange, directions, worksheet) {
|
|
8466
|
+
const maxRow = worksheet.getMaxRows(), maxColumn = worksheet.getMaxColumns(), allMatrixWithSpan = getMatrixWithSpanInfo(worksheet, 0, 0, maxRow - 1, maxColumn - 1), worksheetHasSpan = worksheet.getSnapshot().mergeData.length > 0, { left, right, up, down } = directions;
|
|
8467
|
+
let changed = !0, destRange = { ...startRange };
|
|
8468
|
+
const spanAnchors = [];
|
|
8469
|
+
for (; changed; ) {
|
|
8470
|
+
if (changed = !1, up && destRange.startRow !== 0) {
|
|
8471
|
+
const { hasValue, range, spanAnchor } = getExpandedRangeUp(destRange, allMatrixWithSpan, 1, worksheetHasSpan);
|
|
8472
|
+
if (spanAnchor && spanAnchors.push(spanAnchor), hasValue) {
|
|
8473
|
+
destRange = range, changed = !0;
|
|
8474
|
+
continue;
|
|
8475
|
+
}
|
|
8476
|
+
}
|
|
8477
|
+
if (down && destRange.endRow !== maxRow - 1) {
|
|
8478
|
+
const { hasValue, range, spanAnchor } = getExpandedRangeDown(destRange, allMatrixWithSpan, 1, worksheetHasSpan);
|
|
8479
|
+
if (spanAnchor && spanAnchors.push(spanAnchor), hasValue) {
|
|
8480
|
+
destRange = range, changed = !0;
|
|
8481
|
+
continue;
|
|
8482
|
+
}
|
|
8483
|
+
}
|
|
8484
|
+
if (left && destRange.startColumn !== 0) {
|
|
8485
|
+
const { hasValue, range, spanAnchor } = getExpandedRangeLeft(destRange, allMatrixWithSpan, 1, worksheetHasSpan);
|
|
8486
|
+
if (spanAnchor && spanAnchors.push(spanAnchor), hasValue) {
|
|
8487
|
+
destRange = range, changed = !0;
|
|
8488
|
+
continue;
|
|
8489
|
+
}
|
|
8490
|
+
}
|
|
8491
|
+
if (right && destRange.endColumn !== maxColumn - 1) {
|
|
8492
|
+
const { hasValue, range, spanAnchor } = getExpandedRangeRight(destRange, allMatrixWithSpan, 1, worksheetHasSpan);
|
|
8493
|
+
if (spanAnchor && spanAnchors.push(spanAnchor), hasValue) {
|
|
8494
|
+
destRange = range, changed = !0;
|
|
8495
|
+
continue;
|
|
8496
|
+
}
|
|
8497
|
+
}
|
|
8498
|
+
}
|
|
8499
|
+
return spanAnchors.length > 0 && (destRange = Rectangle.union(destRange, ...spanAnchors)), destRange;
|
|
8500
|
+
}
|
|
8501
|
+
__name(expandToContinuousRange, "expandToContinuousRange");
|
|
8502
|
+
const checkRangesEditablePermission = /* @__PURE__ */ __name((accessor, unitId, subUnitId, ranges) => {
|
|
8330
8503
|
const permissionService = accessor.get(IPermissionService), rangeProtectionRuleModel = accessor.get(RangeProtectionRuleModel$1), workbookEditablePermission = permissionService.getPermissionPoint(new WorkbookEditablePermission$1(unitId).id);
|
|
8331
8504
|
if (!(workbookEditablePermission != null && workbookEditablePermission.value))
|
|
8332
8505
|
return !1;
|
|
@@ -8600,6 +8773,7 @@ export {
|
|
|
8600
8773
|
InsertSheetCommand,
|
|
8601
8774
|
InsertSheetMutation,
|
|
8602
8775
|
InsertSheetUndoMutationFactory,
|
|
8776
|
+
InterceptCellContentPriority,
|
|
8603
8777
|
MAX_CELL_PER_SHEET_KEY,
|
|
8604
8778
|
MERGE_CELL_INTERCEPTOR_CHECK,
|
|
8605
8779
|
MergeCellController,
|
|
@@ -8715,6 +8889,7 @@ export {
|
|
|
8715
8889
|
SetWorksheetShowCommand,
|
|
8716
8890
|
SheetInterceptorService,
|
|
8717
8891
|
SheetsSelectionsService,
|
|
8892
|
+
M as UnitObject,
|
|
8718
8893
|
UniverSheetsPlugin,
|
|
8719
8894
|
WorkbookCommentPermission,
|
|
8720
8895
|
WorkbookCopyPermission,
|
|
@@ -8762,6 +8937,7 @@ export {
|
|
|
8762
8937
|
checkRangesEditablePermission,
|
|
8763
8938
|
convertPrimaryWithCoordToPrimary,
|
|
8764
8939
|
convertSelectionDataToRange,
|
|
8940
|
+
copyRangeStyles,
|
|
8765
8941
|
createTopMatrixFromMatrix,
|
|
8766
8942
|
createTopMatrixFromRanges,
|
|
8767
8943
|
defaultWorkbookPermissionPoints,
|
|
@@ -8793,6 +8969,7 @@ export {
|
|
|
8793
8969
|
handleBaseMoveRowsCols,
|
|
8794
8970
|
handleBaseRemoveRange,
|
|
8795
8971
|
handleCommonDefaultRangeChangeWithEffectRefCommands,
|
|
8972
|
+
handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests,
|
|
8796
8973
|
handleDefaultRangeChangeWithEffectRefCommands,
|
|
8797
8974
|
handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests,
|
|
8798
8975
|
handleDeleteRangeMoveLeft,
|