@univerjs/sheets 1.3.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +21 -5
  2. package/lib/cjs/facade.js +246 -57
  3. package/lib/cjs/index.js +1143 -21533
  4. package/lib/cjs/locale/ar-SA.js +1 -2
  5. package/lib/cjs/locale/ca-ES.js +1 -2
  6. package/lib/cjs/locale/de-DE.js +1 -2
  7. package/lib/cjs/locale/en-US.js +1 -2
  8. package/lib/cjs/locale/es-ES.js +1 -2
  9. package/lib/cjs/locale/fa-IR.js +1 -2
  10. package/lib/cjs/locale/fr-FR.js +1 -2
  11. package/lib/cjs/locale/id-ID.js +1 -2
  12. package/lib/cjs/locale/it-IT.js +1 -2
  13. package/lib/cjs/locale/ja-JP.js +1 -2
  14. package/lib/cjs/locale/ko-KR.js +1 -2
  15. package/lib/cjs/locale/pl-PL.js +1 -2
  16. package/lib/cjs/locale/pt-BR.js +1 -2
  17. package/lib/cjs/locale/ru-RU.js +1 -2
  18. package/lib/cjs/locale/sk-SK.js +1 -2
  19. package/lib/cjs/locale/vi-VN.js +1 -2
  20. package/lib/cjs/locale/zh-CN.js +1 -2
  21. package/lib/cjs/locale/zh-HK.js +1 -2
  22. package/lib/cjs/locale/zh-TW.js +1 -2
  23. package/lib/cjs/plugin-tI5Deb_a.js +22421 -0
  24. package/lib/cjs/worker.js +9 -0
  25. package/lib/es/facade.js +256 -67
  26. package/lib/es/index.js +719 -21110
  27. package/lib/es/locale/ar-SA.js +1 -2
  28. package/lib/es/locale/ca-ES.js +1 -2
  29. package/lib/es/locale/de-DE.js +1 -2
  30. package/lib/es/locale/en-US.js +1 -2
  31. package/lib/es/locale/es-ES.js +1 -2
  32. package/lib/es/locale/fa-IR.js +1 -2
  33. package/lib/es/locale/fr-FR.js +1 -2
  34. package/lib/es/locale/id-ID.js +1 -2
  35. package/lib/es/locale/it-IT.js +1 -2
  36. package/lib/es/locale/ja-JP.js +1 -2
  37. package/lib/es/locale/ko-KR.js +1 -2
  38. package/lib/es/locale/pl-PL.js +1 -2
  39. package/lib/es/locale/pt-BR.js +1 -2
  40. package/lib/es/locale/ru-RU.js +1 -2
  41. package/lib/es/locale/sk-SK.js +1 -2
  42. package/lib/es/locale/vi-VN.js +1 -2
  43. package/lib/es/locale/zh-CN.js +1 -2
  44. package/lib/es/locale/zh-HK.js +1 -2
  45. package/lib/es/locale/zh-TW.js +1 -2
  46. package/lib/es/plugin-Bmc8YRpc.js +20148 -0
  47. package/lib/es/worker.js +3 -0
  48. package/lib/facade.js +256 -67
  49. package/lib/index.js +719 -21110
  50. package/lib/locale/ar-SA.js +1 -2
  51. package/lib/locale/ca-ES.js +1 -2
  52. package/lib/locale/de-DE.js +1 -2
  53. package/lib/locale/en-US.js +1 -2
  54. package/lib/locale/es-ES.js +1 -2
  55. package/lib/locale/fa-IR.js +1 -2
  56. package/lib/locale/fr-FR.js +1 -2
  57. package/lib/locale/id-ID.js +1 -2
  58. package/lib/locale/it-IT.js +1 -2
  59. package/lib/locale/ja-JP.js +1 -2
  60. package/lib/locale/ko-KR.js +1 -2
  61. package/lib/locale/pl-PL.js +1 -2
  62. package/lib/locale/pt-BR.js +1 -2
  63. package/lib/locale/ru-RU.js +1 -2
  64. package/lib/locale/sk-SK.js +1 -2
  65. package/lib/locale/vi-VN.js +1 -2
  66. package/lib/locale/zh-CN.js +1 -2
  67. package/lib/locale/zh-HK.js +1 -2
  68. package/lib/locale/zh-TW.js +1 -2
  69. package/lib/plugin-Bmc8YRpc.js +20148 -0
  70. package/lib/types/commands/commands/move-rows-cols.command.d.ts +2 -2
  71. package/lib/types/commands/commands/reorder-range.command.d.ts +1 -1
  72. package/lib/types/commands/commands/set-border.command.d.ts +1 -1
  73. package/lib/types/commands/mutations/numfmt.mutation.d.ts +1 -1
  74. package/lib/types/controllers/permission/sheet-permission-init.controller.d.ts +3 -2
  75. package/lib/types/facade/f-range.d.ts +154 -7
  76. package/lib/types/facade/f-worksheet.d.ts +76 -2
  77. package/lib/types/index.d.ts +1 -1
  78. package/lib/types/models/range-protection.cache.d.ts +9 -9
  79. package/lib/types/models/range-theme-model.d.ts +1 -1
  80. package/lib/types/services/auto-fill/auto-fill.service.d.ts +1 -1
  81. package/lib/types/services/auto-fill/tools.d.ts +6 -6
  82. package/lib/types/services/exclusive-range/exclusive-range.service.d.ts +1 -1
  83. package/lib/types/services/numfmt/type.d.ts +1 -1
  84. package/lib/types/services/permission/range-permission/range-protection.ref-range.d.ts +13 -4
  85. package/lib/types/services/ref-range/util.d.ts +31 -16
  86. package/lib/types/services/selections/ref-selections.service.d.ts +1 -1
  87. package/lib/types/services/sheet-interceptor/interceptor-const.d.ts +2 -1
  88. package/lib/types/worker.d.ts +16 -0
  89. package/lib/umd/facade.js +1 -1
  90. package/lib/umd/index.js +2 -2
  91. package/lib/worker.js +3 -0
  92. package/package.json +17 -12
