|
46 | 46 | protected hasChildDirective: boolean = false;
|
47 | 47 | protected childDirObjects: string = '';
|
48 | 48 | protected propKeys: any;
|
| 49 | + protected isDecorator: boolean = false; |
49 | 50 |
|
50 | 51 | constructor() {
|
51 | 52 | super(arguments);
|
|
64 | 65 | let vueInjectables: any = getValue('$parent.$options.provide', this);
|
65 | 66 | if (this.hasInjectedModules && !isExecute) {
|
66 | 67 | let prevModule: Object[] = [];
|
67 |
| - if (injectables) { |
| 68 | + if (injectables && injectables.managed) { |
| 69 | + this.isDecorator = true; |
| 70 | + prevModule = this.getInjectedServices() || []; |
| 71 | + } else if (injectables) { |
68 | 72 | prevModule = injectables[this.ej2Instances.getModuleName()] || [];
|
69 | 73 | } else if (vueInjectables) {
|
70 | 74 | prevModule = this.getInjectedServices() || [];
|
|
97 | 101 | }
|
98 | 102 | public getInjectedServices(): Object[] {
|
99 | 103 | let ret = []; let provide: any;
|
100 |
| - if (this.$vnode) { |
| 104 | + if (this.$root && this.isDecorator) { |
| 105 | + provide = getValue('$root.$options.provide', this); |
| 106 | + } else if (this.$vnode) { |
101 | 107 | provide = getValue('$vnode.context.$options.provide', this);
|
102 | 108 | } else if (this.$parent) {
|
103 | 109 | provide = getValue('$parent.$options.provide', this);
|
|
106 | 112 | // tslint:disable:no-any
|
107 | 113 | let injectables: any = provide;
|
108 | 114 | if (typeof provide === 'function') {
|
| 115 | + if (provide.managed) { |
| 116 | + let provideKey: Object = provide.managed; |
| 117 | + let provideValue: string[] = Object.keys(provideKey); |
| 118 | + let key: string[]; |
| 119 | + if (this.$root && this.isDecorator) { |
| 120 | + key = Object.keys(this.$root); |
| 121 | + } else if (this.$vnode) { |
| 122 | + key = Object.keys(this.$vnode.context); |
| 123 | + } else if (this.$parent) { |
| 124 | + key = Object.keys(this.$parent); |
| 125 | + } |
| 126 | + for (let i: number = 0; i < provideValue.length; i++) { |
| 127 | + for (let j: number = 0; j < key.length; j++) { |
| 128 | + if ((key[j].indexOf(provideValue[i])) !== -1) { |
| 129 | + if (this.$root && this.isDecorator) { |
| 130 | + provideKey[provideValue[j]] = this.$root[key[i]]; |
| 131 | + } else if (this.$vnode) { |
| 132 | + provideKey[provideValue[i]] = this.$vnode.context[key[j]]; |
| 133 | + } else if (this.$parent) { |
| 134 | + provideKey[provideValue[i]] = this.$parent[key[j]]; |
| 135 | + } |
| 136 | + injectables = provideKey; |
| 137 | + } |
| 138 | + } |
| 139 | + } |
| 140 | + } |
109 | 141 | // tslint:disable:no-any
|
110 |
| - if (this.$vnode) { |
| 142 | + else if (this.$vnode) { |
111 | 143 | injectables = this.$vnode.context.$options.provide();
|
112 | 144 | } else if(this.$parent) {
|
113 | 145 | injectables = this.$parent.$options.provide();
|
114 | 146 | }
|
115 | 147 | }
|
116 | 148 | ret = injectables[this.ej2Instances.getModuleName()] || [];
|
117 | 149 | }
|
| 150 | + this.isDecorator = false; |
118 | 151 | return ret;
|
119 | 152 | }
|
120 | 153 | public updated(): void {
|
|
0 commit comments