@univerjs/core 0.1.7 → 0.1.8

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.
Files changed (59) hide show
  1. package/lib/cjs/index.js +8 -8
  2. package/lib/es/index.js +4650 -4507
  3. package/lib/types/common/boolean.d.ts +16 -0
  4. package/lib/types/common/interceptor.d.ts +2 -2
  5. package/lib/types/common/number.d.ts +17 -0
  6. package/lib/types/{basics/index.d.ts → common/set.d.ts} +7 -5
  7. package/lib/types/common/type-util.d.ts +16 -0
  8. package/lib/types/common/unit.d.ts +9 -0
  9. package/lib/types/docs/data-model/document-data-model.d.ts +4 -1
  10. package/lib/types/index.d.ts +21 -9
  11. package/lib/types/services/command/command.service.d.ts +1 -0
  12. package/lib/types/services/floating-object/floating-object-manager.service.d.ts +1 -1
  13. package/lib/types/services/instance/instance.service.d.ts +71 -94
  14. package/lib/types/services/lifecycle/lifecycle.service.d.ts +2 -2
  15. package/lib/types/services/permission/permission.service.d.ts +0 -1
  16. package/lib/types/services/permission/univer.permission.service.d.ts +2 -2
  17. package/lib/types/services/plugin/plugin-holder.d.ts +25 -0
  18. package/lib/types/services/plugin/plugin-override.d.ts +8 -0
  19. package/lib/types/{plugin → services/plugin}/plugin.d.ts +11 -16
  20. package/lib/types/services/plugin/plugin.service.d.ts +24 -0
  21. package/lib/types/services/resource-loader/resource-loader.service.d.ts +14 -0
  22. package/lib/types/services/resource-loader/type.d.ts +7 -0
  23. package/lib/types/services/resource-manager/resource-manager.service.d.ts +11 -17
  24. package/lib/types/services/resource-manager/type.d.ts +15 -18
  25. package/lib/types/services/undoredo/undoredo.service.d.ts +2 -2
  26. package/lib/types/shared/__tests__/ref-alias.spec.d.ts +16 -0
  27. package/lib/types/shared/clipboard.d.ts +5 -0
  28. package/lib/types/shared/color/color.d.ts +1 -1
  29. package/lib/types/shared/index.d.ts +2 -0
  30. package/lib/types/shared/lifecycle.d.ts +8 -3
  31. package/lib/types/shared/range.d.ts +3 -0
  32. package/lib/types/sheets/__tests__/create-core-test-bed.d.ts +2 -2
  33. package/lib/types/sheets/column-manager.d.ts +1 -1
  34. package/lib/types/sheets/row-manager.d.ts +4 -2
  35. package/lib/types/sheets/view-model.d.ts +18 -10
  36. package/lib/types/sheets/workbook.d.ts +3 -2
  37. package/lib/types/sheets/worksheet.d.ts +33 -8
  38. package/lib/types/slides/{domain/slide-model.d.ts → slide-model.d.ts} +7 -5
  39. package/lib/types/types/enum/index.d.ts +0 -1
  40. package/lib/types/types/interfaces/i-cell-custom-render.d.ts +2 -0
  41. package/lib/types/types/interfaces/i-cell-data.d.ts +4 -0
  42. package/lib/types/types/interfaces/i-range.d.ts +3 -0
  43. package/lib/types/types/interfaces/i-style-data.d.ts +6 -0
  44. package/lib/types/types/interfaces/i-univer-data.d.ts +2 -13
  45. package/lib/types/univer.d.ts +43 -0
  46. package/lib/umd/index.js +9 -9
  47. package/package.json +8 -8
  48. package/lib/types/basics/plugin-holder.d.ts +0 -16
  49. package/lib/types/basics/univer-doc.d.ts +0 -16
  50. package/lib/types/basics/univer-sheet.d.ts +0 -16
  51. package/lib/types/basics/univer-slide.d.ts +0 -16
  52. package/lib/types/basics/univer.d.ts +0 -46
  53. package/lib/types/slides/domain/index.d.ts +0 -16
  54. package/lib/types/types/enum/condition-type.d.ts +0 -49
  55. /package/lib/types/{basics → common}/registry.d.ts +0 -0
  56. /package/lib/types/shared/{__test__ → __tests__}/common.spec.d.ts +0 -0
  57. /package/lib/types/shared/{__test__ → __tests__}/object-matrix.spec.d.ts +0 -0
  58. /package/lib/types/shared/{__test__/rectangle.spec.d.ts → __tests__/range.spec.d.ts} +0 -0
  59. /package/lib/types/shared/{__test__/ref-alias.spec.d.ts → __tests__/rectangle.spec.d.ts} +0 -0
