@univerjs/core 0.1.3 → 0.1.4

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.
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { Injector } from '@wendellhu/redi';
17
17
  import { LifecycleInitializerService, LifecycleService } from '../services/lifecycle/lifecycle.service';
18
- import { Slide } from '../slides/domain/slide-model';
18
+ import { SlideDataModel } from '../slides/domain/slide-model';
19
19
  import type { ISlideData } from '../types/interfaces/i-slide-data';
20
20
  import { PluginHolder } from './plugin-holder';
21
21
  /**
@@ -26,5 +26,5 @@ export declare class UniverSlide extends PluginHolder {
26
26
  protected readonly _lifecycleService: LifecycleService;
27
27
  protected readonly _lifecycleInitializerService: LifecycleInitializerService;
28
28
  constructor(_injector: Injector, _lifecycleService: LifecycleService, _lifecycleInitializerService: LifecycleInitializerService);
29
- createSlide(data: Partial<ISlideData>): Slide;
29
+ createSlide(data: Partial<ISlideData>): SlideDataModel;
30
30
  }
@@ -18,7 +18,7 @@ import type { DocumentDataModel } from '../docs/data-model/document-data-model';
18
18
  import type { Plugin, PluginCtor } from '../plugin/plugin';
19
19
  import { LifecycleInitializerService, LifecycleService } from '../services/lifecycle/lifecycle.service';
20
20
  import type { Workbook } from '../sheets/workbook';
21
- import type { Slide } from '../slides/domain/slide-model';
21
+ import type { SlideDataModel } from '../slides/domain/slide-model';
22
22
  import type { LocaleType } from '../types/enum/locale-type';
23
23
  import type { IDocumentData, ISlideData, IUniverData, IWorkbookData } from '../types/interfaces';
24
24
  import { PluginHolder } from './plugin-holder';
@@ -41,7 +41,7 @@ export declare class Univer extends PluginHolder {
41
41
  */
42
42
  createUniverSheet(config: Partial<IWorkbookData>): Workbook;
43
43
  createUniverDoc(config: Partial<IDocumentData>): DocumentDataModel;
44
- createUniverSlide(config: Partial<ISlideData>): Slide;
44
+ createUniverSlide(config: Partial<ISlideData>): SlideDataModel;
45
45
  private _initDependencies;
46
46
  /**
47
47
  * Initialize modules provided by Univer-type plugins.
@@ -49,7 +49,7 @@ export declare class Univer extends PluginHolder {
49
49
  private _tryProgressToStart;
50
50
  private _tryProgressToReady;
51
51
  /** Register a plugin into univer. */
52
- registerPlugin<T extends Plugin>(plugin: PluginCtor<T>, config?: any): void;
52
+ registerPlugin<T extends PluginCtor<Plugin>>(plugin: T, config?: ConstructorParameters<T>[0]): void;
53
53
  private _initLazyPluginsTimer?;
54
54
  private _scheduleInitPluginAfterStarted;
55
55
  private _flushLazyPlugins;
@@ -0,0 +1,18 @@
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
+ import { LocaleType } from '../../types/enum/locale-type';
17
+ import type { IDocumentData } from '../../types/interfaces';
18
+ export declare function getEmptySnapshot(unitID?: string, locale?: LocaleType, title?: string): IDocumentData;
@@ -58,7 +58,7 @@ export { Styles } from './sheets/styles';
58
58
  export { DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_COUNT_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT_KEY, DEFAULT_WORKSHEET_ROW_HEIGHT_KEY, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, mergeWorksheetSnapshotWithDefault, } from './sheets/sheet-snapshot-utils';
59
59
  export { SheetViewModel } from './sheets/view-model';
60
60
  export { getWorksheetUID, Workbook } from './sheets/workbook';
61
- export { Worksheet } from './sheets/worksheet';
61
+ export { Worksheet, extractPureTextFromCell } from './sheets/worksheet';
62
62
  export * from './slides/domain';
63
63
  export * from './types/const';
64
64
  export * from './types/enum';
@@ -22,4 +22,5 @@ export declare const EDITOR_ACTIVATED = "EDITOR_ACTIVATED";
22
22
  export declare const FOCUSING_EDITOR_INPUT_FORMULA = "FOCUSING_EDITOR_INPUT_FORMULA";
23
23
  export declare const FOCUSING_FORMULA_EDITOR = "FOCUSING_FORMULA_EDITOR";
24
24
  export declare const FOCUSING_UNIVER_EDITOR = "FOCUSING_UNIVER_EDITOR";
25
- export declare const FOCUSING_UNIVER_EDITOR_SINGLE_MODE = "FOCUSING_UNIVER_EDITOR_SINGLE_MODE";
25
+ export declare const FOCUSING_EDITOR_STANDALONE = "FOCUSING_EDITOR_INPUT_FORMULA";
26
+ export declare const FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE = "FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE";
@@ -18,7 +18,7 @@ import { DocumentDataModel } from '../../docs/data-model/document-data-model';
18
18
  import type { Nullable } from '../../shared';
