@univerjs/sheets 0.1.5 → 0.1.6
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/lib/cjs/index.js +2 -2
- package/lib/es/index.js +2645 -2331
- package/lib/types/commands/commands/__tests__/remove-rows-cols.command.spec.d.ts +16 -0
- package/lib/types/commands/commands/insert-defined-name.command.d.ts +6 -0
- package/lib/types/commands/commands/remove-defined-name.command.d.ts +6 -0
- package/lib/types/commands/commands/set-defined-name.command.d.ts +12 -0
- package/lib/types/commands/commands/set-style.command.d.ts +2 -2
- package/lib/types/commands/mutations/__tests__/set-range-values.mutation.spec.d.ts +16 -0
- package/lib/types/commands/mutations/set-range-values.mutation.d.ts +16 -1
- package/lib/types/commands/operations/scroll-to-cell.operation.d.ts +3 -0
- package/lib/types/controllers/defined-name-data.controller.d.ts +12 -0
- package/lib/types/controllers/merge-cell.controller.d.ts +16 -1
- package/lib/types/index.d.ts +5 -1
- package/lib/types/services/ref-range/ref-range.service.d.ts +2 -0
- package/lib/types/services/ref-range/util.d.ts +3 -0
- package/lib/types/services/sheet-interceptor/sheet-interceptor.service.d.ts +3 -3
- package/lib/umd/index.js +2 -2
- package/package.json +9 -10
|
@@ -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,12 @@
|
|
|
1
|
+
import { ISetDefinedNameMutationParam } from '@univerjs/engine-formula';
|
|
2
|
+
import { ICommand } from '@univerjs/core';
|
|
3
|
+
|
|
4
|
+
export interface ISetDefinedNameCommandParams {
|
|
5
|
+
unitId: string;
|
|
6
|
+
oldDefinedName: ISetDefinedNameMutationParam;
|
|
7
|
+
newDefinedName: ISetDefinedNameMutationParam;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The command to update defined name
|
|
11
|
+
*/
|
|
12
|
+
export declare const SetDefinedNameCommand: ICommand;
|
|
@@ -54,11 +54,11 @@ export declare const SetTextColorCommand: ICommand<ISetColorCommandParams>;
|
|
|
54
54
|
export declare const ResetTextColorCommand: ICommand;
|
|
55
55
|
export declare const SetBackgroundColorCommand: ICommand<ISetColorCommandParams>;
|
|
56
56
|
export declare const ResetBackgroundColorCommand: ICommand;
|
|
57
|
-
export interface ISetVerticalTextAlignCommandParams {
|
|
57
|
+
export interface ISetVerticalTextAlignCommandParams extends ISetStyleCommonParams {
|
|
58
58
|
value: VerticalAlign;
|
|
59
59
|
}
|
|
60
60
|
export declare const SetVerticalTextAlignCommand: ICommand<ISetVerticalTextAlignCommandParams>;
|
|
61
|
-
export interface ISetHorizontalTextAlignCommandParams {
|
|
61
|
+
export interface ISetHorizontalTextAlignCommandParams extends ISetStyleCommonParams {
|
|
62
62
|
value: HorizontalAlign;
|
|
63
63
|
}
|
|
64
64
|
export declare const SetHorizontalTextAlignCommand: ICommand<ISetHorizontalTextAlignCommandParams>;
|
|
@@ -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 {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAccessor } from '@wendellhu/redi';
|
|
2
|
-
import { IBorderData, ICellData, ICopyToOptionsData, IDocumentData, IMutation, IMutationCommonParams, IObjectMatrixPrimitiveType, IRange, IStyleData, Nullable } from '@univerjs/core';
|
|
2
|
+
import { CellValue, IBorderData, ICellData, ICopyToOptionsData, IDocumentData, IMutation, IMutationCommonParams, IObjectMatrixPrimitiveType, IRange, IStyleData, Nullable, CellValueType } from '@univerjs/core';
|
|
3
3
|
|
|
4
4
|
/** Params of `SetRangeValuesMutation` */
|
|
5
5
|
export interface ISetRangeValuesMutationParams extends IMutationCommonParams {
|
|
@@ -31,6 +31,21 @@ export declare const SetRangeValuesUndoMutationFactory: (accessor: IAccessor, pa
|
|
|
31
31
|
Intercept 15-digit number reference function truncateNumber
|
|
32
32
|
*/
|
|
33
33
|
export declare const SetRangeValuesMutation: IMutation<ISetRangeValuesMutationParams, boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* Get the correct type after setting values to a cell.
|
|
36
|
+
*
|
|
37
|
+
* @param v the new value
|
|
38
|
+
* @param oldType the old type
|
|
39
|
+
* @returns the new type
|
|
40
|
+
*/
|
|
41
|
+
export declare function checkCellValueType(v: Nullable<CellValue>, oldType: Nullable<CellValueType>): Nullable<CellValueType>;
|
|
42
|
+
/**
|
|
43
|
+
* Check if the value can be casted to a boolean.
|
|
44
|
+
* @internal
|
|
45
|
+
* @param value
|
|
46
|
+
* @returns It would return null if the value cannot be casted to a boolean, and would return the boolean value if it can be casted.
|
|
47
|
+
*/
|
|
48
|
+
export declare function extractBooleanValue(value: Nullable<string | number | boolean>): Nullable<boolean>;
|
|
34
49
|
/**
|
|
35
50
|
* Convert old style data for storage
|
|
36
51
|
* @param style
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IDefinedNamesService } from '@univerjs/engine-formula';
|
|
2
|
+
import { Disposable, ICommandService, IResourceManagerService, IUniverInstanceService } from '@univerjs/core';
|
|
3
|
+
|
|
4
|
+
export declare class DefinedNameDataController extends Disposable {
|
|
5
|
+
private readonly _commandService;
|
|
6
|
+
private readonly _univerInstanceService;
|
|
7
|
+
private readonly _definedNamesService;
|
|
8
|
+
private _resourceManagerService;
|
|
9
|
+
constructor(_commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _definedNamesService: IDefinedNamesService, _resourceManagerService: IResourceManagerService);
|
|
10
|
+
private _initialize;
|
|
11
|
+
private _initSnapshot;
|
|
12
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { SheetInterceptorService } from '../services/sheet-interceptor/sheet-interceptor.service';
|
|
2
2
|
import { SelectionManagerService } from '../services/selection-manager.service';
|
|
3
|
+
import { EffectRefRangeParams } from '../services/ref-range/type';
|
|
3
4
|
import { RefRangeService } from '../services/ref-range/ref-range.service';
|
|
5
|
+
import { IRemoveWorksheetMergeMutationParams } from '../basics/interfaces/mutation-interface';
|
|
4
6
|
import { Injector } from '@wendellhu/redi';
|
|
5
|
-
import { IRange, Dimension, Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
7
|
+
import { IRange, Dimension, Disposable, DisposableCollection, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* calculates the selection based on the merged cell type
|
|
@@ -18,8 +20,19 @@ export declare class MergeCellController extends Disposable {
|
|
|
18
20
|
private _injector;
|
|
19
21
|
private _sheetInterceptorService;
|
|
20
22
|
private _selectionManagerService;
|
|
23
|
+
disposableCollection: DisposableCollection;
|
|
21
24
|
constructor(_commandService: ICommandService, _refRangeService: RefRangeService, _univerInstanceService: IUniverInstanceService, _injector: Injector, _sheetInterceptorService: SheetInterceptorService, _selectionManagerService: SelectionManagerService);
|
|
22
25
|
private _initCommandInterceptor;
|
|
26
|
+
refRangeHandle(config: EffectRefRangeParams, unitId: string, subUnitId: string): {
|
|
27
|
+
redos: {
|
|
28
|
+
id: string;
|
|
29
|
+
params: IRemoveWorksheetMergeMutationParams;
|
|
30
|
+
}[];
|
|
31
|
+
undos: {
|
|
32
|
+
id: string;
|
|
33
|
+
params: IRemoveWorksheetMergeMutationParams;
|
|
34
|
+
}[];
|
|
35
|
+
};
|
|
23
36
|
private _onRefRangeChange;
|
|
24
37
|
private _handleMoveRowsCommand;
|
|
25
38
|
private _handleMoveColsCommand;
|
|
@@ -32,5 +45,7 @@ export declare class MergeCellController extends Disposable {
|
|
|
32
45
|
private _handleInsertRangeMoveDownCommand;
|
|
33
46
|
private _handleDeleteRangeMoveUpCommand;
|
|
34
47
|
private _handleDeleteRangeMoveLeftCommand;
|
|
48
|
+
private _checkIsMergeCell;
|
|
35
49
|
private _handleNull;
|
|
50
|
+
private _commandExecutedListener;
|
|
36
51
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -108,9 +108,13 @@ 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, } from './services/ref-range/util';
|
|
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';
|
|
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';
|
|
115
115
|
export { MergeCellController } from './controllers/merge-cell.controller';
|
|
116
116
|
export { AddMergeRedoSelectionsOperationFactory, AddMergeUndoSelectionsOperationFactory } from './commands/utils/handle-merge-operation';
|
|
117
|
+
export { InsertDefinedNameCommand } from './commands/commands/insert-defined-name.command';
|
|
118
|
+
export { RemoveDefinedNameCommand } from './commands/commands/remove-defined-name.command';
|
|
119
|
+
export { SetDefinedNameCommand, type ISetDefinedNameCommandParams } from './commands/commands/set-defined-name.command';
|
|
120
|
+
export { ScrollToCellOperation } from './commands/operations/scroll-to-cell.operation';
|
|
@@ -7,6 +7,8 @@ import { IMutationInfo, IRange, Disposable, InterceptorManager, IUniverInstanceS
|
|
|
7
7
|
type RefRangCallback = (params: EffectRefRangeParams) => {
|
|
8
8
|
redos: IMutationInfo[];
|
|
9
9
|
undos: IMutationInfo[];
|
|
10
|
+
preRedos?: IMutationInfo[];
|
|
11
|
+
preUndos?: IMutationInfo[];
|
|
10
12
|
};
|
|
11
13
|
/**
|
|
12
14
|
* Collect side effects caused by ref range change
|
|
@@ -32,7 +32,9 @@ export declare const handleBaseMoveRowsCols: (fromRange: ILine, toRange: ILine,
|
|
|
32
32
|
step: number;
|
|
33
33
|
};
|
|
34
34
|
export declare const handleMoveRows: (params: IMoveRowsCommand, targetRange: IRange) => IOperator[];
|
|
35
|
+
export declare const handleMoveRowsOther: (params: IMoveRowsCommand, targetRange: IRange) => IRange[] | null;
|
|
35
36
|
export declare const handleMoveCols: (params: IMoveColsCommand, targetRange: IRange) => IOperator[];
|
|
37
|
+
export declare const handleMoveColsOther: (params: IMoveColsCommand, targetRange: IRange) => IRange[] | null;
|
|
36
38
|
export declare const handleMoveRange: (param: IMoveRangeCommand, targetRange: IRange) => IOperator[];
|
|
37
39
|
export declare const handleBaseRemoveRange: (_removeRange: IRange, _targetRange: IRange) => {
|
|
38
40
|
step: number;
|
|
@@ -52,4 +54,5 @@ export declare const handleDeleteRangeMoveLeft: (param: IDeleteRangeMoveLeftComm
|
|
|
52
54
|
export declare const handleDeleteRangeMoveUp: (param: IDeleteRangeMoveUpCommand, targetRange: IRange) => IOperator[];
|
|
53
55
|
export declare const runRefRangeMutations: (operators: IOperator[], range: IRange) => IRange | null;
|
|
54
56
|
export declare const handleDefaultRangeChangeWithEffectRefCommands: (range: IRange, commandInfo: ICommandInfo) => IRange | null;
|
|
57
|
+
export declare const handleOtherDefaultRangeChangeWithEffectRefCommands: (range: IRange, commandInfo: ICommandInfo) => IRange | IRange[] | null;
|
|
55
58
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IDisposable } from '@wendellhu/redi';
|
|
2
|
-
import { ICommandInfo, IInterceptor,
|
|
2
|
+
import { ICommandInfo, IInterceptor, IUndoRedoCommandInfosByInterceptor, Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
3
3
|
|
|
4
4
|
export interface ICommandInterceptor {
|
|
5
5
|
priority?: number;
|
|
6
|
-
getMutations(command: ICommandInfo):
|
|
6
|
+
getMutations(command: ICommandInfo): IUndoRedoCommandInfosByInterceptor;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* This class expose methods for sheet features to inject code to sheet underlying logic.
|
|
@@ -24,7 +24,7 @@ export declare class SheetInterceptorService extends Disposable {
|
|
|
24
24
|
* @param command
|
|
25
25
|
* @returns
|
|
26
26
|
*/
|
|
27
|
-
onCommandExecute(command: ICommandInfo):
|
|
27
|
+
onCommandExecute(command: ICommandInfo): IUndoRedoCommandInfosByInterceptor;
|
|
28
28
|
intercept<T extends IInterceptor<any, any>>(name: T, interceptor: T): IDisposable;
|
|
29
29
|
fetchThroughInterceptors<T, C>(name: IInterceptor<T, C>): (initValue: import('@univerjs/core/common/type-utils.js').Nullable<T>, initContext: C) => import('@univerjs/core/common/type-utils.js').Nullable<T>;
|
|
30
30
|
private _interceptWorkbook;
|