@univerjs/sheets 0.2.8 → 0.2.9
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 +226 -169
- package/lib/types/commands/commands/remove-row-col.command.d.ts +3 -0
- package/lib/types/commands/mutations/add-range-protection.mutation.d.ts +1 -1
- package/lib/types/index.d.ts +4 -3
- package/lib/types/model/range-protection-rule.model.d.ts +1 -0
- package/lib/types/services/permission/range-permission/range-protection.ref-range.d.ts +6 -1
- package/lib/types/services/permission/type.d.ts +1 -1
- package/lib/types/services/permission/worksheet-permission/worksheet-permission-point.model.d.ts +1 -0
- package/lib/types/services/permission/worksheet-permission/worksheet-permission-rule.model.d.ts +2 -1
- package/lib/types/services/ref-range/util.d.ts +5 -0
- package/lib/types/services/selections/selection-manager.service.d.ts +7 -3
- package/lib/types/services/sheet-interceptor/interceptor-const.d.ts +4 -0
- package/lib/types/services/sheet-interceptor/sheet-interceptor.service.d.ts +2 -2
- package/lib/umd/index.js +2 -2
- package/package.json +12 -12
|
@@ -2,6 +2,9 @@ import { ICommand, IRange } from '@univerjs/core';
|
|
|
2
2
|
export interface IRemoveRowColCommandParams {
|
|
3
3
|
range: IRange;
|
|
4
4
|
}
|
|
5
|
+
export interface IRemoveRowColCommandInterceptParams extends IRemoveRowColCommandParams {
|
|
6
|
+
ranges?: IRange[];
|
|
7
|
+
}
|
|
5
8
|
export declare const RemoveRowCommandId = "sheet.command.remove-row";
|
|
6
9
|
/**
|
|
7
10
|
* This command would remove the selected rows. These selected rows can be non-continuous.
|
|
@@ -5,7 +5,7 @@ export interface IAddRangeProtectionMutationParams {
|
|
|
5
5
|
rules: IRangeProtectionRule[];
|
|
6
6
|
unitId: string;
|
|
7
7
|
subUnitId: string;
|
|
8
|
-
name
|
|
8
|
+
name?: string;
|
|
9
9
|
description?: string;
|
|
10
10
|
}
|
|
11
11
|
export declare const FactoryAddRangeProtectionMutation: (param: IAddRangeProtectionMutationParams) => IMutationInfo<IDeleteSelectionProtectionMutationParams>;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -41,8 +41,8 @@ export { RefRangeService } from './services/ref-range/ref-range.service';
|
|
|
41
41
|
export type { EffectRefRangeParams, IOperator } from './services/ref-range/type';
|
|
42
42
|
export { EffectRefRangId, OperatorType } from './services/ref-range/type';
|
|
43
43
|
export { DefinedNameDataController } from './controllers/defined-name-data.controller';
|
|
44
|
-
export { handleBaseInsertRange, handleBaseMoveRowsCols, handleBaseRemoveRange, handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleInsertCol, handleInsertRangeMoveDown, handleInsertRangeMoveRight, handleInsertRow, handleIRemoveCol, handleIRemoveRow, handleMoveCols, handleMoveRange, handleMoveRows, rotateRange, runRefRangeMutations, handleCommonDefaultRangeChangeWithEffectRefCommands, handleDefaultRangeChangeWithEffectRefCommands, handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests, } from './services/ref-range/util';
|
|
45
|
-
export { INTERCEPTOR_POINT } from './services/sheet-interceptor/interceptor-const';
|
|
44
|
+
export { handleBaseInsertRange, handleBaseMoveRowsCols, handleBaseRemoveRange, handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleInsertCol, handleInsertRangeMoveDown, handleInsertRangeMoveRight, handleInsertRow, handleIRemoveCol, handleIRemoveRow, handleMoveCols, handleMoveRange, handleMoveRows, rotateRange, runRefRangeMutations, handleCommonDefaultRangeChangeWithEffectRefCommands, handleDefaultRangeChangeWithEffectRefCommands, handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests, } from './services/ref-range/util';
|
|
45
|
+
export { INTERCEPTOR_POINT, InterceptCellContentPriority } from './services/sheet-interceptor/interceptor-const';
|
|
46
46
|
export { SheetInterceptorService } from './services/sheet-interceptor/sheet-interceptor.service';
|
|
47
47
|
export type { ISheetLocation, ISheetLocationBase, ISheetRowLocation } from './services/sheet-interceptor/utils/interceptor';
|
|
48
48
|
export { MergeCellController, MERGE_CELL_INTERCEPTOR_CHECK } from './controllers/merge-cell.controller';
|
|
@@ -54,6 +54,7 @@ export type { IWorksheetProtectionRule } from './services/permission/type';
|
|
|
54
54
|
export { WorksheetProtectionRuleModel, WorksheetProtectionPointModel } from './services/permission/worksheet-permission';
|
|
55
55
|
export { getAllWorkbookPermissionPoint, defaultWorkbookPermissionPoints } from './services/permission/workbook-permission';
|
|
56
56
|
export { WorksheetCopyPermission, WorksheetSelectProtectedCellsPermission, WorksheetSelectUnProtectedCellsPermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetViewPermission, WorksheetSetRowStylePermission, WorksheetSetColumnStylePermission, WorksheetInsertRowPermission, WorksheetInsertColumnPermission, WorksheetInsertHyperlinkPermission, WorksheetDeleteRowPermission, WorksheetDeleteColumnPermission, WorksheetSortPermission, WorksheetFilterPermission, WorksheetPivotTablePermission, WorksheetEditExtraObjectPermission, WorksheetManageCollaboratorPermission, WorksheetEditPermission, WorkbookCommentPermission, WorkbookEditablePermission, WorkbookDuplicatePermission, WorkbookPrintPermission, WorkbookExportPermission, WorkbookMoveSheetPermission, WorkbookDeleteSheetPermission, WorkbookHideSheetPermission, WorkbookRenameSheetPermission, WorkbookCreateSheetPermission, WorkbookHistoryPermission, WorkbookViewPermission, WorkbookSharePermission, WorkbookCopyPermission, WorkbookManageCollaboratorPermission, WorkbookViewHistoryPermission, WorkbookRecoverHistoryPermission, } from './services/permission/permission-point';
|
|
57
|
+
export { UnitObject } from '@univerjs/protocol';
|
|
57
58
|
export { checkRangesEditablePermission } from './services/permission/util';
|
|
58
59
|
export { RangeProtectionRenderModel, type ICellPermission } from './model/range-protection-render.model';
|
|
59
60
|
export { RangeProtectionRuleModel, type IObjectModel, type IRangeProtectionRule, type IModel } from './model/range-protection-rule.model';
|
|
@@ -81,7 +82,7 @@ export { InsertSheetCommand, type IInsertSheetCommandParams } from './commands/c
|
|
|
81
82
|
export { MoveRangeCommand, getMoveRangeUndoRedoMutations, type IMoveRangeCommandParams } from './commands/commands/move-range.command';
|
|
82
83
|
export { MoveRowsCommand, MoveColsCommand, type IMoveRowsCommandParams, type IMoveColsCommandParams, } from './commands/commands/move-rows-cols.command';
|
|
83
84
|
export { RemoveDefinedNameCommand } from './commands/commands/remove-defined-name.command';
|
|
84
|
-
export { RemoveRowCommand, RemoveColCommand, type IRemoveRowColCommandParams } from './commands/commands/remove-row-col.command';
|
|
85
|
+
export { RemoveRowCommand, RemoveColCommand, type IRemoveRowColCommandParams, type IRemoveRowColCommandInterceptParams } from './commands/commands/remove-row-col.command';
|
|
85
86
|
export { RemoveSheetCommand, type IRemoveSheetCommandParams } from './commands/commands/remove-sheet.command';
|
|
86
87
|
export { RemoveWorksheetMergeCommand } from './commands/commands/remove-worksheet-merge.command';
|
|
87
88
|
export { ReorderRangeCommand, type IReorderRangeCommandParams } from './commands/commands/reorder-range.command';
|
|
@@ -43,5 +43,6 @@ export declare class RangeProtectionRuleModel {
|
|
|
43
43
|
fromObject(obj: IObjectModel): void;
|
|
44
44
|
deleteUnitModel(unitId: string): void;
|
|
45
45
|
createRuleId(unitId: string, subUnitId: string): string;
|
|
46
|
+
getTargetByPermissionId(unitId: string, permissionId: string): string[] | null;
|
|
46
47
|
}
|
|
47
48
|
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { Disposable, DisposableCollection, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
1
|
+
import { Disposable, DisposableCollection, ICommandService, IUniverInstanceService, IMutationInfo } from '@univerjs/core';
|
|
2
2
|
import { RangeProtectionRuleModel } from '../../../model/range-protection-rule.model';
|
|
3
3
|
import { RangeProtectionRenderModel } from '../../../model/range-protection-render.model';
|
|
4
4
|
import { ISetRangeProtectionMutationParams } from '../../../commands/mutations/set-range-protection.mutation';
|
|
5
5
|
import { EffectRefRangeParams } from '../../../services/ref-range/type';
|
|
6
6
|
import { RefRangeService } from '../../../services/ref-range/ref-range.service';
|
|
7
|
+
import { IDeleteSelectionProtectionMutationParams } from '../../../commands/mutations/delete-range-protection.mutation';
|
|
8
|
+
import { IAddRangeProtectionMutationParams } from '../../../commands/mutations/add-range-protection.mutation';
|
|
7
9
|
export declare class RangeProtectionRefRangeService extends Disposable {
|
|
8
10
|
private _selectionProtectionRuleModel;
|
|
9
11
|
private _univerInstanceService;
|
|
@@ -22,6 +24,9 @@ export declare class RangeProtectionRefRangeService extends Disposable {
|
|
|
22
24
|
id: string;
|
|
23
25
|
params: ISetRangeProtectionMutationParams;
|
|
24
26
|
}[];
|
|
27
|
+
} | {
|
|
28
|
+
redos: IMutationInfo<IDeleteSelectionProtectionMutationParams | IAddRangeProtectionMutationParams | ISetRangeProtectionMutationParams>[];
|
|
29
|
+
undos: IMutationInfo<IDeleteSelectionProtectionMutationParams | IAddRangeProtectionMutationParams | ISetRangeProtectionMutationParams>[];
|
|
25
30
|
};
|
|
26
31
|
private _getRefRangeMutationsByDeleteCols;
|
|
27
32
|
private _getRefRangeMutationsByDeleteRows;
|
package/lib/types/services/permission/worksheet-permission/worksheet-permission-point.model.d.ts
CHANGED
|
@@ -14,4 +14,5 @@ export declare class WorksheetProtectionPointModel {
|
|
|
14
14
|
fromObject(obj: IObjectPointModel): void;
|
|
15
15
|
deleteUnitModel(unitId: string): void;
|
|
16
16
|
private _ensureSubUnitMap;
|
|
17
|
+
getTargetByPermissionId(unitId: string, permissionId: string): string[] | null | undefined;
|
|
17
18
|
}
|
package/lib/types/services/permission/worksheet-permission/worksheet-permission-rule.model.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ type IRuleChangeType = 'add' | 'set' | 'delete';
|
|
|
3
3
|
export declare class WorksheetProtectionRuleModel {
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
6
|
-
* Map<unitId, Map<subUnitId, Map<
|
|
6
|
+
* Map<unitId, Map<subUnitId, Map<subUnitId, IWorksheetProtectionRule>>>
|
|
7
7
|
*/
|
|
8
8
|
private _model;
|
|
9
9
|
private _ruleChange;
|
|
@@ -31,5 +31,6 @@ export declare class WorksheetProtectionRuleModel {
|
|
|
31
31
|
private _ensureSubUnitMap;
|
|
32
32
|
ruleRefresh(permissionId: string): void;
|
|
33
33
|
resetOrder(): void;
|
|
34
|
+
getTargetByPermissionId(unitId: string, permissionId: string): string[] | null | undefined;
|
|
34
35
|
}
|
|
35
36
|
export {};
|
|
@@ -4,6 +4,7 @@ import { IInsertColMutationParams, IInsertRowMutationParams, IRemoveColMutationP
|
|
|
4
4
|
import { IMoveRangeMutationParams } from '../../commands/mutations/move-range.mutation';
|
|
5
5
|
import { ISheetCommandSharedParams } from '../../commands/utils/interface';
|
|
6
6
|
import { SheetsSelectionsService } from '../selections/selection-manager.service';
|
|
7
|
+
import { IRemoveRowColCommandInterceptParams } from '../../commands/commands/remove-row-col.command';
|
|
7
8
|
import { EffectRefRangeParams, IDeleteRangeMoveLeftCommand, IDeleteRangeMoveUpCommand, IInsertColCommand, IInsertRangeMoveDownCommand, IInsertRangeMoveRightCommand, IInsertRowCommand, IMoveColsCommand, IMoveRangeCommand, IMoveRowsCommand, IOperator, IRemoveRowColCommand, IReorderRangeCommand } from './type';
|
|
8
9
|
export declare const handleRangeTypeInput: (range: IRange) => {
|
|
9
10
|
rangeType?: RANGE_TYPE;
|
|
@@ -67,6 +68,7 @@ export declare const handleDeleteRangeMoveLeft: (param: IDeleteRangeMoveLeftComm
|
|
|
67
68
|
export declare const handleDeleteRangeMoveLeftCommon: (param: IDeleteRangeMoveLeftCommand, targetRange: IRange) => IRange[];
|
|
68
69
|
export declare const handleDeleteRangeMoveUp: (param: IDeleteRangeMoveUpCommand, targetRange: IRange) => IOperator[];
|
|
69
70
|
export declare const handleDeleteRangeMoveUpCommon: (param: IDeleteRangeMoveUpCommand, targetRange: IRange) => IRange[];
|
|
71
|
+
export declare const handleRemoveRowCommon: (param: IRemoveRowColCommandInterceptParams, targetRange: IRange) => IRange[];
|
|
70
72
|
export declare const runRefRangeMutations: (operators: IOperator[], range: IRange) => IRange | null;
|
|
71
73
|
export declare const handleDefaultRangeChangeWithEffectRefCommands: (range: IRange, commandInfo: ICommandInfo) => IRange | null;
|
|
72
74
|
export declare const handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests: (range: IRange, commandInfo: ICommandInfo, deps: {
|
|
@@ -74,6 +76,9 @@ export declare const handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterest
|
|
|
74
76
|
}) => IRange | null;
|
|
75
77
|
type MutationsAffectRange = ISheetCommandSharedParams | IRemoveSheetMutationParams | IMoveRowsMutationParams | IMoveColumnsMutationParams | IRemoveRowsMutationParams | IRemoveColMutationParams | IInsertColMutationParams | IInsertRowMutationParams | IMoveRangeMutationParams;
|
|
76
78
|
export declare const handleCommonDefaultRangeChangeWithEffectRefCommands: (range: IRange, commandInfo: ICommandInfo) => IRange | IRange[] | null;
|
|
79
|
+
export declare const handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests: (range: IRange, commandInfo: ICommandInfo, deps: {
|
|
80
|
+
selectionManagerService: SheetsSelectionsService;
|
|
81
|
+
}) => IRange | IRange[] | null;
|
|
77
82
|
/**
|
|
78
83
|
* This function should work as a pure function.
|
|
79
84
|
*
|
|
@@ -18,7 +18,10 @@ export declare class SheetsSelectionsService extends RxDisposable {
|
|
|
18
18
|
selectionMoveEnd$: Observable<ISelectionWithStyle[]>;
|
|
19
19
|
constructor(_instanceSrv: IUniverInstanceService);
|
|
20
20
|
protected _init(): void;
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Clear all selections in all workbooks.
|
|
23
|
+
* invoked by prompt.controller
|
|
24
|
+
*/
|
|
22
25
|
clear(): void;
|
|
23
26
|
getCurrentSelections(): Readonly<ISelectionWithStyle[]>;
|
|
24
27
|
getCurrentLastSelection(): Readonly<Nullable<ISelectionWithStyle & {
|
|
@@ -60,7 +63,8 @@ export declare class WorkbookSelections extends Disposable {
|
|
|
60
63
|
clear(): void;
|
|
61
64
|
addSelections(sheetId: string, selectionDatas: ISelectionWithStyle[]): void;
|
|
62
65
|
/**
|
|
63
|
-
*
|
|
66
|
+
* Set selectionDatas to _worksheetSelections, and emit selectionDatas by type.
|
|
67
|
+
* If type is not specfied, this method would clear all existing selections.
|
|
64
68
|
* @param sheetId
|
|
65
69
|
* @param selectionDatas
|
|
66
70
|
* @param type
|
|
@@ -74,7 +78,7 @@ export declare class WorkbookSelections extends Disposable {
|
|
|
74
78
|
}>>;
|
|
75
79
|
private _worksheetSelections;
|
|
76
80
|
/**
|
|
77
|
-
*
|
|
81
|
+
* Same as _getCurrentSelections(which return this._worksheetSelections), but this method would set [] if no selection.
|
|
78
82
|
* @param sheetId
|
|
79
83
|
* @returns this._worksheetSelections
|
|
80
84
|
*/
|
|
@@ -4,3 +4,7 @@ export declare const INTERCEPTOR_POINT: {
|
|
|
4
4
|
CELL_CONTENT: import('@univerjs/core').IInterceptor<ICellDataForSheetInterceptor, ISheetLocation>;
|
|
5
5
|
ROW_FILTERED: import('@univerjs/core').IInterceptor<boolean, ISheetRowLocation>;
|
|
6
6
|
};
|
|
7
|
+
export declare enum InterceptCellContentPriority {
|
|
8
|
+
DATA_VALIDATION = 9,
|
|
9
|
+
NUMFMT = 10
|
|
10
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICommandInfo, IDisposable, IInterceptor, IRange, IUndoRedoCommandInfosByInterceptor, Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
1
|
+
import { ICommandInfo, IDisposable, IInterceptor, IRange, IUndoRedoCommandInfosByInterceptor, Nullable, Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
2
2
|
export interface IBeforeCommandInterceptor {
|
|
3
3
|
priority?: number;
|
|
4
4
|
performCheck(info: ICommandInfo): Promise<boolean>;
|
|
@@ -53,7 +53,7 @@ export declare class SheetInterceptorService extends Disposable {
|
|
|
53
53
|
onCommandExecute(info: ICommandInfo): IUndoRedoCommandInfosByInterceptor;
|
|
54
54
|
generateMutationsByRanges(info: IRangesInfo): IUndoRedoCommandInfosByInterceptor;
|
|
55
55
|
intercept<T extends IInterceptor<any, any>>(name: T, interceptor: T): IDisposable;
|
|
56
|
-
fetchThroughInterceptors<T, C>(name: IInterceptor<T, C>): (initValue:
|
|
56
|
+
fetchThroughInterceptors<T, C>(name: IInterceptor<T, C>): (initValue: Nullable<T>, initContext: C) => Nullable<T>;
|
|
57
57
|
private _interceptWorkbook;
|
|
58
58
|
private _disposeWorkbookInterceptor;
|
|
59
59
|
private _disposeSheetInterceptor;
|