@univerjs/core 0.1.0-beta.4 → 0.1.1

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.
@@ -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
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { Nullable } from '../../shared';
17
- import type { IDocumentBody, IDocumentData, IDocumentRenderConfig } from '../../types/interfaces/i-document-data';
17
+ import type { IDocumentBody, IDocumentData, IDocumentRenderConfig, IDocumentStyle } from '../../types/interfaces/i-document-data';
18
18
  import type { IPaddingData } from '../../types/interfaces/i-style-data';
19
19
  import { type TextXAction } from './action-types';
20
20
  export declare const DEFAULT_DOC: {
@@ -31,7 +31,7 @@ declare class DocumentDataModelSimple {
31
31
  snapshot: IDocumentData;
32
32
  constructor(snapshot: Partial<IDocumentData>);
33
33
  get drawings(): import("../../types/interfaces/i-document-data").IDrawings | undefined;
34
- get documentStyle(): import("../../types/interfaces/i-document-data").IDocumentStyle;
34
+ get documentStyle(): IDocumentStyle;
35
35
  get lists(): import("../../types/interfaces/i-document-data").ILists | undefined;
36
36
  /**
37
37
  * @deprecated use getBody to instead.
@@ -45,6 +45,7 @@ declare class DocumentDataModelSimple {
45
45
  getSnapshot(): IDocumentData;
46
46
  updateDocumentId(unitId: string): void;
47
47
  updateDocumentRenderConfig(config: IDocumentRenderConfig): void;
48
+ updateDocumentStyle(config: IDocumentStyle): void;
48
49
  updateDocumentDataMargin(data: IPaddingData): void;
49
50
  updateDocumentDataPageSize(width?: number, height?: number): void;
50
51
  updateDrawing(id: string, config: IDrawingUpdateConfig): void;
@@ -45,7 +45,7 @@ export { ResourceManagerService } from './services/resource-manager/resource-man
45
45
  export type { IResourceHook } from './services/resource-manager/type';
46
46
  export { IResourceManagerService, ISnapshotPersistenceService } from './services/resource-manager/type';
47
47
  export { type IStyleSheet, ThemeService } from './services/theme/theme.service';
48
- 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';
49
49
  export * from './shared';
50
50
  export type { IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';
51
51
  export { composeInterceptors, createInterceptorKey, InterceptorManager } from './common/interceptor';
@@ -53,6 +53,7 @@ export { normalizeTextRuns } from './docs/data-model/apply-utils/common';
53
53
  export type { PluginCtor } from './plugin/plugin';
54
54
  export { Range } from './sheets/range';
55
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';
56
57
  export { SheetViewModel } from './sheets/view-model';
57
58
  export { getWorksheetUID, Workbook } from './sheets/workbook';
58
59
  export { Worksheet } from './sheets/worksheet';
@@ -17,7 +17,7 @@ import type { Ctor, DependencyIdentifier } from '@wendellhu/redi';
17
17
  /**
18
18
  * This enum defines multiple lifecycle stages in Univer SDK.
19
19
  */
20
- export declare const enum LifecycleStages {
20
+ export declare enum LifecycleStages {
21
21
  /**
22
22
  * Register plugins to Univer.
23
23
  */
@@ -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
- };
@@ -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 {};
@@ -17,7 +17,7 @@ import type { IObjectMatrixPrimitiveType, Nullable } from '../shared';
17
17
  import { ObjectMatrix } from '../shared';
18
18
  import type { HorizontalAlign, VerticalAlign, WrapStrategy } from '../types/enum';
19
19
  import { BooleanNumber, FontItalic, FontWeight } from '../types/enum';
20
- import type { IBorderData, ICellData, IDocumentData, IRange, IStyleData, ITextDecoration, ITextRotation } from '../types/interfaces';
20
+ import type { IBorderData, ICellData, IDocumentBody, IDocumentData, IRange, IStyleBase, IStyleData, ITextDecoration, ITextRotation } from '../types/interfaces';
21
21
  import type { Styles } from './styles';
22
22
  import type { Worksheet } from './worksheet';
23
23
  /**
@@ -32,6 +32,7 @@ interface IValueOptionsType {
32
32
  export interface IRangeDependencies {
33
33
  getStyles(): Readonly<Styles>;
34
34
  }
35
+ export declare function isAllFormatInTextRuns(key: keyof IStyleBase, body: IDocumentBody): BooleanNumber;
35
36
  /**
36
37
  * Access and modify spreadsheet ranges.
37
38
  *
@@ -189,7 +190,7 @@ export declare class Range {
189
190
  /**
190
191
  * Returns the font styles of the cells in the range.
191
192
  */
192
- private getFontStyles;
193
+ private _getFontStyles;
193
194
  /**
194
195
  * Returns the font weight (normal/bold) of the cell in the top-left corner of the range.
195
196
  * If the cell has rich text, the return value according to the textRuns of the rich text,
@@ -200,7 +201,7 @@ export declare class Range {
200
201
  /**
201
202
  * Returns the font weights of the cells in the range.
202
203
  */
203
- private getFontWeights;
204
+ private _getFontWeights;
204
205
  /**
205
206
  * Returns the grid ID of the range's parent sheet.
206
207
  */
@@ -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;
@@ -54,4 +54,5 @@ export interface ITextRange extends ITextRangeStart {
54
54
  }
55
55
  export interface ITextRangeParam extends ITextRange {
56
56
  segmentId?: string;
57
+ isActive?: boolean;
57
58
  }
@@ -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>;
@@ -14,27 +14,25 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { IObjectArrayPrimitiveType, IObjectMatrixPrimitiveType } from '../../shared/object-matrix';
17
- import type { IKeyValue } from '../../shared/types';
18
- import type { BooleanNumber, SheetTypes } from '../enum';
17
+ import type { BooleanNumber } from '../enum';
19
18
  import type { ICellData } from './i-cell-data';
20
19
  import type { IColumnData } from './i-column-data';
21
20
  import type { IFreeze } from './i-freeze';
22
21
  import type { IRange, IRangeType } from './i-range';
23
22
  import type { IRowData } from './i-row-data';
24
23
  /**
25
- * Properties of a worksheet's configuration
26
- *
27
- * TODO: 考虑将非通用配置,抽离到插件
28
- *
29
- * 比如 showGridlines 是sheet特有的,而如果实现如普通表格,就不需要 showGridlines
24
+ * Snapshot of a worksheet.
30
25
  */
31
26
  export interface IWorksheetData {
32
- type: SheetTypes;
27
+ /**
28
+ * Id of the worksheet. This should be unique and immutable across the lifecycle of the worksheet.
29
+ */
33
30
  id: string;
31
+ /** Name of the sheet. */
34
32
  name: string;
35
33
  tabColor: string;
36
34
  /**
37
- * Determine whether the sheet is hidden
35
+ * Determine whether the sheet is hidden.
38
36
  *
39
37
  * @remarks
40
38
  * See {@link BooleanNumber| the BooleanNumber enum} for more details.
@@ -43,9 +41,6 @@ export interface IWorksheetData {
43
41
  */
44
42
  hidden: BooleanNumber;
45
43
  freeze: IFreeze;
46
- /**
47
- * row and column count in worksheet, not like excel, it is unlimited
48
- */
49
44
  rowCount: number;
50
45
  columnCount: number;
51
46
  zoomRatio: number;
@@ -53,18 +48,12 @@ export interface IWorksheetData {
53
48
  scrollLeft: number;
54
49
  defaultColumnWidth: number;
55
50
  defaultRowHeight: number;
51
+ /** All merged cells in this worksheet. */
56
52
  mergeData: IRange[];
57
- hideRow: [];
58
- hideColumn: [];
59
- /**
60
- * If the worksheet is the active one.
61
- * @deprecated this should be removed
62
- */
63
- status: BooleanNumber;
53
+ /** A matrix storing cell contents by row and column index. */
64
54
  cellData: IObjectMatrixPrimitiveType<ICellData>;
65
55
  rowData: IObjectArrayPrimitiveType<Partial<IRowData>>;
66
56
  columnData: IObjectArrayPrimitiveType<Partial<IColumnData>>;
67
- showGridlines: BooleanNumber;
68
57
  rowHeader: {
69
58
  width: number;
70
59
  hidden?: BooleanNumber;
@@ -73,7 +62,8 @@ export interface IWorksheetData {
73
62
  height: number;
74
63
  hidden?: BooleanNumber;
75
64
  };
65
+ showGridlines: BooleanNumber;
66
+ /** @deprecated */
76
67
  selections: IRangeType[];
77
68
  rightToLeft: BooleanNumber;
78
- pluginMeta: IKeyValue;
79
69
  }