@univerjs/core 0.4.1 → 0.4.2
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 +5 -5
- package/lib/es/index.js +618 -278
- package/lib/types/common/const.d.ts +1 -0
- package/lib/types/docs/data-model/json-x/json-x.d.ts +2 -2
- package/lib/types/docs/data-model/text-x/__tests__/apply.spec.d.ts +16 -0
- package/lib/types/docs/data-model/text-x/action-types.d.ts +0 -5
- package/lib/types/docs/data-model/text-x/build-utils/custom-range.d.ts +9 -1
- package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +3 -3
- package/lib/types/docs/data-model/text-x/text-x.d.ts +4 -4
- package/lib/types/index.d.ts +1 -1
- package/lib/types/services/config/config.service.d.ts +10 -1
- package/lib/types/services/permission/permission.service.d.ts +3 -0
- package/lib/types/services/permission/type.d.ts +2 -0
- package/lib/types/shared/__tests__/compose.spec.d.ts +16 -0
- package/lib/types/shared/lifecycle.d.ts +1 -1
- package/lib/types/shared/r-tree.d.ts +21 -4
- package/lib/types/shared/rectangle.d.ts +1 -0
- package/lib/types/shared/tools.d.ts +9 -2
- package/lib/types/sheets/column-manager.d.ts +19 -2
- package/lib/types/sheets/row-manager.d.ts +22 -4
- package/lib/types/sheets/typedef.d.ts +32 -2
- package/lib/types/sheets/view-model.d.ts +2 -2
- package/lib/types/sheets/worksheet.d.ts +47 -1
- package/lib/types/types/enum/data-validation-type.d.ts +2 -1
- package/lib/types/types/interfaces/i-document-data.d.ts +3 -2
- package/lib/umd/index.js +5 -5
- package/package.json +4 -3
|
@@ -17,5 +17,6 @@ export declare const DOCS_NORMAL_EDITOR_UNIT_ID_KEY = "__INTERNAL_EDITOR__DOCS_N
|
|
|
17
17
|
export declare const DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY = "__INTERNAL_EDITOR__DOCS_FORMULA_BAR";
|
|
18
18
|
export declare const DOCS_ZEN_EDITOR_UNIT_ID_KEY = "__INTERNAL_EDITOR__ZEN_EDITOR";
|
|
19
19
|
export declare const DEFAULT_EMPTY_DOCUMENT_VALUE = "\r\n";
|
|
20
|
+
export declare const IS_ROW_STYLE_PRECEDE_COLUMN_STYLE = "isRowStylePrecedeColumnStyle";
|
|
20
21
|
export declare function createInternalEditorID(id: string): string;
|
|
21
22
|
export declare function isInternalEditorID(id: string): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Doc, JSONOp, Path } from 'ot-json1';
|
|
2
2
|
import { IDocumentBody, IDocumentData } from '../../../types/interfaces';
|
|
3
|
-
import { TPriority } from '../text-x/text-x';
|
|
4
3
|
import { TextXAction } from '../text-x/action-types';
|
|
4
|
+
import { TPriority } from '../text-x/text-x';
|
|
5
5
|
import * as json1 from 'ot-json1';
|
|
6
6
|
export interface ISubType {
|
|
7
7
|
name: string;
|
|
@@ -15,7 +15,7 @@ export interface ISubType {
|
|
|
15
15
|
makeInvertible?: (actions: TextXAction[], doc: IDocumentBody) => TextXAction[];
|
|
16
16
|
[k: string]: any;
|
|
17
17
|
}
|
|
18
|
-
export {
|
|
18
|
+
export { json1 as JSON1, JSONOp as JSONXActions, Path as JSONXPath };
|
|
19
19
|
export declare class JSONX {
|
|
20
20
|
static uri: string;
|
|
21
21
|
private static _subTypes;
|
|
@@ -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 {};
|
|
@@ -14,7 +14,6 @@ export interface IRetainAction {
|
|
|
14
14
|
body?: IDocumentBody;
|
|
15
15
|
oldBody?: IDocumentBody;
|
|
16
16
|
coverType?: UpdateDocsAttributeType;
|
|
17
|
-
segmentId?: string;
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
19
|
* Insert mutation is used to insert text (maybe with rich text properties) at the given position.
|
|
@@ -23,8 +22,6 @@ export interface IInsertAction {
|
|
|
23
22
|
t: TextXActionType.INSERT;
|
|
24
23
|
body: IDocumentBody;
|
|
25
24
|
len: number;
|
|
26
|
-
line: number;
|
|
27
|
-
segmentId?: string;
|
|
28
25
|
}
|
|
29
26
|
/**
|
|
30
27
|
* Delete mutation is used to delete text at the given position.
|
|
@@ -32,8 +29,6 @@ export interface IInsertAction {
|
|
|
32
29
|
export interface IDeleteAction {
|
|
33
30
|
t: TextXActionType.DELETE;
|
|
34
31
|
len: number;
|
|
35
|
-
line: number;
|
|
36
32
|
body?: IDocumentBody;
|
|
37
|
-
segmentId?: string;
|
|
38
33
|
}
|
|
39
34
|
export type TextXAction = IRetainAction | IInsertAction | IDeleteAction;
|
|
@@ -2,9 +2,17 @@ import { ITextRange } from '../../../../sheets/typedef';
|
|
|
2
2
|
import { ICustomRange } from '../../../../types/interfaces';
|
|
3
3
|
import { DataStreamTreeTokenType } from '../../types';
|
|
4
4
|
export declare function isCustomRangeSplitSymbol(text: string): text is DataStreamTreeTokenType.CUSTOM_RANGE_START | DataStreamTreeTokenType.CUSTOM_RANGE_END;
|
|
5
|
+
/**
|
|
6
|
+
* Check if two ranges intersect
|
|
7
|
+
* @param line1Start - The start of the first range
|
|
8
|
+
* @param line1End - The end of the first range
|
|
9
|
+
* @param line2Start - The start of the second range
|
|
10
|
+
* @param line2End - The end of the second range
|
|
11
|
+
* @returns True if the ranges intersect, false otherwise
|
|
12
|
+
*/
|
|
5
13
|
export declare function isIntersecting(line1Start: number, line1End: number, line2Start: number, line2End: number): boolean;
|
|
6
14
|
export declare function shouldDeleteCustomRange(deleteStart: number, deleteLen: number, customRange: ICustomRange, dataStream: string): boolean;
|
|
7
|
-
export declare function
|
|
15
|
+
export declare function getCustomRangesInterestsWithSelection(range: ITextRange, customRanges: ICustomRange[]): ICustomRange<Record<string, any>>[];
|
|
8
16
|
export declare function copyCustomRange(range: ICustomRange): {
|
|
9
17
|
rangeId: string;
|
|
10
18
|
startIndex: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { copyCustomRange,
|
|
1
|
+
import { copyCustomRange, getCustomRangesInterestsWithSelection, isIntersecting, shouldDeleteCustomRange } from './custom-range';
|
|
2
2
|
import { getDeleteSelection, getInsertSelection, getRetainAndDeleteFromReplace, isSegmentIntersects, makeSelection, normalizeSelection } from './selection';
|
|
3
3
|
import { addCustomRangeTextX, deleteCustomRangeTextX, getRetainAndDeleteAndExcludeLineBreak } from './text-x-utils';
|
|
4
4
|
export declare class BuildTextUtils {
|
|
@@ -6,7 +6,7 @@ export declare class BuildTextUtils {
|
|
|
6
6
|
add: typeof addCustomRangeTextX;
|
|
7
7
|
delete: typeof deleteCustomRangeTextX;
|
|
8
8
|
copyCustomRange: typeof copyCustomRange;
|
|
9
|
-
|
|
9
|
+
getCustomRangesInterestsWithSelection: typeof getCustomRangesInterestsWithSelection;
|
|
10
10
|
shouldDeleteCustomRange: typeof shouldDeleteCustomRange;
|
|
11
11
|
isIntersecting: typeof isIntersecting;
|
|
12
12
|
};
|
|
@@ -17,7 +17,7 @@ export declare class BuildTextUtils {
|
|
|
17
17
|
getDeleteSelection: typeof getDeleteSelection;
|
|
18
18
|
getInsertSelection: typeof getInsertSelection;
|
|
19
19
|
getDeleteActions: typeof getRetainAndDeleteFromReplace;
|
|
20
|
-
|
|
20
|
+
getDeleteExcludeLastLineBreakActions: typeof getRetainAndDeleteAndExcludeLineBreak;
|
|
21
21
|
};
|
|
22
22
|
static range: {
|
|
23
23
|
isIntersects: typeof isSegmentIntersects;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UpdateDocsAttributeType } from '../../../shared/command-enum';
|
|
2
1
|
import { IDocumentBody } from '../../../types/interfaces/i-document-data';
|
|
2
|
+
import { UpdateDocsAttributeType } from '../../../shared/command-enum';
|
|
3
3
|
import { TextXAction } from './action-types';
|
|
4
4
|
export type TPriority = 'left' | 'right';
|
|
5
5
|
export declare class TextX {
|
|
@@ -42,9 +42,9 @@ export declare class TextX {
|
|
|
42
42
|
static invert(actions: TextXAction[]): TextXAction[];
|
|
43
43
|
static makeInvertible(actions: TextXAction[], doc: IDocumentBody): TextXAction[];
|
|
44
44
|
private _actions;
|
|
45
|
-
insert(len: number, body: IDocumentBody
|
|
46
|
-
retain(len: number,
|
|
47
|
-
delete(len: number
|
|
45
|
+
insert(len: number, body: IDocumentBody): this;
|
|
46
|
+
retain(len: number, body?: IDocumentBody, coverType?: UpdateDocsAttributeType): this;
|
|
47
|
+
delete(len: number): this;
|
|
48
48
|
empty(): this;
|
|
49
49
|
serialize(): TextXAction[];
|
|
50
50
|
push(...args: TextXAction[]): this;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
export { debounce, get, merge, mergeWith, set } from 'lodash-es';
|
|
17
17
|
export { dedupe, groupBy, makeArray, remove, rotate } from './common/array';
|
|
18
18
|
export { isBooleanString } from './common/boolean';
|
|
19
|
-
export { createInternalEditorID, DEFAULT_EMPTY_DOCUMENT_VALUE, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, isInternalEditorID, } from './common/const';
|
|
19
|
+
export { createInternalEditorID, DEFAULT_EMPTY_DOCUMENT_VALUE, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, isInternalEditorID, } from './common/const';
|
|
20
20
|
export * from './common/di';
|
|
21
21
|
export { shallowEqual } from './common/equal';
|
|
22
22
|
export { CustomCommandExecutionError } from './common/error';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { IDisposable } from '../../common/di';
|
|
1
2
|
import { Nullable } from '../../shared/types';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
2
4
|
/**
|
|
3
5
|
* IConfig provides universal configuration for the whole application.
|
|
4
6
|
*/
|
|
@@ -20,11 +22,18 @@ export interface IConfigService {
|
|
|
20
22
|
getConfig<T>(id: string): Nullable<T>;
|
|
21
23
|
setConfig(id: string | symbol, value: unknown, options?: IConfigOptions): void;
|
|
22
24
|
deleteConfig(id: string): boolean;
|
|
25
|
+
subscribeConfigValue$<T = unknown>(key: string): Observable<T>;
|
|
23
26
|
}
|
|
24
|
-
export declare class ConfigService implements IConfigService {
|
|
27
|
+
export declare class ConfigService implements IConfigService, IDisposable {
|
|
28
|
+
private _configChanged$;
|
|
29
|
+
readonly configChanged$: Observable<{
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
}>;
|
|
25
32
|
private readonly _config;
|
|
33
|
+
dispose(): void;
|
|
26
34
|
getConfig<T>(id: string | symbol): Nullable<T>;
|
|
27
35
|
setConfig(id: string, value: unknown, options?: IConfigOptions): void;
|
|
28
36
|
deleteConfig(id: string | symbol): boolean;
|
|
37
|
+
subscribeConfigValue$<T = unknown>(key: string): Observable<T>;
|
|
29
38
|
}
|
|
30
39
|
export {};
|
|
@@ -5,6 +5,9 @@ export declare class PermissionService extends Disposable implements IPermission
|
|
|
5
5
|
private _permissionPointMap;
|
|
6
6
|
private _permissionPointUpdate$;
|
|
7
7
|
permissionPointUpdate$: Observable<IPermissionPoint<unknown>>;
|
|
8
|
+
private _showComponents;
|
|
9
|
+
setShowComponents(showComponents: boolean): void;
|
|
10
|
+
getShowComponents(): boolean;
|
|
8
11
|
deletePermissionPoint(permissionId: string): void;
|
|
9
12
|
addPermissionPoint<T = boolean>(_item: IPermissionPoint<T> | BehaviorSubject<IPermissionPoint<T>>): boolean;
|
|
10
13
|
updatePermissionPoint<T = boolean>(permissionId: string, value: T): void;
|
|
@@ -38,5 +38,7 @@ export interface IPermissionService {
|
|
|
38
38
|
composePermission$(permissionId: string[]): Observable<IPermissionPoint<unknown>[]>;
|
|
39
39
|
composePermission(permissionId: string[]): IPermissionPoint<unknown>[];
|
|
40
40
|
getAllPermissionPoint(): Map<string, Observable<IPermissionPoint<unknown>>>;
|
|
41
|
+
getShowComponents(): boolean;
|
|
42
|
+
setShowComponents(showComponents: boolean): void;
|
|
41
43
|
}
|
|
42
44
|
export declare const IPermissionService: import('@wendellhu/redi').IdentifierDecorator<IPermissionService>;
|
|
@@ -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 {};
|
|
@@ -17,7 +17,7 @@ export declare class DisposableCollection implements IDisposable {
|
|
|
17
17
|
export declare class Disposable implements IDisposable {
|
|
18
18
|
protected _disposed: boolean;
|
|
19
19
|
private readonly _collection;
|
|
20
|
-
|
|
20
|
+
disposeWithMe(disposable: DisposableLike): IDisposable;
|
|
21
21
|
protected ensureNotDisposed(): void;
|
|
22
22
|
dispose(): void;
|
|
23
23
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { BBox, default as RBush } from 'rbush';
|
|
2
2
|
import { IUnitRange } from '../sheets/typedef';
|
|
3
|
+
type StringOrNumber = string | number;
|
|
3
4
|
export interface IRTreeItem extends IUnitRange {
|
|
4
|
-
id:
|
|
5
|
+
id: StringOrNumber;
|
|
5
6
|
}
|
|
6
7
|
interface IRBushItem extends BBox {
|
|
7
|
-
id:
|
|
8
|
+
id: StringOrNumber;
|
|
8
9
|
}
|
|
9
10
|
export interface IRTreeData {
|
|
10
11
|
[unitId: string]: {
|
|
@@ -12,13 +13,29 @@ export interface IRTreeData {
|
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
15
|
export declare class RTree {
|
|
16
|
+
private _enableOneCellCache;
|
|
15
17
|
private _tree;
|
|
18
|
+
private _oneCellCache;
|
|
19
|
+
private _kdTree;
|
|
20
|
+
private _kdTreeSearchState;
|
|
21
|
+
constructor(_enableOneCellCache?: boolean);
|
|
16
22
|
dispose(): void;
|
|
17
23
|
getTree(unitId: string, subUnitId: string): RBush<IRBushItem>;
|
|
24
|
+
private _getOneCellCache;
|
|
25
|
+
private _removeOneCellCache;
|
|
26
|
+
private _insertOneCellCache;
|
|
27
|
+
private _getRdTreeItems;
|
|
28
|
+
private _searchByOneCellCache;
|
|
29
|
+
/**
|
|
30
|
+
* Open the kd-tree search state.
|
|
31
|
+
* The kd-tree is used to search for data in a single cell.
|
|
32
|
+
*/
|
|
33
|
+
openKdTree(): void;
|
|
34
|
+
closeKdTree(): void;
|
|
18
35
|
insert(item: IRTreeItem): void;
|
|
19
36
|
bulkInsert(items: IRTreeItem[]): void;
|
|
20
|
-
search(search: IUnitRange):
|
|
21
|
-
bulkSearch(searchList: IUnitRange[]):
|
|
37
|
+
search(search: IUnitRange): StringOrNumber[];
|
|
38
|
+
bulkSearch(searchList: IUnitRange[]): Set<StringOrNumber>;
|
|
22
39
|
removeById(unitId: string, subUnitId?: string): void;
|
|
23
40
|
remove(search: IRTreeItem): void;
|
|
24
41
|
bulkRemove(searchList: IRTreeItem[]): void;
|
|
@@ -45,4 +45,5 @@ export declare class Rectangle {
|
|
|
45
45
|
static subtractMulti(ranges1: IRange[], ranges2: IRange[]): IRange[];
|
|
46
46
|
static hasIntersectionBetweenTwoRect(rect1: IRectLTRB, rect2: IRectLTRB): boolean;
|
|
47
47
|
static getIntersectionBetweenTwoRect(rect1: IRectLTRB, rect2: IRectLTRB): Required<IRectLTRB> | null;
|
|
48
|
+
static sort(ranges: IRange[]): IRange[];
|
|
48
49
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IStyleData } from '../types/interfaces';
|
|
2
|
+
import { IKeyValue, Nullable } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* Universal tool library
|
|
4
5
|
*/
|
|
@@ -17,7 +18,7 @@ export declare class Tools {
|
|
|
17
18
|
static getClassName(instance: object): string;
|
|
18
19
|
static deepMerge(target: any, ...sources: any[]): any;
|
|
19
20
|
static numberFixed(value: number, digit: number): number;
|
|
20
|
-
static diffValue(one: any,
|
|
21
|
+
static diffValue(one: any, two: any): boolean;
|
|
21
22
|
static deepClone<T = unknown>(value: T): T;
|
|
22
23
|
static getLanguage(): string;
|
|
23
24
|
static getValueType(value: any): string;
|
|
@@ -106,3 +107,9 @@ export declare class Tools {
|
|
|
106
107
|
static now(): number;
|
|
107
108
|
}
|
|
108
109
|
export declare function generateRandomId(n?: number, alphabet?: string): string;
|
|
110
|
+
/**
|
|
111
|
+
* compose styles by priority, the latter will overwrite the former
|
|
112
|
+
* @param { Nullable<IStyleData>[]} styles the styles to be composed
|
|
113
|
+
* @returns { Nullable<IStyleData>[]} Returns the composed style
|
|
114
|
+
*/
|
|
115
|
+
export declare function composeStyles(...styles: Nullable<IStyleData>[]): IStyleData;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IObjectArrayPrimitiveType } from '../shared/object-matrix';
|
|
2
2
|
import { Nullable } from '../shared/types';
|
|
3
|
+
import { IStyleData } from '../types/interfaces';
|
|
3
4
|
import { IColumnData, IRange, IWorksheetData } from './typedef';
|
|
4
5
|
/**
|
|
5
6
|
* Manage configuration information of all columns, get column width, column length, set column width, etc.
|
|
@@ -14,6 +15,18 @@ export declare class ColumnManager {
|
|
|
14
15
|
*/
|
|
15
16
|
getColumnData(): IObjectArrayPrimitiveType<Partial<IColumnData>>;
|
|
16
17
|
getColVisible(colPos: number): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Get the column style
|
|
20
|
+
* @param {number} col Column index
|
|
21
|
+
* @returns {string | Nullable<IStyleData>} Style data, may be undefined
|
|
22
|
+
*/
|
|
23
|
+
getColumnStyle(col: number): Nullable<string | IStyleData>;
|
|
24
|
+
/**
|
|
25
|
+
* Set the set column default style
|
|
26
|
+
* @param {number} col Column index
|
|
27
|
+
* @param {string | Nullable<IStyleData>} style Style data
|
|
28
|
+
*/
|
|
29
|
+
setColumnStyle(col: number, style: string | Nullable<IStyleData>): void;
|
|
17
30
|
/**
|
|
18
31
|
* Get all hidden columns
|
|
19
32
|
* @param start Start index
|
|
@@ -43,13 +56,17 @@ export declare class ColumnManager {
|
|
|
43
56
|
/**
|
|
44
57
|
* get given column data
|
|
45
58
|
* @param columnPos column index
|
|
46
|
-
* @returns
|
|
47
59
|
*/
|
|
48
60
|
getColumn(columnPos: number): Nullable<Partial<IColumnData>>;
|
|
61
|
+
/**
|
|
62
|
+
* Remove column data of given column
|
|
63
|
+
* @param columnPos
|
|
64
|
+
*/
|
|
65
|
+
removeColumn(columnPos: number): void;
|
|
49
66
|
/**
|
|
50
67
|
* get given column data or create a column data when it's null
|
|
51
68
|
* @param columnPos column index
|
|
52
|
-
* @returns
|
|
69
|
+
* @returns {Partial<IColumnData>} columnData
|
|
53
70
|
*/
|
|
54
71
|
getColumnOrCreate(columnPos: number): Partial<IColumnData>;
|
|
55
72
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { IObjectArrayPrimitiveType } from '../shared/object-matrix';
|
|
2
|
-
import { IRange, IRowData, IWorksheetData } from './typedef';
|
|
3
1
|
import { Nullable } from '../shared/types';
|
|
2
|
+
import { IStyleData } from '../types/interfaces';
|
|
4
3
|
import { SheetViewModel } from './view-model';
|
|
4
|
+
import { IObjectArrayPrimitiveType } from '../shared/object-matrix';
|
|
5
|
+
import { IRange, IRowData, IWorksheetData } from './typedef';
|
|
5
6
|
/**
|
|
6
7
|
* Manage configuration information of all rows, get row height, row length, set row height, etc.
|
|
7
8
|
*/
|
|
@@ -15,6 +16,18 @@ export declare class RowManager {
|
|
|
15
16
|
* @returns
|
|
16
17
|
*/
|
|
17
18
|
getRowData(): IObjectArrayPrimitiveType<Partial<IRowData>>;
|
|
19
|
+
/**
|
|
20
|
+
* Get the row style
|
|
21
|
+
* @param {number} row Row index
|
|
22
|
+
* @returns {string | Nullable<IStyleData>} Style data, may be undefined
|
|
23
|
+
*/
|
|
24
|
+
getRowStyle(row: number): Nullable<string | IStyleData>;
|
|
25
|
+
/**
|
|
26
|
+
* Set row default style
|
|
27
|
+
* @param {number} row The row index
|
|
28
|
+
* @param {string | Nullable<IStyleData>} style The style data
|
|
29
|
+
*/
|
|
30
|
+
setRowStyle(row: number, style: string | Nullable<IStyleData>): void;
|
|
18
31
|
getRowDatas(rowPos: number, numRows: number): IObjectArrayPrimitiveType<Partial<IRowData>>;
|
|
19
32
|
getRowHeight(rowPos: number): number;
|
|
20
33
|
getRowHeight(rowPos: number, count: number): number;
|
|
@@ -24,10 +37,15 @@ export declare class RowManager {
|
|
|
24
37
|
* @returns {Nullable<Partial<IRowData>>} rowData
|
|
25
38
|
*/
|
|
26
39
|
getRow(rowPos: number): Nullable<Partial<IRowData>>;
|
|
40
|
+
/**
|
|
41
|
+
* Remove row data of given row
|
|
42
|
+
* @param rowPos
|
|
43
|
+
*/
|
|
44
|
+
removeRow(rowPos: number): void;
|
|
27
45
|
/**
|
|
28
46
|
* Get given row data or create a row data when it's null
|
|
29
47
|
* @param rowPos row index
|
|
30
|
-
* @returns
|
|
48
|
+
* @returns {Partial<IRowData>} rowData
|
|
31
49
|
*/
|
|
32
50
|
getRowOrCreate(rowPos: number): Partial<IRowData>;
|
|
33
51
|
/**
|
|
@@ -47,7 +65,7 @@ export declare class RowManager {
|
|
|
47
65
|
getRowRawVisible(row: number): boolean;
|
|
48
66
|
/**
|
|
49
67
|
* Get count of row in the sheet
|
|
50
|
-
* @returns
|
|
68
|
+
* @returns {number} row count
|
|
51
69
|
*/
|
|
52
70
|
getSize(): number;
|
|
53
71
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { BooleanNumber, CellValueType } from '../types/enum';
|
|
2
1
|
import { IResources } from '../services/resource-manager/type';
|
|
3
2
|
import { IObjectArrayPrimitiveType, IObjectMatrixPrimitiveType, Nullable } from '../shared';
|
|
4
3
|
import { LocaleType } from '../types/enum/locale-type';
|
|
@@ -6,6 +5,7 @@ import { IDocumentData } from '../types/interfaces';
|
|
|
6
5
|
import { ICellCustomRender } from '../types/interfaces/i-cell-custom-render';
|
|
7
6
|
import { ICellValidationData } from '../types/interfaces/i-cell-validation-data';
|
|
8
7
|
import { IStyleData } from '../types/interfaces/i-style-data';
|
|
8
|
+
import { BooleanNumber, CellValueType } from '../types/enum';
|
|
9
9
|
/**
|
|
10
10
|
* Snapshot of a workbook.
|
|
11
11
|
*/
|
|
@@ -43,6 +43,10 @@ export interface IWorkbookData {
|
|
|
43
43
|
sheets: {
|
|
44
44
|
[sheetId: string]: Partial<IWorksheetData>;
|
|
45
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* @property {string|Nullable<IStyleData>} [defaultStyle] - Default style id or style data of Workbook.
|
|
48
|
+
*/
|
|
49
|
+
defaultStyle?: Nullable<IStyleData> | string;
|
|
46
50
|
/**
|
|
47
51
|
* Resources of the Univer Sheet. It is used to store the data of other plugins.
|
|
48
52
|
*/
|
|
@@ -85,6 +89,10 @@ export interface IWorksheetData {
|
|
|
85
89
|
cellData: IObjectMatrixPrimitiveType<ICellData>;
|
|
86
90
|
rowData: IObjectArrayPrimitiveType<Partial<IRowData>>;
|
|
87
91
|
columnData: IObjectArrayPrimitiveType<Partial<IColumnData>>;
|
|
92
|
+
/**
|
|
93
|
+
* @property {string|Nullable<IStyleData>} [defaultStyle] - Default style id or style data of Worksheet.
|
|
94
|
+
*/
|
|
95
|
+
defaultStyle?: Nullable<IStyleData> | string;
|
|
88
96
|
rowHeader: {
|
|
89
97
|
width: number;
|
|
90
98
|
hidden?: BooleanNumber;
|
|
@@ -96,6 +104,7 @@ export interface IWorksheetData {
|
|
|
96
104
|
showGridlines: BooleanNumber;
|
|
97
105
|
rightToLeft: BooleanNumber;
|
|
98
106
|
}
|
|
107
|
+
export type CustomData = Nullable<Record<string, any>>;
|
|
99
108
|
/**
|
|
100
109
|
* Properties of row data
|
|
101
110
|
*/
|
|
@@ -116,6 +125,14 @@ export interface IRowData {
|
|
|
116
125
|
* hidden
|
|
117
126
|
*/
|
|
118
127
|
hd?: BooleanNumber;
|
|
128
|
+
/**
|
|
129
|
+
* style id
|
|
130
|
+
*/
|
|
131
|
+
s?: Nullable<IStyleData | string>;
|
|
132
|
+
/**
|
|
133
|
+
* User stored custom fields
|
|
134
|
+
*/
|
|
135
|
+
custom?: CustomData;
|
|
119
136
|
}
|
|
120
137
|
export interface IRowAutoHeightInfo {
|
|
121
138
|
row: number;
|
|
@@ -133,6 +150,18 @@ export interface IColumnData {
|
|
|
133
150
|
* hidden
|
|
134
151
|
*/
|
|
135
152
|
hd?: BooleanNumber;
|
|
153
|
+
/**
|
|
154
|
+
* style id
|
|
155
|
+
*/
|
|
156
|
+
s?: Nullable<IStyleData | string>;
|
|
157
|
+
/**
|
|
158
|
+
* User stored custom fields
|
|
159
|
+
*/
|
|
160
|
+
custom?: CustomData;
|
|
161
|
+
}
|
|
162
|
+
export interface IColAutoWidthInfo {
|
|
163
|
+
col: number;
|
|
164
|
+
width?: number;
|
|
136
165
|
}
|
|
137
166
|
/**
|
|
138
167
|
* Cell value type
|
|
@@ -165,7 +194,7 @@ export interface ICellData {
|
|
|
165
194
|
/**
|
|
166
195
|
* User stored custom fields
|
|
167
196
|
*/
|
|
168
|
-
custom?:
|
|
197
|
+
custom?: CustomData;
|
|
169
198
|
}
|
|
170
199
|
export interface ICellMarksStyle {
|
|
171
200
|
color: string;
|
|
@@ -185,6 +214,7 @@ export interface ICellDataForSheetInterceptor extends ICellData {
|
|
|
185
214
|
markers?: ICellMarks;
|
|
186
215
|
customRender?: Nullable<ICellCustomRender[]>;
|
|
187
216
|
interceptorAutoHeight?: () => number | undefined;
|
|
217
|
+
interceptorAutoWidth?: () => number | undefined;
|
|
188
218
|
/**
|
|
189
219
|
* can cell be covered when sibling is overflow
|
|
190
220
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { InterceptorEffectEnum } from '../common/interceptor';
|
|
2
|
-
import { Disposable } from '../shared/lifecycle';
|
|
3
1
|
import { IDisposable } from '../common/di';
|
|
4
2
|
import { Nullable } from '../shared/types';
|
|
5
3
|
import { ICellData, ICellDataForSheetInterceptor } from './typedef';
|
|
4
|
+
import { InterceptorEffectEnum } from '../common/interceptor';
|
|
5
|
+
import { Disposable } from '../shared/lifecycle';
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Nullable, ObjectMatrix } from '../shared';
|
|
2
|
+
import { IStyleData } from '../types/interfaces';
|
|
2
3
|
import { Styles } from './styles';
|
|
3
4
|
import { ICellData, ICellDataForSheetInterceptor, IFreeze, IRange, ISelectionCell, IWorksheetData } from './typedef';
|
|
4
5
|
import { BooleanNumber } from '../types/enum';
|
|
@@ -33,9 +34,54 @@ export declare class Worksheet {
|
|
|
33
34
|
*/
|
|
34
35
|
setMergeData(mergeData: IRange[]): void;
|
|
35
36
|
getSpanModel(): SpanModel;
|
|
37
|
+
/**
|
|
38
|
+
* Get the style of the column.
|
|
39
|
+
* @param {number} column The column index
|
|
40
|
+
* @param {boolean} [keepRaw] If true, return the raw style data, otherwise return the style data object
|
|
41
|
+
* @returns {Nullable<IStyleData>|string} The style of the column
|
|
42
|
+
*/
|
|
43
|
+
getColumnStyle(column: number, keepRaw?: boolean): string | Nullable<IStyleData>;
|
|
44
|
+
/**
|
|
45
|
+
* Set the style of the column.
|
|
46
|
+
* @param {number} column The column index
|
|
47
|
+
* @param {string|Nullable<IStyleData>} style The style to be set
|
|
48
|
+
*/
|
|
49
|
+
setColumnStyle(column: number, style: string | Nullable<IStyleData>): void;
|
|
50
|
+
/**
|
|
51
|
+
* Get the style of the row.
|
|
52
|
+
* @param {number} row The row index
|
|
53
|
+
* @param {boolean} [keepRaw] If true, return the raw style data, otherwise return the style data object
|
|
54
|
+
* @returns {Nullable<IStyleData>} The style of the row
|
|
55
|
+
*/
|
|
56
|
+
getRowStyle(row: number, keepRaw?: boolean): string | Nullable<IStyleData>;
|
|
57
|
+
/**
|
|
58
|
+
* Set the style of the row.
|
|
59
|
+
* @param {number} row
|
|
60
|
+
* @param {string|Nullable<IStyleData>} style The style to be set
|
|
61
|
+
*/
|
|
62
|
+
setRowStyle(row: number, style: string | Nullable<IStyleData>): void;
|
|
63
|
+
/**
|
|
64
|
+
* this function is used to mixin default style to cell raw{number}
|
|
65
|
+
* @param {number} row The row index
|
|
66
|
+
* @param {number} col The column index
|
|
67
|
+
* @param cellRaw The cell raw data
|
|
68
|
+
* @param {boolean} isRowStylePrecedeColumnStyle The priority of row style and column style
|
|
69
|
+
*/
|
|
70
|
+
mixinDefaultStyleToCellRaw(row: number, col: number, cellRaw: Nullable<ICellData>, isRowStylePrecedeColumnStyle: boolean): void;
|
|
71
|
+
/**
|
|
72
|
+
* Get the default style of the worksheet.
|
|
73
|
+
* @returns {Nullable<IStyleData>} Default Style
|
|
74
|
+
*/
|
|
75
|
+
getDefaultCellStyle(): Nullable<IStyleData> | string;
|
|
76
|
+
getDefaultCellStyleInternal(): Nullable<IStyleData>;
|
|
77
|
+
/**
|
|
78
|
+
* Set Default Style, if the style has been set, all cells style will be base on this style.
|
|
79
|
+
* @param {Nullable<IStyleData>} style The style to be set as default style
|
|
80
|
+
*/
|
|
81
|
+
setDefaultCellStyle(style: Nullable<IStyleData> | string): void;
|
|
36
82
|
/**
|
|
37
83
|
* Returns WorkSheet Cell Data Matrix
|
|
38
|
-
* @returns
|
|
84
|
+
* @returns WorkSheet Cell Data Matrix
|
|
39
85
|
*/
|
|
40
86
|
getCellMatrix(): ObjectMatrix<Nullable<ICellData>>;
|
|
41
87
|
/**
|
|
@@ -330,8 +330,9 @@ export interface IHeaderAndFooterBase {
|
|
|
330
330
|
evenAndOddHeaders?: BooleanNumber;
|
|
331
331
|
}
|
|
332
332
|
export declare enum DocumentFlavor {
|
|
333
|
-
|
|
334
|
-
|
|
333
|
+
UNSPECIFIED = 0,
|
|
334
|
+
TRADITIONAL = 1,
|
|
335
|
+
MODERN = 2
|
|
335
336
|
}
|
|
336
337
|
/**
|
|
337
338
|
* Basics properties of doc style
|