@univerjs/core 0.1.0-beta.3 → 0.1.0-beta.5

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 (26) hide show
  1. package/lib/cjs/index.js +4 -4
  2. package/lib/es/index.js +1876 -1715
  3. package/lib/types/basics/registry.d.ts +5 -5
  4. package/lib/types/docs/data-model/__tests__/common.spec.d.ts +16 -0
  5. package/lib/types/docs/data-model/{mutation-types.d.ts → action-types.d.ts} +8 -3
  6. package/lib/types/docs/data-model/document-data-model.d.ts +2 -2
  7. package/lib/types/docs/data-model/text-x/__tests__/action-iterator.spec.d.ts +16 -0
  8. package/lib/types/docs/data-model/text-x/__tests__/compose.spec.d.ts +16 -0
  9. package/lib/types/docs/data-model/text-x/__tests__/utils.spec.d.ts +16 -0
  10. package/lib/types/docs/data-model/text-x/action-iterator.d.ts +29 -0
  11. package/lib/types/docs/data-model/text-x/text-x.d.ts +2 -1
  12. package/lib/types/docs/data-model/text-x/utils.d.ts +21 -0
  13. package/lib/types/index.d.ts +5 -2
  14. package/lib/types/services/locale/__tests__/locale.service.spec.d.ts +16 -0
  15. package/lib/types/services/locale/locale.service.d.ts +26 -5
  16. package/lib/types/services/undoredo/undoredo.service.d.ts +16 -14
  17. package/lib/types/sheets/range.d.ts +1 -1
  18. package/lib/types/sheets/sheet-snapshot-utils.d.ts +36 -0
  19. package/lib/types/sheets/workbook.d.ts +16 -12
  20. package/lib/types/sheets/worksheet.d.ts +12 -26
  21. package/lib/types/types/const/const.d.ts +3 -13
  22. package/lib/types/types/interfaces/i-document-data.d.ts +5 -0
  23. package/lib/types/types/interfaces/i-style-data.d.ts +1 -1
  24. package/lib/types/types/interfaces/i-worksheet-data.d.ts +11 -21
  25. package/lib/umd/index.js +4 -4
  26. package/package.json +24 -16