19
19
  import { Disposable } from '../../shared/lifecycle';
20
20
  import { Workbook } from '../../sheets/workbook';
21
- import { Slide } from '../../slides/domain/slide-model';
21
+ import { SlideDataModel } from '../../slides/domain/slide-model';
22
22
  import type { IDocumentData, ISlideData, IWorkbookData } from '../../types/interfaces';
23
23
  import { IContextService } from '../context/context.service';
24
24
  export declare enum UniverInstanceType {
@@ -30,7 +30,7 @@ export declare enum UniverInstanceType {
30
30
  export interface IUniverHandler {
31
31
  createUniverDoc(data: Partial<IDocumentData>): DocumentDataModel;
32
32
  createUniverSheet(data: Partial<IWorkbookData>): Workbook;
33
- createUniverSlide(data: Partial<ISlideData>): Slide;
33
+ createUniverSlide(data: Partial<ISlideData>): SlideDataModel;
34
34
  }
35
35
  /**
36
36
  * IUniverInstanceService holds all the current univer instances. And it also manages
@@ -40,34 +40,34 @@ export interface IUniverInstanceService {
40
40
  focused$: Observable<Nullable<string>>;
41
41
  currentSheet$: Observable<Nullable<Workbook>>;
42
42
  currentDoc$: Observable<Nullable<DocumentDataModel>>;
43
- currentSlide$: Observable<Nullable<Slide>>;
43
+ currentSlide$: Observable<Nullable<SlideDataModel>>;
44
44
  sheetAdded$: Observable<Workbook>;
45
45
  docAdded$: Observable<DocumentDataModel>;
46
- slideAdded$: Observable<Slide>;
46
+ slideAdded$: Observable<SlideDataModel>;
47
47
  sheetDisposed$: Observable<Workbook>;
48
48
  docDisposed$: Observable<DocumentDataModel>;
49
- slideDisposed$: Observable<Slide>;
49
+ slideDisposed$: Observable<SlideDataModel>;
50
50
  focusUniverInstance(id: string | null): void;
51
- getFocusedUniverInstance(): Workbook | DocumentDataModel | Slide | null;
51
+ getFocusedUniverInstance(): Nullable<Workbook | DocumentDataModel | SlideDataModel>;
52
52
  createDoc(data: Partial<IDocumentData>): DocumentDataModel;
53
53
  createSheet(data: Partial<IWorkbookData>): Workbook;
54
- createSlide(data: Partial<ISlideData>): Slide;
54
+ createSlide(data: Partial<ISlideData>): SlideDataModel;
55
55
  changeDoc(unitId: string, doc: DocumentDataModel): void;
56
56
  addDoc(doc: DocumentDataModel): void;
57
57
  addSheet(sheet: Workbook): void;
58
- addSlide(slide: Slide): void;
58
+ addSlide(slide: SlideDataModel): void;
59
59
  getUniverSheetInstance(id: string): Nullable<Workbook>;
60
60
  getUniverDocInstance(id: string): Nullable<DocumentDataModel>;
61
- getUniverSlideInstance(id: string): Nullable<Slide>;
61
+ getUniverSlideInstance(id: string): Nullable<SlideDataModel>;
62
62
  getCurrentUniverSheetInstance(): Workbook;
63
63
  getCurrentUniverDocInstance(): DocumentDataModel;
64
- getCurrentUniverSlideInstance(): Slide;
64
+ getCurrentUniverSlideInstance(): SlideDataModel;
65
65
  setCurrentUniverSheetInstance(id: string): void;
66
66
  setCurrentUniverDocInstance(id: string): void;
67
67
  setCurrentUniverSlideInstance(id: string): void;
68
68
  getAllUniverSheetsInstance(): Workbook[];
69
69
  getAllUniverDocsInstance(): DocumentDataModel[];
70
- getAllUniverSlidesInstance(): Slide[];
70
+ getAllUniverSlidesInstance(): SlideDataModel[];
71
71
  getDocumentType(unitId: string): UniverInstanceType;
72
72
  disposeDocument(unitId: string): boolean;
73
73
  }
@@ -83,19 +83,19 @@ export declare class UniverInstanceService extends Disposable implements IUniver
83
83
  private readonly _currentDoc$;
84
84
  readonly currentDoc$: Observable<Nullable<DocumentDataModel>>;
85
85
  private readonly _currentSlide$;
86
- readonly currentSlide$: Observable<Nullable<Slide>>;
86
+ readonly currentSlide$: Observable<Nullable<SlideDataModel>>;
87
87
  private readonly _sheetAdded$;
88
88
  readonly sheetAdded$: Observable<Workbook>;
89
89
  private readonly _docAdded$;
90
90
  readonly docAdded$: Observable<DocumentDataModel>;
91
91
  private readonly _slideAdded$;
92
- readonly slideAdded$: Observable<Slide>;
92
+ readonly slideAdded$: Observable<SlideDataModel>;
93
93
  private readonly _sheetDisposed$;
94
94
  readonly sheetDisposed$: Observable<Workbook>;
95
95
  private readonly _docDisposed$;
96
96
  readonly docDisposed$: Observable<DocumentDataModel>;
97
97
  private readonly _slideDisposed$;
98
- readonly slideDisposed$: Observable<Slide>;
98
+ readonly slideDisposed$: Observable<SlideDataModel>;
99
99
  private readonly _sheets;
100
100
  private readonly _docs;
101
101
  private readonly _slides;
@@ -103,25 +103,25 @@ export declare class UniverInstanceService extends Disposable implements IUniver
103
103
  dispose(): void;
104
104
  createDoc(data: Partial<IDocumentData>): DocumentDataModel;
105
105
  createSheet(data: Partial<IWorkbookData>): Workbook;
106
- createSlide(data: Partial<ISlideData>): Slide;
106
+ createSlide(data: Partial<ISlideData>): SlideDataModel;
107
107
  addSheet(sheet: Workbook): void;
108
108
  changeDoc(unitId: string, doc: DocumentDataModel): void;
109
109
  addDoc(doc: DocumentDataModel): void;
110
- addSlide(slide: Slide): void;
110
+ addSlide(slide: SlideDataModel): void;
111
111
  getUniverSheetInstance(id: string): Nullable<Workbook>;
112
112
  getUniverDocInstance(id: string): Nullable<DocumentDataModel>;
113
- getUniverSlideInstance(id: string): Nullable<Slide>;
113
+ getUniverSlideInstance(id: string): Nullable<SlideDataModel>;
114
114
  getAllUniverSheetsInstance(): Workbook[];
115
115
  getAllUniverDocsInstance(): DocumentDataModel[];
116
- getAllUniverSlidesInstance(): Slide[];
116
+ getAllUniverSlidesInstance(): SlideDataModel[];
117
117
  setCurrentUniverSheetInstance(id: string): void;
118
118
  setCurrentUniverSlideInstance(id: string): void;
119
119
  setCurrentUniverDocInstance(id: string): void;
120
120
  getCurrentUniverSheetInstance(): Workbook;
121
121
  getCurrentUniverDocInstance(): DocumentDataModel;
122
- getCurrentUniverSlideInstance(): Slide;
122
+ getCurrentUniverSlideInstance(): SlideDataModel;
123
123
  focusUniverInstance(id: string | null): void;
124
- getFocusedUniverInstance(): Workbook | DocumentDataModel | Slide | null;
124
+ getFocusedUniverInstance(): Nullable<Workbook | DocumentDataModel | SlideDataModel>;
125
125
  getDocumentType(unitId: string): UniverInstanceType;
126
126
  disposeDocument(unitId: string): boolean;
127
127
  }
@@ -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 {};
@@ -212,4 +212,4 @@ export interface ICell {
212
212
  * @param cell
213
213
  * @returns pure text in this cell
214
214
  */
215
- export declare function extractPureTextFromCell(cell: ICellData): Nullable<string>;
215
+ export declare function extractPureTextFromCell(cell: ICellData): string;
@@ -14,10 +14,12 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { ISlideData, ISlidePage } from '../../types/interfaces';
17
- export declare class Slide {
17
+ export declare class SlideDataModel {
18
18
  private _snapshot;
19
19
  private _unitId;
20
20
  constructor(snapshot: Partial<ISlideData>);
21
+ getContainer(): string | undefined;
22
+ getParentRenderUnitId(): string | undefined;
21
23
  getSnapshot(): ISlideData;
22
24
  getUnitId(): string;
23
25
  getPages(): {
@@ -35,6 +35,7 @@ export interface IDocumentData extends IReferenceSource, IExtraModelData {
35
35
  name: string;
36
36
  data: string;
37
37
  }>;
38
+ disabled?: boolean;
38
39
  }
39
40
  export interface IReferenceSource {
40
41
  footers?: IFooters;
@@ -18,12 +18,13 @@ import type { IKeyType, Nullable } from '../../shared/types';
18
18
  import type { LocaleType, ThemeColorType } from '../enum';
19
19
  import type { ShapeType } from '../enum/shape-type';
20
20
  import type { ICustomBlock, IDocumentData, ILists } from './i-document-data';
21
+ import type { IExtraModelData } from './i-extra-model-data';
21
22
  import type { IImageProperties } from './i-image-properties';
22
23
  import type { IPlaceholder } from './i-placeholder';
23
24
  import type { IShapeProperties } from './i-shape-properties';
24
25
  import type { IColorStyle, IStyleBase, IStyleData } from './i-style-data';
25
26
  import type { IWorksheetData } from './i-worksheet-data';
26
- export interface ISlideData extends IReferenceSource {
27
+ export interface ISlideData extends IReferenceSource, IExtraModelData {
27
28
  id: string;
28
29
  locale?: LocaleType;
29
30
  title: string;