@univerjs/core 0.2.7 → 0.2.9

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 (112) hide show
  1. package/lib/cjs/index.js +8 -8
  2. package/lib/es/index.js +987 -185
  3. package/lib/types/common/equal.d.ts +15 -4
  4. package/lib/types/common/interceptor.d.ts +1 -2
  5. package/lib/types/{types/interfaces/i-freeze.d.ts → common/mixin.d.ts} +9 -5
  6. package/lib/types/common/unit.d.ts +2 -2
  7. package/lib/types/docs/data-model/document-data-model.d.ts +2 -4
  8. package/lib/types/docs/data-model/empty-snapshot.d.ts +0 -1
  9. package/lib/types/docs/data-model/json-x/json-x.d.ts +0 -1
  10. package/lib/types/docs/data-model/preset-list-type.d.ts +0 -1
  11. package/lib/types/docs/data-model/replacement.d.ts +0 -1
  12. package/lib/types/docs/data-model/text-x/action-iterator.d.ts +0 -1
  13. package/lib/types/docs/data-model/text-x/action-types.d.ts +0 -1
  14. package/lib/types/docs/data-model/text-x/apply-utils/common.d.ts +0 -1
  15. package/lib/types/docs/data-model/text-x/apply-utils/delete-apply.d.ts +0 -1
  16. package/lib/types/docs/data-model/text-x/apply-utils/insert-apply.d.ts +0 -1
  17. package/lib/types/docs/data-model/text-x/apply-utils/update-apply.d.ts +0 -1
  18. package/lib/types/docs/data-model/text-x/apply.d.ts +0 -1
  19. package/lib/types/docs/data-model/text-x/text-x.d.ts +0 -1
  20. package/lib/types/docs/data-model/text-x/transform-utils.d.ts +0 -1
  21. package/lib/types/docs/data-model/text-x/utils.d.ts +0 -1
  22. package/lib/types/index.d.ts +5 -2
  23. package/lib/types/observer/observable.d.ts +0 -1
  24. package/lib/types/services/__tests__/index.d.ts +0 -1
  25. package/lib/types/services/authz-io/authz-io-local.service.d.ts +2 -3
  26. package/lib/types/services/authz-io/type.d.ts +0 -1
  27. package/lib/types/services/command/command.service.d.ts +0 -1
  28. package/lib/types/services/config/config.service.d.ts +0 -1
  29. package/lib/types/services/context/context.service.d.ts +0 -1
  30. package/lib/types/services/error/error.service.d.ts +0 -1
  31. package/lib/types/services/instance/instance.service.d.ts +0 -1
  32. package/lib/types/services/lifecycle/lifecycle.d.ts +5 -1
  33. package/lib/types/services/lifecycle/lifecycle.service.d.ts +0 -1
  34. package/lib/types/services/locale/locale.service.d.ts +0 -1
  35. package/lib/types/services/log/log.service.d.ts +0 -1
  36. package/lib/types/services/permission/permission.service.d.ts +0 -1
  37. package/lib/types/services/permission/type.d.ts +2 -3
  38. package/lib/types/services/plugin/plugin-override.d.ts +0 -1
  39. package/lib/types/services/plugin/plugin.d.ts +0 -1
  40. package/lib/types/services/plugin/plugin.service.d.ts +0 -1
  41. package/lib/types/services/resource-loader/resource-loader.service.d.ts +3 -6
  42. package/lib/types/services/resource-loader/type.d.ts +4 -7
  43. package/lib/types/services/resource-manager/resource-manager.service.d.ts +4 -5
  44. package/lib/types/services/resource-manager/type.d.ts +9 -6
  45. package/lib/types/services/snapshot/__tests__/snapshot-mock.d.ts +1 -2
  46. package/lib/types/services/snapshot/snapshot-server.service.d.ts +0 -1
  47. package/lib/types/services/snapshot/snapshot-transform.d.ts +1 -2
  48. package/lib/types/services/snapshot/snapshot-utils.d.ts +1 -4
  49. package/lib/types/services/theme/theme.service.d.ts +0 -1
  50. package/lib/types/services/undoredo/undoredo.service.d.ts +1 -2
  51. package/lib/types/services/user-manager/const.d.ts +0 -1
  52. package/lib/types/shared/after-init-apply.d.ts +0 -1
  53. package/lib/types/shared/check-if-move.d.ts +1 -2
  54. package/lib/types/shared/clipboard.d.ts +0 -1
  55. package/lib/types/shared/color/color.d.ts +1 -2
  56. package/lib/types/shared/common.d.ts +2 -5
  57. package/lib/types/shared/compare.d.ts +0 -1
  58. package/lib/types/shared/doc-tool.d.ts +0 -1
  59. package/lib/types/shared/index.d.ts +1 -0
  60. package/lib/types/shared/lifecycle.d.ts +0 -1
  61. package/lib/types/shared/lru/lru-map.d.ts +0 -1
  62. package/lib/types/shared/numfmt.d.ts +2 -0
  63. package/lib/types/shared/object-matrix-query.d.ts +1 -2
  64. package/lib/types/shared/object-matrix.d.ts +7 -2
  65. package/lib/types/shared/range.d.ts +1 -2
  66. package/lib/types/shared/rectangle.d.ts +1 -2
  67. package/lib/types/shared/rxjs.d.ts +0 -1
  68. package/lib/types/shared/tools.d.ts +1 -3
  69. package/lib/types/shared/types.d.ts +4 -13
  70. package/lib/types/{types/interfaces/i-service-data.d.ts → sheets/__tests__/cell-data.spec.d.ts} +1 -2
  71. package/lib/types/sheets/__tests__/create-core-test-bed.d.ts +1 -2
  72. package/lib/types/sheets/column-manager.d.ts +2 -3
  73. package/lib/types/sheets/empty-snapshot.d.ts +1 -2
  74. package/lib/types/sheets/range.d.ts +2 -2
  75. package/lib/types/sheets/row-manager.d.ts +1 -2
  76. package/lib/types/sheets/sheet-snapshot-utils.d.ts +1 -2
  77. package/lib/types/sheets/styles.d.ts +2 -2
  78. package/lib/types/sheets/typedef.d.ts +451 -0
  79. package/lib/types/sheets/util.d.ts +3 -0
  80. package/lib/types/sheets/view-model.d.ts +2 -3
  81. package/lib/types/sheets/workbook.d.ts +13 -5
  82. package/lib/types/sheets/worksheet.d.ts +11 -2
  83. package/lib/types/slides/slide-model.d.ts +0 -2
  84. package/lib/types/types/const/const.d.ts +1 -1
  85. package/lib/types/types/enum/locale-type.d.ts +3 -1
  86. package/lib/types/types/enum/text-style.d.ts +1 -1
  87. package/lib/types/types/interfaces/i-cell-custom-render.d.ts +2 -3
  88. package/lib/types/types/interfaces/i-cell-validation-data.d.ts +0 -1
  89. package/lib/types/types/interfaces/i-data-validation.d.ts +1 -2
  90. package/lib/types/types/interfaces/i-document-data-interceptor.d.ts +0 -1
  91. package/lib/types/types/interfaces/i-document-data.d.ts +2 -5
  92. package/lib/types/types/interfaces/i-placeholder.d.ts +0 -1
  93. package/lib/types/types/interfaces/i-shape-properties.d.ts +0 -1
  94. package/lib/types/types/interfaces/i-slide-data.d.ts +5 -4
  95. package/lib/types/types/interfaces/i-style-data.d.ts +0 -1
  96. package/lib/types/types/interfaces/index.d.ts +0 -11
  97. package/lib/types/univer.d.ts +14 -3
  98. package/lib/umd/index.js +8 -8
  99. package/package.json +7 -6
  100. package/lib/types/common/type-util.d.ts +0 -16
  101. package/lib/types/common/type-utils.d.ts +0 -16
  102. package/lib/types/types/interfaces/i-cell-data.d.ts +0 -67
  103. package/lib/types/types/interfaces/i-column-data.d.ts +0 -15
  104. package/lib/types/types/interfaces/i-extra-model-data.d.ts +0 -27
  105. package/lib/types/types/interfaces/i-range.d.ts +0 -208
  106. package/lib/types/types/interfaces/i-row-data.d.ts +0 -27
  107. package/lib/types/types/interfaces/i-selection-data.d.ts +0 -59
  108. package/lib/types/types/interfaces/i-univer-data.d.ts +0 -14
  109. package/lib/types/types/interfaces/i-workbook-data.d.ts +0 -40
  110. package/lib/types/types/interfaces/i-worksheet-data.d.ts +0 -55
  111. package/lib/types/types/interfaces/i-worksheet-order-data.d.ts +0 -17
  112. /package/lib/types/{types/interfaces/__tests__/i-cell-data.spec.d.ts → services/__tests__/resources.spec.d.ts} +0 -0
