@univerjs/core 0.2.3 → 0.2.4-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 (41) hide show
  1. package/lib/cjs/index.js +11 -9
  2. package/lib/es/index.js +5131 -4095
  3. package/lib/types/common/__tests__/url.spec.d.ts +16 -0
  4. package/lib/types/common/di.d.ts +17 -0
  5. package/lib/types/common/url.d.ts +1 -0
  6. package/lib/types/docs/data-model/document-data-model.d.ts +2 -1
  7. package/lib/types/docs/data-model/preset-list-type.d.ts +3 -29
  8. package/lib/types/docs/data-model/text-x/utils.d.ts +6 -1
  9. package/lib/types/index.d.ts +2 -1
  10. package/lib/types/services/__tests__/index.d.ts +7 -7
  11. package/lib/types/services/authz-io/authz-io-local.service.d.ts +1 -0
  12. package/lib/types/services/authz-io/type.d.ts +1 -1
  13. package/lib/types/services/command/command.service.d.ts +2 -2
  14. package/lib/types/services/config/config.service.d.ts +1 -1
  15. package/lib/types/services/context/context.service.d.ts +1 -1
  16. package/lib/types/services/instance/instance.service.d.ts +2 -2
  17. package/lib/types/services/lifecycle/lifecycle.d.ts +1 -1
  18. package/lib/types/services/lifecycle/lifecycle.service.d.ts +1 -1
  19. package/lib/types/services/local-storage/local-storage.service.d.ts +1 -1
  20. package/lib/types/services/log/log.service.d.ts +1 -1
  21. package/lib/types/services/permission/type.d.ts +1 -1
  22. package/lib/types/services/plugin/plugin-override.d.ts +1 -1
  23. package/lib/types/services/plugin/plugin.d.ts +1 -1
  24. package/lib/types/services/plugin/plugin.service.d.ts +1 -1
  25. package/lib/types/services/resource-loader/type.d.ts +1 -1
  26. package/lib/types/services/resource-manager/type.d.ts +2 -2
  27. package/lib/types/services/snapshot/snapshot-server.service.d.ts +1 -1
  28. package/lib/types/services/undoredo/undoredo.service.d.ts +2 -2
  29. package/lib/types/services/user-manager/user-manager.service.d.ts +1 -0
  30. package/lib/types/shared/lifecycle.d.ts +8 -1
  31. package/lib/types/shared/lru/lru-map.d.ts +1 -1
  32. package/lib/types/shared/rxjs.d.ts +1 -1
  33. package/lib/types/shared/tools.d.ts +7 -0
  34. package/lib/types/sheets/view-model.d.ts +1 -1
  35. package/lib/types/types/interfaces/i-document-data-interceptor.d.ts +10 -0
  36. package/lib/types/types/interfaces/i-document-data.d.ts +29 -21
  37. package/lib/types/types/interfaces/i-range.d.ts +15 -2
  38. package/lib/types/types/interfaces/index.d.ts +1 -0
  39. package/lib/types/univer.d.ts +1 -1
  40. package/lib/umd/index.js +11 -9
  41. package/package.json +7 -7
@@ -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,17 @@
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 * from '@wendellhu/redi';
17
+ export * from '@wendellhu/redi/react-bindings';
@@ -14,3 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export declare function isLegalUrl(url: string): boolean;
17
+ export declare function normalizeUrl(urlStr: string): string;
@@ -2,6 +2,7 @@ import { Nullable } from '../../shared';
2
2
  import { IDocumentBody, IDocumentData, IDocumentRenderConfig, IDocumentStyle, IDrawings } from '../../types/interfaces/i-document-data';
3
3
  import { IPaddingData } from '../../types/interfaces/i-style-data';
4
4
  import { UnitModel, UniverInstanceType } from '../../common/unit';
5
+ import { SliceBodyType } from './text-x/utils';
5
6
  import { JSONXActions } from './json-x/json-x';
6
7
 
