@univerjs/core 0.2.14 → 0.3.0-alpha.0

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 (40) hide show
  1. package/lib/cjs/index.js +9 -8
  2. package/lib/es/index.js +11500 -10838
  3. package/lib/types/common/interceptor.d.ts +7 -0
  4. package/lib/types/common/unit.d.ts +9 -0
  5. package/lib/types/docs/data-model/document-data-model.d.ts +5 -4
  6. package/lib/types/docs/data-model/index.d.ts +1 -1
  7. package/lib/types/{shared/lru/index.d.ts → docs/data-model/text-x/build-utils/__test__/selection.spec.d.ts} +1 -2
  8. package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +5 -3
  9. package/lib/types/docs/data-model/text-x/build-utils/parse.d.ts +3 -0
  10. package/lib/types/docs/data-model/text-x/build-utils/selection.d.ts +1 -1
  11. package/lib/types/index.d.ts +58 -56
  12. package/lib/types/services/instance/instance.service.d.ts +3 -3
  13. package/lib/types/services/locale/locale.service.d.ts +1 -1
  14. package/lib/types/services/resource-loader/resource-loader.service.d.ts +1 -1
  15. package/lib/types/services/resource-manager/type.d.ts +1 -1
  16. package/lib/types/shared/array-search.d.ts +7 -0
  17. package/lib/types/shared/index.d.ts +9 -10
  18. package/lib/types/shared/lru/{lru-helper.d.ts → __tests__/lru-map.spec.d.ts} +1 -7
  19. package/lib/types/shared/lru/lru-map.d.ts +7 -0
  20. package/lib/types/shared/object-matrix-query.d.ts +5 -1
  21. package/lib/types/shared/object-matrix.d.ts +1 -1
  22. package/lib/types/shared/range.d.ts +25 -0
  23. package/lib/types/shared/rectangle.d.ts +21 -0
  24. package/lib/types/shared/timer.d.ts +16 -0
  25. package/lib/types/shared/tools.d.ts +0 -17
  26. package/lib/types/sheets/__tests__/span-mode.spec.d.ts +16 -0
  27. package/lib/types/sheets/range.d.ts +2 -2
  28. package/lib/types/sheets/span-model.d.ts +62 -0
  29. package/lib/types/sheets/typedef.d.ts +1 -0
  30. package/lib/types/sheets/view-model.d.ts +4 -1
  31. package/lib/types/sheets/workbook.d.ts +3 -2
  32. package/lib/types/sheets/worksheet.d.ts +71 -1
  33. package/lib/types/slides/slide-model.d.ts +4 -1
  34. package/lib/types/types/enum/index.d.ts +2 -2
  35. package/lib/types/types/enum/text-style.d.ts +1 -1
  36. package/lib/types/types/interfaces/index.d.ts +1 -1
  37. package/lib/types/univer.d.ts +4 -4
  38. package/lib/umd/index.js +9 -8
  39. package/package.json +7 -7
  40. package/lib/types/shared/debounce.d.ts +0 -27
@@ -1,9 +1,16 @@
1
1
  import { Nullable } from '../shared/types';
2
2
  export type InterceptorHandler<M = unknown, C = unknown> = (value: Nullable<M>, context: C, next: (value: Nullable<M>) => Nullable<M>) => Nullable<M>;
3
+ export declare enum InterceptorEffectEnum {
4
+ Style = 1,// 1<< 0
5
+ Value = 2
6
+ }
3
7
  export interface IInterceptor<M, C> {
4
8
  priority?: number;
5
9
  handler: InterceptorHandler<M, C>;
6
10
  }
11
+ export interface ICellInterceptor<M, C> extends IInterceptor<M, C> {
12
+ effect?: InterceptorEffectEnum;
13
+ }
7
14
  export declare function createInterceptorKey<T, C>(key: string): IInterceptor<T, C>;
8
15
  export type IComposeInterceptors<T = any, C = any> = (interceptors: Array<IInterceptor<T, C>>) => (initValue: Nullable<T>, initContext: C) => Nullable<T>;
9
16
  /**
@@ -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;
@@ -15,5 +15,5 @@
15
15
  */
16
16
  export * from './document-data-model';