@@ -1,10 +1,7 @@
1
- import { IRange } from '../types/interfaces';
2
- import { ICellData, ICellDataForSheetInterceptor } from '../types/interfaces/i-cell-data';
1
+ import { ICellData, ICellDataForSheetInterceptor, IRange, IRangeWithCoord, ISelectionCell, ISelectionCellWithMergeInfo } from '../sheets/typedef';
3
2
  import { IDocumentData } from '../types/interfaces/i-document-data';
4
- import { IRangeWithCoord, ISelectionCell, ISelectionCellWithMergeInfo } from '../types/interfaces/i-selection-data';
5
3
  import { IColorStyle, IStyleData } from '../types/interfaces/i-style-data';
6
4
  import { Nullable } from './types';
7
-
8
5
  export declare function makeCellToSelection(cellInfo: ISelectionCellWithMergeInfo): IRangeWithCoord;
9
6
  export declare function makeCellRangeToRangeData(cellInfo: Nullable<ISelectionCell>): Nullable<IRange>;
10
7
  export declare function isEmptyCell(cell: Nullable<ICellData>): boolean;
@@ -29,7 +26,7 @@ export declare function isFormulaId(value: any): boolean;
29
26
  */
30
27
  export declare function handleStyleToString(style: IStyleData, isCell?: boolean): string;
