@univerjs/core 0.1.0-alpha.2 → 0.1.0-alpha.3

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 (39) hide show
  1. package/README.md +1 -1
  2. package/lib/cjs/index.js +5 -5
  3. package/lib/es/index.js +2668 -2584
  4. package/lib/types/basics/plugin-holder.d.ts +30 -0
  5. package/lib/types/basics/univer-doc.d.ts +7 -11
  6. package/lib/types/basics/univer-sheet.d.ts +7 -21
  7. package/lib/types/basics/univer-slide.d.ts +6 -19
  8. package/lib/types/basics/univer.d.ts +18 -13
  9. package/lib/types/common/memory-cursor.d.ts +1 -0
  10. package/lib/types/common/shims.d.ts +16 -0
  11. package/lib/types/docs/data-model/index.d.ts +1 -0
  12. package/lib/types/docs/data-model/preset-list-type.d.ts +50 -0
  13. package/lib/types/index.d.ts +1 -0
  14. package/lib/types/plugin/plugin.d.ts +4 -3
  15. package/lib/types/services/command/command.service.d.ts +3 -3
  16. package/lib/types/services/log/log.service.d.ts +8 -6
  17. package/lib/types/shared/color/color-kit.d.ts +64 -0
  18. package/lib/types/shared/color/color.d.ts +17 -3
  19. package/lib/types/shared/common.d.ts +1 -3
  20. package/lib/types/shared/index.d.ts +1 -2
  21. package/lib/types/shared/locale.d.ts +1 -4
  22. package/lib/types/shared/object-matrix.d.ts +29 -28
  23. package/lib/types/shared/rectangle.d.ts +1 -0
  24. package/lib/types/shared/sort-rules.d.ts +2 -2
  25. package/lib/types/shared/tools.d.ts +0 -5
  26. package/lib/types/sheets/column-manager.d.ts +7 -8
  27. package/lib/types/sheets/range.d.ts +4 -4
  28. package/lib/types/sheets/row-manager.d.ts +7 -7
  29. package/lib/types/sheets/styles.d.ts +4 -6
  30. package/lib/types/sheets/workbook.d.ts +5 -3
  31. package/lib/types/sheets/worksheet.d.ts +1 -1
  32. package/lib/types/types/enum/text-style.d.ts +3 -3
  33. package/lib/types/types/interfaces/i-document-data.d.ts +3 -2
  34. package/lib/types/types/interfaces/i-range.d.ts +13 -11
  35. package/lib/types/types/interfaces/i-worksheet-data.d.ts +4 -5
  36. package/lib/umd/index.js +5 -5
  37. package/package.json +4 -4
  38. package/lib/types/shared/color/color-builder.d.ts +0 -35
  39. package/lib/types/shared/object-array.d.ts +0 -110
@@ -13,9 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { Nullable } from '../shared';
17
- import type { ObjectArrayType } from '../shared/object-array';
18
- import { ObjectArray } from '../shared/object-array';
16
+ import type { Nullable } from '../common/type-utils';
17
+ import type { IObjectArrayPrimitiveType } from '../shared/object-matrix';
19
18
  import type { IColumnData, IRange, IWorksheetData } from '../types/interfaces';
20
19
  /**
21
20
  * Manage configuration information of all columns, get column width, column length, set column width, etc.
@@ -23,15 +22,15 @@ import type { IColumnData, IRange, IWorksheetData } from '../types/interfaces';
23
22
  export declare class ColumnManager {
24
23
  private readonly _config;
25
24
  private _columnData;
26
- constructor(_config: IWorksheetData, data: ObjectArrayType<Partial<IColumnData>>);
25
+ constructor(_config: IWorksheetData, data: IObjectArrayPrimitiveType<Partial<IColumnData>>);
27
26
  /**
28
27
  * Get width and hidden status of columns in the sheet
29
28
  * @returns
30
29
  */
31
- getColumnData(): ObjectArray<IColumnData>;
30
+ getColumnData(): IObjectArrayPrimitiveType<Partial<IColumnData>>;
32
31
  getColVisible(colPos: number): boolean;
33
32
  getHiddenCols(start?: number, end?: number): IRange[];
