@univerjs/core 0.1.0-alpha.2 → 0.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/cjs/index.js +5 -5
- package/lib/es/index.js +2668 -2584
- package/lib/types/basics/plugin-holder.d.ts +30 -0
- package/lib/types/basics/univer-doc.d.ts +7 -11
- package/lib/types/basics/univer-sheet.d.ts +7 -21
- package/lib/types/basics/univer-slide.d.ts +6 -19
- package/lib/types/basics/univer.d.ts +18 -13
- package/lib/types/common/memory-cursor.d.ts +1 -0
- package/lib/types/common/shims.d.ts +16 -0
- package/lib/types/docs/data-model/index.d.ts +1 -0
- package/lib/types/docs/data-model/preset-list-type.d.ts +50 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/plugin/plugin.d.ts +4 -3
- package/lib/types/services/command/command.service.d.ts +3 -3
- package/lib/types/services/log/log.service.d.ts +8 -6
- package/lib/types/shared/color/color-kit.d.ts +64 -0
- package/lib/types/shared/color/color.d.ts +17 -3
- package/lib/types/shared/common.d.ts +1 -3
- package/lib/types/shared/index.d.ts +1 -2
- package/lib/types/shared/locale.d.ts +1 -4
- package/lib/types/shared/object-matrix.d.ts +29 -28
- package/lib/types/shared/rectangle.d.ts +1 -0
- package/lib/types/shared/sort-rules.d.ts +2 -2
- package/lib/types/shared/tools.d.ts +0 -5
- package/lib/types/sheets/column-manager.d.ts +7 -8
- package/lib/types/sheets/range.d.ts +4 -4
- package/lib/types/sheets/row-manager.d.ts +7 -7
- package/lib/types/sheets/styles.d.ts +4 -6
- package/lib/types/sheets/workbook.d.ts +5 -3
- package/lib/types/sheets/worksheet.d.ts +1 -1
- package/lib/types/types/enum/text-style.d.ts +3 -3
- package/lib/types/types/interfaces/i-document-data.d.ts +3 -2
- package/lib/types/types/interfaces/i-range.d.ts +13 -11
- package/lib/types/types/interfaces/i-worksheet-data.d.ts +4 -5
- package/lib/umd/index.js +5 -5
- package/package.json +4 -4
- package/lib/types/shared/color/color-builder.d.ts +0 -35
- package/lib/types/shared/object-array.d.ts +0 -110
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { Injector } from '@wendellhu/redi';
|
|
17
|
+
import type { Plugin, PluginCtor } from '../plugin/plugin';
|
|
18
|
+
import { LifecycleStages } from '../services/lifecycle/lifecycle';
|
|
19
|
+
import type { LifecycleInitializerService, LifecycleService } from '../services/lifecycle/lifecycle.service';
|
|
20
|
+
import { Disposable } from '../shared/lifecycle';
|
|
21
|
+
export declare abstract class PluginHolder extends Disposable {
|
|
22
|
+
protected abstract get _lifecycleService(): LifecycleService;
|
|
23
|
+
protected abstract get _lifecycleInitializerService(): LifecycleInitializerService;
|
|
24
|
+
protected abstract get _injector(): Injector;
|
|
25
|
+
protected _started: boolean;
|
|
26
|
+
addPlugins(plugins: Array<[PluginCtor<any>, any]>): void;
|
|
27
|
+
protected _takePluginsThroughLifecycle(plugins: Plugin[], skipStarting?: boolean): void;
|
|
28
|
+
protected _pluginsRunLifecycle(plugins: Plugin[], lifecycle: LifecycleStages): void;
|
|
29
|
+
protected _initPlugin<T extends Plugin>(plugin: PluginCtor<T>, options: any): Plugin;
|
|
30
|
+
}
|
|
@@ -15,20 +15,16 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Injector } from '@wendellhu/redi';
|
|
17
17
|
import { DocumentDataModel } from '../docs/data-model/document-data-model';
|
|
18
|
-
import
|
|
19
|
-
import { LifecycleInitializerService } from '../services/lifecycle/lifecycle.service';
|
|
20
|
-
import { Disposable } from '../shared/lifecycle';
|
|
18
|
+
import { LifecycleInitializerService, LifecycleService } from '../services/lifecycle/lifecycle.service';
|
|
21
19
|
import type { IDocumentData } from '../types/interfaces/i-document-data';
|
|
20
|
+
import { PluginHolder } from './plugin-holder';
|
|
22
21
|
/**
|
|
23
22
|
* Externally provided UniverDoc root instance
|
|
24
23
|
*/
|
|
25
|
-
export declare class UniverDoc extends
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
constructor(_injector: Injector,
|
|
30
|
-
start(): void;
|
|
31
|
-
ready(): void;
|
|
24
|
+
export declare class UniverDoc extends PluginHolder {
|
|
25
|
+
protected readonly _injector: Injector;
|
|
26
|
+
protected readonly _lifecycleService: LifecycleService;
|
|
27
|
+
protected readonly _lifecycleInitializerService: LifecycleInitializerService;
|
|
28
|
+
constructor(_injector: Injector, _lifecycleService: LifecycleService, _lifecycleInitializerService: LifecycleInitializerService);
|
|
32
29
|
createDoc(docData: Partial<IDocumentData>): DocumentDataModel;
|
|
33
|
-
addPlugin<T extends Plugin>(pluginCtor: PluginCtor<T>, options: any): void;
|
|
34
30
|
}
|
|
@@ -15,31 +15,17 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { IDisposable } from '@wendellhu/redi';
|
|
17
17
|
import { Injector } from '@wendellhu/redi';
|
|
18
|
-
import
|
|
19
|
-
import { LifecycleInitializerService } from '../services/lifecycle/lifecycle.service';
|
|
20
|
-
import { Disposable } from '../shared/lifecycle';
|
|
18
|
+
import { LifecycleInitializerService, LifecycleService } from '../services/lifecycle/lifecycle.service';
|
|
21
19
|
import { Workbook } from '../sheets/workbook';
|
|
22
20
|
import type { IWorkbookData } from '../types/interfaces/i-workbook-data';
|
|
21
|
+
import { PluginHolder } from './plugin-holder';
|
|
23
22
|
/**
|
|
24
23
|
* Externally provided UniverSheet root instance
|
|
25
24
|
*/
|
|
26
|
-
export declare class UniverSheet extends
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
constructor(_injector: Injector,
|
|
31
|
-
start(): void;
|
|
32
|
-
ready(): void;
|
|
25
|
+
export declare class UniverSheet extends PluginHolder implements IDisposable {
|
|
26
|
+
protected readonly _injector: Injector;
|
|
27
|
+
protected readonly _lifecycleService: LifecycleService;
|
|
28
|
+
protected readonly _lifecycleInitializerService: LifecycleInitializerService;
|
|
29
|
+
constructor(_injector: Injector, _lifecycleService: LifecycleService, _lifecycleInitializerService: LifecycleInitializerService);
|
|
33
30
|
createSheet(workbookConfig: Partial<IWorkbookData>): Workbook;
|
|
34
|
-
dispose(): void;
|
|
35
|
-
/**
|
|
36
|
-
* Add a plugin into UniverSheet. UniverSheet should add dependencies exposed from this plugin to its DI system.
|
|
37
|
-
*
|
|
38
|
-
* @param plugin constructor of the plugin class
|
|
39
|
-
* @param options options to this plugin
|
|
40
|
-
*
|
|
41
|
-
* @internal
|
|
42
|
-
*/
|
|
43
|
-
addPlugin<T extends Plugin>(plugin: PluginCtor<T>, options: any): void;
|
|
44
|
-
private _initDependencies;
|
|
45
31
|
}
|
|
@@ -14,30 +14,17 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { Injector } from '@wendellhu/redi';
|
|
17
|
-
import type { Plugin, PluginCtor } from '../plugin/plugin';
|
|
18
17
|
import { LifecycleInitializerService, LifecycleService } from '../services/lifecycle/lifecycle.service';
|
|
19
|
-
import { Disposable } from '../shared/lifecycle';
|
|
20
18
|
import { Slide } from '../slides/domain/slide-model';
|
|
21
19
|
import type { ISlideData } from '../types/interfaces/i-slide-data';
|
|
20
|
+
import { PluginHolder } from './plugin-holder';
|
|
22
21
|
/**
|
|
23
22
|
* Externally provided UniverSlide root instance
|
|
24
23
|
*/
|
|
25
|
-
export declare class UniverSlide extends
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
constructor(_injector: Injector, _lifecycleService: LifecycleService, _initializerService: LifecycleInitializerService);
|
|
31
|
-
start(): void;
|
|
32
|
-
ready(): void;
|
|
24
|
+
export declare class UniverSlide extends PluginHolder {
|
|
25
|
+
protected readonly _injector: Injector;
|
|
26
|
+
protected readonly _lifecycleService: LifecycleService;
|
|
27
|
+
protected readonly _lifecycleInitializerService: LifecycleInitializerService;
|
|
28
|
+
constructor(_injector: Injector, _lifecycleService: LifecycleService, _lifecycleInitializerService: LifecycleInitializerService);
|
|
33
29
|
createSlide(data: Partial<ISlideData>): Slide;
|
|
34
|
-
/**
|
|
35
|
-
* Add a plugin into UniverSlide. UniverSlide should add dependencies exposed from this plugin to its DI system.
|
|
36
|
-
*
|
|
37
|
-
* @param plugin constructor of the plugin class
|
|
38
|
-
* @param options options to this plugin
|
|
39
|
-
*
|
|
40
|
-
* @internal
|
|
41
|
-
*/
|
|
42
|
-
addPlugin<T extends Plugin>(plugin: PluginCtor<T>, options: any): void;
|
|
43
30
|
}
|
|
@@ -16,26 +16,25 @@
|
|
|
16
16
|
import { Injector } from '@wendellhu/redi';
|
|
17
17
|
import type { DocumentDataModel } from '../docs/data-model/document-data-model';
|
|
18
18
|
import type { Plugin, PluginCtor } from '../plugin/plugin';
|
|
19
|
+
import { LifecycleInitializerService, LifecycleService } from '../services/lifecycle/lifecycle.service';
|
|
19
20
|
import type { Workbook } from '../sheets/workbook';
|
|
20
21
|
import type { Slide } from '../slides/domain/slide-model';
|
|
21
22
|
import type { LocaleType } from '../types/enum/locale-type';
|
|
22
23
|
import type { IDocumentData, ISlideData, IUniverData, IWorkbookData } from '../types/interfaces';
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export declare class Univer {
|
|
27
|
-
private readonly _rootInjector;
|
|
24
|
+
import { PluginHolder } from './plugin-holder';
|
|
25
|
+
export declare class Univer extends PluginHolder {
|
|
26
|
+
protected readonly _injector: Injector;
|
|
28
27
|
private readonly _univerPluginStore;
|
|
29
28
|
private readonly _univerPluginRegistry;
|
|
30
29
|
private _univerSheet;
|
|
31
30
|
private _univerDoc;
|
|
32
31
|
private _univerSlide;
|
|
33
32
|
private get _univerInstanceService();
|
|
33
|
+
protected get _lifecycleService(): LifecycleService;
|
|
34
|
+
protected get _lifecycleInitializerService(): LifecycleInitializerService;
|
|
34
35
|
constructor(univerData?: Partial<IUniverData>);
|
|
35
36
|
__getInjector(): Injector;
|
|
36
37
|
dispose(): void;
|
|
37
|
-
/** Register a plugin into univer. */
|
|
38
|
-
registerPlugin<T extends Plugin>(plugin: PluginCtor<T>, configs?: any): void;
|
|
39
38
|
setLocale(locale: LocaleType): void;
|
|
40
39
|
/**
|
|
41
40
|
* Create a univer sheet instance with internal dependency injection.
|
|
@@ -44,12 +43,18 @@ export declare class Univer {
|
|
|
44
43
|
createUniverDoc(config: Partial<IDocumentData>): DocumentDataModel;
|
|
45
44
|
createUniverSlide(config: Partial<ISlideData>): Slide;
|
|
46
45
|
private _initDependencies;
|
|
47
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Initialize modules provided by Univer-type plugins.
|
|
48
|
+
*/
|
|
49
|
+
private _tryProgressToStart;
|
|
48
50
|
private _tryProgressToReady;
|
|
51
|
+
/** Register a plugin into univer. */
|
|
52
|
+
registerPlugin<T extends Plugin>(plugin: PluginCtor<T>, config?: any): void;
|
|
53
|
+
private _initLazyPluginsTimer?;
|
|
54
|
+
private _scheduleInitPluginAfterStarted;
|
|
55
|
+
private _flushLazyPlugins;
|
|
49
56
|
private _registerUniverPlugin;
|
|
50
|
-
private
|
|
51
|
-
private
|
|
52
|
-
private
|
|
53
|
-
private _initializePluginsForDoc;
|
|
54
|
-
private _initializePluginsForSlide;
|
|
57
|
+
private _registerSheetsPlugin;
|
|
58
|
+
private _registerDocsPlugin;
|
|
59
|
+
private _registerSlidesPlugin;
|
|
55
60
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare function installShims(): void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { BulletAlignment, GlyphType } from '../../types/interfaces/i-document-data';
|
|
17
|
+
export declare enum PresetListType {
|
|
18
|
+
BULLET_LIST = "BULLET_LIST",
|
|
19
|
+
ORDER_LIST = "ORDER_LIST"
|
|
20
|
+
}
|
|
21
|
+
export declare const PRESET_LIST_TYPE: {
|
|
22
|
+
BULLET_LIST: {
|
|
23
|
+
listType: PresetListType;
|
|
24
|
+
nestingLevel: {
|
|
25
|
+
bulletAlignment: BulletAlignment;
|
|
26
|
+
glyphFormat: string;
|
|
27
|
+
textStyle: {
|
|
28
|
+
fs: number;
|
|
29
|
+
};
|
|
30
|
+
startNumber: number;
|
|
31
|
+
glyphSymbol: string;
|
|
32
|
+
hanging: number;
|
|
33
|
+
indentStart: number;
|
|
34
|
+
}[];
|
|
35
|
+
};
|
|
36
|
+
ORDER_LIST: {
|
|
37
|
+
listType: PresetListType;
|
|
38
|
+
nestingLevel: {
|
|
39
|
+
bulletAlignment: BulletAlignment;
|
|
40
|
+
glyphFormat: string;
|
|
41
|
+
textStyle: {
|
|
42
|
+
fs: number;
|
|
43
|
+
};
|
|
44
|
+
startNumber: number;
|
|
45
|
+
glyphType: GlyphType;
|
|
46
|
+
hanging: number;
|
|
47
|
+
indentStart: number;
|
|
48
|
+
}[];
|
|
49
|
+
};
|
|
50
|
+
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export { type IUndoRedoCommandInfos, type IUndoRedoItem, IUndoRedoService, type
|
|
|
45
45
|
export * from './shared';
|
|
46
46
|
export type { IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';
|
|
47
47
|
export { composeInterceptors, createInterceptorKey, InterceptorManager } from './common/interceptor';
|
|
48
|
+
export type { PluginCtor } from './plugin/plugin';
|
|
48
49
|
export { Range } from './sheets/range';
|
|
49
50
|
export { deserializeRangeWithSheet, getAbsoluteRefTypeWithSingleString, getAbsoluteRefTypeWitString, serializeRange, serializeRangeToRefString, serializeRangeWithSheet, serializeRangeWithSpreadsheet, } from './sheets/reference';
|
|
50
51
|
export { Styles } from './sheets/styles';
|
|
@@ -40,14 +40,14 @@ export declare abstract class Plugin {
|
|
|
40
40
|
getPluginName(): string;
|
|
41
41
|
}
|
|
42
42
|
interface IPluginRegistryItem {
|
|
43
|
-
plugin:
|
|
43
|
+
plugin: PluginCtor<Plugin>;
|
|
44
44
|
options: any;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Store plugin instances.
|
|
48
48
|
*/
|
|
49
49
|
export declare class PluginStore {
|
|
50
|
-
private readonly
|
|
50
|
+
private readonly _plugins;
|
|
51
51
|
addPlugin(plugin: Plugin): void;
|
|
52
52
|
removePlugins(): Plugin[];
|
|
53
53
|
forEachPlugin(callback: (plugin: Plugin) => void): void;
|
|
@@ -56,8 +56,9 @@ export declare class PluginStore {
|
|
|
56
56
|
* Store plugin registry items.
|
|
57
57
|
*/
|
|
58
58
|
export declare class PluginRegistry {
|
|
59
|
-
private readonly
|
|
59
|
+
private readonly _pluginsRegisteredByBusiness;
|
|
60
60
|
registerPlugin(pluginCtor: PluginCtor<any>, options: any): void;
|
|
61
61
|
getRegisterPlugins(type: PluginType): [IPluginRegistryItem];
|
|
62
|
+
clearPluginsOfType(type: PluginType): void;
|
|
62
63
|
}
|
|
63
64
|
export {};
|
|
@@ -95,9 +95,9 @@ export interface IOperationInfo<T extends object = object> {
|
|
|
95
95
|
params: T;
|
|
96
96
|
}
|
|
97
97
|
export interface IExecutionOptions {
|
|
98
|
-
/** This mutation should only be executed on the local machine. */
|
|
99
|
-
|
|
100
|
-
/**
|
|
98
|
+
/** This mutation should only be executed on the local machine, and not synced to replicas. */
|
|
99
|
+
onlyLocal?: boolean;
|
|
100
|
+
/** This command is from collaboration peers. */
|
|
101
101
|
fromCollab?: boolean;
|
|
102
102
|
[key: PropertyKey]: string | number | boolean | undefined;
|
|
103
103
|
}
|
|
@@ -20,17 +20,19 @@ export declare enum LogLevel {
|
|
|
20
20
|
WARN = 2,
|
|
21
21
|
VERBOSE = 3
|
|
22
22
|
}
|
|
23
|
+
type ArgsType = any[];
|
|
23
24
|
export interface ILogService {
|
|
24
|
-
log(...args:
|
|
25
|
-
warn(...args:
|
|
26
|
-
error(...args:
|
|
25
|
+
log(...args: ArgsType): void;
|
|
26
|
+
warn(...args: ArgsType): void;
|
|
27
|
+
error(...args: ArgsType): void;
|
|
27
28
|
setLogLevel(enabled: LogLevel): void;
|
|
28
29
|
}
|
|
29
30
|
export declare const ILogService: import("@wendellhu/redi").IdentifierDecorator<ILogService>;
|
|
30
31
|
export declare class DesktopLogService extends Disposable implements ILogService {
|
|
31
32
|
private _logLevel;
|
|
32
|
-
log(...args:
|
|
33
|
-
warn(...args:
|
|
34
|
-
error(...args:
|
|
33
|
+
log(...args: ArgsType): void;
|
|
34
|
+
warn(...args: ArgsType): void;
|
|
35
|
+
error(...args: ArgsType): void;
|
|
35
36
|
setLogLevel(logLevel: LogLevel): void;
|
|
36
37
|
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
interface IRgbColor {
|
|
17
|
+
b: number;
|
|
18
|
+
g: number;
|
|
19
|
+
r: number;
|
|
20
|
+
a?: number;
|
|
21
|
+
}
|
|
22
|
+
interface IHslColor {
|
|
23
|
+
h: number;
|
|
24
|
+
l: number;
|
|
25
|
+
s: number;
|
|
26
|
+
a?: number;
|
|
27
|
+
}
|
|
28
|
+
interface IHsvColor {
|
|
29
|
+
h: number;
|
|
30
|
+
s: number;
|
|
31
|
+
v: number;
|
|
32
|
+
a?: number;
|
|
33
|
+
}
|
|
34
|
+
type Color = IRgbColor | IHslColor | IHsvColor;
|
|
35
|
+
export declare const RGB_PAREN = "rgb(";
|
|
36
|
+
export declare const RGBA_PAREN = "rgba(";
|
|
37
|
+
export declare const COLORS: {
|
|
38
|
+
[key: string]: number[];
|
|
39
|
+
};
|
|
40
|
+
export declare class ColorKit {
|
|
41
|
+
private _color;
|
|
42
|
+
private _rgbColor;
|
|
43
|
+
private _isValid;
|
|
44
|
+
static mix(color1: string | Color | ColorKit, color2: string | Color | ColorKit, amount: number): ColorKit;
|
|
45
|
+
static getContrastRatio(foreground: string | Color | ColorKit, background: string | Color | ColorKit): number;
|
|
46
|
+
constructor(color: string | Color | ColorKit | undefined);
|
|
47
|
+
get isValid(): boolean;
|
|
48
|
+
toRgb(): IRgbColor;
|
|
49
|
+
toRgbString(): string;
|
|
50
|
+
toString(): string;
|
|
51
|
+
toHexString(allowShort?: boolean): string;
|
|
52
|
+
toHsv(): IHsvColor;
|
|
53
|
+
toHsl(): IHslColor;
|
|
54
|
+
lighten(amount?: number): ColorKit;
|
|
55
|
+
darken(amount?: number): ColorKit;
|
|
56
|
+
setAlpha(value: number): ColorKit;
|
|
57
|
+
getLuminance(): number;
|
|
58
|
+
getBrightness(): number;
|
|
59
|
+
getAlpha(): number;
|
|
60
|
+
isDark(): boolean;
|
|
61
|
+
isLight(): boolean;
|
|
62
|
+
private _setNullColor;
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
@@ -14,9 +14,23 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { Nullable } from '../../common/type-utils';
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
import { ColorType, ThemeColors, ThemeColorType } from '../../types/enum';
|
|
18
|
+
export declare class ColorBuilder {
|
|
19
|
+
private _themeValue;
|
|
20
|
+
private _themeColors;
|
|
21
|
+
private _themeTint;
|
|
22
|
+
private _rgbValue;
|
|
23
|
+
private _colorType;
|
|
24
|
+
constructor();
|
|
25
|
+
asRgbColor(): RgbColor;
|
|
26
|
+
asThemeColor(): ThemeColor;
|
|
27
|
+
build(): Nullable<Color>;
|
|
28
|
+
setRgbColor(cssString: string): ColorBuilder;
|
|
29
|
+
setThemeColors(value: ThemeColors): void;
|
|
30
|
+
setThemeTint(value: number): void;
|
|
31
|
+
setThemeColor(theme: ThemeColorType): ColorBuilder;
|
|
32
|
+
getColorType(): ColorType;
|
|
33
|
+
}
|
|
20
34
|
export declare class Color {
|
|
21
35
|
protected _builder: ColorBuilder;
|
|
22
36
|
constructor(builder: ColorBuilder);
|
|
@@ -25,9 +25,6 @@ export declare function isEmptyCell(cell: Nullable<ICellData>): boolean;
|
|
|
25
25
|
export declare function getColorStyle(color: Nullable<IColorStyle>): Nullable<string>;
|
|
26
26
|
export declare function isFormulaString(value: any): boolean;
|
|
27
27
|
export declare function isFormulaId(value: any): boolean;
|
|
28
|
-
/**
|
|
29
|
-
* move to Styles.getStyleByCell
|
|
30
|
-
*/
|
|
31
28
|
/**
|
|
32
29
|
* Convert rich text json to DOM
|
|
33
30
|
* @param p
|
|
@@ -41,3 +38,4 @@ export declare function handleJsonToDom(p: IDocumentData): string;
|
|
|
41
38
|
export declare function handleStyleToString(style: IStyleData, isCell?: boolean): string;
|
|
42
39
|
export declare function getBorderStyleType(type: string): number;
|
|
43
40
|
export declare function getDocsUpdateBody(model: IDocumentData, segmentId?: string): import("../types/interfaces").IDocumentBody | undefined;
|
|
41
|
+
export declare function isValidRange(range: IRange): boolean;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
export * from './array-search';
|
|
17
17
|
export * from './blob';
|
|
18
18
|
export * from './color/color';
|
|
19
|
-
export
|
|
19
|
+
export { ColorKit, COLORS, RGB_PAREN, RGBA_PAREN } from './color/color-kit';
|
|
20
20
|
export * from './command-enum';
|
|
21
21
|
export * from './common';
|
|
22
22
|
export * from './compare';
|
|
@@ -27,7 +27,6 @@ export * from './hash-algorithm';
|
|
|
27
27
|
export * from './lifecycle';
|
|
28
28
|
export * from './locale';
|
|
29
29
|
export * from './lru/index';
|
|
30
|
-
export * from './object-array';
|
|
31
30
|
export * from './object-matrix';
|
|
32
31
|
export * from './permission';
|
|
33
32
|
export * from './rectangle';
|
|
@@ -14,10 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export interface ILanguagePack {
|
|
17
|
-
[key: string]: string |
|
|
18
|
-
name: string;
|
|
19
|
-
value: string;
|
|
20
|
-
}> | ILanguagePack;
|
|
17
|
+
[key: string]: string | ILanguagePack | ILanguagePack[];
|
|
21
18
|
}
|
|
22
19
|
export interface ILocales {
|
|
23
20
|
[key: string]: ILanguagePack;
|
|
@@ -14,38 +14,41 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { IRange } from '../types/interfaces/i-range';
|
|
17
|
-
import type { PredicateFunction } from './object-array';
|
|
18
|
-
import { ObjectArray } from './object-array';
|
|
19
17
|
import type { Nullable } from './types';
|
|
20
18
|
/**
|
|
21
19
|
* Object Matrix Primitive Type
|
|
22
20
|
*/
|
|
23
|
-
export interface
|
|
24
|
-
[key: number]:
|
|
25
|
-
[key: number]: T;
|
|
26
|
-
};
|
|
21
|
+
export interface IObjectMatrixPrimitiveType<T> {
|
|
22
|
+
[key: number]: IObjectArrayPrimitiveType<T>;
|
|
27
23
|
}
|
|
24
|
+
export interface IObjectArrayPrimitiveType<T> {
|
|
25
|
+
[key: number]: T;
|
|
26
|
+
}
|
|
27
|
+
export declare function getArrayLength<T>(o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): number;
|
|
28
|
+
export declare function insertMatrixArray<T>(index: number, value: T, o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): void;
|
|
29
|
+
export declare function concatMatrixArray<T>(source: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>, target: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>;
|
|
30
|
+
export declare function sliceMatrixArray<T>(start: number, end: number, matrixArray: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>;
|
|
31
|
+
export declare function moveMatrixArray<T>(fromIndex: number, count: number, toIndex: number, o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): void;
|
|
28
32
|
/**
|
|
29
33
|
* A two-dimensional array represented by a two-level deep object and provides an array-like API
|
|
30
34
|
*
|
|
31
35
|
* @beta
|
|
32
36
|
*/
|
|
33
37
|
export declare class ObjectMatrix<T> {
|
|
34
|
-
private _option;
|
|
35
38
|
private _matrix;
|
|
36
|
-
constructor(matrix?:
|
|
39
|
+
constructor(matrix?: IObjectMatrixPrimitiveType<T>);
|
|
37
40
|
static MakeObjectMatrixSize<T>(size: number): ObjectMatrix<T>;
|
|
38
|
-
getMatrix():
|
|
39
|
-
forEach(callback:
|
|
40
|
-
forRow(callback: (row: number, cols: number[]) => Nullable<boolean>):
|
|
41
|
+
getMatrix(): IObjectMatrixPrimitiveType<T>;
|
|
42
|
+
forEach(callback: (row: number, objectArray: IObjectArrayPrimitiveType<T>) => Nullable<boolean>): ObjectMatrix<T>;
|
|
43
|
+
forRow(callback: (row: number, cols: number[]) => Nullable<boolean>): ObjectMatrix<T>;
|
|
41
44
|
forValue(callback: (row: number, col: number, value: T) => Nullable<boolean>): ObjectMatrix<T>;
|
|
42
45
|
swapRow(src: number, target: number): void;
|
|
43
|
-
getRow(rowIndex: number): Nullable<
|
|
44
|
-
getRowOrCreate(rowIndex: number):
|
|
46
|
+
getRow(rowIndex: number): Nullable<IObjectArrayPrimitiveType<T>>;
|
|
47
|
+
getRowOrCreate(rowIndex: number): IObjectArrayPrimitiveType<T>;
|
|
45
48
|
reset(): void;
|
|
46
49
|
hasValue(): boolean;
|
|
47
|
-
getValue(row: number, column: number):
|
|
48
|
-
setValue(row: number, column: number, value:
|
|
50
|
+
getValue(row: number, column: number): T;
|
|
51
|
+
setValue(row: number, column: number, value: T): void;
|
|
49
52
|
/**
|
|
50
53
|
* !!
|
|
51
54
|
* Please +1 ‘!’, who fell into this pit.
|
|
@@ -53,18 +56,9 @@ export declare class ObjectMatrix<T> {
|
|
|
53
56
|
*/
|
|
54
57
|
deleteValue(row: number, column: number): void;
|
|
55
58
|
realDeleteValue(row: number, column: number): void;
|
|
56
|
-
|
|
57
|
-
sliceRows(start: number, count: number): ObjectMatrix<T>;
|
|
58
|
-
pushRow(row: ObjectArray<T>): void;
|
|
59
|
+
setRow(rowNumber: number, row: IObjectArrayPrimitiveType<T>): void;
|
|
59
60
|
moveRows(start: number, count: number, target: number): void;
|
|
60
61
|
moveColumns(start: number, count: number, target: number): void;
|
|
61
|
-
insertRow(rowIndex: number, row: ObjectArray<T>): void;
|
|
62
|
-
insertRowCount(rowIndex: number, rowCount: number): void;
|
|
63
|
-
insertRows(rowIndex: number, matrix: ObjectMatrix<T>): void;
|
|
64
|
-
spliceColumns(start: number, count: number): ObjectMatrix<T>;
|
|
65
|
-
sliceColumns(start: number, count: number): ObjectMatrix<T>;
|
|
66
|
-
insertColumns(columnIndex: number, columnData: ObjectMatrix<T>): void;
|
|
67
|
-
insertColumnCount(columnIndex: number, columnCount: number): void;
|
|
68
62
|
/**
|
|
69
63
|
* Return a fragment of the original data matrix. Note that the returned matrix's row matrix would start from
|
|
70
64
|
* 0 not `startRow`. Neither does its column matrix. If you want to get the original matrix, use `getSlice`.
|
|
@@ -93,9 +87,16 @@ export declare class ObjectMatrix<T> {
|
|
|
93
87
|
getRange(): IRange;
|
|
94
88
|
toNativeArray(): T[];
|
|
95
89
|
toArray(): T[][];
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated Use getMatrix as a substitute.
|
|
92
|
+
*/
|
|
93
|
+
toJSON(): IObjectMatrixPrimitiveType<T>;
|
|
94
|
+
clone(): IObjectMatrixPrimitiveType<T>;
|
|
95
|
+
/**
|
|
96
|
+
* @deprecated Use clone as a substitute.
|
|
97
|
+
*/
|
|
98
|
+
getData(): IObjectMatrixPrimitiveType<T>;
|
|
99
|
+
getArrayData(): IObjectMatrixPrimitiveType<T>;
|
|
99
100
|
getDataRange(): IRange;
|
|
100
101
|
getDiscreteRanges(): IRange[];
|
|
101
102
|
merge(newObject: ObjectMatrix<T>): void;
|
|
@@ -31,4 +31,5 @@ export declare class Rectangle {
|
|
|
31
31
|
static moveHorizontal: (range: IRange, step?: number, length?: number) => IRange;
|
|
32
32
|
static moveVertical: (range: IRange, step?: number, length?: number) => IRange;
|
|
33
33
|
static moveOffset: (range: IRange, offsetX: number, offsetY: number) => IRange;
|
|
34
|
+
static subtract(range1: IRange, range2: IRange): IRange[];
|
|
34
35
|
}
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export declare function sortRules(oa: any, ob: any): 1 |
|
|
17
|
-
export declare function sortRulesByDesc(oa: any, ob: any): 1 |
|
|
16
|
+
export declare function sortRules(oa: any, ob: any): 1 | 0 | -1;
|
|
17
|
+
export declare function sortRulesByDesc(oa: any, ob: any): 1 | 0 | -1;
|
|
18
18
|
/**
|
|
19
19
|
*
|
|
20
20
|
* @param key compare key
|
|
@@ -13,9 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { ObjectArrayPrimitiveType } from './object-array';
|
|
17
|
-
import { ObjectArray } from './object-array';
|
|
18
|
-
import type { ObjectMatrixPrimitiveType } from './object-matrix';
|
|
19
16
|
import type { Class, IKeyValue } from './types';
|
|
20
17
|
/**
|
|
21
18
|
* Universal tool library
|
|
@@ -79,7 +76,6 @@ export declare class Tools {
|
|
|
79
76
|
* @param value value to be set
|
|
80
77
|
* @returns
|
|
81
78
|
*/
|
|
82
|
-
static fillObjectMatrix<T>(rows: number, columns: number, value: T): ObjectMatrixPrimitiveType<T>;
|
|
83
79
|
static numToWord(x: number): string;
|
|
84
80
|
/**
|
|
85
81
|
*
|
|
@@ -112,6 +108,5 @@ export declare class Tools {
|
|
|
112
108
|
static commonExtend<T>(originJson: IKeyValue, extendJson: IKeyValue): T;
|
|
113
109
|
static commonExtend1<T>(originJson: IKeyValue, extendJson: IKeyValue): T;
|
|
114
110
|
static arrayToObject(array: IKeyValue[][]): IKeyValue;
|
|
115
|
-
static createObjectArray<T>(array: ObjectArrayPrimitiveType<T> | ObjectArray<T>): ObjectArray<T>;
|
|
116
111
|
static hasIntersectionBetweenTwoRanges(range1Start: number, range1End: number, range2Start: number, range2End: number): boolean;
|
|
117
112
|
}
|