@univerjs/core 0.2.11 → 0.2.12
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 +3 -3
- package/lib/es/index.js +21 -11
- package/lib/types/common/interceptor.d.ts +1 -0
- package/lib/types/docs/data-model/document-data-model.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/apply-utils/common.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/utils.d.ts +2 -1
- package/lib/types/services/config/config.service.d.ts +19 -6
- package/lib/types/shared/tools.d.ts +1 -2
- package/lib/types/types/interfaces/i-data-validation.d.ts +17 -2
- package/lib/types/types/interfaces/i-document-data.d.ts +24 -7
- package/lib/umd/index.js +3 -3
- package/package.json +3 -3
package/lib/es/index.js
CHANGED
|
@@ -2197,9 +2197,10 @@ const rmsPrefix = /^-ms-/, rDashAlpha = /-([a-z])/g, alphabets = [
|
|
|
2197
2197
|
static clamp(value, min, max) {
|
|
2198
2198
|
return Math.max(min, Math.min(max, value));
|
|
2199
2199
|
}
|
|
2200
|
+
static now() {
|
|
2201
|
+
return performance && performance.now ? performance.now() : Date.now();
|
|
2202
|
+
}
|
|
2200
2203
|
/**
|
|
2201
|
-
*
|
|
2202
|
-
*
|
|
2203
2204
|
* @static
|
|
2204
2205
|
* @param {unknown} object Modify the property while leaving the reference unchanged.
|
|
2205
2206
|
* @param {unknown} source The source being merged in object.
|
|
@@ -9855,11 +9856,17 @@ const IConfigService = createIdentifier("univer.config-service"), _ConfigService
|
|
|
9855
9856
|
getConfig(id) {
|
|
9856
9857
|
return this._config.get(id);
|
|
9857
9858
|
}
|
|
9858
|
-
setConfig(id, value) {
|
|
9859
|
+
setConfig(id, value, options) {
|
|
9860
|
+
var _a13;
|
|
9861
|
+
const { merge: merge2 = !1 } = options || {}, existingValue = (_a13 = this._config.get(id)) != null ? _a13 : {};
|
|
9862
|
+
if (merge2) {
|
|
9863
|
+
this._config.set(id, Tools.deepMerge(existingValue, value));
|
|
9864
|
+
return;
|
|
9865
|
+
}
|
|
9859
9866
|
this._config.set(id, value);
|
|
9860
9867
|
}
|
|
9861
9868
|
deleteConfig(id) {
|
|
9862
|
-
this._config.delete(id);
|
|
9869
|
+
return this._config.delete(id);
|
|
9863
9870
|
}
|
|
9864
9871
|
};
|
|
9865
9872
|
__name(_ConfigService, "ConfigService");
|
|
@@ -10685,7 +10692,7 @@ function extractPureTextFromCell(cell) {
|
|
|
10685
10692
|
return typeof rawValue == "string" ? cell.t === CellValueType.BOOLEAN ? rawValue.toUpperCase() : rawValue.replace(/[\r\n]/g, "") : typeof rawValue == "number" ? cell.t === CellValueType.BOOLEAN ? rawValue ? "TRUE" : "FALSE" : rawValue.toString() : typeof rawValue == "boolean" ? rawValue ? "TRUE" : "FALSE" : "";
|
|
10686
10693
|
}
|
|
10687
10694
|
__name(extractPureTextFromCell, "extractPureTextFromCell");
|
|
10688
|
-
const version = "0.2.
|
|
10695
|
+
const version = "0.2.12";
|
|
10689
10696
|
function getEmptySnapshot(unitID = "", locale = LocaleType.ZH_CN, name = "") {
|
|
10690
10697
|
return {
|
|
10691
10698
|
id: unitID,
|
|
@@ -11854,9 +11861,9 @@ let PluginService = (_a9 = class {
|
|
|
11854
11861
|
_assertPluginValid(ctor) {
|
|
11855
11862
|
const { type: type2, pluginName } = ctor;
|
|
11856
11863
|
if (type2 === I.UNRECOGNIZED)
|
|
11857
|
-
throw new Error(`[PluginService]: invalid plugin type for ${ctor}. Please assign a "type" to your plugin.`);
|
|
11858
|
-
if (pluginName
|
|
11859
|
-
throw new Error(`[PluginService]: no plugin name for ${ctor}. Please assign a "pluginName" to your plugin.`);
|
|
11864
|
+
throw new Error(`[PluginService]: invalid plugin type for ${ctor.name}. Please assign a "type" to your plugin.`);
|
|
11865
|
+
if (!pluginName)
|
|
11866
|
+
throw new Error(`[PluginService]: no plugin name for ${ctor.name}. Please assign a "pluginName" to your plugin.`);
|
|
11860
11867
|
if (this._seenPlugins.has(pluginName))
|
|
11861
11868
|
throw new Error(`[PluginService]: duplicated plugin name for "${pluginName}". Maybe a plugin that dependents on "${pluginName} has already registered it. In that case please register "${pluginName}" before the that plugin.`);
|
|
11862
11869
|
this._seenPlugins.add(ctor.pluginName);
|
|
@@ -12233,19 +12240,19 @@ const IAuthzIoService = createIdentifier("IAuthzIoIoService"), _Univer = class _
|
|
|
12233
12240
|
* @deprecated use `createUnit` instead
|
|
12234
12241
|
*/
|
|
12235
12242
|
createUniverSheet(data) {
|
|
12236
|
-
return this._univerInstanceService.createUnit(I.UNIVER_SHEET, data);
|
|
12243
|
+
return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSheet is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(I.UNIVER_SHEET, data);
|
|
12237
12244
|
}
|
|
12238
12245
|
/**
|
|
12239
12246
|
* @deprecated use `createUnit` instead
|
|
12240
12247
|
*/
|
|
12241
12248
|
createUniverDoc(data) {
|
|
12242
|
-
return this._univerInstanceService.createUnit(I.UNIVER_DOC, data);
|
|
12249
|
+
return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverDoc is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(I.UNIVER_DOC, data);
|
|
12243
12250
|
}
|
|
12244
12251
|
/**
|
|
12245
12252
|
* @deprecated use `createUnit` instead
|
|
12246
12253
|
*/
|
|
12247
12254
|
createUniverSlide(data) {
|
|
12248
|
-
return this._univerInstanceService.createUnit(I.UNIVER_SLIDE, data);
|
|
12255
|
+
return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSlide is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(I.UNIVER_SLIDE, data);
|
|
12249
12256
|
}
|
|
12250
12257
|
_init(injector) {
|
|
12251
12258
|
this._univerInstanceService.registerCtorForType(I.UNIVER_SHEET, Workbook), this._univerInstanceService.registerCtorForType(I.UNIVER_DOC, DocumentDataModel), this._univerInstanceService.registerCtorForType(I.UNIVER_SLIDE, SlideDataModel);
|
|
@@ -12507,6 +12514,9 @@ const composeInterceptors = /* @__PURE__ */ __name((interceptors) => function(in
|
|
|
12507
12514
|
getInterceptPoints() {
|
|
12508
12515
|
return this._interceptorPoints;
|
|
12509
12516
|
}
|
|
12517
|
+
dispose() {
|
|
12518
|
+
this._interceptorsByName.clear();
|
|
12519
|
+
}
|
|
12510
12520
|
};
|
|
12511
12521
|
__name(_InterceptorManager, "InterceptorManager");
|
|
12512
12522
|
let InterceptorManager = _InterceptorManager;
|
|
@@ -17,4 +17,5 @@ export declare class InterceptorManager<P extends Record<string, IInterceptor<an
|
|
|
17
17
|
fetchThroughInterceptors<T, C>(name: IInterceptor<T, C>): (initValue: Nullable<T>, initContext: C) => Nullable<T>;
|
|
18
18
|
intercept<T extends IInterceptor<any, any>>(name: T, interceptor: T): () => boolean;
|
|
19
19
|
getInterceptPoints(): P;
|
|
20
|
+
dispose(): void;
|
|
20
21
|
}
|
|
@@ -47,7 +47,7 @@ export declare class DocumentDataModel extends DocumentDataModelSimple {
|
|
|
47
47
|
dispose(): void;
|
|
48
48
|
getDrawings(): IDrawings | undefined;
|
|
49
49
|
getDrawingsOrder(): string[] | undefined;
|
|
50
|
-
getCustomRanges(): import('../../types/interfaces/i-document-data').ICustomRange[] | undefined;
|
|
50
|
+
getCustomRanges(): import('../../types/interfaces/i-document-data').ICustomRange<Record<string, any>>[] | undefined;
|
|
51
51
|
getCustomDecorations(): import('../../types/interfaces/i-document-data').ICustomDecoration[] | undefined;
|
|
52
52
|
getRev(): number;
|
|
53
53
|
incrementRev(): void;
|
|
@@ -28,5 +28,5 @@ export declare function deleteParagraphs(body: IDocumentBody, textLength: number
|
|
|
28
28
|
export declare function deleteSectionBreaks(body: IDocumentBody, textLength: number, currentIndex: number): ISectionBreak[];
|
|
29
29
|
export declare function deleteCustomBlocks(body: IDocumentBody, textLength: number, currentIndex: number): ICustomBlock[];
|
|
30
30
|
export declare function deleteTables(body: IDocumentBody, textLength: number, currentIndex: number): ICustomTable[];
|
|
31
|
-
export declare function deleteCustomRanges(body: IDocumentBody, textLength: number, currentIndex: number): ICustomRange[];
|
|
31
|
+
export declare function deleteCustomRanges(body: IDocumentBody, textLength: number, currentIndex: number): ICustomRange<Record<string, any>>[];
|
|
32
32
|
export declare function deleteCustomDecorations(body: IDocumentBody, textLength: number, currentIndex: number, needOffset?: boolean): ICustomDecoration[];
|
|
@@ -12,8 +12,9 @@ export declare function getCustomRangeSlice(body: IDocumentBody, startOffset: nu
|
|
|
12
12
|
startIndex: number;
|
|
13
13
|
endIndex: number;
|
|
14
14
|
rangeId: string;
|
|
15
|
-
rangeType: import('../../../types/interfaces/i-document-data').CustomRangeType;
|
|
15
|
+
rangeType: import('../../../types/interfaces/i-document-data').CustomRangeType | number;
|
|
16
16
|
wholeEntity?: boolean;
|
|
17
|
+
properties?: Record<string, any> | undefined;
|
|
17
18
|
}[];
|
|
18
19
|
leftOffset: number;
|
|
19
20
|
rightOffset: number;
|
|
@@ -3,15 +3,28 @@ import { Nullable } from '../../shared/types';
|
|
|
3
3
|
* IConfig provides universal configuration for the whole application.
|
|
4
4
|
*/
|
|
5
5
|
export declare const IConfigService: import('../../common/di').IdentifierDecorator<IConfigService>;
|
|
6
|
+
interface IConfigOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the configuration is read-only.
|
|
9
|
+
* Not implemented yet.
|
|
10
|
+
* @ignore
|
|
11
|
+
*/
|
|
12
|
+
readonly?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Whether to merge the configuration with the existing one.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
merge?: boolean;
|
|
18
|
+
}
|
|
6
19
|
export interface IConfigService {
|
|
7
|
-
getConfig<T>(id: string, defaultValue: T): T;
|
|
8
20
|
getConfig<T>(id: string): Nullable<T>;
|
|
9
|
-
setConfig(id: string, value: unknown): void;
|
|
10
|
-
deleteConfig(id: string):
|
|
21
|
+
setConfig(id: string | symbol, value: unknown, options?: IConfigOptions): void;
|
|
22
|
+
deleteConfig(id: string): boolean;
|
|
11
23
|
}
|
|
12
24
|
export declare class ConfigService implements IConfigService {
|
|
13
25
|
private readonly _config;
|
|
14
|
-
getConfig<T>(id: string): Nullable<T>;
|
|
15
|
-
setConfig(id: string, value: unknown): void;
|
|
16
|
-
deleteConfig(id: string):
|
|
26
|
+
getConfig<T>(id: string | symbol): Nullable<T>;
|
|
27
|
+
setConfig(id: string, value: unknown, options?: IConfigOptions): void;
|
|
28
|
+
deleteConfig(id: string | symbol): boolean;
|
|
17
29
|
}
|
|
30
|
+
export {};
|
|
@@ -111,9 +111,8 @@ export declare class Tools {
|
|
|
111
111
|
*/
|
|
112
112
|
static set(data: Record<string, any>, propertyPath: string, value: any): void;
|
|
113
113
|
static clamp(value: number, min: number, max: number): number;
|
|
114
|
+
static now(): number;
|
|
114
115
|
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
116
|
* @static
|
|
118
117
|
* @param {unknown} object Modify the property while leaving the reference unchanged.
|
|
119
118
|
* @param {unknown} source The source being merged in object.
|
|
@@ -5,8 +5,14 @@ import { DataValidationErrorStyle } from '../enum/data-validation-error-style';
|
|
|
5
5
|
import { DataValidationRenderMode } from '../enum/data-validation-render-mode';
|
|
6
6
|
import { IRange } from '../../sheets/typedef';
|
|
7
7
|
export interface IDataValidationRuleBase {
|
|
8
|
+
/**
|
|
9
|
+
* data validation type
|
|
10
|
+
*/
|
|
8
11
|
type: DataValidationType;
|
|
9
12
|
allowBlank?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* data validation creteria
|
|
15
|
+
*/
|
|
10
16
|
formula1?: string;
|
|
11
17
|
formula2?: string;
|
|
12
18
|
operator?: DataValidationOperator;
|
|
@@ -14,14 +20,20 @@ export interface IDataValidationRuleBase {
|
|
|
14
20
|
export interface IDataValidationRuleOptions {
|
|
15
21
|
imeMode?: DataValidationImeMode;
|
|
16
22
|
/**
|
|
17
|
-
* for dropdown
|
|
23
|
+
* for list&listMultiple, show dropdown or not
|
|
18
24
|
*/
|
|
19
25
|
showDropDown?: boolean;
|
|
20
26
|
/**
|
|
21
27
|
* validator error
|
|
22
28
|
*/
|
|
23
29
|
showErrorMessage?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* custom error tips
|
|
32
|
+
*/
|
|
24
33
|
error?: string;
|
|
34
|
+
/**
|
|
35
|
+
* reaction when validator error
|
|
36
|
+
*/
|
|
25
37
|
errorStyle?: DataValidationErrorStyle;
|
|
26
38
|
errorTitle?: string;
|
|
27
39
|
/**
|
|
@@ -31,13 +43,16 @@ export interface IDataValidationRuleOptions {
|
|
|
31
43
|
prompt?: string;
|
|
32
44
|
promptTitle?: string;
|
|
33
45
|
/**
|
|
34
|
-
* cell render mode of data validation
|
|
46
|
+
* cell render mode of data validation, support TEXT, ARROW, CUSTOM
|
|
35
47
|
*/
|
|
36
48
|
renderMode?: DataValidationRenderMode;
|
|
37
49
|
/**
|
|
38
50
|
* custom biz info
|
|
39
51
|
*/
|
|
40
52
|
bizInfo?: {
|
|
53
|
+
/**
|
|
54
|
+
* show time in date picker
|
|
55
|
+
*/
|
|
41
56
|
showTime?: boolean;
|
|
42
57
|
};
|
|
43
58
|
}
|
|
@@ -264,19 +264,27 @@ export interface ITextRun {
|
|
|
264
264
|
sId?: string;
|
|
265
265
|
ts?: ITextStyle;
|
|
266
266
|
}
|
|
267
|
-
|
|
267
|
+
/**
|
|
268
|
+
* Block element, link like, disabled to self nested
|
|
269
|
+
*/
|
|
270
|
+
export interface ICustomRange<T extends Record<string, any> = Record<string, any>> {
|
|
268
271
|
startIndex: number;
|
|
269
272
|
endIndex: number;
|
|
270
273
|
rangeId: string;
|
|
271
|
-
rangeType: CustomRangeType;
|
|
274
|
+
rangeType: CustomRangeType | number;
|
|
272
275
|
/**
|
|
273
276
|
* display as a whole-entity
|
|
274
277
|
*/
|
|
275
278
|
wholeEntity?: boolean;
|
|
279
|
+
/**
|
|
280
|
+
* properties of custom range,
|
|
281
|
+
* for example, hyperlink: `{ url: string }`
|
|
282
|
+
*/
|
|
283
|
+
properties?: T;
|
|
276
284
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
285
|
+
export type IHyperLinkCustomRange = ICustomRange<{
|
|
286
|
+
url: string;
|
|
287
|
+
}>;
|
|
280
288
|
export declare enum CustomRangeType {
|
|
281
289
|
HYPERLINK = 0,
|
|
282
290
|
FIELD = 1,// 17.16 Fields and Hyperlinks
|
|
@@ -575,8 +583,17 @@ export declare enum NamedStyleType {
|
|
|
575
583
|
HEADING_6 = 9
|
|
576
584
|
}
|
|
577
585
|
export declare enum SpacingRule {
|
|
578
|
-
|
|
579
|
-
|
|
586
|
+
/**
|
|
587
|
+
* Specifies that the line spacing of the parent object shall be automatically determined by the size of its contents, with no predetermined minimum or maximum size.
|
|
588
|
+
*/
|
|
589
|
+
AUTO = 0,
|
|
590
|
+
/**
|
|
591
|
+
* Specifies that the height of the line shall be at least the value specified, but might be expanded to fit its content as needed.
|
|
592
|
+
*/
|
|
593
|
+
AT_LEAST = 1,
|
|
594
|
+
/**
|
|
595
|
+
* Specifies that the height of the line shall be exactly the value specified, regardless of the size of the contents of the contents.
|
|
596
|
+
*/
|
|
580
597
|
EXACT = 2
|
|
581
598
|
}
|
|
582
599
|
/**
|