mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 11:20:11 +00:00
refactor: provide a typing for PluginConfigCreator
This commit is contained in:
parent
66f6918a69
commit
9b0ea3bef3
@ -1,11 +1,6 @@
|
|||||||
import { CompositeObject, ComponentAction } from '@alilc/lowcode-types';
|
import { CompositeObject, ComponentAction } from '@alilc/lowcode-types';
|
||||||
import Logger from 'zen-logger';
|
import Logger from 'zen-logger';
|
||||||
import {
|
import { Hotkey, Skeleton, Project, Event, Material } from '@alilc/lowcode-shell';
|
||||||
Hotkey,
|
|
||||||
Skeleton,
|
|
||||||
Project,
|
|
||||||
Event, Material,
|
|
||||||
} from '@alilc/lowcode-shell';
|
|
||||||
import { EngineConfig } from '@alilc/lowcode-editor-core';
|
import { EngineConfig } from '@alilc/lowcode-editor-core';
|
||||||
import { MetadataTransducer } from '@alilc/lowcode-designer';
|
import { MetadataTransducer } from '@alilc/lowcode-designer';
|
||||||
import { Setters } from '../types';
|
import { Setters } from '../types';
|
||||||
@ -94,7 +89,10 @@ export interface IDesignerCabin {
|
|||||||
|
|
||||||
export interface IPluginPreferenceMananger {
|
export interface IPluginPreferenceMananger {
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
getPreferenceValue: (key: string, defaultValue?: PreferenceValueType) => PreferenceValueType | undefined ;
|
getPreferenceValue: (
|
||||||
|
key: string,
|
||||||
|
defaultValue?: PreferenceValueType,
|
||||||
|
) => PreferenceValueType | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ILowCodePluginContext {
|
export interface ILowCodePluginContext {
|
||||||
@ -136,11 +134,34 @@ export function isLowCodeRegisterOptions(opts: any): opts is ILowCodeRegisterOpt
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ILowCodeRegisterOptions {
|
export interface ILowCodeRegisterOptions {
|
||||||
|
/** Will enable plugin registered with auto-initialization immediately
|
||||||
|
* other than plugin-manager init all plugins at certain time.
|
||||||
|
* It is helpful when plugin register is later than plugin-manager initialization. */
|
||||||
autoInit?: boolean;
|
autoInit?: boolean;
|
||||||
// allow overriding existing plugin with same name when override === true
|
/** allow overriding existing plugin with same name when override === true */
|
||||||
override?: boolean;
|
override?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPluginContextOptions {
|
export interface IPluginContextOptions {
|
||||||
pluginName: string;
|
pluginName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IPluginMetaDefinition {
|
||||||
|
/** define dependencies which the plugin depends on */
|
||||||
|
dependencies?: string[];
|
||||||
|
/** specify which engine version is compatible with the plugin */
|
||||||
|
engines?: {
|
||||||
|
/** e.g. '^1.0.0' */
|
||||||
|
lowcodeEngine?: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IPluginConfigCreatorFn<T extends Record<string, any> = Record<string, any>> {
|
||||||
|
(ctx: ILowCodePluginContext, pluginOptions?: T): ILowCodePluginConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type IPluginConfigCreator<T extends Record<string, any> = Record<string, any>> =
|
||||||
|
IPluginConfigCreatorFn<T> & {
|
||||||
|
pluginName: string;
|
||||||
|
meta?: IPluginMetaDefinition;
|
||||||
|
};
|
||||||
|
|||||||
@ -12,6 +12,7 @@ export type SettingField = designerCabin.SettingField;
|
|||||||
export type ILowCodePluginConfig = designerCabin.ILowCodePluginConfig;
|
export type ILowCodePluginConfig = designerCabin.ILowCodePluginConfig;
|
||||||
export type ILowCodePluginManager = designerCabin.ILowCodePluginManager;
|
export type ILowCodePluginManager = designerCabin.ILowCodePluginManager;
|
||||||
export type ILowCodePluginContext = designerCabin.ILowCodePluginContext;
|
export type ILowCodePluginContext = designerCabin.ILowCodePluginContext;
|
||||||
|
export type IPluginConfigCreator = designerCabin.IPluginConfigCreator;
|
||||||
export type PluginPreference = designerCabin.PluginPreference;
|
export type PluginPreference = designerCabin.PluginPreference;
|
||||||
export type PropsReducerContext = designerCabin.PropsReducerContext;
|
export type PropsReducerContext = designerCabin.PropsReducerContext;
|
||||||
export type DragObjectType = designerCabin.DragObjectType;
|
export type DragObjectType = designerCabin.DragObjectType;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user