@@ -14,11 +14,11 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { CellValue, CustomData, IColumnRange, IFreeze, IObjectArrayPrimitiveType, IRange, IRowRange, IStyleData, Nullable, Workbook, Worksheet } from '@univerjs/core';
17
- import type { FDefinedName } from './f-defined-name';
18
- import type { FWorkbook } from './f-workbook';
19
17
  import { BooleanNumber, ICommandService, ILogService, Injector, WorksheetHiddenState } from '@univerjs/core';
20
18
  import { FBaseInitialable } from '@univerjs/core/facade';
21
19
  import { SheetsSelectionsService } from '@univerjs/sheets';
20
+ import type { FDefinedName } from './f-defined-name';
21
+ import type { FWorkbook } from './f-workbook';
22
22
  import { FRange } from './f-range';
23
23
  import { FSelection } from './f-selection';
24
24
  import { FWorksheetPermission } from './permission/f-worksheet-permission';
@@ -312,6 +312,10 @@ export declare class FWorksheet extends FBaseInitialable {
312
312
  getMaxRows(): number;
313
313
  /**
314
314
  * Inserts a row after the given row position.
315
+ *
316
+ * To insert multiple rows, prefer {@link FWorksheet.insertRowsAfter} with the full count
317
+ * instead of repeatedly calling this method.
318
+ *
315
319
  * @param {number} afterPosition - The existing row after which the new row should be added. The index is zero-based and must be between 0 and `getMaxRows() - 1`.
316
320
  * @returns {FWorksheet} This sheet, for chaining.
317
321
  * @example
@@ -327,6 +331,10 @@ export declare class FWorksheet extends FBaseInitialable {
327
331
  insertRowAfter(afterPosition: number): FWorksheet;
328
332
  /**
329
333
  * Inserts a row before the given row position.
334
+ *
335
+ * To insert multiple rows, prefer {@link FWorksheet.insertRowsBefore} with the full count
336
+ * instead of repeatedly calling this method.
337
+ *
330
338
  * @param {number} beforePosition - The existing row before which the new row should be added. The index is zero-based and must be between 0 and `getMaxRows() - 1`.
331
339
  * @returns {FWorksheet} This sheet, for chaining.
332
340
  * @example
@@ -342,6 +350,10 @@ export declare class FWorksheet extends FBaseInitialable {
342
350
  insertRowBefore(beforePosition: number): FWorksheet;
343
351
  /**
344
352
  * Inserts one or more consecutive blank rows in a sheet starting at the specified location.
353
+ *
354
+ * For multiple consecutive rows, pass the full `numRows` in one call instead of looping
355
+ * with the default count of one.
356
+ *
345
357
  * @param {number} rowIndex - The existing row before which rows are inserted. The index is zero-based and must be between 0 and `getMaxRows() - 1`.
346
358
  * @param {number} [numRows] - The positive number of rows to insert.
347
359
  * @returns {FWorksheet} This sheet, for chaining.
@@ -390,6 +402,11 @@ export declare class FWorksheet extends FBaseInitialable {
390
402
  insertRowsBefore(beforePosition: number, howMany: number): FWorksheet;
391
403
  /**
392
404
  * Deletes the row at the given row position.
405
+ *
406
+ * For consecutive rows, prefer {@link FWorksheet.deleteRows} with the full count. For
407
+ * non-contiguous rows, use {@link FWorksheet.deleteRowsByPoints} so shifting indices are handled
408
+ * without a manual loop over this method.
409
+ *
393
410
  * @param {number} rowPosition - The position of the row, starting at 0 for the first row.
394
411
  * @returns {FWorksheet} This sheet, for chaining.
395
412
  * @example
@@ -452,6 +469,10 @@ export declare class FWorksheet extends FBaseInitialable {
452
469
  moveRows(rowSpec: FRange, destinationIndex: number): FWorksheet;
453
470
  /**
454
471
  * Hides the rows in the given range.
472
+ *
473
+ * For multiple rows, pass an FRange spanning all target rows in one call. If you already have
474
+ * a starting index and count, use {@link FWorksheet.hideRows} instead of calling this method for each row.
475
+ *
455
476
  * @param {FRange} row - The row range to hide.
456
477
  * @returns {FWorksheet} This sheet, for chaining.
457
478
  * @example
@@ -469,6 +490,10 @@ export declare class FWorksheet extends FBaseInitialable {
469
490
  hideRow(row: FRange): FWorksheet;
470
491
  /**
471
492
  * Hides one or more consecutive rows starting at the given index. Use 0-index for this method
493
+ *
494
+ * For multiple consecutive rows, pass the full `numRow` in one call instead of looping
495
+ * with the default count of one.
496
+ *
472
497
  * @param {number} rowIndex - The starting index of the rows to hide
473
498
  * @param {number} [numRow] - The number of rows to hide
474
499
  * @returns {FWorksheet} This sheet, for chaining.
@@ -485,6 +510,10 @@ export declare class FWorksheet extends FBaseInitialable {
485
510
  hideRows(rowIndex: number, numRow?: number): FWorksheet;
486
511
  /**
487
512
  * Make the row in the given range visible.
513
+ *
514
+ * For multiple rows, pass an FRange spanning all target rows in one call. If you already have
515
+ * a starting index and count, use {@link FWorksheet.showRows} instead of calling this method for each row.
516
+ *
488
517
  * @param {FRange} row - The range to unhide, if hidden.
489
518
  * @returns {FWorksheet} This sheet, for chaining.
490
519
  * @example
@@ -502,6 +531,10 @@ export declare class FWorksheet extends FBaseInitialable {
502
531
  unhideRow(row: FRange): FWorksheet;
503
532
  /**
504
533
  * Unhides one or more consecutive rows starting at the given zero-based index.
534
+ *
535
+ * For multiple consecutive rows, pass the full `numRows` in one call instead of looping
536
+ * with the default count of one.
537
+ *
505
538
  * @param {number} rowIndex - The starting index of the rows
506
539
  * @param {number} [numRows] - The number of rows
507
540
  * @returns {FWorksheet} This worksheet instance for chaining
@@ -518,6 +551,10 @@ export declare class FWorksheet extends FBaseInitialable {
518
551
  showRows(rowIndex: number, numRows?: number): FWorksheet;
519
552
  /**
520
553
  * Sets the row height of the given row in pixels. By default, rows grow to fit cell contents. If you want to force rows to a specified height, use setRowHeightsForced(startRow, numRows, height).
554
+ *
555
+ * For the same height across consecutive rows, prefer {@link FWorksheet.setRowHeights} with the full
556
+ * row count instead of calling this method for each row.
557
+ *
521
558
  * @param {number} rowPosition - The row position to change.
522
559
  * @param {number} height - The height in pixels to set it to.
523
560
  * @returns {FWorksheet} This worksheet instance for chaining
@@ -636,6 +673,10 @@ export declare class FWorksheet extends FBaseInitialable {
636
673
  setRowCustom(custom: IObjectArrayPrimitiveType<CustomData>): FWorksheet;
637
674
  /**
638
675
  * Inserts a column after the given column position.
676
+ *
677
+ * To insert multiple columns, prefer {@link FWorksheet.insertColumnsAfter} with the full count
678
+ * instead of repeatedly calling this method.
679
+ *
639
680
  * @param {number} afterPosition - The column after which the new column should be added, starting at 0 for the first column
640
681
  * @returns {FWorksheet} This worksheet instance for chaining
641
682
  * @example
@@ -651,6 +692,10 @@ export declare class FWorksheet extends FBaseInitialable {
651
692
  insertColumnAfter(afterPosition: number): FWorksheet;
652
693
  /**
653
694
  * Inserts a column before the given column position.
695
+ *
696
+ * To insert multiple columns, prefer {@link FWorksheet.insertColumnsBefore} with the full count
697
+ * instead of repeatedly calling this method.
698
+ *
654
699
  * @param {number} beforePosition - The column before which the new column should be added, starting at 0 for the first column
655
700
  * @returns {FWorksheet} This worksheet instance for chaining
656
701
  * @example
@@ -666,6 +711,10 @@ export declare class FWorksheet extends FBaseInitialable {
666
711
  insertColumnBefore(beforePosition: number): FWorksheet;
667
712
  /**
668
713
  * Inserts one or more consecutive blank columns in a sheet starting at the specified location.
714
+ *
715
+ * For multiple consecutive columns, pass the full `numColumns` in one call instead of looping
716
+ * with the default count of one.
717
+ *
669
718
  * @param {number} columnIndex - The index indicating where to insert a column, starting at 0 for the first column
670
719
  * @param {number} [numColumns] - The number of columns to insert
671
720
  * @returns {FWorksheet} This sheet, for chaining
@@ -714,6 +763,11 @@ export declare class FWorksheet extends FBaseInitialable {
714
763
  insertColumnsBefore(beforePosition: number, howMany: number): FWorksheet;
715
764
  /**
716
765
  * Deletes the column at the given column position.
766
+ *
767
+ * For consecutive columns, prefer {@link FWorksheet.deleteColumns} with the full count. For
768
+ * non-contiguous columns, use {@link FWorksheet.deleteColumnsByPoints} so shifting indices are handled
769
+ * without a manual loop over this method.
770
+ *
717
771
  * @param {number} columnPosition - The position of the column, starting at 0 for the first column
718
772
  * @returns {FWorksheet} This sheet, for chaining
719
773
  * @example
@@ -776,6 +830,10 @@ export declare class FWorksheet extends FBaseInitialable {
776
830
  moveColumns(columnSpec: FRange, destinationIndex: number): FWorksheet;
777
831
  /**
778
832
  * Hides the column or columns in the given range.
833
+ *
834
+ * For multiple columns, pass an FRange spanning all target columns in one call. If you already have
835
+ * a starting index and count, use {@link FWorksheet.hideColumns} instead of calling this method for each column.
836
+ *
779
837
  * @param {FRange} column - The column range to hide
780
838
  * @returns {FWorksheet} This sheet, for chaining
781
839
  * @example
@@ -793,6 +851,10 @@ export declare class FWorksheet extends FBaseInitialable {
793
851
  hideColumn(column: FRange): FWorksheet;
794
852
  /**
795
853
  * Hides one or more consecutive columns starting at the given index. Use 0-index for this method
854
+ *
855
+ * For multiple consecutive columns, pass the full `numColumn` in one call instead of looping
856
+ * with the default count of one.
857
+ *
796
858
  * @param {number} columnIndex - The starting index of the columns to hide
797
859
  * @param {number} [numColumn] - The number of columns to hide
798
860
  * @returns {FWorksheet} This sheet, for chaining
@@ -809,6 +871,10 @@ export declare class FWorksheet extends FBaseInitialable {
809
871
  hideColumns(columnIndex: number, numColumn?: number): FWorksheet;
810
872
  /**
811
873
  * Show the column in the given range.
874
+ *
875
+ * For multiple columns, pass an FRange spanning all target columns in one call. If you already have
876
+ * a starting index and count, use {@link FWorksheet.showColumns} instead of calling this method for each column.
877
+ *
812
878
  * @param {FRange} column - The range to unhide, if hidden
813
879
  * @returns {FWorksheet} This sheet, for chaining
814
880
  * @example
@@ -826,6 +892,10 @@ export declare class FWorksheet extends FBaseInitialable {
826
892
  unhideColumn(column: FRange): FWorksheet;
827
893
  /**
828
894
  * Show one or more consecutive columns starting at the given index. Use 0-index for this method
895
+ *
896
+ * For multiple consecutive columns, pass the full `numColumns` in one call instead of looping
897
+ * with the default count of one.
898
+ *
829
899
  * @param {number} columnIndex - The starting index of the columns to unhide
830
900
  * @param {number} [numColumns] - The number of columns to unhide
831
901
  * @returns {FWorksheet} This sheet, for chaining
@@ -842,6 +912,10 @@ export declare class FWorksheet extends FBaseInitialable {
842
912
  showColumns(columnIndex: number, numColumns?: number): FWorksheet;
843
913
  /**
844
914
  * Sets the width of the given column in pixels.
915
+ *
916
+ * For the same width across consecutive columns, prefer {@link FWorksheet.setColumnWidths} with the
917
+ * full column count instead of calling this method for each column.
918
+ *
845
919
  * @param {number} columnPosition - The position of the given column to set
846
920
  * @param {number} width - The width in pixels to set it to
847
921
  * @returns {FWorksheet} This sheet, for chaining
@@ -301,7 +301,7 @@ export { adjustRangeOnMutation, getSeparateEffectedRangesOnCommand, handleBaseIn
301
301
  export type { MutationsAffectRange } from './services/ref-range/util';
302
302
  export * from './services/selections';
303
303
  export { getNextPrimaryCell } from './services/selections/move-active-cell-util';
304
- export { InterceptCellContentPriority, INTERCEPTOR_POINT } from './services/sheet-interceptor/interceptor-const';
304
+ export { InterceptCellContentPriority, INTERCEPTOR_POINT, RangeThemeInterceptorId } from './services/sheet-interceptor/interceptor-const';
305
305
  export { AFTER_CELL_EDIT, BEFORE_CELL_EDIT, SheetInterceptorService, VALIDATE_CELL, } from './services/sheet-interceptor/sheet-interceptor.service';
306
306
  export type { IAutoHeightContext } from './services/sheet-interceptor/sheet-interceptor.service';
307
307
  export type { ISheetLocation, ISheetLocationBase, ISheetRowLocation, } from './services/sheet-interceptor/utils/interceptor';
@@ -40,16 +40,16 @@ export declare class RangeProtectionCache extends Disposable {
40
40
  getRowPermissionInfo(unitId: string, subUnitId: string, row: number, types: UnitAction[]): boolean;
41
41
  getColPermissionInfo(unitId: string, subUnitId: string, col: number, types: UnitAction[]): boolean;
42
42
  private _initUpdateRowColInfoCache;
43
- getCellInfo(unitId: string, subUnitId: string, row: number, col: number): (Partial<Record<UnitAction, boolean>> & {
44
- ruleId?: string;
45
- ranges?: IRange[];
46
- }) | {
43
+ getCellInfo(unitId: string, subUnitId: string, row: number, col: number): {
44
+ [UnitAction.Edit]: boolean;
45
+ [UnitAction.View]: boolean;
46
+ [UnitAction.ManageCollaborator]: boolean;
47
+ [UnitAction.Delete]: boolean;
47
48
  ruleId: string;
48
49
  ranges: IRange[];
49
- 1: boolean;
50
- 0: boolean;
51
- 2: boolean;
52
- 42: boolean;
53
- } | undefined;
50
+ } | (Partial<Record<UnitAction, boolean>> & {
51
+ ruleId?: string;
52
+ ranges?: IRange[];
53
+ }) | undefined;
54
54
  deleteUnit(unitId: string): void;
55
55
  }
@@ -48,7 +48,7 @@ export declare class SheetRangeThemeModel extends Disposable {
48
48
  private _rowVisibleFuncSet;
49
49
  private _rangeThemeMapChanged$;
50
50
  rangeThemeMapChange$: import("rxjs").Observable<{
51
- type: "add" | "remove";
51
+ type: 'add' | 'remove';
52
52
  styleName: string;
53
53
  }>;
54
54
  constructor(_sheetInterceptorService: SheetInterceptorService, _resourceManagerService: IResourceManagerService, _univerInstanceService: IUniverInstanceService, _sheetRowFilteredService?: ISheetRowFilteredService | undefined);
@@ -86,4 +86,4 @@ export declare class AutoFillService extends Disposable implements IAutoFillServ
86
86
  fillData(applyType: AUTO_FILL_APPLY_TYPE): boolean;
87
87
  private _getAutoHeightUndoRedos;
88
88
  }
89
- export declare const IAutoFillService: import("@wendellhu/redi").IdentifierDecorator<IAutoFillService>;
89
+ export declare const IAutoFillService: import("@univerjs/core").IdentifierDecorator<IAutoFillService>;
@@ -40,17 +40,17 @@ declare function getLenS(indexArr: any[], rsd: number): number;
40
40
  declare function isEqualDiff(arr: number[]): boolean;
41
41
  declare function getDataIndex(csLen: number, asLen: number, indexArr: number[]): IAutoFillCopyDataInTypeIndexInfo;
42
42
  declare function fillCopy(data: Array<Nullable<ICellData>>, len: number): {
43
- p: import("@univerjs/core").IDocumentData | null;
44
- s: string | import("@univerjs/core").IStyleData | null;
45
- v: import("@univerjs/core").CellValue | null;
46
- t: CellValueType | null;
47
- f: string | null;
48
43
  ft?: Nullable<import("@univerjs/core").FormulaType>;
49
44
  fd?: Nullable<import("@univerjs/core").BooleanNumber>;
50
45
  ref?: Nullable<string>;
51
46
  xf?: Nullable<string>;
52
- si: string | null;
53
47
  custom?: import("@univerjs/core").CustomData;
48
+ v: import("@univerjs/core").CellValue | null;
49
+ s: string | import("@univerjs/core").IStyleData | null;
50
+ p: import("@univerjs/core").IDocumentData | null;
51
+ f: string | null;
52
+ si: string | null;
53
+ t: CellValueType | null;
54
54
  }[];
55
55
  declare function fillCopyStyles(data: Array<Nullable<ICellData>>, len: number): {
56
56
  s: Nullable<string | import("@univerjs/core").IStyleData>;
@@ -64,7 +64,7 @@ export interface IExclusiveRangeService {
64
64
  */
65
65
  getInterestGroupId(selections: ISelectionWithStyle[]): string[];
66
66
  }
