|
1 | | -//@ts-nocheck |
2 | 1 | import{App}from'vue' |
3 | 2 | import*asComponentsfrom'./components' |
4 | | -import{vcplaceholder,vcpopover,vctooltip}from'./directives' |
5 | | - |
6 | | -constremoveKeysFromObject=(object,keys)=>{ |
7 | | -returnObject.entries(object).reduce((obj,[key,value])=>{ |
8 | | -if(!keys.includes(key)&&!keys.includes(value.name)){ |
9 | | -obj[key]=value |
10 | | -} |
11 | | -returnobj |
12 | | -},{}) |
13 | | -} |
| 3 | +import*asDirectivesfrom'./directives' |
14 | 4 |
|
15 | 5 | constCoreuiVue={ |
16 | | -install:(app:App,options:any):void=>{ |
17 | | -letpluginComponents=Components |
18 | | -// let pluginDirectives = Directives |
19 | | - |
20 | | -consttoRemove=options&&options.remove ?options.remove :null |
21 | | -if(toRemove&&Array.isArray(toRemove)){ |
22 | | -pluginComponents=removeKeysFromObject(Components,toRemove) |
23 | | -// pluginDirectives = removeKeysFromObject(Directives, toRemove) |
| 6 | +install:(app:App):void=>{ |
| 7 | +for(constkeyinComponents){ |
| 8 | +app.component(key,Components[key]) |
24 | 9 | } |
25 | 10 |
|
26 | | -for(constplugininpluginComponents){ |
27 | | -app.component(plugin,Components[plugin]) |
| 11 | +for(constkeyinDirectives){ |
| 12 | +app.directive(key,Directives[key]) |
28 | 13 | } |
29 | | -// for (const directive in pluginDirectives) { |
30 | | -// app.directive(directive, Directives[directive]) |
31 | | -// } |
32 | | - |
33 | | -app.directive('c-placeholder',vcplaceholder) |
34 | | -app.directive('c-popover',vcpopover) |
35 | | -app.directive('c-tooltip',vctooltip) |
36 | 14 | }, |
37 | 15 | } |
38 | 16 |
|
39 | 17 | // Export library |
40 | 18 | exportdefaultCoreuiVue |
41 | 19 |
|
42 | | -//Export components |
| 20 | +//Export components & directives |
43 | 21 | export*from'./components' |
44 | 22 | export*from'./directives' |