@univerjs/core 0.3.0-alpha.0 → 0.3.0-nightly.202410101606

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.
@@ -25,6 +25,7 @@ export declare class BuildTextUtils {
25
25
  static transform: {
26
26
  getPlainText: (dataStream: string) => string;
27
27
  fromPlainText: (text: string) => import('../../../..').IDocumentBody;
28
+ isEmptyDocument: (dataStream?: string) => boolean;
28
29
  };
29
30
  }
30
31
  export type { IAddCustomRangeTextXParam, IDeleteCustomRangeParam, IReplaceSelectionTextXParams } from './text-x-utils';
@@ -1,3 +1,4 @@
1
1
  import { IDocumentBody } from '../../../../types/interfaces';
2
2
  export declare const getPlainText: (dataStream: string) => string;
3
+ export declare const isEmptyDocument: (dataStream?: string) => boolean;
3
4
  export declare const fromPlainText: (text: string) => IDocumentBody;
@@ -1,15 +1,18 @@
1
1
  import { IAccessor } from '@wendellhu/redi';
2
- import { TextX } from '../text-x';
3
2
  import { Nullable } from '../../../../shared';
4
3
  import { ITextRange, ITextRangeParam } from '../../../../sheets/typedef';
5
4
  import { CustomRangeType, IDocumentBody } from '../../../../types/interfaces';
6
5
  import { DocumentDataModel } from '../../document-data-model';
7
6
  import { IDeleteAction, IRetainAction } from '../action-types';
7
+ import { TextX } from '../text-x';
8
8
  export interface IDeleteCustomRangeParam {
9
9
  rangeId: string;
10
10
  segmentId?: string;
11
11
  documentDataModel: DocumentDataModel;
12
12
  insert?: Nullable<IDocumentBody>;
13
+ textRange?: {
14
+ index: number;
15
+ };
13
16
  }
14
17
  export declare function deleteCustomRangeTextX(accessor: IAccessor, params: IDeleteCustomRangeParam): false | TextX;