67
- export declare const IExclusiveRangeService: import("@wendellhu/redi").IdentifierDecorator<IExclusiveRangeService>;
67
+ export declare const IExclusiveRangeService: import("@univerjs/core").IdentifierDecorator<IExclusiveRangeService>;
68
68
  export declare class ExclusiveRangeService extends Disposable implements IExclusiveRangeService {
69
69
  /**
70
70
  * Exclusive range data structure is as follows: unitId -> sheetId -> feature -> range
@@ -25,7 +25,7 @@ export interface INumfmtItemWithCache {
25
25
  };
26
26
  pattern: string;
27
27
  }
28
- export declare const INumfmtService: import("@wendellhu/redi").IdentifierDecorator<INumfmtService>;
28
+ export declare const INumfmtService: import("@univerjs/core").IdentifierDecorator<INumfmtService>;
29
29
  export interface INumfmtService {
30
30
  getValue(unitId: string, subUnitId: string, row: number, col: number, model?: ObjectMatrix<INumfmtItem>): Nullable<INumfmtItemWithCache>;
31
31
  setValues(unitId: string, subUnitId: string, values: Array<{
@@ -14,11 +14,11 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { IMutationInfo } from '@univerjs/core';
17
+ import { Disposable, DisposableCollection, ICommandService, IUniverInstanceService } from '@univerjs/core';
17
18
  import type { IAddRangeProtectionMutationParams } from '../../../commands/mutations/add-range-protection.mutation';
18
19
  import type { IDeleteRangeProtectionMutationParams } from '../../../commands/mutations/delete-range-protection.mutation';
19
20
  import type { ISetRangeProtectionMutationParams } from '../../../commands/mutations/set-range-protection.mutation';
20
21
  import type { EffectRefRangeParams } from '../../ref-range/type';
21
- import { Disposable, DisposableCollection, ICommandService, IUniverInstanceService } from '@univerjs/core';
22
22
  import { RangeProtectionRenderModel } from '../../../models/range-protection-render.model';
23
23
  import { RangeProtectionRuleModel } from '../../../models/range-protection-rule.model';
24
24
  import { RangeProtectionCache } from '../../../models/range-protection.cache';
@@ -37,6 +37,9 @@ export declare class RangeProtectionRefRangeService extends Disposable {
37
37
  constructor(_selectionProtectionRuleModel: RangeProtectionRuleModel, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService, _refRangeService: RefRangeService, _selectionProtectionRenderModel: RangeProtectionRenderModel, _rangeProtectionCache: RangeProtectionCache, _sheetInterceptorService: SheetInterceptorService, _rangeProtectionRuleModel: RangeProtectionRuleModel);
38
38
  private _onRefRangeChange;
39
39
  refRangeHandle(config: EffectRefRangeParams, unitId: string, subUnitId: string): {
40
+ redos: IMutationInfo<IAddRangeProtectionMutationParams | IDeleteRangeProtectionMutationParams | ISetRangeProtectionMutationParams>[];
41
+ undos: IMutationInfo<IAddRangeProtectionMutationParams | IDeleteRangeProtectionMutationParams | ISetRangeProtectionMutationParams>[];
42
+ } | {
40
43
  redos: {
41
44
  id: string;
42
45
  params: ISetRangeProtectionMutationParams;
@@ -45,9 +48,6 @@ export declare class RangeProtectionRefRangeService extends Disposable {
45
48
  id: string;
46
49
  params: ISetRangeProtectionMutationParams;
47
50
  }[];
48
- } | {
49
- redos: IMutationInfo<IDeleteRangeProtectionMutationParams | IAddRangeProtectionMutationParams | ISetRangeProtectionMutationParams>[];
50
- undos: IMutationInfo<IDeleteRangeProtectionMutationParams | IAddRangeProtectionMutationParams | ISetRangeProtectionMutationParams>[];
51
51
  };
52
52
  private _getRefRangeMutationsByDeleteCols;
53
53
  private _getRefRangeMutationsByDeleteRows;
@@ -57,6 +57,15 @@ export declare class RangeProtectionRefRangeService extends Disposable {
57
57
  private _getRefRangeMutationsByMoveCols;
58
58
  private _correctPermissionRange;
59
59
  private _checkIsRightRange;
60
+ private _coversAllRows;
61
+ private _coversAllColumns;
62
+ /**
63
+ * A whole column/row/sheet protection range always covers that axis, so inserting or removing
64
+ * rows/columns there only moves its end instead of shifting it.
65
+ *
66
+ * @returns `true` when the range was adjusted as a whole range
67
+ */
68
+ private _adjustWholeRangeForStructuralChange;
60
69
  private _initReBuildCache;
61
70
  private _initRemoveSheet;
62
71
  }
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { IAccessor, ICommandInfo, IMutationInfo, IRange, Nullable } from '@univerjs/core';
17
+ import { RANGE_TYPE } from '@univerjs/core';
17
18
  import type { IInsertColMutationParams, IInsertRowMutationParams, IRemoveColMutationParams, IRemoveRowsMutationParams, IRemoveSheetMutationParams } from '../../basics';
