1 | import { config as appLoaderConfig, AppLoader } from 'edf-app-loader'
|
2 | import cf from './componentFactory'
|
3 |
|
4 |
|
5 | var toast, notification, modal, errorBox, apps, popconfirm, alert
|
6 |
|
7 | function config(option) {
|
8 | const components = option.components
|
9 |
|
10 | toast = option.toast
|
11 | notification = option.notification
|
12 | modal = option.modal
|
13 | errorBox = option.errorBox
|
14 | apps = option.apps
|
15 | popconfirm = option.popconfirm
|
16 | alert = option.alert
|
17 |
|
18 | appLoaderConfig(option)
|
19 |
|
20 | cf.registerComponent('AppLoader', AppLoader)
|
21 |
|
22 | if (components && components.length > 0) {
|
23 | components.forEach(c => {
|
24 | if (c.appName)
|
25 | cf.registerAppComponent(c.appName, c.name, c.component)
|
26 |
|
27 | else
|
28 | cf.registerComponent(c.name, c.component)
|
29 | })
|
30 | }
|
31 |
|
32 | if (apps) {
|
33 | Object.keys(apps).forEach(k => {
|
34 | let a = apps[k]
|
35 | if (a.components && a.components.length > 0) {
|
36 | a.components.forEach(c => {
|
37 | cf.registerAppComponent(a.name, c.name, c.component)
|
38 | })
|
39 | }
|
40 | })
|
41 | }
|
42 | }
|
43 |
|
44 | config.getToast = () => toast
|
45 | config.getNotification = () => notification
|
46 | config.getModal = () => modal
|
47 | config.getApps = () => apps
|
48 | config.getPopconfirm = () => popconfirm
|
49 | config.getAlert = () => alert
|
50 |
|
51 | export default config |
\ | No newline at end of file |