feat: create plugin
This commit is contained in:
0
packages/dooringx-cli/bin/www
Normal file → Executable file
0
packages/dooringx-cli/bin/www
Normal file → Executable file
@@ -7,6 +7,20 @@ import { specialCoList } from './special';
|
||||
import deepCopys from 'deepcopy';
|
||||
import { FunctionDataMap } from '../functionCenter/config';
|
||||
import UserConfig from '../../config';
|
||||
import { IPluginConfig } from './types';
|
||||
import { ComponentItemFactory } from '../components/abstract';
|
||||
|
||||
// 创建插件
|
||||
export const createPlugin = (config: IPluginConfig) => {
|
||||
return new ComponentItemFactory(
|
||||
config.key,
|
||||
config.name,
|
||||
{},
|
||||
config.attr,
|
||||
config.render,
|
||||
config.attr.resize
|
||||
);
|
||||
};
|
||||
|
||||
export function deepCopy<T = any>(obj: T): T {
|
||||
return deepCopys(obj);
|
||||
|
7
packages/dooringx-lib/src/core/utils/types.ts
Normal file
7
packages/dooringx-lib/src/core/utils/types.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export interface IPluginConfig {
|
||||
key: string;
|
||||
name: string;
|
||||
attr: any;
|
||||
render: (props: any) => JSX.Element;
|
||||
resize?: boolean;
|
||||
}
|
Reference in New Issue
Block a user