@univerjs/sheets 1.0.0-alpha.8 → 1.0.0-beta.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.
Files changed (90) hide show
  1. package/lib/cjs/facade.js +57 -59
  2. package/lib/cjs/index.js +286 -312
  3. package/lib/cjs/locale/ar-SA.js +1 -2
  4. package/lib/cjs/locale/ca-ES.js +1 -2
  5. package/lib/cjs/locale/de-DE.js +1 -2
  6. package/lib/cjs/locale/en-US.js +1 -2
  7. package/lib/cjs/locale/es-ES.js +1 -2
  8. package/lib/cjs/locale/fa-IR.js +1 -2
  9. package/lib/cjs/locale/fr-FR.js +1 -2
  10. package/lib/cjs/locale/id-ID.js +1 -2
  11. package/lib/cjs/locale/it-IT.js +1 -2
  12. package/lib/cjs/locale/ja-JP.js +1 -2
  13. package/lib/cjs/locale/ko-KR.js +1 -2
  14. package/lib/cjs/locale/pl-PL.js +1 -2
  15. package/lib/cjs/locale/pt-BR.js +1 -2
  16. package/lib/cjs/locale/ru-RU.js +1 -2
  17. package/lib/cjs/locale/sk-SK.js +1 -2
  18. package/lib/cjs/locale/vi-VN.js +1 -2
  19. package/lib/cjs/locale/zh-CN.js +2 -3
  20. package/lib/cjs/locale/zh-HK.js +2 -3
  21. package/lib/cjs/locale/zh-TW.js +2 -3
  22. package/lib/es/facade.js +57 -59
  23. package/lib/es/index.js +287 -314
  24. package/lib/es/locale/ar-SA.js +1 -2
  25. package/lib/es/locale/ca-ES.js +1 -2
  26. package/lib/es/locale/de-DE.js +1 -2
  27. package/lib/es/locale/en-US.js +1 -2
  28. package/lib/es/locale/es-ES.js +1 -2
  29. package/lib/es/locale/fa-IR.js +1 -2
  30. package/lib/es/locale/fr-FR.js +1 -2
  31. package/lib/es/locale/id-ID.js +1 -2
  32. package/lib/es/locale/it-IT.js +1 -2
  33. package/lib/es/locale/ja-JP.js +1 -2
  34. package/lib/es/locale/ko-KR.js +1 -2
  35. package/lib/es/locale/pl-PL.js +1 -2
  36. package/lib/es/locale/pt-BR.js +1 -2
  37. package/lib/es/locale/ru-RU.js +1 -2
  38. package/lib/es/locale/sk-SK.js +1 -2
  39. package/lib/es/locale/vi-VN.js +1 -2
  40. package/lib/es/locale/zh-CN.js +2 -3
  41. package/lib/es/locale/zh-HK.js +2 -3
  42. package/lib/es/locale/zh-TW.js +2 -3
  43. package/lib/facade.js +57 -59
  44. package/lib/index.js +287 -314
  45. package/lib/locale/ar-SA.js +1 -2
  46. package/lib/locale/ca-ES.js +1 -2
  47. package/lib/locale/de-DE.js +1 -2
  48. package/lib/locale/en-US.js +1 -2
  49. package/lib/locale/es-ES.js +1 -2
  50. package/lib/locale/fa-IR.js +1 -2
  51. package/lib/locale/fr-FR.js +1 -2
  52. package/lib/locale/id-ID.js +1 -2
  53. package/lib/locale/it-IT.js +1 -2
  54. package/lib/locale/ja-JP.js +1 -2
  55. package/lib/locale/ko-KR.js +1 -2
  56. package/lib/locale/pl-PL.js +1 -2
  57. package/lib/locale/pt-BR.js +1 -2
  58. package/lib/locale/ru-RU.js +1 -2
  59. package/lib/locale/sk-SK.js +1 -2
  60. package/lib/locale/vi-VN.js +1 -2
  61. package/lib/locale/zh-CN.js +2 -3
  62. package/lib/locale/zh-HK.js +2 -3
  63. package/lib/locale/zh-TW.js +2 -3
  64. package/lib/types/basics/cell-type.d.ts +2 -1
  65. package/lib/types/facade/f-worksheet.d.ts +10 -9
  66. package/lib/types/index.d.ts +1 -1
  67. package/lib/types/locale/en-US.d.ts +0 -1
  68. package/lib/types/services/ref-range/ref-range.service.d.ts +2 -0
  69. package/lib/umd/facade.js +1 -1
  70. package/lib/umd/index.js +2 -2
  71. package/lib/umd/locale/ar-SA.js +1 -1
  72. package/lib/umd/locale/ca-ES.js +1 -1
  73. package/lib/umd/locale/de-DE.js +1 -1
  74. package/lib/umd/locale/en-US.js +1 -1
  75. package/lib/umd/locale/es-ES.js +1 -1
  76. package/lib/umd/locale/fa-IR.js +1 -1
  77. package/lib/umd/locale/fr-FR.js +1 -1
  78. package/lib/umd/locale/id-ID.js +1 -1
  79. package/lib/umd/locale/it-IT.js +1 -1
  80. package/lib/umd/locale/ja-JP.js +1 -1
  81. package/lib/umd/locale/ko-KR.js +1 -1
  82. package/lib/umd/locale/pl-PL.js +1 -1
  83. package/lib/umd/locale/pt-BR.js +1 -1
  84. package/lib/umd/locale/ru-RU.js +1 -1
  85. package/lib/umd/locale/sk-SK.js +1 -1
  86. package/lib/umd/locale/vi-VN.js +1 -1
  87. package/lib/umd/locale/zh-CN.js +1 -1
  88. package/lib/umd/locale/zh-HK.js +1 -1
  89. package/lib/umd/locale/zh-TW.js +1 -1
  90. package/package.json +8 -8
package/lib/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { AUTO_HEIGHT_FOR_MERGED_CELLS, BORDER_KEYS, BORDER_STYLE_KEYS, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, COLOR_STYLE_KEYS, CellModeEnum, CellValueType, CommandType, CustomCommandExecutionError, DependentOn, Dimension, Direction, Disposable, DisposableCollection, DocumentDataModel, ErrorService, FontItalic, FontWeight, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, ILogService, IPermissionService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IUndoRedoService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, InterceptorManager, LRUMap, LocaleService, MAX_COLUMN_COUNT, MAX_ROW_COUNT, ObjectMatrix, Optional, PADDING_KEYS, PermissionStatus, Plugin, RANGE_TYPE, RTree, Range, Rectangle, RxDisposable, STYLE_KEYS, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, TextX, Tools, UniverInstanceType, UserManagerService, cellToRange, cloneWorksheetData, composeInterceptors, concatMatrixArray, createIdentifier, createInterceptorKey, createRowColIter, generateRandomId, getArrayLength, getIntersectRange, isBooleanString, isDefaultFormat, isFormulaId, isFormulaString, isICellData, isRealNum, isSafeNumeric, isTextFormat, mapObjectMatrix, merge, mergeIntervals, mergeOverrideWithDependencies, mergeWorksheetSnapshotWithDefault, moveMatrixArray, normalizeTextRuns, numfmt, queryObjectMatrix, regexp, registerDependencies, remove, selectionToArray, sequenceExecute, sliceMatrixArray, spliceArray, throttle, toDisposable, touchDependencies, willLoseNumericPrecision } from "@univerjs/core";
1
+ import { AUTO_HEIGHT_FOR_MERGED_CELLS, BORDER_KEYS, BORDER_STYLE_KEYS, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, COLOR_STYLE_KEYS, CellModeEnum, CellValueType, CommandType, CustomCommandExecutionError, DependentOn, Dimension, Direction, Disposable, DisposableCollection, DocumentDataModel, ErrorService, FontItalic, FontWeight, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, ILogService, IPermissionService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IUndoRedoService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, InterceptorManager, LRUMap, LocaleService, MAX_COLUMN_COUNT, MAX_ROW_COUNT, ObjectMatrix, Optional, PADDING_KEYS, PermissionStatus, Plugin, RANGE_TYPE, RTree, Range, Rectangle, RxDisposable, STYLE_KEYS, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, TextX, Tools, UniverInstanceType, UserManagerService, cellToRange, cloneWorksheetData, composeInterceptors, concatMatrixArray, createIdentifier, createInterceptorKey, createRowColIter, generateRandomId, getArrayLength, getIntersectRange, getNumfmtParseValueFilter, isBooleanString, isDefaultFormat, isFormulaId, isFormulaString, isICellData, isRealNum, isSafeNumeric, isTextFormat, mapObjectMatrix, merge, mergeIntervals, mergeOverrideWithDependencies, mergeWorksheetSnapshotWithDefault, moveMatrixArray, normalizeTextRuns, numfmt, regexp, registerDependencies, remove, selectionToArray, sequenceExecute, sliceMatrixArray, spliceArray, throttle, toDisposable, touchDependencies, willLoseNumericPrecision } from "@univerjs/core";
2
2
  import { BehaviorSubject, Subject, distinctUntilChanged, filter, first, map, merge as merge$1, of, share, shareReplay, skip, switchMap, takeUntil } from "rxjs";
3
3
  import { IDefinedNamesService, LexerTreeBuilder, RemoveDefinedNameMutation, SetDefinedNameMutation, SetDefinedNameMutationFactory, SetFormulaCalculationResultMutation, UniverFormulaEnginePlugin, deserializeRangeWithSheet, deserializeRangeWithSheetWithCache, handleNumfmtInCell, isReferenceStringWithEffectiveColumn, operatorToken, sequenceNodeType, stripErrorMargin } from "@univerjs/engine-formula";
4
4
  import { SpreadsheetSkeleton, cjk, precisionTo } from "@univerjs/engine-render";
@@ -7,6 +7,10 @@ import { filter as filter$1, map as map$1, takeUntil as takeUntil$1 } from "rxjs
7
7
  import { DataSyncPrimaryController } from "@univerjs/rpc";
8
8
 
9
9
  //#region src/basics/cell-type.ts
10
+ function isCellImage(documentData) {
11
+ var _documentData$drawing;
12
+ return !!(documentData === null || documentData === void 0 || (_documentData$drawing = documentData.drawingsOrder) === null || _documentData$drawing === void 0 ? void 0 : _documentData$drawing.length);
13
+ }
10
14
  /**
11
15
  * Get cell value type by style, new value and old value.
12
16
  * If the new value contains t, then take t directly. In other cases, we need to dynamically determine based on actual data and styles
@@ -283,10 +287,7 @@ let SheetInterceptorService = class SheetInterceptorService extends Disposable {
283
287
  interceptCommand(interceptor) {
284
288
  if (this._commandInterceptors.includes(interceptor)) throw new Error("[SheetInterceptorService]: Interceptor already exists!");
285
289
  this._commandInterceptors.push(interceptor);
286
- this._commandInterceptors.sort((a, b) => {
287
- var _b$priority, _a$priority;
288
- 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);
289
- });
290
+ this._commandInterceptors.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
290
291
  return this.disposeWithMe(toDisposable(() => remove(this._commandInterceptors, interceptor)));
291
292
  }
292
293
  /**
@@ -297,25 +298,16 @@ let SheetInterceptorService = class SheetInterceptorService extends Disposable {
297
298
  onCommandExecute(info) {
298
299
  const infos = this._commandInterceptors.map((i) => i.getMutations(info));
299
300
  return {
300
- preUndos: infos.map((i) => {
301
- var _i$preUndos;
302
- return (_i$preUndos = i.preUndos) !== null && _i$preUndos !== void 0 ? _i$preUndos : [];
303
- }).flat(),
301
+ preUndos: infos.map((i) => i.preUndos ?? []).flat(),
304
302
  undos: infos.map((i) => i.undos).flat(),
305
- preRedos: infos.map((i) => {
306
- var _i$preRedos;
307
- return (_i$preRedos = i.preRedos) !== null && _i$preRedos !== void 0 ? _i$preRedos : [];
308
- }).flat(),
303
+ preRedos: infos.map((i) => i.preRedos ?? []).flat(),
309
304
  redos: infos.map((i) => i.redos).flat()
310
305
  };
311
306
  }
312
307
  interceptAfterCommand(interceptor) {
313
308
  if (this._afterCommandInterceptors.includes(interceptor)) throw new Error("[SheetInterceptorService]: Interceptor already exists!");
314
309
  this._afterCommandInterceptors.push(interceptor);
315
- this._afterCommandInterceptors.sort((a, b) => {
316
- var _b$priority2, _a$priority2;
317
- 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);
318
- });
310
+ this._afterCommandInterceptors.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
319
311
  return this.disposeWithMe(toDisposable(() => remove(this._afterCommandInterceptors, interceptor)));
320
312
  }
321
313
  afterCommandExecute(info) {
@@ -328,24 +320,15 @@ let SheetInterceptorService = class SheetInterceptorService extends Disposable {
328
320
  interceptAutoHeight(interceptor) {
329
321
  if (this._autoHeightInterceptors.includes(interceptor)) throw new Error("[SheetInterceptorService]: Interceptor already exists!");
330
322
  this._autoHeightInterceptors.push(interceptor);
331
- this._autoHeightInterceptors.sort((a, b) => {
332
- var _b$priority3, _a$priority3;
333
- 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);
334
- });
323
+ this._autoHeightInterceptors.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
335
324
  return this.disposeWithMe(toDisposable(() => remove(this._autoHeightInterceptors, interceptor)));
336
325
  }
337
326
  generateMutationsOfAutoHeight(ctx) {
338
327
  const infos = this._autoHeightInterceptors.map((i) => i.getMutations(ctx));
339
328
  return {
340
- preUndos: infos.map((i) => {
341
- var _i$preUndos2;
342
- return (_i$preUndos2 = i.preUndos) !== null && _i$preUndos2 !== void 0 ? _i$preUndos2 : [];
343
- }).flat(),
329
+ preUndos: infos.map((i) => i.preUndos ?? []).flat(),
344
330
  undos: infos.map((i) => i.undos).flat(),
345
- preRedos: infos.map((i) => {
346
- var _i$preRedos2;
347
- return (_i$preRedos2 = i.preRedos) !== null && _i$preRedos2 !== void 0 ? _i$preRedos2 : [];
348
- }).flat(),
331
+ preRedos: infos.map((i) => i.preRedos ?? []).flat(),
349
332
  redos: infos.map((i) => i.redos).flat()
350
333
  };
351
334
  }
@@ -361,10 +344,7 @@ let SheetInterceptorService = class SheetInterceptorService extends Disposable {
361
344
  interceptBeforeCommand(interceptor) {
362
345
  if (this._beforeCommandInterceptor.includes(interceptor)) throw new Error("[SheetInterceptorService]: Interceptor already exists!");
363
346
  this._beforeCommandInterceptor.push(interceptor);
364
- this._beforeCommandInterceptor.sort((a, b) => {
365
- var _b$priority4, _a$priority4;
366
- 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);
367
- });
347
+ this._beforeCommandInterceptor.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
368
348
  return this.disposeWithMe(toDisposable(() => remove(this._beforeCommandInterceptor, interceptor)));
369
349
  }
370
350
  /**
@@ -383,24 +363,15 @@ let SheetInterceptorService = class SheetInterceptorService extends Disposable {
383
363
  interceptRanges(interceptor) {
384
364
  if (this._rangeInterceptors.includes(interceptor)) throw new Error("[SheetInterceptorService]: Interceptor already exists!");
385
365
  this._rangeInterceptors.push(interceptor);
386
- this._rangeInterceptors.sort((a, b) => {
387
- var _b$priority5, _a$priority5;
388
- 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);
389
- });
366
+ this._rangeInterceptors.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
390
367
  return this.disposeWithMe(toDisposable(() => remove(this._rangeInterceptors, interceptor)));
391
368
  }
392
369
  generateMutationsByRanges(info) {
393
370
  const infos = this._rangeInterceptors.map((i) => i.getMutations(info));
394
371
  return {
395
- preUndos: infos.map((i) => {
396
- var _i$preUndos3;
397
- return (_i$preUndos3 = i.preUndos) !== null && _i$preUndos3 !== void 0 ? _i$preUndos3 : [];
398
- }).flat(),
372
+ preUndos: infos.map((i) => i.preUndos ?? []).flat(),
399
373
  undos: infos.map((i) => i.undos).flat(),
400
- preRedos: infos.map((i) => {
401
- var _i$preRedos3;
402
- return (_i$preRedos3 = i.preRedos) !== null && _i$preRedos3 !== void 0 ? _i$preRedos3 : [];
403
- }).flat(),
374
+ preRedos: infos.map((i) => i.preRedos ?? []).flat(),
404
375
  redos: infos.map((i) => i.redos).flat()
405
376
  };
406
377
  }
@@ -432,10 +403,7 @@ let SheetInterceptorService = class SheetInterceptorService extends Disposable {
432
403
  if (!this._interceptorsByName.has(key)) this._interceptorsByName.set(key, []);
433
404
  const interceptors = this._interceptorsByName.get(key);
434
405
  interceptors.push(interceptor);
435
- const sortedInterceptors = interceptors.sort((a, b) => {
436
- var _b$priority6, _a$priority6;
437
- 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);
438
- });
406
+ const sortedInterceptors = interceptors.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
439
407
  this._invalidateComposedInterceptors();
440
408
  if (key === INTERCEPTOR_POINT.CELL_CONTENT) {
441
409
  const JOINED_EFFECT = InterceptorEffectEnum.Style | InterceptorEffectEnum.Value;
@@ -460,7 +428,7 @@ let SheetInterceptorService = class SheetInterceptorService extends Disposable {
460
428
  }
461
429
  fetchThroughInterceptors(name, effect, _key, filter) {
462
430
  const byNamesKey = effect === void 0 ? name : `${name}-${effect}`;
463
- const key = _key !== null && _key !== void 0 ? _key : byNamesKey;
431
+ const key = _key ?? byNamesKey;
464
432
  let composed = this._composedInterceptorByKey.get(key);
465
433
  if (!composed) {
466
434
  let interceptors = this._interceptorsByName.get(byNamesKey);
@@ -2169,7 +2137,7 @@ function handleStyle(styles, oldVal, newVal) {
2169
2137
  */
