@univerjs/core 0.1.15 → 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 +1877 -2049
- 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/shared/common.d.ts +2 -1
- package/lib/types/shared/rectangle.d.ts +3 -12
- package/lib/types/sheets/workbook.d.ts +6 -52
- 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/umd/index.js +8 -8
- package/package.json +4 -4
|
@@ -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,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
|
}
|
|
@@ -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
|
*/
|
|
@@ -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
|
+
}
|