31
28
  export declare function getBorderStyleType(type: string): number;
32
- export declare function getDocsUpdateBody(model: IDocumentData, segmentId?: string): import('../types/interfaces').IDocumentBody | undefined;
29
+ export declare function getDocsUpdateBody(model: IDocumentData, segmentId?: string): import('../types/interfaces/i-document-data').IDocumentBody | undefined;
33
30
  export declare function isValidRange(range: IRange): boolean;
34
31
  /**
35
32
  * Covert row/column to range object
@@ -1,5 +1,4 @@
1
1
  import { ITextRun } from '../types/interfaces/i-document-data';
2
-
3
2
  interface AnyObject {
4
3
  [key: number | string]: AnyObject | AnyObject[] | Array<[number | string]> | any;
5
4
  }
@@ -1,5 +1,4 @@
1
1
  import { IParagraph, IParagraphStyle } from '../types/interfaces/i-document-data';
2
-
3
2
  export declare function horizontalLineSegmentsSubtraction(A1: number, A2: number, B1: number, B2: number): number[];
4
3
  export declare function checkParagraphHasBullet(paragraph: IParagraph): boolean;
5
4
  export declare function checkParagraphHasIndent(paragraph: IParagraph): boolean;
@@ -38,6 +38,7 @@ export * from './tools';
38
38
  export * from './types';
39
39
  export * from './debounce';
40
40
  export * from './clipboard';
41
+ export { numfmt } from './numfmt';
41
42
  export { queryObjectMatrix } from './object-matrix-query';
42
43
  export { moveRangeByOffset } from './range';
43
44
  export { afterInitApply } from './after-init-apply';
@@ -1,6 +1,5 @@
1
1
  import { Subscription, SubscriptionLike, Subject } from 'rxjs';
2
2
  import { IDisposable } from '../common/di';
3
-
4
3
  type DisposableLike = IDisposable | SubscriptionLike | (() => void);
5
4
  export declare function toDisposable(disposable: IDisposable): IDisposable;
6
5
  export declare function toDisposable(subscription: SubscriptionLike): IDisposable;
@@ -1,5 +1,4 @@
1
1
  import { IDisposable } from '../../common/di';
2
-
3
2
  declare const NEWER: unique symbol;
4
3
  declare const OLDER: unique symbol;
5
4
  export declare class KeyIterator<K, V> implements IterableIterator<K> {
@@ -0,0 +1,2 @@
1
+ import { default as numfmt } from 'numfmt';
2
+ export { numfmt };
@@ -1,4 +1,3 @@
1
- import { IRange } from '../types/interfaces';
1
+ import { IRange } from '../sheets/typedef';
2
2
  import { ObjectMatrix } from './object-matrix';
3
-
4
3
  export declare function queryObjectMatrix<T>(matrix: ObjectMatrix<T>, match: (value: T) => boolean): IRange[];
@@ -1,6 +1,5 @@
1
- import { IRange } from '../types/interfaces/i-range';
1
+ import { IRange } from '../sheets/typedef';
2
2
  import { Nullable } from './types';
3
-
4
3
  /**
5
4
  * Object Matrix Primitive Type
6
5
  */