7
8
  export declare const DEFAULT_DOC: {
@@ -53,7 +54,7 @@ export declare class DocumentDataModel extends DocumentDataModelSimple {
53
54
  getSelfOrHeaderFooterModel(segmentId?: string): DocumentDataModel;
54
55
  getUnitId(): string;
55
56
  apply(actions: JSONXActions): IDocumentData | undefined;
56
- sliceBody(startOffset: number, endOffset: number): Nullable<IDocumentBody>;
57
+ sliceBody(startOffset: number, endOffset: number, type?: SliceBodyType): Nullable<IDocumentBody>;
57
58
  private _initializeHeaderFooterModel;
58
59
  updateDocumentId(unitId: string): void;
59
60
  }
@@ -1,36 +1,10 @@
1
- import { BulletAlignment, GlyphType } from '../../types/interfaces/i-document-data';
1
+ import { IListData } from '../../types/interfaces/i-document-data';
2
2
 
3
3
  export declare enum PresetListType {
4
4
  BULLET_LIST = "BULLET_LIST",
5
5
  ORDER_LIST = "ORDER_LIST"
6
6
  }
7
7
  export declare const PRESET_LIST_TYPE: {
8
- BULLET_LIST: {
9
- listType: PresetListType;
10
- nestingLevel: {
11
- bulletAlignment: BulletAlignment;
12
- glyphFormat: string;
13
- textStyle: {
14
- fs: number;
15
- };
16
- startNumber: number;
17
- glyphSymbol: string;
18
- hanging: number;
19
- indentStart: number;
20
- }[];
21
- };
22
- ORDER_LIST: {
23
- listType: PresetListType;
24
- nestingLevel: {
25
- bulletAlignment: BulletAlignment;
26
- glyphFormat: string;
27
- textStyle: {
28
- fs: number;
29
- };
30
- startNumber: number;
31
- glyphType: GlyphType;
32
- hanging: number;
33
- indentStart: number;
34
- }[];
35
- };
8
+ BULLET_LIST: IListData;
9
+ ORDER_LIST: IListData;
36
10
  };
@@ -2,7 +2,11 @@ import { UpdateDocsAttributeType } from '../../../shared/command-enum';
2
2
  import { ICustomDecoration, IDocumentBody } from '../../../types/interfaces/i-document-data';
3
3
  import { IRetainAction } from './action-types';
4
4
 
5
- export declare function getBodySlice(body: IDocumentBody, startOffset: number, endOffset: number, returnEmptyTextRun?: boolean): IDocumentBody;
5
+ export declare enum SliceBodyType {
6
+ copy = 0,
7
+ cut = 1
8
+ }
9
+ export declare function getBodySlice(body: IDocumentBody, startOffset: number, endOffset: number, returnEmptyTextRun?: boolean, type?: SliceBodyType): IDocumentBody;
6
10
  export declare function normalizeBody(body: IDocumentBody): IDocumentBody;
7
11
  export declare function getCustomRangeSlice(body: IDocumentBody, startOffset: number, endOffset: number): {
8
12
  customRanges: {
@@ -10,6 +14,7 @@ export declare function getCustomRangeSlice(body: IDocumentBody, startOffset: nu
10
14
  endIndex: number;
11
15
  rangeId: string;
12
16
  rangeType: import('../../../types/interfaces/i-document-data').CustomRangeType;
17
+ wholeEntity?: boolean;
13
18
  }[];
14
19
  leftOffset: number;
15
20
  rightOffset: number;
@@ -31,7 +31,7 @@ export * from './docs/data-model';
31
31
  export { TextXActionType, type TextXAction, type IDeleteAction, type IInsertAction, type IRetainAction, } from './docs/data-model/text-x/action-types';
32
32
  export { DataValidationRenderMode } from './types/enum/data-validation-render-mode';
33
33
  export { ActionIterator } from './docs/data-model/text-x/action-iterator';
34
- export { getBodySlice, composeBody } from './docs/data-model/text-x/utils';
34
+ export { getBodySlice, composeBody, SliceBodyType } from './docs/data-model/text-x/utils';
35
35
  export { TextX } from './docs/data-model/text-x/text-x';
36
36
  export type { TPriority } from './docs/data-model/text-x/text-x';
37
37
  export { JSONX, JSON1 } from './docs/data-model/json-x/json-x';
@@ -110,3 +110,4 @@ export { normalizeBody, getCustomRangeSlice, getCustomDecorationSlice } from './
110
110
  export { updateAttributeByDelete } from './docs/data-model/text-x/apply-utils/delete-apply';
111
111
  export { updateAttributeByInsert } from './docs/data-model/text-x/apply-utils/insert-apply';
112
112
  export { nameCharacterCheck } from './shared/name';
113
+ export * from './common/di';
@@ -1,15 +1,15 @@
1
1
  import { ICommandService, Univer } from '@univerjs/core';
2
- import { Dependency } from '@wendellhu/redi';
2
+ import { Dependency } from '../../common/di';
3
3
 
4
4
  export declare const createTestBed: (dependencies?: Dependency[]) => {
5
5
  univer: Univer;
6
6
  get: {
7
- <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, lookUp?: import('@wendellhu/redi').LookUp): T;
8
- <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.MANY, lookUp?: import('@wendellhu/redi').LookUp): T[];
9
- <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.OPTIONAL, lookUp?: import('@wendellhu/redi').LookUp): T | null;
10
- <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.REQUIRED, lookUp?: import('@wendellhu/redi').LookUp): T;
11
- <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity?: import('@wendellhu/redi').Quantity, lookUp?: import('@wendellhu/redi').LookUp): T[] | T | null;
12
- <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantityOrLookup?: import('@wendellhu/redi').Quantity | import('@wendellhu/redi').LookUp, lookUp?: import('@wendellhu/redi').LookUp): T[] | T | null;
7
+ <T>(id: import('@univerjs/core').DependencyIdentifier<T>, lookUp?: import('@univerjs/core').LookUp): T;
8
+ <T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity: import("@univerjs/core").Quantity.MANY, lookUp?: import('@univerjs/core').LookUp): T[];
9
+ <T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity: import("@univerjs/core").Quantity.OPTIONAL, lookUp?: import('@univerjs/core').LookUp): T | null;
10
+ <T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity: import("@univerjs/core").Quantity.REQUIRED, lookUp?: import('@univerjs/core').LookUp): T;
11
+ <T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity?: import('@univerjs/core').Quantity, lookUp?: import('@univerjs/core').LookUp): T[] | T | null;
12
+ <T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantityOrLookup?: import('@univerjs/core').Quantity | import('@univerjs/core').LookUp, lookUp?: import('@univerjs/core').LookUp): T[] | T | null;
13
13
  };
