@univerjs/sheets 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ export declare const RemoveRowCommandId = "sheet.command.remove-row";
7
7
  /**
8
8
  * This command would remove the selected rows. These selected rows can be non-continuous.
9
9
  */
10
- export declare const RemoveRowCommand: ICommand;
10
+ export declare const RemoveRowCommand: ICommand<IRemoveRowColCommandParams>;
11
11
  export declare const RemoveColCommandId = "sheet.command.remove-col";
12
12
  /**
13
13
  * This command would remove the selected columns. These selected rows can be non-continuous.
@@ -1,4 +1,4 @@
1
- import { ISetSelectionsOperationParams } from '../..';
1
+ import { ISetSelectionsOperationParams } from '../operations/selection.operation';
2
2
  import { IAddMergeCommandParams } from '../commands/add-worksheet-merge.command';
3
3
  import { IRange } from '@univerjs/core';
4
4
  import { IAccessor } from '@wendellhu/redi';
@@ -83,7 +83,7 @@ export type { ISetRangeValuesMutationParams } from './commands/mutations/set-ran
83
83
  export { SetRangeValuesMutation } from './commands/mutations/set-range-values.mutation';
84
84
  export { SetRangeValuesUndoMutationFactory } from './commands/mutations/set-range-values.mutation';
85
85
  export { type ISetRangeValuesRangeMutationParams } from './commands/mutations/set-range-values.mutation';
86
- export { type ISetRowHiddenMutationParams, type ISetRowVisibleMutationParams, SetRowHiddenMutation, SetRowVisibleMutation } from './commands/mutations/set-row-visible.mutation';
86
+ export { type ISetRowHiddenMutationParams, type ISetRowVisibleMutationParams, SetRowHiddenMutation, SetRowVisibleMutation, } from './commands/mutations/set-row-visible.mutation';
87
87
  export { SetTabColorMutation } from './commands/mutations/set-tab-color.mutation';
88
88
  export { type ISetTabColorMutationParams } from './commands/mutations/set-tab-color.mutation';
89
89
  export { type ISetWorksheetColWidthMutationParams, SetWorksheetColWidthMutation, SetWorksheetColWidthMutationFactory, } from './commands/mutations/set-worksheet-col-width.mutation';
@@ -108,7 +108,7 @@ export { INumfmtService } from './services/numfmt/type';
108
108
  export { RefRangeService } from './services/ref-range/ref-range.service';
109
109
  export type { EffectRefRangeParams, IOperator } from './services/ref-range/type';
110
110
  export { EffectRefRangId, OperatorType } from './services/ref-range/type';
111
- export { handleBaseInsertRange, handleBaseMoveRowsCols, handleBaseRemoveRange, handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleInsertCol, handleInsertRangeMoveDown, handleInsertRangeMoveRight, handleInsertRow, handleIRemoveCol, handleIRemoveRow, handleMoveCols, handleMoveRange, handleMoveRows, rotateRange, runRefRangeMutations, handleDefaultRangeChangeWithEffectRefCommands, handleOtherDefaultRangeChangeWithEffectRefCommands, } from './services/ref-range/util';
111
+ export { handleBaseInsertRange, handleBaseMoveRowsCols, handleBaseRemoveRange, handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleInsertCol, handleInsertRangeMoveDown, handleInsertRangeMoveRight, handleInsertRow, handleIRemoveCol, handleIRemoveRow, handleMoveCols, handleMoveRange, handleMoveRows, rotateRange, runRefRangeMutations, handleCommonDefaultRangeChangeWithEffectRefCommands, handleDefaultRangeChangeWithEffectRefCommands, } from './services/ref-range/util';
112
112
  export { INTERCEPTOR_POINT } from './services/sheet-interceptor/interceptor-const';
113
113
  export { SheetInterceptorService } from './services/sheet-interceptor/sheet-interceptor.service';
114
114
  export type { ISheetLocation } from './services/sheet-interceptor/utils/interceptor';
@@ -0,0 +1,14 @@
1
+ import { Univer } from '@univerjs/core';
2
+
3
+ export declare function createRefRangeTestBed(): {
4
+ univer: Univer;
5
+ get: {
6
+ <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, lookUp?: import('@wendellhu/redi').LookUp | undefined): T;
7
+ <T_1>(id: import('@wendellhu/redi').DependencyIdentifier<T_1>, quantity: import("@wendellhu/redi").Quantity.MANY, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_1[];
8
+ <T_2>(id: import('@wendellhu/redi').DependencyIdentifier<T_2>, quantity: import("@wendellhu/redi").Quantity.OPTIONAL, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_2 | null;
9
+ <T_3>(id: import('@wendellhu/redi').DependencyIdentifier<T_3>, quantity: import("@wendellhu/redi").Quantity.REQUIRED, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_3;
10
+ <T_4>(id: import('@wendellhu/redi').DependencyIdentifier<T_4>, quantity?: import('@wendellhu/redi').Quantity | undefined, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_4 | T_4[] | null;
11
+ <T_5>(id: import('@wendellhu/redi').DependencyIdentifier<T_5>, quantityOrLookup?: import('@wendellhu/redi').Quantity | import('@wendellhu/redi').LookUp | undefined, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_5 | T_5[] | null;
12
+ };
13
+ sheet: import('@univerjs/core').Workbook;
14
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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 {};
@@ -2,7 +2,7 @@ import { EffectRefRangeParams } from './type';
2
2
  import { SheetInterceptorService } from '../sheet-interceptor/sheet-interceptor.service';
3
3
  import { SelectionManagerService } from '../selection-manager.service';
4
4
  import { IDisposable } from '@wendellhu/redi';
5
- import { IMutationInfo, IRange, Disposable, InterceptorManager, IUniverInstanceService } from '@univerjs/core';
5
+ import { IMutationInfo, IRange, Nullable, Disposable, ICommandService, InterceptorManager, IUniverInstanceService } from '@univerjs/core';
6
6
 
7
7
  type RefRangCallback = (params: EffectRefRangeParams) => {
8
8
  redos: IMutationInfo[];
@@ -10,10 +10,12 @@ type RefRangCallback = (params: EffectRefRangeParams) => {
10
10
  preRedos?: IMutationInfo[];
11
11
  preUndos?: IMutationInfo[];
12
12
  };
13
+ export type WatchRangeCallback = (before: IRange, after: Nullable<IRange>) => void;
13
14
  /**
14
15
  * Collect side effects caused by ref range change
15
16
  */