@@ -92,6 +91,12 @@ export declare class ObjectMatrix<T> {
92
91
  */
93
92
  getData(): IObjectMatrixPrimitiveType<T>;
94
93
  getArrayData(): IObjectMatrixPrimitiveType<T>;
94
+ /**
95
+ * the function can only be used in all the row and column are positive integer
96
+ * @description the positive integer in V8 Object is stored in a fast memory space and it is sorted when we get the keys
97
+ * @returns {IRange} the start and end scope of the matrix
98
+ */
99
+ getStartEndScope(): IRange;
95
100
  getDataRange(): IRange;
96
101
  getDiscreteRanges(): IRange[];
97
102
  merge(newObject: ObjectMatrix<T>): void;
@@ -1,3 +1,2 @@
1
- import { IRange } from '../types/interfaces/i-range';
2
-
1
+ import { IRange } from '../sheets/typedef';
3
2
  export declare function moveRangeByOffset(range: IRange, refOffsetX: number, refOffsetY: number, ignoreAbsolute?: boolean): IRange;
@@ -1,6 +1,5 @@
1
- import { IRange, IRectLTRB } from '../types/interfaces/i-range';
1
+ import { IRange, IRectLTRB } from '../sheets/typedef';
2
2
  import { Nullable } from './types';
3
-
4
3
  /**
5
4
  * This class provides a set of methods to calculate `IRange`.
6
5
  */
@@ -1,6 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { IDisposable } from '../common/di';
3
-
4
3
  type CallbackFn<T extends readonly unknown[]> = (cb: (...args: T) => void) => IDisposable;
5
4
  /**
6
5
  * Creates an observable from a callback function.
@@ -1,5 +1,4 @@
1
- import { Class, IKeyValue } from './types';
2
-
1
+ import { IKeyValue } from './types';
3
2
  /**
4
3
  * Universal tool library
5
4
  */
@@ -24,7 +23,6 @@ export declare class Tools {
24
23
  static getValueType(value: any): string;
25
24
  static isDefine<T>(value?: T | void): value is T;
26
25
  static isBlank(value: any): boolean;
27
- static isAssignableFrom<T>(object: any, clazz: Class<T>): object is T;
28
26
  static isBoolean(value?: any): value is boolean;
29
27
  static isPlainObject(value: any): value is object;
30
28
  static isFunction(value?: any): value is boolean;
@@ -14,28 +14,19 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export type Nullable<T> = T | null | undefined | void;
17
- /**
18
- * wrap any
19
- */
20
- export type NoNeedCheckedType = any;
21
- /**
22
- * Class type
23
- */
24
- export interface Class<T> {
25
- new (...param: any): T;
26
- }
27
17
  /**
28
18
  * Key value object
29
19
  *
30
- * @deprecated
20
+ * @ignore
21
+ * @deprecated As it has
31
22
  */
32
23
  export interface IKeyValue {
33
24
  [key: string]: any;
34
25
  }
35
26
  /**
36
- * Custom type of key
27
+ * @ignore
28
+ * @deprecated, use {@link Record} instead.
37
29
  */
38
30
  export interface IKeyType<T> {
39
31
  [key: string]: T;
40
32
  }
41
- export type AsyncFunction<T = void, R = void> = (value: T) => Promise<R>;
@@ -13,5 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export interface IServiceData {
17
- }
16
+ export {};
@@ -1,6 +1,5 @@
1
1
  import { Univer } from '../../univer';
2
- import { IWorkbookData } from '../../types/interfaces/i-workbook-data';
3
-
2
+ import { IWorkbookData } from '../typedef';
4
3
  export declare function createCoreTestBed(workbookData?: IWorkbookData): {
5
4
  univer: Univer;
6
5
  get: {
@@ -1,7 +1,6 @@
1
- import { Nullable } from '../common/type-util';
2
1
  import { IObjectArrayPrimitiveType } from '../shared/object-matrix';
3
- import { IColumnData, IRange, IWorksheetData } from '../types/interfaces';
4
-
2
+ import { Nullable } from '../shared/types';
3
+ import { IColumnData, IRange, IWorksheetData } from './typedef';
5
4
  /**
6
5
  * Manage configuration information of all columns, get column width, column length, set column width, etc.
7
6
  */
@@ -1,4 +1,3 @@
1
1
  import { LocaleType } from '../types/enum/locale-type';
2
- import { IWorkbookData } from '../types/interfaces';
3
-
2
+ import { IWorkbookData } from './typedef';
4
3
  export declare function getEmptySnapshot(unitID?: string, locale?: LocaleType, name?: string): IWorkbookData;
@@ -1,9 +1,9 @@
1
1
  import { IObjectMatrixPrimitiveType, Nullable, ObjectMatrix } from '../shared';
2
2
  import { HorizontalAlign, VerticalAlign, BooleanNumber, FontItalic, FontWeight, WrapStrategy } from '../types/enum';
3
- import { IBorderData, ICellData, IDocumentBody, IDocumentData, IRange, IStyleBase, IStyleData, ITextDecoration, ITextRotation } from '../types/interfaces';
3
+ import { IBorderData, IDocumentBody, IDocumentData, IStyleBase, IStyleData, ITextDecoration, ITextRotation } from '../types/interfaces';
4
4
  import { Styles } from './styles';
5
+ import { ICellData, IRange } from './typedef';
5
6
  import { Worksheet } from './worksheet';
6
-
7
7
  /**
8
8
  * getObjectValues options type
9
9
  */
@@ -1,8 +1,7 @@
1
1
  import { IObjectArrayPrimitiveType } from '../shared/object-matrix';
2
2
  import { Nullable } from '../shared/types';
3
- import { IRange, IRowData, IWorksheetData } from '../types/interfaces';
3
+ import { IRange, IRowData, IWorksheetData } from './typedef';
4
4
  import { SheetViewModel } from './view-model';
5
-
6
5
  /**
7
6
  * Manage configuration information of all rows, get row height, row length, set row height, etc.
8
7
  */
@@ -1,5 +1,4 @@
1
- import { IWorksheetData } from '../types/interfaces/i-worksheet-data';
2
-
1
+ import { IWorksheetData } from './typedef';
3
2
  export declare const DEFAULT_WORKSHEET_ROW_COUNT_KEY = "DEFAULT_WORKSHEET_ROW_COUNT";
4
3
  export declare const DEFAULT_WORKSHEET_ROW_COUNT = 1000;
5
4
  export declare const DEFAULT_WORKSHEET_COLUMN_COUNT_KEY = "DEFAULT_WORKSHEET_COLUMN_COUNT";
@@ -1,6 +1,6 @@
1
1
  import { IKeyType, Nullable } from '../shared';
2
- import { ICellDataForSheetInterceptor, IStyleData } from '../types/interfaces';
3
-
2
+ import { IStyleData } from '../types/interfaces';
3
+ import { ICellDataForSheetInterceptor } from './typedef';
4
4
  /**
5
5
  * Styles in a workbook, cells locate styles based on style IDs
6
6
  *