@univerjs/core 0.2.14 → 0.3.0-alpha.0
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 +9 -8
- package/lib/es/index.js +11500 -10838
- package/lib/types/common/interceptor.d.ts +7 -0
- package/lib/types/common/unit.d.ts +9 -0
- package/lib/types/docs/data-model/document-data-model.d.ts +5 -4
- package/lib/types/docs/data-model/index.d.ts +1 -1
- package/lib/types/{shared/lru/index.d.ts → docs/data-model/text-x/build-utils/__test__/selection.spec.d.ts} +1 -2
- package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +5 -3
- package/lib/types/docs/data-model/text-x/build-utils/parse.d.ts +3 -0
- package/lib/types/docs/data-model/text-x/build-utils/selection.d.ts +1 -1
- package/lib/types/index.d.ts +58 -56
- package/lib/types/services/instance/instance.service.d.ts +3 -3
- package/lib/types/services/locale/locale.service.d.ts +1 -1
- package/lib/types/services/resource-loader/resource-loader.service.d.ts +1 -1
- package/lib/types/services/resource-manager/type.d.ts +1 -1
- package/lib/types/shared/array-search.d.ts +7 -0
- package/lib/types/shared/index.d.ts +9 -10
- package/lib/types/shared/lru/{lru-helper.d.ts → __tests__/lru-map.spec.d.ts} +1 -7
- package/lib/types/shared/lru/lru-map.d.ts +7 -0
- package/lib/types/shared/object-matrix-query.d.ts +5 -1
- package/lib/types/shared/object-matrix.d.ts +1 -1
- package/lib/types/shared/range.d.ts +25 -0
- package/lib/types/shared/rectangle.d.ts +21 -0
- package/lib/types/shared/timer.d.ts +16 -0
- package/lib/types/shared/tools.d.ts +0 -17
- package/lib/types/sheets/__tests__/span-mode.spec.d.ts +16 -0
- package/lib/types/sheets/range.d.ts +2 -2
- package/lib/types/sheets/span-model.d.ts +62 -0
- package/lib/types/sheets/typedef.d.ts +1 -0
- package/lib/types/sheets/view-model.d.ts +4 -1
- package/lib/types/sheets/workbook.d.ts +3 -2
- package/lib/types/sheets/worksheet.d.ts +71 -1
- package/lib/types/slides/slide-model.d.ts +4 -1
- package/lib/types/types/enum/index.d.ts +2 -2
- package/lib/types/types/enum/text-style.d.ts +1 -1
- package/lib/types/types/interfaces/index.d.ts +1 -1
- package/lib/types/univer.d.ts +4 -4
- package/lib/umd/index.js +9 -8
- package/package.json +7 -7
- package/lib/types/shared/debounce.d.ts +0 -27
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Disposable } from '../shared/lifecycle';
|
|
2
|
+
import { IRange } from './typedef';
|
|
3
|
+
export declare class SpanModel extends Disposable {
|
|
4
|
+
/**
|
|
5
|
+
* @property Cache for RANGE_TYPE.NORMAL
|
|
6
|
+
*/
|
|
7
|
+
private _cellCache;
|
|
8
|
+
/**
|
|
9
|
+
* @property Cache for RANGE_TYPE.ROW
|
|
10
|
+
*/
|
|
11
|
+
private _rowCache;
|
|
12
|
+
/**
|
|
13
|
+
* @property Cache for RANGE_TYPE.COLUMN
|
|
14
|
+
*/
|
|
15
|
+
private _columnCache;
|
|
16
|
+
/**
|
|
17
|
+
* @property Whether has RANGE_TYPE.ALL
|
|
18
|
+
*/
|
|
19
|
+
private _hasAll;
|
|
20
|
+
/**
|
|
21
|
+
* @property Index for RANGE_TYPE.ALL
|
|
22
|
+
*/
|
|
23
|
+
private _allIndex;
|
|
24
|
+
/**
|
|
25
|
+
* @property the original merge data
|
|
26
|
+
*/
|
|
27
|
+
private _mergeData;
|
|
28
|
+
private _rangeMap;
|
|
29
|
+
private _skeletonCache;
|
|
30
|
+
constructor(mergeData: IRange[]);
|
|
31
|
+
private _init;
|
|
32
|
+
private _clearCache;
|
|
33
|
+
private _createCache;
|
|
34
|
+
/**
|
|
35
|
+
* Rebuild the merge data cache when the merge data is changed.
|
|
36
|
+
* @param {IRange[]} mergeData
|
|
37
|
+
*/
|
|
38
|
+
rebuild(mergeData: IRange[]): void;
|
|
39
|
+
private _createRowCache;
|
|
40
|
+
private _createColumnCache;
|
|
41
|
+
private _createCellAllCache;
|
|
42
|
+
private _createCellCache;
|
|
43
|
+
add(range: IRange): void;
|
|
44
|
+
remove(row: number, column: number): void;
|
|
45
|
+
getMergedCell(row: number, column: number): IRange | null;
|
|
46
|
+
isRowContainsMergedCell(row: number): boolean;
|
|
47
|
+
isColumnContainsMergedCell(column: number): boolean;
|
|
48
|
+
getMergedCellRange(startRow: number, startColumn: number, endRow: number, endColumn: number): IRange[];
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated sigificant performance impact, use _getCellMergeInfo instead.
|
|
51
|
+
* @param startRow
|
|
52
|
+
* @param startColumn
|
|
53
|
+
* @param endRow
|
|
54
|
+
* @param endColumn
|
|
55
|
+
*/
|
|
56
|
+
getMergedCellRangeForSkeleton(startRow: number, startColumn: number, endRow: number, endColumn: number): IRange[];
|
|
57
|
+
private _getRangeFromCache;
|
|
58
|
+
private _getSkeletonRangeFromCache;
|
|
59
|
+
private _getMergeDataIndex;
|
|
60
|
+
getMergeDataSnapshot(): IRange[];
|
|
61
|
+
dispose(): void;
|
|
62
|
+
}
|
|
@@ -466,6 +466,7 @@ export interface ITextRangeParam extends ITextRange {
|
|
|
466
466
|
}
|
|
467
467
|
/**
|
|
468
468
|
* Determines whether the cell(row, column) is within the range of the merged cells.
|
|
469
|
+
* @deprecated please use worksheet.getCellInfoInMergeData instead
|
|
469
470
|
*/
|
|
470
471
|
export declare function getCellInfoInMergeData(row: number, column: number, mergeData?: IRange[]): ISelectionCell;
|
|
471
472
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { InterceptorEffectEnum } from '../common/interceptor';
|
|
1
2
|
import { Disposable } from '../shared/lifecycle';
|
|
2
3
|
import { IDisposable } from '../common/di';
|
|
3
4
|
import { Nullable } from '../shared/types';
|
|
@@ -6,7 +7,7 @@ import { ICellData, ICellDataForSheetInterceptor } from './typedef';
|
|
|
6
7
|
* @internal
|
|
7
8
|
*/
|
|
8
9
|
export interface ICellContentInterceptor {
|
|
9
|
-
getCell: (row: number, col: number) => Nullable<ICellDataForSheetInterceptor>;
|
|
10
|
+
getCell: (row: number, col: number, effect: InterceptorEffectEnum) => Nullable<ICellDataForSheetInterceptor>;
|
|
10
11
|
}
|
|
11
12
|
export interface IRowFilteredInterceptor {
|
|
12
13
|
}
|
|
@@ -37,6 +38,8 @@ export declare class SheetViewModel extends Disposable {
|
|
|
37
38
|
constructor(getRawCell: (row: number, col: number) => Nullable<ICellData>);
|
|
38
39
|
dispose(): void;
|
|
39
40
|
getCell(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;
|
|
41
|
+
getCellValueOnly(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;
|
|
42
|
+
getCellStyleOnly(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;
|
|
40
43
|
getRowFiltered(row: number): boolean;
|
|
41
44
|
registerCellContentInterceptor(interceptor: ICellContentInterceptor): IDisposable;
|
|
42
45
|
registerRowFilteredInterceptor(interceptor: IRowFilteredInterceptor): IDisposable;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import { ILogService } from '../services/log/log.service';
|
|
3
|
-
import { Nullable } from '../shared';
|
|
4
2
|
import { UnitModel, UniverInstanceType } from '../common/unit';
|
|
3
|
+
import { ILogService } from '../services/log/log.service';
|
|
5
4
|
import { Styles } from './styles';
|
|
6
5
|
import { Worksheet } from './worksheet';
|
|
6
|
+
import { Nullable } from '../shared';
|
|
7
7
|
import { IRangeType, IWorkbookData, IWorksheetData } from './typedef';
|
|
8
8
|
export declare function getWorksheetUID(workbook: Workbook, worksheet: Worksheet): string;
|
|
9
9
|
/**
|
|
@@ -61,6 +61,7 @@ export declare class Workbook extends UnitModel<IWorkbookData, UniverInstanceTyp
|
|
|
61
61
|
getUnitId(): string;
|
|
62
62
|
getRev(): number;
|
|
63
63
|
incrementRev(): void;
|
|
64
|
+
setRev(rev: number): void;
|
|
64
65
|
/**
|
|
65
66
|
* Add a Worksheet into Workbook.
|
|
66
67
|
*/
|
|
@@ -3,9 +3,10 @@ import { BooleanNumber } from '../types/enum';
|
|
|
3
3
|
import { ColumnManager } from './column-manager';
|
|
4
4
|
import { Range } from './range';
|
|
5
5
|
import { RowManager } from './row-manager';
|
|
6
|
+
import { SpanModel } from './span-model';
|
|
6
7
|
import { SheetViewModel } from './view-model';
|
|
7
8
|
import { Styles } from './styles';
|
|
8
|
-
import { ICellData, ICellDataForSheetInterceptor, IFreeze, IRange, IWorksheetData } from './typedef';
|
|
9
|
+
import { ICellData, ICellDataForSheetInterceptor, IFreeze, IRange, ISelectionCell, IWorksheetData } from './typedef';
|
|
9
10
|
/**
|
|
10
11
|
* The model of a Worksheet.
|
|
11
12
|
*/
|
|
@@ -18,6 +19,7 @@ export declare class Worksheet {
|
|
|
18
19
|
protected _rowManager: RowManager;
|
|
19
20
|
protected _columnManager: ColumnManager;
|
|
20
21
|
protected readonly _viewModel: SheetViewModel;
|
|
22
|
+
protected _spanModel: SpanModel;
|
|
21
23
|
constructor(unitId: string, snapshot: Partial<IWorksheetData>, _styles: Styles);
|
|
22
24
|
/**
|
|
23
25
|
* @internal
|
|
@@ -25,6 +27,12 @@ export declare class Worksheet {
|
|
|
25
27
|
*/
|
|
26
28
|
__interceptViewModel(callback: (viewModel: SheetViewModel) => void): void;
|
|
27
29
|
getSnapshot(): IWorksheetData;
|
|
30
|
+
/**
|
|
31
|
+
* Set the merge data of the sheet, all the merged cells will be rebuilt.
|
|
32
|
+
* @param mergeData
|
|
33
|
+
*/
|
|
34
|
+
setMergeData(mergeData: IRange[]): void;
|
|
35
|
+
getSpanModel(): SpanModel;
|
|
28
36
|
/**
|
|
29
37
|
* Returns WorkSheet Cell Data Matrix
|
|
30
38
|
* @returns
|
|
@@ -70,8 +78,55 @@ export declare class Worksheet {
|
|
|
70
78
|
* @deprecated
|
|
71
79
|
*/
|
|
72
80
|
clone(): Worksheet;
|
|
81
|
+
/**
|
|
82
|
+
* Get the merged cell list of the sheet.
|
|
83
|
+
* @returns {IRange[]} merged cell list
|
|
84
|
+
*/
|
|
73
85
|
getMergeData(): IRange[];
|
|
86
|
+
/**
|
|
87
|
+
* Get the merged cell Range of the sheet cell.
|
|
88
|
+
* @param {number} row The row index of test cell
|
|
89
|
+
* @param {number} col The column index of test cell
|
|
90
|
+
* @returns {Nullable<IRange>} The merged cell range of the cell, if the cell is not in a merged cell, return null
|
|
91
|
+
*/
|
|
74
92
|
getMergedCell(row: number, col: number): Nullable<IRange>;
|
|
93
|
+
/**
|
|
94
|
+
* Get the merged cell info list which has intersection with the given range.
|
|
95
|
+
* @param {number} startRow The start row index of the range
|
|
96
|
+
* @param {number} startColumn The start column index of the range
|
|
97
|
+
* @param {number} endRow The end row index of the range
|
|
98
|
+
* @param {number} endColumn The end column index of the range
|
|
99
|
+
* @returns {IRange} The merged cell info list which has intersection with the given range or empty array if no merged cell in the range
|
|
100
|
+
*/
|
|
101
|
+
getMergedCellRange(startRow: number, startColumn: number, endRow: number, endColumn: number): IRange[];
|
|
102
|
+
/**
|
|
103
|
+
* Get if the row contains merged cell
|
|
104
|
+
* @param {number} row The row index
|
|
105
|
+
* @returns {boolean} Is merge cell across row
|
|
106
|
+
*/
|
|
107
|
+
isRowContainsMergedCell(row: number): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Get if the column contains merged cell
|
|
110
|
+
* @param {number} column The column index
|
|
111
|
+
* @returns {boolean} Is merge cell across column
|
|
112
|
+
*/
|
|
113
|
+
isColumnContainsMergedCell(column: number): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Get cell info with merge data
|
|
116
|
+
* @param {number} row - The row index of the cell.
|
|
117
|
+
* @param {number} column - The column index of the cell.
|
|
118
|
+
* @type {selectionCell}
|
|
119
|
+
* @property {number} actualRow - The actual row index of the cell
|
|
120
|
+
* @property {number} actualColumn - The actual column index of the cell
|
|
121
|
+
* @property {boolean} isMergedMainCell - Whether the cell is the main cell of the merged cell, only the upper left cell in the merged cell returns true here
|
|
122
|
+
* @property {boolean} isMerged - Whether the cell is in a merged cell, the upper left cell in the merged cell returns false here
|
|
123
|
+
* @property {number} endRow - The end row index of the merged cell
|
|
124
|
+
* @property {number} endColumn - The end column index of the merged cell
|
|
125
|
+
* @property {number} startRow - The start row index of the merged cell
|
|
126
|
+
* @property {number} startColumn - The start column index of the merged cell
|
|
127
|
+
* @returns {selectionCell} - The cell info with merge data
|
|
128
|
+
*/
|
|
129
|
+
getCellInfoInMergeData(row: number, column: number): ISelectionCell;
|
|
75
130
|
/**
|
|
76
131
|
* Get cellData, includes cellData, customRender, markers, dataValidate, etc.
|
|
77
132
|
*
|
|
@@ -83,6 +138,20 @@ export declare class Worksheet {
|
|
|
83
138
|
* @returns ICellDataForSheetInterceptor
|
|
84
139
|
*/
|
|
85
140
|
getCell(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;
|
|
141
|
+
/**
|
|
142
|
+
* Get cellData only use effect on value interceptor
|
|
143
|
+
* @param {number} number row The row index of the cell.
|
|
144
|
+
* @param {number} number col The column index of the cell.
|
|
145
|
+
* @returns {Nullable<ICellDataForSheetInterceptor>} The cell data only use effect on value interceptor
|
|
146
|
+
*/
|
|
147
|
+
getCellValueOnly(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;
|
|
148
|
+
/**
|
|
149
|
+
* Get cellData only use effect on style interceptor
|
|
150
|
+
* @param {number} row The row index of the cell.
|
|
151
|
+
* @param {number} col The column index of the cell.
|
|
152
|
+
* @returns {Nullable<ICellDataForSheetInterceptor>} The cell data only use effect on style interceptor
|
|
153
|
+
*/
|
|
154
|
+
getCellStyleOnly(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;
|
|
86
155
|
getCellRaw(row: number, col: number): Nullable<ICellData>;
|
|
87
156
|
getRowFiltered(row: number): boolean;
|
|
88
157
|
/**
|
|
@@ -242,3 +311,4 @@ export interface ICell {
|
|
|
242
311
|
* @returns pure text in this cell
|
|
243
312
|
*/
|
|
244
313
|
export declare function extractPureTextFromCell(cell: Nullable<ICellData>): string;
|
|
314
|
+
export declare function getOriginCellValue(cell: Nullable<ICellData>): Nullable<import('./typedef').CellValue>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { UnitModel, UniverInstanceType } from '../common/unit';
|
|
3
|
+
import { PageType, ISlideData, ISlidePage } from '../types/interfaces';
|
|
3
4
|
import { Nullable } from '../shared';
|
|
4
|
-
import { ISlideData, ISlidePage, PageType } from '../types/interfaces';
|
|
5
5
|
export declare class SlideDataModel extends UnitModel<ISlideData, UniverInstanceType.UNIVER_SLIDE> {
|
|
6
6
|
type: UniverInstanceType.UNIVER_SLIDE;
|
|
7
7
|
private readonly _activePage$;
|
|
@@ -13,6 +13,9 @@ export declare class SlideDataModel extends UnitModel<ISlideData, UniverInstance
|
|
|
13
13
|
private _unitId;
|
|
14
14
|
constructor(snapshot: Partial<ISlideData>);
|
|
15
15
|
setName(name: string): void;
|
|
16
|
+
getRev(): number;
|
|
17
|
+
incrementRev(): void;
|
|
18
|
+
setRev(_rev: number): void;
|
|
16
19
|
getSnapshot(): ISlideData;
|
|
17
20
|
getUnitId(): string;
|
|
18
21
|
getPages(): {
|
|
@@ -18,6 +18,7 @@ export * from './border-style-types';
|
|
|
18
18
|
export * from './color-type';
|
|
19
19
|
export * from './common-hide-types';
|
|
20
20
|
export * from './copy-paste-type';
|
|
21
|
+
export * from './delete-direction';
|
|
21
22
|
export * from './developer-metadata-visibility';
|
|
22
23
|
export * from './dimension';
|
|
23
24
|
export * from './direction';
|
|
@@ -25,9 +26,8 @@ export * from './format-type';
|
|
|
25
26
|
export * from './interpolation-point-type';
|
|
26
27
|
export * from './locale-type';
|
|
27
28
|
export * from './protection-type';
|
|
29
|
+
export * from './prst-geom-type';
|
|
28
30
|
export * from './relative-date';
|
|
29
31
|
export * from './sheet-types';
|
|
30
32
|
export * from './text-style';
|
|
31
33
|
export * from './theme-color-type';
|
|
32
|
-
export * from './prst-geom-type';
|
|
33
|
-
export * from './delete-direction';
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
export * from './i-document-data';
|
|
17
17
|
export * from './i-document-data-interceptor';
|
|
18
18
|
export * from './i-image-properties';
|
|
19
|
+
export * from './i-need-check-disposable';
|
|
19
20
|
export * from './i-placeholder';
|
|
20
21
|
export * from './i-shape-properties';
|
|
21
22
|
export * from './i-slide-data';
|
|
22
23
|
export * from './i-style-data';
|
|
23
|
-
export * from './i-need-check-disposable';
|
package/lib/types/univer.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Injector } from './common/di';
|
|
2
2
|
import { DocumentDataModel } from './docs/data-model/document-data-model';
|
|
3
|
-
import { LogLevel } from './services/log/log.service';
|
|
4
|
-
import { IStyleSheet } from './services/theme/theme.service';
|
|
5
3
|
import { Workbook } from './sheets/workbook';
|
|
6
4
|
import { SlideDataModel } from './slides/slide-model';
|
|
7
|
-
import { LocaleType } from './types/enum/locale-type';
|
|
8
|
-
import { IDocumentData, ISlideData } from './types/interfaces';
|
|
9
5
|
import { UnitModel, UnitType } from './common/unit';
|
|
6
|
+
import { LogLevel } from './services/log/log.service';
|
|
10
7
|
import { Plugin, PluginCtor } from './services/plugin/plugin';
|
|
11
8
|
import { DependencyOverride } from './services/plugin/plugin-override';
|
|
9
|
+
import { IStyleSheet } from './services/theme/theme.service';
|
|
12
10
|
import { ILocales } from './shared';
|
|
13
11
|
import { IWorkbookData } from './sheets/typedef';
|
|
12
|
+
import { LocaleType } from './types/enum/locale-type';
|
|
13
|
+
import { IDocumentData, ISlideData } from './types/interfaces';
|
|
14
14
|
export interface IUniverConfig {
|
|
15
15
|
theme: IStyleSheet;
|
|
16
16
|
locale: LocaleType;
|