16
17
  export declare class RefRangeService extends Disposable {
18
+ private readonly _commandService;
17
19
  private _sheetInterceptorService;
18
20
  private _univerInstanceService;
19
21
  private _selectionManagerService;
@@ -21,7 +23,9 @@ export declare class RefRangeService extends Disposable {
21
23
  MERGE_REDO: import('@univerjs/core').IInterceptor<IMutationInfo<object>[], null>;
22
24
  MERGE_UNDO: import('@univerjs/core').IInterceptor<IMutationInfo<object>[], null>;
23
25
  }>;
24
- constructor(_sheetInterceptorService: SheetInterceptorService, _univerInstanceService: IUniverInstanceService, _selectionManagerService: SelectionManagerService);
26
+ private _watchRanges;
27
+ constructor(_commandService: ICommandService, _sheetInterceptorService: SheetInterceptorService, _univerInstanceService: IUniverInstanceService, _selectionManagerService: SelectionManagerService);
28
+ watchRange(unitId: string, subUnitId: string, range: IRange, callback: WatchRangeCallback): IDisposable;
25
29
  private _refRangeManagerMap;
26
30
  private _serializer;
27
31
  private _onRefRangeChange;
@@ -1,5 +1,9 @@
1
1
  import { IDeleteRangeMoveLeftCommand, IDeleteRangeMoveUpCommand, IInsertColCommand, IInsertRangeMoveDownCommand, IInsertRangeMoveRightCommand, IInsertRowCommand, IMoveColsCommand, IMoveRangeCommand, IMoveRowsCommand, IOperator, IRemoveRowColCommand } from './type';
2
- import { ICommandInfo, IRange, RANGE_TYPE } from '@univerjs/core';
2
+ import { ISheetCommandSharedParams } from '../../commands/utils/interface';
3
+ import { IMoveRangeMutationParams } from '../../commands/mutations/move-range.mutation';
4
+ import { IInsertColMutationParams, IInsertRowMutationParams, IRemoveColMutationParams, IRemoveRowsMutationParams, IRemoveSheetMutationParams } from '../../basics';
5
+ import { IMoveColumnsMutationParams, IMoveRowsMutationParams } from '../../commands/mutations/move-rows-cols.mutation';
6
+ import { ICommandInfo, IMutationInfo, IRange, Nullable, RANGE_TYPE } from '@univerjs/core';
3
7
 
4
8
  export declare const handleRangeTypeInput: (range: IRange) => {
5
9
  startColumn: number;
@@ -32,10 +36,11 @@ export declare const handleBaseMoveRowsCols: (fromRange: ILine, toRange: ILine,
32
36
  step: number;
33
37
  };
34
38
  export declare const handleMoveRows: (params: IMoveRowsCommand, targetRange: IRange) => IOperator[];
35
- export declare const handleMoveRowsOther: (params: IMoveRowsCommand, targetRange: IRange) => IRange[] | null;
39
+ export declare const handleMoveRowsCommon: (params: IMoveRowsCommand, targetRange: IRange) => IRange[];
36
40
  export declare const handleMoveCols: (params: IMoveColsCommand, targetRange: IRange) => IOperator[];
37
- export declare const handleMoveColsOther: (params: IMoveColsCommand, targetRange: IRange) => IRange[] | null;
41
+ export declare const handleMoveColsCommon: (params: IMoveColsCommand, targetRange: IRange) => IRange[];
38
42
  export declare const handleMoveRange: (param: IMoveRangeCommand, targetRange: IRange) => IOperator[];
43
+ export declare const handleMoveRangeCommon: (param: IMoveRangeCommand, targetRange: IRange) => IRange[];
39
44
  export declare const handleBaseRemoveRange: (_removeRange: IRange, _targetRange: IRange) => {
40
45
  step: number;
41
46
  length: number;
@@ -49,10 +54,24 @@ export declare const handleBaseInsertRange: (_insertRange: IRange, _targetRange:
49
54
  export declare const handleInsertRow: (param: IInsertRowCommand, targetRange: IRange) => IOperator[];
50
55
  export declare const handleInsertCol: (param: IInsertColCommand, targetRange: IRange) => IOperator[];
51
56
  export declare const handleInsertRangeMoveDown: (param: IInsertRangeMoveDownCommand, targetRange: IRange) => IOperator[];
57
+ export declare const handleInsertRangeMoveDownCommon: (param: IInsertRangeMoveDownCommand, targetRange: IRange) => IRange[];
52
58
  export declare const handleInsertRangeMoveRight: (param: IInsertRangeMoveRightCommand, targetRange: IRange) => IOperator[];
59
+ export declare const handleInsertRangeMoveRightCommon: (param: IInsertRangeMoveRightCommand, targetRange: IRange) => IRange[];
53
60
  export declare const handleDeleteRangeMoveLeft: (param: IDeleteRangeMoveLeftCommand, targetRange: IRange) => IOperator[];
61
+ export declare const handleDeleteRangeMoveLeftCommon: (param: IDeleteRangeMoveLeftCommand, targetRange: IRange) => IRange[];
54
62
  export declare const handleDeleteRangeMoveUp: (param: IDeleteRangeMoveUpCommand, targetRange: IRange) => IOperator[];
63
+ export declare const handleDeleteRangeMoveUpCommon: (param: IDeleteRangeMoveUpCommand, targetRange: IRange) => IRange[];
55
64
  export declare const runRefRangeMutations: (operators: IOperator[], range: IRange) => IRange | null;
56
65
  export declare const handleDefaultRangeChangeWithEffectRefCommands: (range: IRange, commandInfo: ICommandInfo) => IRange | null;
57
- export declare const handleOtherDefaultRangeChangeWithEffectRefCommands: (range: IRange, commandInfo: ICommandInfo) => IRange | IRange[] | null;
66
+ type MutationsAffectRange = ISheetCommandSharedParams | IRemoveSheetMutationParams | IMoveRowsMutationParams | IMoveColumnsMutationParams | IRemoveRowsMutationParams | IRemoveColMutationParams | IInsertColMutationParams | IInsertRowMutationParams | IMoveRangeMutationParams;
67
+ export declare const handleCommonDefaultRangeChangeWithEffectRefCommands: (range: IRange, commandInfo: ICommandInfo) => IRange | IRange[] | null;
68
+ /**
69
+ * This function should work as a pure function.
70
+ *
71
+ * @pure
72
+ * @param range
73
+ * @param mutation
74
+ * @returns the adjusted range
75
+ */
76
+ export declare function adjustRangeOnMutation(range: Readonly<IRange>, mutation: IMutationInfo<MutationsAffectRange>): Nullable<IRange>;
58
77
  export {};