2170
2138
  function transformStyle(oldStyle, newStyle) {
2171
2139
  if (!newStyle || !Object.keys(newStyle).length) return oldStyle;
2172
- const backupStyle = Tools.deepClone(oldStyle !== null && oldStyle !== void 0 ? oldStyle : {}) || {};
2140
+ const backupStyle = Tools.deepClone(oldStyle ?? {}) || {};
2173
2141
  const styleRecord = newStyle;
2174
2142
  for (const key of STYLE_KEYS) {
2175
2143
  if (!Object.prototype.hasOwnProperty.call(styleRecord, key)) continue;
@@ -2353,7 +2321,7 @@ const SetRangeValuesUndoMutationFactory = (accessor, params) => {
2353
2321
  const cell = Tools.deepClone(cellMatrix === null || cellMatrix === void 0 ? void 0 : cellMatrix.getValue(row, col)) || {};
2354
2322
  const oldStyle = styles.getStyleByCell(cell);
2355
2323
  const newStyle = styles.getStyleByCell(newVal);
2356
- cell.s = isOverrideStyle && Object.prototype.hasOwnProperty.call(newVal !== null && newVal !== void 0 ? newVal : {}, "s") ? oldStyle !== null && oldStyle !== void 0 ? oldStyle : null : transformStyle(oldStyle, newStyle);
2324
+ cell.s = isOverrideStyle && Object.prototype.hasOwnProperty.call(newVal ?? {}, "s") ? oldStyle ?? null : transformStyle(oldStyle, newStyle);
2357
2325
  undoData.setValue(row, col, setNull(cell));
2358
2326
  });
2359
2327
  return {
@@ -2645,8 +2613,8 @@ const SetWorksheetRowHeightMutationFactory = (params, worksheet) => {
2645
2613
  const rowHeight = {};
2646
2614
  const manager = worksheet.getRowManager();
2647
2615
  for (const { startRow, endRow } of ranges) for (let rowIndex = startRow; rowIndex < endRow + 1; rowIndex++) {
2648
- var _manager$getRow$h, _manager$getRow;
2649
- rowHeight[rowIndex] = (_manager$getRow$h = (_manager$getRow = manager.getRow(rowIndex)) === null || _manager$getRow === void 0 ? void 0 : _manager$getRow.h) !== null && _manager$getRow$h !== void 0 ? _manager$getRow$h : worksheet.getConfig().defaultRowHeight;
2616
+ var _manager$getRow;
2617
+ rowHeight[rowIndex] = ((_manager$getRow = manager.getRow(rowIndex)) === null || _manager$getRow === void 0 ? void 0 : _manager$getRow.h) ?? worksheet.getConfig().defaultRowHeight;
2650
2618
  }
2651
2619
  return {
2652
2620
  unitId,
@@ -2675,11 +2643,11 @@ const SetWorksheetRowAutoHeightMutationFactory = (params, worksheet) => {
2675
2643
  const results = [];
2676
2644
  const manager = worksheet.getRowManager();
2677
2645
  for (const rowInfo of rowsAutoHeightInfo) {
2678
- var _manager$getRow$ah, _manager$getRow3;
2646
+ var _manager$getRow3;
2679
2647
  const { row } = rowInfo;
2680
2648
  results.push({
2681
2649
  row,
2682
- autoHeight: (_manager$getRow$ah = (_manager$getRow3 = manager.getRow(row)) === null || _manager$getRow3 === void 0 ? void 0 : _manager$getRow3.ah) !== null && _manager$getRow$ah !== void 0 ? _manager$getRow$ah : worksheet.getConfig().defaultRowHeight
2650
+ autoHeight: ((_manager$getRow3 = manager.getRow(row)) === null || _manager$getRow3 === void 0 ? void 0 : _manager$getRow3.ah) ?? worksheet.getConfig().defaultRowHeight
2683
2651
  });
2684
2652
  }
2685
2653
  return {
@@ -2713,10 +2681,7 @@ const SetWorksheetRowIsAutoHeightMutation = {
2713
2681
  for (const { startRow, endRow } of ranges) for (let rowIndex = startRow; rowIndex <= endRow; rowIndex++) {
2714
2682
  const row = manager.getRowOrCreate(rowIndex);
2715
2683
  if (typeof autoHeightInfo === "number") row.ia = autoHeightInfo;
2716
- else {
2717
- var _autoHeightInfo$rowIn;
2718
- row.ia = (_autoHeightInfo$rowIn = autoHeightInfo[rowIndex]) !== null && _autoHeightInfo$rowIn !== void 0 ? _autoHeightInfo$rowIn : void 0;
2719
- }
2684
+ else row.ia = autoHeightInfo[rowIndex] ?? void 0;
2720
2685
  }
2721
2686
  return true;
2722
2687
  }
@@ -4252,8 +4217,7 @@ var WorkbookSelectionModel = class extends Disposable {
4252
4217
  return this._worksheetSelections.get(sheetId);
4253
4218
  }
4254
4219
  getLastSelectionPrimaryCellOfWorksheet(sheetId) {
4255
- var _this$_worksheetLastS;
4256
- return (_this$_worksheetLastS = this._worksheetLastSelectionPrimaryCell.get(sheetId)) !== null && _this$_worksheetLastS !== void 0 ? _this$_worksheetLastS : null;
4220
+ return this._worksheetLastSelectionPrimaryCell.get(sheetId) ?? null;
4257
4221
  }
4258
4222
  setSelectionsOfWorksheet(sheetId, selections) {
4259
4223
  this._worksheetSelections.set(sheetId, [...selections]);
@@ -4407,16 +4371,15 @@ let SheetsSelectionsService = class SheetsSelectionsService extends RxDisposable
4407
4371
  setSelections(unitIdOrSelections, worksheetIdOrType, selectionDatas, type) {
4408
4372
  if (typeof unitIdOrSelections === "string" && typeof worksheetIdOrType === "string") {
4409
4373
  const unitId = unitIdOrSelections;
4410
- this._ensureWorkbookSelection(unitId).setSelections(worksheetIdOrType, selectionDatas || [], type !== null && type !== void 0 ? type : 3);
4374
+ this._ensureWorkbookSelection(unitId).setSelections(worksheetIdOrType, selectionDatas || [], type ?? 3);
4411
4375
  return;
4412
4376
  }
4413
4377
  const current = this._currentSelectionPos;
4414
4378
  if (!current) throw new Error("[SheetsSelectionsService]: cannot find current selection position!");
4415
4379
  const { unitId, sheetId } = current;
4416
4380
  if (typeof unitIdOrSelections === "object") {
4417
- var _ref;
4418
- const selectionData = unitIdOrSelections !== null && unitIdOrSelections !== void 0 ? unitIdOrSelections : selectionDatas;
4419
- const type = (_ref = worksheetIdOrType) !== null && _ref !== void 0 ? _ref : 3;
4381
+ const selectionData = unitIdOrSelections ?? selectionDatas;
4382
+ const type = worksheetIdOrType ?? 3;
4420
4383
  this._ensureWorkbookSelection(unitId).setSelections(sheetId, selectionData, type);
4421
4384
  }
4422
4385
  }
@@ -5114,12 +5077,11 @@ const MoveRangeCommand = {
5114
5077
  }
5115
5078
  };
5116
5079
  function _resolveMoveRangeContext(accessor, params) {
5117
- var _ref, _params$toUnitId, _params$fromSubUnitId, _ref2, _params$toSubUnitId;
5118
5080
  const univerInstanceService = accessor.get(IUniverInstanceService);
5119
5081
  const target = getSheetCommandTarget(univerInstanceService);
5120
- const unitId = (_ref = (_params$toUnitId = params.toUnitId) !== null && _params$toUnitId !== void 0 ? _params$toUnitId : params.fromUnitId) !== null && _ref !== void 0 ? _ref : target === null || target === void 0 ? void 0 : target.unitId;
5121
- const fromSubUnitId = (_params$fromSubUnitId = params.fromSubUnitId) !== null && _params$fromSubUnitId !== void 0 ? _params$fromSubUnitId : target === null || target === void 0 ? void 0 : target.subUnitId;
5122
- const toSubUnitId = (_ref2 = (_params$toSubUnitId = params.toSubUnitId) !== null && _params$toSubUnitId !== void 0 ? _params$toSubUnitId : params.fromSubUnitId) !== null && _ref2 !== void 0 ? _ref2 : target === null || target === void 0 ? void 0 : target.subUnitId;
5082
+ const unitId = params.toUnitId ?? params.fromUnitId ?? (target === null || target === void 0 ? void 0 : target.unitId);
5083
+ const fromSubUnitId = params.fromSubUnitId ?? (target === null || target === void 0 ? void 0 : target.subUnitId);
5084
+ const toSubUnitId = params.toSubUnitId ?? params.fromSubUnitId ?? (target === null || target === void 0 ? void 0 : target.subUnitId);
5123
5085
  if (!unitId || !fromSubUnitId || !toSubUnitId) return null;
5124
5086
  if (params.fromUnitId && params.toUnitId && params.fromUnitId !== params.toUnitId) return null;
5125
5087
  const workbook = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
@@ -5135,7 +5097,6 @@ function _resolveMoveRangeContext(accessor, params) {
5135
5097
  };
5136
5098
  }
5137
5099
  function getMoveRangeCommandMutations(accessor, params, options = {}) {
5138
- var _interceptorCommands$, _interceptorCommands$2;
5139
5100
  const { includeSelection = true, includeAfterCommand = true, includeAutoHeight = true } = options;
5140
5101
  const context = _resolveMoveRangeContext(accessor, params);
5141
5102
  if (!context) return null;
@@ -5157,12 +5118,12 @@ function getMoveRangeCommandMutations(accessor, params, options = {}) {
5157
5118
  };
5158
5119
  const interceptorCommands = sheetInterceptorService.onCommandExecute(commandInfo);
5159
5120
  const redos = [
5160
- ...(_interceptorCommands$ = interceptorCommands.preRedos) !== null && _interceptorCommands$ !== void 0 ? _interceptorCommands$ : [],
5121
+ ...interceptorCommands.preRedos ?? [],
5161
5122
  ...moveRangeMutations.redos,
5162
5123
  ...interceptorCommands.redos
5163
5124
  ];
5164
5125
  const undos = [
5165
- ...(_interceptorCommands$2 = interceptorCommands.preUndos) !== null && _interceptorCommands$2 !== void 0 ? _interceptorCommands$2 : [],
5126
+ ...interceptorCommands.preUndos ?? [],
5166
5127
  ...moveRangeMutations.undos,
5167
5128
  ...interceptorCommands.undos
5168
5129
  ];
@@ -5230,8 +5191,7 @@ function getMoveRangeUndoRedoMutations(accessor, from, to, ignoreMerge = false)
5230
5191
  const toRedoCellValue = new ObjectMatrix();
5231
5192
  const toUndoCellValue = new ObjectMatrix();
5232
5193
  Range.foreach(fromRange, (row, col) => {
5233
- var _Tools$deepClone;
5234
- const cellData = (_Tools$deepClone = Tools.deepClone(fromWorksheetCellMatrix.getValue(row, col))) !== null && _Tools$deepClone !== void 0 ? _Tools$deepClone : null;
5194
+ const cellData = Tools.deepClone(fromWorksheetCellMatrix.getValue(row, col)) ?? null;
5235
5195
  if (cellData === null || cellData === void 0 ? void 0 : cellData.s) cellData.s = workbook.getStyles().get(cellData.s);
5236
5196
  fromRedoCellValue.setValue(row, col, null);
5237
5197
  fromUndoCellValue.setValue(row, col, cellData);
@@ -5241,8 +5201,7 @@ function getMoveRangeUndoRedoMutations(accessor, from, to, ignoreMerge = false)
5241
5201
  toRedoCellValue.setValue(range.startRow, range.startColumn, Tools.deepClone(cellData));
5242
5202
  });
5243
5203
  Range.foreach(toRange, (row, col) => {
5244
- var _Tools$deepClone2;
5245
- const cellData = (_Tools$deepClone2 = Tools.deepClone(toWorksheetCellMatrix.getValue(row, col))) !== null && _Tools$deepClone2 !== void 0 ? _Tools$deepClone2 : null;
5204
+ const cellData = Tools.deepClone(toWorksheetCellMatrix.getValue(row, col)) ?? null;
5246
5205
  toUndoCellValue.setValue(row, col, cellData);
5247
5206
  });
5248
5207
  const redoMoveRangeMutationParams = {
@@ -5309,7 +5268,7 @@ const SetRangeValuesCommand = {
5309
5268
  id: "sheet.command.set-range-values",
5310
5269
  type: CommandType.COMMAND,
5311
5270
  handler: (accessor, params) => {
5312
- var _selectionManagerServ, _realCellValue;
5271
+ var _selectionManagerServ;
5313
5272
  const target = getSheetCommandTarget(accessor.get(IUniverInstanceService), params);
5314
5273
  if (!target) return false;
5315
5274
  const currentSelections = (_selectionManagerServ = accessor.get(SheetsSelectionsService).getCurrentSelections()) === null || _selectionManagerServ === void 0 ? void 0 : _selectionManagerServ.map((s) => s.range);
@@ -5337,7 +5296,7 @@ const SetRangeValuesCommand = {
5337
5296
  const setRangeValuesMutationRedoParams = {
5338
5297
  unitId,
5339
5298
  subUnitId,
5340
- cellValue: (_realCellValue = realCellValue) !== null && _realCellValue !== void 0 ? _realCellValue : cellValue.getMatrix()
5299
+ cellValue: realCellValue ?? cellValue.getMatrix()
5341
5300
  };
5342
5301
  const setRangeValuesMutationUndoParams = SetRangeValuesUndoMutationFactory(accessor, setRangeValuesMutationRedoParams);
5343
5302
  const cellHeights = mapObjectMatrix(setRangeValuesMutationRedoParams.cellValue, (row, col) => worksheet.getCellHeight(row, col) || void 0);
@@ -5629,7 +5588,6 @@ const DeleteRangeMoveLeftCommand = {
5629
5588
  type: CommandType.COMMAND,
5630
5589
  id: DeleteRangeMoveLeftCommandId,
5631
5590
  handler: async (accessor, params) => {
5632
- var _sheetInterceptor$pre, _sheetInterceptor$pre2;
5633
5591
  const commandService = accessor.get(ICommandService);
5634
5592
  const undoRedoService = accessor.get(IUndoRedoService);
5635
5593
  const univerInstanceService = accessor.get(IUniverInstanceService);
@@ -5655,11 +5613,11 @@ const DeleteRangeMoveLeftCommand = {
5655
5613
  params: { range }
5656
5614
  });
5657
5615
  const { redo: removeRangeRedo, undo: removeRangeUndo } = getRemoveRangeMutations(accessor, deleteRangeMutationParams);
5658
- const redos = [...(_sheetInterceptor$pre = sheetInterceptor.preRedos) !== null && _sheetInterceptor$pre !== void 0 ? _sheetInterceptor$pre : [], ...removeRangeRedo];
5616
+ const redos = [...sheetInterceptor.preRedos ?? [], ...removeRangeRedo];
5659
5617
  const undos = [...sheetInterceptor.undos, ...removeRangeUndo];
5660
5618
  redos.push(...sheetInterceptor.redos);
5661
5619
  redos.push(followSelectionOperation(range, workbook, worksheet));
5662
- undos.push(...(_sheetInterceptor$pre2 = sheetInterceptor.preUndos) !== null && _sheetInterceptor$pre2 !== void 0 ? _sheetInterceptor$pre2 : []);
5620
+ undos.push(...sheetInterceptor.preUndos ?? []);
5663
5621
  if (sequenceExecute(redos, commandService).result) {
5664
5622
  const afterInterceptors = sheetInterceptorService.afterCommandExecute({
5665
5623
  id: DeleteRangeMoveLeftCommand.id,
@@ -5689,7 +5647,6 @@ const DeleteRangeMoveUpCommand = {
5689
5647
  type: CommandType.COMMAND,
5690
5648
  id: DeleteRangeMoveUpCommandId,
5691
5649
  handler: async (accessor, params) => {
5692
- var _sheetInterceptor$pre, _sheetInterceptor$pre2;
5693
5650
  const commandService = accessor.get(ICommandService);
5694
5651
  const undoRedoService = accessor.get(IUndoRedoService);
5695
5652
  const univerInstanceService = accessor.get(IUniverInstanceService);
@@ -5715,11 +5672,11 @@ const DeleteRangeMoveUpCommand = {
5715
5672
  params: { range }
5716
5673
  });
5717
5674
  const { redo: removeRangeRedo, undo: removeRangeUndo } = getRemoveRangeMutations(accessor, deleteRangeMutationParams);
5718
- const redos = [...(_sheetInterceptor$pre = sheetInterceptor.preRedos) !== null && _sheetInterceptor$pre !== void 0 ? _sheetInterceptor$pre : [], ...removeRangeRedo];
5675
+ const redos = [...sheetInterceptor.preRedos ?? [], ...removeRangeRedo];
5719
5676
  const undos = [...sheetInterceptor.undos, ...removeRangeUndo];
5720
5677
  redos.push(...sheetInterceptor.redos);
5721
5678
  redos.push(followSelectionOperation(range, workbook, worksheet));
5722
- undos.push(...(_sheetInterceptor$pre2 = sheetInterceptor.preUndos) !== null && _sheetInterceptor$pre2 !== void 0 ? _sheetInterceptor$pre2 : []);
5679
+ undos.push(...sheetInterceptor.preUndos ?? []);
5723
5680
  if (sequenceExecute(redos, commandService).result) {
5724
5681
  const afterInterceptors = sheetInterceptorService.afterCommandExecute({
5725
5682
  id: DeleteRangeMoveUpCommand.id,
@@ -5749,7 +5706,6 @@ const InsertRangeMoveDownCommand = {
5749
5706
  type: CommandType.COMMAND,
5750
5707
  id: InsertRangeMoveDownCommandId,
5751
5708
  handler: async (accessor, params) => {
5752
- var _sheetInterceptor$pre, _sheetInterceptor$pre2;
5753
5709
  const commandService = accessor.get(ICommandService);
5754
5710
  const undoRedoService = accessor.get(IUndoRedoService);
5755
5711
  const univerInstanceService = accessor.get(IUniverInstanceService);
@@ -5825,8 +5781,8 @@ const InsertRangeMoveDownCommand = {
5825
5781
  });
5826
5782
  redoMutations.push(...sheetInterceptor.redos);
5827
5783
  redoMutations.push(followSelectionOperation(range, workbook, worksheet));
5828
- undoMutations.push(...(_sheetInterceptor$pre = sheetInterceptor.preUndos) !== null && _sheetInterceptor$pre !== void 0 ? _sheetInterceptor$pre : []);
5829
- redoMutations.unshift(...(_sheetInterceptor$pre2 = sheetInterceptor.preRedos) !== null && _sheetInterceptor$pre2 !== void 0 ? _sheetInterceptor$pre2 : []);
5784
+ undoMutations.push(...sheetInterceptor.preUndos ?? []);
5785
+ redoMutations.unshift(...sheetInterceptor.preRedos ?? []);
5830
5786
  undoMutations.unshift(...sheetInterceptor.undos);
5831
5787
  if (sequenceExecute(redoMutations, commandService).result) {
5832
5788
  const afterInterceptors = sheetInterceptorService.afterCommandExecute({
@@ -5857,7 +5813,6 @@ const InsertRangeMoveRightCommand = {
5857
5813
  type: CommandType.COMMAND,
5858
5814
  id: InsertRangeMoveRightCommandId,
5859
5815
  handler: async (accessor, params) => {
5860
- var _sheetInterceptor$pre, _sheetInterceptor$pre2;
5861
5816
  const commandService = accessor.get(ICommandService);
5862
5817
  const undoRedoService = accessor.get(IUndoRedoService);
5863
5818
  const univerInstanceService = accessor.get(IUniverInstanceService);
@@ -5933,8 +5888,8 @@ const InsertRangeMoveRightCommand = {
5933
5888
  });
5934
5889
  redoMutations.push(...sheetInterceptor.redos);
5935
5890
  redoMutations.push(followSelectionOperation(range, workbook, worksheet));
5936
- undoMutations.push(...(_sheetInterceptor$pre = sheetInterceptor.preUndos) !== null && _sheetInterceptor$pre !== void 0 ? _sheetInterceptor$pre : []);
5937
- redoMutations.unshift(...(_sheetInterceptor$pre2 = sheetInterceptor.preRedos) !== null && _sheetInterceptor$pre2 !== void 0 ? _sheetInterceptor$pre2 : []);
5891
+ undoMutations.push(...sheetInterceptor.preUndos ?? []);
5892
+ redoMutations.unshift(...sheetInterceptor.preRedos ?? []);
5938
5893
  undoMutations.unshift(...sheetInterceptor.undos);
5939
5894
  if (sequenceExecute(redoMutations, commandService).result) {
5940
5895
  const afterInterceptors = sheetInterceptorService.afterCommandExecute({
@@ -5987,7 +5942,6 @@ const InsertRowByRangeCommand = {
5987
5942
  type: CommandType.COMMAND,
5988
5943
  id: "sheet.command.insert-row-by-range",
5989
5944
  handler: (accessor, params) => {
5990
- var _intercepted$preRedos, _intercepted$redos, _intercepted$preUndos, _intercepted$undos;
5991
5945
  const target = getSheetCommandTarget(accessor.get(IUniverInstanceService), params);
5992
5946
  if (!target) throw new Error("Workbook or Worksheet not found at InsertRowByRangeCommand");
5993
5947
  const { workbook, worksheet, unitId, subUnitId } = target;
@@ -6030,11 +5984,11 @@ const InsertRowByRangeCommand = {
6030
5984
  id: InsertRowCommand.id,
6031
5985
  params
6032
5986
  });
6033
- redos.unshift(...(_intercepted$preRedos = intercepted.preRedos) !== null && _intercepted$preRedos !== void 0 ? _intercepted$preRedos : []);
6034
- redos.push(...(_intercepted$redos = intercepted.redos) !== null && _intercepted$redos !== void 0 ? _intercepted$redos : []);
5987
+ redos.unshift(...intercepted.preRedos ?? []);
5988
+ redos.push(...intercepted.redos ?? []);
6035
5989
  redos.push(followSelectionOperation(range, workbook, worksheet));
6036
- undos.unshift(...(_intercepted$preUndos = intercepted.preUndos) !== null && _intercepted$preUndos !== void 0 ? _intercepted$preUndos : []);
6037
- undos.push(...(_intercepted$undos = intercepted.undos) !== null && _intercepted$undos !== void 0 ? _intercepted$undos : []);
5990
+ undos.unshift(...intercepted.preUndos ?? []);
5991
+ undos.push(...intercepted.undos ?? []);
6038
5992
  if (sequenceExecute(redos, commandService).result) {
6039
5993
  const afterInterceptors = sheetInterceptorService.afterCommandExecute({
6040
5994
  id: InsertRowCommand.id,
@@ -6210,7 +6164,6 @@ const InsertColByRangeCommand = {
6210
6164
  type: CommandType.COMMAND,
6211
6165
  id: "sheet.command.insert-col-by-range",
6212
6166
  handler: (accessor, params) => {
6213
- var _intercepted$preRedos2, _intercepted$redos2, _intercepted$preUndos2, _intercepted$undos2;
6214
6167
  const target = getSheetCommandTarget(accessor.get(IUniverInstanceService), params);
6215
6168
  if (!target) throw new Error("Workbook or Worksheet not found at InsertColByRangeCommand");
6216
6169
  const { workbook, worksheet, unitId, subUnitId } = target;
@@ -6253,11 +6206,11 @@ const InsertColByRangeCommand = {
6253
6206
  id: InsertColCommand.id,
6254
6207
  params
6255
6208
  });
6256
- redos.unshift(...(_intercepted$preRedos2 = intercepted.preRedos) !== null && _intercepted$preRedos2 !== void 0 ? _intercepted$preRedos2 : []);
6257
- redos.push(...(_intercepted$redos2 = intercepted.redos) !== null && _intercepted$redos2 !== void 0 ? _intercepted$redos2 : []);
6209
+ redos.unshift(...intercepted.preRedos ?? []);
6210
+ redos.push(...intercepted.redos ?? []);
6258
6211
  redos.push(followSelectionOperation(range, workbook, worksheet));
6259
- undos.unshift(...(_intercepted$preUndos2 = intercepted.preUndos) !== null && _intercepted$preUndos2 !== void 0 ? _intercepted$preUndos2 : []);
6260
- undos.push(...(_intercepted$undos2 = intercepted.undos) !== null && _intercepted$undos2 !== void 0 ? _intercepted$undos2 : []);
6212
+ undos.unshift(...intercepted.preUndos ?? []);
6213
+ undos.push(...intercepted.undos ?? []);
6261
6214
  if (sequenceExecute(redos, commandService).result) {
6262
6215
  const afterInterceptors = sheetInterceptorService.afterCommandExecute({
6263
6216
  id: InsertColCommand.id,
@@ -6419,7 +6372,6 @@ const RemoveRowByRangeCommand = {
6419
6372
  type: CommandType.COMMAND,
6420
6373
  id: "sheet.command.remove-row-by-range",
6421
6374
  handler: (accessor, params) => {
6422
- var _intercepted$preRedos;
6423
6375
  if (!params) return false;
6424
6376
  const target = getSheetCommandTarget(accessor.get(IUniverInstanceService), params);
6425
6377
  if (!target) return false;
@@ -6466,11 +6418,10 @@ const RemoveRowByRangeCommand = {
6466
6418
  });
6467
6419
  const commandService = accessor.get(ICommandService);
6468
6420
  if (sequenceExecute([
6469
- ...(_intercepted$preRedos = intercepted.preRedos) !== null && _intercepted$preRedos !== void 0 ? _intercepted$preRedos : [],
6421
+ ...intercepted.preRedos ?? [],
6470
6422
  ...redoMutations,
6471
6423
  ...intercepted.redos
6472
6424
  ], commandService).result) {
6473
- var _intercepted$preUndos, _intercepted$preRedos2;
6474
6425
  setSelection(range, workbook, worksheet, commandService);
6475
6426
  const afterInterceptors = sheetInterceptorService.afterCommandExecute({
6476
6427
  id: RemoveRowCommandId,
@@ -6480,13 +6431,13 @@ const RemoveRowByRangeCommand = {
6480
6431
  accessor.get(IUndoRedoService).pushUndoRedo({
6481
6432
  unitID: unitId,
6482
6433
  undoMutations: [
6483
- ...(_intercepted$preUndos = intercepted.preUndos) !== null && _intercepted$preUndos !== void 0 ? _intercepted$preUndos : [],
6434
+ ...intercepted.preUndos ?? [],
6484
6435
  ...undoMutations,
6485
6436
  ...intercepted.undos,
6486
6437
  ...afterInterceptors.undos
6487
6438
  ],
6488
6439
  redoMutations: [
6489
- ...(_intercepted$preRedos2 = intercepted.preRedos) !== null && _intercepted$preRedos2 !== void 0 ? _intercepted$preRedos2 : [],
6440
+ ...intercepted.preRedos ?? [],
6490
6441
  ...redoMutations,
6491
6442
  ...intercepted.redos,
6492
6443
  ...afterInterceptors.redos
@@ -6538,7 +6489,6 @@ const RemoveColByRangeCommand = {
6538
6489
  type: CommandType.COMMAND,
6539
6490
  id: "sheet.command.remove-col-by-range",
6540
6491
  handler: (accessor, params) => {
6541
- var _intercepted$preRedos3;
6542
6492
  if (!params) return false;
6543
6493
  const target = getSheetCommandTarget(accessor.get(IUniverInstanceService), params);
6544
6494
  if (!target) return false;
@@ -6563,14 +6513,13 @@ const RemoveColByRangeCommand = {
6563
6513
  });
6564
6514
  const commandService = accessor.get(ICommandService);
6565
6515
  if (sequenceExecute([
6566
- ...(_intercepted$preRedos3 = intercepted.preRedos) !== null && _intercepted$preRedos3 !== void 0 ? _intercepted$preRedos3 : [],
6516
+ ...intercepted.preRedos ?? [],
6567
6517
  {
6568
6518
  id: RemoveColMutation.id,
6569
6519
  params: removeColParams
6570
6520
  },
6571
6521
  ...intercepted.redos
6572
6522
  ], commandService).result) {
6573
- var _intercepted$preUndos2, _intercepted$preRedos4;
6574
6523
  setSelection(range, workbook, worksheet, commandService);
6575
6524
  const afterInterceptors = sheetInterceptorService.afterCommandExecute({
6576
6525
  id: RemoveColCommandId,
@@ -6580,7 +6529,7 @@ const RemoveColByRangeCommand = {
6580
6529
  accessor.get(IUndoRedoService).pushUndoRedo({
6581
6530
  unitID: unitId,
6582
6531
  undoMutations: [
6583
- ...(_intercepted$preUndos2 = intercepted.preUndos) !== null && _intercepted$preUndos2 !== void 0 ? _intercepted$preUndos2 : [],
6532
+ ...intercepted.preUndos ?? [],
6584
6533
  {
6585
6534
  id: InsertColMutation.id,
6586
6535
  params: undoRemoveColParams
@@ -6593,7 +6542,7 @@ const RemoveColByRangeCommand = {
6593
6542
  ...afterInterceptors.undos
6594
6543
  ],
6595
6544
  redoMutations: [
6596
- ...(_intercepted$preRedos4 = intercepted.preRedos) !== null && _intercepted$preRedos4 !== void 0 ? _intercepted$preRedos4 : [],
6545
+ ...intercepted.preRedos ?? [],
6597
6546
  {
6598
6547
  id: RemoveColMutation.id,
6599
6548
  params: removeColParams
@@ -6695,7 +6644,6 @@ const MoveRowsCommand = {
6695
6644
  id: MoveRowsCommandId,
6696
6645
  type: CommandType.COMMAND,
6697
6646
  handler: (accessor, params) => {
6698
- var _interceptorCommands$, _interceptorCommands$2;
6699
6647
  const selectionManagerService = accessor.get(SheetsSelectionsService);
6700
6648
  const { fromRange: { startRow: fromRow }, toRange: { startRow: toRow }, range } = params;
6701
6649
  const selections = range ? [covertRangeToSelection(range)] : selectionManagerService.getCurrentSelections();
@@ -6737,11 +6685,11 @@ const MoveRowsCommand = {
6737
6685
  id: MoveRowsCommand.id,
6738
6686
  params
6739
6687
  });
6740
- const redos = [...(_interceptorCommands$ = interceptorCommands.preRedos) !== null && _interceptorCommands$ !== void 0 ? _interceptorCommands$ : [], {
6688
+ const redos = [...interceptorCommands.preRedos ?? [], {
6741
6689
  id: MoveRowsMutation.id,
6742
6690
  params: moveRowsParams
6743
6691
  }];
6744
- const undos = [...(_interceptorCommands$2 = interceptorCommands.preUndos) !== null && _interceptorCommands$2 !== void 0 ? _interceptorCommands$2 : [], {
6692
+ const undos = [...interceptorCommands.preUndos ?? [], {
6745
6693
  id: MoveRowsMutation.id,
6746
6694
  params: undoMoveRowsParams
6747
6695
  }];
@@ -6807,7 +6755,6 @@ const MoveColsCommand = {
6807
6755
  id: MoveColsCommandId,
6808
6756
  type: CommandType.COMMAND,
6809
6757
  handler: (accessor, params) => {
6810
- var _interceptorCommands$3, _interceptorCommands$4;
6811
6758
  const selectionManagerService = accessor.get(SheetsSelectionsService);
6812
6759
  const { fromRange: { startColumn: fromCol }, toRange: { startColumn: toCol }, range } = params;
6813
6760
  const selections = range ? [covertRangeToSelection(range)] : selectionManagerService.getCurrentSelections();
@@ -6849,11 +6796,11 @@ const MoveColsCommand = {
6849
6796
  id: MoveColsCommand.id,
6850
6797
  params
6851
6798
  });
6852
- const redos = [...(_interceptorCommands$3 = interceptorCommands.preRedos) !== null && _interceptorCommands$3 !== void 0 ? _interceptorCommands$3 : [], {
6799
+ const redos = [...interceptorCommands.preRedos ?? [], {
6853
6800
  id: MoveColsMutation.id,
6854
6801
  params: moveColsParams
6855
6802
  }];
6856
- const undos = [...(_interceptorCommands$4 = interceptorCommands.preUndos) !== null && _interceptorCommands$4 !== void 0 ? _interceptorCommands$4 : [], {
6803
+ const undos = [...interceptorCommands.preUndos ?? [], {
6857
6804
  id: MoveColsMutation.id,
6858
6805
  params: undoMoveColsParams
6859
6806
  }];
@@ -6928,7 +6875,6 @@ const ReorderRangeCommand = {
6928
6875
  id: ReorderRangeCommandId,
6929
6876
  type: CommandType.COMMAND,
6930
6877
  handler: (accessor, params) => {
6931
- var _interceptorCommands$, _interceptorCommands$2;
6932
6878
  const { subUnitId, unitId, range, order } = params;
6933
6879
  const commandService = accessor.get(ICommandService);
6934
6880
  const reorderMutation = {
@@ -6950,12 +6896,12 @@ const ReorderRangeCommand = {
6950
6896
  params
6951
6897
  });
6952
6898
  const redos = [
6953
- ...(_interceptorCommands$ = interceptorCommands.preRedos) !== null && _interceptorCommands$ !== void 0 ? _interceptorCommands$ : [],
6899
+ ...interceptorCommands.preRedos ?? [],
6954
6900
  reorderMutation,
6955
6901
  ...interceptorCommands.redos
6956
6902
  ];
6957
6903
  const undos = [
6958
- ...(_interceptorCommands$2 = interceptorCommands.preUndos) !== null && _interceptorCommands$2 !== void 0 ? _interceptorCommands$2 : [],
6904
+ ...interceptorCommands.preUndos ?? [],
6959
6905
  undoReorderMutation,
6960
6906
  ...interceptorCommands.undos
6961
6907
  ];
@@ -7052,6 +6998,88 @@ const rotateRange = (range) => {
7052
6998
  rangeType
7053
6999
  };
7054
7000
  };
7001
+ function mergeAndSortRanges(ranges) {
7002
+ return sortRanges(ranges.length > 1 ? Rectangle.mergeRanges(ranges) : ranges);
7003
+ }
7004
+ function sortRanges(ranges) {
7005
+ return ranges.sort((a, b) => a.startRow - b.startRow || a.startColumn - b.startColumn || a.endRow - b.endRow || a.endColumn - b.endColumn);
7006
+ }
7007
+ function translateRange(range, rowOffset, columnOffset) {
7008
+ return {
7009
+ startRow: range.startRow + rowOffset,
7010
+ endRow: range.endRow + rowOffset,
7011
+ startColumn: range.startColumn + columnOffset,
7012
+ endColumn: range.endColumn + columnOffset
7013
+ };
7014
+ }
7015
+ function moveRangeAlongAxis(targetRange, from, count, to, isRow) {
7016
+ let transforms;
7017
+ if (from > to) transforms = [
7018
+ {
7019
+ start: Number.NEGATIVE_INFINITY,
7020
+ end: to - 1,
7021
+ offset: 0
7022
+ },
7023
+ {
7024
+ start: to,
7025
+ end: from - 1,
7026
+ offset: count
7027
+ },
7028
+ {
7029
+ start: from,
7030
+ end: from + count - 1,
7031
+ offset: to - from
7032
+ },
7033
+ {
7034
+ start: from + count,
7035
+ end: Number.POSITIVE_INFINITY,
7036
+ offset: 0
7037
+ }
7038
+ ];
7039
+ else {
7040
+ if (from + count > to) throw new Error("Invalid move operation");
7041
+ transforms = [
7042
+ {
7043
+ start: Number.NEGATIVE_INFINITY,
7044
+ end: from - 1,
7045
+ offset: 0
7046
+ },
7047
+ {
7048
+ start: from,
7049
+ end: from + count - 1,
7050
+ offset: to - from - count
7051
+ },
7052
+ {
7053
+ start: from + count,
7054
+ end: to - 1,
7055
+ offset: -count
7056
+ },
7057
+ {
7058
+ start: to,
7059
+ end: Number.POSITIVE_INFINITY,
7060
+ offset: 0
7061
+ }
7062
+ ];
7063
+ }
7064
+ const rangeStart = isRow ? targetRange.startRow : targetRange.startColumn;
7065
+ const rangeEnd = isRow ? targetRange.endRow : targetRange.endColumn;
7066
+ return mergeAndSortRanges(transforms.flatMap(({ start, end, offset }) => {
7067
+ const intersectStart = Math.max(rangeStart, start);
7068
+ const intersectEnd = Math.min(rangeEnd, end);
7069
+ if (intersectStart > intersectEnd) return [];
7070
+ return [translateRange(isRow ? {
7071
+ startRow: intersectStart,
7072
+ endRow: intersectEnd,
7073
+ startColumn: targetRange.startColumn,
7074
+ endColumn: targetRange.endColumn
7075
+ } : {
7076
+ startRow: targetRange.startRow,
7077
+ endRow: targetRange.endRow,
7078
+ startColumn: intersectStart,
7079
+ endColumn: intersectEnd
7080
+ }, isRow ? offset : 0, isRow ? 0 : offset)];
7081
+ }));
7082
+ }
7055
7083
  /**
7056
7084
  * see docs/tldr/ref-range/move-rows-cols.tldr
7057
7085
  */
@@ -7157,33 +7185,33 @@ const handleMoveRowsCommon = (params, targetRange) => {
7157
7185
  const fromRow = fromRange.startRow;
7158
7186
  const count = fromRange.endRow - fromRange.startRow + 1;
7159
7187
  const toRow = toRange.startRow;
7160
- const matrix = new ObjectMatrix();
7161
- Range.foreach(targetRange, (row, col) => {
7162
- matrix.setValue(row, col, 1);
7163
- });
7164
- matrix.moveRows(fromRow, count, toRow);
7165
- return queryObjectMatrix(matrix, (value) => value === 1);
7188
+ return moveRangeAlongAxis(targetRange, fromRow, count, toRow, true);
7166
7189
  };
7167
7190
  const handleReorderRangeCommon = (param, targetRange) => {
7168
7191
  const { range, order } = param.params || {};
7169
7192
  if (!range || !order) return [targetRange];
7170
- const matrix = new ObjectMatrix();
7171
- Range.foreach(targetRange, (row, col) => {
7172
- matrix.setValue(row, col, 1);
7173
- });
7174
- const cacheMatrix = new ObjectMatrix();
7175
- Range.foreach(range, (row, col) => {
7176
- if (Object.prototype.hasOwnProperty.call(order, row)) {
7177
- var _matrix$getValue;
7178
- const targetRow = order[row];
7179
- const cloneCell = (_matrix$getValue = matrix.getValue(targetRow, col)) !== null && _matrix$getValue !== void 0 ? _matrix$getValue : 0;
7180
- cacheMatrix.setValue(row, col, cloneCell);
7181
- }
7182
- });
7183
- cacheMatrix.forValue((row, col, cellData) => {
7184
- matrix.setValue(row, col, cellData);
7193
+ const overwrittenRows = [];
7194
+ const additions = [];
7195
+ const startColumn = Math.max(range.startColumn, targetRange.startColumn);
7196
+ const endColumn = Math.min(range.endColumn, targetRange.endColumn);
7197
+ Object.keys(order).forEach((key) => {
7198
+ const row = Number(key);
7199
+ if (row < range.startRow || row > range.endRow) return;
7200
+ overwrittenRows.push({
7201
+ startRow: row,
7202
+ endRow: row,
7203
+ startColumn: range.startColumn,
7204
+ endColumn: range.endColumn
7205
+ });
7206
+ const sourceRow = order[row];
7207
+ if (sourceRow >= targetRange.startRow && sourceRow <= targetRange.endRow && startColumn <= endColumn) additions.push({
7208
+ startRow: row,
7209
+ endRow: row,
7210
+ startColumn,
7211
+ endColumn
7212
+ });
7185
7213
  });
7186
- return queryObjectMatrix(matrix, (value) => value === 1);
7214
+ return mergeAndSortRanges([...Rectangle.subtractMulti([targetRange], overwrittenRows), ...additions]);
7187
7215
  };
7188
7216
  const handleMoveCols = (params, targetRange) => {
7189
7217
  const { fromRange, toRange } = params.params || {};
@@ -7214,12 +7242,7 @@ const handleMoveColsCommon = (params, targetRange) => {
7214
7242
  const fromCol = fromRange.startColumn;
7215
7243
  const count = fromRange.endColumn - fromRange.startColumn + 1;
7216
7244
  const toCol = toRange.startColumn;
7217
- const matrix = new ObjectMatrix();
7218
- Range.foreach(targetRange, (row, col) => {
7219
- matrix.setValue(row, col, 1);
7220
- });
7221
- matrix.moveColumns(fromCol, count, toCol);
7222
- return queryObjectMatrix(matrix, (value) => value === 1);
7245
+ return moveRangeAlongAxis(targetRange, fromCol, count, toCol, false);
7223
7246
  };
7224
7247
  const handleMoveRange = (param, targetRange) => {
7225
7248
  var _param$params, _param$params2;
@@ -7249,33 +7272,12 @@ const handleMoveRangeCommon = (param, targetRange) => {
7249
7272
  const relativeRange = Rectangle.getRelativeRange(targetRange, fromRange);
7250
7273
  return [Rectangle.getPositionRange(relativeRange, toRange)];
7251
7274
  }
7252
- const matrix = new ObjectMatrix();
7253
- Range.foreach(targetRange, (row, col) => {
7254
- matrix.setValue(row, col, 1);
7255
- });
7256
- const fromMatrix = new ObjectMatrix();
7257
- const loopFromRange = getIntersectRange(fromRange, targetRange);
7258
- loopFromRange && Range.foreach(loopFromRange, (row, col) => {
7259
- if (matrix.getValue(row, col)) {
7260
- matrix.setValue(row, col, void 0);
7261
- fromMatrix.setValue(row, col, 1);
7262
- }
7263
- });
7264
7275
  const columnOffset = toRange.startColumn - fromRange.startColumn;
7265
7276
  const rowOffset = toRange.startRow - fromRange.startRow;
7266
- const loopToRange = {
7267
- startColumn: toRange.startColumn - columnOffset,
7268
- endColumn: toRange.endColumn - columnOffset,
7269
- startRow: toRange.startRow - rowOffset,
7270
- endRow: toRange.endRow - rowOffset
7271
- };
7272
- loopToRange && Range.foreach(loopToRange, (row, col) => {
7273
- var _fromMatrix$getValue;
7274
- const targetRow = row + rowOffset;
7275
- const targetCol = col + columnOffset;
7276
- matrix.setValue(targetRow, targetCol, (_fromMatrix$getValue = fromMatrix.getValue(row, col)) !== null && _fromMatrix$getValue !== void 0 ? _fromMatrix$getValue : 0);
7277
- });
7278
- return queryObjectMatrix(matrix, (value) => value === 1);
7277
+ const movedRange = getIntersectRange(fromRange, targetRange);
7278
+ const remainingRanges = Rectangle.subtractMulti([targetRange], [fromRange, toRange]);
7279
+ const translatedRanges = movedRange ? [translateRange(movedRange, rowOffset, columnOffset)] : [];
7280
+ return mergeAndSortRanges([...remainingRanges, ...translatedRanges]);
7279
7281
  };
7280
7282
  const handleBaseRemoveRange = (_removeRange, _targetRange) => {
7281
7283
  const removeRange = handleRangeTypeInput(_removeRange);
@@ -7485,16 +7487,7 @@ const handleInsertRangeMoveDownCommon = (param, targetRange) => {
7485
7487
  const noMoveRanges = Rectangle.subtract(targetRange, bottomRange);
7486
7488
  const targetMoveRange = getIntersectRange(bottomRange, targetRange);
7487
7489
  if (!targetMoveRange) return [targetRange];
7488
- const matrix = new ObjectMatrix();
7489
- noMoveRanges.forEach((noMoveRange) => {
7490
- Range.foreach(noMoveRange, (row, col) => {
7491
- matrix.setValue(row, col, 1);
7492
- });
7493
- });
7494
- targetMoveRange && Range.foreach(targetMoveRange, (row, col) => {
7495
- matrix.setValue(row + moveCount, col, 1);
7496
- });
7497
- return queryObjectMatrix(matrix, (v) => v === 1);
7490
+ return sortRanges([...noMoveRanges, translateRange(targetMoveRange, moveCount, 0)]);
7498
7491
  };
7499
7492
  const handleInsertRangeMoveRight = (param, targetRange) => {
7500
7493
  var _param$params11;
@@ -7522,16 +7515,7 @@ const handleInsertRangeMoveRightCommon = (param, targetRange) => {
7522
7515
  const noMoveRanges = Rectangle.subtract(targetRange, bottomRange);
7523
7516
  const targetMoveRange = getIntersectRange(bottomRange, targetRange);
7524
7517
  if (!targetMoveRange) return [targetRange];
7525
- const matrix = new ObjectMatrix();
7526
- noMoveRanges.forEach((noMoveRange) => {
7527
- Range.foreach(noMoveRange, (row, col) => {
7528
- matrix.setValue(row, col, 1);
7529
- });
7530
- });
7531
- targetMoveRange && Range.foreach(targetMoveRange, (row, col) => {
7532
- matrix.setValue(row, col + moveCount, 1);
7533
- });
7534
- return queryObjectMatrix(matrix, (v) => v === 1);
7518
+ return sortRanges([...noMoveRanges, translateRange(targetMoveRange, 0, moveCount)]);
7535
7519
  };
7536
7520
  const handleDeleteRangeMoveLeft = (param, targetRange) => {
7537
7521
  var _param$params13;
@@ -7561,23 +7545,11 @@ const handleDeleteRangeMoveLeftCommon = (param, targetRange) => {
7561
7545
  endColumn: Number.POSITIVE_INFINITY
7562
7546
  };
7563
7547
  const moveCount = range.endColumn - range.startColumn + 1;
7564
- const targetDeleteRange = getIntersectRange(range, targetRange);
7565
7548
  const noMoveRanges = Rectangle.subtract(targetRange, rightRange);
7566
7549
  const targetMoveRange = getIntersectRange(rightRange, targetRange);
7567
- if (!targetDeleteRange && !targetMoveRange) return [targetRange];
7568
- const matrix = new ObjectMatrix();
7569
- targetMoveRange && Range.foreach(targetMoveRange, (row, col) => {
7570
- matrix.setValue(row, col - moveCount, 1);
7571
- });
7572
- targetDeleteRange && Range.foreach(targetDeleteRange, (row, col) => {
7573
- matrix.setValue(row, col - moveCount, 0);
7574
- });
7575
- noMoveRanges.forEach((noMoveRange) => {
7576
- Range.foreach(noMoveRange, (row, col) => {
7577
- matrix.setValue(row, col, 1);
7578
- });
7579
- });
7580
- return queryObjectMatrix(matrix, (v) => v === 1);
7550
+ if (!targetMoveRange) return [targetRange];
7551
+ const movedRanges = targetMoveRange ? Rectangle.subtract(targetMoveRange, range).map((target) => translateRange(target, 0, -moveCount)) : [];
7552
+ return mergeAndSortRanges([...noMoveRanges, ...movedRanges]);
7581
7553
  };
7582
7554
  const handleDeleteRangeMoveUp = (param, targetRange) => {
7583
7555
  var _param$params15;
@@ -7606,27 +7578,14 @@ const handleDeleteRangeMoveUpCommon = (param, targetRange) => {
7606
7578
  endRow: Number.POSITIVE_INFINITY
7607
7579
  };
7608
7580
  const moveCount = range.endRow - range.startRow + 1;
7609
- const targetDeleteRange = getIntersectRange(range, targetRange);
7610
7581
  const noMoveRanges = Rectangle.subtract(targetRange, bottomRange);
7611
7582
  const targetMoveRange = getIntersectRange(bottomRange, targetRange);
7612
- if (!targetDeleteRange && !targetMoveRange) return [targetRange];
7613
- const matrix = new ObjectMatrix();
7614
- targetMoveRange && Range.foreach(targetMoveRange, (row, col) => {
7615
- matrix.setValue(row - moveCount, col, 1);
7616
- });
7617
- targetDeleteRange && Range.foreach(targetDeleteRange, (row, col) => {
7618
- matrix.setValue(row - moveCount, col, 0);
7619
- });
7620
- noMoveRanges.forEach((noMoveRange) => {
7621
- Range.foreach(noMoveRange, (row, col) => {
7622
- matrix.setValue(row, col, 1);
7623
- });
7624
- });
7625
- return queryObjectMatrix(matrix, (v) => v === 1);
7583
+ if (!targetMoveRange) return [targetRange];
7584
+ const movedRanges = targetMoveRange ? Rectangle.subtract(targetMoveRange, range).map((target) => translateRange(target, -moveCount, 0)) : [];
7585
+ return mergeAndSortRanges([...noMoveRanges, ...movedRanges]);
7626
7586
  };
7627
7587
  const handleRemoveRowCommon = (param, targetRange) => {
7628
- var _param$ranges;
7629
- const mergedRemoved = mergeIntervals(((_param$ranges = param.ranges) !== null && _param$ranges !== void 0 ? _param$ranges : [param.range]).map((range) => [range.startRow, range.endRow]));
7588
+ const mergedRemoved = mergeIntervals((param.ranges ?? [param.range]).map((range) => [range.startRow, range.endRow]));
7630
7589
  let targetStartRow = targetRange.startRow;
7631
7590
  let targetEndRow = targetRange.endRow;
7632
7591
  for (let i = mergedRemoved.length - 1; i >= 0; i--) {
@@ -8177,8 +8136,9 @@ function getSeparateEffectedRangesOnCommand(accessor, command) {
8177
8136
  const MERGE_REDO = createInterceptorKey("MERGE_REDO");
8178
8137
  const MERGE_UNDO = createInterceptorKey("MERGE_UNDO");
8179
8138
  var WatchRange = class extends Disposable {
8180
- constructor(_unitId, _subUnitId, _range, _callback, _skipIntersects = false) {
8139
+ constructor(revision, _unitId, _subUnitId, _range, _callback, _skipIntersects = false) {
8181
8140
  super();
8141
+ this.revision = revision;
8182
8142
  this._unitId = _unitId;
8183
8143
  this._subUnitId = _subUnitId;
8184
8144
  this._range = _range;
@@ -8217,6 +8177,8 @@ let RefRangeService = class RefRangeService extends Disposable {
8217
8177
  MERGE_UNDO
8218
8178
  }));
8219
8179
  _defineProperty(this, "_watchRanges", /* @__PURE__ */ new Set());
8180
+ _defineProperty(this, "_watchRangesListener", null);
8181
+ _defineProperty(this, "_watchRangeRevision", 0);
8220
8182
  _defineProperty(this, "_refRangeManagerMap", /* @__PURE__ */ new Map());
8221
8183
  _defineProperty(this, "_serializer", createRangeSerializer());
8222
8184
  _defineProperty(this, "_onRefRangeChange", () => {
@@ -8248,15 +8210,14 @@ let RefRangeService = class RefRangeService extends Disposable {
8248
8210
  }], unitId, subUnitId);
8249
8211
  }
8250
8212
  case EffectRefRangId.MoveRangeCommandId: {
8251
- var _params$toUnitId, _params$toSubUnitId;
8252
8213
  const params = command.params;
8253
8214
  const sourceTarget = getSheetCommandTarget(this._univerInstanceService, {
8254
8215
  unitId: params.fromUnitId,
8255
8216
  subUnitId: params.fromSubUnitId
8256
8217
  });
8257
8218
  const destinationTarget = getSheetCommandTarget(this._univerInstanceService, {
8258
- unitId: (_params$toUnitId = params.toUnitId) !== null && _params$toUnitId !== void 0 ? _params$toUnitId : params.fromUnitId,
8259
- subUnitId: (_params$toSubUnitId = params.toSubUnitId) !== null && _params$toSubUnitId !== void 0 ? _params$toSubUnitId : params.fromSubUnitId
8219
+ unitId: params.toUnitId ?? params.fromUnitId,
8220
+ subUnitId: params.toSubUnitId ?? params.fromSubUnitId
8260
8221
  });
8261
8222
  if (!sourceTarget && !destinationTarget) return [];
8262
8223
  if (sourceTarget && destinationTarget && sourceTarget.unitId === destinationTarget.unitId && sourceTarget.subUnitId === destinationTarget.subUnitId) return this._checkRange([params.fromRange, params.toRange], sourceTarget.unitId, sourceTarget.subUnitId);
@@ -8374,11 +8335,10 @@ let RefRangeService = class RefRangeService extends Disposable {
8374
8335
  result.push(v);
8375
8336
  return result;
8376
8337
  }, []).reduce((result, currentValue) => {
8377
- var _currentValue$preRedo, _currentValue$preUndo;
8378
8338
  result.redos.push(...currentValue.redos);
8379
8339
  result.undos.push(...currentValue.undos);
8380
- result.preRedos.push(...(_currentValue$preRedo = currentValue.preRedos) !== null && _currentValue$preRedo !== void 0 ? _currentValue$preRedo : []);
8381
- result.preUndos.push(...(_currentValue$preUndo = currentValue.preUndos) !== null && _currentValue$preUndo !== void 0 ? _currentValue$preUndo : []);
8340
+ result.preRedos.push(...currentValue.preRedos ?? []);
8341
+ result.preUndos.push(...currentValue.preUndos ?? []);
8382
8342
  return result;
8383
8343
  }, {
8384
8344
  redos: [],
@@ -8469,18 +8429,22 @@ let RefRangeService = class RefRangeService extends Disposable {
8469
8429
  });
8470
8430
  }
8471
8431
  watchRange(unitId, subUnitId, range, callback, skipIntersects) {
8472
- let watchRangesListener;
8473
- if (this._watchRanges.size === 0) watchRangesListener = this._commandService.onCommandExecuted((command) => {
8432
+ if (!this._watchRangesListener) this._watchRangesListener = this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
8474
8433
  if (command.type !== CommandType.MUTATION) return false;
8475
- for (const watchRange of this._watchRanges) watchRange.onMutation(command);
8476
- });
8477
- const watchRange = new WatchRange(unitId, subUnitId, range, callback, skipIntersects);
8434
+ const revision = this._watchRangeRevision;
8435
+ for (const watchRange of this._watchRanges) {
8436
+ if (watchRange.revision > revision) continue;
8437
+ watchRange.onMutation(command);
8438
+ }
8439
+ }));
8440
+ const watchRange = new WatchRange(++this._watchRangeRevision, unitId, subUnitId, range, callback, skipIntersects);
8478
8441
  this._watchRanges.add(watchRange);
8479
8442
  const teardownWatching = toDisposable(() => {
8480
8443
  this._watchRanges.delete(watchRange);
8481
8444
  if (this._watchRanges.size === 0) {
8482
- watchRangesListener === null || watchRangesListener === void 0 || watchRangesListener.dispose();
8483
- watchRangesListener = null;
8445
+ var _this$_watchRangesLis;
8446
+ (_this$_watchRangesLis = this._watchRangesListener) === null || _this$_watchRangesLis === void 0 || _this$_watchRangesLis.dispose();
8447
+ this._watchRangesListener = null;
8484
8448
  }
8485
8449
  });
8486
8450
  const registerToService = this.disposeWithMe(teardownWatching);
@@ -8874,11 +8838,10 @@ let MergeCellController = class MergeCellController extends Disposable {
8874
8838
  };
8875
8839
  }
8876
8840
  _handleMoveRangeCommand(params, unitId, subUnitId) {
8877
- var _params$fromSubUnitId, _params$toSubUnitId;
8878
8841
  const workbook = getWorkbook(this._univerInstanceService, unitId);
8879
8842
  if (!workbook) return this._handleNull();
8880
- const sourceSubUnitId = (_params$fromSubUnitId = params.fromSubUnitId) !== null && _params$fromSubUnitId !== void 0 ? _params$fromSubUnitId : subUnitId;
8881
- const targetSubUnitId = (_params$toSubUnitId = params.toSubUnitId) !== null && _params$toSubUnitId !== void 0 ? _params$toSubUnitId : sourceSubUnitId;
8843
+ const sourceSubUnitId = params.fromSubUnitId ?? subUnitId;
8844
+ const targetSubUnitId = params.toSubUnitId ?? sourceSubUnitId;
8882
8845
  const sourceWorksheet = getWorksheet(workbook, sourceSubUnitId);
8883
8846
  const targetWorksheet = getWorksheet(workbook, targetSubUnitId);
8884
8847
  if (!sourceWorksheet || !targetWorksheet) return this._handleNull();
@@ -9796,8 +9759,8 @@ function getClearContentMutationParamForRange(worksheet, range) {
9796
9759
  let leftTopCellValue = null;
9797
9760
  cellMatrix.forValue((row, col, cellData) => {
9798
9761
  if (cellData && row >= startRow && col >= startColumn) {
9799
- var _cellData$p$body$data, _cellData$p;
9800
- if (!leftTopCellValue && worksheet.cellHasValue(cellData) && (cellData.v !== "" || ((_cellData$p$body$data = (_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) !== null && _cellData$p$body$data !== void 0 ? _cellData$p$body$data : 0) > 2)) leftTopCellValue = cellData;
9762
+ var _cellData$p;
9763
+ 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;
9801
9764
  redoMatrix.setValue(row, col, cellData.s ? {
9802
9765
  v: null,
9803
9766
  t: null,
@@ -12620,7 +12583,6 @@ function splitCellDataIntoBatches(unitId, subUnitId, cellData, batchSize) {
12620
12583
  }
12621
12584
  const COPY_SHEET_COMMAND_ID = "sheet.command.copy-sheet";
12622
12585
  function buildCopySheetMutations(accessor, workbook, worksheet, unitId, subUnitId, localeService, sheetInterceptorService) {
12623
- var _intercepted$preRedos, _intercepted$preUndos;
12624
12586
  const pluginConfig = accessor.get(IConfigService).getConfig(SHEETS_PLUGIN_CONFIG_KEY);
12625
12587
  const largeSheetConfig = {
12626
12588
  ...defaultLargeSheetOperationConfig,
@@ -12665,7 +12627,7 @@ function buildCopySheetMutations(accessor, workbook, worksheet, unitId, subUnitI
12665
12627
  });
12666
12628
  return {
12667
12629
  redos: [
12668
- ...(_intercepted$preRedos = intercepted.preRedos) !== null && _intercepted$preRedos !== void 0 ? _intercepted$preRedos : [],
12630
+ ...intercepted.preRedos ?? [],
12669
12631
  {
12670
12632
  id: InsertSheetMutation.id,
12671
12633
  params: insertSheetMutationParams
@@ -12673,7 +12635,7 @@ function buildCopySheetMutations(accessor, workbook, worksheet, unitId, subUnitI
12673
12635
  ...intercepted.redos
12674
12636
  ],
12675
12637
  undos: [
12676
- ...(_intercepted$preUndos = intercepted.preUndos) !== null && _intercepted$preUndos !== void 0 ? _intercepted$preUndos : [],
12638
+ ...intercepted.preUndos ?? [],
12677
12639
  {
12678
12640
  id: RemoveSheetMutation.id,
12679
12641
  params: removeSheetMutationParams
@@ -12888,8 +12850,7 @@ const InsertSheetCommand = {
12888
12850
  const sheetName = sheet === null || sheet === void 0 ? void 0 : sheet.name;
12889
12851
  const sheetConfig = mergeWorksheetSnapshotWithDefault(sheet || {});
12890
12852
  if (params) {
12891
- var _params$index;
12892
- index = (_params$index = params.index) !== null && _params$index !== void 0 ? _params$index : index;
12853
+ index = params.index ?? index;
12893
12854
  sheetConfig.id = sheetId || generateRandomId();
12894
12855
  sheetConfig.name = sheetName ? workbook.uniqueSheetName(sheetName) : workbook.generateNewSheetName(`${localeService.t("sheets.tabs.sheet")}`);
12895
12856
  } else {
@@ -13004,7 +12965,6 @@ const RemoveDefinedNameCommand = {
13004
12965
  id: "sheet.command.remove-defined-name",
13005
12966
  type: CommandType.COMMAND,
13006
12967
  handler: (accessor, params) => {
13007
- var _interceptorCommands$, _interceptorCommands$2;
13008
12968
  const commandService = accessor.get(ICommandService);
13009
12969
  const undoRedoService = accessor.get(IUndoRedoService);
13010
12970
  const sheetInterceptorService = accessor.get(SheetInterceptorService);
@@ -13015,7 +12975,7 @@ const RemoveDefinedNameCommand = {
13015
12975
  params
13016
12976
  });
13017
12977
  const redos = [
13018
- ...(_interceptorCommands$ = interceptorCommands.preRedos) !== null && _interceptorCommands$ !== void 0 ? _interceptorCommands$ : [],
12978
+ ...interceptorCommands.preRedos ?? [],
13019
12979
  {
13020
12980
  id: RemoveDefinedNameMutation.id,
13021
12981
  params: removeSheetMutationParams
@@ -13023,7 +12983,7 @@ const RemoveDefinedNameCommand = {
13023
12983
  ...interceptorCommands.redos
13024
12984
  ];
13025
12985
  const undos = [
13026
- ...(_interceptorCommands$2 = interceptorCommands.preUndos) !== null && _interceptorCommands$2 !== void 0 ? _interceptorCommands$2 : [],
12986
+ ...interceptorCommands.preUndos ?? [],
13027
12987
  {
13028
12988
  id: SetDefinedNameMutation.id,
13029
12989
  params: removeSheetMutationParams
@@ -13051,7 +13011,6 @@ const RemoveSheetCommand = {
13051
13011
  id: "sheet.command.remove-sheet",
13052
13012
  type: CommandType.COMMAND,
13053
13013
  handler: (accessor, params) => {
13054
- var _intercepted$preRedos, _intercepted$preUndos;
13055
13014
  const commandService = accessor.get(ICommandService);
13056
13015
  const undoRedoService = accessor.get(IUndoRedoService);
13057
13016
  const univerInstanceService = accessor.get(IUniverInstanceService);
@@ -13081,7 +13040,7 @@ const RemoveSheetCommand = {
13081
13040
  }
13082
13041
  });
13083
13042
  const redos = [
13084
- ...(_intercepted$preRedos = intercepted.preRedos) !== null && _intercepted$preRedos !== void 0 ? _intercepted$preRedos : [],
13043
+ ...intercepted.preRedos ?? [],
13085
13044
  {
13086
13045
  id: RemoveSheetMutation.id,
13087
13046
  params: RemoveSheetMutationParams
@@ -13089,7 +13048,7 @@ const RemoveSheetCommand = {
13089
13048
  ...intercepted.redos
13090
13049
  ];
13091
13050
  const undos = isLargeSheet ? [] : [
13092
- ...(_intercepted$preUndos = intercepted.preUndos) !== null && _intercepted$preUndos !== void 0 ? _intercepted$preUndos : [],
13051
+ ...intercepted.preUndos ?? [],
13093
13052
  {
13094
13053
  id: InsertSheetMutation.id,
13095
13054
  params: InsertSheetMutationParams
@@ -13619,7 +13578,6 @@ const SetSpecificColsVisibleCommand = {
13619
13578
  });
13620
13579
  const interceptedResult = sequenceExecute([...intercepted.redos], commandService);
13621
13580
  if (result.result && interceptedResult.result) {
13622
- var _intercepted$undos, _intercepted$preRedos;
13623
13581
  const afterInterceptors = sheetInterceptorService.afterCommandExecute({
13624
13582
  id: SetSpecificColsVisibleCommand.id,
13625
13583
  params
@@ -13636,11 +13594,11 @@ const SetSpecificColsVisibleCommand = {
13636
13594
  id: SetSelectionsOperation.id,
13637
13595
  params: undoSetSelectionsOperationParams
13638
13596
  },
13639
- ...(_intercepted$undos = intercepted.undos) !== null && _intercepted$undos !== void 0 ? _intercepted$undos : [],
13597
+ ...intercepted.undos ?? [],
13640
13598
  ...afterInterceptors.undos
13641
13599
  ],
13642
13600
  redoMutations: [
13643
- ...(_intercepted$preRedos = intercepted.preRedos) !== null && _intercepted$preRedos !== void 0 ? _intercepted$preRedos : [],
13601
+ ...intercepted.preRedos ?? [],
13644
13602
  {
13645
13603
  id: SetColVisibleMutation.id,
13646
13604
  params: redoMutationParams
@@ -13730,7 +13688,6 @@ const SetColHiddenCommand = {
13730
13688
  });
13731
13689
  const interceptedResult = sequenceExecute([...intercepted.redos], commandService);
13732
13690
  if (result.result && interceptedResult.result) {
13733
- var _intercepted$undos2, _intercepted$preRedos2;
13734
13691
  const afterInterceptors = sheetInterceptorService.afterCommandExecute({
13735
13692
  id: SetColHiddenCommand.id,
13736
13693
  params: redoMutationParams
@@ -13747,11 +13704,11 @@ const SetColHiddenCommand = {
13747
13704
  id: SetSelectionsOperation.id,
13748
13705
  params: undoSetSelectionsOperationParams
13749
13706
  },
13750
- ...(_intercepted$undos2 = intercepted.undos) !== null && _intercepted$undos2 !== void 0 ? _intercepted$undos2 : [],
13707
+ ...intercepted.undos ?? [],
13751
13708
  ...afterInterceptors.undos
13752
13709
  ],
13753
13710
  redoMutations: [
13754
- ...(_intercepted$preRedos2 = intercepted.preRedos) !== null && _intercepted$preRedos2 !== void 0 ? _intercepted$preRedos2 : [],
13711
+ ...intercepted.preRedos ?? [],
13755
13712
  {
13756
13713
  id: SetColHiddenMutation.id,
13757
13714
  params: redoMutationParams
@@ -13860,7 +13817,6 @@ const SetDefinedNameCommand = {
13860
13817
  id: "sheet.command.set-defined-name",
13861
13818
  type: CommandType.COMMAND,
13862
13819
  handler: (accessor, params) => {
13863
- var _interceptorCommands$, _interceptorCommands$2;
13864
13820
  const commandService = accessor.get(ICommandService);
13865
13821
  const undoRedoService = accessor.get(IUndoRedoService);
13866
13822
  const sheetInterceptorService = accessor.get(SheetInterceptorService);
@@ -13872,7 +13828,7 @@ const SetDefinedNameCommand = {
13872
13828
  params
13873
13829
  });
13874
13830
  const redos = [
13875
- ...(_interceptorCommands$ = interceptorCommands.preRedos) !== null && _interceptorCommands$ !== void 0 ? _interceptorCommands$ : [],
13831
+ ...interceptorCommands.preRedos ?? [],
13876
13832
  ...oldDefinedNameMutationParams ? [{
13877
13833
  id: RemoveDefinedNameMutation.id,
13878
13834
  params: oldDefinedNameMutationParams
@@ -13884,7 +13840,7 @@ const SetDefinedNameCommand = {
13884
13840
  ...interceptorCommands.redos
13885
13841
  ];
13886
13842
  const undos = [
13887
- ...(_interceptorCommands$2 = interceptorCommands.preUndos) !== null && _interceptorCommands$2 !== void 0 ? _interceptorCommands$2 : [],
13843
+ ...interceptorCommands.preUndos ?? [],
13888
13844
  {
13889
13845
  id: RemoveDefinedNameMutation.id,
13890
13846
  params: newDefinedNameMutationParams
@@ -14350,7 +14306,6 @@ const SetSpecificRowsVisibleCommand = {
14350
14306
  });
14351
14307
  const interceptedResult = sequenceExecute([...intercepted.redos], commandService);
14352
14308
  if (result.result && interceptedResult.result) {
14353
- var _intercepted$preUndos, _intercepted$undos, _intercepted$preRedos;
14354
14309
  const afterInterceptors = sheetInterceptorService.afterCommandExecute({
14355
14310
  id: SetSpecificRowsVisibleCommand.id,
14356
14311
  params
@@ -14359,7 +14314,7 @@ const SetSpecificRowsVisibleCommand = {
14359
14314
  undoRedoService.pushUndoRedo({
14360
14315
  unitID: unitId,
14361
14316
  undoMutations: [
14362
- ...(_intercepted$preUndos = intercepted.preUndos) !== null && _intercepted$preUndos !== void 0 ? _intercepted$preUndos : [],
14317
+ ...intercepted.preUndos ?? [],
14363
14318
  {
14364
14319
  id: SetRowHiddenMutation.id,
14365
14320
  params: undoMutationParams
@@ -14368,11 +14323,11 @@ const SetSpecificRowsVisibleCommand = {
14368
14323
  id: SetSelectionsOperation.id,
14369
14324
  params: undoSetSelectionsOperationParams
14370
14325
  },
14371
- ...(_intercepted$undos = intercepted.undos) !== null && _intercepted$undos !== void 0 ? _intercepted$undos : [],
14326
+ ...intercepted.undos ?? [],
14372
14327
  ...afterInterceptors.undos
14373
14328
  ],
14374
14329
  redoMutations: [
14375
- ...(_intercepted$preRedos = intercepted.preRedos) !== null && _intercepted$preRedos !== void 0 ? _intercepted$preRedos : [],
14330
+ ...intercepted.preRedos ?? [],
14376
14331
  {
14377
14332
  id: SetRowVisibleMutation.id,
14378
14333
  params: redoMutationParams
@@ -14414,7 +14369,7 @@ const SetRowHiddenCommand = {
14414
14369
  type: CommandType.COMMAND,
14415
14370
  id: "sheet.command.set-rows-hidden",
14416
14371
  handler: (accessor, params) => {
14417
- var _params$ranges, _intercepted$preRedos2;
14372
+ var _params$ranges;
14418
14373
  const selectionManagerService = accessor.get(SheetsSelectionsService);
14419
14374
  const commandService = accessor.get(ICommandService);
14420
14375
  const undoRedoService = accessor.get(IUndoRedoService);
@@ -14456,7 +14411,7 @@ const SetRowHiddenCommand = {
14456
14411
  params: redoMutationParams
14457
14412
  });
14458
14413
  if (sequenceExecute([
14459
- ...(_intercepted$preRedos2 = intercepted.preRedos) !== null && _intercepted$preRedos2 !== void 0 ? _intercepted$preRedos2 : [],
14414
+ ...intercepted.preRedos ?? [],
14460
14415
  {
14461
14416
  id: SetRowHiddenMutation.id,
14462
14417
  params: redoMutationParams
@@ -14467,7 +14422,6 @@ const SetRowHiddenCommand = {
14467
14422
  },
14468
14423
  ...intercepted.redos
14469
14424
  ], commandService).result) {
14470
- var _intercepted$preUndos2, _intercepted$undos2, _intercepted$preRedos3;
14471
14425
  const afterInterceptors = sheetInterceptorService.afterCommandExecute({
14472
14426
  id: SetRowHiddenCommand.id,
14473
14427
  params: redoMutationParams
@@ -14476,7 +14430,7 @@ const SetRowHiddenCommand = {
14476
14430
  undoRedoService.pushUndoRedo({
14477
14431
  unitID: unitId,
14478
14432
  undoMutations: [
14479
- ...(_intercepted$preUndos2 = intercepted.preUndos) !== null && _intercepted$preUndos2 !== void 0 ? _intercepted$preUndos2 : [],
14433
+ ...intercepted.preUndos ?? [],
14480
14434
  {
14481
14435
  id: SetRowVisibleMutation.id,
14482
14436
  params: undoMutationParams
@@ -14485,11 +14439,11 @@ const SetRowHiddenCommand = {
14485
14439
  id: SetSelectionsOperation.id,
14486
14440
  params: undoSetSelectionsOperationParams
14487
14441
  },
14488
- ...(_intercepted$undos2 = intercepted.undos) !== null && _intercepted$undos2 !== void 0 ? _intercepted$undos2 : [],
14442
+ ...intercepted.undos ?? [],
14489
14443
  ...afterInterceptors.undos
14490
14444
  ],
14491
14445
  redoMutations: [
14492
- ...(_intercepted$preRedos3 = intercepted.preRedos) !== null && _intercepted$preRedos3 !== void 0 ? _intercepted$preRedos3 : [],
14446
+ ...intercepted.preRedos ?? [],
14493
14447
  {
14494
14448
  id: SetRowHiddenMutation.id,
14495
14449
  params: redoMutationParams
@@ -14661,7 +14615,6 @@ const SetWorkbookNameCommand = {
14661
14615
  type: CommandType.COMMAND,
14662
14616
  id: "sheet.command.set-workbook-name",
14663
14617
  handler: (accessor, params) => {
14664
- var _interceptedCommands$;
14665
14618
  const commandService = accessor.get(ICommandService);
14666
14619
  const sheetInterceptorService = accessor.get(SheetInterceptorService);
14667
14620
  if (!getSheetCommandTargetWorkbook(accessor.get(IUniverInstanceService), params)) return false;
@@ -14674,7 +14627,7 @@ const SetWorkbookNameCommand = {
14674
14627
  unitId: params.unitId
14675
14628
  };
14676
14629
  return sequenceExecute([
14677
- ...(_interceptedCommands$ = interceptedCommands.preRedos) !== null && _interceptedCommands$ !== void 0 ? _interceptedCommands$ : [],
14630
+ ...interceptedCommands.preRedos ?? [],
14678
14631
  {
14679
14632
  id: SetWorkbookNameMutation.id,
14680
14633
  params: redoMutationParams
@@ -14850,7 +14803,6 @@ const SetColWidthCommand = {
14850
14803
  });
14851
14804
  const result = sequenceExecute([...intercepted.redos, ...autoHeightRedos], commandService);
14852
14805
  if (setColWidthResult && result.result) {
14853
- var _intercepted$preUndos, _intercepted$preRedos;
14854
14806
  const afterInterceptors = sheetInterceptorService.afterCommandExecute({
14855
14807
  id: SetColWidthCommand.id,
14856
14808
  params: redoMutationParams
@@ -14859,7 +14811,7 @@ const SetColWidthCommand = {
14859
14811
  undoRedoService.pushUndoRedo({
14860
14812
  unitID: unitId,
14861
14813
  undoMutations: [
14862
- ...(_intercepted$preUndos = intercepted.preUndos) !== null && _intercepted$preUndos !== void 0 ? _intercepted$preUndos : [],
14814
+ ...intercepted.preUndos ?? [],
14863
14815
  {
14864
14816
  id: SetWorksheetColWidthMutation.id,
14865
14817
  params: undoMutationParams
@@ -14869,7 +14821,7 @@ const SetColWidthCommand = {
14869
14821
  ...autoHeightUndos
14870
14822
  ],
14871
14823
  redoMutations: [
14872
- ...(_intercepted$preRedos = intercepted.preRedos) !== null && _intercepted$preRedos !== void 0 ? _intercepted$preRedos : [],
14824
+ ...intercepted.preRedos ?? [],
14873
14825
  {
14874
14826
  id: SetWorksheetColWidthMutation.id,
14875
14827
  params: redoMutationParams
@@ -15085,7 +15037,6 @@ const SetWorksheetNameCommand = {
15085
15037
  type: CommandType.COMMAND,
15086
15038
  id: "sheet.command.set-worksheet-name",
15087
15039
  handler: (accessor, params) => {
15088
- var _interceptorCommands$, _interceptorCommands$2;
15089
15040
  const commandService = accessor.get(ICommandService);
15090
15041
  const undoRedoService = accessor.get(IUndoRedoService);
15091
15042
  const sheetInterceptorService = accessor.get(SheetInterceptorService);
@@ -15103,7 +15054,7 @@ const SetWorksheetNameCommand = {
15103
15054
  params
15104
15055
  });
15105
15056
  const redos = [
15106
- ...(_interceptorCommands$ = interceptorCommands.preRedos) !== null && _interceptorCommands$ !== void 0 ? _interceptorCommands$ : [],
15057
+ ...interceptorCommands.preRedos ?? [],
15107
15058
  {
15108
15059
  id: SetWorksheetNameMutation.id,
15109
15060
  params: redoMutationParams
@@ -15111,7 +15062,7 @@ const SetWorksheetNameCommand = {
15111
15062
  ...interceptorCommands.redos
15112
15063
  ];
15113
15064
  const undos = [
15114
- ...(_interceptorCommands$2 = interceptorCommands.preUndos) !== null && _interceptorCommands$2 !== void 0 ? _interceptorCommands$2 : [],
15065
+ ...interceptorCommands.preUndos ?? [],
15115
15066
  {
15116
15067
  id: SetWorksheetNameMutation.id,
15117
15068
  params: undoMutationParams
@@ -16412,10 +16363,7 @@ const SetWorksheetRightToLeftCommand = {
16412
16363
  if (!target) return false;
16413
16364
  const { unitId, subUnitId } = target;
16414
16365
  let rightToLeft = BooleanNumber.FALSE;
16415
- if (params) {
16416
- var _params$rightToLeft;
16417
- rightToLeft = (_params$rightToLeft = params.rightToLeft) !== null && _params$rightToLeft !== void 0 ? _params$rightToLeft : BooleanNumber.FALSE;
16418
- }
16366
+ if (params) rightToLeft = params.rightToLeft ?? BooleanNumber.FALSE;
16419
16367
  const setWorksheetRightToLeftMutationParams = {
16420
16368
  rightToLeft,
16421
16369
  unitId,
@@ -16548,7 +16496,6 @@ const DeltaRowHeightCommand = {
16548
16496
  }], commandService);
16549
16497
  const interceptedResult = sequenceExecute([...intercepted.redos], commandService);
16550
16498
  if (result.result && interceptedResult.result) {
16551
- var _intercepted$preUndos, _intercepted$preRedos;
16552
16499
  const afterInterceptors = sheetInterceptorService.afterCommandExecute({
16553
16500
  id: DeltaRowHeightCommand.id,
16554
16501
  params: redoMutationParams
@@ -16557,7 +16504,7 @@ const DeltaRowHeightCommand = {
16557
16504
  undoRedoService.pushUndoRedo({
16558
16505
  unitID: unitId,
16559
16506
  undoMutations: [
16560
- ...(_intercepted$preUndos = intercepted.preUndos) !== null && _intercepted$preUndos !== void 0 ? _intercepted$preUndos : [],
16507
+ ...intercepted.preUndos ?? [],
16561
16508
  {
16562
16509
  id: SetWorksheetRowHeightMutation.id,
16563
16510
  params: undoMutationParams
@@ -16570,7 +16517,7 @@ const DeltaRowHeightCommand = {
16570
16517
  ...afterInterceptors.undos
16571
16518
  ],
16572
16519
  redoMutations: [
16573
- ...(_intercepted$preRedos = intercepted.preRedos) !== null && _intercepted$preRedos !== void 0 ? _intercepted$preRedos : [],
16520
+ ...intercepted.preRedos ?? [],
16574
16521
  {
16575
16522
  id: SetWorksheetRowHeightMutation.id,
16576
16523
  params: redoMutationParams
@@ -16630,7 +16577,6 @@ const SetRowHeightCommand = {
16630
16577
  });
16631
16578
  const sheetInterceptorResult = sequenceExecute([...intercepted.redos], commandService);
16632
16579
  if (result.result && sheetInterceptorResult.result) {
16633
- var _intercepted$preRedos2, _intercepted$preRedos3;
16634
16580
  const afterInterceptors = sheetInterceptorService.afterCommandExecute({
16635
16581
  id: SetRowHeightCommand.id,
16636
16582
  params: redoMutationParams
@@ -16639,7 +16585,7 @@ const SetRowHeightCommand = {
16639
16585
  undoRedoService.pushUndoRedo({
16640
16586
  unitID: unitId,
16641
16587
  undoMutations: [
16642
- ...(_intercepted$preRedos2 = intercepted.preRedos) !== null && _intercepted$preRedos2 !== void 0 ? _intercepted$preRedos2 : [],
16588
+ ...intercepted.preRedos ?? [],
16643
16589
  {
16644
16590
  id: SetWorksheetRowHeightMutation.id,
16645
16591
  params: undoMutationParams
@@ -16652,7 +16598,7 @@ const SetRowHeightCommand = {
16652
16598
  ...afterInterceptors.undos
16653
16599
  ],
16654
16600
  redoMutations: [
16655
- ...(_intercepted$preRedos3 = intercepted.preRedos) !== null && _intercepted$preRedos3 !== void 0 ? _intercepted$preRedos3 : [],
16601
+ ...intercepted.preRedos ?? [],
16656
16602
  {
16657
16603
  id: SetWorksheetRowHeightMutation.id,
16658
16604
  params: redoMutationParams
@@ -17006,18 +16952,26 @@ const TextToNumberCommand = {
17006
16952
  const undoRedoService = accessor.get(IUndoRedoService);
17007
16953
  const { worksheet, unitId, subUnitId } = target;
17008
16954
  const newCellValue = new ObjectMatrix();
16955
+ const setNumfmtCells = [];
17009
16956
  const removeNumfmtRanges = [];
17010
16957
  for (let i = 0; i < ranges.length; i++) for (let r = ranges[i].startRow; r <= ranges[i].endRow; r++) for (let c = ranges[i].startColumn; c <= ranges[i].endColumn; c++) {
17011
16958
  var _worksheet$getStyleDa, _cell$s;
17012
16959
  if (newCellValue.getValue(r, c)) continue;
17013
16960
  const cell = worksheet.getCellRaw(r, c);
17014
16961
  const pattern = typeof (cell === null || cell === void 0 ? void 0 : cell.s) === "string" ? (_worksheet$getStyleDa = worksheet.getStyleDataByHash(cell.s)) === null || _worksheet$getStyleDa === void 0 || (_worksheet$getStyleDa = _worksheet$getStyleDa.n) === null || _worksheet$getStyleDa === void 0 ? void 0 : _worksheet$getStyleDa.pattern : cell === null || cell === void 0 || (_cell$s = cell.s) === null || _cell$s === void 0 || (_cell$s = _cell$s.n) === null || _cell$s === void 0 ? void 0 : _cell$s.pattern;
17015
- if (cell && cell.v && (cell.t !== CellValueType.NUMBER || isTextFormat(pattern)) && isRealNum(cell.v)) {
16962
+ const parsedValue = typeof (cell === null || cell === void 0 ? void 0 : cell.v) === "string" ? getNumfmtParseValueFilter(cell.v) : null;
16963
+ const numberValue = isRealNum(cell === null || cell === void 0 ? void 0 : cell.v) ? Number(cell === null || cell === void 0 ? void 0 : cell.v) : typeof (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.v) === "number" ? parsedValue.v : null;
16964
+ if (cell && cell.v && (cell.t !== CellValueType.NUMBER || isTextFormat(pattern)) && numberValue !== null) {
17016
16965
  newCellValue.setValue(r, c, {
17017
- v: Number(cell.v),
16966
+ v: numberValue,
17018
16967
  t: CellValueType.NUMBER
17019
16968
  });
17020
- if (isTextFormat(pattern)) removeNumfmtRanges.push({
16969
+ if ((parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.z) && (!pattern || isTextFormat(pattern))) setNumfmtCells.push({
16970
+ pattern: parsedValue.z,
16971
+ row: r,
16972
+ col: c
16973
+ });
16974
+ else if (isTextFormat(pattern)) removeNumfmtRanges.push({
17021
16975
  startRow: r,
17022
16976
  endRow: r,
17023
16977
  startColumn: c,
@@ -17038,6 +16992,14 @@ const TextToNumberCommand = {
17038
16992
  id: SetRangeValuesMutation.id,
17039
16993
  params: SetRangeValuesUndoMutationFactory(accessor, setRangeValuesMutationParams)
17040
16994
  }];
16995
+ if (setNumfmtCells.length) {
16996
+ const setNumfmtMutationParams = transformCellsToRange(unitId, subUnitId, setNumfmtCells);
16997
+ redos.push({
16998
+ id: SetNumfmtMutation.id,
16999
+ params: setNumfmtMutationParams
17000
+ });
17001
+ undos.push(...factorySetNumfmtUndoMutation(accessor, setNumfmtMutationParams));
17002
+ }
17041
17003
  if (removeNumfmtRanges.length) {
17042
17004
  const removeNumfmtMutationParams = {
17043
17005
  unitId,
@@ -17852,14 +17814,14 @@ const effectedByOnlyLocalMutationIds = [
17852
17814
  ];
17853
17815
  let SheetsFreezeSyncController = class SheetsFreezeSyncController extends Disposable {
17854
17816
  constructor(_univerInstanceService, _commandService, _configService) {
17855
- var _this$_configService$, _this$_configService$2;
17817
+ var _this$_configService$;
17856
17818
  super();
17857
17819
  this._univerInstanceService = _univerInstanceService;
17858
17820
  this._commandService = _commandService;
17859
17821
  this._configService = _configService;
17860
17822
  _defineProperty(this, "_d", new DisposableCollection());
17861
17823
  _defineProperty(this, "_enabled", true);
17862
- const freezeSync = (_this$_configService$ = (_this$_configService$2 = this._configService.getConfig("sheets.config")) === null || _this$_configService$2 === void 0 ? void 0 : _this$_configService$2.freezeSync) !== null && _this$_configService$ !== void 0 ? _this$_configService$ : true;
17824
+ const freezeSync = ((_this$_configService$ = this._configService.getConfig("sheets.config")) === null || _this$_configService$ === void 0 ? void 0 : _this$_configService$.freezeSync) ?? true;
17863
17825
  this.setEnabled(freezeSync);
17864
17826
  }
17865
17827
  getEnabled() {
@@ -18255,6 +18217,19 @@ let SheetPermissionCheckController = class SheetPermissionCheckController extend
18255
18217
  }, params.unitId, params.localSheetId);
18256
18218
  errorMsg = this._localeService.t("sheets.permission.dialog.editErr");
18257
18219
  break;
18220
+ case TextToNumberCommand.id:
18221
+ params = commandInfo.params;
18222
+ permission = this.permissionCheckWithRanges({
18223
+ workbookTypes: [WorkbookEditablePermission],
18224
+ worksheetTypes: [
18225
+ WorksheetSetCellValuePermission,
18226
+ WorksheetSetCellStylePermission,
18227
+ WorksheetEditPermission
18228
+ ],
18229
+ rangeTypes: [RangeProtectionPermissionEditPoint]
18230
+ }, 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);
18231
+ errorMsg = this._localeService.t("sheets.permission.dialog.editErr");
18232
+ break;
18258
18233
  default: break;
18259
18234
  }
18260
18235
  if (!permission) this.blockExecuteWithoutPermission(errorMsg);
@@ -18279,7 +18254,7 @@ let SheetPermissionCheckController = class SheetPermissionCheckController extend
18279
18254
  })) return false;
18280
18255
  if (rangeTypes && rangeTypes.length > 0) {
18281
18256
  var _this$_selectionManag;
18282
- const ranges = selectionRanges !== null && selectionRanges !== void 0 ? selectionRanges : (_this$_selectionManag = this._selectionManagerService.getCurrentSelections()) === null || _this$_selectionManag === void 0 ? void 0 : _this$_selectionManag.map((s) => s.range);
18257
+ const ranges = selectionRanges ?? ((_this$_selectionManag = this._selectionManagerService.getCurrentSelections()) === null || _this$_selectionManag === void 0 ? void 0 : _this$_selectionManag.map((s) => s.range));
18283
18258
  if (!ranges) return false;
18284
18259
  const rules = this._rangeProtectionRuleModel.getSubunitRuleList(_unitId, _subUnitId);
18285
18260
  if (rules.length === 0) return true;
@@ -18496,11 +18471,11 @@ let SheetPermissionCheckController = class SheetPermissionCheckController extend
18496
18471
  return true;
18497
18472
  }
18498
18473
  _permissionCheckWithInsertOrDeleteMoveRange(direction, params) {
18499
- var _params$range, _this$_selectionManag3;
18474
+ var _this$_selectionManag3;
18500
18475
  const target = getSheetCommandTarget(this._univerInstanceService);
18501
18476
  if (!target) return false;
18502
18477
  const { worksheet, unitId, subUnitId } = target;
18503
- const range = (_params$range = params === null || params === void 0 ? void 0 : params.range) !== null && _params$range !== void 0 ? _params$range : (_this$_selectionManag3 = this._selectionManagerService.getCurrentLastSelection()) === null || _this$_selectionManag3 === void 0 ? void 0 : _this$_selectionManag3.range;
18478
+ 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);
18504
18479
  if (!range) return false;
18505
18480
  if (!this.permissionCheckWithRanges({
18506
18481
  workbookTypes: [WorkbookEditablePermission],
@@ -19084,10 +19059,9 @@ let RangeProtectionRenderModel = class RangeProtectionRenderModel extends Dispos
19084
19059
  const result = [];
19085
19060
  for (const rule of ruleMap) if (rule.ranges.some((range) => range.startRow <= row && range.endRow >= row && range.startColumn <= col && range.endColumn >= col)) {
19086
19061
  const permissionMap = getAllRangePermissionPoint().reduce((result, F) => {
19087
- var _permission$value;
19088
19062
  const instance = new F(unitId, subUnitId, rule.permissionId);
19089
19063
  const permission = this._permissionService.getPermissionPoint(instance.id);
19090
- result[instance.subType] = (_permission$value = permission === null || permission === void 0 ? void 0 : permission.value) !== null && _permission$value !== void 0 ? _permission$value : instance.value;
19064
+ result[instance.subType] = (permission === null || permission === void 0 ? void 0 : permission.value) ?? instance.value;
19091
19065
  return result;
19092
19066
  }, {});
19093
19067
  result.push({
@@ -19243,11 +19217,11 @@ let RangeProtectionCache = class RangeProtectionCache extends Disposable {
19243
19217
  this._permissionIdCache.delete(rule.permissionId);
19244
19218
  }
19245
19219
  _getSelectionActions(unitId, subUnitId, rule) {
19246
- var _this$_permissionServ, _this$_permissionServ2, _RangeProtectionPermi, _this$_permissionServ3, _this$_permissionServ4, _RangeProtectionPermi2, _this$_permissionServ5, _this$_permissionServ6, _RangeProtectionPermi3, _this$_permissionServ7, _this$_permissionServ8, _RangeProtectionPermi4;
19247
- const edit = (_this$_permissionServ = (_this$_permissionServ2 = this._permissionService.getPermissionPoint((_RangeProtectionPermi = new RangeProtectionPermissionEditPoint(unitId, subUnitId, rule.permissionId)) === null || _RangeProtectionPermi === void 0 ? void 0 : _RangeProtectionPermi.id)) === null || _this$_permissionServ2 === void 0 ? void 0 : _this$_permissionServ2.value) !== null && _this$_permissionServ !== void 0 ? _this$_permissionServ : false;
19248
- const view = (_this$_permissionServ3 = (_this$_permissionServ4 = this._permissionService.getPermissionPoint((_RangeProtectionPermi2 = new RangeProtectionPermissionViewPoint(unitId, subUnitId, rule.permissionId)) === null || _RangeProtectionPermi2 === void 0 ? void 0 : _RangeProtectionPermi2.id)) === null || _this$_permissionServ4 === void 0 ? void 0 : _this$_permissionServ4.value) !== null && _this$_permissionServ3 !== void 0 ? _this$_permissionServ3 : false;
19249
- const manageProtection = (_this$_permissionServ5 = (_this$_permissionServ6 = this._permissionService.getPermissionPoint((_RangeProtectionPermi3 = new RangeProtectionPermissionManageCollaPoint(unitId, subUnitId, rule.permissionId)) === null || _RangeProtectionPermi3 === void 0 ? void 0 : _RangeProtectionPermi3.id)) === null || _this$_permissionServ6 === void 0 ? void 0 : _this$_permissionServ6.value) !== null && _this$_permissionServ5 !== void 0 ? _this$_permissionServ5 : false;
19250
- const deleteProtection = (_this$_permissionServ7 = (_this$_permissionServ8 = this._permissionService.getPermissionPoint((_RangeProtectionPermi4 = new RangeProtectionPermissionDeleteProtectionPoint(unitId, subUnitId, rule.permissionId)) === null || _RangeProtectionPermi4 === void 0 ? void 0 : _RangeProtectionPermi4.id)) === null || _this$_permissionServ8 === void 0 ? void 0 : _this$_permissionServ8.value) !== null && _this$_permissionServ7 !== void 0 ? _this$_permissionServ7 : false;
19220
+ var _this$_permissionServ, _RangeProtectionPermi, _this$_permissionServ2, _RangeProtectionPermi2, _this$_permissionServ3, _RangeProtectionPermi3, _this$_permissionServ4, _RangeProtectionPermi4;
19221
+ 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;
19222
+ 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;
19223
+ 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;
19224
+ 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;
19251
19225
  return {
19252
19226
  [UnitAction.Edit]: edit,
19253
19227
  [UnitAction.View]: view,
@@ -19395,7 +19369,7 @@ RangeProtectionCache = __decorate([
19395
19369
  //#endregion
19396
19370
  //#region package.json
19397
19371
  var name = "@univerjs/sheets";
19398
- var version = "1.0.0-alpha.8";
19372
+ var version = "1.0.0-beta.1";
19399
19373
 
19400
19374
  //#endregion
19401
19375
  //#region src/controllers/active-worksheet.controller.ts
@@ -19502,7 +19476,6 @@ const ONLY_REGISTER_FORMULA_RELATED_MUTATIONS_KEY = "ONLY_REGISTER_FORMULA_RELAT
19502
19476
  //#region src/controllers/basic-worksheet.controller.ts
19503
19477
  let BasicWorksheetController = class BasicWorksheetController extends Disposable {
19504
19478
  constructor(_commandService, _configService, _dataSyncPrimaryController) {
19505
- var _this$_configService$;
19506
19479
  super();
19507
19480
  this._commandService = _commandService;
19508
19481
  this._configService = _configService;
@@ -19544,7 +19517,7 @@ let BasicWorksheetController = class BasicWorksheetController extends Disposable
19544
19517
  this._commandService.registerCommand(mutation);
19545
19518
  (_this$_dataSyncPrimar = this._dataSyncPrimaryController) === null || _this$_dataSyncPrimar === void 0 || _this$_dataSyncPrimar.registerSyncingMutations(mutation);
19546
19519
  });
19547
- if (!((_this$_configService$ = this._configService.getConfig("ONLY_REGISTER_FORMULA_RELATED_MUTATIONS_KEY")) !== null && _this$_configService$ !== void 0 ? _this$_configService$ : false)) [
19520
+ if (!(this._configService.getConfig("ONLY_REGISTER_FORMULA_RELATED_MUTATIONS_KEY") ?? false)) [
19548
19521
  AddWorksheetMergeCommand,
19549
19522
  AddWorksheetMergeAllCommand,
19550
19523
  AddWorksheetMergeVerticalCommand,
@@ -19782,10 +19755,10 @@ let SheetPermissionViewModelController = class SheetPermissionViewModelControlle
19782
19755
  const { unitId, subUnitId } = context;
19783
19756
  const worksheetRule = this._worksheetProtectionRuleModel.getRule(unitId, subUnitId);
19784
19757
  if (worksheetRule === null || worksheetRule === void 0 ? void 0 : worksheetRule.permissionId) {
19785
- var _this$_permissionServ, _this$_permissionServ2, _this$_permissionServ3, _this$_permissionServ4, _selectionProtection$;
19758
+ var _this$_permissionServ, _this$_permissionServ2, _selectionProtection$;
19786
19759
  const selectionProtection = [{
19787
- [UnitAction.View]: (_this$_permissionServ = (_this$_permissionServ2 = this._permissionService.getPermissionPoint(new WorksheetViewPermission(unitId, subUnitId).id)) === null || _this$_permissionServ2 === void 0 ? void 0 : _this$_permissionServ2.value) !== null && _this$_permissionServ !== void 0 ? _this$_permissionServ : false,
19788
- [UnitAction.Edit]: (_this$_permissionServ3 = (_this$_permissionServ4 = this._permissionService.getPermissionPoint(new WorksheetEditPermission(unitId, subUnitId).id)) === null || _this$_permissionServ4 === void 0 ? void 0 : _this$_permissionServ4.value) !== null && _this$_permissionServ3 !== void 0 ? _this$_permissionServ3 : false
19760
+ [UnitAction.View]: ((_this$_permissionServ = this._permissionService.getPermissionPoint(new WorksheetViewPermission(unitId, subUnitId).id)) === null || _this$_permissionServ === void 0 ? void 0 : _this$_permissionServ.value) ?? false,
19761
+ [UnitAction.Edit]: ((_this$_permissionServ2 = this._permissionService.getPermissionPoint(new WorksheetEditPermission(unitId, subUnitId).id)) === null || _this$_permissionServ2 === void 0 ? void 0 : _this$_permissionServ2.value) ?? false
19789
19762
  }];
19790
19763
  const isSkipRender = !((_selectionProtection$ = selectionProtection[0]) === null || _selectionProtection$ === void 0 ? void 0 : _selectionProtection$[UnitAction.View]);
19791
19764
  const _cellData = !cell || cell === context.rawData ? { ...cell } : cell;
@@ -21347,4 +21320,4 @@ function convertPositionCellToSheetOverGrid(unitId, subUnitId, cellOverGridPosit
21347
21320
  }
21348
21321
 
21349
21322
  //#endregion
21350
- export { AFFECT_LAYOUT_STYLES, AFTER_CELL_EDIT, AUTO_FILL_APPLY_TYPE, AUTO_FILL_DATA_TYPE, AUTO_FILL_HOOK_TYPE, AddMergeRedoSelectionsOperationFactory, AddMergeUndoMutationFactory, AddMergeUndoSelectionsOperationFactory, AddRangeProtectionCommand, AddRangeProtectionMutation, AddRangeThemeMutation, AddWorksheetMergeAllCommand, AddWorksheetMergeCommand, AddWorksheetMergeHorizontalCommand, AddWorksheetMergeMutation, AddWorksheetMergeVerticalCommand, AddWorksheetProtectionCommand, AddWorksheetProtectionMutation, AppendRowCommand, AutoClearContentCommand, AutoFillCommand, AutoFillController, AutoFillRules, AutoFillService, AutoFillTools, BEFORE_CELL_EDIT, BorderStyleManagerService, COMMAND_LISTENER_SKELETON_CHANGE, COMMAND_LISTENER_VALUE_CHANGE, CalculateResultApplyController, CancelFrozenCommand, CancelMarkDirtyRowAutoHeightOperation, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, CopySheetCommand, CopyWorksheetEndMutation, DISABLE_NORMAL_SELECTIONS, DefinedNameDataController, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeleteRangeProtectionCommand, DeleteRangeProtectionMutation, DeleteWorksheetProtectionCommand, DeleteWorksheetProtectionMutation, DeleteWorksheetRangeThemeStyleCommand, DeleteWorksheetRangeThemeStyleMutation, DeleteWorksheetRangeThemeStyleMutationFactory, DeltaColumnWidthCommand, DeltaRowHeightCommand, EditStateEnum, EffectRefRangId, EmptyMutation, ExclusiveRangeService, FactoryAddRangeProtectionMutation, FactoryDeleteRangeProtectionMutation, FactorySetRangeProtectionMutation, IAutoFillService, IExclusiveRangeService, INTERCEPTOR_POINT, INumfmtService, IRefSelectionsService, InsertColAfterCommand, InsertColBeforeCommand, InsertColByRangeCommand, InsertColCommand, InsertColMutation, InsertColMutationUndoFactory, InsertDefinedNameCommand, InsertMultiColsLeftCommand, InsertMultiColsRightCommand, InsertMultiRowsAboveCommand, InsertMultiRowsAfterCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowAfterCommand, InsertRowBeforeCommand, InsertRowByRangeCommand, InsertRowCommand, InsertRowMutation, InsertRowMutationUndoFactory, InsertSheetCommand, InsertSheetMutation, InsertSheetUndoMutationFactory, InterceptCellContentPriority, MAX_CELL_PER_SHEET_KEY, MERGE_CELL_INTERCEPTOR_CHECK, MarkDirtyFilterChangeMutation, MarkDirtyRowAutoHeightOperation, MergeCellController, MoveColsCommand, MoveColsMutation, MoveColsMutationUndoFactory, MoveRangeCommand, MoveRangeMutation, MoveRowsCommand, MoveRowsMutation, MoveRowsMutationUndoFactory, NumfmtService, OperatorType, PermissionPointsDefinitions, REF_SELECTIONS_ENABLED, RangeMergeUtil, RangeProtectionCache, RangeProtectionPermissionDeleteProtectionPoint, RangeProtectionPermissionEditPoint, RangeProtectionPermissionManageCollaPoint, RangeProtectionPermissionViewPoint, RangeProtectionRefRangeService, RangeProtectionRenderModel, RangeProtectionRuleModel, RangeProtectionService, RangeThemeStyle, RefRangeService, RefSelectionsService, RefillCommand, RegisterWorksheetRangeThemeStyleCommand, RegisterWorksheetRangeThemeStyleMutation, RemoveColByRangeCommand, RemoveColCommand, RemoveColMutation, RemoveDefinedNameCommand, RemoveMergeUndoMutationFactory, RemoveNumfmtMutation, RemoveRangeThemeMutation, RemoveRowByRangeCommand, RemoveRowCommand, RemoveRowMutation, RemoveSheetCommand, RemoveSheetMutation, RemoveSheetUndoMutationFactory, RemoveWorksheetMergeCommand, RemoveWorksheetMergeMutation, ReorderRangeCommand, ReorderRangeMutation, ReorderRangeUndoMutationFactory, ResetBackgroundColorCommand, ResetTextColorCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SELECTIONS_ENABLED, SELECTION_CONTROL_BORDER_BUFFER_COLOR, SELECTION_CONTROL_BORDER_BUFFER_WIDTH, SHEETS_PLUGIN_CONFIG_KEY, ScrollToCellOperation, SelectRangeCommand, SelectionMoveType, SetBackgroundColorCommand, SetBoldCommand, SetBorderBasicCommand, SetBorderColorCommand, SetBorderCommand, SetBorderPositionCommand, SetBorderStyleCommand, SetColDataCommand, SetColDataMutation, SetColDataMutationFactory, SetColHiddenCommand, SetColHiddenMutation, SetColVisibleMutation, SetColWidthCommand, SetDefinedNameCommand, SetFontFamilyCommand, SetFontSizeCommand, SetFrozenCommand, SetFrozenMutation, SetFrozenMutationFactory, SetGridlinesColorCommand, SetGridlinesColorMutation, SetHorizontalTextAlignCommand, SetItalicCommand, SetNumfmtMutation, SetOverlineCommand, SetProtectionCommand, SetRangeCustomMetadataCommand, SetRangeProtectionMutation, SetRangeThemeMutation, SetRangeValuesCommand, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SetRowDataCommand, SetRowDataMutation, SetRowDataMutationFactory, SetRowHeightCommand, SetRowHiddenCommand, SetRowHiddenMutation, SetRowVisibleMutation, SetSelectedColsVisibleCommand, SetSelectedRowsVisibleCommand, SetSelectionsOperation, SetShrinkToFitCommand, SetSpecificColsVisibleCommand, SetSpecificRowsVisibleCommand, SetStrikeThroughCommand, SetStyleCommand, SetTabColorCommand, SetTabColorMutation, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetUnderlineCommand, SetVerticalTextAlignCommand, SetWorkbookNameCommand, SetWorkbookNameMutation, SetWorksheetActivateCommand, SetWorksheetActiveOperation, SetWorksheetColWidthMutation, SetWorksheetColWidthMutationFactory, SetWorksheetColumnCountCommand, SetWorksheetColumnCountMutation, SetWorksheetColumnCountUndoMutationFactory, SetWorksheetDefaultStyleCommand, SetWorksheetDefaultStyleMutation, SetWorksheetDefaultStyleMutationFactory, SetWorksheetHideCommand, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetNameMutation, SetWorksheetOrderCommand, SetWorksheetOrderMutation, SetWorksheetPermissionPointsCommand, SetWorksheetPermissionPointsMutation, SetWorksheetProtectionCommand, SetWorksheetProtectionMutation, SetWorksheetRangeThemeStyleCommand, SetWorksheetRangeThemeStyleMutation, SetWorksheetRangeThemeStyleMutationFactory, SetWorksheetRightToLeftCommand, SetWorksheetRightToLeftMutation, SetWorksheetRowAutoHeightMutation, SetWorksheetRowAutoHeightMutationFactory, SetWorksheetRowCountCommand, SetWorksheetRowCountMutation, SetWorksheetRowCountUndoMutationFactory, SetWorksheetRowHeightMutation, SetWorksheetRowHeightMutationFactory, SetWorksheetRowIsAutoHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetWorksheetRowIsAutoHeightMutationFactory, SetWorksheetShowCommand, SheetCopyDownCommand, SheetCopyRightCommand, SheetInterceptorService, SheetLazyExecuteScheduleService, SheetPermissionCheckController, SheetPermissionInitController, SheetRangeThemeModel, SheetRangeThemeService, SheetSkeletonChangeType, SheetSkeletonService, SheetValueChangeType, SheetsFreezeSyncController, SheetsSelectionsService, SplitDelimiterEnum, SplitTextToColumnsCommand, TextToNumberCommand, ToggleCellCheckboxCommand, ToggleGridlinesCommand, ToggleGridlinesMutation, UniverSheetsPlugin, UnregisterWorksheetRangeThemeStyleCommand, UnregisterWorksheetRangeThemeStyleMutation, VALIDATE_CELL, ViewStateEnum, WorkbookCommentPermission, WorkbookCopyPermission, WorkbookCopySheetPermission, WorkbookCreateProtectPermission, WorkbookCreateSheetPermission, WorkbookDeleteColumnPermission, WorkbookDeleteRowPermission, WorkbookDeleteSheetPermission, WorkbookDuplicatePermission, WorkbookEditablePermission, WorkbookExportPermission, WorkbookHideSheetPermission, WorkbookInsertColumnPermission, WorkbookInsertRowPermission, WorkbookManageCollaboratorPermission, WorkbookMoveSheetPermission, WorkbookPermissionService, WorkbookPrintPermission, WorkbookRecoverHistoryPermission, WorkbookRenameSheetPermission, WorkbookSelectionModel, WorkbookSharePermission, WorkbookViewHistoryPermission, WorkbookViewPermission, WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditExtraObjectPermission, WorksheetEditPermission, WorksheetFilterPermission, WorksheetInsertColumnPermission, WorksheetInsertHyperlinkPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetPermissionService, WorksheetPivotTablePermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetSelectProtectedCellsPermission, WorksheetSelectUnProtectedCellsPermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetSortPermission, WorksheetViewPermission, ZebraCrossingCacheController, addMergeCellsUtil, adjustRangeOnMutation, alignToMergedCellsBorders, attachPrimaryWithCoord, attachRangeWithCoord, attachSelectionWithCoord, baseProtectionActions, checkCellValueType, checkRangesEditablePermission, convertPositionCellToSheetOverGrid, convertPositionSheetOverGridToAbsolute, convertPrimaryWithCoordToPrimary, convertSelectionDataToRange, copyRangeStyles, countCells, createTopMatrixFromMatrix, createTopMatrixFromRanges, defaultLargeSheetOperationConfig, defaultWorkbookPermissionPoints, defaultWorksheetPermissionPoint, deserializeListOptions, discreteRangeToRange, expandToContinuousRange, factoryRemoveNumfmtUndoMutation, factorySetNumfmtUndoMutation, findAllRectangle, findFirstNonEmptyCell, followSelectionOperation, generateNullCell, generateNullCellValue, getAddMergeMutationRangeByType, getAllRangePermissionPoint, getAllWorkbookPermissionPoint, getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel, getCellAtRowCol, getClearContentMutationParamForRange, getClearContentMutationParamsForRanges, getDefaultRangePermission, getInsertRangeMutations, getMoveRangeCommandMutations, getMoveRangeUndoRedoMutations, getNextPrimaryCell, getPrimaryForRange, getRemoveRangeMutations, getSelectionsService, getSeparateEffectedRangesOnCommand, getSheetCommandTarget, getSheetCommandTargetWorkbook, getSheetMutationTarget, getSkeletonChangedEffectedRange, getValueChangedEffectedRange, getVisibleRanges, handleBaseInsertRange, handleBaseMoveRowsCols, handleBaseRemoveRange, handleCommonDefaultRangeChangeWithEffectRefCommands, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests, handleDefaultRangeChangeWithEffectRefCommands, handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests, handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleDeleteRangeMutation, handleIRemoveCol, handleIRemoveRow, handleInsertCol, handleInsertRangeMoveDown, handleInsertRangeMoveRight, handleInsertRangeMutation, handleInsertRow, handleMoveCols, handleMoveRange, handleMoveRows, isSingleCellSelection, rangeMerge, rangeToDiscreteRange, rotateRange, runRefRangeMutations, serializeListOptions, setEndForRange, splitRangeText, transformCellsToRange, validateDefinedName };
21323
+ export { AFFECT_LAYOUT_STYLES, AFTER_CELL_EDIT, AUTO_FILL_APPLY_TYPE, AUTO_FILL_DATA_TYPE, AUTO_FILL_HOOK_TYPE, AddMergeRedoSelectionsOperationFactory, AddMergeUndoMutationFactory, AddMergeUndoSelectionsOperationFactory, AddRangeProtectionCommand, AddRangeProtectionMutation, AddRangeThemeMutation, AddWorksheetMergeAllCommand, AddWorksheetMergeCommand, AddWorksheetMergeHorizontalCommand, AddWorksheetMergeMutation, AddWorksheetMergeVerticalCommand, AddWorksheetProtectionCommand, AddWorksheetProtectionMutation, AppendRowCommand, AutoClearContentCommand, AutoFillCommand, AutoFillController, AutoFillRules, AutoFillService, AutoFillTools, BEFORE_CELL_EDIT, BorderStyleManagerService, COMMAND_LISTENER_SKELETON_CHANGE, COMMAND_LISTENER_VALUE_CHANGE, CalculateResultApplyController, CancelFrozenCommand, CancelMarkDirtyRowAutoHeightOperation, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, CopySheetCommand, CopyWorksheetEndMutation, DISABLE_NORMAL_SELECTIONS, DefinedNameDataController, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeleteRangeProtectionCommand, DeleteRangeProtectionMutation, DeleteWorksheetProtectionCommand, DeleteWorksheetProtectionMutation, DeleteWorksheetRangeThemeStyleCommand, DeleteWorksheetRangeThemeStyleMutation, DeleteWorksheetRangeThemeStyleMutationFactory, DeltaColumnWidthCommand, DeltaRowHeightCommand, EditStateEnum, EffectRefRangId, EmptyMutation, ExclusiveRangeService, FactoryAddRangeProtectionMutation, FactoryDeleteRangeProtectionMutation, FactorySetRangeProtectionMutation, IAutoFillService, IExclusiveRangeService, INTERCEPTOR_POINT, INumfmtService, IRefSelectionsService, InsertColAfterCommand, InsertColBeforeCommand, InsertColByRangeCommand, InsertColCommand, InsertColMutation, InsertColMutationUndoFactory, InsertDefinedNameCommand, InsertMultiColsLeftCommand, InsertMultiColsRightCommand, InsertMultiRowsAboveCommand, InsertMultiRowsAfterCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowAfterCommand, InsertRowBeforeCommand, InsertRowByRangeCommand, InsertRowCommand, InsertRowMutation, InsertRowMutationUndoFactory, InsertSheetCommand, InsertSheetMutation, InsertSheetUndoMutationFactory, InterceptCellContentPriority, MAX_CELL_PER_SHEET_KEY, MERGE_CELL_INTERCEPTOR_CHECK, MarkDirtyFilterChangeMutation, MarkDirtyRowAutoHeightOperation, MergeCellController, MoveColsCommand, MoveColsMutation, MoveColsMutationUndoFactory, MoveRangeCommand, MoveRangeMutation, MoveRowsCommand, MoveRowsMutation, MoveRowsMutationUndoFactory, NumfmtService, OperatorType, PermissionPointsDefinitions, REF_SELECTIONS_ENABLED, RangeMergeUtil, RangeProtectionCache, RangeProtectionPermissionDeleteProtectionPoint, RangeProtectionPermissionEditPoint, RangeProtectionPermissionManageCollaPoint, RangeProtectionPermissionViewPoint, RangeProtectionRefRangeService, RangeProtectionRenderModel, RangeProtectionRuleModel, RangeProtectionService, RangeThemeStyle, RefRangeService, RefSelectionsService, RefillCommand, RegisterWorksheetRangeThemeStyleCommand, RegisterWorksheetRangeThemeStyleMutation, RemoveColByRangeCommand, RemoveColCommand, RemoveColMutation, RemoveDefinedNameCommand, RemoveMergeUndoMutationFactory, RemoveNumfmtMutation, RemoveRangeThemeMutation, RemoveRowByRangeCommand, RemoveRowCommand, RemoveRowMutation, RemoveSheetCommand, RemoveSheetMutation, RemoveSheetUndoMutationFactory, RemoveWorksheetMergeCommand, RemoveWorksheetMergeMutation, ReorderRangeCommand, ReorderRangeMutation, ReorderRangeUndoMutationFactory, ResetBackgroundColorCommand, ResetTextColorCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SELECTIONS_ENABLED, SELECTION_CONTROL_BORDER_BUFFER_COLOR, SELECTION_CONTROL_BORDER_BUFFER_WIDTH, SHEETS_PLUGIN_CONFIG_KEY, ScrollToCellOperation, SelectRangeCommand, SelectionMoveType, SetBackgroundColorCommand, SetBoldCommand, SetBorderBasicCommand, SetBorderColorCommand, SetBorderCommand, SetBorderPositionCommand, SetBorderStyleCommand, SetColDataCommand, SetColDataMutation, SetColDataMutationFactory, SetColHiddenCommand, SetColHiddenMutation, SetColVisibleMutation, SetColWidthCommand, SetDefinedNameCommand, SetFontFamilyCommand, SetFontSizeCommand, SetFrozenCommand, SetFrozenMutation, SetFrozenMutationFactory, SetGridlinesColorCommand, SetGridlinesColorMutation, SetHorizontalTextAlignCommand, SetItalicCommand, SetNumfmtMutation, SetOverlineCommand, SetProtectionCommand, SetRangeCustomMetadataCommand, SetRangeProtectionMutation, SetRangeThemeMutation, SetRangeValuesCommand, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SetRowDataCommand, SetRowDataMutation, SetRowDataMutationFactory, SetRowHeightCommand, SetRowHiddenCommand, SetRowHiddenMutation, SetRowVisibleMutation, SetSelectedColsVisibleCommand, SetSelectedRowsVisibleCommand, SetSelectionsOperation, SetShrinkToFitCommand, SetSpecificColsVisibleCommand, SetSpecificRowsVisibleCommand, SetStrikeThroughCommand, SetStyleCommand, SetTabColorCommand, SetTabColorMutation, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetUnderlineCommand, SetVerticalTextAlignCommand, SetWorkbookNameCommand, SetWorkbookNameMutation, SetWorksheetActivateCommand, SetWorksheetActiveOperation, SetWorksheetColWidthMutation, SetWorksheetColWidthMutationFactory, SetWorksheetColumnCountCommand, SetWorksheetColumnCountMutation, SetWorksheetColumnCountUndoMutationFactory, SetWorksheetDefaultStyleCommand, SetWorksheetDefaultStyleMutation, SetWorksheetDefaultStyleMutationFactory, SetWorksheetHideCommand, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetNameMutation, SetWorksheetOrderCommand, SetWorksheetOrderMutation, SetWorksheetPermissionPointsCommand, SetWorksheetPermissionPointsMutation, SetWorksheetProtectionCommand, SetWorksheetProtectionMutation, SetWorksheetRangeThemeStyleCommand, SetWorksheetRangeThemeStyleMutation, SetWorksheetRangeThemeStyleMutationFactory, SetWorksheetRightToLeftCommand, SetWorksheetRightToLeftMutation, SetWorksheetRowAutoHeightMutation, SetWorksheetRowAutoHeightMutationFactory, SetWorksheetRowCountCommand, SetWorksheetRowCountMutation, SetWorksheetRowCountUndoMutationFactory, SetWorksheetRowHeightMutation, SetWorksheetRowHeightMutationFactory, SetWorksheetRowIsAutoHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetWorksheetRowIsAutoHeightMutationFactory, SetWorksheetShowCommand, SheetCopyDownCommand, SheetCopyRightCommand, SheetInterceptorService, SheetLazyExecuteScheduleService, SheetPermissionCheckController, SheetPermissionInitController, SheetRangeThemeModel, SheetRangeThemeService, SheetSkeletonChangeType, SheetSkeletonService, SheetValueChangeType, SheetsFreezeSyncController, SheetsSelectionsService, SplitDelimiterEnum, SplitTextToColumnsCommand, TextToNumberCommand, ToggleCellCheckboxCommand, ToggleGridlinesCommand, ToggleGridlinesMutation, UniverSheetsPlugin, UnregisterWorksheetRangeThemeStyleCommand, UnregisterWorksheetRangeThemeStyleMutation, VALIDATE_CELL, ViewStateEnum, WorkbookCommentPermission, WorkbookCopyPermission, WorkbookCopySheetPermission, WorkbookCreateProtectPermission, WorkbookCreateSheetPermission, WorkbookDeleteColumnPermission, WorkbookDeleteRowPermission, WorkbookDeleteSheetPermission, WorkbookDuplicatePermission, WorkbookEditablePermission, WorkbookExportPermission, WorkbookHideSheetPermission, WorkbookInsertColumnPermission, WorkbookInsertRowPermission, WorkbookManageCollaboratorPermission, WorkbookMoveSheetPermission, WorkbookPermissionService, WorkbookPrintPermission, WorkbookRecoverHistoryPermission, WorkbookRenameSheetPermission, WorkbookSelectionModel, WorkbookSharePermission, WorkbookViewHistoryPermission, WorkbookViewPermission, WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditExtraObjectPermission, WorksheetEditPermission, WorksheetFilterPermission, WorksheetInsertColumnPermission, WorksheetInsertHyperlinkPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetPermissionService, WorksheetPivotTablePermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetSelectProtectedCellsPermission, WorksheetSelectUnProtectedCellsPermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetSortPermission, WorksheetViewPermission, ZebraCrossingCacheController, addMergeCellsUtil, adjustRangeOnMutation, alignToMergedCellsBorders, attachPrimaryWithCoord, attachRangeWithCoord, attachSelectionWithCoord, baseProtectionActions, checkCellValueType, checkRangesEditablePermission, convertPositionCellToSheetOverGrid, convertPositionSheetOverGridToAbsolute, convertPrimaryWithCoordToPrimary, convertSelectionDataToRange, copyRangeStyles, countCells, createTopMatrixFromMatrix, createTopMatrixFromRanges, defaultLargeSheetOperationConfig, defaultWorkbookPermissionPoints, defaultWorksheetPermissionPoint, deserializeListOptions, discreteRangeToRange, expandToContinuousRange, factoryRemoveNumfmtUndoMutation, factorySetNumfmtUndoMutation, findAllRectangle, findFirstNonEmptyCell, followSelectionOperation, generateNullCell, generateNullCellValue, getAddMergeMutationRangeByType, getAllRangePermissionPoint, getAllWorkbookPermissionPoint, getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel, getCellAtRowCol, getClearContentMutationParamForRange, getClearContentMutationParamsForRanges, getDefaultRangePermission, getInsertRangeMutations, getMoveRangeCommandMutations, getMoveRangeUndoRedoMutations, getNextPrimaryCell, getPrimaryForRange, getRemoveRangeMutations, getSelectionsService, getSeparateEffectedRangesOnCommand, getSheetCommandTarget, getSheetCommandTargetWorkbook, getSheetMutationTarget, getSkeletonChangedEffectedRange, getValueChangedEffectedRange, getVisibleRanges, handleBaseInsertRange, handleBaseMoveRowsCols, handleBaseRemoveRange, handleCommonDefaultRangeChangeWithEffectRefCommands, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests, handleDefaultRangeChangeWithEffectRefCommands, handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests, handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleDeleteRangeMutation, handleIRemoveCol, handleIRemoveRow, handleInsertCol, handleInsertRangeMoveDown, handleInsertRangeMoveRight, handleInsertRangeMutation, handleInsertRow, handleMoveCols, handleMoveRange, handleMoveRows, isCellImage, isSingleCellSelection, rangeMerge, rangeToDiscreteRange, rotateRange, runRefRangeMutations, serializeListOptions, setEndForRange, splitRangeText, transformCellsToRange, validateDefinedName };