@@ -1,29 +1,26 @@
1
1
  import { IWorkbookData } from '../../types/interfaces/i-workbook-data';
2
- import { Workbook } from '../../sheets/workbook';
2
+ import { UniverInstanceType } from '@univerjs/core';
3
3
  import { Observable } from 'rxjs';
4
4
  import { IDisposable } from '@wendellhu/redi';
5
5
 
6
+ type IBusinessName = 'SHEET' | 'DOC';
7
+ export type IResourceName = `${IBusinessName}_${string}_PLUGIN`;
6
8
  export interface IResourceHook<T = any> {
7
- onChange: (unitID: string, resource: T) => void;
9
+ pluginName: IResourceName;
10
+ businesses: UniverInstanceType[];
11
+ onLoad: (unitID: string, resource: T) => void;
12
+ onUnLoad: (unitID: string) => void;
8
13
  toJson: (unitID: string) => string;
9
14
  parseJson: (bytes: string) => T;
10
15
  }
11
16
  export interface IResourceManagerService {
12
- registerPluginResource: <T = any>(unitID: string, pluginName: string, hook: IResourceHook<T>) => IDisposable;
13
- disposePluginResource: (unitID: string, pluginName: string) => void;
14
- getAllResource: (unitID: string) => Array<{
15
- unitID: string;
16
- resourceName: string;
17
- hook: IResourceHook;
18
- }>;
19
- register$: Observable<{
20
- resourceName: string;
21
- hook: IResourceHook;
22
- unitID: string;
23
- }>;
17
+ register$: Observable<IResourceHook>;
18
+ registerPluginResource: <T = any>(hook: IResourceHook<T>) => IDisposable;
19
+ disposePluginResource: (pluginName: IResourceName) => void;
20
+ getAllResourceHooks: () => IResourceHook[];
21
+ getResources: (unitId: string) => IWorkbookData['resources'];
22
+ loadResources: (unitId: string, resources: IWorkbookData['resources']) => void;
23
+ unloadResources(unitId: string): void;
24
24
  }
25
25
  export declare const IResourceManagerService: import('@wendellhu/redi').IdentifierDecorator<IResourceManagerService>;
26
- export interface ISnapshotPersistenceService {
27
- saveWorkbook: (workbook: Workbook) => IWorkbookData;
28
- }
29
- export declare const ISnapshotPersistenceService: import('@wendellhu/redi').IdentifierDecorator<ISnapshotPersistenceService>;
26
+ export {};
@@ -1,4 +1,4 @@
1
- import { Nullable } from '../../common/type-utils';
1
+ import { Nullable } from '../../common/type-util';
2
2
  import { IUniverInstanceService } from '../instance/instance.service';
3
3
  import { IContextService } from '../context/context.service';
4
4
  import { IMutationInfo, CommandType, ICommandService } from '../command/command.service';
@@ -98,5 +98,5 @@ export declare class LocalUndoRedoService extends Disposable implements IUndoRed
98
98
  protected _getUndoStackForFocused(): IUndoRedoItem[];
99
99
  protected _getRedoStackForFocused(): IUndoRedoItem[];
100
100
  private _tryBatchingElements;
101
- private _getFocusedUniverInstanceId;
101
+ private _getFocusedUnitId;
102
102
  }
@@ -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,5 @@
1
+ import { IDocumentBody, ITextRun } from '../types/interfaces';
2
+
3
+ export declare function getBodySliceHtml(body: IDocumentBody, startIndex: number, endIndex: number): string;
4
+ export declare function convertBodyToHtml(body: IDocumentBody, withParagraphInfo?: boolean): string;
5
+ export declare function covertTextRunToHtml(dataStream: string, textRun: ITextRun): string;
@@ -1,5 +1,5 @@
1
1
  import { ColorType, ThemeColors, ThemeColorType } from '../../types/enum';