15
18
  export interface IAddCustomRangeTextXParam {
@@ -1,6 +1,6 @@
1
- import { UpdateDocsAttributeType } from '../../../shared/command-enum';
2
1
  import { ICustomDecoration, IDocumentBody } from '../../../types/interfaces/i-document-data';
3
2
  import { IRetainAction } from './action-types';
3
+ import { UpdateDocsAttributeType } from '../../../shared/command-enum';
4
4
  export declare enum SliceBodyType {
5
5
  copy = 0,
6
6
  cut = 1
@@ -57,9 +57,8 @@ export { ContextService, IContextService } from './services/context/context.serv
57
57
  export { ErrorService, type IError } from './services/error/error.service';
58
58
  export { IUniverInstanceService } from './services/instance/instance.service';
59
59
  export { UniverInstanceService } from './services/instance/instance.service';
60
- export { LifecycleStages, OnLifecycle, runOnLifecycle } from './services/lifecycle/lifecycle';
60
+ export { LifecycleStages } from './services/lifecycle/lifecycle';
61
61
  export { LifecycleService } from './services/lifecycle/lifecycle.service';
62
- export { LifecycleInitializerService } from './services/lifecycle/lifecycle.service';
63
62
  export { ILocalStorageService } from './services/local-storage/local-storage.service';
64
63
  export { LocaleService } from './services/locale/locale.service';
65
64
  export { DesktopLogService, ILogService, LogLevel } from './services/log/log.service';
@@ -1,4 +1,18 @@
1
- import { Ctor, DependencyIdentifier } from '../../common/di';
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
+ */
2
16
  /**
3
17
  * This enum defines multiple lifecycle stages in Univer SDK.
4
18
  */
@@ -27,44 +41,3 @@ export declare const LifecycleNameMap: {
27
41
  2: string;
28
42
  3: string;
29
43
  };
30
- export declare const LifecycleToModules: Map<LifecycleStages, DependencyIdentifier<unknown>[]>;
31
- /**
32
- * Register the decorated class to be automatically instantiated when Univer progresses to the certain lifecycle stage.
33
- *
34
- * @param lifecycleStage The lifecycle stage to instantiate this class.
35
- * @param identifier The dependency identifier of the class. Usually, it is the class itself unless you bind this class
36
- * with another injection identifier.
37
- *
38
- * @deprecated This API does not work as expected and will be removed in future versions. Please call
39
- * `this._injector.get(YourDependency)` in plugins' lifecycle hooks instead.
40
- *
41
- * @example
42
- * // Ignore the `\` below. This is JSDoc's bug.
43
- * \@OnLifecycle(LifecycleStages.Ready, MyService)
44
- * class MyService {
45
- * }
46
- *
47
- * @example
48
- * // Ignore the `\` below. This is JSDoc's bug.
49
- * \@OnLifecycle(LifecycleStages.Rendered, IMyService)
50
- * class MyService implements IMyService {
51
- * }
52
- */
53
- export declare function OnLifecycle(lifecycleStage: LifecycleStages, identifier: DependencyIdentifier<unknown>): (_: Ctor<unknown>) => void;
54
- /**
55
- * Register a dependency to be automatically instantiated when Univer progresses to the certain lifecycle stage.
56
- *
57
- * @param lifecycleStage The lifecycle stage to instantiate this dependency.
58
- * @param identifier The dependencies' identifier. **Beware** that if the dependency (e.g. a class) is bound to an
59
- * identifier, you should register the identifier instead of the dependency itself.
60
- *
61
- * @deprecated This API does not work as expected and will be removed in future versions. Please call
62
- * `this._injector.get(YourDependency)` in plugins' lifecycle hooks instead.
63
- *
64
- * @example
65
- * runOnLifecycle(LifecycleStages.Ready, MyService);
66
- *
67
- * @example
68
- * runOnLifecycle(LifecycleStages.Rendered, IMyService);
69
- */
70
- export declare function runOnLifecycle(lifecycleStage: LifecycleStages, identifier: DependencyIdentifier<unknown>): void;
@@ -1,5 +1,4 @@
1
1
  import { Observable } from 'rxjs';
2
- import { Injector } from '../../common/di';
3
2
  import { Disposable } from '../../shared/lifecycle';
4
3
  import { ILogService } from '../log/log.service';
5
4
  import { LifecycleStages } from './lifecycle';
@@ -25,16 +24,4 @@ export declare class LifecycleService extends Disposable {
25
24
  subscribeWithPrevious(): Observable<LifecycleStages>;
26
25
  private _reportProgress;
27
26
  }
28
- /**
29
- * This service is used to initialize modules on a certain lifecycle stage.
30
- * Refer to `runOnLifecycle` and `OnLifecycle` for more details.
31
- *
32
- * @internal
33
- */
34
- export declare class LifecycleInitializerService extends Disposable {
35
- private readonly _injector;
36
- private _seenTokens;
37
- constructor(_injector: Injector);
38
- initModulesOnStage(stage: LifecycleStages): void;
39
- }
40
27
  export declare function getLifecycleStagesAndBefore(lifecycleStage: LifecycleStages): Observable<LifecycleStages>;
@@ -1,6 +1,6 @@
1
1
  import { Observable, BehaviorSubject } from 'rxjs';
2
- import { Disposable } from '../../shared';
3
2
  import { IPermissionPoint, IPermissionService } from './type';
3
+ import { Disposable } from '../../shared';
4
4
  export declare class PermissionService extends Disposable implements IPermissionService {
5
5
  private _permissionPointMap;
6
6
  private _permissionPointUpdate$;
@@ -1,7 +1,7 @@
1
- import { BehaviorSubject, Observable } from 'rxjs';
2
1
  import { UnitAction, UnitObject } from '@univerjs/protocol';
3
- import { IRange } from '../../sheets/typedef';
2
+ import { BehaviorSubject, Observable } from 'rxjs';
4
3
  import { Nullable } from '../../shared/types';
4
+ import { IRange } from '../../sheets/typedef';
5
5
  export declare enum PermissionStatus {
6
6
  INIT = "init",
7
7
  FETCHING = "fetching",
@@ -1,7 +1,7 @@
1
1
  import { IDisposable, Injector } from '../../common/di';
2
- import { Disposable } from '../../shared/lifecycle';
3
2
  import { UniverInstanceType } from '../../common/unit';
4
- import { LifecycleInitializerService, LifecycleService } from '../lifecycle/lifecycle.service';
3
+ import { Disposable } from '../../shared/lifecycle';
4
+ import { LifecycleService } from '../lifecycle/lifecycle.service';
5
5
  import { ILogService } from '../log/log.service';
6
6
  import { Plugin, PluginCtor, PluginRegistry, PluginStore } from './plugin';
7
7
  /**
@@ -45,7 +45,6 @@ export declare class PluginHolder extends Disposable {
45
45
  protected readonly _logService: ILogService;
46
46
  protected readonly _injector: Injector;
47
47
  protected readonly _lifecycleService: LifecycleService;
48
- protected readonly _lifecycleInitializerService: LifecycleInitializerService;
49
48
  protected _started: boolean;
50
49
  get started(): boolean;
51
50
  private _warnedAboutOnStartingDeprecation;
@@ -54,7 +53,7 @@ export declare class PluginHolder extends Disposable {
54
53
  /** Stores initialized plugin instances. */
55
54
  protected readonly _pluginStore: PluginStore;
56
55
  private readonly _awaitingPlugins;
57
- constructor(_checkPluginRegistered: (pluginCtor: PluginCtor) => boolean, _registerPlugin: <T extends PluginCtor>(plugin: T, config?: ConstructorParameters<T>[0]) => void, _logService: ILogService, _injector: Injector, _lifecycleService: LifecycleService, _lifecycleInitializerService: LifecycleInitializerService);
56
+ constructor(_checkPluginRegistered: (pluginCtor: PluginCtor) => boolean, _registerPlugin: <T extends PluginCtor>(plugin: T, config?: ConstructorParameters<T>[0]) => void, _logService: ILogService, _injector: Injector, _lifecycleService: LifecycleService);
58
57
  dispose(): void;
59
58
  register<T extends PluginCtor<Plugin>>(pluginCtor: T, config?: ConstructorParameters<T>[0]): void;
60
59
  immediateInitPlugin<T extends Plugin>(plugin: PluginCtor<T>): void;
@@ -1,7 +1,7 @@
1
1
  import { IResources } from '../resource-manager/type';
2
+ export declare const IResourceLoaderService: import('@wendellhu/redi').IdentifierDecorator<IResourceLoaderService>;
2
3
  export interface IResourceLoaderService {
3
4
  saveUnit<T = object>(unitId: string): T & {
4
5
  resources: IResources;
5
6
  } | null;
6
7
  }
7
- export declare const IResourceLoaderService: import('@wendellhu/redi').IdentifierDecorator<IResourceLoaderService>;
@@ -1,5 +1,5 @@
1
- import { Observable } from 'rxjs';
2
1
  import { UniverInstanceType } from '@univerjs/core';
2
+ import { Observable } from 'rxjs';
3
3
  import { IDisposable } from '../../common/di';
4
4
  export type IResources = Array<{
5
5
  id?: string;
@@ -1,5 +1,5 @@
1
- import { ObjectMatrix, IObjectMatrixPrimitiveType, Nullable } from '../shared';
2
- import { BooleanNumber, FontItalic, FontWeight, WrapStrategy, HorizontalAlign, VerticalAlign } from '../types/enum';
1
+ import { IObjectMatrixPrimitiveType, Nullable, ObjectMatrix } from '../shared';
2
+ import { HorizontalAlign, VerticalAlign, BooleanNumber, FontItalic, FontWeight, WrapStrategy } 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';
@@ -1,5 +1,5 @@
1
- import { Disposable } from '../shared/lifecycle';
2
1
  import { IRange } from './typedef';
2
+ import { Disposable } from '../shared/lifecycle';
3
3
  export declare class SpanModel extends Disposable {
4
4
  /**
5
5
  * @property Cache for RANGE_TYPE.NORMAL
@@ -13,6 +13,14 @@ export declare class SpanModel extends Disposable {
13
13
  * @property Cache for RANGE_TYPE.COLUMN
14
14
  */
15
15
  private _columnCache;
16
+ /**
17
+ * @property Whether has RANGE_TYPE.ROW
18
+ */
19
+ private _hasRow;
20
+ /**
21
+ * @property Whether has RANGE_TYPE.COLUMN
22
+ */
23
+ private _hasColumn;
16
24
  /**
17
25
  * @property Whether has RANGE_TYPE.ALL
18
26
  */
@@ -1,7 +1,3 @@
1
- import { Injector } from './common/di';
2
- import { DocumentDataModel } from './docs/data-model/document-data-model';
3
- import { Workbook } from './sheets/workbook';
4
- import { SlideDataModel } from './slides/slide-model';
5
1
  import { UnitModel, UnitType } from './common/unit';
6
2
  import { LogLevel } from './services/log/log.service';
7
3
  import { Plugin, PluginCtor } from './services/plugin/plugin';
@@ -11,6 +7,10 @@ import { ILocales } from './shared';
11
7
  import { IWorkbookData } from './sheets/typedef';
12
8
  import { LocaleType } from './types/enum/locale-type';
13
9
  import { IDocumentData, ISlideData } from './types/interfaces';
10
+ import { Injector } from './common/di';
11
+ import { DocumentDataModel } from './docs/data-model/document-data-model';
12
+ import { Workbook } from './sheets/workbook';
13
+ import { SlideDataModel } from './slides/slide-model';
14
14
  export interface IUniverConfig {
15
15
  theme: IStyleSheet;
16
16
  locale: LocaleType;