2021-07-10 19:35:06 +08:00
|
|
|
/*
|
|
|
|
* @Author: yehuozhili
|
|
|
|
* @Date: 2021-07-07 14:29:38
|
|
|
|
* @LastEditors: yehuozhili
|
2021-07-12 11:37:22 +08:00
|
|
|
* @LastEditTime: 2021-07-12 11:24:56
|
|
|
|
* @FilePath: \dooringx\packages\dooringx-example\src\plugin\formComponentModules.ts
|
2021-07-10 19:35:06 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
import { ComponentClass } from 'react';
|
|
|
|
import { FunctionComponent } from 'react';
|
|
|
|
|
|
|
|
const modulesFiles = (require as any).context('./formComponents', true, /\.(js|tsx)$/);
|
|
|
|
export const Formmodules: Record<string, FunctionComponent<any> | ComponentClass<any, any>> =
|
|
|
|
modulesFiles.keys().reduce((modules: any, modulePath: any) => {
|
|
|
|
const tmp = modulePath.split('.');
|
|
|
|
const name = tmp[tmp.length - 2].slice(1);
|
|
|
|
const value = modulesFiles(modulePath);
|
|
|
|
modules[name] = value.default;
|
|
|
|
return modules;
|
2021-07-12 11:37:22 +08:00
|
|
|
}, {});
|