@univerjs/core 0.1.13 → 0.1.14
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 +8 -8
- package/lib/es/index.js +1270 -1212
- package/lib/types/index.d.ts +2 -3
- package/lib/types/services/permission/type.d.ts +3 -4
- package/lib/types/services/plugin/plugin.d.ts +4 -2
- package/lib/types/services/plugin/plugin.service.d.ts +45 -5
- package/lib/types/shared/debounce.d.ts +10 -1
- package/lib/types/shared/tools.d.ts +8 -0
- package/lib/types/types/interfaces/i-document-data.d.ts +1 -0
- package/lib/umd/index.js +8 -8
- package/package.json +16 -7
- package/lib/types/services/plugin/plugin-holder.d.ts +0 -25
package/lib/types/index.d.ts
CHANGED
|
@@ -17,7 +17,6 @@ export { DEFAULT_DOCUMENT_SUB_COMPONENT_ID } from './docs/data-model/subdocument
|
|
|
17
17
|
export { type UnitType, UnitModel, UniverInstanceType } from './common/unit';
|
|
18
18
|
export { Registry, RegistryAsMap } from './common/registry';
|
|
19
19
|
export { Univer } from './univer';
|
|
20
|
-
export { PluginHolder } from './services/plugin/plugin-holder';
|
|
21
20
|
export { shallowEqual, isRangesEqual, isUnitRangesEqual } from './common/equal';
|
|
22
21
|
export { isNumeric, isSafeNumeric } from './common/number';
|
|
23
22
|
export { isBooleanString } from './common/boolean';
|
|
@@ -40,7 +39,7 @@ export type { JSONXActions, JSONXPath } from './docs/data-model/json-x/json-x';
|
|
|
40
39
|
export { replaceInDocumentBody } from './docs/data-model/replacement';
|
|
41
40
|
export * from './observer';
|
|
42
41
|
export { Plugin } from './services/plugin/plugin';
|
|
43
|
-
export { PluginService } from './services/plugin/plugin.service';
|
|
42
|
+
export { PluginService, DependentOn } from './services/plugin/plugin.service';
|
|
44
43
|
export { type CommandListener, CommandService, CommandType, type ICommand, type ICommandInfo, ICommandService, type IExecutionOptions, type IMultiCommand, type IMutation, type IMutationCommonParams, type IMutationInfo, type IOperation, type IOperationInfo, NilCommand, sequenceExecute, sequenceExecuteAsync, } from './services/command/command.service';
|
|
45
44
|
export { IConfigService } from './services/config/config.service';
|
|
46
45
|
export * from './services/context/context';
|
|
@@ -101,7 +100,7 @@ export { DataValidationImeMode } from './types/enum/data-validation-ime-mode';
|
|
|
101
100
|
export { DataValidationOperator } from './types/enum/data-validation-operator';
|
|
102
101
|
export { DataValidationType } from './types/enum/data-validation-type';
|
|
103
102
|
export { DataValidationStatus } from './types/enum/data-validation-status';
|
|
104
|
-
export type { IPermissionTypes } from './services/permission/type';
|
|
103
|
+
export type { IPermissionTypes, WorkbookPermissionPointConstructor } from './services/permission/type';
|
|
105
104
|
export { AuthzIoLocalService } from './services/authz-io/authz-io-local.service';
|
|
106
105
|
export { IAuthzIoService } from './services/authz-io/type';
|
|
107
106
|
export { createDefaultUser } from './services/user-manager/const';
|
|
@@ -8,9 +8,9 @@ export declare enum PermissionStatus {
|
|
|
8
8
|
FETCHING = "fetching",
|
|
9
9
|
DONE = "done"
|
|
10
10
|
}
|
|
11
|
-
type WorkbookPermissionPointConstructor = new (unitId: string) => IPermissionPoint;
|
|
12
|
-
type WorkSheetPermissionPointConstructor = new (unitId: string, subUnitId: string) => IPermissionPoint;
|
|
13
|
-
type RangePermissionPointConstructor = new (unitId: string, subUnitId: string, permissionId: string) => IPermissionPoint;
|
|
11
|
+
export type WorkbookPermissionPointConstructor = new (unitId: string) => IPermissionPoint;
|
|
12
|
+
export type WorkSheetPermissionPointConstructor = new (unitId: string, subUnitId: string) => IPermissionPoint;
|
|
13
|
+
export type RangePermissionPointConstructor = new (unitId: string, subUnitId: string, permissionId: string) => IPermissionPoint;
|
|
14
14
|
export interface IPermissionTypes {
|
|
15
15
|
rangeTypes?: RangePermissionPointConstructor[];
|
|
16
16
|
worksheetTypes?: WorkSheetPermissionPointConstructor[];
|
|
@@ -40,4 +40,3 @@ export interface IPermissionService {
|
|
|
40
40
|
composePermission(permissionId: string[]): IPermissionPoint<unknown>[];
|
|
41
41
|
}
|
|
42
42
|
export declare const IPermissionService: import('@wendellhu/redi').IdentifierDecorator<IPermissionService>;
|
|
43
|
-
export {};
|
|
@@ -2,9 +2,11 @@ import { Ctor, Injector } from '@wendellhu/redi';
|
|
|
2
2
|
import { Disposable } from '../../shared';
|
|
3
3
|
import { UniverInstanceType } from '../../common/unit';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export declare const DependentOnSymbol: unique symbol;
|
|
6
|
+
export type PluginCtor<T extends Plugin = Plugin> = Ctor<T> & {
|
|
6
7
|
type: UniverInstanceType;
|
|
7
8
|
pluginName: string;
|
|
9
|
+
[DependentOnSymbol]?: PluginCtor[];
|
|
8
10
|
};
|
|
9
11
|
/**
|
|
10
12
|
* Plug-in base class, all plug-ins must inherit from this base class. Provide basic methods.
|
|
@@ -13,7 +15,7 @@ export declare abstract class Plugin extends Disposable {
|
|
|
13
15
|
static pluginName: string;
|
|
14
16
|
static type: UniverInstanceType;
|
|
15
17
|
protected abstract _injector: Injector;
|
|
16
|
-
onStarting(
|
|
18
|
+
onStarting(injector: Injector): void;
|
|
17
19
|
onReady(): void;
|
|
18
20
|
onRendered(): void;
|
|
19
21
|
onSteady(): void;
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import { IDisposable, Injector } from '@wendellhu/redi';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { Disposable } from '../../shared/lifecycle';
|
|
3
|
+
import { UniverInstanceType } from '../../common/unit';
|
|
4
|
+
import { LifecycleInitializerService, LifecycleService } from '../lifecycle/lifecycle.service';
|
|
5
|
+
import { ILogService } from '../log/log.service';
|
|
6
|
+
import { Plugin, PluginCtor, PluginRegistry, PluginStore } from './plugin';
|
|
5
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Use this decorator to declare dependencies among plugins. If a dependent plugin is not registered yet,
|
|
10
|
+
* Univer will automatically register it with no configuration.
|
|
11
|
+
*
|
|
12
|
+
* For example:
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* @DependentOn(UniverDrawingPlugin, UniverDrawingUIPlugin, UniverSheetsDrawingPlugin)
|
|
16
|
+
* export class UniverSheetsDrawingUIPlugin extends Plugin {
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function DependentOn(...plugins: PluginCtor<Plugin>[]): (target: PluginCtor<Plugin>) => void;
|
|
6
21
|
/**
|
|
7
22
|
* This service manages plugin registration.
|
|
8
23
|
*/
|
|
@@ -10,15 +25,40 @@ export declare class PluginService implements IDisposable {
|
|
|
10
25
|
private readonly _injector;
|
|
11
26
|
private readonly _pluginHolderForUniver;
|
|
12
27
|
private readonly _pluginHoldersForTypes;
|
|
28
|
+
private readonly _seenPlugins;
|
|
13
29
|
constructor(_injector: Injector);
|
|
14
30
|
dispose(): void;
|
|
15
31
|
/** Register a plugin into univer. */
|
|
16
|
-
registerPlugin<T extends PluginCtor
|
|
32
|
+
registerPlugin<T extends PluginCtor>(ctor: T, config?: ConstructorParameters<T>[0]): void;
|
|
17
33
|
startPluginForType(type: UniverInstanceType): void;
|
|
18
|
-
_ensurePluginHolderForType
|
|
34
|
+
private _ensurePluginHolderForType;
|
|
35
|
+
private _immediateInitPlugin;
|
|
36
|
+
private _checkPluginSeen;
|
|
19
37
|
private _assertPluginValid;
|
|
20
38
|
private _flushTimer?;
|
|
21
39
|
private _scheduleInitPlugin;
|
|
22
40
|
private _clearFlushTimer;
|
|
23
41
|
private _flushPlugins;
|
|
24
42
|
}
|
|
43
|
+
export declare class PluginHolder extends Disposable {
|
|
44
|
+
private _checkPluginRegistered;
|
|
45
|
+
private _registerPlugin;
|
|
46
|
+
protected readonly _logService: ILogService;
|
|
47
|
+
protected readonly _injector: Injector;
|
|
48
|
+
protected readonly _lifecycleService: LifecycleService;
|
|
49
|
+
protected readonly _lifecycleInitializerService: LifecycleInitializerService;
|
|
50
|
+
protected _started: boolean;
|
|
51
|
+
get started(): boolean;
|
|
52
|
+
/** Plugin constructors waiting to be initialized. */
|
|
53
|
+
protected readonly _pluginRegistry: PluginRegistry;
|
|
54
|
+
/** Stores initialized plugin instances. */
|
|
55
|
+
protected readonly _pluginStore: PluginStore;
|
|
56
|
+
constructor(_checkPluginRegistered: (pluginCtor: PluginCtor) => boolean, _registerPlugin: <T extends PluginCtor>(plugin: T, config?: ConstructorParameters<T>[0]) => void, _logService: ILogService, _injector: Injector, _lifecycleService: LifecycleService, _lifecycleInitializerService: LifecycleInitializerService);
|
|
57
|
+
dispose(): void;
|
|
58
|
+
register<T extends PluginCtor<Plugin>>(pluginCtor: T, config?: ConstructorParameters<T>[0]): void;
|
|
59
|
+
immediateInitPlugin<T extends Plugin>(plugin: PluginCtor<T>): void;
|
|
60
|
+
start(): void;
|
|
61
|
+
flush(): void;
|
|
62
|
+
private _initPlugin;
|
|
63
|
+
protected _pluginsRunLifecycle(plugins: Plugin[]): void;
|
|
64
|
+
}
|
|
@@ -14,5 +14,14 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
type debounceFn<T extends (...args: any[]) => any> = (this: ThisParameterType<T>, ...args: Parameters<T>) => void;
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Creates a debounced function that delays invoking the provided function until after `wait` milliseconds have elapsed since the last time the debounced function was invoked.
|
|
19
|
+
* @template T - The type of the function to be debounced.
|
|
20
|
+
* @param {T} func - The function to be debounced.
|
|
21
|
+
* @param {number} wait - The number of milliseconds to wait before invoking the function.
|
|
22
|
+
* @returns {debounceFn<T> & { cancel: () => void }} - The debounced function, which also has a `cancel` method to cancel the scheduled function call.
|
|
23
|
+
*/
|
|
24
|
+
export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): debounceFn<T> & {
|
|
25
|
+
cancel: () => void;
|
|
26
|
+
};
|
|
18
27
|
export {};
|
|
@@ -97,4 +97,12 @@ export declare class Tools {
|
|
|
97
97
|
static hasIntersectionBetweenTwoRanges(range1Start: number, range1End: number, range2Start: number, range2End: number): boolean;
|
|
98
98
|
static isStartValidPosition(name: string): boolean;
|
|
99
99
|
static isValidParameter(name: string): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* As lodash set, via a path string to set value to deep property
|
|
102
|
+
* set(obj, 'xx.yy', val)
|
|
103
|
+
* @param data
|
|
104
|
+
* @param propertyPath
|
|
105
|
+
* @param value
|
|
106
|
+
*/
|
|
107
|
+
static set(data: Record<string, any>, propertyPath: string, value: any): void;
|
|
100
108
|
}
|
|
@@ -291,6 +291,7 @@ export interface IDocumentRenderConfig {
|
|
|
291
291
|
background?: IColorStyle;
|
|
292
292
|
wrapStrategy?: WrapStrategy;
|
|
293
293
|
cellValueType?: CellValueType;
|
|
294
|
+
isRenderStyle?: BooleanNumber;
|
|
294
295
|
}
|
|
295
296
|
export interface ISectionBreakBase {
|
|
296
297
|
columnProperties?: ISectionColumnProperties[];
|