2
- import { Nullable } from '../../common/type-utils';
2
+ import { Nullable } from '../../common/type-util';
3
3
 
4
4
  export declare class ColorBuilder {
5
5
  private _themeValue;
@@ -36,4 +36,6 @@ export * from './sort-rules';
36
36
  export * from './tools';
37
37
  export * from './types';
38
38
  export * from './debounce';
39
+ export * from './clipboard';
39
40
  export { queryObjectMatrix } from './object-matrix-query';
41
+ export { moveRangeByOffset } from './range';
@@ -1,27 +1,32 @@
1
1
  import { Observer } from '../observer/observable';
2
- import { Nullable } from '../common/type-utils';
2
+ import { Nullable } from '../common/type-util';
3
3
  import { Subscription, SubscriptionLike, Subject } from 'rxjs';
4
4
  import { IDisposable } from '@wendellhu/redi';
5
5
 
6
+ type DisposableLike = IDisposable | Nullable<Observer<any>> | SubscriptionLike | (() => void);
7
+ export declare function toDisposable(disposable: IDisposable): IDisposable;
6
8
  export declare function toDisposable(observer: Nullable<Observer<any>>): IDisposable;
7
9
  export declare function toDisposable(subscription: SubscriptionLike): IDisposable;
8
10
  export declare function toDisposable(callback: () => void): IDisposable;
11
+ export declare function toDisposable(v: DisposableLike): IDisposable;
9
12
  /**
10
13
  * @deprecated use toDisposable instead
11
14
  */
12
15
  export declare function fromObservable(subscription: Subscription): IDisposable;
13
16
  export declare class DisposableCollection implements IDisposable {
14
17
  private readonly _disposables;
15
- add(disposable: IDisposable): IDisposable;
18
+ add(disposable: DisposableLike): IDisposable;
16
19
  dispose(): void;
17
20
  }
18
21
  export declare class Disposable implements IDisposable {
19
22
  protected _disposed: boolean;
20
23
  private readonly _collection;
21
- protected disposeWithMe(disposable: IDisposable | SubscriptionLike): IDisposable;
24
+ protected disposeWithMe(disposable: DisposableLike): IDisposable;
25
+ protected ensureNotDisposed(): void;
22
26
  dispose(): void;
23
27
  }
24
28
  export declare class RxDisposable extends Disposable implements IDisposable {
25
29
  protected dispose$: Subject<void>;
26
30
  dispose(): void;
27
31
  }
32
+ export {};
@@ -0,0 +1,3 @@
1
+ import { IRange } from '../types/interfaces/i-range';
2
+
3
+ export declare function moveRangeByOffset(range: IRange, refOffsetX: number, refOffsetY: number, ignoreAbsolute?: boolean): IRange;
@@ -1,7 +1,7 @@
1
1
  import { IWorkbookData } from '../../types/interfaces/i-workbook-data';
2
- import { Univer } from '../../basics/univer';
2
+ import { Univer } from '../../univer';
3
3
 
4
- export declare function createCoreTestBed(workbookConfig?: IWorkbookData): {
4
+ export declare function createCoreTestBed(workbookData?: IWorkbookData): {
5
5
  univer: Univer;
6
6
  get: {
7
7
  <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, lookUp?: import('@wendellhu/redi').LookUp | undefined): T;
@@ -1,6 +1,6 @@
1
1
  import { IColumnData, IRange, IWorksheetData } from '../types/interfaces';
2
2
  import { IObjectArrayPrimitiveType } from '../shared/object-matrix';
3
- import { Nullable } from '../common/type-utils';
3
+ import { Nullable } from '../common/type-util';
4
4
 
5
5
  /**
6
6
  * Manage configuration information of all columns, get column width, column length, set column width, etc.
@@ -1,3 +1,4 @@
1
+ import { SheetViewModel } from './view-model';
1
2
  import { IRange, IRowData, IWorksheetData } from '../types/interfaces';
2
3
  import { Nullable } from '../shared/types';
3
4
  import { IObjectArrayPrimitiveType } from '../shared/object-matrix';
@@ -7,8 +8,9 @@ import { IObjectArrayPrimitiveType } from '../shared/object-matrix';
7
8
  */
8
9
  export declare class RowManager {
9
10
  private readonly _config;
11
+ private readonly _viewModel;
10
12
  private _rowData;
11
- constructor(_config: IWorksheetData, data: IObjectArrayPrimitiveType<Partial<IRowData>>);
13
+ constructor(_config: IWorksheetData, _viewModel: SheetViewModel, data: IObjectArrayPrimitiveType<Partial<IRowData>>);
12
14
  /**
13
15
  * Get height and hidden status of columns in the sheet
14
16
  * @returns
@@ -43,7 +45,7 @@ export declare class RowManager {
43
45
  * @returns Visible rows range list
44
46
  */
45
47
  getVisibleRows(start?: number, end?: number): IRange[];
46
- getRowVisible(rowPos: number): boolean;
48
+ getRowRawVisible(row: number): boolean;
47
49
  /**
48
50
  * Get count of row in the sheet
49
51
  * @returns
@@ -1,8 +1,11 @@
1
- import { ICellDataForSheetInterceptor } from '../types/interfaces/i-cell-data';
1
+ import { ICellData, ICellDataForSheetInterceptor } from '../types/interfaces/i-cell-data';
2
2
  import { Disposable } from '../shared/lifecycle';
3
- import { Nullable } from '../common/type-utils';
3
+ import { Nullable } from '../common/type-util';
4
4
  import { IDisposable } from '@wendellhu/redi';
5
5
 
6
+ /**
7
+ * @internal
8
+ */
6
9
  export interface ICellContentInterceptor {
7
10
  getCell: (row: number, col: number) => Nullable<ICellDataForSheetInterceptor>;
8
11
  }
@@ -20,17 +23,22 @@ export interface ISheetViewModel {
20
23
  getCell: (row: number, col: number) => Nullable<ICellDataForSheetInterceptor>;
21
24
  }
22
25
  /**
23
- * SheetViewModel
26
+ * @internal
27
+ */
28
+ export interface IRowFilteredInterceptor {
29
+ getRowFiltered(row: number): boolean;
30
+ }
31
+ /**
32
+ * @internal
24
33
  */
25
- export declare class SheetViewModel extends Disposable implements ISheetViewModel {
26
- private readonly _cellContentInterceptors;
27
- private readonly _rowFilteredInterceptors;
28
- private readonly _rowVisibleInterceptors;
29
- private readonly _colVisibleInterceptors;
34
+ export declare class SheetViewModel extends Disposable {
35
+ private readonly getRawCell;
36
+ private _cellContentInterceptor;
37
+ private _rowFilteredInterceptor;
38
+ constructor(getRawCell: (row: number, col: number) => Nullable<ICellData>);
30
39
  dispose(): void;
31
40
  getCell(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;
41
+ getRowFiltered(row: number): boolean;
32
42
  registerCellContentInterceptor(interceptor: ICellContentInterceptor): IDisposable;
33
43
  registerRowFilteredInterceptor(interceptor: IRowFilteredInterceptor): IDisposable;
34
- registerRowVisibleInterceptor(interceptor: IRowVisibleInterceptor): IDisposable;
35
- registerColVisibleInterceptor(interceptor: IColVisibleInterceptor): IDisposable;
36
44
  }
@@ -1,7 +1,7 @@
1
1
  import { Worksheet } from './worksheet';
2
2
  import { Styles } from './styles';
3
+ import { UnitModel, UniverInstanceType } from '../common/unit';
3
4
  import { IGridRange, IRangeType, IWorkbookData, IWorksheetData } from '../types/interfaces';
4
- import { Disposable } from '../shared/lifecycle';
5
5
  import { Nullable } from '../shared';
6
6
  import { ILogService } from '../services/log/log.service';
7
7
 
@@ -9,8 +9,9 @@ export declare function getWorksheetUID(workbook: Workbook, worksheet: Worksheet
9
9
  /**
10
10
  * Access and create Univer Sheets files
11
11
  */
12
- export declare class Workbook extends Disposable {
12
+ export declare class Workbook extends UnitModel<IWorkbookData, UniverInstanceType.UNIVER_SHEET> {
13
13
  private readonly _logService;
14
+ type: UniverInstanceType.UNIVER_SHEET;
14
15
  private readonly _sheetCreated$;
15
16
  readonly sheetCreated$: import('rxjs').Observable<Worksheet>;
16
17
  private readonly _sheetDisposed$;
@@ -11,6 +11,7 @@ import { Nullable, ObjectMatrix } from '../shared';
11
11
  * The model of a Worksheet.
12
12
  */
13
13
  export declare class Worksheet {
14
+ readonly unitId: string;
14
15
  private readonly _styles;
15
16
  protected _sheetId: string;
16
17
  protected _snapshot: IWorksheetData;
@@ -18,7 +19,7 @@ export declare class Worksheet {
18
19
  protected _rowManager: RowManager;
19
20
  protected _columnManager: ColumnManager;
20
21
  protected readonly _viewModel: SheetViewModel;
21
- constructor(snapshot: Partial<IWorksheetData>, _styles: Styles);
22
+ constructor(unitId: string, snapshot: Partial<IWorksheetData>, _styles: Styles);
22
23
  /**
23
24
  * @internal
24
25
  * @param callback
@@ -45,6 +46,10 @@ export declare class Worksheet {
45
46
  * @returns Row Manager
46
47
  */
47
48
  getRowManager(): RowManager;
49
+ /**
50
+ * Returns the ID of its parent unit.
51
+ */
52
+ getUnitId(): string;
48
53
  /**
49
54
  * Returns the ID of the sheet represented by this object.
50
55
  * @returns ID of the sheet
@@ -70,13 +75,14 @@ export declare class Worksheet {
70
75
  getMergedCell(row: number, col: number): Nullable<IRange>;
71
76
  getCell(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;
72
77
  getCellRaw(row: number, col: number): Nullable<ICellData>;
78
+ getRowFiltered(row: number): boolean;
73
79
  /**
74
80
  * Get cell matrix from a given range and pick out non-first cells of merged cells.
75
81
  *
76
82
  * Notice that `ICellData` here is not after copying. In another word, the object matrix here should be
77
83
  * considered as a slice of the original worksheet data matrix.
78
84
  */
79
- getMatrixWithMergedCells(row: number, col: number, endRow: number, endCol: number): ObjectMatrix<ICellData & {
85
+ getMatrixWithMergedCells(row: number, col: number, endRow: number, endCol: number, isRaw?: boolean): ObjectMatrix<ICellData & {
80
86
  rowSpan?: number;
81
87
  colSpan?: number;
82
88
  }>;
@@ -135,11 +141,22 @@ export declare class Worksheet {
135
141
  getColumnWidth(columnPosition: number): number;
136
142
  /**
137
143
  * Gets the height in pixels of the given row.
138
- * @param rowPosition row index
144
+ * @param row row index
139
145
  * @returns Gets the height in pixels of the given row.
140
146
  */
141
- getRowHeight(rowPosition: number): number;
147
+ getRowHeight(row: number): number;
148
+ /**
149
+ * Get if the row in visible. It may be affected by features like filter and view.
150
+ * @param row the row index
151
+ * @returns if the row in visible to the user
152
+ */
142
153
  getRowVisible(row: number): boolean;
154
+ /**
155
+ * Get if the row does not have `hidden` property.
156
+ * @param row the row index
157
+ * @returns if the row does not have `hidden` property
158
+ */
159
+ getRowRawVisible(row: number): boolean;
143
160
  getHiddenRows(start?: number, end?: number): IRange[];
144
161
  getColVisible(col: number): boolean;
145
162
  getHiddenCols(start?: number, end?: number): IRange[];
@@ -173,14 +190,22 @@ export declare class Worksheet {
173
190
  * Iterate a range row by row.
174
191
  *
175
192
  * Performance intensive.
193
+ *
194
+ * @param range the iterate range
195
+ * @param skipEmpty whether to skip empty cells, default to be `true`
176
196
  */
177
- iterateByRow(range: IRange): Iterator<Readonly<ICell>, Readonly<ICell>>;
197
+ iterateByRow(range: IRange, skipEmpty?: boolean): Iterable<Readonly<ICell>>;
178
198
  /**
179
199
  * Iterate a range column by column. This is pretty similar to `iterateByRow` but with different order.
180
200
  *
181
201
  * Performance intensive.
202
+ *
203
+ * @param range The iterate range.
204
+ * @param skipEmpty Whether to skip empty cells, default to be `true`.
205
+ * @param skipNonTopLeft Whether to skip non-top-left cells of merged cells, default to be `true`. If the
206
+ * parameter is set to `false`, the iterator will return cells in the top row.
182
207
  */
183
- iterateByColumn(range: IRange): Iterator<Readonly<ICell>, Readonly<ICell>>;
208
+ iterateByColumn(range: IRange, skipEmpty?: boolean, skipNonTopLeft?: boolean): Iterable<Readonly<ICell>>;
184
209
  }
185
210
  /**
186
211
  * A cell info including its span (if it is the top-left cell of a merged cell).
@@ -190,11 +215,11 @@ export interface ICell {
190
215
  col: number;
191
216
  rowSpan?: number;
192
217
  colSpan?: number;
193
- value: ICellData;
218
+ value: Nullable<ICellData>;
194
219
  }
195
220
  /**
196
221
  * Get pure text in a cell.
197
222
  * @param cell
198
223
  * @returns pure text in this cell
199
224
  */
200
- export declare function extractPureTextFromCell(cell: ICellData): string;
225
+ export declare function extractPureTextFromCell(cell: Nullable<ICellData>): string;
@@ -1,6 +1,8 @@
1
- import { ISlideData, ISlidePage } from '../../types/interfaces';
1
+ import { ISlideData, ISlidePage } from '../types/interfaces';
2
+ import { UnitModel, UniverInstanceType } from '../common/unit';
2
3
 
3
- export declare class SlideDataModel {
4
+ export declare class SlideDataModel extends UnitModel<ISlideData, UniverInstanceType.UNIVER_SLIDE> {
5
+ type: UniverInstanceType.UNIVER_SLIDE;
4
6
  private _snapshot;
5
7
  private _unitId;
6
8
  constructor(snapshot: Partial<ISlideData>);
@@ -14,9 +16,9 @@ export declare class SlideDataModel {
14
16
  getPageOrder(): string[] | undefined;
15
17
  getPage(pageId: string): ISlidePage | undefined;
16
18
  getElementsByPage(pageId: string): {
17
- [elementId: string]: import('../../types/interfaces').IPageElement;
19
+ [elementId: string]: import('../types/interfaces').IPageElement;
18
20
  } | undefined;
19
- getElement(pageId: string, elementId: string): import('../../types/interfaces').IPageElement | undefined;
20
- getPageSize(): import('../..').ISize;
21
+ getElement(pageId: string, elementId: string): import('../types/interfaces').IPageElement | undefined;
22
+ getPageSize(): import('..').ISize;
21
23
  addPage(): ISlidePage;
22
24
  }
@@ -17,7 +17,6 @@ export * from './auto-fill-series';
17
17
  export * from './border-style-types';
18
18
  export * from './color-type';
19
19
  export * from './common-hide-types';
20
- export * from './condition-type';
21
20
  export * from './copy-paste-type';
22
21
  export * from './developer-metadata-visibility';
23
22
  export * from './dimension';
@@ -14,6 +14,8 @@ export interface ICellRenderContext {
14
14
  }
15
15
  /**
16
16
  * @debt This shouldn't exist in core package.
17
+ *
18
+ * @deprecated This interface is subject to change in the future.
17
19
  */
18
20
  export interface ICellCustomRender {
19
21
  drawWith(ctx: CanvasRenderingContext2D, info: ICellRenderContext, skeleton: any, spreadsheets: any): void;
@@ -33,6 +33,10 @@ export interface ICellData {
33
33
  * Id of the formula.
34
34
  */
35
35
  si?: Nullable<string>;
36
+ /**
37
+ * User stored custom fields
38
+ */
39
+ custom?: Nullable<Record<string, any>>;
36
40
  }
37
41
  export interface ICellMarksStyle {
38
42
  color: string;
@@ -97,6 +97,9 @@ export interface IUnitRangeName {
97
97
  export interface IUnitRange extends IGridRange {
98
98
  unitId: string;
99
99
  }
100
+ export interface IUnitRangeWithName extends IUnitRange {
101
+ sheetName: string;
102
+ }
100
103
  /**
101
104
  * One of the range types,
102
105
  *
@@ -136,6 +136,12 @@ export interface IStyleBase {
136
136
  * (Subscript 下标 /Superscript上标 Text)
137
137
  */
138
138
  va?: Nullable<BaselineOffset>;
139
+ /**
140
+ * Numfmt pattern
141
+ */
142
+ n?: Nullable<{
143
+ pattern: string;
144
+ }>;
139
145
  }
140
146
  /**
141
147
  * Properties of cell style
@@ -1,6 +1,7 @@
1
1
  import { LocaleType } from '../enum';
2
2
  import { ILocales } from '../../shared/locale';
3
3
  import { IStyleSheet } from '../../services/theme/theme.service';
4
+ import { DependencyOverride } from '../../services/plugin/plugin-override';
4
5
  import { LogLevel } from '../../services/log/log.service';
5
6
 
6
7
  export interface IUniverData {
@@ -9,17 +10,5 @@ export interface IUniverData {
9
10
  locales: ILocales;
10
11
  logLevel: LogLevel;
11
12
  id: string;
12
- }
13
- /**
14
- * Toolbar Observer generic interface, convenient for plug-ins to define their own types
15
- */
16
- export interface UIObserver<T = string> {
17
- /**
18
- * fontSize, fontFamily,color...
19
- */
20
- name: string;
21
- /**
22
- * fontSize:number, fontFamily:string ...
23
- */
24
- value?: T;
13
+ override?: DependencyOverride;
25
14
  }
@@ -0,0 +1,43 @@
1
+ import { Plugin, PluginCtor } from './services/plugin/plugin';
2
+ import { UnitModel, UnitType } from './common/unit';
3
+ import { IDocumentData, ISlideData, IUniverData, IWorkbookData } from './types/interfaces';
4
+ import { LocaleType } from './types/enum/locale-type';
5
+ import { SlideDataModel } from './slides/slide-model';
6
+ import { Workbook } from './sheets/workbook';
7
+ import { DocumentDataModel } from './docs/data-model/document-data-model';
8
+ import { Injector } from '@wendellhu/redi';
9
+
10
+ export declare class Univer {
11
+ private _startedTypes;
12
+ private _injector;
13
+ private get _univerInstanceService();
14
+ private get _pluginService();
15
+ /**
16
+ * Create a Univer instance.
17
+ * @param config Configuration data for Univer
18
+ * @param parentInjector An optional parent injector of the Univer injector. For more information, see https://redi.wendell.fun/docs/hierarchy.
19
+ */
20
+ constructor(config?: Partial<IUniverData>, parentInjector?: Injector);
21
+ __getInjector(): Injector;
22
+ dispose(): void;
23
+ setLocale(locale: LocaleType): void;
24
+ createUnit<T, U extends UnitModel>(type: UnitType, data: Partial<T>): U;
25
+ /**
26
+ * Create a univer sheet instance with internal dependency injection.
27
+ *
28
+ * @deprecated use `createUnit` instead
29
+ */
30
+ createUniverSheet(data: Partial<IWorkbookData>): Workbook;
31
+ /**
32
+ * @deprecated use `createUnit` instead
33
+ */
34
+ createUniverDoc(data: Partial<IDocumentData>): DocumentDataModel;
35
+ /**
36
+ * @deprecated use `createUnit` instead
37
+ */
38
+ createUniverSlide(data: Partial<ISlideData>): SlideDataModel;
39
+ private _init;
40
+ private _tryProgressToReady;
41
+ /** Register a plugin into univer. */
42
+ registerPlugin<T extends PluginCtor<Plugin>>(plugin: T, config?: ConstructorParameters<T>[0]): void;
43
+ }