@univerjs/core 0.1.0-beta.1 → 0.1.0-beta.3

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 (37) hide show
  1. package/{LICENSE.txt → LICENSE} +0 -2
  2. package/lib/cjs/index.js +5 -11
  3. package/lib/es/index.js +2070 -2478
  4. package/lib/types/common/function.d.ts +16 -0
  5. package/lib/types/docs/data-model/document-data-model.d.ts +5 -3
  6. package/lib/types/docs/data-model/mutation-types.d.ts +5 -5
  7. package/lib/types/docs/data-model/text-x/text-x.d.ts +27 -0
  8. package/lib/types/docs/data-model/types.d.ts +1 -1
  9. package/lib/types/index.d.ts +5 -3
  10. package/lib/types/services/{auth/auth.service.d.ts → command/__tests__/command.service.spec.d.ts} +1 -2
  11. package/lib/types/services/command/command.service.d.ts +13 -4
  12. package/lib/types/services/config/config.service.d.ts +2 -2
  13. package/lib/types/services/context/__tests__/context.service.spec.d.ts +16 -0
  14. package/lib/types/services/context/context.d.ts +3 -1
  15. package/lib/types/services/context/context.service.d.ts +9 -3
  16. package/lib/types/services/floating-object/floating-object-manager.service.d.ts +1 -1
  17. package/lib/types/services/lifecycle/__tests__/lifecycle.service.spec.d.ts +16 -0
  18. package/lib/types/services/lifecycle/lifecycle.service.d.ts +19 -1
  19. package/lib/types/services/locale/locale.service.d.ts +2 -2
  20. package/lib/types/services/log/log.service.d.ts +5 -1
  21. package/lib/types/shared/generate.d.ts +5 -5
  22. package/lib/types/shared/lifecycle.d.ts +1 -1
  23. package/lib/types/shared/object-matrix.d.ts +7 -3
  24. package/lib/types/sheets/__tests__/workbook.spec.d.ts +16 -0
  25. package/lib/types/sheets/column-manager.d.ts +13 -0
  26. package/lib/types/sheets/row-manager.d.ts +13 -0
  27. package/lib/types/sheets/workbook.d.ts +18 -0
  28. package/lib/types/sheets/worksheet.d.ts +10 -0
  29. package/lib/types/types/enum/text-style.d.ts +9 -15
  30. package/lib/types/types/interfaces/__tests__/i-cell-data.spec.d.ts +16 -0
  31. package/lib/types/types/interfaces/i-cell-data.d.ts +3 -2
  32. package/lib/types/types/interfaces/i-row-data.d.ts +1 -1
  33. package/lib/types/types/interfaces/i-style-data.d.ts +1 -0
  34. package/lib/umd/index.js +5 -11
  35. package/package.json +31 -28
  36. package/lib/types/sheets/reference.d.ts +0 -60
  37. /package/lib/types/{services/command/command.service.spec.d.ts → docs/data-model/text-x/__tests__/text-x.spec.d.ts} +0 -0
@@ -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 throttle<T extends (...args: any[]) => any>(fn: T, wait?: number): T;
@@ -13,9 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import type { Nullable } from '../../shared';
16
17
  import type { IDocumentBody, IDocumentData, IDocumentRenderConfig } from '../../types/interfaces/i-document-data';
