@univerjs/core 0.4.2 → 0.5.0-beta.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.
- package/lib/cjs/index.js +9 -9
- package/lib/es/index.js +11645 -10406
- package/lib/types/common/__tests__/interceptor.spec.d.ts +16 -0
- package/lib/types/common/interceptor.d.ts +17 -0
- package/lib/types/docs/data-model/replacement.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/__tests__/apply-consistency.spec.d.ts +16 -0
- package/lib/types/docs/data-model/text-x/__tests__/delete-apply.spec.d.ts +16 -0
- package/lib/types/docs/data-model/text-x/__tests__/transform-custom-decorations.spec.d.ts +16 -0
- package/lib/types/docs/data-model/text-x/__tests__/transform-custom-range.spec.d.ts +16 -0
- package/lib/types/docs/data-model/text-x/__tests__/transform-paragraph.spec.d.ts +16 -0
- package/lib/types/docs/data-model/text-x/__tests__/transform-textrun.spec.d.ts +16 -0
- package/lib/types/docs/data-model/text-x/apply-utils/common.d.ts +6 -1
- package/lib/types/docs/data-model/text-x/apply-utils/update-apply.d.ts +2 -2
- package/lib/types/docs/data-model/text-x/build-utils/__test__/textX.d.ts +16 -0
- package/lib/types/docs/data-model/text-x/build-utils/custom-decoration.d.ts +17 -0
- package/lib/types/docs/data-model/text-x/build-utils/custom-range.d.ts +15 -5
- package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +9 -8
- package/lib/types/docs/data-model/text-x/build-utils/selection.d.ts +0 -25
- package/lib/types/docs/data-model/text-x/build-utils/text-x-utils.d.ts +7 -8
- package/lib/types/docs/data-model/text-x/text-x.d.ts +4 -0
- package/lib/types/docs/data-model/text-x/transform-utils.d.ts +8 -2
- package/lib/types/docs/data-model/text-x/utils.d.ts +6 -2
- package/lib/types/docs/data-model/types.d.ts +6 -0
- package/lib/types/docs/data-model/utils.d.ts +20 -0
- package/lib/types/facade/f-base.d.ts +26 -0
- package/lib/types/facade/f-hooks.d.ts +57 -0
- package/lib/types/facade/f-univer.d.ts +76 -0
- package/lib/types/index.d.ts +8 -3
- package/lib/types/services/command/command.service.d.ts +5 -5
- package/lib/types/services/context/context.d.ts +2 -0
- package/lib/types/services/resource-loader/resource-loader.service.d.ts +3 -3
- package/lib/types/shared/__tests__/array-search.spec.d.ts +16 -0
- package/lib/types/shared/__tests__/doc-tool.spec.d.ts +16 -0
- package/lib/types/shared/array-search.d.ts +30 -5
- package/lib/types/shared/command-enum.d.ts +1 -2
- package/lib/types/shared/common.d.ts +12 -2
- package/lib/types/shared/dayjs.d.ts +2 -0
- package/lib/types/shared/doc-tool.d.ts +1 -1
- package/lib/types/shared/index.d.ts +1 -0
- package/lib/types/shared/r-tree.d.ts +4 -3
- package/lib/types/shared/rectangle.d.ts +1 -0
- package/lib/types/shared/ref-alias.d.ts +1 -1
- package/lib/types/shared/rxjs.d.ts +1 -0
- package/lib/types/shared/text-diff.d.ts +16 -0
- package/lib/types/shared/tools.d.ts +1 -0
- package/lib/types/sheets/typedef.d.ts +62 -10
- package/lib/types/sheets/util.d.ts +35 -0
- package/lib/types/sheets/worksheet.d.ts +41 -2
- package/lib/types/types/const/const.d.ts +1 -0
- package/lib/types/types/interfaces/i-cell-custom-render.d.ts +3 -3
- package/lib/types/types/interfaces/i-document-data.d.ts +7 -4
- package/lib/umd/index.js +9 -9
- package/package.json +13 -11
package/lib/types/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export { debounce, get, merge, mergeWith, set } from 'lodash-es';
|
|
17
|
+
export { textDiff } from './shared/text-diff';
|
|
17
18
|
export { dedupe, groupBy, makeArray, remove, rotate } from './common/array';
|
|
18
19
|
export { isBooleanString } from './common/boolean';
|
|
19
20
|
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, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, isInternalEditorID, } from './common/const';
|
|
@@ -22,10 +23,13 @@ export { shallowEqual } from './common/equal';
|
|
|
22
23
|
export { CustomCommandExecutionError } from './common/error';
|
|
23
24
|
export { throttle } from './common/function';
|
|
24
25
|
export type { ICellInterceptor, IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';
|
|
25
|
-
export { composeInterceptors, createInterceptorKey, InterceptorEffectEnum, InterceptorManager } from './common/interceptor';
|
|
26
|
+
export { AsyncInterceptorManager, composeInterceptors, createAsyncInterceptorKey, createInterceptorKey, InterceptorEffectEnum, InterceptorManager } from './common/interceptor';
|
|
26
27
|
export type { Serializable } from './common/json';
|
|
27
28
|
export { MemoryCursor } from './common/memory-cursor';
|
|
28
29
|
export { mixinClass } from './common/mixin';
|
|
30
|
+
export { FBase } from './facade/f-base';
|
|
31
|
+
export { FUniver } from './facade/f-univer';
|
|
32
|
+
export { FHooks } from './facade/f-hooks';
|
|
29
33
|
export { isNumeric, isSafeNumeric } from './common/number';
|
|
30
34
|
export { Registry, RegistryAsMap } from './common/registry';
|
|
31
35
|
export { requestImmediateMacroTask } from './common/request-immediate-macro-task';
|
|
@@ -84,13 +88,13 @@ export { isBlackColor, isWhiteColor } from './shared/color/color-kit';
|
|
|
84
88
|
export { cellToRange } from './shared/common';
|
|
85
89
|
export { getIntersectRange } from './shared/range';
|
|
86
90
|
export { nameCharacterCheck } from './shared/name';
|
|
87
|
-
export { bufferDebounceTime, fromCallback, takeAfter } from './shared/rxjs';
|
|
91
|
+
export { afterTime, bufferDebounceTime, fromCallback, takeAfter } from './shared/rxjs';
|
|
88
92
|
export { awaitTime } from './shared/timer';
|
|
89
93
|
export { Range } from './sheets/range';
|
|
90
94
|
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';
|
|
91
95
|
export { Styles } from './sheets/styles';
|
|
92
96
|
export * from './sheets/typedef';
|
|
93
|
-
export { isRangesEqual, isUnitRangesEqual } from './sheets/util';
|
|
97
|
+
export { addLinkToDocumentModel, isRangesEqual, isUnitRangesEqual } from './sheets/util';
|
|
94
98
|
export { SheetViewModel } from './sheets/view-model';
|
|
95
99
|
export { getWorksheetUID, Workbook } from './sheets/workbook';
|
|
96
100
|
export { extractPureTextFromCell, getOriginCellValue, Worksheet } from './sheets/worksheet';
|
|
@@ -112,3 +116,4 @@ export type { ICellCustomRender, ICellRenderContext } from './types/interfaces/i
|
|
|
112
116
|
export type { IDataValidationRule, IDataValidationRuleBase, IDataValidationRuleInfo, IDataValidationRuleOptions, ISheetDataValidationRule } from './types/interfaces/i-data-validation';
|
|
113
117
|
export { type IRTreeItem, RTree } from './shared/r-tree';
|
|
114
118
|
export { type IUniverConfig, Univer } from './univer';
|
|
119
|
+
export { isNodeEnv } from './shared/tools';
|
|
@@ -13,14 +13,14 @@ export declare enum CommandType {
|
|
|
13
13
|
*/
|
|
14
14
|
COMMAND = 0,
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
* modifying
|
|
18
|
-
* Univer, it is the smallest unit of conflict resolution.
|
|
16
|
+
* OPERATION is the change made to data that is not saved to snapshot, without conflict resolution,
|
|
17
|
+
* such as modifying scroll position, modifying sidebar state, etc.
|
|
19
18
|
*/
|
|
20
19
|
OPERATION = 1,
|
|
21
20
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* MUTATION is the change made to the data saved to snapshot, such as inserting rows and columns,
|
|
22
|
+
* modifying cell content, modifying filter ranges, etc. If you want to add collaborative editing capabilities to
|
|
23
|
+
* Univer, it is the smallest unit of conflict resolution.
|
|
24
24
|
*/
|
|
25
25
|
MUTATION = 2
|
|
26
26
|
}
|
|
@@ -25,6 +25,8 @@ export declare const FOCUSING_EDITOR_INPUT_FORMULA = "FOCUSING_EDITOR_INPUT_FORM
|
|
|
25
25
|
export declare const FOCUSING_FX_BAR_EDITOR = "FOCUSING_FX_BAR_EDITOR";
|
|
26
26
|
export declare const FOCUSING_UNIVER_EDITOR = "FOCUSING_UNIVER_EDITOR";
|
|
27
27
|
export declare const FOCUSING_EDITOR_STANDALONE = "FOCUSING_EDITOR_INPUT_FORMULA";
|
|
28
|
+
/** The focusing state of the editor in side panel, such as Chart Editor Panel. */
|
|
29
|
+
export declare const FOCUSING_PANEL_EDITOR = "FOCUSING_PANEL_EDITOR";
|
|
28
30
|
export declare const FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE = "FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE";
|
|
29
31
|
/**
|
|
30
32
|
* The focusing state of the common drawings.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IResourceManagerService } from '../resource-manager/type';
|
|
2
|
-
import { IUniverInstanceService } from '../instance/instance.service';
|
|
3
|
-
import { Disposable } from '../../shared/lifecycle';
|
|
4
1
|
import { IResourceLoaderService } from './type';
|
|
2
|
+
import { Disposable } from '../../shared/lifecycle';
|
|
3
|
+
import { IUniverInstanceService } from '../instance/instance.service';
|
|
4
|
+
import { IResourceManagerService } from '../resource-manager/type';
|
|
5
5
|
export declare class ResourceLoaderService extends Disposable implements IResourceLoaderService {
|
|
6
6
|
private readonly _resourceManagerService;
|
|
7
7
|
private readonly _univerInstanceService;
|
|
@@ -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,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 {};
|
|
@@ -13,13 +13,38 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
/**
|
|
17
|
+
* Return the index of the first value in an ascending array that is greater than the target value. If there is no value greater than the target, return -1.
|
|
18
|
+
*
|
|
19
|
+
* Alternatively, you can consider inserting a number to ensure the array remains sorted, and return the position for insertion. If the target is the same as the maximum value, return arr.length -1
|
|
20
|
+
* @param arr
|
|
21
|
+
* @param target
|
|
22
|
+
*/
|
|
23
|
+
export declare function searchInOrderedArray(arr: number[], target: number): number;
|
|
24
|
+
/**
|
|
25
|
+
* Return the index of the first value in an ascending array that is greater than the target value. If there is no value greater than the target, return last index.
|
|
26
|
+
*
|
|
27
|
+
* @param arr
|
|
28
|
+
* @param pos
|
|
29
|
+
*/
|
|
16
30
|
export declare function binarySearchArray(arr: number[], pos: number): number;
|
|
17
|
-
export declare function orderSearchArray(arr: number[], pos: number): number;
|
|
18
31
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
32
|
+
* Return the index of the last index in an ascending array which value is just greater than the target. If there is no value greater than the target, return arr.length - 1.
|
|
33
|
+
*
|
|
34
|
+
* Alternatively, you can consider inserting a number to ensure the array remains sorted, and return the position for insertion.
|
|
35
|
+
*
|
|
21
36
|
* @param arr
|
|
22
|
-
* @param
|
|
37
|
+
* @param target
|
|
38
|
+
*/
|
|
39
|
+
export declare function binSearchFirstGreaterThanTarget(arr: number[], target: number): number;
|
|
40
|
+
/**
|
|
41
|
+
* Find value in the data that is just greater than the target; if there are equal values greater than the target, select the last one.
|
|
42
|
+
* If firstMatch is true, then return the index of the first number greater than the target.
|
|
43
|
+
* see #univer/pull/3903
|
|
44
|
+
*
|
|
45
|
+
* @param arr ascending array
|
|
46
|
+
* @param target value wants to find
|
|
47
|
+
* @param firstMatch if true, return the first match when value > target in the array, otherwise return the last value > target. if not match,
|
|
23
48
|
* @returns {number} index
|
|
24
49
|
*/
|
|
25
|
-
export declare function searchArray(arr: number[],
|
|
50
|
+
export declare function searchArray(arr: number[], target: number, firstMatch?: boolean): number;
|
|
@@ -15,6 +15,5 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export declare enum UpdateDocsAttributeType {
|
|
17
17
|
COVER = 0,// Default, if not present, add; if present, overwrite, while retaining the original properties.
|
|
18
|
-
REPLACE = 1
|
|
19
|
-
INTERSECTION = 2
|
|
18
|
+
REPLACE = 1
|
|
20
19
|
}
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import { ICellData, ICellDataForSheetInterceptor, IRange, IRangeWithCoord, ISelectionCell
|
|
1
|
+
import { ICellData, ICellDataForSheetInterceptor, ICellWithCoord, IRange, IRangeWithCoord, ISelectionCell } from '../sheets/typedef';
|
|
2
2
|
import { Worksheet } from '../sheets/worksheet';
|
|
3
3
|
import { IDocumentData } from '../types/interfaces/i-document-data';
|
|
4
4
|
import { IColorStyle, IStyleData } from '../types/interfaces/i-style-data';
|
|
5
5
|
import { Nullable } from './types';
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Data type convert, convert ICellWithCoord to IRangeWithCoord
|
|
8
|
+
* @param cellInfo
|
|
9
|
+
* @returns IRangeWithCoord
|
|
10
|
+
*/
|
|
11
|
+
export declare function convertCellToRange(cellInfo: ICellWithCoord): IRangeWithCoord;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated use `convertCellToRange` instead
|
|
14
|
+
*/
|
|
15
|
+
declare const makeCellToSelection: typeof convertCellToRange;
|
|
16
|
+
export { makeCellToSelection };
|
|
7
17
|
export declare function makeCellRangeToRangeData(cellInfo: Nullable<ISelectionCell>): Nullable<IRange>;
|
|
8
18
|
export declare function isEmptyCell(cell: Nullable<ICellData>): boolean;
|
|
9
19
|
export declare function isCellCoverable(cell: Nullable<ICellDataForSheetInterceptor>): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IParagraph, IParagraphStyle } from '../types/interfaces/i-document-data';
|
|
2
|
-
export declare function horizontalLineSegmentsSubtraction(
|
|
2
|
+
export declare function horizontalLineSegmentsSubtraction(aStart: number, aEnd: number, bStart: number, bEnd: number): number[];
|
|
3
3
|
export declare function checkParagraphHasBullet(paragraph: IParagraph): boolean;
|
|
4
4
|
export declare function checkParagraphHasIndent(paragraph: IParagraph): boolean;
|
|
5
5
|
export declare function checkParagraphHasIndentByStyle(paragraphStyle?: IParagraphStyle): boolean;
|
|
@@ -23,6 +23,7 @@ export { ColorKit, COLORS, type IRgbColor, RGB_PAREN, RGBA_PAREN } from './color
|
|
|
23
23
|
export * from './command-enum';
|
|
24
24
|
export * from './common';
|
|
25
25
|
export * from './compare';
|
|
26
|
+
export * from './dayjs';
|
|
26
27
|
export * from './doc-tool';
|
|
27
28
|
export * from './generate';
|
|
28
29
|
export * from './hash-algorithm';
|
|
@@ -17,12 +17,12 @@ export declare class RTree {
|
|
|
17
17
|
private _tree;
|
|
18
18
|
private _oneCellCache;
|
|
19
19
|
private _kdTree;
|
|
20
|
-
private _kdTreeSearchState;
|
|
21
20
|
constructor(_enableOneCellCache?: boolean);
|
|
22
21
|
dispose(): void;
|
|
23
22
|
getTree(unitId: string, subUnitId: string): RBush<IRBushItem>;
|
|
24
23
|
private _getOneCellCache;
|
|
25
24
|
private _removeOneCellCache;
|
|
25
|
+
private _removeCellCacheByRange;
|
|
26
26
|
private _insertOneCellCache;
|
|
27
27
|
private _getRdTreeItems;
|
|
28
28
|
private _searchByOneCellCache;
|
|
@@ -34,9 +34,10 @@ export declare class RTree {
|
|
|
34
34
|
closeKdTree(): void;
|
|
35
35
|
insert(item: IRTreeItem): void;
|
|
36
36
|
bulkInsert(items: IRTreeItem[]): void;
|
|
37
|
-
|
|
38
|
-
bulkSearch(searchList: IUnitRange[]): Set<StringOrNumber>;
|
|
37
|
+
searchGenerator(search: IUnitRange): IterableIterator<StringOrNumber>;
|
|
38
|
+
bulkSearch(searchList: IUnitRange[], exceptTreeIds?: Set<number>): Set<StringOrNumber>;
|
|
39
39
|
removeById(unitId: string, subUnitId?: string): void;
|
|
40
|
+
private _removeRTreeItem;
|
|
40
41
|
remove(search: IRTreeItem): void;
|
|
41
42
|
bulkRemove(searchList: IRTreeItem[]): void;
|
|
42
43
|
clear(): void;
|
|
@@ -42,6 +42,7 @@ export declare class Rectangle {
|
|
|
42
42
|
* @returns
|
|
43
43
|
*/
|
|
44
44
|
static mergeRanges(ranges: IRange[]): IRange[];
|
|
45
|
+
static splitIntoGrid(ranges: IRange[]): IRange[];
|
|
45
46
|
static subtractMulti(ranges1: IRange[], ranges2: IRange[]): IRange[];
|
|
46
47
|
static hasIntersectionBetweenTwoRect(rect1: IRectLTRB, rect2: IRectLTRB): boolean;
|
|
47
48
|
static getIntersectionBetweenTwoRect(rect1: IRectLTRB, rect2: IRectLTRB): Required<IRectLTRB> | null;
|
|
@@ -30,7 +30,7 @@ export declare class RefAlias<T extends Record<string, unknown>, K extends keyof
|
|
|
30
30
|
hasValue(key: string): boolean;
|
|
31
31
|
addValue(item: T): void;
|
|
32
32
|
setValue(key: string, attr: keyof T, value: unknown): void;
|
|
33
|
-
deleteValue(key: string): void;
|
|
33
|
+
deleteValue(key: string, keyGroup?: K[]): void;
|
|
34
34
|
getValues(): T[];
|
|
35
35
|
getKeyMap(key: K): unknown[];
|
|
36
36
|
clear(): void;
|
|
@@ -16,4 +16,5 @@ export declare function fromCallback<T extends readonly unknown[]>(callback: Cal
|
|
|
16
16
|
*/
|
|
17
17
|
export declare function takeAfter<T>(callback: (value: T) => boolean): (source: Observable<T>) => Observable<T>;
|
|
18
18
|
export declare function bufferDebounceTime<T>(time?: number): OperatorFunction<T, T[]>;
|
|
19
|
+
export declare function afterTime(ms: number): Observable<void>;
|
|
19
20
|
export {};
|
|
@@ -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 { default as textDiff } from 'fast-diff';
|
|
@@ -113,3 +113,4 @@ export declare function generateRandomId(n?: number, alphabet?: string): string;
|
|
|
113
113
|
* @returns { Nullable<IStyleData>[]} Returns the composed style
|
|
114
114
|
*/
|
|
115
115
|
export declare function composeStyles(...styles: Nullable<IStyleData>[]): IStyleData;
|
|
116
|
+
export declare const isNodeEnv: () => boolean;
|
|
@@ -448,11 +448,69 @@ export interface ISingleCell {
|
|
|
448
448
|
}
|
|
449
449
|
export interface IRangeWithCoord extends IPosition, IRange {
|
|
450
450
|
}
|
|
451
|
-
|
|
452
|
-
|
|
451
|
+
/**
|
|
452
|
+
* @deprecated use ICellWithCoord instead.
|
|
453
|
+
*/
|
|
453
454
|
export interface ISelectionCellWithMergeInfo extends IPosition, ISingleCell {
|
|
454
455
|
mergeInfo: IRangeWithCoord;
|
|
455
456
|
}
|
|
457
|
+
/**
|
|
458
|
+
* SingleCell & coordinate and mergeRange.
|
|
459
|
+
*/
|
|
460
|
+
export interface ICellWithCoord extends IPosition, ISingleCell {
|
|
461
|
+
mergeInfo: IRangeWithCoord;
|
|
462
|
+
/**
|
|
463
|
+
* Coordinate of the single cell(actual row and column).
|
|
464
|
+
*/
|
|
465
|
+
startX: number;
|
|
466
|
+
/**
|
|
467
|
+
* Coordinate of the single cell(actual row and column).
|
|
468
|
+
*/
|
|
469
|
+
startY: number;
|
|
470
|
+
/**
|
|
471
|
+
* Coordinate of the single cell(actual row and column).
|
|
472
|
+
*/
|
|
473
|
+
endX: number;
|
|
474
|
+
/**
|
|
475
|
+
* Coordinate of the single cell(actual row and column).
|
|
476
|
+
*/
|
|
477
|
+
endY: number;
|
|
478
|
+
/**
|
|
479
|
+
* The raw row index calculated by the offsetX (Without considering merged cells, this value is simply the row index.If there are merged cells, this value refers to the cell where the mouse was clicked.)
|
|
480
|
+
*/
|
|
481
|
+
actualRow: number;
|
|
482
|
+
/**
|
|
483
|
+
* The raw col index calculated by the offsetX (Without considering merged cells)
|
|
484
|
+
*/
|
|
485
|
+
actualColumn: number;
|
|
486
|
+
/**
|
|
487
|
+
* Whether the cell is merged. But main merged cell is false.
|
|
488
|
+
*/
|
|
489
|
+
isMerged: boolean;
|
|
490
|
+
/**
|
|
491
|
+
* if Merged and is main merged cell.
|
|
492
|
+
*/
|
|
493
|
+
isMergedMainCell: boolean;
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Range & SingleCell & isMerged.
|
|
497
|
+
* startRow: number;
|
|
498
|
+
* startColumn: number;
|
|
499
|
+
* endRow: number;
|
|
500
|
+
* endColumn: number;
|
|
501
|
+
*
|
|
502
|
+
* actualRow: number;
|
|
503
|
+
* actualColumn: number;
|
|
504
|
+
* isMerged: boolean;
|
|
505
|
+
* isMergedMainCell: boolean;
|
|
506
|
+
*/
|
|
507
|
+
export interface ISelectionCell extends IRange, ISingleCell {
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* ICellInfo has the same properties as ISelectionCell, but the name ICellInfo might be more semantically appropriate in some contexts.
|
|
511
|
+
*/
|
|
512
|
+
export interface ICellInfo extends ISelectionCell {
|
|
513
|
+
}
|
|
456
514
|
export interface ISelection {
|
|
457
515
|
/**
|
|
458
516
|
* Sheet selection range.
|
|
@@ -460,17 +518,11 @@ export interface ISelection {
|
|
|
460
518
|
range: IRange;
|
|
461
519
|
/**
|
|
462
520
|
* The highlighted cell in the selection range. If there are several selections, only one selection would have a primary cell.
|
|
521
|
+
*
|
|
522
|
+
* This cell range should consider the merged cells.
|
|
463
523
|
*/
|
|
464
524
|
primary: Nullable<ISelectionCell>;
|
|
465
525
|
}
|
|
466
|
-
/**
|
|
467
|
-
* Selection range Info, contains selection range & primary range
|
|
468
|
-
* primary range is the range of the highlighted cell.
|
|
469
|
-
*/
|
|
470
|
-
export interface ISelectionWithCoord {
|
|
471
|
-
rangeWithCoord: IRangeWithCoord;
|
|
472
|
-
primaryWithCoord: Nullable<ISelectionCellWithMergeInfo>;
|
|
473
|
-
}
|
|
474
526
|
export interface ITextRangeStart {
|
|
475
527
|
startOffset: number;
|
|
476
528
|
}
|
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
import { Nullable } from '../shared';
|
|
1
2
|
import { IRange, IUnitRange } from './typedef';
|
|
3
|
+
import { DocumentDataModel } from '../docs';
|
|
4
|
+
import { CellValueType, HorizontalAlign, TextDirection, VerticalAlign, WrapStrategy } from '../types/enum';
|
|
5
|
+
import { IPaddingData, IStyleBase, IStyleData, ITextRotation, ITextStyle } from '../types/interfaces';
|
|
2
6
|
export declare const isRangesEqual: (oldRanges: IRange[], ranges: IRange[]) => boolean;
|
|
3
7
|
export declare const isUnitRangesEqual: (oldRanges: IUnitRange[], ranges: IUnitRange[]) => boolean;
|
|
8
|
+
export declare const DEFAULT_PADDING_DATA: {
|
|
9
|
+
t: number;
|
|
10
|
+
b: number;
|
|
11
|
+
l: number;
|
|
12
|
+
r: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const getDefaultBaselineOffset: (fontSize: number) => {
|
|
15
|
+
sbr: number;
|
|
16
|
+
sbo: number;
|
|
17
|
+
spr: number;
|
|
18
|
+
spo: number;
|
|
19
|
+
};
|
|
20
|
+
export interface ICellStyle {
|
|
21
|
+
textRotation?: ITextRotation;
|
|
22
|
+
textDirection?: Nullable<TextDirection>;
|
|
23
|
+
horizontalAlign?: HorizontalAlign;
|
|
24
|
+
verticalAlign?: VerticalAlign;
|
|
25
|
+
wrapStrategy?: WrapStrategy;
|
|
26
|
+
paddingData?: IPaddingData;
|
|
27
|
+
cellValueType?: CellValueType;
|
|
28
|
+
}
|
|
29
|
+
export declare const VERTICAL_ROTATE_ANGLE = 90;
|
|
30
|
+
export declare function createDocumentModelWithStyle(content: string, textStyle: ITextStyle, config?: ICellStyle): DocumentDataModel;
|
|
31
|
+
export declare function extractOtherStyle(style?: Nullable<IStyleData>): ICellStyle;
|
|
32
|
+
/**
|
|
33
|
+
* Pick font style from cell style.
|
|
34
|
+
* @param format
|
|
35
|
+
* @returns {IStyleBase} style
|
|
36
|
+
*/
|
|
37
|
+
export declare function getFontFormat(format?: Nullable<IStyleData>): IStyleBase;
|
|
38
|
+
export declare function addLinkToDocumentModel(documentModel: DocumentDataModel, linkUrl: string, linkId: string): void;
|
|
@@ -1,13 +1,38 @@
|
|
|
1
1
|
import { Nullable, ObjectMatrix } from '../shared';
|
|
2
|
-
import { IStyleData } from '../types/interfaces';
|
|
2
|
+
import { IPaddingData, IStyleData, ITextRotation } from '../types/interfaces';
|
|
3
3
|
import { Styles } from './styles';
|
|
4
4
|
import { ICellData, ICellDataForSheetInterceptor, IFreeze, IRange, ISelectionCell, IWorksheetData } from './typedef';
|
|
5
|
-
import {
|
|
5
|
+
import { DocumentDataModel } from '../docs';
|
|
6
|
+
import { BooleanNumber, CellValueType, HorizontalAlign, TextDirection, VerticalAlign, WrapStrategy } from '../types/enum';
|
|
6
7
|
import { ColumnManager } from './column-manager';
|
|
7
8
|
import { Range } from './range';
|
|
8
9
|
import { RowManager } from './row-manager';
|
|
9
10
|
import { SpanModel } from './span-model';
|
|
10
11
|
import { SheetViewModel } from './view-model';
|
|
12
|
+
export interface IDocumentLayoutObject {
|
|
13
|
+
documentModel: Nullable<DocumentDataModel>;
|
|
14
|
+
fontString: string;
|
|
15
|
+
textRotation: ITextRotation;
|
|
16
|
+
wrapStrategy: WrapStrategy;
|
|
17
|
+
verticalAlign: VerticalAlign;
|
|
18
|
+
horizontalAlign: HorizontalAlign;
|
|
19
|
+
paddingData: IPaddingData;
|
|
20
|
+
fill?: Nullable<string>;
|
|
21
|
+
}
|
|
22
|
+
export interface ICellOtherConfig {
|
|
23
|
+
textRotation?: ITextRotation;
|
|
24
|
+
textDirection?: Nullable<TextDirection>;
|
|
25
|
+
horizontalAlign?: HorizontalAlign;
|
|
26
|
+
verticalAlign?: VerticalAlign;
|
|
27
|
+
wrapStrategy?: WrapStrategy;
|
|
28
|
+
paddingData?: IPaddingData;
|
|
29
|
+
cellValueType?: CellValueType;
|
|
30
|
+
}
|
|
31
|
+
export interface ICellDocumentModelOption {
|
|
32
|
+
isDeepClone?: boolean;
|
|
33
|
+
displayRawFormula?: boolean;
|
|
34
|
+
ignoreTextRotation?: boolean;
|
|
35
|
+
}
|
|
11
36
|
/**
|
|
12
37
|
* The model of a Worksheet.
|
|
13
38
|
*/
|
|
@@ -340,6 +365,20 @@ export declare class Worksheet {
|
|
|
340
365
|
* parameter is set to `false`, the iterator will return cells in the top row.
|
|
341
366
|
*/
|
|
342
367
|
iterateByColumn(range: IRange, skipEmpty?: boolean, skipNonTopLeft?: boolean): Iterable<Readonly<ICell>>;
|
|
368
|
+
/**
|
|
369
|
+
* This method generates a document model based on the cell's properties and handles the associated styles and configurations.
|
|
370
|
+
* If the cell does not exist, it will return null.
|
|
371
|
+
* PS: This method has significant impact on performance.
|
|
372
|
+
* @param cell
|
|
373
|
+
* @param options
|
|
374
|
+
*/
|
|
375
|
+
private _getCellDocumentModel;
|
|
376
|
+
private _updateConfigAndGetDocumentModel;
|
|
377
|
+
/**
|
|
378
|
+
* Only used for cell edit, and no need to rotate text when edit cell content!
|
|
379
|
+
*/
|
|
380
|
+
getBlankCellDocumentModel(cell: Nullable<ICellData>): IDocumentLayoutObject;
|
|
381
|
+
getCellDocumentModelWithFormula(cell: ICellData): Nullable<IDocumentLayoutObject>;
|
|
343
382
|
}
|
|
344
383
|
/**
|
|
345
384
|
* A cell info including its span (if it is the top-left cell of a merged cell).
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Nullable } from '../../shared';
|
|
2
|
-
import {
|
|
2
|
+
import { ICellDataForSheetInterceptor, ICellWithCoord } from '../../sheets/typedef';
|
|
3
3
|
import { Workbook } from '../../sheets/workbook';
|
|
4
|
-
import {
|
|
4
|
+
import { Worksheet } from '../../sheets/worksheet';
|
|
5
5
|
import { IStyleData } from './i-style-data';
|
|
6
6
|
export interface ICellRenderContext {
|
|
7
7
|
data: ICellDataForSheetInterceptor;
|
|
8
8
|
style: Nullable<IStyleData>;
|
|
9
|
-
primaryWithCoord:
|
|
9
|
+
primaryWithCoord: ICellWithCoord;
|
|
10
10
|
unitId: string;
|
|
11
11
|
subUnitId: string;
|
|
12
12
|
row: number;
|
|
@@ -293,7 +293,8 @@ export declare enum CustomRangeType {
|
|
|
293
293
|
COMMENT = 4,
|
|
294
294
|
CUSTOM = 5,
|
|
295
295
|
MENTION = 6,
|
|
296
|
-
UNI_FORMULA = 7
|
|
296
|
+
UNI_FORMULA = 7,
|
|
297
|
+
DELTED = 9999
|
|
297
298
|
}
|
|
298
299
|
/**
|
|
299
300
|
* Custom Block
|
|
@@ -304,7 +305,8 @@ export interface ICustomBlock {
|
|
|
304
305
|
blockId: string;
|
|
305
306
|
}
|
|
306
307
|
export declare enum CustomDecorationType {
|
|
307
|
-
COMMENT = 0
|
|
308
|
+
COMMENT = 0,
|
|
309
|
+
DELETED = 9999
|
|
308
310
|
}
|
|
309
311
|
export interface ICustomDecoration {
|
|
310
312
|
startIndex: number;
|
|
@@ -388,6 +390,7 @@ export interface IDocumentRenderConfig {
|
|
|
388
390
|
wrapStrategy?: WrapStrategy;
|
|
389
391
|
cellValueType?: CellValueType;
|
|
390
392
|
isRenderStyle?: BooleanNumber;
|
|
393
|
+
zeroWidthParagraphBreak?: BooleanNumber;
|
|
391
394
|
}
|
|
392
395
|
export interface ISectionBreakBase {
|
|
393
396
|
charSpace?: number;
|
|
@@ -696,7 +699,7 @@ export interface ITable {
|
|
|
696
699
|
overlap?: BooleanNumber;
|
|
697
700
|
description?: string;
|
|
698
701
|
}
|
|
699
|
-
export declare enum
|
|
702
|
+
export declare enum TableRowHeightRule {
|
|
700
703
|
AUTO = 0,
|
|
701
704
|
AT_LEAST = 1,
|
|
702
705
|
EXACT = 2
|
|
@@ -706,7 +709,7 @@ export interface ITableColumn {
|
|
|
706
709
|
}
|
|
707
710
|
export interface ITableRowSize {
|
|
708
711
|
val: INumberUnit;
|
|
709
|
-
hRule:
|
|
712
|
+
hRule: TableRowHeightRule;
|
|
710
713
|
}
|
|
711
714
|
/**
|
|
712
715
|
* Properties of row of table
|