@univerjs/sheets 0.1.0-beta.2 → 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 +2865 -2782
- 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/utils/selection-utils.d.ts +13 -1
- package/lib/types/commands/mutations/empty.mutation.d.ts +17 -0
- package/lib/types/commands/mutations/set-worksheet-row-height.mutation.d.ts +2 -2
- package/lib/types/commands/{mutations/delete-range.mutation.d.ts → utils/handle-range-mutation.d.ts} +25 -2
- package/lib/types/index.d.ts +7 -6
- package/lib/types/services/ref-range/util.d.ts +28 -13
- 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,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,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>;
|
|
@@ -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;
|
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>>;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -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
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, handleMoveCols, handleMoveRange, handleMoveRows, 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';
|
|
@@ -14,22 +14,37 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { IRange } from '@univerjs/core';
|
|
17
|
-
import type {
|
|
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
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* see docs/tldr/ref-range/move-rows-cols.tldr
|
|
25
|
+
*/
|
|
26
|
+
export declare const handleBaseMoveRowsCols: (fromRange: ILine, toRange: ILine, effectRange: ILine) => {
|
|
27
|
+
length: number;
|
|
28
|
+
step: number;
|
|
29
|
+
};
|
|
18
30
|
export declare const handleMoveRows: (params: IMoveRowsCommand, targetRange: IRange) => IOperator[];
|
|
19
31
|
export declare const handleMoveCols: (params: IMoveColsCommand, targetRange: IRange) => IOperator[];
|
|
20
32
|
export declare const handleMoveRange: (param: IMoveRangeCommand, targetRange: IRange) => IOperator[];
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
export declare const handleBaseRemoveRange: (removeRange: IRange, targetRange: IRange) => {
|
|
34
|
+
step: number;
|
|
35
|
+
length: number;
|
|
36
|
+
} | null;
|
|
24
37
|
export declare const handleIRemoveCol: (param: IRemoveRowColCommand, targetRange: IRange) => IOperator[];
|
|
25
|
-
/**
|
|
26
|
-
* see the doc 【ref-range-remove-row.tldr】
|
|
27
|
-
*/
|
|
28
38
|
export declare const handleIRemoveRow: (param: IRemoveRowColCommand, targetRange: IRange) => IOperator[];
|
|
29
|
-
export declare const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
export declare const
|
|
34
|
-
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[];
|
|
35
49
|
export declare const runRefRangeMutations: (operators: IOperator[], range: IRange) => IRange | null;
|
|
50
|
+
export {};
|