17
17
  export * from './preset-list-type';
18
- export * from './types';
19
18
  export * from './text-x/build-utils';
19
+ export * from './types';
@@ -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;
@@ -1,8 +1,8 @@
1
- import { DeleteDirection } from '../../../../types/enum';
2
1
  import { Nullable } from '../../../../shared';
3
2
  import { ITextRange } from '../../../../sheets/typedef';
4
3
  import { IDocumentBody } from '../../../../types/interfaces';
5
4
  import { IDeleteAction, IRetainAction } from '../action-types';
5
+ import { DeleteDirection } from '../../../../types/enum';
6
6
  export declare function makeSelection(startOffset: number, endOffset?: number): ITextRange;
7
7
  export declare function normalizeSelection(selection: ITextRange): ITextRange;
8
8
  export declare function getSelectionWithSymbolMax(selection: ITextRange, body: IDocumentBody): {
@@ -13,99 +13,101 @@
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 { debounce, get, merge, mergeWith, set } from 'lodash-es';
17
+ export { dedupe, groupBy, makeArray, remove, rotate } from './common/array';
24
18
  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';
19
+ 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';
20
+ export * from './common/di';
21
+ export { shallowEqual } from './common/equal';
22
+ export { CustomCommandExecutionError } from './common/error';
28
23
  export { throttle } from './common/function';
24
+ export type { ICellInterceptor, IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';
25
+ export { composeInterceptors, createInterceptorKey, InterceptorEffectEnum, InterceptorManager } from './common/interceptor';
26
+ export type { Serializable } from './common/json';
29
27
  export { MemoryCursor } from './common/memory-cursor';
28
+ export { mixinClass } from './common/mixin';
29
+ export { isNumeric, isSafeNumeric } from './common/number';
30
+ export { Registry, RegistryAsMap } from './common/registry';
30
31
  export { requestImmediateMacroTask } from './common/request-immediate-macro-task';
31
32
  export { type ISequenceExecuteResult, sequence, sequenceAsync } from './common/sequence';
33
+ export { mergeSets } from './common/set';
34
+ export { UnitModel, type UnitType, UniverInstanceType } from './common/unit';
32
35
  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';
36
+ export { JSON1, JSONX } from './docs/data-model/json-x/json-x';
37
+ export type { JSONXActions, JSONXPath } from './docs/data-model/json-x/json-x';
38
+ export { replaceInDocumentBody } from './docs/data-model/replacement';
39
+ export { DEFAULT_DOCUMENT_SUB_COMPONENT_ID } from './docs/data-model/subdocument';
35
40
  export { ActionIterator } from './docs/data-model/text-x/action-iterator';
36
- export { getBodySlice, composeBody, SliceBodyType } from './docs/data-model/text-x/utils';
41
+ export { type IDeleteAction, type IInsertAction, type IRetainAction, type TextXAction, TextXActionType, } from './docs/data-model/text-x/action-types';
42
+ export { normalizeTextRuns } from './docs/data-model/text-x/apply-utils/common';
43
+ export { updateAttributeByDelete } from './docs/data-model/text-x/apply-utils/delete-apply';
44
+ export { updateAttributeByInsert } from './docs/data-model/text-x/apply-utils/insert-apply';
37
45
  export { TextX } from './docs/data-model/text-x/text-x';
38
46
  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';
47
+ export { composeBody, getBodySlice, SliceBodyType } from './docs/data-model/text-x/utils';
48
+ export { getCustomDecorationSlice, getCustomRangeSlice, normalizeBody } from './docs/data-model/text-x/utils';
49
+ export { EventState, EventSubject, fromEventSubject, type IEventObserver } from './observer/observable';
50
+ export { AuthzIoLocalService } from './services/authz-io/authz-io-local.service';
51
+ export { IAuthzIoService } from './services/authz-io/type';
45
52
  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
53
  export { IConfigService } from './services/config/config.service';
54
+ export { ConfigService } from './services/config/config.service';
47
55
  export * from './services/context/context';
48
56
  export { ContextService, IContextService } from './services/context/context.service';
49
57
  export { ErrorService, type IError } from './services/error/error.service';
50
58
  export { IUniverInstanceService } from './services/instance/instance.service';
59
+ export { UniverInstanceService } from './services/instance/instance.service';
51
60
  export { LifecycleStages, OnLifecycle, runOnLifecycle } from './services/lifecycle/lifecycle';
52
61
  export { LifecycleService } from './services/lifecycle/lifecycle.service';
62
+ export { LifecycleInitializerService } from './services/lifecycle/lifecycle.service';
53
63
  export { ILocalStorageService } from './services/local-storage/local-storage.service';
54
64
  export { LocaleService } from './services/locale/locale.service';
55
65
  export { DesktopLogService, ILogService, LogLevel } from './services/log/log.service';
66
+ export { PermissionService } from './services/permission/permission.service';
56
67
  export { IPermissionService, PermissionStatus, } from './services/permission/type';
57
68
  export type { IPermissionParam } from './services/permission/type';
58
69
  export type { IPermissionPoint } from './services/permission/type';
70
+ export type { IPermissionTypes, RangePermissionPointConstructor, WorkbookPermissionPointConstructor, WorkSheetPermissionPointConstructor } from './services/permission/type';
71
+ export { Plugin } from './services/plugin/plugin';
72
+ export type { PluginCtor } from './services/plugin/plugin';
73
+ export { DependentOn, PluginService } from './services/plugin/plugin.service';
74
+ export { type DependencyOverride, mergeOverrideWithDependencies } from './services/plugin/plugin-override';
59
75
  export { IResourceLoaderService } from './services/resource-loader/type';
60
76
  export { ResourceManagerService } from './services/resource-manager/resource-manager.service';
61
- export type { IResourceHook } from './services/resource-manager/type';
77
+ export type { IResourceHook, IResources } from './services/resource-manager/type';
62
78
  export { IResourceManagerService } from './services/resource-manager/type';
63
79
  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';
80
+ export { type IUndoRedoCommandInfos, type IUndoRedoCommandInfosByInterceptor, type IUndoRedoItem, IUndoRedoService, type IUndoRedoStatus, LocalUndoRedoService, RedoCommand, RedoCommandId, UndoCommand, UndoCommandId, } from './services/undoredo/undoredo.service';
81
+ export { createDefaultUser } from './services/user-manager/const';
82
+ export { type IUser, UserManagerService } from './services/user-manager/user-manager.service';
65
83
  export * from './shared';
84
+ export { isBlackColor, isWhiteColor } from './shared/color/color-kit';
85
+ export { cellToRange } from './shared/common';
86
+ export { nameCharacterCheck } from './shared/name';
66
87
  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';
88
+ export { awaitTime } from './shared/timer';
80
89
  export { Range } from './sheets/range';
90
+ 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
91
  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
92
  export * from './sheets/typedef';
93
+ export { isRangesEqual, isUnitRangesEqual } from './sheets/util';
94
+ export { SheetViewModel } from './sheets/view-model';
85
95
  export { getWorksheetUID, Workbook } from './sheets/workbook';
86
- export { Worksheet, extractPureTextFromCell } from './sheets/worksheet';
96
+ export { extractPureTextFromCell, getOriginCellValue, Worksheet } from './sheets/worksheet';
87
97
  export { SlideDataModel } from './slides/slide-model';
88
98
  export * from './types/const';
99
+ export * from './types/const';
100
+ export { skipParseTagNames } from './types/const/clipboard';
101
+ export * from './types/enum';
89
102
  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
103
  export { DataValidationErrorStyle } from './types/enum/data-validation-error-style';
96
104
  export { DataValidationImeMode } from './types/enum/data-validation-ime-mode';
97
105
  export { DataValidationOperator } from './types/enum/data-validation-operator';
98
- export { DataValidationType } from './types/enum/data-validation-type';
106
+ export { DataValidationRenderMode } from './types/enum/data-validation-render-mode';
99
107
  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';
108
+ export { DataValidationType } from './types/enum/data-validation-type';
109
+ export * from './types/interfaces';
110
+ export * from './types/interfaces';
111
+ export type { ICellCustomRender, ICellRenderContext } from './types/interfaces/i-cell-custom-render';
112
+ export type { IDataValidationRule, IDataValidationRuleBase, IDataValidationRuleInfo, IDataValidationRuleOptions, ISheetDataValidationRule } from './types/interfaces/i-data-validation';
113
+ 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
  /**
@@ -1,7 +1,7 @@
1
1
  import { Subject } from 'rxjs';
2
2
  import { Disposable } from '../../shared/lifecycle';
3
- import { ILanguagePack, ILocales, LanguageValue } from '../../shared/locale';
4
3
  import { LocaleType } from '../../types/enum/locale-type';
4
+ import { ILanguagePack, ILocales, LanguageValue } from '../../shared/locale';
5
5
  /**
6
6
  * This service provides i18n and timezone / location features to other modules.
7
7
  */
@@ -8,6 +8,6 @@ export declare class ResourceLoaderService extends Disposable implements IResour
8
8
  constructor(_resourceManagerService: IResourceManagerService, _univerInstanceService: IUniverInstanceService);
9
9
  private _init;
10
10
  saveUnit<T = object>(unitId: string): ({
11
- resources: import('../resource-manager/type').IResources;
11
+ resources: import('../..').IResources;
12
12
  } & T) | null;
13
13
  }
@@ -13,7 +13,7 @@ export interface IResourceHook<T = any> {
13
13
  businesses: UniverInstanceType[];
14
14
  onLoad: (unitID: string, resource: T) => void;
15
15
  onUnLoad: (unitID: string) => void;
16
- toJson: (unitID: string) => string;
16
+ toJson: (unitID: string, model?: T) => string;
17
17
  parseJson: (bytes: string) => T;
18
18
  }
19
19
  export interface IResourceManagerService {
@@ -15,4 +15,11 @@
15
15
  */
16
16
  export declare function binarySearchArray(arr: number[], pos: number): number;
17
17
  export declare function orderSearchArray(arr: number[], pos: number): number;
18
+ /**
19
+ * return the first index which arr[index] > num
20
+ * ex: searchArray([1, 3, 5, 7, 9], 7) = 4
21
+ * @param arr
22
+ * @param num
23
+ * @returns {number} index
24
+ */
18
25
  export declare function searchArray(arr: number[], num: number): number;
@@ -13,11 +13,13 @@
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,19 +28,16 @@ export * from './generate';
26
28
  export * from './hash-algorithm';
27
29
  export * from './lifecycle';
28
30
  export * from './locale';
29
- export * from './lru/index';
31
+ export { LRUHelper, LRUMap } from './lru/lru-map';
32
+ export { numfmt } from './numfmt';
30
33
  export * from './object-matrix';
34
+ export { queryObjectMatrix } from './object-matrix-query';
35
+ export { moveRangeByOffset, splitIntoGrid } from './range';
31
36
  export * from './rectangle';
32
37
  export { RefAlias } from './ref-alias';
33
38
  export * from './row-col-iter';
34
39
  export * from './sequence';
35
- export * from './sort-rules';
36
40
  export * from './shape';
41
+ export * from './sort-rules';
37
42
  export * from './tools';
38
43
  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,7 @@
1
- import { IRange } from '../sheets/typedef';
2
1
  import { ObjectMatrix } from './object-matrix';
2
+ import { IRange } from '../sheets/typedef';
3
+ /**
4
+ * @deprecated this function could cause memory out of use in large range.
5
+ */
3
6
  export declare function queryObjectMatrix<T>(matrix: ObjectMatrix<T>, match: (value: T) => boolean): IRange[];
7
+ export declare function multiSubtractMultiRanges(ranges1: IRange[], ranges2: IRange[]): IRange[];
@@ -36,7 +36,7 @@ export declare class ObjectMatrix<T> {
36
36
  getRowOrCreate(rowIndex: number): IObjectArrayPrimitiveType<T>;
37
37
  reset(): void;
38
38
  hasValue(): boolean;
39
- getValue(row: number, column: number): T;
39
+ getValue(row: number, column: number): Nullable<T>;
40
40
  setValue(row: number, column: number, value: T): void;
41
41
  /**
42
42
  * !!
@@ -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[];
@@ -6,6 +6,14 @@ import { Nullable } from './types';
6
6
  export declare class Rectangle {
7
7
  static clone(src: IRange): IRange;
8
8
  static equals(src: IRange, target: IRange): boolean;
9
+ /**
10
+ * Check intersects of normal range(RANGE_TYPE.NORMAL)
11
+ * For other types of ranges, please consider using the intersects method.
12
+ * @param rangeA
13
+ * @param rangeB
14
+ * @returns boolean
15
+ */
16
+ static simpleRangesIntersect(rangeA: IRange, rangeB: IRange): boolean;
9
17
  static intersects(src: IRange, target: IRange): boolean;
10
18
  static getIntersects(src: IRange, target: IRange): Nullable<IRange>;
11
19
  static contains(src: IRange, target: IRange): boolean;
@@ -17,7 +25,20 @@ export declare class Rectangle {
17
25
  static moveHorizontal: (range: IRange, step?: number, length?: number) => IRange;
18
26
  static moveVertical: (range: IRange, step?: number, length?: number) => IRange;
19
27
  static moveOffset: (range: IRange, offsetX: number, offsetY: number) => IRange;
28
+ /**
29
+ * Subtract range2 from range1, the result is is horizontal first then vertical
30
+ * @param {IRange} range1 The source range
31
+ * @param {IRange} range2 The range to be subtracted
32
+ * @returns {IRange[]} Returns the array of ranges, which are the result not intersected with range1
33
+ */
20
34
  static subtract(range1: IRange, range2: IRange): IRange[];
35
+ /**
36
+ * Combine smaller rectangles into larger ones
37
+ * @param ranges
38
+ * @returns
39
+ */
40
+ static mergeRanges(ranges: IRange[]): IRange[];
41
+ static subtractMulti(ranges1: IRange[], ranges2: IRange[]): IRange[];
21
42
  static hasIntersectionBetweenTwoRect(rect1: IRectLTRB, rect2: IRectLTRB): boolean;
22
43
  static getIntersectionBetweenTwoRect(rect1: IRectLTRB, rect2: IRectLTRB): Required<IRectLTRB> | null;
23
44
  }
@@ -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>;
@@ -102,24 +102,7 @@ export declare class Tools {
102
102
  static hasIntersectionBetweenTwoRanges(range1Start: number, range1End: number, range2Start: number, range2End: number): boolean;
103
103
  static isStartValidPosition(name: string): boolean;
104
104
  static isValidParameter(name: string): boolean;
105
- /**
106
- * As lodash set, via a path string to set value to deep property
107
- * set(obj, 'xx.yy', val)
108
- * @param data
109
- * @param propertyPath
110
- * @param value
111
- */
112
- static set(data: Record<string, any>, propertyPath: string, value: any): void;
113
105
  static clamp(value: number, min: number, max: number): number;
114
106
  static now(): number;
115
- /**
116
- * @static
117
- * @param {unknown} object Modify the property while leaving the reference unchanged.
118
- * @param {unknown} source The source being merged in object.
119
- * @param {(value: unknown, originValue: unknown, key: string, object: unknown, source: unknown, stack: string[]) => {}} [customizer]
120
- * @return {*}
121
- * @memberof Tools
122
- */
123
- static mergeWith(object: unknown, source: unknown, customizer?: (value: unknown, originValue: unknown, key: string, object: unknown, source: unknown, stack: string[]) => {}): any;
124
107
  }
125
108
  export declare function generateRandomId(n?: number, alphabet?: string): string;
@@ -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 {};
@@ -1,5 +1,5 @@
1
- import { IObjectMatrixPrimitiveType, Nullable, ObjectMatrix } from '../shared';
2
- import { HorizontalAlign, VerticalAlign, BooleanNumber, FontItalic, FontWeight, WrapStrategy } from '../types/enum';
1
+ import { ObjectMatrix, IObjectMatrixPrimitiveType, Nullable } from '../shared';
2
+ import { BooleanNumber, FontItalic, FontWeight, WrapStrategy, HorizontalAlign, VerticalAlign } from '../types/enum';
3
3
  import { IBorderData, IDocumentBody, IDocumentData, IStyleBase, IStyleData, ITextDecoration, ITextRotation } from '../types/interfaces';
4
4
  import { Styles } from './styles';
5
5
  import { ICellData, IRange } from './typedef';