@univerjs/core 0.1.14 → 0.1.16
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 +8 -8
- package/lib/es/index.js +2006 -2102
- package/lib/types/index.d.ts +2 -1
- package/lib/types/services/instance/instance.service.d.ts +11 -4
- package/lib/types/services/permission/permission.service.d.ts +5 -4
- package/lib/types/services/permission/type.d.ts +3 -2
- package/lib/types/services/user-manager/const.d.ts +1 -1
- package/lib/types/services/user-manager/user-manager.service.d.ts +24 -6
- package/lib/types/shared/common.d.ts +2 -1
- package/lib/types/shared/rectangle.d.ts +3 -12
- package/lib/types/sheets/range.d.ts +1 -0
- package/lib/types/sheets/workbook.d.ts +6 -52
- package/lib/types/sheets/worksheet.d.ts +4 -0
- package/lib/types/types/interfaces/i-cell-custom-render.d.ts +4 -0
- package/lib/types/types/interfaces/i-cell-data.d.ts +4 -0
- package/lib/types/types/interfaces/i-range.d.ts +8 -0
- package/lib/types/types/interfaces/i-row-data.d.ts +4 -0
- package/lib/types/types/interfaces/i-selection-data.d.ts +4 -0
- package/lib/umd/index.js +8 -8
- package/package.json +8 -7
- package/lib/types/services/user-manager/index.d.ts +0 -16
package/lib/types/index.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export { type IStyleSheet, ThemeService } from './services/theme/theme.service';
|
|
|
62
62
|
export { type IUndoRedoCommandInfos, type IUndoRedoCommandInfosByInterceptor, type IUndoRedoItem, IUndoRedoService, type IUndoRedoStatus, LocalUndoRedoService, RedoCommand, UndoCommand, RedoCommandId, UndoCommandId, } from './services/undoredo/undoredo.service';
|
|
63
63
|
export * from './shared';
|
|
64
64
|
export { fromCallback } from './shared/rxjs';
|
|
65
|
-
export { UserManagerService } from './services/user-manager/user-manager.service';
|
|
65
|
+
export { UserManagerService, type IUser } from './services/user-manager/user-manager.service';
|
|
66
66
|
export type { IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';
|
|
67
67
|
export { composeInterceptors, createInterceptorKey, InterceptorManager } from './common/interceptor';
|
|
68
68
|
export { normalizeTextRuns } from './docs/data-model/text-x/apply-utils/common';
|
|
@@ -101,6 +101,7 @@ export { DataValidationOperator } from './types/enum/data-validation-operator';
|
|
|
101
101
|
export { DataValidationType } from './types/enum/data-validation-type';
|
|
102
102
|
export { DataValidationStatus } from './types/enum/data-validation-status';
|
|
103
103
|
export type { IPermissionTypes, WorkbookPermissionPointConstructor } from './services/permission/type';
|
|
104
|
+
export { PermissionService } from './services/permission/permission.service';
|
|
104
105
|
export { AuthzIoLocalService } from './services/authz-io/authz-io-local.service';
|
|
105
106
|
export { IAuthzIoService } from './services/authz-io/type';
|
|
106
107
|
export { createDefaultUser } from './services/user-manager/const';
|
|
@@ -59,19 +59,26 @@ export declare class UniverInstanceService extends Disposable implements IUniver
|
|
|
59
59
|
createUnit<T, U extends UnitModel>(type: UnitType, data: T): U;
|
|
60
60
|
private readonly _ctorByType;
|
|
61
61
|
registerCtorForType<T extends UnitModel>(type: UnitType, ctor: new () => T): IDisposable;
|
|
62
|
+
private _currentUnits;
|
|
62
63
|
private readonly _currentUnits$;
|
|
63
|
-
readonly currentUnits$: Observable<
|
|
64
|
-
[type: number]: Nullable<UnitModel<object, number>>;
|
|
65
|
-
}>;
|
|
64
|
+
readonly currentUnits$: Observable<Map<number, Nullable<UnitModel<object, number>>>>;
|
|
66
65
|
getCurrentTypeOfUnit$<T>(type: number): Observable<Nullable<T>>;
|
|
67
66
|
getCurrentUnitForType<T>(type: UnitType): Nullable<T>;
|
|
68
67
|
setCurrentUnitForType(unitId: string): void;
|
|
68
|
+
private _removeCurrentUnitForType;
|
|
69
69
|
private readonly _unitAdded$;
|
|
70
70
|
readonly unitAdded$: Observable<UnitModel<object, number>>;
|
|
71
71
|
getTypeOfUnitAdded$<T extends UnitModel<object, number>>(type: UnitType): Observable<T>;
|
|
72
|
+
/**
|
|
73
|
+
* Add a unit into Univer.
|
|
74
|
+
*
|
|
75
|
+
* @ignore
|
|
76
|
+
*
|
|
77
|
+
* @param unit The unit to be added.
|
|
78
|
+
*/
|
|
72
79
|
__addUnit(unit: UnitModel): void;
|
|
73
80
|
private _unitDisposed$;
|
|
74
|
-
unitDisposed$: Observable<UnitModel<object, number>>;
|
|
81
|
+
readonly unitDisposed$: Observable<UnitModel<object, number>>;
|
|
75
82
|
getTypeOfUnitDisposed$<T extends UnitModel<object, number>>(type: UniverInstanceType): Observable<T>;
|
|
76
83
|
getUnit<T extends UnitModel = UnitModel>(id: string, type?: UnitType): Nullable<T>;
|
|
77
84
|
getCurrentUniverDocInstance(): Nullable<DocumentDataModel>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
1
|
+
import { Observable, BehaviorSubject } from 'rxjs';
|
|
2
2
|
import { Disposable } from '../../shared';
|
|
3
3
|
import { IPermissionPoint, IPermissionService } from './type';
|
|
4
4
|
|
|
@@ -7,11 +7,12 @@ export declare class PermissionService extends Disposable implements IPermission
|
|
|
7
7
|
private _permissionPointUpdate$;
|
|
8
8
|
permissionPointUpdate$: Observable<IPermissionPoint<unknown>>;
|
|
9
9
|
deletePermissionPoint(permissionId: string): void;
|
|
10
|
-
addPermissionPoint<T = boolean>(
|
|
10
|
+
addPermissionPoint<T = boolean>(_item: IPermissionPoint<T> | BehaviorSubject<IPermissionPoint<T>>): boolean;
|
|
11
11
|
updatePermissionPoint<T = boolean>(permissionId: string, value: T): void;
|
|
12
12
|
clearPermissionMap(): void;
|
|
13
13
|
getPermissionPoint<T = boolean>(permissionId: string): IPermissionPoint<T> | undefined;
|
|
14
14
|
getPermissionPoint$<T = boolean>(permissionId: string): Observable<IPermissionPoint<T>> | undefined;
|
|
15
|
-
composePermission$(permissionIdList: string[]): Observable<IPermissionPoint<
|
|
16
|
-
composePermission(permissionIdList: string[]): IPermissionPoint<
|
|
15
|
+
composePermission$(permissionIdList: string[]): Observable<IPermissionPoint<any>[]>;
|
|
16
|
+
composePermission(permissionIdList: string[]): IPermissionPoint<any>[];
|
|
17
|
+
getAllPermissionPoint(): Map<string, BehaviorSubject<IPermissionPoint<unknown>>>;
|
|
17
18
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
1
|
+
import { BehaviorSubject, Observable } from 'rxjs';
|
|
2
2
|
import { UnitAction, UnitObject } from '@univerjs/protocol';
|
|
3
3
|
import { Nullable } from '../../common/type-utils';
|
|
4
4
|
import { IRange } from '../../types/interfaces';
|
|
@@ -31,12 +31,13 @@ export interface IPermissionParam {
|
|
|
31
31
|
export interface IPermissionService {
|
|
32
32
|
permissionPointUpdate$: Observable<IPermissionPoint<unknown>>;
|
|
33
33
|
deletePermissionPoint(permissionId: string): void;
|
|
34
|
-
addPermissionPoint<T = boolean>(permissionPoint: IPermissionPoint<T>): boolean;
|
|
34
|
+
addPermissionPoint<T = boolean>(permissionPoint: IPermissionPoint<T> | BehaviorSubject<IPermissionPoint<T>>): boolean;
|
|
35
35
|
updatePermissionPoint<T = boolean>(permissionId: string, value: T): void;
|
|
36
36
|
getPermissionPoint<T = boolean>(permissionId: string): Nullable<IPermissionPoint<T>>;
|
|
37
37
|
getPermissionPoint$<T = boolean>(permissionId: string): Nullable<Observable<IPermissionPoint<T>>>;
|
|
38
38
|
clearPermissionMap(): void;
|
|
39
39
|
composePermission$(permissionId: string[]): Observable<IPermissionPoint<unknown>[]>;
|
|
40
40
|
composePermission(permissionId: string[]): IPermissionPoint<unknown>[];
|
|
41
|
+
getAllPermissionPoint(): Map<string, Observable<IPermissionPoint<unknown>>>;
|
|
41
42
|
}
|
|
42
43
|
export declare const IPermissionService: import('@wendellhu/redi').IdentifierDecorator<IPermissionService>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IUser, UnitRole } from '@univerjs/protocol';
|
|
2
2
|
|
|
3
|
-
export declare const createDefaultUser: (type
|
|
3
|
+
export declare const createDefaultUser: (type?: UnitRole) => IUser;
|
|
4
4
|
export declare const isDevRole: (userId: string, type: UnitRole) => boolean;
|
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 interface IUser {
|
|
17
|
+
userID: string;
|
|
18
|
+
name: string;
|
|
19
|
+
avatar?: string;
|
|
20
|
+
}
|
|
3
21
|
export declare class UserManagerService {
|
|
4
22
|
private _model;
|
|
5
23
|
private _userChange$;
|
|
@@ -15,10 +33,10 @@ export declare class UserManagerService {
|
|
|
15
33
|
* @memberof UserManagerService
|
|
16
34
|
*/
|
|
17
35
|
currentUser$: import('rxjs').Observable<IUser>;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
addUser(user:
|
|
21
|
-
getUser(userId: string, callBack?: () => void):
|
|
36
|
+
getCurrentUser<T extends IUser>(): T;
|
|
37
|
+
setCurrentUser<T extends IUser>(user: T): void;
|
|
38
|
+
addUser<T extends IUser>(user: T): void;
|
|
39
|
+
getUser<T extends IUser>(userId: string, callBack?: () => void): T | undefined;
|
|
22
40
|
delete(userId: string): void;
|
|
23
41
|
clear(): void;
|
|
24
42
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IRange } from '../types/interfaces';
|
|
2
|
-
import { ICellData } from '../types/interfaces/i-cell-data';
|
|
2
|
+
import { ICellData, ICellDataForSheetInterceptor } from '../types/interfaces/i-cell-data';
|
|
3
3
|
import { IDocumentData } from '../types/interfaces/i-document-data';
|
|
4
4
|
import { IRangeWithCoord, ISelectionCell, ISelectionCellWithCoord } from '../types/interfaces/i-selection-data';
|
|
5
5
|
import { IColorStyle, IStyleData } from '../types/interfaces/i-style-data';
|
|
@@ -8,6 +8,7 @@ import { Nullable } from './types';
|
|
|
8
8
|
export declare function makeCellToSelection(cellInfo: Nullable<ISelectionCellWithCoord>): Nullable<IRangeWithCoord>;
|
|
9
9
|
export declare function makeCellRangeToRangeData(cellInfo: Nullable<ISelectionCell>): Nullable<IRange>;
|
|
10
10
|
export declare function isEmptyCell(cell: Nullable<ICellData>): boolean;
|
|
11
|
+
export declare function isCellCoverable(cell: Nullable<ICellDataForSheetInterceptor>): boolean;
|
|
11
12
|
export declare function getColorStyle(color: Nullable<IColorStyle>): Nullable<string>;
|
|
12
13
|
/**
|
|
13
14
|
* A string starting with an equal sign is a formula
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRange } from '../types/interfaces/i-range';
|
|
1
|
+
import { IRange, IRectLTRB } from '../types/interfaces/i-range';
|
|
2
2
|
import { Nullable } from './types';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -19,15 +19,6 @@ export declare class Rectangle {
|
|
|
19
19
|
static moveVertical: (range: IRange, step?: number, length?: number) => IRange;
|
|
20
20
|
static moveOffset: (range: IRange, offsetX: number, offsetY: number) => IRange;
|
|
21
21
|
static subtract(range1: IRange, range2: IRange): IRange[];
|
|
22
|
-
static
|
|
23
|
-
|
|
24
|
-
top: number;
|
|
25
|
-
right: number;
|
|
26
|
-
bottom: number;
|
|
27
|
-
}, rect2: {
|
|
28
|
-
left: number;
|
|
29
|
-
top: number;
|
|
30
|
-
right: number;
|
|
31
|
-
bottom: number;
|
|
32
|
-
}): boolean;
|
|
22
|
+
static hasIntersectionBetweenTwoRect(rect1: IRectLTRB, rect2: IRectLTRB): boolean;
|
|
23
|
+
static getIntersectionBetweenTwoRect(rect1: IRectLTRB, rect2: IRectLTRB): Required<IRectLTRB> | null;
|
|
33
24
|
}
|
|
@@ -33,6 +33,7 @@ export declare class Range {
|
|
|
33
33
|
private _worksheet;
|
|
34
34
|
constructor(workSheet: Worksheet, range: IRange, _deps: IRangeDependencies);
|
|
35
35
|
static foreach(range: IRange, action: (row: number, column: number) => void): void;
|
|
36
|
+
static transformRange: (range: IRange, worksheet: Worksheet) => IRange;
|
|
36
37
|
/**
|
|
37
38
|
* get current range data
|
|
38
39
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { ILogService } from '../services/log/log.service';
|
|
3
3
|
import { Nullable } from '../shared';
|
|
4
|
-
import {
|
|
4
|
+
import { IRangeType, IWorkbookData, IWorksheetData } from '../types/interfaces';
|
|
5
5
|
import { UnitModel, UniverInstanceType } from '../common/unit';
|
|
6
6
|
import { Styles } from './styles';
|
|
7
7
|
import { Worksheet } from './worksheet';
|
|
@@ -63,15 +63,15 @@ export declare class Workbook extends UnitModel<IWorkbookData, UniverInstanceTyp
|
|
|
63
63
|
getConfig(): IWorkbookData;
|
|
64
64
|
getIndexBySheetId(sheetId: string): number;
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
67
|
-
* @returns
|
|
66
|
+
* Get the active sheet
|
|
68
67
|
*/
|
|
69
|
-
|
|
68
|
+
getActiveSheet(): Nullable<Worksheet>;
|
|
70
69
|
/**
|
|
71
|
-
*
|
|
70
|
+
* If there is no active sheet, the first sheet would
|
|
72
71
|
* be set active.
|
|
72
|
+
* @returns
|
|
73
73
|
*/
|
|
74
|
-
|
|
74
|
+
ensureActiveSheet(): Worksheet;
|
|
75
75
|
setActiveSheet(worksheet: Nullable<Worksheet>): void;
|
|
76
76
|
removeSheet(sheetId: string): boolean;
|
|
77
77
|
getActiveSheetIndex(): number;
|
|
@@ -83,45 +83,6 @@ export declare class Workbook extends UnitModel<IWorkbookData, UniverInstanceTyp
|
|
|
83
83
|
getSheetBySheetId(sheetId: string): Nullable<Worksheet>;
|
|
84
84
|
getSheetByIndex(index: number): Nullable<Worksheet>;
|
|
85
85
|
getHiddenWorksheets(): string[];
|
|
86
|
-
/**
|
|
87
|
-
* transform any range type to range data
|
|
88
|
-
*
|
|
89
|
-
* @remarks
|
|
90
|
-
* e.g.,
|
|
91
|
-
* "A1:B1", "Sheet2!A1:B1"
|
|
92
|
-
*
|
|
93
|
-
* or
|
|
94
|
-
*
|
|
95
|
-
* {
|
|
96
|
-
* row:[0,1],
|
|
97
|
-
* column:[0,1]
|
|
98
|
-
* }
|
|
99
|
-
*
|
|
100
|
-
* or
|
|
101
|
-
*
|
|
102
|
-
* {
|
|
103
|
-
* startRow:0 ,
|
|
104
|
-
* startColumn:0,
|
|
105
|
-
* endRow:1,
|
|
106
|
-
* endColumn:1,
|
|
107
|
-
* }
|
|
108
|
-
*
|
|
109
|
-
* to
|
|
110
|
-
*
|
|
111
|
-
* {
|
|
112
|
-
* startRow:0 ,
|
|
113
|
-
* startColumn:0,
|
|
114
|
-
* endRow:1,
|
|
115
|
-
* endColumn:1,
|
|
116
|
-
* }
|
|
117
|
-
*
|
|
118
|
-
* IRangeType[] is to prevent type detection
|
|
119
|
-
*
|
|
120
|
-
* @param range support all range types
|
|
121
|
-
*
|
|
122
|
-
* @returns range data
|
|
123
|
-
*/
|
|
124
|
-
transformRangeType(range: IRangeType | IRangeType[]): IGridRange;
|
|
125
86
|
load(config: IWorkbookData): void;
|
|
126
87
|
/**
|
|
127
88
|
* Check if sheet name is unique
|
|
@@ -141,13 +102,6 @@ export declare class Workbook extends UnitModel<IWorkbookData, UniverInstanceTyp
|
|
|
141
102
|
* @returns New sheet name
|
|
142
103
|
*/
|
|
143
104
|
generateNewSheetName(name: string): string;
|
|
144
|
-
/**
|
|
145
|
-
* Get the range array based on the range string and sheet id
|
|
146
|
-
*
|
|
147
|
-
* @param txt - range string
|
|
148
|
-
* @returns
|
|
149
|
-
*/
|
|
150
|
-
private _getCellRange;
|
|
151
105
|
/**
|
|
152
106
|
* Get Default Sheet
|
|
153
107
|
*/
|
|
@@ -89,6 +89,10 @@ export declare class Worksheet {
|
|
|
89
89
|
getRange(range: IRange): Range;
|
|
90
90
|
getRange(startRow: number, startColumn: number): Range;
|
|
91
91
|
getRange(startRow: number, startColumn: number, endRow: number, endColumn: number): Range;
|
|
92
|
+
getScrollLeftTopFromSnapshot(): {
|
|
93
|
+
scrollLeft: number;
|
|
94
|
+
scrollTop: number;
|
|
95
|
+
};
|
|
92
96
|
/**
|
|
93
97
|
* Return WorkSheetZoomRatio
|
|
94
98
|
* @return zoomRatio
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Nullable } from '../../shared';
|
|
2
|
+
import { Worksheet } from '../../sheets/worksheet';
|
|
3
|
+
import { Workbook } from '../../sheets/workbook';
|
|
2
4
|
import { ISelectionCellWithCoord } from './i-selection-data';
|
|
3
5
|
import { IStyleData } from './i-style-data';
|
|
4
6
|
import { ICellDataForSheetInterceptor } from './i-cell-data';
|
|
@@ -11,6 +13,8 @@ export interface ICellRenderContext {
|
|
|
11
13
|
subUnitId: string;
|
|
12
14
|
row: number;
|
|
13
15
|
col: number;
|
|
16
|
+
worksheet: Worksheet;
|
|
17
|
+
workbook?: Workbook;
|
|
14
18
|
}
|
|
15
19
|
/**
|
|
16
20
|
* @debt This shouldn't exist in core package.
|
|
@@ -56,6 +56,10 @@ export interface ICellDataForSheetInterceptor extends ICellData {
|
|
|
56
56
|
markers?: ICellMarks;
|
|
57
57
|
customRender?: Nullable<ICellCustomRender[]>;
|
|
58
58
|
interceptorAutoHeight?: number;
|
|
59
|
+
/**
|
|
60
|
+
* can cell be covered when sibling is overflow
|
|
61
|
+
*/
|
|
62
|
+
coverable?: boolean;
|
|
59
63
|
}
|
|
60
64
|
export declare function isICellData(value: any): value is ICellData;
|
|
61
65
|
export declare function getCellValueType(cell: ICellData): CellValueType | null | undefined;
|
|
@@ -183,3 +183,11 @@ export interface IOptionData {
|
|
|
183
183
|
*/
|
|
184
184
|
export interface ICopyToOptionsData extends IOptionData {
|
|
185
185
|
}
|
|
186
|
+
export interface IRectLTRB {
|
|
187
|
+
left: number;
|
|
188
|
+
top: number;
|
|
189
|
+
right: number;
|
|
190
|
+
bottom: number;
|
|
191
|
+
width?: number;
|
|
192
|
+
height?: number;
|
|
193
|
+
}
|
|
@@ -48,3 +48,7 @@ export interface ITextRangeParam extends ITextRange {
|
|
|
48
48
|
segmentId?: string;
|
|
49
49
|
isActive?: boolean;
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Determines whether the cell(row, column) is within the range of the merged cells.
|
|
53
|
+
*/
|
|
54
|
+
export declare function getCellInfoInMergeData(row: number, column: number, mergeData?: IRange[]): ISelectionCell;
|