18
19
  import type { IInsertColCommandParams, IInsertRowCommandParams } from '../../commands/commands/insert-row-col.command';
19
20
  import type { IRemoveRowColCommandInterceptParams } from '../../commands/commands/remove-row-col.command';
@@ -22,28 +23,27 @@ import type { IMoveColumnsMutationParams, IMoveRowsMutationParams } from '../../
22
23
  import type { ISheetCommandSharedParams } from '../../commands/utils/interface';
23
24
  import type { SheetsSelectionsService } from '../selections/selection.service';
24
25
  import type { EffectRefRangeParams, IDeleteRangeMoveLeftCommand, IDeleteRangeMoveUpCommand, IInsertColCommand, IInsertRangeMoveDownCommand, IInsertRangeMoveRightCommand, IInsertRowCommand, IMoveColsCommand, IMoveRangeCommand, IMoveRowsCommand, IOperator, IRemoveRowColCommand, IReorderRangeCommand } from './type';
25
- import { RANGE_TYPE } from '@univerjs/core';
26
26
  export declare const handleRangeTypeInput: (range: IRange) => {
27
- rangeType?: RANGE_TYPE;
28
- startAbsoluteRefType?: import("@univerjs/core").AbsoluteRefType;
29
- endAbsoluteRefType?: import("@univerjs/core").AbsoluteRefType;
30
- startRow: number;
31
- endRow: number;
32
27
  unitId?: string;
33
28
  sheetId?: string;
29
+ startRow: number;
30
+ endRow: number;
34
31
  startColumn: number;
35
32
  endColumn: number;
36
- };
37
- export declare const handleRangeTypeOutput: (range: IRange, maxRow: number, maxCol: number) => {
38
33
  rangeType?: RANGE_TYPE;
39
34
  startAbsoluteRefType?: import("@univerjs/core").AbsoluteRefType;
40
35
  endAbsoluteRefType?: import("@univerjs/core").AbsoluteRefType;
41
- startRow: number;
42
- endRow: number;
36
+ };
37
+ export declare const handleRangeTypeOutput: (range: IRange, maxRow: number, maxCol: number) => {
43
38
  unitId?: string;
44
39
  sheetId?: string;
40
+ startRow: number;
41
+ endRow: number;
45
42
  startColumn: number;
46
43
  endColumn: number;
44
+ rangeType?: RANGE_TYPE;
45
+ startAbsoluteRefType?: import("@univerjs/core").AbsoluteRefType;
46
+ endAbsoluteRefType?: import("@univerjs/core").AbsoluteRefType;
47
47
  };
