mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-20 15:38:32 +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-context';
|
||||||
export * from './plugin-manager';
|
export * from './plugin-manager';
|
||||||
|
export * from './plugin-types';
|
||||||
export * from './plugin';
|
export * from './plugin';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Editor, Hotkey, hotkey } from '@ali/lowcode-editor-core';
|
import { Editor, Hotkey, hotkey } from '@ali/lowcode-editor-core';
|
||||||
import { Skeleton } from '@ali/lowcode-editor-skeleton';
|
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 { getLogger, Logger } from '../utils';
|
||||||
import {
|
import {
|
||||||
registerMetadataTransducer,
|
registerMetadataTransducer,
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Editor } from '@ali/lowcode-editor-core';
|
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 { LowCodePlugin } from './plugin';
|
||||||
import LowCodePluginContext from './plugin-context';
|
import LowCodePluginContext from './plugin-context';
|
||||||
import { getLogger, invariant } from '../utils';
|
import { getLogger, invariant } from '../utils';
|
||||||
@ -23,8 +23,8 @@ export class LowCodePluginManager implements ILowCodePluginManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
register(
|
register(
|
||||||
pluginConfig: (ctx: ILowCodePluginContext, options: CompositeObject) => ILowCodePluginConfig,
|
pluginConfig: (ctx: ILowCodePluginContext, options?: CompositeObject) => ILowCodePluginConfig,
|
||||||
options: CompositeObject = {},
|
options?: CompositeObject,
|
||||||
): void {
|
): void {
|
||||||
const ctx = this._getLowCodePluginContext();
|
const ctx = this._getLowCodePluginContext();
|
||||||
const config = pluginConfig(ctx, options);
|
const config = pluginConfig(ctx, options);
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export interface ILowCodePluginConfig {
|
|||||||
exports?(): CompositeObject;
|
exports?(): CompositeObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ILowCodePlugin {
|
export interface ILowCodePluginCore {
|
||||||
name: string;
|
name: string;
|
||||||
dep: string[];
|
dep: string[];
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
@ -31,6 +31,12 @@ export interface ILowCodePlugin {
|
|||||||
setDisabled(flag: boolean): void;
|
setDisabled(flag: boolean): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ILowCodePluginExportsAccessor {
|
||||||
|
[propName: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ILowCodePlugin = ILowCodePluginCore & ILowCodePluginExportsAccessor;
|
||||||
|
|
||||||
export interface IDesignerCabin {
|
export interface IDesignerCabin {
|
||||||
registerMetadataTransducer: (transducer: MetadataTransducer, level: number, id?: string) => void;
|
registerMetadataTransducer: (transducer: MetadataTransducer, level: number, id?: string) => void;
|
||||||
addBuiltinComponentAction: (action: ComponentAction) => 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(
|
register(
|
||||||
pluginConfig: (ctx: ILowCodePluginContext, options: CompositeObject) => ILowCodePluginConfig,
|
pluginConfig: (ctx: ILowCodePluginContext, options?: CompositeObject) => ILowCodePluginConfig,
|
||||||
options: CompositeObject,
|
options?: CompositeObject,
|
||||||
): void;
|
): void;
|
||||||
get(pluginName: string): ILowCodePlugin | undefined;
|
get(pluginName: string): ILowCodePlugin | undefined;
|
||||||
getAll(): ILowCodePlugin[];
|
getAll(): ILowCodePlugin[];
|
||||||
@ -62,3 +72,5 @@ export interface ILowCodePluginManager {
|
|||||||
setDisabled(pluginName: string, flag: boolean): void;
|
setDisabled(pluginName: string, flag: boolean): void;
|
||||||
dispose(): void;
|
dispose(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ILowCodePluginManager = ILowCodePluginManagerCore & ILowCodePluginManagerPluginAccessor;
|
||||||
@ -16,7 +16,7 @@ import './modules/live-editing';
|
|||||||
export * from './modules/editor-types';
|
export * from './modules/editor-types';
|
||||||
export * from './modules/skeleton-types';
|
export * from './modules/skeleton-types';
|
||||||
export * from './modules/designer-types';
|
export * from './modules/designer-types';
|
||||||
export * from './modules/lowcode-types';
|
// export * from './modules/lowcode-types';
|
||||||
|
|
||||||
const { hotkey, monitor, getSetter, registerSetter, getSettersMap } = editorCabin;
|
const { hotkey, monitor, getSetter, registerSetter, getSettersMap } = editorCabin;
|
||||||
registerDefaults();
|
registerDefaults();
|
||||||
|
|||||||
@ -1,5 +1,12 @@
|
|||||||
import * as designerCabin from '@ali/lowcode-designer';
|
import * as designerCabin from '@ali/lowcode-designer';
|
||||||
|
|
||||||
|
export {
|
||||||
|
ILowCodePluginConfig,
|
||||||
|
ILowCodePluginManager,
|
||||||
|
ILowCodePluginContext,
|
||||||
|
IDesignerCabin,
|
||||||
|
} from '@ali/lowcode-designer';
|
||||||
|
|
||||||
// 这样做的目的是为了去除 Node / DocumentModel 等的值属性,仅保留类型属性
|
// 这样做的目的是为了去除 Node / DocumentModel 等的值属性,仅保留类型属性
|
||||||
export type Node = designerCabin.Node;
|
export type Node = designerCabin.Node;
|
||||||
export type ParentalNode = designerCabin.ParentalNode;
|
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