@univerjs/sheets 0.1.0-beta.1 → 0.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{LICENSE.txt → LICENSE} +0 -2
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +3152 -2860
- package/lib/types/basics/interfaces/mutation-interface.d.ts +2 -2
- package/lib/types/commands/commands/move-range.command.d.ts +11 -1
- package/lib/types/commands/commands/move-rows-cols.command.d.ts +7 -5
- package/lib/types/commands/commands/set-border-command.d.ts +8 -2
- package/lib/types/commands/commands/set-style.command.d.ts +5 -2
- package/lib/types/commands/commands/utils/selection-utils.d.ts +13 -1
- package/lib/types/commands/mutations/__tests__/create-command-test-bed.d.ts +25 -0
- package/lib/types/commands/mutations/__tests__/move-rows-cols.mutation.spec.d.ts +16 -0
- package/lib/types/commands/mutations/__tests__/remove-row-col.mutation.spec.d.ts +16 -0
- package/lib/types/commands/mutations/empty.mutation.d.ts +17 -0
- package/lib/types/commands/mutations/move-range.mutation.d.ts +8 -3
- package/lib/types/commands/mutations/move-rows-cols.mutation.d.ts +2 -2
- package/lib/types/commands/mutations/set-frozen.mutation.d.ts +1 -0
- package/lib/types/commands/mutations/set-worksheet-row-height.mutation.d.ts +2 -2
- package/lib/types/commands/utils/get-target.d.ts +32 -0
- package/lib/types/commands/{mutations/delete-range.mutation.d.ts → utils/handle-range-mutation.d.ts} +25 -2
- package/lib/types/controllers/merge-cell.controller.d.ts +2 -0
- package/lib/types/index.d.ts +11 -10
- package/lib/types/locale/en-US.d.ts +1 -0
- package/lib/types/locale/zh-CN.d.ts +1 -0
- package/lib/types/services/permission/index.d.ts +1 -0
- package/lib/types/services/permission/tool.d.ts +18 -0
- package/lib/types/services/ref-range/type.d.ts +11 -1
- package/lib/types/services/ref-range/util.d.ts +29 -12
- package/lib/umd/index.js +1 -1
- package/package.json +29 -28
- package/lib/types/commands/mutations/insert-range.mutation.d.ts +0 -29
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { Dimension, ICellData, IColumnData, IObjectArrayPrimitiveType, IObjectMatrixPrimitiveType, IRange, IRowData, IWorksheetData } from '@univerjs/core';
|
|
16
|
+
import type { Dimension, ICellData, IColumnData, IObjectArrayPrimitiveType, IObjectMatrixPrimitiveType, IRange, IRowData, IWorksheetData, Nullable } from '@univerjs/core';
|
|
17
17
|
/** Params of `RemoveSheetMutation` */
|
|
18
18
|
export interface IRemoveSheetMutationParams {
|
|
19
19
|
subUnitId: string;
|
|
@@ -64,7 +64,7 @@ export interface IInsertRangeMutationParams {
|
|
|
64
64
|
subUnitId: string;
|
|
65
65
|
range: IRange;
|
|
66
66
|
shiftDimension: Dimension;
|
|
67
|
-
cellValue?: IObjectMatrixPrimitiveType<ICellData
|
|
67
|
+
cellValue?: IObjectMatrixPrimitiveType<Nullable<ICellData>>;
|
|
68
68
|
}
|
|
69
69
|
/** Params of RemoveWorksheetMergeMutation */
|
|
70
70
|
export interface IRemoveWorksheetMergeMutationParams {
|
|
@@ -13,10 +13,20 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { ICommand, IRange } from '@univerjs/core';
|
|
16
|
+
import type { ICommand, IMutationInfo, IRange } from '@univerjs/core';
|
|
17
|
+
import type { IAccessor } from '@wendellhu/redi';
|
|
17
18
|
export interface IMoveRangeCommandParams {
|
|
18
19
|
toRange: IRange;
|
|
19
20
|
fromRange: IRange;
|
|
20
21
|
}
|
|
21
22
|
export declare const MoveRangeCommandId = "sheet.command.move-range";
|
|
22
23
|
export declare const MoveRangeCommand: ICommand;
|
|
24
|
+
export interface IRangeUnit {
|
|
25
|
+
unitId: string;
|
|
26
|
+
subUnitId: string;
|
|
27
|
+
range: IRange;
|
|
28
|
+
}
|
|
29
|
+
export declare function getMoveRangeUndoRedoMutations(accessor: IAccessor, from: IRangeUnit, to: IRangeUnit, ignoreMerge?: boolean): {
|
|
30
|
+
redos: IMutationInfo<object>[];
|
|
31
|
+
undos: IMutationInfo<object>[];
|
|
32
|
+
} | null;
|
|
@@ -13,17 +13,19 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { ICommand } from '@univerjs/core';
|
|
16
|
+
import type { ICommand, IRange } from '@univerjs/core';
|
|
17
17
|
export interface IMoveRowsCommandParams {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
fromRange: IRange;
|
|
19
|
+
toRange: IRange;
|
|
20
20
|
}
|
|
21
|
+
export declare const MoveRowsCommandId: "sheet.command.move-rows";
|
|
21
22
|
/**
|
|
22
23
|
* Command to move the selected rows (must currently selected) to the specified row.
|
|
23
24
|
*/
|
|
24
25
|
export declare const MoveRowsCommand: ICommand<IMoveRowsCommandParams>;
|
|
25
26
|
export interface IMoveColsCommandParams {
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
fromRange: IRange;
|
|
28
|
+
toRange: IRange;
|
|
28
29
|
}
|
|
30
|
+
export declare const MoveColsCommandId: "sheet.command.move-cols";
|
|
29
31
|
export declare const MoveColsCommand: ICommand<IMoveColsCommandParams>;
|
|
@@ -16,10 +16,12 @@
|
|
|
16
16
|
import type { BorderStyleTypes, ICommand } from '@univerjs/core';
|
|
17
17
|
import { BorderType } from '@univerjs/core';
|
|
18
18
|
import { type IBorderInfo } from '../../services/border-style-manager.service';
|
|
19
|
-
export interface
|
|
19
|
+
export interface ISetBorderBasicCommandParams {
|
|
20
|
+
unitId?: string;
|
|
21
|
+
subUnitId?: string;
|
|
20
22
|
value: IBorderInfo;
|
|
21
23
|
}
|
|
22
|
-
export declare const SetBorderBasicCommand: ICommand<
|
|
24
|
+
export declare const SetBorderBasicCommand: ICommand<ISetBorderBasicCommandParams>;
|
|
23
25
|
export interface ISetBorderPositionCommandParams {
|
|
24
26
|
value: BorderType;
|
|
25
27
|
}
|
|
@@ -32,6 +34,10 @@ export interface ISetBorderColorCommandParams {
|
|
|
32
34
|
value: string;
|
|
33
35
|
}
|
|
34
36
|
export declare const SetBorderColorCommand: ICommand<ISetBorderColorCommandParams>;
|
|
37
|
+
export interface ISetBorderCommandParams {
|
|
38
|
+
unitId?: string;
|
|
39
|
+
subUnitId?: string;
|
|
40
|
+
}
|
|
35
41
|
/**
|
|
36
42
|
* The command to clear content in current selected ranges.
|
|
37
43
|
*/
|
|
@@ -18,10 +18,12 @@ export interface IStyleTypeValue<T> {
|
|
|
18
18
|
type: keyof IStyleData;
|
|
19
19
|
value: T | T[][];
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
interface ISetStyleCommonParams {
|
|
22
22
|
subUnitId?: string;
|
|
23
23
|
unitId?: string;
|
|
24
24
|
range?: IRange;
|
|
25
|
+
}
|
|
26
|
+
export interface ISetStyleCommandParams<T> extends ISetStyleCommonParams {
|
|
25
27
|
style: IStyleTypeValue<T>;
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
@@ -74,7 +76,7 @@ export interface ISetHorizontalTextAlignCommandParams {
|
|
|
74
76
|
value: HorizontalAlign;
|
|
75
77
|
}
|
|
76
78
|
export declare const SetHorizontalTextAlignCommand: ICommand<ISetHorizontalTextAlignCommandParams>;
|
|
77
|
-
export interface ISetTextWrapCommandParams {
|
|
79
|
+
export interface ISetTextWrapCommandParams extends ISetStyleCommonParams {
|
|
78
80
|
value: WrapStrategy;
|
|
79
81
|
}
|
|
80
82
|
export declare const SetTextWrapCommand: ICommand<ISetTextWrapCommandParams>;
|
|
@@ -82,3 +84,4 @@ export interface ISetTextRotationCommandParams {
|
|
|
82
84
|
value: number | string;
|
|
83
85
|
}
|
|
84
86
|
export declare const SetTextRotationCommand: ICommand<ISetTextRotationCommandParams>;
|
|
87
|
+
export {};
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { IRange, ISelectionCell, Worksheet } from '@univerjs/core';
|
|
16
|
+
import type { IRange, ISelectionCell, Workbook, Worksheet } from '@univerjs/core';
|
|
17
17
|
export interface IExpandParams {
|
|
18
18
|
left?: boolean;
|
|
19
19
|
right?: boolean;
|
|
@@ -40,3 +40,15 @@ export interface IInterval {
|
|
|
40
40
|
* @returns
|
|
41
41
|
*/
|
|
42
42
|
export declare function calculateTotalLength(intervalsObject: IInterval): number;
|
|
43
|
+
export declare const followSelectionOperation: (range: IRange, workbook: Workbook, worksheet: Worksheet) => {
|
|
44
|
+
id: string;
|
|
45
|
+
params: {
|
|
46
|
+
unitId: string;
|
|
47
|
+
sheetId: string;
|
|
48
|
+
pluginName: string;
|
|
49
|
+
selections: {
|
|
50
|
+
range: IRange;
|
|
51
|
+
primary: ISelectionCell;
|
|
52
|
+
}[];
|
|
53
|
+
};
|
|
54
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
import type { IWorkbookData, Workbook } from '@univerjs/core';
|
|
17
|
+
import { Univer } from '@univerjs/core';
|
|
18
|
+
import type { Dependency } from '@wendellhu/redi';
|
|
19
|
+
import { Injector } from '@wendellhu/redi';
|
|
20
|
+
export interface ITestBed {
|
|
21
|
+
univer: Univer;
|
|
22
|
+
get: Injector['get'];
|
|
23
|
+
sheet: Workbook;
|
|
24
|
+
}
|
|
25
|
+
export declare function createCommandTestBed(workbookConfig?: IWorkbookData, dependencies?: Dependency[]): ITestBed;
|
|
@@ -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 {};
|
|
@@ -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 {};
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
import type { IMutation } from '@univerjs/core';
|
|
17
|
+
export declare const EmptyMutation: IMutation<{}, boolean>;
|
|
@@ -16,8 +16,13 @@
|
|
|
16
16
|
import type { ICellData, IMutation, IObjectMatrixPrimitiveType, Nullable } from '@univerjs/core';
|
|
17
17
|
export interface IMoveRangeMutationParams {
|
|
18
18
|
unitId: string;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
from: {
|
|
20
|
+
subUnitId: string;
|
|
21
|
+
value: IObjectMatrixPrimitiveType<Nullable<ICellData>>;
|
|
22
|
+
};
|
|
23
|
+
to: {
|
|
24
|
+
subUnitId: string;
|
|
25
|
+
value: IObjectMatrixPrimitiveType<Nullable<ICellData>>;
|
|
26
|
+
};
|
|
22
27
|
}
|
|
23
28
|
export declare const MoveRangeMutation: IMutation<IMoveRangeMutationParams, boolean>;
|
|
@@ -32,7 +32,7 @@ export interface IMoveRowsMutationParams {
|
|
|
32
32
|
* @param accessor
|
|
33
33
|
* @param params
|
|
34
34
|
*/
|
|
35
|
-
export declare function MoveRowsMutationUndoFactory(_accessor: IAccessor, params: IMoveRowsMutationParams): IMoveRowsMutationParams;
|
|
35
|
+
export declare function MoveRowsMutationUndoFactory(_accessor: IAccessor | null, params: IMoveRowsMutationParams): IMoveRowsMutationParams;
|
|
36
36
|
export declare const MoveRowsMutation: IMutation<IMoveRowsMutationParams>;
|
|
37
37
|
export interface IMoveColumnsMutationParams {
|
|
38
38
|
unitId: string;
|
|
@@ -46,5 +46,5 @@ export interface IMoveColumnsMutationParams {
|
|
|
46
46
|
*/
|
|
47
47
|
targetRange: IRange;
|
|
48
48
|
}
|
|
49
|
-
export declare function MoveColsMutationUndoFactory(_accessor: IAccessor, params: IMoveColumnsMutationParams): IMoveColumnsMutationParams;
|
|
49
|
+
export declare function MoveColsMutationUndoFactory(_accessor: IAccessor | null, params: IMoveColumnsMutationParams): IMoveColumnsMutationParams;
|
|
50
50
|
export declare const MoveColsMutation: IMutation<IMoveColumnsMutationParams>;
|
|
@@ -22,6 +22,7 @@ export interface ISetFrozenMutationParams {
|
|
|
22
22
|
startColumn: number;
|
|
23
23
|
ySplit: number;
|
|
24
24
|
xSplit: number;
|
|
25
|
+
resetScroll?: boolean;
|
|
25
26
|
}
|
|
26
27
|
export declare const SetFrozenMutationFactory: (accessor: IAccessor, params: ISetFrozenMutationParams) => ISetFrozenMutationParams;
|
|
27
28
|
export declare const SetFrozenMutation: IMutation<ISetFrozenMutationParams>;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { IMutation, IObjectArrayPrimitiveType, IRange, Nullable } from '@univerjs/core';
|
|
16
|
+
import type { BooleanNumber, IMutation, IObjectArrayPrimitiveType, IRange, Nullable } from '@univerjs/core';
|
|
17
17
|
import type { IRowAutoHeightInfo } from '@univerjs/engine-render';
|
|
18
18
|
import type { IAccessor } from '@wendellhu/redi';
|
|
19
19
|
export interface ISetWorksheetRowHeightMutationParams {
|
|
@@ -26,7 +26,7 @@ export interface ISetWorksheetRowIsAutoHeightMutationParams {
|
|
|
26
26
|
unitId: string;
|
|
27
27
|
subUnitId: string;
|
|
28
28
|
ranges: IRange[];
|
|
29
|
-
autoHeightInfo:
|
|
29
|
+
autoHeightInfo: BooleanNumber | IObjectArrayPrimitiveType<Nullable<BooleanNumber>>;
|
|
30
30
|
}
|
|
31
31
|
export interface ISetWorksheetRowAutoHeightMutationParams {
|
|
32
32
|
unitId: string;
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
import type { IUniverInstanceService, Workbook, Worksheet } from '@univerjs/core';
|
|
17
|
+
/**
|
|
18
|
+
* Get target workbook and worksheet.
|
|
19
|
+
* @param univerInstanceService
|
|
20
|
+
* @param unitId
|
|
21
|
+
* @param subUnitId
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
export declare function getCommandTarget(univerInstanceService: IUniverInstanceService, unitId?: string, subUnitId?: string): {
|
|
28
|
+
workbook: Workbook;
|
|
29
|
+
worksheet: Worksheet;
|
|
30
|
+
unitId: string;
|
|
31
|
+
subUnitId: string;
|
|
32
|
+
};
|
package/lib/types/commands/{mutations/delete-range.mutation.d.ts → utils/handle-range-mutation.d.ts}
RENAMED
|
@@ -13,10 +13,33 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type {
|
|
16
|
+
import type { ICellData, IMutationInfo, IObjectMatrixPrimitiveType, IRange, Nullable } from '@univerjs/core';
|
|
17
17
|
import { Dimension, ObjectMatrix } from '@univerjs/core';
|
|
18
18
|
import type { IAccessor } from '@wendellhu/redi';
|
|
19
19
|
import type { IDeleteRangeMutationParams, IInsertRangeMutationParams } from '../../basics/interfaces/mutation-interface';
|
|
20
|
+
/**
|
|
21
|
+
* Generate undo mutation of a `InsertRangeMutation`
|
|
22
|
+
*
|
|
23
|
+
* @param {IAccessor} accessor - injector accessor
|
|
24
|
+
* @param {IInsertRangeMutationParams} params - do mutation params
|
|
25
|
+
* @returns {IDeleteRangeMutationParams} undo mutation params
|
|
26
|
+
*/
|
|
27
|
+
export declare const InsertRangeUndoMutationFactory: (accessor: IAccessor, params: IInsertRangeMutationParams) => IDeleteRangeMutationParams;
|
|
28
|
+
/**
|
|
29
|
+
* InsertRange is not a mutation but combination of `SetRangeValuesMutation` and `MoveRangeMutation`.
|
|
30
|
+
* @param accessor
|
|
31
|
+
* @param params
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
export declare function getInsertRangeMutations(accessor: IAccessor, params: IInsertRangeMutationParams): {
|
|
35
|
+
redo: IMutationInfo<object>[];
|
|
36
|
+
undo: IMutationInfo<object>[];
|
|
37
|
+
};
|
|
38
|
+
export declare function getRemoveRangeMutations(accessor: IAccessor, params: IDeleteRangeMutationParams): {
|
|
39
|
+
redo: IMutationInfo<object>[];
|
|
40
|
+
undo: IMutationInfo<object>[];
|
|
41
|
+
};
|
|
42
|
+
export declare function handleInsertRangeMutation<T>(cellMatrix: ObjectMatrix<T>, range: IRange, lastEndRow: number, lastEndColumn: number, shiftDimension: Dimension, cellValue?: IObjectMatrixPrimitiveType<T>): void;
|
|
20
43
|
/**
|
|
21
44
|
* Generate undo mutation of a `DeleteRangeMutation`
|
|
22
45
|
*
|
|
@@ -25,5 +48,5 @@ import type { IDeleteRangeMutationParams, IInsertRangeMutationParams } from '../
|
|
|
25
48
|
* @returns {IInsertRangeMutationParams} undo mutation params
|
|
26
49
|
*/
|
|
27
50
|
export declare const DeleteRangeUndoMutationFactory: (accessor: IAccessor, params: IDeleteRangeMutationParams) => Nullable<IInsertRangeMutationParams>;
|
|
28
|
-
export declare const DeleteRangeMutation: IMutation<IDeleteRangeMutationParams, boolean>;
|
|
29
51
|
export declare function handleDeleteRangeMutation<T>(cellMatrix: ObjectMatrix<T>, range: IRange, lastEndRow: number, lastEndColumn: number, shiftDimension: Dimension): void;
|
|
52
|
+
export declare function generateNullCellValue(range: IRange[]): IObjectMatrixPrimitiveType<Nullable<ICellData>>;
|
|
@@ -36,6 +36,8 @@ export declare class MergeCellController extends Disposable {
|
|
|
36
36
|
constructor(_commandService: ICommandService, _refRangeService: RefRangeService, _univerInstanceService: IUniverInstanceService, _injector: Injector, _sheetInterceptorService: SheetInterceptorService, _selectionManagerService: SelectionManagerService);
|
|
37
37
|
private _initCommandInterceptor;
|
|
38
38
|
private _onRefRangeChange;
|
|
39
|
+
private _handleMoveRowsCommand;
|
|
40
|
+
private _handleMoveColsCommand;
|
|
39
41
|
private _handleMoveRangeCommand;
|
|
40
42
|
private _handleInsertRowCommand;
|
|
41
43
|
private _handleInsertColCommand;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export { convertPrimaryWithCoordToPrimary, convertSelectionDataToRange, getNorma
|
|
|
20
20
|
export { alignToMergedCellsBorders, getCellAtRowCol } from './commands/commands/utils/selection-utils';
|
|
21
21
|
export { MAX_CELL_PER_SHEET_KEY } from './controllers/config/config';
|
|
22
22
|
export { BorderStyleManagerService, type IBorderInfo } from './services/border-style-manager.service';
|
|
23
|
-
export { SheetEditablePermission, SheetPermissionService } from './services/permission';
|
|
23
|
+
export { getCurrentSheetDisabled$, SheetEditablePermission, SheetPermissionService } from './services/permission';
|
|
24
24
|
export { NORMAL_SELECTION_PLUGIN_NAME, SelectionManagerService, SelectionMoveType, } from './services/selection-manager.service';
|
|
25
25
|
export { rangeMerge } from './basics/rangeMerge';
|
|
26
26
|
export { ClearSelectionAllCommand } from './commands/commands/clear-selection-all.command';
|
|
@@ -46,13 +46,13 @@ export { RemoveColCommand, RemoveRowCommand } from './commands/commands/remove-r
|
|
|
46
46
|
export type { IRemoveSheetCommandParams } from './commands/commands/remove-sheet.command';
|
|
47
47
|
export { RemoveSheetCommand } from './commands/commands/remove-sheet.command';
|
|
48
48
|
export { RemoveWorksheetMergeCommand } from './commands/commands/remove-worksheet-merge.command';
|
|
49
|
-
export type { ISetBorderColorCommandParams, ISetBorderPositionCommandParams, ISetBorderStyleCommandParams, } from './commands/commands/set-border-command';
|
|
49
|
+
export type { ISetBorderBasicCommandParams, ISetBorderColorCommandParams, ISetBorderCommandParams, ISetBorderPositionCommandParams, ISetBorderStyleCommandParams, } from './commands/commands/set-border-command';
|
|
50
50
|
export { SetBorderBasicCommand, SetBorderColorCommand, SetBorderCommand, SetBorderPositionCommand, SetBorderStyleCommand, } from './commands/commands/set-border-command';
|
|
51
51
|
export { type ISetSpecificColsVisibleCommandParams, SetColHiddenCommand, SetSelectedColsVisibleCommand, SetSpecificColsVisibleCommand, } from './commands/commands/set-col-visible.command';
|
|
52
52
|
export { SetFrozenCommand } from './commands/commands/set-frozen.command';
|
|
53
53
|
export { type ISetRangeValuesCommandParams, SetRangeValuesCommand } from './commands/commands/set-range-values.command';
|
|
54
54
|
export { type ISetSpecificRowsVisibleCommandParams, SetRowHiddenCommand, SetSelectedRowsVisibleCommand, SetSpecificRowsVisibleCommand, } from './commands/commands/set-row-visible.command';
|
|
55
|
-
export { type ISetStyleCommandParams, ResetBackgroundColorCommand, ResetTextColorCommand, SetBackgroundColorCommand, SetBoldCommand, SetFontFamilyCommand, SetFontSizeCommand, SetHorizontalTextAlignCommand, SetItalicCommand, SetStrikeThroughCommand, SetStyleCommand, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetUnderlineCommand, SetVerticalTextAlignCommand, } from './commands/commands/set-style.command';
|
|
55
|
+
export { type ISetColorCommandParams, type ISetFontFamilyCommandParams, type ISetFontSizeCommandParams, type ISetHorizontalTextAlignCommandParams, type ISetStyleCommandParams, type ISetTextRotationCommandParams, type ISetTextWrapCommandParams, type ISetVerticalTextAlignCommandParams, type IStyleTypeValue, ResetBackgroundColorCommand, ResetTextColorCommand, SetBackgroundColorCommand, SetBoldCommand, SetFontFamilyCommand, SetFontSizeCommand, SetHorizontalTextAlignCommand, SetItalicCommand, SetStrikeThroughCommand, SetStyleCommand, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetUnderlineCommand, SetVerticalTextAlignCommand, } from './commands/commands/set-style.command';
|
|
56
56
|
export { SetTabColorCommand } from './commands/commands/set-tab-color.command';
|
|
57
57
|
export { type ISetWorksheetActivateCommandParams, SetWorksheetActivateCommand, } from './commands/commands/set-worksheet-activate.command';
|
|
58
58
|
export { DeltaColumnWidthCommand, type IDeltaColumnWidthCommandParams, SetColWidthCommand, } from './commands/commands/set-worksheet-col-width.command';
|
|
@@ -61,12 +61,9 @@ export { type ISetWorksheetNameCommandParams, SetWorksheetNameCommand, } from '.
|
|
|
61
61
|
export { SetWorksheetOrderCommand } from './commands/commands/set-worksheet-order.command';
|
|
62
62
|
export { DeltaRowHeightCommand, type IDeltaRowHeightCommand, type ISetWorksheetRowIsAutoHeightCommandParams, SetRowHeightCommand, SetWorksheetRowIsAutoHeightCommand, } from './commands/commands/set-worksheet-row-height.command';
|
|
63
63
|
export { SetWorksheetShowCommand } from './commands/commands/set-worksheet-show.command';
|
|
64
|
-
export { getPrimaryForRange } from './commands/commands/utils/selection-utils';
|
|
64
|
+
export { followSelectionOperation, getPrimaryForRange } from './commands/commands/utils/selection-utils';
|
|
65
65
|
export { AddMergeUndoMutationFactory, AddWorksheetMergeMutation, } from './commands/mutations/add-worksheet-merge.mutation';
|
|
66
|
-
export {
|
|
67
|
-
export { handleDeleteRangeMutation } from './commands/mutations/delete-range.mutation';
|
|
68
|
-
export { InsertRangeMutation } from './commands/mutations/insert-range.mutation';
|
|
69
|
-
export { handleInsertRangeMutation } from './commands/mutations/insert-range.mutation';
|
|
66
|
+
export { EmptyMutation } from './commands/mutations/empty.mutation';
|
|
70
67
|
export { InsertColMutation, InsertColMutationUndoFactory, InsertRowMutation, InsertRowMutationUndoFactory, } from './commands/mutations/insert-row-col.mutation';
|
|
71
68
|
export { InsertSheetMutation, InsertSheetUndoMutationFactory } from './commands/mutations/insert-sheet.mutation';
|
|
72
69
|
export { MoveRangeMutation } from './commands/mutations/move-range.mutation';
|
|
@@ -99,15 +96,19 @@ export { type ISetWorksheetRowAutoHeightMutationParams, type ISetWorksheetRowHei
|
|
|
99
96
|
export { type ISetSelectionsOperationParams, SetSelectionsOperation } from './commands/operations/selection.operation';
|
|
100
97
|
export { SetWorksheetActiveOperation } from './commands/operations/set-worksheet-active.operation';
|
|
101
98
|
export { type ISetWorksheetActiveOperationParams } from './commands/operations/set-worksheet-active.operation';
|
|
99
|
+
export { handleDeleteRangeMutation } from './commands/utils/handle-range-mutation';
|
|
100
|
+
export { getInsertRangeMutations, getRemoveRangeMutations } from './commands/utils/handle-range-mutation';
|
|
101
|
+
export { handleInsertRangeMutation } from './commands/utils/handle-range-mutation';
|
|
102
102
|
export { type ISheetCommandSharedParams } from './commands/utils/interface';
|
|
103
103
|
export { getAddMergeMutationRangeByType } from './controllers/merge-cell.controller';
|
|
104
104
|
export { enUS, zhCN } from './locale';
|
|
105
|
+
export { NumfmtService } from './services/numfmt/numfmt.service';
|
|
105
106
|
export type { FormatType, INumfmtItem, INumfmtItemWithCache } from './services/numfmt/type';
|
|
106
107
|
export { INumfmtService } from './services/numfmt/type';
|
|
107
108
|
export { RefRangeService } from './services/ref-range/ref-range.service';
|
|
108
|
-
export type { EffectRefRangeParams } from './services/ref-range/type';
|
|
109
|
+
export type { EffectRefRangeParams, IOperator } from './services/ref-range/type';
|
|
109
110
|
export { EffectRefRangId, OperatorType } from './services/ref-range/type';
|
|
110
|
-
export { handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleInsertCol, handleInsertRangeMoveDown, handleInsertRangeMoveRight, handleInsertRow, handleIRemoveCol, handleIRemoveRow, handleMoveRange, runRefRangeMutations, } from './services/ref-range/util';
|
|
111
|
+
export { handleBaseInsertRange, handleBaseMoveRowsCols, handleBaseRemoveRange, handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleInsertCol, handleInsertRangeMoveDown, handleInsertRangeMoveRight, handleInsertRow, handleIRemoveCol, handleIRemoveRow, handleMoveCols, handleMoveRange, handleMoveRows, rotateRange, runRefRangeMutations, } from './services/ref-range/util';
|
|
111
112
|
export { INTERCEPTOR_POINT } from './services/sheet-interceptor/interceptor-const';
|
|
112
113
|
export { SheetInterceptorService } from './services/sheet-interceptor/sheet-interceptor.service';
|
|
113
114
|
export type { ISheetLocation } from './services/sheet-interceptor/utils/interceptor';
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
import type { IAccessor } from '@wendellhu/redi';
|
|
17
|
+
import { Observable } from 'rxjs';
|
|
18
|
+
export declare function getCurrentSheetDisabled$(accessor: IAccessor): Observable<boolean>;
|
|
@@ -26,8 +26,16 @@ import type { IInsertColCommandParams, IInsertRowCommandParams } from '../../com
|
|
|
26
26
|
import { InsertColCommandId, InsertRowCommandId } from '../../commands/commands/insert-row-col.command';
|
|
27
27
|
import type { IMoveRangeCommandParams } from '../../commands/commands/move-range.command';
|
|
28
28
|
import { MoveRangeCommandId } from '../../commands/commands/move-range.command';
|
|
29
|
+
import type { IMoveColsCommandParams, IMoveRowsCommandParams } from '../../commands/commands/move-rows-cols.command';
|
|
30
|
+
import { MoveColsCommandId, MoveRowsCommandId } from '../../commands/commands/move-rows-cols.command';
|
|
29
31
|
import type { IRemoveRowColCommandParams } from '../../commands/commands/remove-row-col.command';
|
|
30
32
|
import { RemoveColCommandId, RemoveRowCommandId } from '../../commands/commands/remove-row-col.command';
|
|
33
|
+
export type IMoveRowsCommand = ICommandInfo<IMoveRowsCommandParams> & {
|
|
34
|
+
id: typeof MoveRowsCommandId;
|
|
35
|
+
};
|
|
36
|
+
export type IMoveColsCommand = ICommandInfo<IMoveColsCommandParams> & {
|
|
37
|
+
id: typeof MoveColsCommandId;
|
|
38
|
+
};
|
|
31
39
|
export type IMoveRangeCommand = ICommandInfo<IMoveRangeCommandParams> & {
|
|
32
40
|
id: typeof MoveRangeCommandId;
|
|
33
41
|
};
|
|
@@ -52,7 +60,7 @@ export type IInsertRangeMoveDownCommand = ICommandInfo<InsertRangeMoveDownComman
|
|
|
52
60
|
export type IInsertRangeMoveRightCommand = ICommandInfo<InsertRangeMoveRightCommandParams> & {
|
|
53
61
|
id: typeof InsertRangeMoveRightCommandId;
|
|
54
62
|
};
|
|
55
|
-
export type EffectRefRangeParams = IMoveRangeCommand | IInsertRowCommand | IInsertColCommand | IRemoveRowColCommand | IDeleteRangeMoveLeftCommand | IDeleteRangeMoveUpCommand | IInsertRangeMoveDownCommand | IInsertRangeMoveRightCommand;
|
|
63
|
+
export type EffectRefRangeParams = IMoveRangeCommand | IInsertRowCommand | IInsertColCommand | IRemoveRowColCommand | IDeleteRangeMoveLeftCommand | IDeleteRangeMoveUpCommand | IInsertRangeMoveDownCommand | IInsertRangeMoveRightCommand | IMoveColsCommand | IMoveRowsCommand;
|
|
56
64
|
export declare const EffectRefRangId: {
|
|
57
65
|
readonly MoveRangeCommandId: "sheet.command.move-range";
|
|
58
66
|
readonly InsertRowCommandId: "sheet.command.insert-row";
|
|
@@ -63,6 +71,8 @@ export declare const EffectRefRangId: {
|
|
|
63
71
|
readonly DeleteRangeMoveUpCommandId: "sheet.command.delete-range-move-up";
|
|
64
72
|
readonly InsertRangeMoveDownCommandId: "sheet.command.insert-range-move-down";
|
|
65
73
|
readonly InsertRangeMoveRightCommandId: "sheet.command.insert-range-move-right";
|
|
74
|
+
readonly MoveColsCommandId: "sheet.command.move-cols";
|
|
75
|
+
readonly MoveRowsCommandId: "sheet.command.move-rows";
|
|
66
76
|
};
|
|
67
77
|
export declare enum OperatorType {
|
|
68
78
|
Set = 0,
|
|
@@ -14,20 +14,37 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { IRange } from '@univerjs/core';
|
|
17
|
-
import type {
|
|
18
|
-
export declare const
|
|
17
|
+
import type { IDeleteRangeMoveLeftCommand, IDeleteRangeMoveUpCommand, IInsertColCommand, IInsertRangeMoveDownCommand, IInsertRangeMoveRightCommand, IInsertRowCommand, IMoveColsCommand, IMoveRangeCommand, IMoveRowsCommand, IOperator, IRemoveRowColCommand } from './type';
|
|
18
|
+
export declare const rotateRange: (range: IRange) => IRange;
|
|
19
|
+
interface ILine {
|
|
20
|
+
start: number;
|
|
21
|
+
end: number;
|
|
22
|
+
}
|
|
19
23
|
/**
|
|
20
|
-
* see
|
|
24
|
+
* see docs/tldr/ref-range/move-rows-cols.tldr
|
|
21
25
|
*/
|
|
26
|
+
export declare const handleBaseMoveRowsCols: (fromRange: ILine, toRange: ILine, effectRange: ILine) => {
|
|
27
|
+
length: number;
|
|
28
|
+
step: number;
|
|
29
|
+
};
|
|
30
|
+
export declare const handleMoveRows: (params: IMoveRowsCommand, targetRange: IRange) => IOperator[];
|
|
31
|
+
export declare const handleMoveCols: (params: IMoveColsCommand, targetRange: IRange) => IOperator[];
|
|
32
|
+
export declare const handleMoveRange: (param: IMoveRangeCommand, targetRange: IRange) => IOperator[];
|
|
33
|
+
export declare const handleBaseRemoveRange: (removeRange: IRange, targetRange: IRange) => {
|
|
34
|
+
step: number;
|
|
35
|
+
length: number;
|
|
36
|
+
} | null;
|
|
22
37
|
export declare const handleIRemoveCol: (param: IRemoveRowColCommand, targetRange: IRange) => IOperator[];
|
|
23
|
-
/**
|
|
24
|
-
* see the doc 【ref-range-remove-row.tldr】
|
|
25
|
-
*/
|
|
26
38
|
export declare const handleIRemoveRow: (param: IRemoveRowColCommand, targetRange: IRange) => IOperator[];
|
|
27
|
-
export declare const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export declare const
|
|
32
|
-
export declare const
|
|
39
|
+
export declare const handleBaseInsertRange: (insertRange: IRange, targetRange: IRange) => {
|
|
40
|
+
step: number;
|
|
41
|
+
length: number;
|
|
42
|
+
};
|
|
43
|
+
export declare const handleInsertRow: (param: IInsertRowCommand, targetRange: IRange) => IOperator[];
|
|
44
|
+
export declare const handleInsertCol: (param: IInsertColCommand, targetRange: IRange) => IOperator[];
|
|
45
|
+
export declare const handleInsertRangeMoveDown: (param: IInsertRangeMoveDownCommand, targetRange: IRange) => IOperator[];
|
|
46
|
+
export declare const handleInsertRangeMoveRight: (param: IInsertRangeMoveRightCommand, targetRange: IRange) => IOperator[];
|
|
47
|
+
export declare const handleDeleteRangeMoveLeft: (param: IDeleteRangeMoveLeftCommand, targetRange: IRange) => IOperator[];
|
|
48
|
+
export declare const handleDeleteRangeMoveUp: (param: IDeleteRangeMoveUpCommand, targetRange: IRange) => IOperator[];
|
|
33
49
|
export declare const runRefRangeMutations: (operators: IOperator[], range: IRange) => IRange | null;
|
|
50
|
+
export {};
|