17
- import { type IPaddingData } from '../../types/interfaces/i-style-data';
18
- import { type DocMutationParams } from './mutation-types';
18
+ import type { IPaddingData } from '../../types/interfaces/i-style-data';
19
+ import type { TextXAction } from './mutation-types';
19
20
  export declare const DEFAULT_DOC: {
20
21
  id: string;
21
22
  documentStyle: {};
@@ -61,7 +62,8 @@ export declare class DocumentDataModel extends DocumentDataModelSimple {
61
62
  reset(snapshot: Partial<IDocumentData>): void;
62
63
  getSelfOrHeaderFooterModel(segmentId?: string): DocumentDataModel;
63
64
  getUnitId(): string;
64
- apply(mutations: DocMutationParams[]): DocMutationParams[];
65
+ apply(mutations: TextXAction[]): TextXAction[];
66
+ sliceBody(startOffset: number, endOffset: number): Nullable<IDocumentBody>;
65
67
  private _updateApply;
66
68
  private _deleteApply;
67
69
  private _insertApply;
@@ -18,7 +18,7 @@ import type { IDocumentBody } from '../../types/interfaces/i-document-data';
18
18
  /**
19
19
  * Retain mutation is used to move the cursor or to update properties of the text in the given range.
20
20
  */
21
- export interface IRetainMutationParams {
21
+ export interface IRetainAction {
22
22
  t: 'r';
23
23
  len: number;
24
24
  body?: IDocumentBody;
@@ -28,7 +28,7 @@ export interface IRetainMutationParams {
28
28
  /**
29
29
  * Insert mutation is used to insert text (maybe with rich text properties) at the given position.
30
30
  */
31
- export interface IInsertMutationParams {
31
+ export interface IInsertAction {
32
32
  t: 'i';
33
33
  body: IDocumentBody;
34
34
  len: number;
@@ -38,10 +38,10 @@ export interface IInsertMutationParams {
38
38
  /**
39
39
  * Delete mutation is used to delete text at the given position.
40
40
  */
41
- export interface IDeleteMutationParams {
41
+ export interface IDeleteAction {
42
42
  t: 'd';
43
- line: number;
44
43
  len: number;
44
+ line: number;
45
45
  segmentId?: string;
46
46
  }
47
- export type DocMutationParams = IRetainMutationParams | IInsertMutationParams | IDeleteMutationParams;
47
+ export type TextXAction = IRetainAction | IInsertAction | IDeleteAction;
@@ -0,0 +1,27 @@
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
+ import type { UpdateDocsAttributeType } from '../../../shared/command-enum';
17
+ import type { IDocumentBody } from '../../../types/interfaces/i-document-data';
18
+ import type { TextXAction } from '../mutation-types';
19
+ export declare class TextX {
20
+ static compose(thisActions: TextXAction[], otherActions: TextXAction[]): TextXAction[];
21
+ private _actions;
22
+ insert(len: number, body: IDocumentBody, segmentId: string): this;
23
+ retain(len: number, segmentId: string, body?: IDocumentBody, coverType?: UpdateDocsAttributeType): this;
24
+ delete(len: number, segmentId: string): this;
25
+ serialize(): TextXAction[];
26
+ push(...args: TextXAction[]): this;
27
+ }
@@ -35,7 +35,7 @@ export declare enum DataStreamTreeTokenType {
35
35
  PAGE_BREAK = "\f",// 换页
36
36
  DOCS_END = "\0",// 文档结尾
37
37
  TAB = "\t",// 制表符
38
- CUSTOM_BLOCK = "\b",// 图片 mention等不参与文档流的场景
38
+ CUSTOM_BLOCK = "\b",// 图片 mention 等不参与文档流的场景
39
39
  LETTER = "",
40
40
  SPACE = " "
41
41
  }
@@ -16,14 +16,16 @@
16
16
  export * from './basics';
17
17
  export { dedupe, remove } from './common/array';
18
18
  export { DEFAULT_EMPTY_DOCUMENT_VALUE, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, } from './common/const';
19
+ export { throttle } from './common/function';
19
20
  export { MemoryCursor } from './common/memory-cursor';
20
21
  export { requestImmediateMacroTask } from './common/request-immediate-macro-task';
21
22
  export { type ISequenceExecuteResult, sequence, sequenceAsync } from './common/sequence';
22
23
  export * from './docs/data-model';
23
- export { type DocMutationParams, type IDeleteMutationParams, type IInsertMutationParams, type IRetainMutationParams, } from './docs/data-model/mutation-types';
24
+ export { type TextXAction, type IDeleteAction, type IInsertAction, type IRetainAction, } from './docs/data-model/mutation-types';
25
+ export { TextX } from './docs/data-model/text-x/text-x';
24
26
  export * from './observer';
25
27
  export { Plugin, PluginType } from './plugin/plugin';
26
- export { type CommandListener, CommandService, CommandType, type ICommand, type ICommandInfo, ICommandService, type IExecutionOptions, type IMultiCommand, type IMutation, type IMutationCommonParams, type IMutationInfo, type IOperation, type IOperationInfo, sequenceExecute, sequenceExecuteAsync, } from './services/command/command.service';
28
+ 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';
27
29
  export { IConfigService } from './services/config/config.service';
28
30
  export * from './services/context/context';
29
31
  export { ContextService, IContextService } from './services/context/context.service';
@@ -45,9 +47,9 @@ export { type IUndoRedoCommandInfos, type IUndoRedoItem, IUndoRedoService, type
45
47
  export * from './shared';
46
48
  export type { IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';
47
49
  export { composeInterceptors, createInterceptorKey, InterceptorManager } from './common/interceptor';
50
+ export { normalizeTextRuns } from './docs/data-model/apply-utils/common';
48
51
  export type { PluginCtor } from './plugin/plugin';
49
52
  export { Range } from './sheets/range';
50
- export { deserializeRangeWithSheet, getAbsoluteRefTypeWithSingleString, getAbsoluteRefTypeWitString, serializeRange, serializeRangeToRefString, serializeRangeWithSheet, serializeRangeWithSpreadsheet, } from './sheets/reference';
51
53
  export { Styles } from './sheets/styles';
52
54
  export { SheetViewModel } from './sheets/view-model';
53
55
  export { getWorksheetUID, Workbook } from './sheets/workbook';
@@ -13,5 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export interface IAuthService {
17
- }
16
+ export {};
@@ -104,7 +104,7 @@ export interface IExecutionOptions {
104
104
  export type CommandListener = (commandInfo: Readonly<ICommandInfo>, options?: IExecutionOptions) => void;
105
105
  export interface ICommandService {
106
106
  registerCommand(command: ICommand): IDisposable;
107
- registerAsMultipleCommand(command: ICommand): IDisposable;
107
+ registerMultipleCommand(command: ICommand): IDisposable;
108
108
  executeCommand<P extends object = object, R = boolean>(id: string, params?: P, options?: IExecutionOptions): Promise<R>;
109
109
  syncExecuteCommand<P extends object = object, R = boolean>(id: string, params?: P, options?: IExecutionOptions): R;
110
110
  /**
@@ -118,18 +118,26 @@ export interface ICommandService {
118
118
  beforeCommandExecuted(listener: CommandListener): IDisposable;
119
119
  }
120
120
  export declare const ICommandService: import("@wendellhu/redi").IdentifierDecorator<ICommandService>;
121
+ /**
122
+ * The registry of commands.
123
+ */
124
+ export declare class CommandRegistry {
125
+ private readonly _commands;
126
+ registerCommand(command: ICommand): IDisposable;
127
+ getCommand(id: string): [ICommand] | null;
128
+ }
121
129
  export declare class CommandService implements ICommandService {
122
130
  private readonly _injector;
123
- private readonly _log;
131
+ private readonly _logService;
124
132
  private readonly _commandRegistry;
125
133
  private readonly _beforeCommandExecutionListeners;
126
134
  private readonly _commandExecutedListeners;
127
135
  private _multiCommandDisposables;
128
136
  private _commandExecutingLevel;
129
137
  private _commandExecutionStack;
130
- constructor(_injector: Injector, _log: ILogService);
138
+ constructor(_injector: Injector, _logService: ILogService);
131
139
  registerCommand(command: ICommand): IDisposable;
132
- registerAsMultipleCommand(command: ICommand): IDisposable;
140
+ registerMultipleCommand(command: ICommand): IDisposable;
133
141
  beforeCommandExecuted(listener: CommandListener): IDisposable;
134
142
  onCommandExecuted(listener: (commandInfo: ICommandInfo) => void): IDisposable;
135
143
  executeCommand<P extends object = object, R = boolean>(id: string, params?: P, options?: IExecutionOptions): Promise<R>;
@@ -142,3 +150,4 @@ export declare class CommandService implements ICommandService {
142
150
  }
143
151
  export declare function sequenceExecute(tasks: ICommandInfo[], commandService: ICommandService, options?: IExecutionOptions): import("../../common/sequence").ISequenceExecuteResult;
144
152
  export declare function sequenceExecuteAsync(tasks: ICommandInfo[], commandService: ICommandService, options?: IExecutionOptions): Promise<import("../../common/sequence").ISequenceExecuteResult>;
153
+ export declare const NilCommand: ICommand;
@@ -21,12 +21,12 @@ export declare const IConfigService: import("@wendellhu/redi").IdentifierDecorat
21
21
  export interface IConfigService {
22
22
  getConfig<T>(id: string, defaultValue: T): T;
23
23
  getConfig<T>(id: string): Nullable<T>;
24
- setConfig(id: string, value: any): void;
24
+ setConfig(id: string, value: unknown): void;
25
25
  deleteConfig(id: string): void;
26
26
  }
27
27
  export declare class ConfigService implements IConfigService {
28
28
  private readonly _config;
29
29
  getConfig<T>(id: string): Nullable<T>;
30
- setConfig(id: string, value: any): void;
30
+ setConfig(id: string, value: unknown): void;
31
31
  deleteConfig(id: string): void;
32
32
  }
@@ -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 {};
@@ -16,7 +16,9 @@
16
16
  export declare const FOCUSING_SHEET = "FOCUSING_SHEET";
17
17
  export declare const FOCUSING_DOC = "FOCUSING_DOC";
18
18
  export declare const FOCUSING_SLIDE = "FOCUSING_SLIDE";
19
+ /** @deprecated */
19
20
  export declare const FOCUSING_EDITOR_BUT_HIDDEN = "FOCUSING_EDITOR_BUT_HIDDEN";
20
- export declare const FOCUSING_EDITOR = "FOCUSING_EDITOR";
21
+ export declare const EDITOR_ACTIVATED = "EDITOR_ACTIVATED";
21
22
  export declare const FOCUSING_EDITOR_INPUT_FORMULA = "FOCUSING_EDITOR_INPUT_FORMULA";
22
23
  export declare const FOCUSING_FORMULA_EDITOR = "FOCUSING_FORMULA_EDITOR";
24
+ export declare const FOCUSING_UNIVER_EDITOR = "FOCUSING_UNIVER_EDITOR";
@@ -13,19 +13,25 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { Observable } from 'rxjs';
16
+ import { Observable } from 'rxjs';
17
17
  import { Disposable } from '../../shared/lifecycle';
18
18
  export interface IContextService {
19
- contextChanged$: Observable<void>;
19
+ readonly contextChanged$: Observable<{
20
+ [key: string]: boolean;
21
+ }>;
20
22
  getContextValue(key: string): boolean;
21
23
  setContextValue(key: string, value: boolean): void;
24
+ subscribeContextValue$(key: string): Observable<boolean>;
22
25
  }
23
26
  export declare const IContextService: import("@wendellhu/redi").IdentifierDecorator<IContextService>;
24
27
  export declare class ContextService extends Disposable implements IContextService {
25
28
  private _contextChanged$;
26
- contextChanged$: Observable<void>;
29
+ readonly contextChanged$: Observable<{
30
+ [key: string]: boolean;
31
+ }>;
27
32
  private readonly _contextMap;
28
33
  dispose(): void;
29
34
  getContextValue(key: string): boolean;
30
35
  setContextValue(key: string, value: boolean): void;
36
+ subscribeContextValue$(key: string): Observable<boolean>;
31
37
  }
@@ -20,7 +20,7 @@ import type { ITransformState } from './floating-object-interfaces';
20
20
  export declare const DEFAULT_DOCUMENT_SUB_COMPONENT_ID = "__default_document_sub_component_id20231101__";
21
21
  export interface IFloatingObjectManagerSearchParam {
22
22
  unitId: string;
23
- subComponentId: string;
23
+ subUnitId: string;
24
24
  }
25
25
  export interface IFloatingObjectManagerSearchItemParam extends IFloatingObjectManagerSearchParam {
26
26
  floatingObjectId: 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 {};
@@ -18,15 +18,33 @@ import { Observable } from 'rxjs';
18
18
  import { Disposable } from '../../shared/lifecycle';
19
19
  import { ILogService } from '../log/log.service';
20
20
  import { LifecycleStages } from './lifecycle';
21
+ /**
22
+ * This service controls the lifecycle of a Univer instance. Other modules can
23
+ * inject this service to read the current lifecycle stage or subscribe to
24
+ * lifecycle changes.
25
+ */
21
26
  export declare class LifecycleService extends Disposable {
22
27
  private readonly _logService;
23
28
  private _lifecycle$;
24
- lifecycle$: Observable<LifecycleStages>;
29
+ readonly lifecycle$: Observable<LifecycleStages>;
25
30
  constructor(_logService: ILogService);
26
31
  get stage(): LifecycleStages;
27
32
  set stage(stage: LifecycleStages);
33
+ dispose(): void;
34
+ /**
35
+ * Subscribe to lifecycle changes and all previous stages and the current
36
+ * stage will be emitted immediately.
37
+ * @returns
38
+ */
28
39
  subscribeWithPrevious(): Observable<LifecycleStages>;
40
+ private _reportProgress;
29
41
  }
42
+ /**
43
+ * This service is used to initialize modules on a certain lifecycle stage.
44
+ * Refer to `runOnLifecycle` and `OnLifecycle` for more details.
45
+ *
46
+ * @internal
47
+ */
30
48
  export declare class LifecycleInitializerService extends Disposable {
31
49
  private _lifecycleService;
32
50
  private readonly _injector;
@@ -21,8 +21,8 @@ import { LocaleType } from '../../types/enum/locale-type';
21
21
  * This service provides i18n and timezone / location features to other modules.
22
22
  */
23
23
  export declare class LocaleService extends Disposable {
24
- private currentLocale;
25
- private locales;
24
+ private _currentLocale;
25
+ private _locales;
26
26
  localeChanged$: Subject<void>;
27
27
  constructor();
28
28
  /**
@@ -18,10 +18,12 @@ export declare enum LogLevel {
18
18
  SILENT = 0,
19
19
  ERROR = 1,
20
20
  WARN = 2,
21
- VERBOSE = 3
21
+ INFO = 3,
22
+ VERBOSE = 4
22
23
  }
23
24
  type ArgsType = any[];
24
25
  export interface ILogService {
26
+ debug(...args: ArgsType): void;
25
27
  log(...args: ArgsType): void;
26
28
  warn(...args: ArgsType): void;
27
29
  error(...args: ArgsType): void;
@@ -30,9 +32,11 @@ export interface ILogService {
30
32
  export declare const ILogService: import("@wendellhu/redi").IdentifierDecorator<ILogService>;
31
33
  export declare class DesktopLogService extends Disposable implements ILogService {
32
34
  private _logLevel;
35
+ debug(...args: ArgsType): void;
33
36
  log(...args: ArgsType): void;
34
37
  warn(...args: ArgsType): void;
35
38
  error(...args: ArgsType): void;
36
39
  setLogLevel(logLevel: LogLevel): void;
40
+ private _log;
37
41
  }
38
42
  export {};
@@ -13,9 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { IKeyType } from './types';
17
- export declare const error: IKeyType<string>;
16
+ /**
17
+ * Determine whether it is a pure number, "12" and "12e+3" are both true
18
+ * @param val The number or string to be judged
19
+ * @returns Result
20
+ */
18
21
  export declare function isRealNum(val: string | number): boolean;
19
- export declare function datenum_local(v: Date, date1904?: number): number;
20
- export declare function generate(value: string): any;
21
- export declare const update: (a: any, b: any) => any;
@@ -33,7 +33,7 @@ export declare class DisposableCollection implements IDisposable {
33
33
  export declare class Disposable implements IDisposable {
34
34
  protected _disposed: boolean;
35
35
  private readonly _collection;
36
- protected disposeWithMe(disposable: IDisposable): IDisposable;
36
+ protected disposeWithMe(disposable: IDisposable | SubscriptionLike): IDisposable;
37
37
  dispose(): void;
38
38
  }
39
39
  export declare class RxDisposable extends Disposable implements IDisposable {
@@ -26,9 +26,9 @@ export interface IObjectArrayPrimitiveType<T> {
26
26
  }
27
27
  export declare function getArrayLength<T>(o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): number;
28
28
  export declare function insertMatrixArray<T>(index: number, value: T, o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): void;
29
- export declare function spliceArray<T>(start: number, count: number, o: IObjectArrayPrimitiveType<T>): void;
30
- export declare function concatMatrixArray<T>(source: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>, target: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>;
31
- export declare function sliceMatrixArray<T>(start: number, end: number, matrixArray: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>;
29
+ export declare function spliceArray<T>(start: number, count: number, o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>, insert?: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>;
30
+ export declare function concatMatrixArray<T>(source: IObjectArrayPrimitiveType<T>, target: IObjectArrayPrimitiveType<T>): IObjectArrayPrimitiveType<T>;
31
+ export declare function sliceMatrixArray<T>(start: number, end: number, matrixArray: IObjectArrayPrimitiveType<T>): IObjectArrayPrimitiveType<T>;
32
32
  export declare function moveMatrixArray<T>(fromIndex: number, count: number, toIndex: number, o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): void;
33
33
  /**
34
34
  * A two-dimensional array represented by a two-level deep object and provides an array-like API
@@ -60,6 +60,10 @@ export declare class ObjectMatrix<T> {
60
60
  setRow(rowNumber: number, row: IObjectArrayPrimitiveType<T>): void;
61
61
  moveRows(start: number, count: number, target: number): void;
62
62
  moveColumns(start: number, count: number, target: number): void;
63
+ insertRows(start: number, count: number): void;
64
+ insertColumns(start: number, count: number): void;
65
+ removeRows(start: number, count: number): void;
66
+ removeColumns(start: number, count: number): void;
63
67
  /**
64
68
  * Return a fragment of the original data matrix. Note that the returned matrix's row matrix would start from
65
69
  * 0 not `startRow`. Neither does its column matrix. If you want to get the original matrix, use `getSlice`.
@@ -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 {};
@@ -29,7 +29,20 @@ export declare class ColumnManager {
29
29
  */
30
30
  getColumnData(): IObjectArrayPrimitiveType<Partial<IColumnData>>;
31
31
  getColVisible(colPos: number): boolean;
32
+ /**
33
+ * Get all hidden columns
34
+ * @param start Start index
35
+ * @param end End index
36
+ * @returns Hidden columns range list
37
+ */
32
38
  getHiddenCols(start?: number, end?: number): IRange[];
39
+ /**
40
+ * Get all visible columns
41
+ * @param start Start index
42
+ * @param end End index
43
+ * @returns Visible columns range list
44
+ */
45
+ getVisibleCols(start?: number, end?: number): IRange[];
33
46
  getColumnDatas(columnPos: number, numColumns: number): IObjectArrayPrimitiveType<Partial<IColumnData>>;
34
47
  /**
35
48
  * Get count of column in the sheet
@@ -45,7 +45,20 @@ export declare class RowManager {
45
45
  * @returns
46
46
  */
47
47
  getRowOrCreate(rowPos: number): Partial<IRowData>;
48
+ /**
49
+ * Get all hidden rows
50
+ * @param start Start index
51
+ * @param end End index
52
+ * @returns Hidden rows range list
53
+ */
48
54
  getHiddenRows(start?: number, end?: number): IRange[];
55
+ /**
56
+ * Get all visible rows
57
+ * @param start Start index
58
+ * @param end End index
59
+ * @returns Visible rows range list
60
+ */
61
+ getVisibleRows(start?: number, end?: number): IRange[];
49
62
  getRowVisible(rowPos: number): boolean;
50
63
  /**
51
64
  * Get count of row in the sheet
@@ -48,11 +48,13 @@ export declare class Workbook extends Disposable {
48
48
  private _snapshot;
49
49
  private _unitId;
50
50
  private _count;
51
+ get name(): string;
51
52
  constructor(workbookData: Partial<IWorkbookData> | undefined, _log: ILogService);
52
53
  dispose(): void;
53
54
  save(): IWorkbookData;
54
55
  static isIRangeType(range: IRangeType | IRangeType[]): Boolean;
55
56
  getSnapshot(): IWorkbookData;
57
+ getName(): string;
56
58
  getUnitId(): string;
57
59
  getRev(): number;
58
60
  incrementRev(): void;
@@ -126,8 +128,24 @@ export declare class Workbook extends Disposable {
126
128
  */
127
129
  transformRangeType(range: IRangeType | IRangeType[]): IGridRange;
128
130
  load(config: IWorkbookData): void;
131
+ /**
132
+ * Check if sheet name is unique
133
+ * @param name sheet name
134
+ * @returns True if sheet name is unique
135
+ */
129
136
  checkSheetName(name: string): boolean;
137
+ /**
138
+ * Check whether the sheet name is unique and generate a new unique sheet name
139
+ * @param name sheet name
140
+ * @returns Unique sheet name
141
+ */
130
142
  uniqueSheetName(name?: string): string;
143
+ /**
144
+ * Automatically generate new sheet name
145
+ * @param name sheet name
146
+ * @returns New sheet name
147
+ */
148
+ generateNewSheetName(name: string): string;
131
149
  /**
132
150
  * Get the range array based on the range string and sheet id
133
151
  *
@@ -167,6 +167,16 @@ export declare class Worksheet {
167
167
  getHiddenRows(start?: number, end?: number): IRange[];
168
168
  getColVisible(col: number): boolean;
169
169
  getHiddenCols(start?: number, end?: number): IRange[];
170
+ /**
171
+ * Get all visible rows in the sheet.
172
+ * @returns Visible rows range list
173
+ */
174
+ getVisibleRows(): IRange[];
175
+ /**
176
+ * Get all visible columns in the sheet.
177
+ * @returns Visible columns range list
178
+ */
179
+ getVisibleCols(): IRange[];
170
180
  /**
171
181
  * Returns true if this sheet layout is right-to-left. Returns false if the sheet uses the default left-to-right layout.
172
182
  * @returns true if this sheet layout is right-to-left. Returns false if the sheet uses the default left-to-right layout.
@@ -67,29 +67,23 @@ export declare enum WrapStrategy {
67
67
  UNSPECIFIED = 0,
68
68
  /**
69
69
  * Lines that are longer than the cell width will be written in the next cell over, so long as that cell is empty. If the next cell over is non-empty, this behaves the same as CLIP . The text will never wrap to the next line unless the user manually inserts a new line. Example:
70
-
71
-
72
- | First sentence. |
73
- | Manual newline that is very long. <- Text continues into next cell
74
- | Next newline. |
70
+ * | First sentence. |
71
+ * | Manual newline that is very long. <- Text continues into next cell
72
+ * | Next newline. |
75
73
  */
76
74
  OVERFLOW = 1,
77
75
  /**
78
76
  * Lines that are longer than the cell width will be clipped. The text will never wrap to the next line unless the user manually inserts a new line. Example:
79
-
80
-
81
- | First sentence. |
82
- | Manual newline t| <- Text is clipped
83
- | Next newline. |
77
+ * | First sentence. |
78
+ * | Manual newline t| <- Text is clipped
79
+ * | Next newline. |
84
80
  */
85
81
  CLIP = 2,
86
82
  /**
87
83
  * Words that are longer than a line are wrapped at the character level rather than clipped. Example:
88
-
89
-
90
- | Cell has a |
91
- | loooooooooo| <- Word is broken.
92
- | ong word. |
84
+ * | Cell has a |
85
+ * | loooooooooo| <- Word is broken.
86
+ * | ong word. |
93
87
  */
94
88
  WRAP = 3
95
89
  }
@@ -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 {};
@@ -20,7 +20,7 @@ import type { IStyleData } from './i-style-data';
20
20
  /**
21
21
  * Cell value type
22
22
  */
23
- export type ICellV = string | number | boolean;
23
+ export type CellValue = string | number | boolean;
24
24
  /**
25
25
  * Cell data
26
26
  */
@@ -35,7 +35,7 @@ export interface ICellData {
35
35
  /**
36
36
  * Origin value
37
37
  */
38
- v?: Nullable<ICellV>;
38
+ v?: Nullable<CellValue>;
39
39
  t?: Nullable<CellValueType>;
40
40
  f?: Nullable<string>;
41
41
  si?: Nullable<string>;
@@ -47,3 +47,4 @@ export interface ICellDataForSheetInterceptor extends ICellData {
47
47
  export declare function isICellData(value: any): value is ICellData;
48
48
  export declare function getCellValueType(cell: ICellData): CellValueType | null | undefined;
49
49
  export declare function isNullCell(cell: Nullable<ICellData>): boolean;
50
+ export declare function isCellV(cell: Nullable<ICellData | CellValue>): boolean;
@@ -25,7 +25,7 @@ export interface IRowData {
25
25
  /**
26
26
  * is current row self-adaptive to its content, use `ah` to set row height when true, else use `h`.
27
27
  */
28
- isAutoHeight?: boolean;
28
+ ia?: BooleanNumber;
29
29
  /**
30
30
  * auto height
31
31
  */
@@ -22,6 +22,7 @@ import type { ThemeColorType } from '../enum/theme-color-type';
22
22
  */
23
23
  export interface ITextDecoration {
24
24
  s: BooleanNumber;
25
+ c?: BooleanNumber;
25
26
  cl?: IColorStyle;
26
27
  t?: TextDecoration;
27
28
  }