mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
Merge branch 'refactor/plugin-types' into 'release/1.0.32'
refactor: 将 plugin 相关的 types 都移到 designer 中 1. refactor: 将 plugin 相关的 types 都移到 designer 中 2. 处理 ctx.plugins.somePlugin.someProp 的 ts 报错问题 See merge request !1129436
This commit is contained in:
commit
2f3a2c58b6
@ -1,3 +1,4 @@
|
||||
export * from './plugin-context';
|
||||
export * from './plugin-manager';
|
||||
export * from './plugin-types';
|
||||
export * from './plugin';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Editor, Hotkey, hotkey } from '@ali/lowcode-editor-core';
|
||||
import { Skeleton } from '@ali/lowcode-editor-skeleton';
|
||||
import { ILowCodePluginConfig, ILowCodePluginManager, ILowCodePluginContext, IDesignerCabin } from '@ali/lowcode-types';
|
||||
import { ILowCodePluginConfig, ILowCodePluginManager, ILowCodePluginContext, IDesignerCabin } from './plugin-types';
|
||||
import { getLogger, Logger } from '../utils';
|
||||
import {
|
||||
registerMetadataTransducer,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Editor } from '@ali/lowcode-editor-core';
|
||||
import { CompositeObject, ILowCodePlugin, ILowCodePluginConfig, ILowCodePluginManager, ILowCodePluginContext } from '@ali/lowcode-types';
|
||||
import { CompositeObject, ILowCodePlugin, ILowCodePluginConfig, ILowCodePluginManager, ILowCodePluginContext } from './plugin-types';
|
||||
import { LowCodePlugin } from './plugin';
|
||||
import LowCodePluginContext from './plugin-context';
|
||||
import { getLogger, invariant } from '../utils';
|
||||
@ -23,8 +23,8 @@ export class LowCodePluginManager implements ILowCodePluginManager {
|
||||
}
|
||||
|
||||
register(
|
||||
pluginConfig: (ctx: ILowCodePluginContext, options: CompositeObject) => ILowCodePluginConfig,
|
||||
options: CompositeObject = {},
|
||||
pluginConfig: (ctx: ILowCodePluginContext, options?: CompositeObject) => ILowCodePluginConfig,
|
||||
options?: CompositeObject,
|
||||
): void {
|
||||
const ctx = this._getLowCodePluginContext();
|
||||
const config = pluginConfig(ctx, options);
|
||||
|
||||
@ -15,7 +15,7 @@ export interface ILowCodePluginConfig {
|
||||
exports?(): CompositeObject;
|
||||
}
|
||||
|
||||
export interface ILowCodePlugin {
|
||||
export interface ILowCodePluginCore {
|
||||
name: string;
|
||||
dep: string[];
|
||||
disabled: boolean;
|
||||
@ -31,6 +31,12 @@ export interface ILowCodePlugin {
|
||||
setDisabled(flag: boolean): void;
|
||||
}
|
||||
|
||||
interface ILowCodePluginExportsAccessor {
|
||||
[propName: string]: any;
|
||||
}
|
||||
|
||||
export type ILowCodePlugin = ILowCodePluginCore & ILowCodePluginExportsAccessor;
|
||||
|
||||
export interface IDesignerCabin {
|
||||
registerMetadataTransducer: (transducer: MetadataTransducer, level: number, id?: string) => void;
|
||||
addBuiltinComponentAction: (action: ComponentAction) => void;
|
||||
@ -50,10 +56,14 @@ export interface ILowCodePluginContext {
|
||||
*/
|
||||
}
|
||||
|
||||
export interface ILowCodePluginManager {
|
||||
interface ILowCodePluginManagerPluginAccessor {
|
||||
[pluginName: string]: ILowCodePlugin | any;
|
||||
}
|
||||
|
||||
export interface ILowCodePluginManagerCore {
|
||||
register(
|
||||
pluginConfig: (ctx: ILowCodePluginContext, options: CompositeObject) => ILowCodePluginConfig,
|
||||
options: CompositeObject,
|
||||
pluginConfig: (ctx: ILowCodePluginContext, options?: CompositeObject) => ILowCodePluginConfig,
|
||||
options?: CompositeObject,
|
||||
): void;
|
||||
get(pluginName: string): ILowCodePlugin | undefined;
|
||||
getAll(): ILowCodePlugin[];
|
||||
@ -62,3 +72,5 @@ export interface ILowCodePluginManager {
|
||||
setDisabled(pluginName: string, flag: boolean): void;
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
export type ILowCodePluginManager = ILowCodePluginManagerCore & ILowCodePluginManagerPluginAccessor;
|
||||
@ -16,7 +16,7 @@ import './modules/live-editing';
|
||||
export * from './modules/editor-types';
|
||||
export * from './modules/skeleton-types';
|
||||
export * from './modules/designer-types';
|
||||
export * from './modules/lowcode-types';
|
||||
// export * from './modules/lowcode-types';
|
||||
|
||||
const { hotkey, monitor, getSetter, registerSetter, getSettersMap } = editorCabin;
|
||||
registerDefaults();
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
import * as designerCabin from '@ali/lowcode-designer';
|
||||
|
||||
export {
|
||||
ILowCodePluginConfig,
|
||||
ILowCodePluginManager,
|
||||
ILowCodePluginContext,
|
||||
IDesignerCabin,
|
||||
} from '@ali/lowcode-designer';
|
||||
|
||||
// 这样做的目的是为了去除 Node / DocumentModel 等的值属性,仅保留类型属性
|
||||
export type Node = designerCabin.Node;
|
||||
export type ParentalNode = designerCabin.ParentalNode;
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
export {
|
||||
ILowCodePluginConfig,
|
||||
ILowCodePluginManager,
|
||||
ILowCodePluginContext,
|
||||
IDesignerCabin,
|
||||
} from '@ali/lowcode-types';
|
||||
Loading…
x
Reference in New Issue
Block a user