|
1 | | -//@ts-nocheck |
2 | 1 | import { App } from 'vue' |
3 | 2 | import * as Components from './components' |
4 | | -import { vcplaceholder, vcpopover, vctooltip } from './directives' |
5 | | - |
6 | | -const removeKeysFromObject = (object, keys) => { |
7 | | - return Object.entries(object).reduce((obj, [key, value]) => { |
8 | | - if (!keys.includes(key) && !keys.includes(value.name)) { |
9 | | - obj[key] = value |
10 | | - } |
11 | | - return obj |
12 | | - }, {}) |
13 | | -} |
| 3 | +import * as Directives from './directives' |
14 | 4 |
|
15 | 5 | const CoreuiVue = { |
16 | | - install: (app: App, options: any): void => { |
17 | | - let pluginComponents = Components |
18 | | - // let pluginDirectives = Directives |
19 | | - |
20 | | - const toRemove = 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 (const key in Components) { |
| 8 | + app.component(key, Components[key]) |
24 | 9 | } |
25 | 10 |
|
26 | | - for (const plugin in pluginComponents) { |
27 | | - app.component(plugin, Components[plugin]) |
| 11 | + for (const key in Directives) { |
| 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 | export default CoreuiVue |
41 | 19 |
|
42 | | -//Export components |
| 20 | +// Export components & directives |
43 | 21 | export * from './components' |
44 | 22 | export * from './directives' |
0 commit comments