34
- getColumnDatas(columnPos: number, numColumns: number): ObjectArray<IColumnData>;
33
+ getColumnDatas(columnPos: number, numColumns: number): IObjectArrayPrimitiveType<Partial<IColumnData>>;
35
34
  /**
36
35
  * Get count of column in the sheet
37
36
  * @returns
@@ -48,11 +47,11 @@ export declare class ColumnManager {
48
47
  * @param columnPos column index
49
48
  * @returns
50
49
  */
51
- getColumn(columnPos: number): Nullable<IColumnData>;
50
+ getColumn(columnPos: number): Nullable<Partial<IColumnData>>;
52
51
  /**
53
52
  * get given column data or create a column data when it's null
54
53
  * @param columnPos column index
55
54
  * @returns
56
55
  */
57
- getColumnOrCreate(columnPos: number): IColumnData;
56
+ getColumnOrCreate(columnPos: number): Partial<IColumnData>;
58
57
  }
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { Nullable, ObjectMatrixPrimitiveType } from '../shared';
16
+ 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';
@@ -79,7 +79,7 @@ export declare class Range {
79
79
  *
80
80
  * @returns range matrix
81
81
  */
82
- getMatrix(): ObjectMatrix<ICellData>;
82
+ getMatrix(): ObjectMatrix<Nullable<ICellData>>;
83
83
  /**
84
84
  * get range matrix object
85
85
  *
@@ -121,14 +121,14 @@ export declare class Range {
121
121
  /**
122
122
  * Returns the data of the object structure, and can set whether to bring styles
123
123
  */
124
- getObjectValue(options?: IValueOptionsType): ICellData;
124
+ getObjectValue(options?: IValueOptionsType): Nullable<ICellData>;
125
125
  /**
126
126
  * Returns the data of the object structure, and can set whether to bring styles
127
127
  *
128
128
  * @param options set whether to include style
129
129
  * @returns Returns a value in object format
130
130
  */
131
- getObjectValues(options?: IValueOptionsType): ObjectMatrixPrimitiveType<ICellData>;
131
+ getObjectValues(options?: IValueOptionsType): IObjectMatrixPrimitiveType<Nullable<ICellData>>;
132
132
  /**
133
133
  * Returns the font color of the cell in the top-left corner of the range, in CSS notation
134
134
  */
@@ -13,8 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { Nullable, ObjectArrayType } from '../shared';
17
- import { ObjectArray } from '../shared';
16
+ import { type IObjectArrayPrimitiveType } from '../shared/object-matrix';
17
+ import type { Nullable } from '../shared/types';
18
18
  import type { IRange, IRowData, IWorksheetData } from '../types/interfaces';
19
19
  /**
20
20
  * Manage configuration information of all rows, get row height, row length, set row height, etc.
@@ -24,13 +24,13 @@ import type { IRange, IRowData, IWorksheetData } from '../types/interfaces';
24
24
  export declare class RowManager {
25
25
  private readonly _config;
26
26
  private _rowData;
27
- constructor(_config: IWorksheetData, data: ObjectArrayType<Partial<IRowData>>);
27
+ constructor(_config: IWorksheetData, data: IObjectArrayPrimitiveType<Partial<IRowData>>);
28
28
  /**
29
29
  * Get height and hidden status of columns in the sheet
30
30
  * @returns
31
31
  */
32
- getRowData(): ObjectArray<IRowData>;
33
- getRowDatas(rowPos: number, numRows: number): ObjectArray<IRowData>;
32
+ getRowData(): IObjectArrayPrimitiveType<Partial<IRowData>>;
33
+ getRowDatas(rowPos: number, numRows: number): IObjectArrayPrimitiveType<Partial<IRowData>>;
34
34
  getRowHeight(rowPos: number): number;
35
35
  getRowHeight(rowPos: number, count: number): number;
36
36
  /**
@@ -38,13 +38,13 @@ export declare class RowManager {
38
38
  * @param rowPos row index
39
39
  * @returns
40
40
  */
41
- getRow(rowPos: number): Nullable<IRowData>;
41
+ getRow(rowPos: number): Nullable<Partial<IRowData>>;
42
42
  /**
43
43
  * Get given row data or create a row data when it's null
44
44
  * @param rowPos row index
45
45
  * @returns
46
46
  */
47
- getRowOrCreate(rowPos: number): IRowData;
47
+ getRowOrCreate(rowPos: number): Partial<IRowData>;
48
48
  getHiddenRows(start?: number, end?: number): IRange[];
49
49
  getRowVisible(rowPos: number): boolean;
50
50
  /**
@@ -18,20 +18,18 @@ import type { ICellDataForSheetInterceptor, IStyleData } from '../types/interfac
18
18
  /**
19
19
  * Styles in a workbook, cells locate styles based on style IDs
20
20
  *
21
- * TODO@Dushusir: Cachemap needs to follow style to clear cleared following styles
22
21
  */
23
22
  export declare class Styles {
24
23
  private _styles;
25
24
  private _cacheMap;
26
- private _maxCacheSize;
27
- constructor(styles?: IKeyType<Nullable<IStyleData>>, maxCacheSize?: number);
25
+ constructor(styles?: IKeyType<Nullable<IStyleData>>);
28
26
  each(callback: (value: [string, Nullable<IStyleData>], index: number, array: Array<[string, Nullable<IStyleData>]>) => void): this;
29
- search(data: IStyleData): string;
27
+ search(data: IStyleData, styleObject: string): string;
30
28
  get(id: string | Nullable<IStyleData>): Nullable<IStyleData>;
31
- add(data: IStyleData): string;
29
+ add(data: IStyleData, styleObject: string): string;
32
30
  setValue(data: Nullable<IStyleData>): Nullable<string>;
33
31
  toJSON(): IKeyType<Nullable<IStyleData>>;
34
32
  getStyleByCell(cell: Nullable<ICellDataForSheetInterceptor>): Nullable<IStyleData>;
35
33
  private _generateCacheMap;
36
- private getExistingStyleId;
34
+ private _getExistingStyleId;
37
35
  }
@@ -15,7 +15,6 @@
15
15
  */
16
16
  import { Injector } from '@wendellhu/redi';
17
17
  import type { Nullable } from '../shared';
18
- import { GenName } from '../shared';
19
18
  import { Disposable } from '../shared/lifecycle';
20
19
  import type { IGridRange, IRangeType, IWorkbookData, IWorksheetData } from '../types/interfaces';
21
20
  import { Styles } from './styles';
@@ -25,12 +24,14 @@ export declare function getWorksheetUID(workbook: Workbook, worksheet: Worksheet
25
24
  * Access and create Univer Sheets files
26
25
  */
27
26
  export declare class Workbook extends Disposable {
28
- private readonly _genName;
29
27
  readonly _injector: Injector;
30
28
  private readonly _sheetCreated$;
31
29
  readonly sheetCreated$: import("rxjs").Observable<Worksheet>;
32
30
  private readonly _sheetDisposed$;
33
31
  readonly sheetDisposed$: import("rxjs").Observable<Worksheet>;
32
+ private readonly _genName;
33
+ private readonly _activeSheet$;
34
+ readonly activeSheet$: import("rxjs").Observable<Nullable<Worksheet>>;
34
35
  /**
35
36
  * sheets list
36
37
  * @private
@@ -47,7 +48,7 @@ export declare class Workbook extends Disposable {
47
48
  */
48
49
  private _snapshot;
49
50
  private _unitId;
50
- constructor(workbookData: Partial<IWorkbookData> | undefined, _genName: GenName, _injector: Injector);
51
+ constructor(workbookData: Partial<IWorkbookData> | undefined, _injector: Injector);
51
52
  dispose(): void;
52
53
  save(): IWorkbookData;
53
54
  static isIRangeType(range: IRangeType | IRangeType[]): Boolean;
@@ -69,6 +70,7 @@ export declare class Workbook extends Disposable {
69
70
  getIndexBySheetId(sheetId: string): number;
70
71
  getRawActiveSheet(): Nullable<string>;
71
72
  getActiveSheet(): Worksheet;
73
+ __setActiveSheet(worksheet: Worksheet): void;
72
74
  getActiveSheetIndex(): number;
73
75
  getSheetSize(): number;
74
76
  /**
@@ -46,7 +46,7 @@ export declare class Worksheet {
46
46
  * Returns WorkSheet Cell Data Matrix
47
47
  * @returns
48
48
  */
49
- getCellMatrix(): ObjectMatrix<ICellData>;
49
+ getCellMatrix(): ObjectMatrix<Nullable<ICellData>>;
50
50
  /**
51
51
  * Returns Row Manager
52
52
  * @returns Row Manager
@@ -108,9 +108,9 @@ export declare enum FontWeight {
108
108
  BOLD = 1
109
109
  }
110
110
  export declare enum BaselineOffset {
111
- NORMAL = 0,
112
- SUBSCRIPT = 1,
113
- SUPERSCRIPT = 2
111
+ NORMAL = 1,
112
+ SUBSCRIPT = 2,
113
+ SUPERSCRIPT = 3
114
114
  }
115
115
  /**
116
116
  * General Boolean Enum
@@ -56,7 +56,7 @@ export interface IFooters {
56
56
  * Set of lists
57
57
  */
58
58
  export interface ILists {
59
- [listId: string]: IListData;
59
+ [listType: string]: IListData;
60
60
  }
61
61
  /**
62
62
  * Set of Drawings
@@ -136,7 +136,7 @@ export interface IHeaderData {
136
136
  * The properties of a list which describe the look and feel of bullets belonging to paragraphs associated with a list.
137
137
  */
138
138
  export interface IListData {
139
- listId: string;
139
+ listType: string;
140
140
  nestingLevel: INestingLevel[];
141
141
  }
142
142
  /**
@@ -360,6 +360,7 @@ export declare enum ParagraphElementType {
360
360
  * Properties of list
361
361
  */
362
362
  export interface IBullet {
363
+ listType: string;
363
364
  listId: string;
364
365
  nestingLevel: number;
365
366
  textStyle: ITextStyle;
@@ -31,6 +31,18 @@ export declare enum AbsoluteRefType {
31
31
  COLUMN = 2,
32
32
  ALL = 3
33
33
  }
34
+ export interface IRowRange {
35
+ /**
36
+ * The start row (inclusive) of the range
37
+ * startRow
38
+ */
39
+ startRow: number;
40
+ /**
41
+ * The end row (exclusive) of the range
42
+ * endRow
43
+ */
44
+ endRow: number;
45
+ }
34
46
  /**
35
47
  * Range data structure
36
48
  *
@@ -46,22 +58,12 @@ export declare enum AbsoluteRefType {
46
58
  *
47
59
  * means "A1:B2"
48
60
  */
49
- export interface IRange {
50
- /**
51
- * The start row (inclusive) of the range
52
- * startRow
53
- */
54
- startRow: number;
61
+ export interface IRange extends IRowRange {
55
62
  /**
56
63
  * The start column (inclusive) of the range
57
64
  * startColumn
58
65
  */
59
66
  startColumn: number;
60
- /**
61
- * The end row (exclusive) of the range
62
- * endRow
63
- */
64
- endRow: number;
65
67
  /**
66
68
  * The end column (exclusive) of the range
67
69
  * endColumn
@@ -13,8 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { ObjectArrayType } from '../../shared/object-array';
17
- import type { ObjectMatrixPrimitiveType } from '../../shared/object-matrix';
16
+ import type { IObjectArrayPrimitiveType, IObjectMatrixPrimitiveType } from '../../shared/object-matrix';
18
17
  import type { IKeyValue } from '../../shared/types';
19
18
  import type { BooleanNumber, SheetTypes } from '../enum';
20
19
  import type { ICellData } from './i-cell-data';
@@ -62,9 +61,9 @@ export interface IWorksheetData {
62
61
  * @deprecated this should be removed
63
62
  */
64
63
  status: BooleanNumber;
65
- cellData: ObjectMatrixPrimitiveType<ICellData>;
66
- rowData: ObjectArrayType<Partial<IRowData>>;
67
- columnData: ObjectArrayType<Partial<IColumnData>>;
64
+ cellData: IObjectMatrixPrimitiveType<ICellData>;
65
+ rowData: IObjectArrayPrimitiveType<Partial<IRowData>>;
66
+ columnData: IObjectArrayPrimitiveType<Partial<IColumnData>>;
68
67
  showGridlines: BooleanNumber;
69
68
  rowHeader: {
70
69
  width: number;