@univerjs/core 0.2.13 → 0.2.15

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.
@@ -3,10 +3,19 @@ import { Observable } from 'rxjs';
3
3
  import { Disposable } from '../shared';
4
4
  export { UniverType as UniverInstanceType } from '@univerjs/protocol';
5
5
  export type UnitType = UniverType | number;
6
+ /**
7
+ * The base class for all units.
8
+ */
6
9
  export declare abstract class UnitModel<D = object, T extends UnitType = UnitType> extends Disposable {
7
10
  abstract readonly type: T;
8
11
  abstract getUnitId(): string;
9
12
  abstract name$: Observable<string>;
10
13
  abstract setName(name: string): void;
11
14
  abstract getSnapshot(): D;
15
+ /** Get revision of the unit's snapshot. Note that revision should start from 1. */
16
+ abstract getRev(): number;
17
+ /** Increment the current revision. */
18
+ abstract incrementRev(): void;
19
+ /** Set revision of the current snapshot. */
20
+ abstract setRev(rev: number): void;
12
21
  }
@@ -1,9 +1,9 @@
1
1
  import { BehaviorSubject } from 'rxjs';
2
+ import { UnitModel, UniverInstanceType } from '../../common/unit';
3
+ import { SliceBodyType } from './text-x/utils';
2
4
  import { Nullable } from '../../shared';
3
5
  import { IDocumentBody, IDocumentData, IDocumentRenderConfig, IDocumentStyle, IDrawings, IListData } from '../../types/interfaces/i-document-data';
4
6
  import { IPaddingData } from '../../types/interfaces/i-style-data';
5
- import { UnitModel, UniverInstanceType } from '../../common/unit';
6
- import { SliceBodyType } from './text-x/utils';
7
7
  import { JSONXActions } from './json-x/json-x';
