@univerjs/sheets 1.0.0-rc.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +211 -110
- package/lib/cjs/index.js +350 -246
- package/lib/cjs/locale/ar-SA.js +0 -1
- package/lib/cjs/locale/ca-ES.js +0 -1
- package/lib/cjs/locale/de-DE.js +0 -1
- package/lib/cjs/locale/en-US.js +0 -1
- package/lib/cjs/locale/es-ES.js +0 -1
- package/lib/cjs/locale/fa-IR.js +0 -1
- package/lib/cjs/locale/fr-FR.js +0 -1
- package/lib/cjs/locale/id-ID.js +0 -1
- package/lib/cjs/locale/it-IT.js +0 -1
- package/lib/cjs/locale/ja-JP.js +0 -1
- package/lib/cjs/locale/ko-KR.js +0 -1
- package/lib/cjs/locale/pl-PL.js +0 -1
- package/lib/cjs/locale/pt-BR.js +0 -1
- package/lib/cjs/locale/ru-RU.js +0 -1
- package/lib/cjs/locale/sk-SK.js +0 -1
- package/lib/cjs/locale/vi-VN.js +0 -1
- package/lib/cjs/locale/zh-CN.js +0 -1
- package/lib/cjs/locale/zh-HK.js +0 -1
- package/lib/cjs/locale/zh-TW.js +0 -1
- package/lib/es/facade.js +212 -111
- package/lib/es/index.js +351 -248
- package/lib/facade.js +212 -111
- package/lib/index.js +351 -248
- package/lib/types/commands/commands/set-worksheet-hide.command.d.ts +4 -0
- package/lib/types/commands/mutations/set-range-values.mutation.d.ts +12 -1
- package/lib/types/commands/mutations/set-worksheet-hide.mutation.d.ts +2 -1
- package/lib/types/controllers/calculate-result-apply.controller.d.ts +1 -1
- package/lib/types/facade/f-defined-name.d.ts +2 -2
- package/lib/types/facade/f-range.d.ts +118 -45
- package/lib/types/facade/f-selection.d.ts +1 -1
- package/lib/types/facade/f-univer.d.ts +4 -5
- package/lib/types/facade/f-workbook.d.ts +8 -13
- package/lib/types/facade/f-worksheet.d.ts +43 -28
- package/lib/types/facade/permission/f-range-permission.d.ts +1 -1
- package/lib/types/facade/permission/f-range-protection-rule.d.ts +2 -2
- package/lib/types/facade/permission/f-workbook-permission.d.ts +3 -3
- package/lib/types/facade/permission/f-worksheet-permission.d.ts +5 -4
- package/lib/types/facade/utils.d.ts +1 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/services/auto-fill/tools.d.ts +2 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +2 -2
- package/package.json +9 -9
package/lib/cjs/index.js
CHANGED
|
@@ -119,6 +119,8 @@ function extractBooleanValue(value) {
|
|
|
119
119
|
function setNull(value) {
|
|
120
120
|
if (value == null) return null;
|
|
121
121
|
if (value.f === void 0) value.f = null;
|
|
122
|
+
if (value.ft === void 0) value.ft = null;
|
|
123
|
+
if (value.fd === void 0) value.fd = null;
|
|
122
124
|
if (value.si === void 0) value.si = null;
|
|
123
125
|
if (value.p === void 0) value.p = null;
|
|
124
126
|
if (value.v === void 0) value.v = null;
|
|
@@ -217,7 +219,7 @@ const RangeThemeInterceptorId = "sheet.interceptor.range-theme-id";
|
|
|
217
219
|
const IgnoreRangeThemeInterceptorKey = "sheet.interceptor.ignore-range-theme";
|
|
218
220
|
|
|
219
221
|
//#endregion
|
|
220
|
-
//#region \0@oxc-project+runtime@0.
|
|
222
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
|
|
221
223
|
function _typeof(o) {
|
|
222
224
|
"@babel/helpers - typeof";
|
|
223
225
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -228,7 +230,7 @@ function _typeof(o) {
|
|
|
228
230
|
}
|
|
229
231
|
|
|
230
232
|
//#endregion
|
|
231
|
-
//#region \0@oxc-project+runtime@0.
|
|
233
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
|
|
232
234
|
function toPrimitive(t, r) {
|
|
233
235
|
if ("object" != _typeof(t) || !t) return t;
|
|
234
236
|
var e = t[Symbol.toPrimitive];
|
|
@@ -241,14 +243,14 @@ function toPrimitive(t, r) {
|
|
|
241
243
|
}
|
|
242
244
|
|
|
243
245
|
//#endregion
|
|
244
|
-
//#region \0@oxc-project+runtime@0.
|
|
246
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
|
|
245
247
|
function toPropertyKey(t) {
|
|
246
248
|
var i = toPrimitive(t, "string");
|
|
247
249
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
248
250
|
}
|
|
249
251
|
|
|
250
252
|
//#endregion
|
|
251
|
-
//#region \0@oxc-project+runtime@0.
|
|
253
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
|
|
252
254
|
function _defineProperty(e, r, t) {
|
|
253
255
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
254
256
|
value: t,
|
|
@@ -259,7 +261,7 @@ function _defineProperty(e, r, t) {
|
|
|
259
261
|
}
|
|
260
262
|
|
|
261
263
|
//#endregion
|
|
262
|
-
//#region \0@oxc-project+runtime@0.
|
|
264
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
|
|
263
265
|
function __decorateParam(paramIndex, decorator) {
|
|
264
266
|
return function(target, key) {
|
|
265
267
|
decorator(target, key, paramIndex);
|
|
@@ -267,7 +269,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
267
269
|
}
|
|
268
270
|
|
|
269
271
|
//#endregion
|
|
270
|
-
//#region \0@oxc-project+runtime@0.
|
|
272
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
|
|
271
273
|
function __decorate(decorators, target, key, desc) {
|
|
272
274
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
273
275
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1710,7 +1712,8 @@ const MoveRowsMutation = {
|
|
|
1710
1712
|
const fromRow = sourceRange.startRow;
|
|
1711
1713
|
const count = sourceRange.endRow - sourceRange.startRow + 1;
|
|
1712
1714
|
const toRow = targetRange.startRow;
|
|
1713
|
-
|
|
1715
|
+
const rowWrapper = worksheet.getRowManager().getRowData();
|
|
1716
|
+
(0, _univerjs_core.moveMatrixArray)(fromRow, count, toRow, rowWrapper);
|
|
1714
1717
|
worksheet.getCellMatrix().moveRows(fromRow, count, toRow);
|
|
1715
1718
|
return true;
|
|
1716
1719
|
}
|
|
@@ -1752,7 +1755,8 @@ const MoveColsMutation = {
|
|
|
1752
1755
|
const fromCol = sourceRange.startColumn;
|
|
1753
1756
|
const count = sourceRange.endColumn - sourceRange.startColumn + 1;
|
|
1754
1757
|
const toCol = targetRange.startColumn;
|
|
1755
|
-
|
|
1758
|
+
const columnWrapper = worksheet.getColumnManager().getColumnData();
|
|
1759
|
+
(0, _univerjs_core.moveMatrixArray)(fromCol, count, toCol, columnWrapper);
|
|
1756
1760
|
worksheet.getCellMatrix().moveColumns(fromCol, count, toCol);
|
|
1757
1761
|
return true;
|
|
1758
1762
|
}
|
|
@@ -1764,7 +1768,8 @@ const RemoveRowsUndoMutationFactory = (params, worksheet) => {
|
|
|
1764
1768
|
const rowWrapper = worksheet.getRowManager().getRowData();
|
|
1765
1769
|
const rowInfo = {};
|
|
1766
1770
|
const range = params.range;
|
|
1767
|
-
const
|
|
1771
|
+
const slice = (0, _univerjs_core.sliceMatrixArray)(range.startRow, range.endRow, rowWrapper);
|
|
1772
|
+
const _rowInfo = (0, _univerjs_core.concatMatrixArray)(rowInfo, slice);
|
|
1768
1773
|
return {
|
|
1769
1774
|
unitId: params.unitId,
|
|
1770
1775
|
subUnitId: params.subUnitId,
|
|
@@ -1799,7 +1804,8 @@ const RemoveColMutationFactory = (accessor, params) => {
|
|
|
1799
1804
|
const columnWrapper = worksheet.getColumnManager().getColumnData();
|
|
1800
1805
|
const colInfo = {};
|
|
1801
1806
|
const range = params.range;
|
|
1802
|
-
const
|
|
1807
|
+
const slice = (0, _univerjs_core.sliceMatrixArray)(range.startColumn, range.endColumn, columnWrapper);
|
|
1808
|
+
const _colInfo = (0, _univerjs_core.concatMatrixArray)(colInfo, slice);
|
|
1803
1809
|
return {
|
|
1804
1810
|
unitId: params.unitId,
|
|
1805
1811
|
subUnitId: params.subUnitId,
|
|
@@ -1946,7 +1952,8 @@ const SetColDataMutationFactory = (params, worksheet) => {
|
|
|
1946
1952
|
const manager = worksheet.getColumnManager();
|
|
1947
1953
|
for (const colIndex in columnData) {
|
|
1948
1954
|
const newCol = columnData[colIndex];
|
|
1949
|
-
|
|
1955
|
+
const currentCol = manager.getColumn(Number(colIndex));
|
|
1956
|
+
oldColData[colIndex] = getOldColumnData(currentCol, newCol);
|
|
1950
1957
|
}
|
|
1951
1958
|
return {
|
|
1952
1959
|
unitId,
|
|
@@ -1959,7 +1966,8 @@ const SetColDataMutation = {
|
|
|
1959
1966
|
type: _univerjs_core.CommandType.MUTATION,
|
|
1960
1967
|
handler: (accessor, params) => {
|
|
1961
1968
|
const { columnData } = params;
|
|
1962
|
-
const
|
|
1969
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
1970
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
1963
1971
|
if (!target) return false;
|
|
1964
1972
|
const { worksheet } = target;
|
|
1965
1973
|
const manager = worksheet.getColumnManager();
|
|
@@ -2303,6 +2311,34 @@ function mergeRichTextStyle(p, newStyle) {
|
|
|
2303
2311
|
//#endregion
|
|
2304
2312
|
//#region src/commands/mutations/set-range-values.mutation.ts
|
|
2305
2313
|
/**
|
|
2314
|
+
* Read-only native value preparation for caller-owned atomic model staging. The resulting style IDs
|
|
2315
|
+
* must travel with the prepared cells; replay installs them and must not allocate replacement IDs.
|
|
2316
|
+
* This does not execute handlers, publish notifications, or own style garbage collection.
|
|
2317
|
+
*/
|
|
2318
|
+
function prepareSetRangeValuesMutation(cells, styles, params) {
|
|
2319
|
+
const detachedStyles = new _univerjs_core.Styles(_univerjs_core.Tools.deepClone(styles.toJSON()));
|
|
2320
|
+
const before = new _univerjs_core.ObjectMatrix();
|
|
2321
|
+
const after = new _univerjs_core.ObjectMatrix();
|
|
2322
|
+
new _univerjs_core.ObjectMatrix(_univerjs_core.Tools.deepClone(params.cellValue)).forValue((row, column, value) => {
|
|
2323
|
+
const original = _univerjs_core.Tools.deepClone(cells.getValue(row, column) ?? null);
|
|
2324
|
+
before.setValue(row, column, original);
|
|
2325
|
+
const next = value ? mergeCellData(value, _univerjs_core.Tools.deepClone(original ?? {}), detachedStyles, !!params.isOverrideStyle) : null;
|
|
2326
|
+
after.setValue(row, column, next && !_univerjs_core.Tools.isEmptyObject(next) ? next : null);
|
|
2327
|
+
});
|
|
2328
|
+
const addedStyles = {};
|
|
2329
|
+
for (const [id, style] of Object.entries(detachedStyles.toJSON())) {
|
|
2330
|
+
if (!style) continue;
|
|
2331
|
+
const current = styles.get(id);
|
|
2332
|
+
if (current && !_univerjs_core.Tools.diffValue(current, style)) throw new TypeError("Prepared style ID collides with an existing style.");
|
|
2333
|
+
if (!current) addedStyles[id] = _univerjs_core.Tools.deepClone(style);
|
|
2334
|
+
}
|
|
2335
|
+
return {
|
|
2336
|
+
before: before.getMatrix(),
|
|
2337
|
+
after: after.getMatrix(),
|
|
2338
|
+
styles: addedStyles
|
|
2339
|
+
};
|
|
2340
|
+
}
|
|
2341
|
+
/**
|
|
2306
2342
|
* Generate undo mutation of a `SetRangeValuesMutation`
|
|
2307
2343
|
*
|
|
2308
2344
|
* @param {IAccessor} accessor - injector accessor
|
|
@@ -2359,7 +2395,9 @@ const overwriteCellPropertiesSet = /* @__PURE__ */ new Set([
|
|
|
2359
2395
|
"si",
|
|
2360
2396
|
"custom",
|
|
2361
2397
|
"ref",
|
|
2362
|
-
"xf"
|
|
2398
|
+
"xf",
|
|
2399
|
+
"ft",
|
|
2400
|
+
"fd"
|
|
2363
2401
|
]);
|
|
2364
2402
|
function mergeCellData(newValue, oldValue, styles, isOverrideStyle = false) {
|
|
2365
2403
|
const type = getCellType(styles, newValue, oldValue);
|
|
@@ -2370,9 +2408,15 @@ function mergeCellData(newValue, oldValue, styles, isOverrideStyle = false) {
|
|
|
2370
2408
|
updateCellProperty(oldValue, cellPropertyKey, propertyValue);
|
|
2371
2409
|
} else if (cellPropertyKey === "v") {
|
|
2372
2410
|
if (newValue.v !== void 0) oldValue.v = getCellValue(type, newValue);
|
|
2373
|
-
} else if (cellPropertyKey === "s")
|
|
2374
|
-
|
|
2411
|
+
} else if (cellPropertyKey === "s") {
|
|
2412
|
+
if (isOverrideStyle) overrideStyle(styles, oldValue, newValue);
|
|
2413
|
+
else handleStyle(styles, oldValue, newValue);
|
|
2414
|
+
}
|
|
2375
2415
|
});
|
|
2416
|
+
if ((newValue.f === null || newValue.f === "") && !(0, _univerjs_core.isFormulaId)(newValue.si)) {
|
|
2417
|
+
delete oldValue.ft;
|
|
2418
|
+
delete oldValue.fd;
|
|
2419
|
+
}
|
|
2376
2420
|
if (oldValue.v !== void 0) {
|
|
2377
2421
|
oldValue.t = type;
|
|
2378
2422
|
oldValue.v = getCellValue(type, oldValue);
|
|
@@ -2408,7 +2452,8 @@ const SetRowDataMutationFactory = (params, worksheet) => {
|
|
|
2408
2452
|
const manager = worksheet.getRowManager();
|
|
2409
2453
|
for (const rowIndex in rowData) {
|
|
2410
2454
|
const newRow = rowData[rowIndex];
|
|
2411
|
-
|
|
2455
|
+
const currentRow = manager.getRow(Number(rowIndex));
|
|
2456
|
+
oldRowData[rowIndex] = getOldRowData(currentRow, newRow);
|
|
2412
2457
|
}
|
|
2413
2458
|
return {
|
|
2414
2459
|
unitId,
|
|
@@ -2421,7 +2466,8 @@ const SetRowDataMutation = {
|
|
|
2421
2466
|
type: _univerjs_core.CommandType.MUTATION,
|
|
2422
2467
|
handler: (accessor, params) => {
|
|
2423
2468
|
const { rowData } = params;
|
|
2424
|
-
const
|
|
2469
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
2470
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
2425
2471
|
if (!target) return false;
|
|
2426
2472
|
const { worksheet } = target;
|
|
2427
2473
|
const manager = worksheet.getRowManager();
|
|
@@ -2521,7 +2567,8 @@ const SetWorksheetColWidthMutation = {
|
|
|
2521
2567
|
id: "sheet.mutation.set-worksheet-col-width",
|
|
2522
2568
|
type: _univerjs_core.CommandType.MUTATION,
|
|
2523
2569
|
handler: (accessor, params) => {
|
|
2524
|
-
const
|
|
2570
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
2571
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
2525
2572
|
if (!target) return false;
|
|
2526
2573
|
const { worksheet } = target;
|
|
2527
2574
|
const manager = worksheet.getColumnManager();
|
|
@@ -2553,7 +2600,8 @@ const SetWorksheetColumnCountMutation = {
|
|
|
2553
2600
|
id: "sheet.mutation.set-worksheet-column-count",
|
|
2554
2601
|
type: _univerjs_core.CommandType.MUTATION,
|
|
2555
2602
|
handler: (accessor, params) => {
|
|
2556
|
-
const
|
|
2603
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
2604
|
+
const target = getSheetMutationTarget(univerInstanceService, params);
|
|
2557
2605
|
if (!target) return false;
|
|
2558
2606
|
target.worksheet.setColumnCount(params.columnCount);
|
|
2559
2607
|
return true;
|
|
@@ -2600,7 +2648,8 @@ const SetWorksheetRowCountMutation = {
|
|
|
2600
2648
|
id: "sheet.mutation.set-worksheet-row-count",
|
|
2601
2649
|
type: _univerjs_core.CommandType.MUTATION,
|
|
2602
2650
|
handler: (accessor, params) => {
|
|
2603
|
-
const
|
|
2651
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
2652
|
+
const target = getSheetMutationTarget(univerInstanceService, params);
|
|
2604
2653
|
if (!target) return false;
|
|
2605
2654
|
target.worksheet.setRowCount(params.rowCount);
|
|
2606
2655
|
return true;
|
|
@@ -2662,7 +2711,8 @@ const SetWorksheetRowHeightMutation = {
|
|
|
2662
2711
|
type: _univerjs_core.CommandType.MUTATION,
|
|
2663
2712
|
handler: (accessor, params) => {
|
|
2664
2713
|
const { ranges, rowHeight } = params;
|
|
2665
|
-
const
|
|
2714
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
2715
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
2666
2716
|
if (!target) return false;
|
|
2667
2717
|
const { worksheet } = target;
|
|
2668
2718
|
const manager = worksheet.getRowManager();
|
|
@@ -2676,7 +2726,8 @@ const SetWorksheetRowIsAutoHeightMutation = {
|
|
|
2676
2726
|
type: _univerjs_core.CommandType.MUTATION,
|
|
2677
2727
|
handler: (accessor, params) => {
|
|
2678
2728
|
const { ranges, autoHeightInfo } = params;
|
|
2679
|
-
const
|
|
2729
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
2730
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
2680
2731
|
if (!target) return false;
|
|
2681
2732
|
const manager = target.worksheet.getRowManager();
|
|
2682
2733
|
for (const { startRow, endRow } of ranges) for (let rowIndex = startRow; rowIndex <= endRow; rowIndex++) {
|
|
@@ -2692,7 +2743,8 @@ const SetWorksheetRowAutoHeightMutation = {
|
|
|
2692
2743
|
type: _univerjs_core.CommandType.MUTATION,
|
|
2693
2744
|
handler: (accessor, params) => {
|
|
2694
2745
|
const { rowsAutoHeightInfo } = params;
|
|
2695
|
-
const
|
|
2746
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
2747
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
2696
2748
|
if (!target) return false;
|
|
2697
2749
|
const rowManager = target.worksheet.getRowManager();
|
|
2698
2750
|
for (const { row, autoHeight } of rowsAutoHeightInfo) {
|
|
@@ -3126,18 +3178,20 @@ function getExpandedRangeLeft(range, allMatrixWithSpan, leftOffset, isWorksheetH
|
|
|
3126
3178
|
const cell = allMatrixWithSpan.getValue(i, startColumn - leftOffset);
|
|
3127
3179
|
hasValue = hasValue || hasValueFromMatrixWithSpanInfo(cell, allMatrixWithSpan);
|
|
3128
3180
|
if (!isWorksheetHasSpan && hasValue) break;
|
|
3129
|
-
if (cell && cell.spanAnchor)
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3181
|
+
if (cell && cell.spanAnchor) {
|
|
3182
|
+
if (!spanAnchor) spanAnchor = {
|
|
3183
|
+
startRow: cell.spanAnchor.startRow,
|
|
3184
|
+
startColumn: cell.spanAnchor.startColumn,
|
|
3185
|
+
endRow: cell.spanAnchor.endRow,
|
|
3186
|
+
endColumn: cell.spanAnchor.endColumn
|
|
3187
|
+
};
|
|
3188
|
+
else spanAnchor = {
|
|
3189
|
+
startRow: Math.min(cell.spanAnchor.startRow, spanAnchor.startRow),
|
|
3190
|
+
startColumn: Math.min(cell.spanAnchor.startColumn, spanAnchor.startColumn),
|
|
3191
|
+
endRow: Math.max(cell.spanAnchor.endRow, spanAnchor.endRow),
|
|
3192
|
+
endColumn: Math.max(cell.spanAnchor.endColumn, spanAnchor.endColumn)
|
|
3193
|
+
};
|
|
3194
|
+
}
|
|
3141
3195
|
}
|
|
3142
3196
|
if (hasValue) {
|
|
3143
3197
|
range.startColumn = range.startColumn - leftOffset;
|
|
@@ -3166,18 +3220,20 @@ function getExpandedRangeRight(range, allMatrixWithSpan, rightOffset, isWorkshee
|
|
|
3166
3220
|
const cell = allMatrixWithSpan.getValue(i, endColumn + rightOffset);
|
|
3167
3221
|
hasValue = hasValue || hasValueFromMatrixWithSpanInfo(cell, allMatrixWithSpan);
|
|
3168
3222
|
if (!isWorksheetHasSpan && hasValue) break;
|
|
3169
|
-
if (cell && cell.spanAnchor)
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3223
|
+
if (cell && cell.spanAnchor) {
|
|
3224
|
+
if (!spanAnchor) spanAnchor = {
|
|
3225
|
+
startRow: cell.spanAnchor.startRow,
|
|
3226
|
+
startColumn: cell.spanAnchor.startColumn,
|
|
3227
|
+
endRow: cell.spanAnchor.endRow,
|
|
3228
|
+
endColumn: cell.spanAnchor.endColumn
|
|
3229
|
+
};
|
|
3230
|
+
else spanAnchor = {
|
|
3231
|
+
startRow: Math.min(cell.spanAnchor.startRow, spanAnchor.startRow),
|
|
3232
|
+
startColumn: Math.min(cell.spanAnchor.startColumn, spanAnchor.startColumn),
|
|
3233
|
+
endRow: Math.max(cell.spanAnchor.endRow, spanAnchor.endRow),
|
|
3234
|
+
endColumn: Math.max(cell.spanAnchor.endColumn, spanAnchor.endColumn)
|
|
3235
|
+
};
|
|
3236
|
+
}
|
|
3181
3237
|
}
|
|
3182
3238
|
if (hasValue) {
|
|
3183
3239
|
range.endColumn = range.endColumn + rightOffset;
|
|
@@ -3206,18 +3262,20 @@ function getExpandedRangeUp(range, allMatrixWithSpan, upOffset, isWorksheetHasSp
|
|
|
3206
3262
|
const cell = allMatrixWithSpan.getValue(startRow - upOffset, i);
|
|
3207
3263
|
hasValue = hasValue || hasValueFromMatrixWithSpanInfo(cell, allMatrixWithSpan);
|
|
3208
3264
|
if (!isWorksheetHasSpan && hasValue) break;
|
|
3209
|
-
if (cell && cell.spanAnchor)
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3265
|
+
if (cell && cell.spanAnchor) {
|
|
3266
|
+
if (!spanAnchor) spanAnchor = {
|
|
3267
|
+
startRow: cell.spanAnchor.startRow,
|
|
3268
|
+
startColumn: cell.spanAnchor.startColumn,
|
|
3269
|
+
endRow: cell.spanAnchor.endRow,
|
|
3270
|
+
endColumn: cell.spanAnchor.endColumn
|
|
3271
|
+
};
|
|
3272
|
+
else spanAnchor = {
|
|
3273
|
+
startRow: Math.min(cell.spanAnchor.startRow, spanAnchor.startRow),
|
|
3274
|
+
startColumn: Math.min(cell.spanAnchor.startColumn, spanAnchor.startColumn),
|
|
3275
|
+
endRow: Math.max(cell.spanAnchor.endRow, spanAnchor.endRow),
|
|
3276
|
+
endColumn: Math.max(cell.spanAnchor.endColumn, spanAnchor.endColumn)
|
|
3277
|
+
};
|
|
3278
|
+
}
|
|
3221
3279
|
}
|
|
3222
3280
|
if (hasValue) {
|
|
3223
3281
|
range.startRow = range.startRow - upOffset;
|
|
@@ -3246,18 +3304,20 @@ function getExpandedRangeDown(range, allMatrixWithSpan, downOffset, isWorksheetH
|
|
|
3246
3304
|
const cell = allMatrixWithSpan.getValue(endRow + downOffset, i);
|
|
3247
3305
|
hasValue = hasValue || hasValueFromMatrixWithSpanInfo(cell, allMatrixWithSpan);
|
|
3248
3306
|
if (!isWorksheetHasSpan && hasValue) break;
|
|
3249
|
-
if (cell && cell.spanAnchor)
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3307
|
+
if (cell && cell.spanAnchor) {
|
|
3308
|
+
if (!spanAnchor) spanAnchor = {
|
|
3309
|
+
startRow: cell.spanAnchor.startRow,
|
|
3310
|
+
startColumn: cell.spanAnchor.startColumn,
|
|
3311
|
+
endRow: cell.spanAnchor.endRow,
|
|
3312
|
+
endColumn: cell.spanAnchor.endColumn
|
|
3313
|
+
};
|
|
3314
|
+
else spanAnchor = {
|
|
3315
|
+
startRow: Math.min(cell.spanAnchor.startRow, spanAnchor.startRow),
|
|
3316
|
+
startColumn: Math.min(cell.spanAnchor.startColumn, spanAnchor.startColumn),
|
|
3317
|
+
endRow: Math.max(cell.spanAnchor.endRow, spanAnchor.endRow),
|
|
3318
|
+
endColumn: Math.max(cell.spanAnchor.endColumn, spanAnchor.endColumn)
|
|
3319
|
+
};
|
|
3320
|
+
}
|
|
3261
3321
|
}
|
|
3262
3322
|
if (hasValue) {
|
|
3263
3323
|
range.endRow = range.endRow + downOffset;
|
|
@@ -3638,10 +3698,7 @@ var DelimiterCounter = class {
|
|
|
3638
3698
|
case ";":
|
|
3639
3699
|
this._semicolonCount++;
|
|
3640
3700
|
break;
|
|
3641
|
-
case " ":
|
|
3642
|
-
this._spaceCount++;
|
|
3643
|
-
break;
|
|
3644
|
-
default: break;
|
|
3701
|
+
case " ": this._spaceCount++;
|
|
3645
3702
|
}
|
|
3646
3703
|
}
|
|
3647
3704
|
update(cellText) {
|
|
@@ -3875,7 +3932,7 @@ function deserializeListOptions(optionsStr) {
|
|
|
3875
3932
|
const options = JSON.parse(optionsStr);
|
|
3876
3933
|
if (Array.isArray(options) && options.every((option) => typeof option === "string")) return options.filter(Boolean);
|
|
3877
3934
|
} catch {}
|
|
3878
|
-
return optionsStr.split(",").filter(Boolean);
|
|
3935
|
+
return optionsStr.split(",").map((option) => option.trim()).filter(Boolean);
|
|
3879
3936
|
}
|
|
3880
3937
|
|
|
3881
3938
|
//#endregion
|
|
@@ -4205,9 +4262,7 @@ var WorkbookSelectionModel = class extends _univerjs_core.Disposable {
|
|
|
4205
4262
|
case 3:
|
|
4206
4263
|
this._selectionSet$.next(selectionDatas);
|
|
4207
4264
|
break;
|
|
4208
|
-
default:
|
|
4209
|
-
this._selectionSet$.next(selectionDatas);
|
|
4210
|
-
break;
|
|
4265
|
+
default: this._selectionSet$.next(selectionDatas);
|
|
4211
4266
|
}
|
|
4212
4267
|
}
|
|
4213
4268
|
getCurrentSelections() {
|
|
@@ -4678,10 +4733,11 @@ const ClearSelectionAllCommand = {
|
|
|
4678
4733
|
const sheetInterceptorService = accessor.get(SheetInterceptorService);
|
|
4679
4734
|
const redoMutations = [];
|
|
4680
4735
|
const undoMutations = [];
|
|
4736
|
+
const visibleRanges = getVisibleRanges(ranges, accessor, unitId, subUnitId);
|
|
4681
4737
|
const clearMutationParams = {
|
|
4682
4738
|
subUnitId,
|
|
4683
4739
|
unitId,
|
|
4684
|
-
cellValue: generateNullCell(
|
|
4740
|
+
cellValue: generateNullCell(visibleRanges)
|
|
4685
4741
|
};
|
|
4686
4742
|
const undoClearMutationParams = SetRangeValuesUndoMutationFactory(accessor, clearMutationParams);
|
|
4687
4743
|
redoMutations.push({
|
|
@@ -4748,10 +4804,11 @@ const ClearSelectionFormatCommand = {
|
|
|
4748
4804
|
const sheetInterceptorService = accessor.get(SheetInterceptorService);
|
|
4749
4805
|
const redoMutations = [];
|
|
4750
4806
|
const undoMutations = [];
|
|
4807
|
+
const visibleRanges = getVisibleRanges(ranges, accessor, unitId, subUnitId);
|
|
4751
4808
|
const clearMutationParams = {
|
|
4752
4809
|
subUnitId,
|
|
4753
4810
|
unitId,
|
|
4754
|
-
cellValue: generateNullCellStyle(
|
|
4811
|
+
cellValue: generateNullCellStyle(visibleRanges)
|
|
4755
4812
|
};
|
|
4756
4813
|
const undoClearMutationParams = SetRangeValuesUndoMutationFactory(accessor, clearMutationParams);
|
|
4757
4814
|
redoMutations.push({
|
|
@@ -5299,6 +5356,13 @@ const SetRangeValuesCommand = {
|
|
|
5299
5356
|
subUnitId,
|
|
5300
5357
|
cellValue: _univerjs_core.Tools.deepClone(realCellValue ?? cellValue.getMatrix())
|
|
5301
5358
|
};
|
|
5359
|
+
new _univerjs_core.ObjectMatrix(setRangeValuesMutationRedoParams.cellValue).forValue((row, col, cell) => {
|
|
5360
|
+
var _worksheet$getCell;
|
|
5361
|
+
if ((cell === null || cell === void 0 ? void 0 : cell.f) !== void 0 && cell.f !== ((_worksheet$getCell = worksheet.getCell(row, col)) === null || _worksheet$getCell === void 0 ? void 0 : _worksheet$getCell.f)) {
|
|
5362
|
+
cell.ft ??= null;
|
|
5363
|
+
cell.fd ??= null;
|
|
5364
|
+
}
|
|
5365
|
+
});
|
|
5302
5366
|
const setRangeValuesMutationUndoParams = SetRangeValuesUndoMutationFactory(accessor, setRangeValuesMutationRedoParams);
|
|
5303
5367
|
const cellHeights = (0, _univerjs_core.mapObjectMatrix)(setRangeValuesMutationRedoParams.cellValue, (row, col) => worksheet.getCellHeight(row, col) || void 0);
|
|
5304
5368
|
if (!commandService.syncExecuteCommand(SetRangeValuesMutation.id, setRangeValuesMutationRedoParams)) return false;
|
|
@@ -5767,13 +5831,14 @@ const InsertRangeMoveDownCommand = {
|
|
|
5767
5831
|
if (!cellValue[row]) cellValue[row] = {};
|
|
5768
5832
|
cellValue[row][col] = { s: cell.s };
|
|
5769
5833
|
});
|
|
5770
|
-
const
|
|
5834
|
+
const insertRangeMutationParams = {
|
|
5771
5835
|
range,
|
|
5772
5836
|
subUnitId,
|
|
5773
5837
|
unitId,
|
|
5774
5838
|
shiftDimension: _univerjs_core.Dimension.ROWS,
|
|
5775
5839
|
cellValue
|
|
5776
|
-
}
|
|
5840
|
+
};
|
|
5841
|
+
const { redo: insertRangeRedo, undo: insertRangeUndo } = getInsertRangeMutations(accessor, insertRangeMutationParams);
|
|
5777
5842
|
redoMutations.push(...insertRangeRedo);
|
|
5778
5843
|
undoMutations.push(...insertRangeUndo);
|
|
5779
5844
|
const sheetInterceptor = sheetInterceptorService.onCommandExecute({
|
|
@@ -5874,13 +5939,14 @@ const InsertRangeMoveRightCommand = {
|
|
|
5874
5939
|
if (!cellValue[row]) cellValue[row] = {};
|
|
5875
5940
|
cellValue[row][col] = { s: cell.s };
|
|
5876
5941
|
});
|
|
5877
|
-
const
|
|
5942
|
+
const insertRangeMutationParams = {
|
|
5878
5943
|
range,
|
|
5879
5944
|
subUnitId,
|
|
5880
5945
|
unitId,
|
|
5881
5946
|
shiftDimension: _univerjs_core.Dimension.COLUMNS,
|
|
5882
5947
|
cellValue
|
|
5883
|
-
}
|
|
5948
|
+
};
|
|
5949
|
+
const { redo: insertRangeRedo, undo: insertRangeUndo } = getInsertRangeMutations(accessor, insertRangeMutationParams);
|
|
5884
5950
|
redoMutations.push(...insertRangeRedo);
|
|
5885
5951
|
undoMutations.push(...insertRangeUndo);
|
|
5886
5952
|
const sheetInterceptor = sheetInterceptorService.onCommandExecute({
|
|
@@ -6017,7 +6083,8 @@ const InsertRowBeforeCommand = {
|
|
|
6017
6083
|
let range;
|
|
6018
6084
|
if ((selections === null || selections === void 0 ? void 0 : selections.length) === 1) range = selections[0];
|
|
6019
6085
|
else return false;
|
|
6020
|
-
const
|
|
6086
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
6087
|
+
const target = getSheetCommandTarget(univerInstanceService);
|
|
6021
6088
|
if (!target) return false;
|
|
6022
6089
|
const { worksheet, subUnitId, unitId } = target;
|
|
6023
6090
|
const count = params.value || 0;
|
|
@@ -6049,7 +6116,8 @@ const InsertRowAfterCommand = {
|
|
|
6049
6116
|
let range;
|
|
6050
6117
|
if ((selections === null || selections === void 0 ? void 0 : selections.length) === 1) range = selections[0];
|
|
6051
6118
|
else return false;
|
|
6052
|
-
const
|
|
6119
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
6120
|
+
const target = getSheetCommandTarget(univerInstanceService);
|
|
6053
6121
|
if (!target) return false;
|
|
6054
6122
|
const { worksheet, unitId, subUnitId } = target;
|
|
6055
6123
|
const count = range.endRow - range.startRow + 1;
|
|
@@ -6082,7 +6150,8 @@ const InsertMultiRowsAboveCommand = {
|
|
|
6082
6150
|
let range;
|
|
6083
6151
|
if ((selections === null || selections === void 0 ? void 0 : selections.length) === 1) range = selections[0];
|
|
6084
6152
|
else return false;
|
|
6085
|
-
const
|
|
6153
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
6154
|
+
const target = getSheetCommandTarget(univerInstanceService);
|
|
6086
6155
|
if (!target) return false;
|
|
6087
6156
|
const { worksheet, unitId, subUnitId } = target;
|
|
6088
6157
|
const count = params.value || 0;
|
|
@@ -6116,7 +6185,8 @@ const InsertMultiRowsAfterCommand = {
|
|
|
6116
6185
|
let range;
|
|
6117
6186
|
if ((selections === null || selections === void 0 ? void 0 : selections.length) === 1) range = selections[0];
|
|
6118
6187
|
else return false;
|
|
6119
|
-
const
|
|
6188
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
6189
|
+
const target = getSheetCommandTarget(univerInstanceService);
|
|
6120
6190
|
if (!target) return false;
|
|
6121
6191
|
const { worksheet, unitId, subUnitId } = target;
|
|
6122
6192
|
const count = params.value || 0;
|
|
@@ -6238,7 +6308,8 @@ const InsertColBeforeCommand = {
|
|
|
6238
6308
|
let range;
|
|
6239
6309
|
if ((selections === null || selections === void 0 ? void 0 : selections.length) === 1) range = selections[0].range;
|
|
6240
6310
|
else return false;
|
|
6241
|
-
const
|
|
6311
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
6312
|
+
const target = getSheetCommandTarget(univerInstanceService);
|
|
6242
6313
|
if (!target) return false;
|
|
6243
6314
|
const { worksheet, unitId, subUnitId } = target;
|
|
6244
6315
|
const count = params.value || 0;
|
|
@@ -6270,7 +6341,8 @@ const InsertColAfterCommand = {
|
|
|
6270
6341
|
let range;
|
|
6271
6342
|
if ((selections === null || selections === void 0 ? void 0 : selections.length) === 1) range = selections[0].range;
|
|
6272
6343
|
else return false;
|
|
6273
|
-
const
|
|
6344
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
6345
|
+
const target = getSheetCommandTarget(univerInstanceService);
|
|
6274
6346
|
if (!target) return false;
|
|
6275
6347
|
const { worksheet, unitId, subUnitId } = target;
|
|
6276
6348
|
const count = range.endColumn - range.startColumn + 1;
|
|
@@ -6301,7 +6373,8 @@ const InsertMultiColsLeftCommand = {
|
|
|
6301
6373
|
let range;
|
|
6302
6374
|
if ((selections === null || selections === void 0 ? void 0 : selections.length) === 1) range = selections[0].range;
|
|
6303
6375
|
else return false;
|
|
6304
|
-
const
|
|
6376
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
6377
|
+
const target = getSheetCommandTarget(univerInstanceService);
|
|
6305
6378
|
if (!target) return false;
|
|
6306
6379
|
const { worksheet, unitId, subUnitId } = target;
|
|
6307
6380
|
const count = params.value || 0;
|
|
@@ -6333,7 +6406,8 @@ const InsertMultiColsRightCommand = {
|
|
|
6333
6406
|
let range;
|
|
6334
6407
|
if ((selections === null || selections === void 0 ? void 0 : selections.length) === 1) range = selections[0].range;
|
|
6335
6408
|
else return false;
|
|
6336
|
-
const
|
|
6409
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
6410
|
+
const target = getSheetCommandTarget(univerInstanceService);
|
|
6337
6411
|
if (!target) return false;
|
|
6338
6412
|
const { worksheet, unitId, subUnitId } = target;
|
|
6339
6413
|
const count = params.value || 0;
|
|
@@ -6374,7 +6448,8 @@ const RemoveRowByRangeCommand = {
|
|
|
6374
6448
|
id: "sheet.command.remove-row-by-range",
|
|
6375
6449
|
handler: (accessor, params) => {
|
|
6376
6450
|
if (!params) return false;
|
|
6377
|
-
const
|
|
6451
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
6452
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
6378
6453
|
if (!target) return false;
|
|
6379
6454
|
const { workbook, worksheet } = target;
|
|
6380
6455
|
const sheetInterceptorService = accessor.get(SheetInterceptorService);
|
|
@@ -6491,7 +6566,8 @@ const RemoveColByRangeCommand = {
|
|
|
6491
6566
|
id: "sheet.command.remove-col-by-range",
|
|
6492
6567
|
handler: (accessor, params) => {
|
|
6493
6568
|
if (!params) return false;
|
|
6494
|
-
const
|
|
6569
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
6570
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
6495
6571
|
if (!target) return false;
|
|
6496
6572
|
const { workbook, worksheet } = target;
|
|
6497
6573
|
const sheetInterceptorService = accessor.get(SheetInterceptorService);
|
|
@@ -6571,7 +6647,8 @@ const RemoveColCommand = {
|
|
|
6571
6647
|
let range = params === null || params === void 0 ? void 0 : params.range;
|
|
6572
6648
|
if (!range) range = (_selectionManagerServ2 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ2 === void 0 ? void 0 : _selectionManagerServ2.range;
|
|
6573
6649
|
if (!range) return false;
|
|
6574
|
-
const
|
|
6650
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
6651
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
6575
6652
|
if (!target) return false;
|
|
6576
6653
|
const { worksheet, subUnitId, unitId } = target;
|
|
6577
6654
|
range = {
|
|
@@ -6651,7 +6728,8 @@ const MoveRowsCommand = {
|
|
|
6651
6728
|
const filteredSelections = selections === null || selections === void 0 ? void 0 : selections.filter((selection) => selection.range.rangeType === _univerjs_core.RANGE_TYPE.ROW && selection.range.startRow <= fromRow && fromRow <= selection.range.endRow);
|
|
6652
6729
|
if ((filteredSelections === null || filteredSelections === void 0 ? void 0 : filteredSelections.length) !== 1) return false;
|
|
6653
6730
|
const sheetInterceptorService = accessor.get(SheetInterceptorService);
|
|
6654
|
-
const
|
|
6731
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
6732
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
6655
6733
|
if (!target) return false;
|
|
6656
6734
|
const { workbook, worksheet } = target;
|
|
6657
6735
|
const unitId = workbook.getUnitId();
|
|
@@ -6762,7 +6840,8 @@ const MoveColsCommand = {
|
|
|
6762
6840
|
const filteredSelections = selections === null || selections === void 0 ? void 0 : selections.filter((selection) => selection.range.rangeType === _univerjs_core.RANGE_TYPE.COLUMN && selection.range.startColumn <= fromCol && fromCol <= selection.range.endColumn);
|
|
6763
6841
|
if ((filteredSelections === null || filteredSelections === void 0 ? void 0 : filteredSelections.length) !== 1) return false;
|
|
6764
6842
|
const sheetInterceptorService = accessor.get(SheetInterceptorService);
|
|
6765
|
-
const
|
|
6843
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
6844
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
6766
6845
|
if (!target) return false;
|
|
6767
6846
|
const { workbook, worksheet } = target;
|
|
6768
6847
|
const unitId = workbook.getUnitId();
|
|
@@ -7124,11 +7203,12 @@ const handleBaseMoveRowsCols = (fromRange, toRange, effectRange) => {
|
|
|
7124
7203
|
const newLine = getAbsolute(getRelative(_effectRange, fromRange), _toRange);
|
|
7125
7204
|
_effectRange.start = newLine.start;
|
|
7126
7205
|
_effectRange.end = newLine.end;
|
|
7127
|
-
} else if (fromRangeIntersectsEffectRange.start > fromRange.start)
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7206
|
+
} else if (fromRangeIntersectsEffectRange.start > fromRange.start) {
|
|
7207
|
+
if (isToLargeFrom) {
|
|
7208
|
+
_effectRange.end -= fromRangeIntersectsEffectRangeStep + fromRangeStep;
|
|
7209
|
+
_effectRange.start -= fromRangeStep;
|
|
7210
|
+
} else _effectRange.end -= fromRangeIntersectsEffectRangeStep;
|
|
7211
|
+
} else if (isToLargeFrom) _effectRange.end -= fromRangeIntersectsEffectRangeStep;
|
|
7132
7212
|
else if (_effectRange.start > fromRange.start && _effectRange.end > fromRange.end) {
|
|
7133
7213
|
_effectRange.start -= fromRangeStep;
|
|
7134
7214
|
_effectRange.end -= fromRangeStep + fromRangeIntersectsEffectRangeStep;
|
|
@@ -7586,7 +7666,8 @@ const handleDeleteRangeMoveUpCommon = (param, targetRange) => {
|
|
|
7586
7666
|
return mergeAndSortRanges([...noMoveRanges, ...movedRanges]);
|
|
7587
7667
|
};
|
|
7588
7668
|
const handleRemoveRowCommon = (param, targetRange) => {
|
|
7589
|
-
const
|
|
7669
|
+
const removed = (param.ranges ?? [param.range]).map((range) => [range.startRow, range.endRow]);
|
|
7670
|
+
const mergedRemoved = (0, _univerjs_core.mergeIntervals)(removed);
|
|
7590
7671
|
let targetStartRow = targetRange.startRow;
|
|
7591
7672
|
let targetEndRow = targetRange.endRow;
|
|
7592
7673
|
for (let i = mergedRemoved.length - 1; i >= 0; i--) {
|
|
@@ -7679,9 +7760,7 @@ const runRefRangeMutations = (operators, range) => {
|
|
|
7679
7760
|
result.startRow += operator.step;
|
|
7680
7761
|
result.endRow += operator.step + (operator.length || 0);
|
|
7681
7762
|
break;
|
|
7682
|
-
case 0:
|
|
7683
|
-
result = operator.range;
|
|
7684
|
-
break;
|
|
7763
|
+
case 0: result = operator.range;
|
|
7685
7764
|
}
|
|
7686
7765
|
});
|
|
7687
7766
|
if (result) {
|
|
@@ -7725,9 +7804,7 @@ const handleDefaultRangeChangeWithEffectRefCommands = (range, commandInfo) => {
|
|
|
7725
7804
|
case EffectRefRangId.RemoveRowCommandId:
|
|
7726
7805
|
operator = handleIRemoveRow(commandInfo, range);
|
|
7727
7806
|
break;
|
|
7728
|
-
case EffectRefRangId.ReorderRangeCommandId:
|
|
7729
|
-
operator = handleReorderRange(commandInfo, range);
|
|
7730
|
-
break;
|
|
7807
|
+
case EffectRefRangId.ReorderRangeCommandId: operator = handleReorderRange(commandInfo, range);
|
|
7731
7808
|
}
|
|
7732
7809
|
return runRefRangeMutations(operator, range);
|
|
7733
7810
|
};
|
|
@@ -7838,10 +7915,7 @@ function adjustRangeOnMutation(range, mutation) {
|
|
|
7838
7915
|
baseRangeOperator = handleBaseInsertRange(params.range, range);
|
|
7839
7916
|
baseRangeOperator.type = 2;
|
|
7840
7917
|
break;
|
|
7841
|
-
case MoveRangeMutation.id:
|
|
7842
|
-
baseRangeOperator = handleBaseMoveRange(params.fromRange || new _univerjs_core.ObjectMatrix(params.from).getRange(), params.toRange || new _univerjs_core.ObjectMatrix(params.to).getRange(), range);
|
|
7843
|
-
break;
|
|
7844
|
-
default: break;
|
|
7918
|
+
case MoveRangeMutation.id: baseRangeOperator = handleBaseMoveRange(params.fromRange || new _univerjs_core.ObjectMatrix(params.from).getRange(), params.toRange || new _univerjs_core.ObjectMatrix(params.to).getRange(), range);
|
|
7845
7919
|
}
|
|
7846
7920
|
if (baseRangeOperator) return Array.isArray(baseRangeOperator) ? runRefRangeMutations(baseRangeOperator, range) : runRefRangeMutations([baseRangeOperator], range);
|
|
7847
7921
|
else return range;
|
|
@@ -7954,7 +8028,6 @@ function getEffectedRangesOnMutation(mutation) {
|
|
|
7954
8028
|
}
|
|
7955
8029
|
case RemoveColMutation.id: return [mutation.params.range];
|
|
7956
8030
|
case RemoveRowMutation.id: return [mutation.params.range];
|
|
7957
|
-
default: break;
|
|
7958
8031
|
}
|
|
7959
8032
|
}
|
|
7960
8033
|
function getSeparateEffectedRangesOnCommand(accessor, command) {
|
|
@@ -8766,10 +8839,11 @@ let MergeCellController = class MergeCellController extends _univerjs_core.Dispo
|
|
|
8766
8839
|
mergeData.forEach((range) => {
|
|
8767
8840
|
if (sourceStart <= range.startRow && sourceEnd >= range.endRow) {
|
|
8768
8841
|
removeParams.ranges.push(range);
|
|
8769
|
-
const
|
|
8842
|
+
const operation = handleMoveRows({
|
|
8770
8843
|
id: EffectRefRangId.MoveRowsCommandId,
|
|
8771
8844
|
params
|
|
8772
|
-
}, range)
|
|
8845
|
+
}, range);
|
|
8846
|
+
const result = runRefRangeMutations(operation, range);
|
|
8773
8847
|
result && addParams.ranges.push(result);
|
|
8774
8848
|
}
|
|
8775
8849
|
});
|
|
@@ -8816,10 +8890,11 @@ let MergeCellController = class MergeCellController extends _univerjs_core.Dispo
|
|
|
8816
8890
|
mergeData.forEach((range) => {
|
|
8817
8891
|
if (sourceStart <= range.startColumn && sourceEnd >= range.endColumn) {
|
|
8818
8892
|
removeParams.ranges.push(range);
|
|
8819
|
-
const
|
|
8893
|
+
const operation = handleMoveCols({
|
|
8820
8894
|
id: EffectRefRangId.MoveColsCommandId,
|
|
8821
8895
|
params
|
|
8822
|
-
}, range)
|
|
8896
|
+
}, range);
|
|
8897
|
+
const result = runRefRangeMutations(operation, range);
|
|
8823
8898
|
result && addParams.ranges.push(result);
|
|
8824
8899
|
}
|
|
8825
8900
|
});
|
|
@@ -9787,7 +9862,8 @@ const AddWorksheetMergeCommand = {
|
|
|
9787
9862
|
type: _univerjs_core.CommandType.COMMAND,
|
|
9788
9863
|
id: "sheet.command.add-worksheet-merge",
|
|
9789
9864
|
handler: async (accessor, params) => {
|
|
9790
|
-
const
|
|
9865
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
9866
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
9791
9867
|
if (!target) return false;
|
|
9792
9868
|
const { worksheet } = target;
|
|
9793
9869
|
const { unitId, subUnitId, selections } = params;
|
|
@@ -9873,7 +9949,8 @@ const AddWorksheetMergeAllCommand = {
|
|
|
9873
9949
|
var _selectionManagerServ;
|
|
9874
9950
|
const mergeableSelections = getMergeableSelectionsByType("mergeAll", (_selectionManagerServ = accessor.get(SheetsSelectionsService).getCurrentSelections()) === null || _selectionManagerServ === void 0 ? void 0 : _selectionManagerServ.map((s) => s.range));
|
|
9875
9951
|
if (!(mergeableSelections === null || mergeableSelections === void 0 ? void 0 : mergeableSelections.length)) return false;
|
|
9876
|
-
const
|
|
9952
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
9953
|
+
const target = getSheetCommandTarget(univerInstanceService);
|
|
9877
9954
|
if (!target) return false;
|
|
9878
9955
|
const { worksheet } = target;
|
|
9879
9956
|
const unitId = worksheet.getUnitId();
|
|
@@ -9892,7 +9969,8 @@ const AddWorksheetMergeVerticalCommand = {
|
|
|
9892
9969
|
var _selectionManagerServ2;
|
|
9893
9970
|
const mergeableSelections = getMergeableSelectionsByType("mergeVertical", (_selectionManagerServ2 = accessor.get(SheetsSelectionsService).getCurrentSelections()) === null || _selectionManagerServ2 === void 0 ? void 0 : _selectionManagerServ2.map((s) => s.range));
|
|
9894
9971
|
if (!(mergeableSelections === null || mergeableSelections === void 0 ? void 0 : mergeableSelections.length)) return false;
|
|
9895
|
-
const
|
|
9972
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
9973
|
+
const target = getSheetCommandTarget(univerInstanceService);
|
|
9896
9974
|
if (!target) return false;
|
|
9897
9975
|
const { worksheet } = target;
|
|
9898
9976
|
const unitId = worksheet.getUnitId();
|
|
@@ -9912,7 +9990,8 @@ const AddWorksheetMergeHorizontalCommand = {
|
|
|
9912
9990
|
var _selectionManagerServ3;
|
|
9913
9991
|
const mergeableSelections = getMergeableSelectionsByType("mergeHorizontal", (_selectionManagerServ3 = accessor.get(SheetsSelectionsService).getCurrentSelections()) === null || _selectionManagerServ3 === void 0 ? void 0 : _selectionManagerServ3.map((s) => s.range));
|
|
9914
9992
|
if (!(mergeableSelections === null || mergeableSelections === void 0 ? void 0 : mergeableSelections.length)) return false;
|
|
9915
|
-
const
|
|
9993
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
9994
|
+
const target = getSheetCommandTarget(univerInstanceService);
|
|
9916
9995
|
if (!target) return false;
|
|
9917
9996
|
const { workbook, worksheet } = target;
|
|
9918
9997
|
const unitId = workbook.getUnitId();
|
|
@@ -10279,7 +10358,8 @@ const SetStyleCommand = {
|
|
|
10279
10358
|
id: "sheet.command.set-style",
|
|
10280
10359
|
handler: (accessor, params) => {
|
|
10281
10360
|
var _selectionManagerServ;
|
|
10282
|
-
const
|
|
10361
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
10362
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
10283
10363
|
if (!target) return false;
|
|
10284
10364
|
const { unitId, subUnitId, worksheet } = target;
|
|
10285
10365
|
const { range, style } = params;
|
|
@@ -10773,13 +10853,16 @@ function numberToChinese(num) {
|
|
|
10773
10853
|
function isChnNumber$1(txt) {
|
|
10774
10854
|
if (!txt) return false;
|
|
10775
10855
|
let isChnNumber = true;
|
|
10776
|
-
if (txt)
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10856
|
+
if (txt) {
|
|
10857
|
+
if (txt.length === 1) {
|
|
10858
|
+
if (txt === "日" || txt in chnNumChar) isChnNumber = true;
|
|
10859
|
+
else isChnNumber = false;
|
|
10860
|
+
} else {
|
|
10861
|
+
const str = txt.split("");
|
|
10862
|
+
for (let i = 0; i < str.length; i++) if (!(str[i] in chnNumChar || str[i] in chnNameValue)) {
|
|
10863
|
+
isChnNumber = false;
|
|
10864
|
+
break;
|
|
10865
|
+
}
|
|
10783
10866
|
}
|
|
10784
10867
|
}
|
|
10785
10868
|
return isChnNumber;
|
|
@@ -10803,23 +10886,26 @@ function matchExtendNumber$1(txt) {
|
|
|
10803
10886
|
}
|
|
10804
10887
|
function isChnWeek1(txt) {
|
|
10805
10888
|
let isChnWeek1;
|
|
10806
|
-
if (txt.length === 1)
|
|
10807
|
-
|
|
10808
|
-
|
|
10889
|
+
if (txt.length === 1) {
|
|
10890
|
+
if (txt === "日" || chineseToNumber$1(txt) < 7) isChnWeek1 = true;
|
|
10891
|
+
else isChnWeek1 = false;
|
|
10892
|
+
} else isChnWeek1 = false;
|
|
10809
10893
|
return isChnWeek1;
|
|
10810
10894
|
}
|
|
10811
10895
|
function isChnWeek2$1(txt) {
|
|
10812
10896
|
let isChnWeek2;
|
|
10813
|
-
if (txt.length === 2)
|
|
10814
|
-
|
|
10815
|
-
|
|
10897
|
+
if (txt.length === 2) {
|
|
10898
|
+
if (txt === "周一" || txt === "周二" || txt === "周三" || txt === "周四" || txt === "周五" || txt === "周六" || txt === "周日") isChnWeek2 = true;
|
|
10899
|
+
else isChnWeek2 = false;
|
|
10900
|
+
} else isChnWeek2 = false;
|
|
10816
10901
|
return isChnWeek2;
|
|
10817
10902
|
}
|
|
10818
10903
|
function isChnWeek3$1(txt) {
|
|
10819
10904
|
let isChnWeek3;
|
|
10820
|
-
if (txt.length === 3)
|
|
10821
|
-
|
|
10822
|
-
|
|
10905
|
+
if (txt.length === 3) {
|
|
10906
|
+
if (txt === "星期一" || txt === "星期二" || txt === "星期三" || txt === "星期四" || txt === "星期五" || txt === "星期六" || txt === "星期日") isChnWeek3 = true;
|
|
10907
|
+
else isChnWeek3 = false;
|
|
10908
|
+
} else isChnWeek3 = false;
|
|
10823
10909
|
return isChnWeek3;
|
|
10824
10910
|
}
|
|
10825
10911
|
function getLenS$1(indexArr, rsd) {
|
|
@@ -11584,12 +11670,13 @@ const AutoFillRules = {
|
|
|
11584
11670
|
for (let i = 0; i < data.length; i++) {
|
|
11585
11671
|
var _data$i3;
|
|
11586
11672
|
const formattedValue = `${(_data$i3 = data[i]) === null || _data$i3 === void 0 ? void 0 : _data$i3.v}`;
|
|
11587
|
-
if (formattedValue === "日")
|
|
11588
|
-
|
|
11589
|
-
|
|
11590
|
-
|
|
11591
|
-
|
|
11592
|
-
|
|
11673
|
+
if (formattedValue === "日") {
|
|
11674
|
+
if (i === 0) dataNumArr.push(0);
|
|
11675
|
+
else {
|
|
11676
|
+
weekIndex++;
|
|
11677
|
+
dataNumArr.push(weekIndex * 7);
|
|
11678
|
+
}
|
|
11679
|
+
} else if (hasWeek && chineseToNumber(formattedValue) > 0 && chineseToNumber(formattedValue) < 7) dataNumArr.push(chineseToNumber(formattedValue) + weekIndex * 7);
|
|
11593
11680
|
else dataNumArr.push(chineseToNumber(formattedValue));
|
|
11594
11681
|
}
|
|
11595
11682
|
if (isReverse) {
|
|
@@ -11631,12 +11718,13 @@ const AutoFillRules = {
|
|
|
11631
11718
|
var _data$i4;
|
|
11632
11719
|
const formattedValue = `${(_data$i4 = data[i]) === null || _data$i4 === void 0 ? void 0 : _data$i4.v}`;
|
|
11633
11720
|
const lastTxt = formattedValue === null || formattedValue === void 0 ? void 0 : formattedValue.substr(formattedValue.length - 1, 1);
|
|
11634
|
-
if (formattedValue === "周日")
|
|
11635
|
-
|
|
11636
|
-
|
|
11637
|
-
|
|
11638
|
-
|
|
11639
|
-
|
|
11721
|
+
if (formattedValue === "周日") {
|
|
11722
|
+
if (i === 0) dataNumArr.push(0);
|
|
11723
|
+
else {
|
|
11724
|
+
weekIndex++;
|
|
11725
|
+
dataNumArr.push(weekIndex * 7);
|
|
11726
|
+
}
|
|
11727
|
+
} else dataNumArr.push(chineseToNumber(lastTxt) + weekIndex * 7);
|
|
11640
11728
|
}
|
|
11641
11729
|
if (isReverse) {
|
|
11642
11730
|
data.reverse();
|
|
@@ -11671,12 +11759,13 @@ const AutoFillRules = {
|
|
|
11671
11759
|
const formattedValue = `${(_data$i5 = data[i]) === null || _data$i5 === void 0 ? void 0 : _data$i5.v}`;
|
|
11672
11760
|
if (formattedValue) {
|
|
11673
11761
|
const lastTxt = formattedValue.substr(formattedValue.length - 1, 1);
|
|
11674
|
-
if (formattedValue === "星期日")
|
|
11675
|
-
|
|
11676
|
-
|
|
11677
|
-
|
|
11678
|
-
|
|
11679
|
-
|
|
11762
|
+
if (formattedValue === "星期日") {
|
|
11763
|
+
if (i === 0) dataNumArr.push(0);
|
|
11764
|
+
else {
|
|
11765
|
+
weekIndex++;
|
|
11766
|
+
dataNumArr.push(weekIndex * 7);
|
|
11767
|
+
}
|
|
11768
|
+
} else dataNumArr.push(chineseToNumber(lastTxt) + weekIndex * 7);
|
|
11680
11769
|
}
|
|
11681
11770
|
}
|
|
11682
11771
|
if (isReverse) {
|
|
@@ -11718,12 +11807,15 @@ const AutoFillRules = {
|
|
|
11718
11807
|
for (let i = 0; i < data.length; i++) {
|
|
11719
11808
|
var _data$i6;
|
|
11720
11809
|
const formattedValue = `${(_data$i6 = data[i]) === null || _data$i6 === void 0 ? void 0 : _data$i6.v}`;
|
|
11721
|
-
if (formattedValue)
|
|
11722
|
-
|
|
11723
|
-
|
|
11724
|
-
|
|
11810
|
+
if (formattedValue) {
|
|
11811
|
+
if (formattedValue === series[0]) {
|
|
11812
|
+
if (i === 0) dataNumArr.push(0);
|
|
11813
|
+
else {
|
|
11814
|
+
cycleIndex++;
|
|
11815
|
+
dataNumArr.push(cycleIndex * series.length);
|
|
11816
|
+
}
|
|
11817
|
+
} else dataNumArr.push(series.indexOf(formattedValue) + cycleIndex * 7);
|
|
11725
11818
|
}
|
|
11726
|
-
else dataNumArr.push(series.indexOf(formattedValue) + cycleIndex * 7);
|
|
11727
11819
|
}
|
|
11728
11820
|
if (isReverse) {
|
|
11729
11821
|
data.reverse();
|
|
@@ -12311,10 +12403,11 @@ const ClearSelectionContentCommand = {
|
|
|
12311
12403
|
const sheetInterceptorService = accessor.get(SheetInterceptorService);
|
|
12312
12404
|
const redoMutations = [];
|
|
12313
12405
|
const undoMutations = [];
|
|
12406
|
+
const visibleRanges = getVisibleRanges(ranges, accessor, unitId, subUnitId);
|
|
12314
12407
|
const clearMutationParams = {
|
|
12315
12408
|
subUnitId,
|
|
12316
12409
|
unitId,
|
|
12317
|
-
cellValue: generateNullCellValue(
|
|
12410
|
+
cellValue: generateNullCellValue(visibleRanges)
|
|
12318
12411
|
};
|
|
12319
12412
|
const undoClearMutationParams = SetRangeValuesUndoMutationFactory(accessor, clearMutationParams);
|
|
12320
12413
|
redoMutations.push({
|
|
@@ -12437,7 +12530,7 @@ let SheetLazyExecuteScheduleService = class SheetLazyExecuteScheduleService exte
|
|
|
12437
12530
|
}
|
|
12438
12531
|
_scheduleNextIdle() {
|
|
12439
12532
|
if (this._idleCallbackId !== null) return;
|
|
12440
|
-
if (typeof requestIdleCallback !== "undefined") this._idleCallbackId = requestIdleCallback((deadline) => this._processIdleTasks(deadline), { timeout:
|
|
12533
|
+
if (typeof requestIdleCallback !== "undefined") this._idleCallbackId = requestIdleCallback((deadline) => this._processIdleTasks(deadline), { timeout: 6e4 });
|
|
12441
12534
|
else this._idleCallbackId = setTimeout(() => {
|
|
12442
12535
|
this._processIdleTasks({
|
|
12443
12536
|
didTimeout: false,
|
|
@@ -13506,7 +13599,8 @@ const SetColDataCommand = {
|
|
|
13506
13599
|
handler: (accessor, params) => {
|
|
13507
13600
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
13508
13601
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
13509
|
-
const
|
|
13602
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
13603
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
13510
13604
|
if (!target) return false;
|
|
13511
13605
|
const { columnData } = params;
|
|
13512
13606
|
const { unitId, subUnitId, worksheet } = target;
|
|
@@ -13543,7 +13637,8 @@ const SetSpecificColsVisibleCommand = {
|
|
|
13543
13637
|
const { unitId, subUnitId, ranges } = params;
|
|
13544
13638
|
const sheetInterceptorService = accessor.get(SheetInterceptorService);
|
|
13545
13639
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
13546
|
-
const
|
|
13640
|
+
const instanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
13641
|
+
const target = getSheetCommandTarget(instanceService, {
|
|
13547
13642
|
unitId,
|
|
13548
13643
|
subUnitId
|
|
13549
13644
|
});
|
|
@@ -13914,7 +14009,8 @@ const SetFrozenCommand = {
|
|
|
13914
14009
|
handler: (accessor, params) => {
|
|
13915
14010
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
13916
14011
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
13917
|
-
const
|
|
14012
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
14013
|
+
const target = getSheetCommandTarget(univerInstanceService, {
|
|
13918
14014
|
unitId: params.unitId,
|
|
13919
14015
|
subUnitId: params.subUnitId
|
|
13920
14016
|
});
|
|
@@ -13993,7 +14089,8 @@ const SetGridlinesColorCommand = {
|
|
|
13993
14089
|
handler: (accessor, params) => {
|
|
13994
14090
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
13995
14091
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
13996
|
-
const
|
|
14092
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
14093
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
13997
14094
|
if (!target) return false;
|
|
13998
14095
|
const { worksheet } = target;
|
|
13999
14096
|
const currentlyColor = worksheet.getConfig().gridlinesColor;
|
|
@@ -14077,44 +14174,45 @@ const SetProtectionCommand = {
|
|
|
14077
14174
|
const { unitId, subUnitId } = rule;
|
|
14078
14175
|
const redoMutations = [];
|
|
14079
14176
|
const undoMutations = [];
|
|
14080
|
-
if ((oldRule === null || oldRule === void 0 ? void 0 : oldRule.unitType) === rule.unitType)
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
14177
|
+
if ((oldRule === null || oldRule === void 0 ? void 0 : oldRule.unitType) === rule.unitType) {
|
|
14178
|
+
if (rule.unitType === _univerjs_protocol.UnitObject.Worksheet) {
|
|
14179
|
+
redoMutations.push({
|
|
14180
|
+
id: SetWorksheetProtectionMutation.id,
|
|
14181
|
+
params: {
|
|
14182
|
+
unitId,
|
|
14183
|
+
subUnitId,
|
|
14184
|
+
rule
|
|
14185
|
+
}
|
|
14186
|
+
});
|
|
14187
|
+
undoMutations.push({
|
|
14188
|
+
id: SetWorksheetProtectionMutation.id,
|
|
14189
|
+
params: {
|
|
14190
|
+
unitId,
|
|
14191
|
+
subUnitId,
|
|
14192
|
+
rule: oldRule
|
|
14193
|
+
}
|
|
14194
|
+
});
|
|
14195
|
+
} else {
|
|
14196
|
+
redoMutations.push({
|
|
14197
|
+
id: SetRangeProtectionMutation.id,
|
|
14198
|
+
params: {
|
|
14199
|
+
unitId,
|
|
14200
|
+
subUnitId,
|
|
14201
|
+
rule,
|
|
14202
|
+
ruleId: rule.id
|
|
14203
|
+
}
|
|
14204
|
+
});
|
|
14205
|
+
undoMutations.push({
|
|
14206
|
+
id: SetRangeProtectionMutation.id,
|
|
14207
|
+
params: {
|
|
14208
|
+
unitId,
|
|
14209
|
+
subUnitId,
|
|
14210
|
+
ruleId: oldRule.id,
|
|
14211
|
+
rule: oldRule
|
|
14212
|
+
}
|
|
14213
|
+
});
|
|
14214
|
+
}
|
|
14097
14215
|
} else {
|
|
14098
|
-
redoMutations.push({
|
|
14099
|
-
id: SetRangeProtectionMutation.id,
|
|
14100
|
-
params: {
|
|
14101
|
-
unitId,
|
|
14102
|
-
subUnitId,
|
|
14103
|
-
rule,
|
|
14104
|
-
ruleId: rule.id
|
|
14105
|
-
}
|
|
14106
|
-
});
|
|
14107
|
-
undoMutations.push({
|
|
14108
|
-
id: SetRangeProtectionMutation.id,
|
|
14109
|
-
params: {
|
|
14110
|
-
unitId,
|
|
14111
|
-
subUnitId,
|
|
14112
|
-
ruleId: oldRule.id,
|
|
14113
|
-
rule: oldRule
|
|
14114
|
-
}
|
|
14115
|
-
});
|
|
14116
|
-
}
|
|
14117
|
-
else {
|
|
14118
14216
|
if (oldRule) {
|
|
14119
14217
|
if (oldRule.unitType === _univerjs_protocol.UnitObject.Worksheet) {
|
|
14120
14218
|
redoMutations.push({
|
|
@@ -14233,7 +14331,8 @@ const SetRowDataCommand = {
|
|
|
14233
14331
|
handler: (accessor, params) => {
|
|
14234
14332
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
14235
14333
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
14236
|
-
const
|
|
14334
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
14335
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
14237
14336
|
if (!target) return false;
|
|
14238
14337
|
const { rowData } = params;
|
|
14239
14338
|
const { unitId, subUnitId, worksheet } = target;
|
|
@@ -14635,14 +14734,15 @@ const SetWorkbookNameCommand = {
|
|
|
14635
14734
|
name: params.name,
|
|
14636
14735
|
unitId: params.unitId
|
|
14637
14736
|
};
|
|
14638
|
-
|
|
14737
|
+
const redos = [
|
|
14639
14738
|
...interceptedCommands.preRedos ?? [],
|
|
14640
14739
|
{
|
|
14641
14740
|
id: SetWorkbookNameMutation.id,
|
|
14642
14741
|
params: redoMutationParams
|
|
14643
14742
|
},
|
|
14644
14743
|
...interceptedCommands.redos
|
|
14645
|
-
]
|
|
14744
|
+
];
|
|
14745
|
+
return (0, _univerjs_core.sequenceExecute)(redos, commandService).result;
|
|
14646
14746
|
}
|
|
14647
14747
|
};
|
|
14648
14748
|
|
|
@@ -14852,7 +14952,8 @@ const SetWorksheetColIsAutoWidthCommand = {
|
|
|
14852
14952
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
14853
14953
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
14854
14954
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
14855
|
-
const
|
|
14955
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
14956
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
14856
14957
|
if (!target) return false;
|
|
14857
14958
|
const { unitId, subUnitId } = target;
|
|
14858
14959
|
let ranges = [];
|
|
@@ -14892,7 +14993,8 @@ const SetWorksheetColumnCountCommand = {
|
|
|
14892
14993
|
const { unitId, subUnitId, columnCount } = params;
|
|
14893
14994
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
14894
14995
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
14895
|
-
|
|
14996
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
14997
|
+
if (!getSheetCommandTarget(univerInstanceService, params)) return false;
|
|
14896
14998
|
const redoMutationParams = {
|
|
14897
14999
|
unitId,
|
|
14898
15000
|
subUnitId,
|
|
@@ -14952,7 +15054,7 @@ const SetWorksheetHideMutationFactory = (accessor, params) => {
|
|
|
14952
15054
|
if (!target) throw new Error("[SetWorksheetHideMutationFactory]: worksheet is null error!");
|
|
14953
15055
|
const { worksheet } = target;
|
|
14954
15056
|
return {
|
|
14955
|
-
hidden: worksheet.
|
|
15057
|
+
hidden: worksheet.getHiddenState(),
|
|
14956
15058
|
unitId: params.unitId,
|
|
14957
15059
|
subUnitId: worksheet.getSheetId()
|
|
14958
15060
|
};
|
|
@@ -14965,7 +15067,8 @@ const SetWorksheetHideMutation = {
|
|
|
14965
15067
|
if (universheet == null) return false;
|
|
14966
15068
|
const worksheet = universheet.getSheetBySheetId(params.subUnitId);
|
|
14967
15069
|
if (!worksheet) return false;
|
|
14968
|
-
|
|
15070
|
+
if (params.hidden !== _univerjs_core.WorksheetHiddenState.VISIBLE && params.hidden !== _univerjs_core.WorksheetHiddenState.HIDDEN && params.hidden !== _univerjs_core.WorksheetHiddenState.VERY_HIDDEN) return false;
|
|
15071
|
+
worksheet.setHiddenState(params.hidden);
|
|
14969
15072
|
return true;
|
|
14970
15073
|
}
|
|
14971
15074
|
};
|
|
@@ -14983,14 +15086,19 @@ const SetWorksheetHideCommand = {
|
|
|
14983
15086
|
const target = getSheetCommandTarget(accessor.get(_univerjs_core.IUniverInstanceService), params);
|
|
14984
15087
|
if (!target) return false;
|
|
14985
15088
|
const { workbook, worksheet, unitId, subUnitId } = target;
|
|
14986
|
-
|
|
15089
|
+
const hidden = (params === null || params === void 0 ? void 0 : params.hidden) ?? _univerjs_core.WorksheetHiddenState.HIDDEN;
|
|
15090
|
+
const currentHiddenState = worksheet.getHiddenState();
|
|
15091
|
+
if (hidden !== _univerjs_core.WorksheetHiddenState.HIDDEN && hidden !== _univerjs_core.WorksheetHiddenState.VERY_HIDDEN) return false;
|
|
15092
|
+
if (currentHiddenState === hidden) return false;
|
|
15093
|
+
if ((params === null || params === void 0 ? void 0 : params.hidden) === void 0 && currentHiddenState !== _univerjs_core.WorksheetHiddenState.VISIBLE) return false;
|
|
14987
15094
|
const redoMutationParams = {
|
|
14988
15095
|
unitId,
|
|
14989
15096
|
subUnitId,
|
|
14990
|
-
hidden
|
|
15097
|
+
hidden
|
|
14991
15098
|
};
|
|
14992
15099
|
const undoMutationParams = SetWorksheetHideMutationFactory(accessor, redoMutationParams);
|
|
14993
|
-
|
|
15100
|
+
const visibleWorksheets = workbook.getSheets().filter((sheet) => sheet.getConfig().hidden === _univerjs_core.BooleanNumber.FALSE);
|
|
15101
|
+
if (currentHiddenState === _univerjs_core.WorksheetHiddenState.VISIBLE && visibleWorksheets.length === 1) {
|
|
14994
15102
|
errorService.emit(localeService.t("sheets.info.hideSheet"));
|
|
14995
15103
|
return false;
|
|
14996
15104
|
}
|
|
@@ -16155,12 +16263,10 @@ let WorksheetPermissionService = class WorksheetPermissionService extends _unive
|
|
|
16155
16263
|
this._permissionService.updatePermissionPoint(instance.id, true);
|
|
16156
16264
|
});
|
|
16157
16265
|
break;
|
|
16158
|
-
case "set":
|
|
16159
|
-
|
|
16160
|
-
|
|
16161
|
-
|
|
16162
|
-
});
|
|
16163
|
-
break;
|
|
16266
|
+
case "set": getAllWorksheetPermissionPoint().forEach((F) => {
|
|
16267
|
+
const instance = new F(info.unitId, info.subUnitId);
|
|
16268
|
+
this._permissionService.updatePermissionPoint(instance.id, info.rule);
|
|
16269
|
+
});
|
|
16164
16270
|
}
|
|
16165
16271
|
}));
|
|
16166
16272
|
}
|
|
@@ -16408,7 +16514,8 @@ const SetWorksheetRowCountCommand = {
|
|
|
16408
16514
|
const { unitId, subUnitId, rowCount } = params;
|
|
16409
16515
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
16410
16516
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
16411
|
-
|
|
16517
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
16518
|
+
if (!getSheetCommandTarget(univerInstanceService, params)) return false;
|
|
16412
16519
|
const redoMutationParams = {
|
|
16413
16520
|
unitId,
|
|
16414
16521
|
subUnitId,
|
|
@@ -16635,7 +16742,8 @@ const SetWorksheetRowIsAutoHeightCommand = {
|
|
|
16635
16742
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
16636
16743
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
16637
16744
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
16638
|
-
const
|
|
16745
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
16746
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
16639
16747
|
if (!target) return false;
|
|
16640
16748
|
const { unitId, subUnitId, worksheet } = target;
|
|
16641
16749
|
const ranges = (params === null || params === void 0 || (_params$ranges2 = params.ranges) === null || _params$ranges2 === void 0 ? void 0 : _params$ranges2.length) ? params.ranges : (_selectionManagerServ2 = selectionManagerService.getCurrentSelections()) === null || _selectionManagerServ2 === void 0 ? void 0 : _selectionManagerServ2.map((s) => s.range);
|
|
@@ -17576,6 +17684,8 @@ let AutoFillController = class AutoFillController extends _univerjs_core.Disposa
|
|
|
17576
17684
|
if (cellData) {
|
|
17577
17685
|
const old = this._beforeApplyData[rowIndex][colIndex] || {};
|
|
17578
17686
|
cellData.f = old.f;
|
|
17687
|
+
cellData.ft = old.ft;
|
|
17688
|
+
cellData.fd = old.fd;
|
|
17579
17689
|
cellData.si = old.si;
|
|
17580
17690
|
cellData.t = old.t;
|
|
17581
17691
|
cellData.v = old.v;
|
|
@@ -17735,7 +17845,7 @@ let CalculateResultApplyController = class CalculateResultApplyController extend
|
|
|
17735
17845
|
* @param unitId
|
|
17736
17846
|
* @param sheetId
|
|
17737
17847
|
* @param cellData
|
|
17738
|
-
* @returns
|
|
17848
|
+
* @returns Calculated cell data merged with number formats.
|
|
17739
17849
|
*/
|
|
17740
17850
|
_getMergedCellData(unitId, sheetId, cellData) {
|
|
17741
17851
|
const workbook = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
@@ -17744,7 +17854,8 @@ let CalculateResultApplyController = class CalculateResultApplyController extend
|
|
|
17744
17854
|
const oldCellDataMatrix = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getCellMatrix();
|
|
17745
17855
|
const cellDataMatrix = new _univerjs_core.ObjectMatrix(cellData);
|
|
17746
17856
|
cellDataMatrix.forValue((row, col, cell) => {
|
|
17747
|
-
const
|
|
17857
|
+
const oldCell = oldCellDataMatrix === null || oldCellDataMatrix === void 0 ? void 0 : oldCellDataMatrix.getValue(row, col);
|
|
17858
|
+
const newCell = (0, _univerjs_engine_formula.handleNumfmtInCell)(oldCell, cell, styles);
|
|
17748
17859
|
cellDataMatrix.setValue(row, col, newCell);
|
|
17749
17860
|
});
|
|
17750
17861
|
return cellDataMatrix.getMatrix();
|
|
@@ -18244,8 +18355,6 @@ let SheetPermissionCheckController = class SheetPermissionCheckController extend
|
|
|
18244
18355
|
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
18245
18356
|
}, params === null || params === void 0 ? void 0 : params.ranges, params === null || params === void 0 ? void 0 : params.unitId, params === null || params === void 0 ? void 0 : params.subUnitId);
|
|
18246
18357
|
errorMsg = this._localeService.t("sheets.permission.dialog.editErr");
|
|
18247
|
-
break;
|
|
18248
|
-
default: break;
|
|
18249
18358
|
}
|
|
18250
18359
|
if (!permission) this.blockExecuteWithoutPermission(errorMsg);
|
|
18251
18360
|
}
|
|
@@ -18995,14 +19104,11 @@ let ZebraCrossingCacheController = class ZebraCrossingCacheController extends _u
|
|
|
18995
19104
|
subUnitId = params.subUnitId;
|
|
18996
19105
|
}
|
|
18997
19106
|
break;
|
|
18998
|
-
case SetWorksheetRowHeightMutation.id:
|
|
18999
|
-
|
|
19000
|
-
|
|
19001
|
-
|
|
19002
|
-
|
|
19003
|
-
}
|
|
19004
|
-
break;
|
|
19005
|
-
default: break;
|
|
19107
|
+
case SetWorksheetRowHeightMutation.id: {
|
|
19108
|
+
const params = commandInfo.params;
|
|
19109
|
+
unitId = params.unitId;
|
|
19110
|
+
subUnitId = params.subUnitId;
|
|
19111
|
+
}
|
|
19006
19112
|
}
|
|
19007
19113
|
if (unitId && subUnitId) {
|
|
19008
19114
|
this._sheetRangeThemeModel.refreshSheetRowVisibleFuncSet(unitId, subUnitId);
|
|
@@ -19384,7 +19490,7 @@ RangeProtectionCache = __decorate([
|
|
|
19384
19490
|
//#endregion
|
|
19385
19491
|
//#region package.json
|
|
19386
19492
|
var name = "@univerjs/sheets";
|
|
19387
|
-
var version = "1.0.
|
|
19493
|
+
var version = "1.0.1";
|
|
19388
19494
|
|
|
19389
19495
|
//#endregion
|
|
19390
19496
|
//#region src/controllers/active-worksheet.controller.ts
|
|
@@ -20026,7 +20132,6 @@ let RangeProtectionRefRangeService = class RangeProtectionRefRangeService extend
|
|
|
20026
20132
|
case InsertColCommand.id: return this._getRefRangeMutationsByInsertCols(config.params, unitId, subUnitId);
|
|
20027
20133
|
case RemoveColCommand.id: return this._getRefRangeMutationsByDeleteCols(config.params, unitId, subUnitId);
|
|
20028
20134
|
case RemoveRowCommand.id: return this._getRefRangeMutationsByDeleteRows(config.params, unitId, subUnitId);
|
|
20029
|
-
default: break;
|
|
20030
20135
|
}
|
|
20031
20136
|
return {
|
|
20032
20137
|
redos: [],
|
|
@@ -20593,14 +20698,12 @@ let RangeProtectionService = class RangeProtectionService extends _univerjs_core
|
|
|
20593
20698
|
this._permissionService.deletePermissionPoint(instance.id);
|
|
20594
20699
|
});
|
|
20595
20700
|
break;
|
|
20596
|
-
case "set":
|
|
20597
|
-
|
|
20598
|
-
|
|
20599
|
-
|
|
20600
|
-
|
|
20601
|
-
|
|
20602
|
-
});
|
|
20603
|
-
break;
|
|
20701
|
+
case "set": if (info.oldRule.permissionId !== info.rule.permissionId) getAllRangePermissionPoint().forEach((F) => {
|
|
20702
|
+
const oldPermissionPoint = new F(info.unitId, info.subUnitId, info.oldRule.permissionId);
|
|
20703
|
+
this._permissionService.deletePermissionPoint(oldPermissionPoint.id);
|
|
20704
|
+
const newPermissionPoint = new F(info.unitId, info.subUnitId, info.rule.permissionId);
|
|
20705
|
+
this._permissionService.addPermissionPoint(newPermissionPoint);
|
|
20706
|
+
});
|
|
20604
20707
|
}
|
|
20605
20708
|
}));
|
|
20606
20709
|
}
|
|
@@ -21848,6 +21951,7 @@ exports.handleMoveRange = handleMoveRange;
|
|
|
21848
21951
|
exports.handleMoveRows = handleMoveRows;
|
|
21849
21952
|
exports.isCellImage = isCellImage;
|
|
21850
21953
|
exports.isSingleCellSelection = isSingleCellSelection;
|
|
21954
|
+
exports.prepareSetRangeValuesMutation = prepareSetRangeValuesMutation;
|
|
21851
21955
|
exports.rangeMerge = rangeMerge;
|
|
21852
21956
|
exports.rangeToDiscreteRange = rangeToDiscreteRange;
|
|
21853
21957
|
exports.rotateRange = rotateRange;
|