@@ -13,12 +13,12 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare class Registry {
16
+ export declare class Registry<T = any> {
17
17
  private _data;
18
- static create(): Registry;
19
- add(dataInstance: any): void;
20
- delete(dataInstance: any): void;
21
- getData(): any[];
18
+ static create<T = any>(): Registry<T>;
19
+ add(dataInstance: T): void;
20
+ delete(dataInstance: T): void;
21
+ getData(): T[];
22
22
  }
23
23
  /**
24
24
  * Add extension modules statically when the plugin is initialized, so that the plugin can register these extension modules uniformly
@@ -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 {};
@@ -15,11 +15,16 @@
15
15
  */
16
16
  import type { UpdateDocsAttributeType } from '../../shared/command-enum';
17
17
  import type { IDocumentBody } from '../../types/interfaces/i-document-data';
18
+ export declare enum TextXActionType {
19
+ RETAIN = "r",
20
+ INSERT = "i",
21
+ DELETE = "d"
22
+ }
18
23
  /**
19
24
  * Retain mutation is used to move the cursor or to update properties of the text in the given range.
20
25
  */
21
26
  export interface IRetainAction {
22
- t: 'r';
27
+ t: TextXActionType.RETAIN;
23
28
  len: number;
24
29
  body?: IDocumentBody;
25
30
  coverType?: UpdateDocsAttributeType;
@@ -29,7 +34,7 @@ export interface IRetainAction {
29
34
  * Insert mutation is used to insert text (maybe with rich text properties) at the given position.
30
35
  */
31
36
  export interface IInsertAction {
32
- t: 'i';
37
+ t: TextXActionType.INSERT;
33
38
  body: IDocumentBody;
34
39
  len: number;
35
40
  line: number;
@@ -39,7 +44,7 @@ export interface IInsertAction {
39
44
  * Delete mutation is used to delete text at the given position.
40
45
  */
41
46
  export interface IDeleteAction {
42
- t: 'd';
47
+ t: TextXActionType.DELETE;
43
48
  len: number;
44
49
  line: number;
45
50
  segmentId?: string;
@@ -16,7 +16,7 @@
16
16
  import type { Nullable } from '../../shared';
17
17
  import type { IDocumentBody, IDocumentData, IDocumentRenderConfig } from '../../types/interfaces/i-document-data';
18
18
  import type { IPaddingData } from '../../types/interfaces/i-style-data';
19
- import type { TextXAction } from './mutation-types';
19
+ import { type TextXAction } from './action-types';
20
20
  export declare const DEFAULT_DOC: {
21
21
  id: string;
22
22
  documentStyle: {};
@@ -62,7 +62,7 @@ export declare class DocumentDataModel extends DocumentDataModelSimple {
62
62
  reset(snapshot: Partial<IDocumentData>): void;
63
63
  getSelfOrHeaderFooterModel(segmentId?: string): DocumentDataModel;
64
64
  getUnitId(): string;
65
- apply(mutations: TextXAction[]): TextXAction[];
65
+ apply(actions: TextXAction[]): TextXAction[];
66
66
  sliceBody(startOffset: number, endOffset: number): Nullable<IDocumentBody>;
67
67
  private _updateApply;
68
68
  private _deleteApply;
@@ -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,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,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,29 @@
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 type { TextXAction } from '../action-types';
17
+ import { TextXActionType } from '../action-types';
18
+ export declare class ActionIterator {
19
+ private _actions;
20
+ private _index;
21
+ private _offset;
22
+ constructor(_actions: TextXAction[]);
23
+ hasNext(): boolean;
24
+ next(length?: number): TextXAction;
25
+ peek(): TextXAction;
26
+ peekLength(): number;
27
+ peekType(): TextXActionType;
28
+ rest(): TextXAction[];
29
+ }
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import type { UpdateDocsAttributeType } from '../../../shared/command-enum';
17
17
  import type { IDocumentBody } from '../../../types/interfaces/i-document-data';
18
- import type { TextXAction } from '../mutation-types';
18
+ import { type TextXAction } from '../action-types';
19
19
  export declare class TextX {
20
20
  static compose(thisActions: TextXAction[], otherActions: TextXAction[]): TextXAction[];
21
21
  private _actions;
@@ -24,4 +24,5 @@ export declare class TextX {
24
24
  delete(len: number, segmentId: string): this;
25
25
  serialize(): TextXAction[];
26
26
  push(...args: TextXAction[]): this;
27
+ trimEndUselessRetainAction(): this;
27
28
  }
@@ -0,0 +1,21 @@
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 { UpdateDocsAttributeType } from '../../../shared/command-enum';
17
+ import type { IDocumentBody } from '../../../types/interfaces/i-document-data';
18
+ import type { IRetainAction } from '../action-types';
19
+ export declare function getBodySlice(body: IDocumentBody, startOffset: number, endOffset: number): IDocumentBody;
20
+ export declare function composeBody(thisBody: IDocumentBody, otherBody: IDocumentBody, coverType?: UpdateDocsAttributeType): IDocumentBody;
21
+ export declare function isUselessRetainAction(action: IRetainAction): boolean;
@@ -21,7 +21,9 @@ export { MemoryCursor } from './common/memory-cursor';
21
21
  export { requestImmediateMacroTask } from './common/request-immediate-macro-task';
22
22
  export { type ISequenceExecuteResult, sequence, sequenceAsync } from './common/sequence';
23
23
  export * from './docs/data-model';
24
- export { type TextXAction, type IDeleteAction, type IInsertAction, type IRetainAction, } from './docs/data-model/mutation-types';
24
+ export { TextXActionType, type TextXAction, type IDeleteAction, type IInsertAction, type IRetainAction, } from './docs/data-model/action-types';
25
+ export { ActionIterator } from './docs/data-model/text-x/action-iterator';
26
+ export { getBodySlice, composeBody } from './docs/data-model/text-x/utils';
25
27
  export { TextX } from './docs/data-model/text-x/text-x';
26
28
  export * from './observer';
27
29
  export { Plugin, PluginType } from './plugin/plugin';
@@ -43,7 +45,7 @@ export { ResourceManagerService } from './services/resource-manager/resource-man
43
45
  export type { IResourceHook } from './services/resource-manager/type';
44
46
  export { IResourceManagerService, ISnapshotPersistenceService } from './services/resource-manager/type';
45
47
  export { type IStyleSheet, ThemeService } from './services/theme/theme.service';
46
- export { type IUndoRedoCommandInfos, type IUndoRedoItem, IUndoRedoService, type IUndoRedoStatus, LocalUndoRedoService, RedoCommand, UndoCommand, } from './services/undoredo/undoredo.service';
48
+ export { type IUndoRedoCommandInfos, type IUndoRedoItem, IUndoRedoService, type IUndoRedoStatus, LocalUndoRedoService, RedoCommand, UndoCommand, RedoCommandId, UndoCommandId, } from './services/undoredo/undoredo.service';
47
49
  export * from './shared';
48
50
  export type { IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';
49
51
  export { composeInterceptors, createInterceptorKey, InterceptorManager } from './common/interceptor';
@@ -51,6 +53,7 @@ export { normalizeTextRuns } from './docs/data-model/apply-utils/common';
51
53
  export type { PluginCtor } from './plugin/plugin';
52
54
  export { Range } from './sheets/range';
53
55
  export { Styles } from './sheets/styles';
56
+ 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';
54
57
  export { SheetViewModel } from './sheets/view-model';
55
58
  export { getWorksheetUID, Workbook } from './sheets/workbook';
56
59
  export { Worksheet } from './sheets/worksheet';
@@ -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 {};
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { Subject } from 'rxjs';
17
17
  import { Disposable } from '../../shared/lifecycle';
18
- import type { ILocales } from '../../shared/locale';
18
+ import type { ILanguagePack, ILocales } from '../../shared/locale';
19
19
  import { LocaleType } from '../../types/enum/locale-type';
20
20
  /**
21
21
  * This service provides i18n and timezone / location features to other modules.
@@ -29,12 +29,33 @@ export declare class LocaleService extends Disposable {
29
29
  * Load more locales after init
30
30
  *
31
31
  * @param locales - Locale object
32
- * @returns void
33
32
  *
34
33
  */
35
34
  load(locales: ILocales): void;
36
- t: (key: string) => string;
35
+ /**
36
+ * Translate a key to the current locale
37
+ * @param {string} key the key to translate
38
+ * @param {string[]} args optional arguments to replace in the translated string
39
+ * @returns {string} the translated string
40
+ * @example
41
+ * const locales = {
42
+ * [LocaleType.EN_US]: {
43
+ * foo: {
44
+ * bar: 'Hello'
45
+ * }
46
+ * }
47
+ * t('foo.bar') => 'Hello'
48
+ *
49
+ * @example
50
+ * const locales = {
51
+ * [LocaleType.EN_US]: {
52
+ * foo: {
53
+ * bar: 'Hello {0}'
54
+ * }
55
+ * }
56
+ * t('foo.bar', 'World') => 'Hello World'
57
+ */
58
+ t: (key: string, ...args: string[]) => string;
37
59
  setLocale(locale: LocaleType): void;
38
- getLocales(): import("../../shared/locale").ILanguagePack | undefined;
39
- getCurrentLocale(): LocaleType;
60
+ getLocales(): ILanguagePack | undefined;
40
61
  }
@@ -47,6 +47,22 @@ export interface IUndoRedoStatus {
47
47
  undos: number;
48
48
  redos: number;
49
49
  }
50
+ export declare const RedoCommandId = "univer.command.redo";
51
+ export declare const UndoCommandId = "univer.command.undo";
52
+ export declare const UndoCommand: {
53
+ readonly type: CommandType.COMMAND;
54
+ readonly id: "univer.command.undo";
55
+ handler(accessor: IAccessor): Promise<boolean>;
56
+ dispose(): void;
57
+ dispatchToHandlers(): Promise<boolean>;
58
+ };
59
+ export declare const RedoCommand: {
60
+ readonly type: CommandType.COMMAND;
61
+ readonly id: "univer.command.redo";
62
+ handler(accessor: IAccessor): Promise<boolean>;
63
+ dispose(): void;
64
+ dispatchToHandlers(): Promise<boolean>;
65
+ };
50
66
  /**
51
67
  * This UndoRedoService is local.
52
68
  */
@@ -77,17 +93,3 @@ export declare class LocalUndoRedoService extends Disposable implements IUndoRed
77
93
  protected _getRedoStackForFocused(): IUndoRedoItem[];
78
94
  private _getFocusedUniverInstanceId;
79
95
  }
80
- export declare const UndoCommand: {
81
- readonly type: CommandType.COMMAND;
82
- readonly id: "univer.command.undo";
83
- handler(accessor: IAccessor): Promise<boolean>;
84
- dispose(): void;
85
- dispatchToHandlers(): Promise<boolean>;
86
- };
87
- export declare const RedoCommand: {
88
- readonly type: CommandType.COMMAND;
89
- readonly id: "univer.command.redo";
90
- handler(accessor: IAccessor): Promise<boolean>;
91
- dispose(): void;
92
- dispatchToHandlers(): Promise<boolean>;
93
- };
@@ -200,7 +200,7 @@ export declare class Range {
200
200
  /**
201
201
  * Returns the font weights of the cells in the range.
202
202
  */
203
- private getFontWeights;
203
+ private _getFontWeights;
204
204
  /**
205
205
  * Returns the grid ID of the range's parent sheet.
206
206
  */
@@ -0,0 +1,36 @@
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 type { IWorksheetData } from '../types/interfaces/i-worksheet-data';
17
+ export declare const DEFAULT_WORKSHEET_ROW_COUNT_KEY = "DEFAULT_WORKSHEET_ROW_COUNT";
18
+ export declare const DEFAULT_WORKSHEET_ROW_COUNT = 1000;
19
+ export declare const DEFAULT_WORKSHEET_COLUMN_COUNT_KEY = "DEFAULT_WORKSHEET_COLUMN_COUNT";
20
+ export declare const DEFAULT_WORKSHEET_COLUMN_COUNT = 20;
21
+ export declare const DEFAULT_WORKSHEET_ROW_HEIGHT_KEY = "DEFAULT_WORKSHEET_ROW_HEIGHT";
22
+ export declare const DEFAULT_WORKSHEET_ROW_HEIGHT = 19;
23
+ export declare const DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY = "DEFAULT_WORKSHEET_COLUMN_WIDTH";
24
+ export declare const DEFAULT_WORKSHEET_COLUMN_WIDTH = 73;
25
+ export declare const DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY = "DEFAULT_WORKSHEET_ROW_TITLE_WIDTH";
26
+ export declare const DEFAULT_WORKSHEET_ROW_TITLE_WIDTH = 46;
27
+ export declare const DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY = "DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT";
28
+ export declare const DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT = 20;
29
+ /**
30
+ * This function is used to merge the user passed in snapshot with the default snapshot
31
+ * without changing the user's snapshot's reference.
32
+ *
33
+ * @param snapshot user passed in snapshot
34
+ * @returns merged snapshot
35
+ */
36
+ export declare function mergeWorksheetSnapshotWithDefault(snapshot: Partial<IWorksheetData>): IWorksheetData;
@@ -24,12 +24,13 @@ export declare function getWorksheetUID(workbook: Workbook, worksheet: Worksheet
24
24
  * Access and create Univer Sheets files
25
25
  */
26
26
  export declare class Workbook extends Disposable {
27
- private readonly _log;
27
+ private readonly _logService;
28
28
  private readonly _sheetCreated$;
29
29
  readonly sheetCreated$: import("rxjs").Observable<Worksheet>;
30
30
  private readonly _sheetDisposed$;
31
31
  readonly sheetDisposed$: import("rxjs").Observable<Worksheet>;
32
32
  private readonly _activeSheet$;
33
+ private get _activeSheet();
33
34
  readonly activeSheet$: import("rxjs").Observable<Nullable<Worksheet>>;
34
35
  /**
35
36
  * sheets list
@@ -49,10 +50,10 @@ export declare class Workbook extends Disposable {
49
50
  private _unitId;
50
51
  private _count;
51
52
  get name(): string;
52
- constructor(workbookData: Partial<IWorkbookData> | undefined, _log: ILogService);
53
+ constructor(workbookData: Partial<IWorkbookData> | undefined, _logService: ILogService);
53
54
  dispose(): void;
54
55
  save(): IWorkbookData;
55
- static isIRangeType(range: IRangeType | IRangeType[]): Boolean;
56
+ static isIRangeType(range: IRangeType | IRangeType[]): boolean;
56
57
  getSnapshot(): IWorkbookData;
57
58
  getName(): string;
58
59
  getUnitId(): string;
@@ -70,17 +71,20 @@ export declare class Workbook extends Disposable {
70
71
  getStyles(): Styles;
71
72
  getConfig(): IWorkbookData;
72
73
  getIndexBySheetId(sheetId: string): number;
73
- getRawActiveSheet(): Nullable<string>;
74
- getActiveSheet(): Worksheet;
75
- __setActiveSheet(worksheet: Worksheet): void;
76
- getActiveSheetIndex(): number;
77
- getSheetSize(): number;
78
74
  /**
79
- * Applies all pending Sheets changes.
80
75
  *
81
- * @returns void
76
+ * @returns
82
77
  */
83
- flush(): void;
78
+ getRawActiveSheet(): Nullable<Worksheet>;
79
+ /**
80
+ * Get the active sheet. If there is no active sheet, the first sheet would
81
+ * be set active.
82
+ */
83
+ getActiveSheet(): Worksheet;
84
+ setActiveSheet(worksheet: Nullable<Worksheet>): void;
85
+ removeSheet(sheetId: string): boolean;
86
+ getActiveSheetIndex(): number;
87
+ getSheetSize(): number;
84
88
  getSheets(): Worksheet[];
85
89
  getSheetsName(): string[];
86
90
  getSheetIndex(sheet: Worksheet): number;
@@ -156,5 +160,5 @@ export declare class Workbook extends Disposable {
156
160
  /**
157
161
  * Get Default Sheet
158
162
  */
159
- private _getDefaultWorkSheet;
163
+ private _passWorksheetSnapshots;
160
164
  }
@@ -15,8 +15,7 @@
15
15
  */
16
16
  import type { Nullable } from '../shared';
17
17
  import { ObjectMatrix } from '../shared';
18
- import type { SheetTypes } from '../types/enum';
19
- import { BooleanNumber } from '../types/enum';
18
+ import type { BooleanNumber } from '../types/enum';
20
19
  import type { ICellData, ICellDataForSheetInterceptor, IFreeze, IRange, IWorksheetData } from '../types/interfaces';
21
20
  import { ColumnManager } from './column-manager';
22
21
  import { Range } from './range';
@@ -47,6 +46,16 @@ export declare class Worksheet {
47
46
  * @returns
48
47
  */
49
48
  getCellMatrix(): ObjectMatrix<Nullable<ICellData>>;
49
+ /**
50
+ * Get worksheet printable cell range.
51
+ * @returns
52
+ */
53
+ getCellMatrixPrintRange(): {
54
+ startColumn: number;
55
+ startRow: number;
56
+ endColumn: number;
57
+ endRow: number;
58
+ } | null;
50
59
  /**
51
60
  * Returns Row Manager
52
61
  * @returns Row Manager
@@ -97,11 +106,6 @@ export declare class Worksheet {
97
106
  getRange(range: IRange): Range;
98
107
  getRange(startRow: number, startColumn: number): Range;
99
108
  getRange(startRow: number, startColumn: number, endRow: number, endColumn: number): Range;
100
- /**
101
- * Returns WorkSheet Status
102
- * @returns WorkSheet Status
103
- */
104
- getStatus(): BooleanNumber;
105
109
  /**
106
110
  * Return WorkSheetZoomRatio
107
111
  * @return zoomRatio
@@ -127,11 +131,6 @@ export declare class Worksheet {
127
131
  * @returns the current number of rows in the sheet, regardless of content
128
132
  */
129
133
  getMaxRows(): number;
130
- /**
131
- * Returns the type of the sheet.
132
- * @returns the type of the sheet
133
- */
134
- getType(): SheetTypes;
135
134
  getRowCount(): number;
136
135
  setRowCount(count: number): void;
137
136
  getColumnCount(): number;
@@ -145,7 +144,7 @@ export declare class Worksheet {
145
144
  * Returns true if the sheet's gridlines are hidden; otherwise returns false. Gridlines are visible by default.
146
145
  * @returns Gridlines Hidden Status
147
146
  */
148
- hasHiddenGridlines(): Boolean;
147
+ hasHiddenGridlines(): boolean;
149
148
  /**
150
149
  * Gets the sheet tab color, or null if the sheet tab has no color.
151
150
  * @returns the sheet tab color or null
@@ -182,19 +181,6 @@ export declare class Worksheet {
182
181
  * @returns true if this sheet layout is right-to-left. Returns false if the sheet uses the default left-to-right layout.
183
182
  */
184
183
  isRightToLeft(): BooleanNumber;
185
- /**
186
- * @typeParam T - plugin data structure
187
- * @param name - plugin name
188
- * @returns information stored by the plugin
189
- */
190
- getPluginMeta<T>(name: string): T;
191
- /**
192
- * @typeParam T - plugin data structure
193
- * @param name - plugin name
194
- * @param value - plugin value
195
- * @returns
196
- */
197
- setPluginMeta<T>(name: string, value: T): void;
198
184
  /**
199
185
  * Returns the position of the last row that has content.
200
186
  * @returns the position of the last row that has content.
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { BooleanNumber, HorizontalAlign, TextDirection, VerticalAlign, WrapStrategy } from '../enum';
17
- import type { IWorkbookData, IWorksheetData } from '../interfaces';
17
+ import type { IWorkbookData } from '../interfaces';
18
18
  /**
19
19
  * Used as an illegal range array return value
20
20
  */
@@ -56,18 +56,8 @@ export declare const DEFAULT_CELL: {
56
56
  * Used as an init workbook return value
57
57
  */
58
58
  export declare const DEFAULT_WORKBOOK: IWorkbookData;
59
- export declare const DEFAULT_WORKSHEET_ROW_COUNT = 1000;
60
- export declare const DEFAULT_WORKSHEET_COLUMN_COUNT = 20;
61
- export declare const DEFAULT_WORKSHEET_ROW_HEIGHT = 19;
62
- export declare const DEFAULT_WORKSHEET_COLUMN_WIDTH = 73;
63
- export declare const DEFAULT_WORKSHEET_ROW_TITLE_WIDTH = 46;
64
- export declare const DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT = 20;
65
59
  /**
66
- * Used as an init worksheet return value
67
- */
68
- export declare const DEFAULT_WORKSHEET: IWorksheetData;
69
- /**
70
- * Default styles
60
+ * Default styles.
71
61
  */
72
62
  export declare const DEFAULT_STYLES: {
73
63
  /**
@@ -119,7 +109,7 @@ export declare const DEFAULT_STYLES: {
119
109
  */
120
110
  v: BooleanNumber;
121
111
  };
122
- /** *
112
+ /**
123
113
  * textDirection
124
114
  */
125
115
  td: TextDirection;
@@ -30,6 +30,11 @@ export interface IDocumentData extends IReferenceSource, IExtraModelData {
30
30
  body?: IDocumentBody;
31
31
  documentStyle: IDocumentStyle;
32
32
  settings?: IDocumentSettings;
33
+ resources?: Array<{
34
+ id?: string;
35
+ name: string;
36
+ data: string;
37
+ }>;
33
38
  }
34
39
  export interface IReferenceSource {
35
40
  footers?: IFooters;
@@ -159,7 +159,7 @@ export interface IStyleData extends IStyleBase {
159
159
  * textRotation
160
160
  */
161
161
  tr?: Nullable<ITextRotation>;
162
- /** *
162
+ /**
163
163
  * textDirection
164
164
  */
165
165
  td?: Nullable<TextDirection>;