@univerjs/sheets 1.0.0-alpha.8 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +57 -59
- package/lib/cjs/index.js +139 -210
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-HK.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/facade.js +57 -59
- package/lib/es/index.js +139 -211
- package/lib/es/locale/zh-CN.js +1 -1
- package/lib/es/locale/zh-HK.js +1 -1
- package/lib/es/locale/zh-TW.js +1 -1
- package/lib/facade.js +57 -59
- package/lib/index.js +139 -211
- package/lib/locale/zh-CN.js +1 -1
- package/lib/locale/zh-HK.js +1 -1
- package/lib/locale/zh-TW.js +1 -1
- package/lib/types/basics/cell-type.d.ts +2 -1
- package/lib/types/facade/f-worksheet.d.ts +10 -9
- package/lib/types/index.d.ts +1 -1
- package/lib/types/services/ref-range/ref-range.service.d.ts +2 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +2 -2
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +8 -8
package/lib/cjs/index.js
CHANGED
|
@@ -8,6 +8,10 @@ let rxjs_operators = require("rxjs/operators");
|
|
|
8
8
|
let _univerjs_rpc = require("@univerjs/rpc");
|
|
9
9
|
|
|
10
10
|
//#region src/basics/cell-type.ts
|
|
11
|
+
function isCellImage(documentData) {
|
|
12
|
+
var _documentData$drawing;
|
|
13
|
+
return !!(documentData === null || documentData === void 0 || (_documentData$drawing = documentData.drawingsOrder) === null || _documentData$drawing === void 0 ? void 0 : _documentData$drawing.length);
|
|
14
|
+
}
|
|
11
15
|
/**
|
|
12
16
|
* Get cell value type by style, new value and old value.
|
|
13
17
|
* If the new value contains t, then take t directly. In other cases, we need to dynamically determine based on actual data and styles
|
|
@@ -284,10 +288,7 @@ let SheetInterceptorService = class SheetInterceptorService extends _univerjs_co
|
|
|
284
288
|
interceptCommand(interceptor) {
|
|
285
289
|
if (this._commandInterceptors.includes(interceptor)) throw new Error("[SheetInterceptorService]: Interceptor already exists!");
|
|
286
290
|
this._commandInterceptors.push(interceptor);
|
|
287
|
-
this._commandInterceptors.sort((a, b) =>
|
|
288
|
-
var _b$priority, _a$priority;
|
|
289
|
-
return ((_b$priority = b.priority) !== null && _b$priority !== void 0 ? _b$priority : 0) - ((_a$priority = a.priority) !== null && _a$priority !== void 0 ? _a$priority : 0);
|
|
290
|
-
});
|
|
291
|
+
this._commandInterceptors.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
291
292
|
return this.disposeWithMe((0, _univerjs_core.toDisposable)(() => (0, _univerjs_core.remove)(this._commandInterceptors, interceptor)));
|
|
292
293
|
}
|
|
293
294
|
/**
|
|
@@ -298,25 +299,16 @@ let SheetInterceptorService = class SheetInterceptorService extends _univerjs_co
|
|
|
298
299
|
onCommandExecute(info) {
|
|
299
300
|
const infos = this._commandInterceptors.map((i) => i.getMutations(info));
|
|
300
301
|
return {
|
|
301
|
-
preUndos: infos.map((i) =>
|
|
302
|
-
var _i$preUndos;
|
|
303
|
-
return (_i$preUndos = i.preUndos) !== null && _i$preUndos !== void 0 ? _i$preUndos : [];
|
|
304
|
-
}).flat(),
|
|
302
|
+
preUndos: infos.map((i) => i.preUndos ?? []).flat(),
|
|
305
303
|
undos: infos.map((i) => i.undos).flat(),
|
|
306
|
-
preRedos: infos.map((i) =>
|
|
307
|
-
var _i$preRedos;
|
|
308
|
-
return (_i$preRedos = i.preRedos) !== null && _i$preRedos !== void 0 ? _i$preRedos : [];
|
|
309
|
-
}).flat(),
|
|
304
|
+
preRedos: infos.map((i) => i.preRedos ?? []).flat(),
|
|
310
305
|
redos: infos.map((i) => i.redos).flat()
|
|
311
306
|
};
|
|
312
307
|
}
|
|
313
308
|
interceptAfterCommand(interceptor) {
|
|
314
309
|
if (this._afterCommandInterceptors.includes(interceptor)) throw new Error("[SheetInterceptorService]: Interceptor already exists!");
|
|
315
310
|
this._afterCommandInterceptors.push(interceptor);
|
|
316
|
-
this._afterCommandInterceptors.sort((a, b) =>
|
|
317
|
-
var _b$priority2, _a$priority2;
|
|
318
|
-
return ((_b$priority2 = b.priority) !== null && _b$priority2 !== void 0 ? _b$priority2 : 0) - ((_a$priority2 = a.priority) !== null && _a$priority2 !== void 0 ? _a$priority2 : 0);
|
|
319
|
-
});
|
|
311
|
+
this._afterCommandInterceptors.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
320
312
|
return this.disposeWithMe((0, _univerjs_core.toDisposable)(() => (0, _univerjs_core.remove)(this._afterCommandInterceptors, interceptor)));
|
|
321
313
|
}
|
|
322
314
|
afterCommandExecute(info) {
|
|
@@ -329,24 +321,15 @@ let SheetInterceptorService = class SheetInterceptorService extends _univerjs_co
|
|
|
329
321
|
interceptAutoHeight(interceptor) {
|
|
330
322
|
if (this._autoHeightInterceptors.includes(interceptor)) throw new Error("[SheetInterceptorService]: Interceptor already exists!");
|
|
331
323
|
this._autoHeightInterceptors.push(interceptor);
|
|
332
|
-
this._autoHeightInterceptors.sort((a, b) =>
|
|
333
|
-
var _b$priority3, _a$priority3;
|
|
334
|
-
return ((_b$priority3 = b.priority) !== null && _b$priority3 !== void 0 ? _b$priority3 : 0) - ((_a$priority3 = a.priority) !== null && _a$priority3 !== void 0 ? _a$priority3 : 0);
|
|
335
|
-
});
|
|
324
|
+
this._autoHeightInterceptors.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
336
325
|
return this.disposeWithMe((0, _univerjs_core.toDisposable)(() => (0, _univerjs_core.remove)(this._autoHeightInterceptors, interceptor)));
|
|
337
326
|
}
|
|
338
327
|
generateMutationsOfAutoHeight(ctx) {
|
|
339
328
|
const infos = this._autoHeightInterceptors.map((i) => i.getMutations(ctx));
|
|
340
329
|
return {
|
|
341
|
-
preUndos: infos.map((i) =>
|
|
342
|
-
var _i$preUndos2;
|
|
343
|
-
return (_i$preUndos2 = i.preUndos) !== null && _i$preUndos2 !== void 0 ? _i$preUndos2 : [];
|
|
344
|
-
}).flat(),
|
|
330
|
+
preUndos: infos.map((i) => i.preUndos ?? []).flat(),
|
|
345
331
|
undos: infos.map((i) => i.undos).flat(),
|
|
346
|
-
preRedos: infos.map((i) =>
|
|
347
|
-
var _i$preRedos2;
|
|
348
|
-
return (_i$preRedos2 = i.preRedos) !== null && _i$preRedos2 !== void 0 ? _i$preRedos2 : [];
|
|
349
|
-
}).flat(),
|
|
332
|
+
preRedos: infos.map((i) => i.preRedos ?? []).flat(),
|
|
350
333
|
redos: infos.map((i) => i.redos).flat()
|
|
351
334
|
};
|
|
352
335
|
}
|
|
@@ -362,10 +345,7 @@ let SheetInterceptorService = class SheetInterceptorService extends _univerjs_co
|
|
|
362
345
|
interceptBeforeCommand(interceptor) {
|
|
363
346
|
if (this._beforeCommandInterceptor.includes(interceptor)) throw new Error("[SheetInterceptorService]: Interceptor already exists!");
|
|
364
347
|
this._beforeCommandInterceptor.push(interceptor);
|
|
365
|
-
this._beforeCommandInterceptor.sort((a, b) =>
|
|
366
|
-
var _b$priority4, _a$priority4;
|
|
367
|
-
return ((_b$priority4 = b.priority) !== null && _b$priority4 !== void 0 ? _b$priority4 : 0) - ((_a$priority4 = a.priority) !== null && _a$priority4 !== void 0 ? _a$priority4 : 0);
|
|
368
|
-
});
|
|
348
|
+
this._beforeCommandInterceptor.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
369
349
|
return this.disposeWithMe((0, _univerjs_core.toDisposable)(() => (0, _univerjs_core.remove)(this._beforeCommandInterceptor, interceptor)));
|
|
370
350
|
}
|
|
371
351
|
/**
|
|
@@ -384,24 +364,15 @@ let SheetInterceptorService = class SheetInterceptorService extends _univerjs_co
|
|
|
384
364
|
interceptRanges(interceptor) {
|
|
385
365
|
if (this._rangeInterceptors.includes(interceptor)) throw new Error("[SheetInterceptorService]: Interceptor already exists!");
|
|
386
366
|
this._rangeInterceptors.push(interceptor);
|
|
387
|
-
this._rangeInterceptors.sort((a, b) =>
|
|
388
|
-
var _b$priority5, _a$priority5;
|
|
389
|
-
return ((_b$priority5 = b.priority) !== null && _b$priority5 !== void 0 ? _b$priority5 : 0) - ((_a$priority5 = a.priority) !== null && _a$priority5 !== void 0 ? _a$priority5 : 0);
|
|
390
|
-
});
|
|
367
|
+
this._rangeInterceptors.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
391
368
|
return this.disposeWithMe((0, _univerjs_core.toDisposable)(() => (0, _univerjs_core.remove)(this._rangeInterceptors, interceptor)));
|
|
392
369
|
}
|
|
393
370
|
generateMutationsByRanges(info) {
|
|
394
371
|
const infos = this._rangeInterceptors.map((i) => i.getMutations(info));
|
|
395
372
|
return {
|
|
396
|
-
preUndos: infos.map((i) =>
|
|
397
|
-
var _i$preUndos3;
|
|
398
|
-
return (_i$preUndos3 = i.preUndos) !== null && _i$preUndos3 !== void 0 ? _i$preUndos3 : [];
|
|
399
|
-
}).flat(),
|
|
373
|
+
preUndos: infos.map((i) => i.preUndos ?? []).flat(),
|
|
400
374
|
undos: infos.map((i) => i.undos).flat(),
|
|
401
|
-
preRedos: infos.map((i) =>
|
|
402
|
-
var _i$preRedos3;
|
|
403
|
-
return (_i$preRedos3 = i.preRedos) !== null && _i$preRedos3 !== void 0 ? _i$preRedos3 : [];
|
|
404
|
-
}).flat(),
|
|
375
|
+
preRedos: infos.map((i) => i.preRedos ?? []).flat(),
|
|
405
376
|
redos: infos.map((i) => i.redos).flat()
|
|
406
377
|
};
|
|
407
378
|
}
|
|
@@ -433,10 +404,7 @@ let SheetInterceptorService = class SheetInterceptorService extends _univerjs_co
|
|
|
433
404
|
if (!this._interceptorsByName.has(key)) this._interceptorsByName.set(key, []);
|
|
434
405
|
const interceptors = this._interceptorsByName.get(key);
|
|
435
406
|
interceptors.push(interceptor);
|
|
436
|
-
const sortedInterceptors = interceptors.sort((a, b) =>
|
|
437
|
-
var _b$priority6, _a$priority6;
|
|
438
|
-
return ((_b$priority6 = b.priority) !== null && _b$priority6 !== void 0 ? _b$priority6 : 0) - ((_a$priority6 = a.priority) !== null && _a$priority6 !== void 0 ? _a$priority6 : 0);
|
|
439
|
-
});
|
|
407
|
+
const sortedInterceptors = interceptors.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
440
408
|
this._invalidateComposedInterceptors();
|
|
441
409
|
if (key === INTERCEPTOR_POINT.CELL_CONTENT) {
|
|
442
410
|
const JOINED_EFFECT = _univerjs_core.InterceptorEffectEnum.Style | _univerjs_core.InterceptorEffectEnum.Value;
|
|
@@ -461,7 +429,7 @@ let SheetInterceptorService = class SheetInterceptorService extends _univerjs_co
|
|
|
461
429
|
}
|
|
462
430
|
fetchThroughInterceptors(name, effect, _key, filter) {
|
|
463
431
|
const byNamesKey = effect === void 0 ? name : `${name}-${effect}`;
|
|
464
|
-
const key = _key
|
|
432
|
+
const key = _key ?? byNamesKey;
|
|
465
433
|
let composed = this._composedInterceptorByKey.get(key);
|
|
466
434
|
if (!composed) {
|
|
467
435
|
let interceptors = this._interceptorsByName.get(byNamesKey);
|
|
@@ -2170,7 +2138,7 @@ function handleStyle(styles, oldVal, newVal) {
|
|
|
2170
2138
|
*/
|
|
2171
2139
|
function transformStyle(oldStyle, newStyle) {
|
|
2172
2140
|
if (!newStyle || !Object.keys(newStyle).length) return oldStyle;
|
|
2173
|
-
const backupStyle = _univerjs_core.Tools.deepClone(oldStyle
|
|
2141
|
+
const backupStyle = _univerjs_core.Tools.deepClone(oldStyle ?? {}) || {};
|
|
2174
2142
|
const styleRecord = newStyle;
|
|
2175
2143
|
for (const key of _univerjs_core.STYLE_KEYS) {
|
|
2176
2144
|
if (!Object.prototype.hasOwnProperty.call(styleRecord, key)) continue;
|
|
@@ -2354,7 +2322,7 @@ const SetRangeValuesUndoMutationFactory = (accessor, params) => {
|
|
|
2354
2322
|
const cell = _univerjs_core.Tools.deepClone(cellMatrix === null || cellMatrix === void 0 ? void 0 : cellMatrix.getValue(row, col)) || {};
|
|
2355
2323
|
const oldStyle = styles.getStyleByCell(cell);
|
|
2356
2324
|
const newStyle = styles.getStyleByCell(newVal);
|
|
2357
|
-
cell.s = isOverrideStyle && Object.prototype.hasOwnProperty.call(newVal
|
|
2325
|
+
cell.s = isOverrideStyle && Object.prototype.hasOwnProperty.call(newVal ?? {}, "s") ? oldStyle ?? null : transformStyle(oldStyle, newStyle);
|
|
2358
2326
|
undoData.setValue(row, col, setNull(cell));
|
|
2359
2327
|
});
|
|
2360
2328
|
return {
|
|
@@ -2646,8 +2614,8 @@ const SetWorksheetRowHeightMutationFactory = (params, worksheet) => {
|
|
|
2646
2614
|
const rowHeight = {};
|
|
2647
2615
|
const manager = worksheet.getRowManager();
|
|
2648
2616
|
for (const { startRow, endRow } of ranges) for (let rowIndex = startRow; rowIndex < endRow + 1; rowIndex++) {
|
|
2649
|
-
var _manager$getRow
|
|
2650
|
-
rowHeight[rowIndex] = (
|
|
2617
|
+
var _manager$getRow;
|
|
2618
|
+
rowHeight[rowIndex] = ((_manager$getRow = manager.getRow(rowIndex)) === null || _manager$getRow === void 0 ? void 0 : _manager$getRow.h) ?? worksheet.getConfig().defaultRowHeight;
|
|
2651
2619
|
}
|
|
2652
2620
|
return {
|
|
2653
2621
|
unitId,
|
|
@@ -2676,11 +2644,11 @@ const SetWorksheetRowAutoHeightMutationFactory = (params, worksheet) => {
|
|
|
2676
2644
|
const results = [];
|
|
2677
2645
|
const manager = worksheet.getRowManager();
|
|
2678
2646
|
for (const rowInfo of rowsAutoHeightInfo) {
|
|
2679
|
-
var _manager$
|
|
2647
|
+
var _manager$getRow3;
|
|
2680
2648
|
const { row } = rowInfo;
|
|
2681
2649
|
results.push({
|
|
2682
2650
|
row,
|
|
2683
|
-
autoHeight: (
|
|
2651
|
+
autoHeight: ((_manager$getRow3 = manager.getRow(row)) === null || _manager$getRow3 === void 0 ? void 0 : _manager$getRow3.ah) ?? worksheet.getConfig().defaultRowHeight
|
|
2684
2652
|
});
|
|
2685
2653
|
}
|
|
2686
2654
|
return {
|
|
@@ -2714,10 +2682,7 @@ const SetWorksheetRowIsAutoHeightMutation = {
|
|
|
2714
2682
|
for (const { startRow, endRow } of ranges) for (let rowIndex = startRow; rowIndex <= endRow; rowIndex++) {
|
|
2715
2683
|
const row = manager.getRowOrCreate(rowIndex);
|
|
2716
2684
|
if (typeof autoHeightInfo === "number") row.ia = autoHeightInfo;
|
|
2717
|
-
else
|
|
2718
|
-
var _autoHeightInfo$rowIn;
|
|
2719
|
-
row.ia = (_autoHeightInfo$rowIn = autoHeightInfo[rowIndex]) !== null && _autoHeightInfo$rowIn !== void 0 ? _autoHeightInfo$rowIn : void 0;
|
|
2720
|
-
}
|
|
2685
|
+
else row.ia = autoHeightInfo[rowIndex] ?? void 0;
|
|
2721
2686
|
}
|
|
2722
2687
|
return true;
|
|
2723
2688
|
}
|
|
@@ -4253,8 +4218,7 @@ var WorkbookSelectionModel = class extends _univerjs_core.Disposable {
|
|
|
4253
4218
|
return this._worksheetSelections.get(sheetId);
|
|
4254
4219
|
}
|
|
4255
4220
|
getLastSelectionPrimaryCellOfWorksheet(sheetId) {
|
|
4256
|
-
|
|
4257
|
-
return (_this$_worksheetLastS = this._worksheetLastSelectionPrimaryCell.get(sheetId)) !== null && _this$_worksheetLastS !== void 0 ? _this$_worksheetLastS : null;
|
|
4221
|
+
return this._worksheetLastSelectionPrimaryCell.get(sheetId) ?? null;
|
|
4258
4222
|
}
|
|
4259
4223
|
setSelectionsOfWorksheet(sheetId, selections) {
|
|
4260
4224
|
this._worksheetSelections.set(sheetId, [...selections]);
|
|
@@ -4408,16 +4372,15 @@ let SheetsSelectionsService = class SheetsSelectionsService extends _univerjs_co
|
|
|
4408
4372
|
setSelections(unitIdOrSelections, worksheetIdOrType, selectionDatas, type) {
|
|
4409
4373
|
if (typeof unitIdOrSelections === "string" && typeof worksheetIdOrType === "string") {
|
|
4410
4374
|
const unitId = unitIdOrSelections;
|
|
4411
|
-
this._ensureWorkbookSelection(unitId).setSelections(worksheetIdOrType, selectionDatas || [], type
|
|
4375
|
+
this._ensureWorkbookSelection(unitId).setSelections(worksheetIdOrType, selectionDatas || [], type ?? 3);
|
|
4412
4376
|
return;
|
|
4413
4377
|
}
|
|
4414
4378
|
const current = this._currentSelectionPos;
|
|
4415
4379
|
if (!current) throw new Error("[SheetsSelectionsService]: cannot find current selection position!");
|
|
4416
4380
|
const { unitId, sheetId } = current;
|
|
4417
4381
|
if (typeof unitIdOrSelections === "object") {
|
|
4418
|
-
|
|
4419
|
-
const
|
|
4420
|
-
const type = (_ref = worksheetIdOrType) !== null && _ref !== void 0 ? _ref : 3;
|
|
4382
|
+
const selectionData = unitIdOrSelections ?? selectionDatas;
|
|
4383
|
+
const type = worksheetIdOrType ?? 3;
|
|
4421
4384
|
this._ensureWorkbookSelection(unitId).setSelections(sheetId, selectionData, type);
|
|
4422
4385
|
}
|
|
4423
4386
|
}
|
|
@@ -5115,12 +5078,11 @@ const MoveRangeCommand = {
|
|
|
5115
5078
|
}
|
|
5116
5079
|
};
|
|
5117
5080
|
function _resolveMoveRangeContext(accessor, params) {
|
|
5118
|
-
var _ref, _params$toUnitId, _params$fromSubUnitId, _ref2, _params$toSubUnitId;
|
|
5119
5081
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
5120
5082
|
const target = getSheetCommandTarget(univerInstanceService);
|
|
5121
|
-
const unitId =
|
|
5122
|
-
const fromSubUnitId =
|
|
5123
|
-
const toSubUnitId =
|
|
5083
|
+
const unitId = params.toUnitId ?? params.fromUnitId ?? (target === null || target === void 0 ? void 0 : target.unitId);
|
|
5084
|
+
const fromSubUnitId = params.fromSubUnitId ?? (target === null || target === void 0 ? void 0 : target.subUnitId);
|
|
5085
|
+
const toSubUnitId = params.toSubUnitId ?? params.fromSubUnitId ?? (target === null || target === void 0 ? void 0 : target.subUnitId);
|
|
5124
5086
|
if (!unitId || !fromSubUnitId || !toSubUnitId) return null;
|
|
5125
5087
|
if (params.fromUnitId && params.toUnitId && params.fromUnitId !== params.toUnitId) return null;
|
|
5126
5088
|
const workbook = univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
@@ -5136,7 +5098,6 @@ function _resolveMoveRangeContext(accessor, params) {
|
|
|
5136
5098
|
};
|
|
5137
5099
|
}
|
|
5138
5100
|
function getMoveRangeCommandMutations(accessor, params, options = {}) {
|
|
5139
|
-
var _interceptorCommands$, _interceptorCommands$2;
|
|
5140
5101
|
const { includeSelection = true, includeAfterCommand = true, includeAutoHeight = true } = options;
|
|
5141
5102
|
const context = _resolveMoveRangeContext(accessor, params);
|
|
5142
5103
|
if (!context) return null;
|
|
@@ -5158,12 +5119,12 @@ function getMoveRangeCommandMutations(accessor, params, options = {}) {
|
|
|
5158
5119
|
};
|
|
5159
5120
|
const interceptorCommands = sheetInterceptorService.onCommandExecute(commandInfo);
|
|
5160
5121
|
const redos = [
|
|
5161
|
-
...
|
|
5122
|
+
...interceptorCommands.preRedos ?? [],
|
|
5162
5123
|
...moveRangeMutations.redos,
|
|
5163
5124
|
...interceptorCommands.redos
|
|
5164
5125
|
];
|
|
5165
5126
|
const undos = [
|
|
5166
|
-
...
|
|
5127
|
+
...interceptorCommands.preUndos ?? [],
|
|
5167
5128
|
...moveRangeMutations.undos,
|
|
5168
5129
|
...interceptorCommands.undos
|
|
5169
5130
|
];
|
|
@@ -5231,8 +5192,7 @@ function getMoveRangeUndoRedoMutations(accessor, from, to, ignoreMerge = false)
|
|
|
5231
5192
|
const toRedoCellValue = new _univerjs_core.ObjectMatrix();
|
|
5232
5193
|
const toUndoCellValue = new _univerjs_core.ObjectMatrix();
|
|
5233
5194
|
_univerjs_core.Range.foreach(fromRange, (row, col) => {
|
|
5234
|
-
|
|
5235
|
-
const cellData = (_Tools$deepClone = _univerjs_core.Tools.deepClone(fromWorksheetCellMatrix.getValue(row, col))) !== null && _Tools$deepClone !== void 0 ? _Tools$deepClone : null;
|
|
5195
|
+
const cellData = _univerjs_core.Tools.deepClone(fromWorksheetCellMatrix.getValue(row, col)) ?? null;
|
|
5236
5196
|
if (cellData === null || cellData === void 0 ? void 0 : cellData.s) cellData.s = workbook.getStyles().get(cellData.s);
|
|
5237
5197
|
fromRedoCellValue.setValue(row, col, null);
|
|
5238
5198
|
fromUndoCellValue.setValue(row, col, cellData);
|
|
@@ -5242,8 +5202,7 @@ function getMoveRangeUndoRedoMutations(accessor, from, to, ignoreMerge = false)
|
|
|
5242
5202
|
toRedoCellValue.setValue(range.startRow, range.startColumn, _univerjs_core.Tools.deepClone(cellData));
|
|
5243
5203
|
});
|
|
5244
5204
|
_univerjs_core.Range.foreach(toRange, (row, col) => {
|
|
5245
|
-
|
|
5246
|
-
const cellData = (_Tools$deepClone2 = _univerjs_core.Tools.deepClone(toWorksheetCellMatrix.getValue(row, col))) !== null && _Tools$deepClone2 !== void 0 ? _Tools$deepClone2 : null;
|
|
5205
|
+
const cellData = _univerjs_core.Tools.deepClone(toWorksheetCellMatrix.getValue(row, col)) ?? null;
|
|
5247
5206
|
toUndoCellValue.setValue(row, col, cellData);
|
|
5248
5207
|
});
|
|
5249
5208
|
const redoMoveRangeMutationParams = {
|
|
@@ -5310,7 +5269,7 @@ const SetRangeValuesCommand = {
|
|
|
5310
5269
|
id: "sheet.command.set-range-values",
|
|
5311
5270
|
type: _univerjs_core.CommandType.COMMAND,
|
|
5312
5271
|
handler: (accessor, params) => {
|
|
5313
|
-
var _selectionManagerServ
|
|
5272
|
+
var _selectionManagerServ;
|
|
5314
5273
|
const target = getSheetCommandTarget(accessor.get(_univerjs_core.IUniverInstanceService), params);
|
|
5315
5274
|
if (!target) return false;
|
|
5316
5275
|
const currentSelections = (_selectionManagerServ = accessor.get(SheetsSelectionsService).getCurrentSelections()) === null || _selectionManagerServ === void 0 ? void 0 : _selectionManagerServ.map((s) => s.range);
|
|
@@ -5338,7 +5297,7 @@ const SetRangeValuesCommand = {
|
|
|
5338
5297
|
const setRangeValuesMutationRedoParams = {
|
|
5339
5298
|
unitId,
|
|
5340
5299
|
subUnitId,
|
|
5341
|
-
cellValue:
|
|
5300
|
+
cellValue: realCellValue ?? cellValue.getMatrix()
|
|
5342
5301
|
};
|
|
5343
5302
|
const setRangeValuesMutationUndoParams = SetRangeValuesUndoMutationFactory(accessor, setRangeValuesMutationRedoParams);
|
|
5344
5303
|
const cellHeights = (0, _univerjs_core.mapObjectMatrix)(setRangeValuesMutationRedoParams.cellValue, (row, col) => worksheet.getCellHeight(row, col) || void 0);
|
|
@@ -5630,7 +5589,6 @@ const DeleteRangeMoveLeftCommand = {
|
|
|
5630
5589
|
type: _univerjs_core.CommandType.COMMAND,
|
|
5631
5590
|
id: DeleteRangeMoveLeftCommandId,
|
|
5632
5591
|
handler: async (accessor, params) => {
|
|
5633
|
-
var _sheetInterceptor$pre, _sheetInterceptor$pre2;
|
|
5634
5592
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
5635
5593
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
5636
5594
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
@@ -5656,11 +5614,11 @@ const DeleteRangeMoveLeftCommand = {
|
|
|
5656
5614
|
params: { range }
|
|
5657
5615
|
});
|
|
5658
5616
|
const { redo: removeRangeRedo, undo: removeRangeUndo } = getRemoveRangeMutations(accessor, deleteRangeMutationParams);
|
|
5659
|
-
const redos = [...
|
|
5617
|
+
const redos = [...sheetInterceptor.preRedos ?? [], ...removeRangeRedo];
|
|
5660
5618
|
const undos = [...sheetInterceptor.undos, ...removeRangeUndo];
|
|
5661
5619
|
redos.push(...sheetInterceptor.redos);
|
|
5662
5620
|
redos.push(followSelectionOperation(range, workbook, worksheet));
|
|
5663
|
-
undos.push(...
|
|
5621
|
+
undos.push(...sheetInterceptor.preUndos ?? []);
|
|
5664
5622
|
if ((0, _univerjs_core.sequenceExecute)(redos, commandService).result) {
|
|
5665
5623
|
const afterInterceptors = sheetInterceptorService.afterCommandExecute({
|
|
5666
5624
|
id: DeleteRangeMoveLeftCommand.id,
|
|
@@ -5690,7 +5648,6 @@ const DeleteRangeMoveUpCommand = {
|
|
|
5690
5648
|
type: _univerjs_core.CommandType.COMMAND,
|
|
5691
5649
|
id: DeleteRangeMoveUpCommandId,
|
|
5692
5650
|
handler: async (accessor, params) => {
|
|
5693
|
-
var _sheetInterceptor$pre, _sheetInterceptor$pre2;
|
|
5694
5651
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
5695
5652
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
5696
5653
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
@@ -5716,11 +5673,11 @@ const DeleteRangeMoveUpCommand = {
|
|
|
5716
5673
|
params: { range }
|
|
5717
5674
|
});
|
|
5718
5675
|
const { redo: removeRangeRedo, undo: removeRangeUndo } = getRemoveRangeMutations(accessor, deleteRangeMutationParams);
|
|
5719
|
-
const redos = [...
|
|
5676
|
+
const redos = [...sheetInterceptor.preRedos ?? [], ...removeRangeRedo];
|
|
5720
5677
|
const undos = [...sheetInterceptor.undos, ...removeRangeUndo];
|
|
5721
5678
|
redos.push(...sheetInterceptor.redos);
|
|
5722
5679
|
redos.push(followSelectionOperation(range, workbook, worksheet));
|
|
5723
|
-
undos.push(...
|
|
5680
|
+
undos.push(...sheetInterceptor.preUndos ?? []);
|
|
5724
5681
|
if ((0, _univerjs_core.sequenceExecute)(redos, commandService).result) {
|
|
5725
5682
|
const afterInterceptors = sheetInterceptorService.afterCommandExecute({
|
|
5726
5683
|
id: DeleteRangeMoveUpCommand.id,
|
|
@@ -5750,7 +5707,6 @@ const InsertRangeMoveDownCommand = {
|
|
|
5750
5707
|
type: _univerjs_core.CommandType.COMMAND,
|
|
5751
5708
|
id: InsertRangeMoveDownCommandId,
|
|
5752
5709
|
handler: async (accessor, params) => {
|
|
5753
|
-
var _sheetInterceptor$pre, _sheetInterceptor$pre2;
|
|
5754
5710
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
5755
5711
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
5756
5712
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
@@ -5826,8 +5782,8 @@ const InsertRangeMoveDownCommand = {
|
|
|
5826
5782
|
});
|
|
5827
5783
|
redoMutations.push(...sheetInterceptor.redos);
|
|
5828
5784
|
redoMutations.push(followSelectionOperation(range, workbook, worksheet));
|
|
5829
|
-
undoMutations.push(...
|
|
5830
|
-
redoMutations.unshift(...
|
|
5785
|
+
undoMutations.push(...sheetInterceptor.preUndos ?? []);
|
|
5786
|
+
redoMutations.unshift(...sheetInterceptor.preRedos ?? []);
|
|
5831
5787
|
undoMutations.unshift(...sheetInterceptor.undos);
|
|
5832
5788
|
if ((0, _univerjs_core.sequenceExecute)(redoMutations, commandService).result) {
|
|
5833
5789
|
const afterInterceptors = sheetInterceptorService.afterCommandExecute({
|
|
@@ -5858,7 +5814,6 @@ const InsertRangeMoveRightCommand = {
|
|
|
5858
5814
|
type: _univerjs_core.CommandType.COMMAND,
|
|
5859
5815
|
id: InsertRangeMoveRightCommandId,
|
|
5860
5816
|
handler: async (accessor, params) => {
|
|
5861
|
-
var _sheetInterceptor$pre, _sheetInterceptor$pre2;
|
|
5862
5817
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
5863
5818
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
5864
5819
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
@@ -5934,8 +5889,8 @@ const InsertRangeMoveRightCommand = {
|
|
|
5934
5889
|
});
|
|
5935
5890
|
redoMutations.push(...sheetInterceptor.redos);
|
|
5936
5891
|
redoMutations.push(followSelectionOperation(range, workbook, worksheet));
|
|
5937
|
-
undoMutations.push(...
|
|
5938
|
-
redoMutations.unshift(...
|
|
5892
|
+
undoMutations.push(...sheetInterceptor.preUndos ?? []);
|
|
5893
|
+
redoMutations.unshift(...sheetInterceptor.preRedos ?? []);
|
|
5939
5894
|
undoMutations.unshift(...sheetInterceptor.undos);
|
|
5940
5895
|
if ((0, _univerjs_core.sequenceExecute)(redoMutations, commandService).result) {
|
|
5941
5896
|
const afterInterceptors = sheetInterceptorService.afterCommandExecute({
|
|
@@ -5988,7 +5943,6 @@ const InsertRowByRangeCommand = {
|
|
|
5988
5943
|
type: _univerjs_core.CommandType.COMMAND,
|
|
5989
5944
|
id: "sheet.command.insert-row-by-range",
|
|
5990
5945
|
handler: (accessor, params) => {
|
|
5991
|
-
var _intercepted$preRedos, _intercepted$redos, _intercepted$preUndos, _intercepted$undos;
|
|
5992
5946
|
const target = getSheetCommandTarget(accessor.get(_univerjs_core.IUniverInstanceService), params);
|
|
5993
5947
|
if (!target) throw new Error("Workbook or Worksheet not found at InsertRowByRangeCommand");
|
|
5994
5948
|
const { workbook, worksheet, unitId, subUnitId } = target;
|
|
@@ -6031,11 +5985,11 @@ const InsertRowByRangeCommand = {
|
|
|
6031
5985
|
id: InsertRowCommand.id,
|
|
6032
5986
|
params
|
|
6033
5987
|
});
|
|
6034
|
-
redos.unshift(...
|
|
6035
|
-
redos.push(...
|
|
5988
|
+
redos.unshift(...intercepted.preRedos ?? []);
|
|
5989
|
+
redos.push(...intercepted.redos ?? []);
|
|
6036
5990
|
redos.push(followSelectionOperation(range, workbook, worksheet));
|
|
6037
|
-
undos.unshift(...
|
|
6038
|
-
undos.push(...
|
|
5991
|
+
undos.unshift(...intercepted.preUndos ?? []);
|
|
5992
|
+
undos.push(...intercepted.undos ?? []);
|
|
6039
5993
|
if ((0, _univerjs_core.sequenceExecute)(redos, commandService).result) {
|
|
6040
5994
|
const afterInterceptors = sheetInterceptorService.afterCommandExecute({
|
|
6041
5995
|
id: InsertRowCommand.id,
|
|
@@ -6211,7 +6165,6 @@ const InsertColByRangeCommand = {
|
|
|
6211
6165
|
type: _univerjs_core.CommandType.COMMAND,
|
|
6212
6166
|
id: "sheet.command.insert-col-by-range",
|
|
6213
6167
|
handler: (accessor, params) => {
|
|
6214
|
-
var _intercepted$preRedos2, _intercepted$redos2, _intercepted$preUndos2, _intercepted$undos2;
|
|
6215
6168
|
const target = getSheetCommandTarget(accessor.get(_univerjs_core.IUniverInstanceService), params);
|
|
6216
6169
|
if (!target) throw new Error("Workbook or Worksheet not found at InsertColByRangeCommand");
|
|
6217
6170
|
const { workbook, worksheet, unitId, subUnitId } = target;
|
|
@@ -6254,11 +6207,11 @@ const InsertColByRangeCommand = {
|
|
|
6254
6207
|
id: InsertColCommand.id,
|
|
6255
6208
|
params
|
|
6256
6209
|
});
|
|
6257
|
-
redos.unshift(...
|
|
6258
|
-
redos.push(...
|
|
6210
|
+
redos.unshift(...intercepted.preRedos ?? []);
|
|
6211
|
+
redos.push(...intercepted.redos ?? []);
|
|
6259
6212
|
redos.push(followSelectionOperation(range, workbook, worksheet));
|
|
6260
|
-
undos.unshift(...
|
|
6261
|
-
undos.push(...
|
|
6213
|
+
undos.unshift(...intercepted.preUndos ?? []);
|
|
6214
|
+
undos.push(...intercepted.undos ?? []);
|
|
6262
6215
|
if ((0, _univerjs_core.sequenceExecute)(redos, commandService).result) {
|
|
6263
6216
|
const afterInterceptors = sheetInterceptorService.afterCommandExecute({
|
|
6264
6217
|
id: InsertColCommand.id,
|
|
@@ -6420,7 +6373,6 @@ const RemoveRowByRangeCommand = {
|
|
|
6420
6373
|
type: _univerjs_core.CommandType.COMMAND,
|
|
6421
6374
|
id: "sheet.command.remove-row-by-range",
|
|
6422
6375
|
handler: (accessor, params) => {
|
|
6423
|
-
var _intercepted$preRedos;
|
|
6424
6376
|
if (!params) return false;
|
|
6425
6377
|
const target = getSheetCommandTarget(accessor.get(_univerjs_core.IUniverInstanceService), params);
|
|
6426
6378
|
if (!target) return false;
|
|
@@ -6467,11 +6419,10 @@ const RemoveRowByRangeCommand = {
|
|
|
6467
6419
|
});
|
|
6468
6420
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
6469
6421
|
if ((0, _univerjs_core.sequenceExecute)([
|
|
6470
|
-
...
|
|
6422
|
+
...intercepted.preRedos ?? [],
|
|
6471
6423
|
...redoMutations,
|
|
6472
6424
|
...intercepted.redos
|
|
6473
6425
|
], commandService).result) {
|
|
6474
|
-
var _intercepted$preUndos, _intercepted$preRedos2;
|
|
6475
6426
|
setSelection(range, workbook, worksheet, commandService);
|
|
6476
6427
|
const afterInterceptors = sheetInterceptorService.afterCommandExecute({
|
|
6477
6428
|
id: RemoveRowCommandId,
|
|
@@ -6481,13 +6432,13 @@ const RemoveRowByRangeCommand = {
|
|
|
6481
6432
|
accessor.get(_univerjs_core.IUndoRedoService).pushUndoRedo({
|
|
6482
6433
|
unitID: unitId,
|
|
6483
6434
|
undoMutations: [
|
|
6484
|
-
...
|
|
6435
|
+
...intercepted.preUndos ?? [],
|
|
6485
6436
|
...undoMutations,
|
|
6486
6437
|
...intercepted.undos,
|
|
6487
6438
|
...afterInterceptors.undos
|
|
6488
6439
|
],
|
|
6489
6440
|
redoMutations: [
|
|
6490
|
-
...
|
|
6441
|
+
...intercepted.preRedos ?? [],
|
|
6491
6442
|
...redoMutations,
|
|
6492
6443
|
...intercepted.redos,
|
|
6493
6444
|
...afterInterceptors.redos
|
|
@@ -6539,7 +6490,6 @@ const RemoveColByRangeCommand = {
|
|
|
6539
6490
|
type: _univerjs_core.CommandType.COMMAND,
|
|
6540
6491
|
id: "sheet.command.remove-col-by-range",
|
|
6541
6492
|
handler: (accessor, params) => {
|
|
6542
|
-
var _intercepted$preRedos3;
|
|
6543
6493
|
if (!params) return false;
|
|
6544
6494
|
const target = getSheetCommandTarget(accessor.get(_univerjs_core.IUniverInstanceService), params);
|
|
6545
6495
|
if (!target) return false;
|
|
@@ -6564,14 +6514,13 @@ const RemoveColByRangeCommand = {
|
|
|
6564
6514
|
});
|
|
6565
6515
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
6566
6516
|
if ((0, _univerjs_core.sequenceExecute)([
|
|
6567
|
-
...
|
|
6517
|
+
...intercepted.preRedos ?? [],
|
|
6568
6518
|
{
|
|
6569
6519
|
id: RemoveColMutation.id,
|
|
6570
6520
|
params: removeColParams
|
|
6571
6521
|
},
|
|
6572
6522
|
...intercepted.redos
|
|
6573
6523
|
], commandService).result) {
|
|
6574
|
-
var _intercepted$preUndos2, _intercepted$preRedos4;
|
|
6575
6524
|
setSelection(range, workbook, worksheet, commandService);
|
|
6576
6525
|
const afterInterceptors = sheetInterceptorService.afterCommandExecute({
|
|
6577
6526
|
id: RemoveColCommandId,
|
|
@@ -6581,7 +6530,7 @@ const RemoveColByRangeCommand = {
|
|
|
6581
6530
|
accessor.get(_univerjs_core.IUndoRedoService).pushUndoRedo({
|
|
6582
6531
|
unitID: unitId,
|
|
6583
6532
|
undoMutations: [
|
|
6584
|
-
...
|
|
6533
|
+
...intercepted.preUndos ?? [],
|
|
6585
6534
|
{
|
|
6586
6535
|
id: InsertColMutation.id,
|
|
6587
6536
|
params: undoRemoveColParams
|
|
@@ -6594,7 +6543,7 @@ const RemoveColByRangeCommand = {
|
|
|
6594
6543
|
...afterInterceptors.undos
|
|
6595
6544
|
],
|
|
6596
6545
|
redoMutations: [
|
|
6597
|
-
...
|
|
6546
|
+
...intercepted.preRedos ?? [],
|
|
6598
6547
|
{
|
|
6599
6548
|
id: RemoveColMutation.id,
|
|
6600
6549
|
params: removeColParams
|
|
@@ -6696,7 +6645,6 @@ const MoveRowsCommand = {
|
|
|
6696
6645
|
id: MoveRowsCommandId,
|
|
6697
6646
|
type: _univerjs_core.CommandType.COMMAND,
|
|
6698
6647
|
handler: (accessor, params) => {
|
|
6699
|
-
var _interceptorCommands$, _interceptorCommands$2;
|
|
6700
6648
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
6701
6649
|
const { fromRange: { startRow: fromRow }, toRange: { startRow: toRow }, range } = params;
|
|
6702
6650
|
const selections = range ? [covertRangeToSelection(range)] : selectionManagerService.getCurrentSelections();
|
|
@@ -6738,11 +6686,11 @@ const MoveRowsCommand = {
|
|
|
6738
6686
|
id: MoveRowsCommand.id,
|
|
6739
6687
|
params
|
|
6740
6688
|
});
|
|
6741
|
-
const redos = [...
|
|
6689
|
+
const redos = [...interceptorCommands.preRedos ?? [], {
|
|
6742
6690
|
id: MoveRowsMutation.id,
|
|
6743
6691
|
params: moveRowsParams
|
|
6744
6692
|
}];
|
|
6745
|
-
const undos = [...
|
|
6693
|
+
const undos = [...interceptorCommands.preUndos ?? [], {
|
|
6746
6694
|
id: MoveRowsMutation.id,
|
|
6747
6695
|
params: undoMoveRowsParams
|
|
6748
6696
|
}];
|
|
@@ -6808,7 +6756,6 @@ const MoveColsCommand = {
|
|
|
6808
6756
|
id: MoveColsCommandId,
|
|
6809
6757
|
type: _univerjs_core.CommandType.COMMAND,
|
|
6810
6758
|
handler: (accessor, params) => {
|
|
6811
|
-
var _interceptorCommands$3, _interceptorCommands$4;
|
|
6812
6759
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
6813
6760
|
const { fromRange: { startColumn: fromCol }, toRange: { startColumn: toCol }, range } = params;
|
|
6814
6761
|
const selections = range ? [covertRangeToSelection(range)] : selectionManagerService.getCurrentSelections();
|
|
@@ -6850,11 +6797,11 @@ const MoveColsCommand = {
|
|
|
6850
6797
|
id: MoveColsCommand.id,
|
|
6851
6798
|
params
|
|
6852
6799
|
});
|
|
6853
|
-
const redos = [...
|
|
6800
|
+
const redos = [...interceptorCommands.preRedos ?? [], {
|
|
6854
6801
|
id: MoveColsMutation.id,
|
|
6855
6802
|
params: moveColsParams
|
|
6856
6803
|
}];
|
|
6857
|
-
const undos = [...
|
|
6804
|
+
const undos = [...interceptorCommands.preUndos ?? [], {
|
|
6858
6805
|
id: MoveColsMutation.id,
|
|
6859
6806
|
params: undoMoveColsParams
|
|
6860
6807
|
}];
|
|
@@ -6929,7 +6876,6 @@ const ReorderRangeCommand = {
|
|
|
6929
6876
|
id: ReorderRangeCommandId,
|
|
6930
6877
|
type: _univerjs_core.CommandType.COMMAND,
|
|
6931
6878
|
handler: (accessor, params) => {
|
|
6932
|
-
var _interceptorCommands$, _interceptorCommands$2;
|
|
6933
6879
|
const { subUnitId, unitId, range, order } = params;
|
|
6934
6880
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
6935
6881
|
const reorderMutation = {
|
|
@@ -6951,12 +6897,12 @@ const ReorderRangeCommand = {
|
|
|
6951
6897
|
params
|
|
6952
6898
|
});
|
|
6953
6899
|
const redos = [
|
|
6954
|
-
...
|
|
6900
|
+
...interceptorCommands.preRedos ?? [],
|
|
6955
6901
|
reorderMutation,
|
|
6956
6902
|
...interceptorCommands.redos
|
|
6957
6903
|
];
|
|
6958
6904
|
const undos = [
|
|
6959
|
-
...
|
|
6905
|
+
...interceptorCommands.preUndos ?? [],
|
|
6960
6906
|
undoReorderMutation,
|
|
6961
6907
|
...interceptorCommands.undos
|
|
6962
6908
|
];
|
|
@@ -7175,9 +7121,8 @@ const handleReorderRangeCommon = (param, targetRange) => {
|
|
|
7175
7121
|
const cacheMatrix = new _univerjs_core.ObjectMatrix();
|
|
7176
7122
|
_univerjs_core.Range.foreach(range, (row, col) => {
|
|
7177
7123
|
if (Object.prototype.hasOwnProperty.call(order, row)) {
|
|
7178
|
-
var _matrix$getValue;
|
|
7179
7124
|
const targetRow = order[row];
|
|
7180
|
-
const cloneCell =
|
|
7125
|
+
const cloneCell = matrix.getValue(targetRow, col) ?? 0;
|
|
7181
7126
|
cacheMatrix.setValue(row, col, cloneCell);
|
|
7182
7127
|
}
|
|
7183
7128
|
});
|
|
@@ -7271,10 +7216,9 @@ const handleMoveRangeCommon = (param, targetRange) => {
|
|
|
7271
7216
|
endRow: toRange.endRow - rowOffset
|
|
7272
7217
|
};
|
|
7273
7218
|
loopToRange && _univerjs_core.Range.foreach(loopToRange, (row, col) => {
|
|
7274
|
-
var _fromMatrix$getValue;
|
|
7275
7219
|
const targetRow = row + rowOffset;
|
|
7276
7220
|
const targetCol = col + columnOffset;
|
|
7277
|
-
matrix.setValue(targetRow, targetCol,
|
|
7221
|
+
matrix.setValue(targetRow, targetCol, fromMatrix.getValue(row, col) ?? 0);
|
|
7278
7222
|
});
|
|
7279
7223
|
return (0, _univerjs_core.queryObjectMatrix)(matrix, (value) => value === 1);
|
|
7280
7224
|
};
|
|
@@ -7626,8 +7570,7 @@ const handleDeleteRangeMoveUpCommon = (param, targetRange) => {
|
|
|
7626
7570
|
return (0, _univerjs_core.queryObjectMatrix)(matrix, (v) => v === 1);
|
|
7627
7571
|
};
|
|
7628
7572
|
const handleRemoveRowCommon = (param, targetRange) => {
|
|
7629
|
-
|
|
7630
|
-
const mergedRemoved = (0, _univerjs_core.mergeIntervals)(((_param$ranges = param.ranges) !== null && _param$ranges !== void 0 ? _param$ranges : [param.range]).map((range) => [range.startRow, range.endRow]));
|
|
7573
|
+
const mergedRemoved = (0, _univerjs_core.mergeIntervals)((param.ranges ?? [param.range]).map((range) => [range.startRow, range.endRow]));
|
|
7631
7574
|
let targetStartRow = targetRange.startRow;
|
|
7632
7575
|
let targetEndRow = targetRange.endRow;
|
|
7633
7576
|
for (let i = mergedRemoved.length - 1; i >= 0; i--) {
|
|
@@ -8178,8 +8121,9 @@ function getSeparateEffectedRangesOnCommand(accessor, command) {
|
|
|
8178
8121
|
const MERGE_REDO = (0, _univerjs_core.createInterceptorKey)("MERGE_REDO");
|
|
8179
8122
|
const MERGE_UNDO = (0, _univerjs_core.createInterceptorKey)("MERGE_UNDO");
|
|
8180
8123
|
var WatchRange = class extends _univerjs_core.Disposable {
|
|
8181
|
-
constructor(_unitId, _subUnitId, _range, _callback, _skipIntersects = false) {
|
|
8124
|
+
constructor(revision, _unitId, _subUnitId, _range, _callback, _skipIntersects = false) {
|
|
8182
8125
|
super();
|
|
8126
|
+
this.revision = revision;
|
|
8183
8127
|
this._unitId = _unitId;
|
|
8184
8128
|
this._subUnitId = _subUnitId;
|
|
8185
8129
|
this._range = _range;
|
|
@@ -8218,6 +8162,8 @@ let RefRangeService = class RefRangeService extends _univerjs_core.Disposable {
|
|
|
8218
8162
|
MERGE_UNDO
|
|
8219
8163
|
}));
|
|
8220
8164
|
_defineProperty(this, "_watchRanges", /* @__PURE__ */ new Set());
|
|
8165
|
+
_defineProperty(this, "_watchRangesListener", null);
|
|
8166
|
+
_defineProperty(this, "_watchRangeRevision", 0);
|
|
8221
8167
|
_defineProperty(this, "_refRangeManagerMap", /* @__PURE__ */ new Map());
|
|
8222
8168
|
_defineProperty(this, "_serializer", createRangeSerializer());
|
|
8223
8169
|
_defineProperty(this, "_onRefRangeChange", () => {
|
|
@@ -8249,15 +8195,14 @@ let RefRangeService = class RefRangeService extends _univerjs_core.Disposable {
|
|
|
8249
8195
|
}], unitId, subUnitId);
|
|
8250
8196
|
}
|
|
8251
8197
|
case EffectRefRangId.MoveRangeCommandId: {
|
|
8252
|
-
var _params$toUnitId, _params$toSubUnitId;
|
|
8253
8198
|
const params = command.params;
|
|
8254
8199
|
const sourceTarget = getSheetCommandTarget(this._univerInstanceService, {
|
|
8255
8200
|
unitId: params.fromUnitId,
|
|
8256
8201
|
subUnitId: params.fromSubUnitId
|
|
8257
8202
|
});
|
|
8258
8203
|
const destinationTarget = getSheetCommandTarget(this._univerInstanceService, {
|
|
8259
|
-
unitId:
|
|
8260
|
-
subUnitId:
|
|
8204
|
+
unitId: params.toUnitId ?? params.fromUnitId,
|
|
8205
|
+
subUnitId: params.toSubUnitId ?? params.fromSubUnitId
|
|
8261
8206
|
});
|
|
8262
8207
|
if (!sourceTarget && !destinationTarget) return [];
|
|
8263
8208
|
if (sourceTarget && destinationTarget && sourceTarget.unitId === destinationTarget.unitId && sourceTarget.subUnitId === destinationTarget.subUnitId) return this._checkRange([params.fromRange, params.toRange], sourceTarget.unitId, sourceTarget.subUnitId);
|
|
@@ -8375,11 +8320,10 @@ let RefRangeService = class RefRangeService extends _univerjs_core.Disposable {
|
|
|
8375
8320
|
result.push(v);
|
|
8376
8321
|
return result;
|
|
8377
8322
|
}, []).reduce((result, currentValue) => {
|
|
8378
|
-
var _currentValue$preRedo, _currentValue$preUndo;
|
|
8379
8323
|
result.redos.push(...currentValue.redos);
|
|
8380
8324
|
result.undos.push(...currentValue.undos);
|
|
8381
|
-
result.preRedos.push(...
|
|
8382
|
-
result.preUndos.push(...
|
|
8325
|
+
result.preRedos.push(...currentValue.preRedos ?? []);
|
|
8326
|
+
result.preUndos.push(...currentValue.preUndos ?? []);
|
|
8383
8327
|
return result;
|
|
8384
8328
|
}, {
|
|
8385
8329
|
redos: [],
|
|
@@ -8470,18 +8414,22 @@ let RefRangeService = class RefRangeService extends _univerjs_core.Disposable {
|
|
|
8470
8414
|
});
|
|
8471
8415
|
}
|
|
8472
8416
|
watchRange(unitId, subUnitId, range, callback, skipIntersects) {
|
|
8473
|
-
|
|
8474
|
-
if (this._watchRanges.size === 0) watchRangesListener = this._commandService.onCommandExecuted((command) => {
|
|
8417
|
+
if (!this._watchRangesListener) this._watchRangesListener = this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
|
|
8475
8418
|
if (command.type !== _univerjs_core.CommandType.MUTATION) return false;
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8419
|
+
const revision = this._watchRangeRevision;
|
|
8420
|
+
for (const watchRange of this._watchRanges) {
|
|
8421
|
+
if (watchRange.revision > revision) continue;
|
|
8422
|
+
watchRange.onMutation(command);
|
|
8423
|
+
}
|
|
8424
|
+
}));
|
|
8425
|
+
const watchRange = new WatchRange(++this._watchRangeRevision, unitId, subUnitId, range, callback, skipIntersects);
|
|
8479
8426
|
this._watchRanges.add(watchRange);
|
|
8480
8427
|
const teardownWatching = (0, _univerjs_core.toDisposable)(() => {
|
|
8481
8428
|
this._watchRanges.delete(watchRange);
|
|
8482
8429
|
if (this._watchRanges.size === 0) {
|
|
8483
|
-
|
|
8484
|
-
|
|
8430
|
+
var _this$_watchRangesLis;
|
|
8431
|
+
(_this$_watchRangesLis = this._watchRangesListener) === null || _this$_watchRangesLis === void 0 || _this$_watchRangesLis.dispose();
|
|
8432
|
+
this._watchRangesListener = null;
|
|
8485
8433
|
}
|
|
8486
8434
|
});
|
|
8487
8435
|
const registerToService = this.disposeWithMe(teardownWatching);
|
|
@@ -8875,11 +8823,10 @@ let MergeCellController = class MergeCellController extends _univerjs_core.Dispo
|
|
|
8875
8823
|
};
|
|
8876
8824
|
}
|
|
8877
8825
|
_handleMoveRangeCommand(params, unitId, subUnitId) {
|
|
8878
|
-
var _params$fromSubUnitId, _params$toSubUnitId;
|
|
8879
8826
|
const workbook = getWorkbook(this._univerInstanceService, unitId);
|
|
8880
8827
|
if (!workbook) return this._handleNull();
|
|
8881
|
-
const sourceSubUnitId =
|
|
8882
|
-
const targetSubUnitId =
|
|
8828
|
+
const sourceSubUnitId = params.fromSubUnitId ?? subUnitId;
|
|
8829
|
+
const targetSubUnitId = params.toSubUnitId ?? sourceSubUnitId;
|
|
8883
8830
|
const sourceWorksheet = getWorksheet(workbook, sourceSubUnitId);
|
|
8884
8831
|
const targetWorksheet = getWorksheet(workbook, targetSubUnitId);
|
|
8885
8832
|
if (!sourceWorksheet || !targetWorksheet) return this._handleNull();
|
|
@@ -9797,8 +9744,8 @@ function getClearContentMutationParamForRange(worksheet, range) {
|
|
|
9797
9744
|
let leftTopCellValue = null;
|
|
9798
9745
|
cellMatrix.forValue((row, col, cellData) => {
|
|
9799
9746
|
if (cellData && row >= startRow && col >= startColumn) {
|
|
9800
|
-
var _cellData$p
|
|
9801
|
-
if (!leftTopCellValue && worksheet.cellHasValue(cellData) && (cellData.v !== "" || ((
|
|
9747
|
+
var _cellData$p;
|
|
9748
|
+
if (!leftTopCellValue && worksheet.cellHasValue(cellData) && (cellData.v !== "" || (((_cellData$p = cellData.p) === null || _cellData$p === void 0 || (_cellData$p = _cellData$p.body) === null || _cellData$p === void 0 || (_cellData$p = _cellData$p.dataStream) === null || _cellData$p === void 0 ? void 0 : _cellData$p.length) ?? 0) > 2)) leftTopCellValue = cellData;
|
|
9802
9749
|
redoMatrix.setValue(row, col, cellData.s ? {
|
|
9803
9750
|
v: null,
|
|
9804
9751
|
t: null,
|
|
@@ -12621,7 +12568,6 @@ function splitCellDataIntoBatches(unitId, subUnitId, cellData, batchSize) {
|
|
|
12621
12568
|
}
|
|
12622
12569
|
const COPY_SHEET_COMMAND_ID = "sheet.command.copy-sheet";
|
|
12623
12570
|
function buildCopySheetMutations(accessor, workbook, worksheet, unitId, subUnitId, localeService, sheetInterceptorService) {
|
|
12624
|
-
var _intercepted$preRedos, _intercepted$preUndos;
|
|
12625
12571
|
const pluginConfig = accessor.get(_univerjs_core.IConfigService).getConfig(SHEETS_PLUGIN_CONFIG_KEY);
|
|
12626
12572
|
const largeSheetConfig = {
|
|
12627
12573
|
...defaultLargeSheetOperationConfig,
|
|
@@ -12666,7 +12612,7 @@ function buildCopySheetMutations(accessor, workbook, worksheet, unitId, subUnitI
|
|
|
12666
12612
|
});
|
|
12667
12613
|
return {
|
|
12668
12614
|
redos: [
|
|
12669
|
-
...
|
|
12615
|
+
...intercepted.preRedos ?? [],
|
|
12670
12616
|
{
|
|
12671
12617
|
id: InsertSheetMutation.id,
|
|
12672
12618
|
params: insertSheetMutationParams
|
|
@@ -12674,7 +12620,7 @@ function buildCopySheetMutations(accessor, workbook, worksheet, unitId, subUnitI
|
|
|
12674
12620
|
...intercepted.redos
|
|
12675
12621
|
],
|
|
12676
12622
|
undos: [
|
|
12677
|
-
...
|
|
12623
|
+
...intercepted.preUndos ?? [],
|
|
12678
12624
|
{
|
|
12679
12625
|
id: RemoveSheetMutation.id,
|
|
12680
12626
|
params: removeSheetMutationParams
|
|
@@ -12889,8 +12835,7 @@ const InsertSheetCommand = {
|
|
|
12889
12835
|
const sheetName = sheet === null || sheet === void 0 ? void 0 : sheet.name;
|
|
12890
12836
|
const sheetConfig = (0, _univerjs_core.mergeWorksheetSnapshotWithDefault)(sheet || {});
|
|
12891
12837
|
if (params) {
|
|
12892
|
-
|
|
12893
|
-
index = (_params$index = params.index) !== null && _params$index !== void 0 ? _params$index : index;
|
|
12838
|
+
index = params.index ?? index;
|
|
12894
12839
|
sheetConfig.id = sheetId || (0, _univerjs_core.generateRandomId)();
|
|
12895
12840
|
sheetConfig.name = sheetName ? workbook.uniqueSheetName(sheetName) : workbook.generateNewSheetName(`${localeService.t("sheets.tabs.sheet")}`);
|
|
12896
12841
|
} else {
|
|
@@ -13005,7 +12950,6 @@ const RemoveDefinedNameCommand = {
|
|
|
13005
12950
|
id: "sheet.command.remove-defined-name",
|
|
13006
12951
|
type: _univerjs_core.CommandType.COMMAND,
|
|
13007
12952
|
handler: (accessor, params) => {
|
|
13008
|
-
var _interceptorCommands$, _interceptorCommands$2;
|
|
13009
12953
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
13010
12954
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
13011
12955
|
const sheetInterceptorService = accessor.get(SheetInterceptorService);
|
|
@@ -13016,7 +12960,7 @@ const RemoveDefinedNameCommand = {
|
|
|
13016
12960
|
params
|
|
13017
12961
|
});
|
|
13018
12962
|
const redos = [
|
|
13019
|
-
...
|
|
12963
|
+
...interceptorCommands.preRedos ?? [],
|
|
13020
12964
|
{
|
|
13021
12965
|
id: _univerjs_engine_formula.RemoveDefinedNameMutation.id,
|
|
13022
12966
|
params: removeSheetMutationParams
|
|
@@ -13024,7 +12968,7 @@ const RemoveDefinedNameCommand = {
|
|
|
13024
12968
|
...interceptorCommands.redos
|
|
13025
12969
|
];
|
|
13026
12970
|
const undos = [
|
|
13027
|
-
...
|
|
12971
|
+
...interceptorCommands.preUndos ?? [],
|
|
13028
12972
|
{
|
|
13029
12973
|
id: _univerjs_engine_formula.SetDefinedNameMutation.id,
|
|
13030
12974
|
params: removeSheetMutationParams
|
|
@@ -13052,7 +12996,6 @@ const RemoveSheetCommand = {
|
|
|
13052
12996
|
id: "sheet.command.remove-sheet",
|
|
13053
12997
|
type: _univerjs_core.CommandType.COMMAND,
|
|
13054
12998
|
handler: (accessor, params) => {
|
|
13055
|
-
var _intercepted$preRedos, _intercepted$preUndos;
|
|
13056
12999
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
13057
13000
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
13058
13001
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
@@ -13082,7 +13025,7 @@ const RemoveSheetCommand = {
|
|
|
13082
13025
|
}
|
|
13083
13026
|
});
|
|
13084
13027
|
const redos = [
|
|
13085
|
-
...
|
|
13028
|
+
...intercepted.preRedos ?? [],
|
|
13086
13029
|
{
|
|
13087
13030
|
id: RemoveSheetMutation.id,
|
|
13088
13031
|
params: RemoveSheetMutationParams
|
|
@@ -13090,7 +13033,7 @@ const RemoveSheetCommand = {
|
|
|
13090
13033
|
...intercepted.redos
|
|
13091
13034
|
];
|
|
13092
13035
|
const undos = isLargeSheet ? [] : [
|
|
13093
|
-
...
|
|
13036
|
+
...intercepted.preUndos ?? [],
|
|
13094
13037
|
{
|
|
13095
13038
|
id: InsertSheetMutation.id,
|
|
13096
13039
|
params: InsertSheetMutationParams
|
|
@@ -13620,7 +13563,6 @@ const SetSpecificColsVisibleCommand = {
|
|
|
13620
13563
|
});
|
|
13621
13564
|
const interceptedResult = (0, _univerjs_core.sequenceExecute)([...intercepted.redos], commandService);
|
|
13622
13565
|
if (result.result && interceptedResult.result) {
|
|
13623
|
-
var _intercepted$undos, _intercepted$preRedos;
|
|
13624
13566
|
const afterInterceptors = sheetInterceptorService.afterCommandExecute({
|
|
13625
13567
|
id: SetSpecificColsVisibleCommand.id,
|
|
13626
13568
|
params
|
|
@@ -13637,11 +13579,11 @@ const SetSpecificColsVisibleCommand = {
|
|
|
13637
13579
|
id: SetSelectionsOperation.id,
|
|
13638
13580
|
params: undoSetSelectionsOperationParams
|
|
13639
13581
|
},
|
|
13640
|
-
...
|
|
13582
|
+
...intercepted.undos ?? [],
|
|
13641
13583
|
...afterInterceptors.undos
|
|
13642
13584
|
],
|
|
13643
13585
|
redoMutations: [
|
|
13644
|
-
...
|
|
13586
|
+
...intercepted.preRedos ?? [],
|
|
13645
13587
|
{
|
|
13646
13588
|
id: SetColVisibleMutation.id,
|
|
13647
13589
|
params: redoMutationParams
|
|
@@ -13731,7 +13673,6 @@ const SetColHiddenCommand = {
|
|
|
13731
13673
|
});
|
|
13732
13674
|
const interceptedResult = (0, _univerjs_core.sequenceExecute)([...intercepted.redos], commandService);
|
|
13733
13675
|
if (result.result && interceptedResult.result) {
|
|
13734
|
-
var _intercepted$undos2, _intercepted$preRedos2;
|
|
13735
13676
|
const afterInterceptors = sheetInterceptorService.afterCommandExecute({
|
|
13736
13677
|
id: SetColHiddenCommand.id,
|
|
13737
13678
|
params: redoMutationParams
|
|
@@ -13748,11 +13689,11 @@ const SetColHiddenCommand = {
|
|
|
13748
13689
|
id: SetSelectionsOperation.id,
|
|
13749
13690
|
params: undoSetSelectionsOperationParams
|
|
13750
13691
|
},
|
|
13751
|
-
...
|
|
13692
|
+
...intercepted.undos ?? [],
|
|
13752
13693
|
...afterInterceptors.undos
|
|
13753
13694
|
],
|
|
13754
13695
|
redoMutations: [
|
|
13755
|
-
...
|
|
13696
|
+
...intercepted.preRedos ?? [],
|
|
13756
13697
|
{
|
|
13757
13698
|
id: SetColHiddenMutation.id,
|
|
13758
13699
|
params: redoMutationParams
|
|
@@ -13861,7 +13802,6 @@ const SetDefinedNameCommand = {
|
|
|
13861
13802
|
id: "sheet.command.set-defined-name",
|
|
13862
13803
|
type: _univerjs_core.CommandType.COMMAND,
|
|
13863
13804
|
handler: (accessor, params) => {
|
|
13864
|
-
var _interceptorCommands$, _interceptorCommands$2;
|
|
13865
13805
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
13866
13806
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
13867
13807
|
const sheetInterceptorService = accessor.get(SheetInterceptorService);
|
|
@@ -13873,7 +13813,7 @@ const SetDefinedNameCommand = {
|
|
|
13873
13813
|
params
|
|
13874
13814
|
});
|
|
13875
13815
|
const redos = [
|
|
13876
|
-
...
|
|
13816
|
+
...interceptorCommands.preRedos ?? [],
|
|
13877
13817
|
...oldDefinedNameMutationParams ? [{
|
|
13878
13818
|
id: _univerjs_engine_formula.RemoveDefinedNameMutation.id,
|
|
13879
13819
|
params: oldDefinedNameMutationParams
|
|
@@ -13885,7 +13825,7 @@ const SetDefinedNameCommand = {
|
|
|
13885
13825
|
...interceptorCommands.redos
|
|
13886
13826
|
];
|
|
13887
13827
|
const undos = [
|
|
13888
|
-
...
|
|
13828
|
+
...interceptorCommands.preUndos ?? [],
|
|
13889
13829
|
{
|
|
13890
13830
|
id: _univerjs_engine_formula.RemoveDefinedNameMutation.id,
|
|
13891
13831
|
params: newDefinedNameMutationParams
|
|
@@ -14351,7 +14291,6 @@ const SetSpecificRowsVisibleCommand = {
|
|
|
14351
14291
|
});
|
|
14352
14292
|
const interceptedResult = (0, _univerjs_core.sequenceExecute)([...intercepted.redos], commandService);
|
|
14353
14293
|
if (result.result && interceptedResult.result) {
|
|
14354
|
-
var _intercepted$preUndos, _intercepted$undos, _intercepted$preRedos;
|
|
14355
14294
|
const afterInterceptors = sheetInterceptorService.afterCommandExecute({
|
|
14356
14295
|
id: SetSpecificRowsVisibleCommand.id,
|
|
14357
14296
|
params
|
|
@@ -14360,7 +14299,7 @@ const SetSpecificRowsVisibleCommand = {
|
|
|
14360
14299
|
undoRedoService.pushUndoRedo({
|
|
14361
14300
|
unitID: unitId,
|
|
14362
14301
|
undoMutations: [
|
|
14363
|
-
...
|
|
14302
|
+
...intercepted.preUndos ?? [],
|
|
14364
14303
|
{
|
|
14365
14304
|
id: SetRowHiddenMutation.id,
|
|
14366
14305
|
params: undoMutationParams
|
|
@@ -14369,11 +14308,11 @@ const SetSpecificRowsVisibleCommand = {
|
|
|
14369
14308
|
id: SetSelectionsOperation.id,
|
|
14370
14309
|
params: undoSetSelectionsOperationParams
|
|
14371
14310
|
},
|
|
14372
|
-
...
|
|
14311
|
+
...intercepted.undos ?? [],
|
|
14373
14312
|
...afterInterceptors.undos
|
|
14374
14313
|
],
|
|
14375
14314
|
redoMutations: [
|
|
14376
|
-
...
|
|
14315
|
+
...intercepted.preRedos ?? [],
|
|
14377
14316
|
{
|
|
14378
14317
|
id: SetRowVisibleMutation.id,
|
|
14379
14318
|
params: redoMutationParams
|
|
@@ -14415,7 +14354,7 @@ const SetRowHiddenCommand = {
|
|
|
14415
14354
|
type: _univerjs_core.CommandType.COMMAND,
|
|
14416
14355
|
id: "sheet.command.set-rows-hidden",
|
|
14417
14356
|
handler: (accessor, params) => {
|
|
14418
|
-
var _params$ranges
|
|
14357
|
+
var _params$ranges;
|
|
14419
14358
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
14420
14359
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
14421
14360
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
@@ -14457,7 +14396,7 @@ const SetRowHiddenCommand = {
|
|
|
14457
14396
|
params: redoMutationParams
|
|
14458
14397
|
});
|
|
14459
14398
|
if ((0, _univerjs_core.sequenceExecute)([
|
|
14460
|
-
...
|
|
14399
|
+
...intercepted.preRedos ?? [],
|
|
14461
14400
|
{
|
|
14462
14401
|
id: SetRowHiddenMutation.id,
|
|
14463
14402
|
params: redoMutationParams
|
|
@@ -14468,7 +14407,6 @@ const SetRowHiddenCommand = {
|
|
|
14468
14407
|
},
|
|
14469
14408
|
...intercepted.redos
|
|
14470
14409
|
], commandService).result) {
|
|
14471
|
-
var _intercepted$preUndos2, _intercepted$undos2, _intercepted$preRedos3;
|
|
14472
14410
|
const afterInterceptors = sheetInterceptorService.afterCommandExecute({
|
|
14473
14411
|
id: SetRowHiddenCommand.id,
|
|
14474
14412
|
params: redoMutationParams
|
|
@@ -14477,7 +14415,7 @@ const SetRowHiddenCommand = {
|
|
|
14477
14415
|
undoRedoService.pushUndoRedo({
|
|
14478
14416
|
unitID: unitId,
|
|
14479
14417
|
undoMutations: [
|
|
14480
|
-
...
|
|
14418
|
+
...intercepted.preUndos ?? [],
|
|
14481
14419
|
{
|
|
14482
14420
|
id: SetRowVisibleMutation.id,
|
|
14483
14421
|
params: undoMutationParams
|
|
@@ -14486,11 +14424,11 @@ const SetRowHiddenCommand = {
|
|
|
14486
14424
|
id: SetSelectionsOperation.id,
|
|
14487
14425
|
params: undoSetSelectionsOperationParams
|
|
14488
14426
|
},
|
|
14489
|
-
...
|
|
14427
|
+
...intercepted.undos ?? [],
|
|
14490
14428
|
...afterInterceptors.undos
|
|
14491
14429
|
],
|
|
14492
14430
|
redoMutations: [
|
|
14493
|
-
...
|
|
14431
|
+
...intercepted.preRedos ?? [],
|
|
14494
14432
|
{
|
|
14495
14433
|
id: SetRowHiddenMutation.id,
|
|
14496
14434
|
params: redoMutationParams
|
|
@@ -14662,7 +14600,6 @@ const SetWorkbookNameCommand = {
|
|
|
14662
14600
|
type: _univerjs_core.CommandType.COMMAND,
|
|
14663
14601
|
id: "sheet.command.set-workbook-name",
|
|
14664
14602
|
handler: (accessor, params) => {
|
|
14665
|
-
var _interceptedCommands$;
|
|
14666
14603
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
14667
14604
|
const sheetInterceptorService = accessor.get(SheetInterceptorService);
|
|
14668
14605
|
if (!getSheetCommandTargetWorkbook(accessor.get(_univerjs_core.IUniverInstanceService), params)) return false;
|
|
@@ -14675,7 +14612,7 @@ const SetWorkbookNameCommand = {
|
|
|
14675
14612
|
unitId: params.unitId
|
|
14676
14613
|
};
|
|
14677
14614
|
return (0, _univerjs_core.sequenceExecute)([
|
|
14678
|
-
...
|
|
14615
|
+
...interceptedCommands.preRedos ?? [],
|
|
14679
14616
|
{
|
|
14680
14617
|
id: SetWorkbookNameMutation.id,
|
|
14681
14618
|
params: redoMutationParams
|
|
@@ -14851,7 +14788,6 @@ const SetColWidthCommand = {
|
|
|
14851
14788
|
});
|
|
14852
14789
|
const result = (0, _univerjs_core.sequenceExecute)([...intercepted.redos, ...autoHeightRedos], commandService);
|
|
14853
14790
|
if (setColWidthResult && result.result) {
|
|
14854
|
-
var _intercepted$preUndos, _intercepted$preRedos;
|
|
14855
14791
|
const afterInterceptors = sheetInterceptorService.afterCommandExecute({
|
|
14856
14792
|
id: SetColWidthCommand.id,
|
|
14857
14793
|
params: redoMutationParams
|
|
@@ -14860,7 +14796,7 @@ const SetColWidthCommand = {
|
|
|
14860
14796
|
undoRedoService.pushUndoRedo({
|
|
14861
14797
|
unitID: unitId,
|
|
14862
14798
|
undoMutations: [
|
|
14863
|
-
...
|
|
14799
|
+
...intercepted.preUndos ?? [],
|
|
14864
14800
|
{
|
|
14865
14801
|
id: SetWorksheetColWidthMutation.id,
|
|
14866
14802
|
params: undoMutationParams
|
|
@@ -14870,7 +14806,7 @@ const SetColWidthCommand = {
|
|
|
14870
14806
|
...autoHeightUndos
|
|
14871
14807
|
],
|
|
14872
14808
|
redoMutations: [
|
|
14873
|
-
...
|
|
14809
|
+
...intercepted.preRedos ?? [],
|
|
14874
14810
|
{
|
|
14875
14811
|
id: SetWorksheetColWidthMutation.id,
|
|
14876
14812
|
params: redoMutationParams
|
|
@@ -15086,7 +15022,6 @@ const SetWorksheetNameCommand = {
|
|
|
15086
15022
|
type: _univerjs_core.CommandType.COMMAND,
|
|
15087
15023
|
id: "sheet.command.set-worksheet-name",
|
|
15088
15024
|
handler: (accessor, params) => {
|
|
15089
|
-
var _interceptorCommands$, _interceptorCommands$2;
|
|
15090
15025
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
15091
15026
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
15092
15027
|
const sheetInterceptorService = accessor.get(SheetInterceptorService);
|
|
@@ -15104,7 +15039,7 @@ const SetWorksheetNameCommand = {
|
|
|
15104
15039
|
params
|
|
15105
15040
|
});
|
|
15106
15041
|
const redos = [
|
|
15107
|
-
...
|
|
15042
|
+
...interceptorCommands.preRedos ?? [],
|
|
15108
15043
|
{
|
|
15109
15044
|
id: SetWorksheetNameMutation.id,
|
|
15110
15045
|
params: redoMutationParams
|
|
@@ -15112,7 +15047,7 @@ const SetWorksheetNameCommand = {
|
|
|
15112
15047
|
...interceptorCommands.redos
|
|
15113
15048
|
];
|
|
15114
15049
|
const undos = [
|
|
15115
|
-
...
|
|
15050
|
+
...interceptorCommands.preUndos ?? [],
|
|
15116
15051
|
{
|
|
15117
15052
|
id: SetWorksheetNameMutation.id,
|
|
15118
15053
|
params: undoMutationParams
|
|
@@ -16413,10 +16348,7 @@ const SetWorksheetRightToLeftCommand = {
|
|
|
16413
16348
|
if (!target) return false;
|
|
16414
16349
|
const { unitId, subUnitId } = target;
|
|
16415
16350
|
let rightToLeft = _univerjs_core.BooleanNumber.FALSE;
|
|
16416
|
-
if (params)
|
|
16417
|
-
var _params$rightToLeft;
|
|
16418
|
-
rightToLeft = (_params$rightToLeft = params.rightToLeft) !== null && _params$rightToLeft !== void 0 ? _params$rightToLeft : _univerjs_core.BooleanNumber.FALSE;
|
|
16419
|
-
}
|
|
16351
|
+
if (params) rightToLeft = params.rightToLeft ?? _univerjs_core.BooleanNumber.FALSE;
|
|
16420
16352
|
const setWorksheetRightToLeftMutationParams = {
|
|
16421
16353
|
rightToLeft,
|
|
16422
16354
|
unitId,
|
|
@@ -16549,7 +16481,6 @@ const DeltaRowHeightCommand = {
|
|
|
16549
16481
|
}], commandService);
|
|
16550
16482
|
const interceptedResult = (0, _univerjs_core.sequenceExecute)([...intercepted.redos], commandService);
|
|
16551
16483
|
if (result.result && interceptedResult.result) {
|
|
16552
|
-
var _intercepted$preUndos, _intercepted$preRedos;
|
|
16553
16484
|
const afterInterceptors = sheetInterceptorService.afterCommandExecute({
|
|
16554
16485
|
id: DeltaRowHeightCommand.id,
|
|
16555
16486
|
params: redoMutationParams
|
|
@@ -16558,7 +16489,7 @@ const DeltaRowHeightCommand = {
|
|
|
16558
16489
|
undoRedoService.pushUndoRedo({
|
|
16559
16490
|
unitID: unitId,
|
|
16560
16491
|
undoMutations: [
|
|
16561
|
-
...
|
|
16492
|
+
...intercepted.preUndos ?? [],
|
|
16562
16493
|
{
|
|
16563
16494
|
id: SetWorksheetRowHeightMutation.id,
|
|
16564
16495
|
params: undoMutationParams
|
|
@@ -16571,7 +16502,7 @@ const DeltaRowHeightCommand = {
|
|
|
16571
16502
|
...afterInterceptors.undos
|
|
16572
16503
|
],
|
|
16573
16504
|
redoMutations: [
|
|
16574
|
-
...
|
|
16505
|
+
...intercepted.preRedos ?? [],
|
|
16575
16506
|
{
|
|
16576
16507
|
id: SetWorksheetRowHeightMutation.id,
|
|
16577
16508
|
params: redoMutationParams
|
|
@@ -16631,7 +16562,6 @@ const SetRowHeightCommand = {
|
|
|
16631
16562
|
});
|
|
16632
16563
|
const sheetInterceptorResult = (0, _univerjs_core.sequenceExecute)([...intercepted.redos], commandService);
|
|
16633
16564
|
if (result.result && sheetInterceptorResult.result) {
|
|
16634
|
-
var _intercepted$preRedos2, _intercepted$preRedos3;
|
|
16635
16565
|
const afterInterceptors = sheetInterceptorService.afterCommandExecute({
|
|
16636
16566
|
id: SetRowHeightCommand.id,
|
|
16637
16567
|
params: redoMutationParams
|
|
@@ -16640,7 +16570,7 @@ const SetRowHeightCommand = {
|
|
|
16640
16570
|
undoRedoService.pushUndoRedo({
|
|
16641
16571
|
unitID: unitId,
|
|
16642
16572
|
undoMutations: [
|
|
16643
|
-
...
|
|
16573
|
+
...intercepted.preRedos ?? [],
|
|
16644
16574
|
{
|
|
16645
16575
|
id: SetWorksheetRowHeightMutation.id,
|
|
16646
16576
|
params: undoMutationParams
|
|
@@ -16653,7 +16583,7 @@ const SetRowHeightCommand = {
|
|
|
16653
16583
|
...afterInterceptors.undos
|
|
16654
16584
|
],
|
|
16655
16585
|
redoMutations: [
|
|
16656
|
-
...
|
|
16586
|
+
...intercepted.preRedos ?? [],
|
|
16657
16587
|
{
|
|
16658
16588
|
id: SetWorksheetRowHeightMutation.id,
|
|
16659
16589
|
params: redoMutationParams
|
|
@@ -17853,14 +17783,14 @@ const effectedByOnlyLocalMutationIds = [
|
|
|
17853
17783
|
];
|
|
17854
17784
|
let SheetsFreezeSyncController = class SheetsFreezeSyncController extends _univerjs_core.Disposable {
|
|
17855
17785
|
constructor(_univerInstanceService, _commandService, _configService) {
|
|
17856
|
-
var _this$_configService
|
|
17786
|
+
var _this$_configService$;
|
|
17857
17787
|
super();
|
|
17858
17788
|
this._univerInstanceService = _univerInstanceService;
|
|
17859
17789
|
this._commandService = _commandService;
|
|
17860
17790
|
this._configService = _configService;
|
|
17861
17791
|
_defineProperty(this, "_d", new _univerjs_core.DisposableCollection());
|
|
17862
17792
|
_defineProperty(this, "_enabled", true);
|
|
17863
|
-
const freezeSync = (
|
|
17793
|
+
const freezeSync = ((_this$_configService$ = this._configService.getConfig("sheets.config")) === null || _this$_configService$ === void 0 ? void 0 : _this$_configService$.freezeSync) ?? true;
|
|
17864
17794
|
this.setEnabled(freezeSync);
|
|
17865
17795
|
}
|
|
17866
17796
|
getEnabled() {
|
|
@@ -18280,7 +18210,7 @@ let SheetPermissionCheckController = class SheetPermissionCheckController extend
|
|
|
18280
18210
|
})) return false;
|
|
18281
18211
|
if (rangeTypes && rangeTypes.length > 0) {
|
|
18282
18212
|
var _this$_selectionManag;
|
|
18283
|
-
const ranges = selectionRanges
|
|
18213
|
+
const ranges = selectionRanges ?? ((_this$_selectionManag = this._selectionManagerService.getCurrentSelections()) === null || _this$_selectionManag === void 0 ? void 0 : _this$_selectionManag.map((s) => s.range));
|
|
18284
18214
|
if (!ranges) return false;
|
|
18285
18215
|
const rules = this._rangeProtectionRuleModel.getSubunitRuleList(_unitId, _subUnitId);
|
|
18286
18216
|
if (rules.length === 0) return true;
|
|
@@ -18497,11 +18427,11 @@ let SheetPermissionCheckController = class SheetPermissionCheckController extend
|
|
|
18497
18427
|
return true;
|
|
18498
18428
|
}
|
|
18499
18429
|
_permissionCheckWithInsertOrDeleteMoveRange(direction, params) {
|
|
18500
|
-
var
|
|
18430
|
+
var _this$_selectionManag3;
|
|
18501
18431
|
const target = getSheetCommandTarget(this._univerInstanceService);
|
|
18502
18432
|
if (!target) return false;
|
|
18503
18433
|
const { worksheet, unitId, subUnitId } = target;
|
|
18504
|
-
const range = (
|
|
18434
|
+
const range = (params === null || params === void 0 ? void 0 : params.range) ?? ((_this$_selectionManag3 = this._selectionManagerService.getCurrentLastSelection()) === null || _this$_selectionManag3 === void 0 ? void 0 : _this$_selectionManag3.range);
|
|
18505
18435
|
if (!range) return false;
|
|
18506
18436
|
if (!this.permissionCheckWithRanges({
|
|
18507
18437
|
workbookTypes: [WorkbookEditablePermission],
|
|
@@ -19085,10 +19015,9 @@ let RangeProtectionRenderModel = class RangeProtectionRenderModel extends _unive
|
|
|
19085
19015
|
const result = [];
|
|
19086
19016
|
for (const rule of ruleMap) if (rule.ranges.some((range) => range.startRow <= row && range.endRow >= row && range.startColumn <= col && range.endColumn >= col)) {
|
|
19087
19017
|
const permissionMap = getAllRangePermissionPoint().reduce((result, F) => {
|
|
19088
|
-
var _permission$value;
|
|
19089
19018
|
const instance = new F(unitId, subUnitId, rule.permissionId);
|
|
19090
19019
|
const permission = this._permissionService.getPermissionPoint(instance.id);
|
|
19091
|
-
result[instance.subType] = (
|
|
19020
|
+
result[instance.subType] = (permission === null || permission === void 0 ? void 0 : permission.value) ?? instance.value;
|
|
19092
19021
|
return result;
|
|
19093
19022
|
}, {});
|
|
19094
19023
|
result.push({
|
|
@@ -19244,11 +19173,11 @@ let RangeProtectionCache = class RangeProtectionCache extends _univerjs_core.Dis
|
|
|
19244
19173
|
this._permissionIdCache.delete(rule.permissionId);
|
|
19245
19174
|
}
|
|
19246
19175
|
_getSelectionActions(unitId, subUnitId, rule) {
|
|
19247
|
-
var _this$_permissionServ,
|
|
19248
|
-
const edit = (_this$_permissionServ =
|
|
19249
|
-
const view = (
|
|
19250
|
-
const manageProtection = (
|
|
19251
|
-
const deleteProtection = (
|
|
19176
|
+
var _this$_permissionServ, _RangeProtectionPermi, _this$_permissionServ2, _RangeProtectionPermi2, _this$_permissionServ3, _RangeProtectionPermi3, _this$_permissionServ4, _RangeProtectionPermi4;
|
|
19177
|
+
const edit = ((_this$_permissionServ = this._permissionService.getPermissionPoint((_RangeProtectionPermi = new RangeProtectionPermissionEditPoint(unitId, subUnitId, rule.permissionId)) === null || _RangeProtectionPermi === void 0 ? void 0 : _RangeProtectionPermi.id)) === null || _this$_permissionServ === void 0 ? void 0 : _this$_permissionServ.value) ?? false;
|
|
19178
|
+
const view = ((_this$_permissionServ2 = this._permissionService.getPermissionPoint((_RangeProtectionPermi2 = new RangeProtectionPermissionViewPoint(unitId, subUnitId, rule.permissionId)) === null || _RangeProtectionPermi2 === void 0 ? void 0 : _RangeProtectionPermi2.id)) === null || _this$_permissionServ2 === void 0 ? void 0 : _this$_permissionServ2.value) ?? false;
|
|
19179
|
+
const manageProtection = ((_this$_permissionServ3 = this._permissionService.getPermissionPoint((_RangeProtectionPermi3 = new RangeProtectionPermissionManageCollaPoint(unitId, subUnitId, rule.permissionId)) === null || _RangeProtectionPermi3 === void 0 ? void 0 : _RangeProtectionPermi3.id)) === null || _this$_permissionServ3 === void 0 ? void 0 : _this$_permissionServ3.value) ?? false;
|
|
19180
|
+
const deleteProtection = ((_this$_permissionServ4 = this._permissionService.getPermissionPoint((_RangeProtectionPermi4 = new RangeProtectionPermissionDeleteProtectionPoint(unitId, subUnitId, rule.permissionId)) === null || _RangeProtectionPermi4 === void 0 ? void 0 : _RangeProtectionPermi4.id)) === null || _this$_permissionServ4 === void 0 ? void 0 : _this$_permissionServ4.value) ?? false;
|
|
19252
19181
|
return {
|
|
19253
19182
|
[_univerjs_protocol.UnitAction.Edit]: edit,
|
|
19254
19183
|
[_univerjs_protocol.UnitAction.View]: view,
|
|
@@ -19396,7 +19325,7 @@ RangeProtectionCache = __decorate([
|
|
|
19396
19325
|
//#endregion
|
|
19397
19326
|
//#region package.json
|
|
19398
19327
|
var name = "@univerjs/sheets";
|
|
19399
|
-
var version = "1.0.0-
|
|
19328
|
+
var version = "1.0.0-beta.0";
|
|
19400
19329
|
|
|
19401
19330
|
//#endregion
|
|
19402
19331
|
//#region src/controllers/active-worksheet.controller.ts
|
|
@@ -19503,7 +19432,6 @@ const ONLY_REGISTER_FORMULA_RELATED_MUTATIONS_KEY = "ONLY_REGISTER_FORMULA_RELAT
|
|
|
19503
19432
|
//#region src/controllers/basic-worksheet.controller.ts
|
|
19504
19433
|
let BasicWorksheetController = class BasicWorksheetController extends _univerjs_core.Disposable {
|
|
19505
19434
|
constructor(_commandService, _configService, _dataSyncPrimaryController) {
|
|
19506
|
-
var _this$_configService$;
|
|
19507
19435
|
super();
|
|
19508
19436
|
this._commandService = _commandService;
|
|
19509
19437
|
this._configService = _configService;
|
|
@@ -19545,7 +19473,7 @@ let BasicWorksheetController = class BasicWorksheetController extends _univerjs_
|
|
|
19545
19473
|
this._commandService.registerCommand(mutation);
|
|
19546
19474
|
(_this$_dataSyncPrimar = this._dataSyncPrimaryController) === null || _this$_dataSyncPrimar === void 0 || _this$_dataSyncPrimar.registerSyncingMutations(mutation);
|
|
19547
19475
|
});
|
|
19548
|
-
if (!(
|
|
19476
|
+
if (!(this._configService.getConfig("ONLY_REGISTER_FORMULA_RELATED_MUTATIONS_KEY") ?? false)) [
|
|
19549
19477
|
AddWorksheetMergeCommand,
|
|
19550
19478
|
AddWorksheetMergeAllCommand,
|
|
19551
19479
|
AddWorksheetMergeVerticalCommand,
|
|
@@ -19783,10 +19711,10 @@ let SheetPermissionViewModelController = class SheetPermissionViewModelControlle
|
|
|
19783
19711
|
const { unitId, subUnitId } = context;
|
|
19784
19712
|
const worksheetRule = this._worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
19785
19713
|
if (worksheetRule === null || worksheetRule === void 0 ? void 0 : worksheetRule.permissionId) {
|
|
19786
|
-
var _this$_permissionServ, _this$_permissionServ2,
|
|
19714
|
+
var _this$_permissionServ, _this$_permissionServ2, _selectionProtection$;
|
|
19787
19715
|
const selectionProtection = [{
|
|
19788
|
-
[_univerjs_protocol.UnitAction.View]: (_this$_permissionServ =
|
|
19789
|
-
[_univerjs_protocol.UnitAction.Edit]: (
|
|
19716
|
+
[_univerjs_protocol.UnitAction.View]: ((_this$_permissionServ = this._permissionService.getPermissionPoint(new WorksheetViewPermission(unitId, subUnitId).id)) === null || _this$_permissionServ === void 0 ? void 0 : _this$_permissionServ.value) ?? false,
|
|
19717
|
+
[_univerjs_protocol.UnitAction.Edit]: ((_this$_permissionServ2 = this._permissionService.getPermissionPoint(new WorksheetEditPermission(unitId, subUnitId).id)) === null || _this$_permissionServ2 === void 0 ? void 0 : _this$_permissionServ2.value) ?? false
|
|
19790
19718
|
}];
|
|
19791
19719
|
const isSkipRender = !((_selectionProtection$ = selectionProtection[0]) === null || _selectionProtection$ === void 0 ? void 0 : _selectionProtection$[_univerjs_protocol.UnitAction.View]);
|
|
19792
19720
|
const _cellData = !cell || cell === context.rawData ? { ...cell } : cell;
|
|
@@ -21857,6 +21785,7 @@ exports.handleInsertRow = handleInsertRow;
|
|
|
21857
21785
|
exports.handleMoveCols = handleMoveCols;
|
|
21858
21786
|
exports.handleMoveRange = handleMoveRange;
|
|
21859
21787
|
exports.handleMoveRows = handleMoveRows;
|
|
21788
|
+
exports.isCellImage = isCellImage;
|
|
21860
21789
|
exports.isSingleCellSelection = isSingleCellSelection;
|
|
21861
21790
|
exports.rangeMerge = rangeMerge;
|
|
21862
21791
|
exports.rangeToDiscreteRange = rangeToDiscreteRange;
|