@univerjs/core 0.1.5 → 0.1.6
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/README.md +22 -0
- package/lib/cjs/index.js +8 -8
- package/lib/es/index.js +2754 -2664
- package/lib/types/common/equal.d.ts +20 -0
- package/lib/types/index.d.ts +10 -1
- package/lib/types/services/lifecycle/lifecycle.d.ts +31 -1
- package/lib/types/services/undoredo/undoredo.service.d.ts +10 -0
- package/lib/types/shared/index.d.ts +1 -0
- package/lib/types/shared/object-matrix-query.d.ts +4 -0
- package/lib/types/shared/object-matrix.d.ts +2 -1
- package/lib/types/shared/tools.d.ts +2 -0
- package/lib/types/sheets/empty-snapshot.d.ts +4 -0
- package/lib/types/sheets/view-model.d.ts +6 -6
- package/lib/types/types/const/const.d.ts +0 -5
- package/lib/types/types/enum/data-validation-error-style.d.ts +20 -0
- package/lib/types/types/enum/data-validation-ime-mode.d.ts +28 -0
- package/lib/types/types/enum/data-validation-operator.d.ts +25 -0
- package/lib/types/types/enum/data-validation-render-mode.d.ts +20 -0
- package/lib/types/types/enum/data-validation-status.d.ts +20 -0
- package/lib/types/types/enum/data-validation-type.d.ts +36 -0
- package/lib/types/types/interfaces/i-cell-custom-render.d.ts +28 -0
- package/lib/types/types/interfaces/i-cell-data.d.ts +16 -0
- package/lib/types/types/interfaces/i-cell-validation-data.d.ts +9 -0
- package/lib/types/types/interfaces/i-data-validation.d.ts +44 -0
- package/lib/umd/index.js +8 -8
- package/package.json +3 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IRange, IUnitRange } from '../types/interfaces';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copyright 2023-present DreamNum Inc.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
export declare const isRangesEqual: (oldRanges: IRange[], ranges: IRange[]) => boolean;
|
|
19
|
+
export declare const isUnitRangesEqual: (oldRanges: IUnitRange[], ranges: IUnitRange[]) => boolean;
|
|
20
|
+
export declare function shallowEqual(objA: any, objB: any): boolean;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
export { shallowEqual, isRangesEqual, isUnitRangesEqual } from './common/equal';
|
|
16
17
|
export * from './basics';
|
|
17
18
|
export { dedupe, remove, rotate, groupBy } from './common/array';
|
|
18
19
|
export { DEFAULT_EMPTY_DOCUMENT_VALUE, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, } from './common/const';
|
|
@@ -22,6 +23,7 @@ export { requestImmediateMacroTask } from './common/request-immediate-macro-task
|
|
|
22
23
|
export { type ISequenceExecuteResult, sequence, sequenceAsync } from './common/sequence';
|
|
23
24
|
export * from './docs/data-model';
|
|
24
25
|
export { TextXActionType, type TextXAction, type IDeleteAction, type IInsertAction, type IRetainAction, } from './docs/data-model/action-types';
|
|
26
|
+
export { DataValidationRenderMode } from './types/enum/data-validation-render-mode';
|
|
25
27
|
export { ActionIterator } from './docs/data-model/text-x/action-iterator';
|
|
26
28
|
export { getBodySlice, composeBody } from './docs/data-model/text-x/utils';
|
|
27
29
|
export { TextX } from './docs/data-model/text-x/text-x';
|
|
@@ -46,7 +48,7 @@ export { ResourceManagerService } from './services/resource-manager/resource-man
|
|
|
46
48
|
export type { IResourceHook } from './services/resource-manager/type';
|
|
47
49
|
export { IResourceManagerService, ISnapshotPersistenceService } from './services/resource-manager/type';
|
|
48
50
|
export { type IStyleSheet, ThemeService } from './services/theme/theme.service';
|
|
49
|
-
export { type IUndoRedoCommandInfos, type IUndoRedoItem, IUndoRedoService, type IUndoRedoStatus, LocalUndoRedoService, RedoCommand, UndoCommand, RedoCommandId, UndoCommandId, } from './services/undoredo/undoredo.service';
|
|
51
|
+
export { type IUndoRedoCommandInfos, type IUndoRedoCommandInfosByInterceptor, type IUndoRedoItem, IUndoRedoService, type IUndoRedoStatus, LocalUndoRedoService, RedoCommand, UndoCommand, RedoCommandId, UndoCommandId, } from './services/undoredo/undoredo.service';
|
|
50
52
|
export * from './shared';
|
|
51
53
|
export { fromCallback } from './shared/rxjs';
|
|
52
54
|
export type { IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';
|
|
@@ -75,3 +77,10 @@ export { ClientSnapshotServerService } from './services/snapshot/snapshot-server
|
|
|
75
77
|
export { getSheetBlocksFromSnapshot } from './services/snapshot/snapshot-transform';
|
|
76
78
|
export { isBlackColor, isWhiteColor } from './shared/color/color-kit';
|
|
77
79
|
export { cellToRange } from './shared/common';
|
|
80
|
+
export type { IDataValidationRule, IDataValidationRuleBase, IDataValidationRuleInfo, IDataValidationRuleOptions, ISheetDataValidationRule } from './types/interfaces/i-data-validation';
|
|
81
|
+
export type { ICellCustomRender, ICellRenderContext } from './types/interfaces/i-cell-custom-render';
|
|
82
|
+
export { DataValidationErrorStyle } from './types/enum/data-validation-error-style';
|
|
83
|
+
export { DataValidationImeMode } from './types/enum/data-validation-ime-mode';
|
|
84
|
+
export { DataValidationOperator } from './types/enum/data-validation-operator';
|
|
85
|
+
export { DataValidationType } from './types/enum/data-validation-type';
|
|
86
|
+
export { DataValidationStatus } from './types/enum/data-validation-status';
|
|
@@ -30,7 +30,37 @@ export declare const LifecycleNameMap: {
|
|
|
30
30
|
};
|
|
31
31
|
export declare const LifecycleToModules: Map<LifecycleStages, DependencyIdentifier<unknown>[]>;
|
|
32
32
|
/**
|
|
33
|
-
* Register
|
|
33
|
+
* Register the decorated class to be automatically instantiated when Univer progresses to the certain lifecycle stage.
|
|
34
|
+
*
|
|
35
|
+
* @param lifecycleStage The lifecycle stage to instantiate this class.
|
|
36
|
+
* @param identifier The dependency identifier of the class. Usually, it is the class itself unless you bind this class
|
|
37
|
+
* with another injection identifier.
|
|
38
|
+
*
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* // Ignore the `\` below. This is JSDoc's bug.
|
|
42
|
+
* \@OnLifecycle(LifecycleStages.Ready, MyService)
|
|
43
|
+
* class MyService {
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* // Ignore the `\` below. This is JSDoc's bug.
|
|
48
|
+
* \@OnLifecycle(LifecycleStages.Rendered, IMyService)
|
|
49
|
+
* class MyService implements IMyService {
|
|
50
|
+
* }
|
|
34
51
|
*/
|
|
35
52
|
export declare function OnLifecycle(lifecycleStage: LifecycleStages, identifier: DependencyIdentifier<unknown>): (_: Ctor<unknown>) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Register a dependency to be automatically instantiated when Univer progresses to the certain lifecycle stage.
|
|
55
|
+
*
|
|
56
|
+
* @param lifecycleStage The lifecycle stage to instantiate this dependency.
|
|
57
|
+
* @param identifier The dependencies' identifier. **Beware** that if the dependency (e.g. a class) is bound to an
|
|
58
|
+
* identifier, you should register the identifier instead of the dependency itself.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* runOnLifecycle(LifecycleStages.Ready, MyService);
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* runOnLifecycle(LifecycleStages.Rendered, IMyService);
|
|
65
|
+
*/
|
|
36
66
|
export declare function runOnLifecycle(lifecycleStage: LifecycleStages, identifier: DependencyIdentifier<unknown>): void;
|
|
@@ -30,6 +30,16 @@ export interface IUndoRedoService {
|
|
|
30
30
|
*/
|
|
31
31
|
__tempBatchingUndoRedo(unitId: string): IDisposable;
|
|
32
32
|
}
|
|
33
|
+
export interface IUndoRedoCommandInfosByInterceptor {
|
|
34
|
+
/**
|
|
35
|
+
* Sometimes, mutations generated by interceptors need to ensure a certain execution order
|
|
36
|
+
* PreMutations run before user's intent to make sure the undo/redo works correctly.
|
|
37
|
+
*/
|
|
38
|
+
preUndos?: IMutationInfo[];
|
|
39
|
+
undos: IMutationInfo[];
|
|
40
|
+
redos: IMutationInfo[];
|
|
41
|
+
preRedos?: IMutationInfo[];
|
|
42
|
+
}
|
|
33
43
|
export interface IUndoRedoCommandInfos {
|
|
34
44
|
undos: IMutationInfo[];
|
|
35
45
|
redos: IMutationInfo[];
|
|
@@ -12,7 +12,7 @@ export interface IObjectArrayPrimitiveType<T> {
|
|
|
12
12
|
}
|
|
13
13
|
export declare function getArrayLength<T>(o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): number;
|
|
14
14
|
export declare function insertMatrixArray<T>(index: number, value: T, o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): void;
|
|
15
|
-
export declare function spliceArray<T>(start: number, count: number, o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T
|
|
15
|
+
export declare function spliceArray<T>(start: number, count: number, o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): void;
|
|
16
16
|
export declare function concatMatrixArray<T>(source: IObjectArrayPrimitiveType<T>, target: IObjectArrayPrimitiveType<T>): IObjectArrayPrimitiveType<T>;
|
|
17
17
|
export declare function sliceMatrixArray<T>(start: number, end: number, matrixArray: IObjectArrayPrimitiveType<T>): IObjectArrayPrimitiveType<T>;
|
|
18
18
|
export declare function moveMatrixArray<T>(fromIndex: number, count: number, toIndex: number, o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): void;
|
|
@@ -81,6 +81,7 @@ export declare class ObjectMatrix<T> {
|
|
|
81
81
|
getRange(): IRange;
|
|
82
82
|
toNativeArray(): T[];
|
|
83
83
|
toArray(): T[][];
|
|
84
|
+
toFullArray(): T[][];
|
|
84
85
|
/**
|
|
85
86
|
* @deprecated Use getMatrix as a substitute.
|
|
86
87
|
*/
|
|
@@ -95,4 +95,6 @@ export declare class Tools {
|
|
|
95
95
|
static commonExtend1<T>(originJson: IKeyValue, extendJson: IKeyValue): T;
|
|
96
96
|
static arrayToObject(array: IKeyValue[][]): IKeyValue;
|
|
97
97
|
static hasIntersectionBetweenTwoRanges(range1Start: number, range1End: number, range2Start: number, range2End: number): boolean;
|
|
98
|
+
static isStartValidPosition(name: string): boolean;
|
|
99
|
+
static isValidParameter(name: string): boolean;
|
|
98
100
|
}
|
|
@@ -4,7 +4,7 @@ import { Nullable } from '../common/type-utils';
|
|
|
4
4
|
import { IDisposable } from '@wendellhu/redi';
|
|
5
5
|
|
|
6
6
|
export interface ICellContentInterceptor {
|
|
7
|
-
getCell(row: number, col: number)
|
|
7
|
+
getCell: (row: number, col: number) => Nullable<ICellDataForSheetInterceptor>;
|
|
8
8
|
}
|
|
9
9
|
export interface IRowFilteredInterceptor {
|
|
10
10
|
}
|
|
@@ -13,11 +13,11 @@ export interface IRowVisibleInterceptor {
|
|
|
13
13
|
export interface IColVisibleInterceptor {
|
|
14
14
|
}
|
|
15
15
|
export interface ISheetViewModel {
|
|
16
|
-
registerCellContentInterceptor(interceptor: ICellContentInterceptor)
|
|
17
|
-
registerRowFilteredInterceptor(interceptor: IRowFilteredInterceptor)
|
|
18
|
-
registerRowVisibleInterceptor(interceptor: IRowVisibleInterceptor)
|
|
19
|
-
registerColVisibleInterceptor(interceptor: IColVisibleInterceptor)
|
|
20
|
-
getCell(row: number, col: number)
|
|
16
|
+
registerCellContentInterceptor: (interceptor: ICellContentInterceptor) => IDisposable;
|
|
17
|
+
registerRowFilteredInterceptor: (interceptor: IRowFilteredInterceptor) => IDisposable;
|
|
18
|
+
registerRowVisibleInterceptor: (interceptor: IRowVisibleInterceptor) => IDisposable;
|
|
19
|
+
registerColVisibleInterceptor: (interceptor: IColVisibleInterceptor) => IDisposable;
|
|
20
|
+
getCell: (row: number, col: number) => Nullable<ICellDataForSheetInterceptor>;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* SheetViewModel
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IWorkbookData } from '../interfaces';
|
|
2
1
|
import { BooleanNumber, HorizontalAlign, TextDirection, VerticalAlign, WrapStrategy } from '../enum';
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -38,10 +37,6 @@ export declare const DEFAULT_CELL: {
|
|
|
38
37
|
row: number;
|
|
39
38
|
column: number;
|
|
40
39
|
};
|
|
41
|
-
/**
|
|
42
|
-
* Used as an init workbook return value
|
|
43
|
-
*/
|
|
44
|
-
export declare const DEFAULT_WORKBOOK: IWorkbookData;
|
|
45
40
|
/**
|
|
46
41
|
* Default styles.
|
|
47
42
|
*/
|
|
@@ -0,0 +1,20 @@
|
|
|
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 enum DataValidationErrorStyle {
|
|
17
|
+
INFO = 0,
|
|
18
|
+
STOP = 1,
|
|
19
|
+
WARNING = 2
|
|
20
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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 enum DataValidationImeMode {
|
|
17
|
+
DISABLED = 0,
|
|
18
|
+
FULL_ALPHA = 1,
|
|
19
|
+
FULL_HANGUL = 2,
|
|
20
|
+
FULL_KATAKANA = 3,
|
|
21
|
+
HALF_ALPHA = 4,
|
|
22
|
+
HALF_HANGUL = 5,
|
|
23
|
+
HALF_KATAKANA = 6,
|
|
24
|
+
HIRAGANA = 7,
|
|
25
|
+
NO_CONTROL = 8,
|
|
26
|
+
OFF = 9,
|
|
27
|
+
ON = 10
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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 enum DataValidationOperator {
|
|
17
|
+
BETWEEN = "between",
|
|
18
|
+
EQUAL = "equal",
|
|
19
|
+
GREATER_THAN = "greaterThan",
|
|
20
|
+
GREATER_THAN_OR_EQUAL = "greaterThanOrEqual",
|
|
21
|
+
LESS_THAN = "lessThan",
|
|
22
|
+
LESS_THAN_OR_EQUAL = "lessThanOrEqual",
|
|
23
|
+
NOT_BETWEEN = "notBetween",
|
|
24
|
+
NOT_EQUAL = "notEqual"
|
|
25
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 enum DataValidationRenderMode {
|
|
17
|
+
TEXT = 0,
|
|
18
|
+
ARROW = 1,
|
|
19
|
+
CUSTOM = 2
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 enum DataValidationStatus {
|
|
17
|
+
VALID = "valid",
|
|
18
|
+
INVALID = "invalid",
|
|
19
|
+
VALIDATING = "validating"
|
|
20
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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 enum DataValidationType {
|
|
17
|
+
/**
|
|
18
|
+
* custom formula
|
|
19
|
+
*/
|
|
20
|
+
CUSTOM = "custom",
|
|
21
|
+
LIST = "list",
|
|
22
|
+
LIST_MULTIPLE = "listMultiple",
|
|
23
|
+
NONE = "none",
|
|
24
|
+
TEXT_LENGTH = "textLength",
|
|
25
|
+
DATE = "date",
|
|
26
|
+
TIME = "time",
|
|
27
|
+
/**
|
|
28
|
+
* integer number
|
|
29
|
+
*/
|
|
30
|
+
WHOLE = "whole",
|
|
31
|
+
/**
|
|
32
|
+
* decimal number
|
|
33
|
+
*/
|
|
34
|
+
DECIMAL = "decimal",
|
|
35
|
+
CHECKBOX = "checkbox"
|
|
36
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ICellDataForSheetInterceptor } from './i-cell-data';
|
|
2
|
+
import { IStyleData } from './i-style-data';
|
|
3
|
+
import { ISelectionCellWithCoord } from './i-selection-data';
|
|
4
|
+
import { Nullable } from '../../shared';
|
|
5
|
+
|
|
6
|
+
export interface ICellRenderContext {
|
|
7
|
+
data: ICellDataForSheetInterceptor;
|
|
8
|
+
style: Nullable<IStyleData>;
|
|
9
|
+
primaryWithCoord: ISelectionCellWithCoord;
|
|
10
|
+
unitId?: string;
|
|
11
|
+
subUnitId: string;
|
|
12
|
+
row: number;
|
|
13
|
+
col: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @debt This shouldn't exist in core package.
|
|
17
|
+
*/
|
|
18
|
+
export interface ICellCustomRender {
|
|
19
|
+
drawWith(ctx: CanvasRenderingContext2D, info: ICellRenderContext, skeleton: any, spreadsheets: any): void;
|
|
20
|
+
zIndex?: number;
|
|
21
|
+
isHit?: (position: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
}, info: ICellRenderContext) => boolean;
|
|
25
|
+
onPointerDown?: (info: ICellRenderContext, evt: any) => void;
|
|
26
|
+
onPointerEnter?: (info: ICellRenderContext, evt: any) => void;
|
|
27
|
+
onPointerLeave?: (info: ICellRenderContext, evt: any) => void;
|
|
28
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { ICellValidationData } from './i-cell-validation-data';
|
|
1
2
|
import { IStyleData } from './i-style-data';
|
|
2
3
|
import { IDocumentData } from './i-document-data';
|
|
4
|
+
import { ICellCustomRender } from './i-cell-custom-render';
|
|
3
5
|
import { CellValueType } from '../enum/text-style';
|
|
4
6
|
import { Nullable } from '../../shared/types';
|
|
5
7
|
|
|
@@ -32,9 +34,23 @@ export interface ICellData {
|
|
|
32
34
|
*/
|
|
33
35
|
si?: Nullable<string>;
|
|
34
36
|
}
|
|
37
|
+
export interface ICellMarksStyle {
|
|
38
|
+
color: string;
|
|
39
|
+
size: number;
|
|
40
|
+
}
|
|
41
|
+
export interface ICellMarks {
|
|
42
|
+
tl?: ICellMarksStyle;
|
|
43
|
+
tr?: ICellMarksStyle;
|
|
44
|
+
bl?: ICellMarksStyle;
|
|
45
|
+
br?: ICellMarksStyle;
|
|
46
|
+
}
|
|
35
47
|
export interface ICellDataForSheetInterceptor extends ICellData {
|
|
36
48
|
interceptorStyle?: Nullable<IStyleData>;
|
|
37
49
|
isInArrayFormulaRange?: Nullable<boolean>;
|
|
50
|
+
dataValidation?: Nullable<ICellValidationData>;
|
|
51
|
+
markers?: ICellMarks;
|
|
52
|
+
customRender?: Nullable<ICellCustomRender[]>;
|
|
53
|
+
interceptorAutoHeight?: number;
|
|
38
54
|
}
|
|
39
55
|
export declare function isICellData(value: any): value is ICellData;
|
|
40
56
|
export declare function getCellValueType(cell: ICellData): CellValueType | null | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IDataValidationRule } from './i-data-validation';
|
|
2
|
+
import { DataValidationStatus } from '../enum/data-validation-status';
|
|
3
|
+
|
|
4
|
+
export interface ICellValidationData {
|
|
5
|
+
ruleId: string;
|
|
6
|
+
validStatus: DataValidationStatus;
|
|
7
|
+
rule: IDataValidationRule;
|
|
8
|
+
validator: any;
|
|
9
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { IRange } from './i-range';
|
|
2
|
+
import { DataValidationRenderMode } from '../enum/data-validation-render-mode';
|
|
3
|
+
import { DataValidationErrorStyle } from '../enum/data-validation-error-style';
|
|
4
|
+
import { DataValidationImeMode } from '../enum/data-validation-ime-mode';
|
|
5
|
+
import { DataValidationType } from '../enum/data-validation-type';
|
|
6
|
+
import { DataValidationOperator } from '../enum/data-validation-operator';
|
|
7
|
+
|
|
8
|
+
export interface IDataValidationRuleBase {
|
|
9
|
+
type: DataValidationType;
|
|
10
|
+
allowBlank?: boolean;
|
|
11
|
+
formula1?: string;
|
|
12
|
+
formula2?: string;
|
|
13
|
+
operator?: DataValidationOperator;
|
|
14
|
+
}
|
|
15
|
+
export interface IDataValidationRuleOptions {
|
|
16
|
+
error?: string;
|
|
17
|
+
errorStyle?: DataValidationErrorStyle;
|
|
18
|
+
errorTitle?: string;
|
|
19
|
+
imeMode?: DataValidationImeMode;
|
|
20
|
+
prompt?: string;
|
|
21
|
+
promptTitle?: string;
|
|
22
|
+
showDropDown?: boolean;
|
|
23
|
+
showErrorMessage?: boolean;
|
|
24
|
+
showInputMessage?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* cell render mode of data validation
|
|
27
|
+
*/
|
|
28
|
+
renderMode?: DataValidationRenderMode;
|
|
29
|
+
}
|
|
30
|
+
export interface IDataValidationRule extends IDataValidationRuleBase, IDataValidationRuleOptions {
|
|
31
|
+
uid: string;
|
|
32
|
+
/**
|
|
33
|
+
* @debt should using specific type cover sheet、doc、slide range type
|
|
34
|
+
*/
|
|
35
|
+
ranges: any;
|
|
36
|
+
}
|
|
37
|
+
export interface ISheetDataValidationRule extends IDataValidationRule {
|
|
38
|
+
ranges: IRange[];
|
|
39
|
+
}
|
|
40
|
+
export interface IDataValidationRuleInfo {
|
|
41
|
+
rule: IDataValidationRule;
|
|
42
|
+
unitId: string;
|
|
43
|
+
subUnitId: string;
|
|
44
|
+
}
|