48
48
  export declare const rotateRange: (range: IRange) => IRange;
49
49
  interface ILine {
@@ -95,17 +95,32 @@ export declare const handleDeleteRangeMoveLeftCommon: (param: IDeleteRangeMoveLe
95
95
  export declare const handleDeleteRangeMoveUp: (param: IDeleteRangeMoveUpCommand, targetRange: IRange) => IOperator[];
96
96
  export declare const handleDeleteRangeMoveUpCommon: (param: IDeleteRangeMoveUpCommand, targetRange: IRange) => IRange[];
97
97
  export declare const handleRemoveRowCommon: (param: IRemoveRowColCommandInterceptParams, targetRange: IRange) => {
98
- startRow: number;
99
- endRow: number;
100
- rangeType?: RANGE_TYPE;
101
- startAbsoluteRefType?: import("@univerjs/core").AbsoluteRefType;
102
- endAbsoluteRefType?: import("@univerjs/core").AbsoluteRefType;
103
98
  unitId?: string;
104
99
  sheetId?: string;
105
100
  startColumn: number;
106
101
  endColumn: number;
102
+ rangeType?: RANGE_TYPE;
103
+ startAbsoluteRefType?: import("@univerjs/core").AbsoluteRefType;
104
+ endAbsoluteRefType?: import("@univerjs/core").AbsoluteRefType;
105
+ startRow: number;
106
+ endRow: number;
107
107
  }[];
108
+ /**
109
+ * A ref range follows the data it covers, whichever command entry produced the insertion:
110
+ * inserting above the range shifts it down, inserting inside the range expands it, and
111
+ * inserting below the range leaves it untouched.
112
+ *
113
+ * `direction` only decides which row the inserted cells inherit styles and height from, so it
114
+ * is deliberately ignored here: two entry points that insert a row at the same position must
115
+ * return the same range. This matches `handleBaseInsertRange`, which serves the mutation based
116
+ * ref-range paths, and the collaboration transform algorithms, which cannot supply a direction
117
+ * at all.
118
+ */
108
119
  export declare const handleInsertRowCommon: (info: ICommandInfo<IInsertRowCommandParams>, targetRange: IRange) => IRange[];
120
+ /**
121
+ * Column counterpart of {@link handleInsertRowCommon}: a ref range follows the data it covers,
122
+ * so `direction` is deliberately ignored here as well.
123
+ */
109
124
  export declare const handleInsertColCommon: (info: ICommandInfo<IInsertColCommandParams>, targetRange: IRange) => IRange[];
110
125
  export declare const runRefRangeMutations: (operators: IOperator[], range: IRange) => IRange | null;
111
126
  export declare const handleDefaultRangeChangeWithEffectRefCommands: (range: IRange, commandInfo: ICommandInfo) => IRange | null;
@@ -116,7 +131,7 @@ export type MutationsAffectRange = ISheetCommandSharedParams | IRemoveSheetMutat
116
131
  export declare const handleCommonDefaultRangeChangeWithEffectRefCommands: (range: IRange, commandInfo: ICommandInfo) => IRange[];
117
132
  export declare const handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests: (range: IRange, commandInfo: ICommandInfo, deps: {
118
133
  selectionManagerService: SheetsSelectionsService;
119
- }) => IRange | IRange[];
134
+ }) => IRange[] | IRange;
120
135
  /**
121
136
  * This function should work as a pure function.
122
137
  *
@@ -21,7 +21,7 @@ import { SheetsSelectionsService } from './selection.service';
21
21
  *
22
22
  * Its data should be cleared by the caller quit editing formula and reconstructed when user starts editing.
23
23
  */
24
- export declare const IRefSelectionsService: import("@wendellhu/redi").IdentifierDecorator<SheetsSelectionsService>;
24
+ export declare const IRefSelectionsService: import("@univerjs/core").IdentifierDecorator<SheetsSelectionsService>;
25
25
  /**
26
26
  * RefSelectionsService treats `selectionMoveStart$` `selectionMoving$` and `selectionMoveEnd$` differently
27
27
  * than `SheetsSelectionsService`. Because ref selections can be in different workbooks.
@@ -24,7 +24,8 @@ export declare const INTERCEPTOR_POINT: {
24
24
  export declare enum InterceptCellContentPriority {
25
25
  DATA_VALIDATION = 9,
26
26
  NUMFMT = 10,
27
- CELL_IMAGE = 11
27
+ CELL_IMAGE = 11,
28
+ TABLE_STYLE = 12
28
29
  }
29
30
  export declare const RangeThemeInterceptorId = "sheet.interceptor.range-theme-id";
30
31
  export declare const IgnoreRangeThemeInterceptorKey = "sheet.interceptor.ignore-range-theme";
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export { UniverSheetsPlugin } from './plugin';