@univerjs/sheets 0.2.6 → 0.2.7
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 +2 -2
- package/lib/es/index.js +168 -54
- package/lib/types/controllers/merge-cell.controller.d.ts +5 -1
- package/lib/types/index.d.ts +3 -2
- package/lib/types/services/permission/util.d.ts +3 -0
- package/lib/types/services/sheet-interceptor/sheet-interceptor.service.d.ts +31 -2
- package/lib/umd/index.js +2 -2
- package/package.json +13 -12
package/lib/es/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { DataSyncPrimaryController } from "@univerjs/rpc";
|
|
|
8
8
|
import { shareReplay, takeUntil, switchMap, of, Subject, BehaviorSubject, merge, map } from "rxjs";
|
|
9
9
|
import { DEFAULT_TEXT_FORMAT } from "@univerjs/engine-numfmt";
|
|
10
10
|
import { takeUntil as takeUntil$1, filter, map as map$1 } from "rxjs/operators";
|
|
11
|
+
import { RangeProtectionRuleModel as RangeProtectionRuleModel$1, WorkbookEditablePermission as WorkbookEditablePermission$1, WorksheetEditPermission as WorksheetEditPermission$1, RangeProtectionPermissionEditPoint as RangeProtectionPermissionEditPoint$1 } from "@univerjs/sheets";
|
|
11
12
|
var __defProp$i = Object.defineProperty, __getOwnPropDesc$i = Object.getOwnPropertyDescriptor, __decorateClass$i = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
12
13
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13
14
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
@@ -194,6 +195,8 @@ let SheetInterceptorService = (_a2 = class extends Disposable {
|
|
|
194
195
|
super();
|
|
195
196
|
__publicField(this, "_interceptorsByName", /* @__PURE__ */ new Map());
|
|
196
197
|
__publicField(this, "_commandInterceptors", []);
|
|
198
|
+
__publicField(this, "_rangeInterceptors", []);
|
|
199
|
+
__publicField(this, "_beforeCommandInterceptor", []);
|
|
197
200
|
__publicField(this, "_workbookDisposables", /* @__PURE__ */ new Map());
|
|
198
201
|
__publicField(this, "_worksheetDisposables", /* @__PURE__ */ new Map());
|
|
199
202
|
this._univerInstanceService = _univerInstanceService, this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {
|
|
@@ -219,13 +222,58 @@ let SheetInterceptorService = (_a2 = class extends Disposable {
|
|
|
219
222
|
return ((_a20 = b.priority) != null ? _a20 : 0) - ((_b = a.priority) != null ? _b : 0);
|
|
220
223
|
}), this.disposeWithMe(toDisposable(() => remove(this._commandInterceptors, interceptor)));
|
|
221
224
|
}
|
|
225
|
+
// Add a listener function to the command, which will be run before the command is run to get whether it can be executed the command
|
|
226
|
+
interceptBeforeCommand(interceptor) {
|
|
227
|
+
if (this._beforeCommandInterceptor.includes(interceptor))
|
|
228
|
+
throw new Error("[SheetInterceptorService]: Interceptor already exists!");
|
|
229
|
+
return this._beforeCommandInterceptor.push(interceptor), this._beforeCommandInterceptor.sort((a, b) => {
|
|
230
|
+
var _a20, _b;
|
|
231
|
+
return ((_a20 = b.priority) != null ? _a20 : 0) - ((_b = a.priority) != null ? _b : 0);
|
|
232
|
+
}), this.disposeWithMe(toDisposable(() => remove(this._beforeCommandInterceptor, interceptor)));
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* before command execute, call this method to get the flag of whether it can be executed the command,
|
|
236
|
+
* @param info ICommandInfo
|
|
237
|
+
* @returns Promise<boolean>
|
|
238
|
+
*/
|
|
239
|
+
async beforeCommandExecute(info) {
|
|
240
|
+
return (await Promise.all(this._beforeCommandInterceptor.map((i) => i.performCheck(info)))).every((perform) => perform);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* By adding callbacks to some Ranges can get some additional mutations, such as clearing all plugin data in a certain area.
|
|
244
|
+
* @param interceptor IRangeInterceptors
|
|
245
|
+
* @returns IDisposable
|
|
246
|
+
*/
|
|
247
|
+
interceptRanges(interceptor) {
|
|
248
|
+
if (this._rangeInterceptors.includes(interceptor))
|
|
249
|
+
throw new Error("[SheetInterceptorService]: Interceptor already exists!");
|
|
250
|
+
return this._rangeInterceptors.push(interceptor), this._rangeInterceptors.sort((a, b) => {
|
|
251
|
+
var _a20, _b;
|
|
252
|
+
return ((_a20 = b.priority) != null ? _a20 : 0) - ((_b = a.priority) != null ? _b : 0);
|
|
253
|
+
}), this.disposeWithMe(toDisposable(() => remove(this._rangeInterceptors, interceptor)));
|
|
254
|
+
}
|
|
222
255
|
/**
|
|
223
256
|
* When command is executing, call this method to gether undo redo mutations from upper features.
|
|
224
257
|
* @param command
|
|
225
258
|
* @returns
|
|
226
259
|
*/
|
|
227
|
-
onCommandExecute(
|
|
228
|
-
const infos = this._commandInterceptors.map((i) => i.getMutations(
|
|
260
|
+
onCommandExecute(info) {
|
|
261
|
+
const infos = this._commandInterceptors.map((i) => i.getMutations(info));
|
|
262
|
+
return {
|
|
263
|
+
preUndos: infos.map((i) => {
|
|
264
|
+
var _a20;
|
|
265
|
+
return (_a20 = i.preUndos) != null ? _a20 : [];
|
|
266
|
+
}).flat(),
|
|
267
|
+
undos: infos.map((i) => i.undos).flat(),
|
|
268
|
+
preRedos: infos.map((i) => {
|
|
269
|
+
var _a20;
|
|
270
|
+
return (_a20 = i.preRedos) != null ? _a20 : [];
|
|
271
|
+
}).flat(),
|
|
272
|
+
redos: infos.map((i) => i.redos).flat()
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
generateMutationsByRanges(info) {
|
|
276
|
+
const infos = this._rangeInterceptors.map((i) => i.getMutations(info));
|
|
229
277
|
return {
|
|
230
278
|
preUndos: infos.map((i) => {
|
|
231
279
|
var _a20;
|
|
@@ -966,10 +1014,11 @@ __name(createRangeIteratorWithSkipFilteredRows, "createRangeIteratorWithSkipFilt
|
|
|
966
1014
|
const MoveRangeCommandId = "sheet.command.move-range", MoveRangeCommand = {
|
|
967
1015
|
type: CommandType.COMMAND,
|
|
968
1016
|
id: MoveRangeCommandId,
|
|
969
|
-
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
1017
|
+
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
970
1018
|
var _a20, _b;
|
|
971
|
-
const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), univerInstanceService = accessor.get(IUniverInstanceService), errorService = accessor.get(ErrorService), localeService = accessor.get(LocaleService), target = getSheetCommandTarget(univerInstanceService);
|
|
972
|
-
if (!target
|
|
1019
|
+
const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), univerInstanceService = accessor.get(IUniverInstanceService), errorService = accessor.get(ErrorService), localeService = accessor.get(LocaleService), sheetInterceptorService = accessor.get(SheetInterceptorService), target = getSheetCommandTarget(univerInstanceService);
|
|
1020
|
+
if (!target || !await sheetInterceptorService.beforeCommandExecute({ id: MoveRangeCommand.id, params }))
|
|
1021
|
+
return !1;
|
|
973
1022
|
const { worksheet, subUnitId, unitId } = target, moveRangeMutations = getMoveRangeUndoRedoMutations(
|
|
974
1023
|
accessor,
|
|
975
1024
|
{ unitId, subUnitId, range: params.fromRange },
|
|
@@ -977,7 +1026,7 @@ const MoveRangeCommandId = "sheet.command.move-range", MoveRangeCommand = {
|
|
|
977
1026
|
);
|
|
978
1027
|
if (moveRangeMutations === null)
|
|
979
1028
|
return errorService.emit(localeService.t("sheets.info.acrossMergedCell")), !1;
|
|
980
|
-
const interceptorCommands =
|
|
1029
|
+
const interceptorCommands = sheetInterceptorService.onCommandExecute({
|
|
981
1030
|
id: MoveRangeCommand.id,
|
|
982
1031
|
params: { ...params }
|
|
983
1032
|
}), redos = [
|
|
@@ -1060,11 +1109,11 @@ function getMoveRangeUndoRedoMutations(accessor, from, to, ignoreMerge = !1) {
|
|
|
1060
1109
|
};
|
|
1061
1110
|
}
|
|
1062
1111
|
__name(getMoveRangeUndoRedoMutations, "getMoveRangeUndoRedoMutations");
|
|
1063
|
-
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.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 || {}),
|
|
1112
|
+
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.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 || {}), l = /* @__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))(l || {});
|
|
1064
1113
|
const _WorksheetCopyPermission = class _WorksheetCopyPermission {
|
|
1065
1114
|
constructor(unitId, subUnitId) {
|
|
1066
1115
|
__publicField(this, "value", !0);
|
|
1067
|
-
__publicField(this, "type",
|
|
1116
|
+
__publicField(this, "type", l.Worksheet);
|
|
1068
1117
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1069
1118
|
__publicField(this, "id");
|
|
1070
1119
|
__publicField(this, "subType", P.Copy);
|
|
@@ -1076,7 +1125,7 @@ let WorksheetCopyPermission = _WorksheetCopyPermission;
|
|
|
1076
1125
|
const _WorksheetSelectProtectedCellsPermission = class _WorksheetSelectProtectedCellsPermission {
|
|
1077
1126
|
constructor(unitId, subUnitId) {
|
|
1078
1127
|
__publicField(this, "value", !0);
|
|
1079
|
-
__publicField(this, "type",
|
|
1128
|
+
__publicField(this, "type", l.Worksheet);
|
|
1080
1129
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1081
1130
|
__publicField(this, "id");
|
|
1082
1131
|
__publicField(this, "subType", P.SelectProtectedCells);
|
|
@@ -1088,7 +1137,7 @@ let WorksheetSelectProtectedCellsPermission = _WorksheetSelectProtectedCellsPerm
|
|
|
1088
1137
|
const _WorksheetSelectUnProtectedCellsPermission = class _WorksheetSelectUnProtectedCellsPermission {
|
|
1089
1138
|
constructor(unitId, subUnitId) {
|
|
1090
1139
|
__publicField(this, "value", !0);
|
|
1091
|
-
__publicField(this, "type",
|
|
1140
|
+
__publicField(this, "type", l.Worksheet);
|
|
1092
1141
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1093
1142
|
__publicField(this, "id");
|
|
1094
1143
|
__publicField(this, "subType", P.SelectUnProtectedCells);
|
|
@@ -1100,7 +1149,7 @@ let WorksheetSelectUnProtectedCellsPermission = _WorksheetSelectUnProtectedCells
|
|
|
1100
1149
|
const _WorksheetSetCellStylePermission = class _WorksheetSetCellStylePermission {
|
|
1101
1150
|
constructor(unitId, subUnitId) {
|
|
1102
1151
|
__publicField(this, "value", !0);
|
|
1103
|
-
__publicField(this, "type",
|
|
1152
|
+
__publicField(this, "type", l.Worksheet);
|
|
1104
1153
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1105
1154
|
__publicField(this, "id");
|
|
1106
1155
|
__publicField(this, "subType", P.SetCellStyle);
|
|
@@ -1112,7 +1161,7 @@ let WorksheetSetCellStylePermission = _WorksheetSetCellStylePermission;
|
|
|
1112
1161
|
const _WorksheetSetCellValuePermission = class _WorksheetSetCellValuePermission {
|
|
1113
1162
|
constructor(unitId, subUnitId) {
|
|
1114
1163
|
__publicField(this, "value", !0);
|
|
1115
|
-
__publicField(this, "type",
|
|
1164
|
+
__publicField(this, "type", l.Worksheet);
|
|
1116
1165
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1117
1166
|
__publicField(this, "id");
|
|
1118
1167
|
__publicField(this, "subType", P.SetCellValue);
|
|
@@ -1124,7 +1173,7 @@ let WorksheetSetCellValuePermission = _WorksheetSetCellValuePermission;
|
|
|
1124
1173
|
const _WorksheetViewPermission = class _WorksheetViewPermission {
|
|
1125
1174
|
constructor(unitId, subUnitId) {
|
|
1126
1175
|
__publicField(this, "value", !0);
|
|
1127
|
-
__publicField(this, "type",
|
|
1176
|
+
__publicField(this, "type", l.Worksheet);
|
|
1128
1177
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1129
1178
|
__publicField(this, "id");
|
|
1130
1179
|
__publicField(this, "subType", P.View);
|
|
@@ -1136,7 +1185,7 @@ let WorksheetViewPermission = _WorksheetViewPermission;
|
|
|
1136
1185
|
const _WorksheetSetRowStylePermission = class _WorksheetSetRowStylePermission {
|
|
1137
1186
|
constructor(unitId, subUnitId) {
|
|
1138
1187
|
__publicField(this, "value", !0);
|
|
1139
|
-
__publicField(this, "type",
|
|
1188
|
+
__publicField(this, "type", l.Worksheet);
|
|
1140
1189
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1141
1190
|
__publicField(this, "id");
|
|
1142
1191
|
__publicField(this, "subType", P.SetRowStyle);
|
|
@@ -1148,7 +1197,7 @@ let WorksheetSetRowStylePermission = _WorksheetSetRowStylePermission;
|
|
|
1148
1197
|
const _WorksheetSetColumnStylePermission = class _WorksheetSetColumnStylePermission {
|
|
1149
1198
|
constructor(unitId, subUnitId) {
|
|
1150
1199
|
__publicField(this, "value", !0);
|
|
1151
|
-
__publicField(this, "type",
|
|
1200
|
+
__publicField(this, "type", l.Worksheet);
|
|
1152
1201
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1153
1202
|
__publicField(this, "id");
|
|
1154
1203
|
__publicField(this, "subType", P.SetColumnStyle);
|
|
@@ -1160,7 +1209,7 @@ let WorksheetSetColumnStylePermission = _WorksheetSetColumnStylePermission;
|
|
|
1160
1209
|
const _WorksheetInsertRowPermission = class _WorksheetInsertRowPermission {
|
|
1161
1210
|
constructor(unitId, subUnitId) {
|
|
1162
1211
|
__publicField(this, "value", !0);
|
|
1163
|
-
__publicField(this, "type",
|
|
1212
|
+
__publicField(this, "type", l.Worksheet);
|
|
1164
1213
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1165
1214
|
__publicField(this, "id");
|
|
1166
1215
|
__publicField(this, "subType", P.InsertRow);
|
|
@@ -1172,7 +1221,7 @@ let WorksheetInsertRowPermission = _WorksheetInsertRowPermission;
|
|
|
1172
1221
|
const _WorksheetInsertColumnPermission = class _WorksheetInsertColumnPermission {
|
|
1173
1222
|
constructor(unitId, subUnitId) {
|
|
1174
1223
|
__publicField(this, "value", !0);
|
|
1175
|
-
__publicField(this, "type",
|
|
1224
|
+
__publicField(this, "type", l.Worksheet);
|
|
1176
1225
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1177
1226
|
__publicField(this, "id");
|
|
1178
1227
|
__publicField(this, "subType", P.InsertColumn);
|
|
@@ -1184,7 +1233,7 @@ let WorksheetInsertColumnPermission = _WorksheetInsertColumnPermission;
|
|
|
1184
1233
|
const _WorksheetInsertHyperlinkPermission = class _WorksheetInsertHyperlinkPermission {
|
|
1185
1234
|
constructor(unitId, subUnitId) {
|
|
1186
1235
|
__publicField(this, "value", !0);
|
|
1187
|
-
__publicField(this, "type",
|
|
1236
|
+
__publicField(this, "type", l.Worksheet);
|
|
1188
1237
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1189
1238
|
__publicField(this, "id");
|
|
1190
1239
|
__publicField(this, "subType", P.InsertHyperlink);
|
|
@@ -1196,7 +1245,7 @@ let WorksheetInsertHyperlinkPermission = _WorksheetInsertHyperlinkPermission;
|
|
|
1196
1245
|
const _WorksheetDeleteRowPermission = class _WorksheetDeleteRowPermission {
|
|
1197
1246
|
constructor(unitId, subUnitId) {
|
|
1198
1247
|
__publicField(this, "value", !0);
|
|
1199
|
-
__publicField(this, "type",
|
|
1248
|
+
__publicField(this, "type", l.Worksheet);
|
|
1200
1249
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1201
1250
|
__publicField(this, "id");
|
|
1202
1251
|
__publicField(this, "subType", P.DeleteRow);
|
|
@@ -1208,7 +1257,7 @@ let WorksheetDeleteRowPermission = _WorksheetDeleteRowPermission;
|
|
|
1208
1257
|
const _WorksheetDeleteColumnPermission = class _WorksheetDeleteColumnPermission {
|
|
1209
1258
|
constructor(unitId, subUnitId) {
|
|
1210
1259
|
__publicField(this, "value", !0);
|
|
1211
|
-
__publicField(this, "type",
|
|
1260
|
+
__publicField(this, "type", l.Worksheet);
|
|
1212
1261
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1213
1262
|
__publicField(this, "id");
|
|
1214
1263
|
__publicField(this, "subType", P.DeleteColumn);
|
|
@@ -1220,7 +1269,7 @@ let WorksheetDeleteColumnPermission = _WorksheetDeleteColumnPermission;
|
|
|
1220
1269
|
const _WorksheetSortPermission = class _WorksheetSortPermission {
|
|
1221
1270
|
constructor(unitId, subUnitId) {
|
|
1222
1271
|
__publicField(this, "value", !0);
|
|
1223
|
-
__publicField(this, "type",
|
|
1272
|
+
__publicField(this, "type", l.Worksheet);
|
|
1224
1273
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1225
1274
|
__publicField(this, "id");
|
|
1226
1275
|
__publicField(this, "subType", P.Sort);
|
|
@@ -1232,7 +1281,7 @@ let WorksheetSortPermission = _WorksheetSortPermission;
|
|
|
1232
1281
|
const _WorksheetFilterPermission = class _WorksheetFilterPermission {
|
|
1233
1282
|
constructor(unitId, subUnitId) {
|
|
1234
1283
|
__publicField(this, "value", !0);
|
|
1235
|
-
__publicField(this, "type",
|
|
1284
|
+
__publicField(this, "type", l.Worksheet);
|
|
1236
1285
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1237
1286
|
__publicField(this, "id");
|
|
1238
1287
|
__publicField(this, "subType", P.Filter);
|
|
@@ -1244,7 +1293,7 @@ let WorksheetFilterPermission = _WorksheetFilterPermission;
|
|
|
1244
1293
|
const _WorksheetPivotTablePermission = class _WorksheetPivotTablePermission {
|
|
1245
1294
|
constructor(unitId, subUnitId) {
|
|
1246
1295
|
__publicField(this, "value", !0);
|
|
1247
|
-
__publicField(this, "type",
|
|
1296
|
+
__publicField(this, "type", l.Worksheet);
|
|
1248
1297
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1249
1298
|
__publicField(this, "id");
|
|
1250
1299
|
__publicField(this, "subType", P.PivotTable);
|
|
@@ -1256,7 +1305,7 @@ let WorksheetPivotTablePermission = _WorksheetPivotTablePermission;
|
|
|
1256
1305
|
const _WorksheetEditExtraObjectPermission = class _WorksheetEditExtraObjectPermission {
|
|
1257
1306
|
constructor(unitId, subUnitId) {
|
|
1258
1307
|
__publicField(this, "value", !0);
|
|
1259
|
-
__publicField(this, "type",
|
|
1308
|
+
__publicField(this, "type", l.Worksheet);
|
|
1260
1309
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1261
1310
|
__publicField(this, "id");
|
|
1262
1311
|
__publicField(this, "subType", P.EditExtraObject);
|
|
@@ -1268,7 +1317,7 @@ let WorksheetEditExtraObjectPermission = _WorksheetEditExtraObjectPermission;
|
|
|
1268
1317
|
const _WorksheetManageCollaboratorPermission = class _WorksheetManageCollaboratorPermission {
|
|
1269
1318
|
constructor(unitId, subUnitId) {
|
|
1270
1319
|
__publicField(this, "value", !0);
|
|
1271
|
-
__publicField(this, "type",
|
|
1320
|
+
__publicField(this, "type", l.Worksheet);
|
|
1272
1321
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1273
1322
|
__publicField(this, "id");
|
|
1274
1323
|
__publicField(this, "subType", P.ManageCollaborator);
|
|
@@ -1280,7 +1329,7 @@ let WorksheetManageCollaboratorPermission = _WorksheetManageCollaboratorPermissi
|
|
|
1280
1329
|
const _WorksheetEditPermission = class _WorksheetEditPermission {
|
|
1281
1330
|
constructor(unitId, subUnitId) {
|
|
1282
1331
|
__publicField(this, "value", !0);
|
|
1283
|
-
__publicField(this, "type",
|
|
1332
|
+
__publicField(this, "type", l.Worksheet);
|
|
1284
1333
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1285
1334
|
__publicField(this, "id");
|
|
1286
1335
|
__publicField(this, "subType", P.Edit);
|
|
@@ -1293,7 +1342,7 @@ const _WorkbookCommentPermission = class _WorkbookCommentPermission {
|
|
|
1293
1342
|
constructor(unitId) {
|
|
1294
1343
|
__publicField(this, "id");
|
|
1295
1344
|
__publicField(this, "value", !0);
|
|
1296
|
-
__publicField(this, "type",
|
|
1345
|
+
__publicField(this, "type", l.Workbook);
|
|
1297
1346
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1298
1347
|
__publicField(this, "subType", P.Comment);
|
|
1299
1348
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.Comment}_${unitId}`;
|
|
@@ -1305,7 +1354,7 @@ const _WorkbookEditablePermission = class _WorkbookEditablePermission {
|
|
|
1305
1354
|
constructor(unitId) {
|
|
1306
1355
|
__publicField(this, "id");
|
|
1307
1356
|
__publicField(this, "value", !0);
|
|
1308
|
-
__publicField(this, "type",
|
|
1357
|
+
__publicField(this, "type", l.Workbook);
|
|
1309
1358
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1310
1359
|
__publicField(this, "subType", P.Edit);
|
|
1311
1360
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.Edit}_${unitId}`;
|
|
@@ -1317,7 +1366,7 @@ const _WorkbookDuplicatePermission = class _WorkbookDuplicatePermission {
|
|
|
1317
1366
|
constructor(unitId) {
|
|
1318
1367
|
__publicField(this, "id");
|
|
1319
1368
|
__publicField(this, "value", !0);
|
|
1320
|
-
__publicField(this, "type",
|
|
1369
|
+
__publicField(this, "type", l.Workbook);
|
|
1321
1370
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1322
1371
|
__publicField(this, "subType", P.Duplicate);
|
|
1323
1372
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.Duplicate}_${unitId}`;
|
|
@@ -1329,7 +1378,7 @@ const _WorkbookPrintPermission = class _WorkbookPrintPermission {
|
|
|
1329
1378
|
constructor(unitId) {
|
|
1330
1379
|
__publicField(this, "id");
|
|
1331
1380
|
__publicField(this, "value", !0);
|
|
1332
|
-
__publicField(this, "type",
|
|
1381
|
+
__publicField(this, "type", l.Workbook);
|
|
1333
1382
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1334
1383
|
__publicField(this, "subType", P.Print);
|
|
1335
1384
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.Print}_${unitId}`;
|
|
@@ -1341,7 +1390,7 @@ const _WorkbookExportPermission = class _WorkbookExportPermission {
|
|
|
1341
1390
|
constructor(unitId) {
|
|
1342
1391
|
__publicField(this, "id");
|
|
1343
1392
|
__publicField(this, "value", !0);
|
|
1344
|
-
__publicField(this, "type",
|
|
1393
|
+
__publicField(this, "type", l.Workbook);
|
|
1345
1394
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1346
1395
|
__publicField(this, "subType", P.Export);
|
|
1347
1396
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.Export}_${unitId}`;
|
|
@@ -1353,7 +1402,7 @@ const _WorkbookMoveSheetPermission = class _WorkbookMoveSheetPermission {
|
|
|
1353
1402
|
constructor(unitId) {
|
|
1354
1403
|
__publicField(this, "id");
|
|
1355
1404
|
__publicField(this, "value", !0);
|
|
1356
|
-
__publicField(this, "type",
|
|
1405
|
+
__publicField(this, "type", l.Workbook);
|
|
1357
1406
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1358
1407
|
__publicField(this, "subType", P.MoveSheet);
|
|
1359
1408
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.MoveSheet}_${unitId}`;
|
|
@@ -1365,7 +1414,7 @@ const _WorkbookDeleteSheetPermission = class _WorkbookDeleteSheetPermission {
|
|
|
1365
1414
|
constructor(unitId) {
|
|
1366
1415
|
__publicField(this, "id");
|
|
1367
1416
|
__publicField(this, "value", !0);
|
|
1368
|
-
__publicField(this, "type",
|
|
1417
|
+
__publicField(this, "type", l.Workbook);
|
|
1369
1418
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1370
1419
|
__publicField(this, "subType", P.DeleteSheet);
|
|
1371
1420
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.DeleteSheet}_${unitId}`;
|
|
@@ -1377,7 +1426,7 @@ const _WorkbookHideSheetPermission = class _WorkbookHideSheetPermission {
|
|
|
1377
1426
|
constructor(unitId) {
|
|
1378
1427
|
__publicField(this, "id");
|
|
1379
1428
|
__publicField(this, "value", !0);
|
|
1380
|
-
__publicField(this, "type",
|
|
1429
|
+
__publicField(this, "type", l.Workbook);
|
|
1381
1430
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1382
1431
|
__publicField(this, "subType", P.HideSheet);
|
|
1383
1432
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.HideSheet}_${unitId}`;
|
|
@@ -1389,7 +1438,7 @@ const _WorkbookRenameSheetPermission = class _WorkbookRenameSheetPermission {
|
|
|
1389
1438
|
constructor(unitId) {
|
|
1390
1439
|
__publicField(this, "id");
|
|
1391
1440
|
__publicField(this, "value", !0);
|
|
1392
|
-
__publicField(this, "type",
|
|
1441
|
+
__publicField(this, "type", l.Workbook);
|
|
1393
1442
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1394
1443
|
__publicField(this, "subType", P.RenameSheet);
|
|
1395
1444
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.RenameSheet}_${unitId}`;
|
|
@@ -1401,7 +1450,7 @@ const _WorkbookCreateSheetPermission = class _WorkbookCreateSheetPermission {
|
|
|
1401
1450
|
constructor(unitId) {
|
|
1402
1451
|
__publicField(this, "id");
|
|
1403
1452
|
__publicField(this, "value", !0);
|
|
1404
|
-
__publicField(this, "type",
|
|
1453
|
+
__publicField(this, "type", l.Workbook);
|
|
1405
1454
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1406
1455
|
__publicField(this, "subType", P.CreateSheet);
|
|
1407
1456
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.CreateSheet}_${unitId}`;
|
|
@@ -1413,7 +1462,7 @@ const _WorkbookHistoryPermission = class _WorkbookHistoryPermission {
|
|
|
1413
1462
|
constructor(unitId) {
|
|
1414
1463
|
__publicField(this, "id");
|
|
1415
1464
|
__publicField(this, "value", !0);
|
|
1416
|
-
__publicField(this, "type",
|
|
1465
|
+
__publicField(this, "type", l.Workbook);
|
|
1417
1466
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1418
1467
|
__publicField(this, "subType", P.History);
|
|
1419
1468
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.History}_${unitId}`;
|
|
@@ -1425,7 +1474,7 @@ const _WorkbookViewPermission = class _WorkbookViewPermission {
|
|
|
1425
1474
|
constructor(unitId) {
|
|
1426
1475
|
__publicField(this, "id");
|
|
1427
1476
|
__publicField(this, "value", !0);
|
|
1428
|
-
__publicField(this, "type",
|
|
1477
|
+
__publicField(this, "type", l.Workbook);
|
|
1429
1478
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1430
1479
|
__publicField(this, "subType", P.View);
|
|
1431
1480
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.View}_${unitId}`;
|
|
@@ -1437,7 +1486,7 @@ const _WorkbookSharePermission = class _WorkbookSharePermission {
|
|
|
1437
1486
|
constructor(unitId) {
|
|
1438
1487
|
__publicField(this, "id");
|
|
1439
1488
|
__publicField(this, "value", !0);
|
|
1440
|
-
__publicField(this, "type",
|
|
1489
|
+
__publicField(this, "type", l.Workbook);
|
|
1441
1490
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1442
1491
|
__publicField(this, "subType", P.Share);
|
|
1443
1492
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.Share}_${unitId}`;
|
|
@@ -1449,7 +1498,7 @@ const _WorkbookCopyPermission = class _WorkbookCopyPermission {
|
|
|
1449
1498
|
constructor(unitId) {
|
|
1450
1499
|
__publicField(this, "id");
|
|
1451
1500
|
__publicField(this, "value", !0);
|
|
1452
|
-
__publicField(this, "type",
|
|
1501
|
+
__publicField(this, "type", l.Workbook);
|
|
1453
1502
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1454
1503
|
__publicField(this, "subType", P.Copy);
|
|
1455
1504
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.Copy}_${unitId}`;
|
|
@@ -1461,7 +1510,7 @@ const _WorkbookCopySheetPermission = class _WorkbookCopySheetPermission {
|
|
|
1461
1510
|
constructor(unitId) {
|
|
1462
1511
|
__publicField(this, "id");
|
|
1463
1512
|
__publicField(this, "value", !0);
|
|
1464
|
-
__publicField(this, "type",
|
|
1513
|
+
__publicField(this, "type", l.Workbook);
|
|
1465
1514
|
__publicField(this, "subType", P.CopySheet);
|
|
1466
1515
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1467
1516
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.CopySheet}_${unitId}`;
|
|
@@ -1473,7 +1522,7 @@ const _WorkbookManageCollaboratorPermission = class _WorkbookManageCollaboratorP
|
|
|
1473
1522
|
constructor(unitId) {
|
|
1474
1523
|
__publicField(this, "id");
|
|
1475
1524
|
__publicField(this, "value", !0);
|
|
1476
|
-
__publicField(this, "type",
|
|
1525
|
+
__publicField(this, "type", l.Workbook);
|
|
1477
1526
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1478
1527
|
__publicField(this, "subType", P.ManageCollaborator);
|
|
1479
1528
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.ManageCollaborator}_${unitId}`;
|
|
@@ -1485,7 +1534,7 @@ const _WorkbookViewHistoryPermission = class _WorkbookViewHistoryPermission {
|
|
|
1485
1534
|
constructor(unitId) {
|
|
1486
1535
|
__publicField(this, "id");
|
|
1487
1536
|
__publicField(this, "value", !0);
|
|
1488
|
-
__publicField(this, "type",
|
|
1537
|
+
__publicField(this, "type", l.Workbook);
|
|
1489
1538
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1490
1539
|
__publicField(this, "subType", P.ViewHistory);
|
|
1491
1540
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.ViewHistory}_${unitId}`;
|
|
@@ -1497,7 +1546,7 @@ const _WorkbookRecoverHistoryPermission = class _WorkbookRecoverHistoryPermissio
|
|
|
1497
1546
|
constructor(unitId) {
|
|
1498
1547
|
__publicField(this, "id");
|
|
1499
1548
|
__publicField(this, "value", !0);
|
|
1500
|
-
__publicField(this, "type",
|
|
1549
|
+
__publicField(this, "type", l.Workbook);
|
|
1501
1550
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1502
1551
|
__publicField(this, "subType", P.RecoverHistory);
|
|
1503
1552
|
this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${P.RecoverHistory}_${unitId}`;
|
|
@@ -1507,7 +1556,7 @@ __name(_WorkbookRecoverHistoryPermission, "WorkbookRecoverHistoryPermission");
|
|
|
1507
1556
|
let WorkbookRecoverHistoryPermission = _WorkbookRecoverHistoryPermission;
|
|
1508
1557
|
const _RangeProtectionPermissionEditPoint = class _RangeProtectionPermissionEditPoint {
|
|
1509
1558
|
constructor(unitId, subUnitId, permissionId) {
|
|
1510
|
-
__publicField(this, "type",
|
|
1559
|
+
__publicField(this, "type", l.SelectRange);
|
|
1511
1560
|
__publicField(this, "subType", P.Edit);
|
|
1512
1561
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1513
1562
|
__publicField(this, "value", !0);
|
|
@@ -1515,14 +1564,14 @@ const _RangeProtectionPermissionEditPoint = class _RangeProtectionPermissionEdit
|
|
|
1515
1564
|
__publicField(this, "unitId");
|
|
1516
1565
|
__publicField(this, "subUnitId");
|
|
1517
1566
|
__publicField(this, "permissionId");
|
|
1518
|
-
this.unitId = unitId, this.subUnitId = subUnitId, this.permissionId = permissionId, this.id = `${
|
|
1567
|
+
this.unitId = unitId, this.subUnitId = subUnitId, this.permissionId = permissionId, this.id = `${l.SelectRange}.${P.Edit}.${permissionId}`;
|
|
1519
1568
|
}
|
|
1520
1569
|
};
|
|
1521
1570
|
__name(_RangeProtectionPermissionEditPoint, "RangeProtectionPermissionEditPoint");
|
|
1522
1571
|
let RangeProtectionPermissionEditPoint = _RangeProtectionPermissionEditPoint;
|
|
1523
1572
|
const _RangeProtectionPermissionViewPoint = class _RangeProtectionPermissionViewPoint {
|
|
1524
1573
|
constructor(unitId, subUnitId, permissionId) {
|
|
1525
|
-
__publicField(this, "type",
|
|
1574
|
+
__publicField(this, "type", l.SelectRange);
|
|
1526
1575
|
__publicField(this, "subType", P.View);
|
|
1527
1576
|
__publicField(this, "status", PermissionStatus.INIT);
|
|
1528
1577
|
__publicField(this, "value", !0);
|
|
@@ -1530,7 +1579,7 @@ const _RangeProtectionPermissionViewPoint = class _RangeProtectionPermissionView
|
|
|
1530
1579
|
__publicField(this, "unitId");
|
|
1531
1580
|
__publicField(this, "subUnitId");
|
|
1532
1581
|
__publicField(this, "permissionId");
|
|
1533
|
-
this.unitId = unitId, this.subUnitId = subUnitId, this.permissionId = permissionId, this.id = `${
|
|
1582
|
+
this.unitId = unitId, this.subUnitId = subUnitId, this.permissionId = permissionId, this.id = `${l.SelectRange}.${P.View}.${permissionId}`;
|
|
1534
1583
|
}
|
|
1535
1584
|
};
|
|
1536
1585
|
__name(_RangeProtectionPermissionViewPoint, "RangeProtectionPermissionViewPoint");
|
|
@@ -2095,7 +2144,13 @@ const DeleteRangeMoveLeftCommandId = "sheet.command.delete-range-move-left", Del
|
|
|
2095
2144
|
}, undoRowInsertionParams = InsertRowMutationUndoFactory(
|
|
2096
2145
|
accessor,
|
|
2097
2146
|
insertRowParams
|
|
2098
|
-
)
|
|
2147
|
+
);
|
|
2148
|
+
if (!await sheetInterceptorService.beforeCommandExecute({
|
|
2149
|
+
id: InsertRowCommand.id,
|
|
2150
|
+
params: insertRowParams
|
|
2151
|
+
}))
|
|
2152
|
+
return !1;
|
|
2153
|
+
const redos = [{ id: InsertRowMutation.id, params: insertRowParams }], undos = [{ id: RemoveRowMutation.id, params: undoRowInsertionParams }];
|
|
2099
2154
|
cellValue && redos.push({
|
|
2100
2155
|
id: SetRangeValuesMutation.id,
|
|
2101
2156
|
params: {
|
|
@@ -2197,7 +2252,13 @@ const DeleteRangeMoveLeftCommandId = "sheet.command.delete-range-move-left", Del
|
|
|
2197
2252
|
}, undoColInsertionParams = InsertColMutationUndoFactory(
|
|
2198
2253
|
accessor,
|
|
2199
2254
|
insertColParams
|
|
2200
|
-
)
|
|
2255
|
+
);
|
|
2256
|
+
if (!await sheetInterceptorService.beforeCommandExecute({
|
|
2257
|
+
id: InsertColCommand.id,
|
|
2258
|
+
params: insertColParams
|
|
2259
|
+
}))
|
|
2260
|
+
return !1;
|
|
2261
|
+
const redos = [{ id: InsertColMutation.id, params: insertColParams }], undos = [{ id: RemoveColMutation.id, params: undoColInsertionParams }];
|
|
2201
2262
|
cellValue && redos.push({
|
|
2202
2263
|
id: SetRangeValuesMutation.id,
|
|
2203
2264
|
params: {
|
|
@@ -2545,6 +2606,11 @@ const MoveRowsCommandId = "sheet.command.move-rows", MoveRowsCommand = {
|
|
|
2545
2606
|
});
|
|
2546
2607
|
} else
|
|
2547
2608
|
ranges.push(totalRange);
|
|
2609
|
+
if (!await sheetInterceptorService.beforeCommandExecute({
|
|
2610
|
+
id: RemoveRowCommand.id,
|
|
2611
|
+
params: { range: totalRange }
|
|
2612
|
+
}))
|
|
2613
|
+
return !1;
|
|
2548
2614
|
const redos = [], undos = [];
|
|
2549
2615
|
ranges.forEach((range) => {
|
|
2550
2616
|
const removeRowsParams = {
|
|
@@ -2611,7 +2677,13 @@ const MoveRowsCommandId = "sheet.command.move-rows", MoveRowsCommand = {
|
|
|
2611
2677
|
unitId,
|
|
2612
2678
|
subUnitId,
|
|
2613
2679
|
cellValue: removedCols.getMatrix()
|
|
2614
|
-
}
|
|
2680
|
+
};
|
|
2681
|
+
if (!await sheetInterceptorService.beforeCommandExecute({
|
|
2682
|
+
id: RemoveColCommand.id,
|
|
2683
|
+
params: { range }
|
|
2684
|
+
}))
|
|
2685
|
+
return !1;
|
|
2686
|
+
const intercepted = sheetInterceptorService.onCommandExecute({
|
|
2615
2687
|
id: RemoveColCommand.id,
|
|
2616
2688
|
params: { range }
|
|
2617
2689
|
}), commandService = accessor.get(ICommandService);
|
|
@@ -6690,11 +6762,13 @@ function getAddMergeMutationRangeByType(selection, type) {
|
|
|
6690
6762
|
return ranges;
|
|
6691
6763
|
}
|
|
6692
6764
|
__name(getAddMergeMutationRangeByType, "getAddMergeMutationRangeByType");
|
|
6765
|
+
const MERGE_CELL_INTERCEPTOR_CHECK = createInterceptorKey("mergeCellPermissionCheck");
|
|
6693
6766
|
var _a11;
|
|
6694
6767
|
let MergeCellController = (_a11 = class extends Disposable {
|
|
6695
6768
|
constructor(_commandService, _refRangeService, _univerInstanceService, _injector, _sheetInterceptorService, _selectionManagerService) {
|
|
6696
6769
|
super();
|
|
6697
6770
|
__publicField(this, "disposableCollection", new DisposableCollection());
|
|
6771
|
+
__publicField(this, "interceptor", new InterceptorManager({ MERGE_CELL_INTERCEPTOR_CHECK }));
|
|
6698
6772
|
this._commandService = _commandService, this._refRangeService = _refRangeService, this._univerInstanceService = _univerInstanceService, this._injector = _injector, this._sheetInterceptorService = _sheetInterceptorService, this._selectionManagerService = _selectionManagerService, this._onRefRangeChange(), this._initCommandInterceptor(), this._commandExecutedListener();
|
|
6699
6773
|
}
|
|
6700
6774
|
_initCommandInterceptor() {
|
|
@@ -6727,6 +6801,31 @@ let MergeCellController = (_a11 = class extends Disposable {
|
|
|
6727
6801
|
}
|
|
6728
6802
|
return { redos: [], undos: [] };
|
|
6729
6803
|
}
|
|
6804
|
+
}), this._sheetInterceptorService.interceptRanges({
|
|
6805
|
+
getMutations: /* @__PURE__ */ __name(({ unitId, subUnitId, ranges }) => {
|
|
6806
|
+
const redos = [], undos = [], emptyInterceptorArr = { redos, undos };
|
|
6807
|
+
if (!ranges || !ranges.length)
|
|
6808
|
+
return emptyInterceptorArr;
|
|
6809
|
+
const target = getSheetCommandTarget(this._univerInstanceService, { unitId, subUnitId });
|
|
6810
|
+
if (!target)
|
|
6811
|
+
return emptyInterceptorArr;
|
|
6812
|
+
const { worksheet } = target, overlapRanges = worksheet.getMergeData().filter((item) => ranges.some((range) => Rectangle.intersects(item, range)));
|
|
6813
|
+
return overlapRanges.length ? (redos.push({
|
|
6814
|
+
id: RemoveWorksheetMergeMutation.id,
|
|
6815
|
+
params: {
|
|
6816
|
+
unitId,
|
|
6817
|
+
subUnitId,
|
|
6818
|
+
ranges: overlapRanges
|
|
6819
|
+
}
|
|
6820
|
+
}), undos.push({
|
|
6821
|
+
id: AddWorksheetMergeMutation.id,
|
|
6822
|
+
params: {
|
|
6823
|
+
unitId,
|
|
6824
|
+
subUnitId,
|
|
6825
|
+
ranges: overlapRanges
|
|
6826
|
+
}
|
|
6827
|
+
}), { undos, redos }) : emptyInterceptorArr;
|
|
6828
|
+
}, "getMutations")
|
|
6730
6829
|
});
|
|
6731
6830
|
}
|
|
6732
6831
|
refRangeHandle(config, unitId, subUnitId) {
|
|
@@ -7614,7 +7713,7 @@ let RangeProtectionRenderModel = (_a15 = class {
|
|
|
7614
7713
|
}
|
|
7615
7714
|
_init() {
|
|
7616
7715
|
this._permissionService.permissionPointUpdate$.pipe(
|
|
7617
|
-
filter((permission) => permission.type ===
|
|
7716
|
+
filter((permission) => permission.type === l.SelectRange),
|
|
7618
7717
|
filter((permission) => getAllRangePermissionPoint().some((F) => permission instanceof F)),
|
|
7619
7718
|
map$1((permission) => permission)
|
|
7620
7719
|
).subscribe((permission) => {
|
|
@@ -7954,7 +8053,7 @@ let RangeProtectionService = (_a17 = class extends Disposable {
|
|
|
7954
8053
|
allAllowedParams.push({
|
|
7955
8054
|
objectID: rule.permissionId,
|
|
7956
8055
|
unitID: unitId,
|
|
7957
|
-
objectType:
|
|
8056
|
+
objectType: l.SelectRange,
|
|
7958
8057
|
actions: [P.View, P.Edit]
|
|
7959
8058
|
});
|
|
7960
8059
|
}), list.forEach((rule) => {
|
|
@@ -8214,7 +8313,19 @@ const AddMergeRedoSelectionsOperationFactory = /* @__PURE__ */ __name((accessor,
|
|
|
8214
8313
|
};
|
|
8215
8314
|
}
|
|
8216
8315
|
return null;
|
|
8217
|
-
}, "AddMergeUndoSelectionsOperationFactory")
|
|
8316
|
+
}, "AddMergeUndoSelectionsOperationFactory"), checkRangesEditablePermission = /* @__PURE__ */ __name((accessor, unitId, subUnitId, ranges) => {
|
|
8317
|
+
const permissionService = accessor.get(IPermissionService), rangeProtectionRuleModel = accessor.get(RangeProtectionRuleModel$1), workbookEditablePermission = permissionService.getPermissionPoint(new WorkbookEditablePermission$1(unitId).id);
|
|
8318
|
+
if (!(workbookEditablePermission != null && workbookEditablePermission.value))
|
|
8319
|
+
return !1;
|
|
8320
|
+
const worksheetEditPermission = permissionService.getPermissionPoint(new WorksheetEditPermission$1(unitId, subUnitId).id);
|
|
8321
|
+
if (!(worksheetEditPermission != null && worksheetEditPermission.value))
|
|
8322
|
+
return !1;
|
|
8323
|
+
const ruleList = rangeProtectionRuleModel.getSubunitRuleList(unitId, subUnitId).filter((rule) => rule.ranges.some((ruleRange) => ranges.some((range) => Rectangle.intersects(ruleRange, range))));
|
|
8324
|
+
return ruleList.length ? ruleList.every((rule) => {
|
|
8325
|
+
const permissionId = rule.permissionId, permissionPoint = permissionService.getPermissionPoint(new RangeProtectionPermissionEditPoint$1(unitId, subUnitId, permissionId).id);
|
|
8326
|
+
return !!(permissionPoint != null && permissionPoint.value);
|
|
8327
|
+
}) : !0;
|
|
8328
|
+
}, "checkRangesEditablePermission");
|
|
8218
8329
|
function checkCellContentInRanges(worksheet, ranges) {
|
|
8219
8330
|
return ranges.some((range) => checkCellContentInRange(worksheet, range));
|
|
8220
8331
|
}
|
|
@@ -8477,6 +8588,7 @@ export {
|
|
|
8477
8588
|
InsertSheetMutation,
|
|
8478
8589
|
InsertSheetUndoMutationFactory,
|
|
8479
8590
|
MAX_CELL_PER_SHEET_KEY,
|
|
8591
|
+
MERGE_CELL_INTERCEPTOR_CHECK,
|
|
8480
8592
|
MergeCellController,
|
|
8481
8593
|
MoveColsCommand,
|
|
8482
8594
|
MoveColsMutation,
|
|
@@ -8634,6 +8746,7 @@ export {
|
|
|
8634
8746
|
WorksheetSortPermission,
|
|
8635
8747
|
WorksheetViewPermission,
|
|
8636
8748
|
alignToMergedCellsBorders,
|
|
8749
|
+
checkRangesEditablePermission,
|
|
8637
8750
|
convertPrimaryWithCoordToPrimary,
|
|
8638
8751
|
convertSelectionDataToRange,
|
|
8639
8752
|
createTopMatrixFromMatrix,
|
|
@@ -8645,6 +8758,7 @@ export {
|
|
|
8645
8758
|
factorySetNumfmtUndoMutation,
|
|
8646
8759
|
findAllRectangle,
|
|
8647
8760
|
followSelectionOperation,
|
|
8761
|
+
generateNullCell,
|
|
8648
8762
|
generateNullCellValue,
|
|
8649
8763
|
getAddMergeMutationRangeByType,
|
|
8650
8764
|
getAllRangePermissionPoint,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRange, Dimension, Disposable, DisposableCollection, ICommandService, Injector, IUniverInstanceService } from '@univerjs/core';
|
|
1
|
+
import { IRange, Dimension, Disposable, DisposableCollection, ICommandService, Injector, InterceptorManager, IUniverInstanceService } from '@univerjs/core';
|
|
2
2
|
import { IRemoveWorksheetMergeMutationParams } from '../basics/interfaces/mutation-interface';
|
|
3
3
|
import { RefRangeService } from '../services/ref-range/ref-range.service';
|
|
4
4
|
import { EffectRefRangeParams } from '../services/ref-range/type';
|
|
@@ -12,6 +12,7 @@ import { SheetInterceptorService } from '../services/sheet-interceptor/sheet-int
|
|
|
12
12
|
* @return {*}
|
|
13
13
|
*/
|
|
14
14
|
export declare function getAddMergeMutationRangeByType(selection: IRange[], type?: Dimension): IRange[];
|
|
15
|
+
export declare const MERGE_CELL_INTERCEPTOR_CHECK: import('@univerjs/core').IInterceptor<boolean, IRange[]>;
|
|
15
16
|
export declare class MergeCellController extends Disposable {
|
|
16
17
|
private readonly _commandService;
|
|
17
18
|
private readonly _refRangeService;
|
|
@@ -20,6 +21,9 @@ export declare class MergeCellController extends Disposable {
|
|
|
20
21
|
private _sheetInterceptorService;
|
|
21
22
|
private _selectionManagerService;
|
|
22
23
|
disposableCollection: DisposableCollection;
|
|
24
|
+
readonly interceptor: InterceptorManager<{
|
|
25
|
+
MERGE_CELL_INTERCEPTOR_CHECK: import('@univerjs/core').IInterceptor<boolean, IRange[]>;
|
|
26
|
+
}>;
|
|
23
27
|
constructor(_commandService: ICommandService, _refRangeService: RefRangeService, _univerInstanceService: IUniverInstanceService, _injector: Injector, _sheetInterceptorService: SheetInterceptorService, _selectionManagerService: SheetsSelectionsService);
|
|
24
28
|
private _initCommandInterceptor;
|
|
25
29
|
refRangeHandle(config: EffectRefRangeParams, unitId: string, subUnitId: string): {
|