@univerjs/core 0.8.0-beta.0 → 0.8.0-beta.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.
@@ -1,4 +1,4 @@
1
- import { INumfmt, Rectangle, Tools } from '@univerjs/core';
1
+ import { numfmt, Rectangle, Tools } from '@univerjs/core';
2
2
  /**
3
3
  * @ignore
4
4
  */
@@ -35,7 +35,7 @@ export declare class FUtil {
35
35
  * console.log(text);
36
36
  * ```
37
37
  */
38
- get numfmt(): INumfmt;
38
+ get numfmt(): typeof numfmt;
39
39
  /**
40
40
  * common tools
41
41
  *
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export { getPlainText } from './docs/data-model/text-x/build-utils/parse';
17
- export type { INumfmt } from './shared/types/numfmt.type';
18
17
  export { debounce, get, merge, mergeWith, set } from 'lodash-es';
19
18
  export { textDiff } from './shared/text-diff';
20
19
  export { dedupe, dedupeBy, groupBy, makeArray, remove, rotate } from './common/array';
@@ -19,6 +19,7 @@ export declare const ILogService: import('@wendellhu/redi').IdentifierDecorator<
19
19
  export declare class DesktopLogService extends Disposable implements ILogService {
20
20
  private _logLevel;
21
21
  private _deduction;
22
+ dispose(): void;
22
23
  debug(...args: ArgsType): void;
23
24
  log(...args: ArgsType): void;
24
25
  warn(...args: ArgsType): void;
@@ -1,24 +1,10 @@
1
- /**
2
- * Copyright 2023-present DreamNum Co., Ltd.
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
- */
1
+ import { Disposable } from '../../shared/lifecycle';
16
2
  export interface IUser {
17
3
  userID: string;
18
4
  name: string;
19
5
  avatar?: string;
20
6
  }
21
- export declare class UserManagerService {
7
+ export declare class UserManagerService extends Disposable {
22
8
  private _model;
23
9
  private _userChange$;
24
10
  userChange$: import('rxjs').Observable<{
@@ -33,6 +19,7 @@ export declare class UserManagerService {
33
19
  * @memberof UserManagerService
34
20
  */
35
21
  currentUser$: import('rxjs').Observable<IUser>;
22
+ dispose(): void;
36
23
  getCurrentUser<T extends IUser>(): T;
37
24
  setCurrentUser<T extends IUser>(user: T): void;
38
25
  addUser<T extends IUser>(user: T): void;
@@ -30,7 +30,7 @@ export * from './hash-algorithm';
30
30
  export * from './lifecycle';
31
31
  export * from './locale';
32
32
  export { LRUHelper, LRUMap } from './lru/lru-map';
33
- export { type INumfmtLocalTag, numfmt } from './numfmt';
33
+ export { type INumfmtLocalTag, isPatternEqualWithoutDecimal, numfmt } from './numfmt';
34
34
  export * from './object-matrix';
35
35
  export { queryObjectMatrix } from './object-matrix-query';
36
36
  export { moveRangeByOffset, splitIntoGrid } from './range';
@@ -1,3 +1,23 @@
1
- import { INumfmt, LocaleTag } from './types/numfmt.type';
2
- declare const numfmt: INumfmt;
3
- export { LocaleTag as INumfmtLocalTag, numfmt };
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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 * as numfmt from 'numfmt';
17
+ export type INumfmtLocalTag = 'zh-CN' | 'zh-TW' | 'cs' | 'da' | 'nl' | 'en' | 'fi' | 'fr' | 'de' | 'el' | 'hu' | 'is' | 'id' | 'it' | 'ja' | 'ko' | 'nb' | 'pl' | 'pt' | 'ru' | 'sk' | 'es' | 'sv' | 'th' | 'tr' | 'vi';
18
+ /**
19
+ * Determines whether two patterns are equal, excluding differences in decimal places.
20
+ * This function ignores the decimal part of the patterns and the positive color will be ignored but negative color will be considered.
21
+ * more info can check the test case.
22
+ */
23
+ export declare const isPatternEqualWithoutDecimal: (patternA: string, patternB: string) => boolean;
@@ -9,6 +9,7 @@ export interface IObjectMatrixPrimitiveType<T> {
9
9
  export interface IObjectArrayPrimitiveType<T> {
10
10
  [key: number]: T;
11
11
  }
12
+ export declare function mapObjectMatrix<T, R>(o: IObjectMatrixPrimitiveType<T>, callback: (row: number, col: number, value: T) => R): IObjectMatrixPrimitiveType<R>;
12
13
  export declare function getArrayLength<T>(o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): number;
13
14
  export declare function insertMatrixArray<T>(index: number, value: T, o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): void;
14
15
  export declare function spliceArray<T>(start: number, count: number, o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): void;
@@ -99,5 +100,6 @@ export declare class ObjectMatrix<T> {
99
100
  getStartEndScope(): IRange;
100
101
  getDataRange(): IRange;
101
102
  getDiscreteRanges(): IRange[];
103
+ merge(newObject: ObjectMatrix<Nullable<T>>): void;
102
104
  private _setOriginValue;
103
105
  }
@@ -34,10 +34,6 @@ export declare class SheetSkeleton extends Skeleton {
34
34
  protected _renderRawFormula: boolean;
35
35
  protected _cellData: ObjectMatrix<Nullable<ICellData>>;
36
36
  protected _imageCacheMap: ImageCacheMap;
37
- /**
38
- * Whether the row style precedes the column style.
39
- */
40
- protected _isRowStylePrecedeColumnStyle: boolean;
41
37
  /**
42
38
  * Whether auto height for merged cells
43
39
  */
@@ -42,19 +42,26 @@ export declare class Worksheet {
42
42
  private readonly _styles;
43
43
  protected _sheetId: string;
44
44
  protected _snapshot: IWorksheetData;
45
- protected _cellData: ObjectMatrix<ICellData>;
45
+ protected _cellData: ObjectMatrix<Nullable<ICellData>>;
46
46
  protected _rowManager: RowManager;
47
47
  protected _columnManager: ColumnManager;
48
48
  protected readonly _viewModel: SheetViewModel;
49
49
  protected _spanModel: SpanModel;
50
+ /**
51
+ * Whether the row style precedes the column style.
52
+ */
53
+ protected _isRowStylePrecedeColumnStyle: boolean;
54
+ private _getCellHeight;
50
55
  constructor(unitId: string, snapshot: Partial<IWorksheetData>, _styles: Styles);
51
56
  getSnapshot(): IWorksheetData;
57
+ getCellHeight(row: number, col: number): number;
52
58
  /**
53
59
  * Set the merge data of the sheet, all the merged cells will be rebuilt.
54
60
  * @param mergeData
55
61
  */
56
62
  setMergeData(mergeData: IRange[]): void;
57
63
  getSpanModel(): SpanModel;
64
+ setIsRowStylePrecedeColumnStyle(isRowStylePrecedeColumnStyle: boolean): void;
58
65
  getStyleDataByHash(hash: string): Nullable<IStyleData>;
59
66
  setStyleData(style: IStyleData): Nullable<string>;
60
67
  /**
@@ -383,13 +390,13 @@ export declare class Worksheet {
383
390
  * @param cell
384
391
  * @param options
385
392
  */
386
- private _getCellDocumentModel;
393
+ getCellDocumentModel(cell: Nullable<ICellDataForSheetInterceptor>, style: Nullable<IStyleData>, options?: ICellDocumentModelOption): Nullable<IDocumentLayoutObject>;
387
394
  private _updateConfigAndGetDocumentModel;
388
395
  /**
389
396
  * Only used for cell edit, and no need to rotate text when edit cell content!
390
397
  */
391
- getBlankCellDocumentModel(cell: Nullable<ICellData>): IDocumentLayoutObject;
392
- getCellDocumentModelWithFormula(cell: ICellData): Nullable<IDocumentLayoutObject>;
398
+ getBlankCellDocumentModel(cell: Nullable<ICellData>, row: number, column: number): IDocumentLayoutObject;
399
+ getCellDocumentModelWithFormula(cell: ICellData, row: number, column: number): Nullable<IDocumentLayoutObject>;
393
400
  /**
394
401
  * Get custom metadata of worksheet
395
402
  * @returns {CustomData | undefined} custom metadata
@@ -1,6 +1,6 @@
1
1
  import { Nullable } from '../../shared/types';
2
2
  import { BorderStyleTypes } from '../enum/border-style-types';
3
- import { BaselineOffset, BooleanNumber, HorizontalAlign, TextDecoration, TextDirection, VerticalAlign, WrapStrategy } from '../enum/text-style';
3
+ import { BaselineOffset, BooleanNumber, HorizontalAlign, TextDecoration, VerticalAlign, WrapStrategy } from '../enum/text-style';
4
4
  import { ThemeColorType } from '../enum/theme-color-type';
5
5
  /**
6
6
  * Properties of text decoration
@@ -166,10 +166,6 @@ export interface IStyleData extends IStyleBase {
166
166
  * textRotation
167
167
  */
168
168
  tr?: Nullable<ITextRotation>;
169
- /**
170
- * textDirection
171
- */
172
- td?: Nullable<TextDirection>;
173
169
  /**
174
170
  * horizontalAlignment
175
171
  */
@@ -182,8 +178,4 @@ export interface IStyleData extends IStyleBase {
182
178
  * wrapStrategy
183
179
  */
184
180
  tb?: Nullable<WrapStrategy>;
185
- /**
186
- * padding
187
- */
188
- pd?: Nullable<IPaddingData>;
189
181
  }