14
14
  workbook: import('@univerjs/core').Workbook;
15
15
  unitId: string;
@@ -11,6 +11,7 @@ export declare class AuthzIoLocalService implements IAuthzIoService {
11
11
  private _userManagerService;
12
12
  private _permissionMap;
13
13
  constructor(_resourceManagerService: IResourceManagerService, _userManagerService: UserManagerService);
14
+ private _initDefaultUser;
14
15
  private _getRole;
15
16
  private _initSnapshot;
16
17
  create(config: ICreateRequest): Promise<string>;
@@ -17,4 +17,4 @@ export interface IAuthzIoService {
17
17
  createCollaborator(config: ICreateCollaboratorRequest, context?: ILogContext): Promise<void>;
18
18
  putCollaborators(config: IPutCollaboratorsRequest, context?: ILogContext): Promise<void>;
19
19
  }
20
- export declare const IAuthzIoService: import('@wendellhu/redi').IdentifierDecorator<IAuthzIoService>;
20
+ export declare const IAuthzIoService: import('@univerjs/core').IdentifierDecorator<IAuthzIoService>;
@@ -1,4 +1,4 @@
1
- import { IAccessor, IDisposable, Injector } from '@wendellhu/redi';
1
+ import { IAccessor, IDisposable, Injector } from '../../common/di';
2
2
  import { Disposable } from '../../shared/lifecycle';
3
3
  import { IContextService } from '../context/context.service';
4
4
  import { ILogService } from '../log/log.service';
@@ -111,7 +111,7 @@ export interface ICommandService {
111
111
  */
112
112
  beforeCommandExecuted(listener: CommandListener): IDisposable;
113
113
  }
114
- export declare const ICommandService: import('@wendellhu/redi').IdentifierDecorator<ICommandService>;
114
+ export declare const ICommandService: import('../../common/di').IdentifierDecorator<ICommandService>;
115
115
  /**
116
116
  * The registry of commands.
117
117
  */
@@ -3,7 +3,7 @@ import { Nullable } from '../../shared/types';
3
3
  /**
4
4
  * IConfig provides universal configuration for the whole application.
5
5
  */
6
- export declare const IConfigService: import('@wendellhu/redi').IdentifierDecorator<IConfigService>;
6
+ export declare const IConfigService: import('../../common/di').IdentifierDecorator<IConfigService>;
7
7
  export interface IConfigService {
8
8
  getConfig<T>(id: string, defaultValue: T): T;
9
9
  getConfig<T>(id: string): Nullable<T>;
@@ -9,7 +9,7 @@ export interface IContextService {
9
9
  setContextValue(key: string, value: boolean): void;
10
10
  subscribeContextValue$(key: string): Observable<boolean>;
11
11
  }
12
- export declare const IContextService: import('@wendellhu/redi').IdentifierDecorator<IContextService>;
12
+ export declare const IContextService: import('../../common/di').IdentifierDecorator<IContextService>;
13
13
  export declare class ContextService extends Disposable implements IContextService {
14
14
  private _contextChanged$;
15
15
  readonly contextChanged$: Observable<{
@@ -1,5 +1,5 @@
1
- import { IDisposable, Injector } from '@wendellhu/redi';
2
1
  import { Observable } from 'rxjs';
2
+ import { IDisposable, Injector } from '../../common/di';
3
3
  import { DocumentDataModel } from '../../docs/data-model/document-data-model';
4
4
  import { Nullable } from '../../shared';
5
5
  import { Disposable } from '../../shared/lifecycle';
@@ -47,7 +47,7 @@ export interface IUniverInstanceService {
47
47
  /** @deprecated */
48
48
  getCurrentUniverDocInstance(): Nullable<DocumentDataModel>;
49
49
  }
50
- export declare const IUniverInstanceService: import('@wendellhu/redi').IdentifierDecorator<IUniverInstanceService>;
50
+ export declare const IUniverInstanceService: import('../../common/di').IdentifierDecorator<IUniverInstanceService>;
51
51
  export declare class UniverInstanceService extends Disposable implements IUniverInstanceService {
52
52
  private readonly _injector;
53
53
  private readonly _contextService;
@@ -1,4 +1,4 @@
1
- import { Ctor, DependencyIdentifier } from '@wendellhu/redi';
1
+ import { Ctor, DependencyIdentifier } from '../../common/di';
2
2
 
3
3
  /**
4
4
  * This enum defines multiple lifecycle stages in Univer SDK.
@@ -1,5 +1,5 @@
1
- import { Injector } from '@wendellhu/redi';
2
1
  import { Observable } from 'rxjs';
2
+ import { Injector } from '../../common/di';
3
3
  import { Disposable } from '../../shared/lifecycle';
4
4
  import { ILogService } from '../log/log.service';
5
5
  import { LifecycleStages } from './lifecycle';
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const ILocalStorageService: import('@wendellhu/redi').IdentifierDecorator<ILocalStorageService>;
16
+ export declare const ILocalStorageService: import('../../common/di').IdentifierDecorator<ILocalStorageService>;
17
17
  export type LocalStorageValueTypes = string;
18
18
  export interface ILocalStorageService {
19
19
  getItem<T>(key: string): Promise<T | null>;
@@ -15,7 +15,7 @@ export interface ILogService {
15
15
  error(...args: ArgsType): void;
16
16
  setLogLevel(enabled: LogLevel): void;
17
17
  }
18
- export declare const ILogService: import('@wendellhu/redi').IdentifierDecorator<ILogService>;
18
+ export declare const ILogService: import('../../common/di').IdentifierDecorator<ILogService>;
19
19
  export declare class DesktopLogService extends Disposable implements ILogService {
20
20
  private _logLevel;
21
21
  debug(...args: ArgsType): void;
@@ -40,4 +40,4 @@ export interface IPermissionService {
40
40
  composePermission(permissionId: string[]): IPermissionPoint<unknown>[];
41
41
  getAllPermissionPoint(): Map<string, Observable<IPermissionPoint<unknown>>>;
42
42
  }
43
- export declare const IPermissionService: import('@wendellhu/redi').IdentifierDecorator<IPermissionService>;
43
+ export declare const IPermissionService: import('../../common/di').IdentifierDecorator<IPermissionService>;
@@ -1,4 +1,4 @@
1
- import { Dependency, DependencyIdentifier, DependencyItem } from '@wendellhu/redi';
1
+ import { Dependency, DependencyIdentifier, DependencyItem } from '../../common/di';
2
2
 
3
3
  export type NullableDependencyPair<T> = [DependencyIdentifier<T>, DependencyItem<T> | null];
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { Ctor, Injector } from '@wendellhu/redi';
1
+ import { Ctor, Injector } from '../../common/di';
2
2
  import { Disposable } from '../../shared';
3
3
  import { UniverInstanceType } from '../../common/unit';
4
4
 
@@ -1,4 +1,4 @@
1
- import { IDisposable, Injector } from '@wendellhu/redi';
1
+ import { IDisposable, Injector } from '../../common/di';
2
2
  import { Disposable } from '../../shared/lifecycle';
3
3
  import { UniverInstanceType } from '../../common/unit';
4
4
  import { LifecycleInitializerService, LifecycleService } from '../lifecycle/lifecycle.service';
@@ -7,4 +7,4 @@ export interface IResourceLoaderService {
7
7
  saveWorkbook: (workbook: Workbook) => IWorkbookData;
8
8
  saveDoc: (doc: DocumentDataModel) => IDocumentData;
9
9
  }
10
- export declare const IResourceLoaderService: import('@wendellhu/redi').IdentifierDecorator<IResourceLoaderService>;
10
+ export declare const IResourceLoaderService: import('../../common/di').IdentifierDecorator<IResourceLoaderService>;
@@ -1,6 +1,6 @@
1
- import { IDisposable } from '@wendellhu/redi';
2
1
  import { Observable } from 'rxjs';
3
2
  import { UniverInstanceType } from '@univerjs/core';
3
+ import { IDisposable } from '../../common/di';
4
4
  import { IWorkbookData } from '../../types/interfaces/i-workbook-data';
5
5
 
6
6
  type IBusinessName = 'SHEET' | 'DOC';
@@ -23,5 +23,5 @@ export interface IResourceManagerService {
23
23
  loadResources: (unitId: string, resources: IWorkbookData['resources']) => void;
24
24
  unloadResources(unitId: string): void;
25
25
  }
26
- export declare const IResourceManagerService: import('@wendellhu/redi').IdentifierDecorator<IResourceManagerService>;
26
+ export declare const IResourceManagerService: import('@univerjs/core').IdentifierDecorator<IResourceManagerService>;
27
27
  export {};
@@ -6,7 +6,7 @@ import { ILogContext } from '../log/context';
6
6
  * or load snapshots. This service should be implemented by the host environment.
7
7
  * And it shouldn't contain any business logic.
8
8
  */
9
- export declare const ISnapshotServerService: import('@wendellhu/redi').IdentifierDecorator<ISnapshotServerService>;
9
+ export declare const ISnapshotServerService: import('../../common/di').IdentifierDecorator<ISnapshotServerService>;
10
10
  export interface ISnapshotServerService {
11
11
  /** Load snapshot from a database. */
12
12
  getUnitOnRev: (context: ILogContext, params: IGetUnitOnRevRequest) => Promise<IGetUnitOnRevResponse>;
@@ -1,5 +1,5 @@
1
- import { IAccessor, IDisposable } from '@wendellhu/redi';
2
1
  import { Observable, BehaviorSubject } from 'rxjs';
2
+ import { IAccessor, IDisposable } from '../../common/di';
3
3
  import { Disposable } from '../../shared/lifecycle';
4
4
  import { IMutationInfo, CommandType, ICommandService } from '../command/command.service';
5
5
  import { IContextService } from '../context/context.service';
@@ -44,7 +44,7 @@ export interface IUndoRedoCommandInfos {
44
44
  undos: IMutationInfo[];
45
45
  redos: IMutationInfo[];
46
46
  }
47
- export declare const IUndoRedoService: import('@wendellhu/redi').IdentifierDecorator<IUndoRedoService>;
47
+ export declare const IUndoRedoService: import('../../common/di').IdentifierDecorator<IUndoRedoService>;
48
48
  export interface IUndoRedoStatus {
49
49
  undos: number;
50
50
  redos: number;
@@ -39,4 +39,5 @@ export declare class UserManagerService {
39
39
  getUser<T extends IUser>(userId: string, callBack?: () => void): T | undefined;
40
40
  delete(userId: string): void;
41
41
  clear(): void;
42
+ list(): IUser[];
42
43
  }
@@ -1,5 +1,5 @@
1
- import { IDisposable } from '@wendellhu/redi';
2
1
  import { Subscription, SubscriptionLike, Subject } from 'rxjs';
2
+ import { IDisposable } from '../common/di';
3
3
 
4
4
  type DisposableLike = IDisposable | SubscriptionLike | (() => void);
5
5
  export declare function toDisposable(disposable: IDisposable): IDisposable;
@@ -26,4 +26,11 @@ export declare class RxDisposable extends Disposable implements IDisposable {
26
26
  protected dispose$: Subject<void>;
27
27
  dispose(): void;
28
28
  }
29
+ export declare class RCDisposable extends Disposable {
30
+ private readonly _rootDisposable;
31
+ private _ref;
32
+ constructor(_rootDisposable: IDisposable);
33
+ inc(): void;
34
+ dec(): void;
35
+ }
29
36
  export {};
@@ -1,4 +1,4 @@
1
- import { IDisposable } from '@wendellhu/redi';
1
+ import { IDisposable } from '../../common/di';
2
2
 
3
3
  declare const NEWER: unique symbol;
4
4
  declare const OLDER: unique symbol;
@@ -1,5 +1,5 @@
1
- import { IDisposable } from '@wendellhu/redi';
2
1
  import { Observable } from 'rxjs';
2
+ import { IDisposable } from '../common/di';
3
3
 
4
4
  type CallbackFn<T extends readonly unknown[]> = (cb: (...args: T) => void) => IDisposable;
5
5
  /**
@@ -9,6 +9,11 @@ export declare class Tools {
9
9
  static deleteBlank(value?: string): string | undefined;
10
10
  static getSystemType(): string;
11
11
  static getBrowserType(): string;
12
+ /**
13
+ * Use this method without `Tools`.
14
+ *
15
+ * @deprecated
16
+ */
12
17
  static generateRandomId(n?: number, alphabet?: string): string;
13
18
  static getClassName(instance: object): string;
14
19
  static deepMerge(target: any, ...sources: any[]): any;
@@ -37,6 +42,7 @@ export declare class Tools {
37
42
  static isAndroid(): boolean;
38
43
  static isIPhone(): boolean;
39
44
  static isLegalUrl(url: string): boolean;
45
+ static normalizeUrl(url: string): string;
40
46
  static itCount(count: number): Function;
41
47
  static hasLength(target: IArguments | any[] | string, length?: number): boolean;
42
48
  static capitalize(str: string): string;
@@ -108,3 +114,4 @@ export declare class Tools {
108
114
  static set(data: Record<string, any>, propertyPath: string, value: any): void;
109
115
  static clamp(value: number, min: number, max: number): number;
110
116
  }
117
+ export declare function generateRandomId(n?: number, alphabet?: string): string;
@@ -1,4 +1,4 @@
1
- import { IDisposable } from '@wendellhu/redi';
1
+ import { IDisposable } from '../common/di';
2
2
  import { Nullable } from '../common/type-util';
3
3
  import { Disposable } from '../shared/lifecycle';
4
4
  import { ICellData, ICellDataForSheetInterceptor } from '../types/interfaces/i-cell-data';
@@ -0,0 +1,10 @@
1
+ import { ICustomDecoration, ICustomRange } from './i-document-data';
2
+
3
+ export interface ICustomRangeForInterceptor extends ICustomRange {
4
+ active?: boolean;
5
+ show?: boolean;
6
+ }
7
+ export interface ICustomDecorationForInterceptor extends ICustomDecoration {
8
+ active?: boolean;
9
+ show?: boolean;
10
+ }
@@ -99,6 +99,11 @@ export interface IDocumentBody {
99
99
  tables?: ITable[];
100
100
  customRanges?: ICustomRange[];
101
101
  customDecorations?: ICustomDecoration[];
102
+ /**
103
+ * for copy/paste, data of custom-range and other module
104
+ * it won't save to disk
105
+ */
106
+ payloads?: Record<string, string>;
102
107
  }
103
108
  export interface IDocStyle {
104
109
  name: string;
@@ -202,15 +207,14 @@ export interface ICustomRange {
202
207
  endIndex: number;
203
208
  rangeId: string;
204
209
  rangeType: CustomRangeType;
210
+ /**
211
+ * display as a whole-entity
212
+ */
213
+ wholeEntity?: boolean;
205
214
  }
206
- export interface ICustomRangeForInterceptor extends ICustomRange {
207
- active?: boolean;
208
- show?: boolean;
209
- }
210
- export interface ICustomDecorationForInterceptor extends ICustomDecoration {
211
- active?: boolean;
212
- show?: boolean;
213
- }
215
+ /**
216
+ * @deprecated
217
+ */
214
218
  export declare enum CustomRangeType {
215
219
  HYPERLINK = 0,
216
220
  FIELD = 1,// 17.16 Fields and Hyperlinks
@@ -218,7 +222,8 @@ export declare enum CustomRangeType {
218
222
  BOOKMARK = 3,
219
223
  COMMENT = 4,
220
224
  CUSTOM = 5,
221
- MENTION = 6
225
+ MENTION = 6,
226
+ UNI_FORMULA = 7
222
227
  }
223
228
  /**
224
229
  * Custom Block
@@ -271,9 +276,6 @@ export interface IDocStyleBase extends IMargin {
271
276
  renderConfig?: IDocumentRenderConfig;
272
277
  }
273
278
  export interface IDocumentLayout {
274
- charSpace?: number;
275
- linePitch?: number;
276
- gridType?: GridType;
277
279
  defaultTabStop?: number;
278
280
  characterSpacingControl?: characterSpacingControlType;
279
281
  paragraphLineGapDefault?: number;
@@ -317,6 +319,9 @@ export interface IDocumentRenderConfig {
317
319
  isRenderStyle?: BooleanNumber;
318
320
  }
319
321
  export interface ISectionBreakBase {
322
+ charSpace?: number;
323
+ linePitch?: number;
324
+ gridType?: GridType;
320
325
  columnProperties?: ISectionColumnProperties[];
321
326
  columnSeparatorType?: ColumnSeparatorType;
322
327
  contentDirection?: TextDirection;
@@ -458,9 +463,9 @@ export interface ITextStyle extends IStyleBase {
458
463
  sa?: number;
459
464
  }
460
465
  export interface IIndentStart {
461
- indentFirstLine?: INumberUnit | number;
462
- hanging?: INumberUnit | number;
463
- indentStart?: INumberUnit | number;
466
+ indentFirstLine?: INumberUnit;
467
+ hanging?: INumberUnit;
468
+ indentStart?: INumberUnit;
464
469
  tabStops?: ITabStop[];
465
470
  }
466
471
  /**
@@ -474,14 +479,14 @@ export interface IParagraphStyle extends IIndentStart {
474
479
  direction?: TextDirection;
475
480
  spacingRule?: SpacingRule;
476
481
  snapToGrid?: BooleanNumber;
477
- spaceAbove?: INumberUnit | number;
478
- spaceBelow?: INumberUnit | number;
482
+ spaceAbove?: INumberUnit;
483
+ spaceBelow?: INumberUnit;
479
484
  borderBetween?: IParagraphBorder;
480
485
  borderTop?: IParagraphBorder;
481
486
  borderBottom?: IParagraphBorder;
482
487
  borderLeft?: IParagraphBorder;
483
488
  borderRight?: IParagraphBorder;
484
- indentEnd?: INumberUnit | number;
489
+ indentEnd?: INumberUnit;
485
490
  keepLines?: BooleanNumber;
486
491
  keepNext?: BooleanNumber;
487
492
  wordWrap?: BooleanNumber;
@@ -639,7 +644,7 @@ export declare enum FontStyleType {
639
644
  }
640
645
  export interface INumberUnit {
641
646
  v: number;
642
- u: NumberUnitType;
647
+ u?: NumberUnitType;
643
648
  }
644
649
  export interface IObjectPositionH {
645
650
  relativeFrom: ObjectRelativeFromH;
@@ -676,14 +681,17 @@ export declare enum ObjectRelativeFromV {
676
681
  export declare enum NumberUnitType {
677
682
  POINT = 0,
678
683
  LINE = 1,
679
- CHARACTER = 2
684
+ CHARACTER = 2,
685
+ PIXEL = 3
680
686
  }
681
687
  export declare enum AlignTypeH {
682
688
  CENTER = 0,
683
689
  INSIDE = 1,
684
690
  LEFT = 2,
685
691
  OUTSIDE = 3,
686
- RIGHT = 4
692
+ RIGHT = 4,
693
+ BOTH = 5,
694
+ DISTRIBUTE = 6
687
695
  }
688
696
  export declare enum AlignTypeV {
689
697
  BOTTOM = 0,
@@ -31,7 +31,19 @@ export declare enum AbsoluteRefType {
31
31
  COLUMN = 2,
32
32
  ALL = 3
33
33
  }
34
- export interface IRowRange {
34
+ interface IRangeLocation {
35
+ /**
36
+ * Id of the Workbook the range belongs to.
37
+ * When this field is not defined, it should be considered as the range in the currently activated worksheet.
38
+ */
39
+ unitId?: string;
40
+ /**
41
+ * Id of the Worksheet the range belongs to.
42
+ * When this field is not defined, it should be considered as the range in the currently activated worksheet.
43
+ */
44
+ sheetId?: string;
45
+ }
46
+ export interface IRowRange extends IRangeLocation {
35
47
  /**
36
48
  * The start row (inclusive) of the range
37
49
  * startRow
@@ -43,7 +55,7 @@ export interface IRowRange {
43
55
  */
44
56
  endRow: number;
45
57
  }
46
- export interface IColumnRange {
58
+ export interface IColumnRange extends IRangeLocation {
47
59
  /**
48
60
  * The start column (inclusive) of the range
49
61
  * startColumn
@@ -193,3 +205,4 @@ export interface IRectLTRB {
193
205
  width?: number;
194
206
  height?: number;
195
207
  }
208
+ export {};
@@ -16,6 +16,7 @@
16
16
  export * from './i-cell-data';
17
17
  export * from './i-column-data';
18
18
  export * from './i-document-data';
19
+ export * from './i-document-data-interceptor';
19
20
  export * from './i-freeze';
20
21
  export * from './i-image-properties';
21
22
  export * from './i-placeholder';
@@ -1,4 +1,4 @@
1
- import { Injector } from '@wendellhu/redi';
1
+ import { Injector } from './common/di';
2
2
  import { DocumentDataModel } from './docs/data-model/document-data-model';
3
3
  import { Workbook } from './sheets/workbook';
4
4
  import { SlideDataModel } from './slides/slide-model';