8
8
  export declare const DEFAULT_DOC: {
9
9
  id: string;
@@ -22,6 +22,9 @@ declare class DocumentDataModelSimple extends UnitModel<IDocumentData, UniverIns
22
22
  name$: import('rxjs').Observable<string>;
23
23
  protected snapshot: IDocumentData;
24
24
  constructor(snapshot: Partial<IDocumentData>);
25
+ getRev(): number;
26
+ incrementRev(): void;
27
+ setRev(rev: number): void;
25
28
  setName(name: string): void;
26
29
  get drawings(): IDrawings | undefined;
27
30
  get documentStyle(): IDocumentStyle;
@@ -49,8 +52,6 @@ export declare class DocumentDataModel extends DocumentDataModelSimple {
49
52
  getDrawingsOrder(): string[] | undefined;
50
53
  getCustomRanges(): import('../..').ICustomRange<Record<string, any>>[] | undefined;
51
54
  getCustomDecorations(): import('../..').ICustomDecoration[] | undefined;
52
- getRev(): number;
53
- incrementRev(): void;
54
55
  getSettings(): import('../..').IDocumentSettings | undefined;
55
56
  reset(snapshot: Partial<IDocumentData>): void;
56
57
  getSelfOrHeaderFooterModel(segmentId?: string): DocumentDataModel;
@@ -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 * from './lru-helper';
17
- export * from './lru-map';
16
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { copyCustomRange, getCustomRangesInterestsWithRange, isIntersecting, shouldDeleteCustomRange } from './custom-range';
2
- import { getDeleteSelection, getInsertSelection, getRetainAndDeleteFromReplace, getSelectionWithNoSymbolSide, getSelectionWithSymbolMax, isSegmentIntersects, makeSelection, normalizeSelection } from './selection';
2
+ import { getDeleteSelection, getInsertSelection, getRetainAndDeleteFromReplace, isSegmentIntersects, makeSelection, normalizeSelection } from './selection';
3
3
  import { addCustomRangeTextX, deleteCustomRangeTextX, getRetainAndDeleteAndExcludeLineBreak } from './text-x-utils';
4
4
  export declare class BuildTextUtils {
5
5
  static customRange: {
@@ -14,8 +14,6 @@ export declare class BuildTextUtils {
14
14
  replace: (params: import('./text-x-utils').IReplaceSelectionTextXParams) => false | import('../text-x').TextX;
15
15
  makeSelection: typeof makeSelection;
16
16
  normalizeSelection: typeof normalizeSelection;
17
- getSelectionWithSymbolMax: typeof getSelectionWithSymbolMax;
18
- getSelectionWithNoSymbolSide: typeof getSelectionWithNoSymbolSide;
19
17
  getDeleteSelection: typeof getDeleteSelection;
20
18
  getInsertSelection: typeof getInsertSelection;
21
19
  getDeleteActions: typeof getRetainAndDeleteFromReplace;
@@ -24,5 +22,9 @@ export declare class BuildTextUtils {
24
22
  static range: {
25
23
  isIntersects: typeof isSegmentIntersects;
26
24
  };
25
+ static transform: {
26
+ getPlainText: (dataStream: string) => string;
27
+ fromPlainText: (text: string) => import('../../../..').IDocumentBody;
28
+ };
27
29
  }
28
30
  export type { IAddCustomRangeTextXParam, IDeleteCustomRangeParam, IReplaceSelectionTextXParams } from './text-x-utils';
@@ -0,0 +1,3 @@
1
+ import { IDocumentBody } from '../../../../types/interfaces';
2
+ export declare const getPlainText: (dataStream: string) => string;
3
+ export declare const fromPlainText: (text: string) => IDocumentBody;
@@ -13,99 +13,100 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export type { Serializable } from './common/json';
17
- export { DEFAULT_DOCUMENT_SUB_COMPONENT_ID } from './docs/data-model/subdocument';
18
- export { type UnitType, UnitModel, UniverInstanceType } from './common/unit';
19
- export { Registry, RegistryAsMap } from './common/registry';
20
- export { CustomCommandExecutionError } from './common/error';
21
- export { Univer } from './univer';
22
- export { shallowEqual } from './common/equal';
23
- export { isNumeric, isSafeNumeric } from './common/number';
16
+ export { dedupe, groupBy, makeArray, remove, rotate } from './common/array';
24
17
  export { isBooleanString } from './common/boolean';
25
- export { dedupe, remove, rotate, groupBy, makeArray } from './common/array';
26
- export { mergeSets } from './common/set';
27
- export { DEFAULT_EMPTY_DOCUMENT_VALUE, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, createInternalEditorID, isInternalEditorID, } from './common/const';
18
+ export { createInternalEditorID, DEFAULT_EMPTY_DOCUMENT_VALUE, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, isInternalEditorID, } from './common/const';
19
+ export * from './common/di';
20
+ export { shallowEqual } from './common/equal';
21
+ export { CustomCommandExecutionError } from './common/error';
28
22
  export { throttle } from './common/function';
23
+ export type { IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';
24
+ export { composeInterceptors, createInterceptorKey, InterceptorManager } from './common/interceptor';
25
+ export type { Serializable } from './common/json';
29
26
  export { MemoryCursor } from './common/memory-cursor';
27
+ export { mixinClass } from './common/mixin';
28
+ export { isNumeric, isSafeNumeric } from './common/number';
29
+ export { Registry, RegistryAsMap } from './common/registry';
30
30
  export { requestImmediateMacroTask } from './common/request-immediate-macro-task';
31
31
  export { type ISequenceExecuteResult, sequence, sequenceAsync } from './common/sequence';
32
+ export { mergeSets } from './common/set';
33
+ export { UnitModel, type UnitType, UniverInstanceType } from './common/unit';
32
34
  export * from './docs/data-model';
33
- export { TextXActionType, type TextXAction, type IDeleteAction, type IInsertAction, type IRetainAction, } from './docs/data-model/text-x/action-types';
34
- export { DataValidationRenderMode } from './types/enum/data-validation-render-mode';
35
+ export { JSON1, JSONX } from './docs/data-model/json-x/json-x';
36
+ export type { JSONXActions, JSONXPath } from './docs/data-model/json-x/json-x';
37
+ export { replaceInDocumentBody } from './docs/data-model/replacement';
38
+ export { DEFAULT_DOCUMENT_SUB_COMPONENT_ID } from './docs/data-model/subdocument';
35
39
  export { ActionIterator } from './docs/data-model/text-x/action-iterator';
36
- export { getBodySlice, composeBody, SliceBodyType } from './docs/data-model/text-x/utils';
40
+ export { type IDeleteAction, type IInsertAction, type IRetainAction, type TextXAction, TextXActionType, } from './docs/data-model/text-x/action-types';
41
+ export { normalizeTextRuns } from './docs/data-model/text-x/apply-utils/common';
42
+ export { updateAttributeByDelete } from './docs/data-model/text-x/apply-utils/delete-apply';
43
+ export { updateAttributeByInsert } from './docs/data-model/text-x/apply-utils/insert-apply';
37
44
  export { TextX } from './docs/data-model/text-x/text-x';
38
45
  export type { TPriority } from './docs/data-model/text-x/text-x';
39
- export { JSONX, JSON1 } from './docs/data-model/json-x/json-x';
40
- export type { JSONXActions, JSONXPath } from './docs/data-model/json-x/json-x';
41
- export { replaceInDocumentBody } from './docs/data-model/replacement';
42
- export { type IEventObserver, EventState, EventSubject, fromEventSubject } from './observer/observable';
43
- export { Plugin } from './services/plugin/plugin';
44
- export { PluginService, DependentOn } from './services/plugin/plugin.service';
46
+ export { composeBody, getBodySlice, SliceBodyType } from './docs/data-model/text-x/utils';
47
+ export { getCustomDecorationSlice, getCustomRangeSlice, normalizeBody } from './docs/data-model/text-x/utils';
48
+ export { EventState, EventSubject, fromEventSubject, type IEventObserver } from './observer/observable';
49
+ export { AuthzIoLocalService } from './services/authz-io/authz-io-local.service';
50
+ export { IAuthzIoService } from './services/authz-io/type';
45
51
  export { type CommandListener, CommandService, CommandType, type ICommand, type ICommandInfo, ICommandService, type IExecutionOptions, type IMultiCommand, type IMutation, type IMutationCommonParams, type IMutationInfo, type IOperation, type IOperationInfo, NilCommand, sequenceExecute, sequenceExecuteAsync, } from './services/command/command.service';
46
52
  export { IConfigService } from './services/config/config.service';
53
+ export { ConfigService } from './services/config/config.service';
47
54
  export * from './services/context/context';
48
55
  export { ContextService, IContextService } from './services/context/context.service';
49
56
  export { ErrorService, type IError } from './services/error/error.service';
50
57
  export { IUniverInstanceService } from './services/instance/instance.service';
58
+ export { UniverInstanceService } from './services/instance/instance.service';
51
59
  export { LifecycleStages, OnLifecycle, runOnLifecycle } from './services/lifecycle/lifecycle';
52
60
  export { LifecycleService } from './services/lifecycle/lifecycle.service';
61
+ export { LifecycleInitializerService } from './services/lifecycle/lifecycle.service';
53
62
  export { ILocalStorageService } from './services/local-storage/local-storage.service';
54
63
  export { LocaleService } from './services/locale/locale.service';
55
64
  export { DesktopLogService, ILogService, LogLevel } from './services/log/log.service';
65
+ export { PermissionService } from './services/permission/permission.service';
56
66
  export { IPermissionService, PermissionStatus, } from './services/permission/type';
57
67
  export type { IPermissionParam } from './services/permission/type';
58
68
  export type { IPermissionPoint } from './services/permission/type';
69
+ export type { IPermissionTypes, RangePermissionPointConstructor, WorkbookPermissionPointConstructor, WorkSheetPermissionPointConstructor } from './services/permission/type';
70
+ export { Plugin } from './services/plugin/plugin';
71
+ export type { PluginCtor } from './services/plugin/plugin';
72
+ export { DependentOn, PluginService } from './services/plugin/plugin.service';
73
+ export { type DependencyOverride, mergeOverrideWithDependencies } from './services/plugin/plugin-override';
59
74
  export { IResourceLoaderService } from './services/resource-loader/type';
60
75
  export { ResourceManagerService } from './services/resource-manager/resource-manager.service';
61
76
  export type { IResourceHook } from './services/resource-manager/type';
62
77
  export { IResourceManagerService } from './services/resource-manager/type';
63
78
  export { type IStyleSheet, ThemeService } from './services/theme/theme.service';
64
- export { type IUndoRedoCommandInfos, type IUndoRedoCommandInfosByInterceptor, type IUndoRedoItem, IUndoRedoService, type IUndoRedoStatus, LocalUndoRedoService, RedoCommand, UndoCommand, RedoCommandId, UndoCommandId, } from './services/undoredo/undoredo.service';
79
+ export { type IUndoRedoCommandInfos, type IUndoRedoCommandInfosByInterceptor, type IUndoRedoItem, IUndoRedoService, type IUndoRedoStatus, LocalUndoRedoService, RedoCommand, RedoCommandId, UndoCommand, UndoCommandId, } from './services/undoredo/undoredo.service';
80
+ export { createDefaultUser } from './services/user-manager/const';
81
+ export { type IUser, UserManagerService } from './services/user-manager/user-manager.service';
65
82
  export * from './shared';
83
+ export { isBlackColor, isWhiteColor } from './shared/color/color-kit';
84
+ export { cellToRange } from './shared/common';
85
+ export { nameCharacterCheck } from './shared/name';
66
86
  export { fromCallback, takeAfter } from './shared/rxjs';
67
- export { UserManagerService, type IUser } from './services/user-manager/user-manager.service';
68
- export type { IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';
69
- export { composeInterceptors, createInterceptorKey, InterceptorManager } from './common/interceptor';
70
- export { normalizeTextRuns } from './docs/data-model/text-x/apply-utils/common';
71
- export type { PluginCtor } from './services/plugin/plugin';
72
- export { type DependencyOverride, mergeOverrideWithDependencies } from './services/plugin/plugin-override';
73
- export * from './types/const';
74
- export * from './types/enum';
75
- export * from './types/interfaces';
76
- export { UniverInstanceService } from './services/instance/instance.service';
77
- export { LifecycleInitializerService } from './services/lifecycle/lifecycle.service';
78
- export { ConfigService } from './services/config/config.service';
79
- export { isRangesEqual, isUnitRangesEqual } from './sheets/util';
87
+ export { awaitTime } from './shared/timer';
80
88
  export { Range } from './sheets/range';
89
+ export { DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_COUNT_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_COUNT_KEY, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_HEIGHT_KEY, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY, mergeWorksheetSnapshotWithDefault, } from './sheets/sheet-snapshot-utils';
81
90
  export { Styles } from './sheets/styles';
82
- 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';
83
- export { SheetViewModel } from './sheets/view-model';
84
91
  export * from './sheets/typedef';
92
+ export { isRangesEqual, isUnitRangesEqual } from './sheets/util';
93
+ export { SheetViewModel } from './sheets/view-model';
85
94
  export { getWorksheetUID, Workbook } from './sheets/workbook';
86
- export { Worksheet, extractPureTextFromCell } from './sheets/worksheet';
95
+ export { extractPureTextFromCell, getOriginCellValue, Worksheet } from './sheets/worksheet';
87
96
  export { SlideDataModel } from './slides/slide-model';
88
97
  export * from './types/const';
98
+ export * from './types/const';
99
+ export { skipParseTagNames } from './types/const/clipboard';
100
+ export * from './types/enum';
89
101
  export * from './types/enum';
90
- export * from './types/interfaces';
91
- export { isBlackColor, isWhiteColor } from './shared/color/color-kit';
92
- export { cellToRange } from './shared/common';
93
- export type { IDataValidationRule, IDataValidationRuleBase, IDataValidationRuleInfo, IDataValidationRuleOptions, ISheetDataValidationRule } from './types/interfaces/i-data-validation';
94
- export type { ICellCustomRender, ICellRenderContext } from './types/interfaces/i-cell-custom-render';
95
102
  export { DataValidationErrorStyle } from './types/enum/data-validation-error-style';
96
103
  export { DataValidationImeMode } from './types/enum/data-validation-ime-mode';
97
104
  export { DataValidationOperator } from './types/enum/data-validation-operator';
98
- export { DataValidationType } from './types/enum/data-validation-type';
105
+ export { DataValidationRenderMode } from './types/enum/data-validation-render-mode';
99
106
  export { DataValidationStatus } from './types/enum/data-validation-status';
100
- export type { IPermissionTypes, WorkbookPermissionPointConstructor, WorkSheetPermissionPointConstructor, RangePermissionPointConstructor } from './services/permission/type';
101
- export { PermissionService } from './services/permission/permission.service';
102
- export { AuthzIoLocalService } from './services/authz-io/authz-io-local.service';
103
- export { IAuthzIoService } from './services/authz-io/type';
104
- export { createDefaultUser } from './services/user-manager/const';
105
- export { skipParseTagNames } from './types/const/clipboard';
106
- export { normalizeBody, getCustomRangeSlice, getCustomDecorationSlice } from './docs/data-model/text-x/utils';
107
- export { updateAttributeByDelete } from './docs/data-model/text-x/apply-utils/delete-apply';
108
- export { updateAttributeByInsert } from './docs/data-model/text-x/apply-utils/insert-apply';
109
- export { nameCharacterCheck } from './shared/name';
110
- export { mixinClass } from './common/mixin';
111
- export * from './common/di';
107
+ export { DataValidationType } from './types/enum/data-validation-type';
108
+ export * from './types/interfaces';
109
+ export * from './types/interfaces';
110
+ export type { ICellCustomRender, ICellRenderContext } from './types/interfaces/i-cell-custom-render';
111
+ export type { IDataValidationRule, IDataValidationRuleBase, IDataValidationRuleInfo, IDataValidationRuleOptions, ISheetDataValidationRule } from './types/interfaces/i-data-validation';
112
+ export { Univer } from './univer';
@@ -1,11 +1,11 @@
1
1
  import { Observable } from 'rxjs';
2
- import { IDisposable, Injector } from '../../common/di';
2
+ import { Injector, IDisposable } from '../../common/di';
3
+ import { UniverInstanceType, UnitModel, UnitType } from '../../common/unit';
3
4
  import { DocumentDataModel } from '../../docs/data-model/document-data-model';
4
- import { Nullable } from '../../shared';
5
5
  import { Disposable } from '../../shared/lifecycle';
6
6
  import { Workbook } from '../../sheets/workbook';
7
7
  import { IContextService } from '../context/context.service';
8
- import { UnitModel, UnitType, UniverInstanceType } from '../../common/unit';
8
+ import { Nullable } from '../../shared';
9
9
  export type UnitCtor = new (...args: any[]) => UnitModel;
10
10
  export interface ICreateUnitOptions {
11
11
  /**
@@ -13,32 +13,32 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { checkIfMove, MOVE_BUFFER_VALUE, ROTATE_BUFFER_VALUE } from './check-if-move';
16
+ export { afterInitApply } from './after-init-apply';
17
17
  export * from './array-search';
18
18
  export * from './blob';
19
+ export { checkIfMove, MOVE_BUFFER_VALUE, ROTATE_BUFFER_VALUE } from './check-if-move';
20
+ export * from './clipboard';
19
21
  export * from './color/color';
20
- export { ColorKit, COLORS, RGB_PAREN, RGBA_PAREN, type IRgbColor } from './color/color-kit';
22
+ export { ColorKit, COLORS, type IRgbColor, RGB_PAREN, RGBA_PAREN } from './color/color-kit';
21
23
  export * from './command-enum';
22
24
  export * from './common';
23
25
  export * from './compare';
26
+ export * from './debounce';
24
27
  export * from './doc-tool';
25
28
  export * from './generate';
26
29
  export * from './hash-algorithm';
27
30
  export * from './lifecycle';
28
31
  export * from './locale';
29
- export * from './lru/index';
32
+ export { LRUHelper, LRUMap } from './lru/lru-map';
33
+ export { numfmt } from './numfmt';
30
34
  export * from './object-matrix';
35
+ export { queryObjectMatrix } from './object-matrix-query';
36
+ export { moveRangeByOffset } from './range';
31
37
  export * from './rectangle';
32
38
  export { RefAlias } from './ref-alias';
33
39
  export * from './row-col-iter';
34
40
  export * from './sequence';
35
- export * from './sort-rules';
36
41
  export * from './shape';
42
+ export * from './sort-rules';
37
43
  export * from './tools';
38
44
  export * from './types';
39
- export * from './debounce';
40
- export * from './clipboard';
41
- export { numfmt } from './numfmt';
42
- export { queryObjectMatrix } from './object-matrix-query';
43
- export { moveRangeByOffset } from './range';
44
- export { afterInitApply } from './after-init-apply';
@@ -13,10 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare class LRUHelper {
17
- static hasLength(array: unknown[], size: number): boolean;
18
- static getValueType(value: any): string;
19
- static isObject<T = object>(value?: any): value is T;
20
- static isIterable<T>(value?: any): value is Iterable<T>;
21
- static isNumber(value?: any): value is number;
22
- }
16
+ export {};
@@ -62,4 +62,11 @@ export declare class LRUMap<K, V> {
62
62
  }>;
63
63
  toString(): string;
64
64
  }
65
+ export declare class LRUHelper {
66
+ static hasLength(array: unknown[], size: number): boolean;
67
+ static getValueType(value: any): string;
68
+ static isObject<T = object>(value?: any): value is T;
69
+ static isIterable<T>(value?: any): value is Iterable<T>;
70
+ static isNumber(value?: any): value is number;
71
+ }
65
72
  export {};
@@ -1,3 +1,4 @@
1
- import { IRange } from '../sheets/typedef';
2
1
  import { ObjectMatrix } from './object-matrix';
2
+ import { IRange } from '../sheets/typedef';
3
3
  export declare function queryObjectMatrix<T>(matrix: ObjectMatrix<T>, match: (value: T) => boolean): IRange[];
4
+ export declare function multiSubtractMultiRanges(ranges1: IRange[], ranges2: IRange[]): IRange[];
@@ -1,2 +1,27 @@
1
1
  import { IRange } from '../sheets/typedef';
2
2
  export declare function moveRangeByOffset(range: IRange, refOffsetX: number, refOffsetY: number, ignoreAbsolute?: boolean): IRange;
3
+ /**
4
+ * Split ranges into aligned smaller ranges
5
+ * @param ranges no overlap ranges
6
+ * @returns aligned smaller ranges
7
+ */
8
+ export declare function splitIntoGrid(ranges: IRange[]): IRange[];
9
+ /**
10
+ * Horizontal Merging
11
+ * @param ranges no overlap ranges
12
+ * @returns merged ranges
13
+ */
14
+ export declare function mergeHorizontalRanges(ranges: IRange[]): IRange[];
15
+ /**
16
+ * Vertical Merging
17
+ * @param ranges no overlap ranges
18
+ * @returns merged ranges
19
+ */
20
+ export declare function mergeVerticalRanges(ranges: IRange[]): IRange[];
21
+ /**
22
+ * Merge no overlap ranges
23
+ * @param ranges no overlap ranges
24
+ * @returns ranges
25
+ */
26
+ export declare function mergeRanges(ranges: IRange[]): IRange[];
27
+ export declare function multiSubtractSingleRange(ranges: IRange[], toDelete: IRange): IRange[];
@@ -18,6 +18,13 @@ export declare class Rectangle {
18
18
  static moveVertical: (range: IRange, step?: number, length?: number) => IRange;
19
19
  static moveOffset: (range: IRange, offsetX: number, offsetY: number) => IRange;
20
20
  static subtract(range1: IRange, range2: IRange): IRange[];
21
+ /**
22
+ * Combine smaller rectangles into larger ones
23
+ * @param ranges
24
+ * @returns
25
+ */
26
+ static mergeRanges(ranges: IRange[]): IRange[];
27
+ static subtractMulti(ranges1: IRange[], ranges2: IRange[]): IRange[];
21
28
  static hasIntersectionBetweenTwoRect(rect1: IRectLTRB, rect2: IRectLTRB): boolean;
22
29
  static getIntersectionBetweenTwoRect(rect1: IRectLTRB, rect2: IRectLTRB): Required<IRectLTRB> | null;
23
30
  }
@@ -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 declare function awaitTime(ms: number): Promise<void>;
@@ -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,55 @@
1
+ import { Disposable } from '../shared/lifecycle';
2
+ import { IRange } from './typedef';
3
+ export declare class SpanModel extends Disposable {
4
+ /**
5
+ * @property Cache for RANGE_TYPE.NORMAL
6
+ */
7
+ private _cellCache;
8
+ /**
9
+ * @property Cache for RANGE_TYPE.ROW
10
+ */
11
+ private _rowCache;
12
+ /**
13
+ * @property Cache for RANGE_TYPE.COLUMN
14
+ */
15
+ private _columnCache;
16
+ /**
17
+ * @property Whether has RANGE_TYPE.ALL
18
+ */
19
+ private _hasAll;
20
+ /**
21
+ * @property Index for RANGE_TYPE.ALL
22
+ */
23
+ private _allIndex;
24
+ /**
25
+ * @property the original merge data
26
+ */
27
+ private _mergeData;
28
+ private _rangeMap;
29
+ private _skeletonCache;
30
+ constructor(mergeData: IRange[]);
31
+ private _init;
32
+ private _clearCache;
33
+ private _createCache;
34
+ /**
35
+ * Rebuild the merge data cache when the merge data is changed.
36
+ * @param {IRange[]} mergeData
37
+ */
38
+ rebuild(mergeData: IRange[]): void;
39
+ private _createRowCache;
40
+ private _createColumnCache;
41
+ private _createCellAllCache;
42
+ private _createCellCache;
43
+ add(range: IRange): void;
44
+ remove(row: number, column: number): void;
45
+ getMergedCell(row: number, column: number): IRange | null;
46
+ isRowContainsMergedCell(row: number): boolean;
47
+ isColumnContainsMergedCell(column: number): boolean;
48
+ getMergedCellRange(startRow: number, startColumn: number, endRow: number, endColumn: number): IRange[];
49
+ getMergedCellRangeForSkeleton(startRow: number, startColumn: number, endRow: number, endColumn: number): IRange[];
50
+ private _getRangeFromCache;
51
+ private _getSkeletonRangeFromCache;
52
+ private _getMergeDataIndex;
53
+ getMergeDataSnapshot(): IRange[];
54
+ dispose(): void;
55
+ }
@@ -466,6 +466,7 @@ export interface ITextRangeParam extends ITextRange {
466
466
  }
467
467
  /**
468
468
  * Determines whether the cell(row, column) is within the range of the merged cells.
469
+ * @deprecated please use worksheet.getCellInfoInMergeData instead
469
470
  */
470
471
  export declare function getCellInfoInMergeData(row: number, column: number, mergeData?: IRange[]): ISelectionCell;
471
472
  export {};
@@ -1,9 +1,9 @@
1
1
  import { Observable } from 'rxjs';
2
- import { ILogService } from '../services/log/log.service';
3
- import { Nullable } from '../shared';
4
2
  import { UnitModel, UniverInstanceType } from '../common/unit';
3
+ import { ILogService } from '../services/log/log.service';
5
4
  import { Styles } from './styles';
6
5
  import { Worksheet } from './worksheet';
6
+ import { Nullable } from '../shared';
7
7
  import { IRangeType, IWorkbookData, IWorksheetData } from './typedef';
8
8
  export declare function getWorksheetUID(workbook: Workbook, worksheet: Worksheet): string;
9
9
  /**
@@ -61,6 +61,7 @@ export declare class Workbook extends UnitModel<IWorkbookData, UniverInstanceTyp
61
61
  getUnitId(): string;
62
62
  getRev(): number;
63
63
  incrementRev(): void;
64
+ setRev(rev: number): void;
64
65
  /**
65
66
  * Add a Worksheet into Workbook.
66
67
  */
@@ -3,9 +3,10 @@ import { BooleanNumber } from '../types/enum';
3
3
  import { ColumnManager } from './column-manager';
4
4
  import { Range } from './range';
5
5
  import { RowManager } from './row-manager';
6
+ import { SpanModel } from './span-model';
6
7
  import { SheetViewModel } from './view-model';
7
8
  import { Styles } from './styles';
8
- import { ICellData, ICellDataForSheetInterceptor, IFreeze, IRange, IWorksheetData } from './typedef';
9
+ import { ICellData, ICellDataForSheetInterceptor, IFreeze, IRange, ISelectionCell, IWorksheetData } from './typedef';
9
10
  /**
10
11
  * The model of a Worksheet.
11
12
  */
@@ -18,6 +19,7 @@ export declare class Worksheet {
18
19
  protected _rowManager: RowManager;
19
20
  protected _columnManager: ColumnManager;
20
21
  protected readonly _viewModel: SheetViewModel;
22
+ protected _spanModel: SpanModel;
21
23
  constructor(unitId: string, snapshot: Partial<IWorksheetData>, _styles: Styles);
22
24
  /**
23
25
  * @internal
@@ -25,6 +27,12 @@ export declare class Worksheet {
25
27
  */
26
28
  __interceptViewModel(callback: (viewModel: SheetViewModel) => void): void;
27
29
  getSnapshot(): IWorksheetData;
30
+ /**
31
+ * Set the merge data of the sheet, all the merged cells will be rebuilt.
32
+ * @param mergeData
33
+ */
34
+ setMergeData(mergeData: IRange[]): void;
35
+ getSpanModel(): SpanModel;
28
36
  /**
29
37
  * Returns WorkSheet Cell Data Matrix
30
38
  * @returns
@@ -70,8 +78,55 @@ export declare class Worksheet {
70
78
  * @deprecated
71
79
  */
72
80
  clone(): Worksheet;
81
+ /**
82
+ * Get the merged cell list of the sheet.
83
+ * @returns {IRange[]} merged cell list
84
+ */
73
85
  getMergeData(): IRange[];
86
+ /**
87
+ * Get the merged cell Range of the sheet cell.
88
+ * @param {number} row The row index of test cell
89
+ * @param {number} col The column index of test cell
90
+ * @returns {Nullable<IRange>} The merged cell range of the cell, if the cell is not in a merged cell, return null
91
+ */
74
92
  getMergedCell(row: number, col: number): Nullable<IRange>;
93
+ /**
94
+ * Get the merged cell info list which has intersection with the given range.
95
+ * @param {number} startRow The start row index of the range
96
+ * @param {number} startColumn The start column index of the range
97
+ * @param {number} endRow The end row index of the range
98
+ * @param {number} endColumn The end column index of the range
99
+ * @returns {IRange} The merged cell info list which has intersection with the given range or empty array if no merged cell in the range
100
+ */
101
+ getMergedCellRange(startRow: number, startColumn: number, endRow: number, endColumn: number): IRange[];
102
+ /**
103
+ * Get if the row contains merged cell
104
+ * @param {number} row The row index
105
+ * @returns {boolean} Is merge cell across row
106
+ */
107
+ isRowContainsMergedCell(row: number): boolean;
108
+ /**
109
+ * Get if the column contains merged cell
110
+ * @param {number} column The column index
111
+ * @returns {boolean} Is merge cell across column
112
+ */
113
+ isColumnContainsMergedCell(column: number): boolean;
114
+ /**
115
+ * Get cell info with merge data
116
+ * @param {number} row - The row index of the cell.
117
+ * @param {number} column - The column index of the cell.
118
+ * @type {selectionCell}
119
+ * @property {number} actualRow - The actual row index of the cell
120
+ * @property {number} actualColumn - The actual column index of the cell
121
+ * @property {boolean} isMergedMainCell - Whether the cell is the main cell of the merged cell, only the upper left cell in the merged cell returns true here
122
+ * @property {boolean} isMerged - Whether the cell is in a merged cell, the upper left cell in the merged cell returns false here
123
+ * @property {number} endRow - The end row index of the merged cell
124
+ * @property {number} endColumn - The end column index of the merged cell
125
+ * @property {number} startRow - The start row index of the merged cell
126
+ * @property {number} startColumn - The start column index of the merged cell
127
+ * @returns {selectionCell} - The cell info with merge data
128
+ */
129
+ getCellInfoInMergeData(row: number, column: number): ISelectionCell;
75
130
  /**
76
131
  * Get cellData, includes cellData, customRender, markers, dataValidate, etc.
77
132
  *
@@ -242,3 +297,4 @@ export interface ICell {
242
297
  * @returns pure text in this cell
243
298
  */
244
299
  export declare function extractPureTextFromCell(cell: Nullable<ICellData>): string;
300
+ export declare function getOriginCellValue(cell: Nullable<ICellData>): Nullable<import('./typedef').CellValue>;
@@ -1,7 +1,7 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { UnitModel, UniverInstanceType } from '../common/unit';
3
+ import { PageType, ISlideData, ISlidePage } from '../types/interfaces';
3
4
  import { Nullable } from '../shared';
4
- import { ISlideData, ISlidePage, PageType } from '../types/interfaces';
5
5
  export declare class SlideDataModel extends UnitModel<ISlideData, UniverInstanceType.UNIVER_SLIDE> {
6
6
  type: UniverInstanceType.UNIVER_SLIDE;
7
7
  private readonly _activePage$;
@@ -13,6 +13,9 @@ export declare class SlideDataModel extends UnitModel<ISlideData, UniverInstance
13
13
  private _unitId;
14
14
  constructor(snapshot: Partial<ISlideData>);
15
15
  setName(name: string): void;
16
+ getRev(): number;
17
+ incrementRev(): void;
18
+ setRev(_rev: number): void;
16
19
  getSnapshot(): ISlideData;
17
20
  getUnitId(): string;
18
21
  getPages(): {