@syncfusion/ej2-vue-base 20.4.48 → 21.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/ej2-vue-base.umd.min.js +2 -20
- package/dist/ej2-vue-base.umd.min.js.map +1 -1
- package/dist/es6/ej2-vue-base.es2015.js +470 -527
- package/dist/es6/ej2-vue-base.es2015.js.map +1 -1
- package/dist/es6/ej2-vue-base.es5.js +507 -574
- package/dist/es6/ej2-vue-base.es5.js.map +1 -1
- package/dist/global/ej2-vue-base.min.js +2 -2
- package/dist/global/ej2-vue-base.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +8 -8
- package/src/component-base.d.ts +4 -46
- package/src/component-base.js +450 -437
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -1
- package/src/template.js +64 -5
- package/postinstall.js +0 -119
- package/src/component-decorator.d.ts +0 -4
- package/src/component-decorator.js +0 -144
|
@@ -1,62 +1,43 @@
|
|
|
1
|
+
import * as Vue from 'vue';
|
|
1
2
|
import { createElement, detach, extend, getTemplateEngine, getUniqueID, getValue, isNullOrUndefined, setTemplateEngine } from '@syncfusion/ej2-base';
|
|
2
|
-
import { Vue } from 'vue-class-component';
|
|
3
|
-
import * as Vue$1 from 'vue';
|
|
4
|
-
import Vue$1__default from 'vue';
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* Vue Component Base
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
extendStatics = Object.setPrototypeOf ||
|
|
12
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
13
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
14
|
-
return extendStatics(d, b);
|
|
15
|
-
};
|
|
16
|
-
return function (d, b) {
|
|
17
|
-
extendStatics(d, b);
|
|
18
|
-
function __() { this.constructor = d; }
|
|
19
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
20
|
-
};
|
|
21
|
-
})();
|
|
22
|
-
var aVue = _interopRequireWildcard(Vue$1);
|
|
23
|
-
function _interopRequireWildcard(obj) {
|
|
24
|
-
if (obj && obj.__esModule) {
|
|
25
|
-
return obj;
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
var newObj = {};
|
|
29
|
-
if (obj != null) {
|
|
30
|
-
for (var key in obj) {
|
|
31
|
-
if (Object.prototype.hasOwnProperty.call(obj, key))
|
|
32
|
-
newObj["" + key] = obj["" + key];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
newObj.default = obj;
|
|
36
|
-
return newObj;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
var allVue = aVue;
|
|
40
|
-
var gh = allVue.h;
|
|
41
|
-
var isExecute = (parseInt(allVue.version) > 2) ? false : true;
|
|
42
|
-
var vueImport;
|
|
43
|
-
if (!isExecute || parseInt(allVue.version) < 3) {
|
|
44
|
-
vueImport = Vue;
|
|
7
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) {
|
|
8
|
+
return obj;
|
|
45
9
|
}
|
|
46
10
|
else {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
_this.hasInjectedModules = false;
|
|
54
|
-
_this.hasChildDirective = false;
|
|
55
|
-
_this.childDirObjects = '';
|
|
56
|
-
_this.isDecorator = false;
|
|
57
|
-
return _this;
|
|
11
|
+
var newObj = {};
|
|
12
|
+
if (obj != null) {
|
|
13
|
+
for (var key in obj) {
|
|
14
|
+
if (Object.prototype.hasOwnProperty.call(obj, key))
|
|
15
|
+
newObj["" + key] = obj["" + key];
|
|
16
|
+
}
|
|
58
17
|
}
|
|
59
|
-
|
|
18
|
+
newObj.default = obj;
|
|
19
|
+
return newObj;
|
|
20
|
+
} }
|
|
21
|
+
var curVue = _interopRequireWildcard(Vue);
|
|
22
|
+
var isExecute = (parseInt(curVue['version']) > 2) ? false : true;
|
|
23
|
+
var aVue = !isExecute ? curVue : curVue['default'];
|
|
24
|
+
var gh = curVue['h'];
|
|
25
|
+
var vueDefineComponent = function (options) { return !isExecute ? aVue['defineComponent'](options) : aVue['extend'](options); };
|
|
26
|
+
var ComponentBase = vueDefineComponent({
|
|
27
|
+
name: 'ComponentBase',
|
|
28
|
+
data: function () {
|
|
29
|
+
return {
|
|
30
|
+
ej2Instances: {},
|
|
31
|
+
tagMapper: {},
|
|
32
|
+
tagNameMapper: {},
|
|
33
|
+
hasInjectedModules: false,
|
|
34
|
+
hasChildDirective: false,
|
|
35
|
+
childDirObjects: '',
|
|
36
|
+
propKeys: {},
|
|
37
|
+
isDecorator: false
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
created: function () {
|
|
60
41
|
var _this = this;
|
|
61
42
|
if (!this.propKeys) {
|
|
62
43
|
return;
|
|
@@ -95,8 +76,8 @@ var ComponentBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
95
76
|
}
|
|
96
77
|
this.ej2Instances.injectedModules = prevModule;
|
|
97
78
|
}
|
|
98
|
-
}
|
|
99
|
-
|
|
79
|
+
},
|
|
80
|
+
mounted: function () {
|
|
100
81
|
var cusEle = this.$el ? this.$el.querySelectorAll("div.e-directive") : null;
|
|
101
82
|
if (!isExecute && cusEle) {
|
|
102
83
|
for (var i = 0; i < cusEle.length; i++) {
|
|
@@ -112,79 +93,8 @@ var ComponentBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
112
93
|
this.setModelValue();
|
|
113
94
|
}
|
|
114
95
|
this.ej2Instances.appendTo(this.$el);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (!isNullOrUndefined(this.modelValue) || !isNullOrUndefined(this.$attrs.modelValue)) {
|
|
118
|
-
var key = this.models.toString().match(/checked|value/) || [];
|
|
119
|
-
var propKey = key[0];
|
|
120
|
-
if (!isNullOrUndefined(propKey)) {
|
|
121
|
-
this.ej2Instances["" + propKey] = !isNullOrUndefined(this.modelValue) ? this.modelValue : this.$attrs.modelValue;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
ComponentBase.prototype.getInjectedServices = function () {
|
|
126
|
-
var ret = [];
|
|
127
|
-
var provide;
|
|
128
|
-
if (this.$root && this.isDecorator) {
|
|
129
|
-
provide = getValue('$root.$options.provide', this);
|
|
130
|
-
}
|
|
131
|
-
else if (this.$vnode) {
|
|
132
|
-
provide = getValue('$vnode.context.$options.provide', this);
|
|
133
|
-
}
|
|
134
|
-
else if (this.$parent) {
|
|
135
|
-
provide = getValue('$parent.$options.provide', this);
|
|
136
|
-
}
|
|
137
|
-
if (isNullOrUndefined(provide) && !isNullOrUndefined(this.$)) {
|
|
138
|
-
provide = getValue('$.parent.provides', this);
|
|
139
|
-
}
|
|
140
|
-
if (provide) {
|
|
141
|
-
// tslint:disable:no-any
|
|
142
|
-
var injectables = provide;
|
|
143
|
-
if (typeof provide === 'function') {
|
|
144
|
-
if (provide.managed) {
|
|
145
|
-
var provideKey = provide.managed;
|
|
146
|
-
var provideValue = Object.keys(provideKey);
|
|
147
|
-
var key = void 0;
|
|
148
|
-
if (this.$root && this.isDecorator) {
|
|
149
|
-
key = Object.keys(this.$root);
|
|
150
|
-
}
|
|
151
|
-
else if (this.$vnode) {
|
|
152
|
-
key = Object.keys(this.$vnode.context);
|
|
153
|
-
}
|
|
154
|
-
else if (this.$parent) {
|
|
155
|
-
key = Object.keys(this.$parent);
|
|
156
|
-
}
|
|
157
|
-
for (var i = 0; i < provideValue.length; i++) {
|
|
158
|
-
for (var j = 0; j < key.length; j++) {
|
|
159
|
-
if ((key[parseInt(j.toString(), 10)].indexOf(provideValue[parseInt(i.toString(), 10)])) !== -1) {
|
|
160
|
-
if (this.$root && this.isDecorator) {
|
|
161
|
-
provideKey[provideValue[parseInt(j.toString(), 10)]] = this.$root[key[parseInt(i.toString(), 10)]];
|
|
162
|
-
}
|
|
163
|
-
else if (this.$vnode) {
|
|
164
|
-
provideKey[provideValue[parseInt(i.toString(), 10)]] = this.$vnode.context[key[parseInt(j.toString(), 10)]];
|
|
165
|
-
}
|
|
166
|
-
else if (this.$parent) {
|
|
167
|
-
provideKey[provideValue[parseInt(i.toString(), 10)]] = this.$parent[key[parseInt(j.toString(), 10)]];
|
|
168
|
-
}
|
|
169
|
-
injectables = provideKey;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
// tslint:disable:no-any
|
|
175
|
-
else if (this.$vnode) {
|
|
176
|
-
injectables = this.$vnode.context.$options.provide();
|
|
177
|
-
}
|
|
178
|
-
else if (this.$parent) {
|
|
179
|
-
injectables = this.$parent.$options.provide();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
ret = injectables[this.ej2Instances.getModuleName()] || [];
|
|
183
|
-
}
|
|
184
|
-
this.isDecorator = false;
|
|
185
|
-
return ret;
|
|
186
|
-
};
|
|
187
|
-
ComponentBase.prototype.updated = function () {
|
|
96
|
+
},
|
|
97
|
+
updated: function () {
|
|
188
98
|
if (this.isVue3) {
|
|
189
99
|
this.setModelValue();
|
|
190
100
|
}
|
|
@@ -197,393 +107,460 @@ var ComponentBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
197
107
|
this.assignValueToWrapper(childKey, false);
|
|
198
108
|
}
|
|
199
109
|
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
if (this.hasChildDirective) {
|
|
216
|
-
this.fetchChildPropValues(options);
|
|
217
|
-
}
|
|
218
|
-
if (this.hasInjectedModules) {
|
|
219
|
-
var prevModule = this.getInjectedServices() || [];
|
|
220
|
-
var curModule = this.ej2Instances.getInjectedModules() || [];
|
|
221
|
-
for (var _b = 0, curModule_2 = curModule; _b < curModule_2.length; _b++) {
|
|
222
|
-
var mod = curModule_2[_b];
|
|
223
|
-
if (prevModule.indexOf(mod) === -1) {
|
|
224
|
-
prevModule.push(mod);
|
|
110
|
+
},
|
|
111
|
+
beforeDestroy: function () {
|
|
112
|
+
this.destroyComponent();
|
|
113
|
+
},
|
|
114
|
+
beforeUnmount: function () {
|
|
115
|
+
this.destroyComponent();
|
|
116
|
+
},
|
|
117
|
+
methods: {
|
|
118
|
+
setModelValue: function () {
|
|
119
|
+
if (!isNullOrUndefined(this.modelValue) || !isNullOrUndefined(this.$attrs.modelValue)) {
|
|
120
|
+
var key = this.models.toString().match(/checked|value/) || [];
|
|
121
|
+
var propKey = key[0];
|
|
122
|
+
if (!isNullOrUndefined(propKey)) {
|
|
123
|
+
this.ej2Instances["" + propKey] = !isNullOrUndefined(this.modelValue) ? this.modelValue : this.$attrs.modelValue;
|
|
225
124
|
}
|
|
226
125
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
var key =
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
var splitKeys = key.split('-');
|
|
254
|
-
var controlName = this.ej2Instances.getModuleName().toLowerCase();
|
|
255
|
-
var keyRef = (splitKeys.length > 1 && controlName.indexOf(splitKeys[0]) > -1) ? splitKeys[1] : splitKeys[0];
|
|
256
|
-
keyRef = keyRef.replace(controlName, '');
|
|
257
|
-
if (controlName == "splitter" && keyRef == "panes") {
|
|
258
|
-
keyRef = "paneSettings";
|
|
126
|
+
},
|
|
127
|
+
getInjectedServices: function () {
|
|
128
|
+
var ret = [];
|
|
129
|
+
var provide;
|
|
130
|
+
if (this.$root && this.isDecorator) {
|
|
131
|
+
provide = getValue('$root.$options.provide', this);
|
|
132
|
+
}
|
|
133
|
+
else if (this.$vnode) {
|
|
134
|
+
provide = getValue('$vnode.context.$options.provide', this);
|
|
135
|
+
}
|
|
136
|
+
else if (this.$parent) {
|
|
137
|
+
provide = getValue('$parent.$options.provide', this);
|
|
138
|
+
}
|
|
139
|
+
if (isNullOrUndefined(provide) && !isNullOrUndefined(this.$)) {
|
|
140
|
+
provide = getValue('$.parent.provides', this);
|
|
141
|
+
}
|
|
142
|
+
if (provide) {
|
|
143
|
+
// tslint:disable:no-any
|
|
144
|
+
var injectables = provide;
|
|
145
|
+
if (typeof provide === 'function') {
|
|
146
|
+
if (provide.managed) {
|
|
147
|
+
var provideKey = provide.managed;
|
|
148
|
+
var provideValue = Object.keys(provideKey);
|
|
149
|
+
var key = void 0;
|
|
150
|
+
if (this.$root && this.isDecorator) {
|
|
151
|
+
key = Object.keys(this.$root);
|
|
259
152
|
}
|
|
260
|
-
else if (
|
|
261
|
-
|
|
153
|
+
else if (this.$vnode) {
|
|
154
|
+
key = Object.keys(this.$vnode.context);
|
|
262
155
|
}
|
|
263
|
-
else if (
|
|
264
|
-
|
|
156
|
+
else if (this.$parent) {
|
|
157
|
+
key = Object.keys(this.$parent);
|
|
265
158
|
}
|
|
266
|
-
|
|
159
|
+
for (var i = 0; i < provideValue.length; i++) {
|
|
160
|
+
for (var j = 0; j < key.length; j++) {
|
|
161
|
+
if ((key[parseInt(j.toString(), 10)].indexOf(provideValue[parseInt(i.toString(), 10)])) !== -1) {
|
|
162
|
+
if (this.$root && this.isDecorator) {
|
|
163
|
+
provideKey[provideValue[parseInt(j.toString(), 10)]] = this.$root[key[parseInt(i.toString(), 10)]];
|
|
164
|
+
}
|
|
165
|
+
else if (this.$vnode) {
|
|
166
|
+
provideKey[provideValue[parseInt(i.toString(), 10)]] = this.$vnode.context[key[parseInt(j.toString(), 10)]];
|
|
167
|
+
}
|
|
168
|
+
else if (this.$parent) {
|
|
169
|
+
provideKey[provideValue[parseInt(i.toString(), 10)]] = this.$parent[key[parseInt(j.toString(), 10)]];
|
|
170
|
+
}
|
|
171
|
+
injectables = provideKey;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// tslint:disable:no-any
|
|
177
|
+
else if (this.$vnode) {
|
|
178
|
+
injectables = this.$vnode.context.$options.provide();
|
|
179
|
+
}
|
|
180
|
+
else if (this.$parent) {
|
|
181
|
+
injectables = this.$parent.$options.provide();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
ret = injectables[this.ej2Instances.getModuleName()] || [];
|
|
185
|
+
}
|
|
186
|
+
this.isDecorator = false;
|
|
187
|
+
return ret;
|
|
188
|
+
},
|
|
189
|
+
destroyComponent: function () {
|
|
190
|
+
var tempBeforeDestroyThis = this;
|
|
191
|
+
tempBeforeDestroyThis.ej2Instances.destroy();
|
|
192
|
+
tempBeforeDestroyThis.$el.style.visibility = 'hidden';
|
|
193
|
+
tempBeforeDestroyThis = null;
|
|
194
|
+
},
|
|
195
|
+
bindProperties: function () {
|
|
196
|
+
var options = {};
|
|
197
|
+
for (var _i = 0, _a = this.propKeys; _i < _a.length; _i++) {
|
|
198
|
+
var prop = _a[_i];
|
|
199
|
+
if (!isNullOrUndefined(this["" + prop])) {
|
|
200
|
+
options["" + prop] = this["" + prop];
|
|
201
|
+
}
|
|
202
|
+
else if (this[0] && !isNullOrUndefined(this[0][0]) && !isNullOrUndefined(this[0][0]["" + prop])) {
|
|
203
|
+
options["" + prop] = this[0][0]["" + prop];
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (this.hasChildDirective) {
|
|
207
|
+
this.fetchChildPropValues(options);
|
|
208
|
+
}
|
|
209
|
+
if (this.hasInjectedModules) {
|
|
210
|
+
var prevModule = this.getInjectedServices() || [];
|
|
211
|
+
var curModule = this.ej2Instances.getInjectedModules() || [];
|
|
212
|
+
for (var _b = 0, curModule_2 = curModule; _b < curModule_2.length; _b++) {
|
|
213
|
+
var mod = curModule_2[_b];
|
|
214
|
+
if (prevModule.indexOf(mod) === -1) {
|
|
215
|
+
prevModule.push(mod);
|
|
267
216
|
}
|
|
268
217
|
}
|
|
218
|
+
this.ej2Instances.injectedModules = prevModule;
|
|
269
219
|
}
|
|
270
|
-
|
|
271
|
-
|
|
220
|
+
this.assignValueToWrapper(options);
|
|
221
|
+
},
|
|
222
|
+
assignValueToWrapper: function (option, silent) {
|
|
223
|
+
this.ej2Instances.setProperties(extend({}, {}, option, true), isNullOrUndefined(silent) ? true : silent);
|
|
224
|
+
},
|
|
225
|
+
fetchChildPropValues: function (childOption) {
|
|
226
|
+
var dirProps = {};
|
|
227
|
+
if (!this.isVue3) {
|
|
228
|
+
dirProps = this.getDirectiveValues(this.$slots.default, this.tagMapper || {}, this.tagNameMapper || {});
|
|
272
229
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
230
|
+
else {
|
|
231
|
+
var propRef = void 0;
|
|
232
|
+
if (this[0] && this[0][1].slots.default) {
|
|
233
|
+
propRef = this[0][1].slots.default();
|
|
234
|
+
}
|
|
235
|
+
else if (this && this.$ && this.$.slots && this.$.slots.default) {
|
|
236
|
+
propRef = this.$.slots.default();
|
|
237
|
+
}
|
|
238
|
+
if (propRef) {
|
|
239
|
+
for (var i = 0; i < propRef.length; i++) {
|
|
240
|
+
if (propRef[parseInt(i.toString(), 10)].type.methods || propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection') {
|
|
241
|
+
var key = propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection' ? 'series-collection' :
|
|
242
|
+
propRef[parseInt(i.toString(), 10)].type.methods.getTag().replace("e-", "");
|
|
243
|
+
var ref = this.resolveArrayDirectives(propRef[parseInt(i.toString(), 10)].children, key);
|
|
244
|
+
var splitKeys = key.split('-');
|
|
245
|
+
var controlName = this.ej2Instances.getModuleName().toLowerCase();
|
|
246
|
+
var keyRef = (splitKeys.length > 1 && controlName.indexOf(splitKeys[0]) > -1) ? splitKeys[1] : splitKeys[0];
|
|
247
|
+
keyRef = keyRef.replace(controlName, '');
|
|
248
|
+
if (controlName == "splitter" && keyRef == "panes") {
|
|
249
|
+
keyRef = "paneSettings";
|
|
250
|
+
}
|
|
251
|
+
else if (controlName == "bulletchart" && keyRef == "range") {
|
|
252
|
+
keyRef = "ranges";
|
|
253
|
+
}
|
|
254
|
+
else if (controlName == "schedule" && keyRef == "header") {
|
|
255
|
+
keyRef = "headerRows";
|
|
256
|
+
}
|
|
257
|
+
dirProps["" + keyRef] = ref["" + key];
|
|
258
|
+
}
|
|
259
|
+
}
|
|
296
260
|
}
|
|
297
261
|
else {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (!this.childDirObjects) {
|
|
266
|
+
this.childDirObjects = JSON.stringify(dirProps);
|
|
267
|
+
}
|
|
268
|
+
for (var _i = 0, _a = Object.keys(dirProps); _i < _a.length; _i++) {
|
|
269
|
+
var dirProp = _a[_i];
|
|
270
|
+
childOption["" + dirProp] = dirProps["" + dirProp];
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
resolveArrayDirectives: function (slots, tagName) {
|
|
274
|
+
var slot = [];
|
|
275
|
+
var innerDirValues;
|
|
276
|
+
slot = slots.default ? slots.default() : slots;
|
|
277
|
+
var items = {};
|
|
278
|
+
items["" + tagName] = [];
|
|
279
|
+
var _loop_2 = function (childSlot) {
|
|
280
|
+
var tempObj = {};
|
|
281
|
+
var tagRef = childSlot.type.methods ? childSlot.type.methods.getTag() : tagName;
|
|
282
|
+
if (childSlot.children) {
|
|
283
|
+
var key = void 0;
|
|
284
|
+
innerDirValues = this_2.resolveComplexDirs(childSlot.children, this_2.tagMapper["e-" + tagName], tagRef);
|
|
285
|
+
if (innerDirValues.length) {
|
|
286
|
+
tempObj = innerDirValues;
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
for (var i = 0; i < Object.keys(innerDirValues).length; i++) {
|
|
290
|
+
key = Object.keys(innerDirValues)[parseInt(i.toString(), 10)];
|
|
291
|
+
tempObj["" + key] = innerDirValues["" + key];
|
|
292
|
+
}
|
|
301
293
|
}
|
|
302
|
-
|
|
303
294
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
295
|
+
if (childSlot.props) {
|
|
296
|
+
Object.keys(childSlot.props).forEach(function (key) {
|
|
297
|
+
var propName = key.replace(/-[a-z]/g, function (e) { return e[1].toUpperCase(); });
|
|
298
|
+
if (propName) {
|
|
299
|
+
tempObj["" + propName] = childSlot.props["" + key];
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
if (((/[s]\b/).test(tagRef) && innerDirValues) && (!(/[s]\b/).test(tagName) || innerDirValues.length)) {
|
|
304
|
+
items["" + tagName] = tempObj;
|
|
305
|
+
}
|
|
306
|
+
else if (tempObj && Object.keys(tempObj).length !== 0) {
|
|
307
|
+
items["" + tagName].push(tempObj);
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
var this_2 = this;
|
|
311
|
+
for (var _i = 0, slot_1 = slot; _i < slot_1.length; _i++) {
|
|
312
|
+
var childSlot = slot_1[_i];
|
|
313
|
+
_loop_2(childSlot);
|
|
314
|
+
}
|
|
315
|
+
return items;
|
|
316
|
+
},
|
|
317
|
+
resolveComplexDirs: function (slots, tagObject, tagName) {
|
|
318
|
+
var slot = [];
|
|
319
|
+
var innerDirValues;
|
|
320
|
+
slot = slots.default ? slots.default() : slots;
|
|
321
|
+
var items = {};
|
|
322
|
+
var _loop_3 = function (childSlot) {
|
|
323
|
+
var tagRef = void 0;
|
|
324
|
+
var tag = void 0;
|
|
325
|
+
if (tagObject["" + tagName]) {
|
|
326
|
+
tagRef = Object.keys(tagObject["" + tagName]);
|
|
327
|
+
tag = tagRef.find(function (key) {
|
|
328
|
+
return tagObject["" + tagName]["" + key] ===
|
|
329
|
+
childSlot.type.methods.getTag().replace(/[s]\b/, "");
|
|
330
|
+
});
|
|
331
|
+
var moduleName = this_3.ej2Instances.getModuleName().toLowerCase();
|
|
332
|
+
tag = tag
|
|
333
|
+
? tag.replace("e-", "")
|
|
334
|
+
: childSlot.type.methods.getTag().replace(moduleName === "ribbon" ? "e-ribbon-" : "e-", "");
|
|
335
|
+
if (this_3.ej2Instances.getModuleName().toLowerCase() == "diagram" && tag.indexOf('annotations') != -1) {
|
|
336
|
+
tag = 'annotations';
|
|
310
337
|
}
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
if (((/[s]\b/).test(tagRef) && innerDirValues) && (!(/[s]\b/).test(tagName) || innerDirValues.length)) {
|
|
314
|
-
items["" + tagName] = tempObj;
|
|
315
|
-
}
|
|
316
|
-
else if (tempObj && Object.keys(tempObj).length !== 0) {
|
|
317
|
-
items["" + tagName].push(tempObj);
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
var this_2 = this;
|
|
321
|
-
for (var _i = 0, slot_1 = slot; _i < slot_1.length; _i++) {
|
|
322
|
-
var childSlot = slot_1[_i];
|
|
323
|
-
_loop_2(childSlot);
|
|
324
|
-
}
|
|
325
|
-
return items;
|
|
326
|
-
};
|
|
327
|
-
ComponentBase.prototype.resolveComplexDirs = function (slots, tagObject, tagName) {
|
|
328
|
-
var slot = [];
|
|
329
|
-
var innerDirValues;
|
|
330
|
-
slot = slots.default ? slots.default() : slots;
|
|
331
|
-
var items = {};
|
|
332
|
-
var _loop_3 = function (childSlot) {
|
|
333
|
-
var tagRef = void 0;
|
|
334
|
-
var tag = void 0;
|
|
335
|
-
if (tagObject["" + tagName]) {
|
|
336
|
-
tagRef = Object.keys(tagObject["" + tagName]);
|
|
337
|
-
tag = tagRef.find(function (key) {
|
|
338
|
-
return tagObject["" + tagName]["" + key] ===
|
|
339
|
-
childSlot.type.methods.getTag().replace(/[s]\b/, "");
|
|
340
|
-
});
|
|
341
|
-
tag = tag
|
|
342
|
-
? tag.replace("e-", "")
|
|
343
|
-
: childSlot.type.methods.getTag().replace("e-", "");
|
|
344
|
-
if (this_3.ej2Instances.getModuleName().toLowerCase() == "diagram" && tag.indexOf('annotations') != -1) {
|
|
345
|
-
tag = 'annotations';
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
if (childSlot.children) {
|
|
349
|
-
innerDirValues = this_3.resolveComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
|
|
350
|
-
if (!items["" + tag]) {
|
|
351
|
-
items["" + tag] = [];
|
|
352
|
-
}
|
|
353
|
-
if (innerDirValues.length > 1) {
|
|
354
|
-
items["" + tag] = innerDirValues;
|
|
355
338
|
}
|
|
356
|
-
|
|
357
|
-
|
|
339
|
+
if (childSlot.children) {
|
|
340
|
+
innerDirValues = this_3.resolveComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
|
|
341
|
+
if (!items["" + tag]) {
|
|
342
|
+
items["" + tag] = [];
|
|
343
|
+
}
|
|
344
|
+
if (innerDirValues.length > 1) {
|
|
345
|
+
items["" + tag] = innerDirValues;
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
items["" + tag].push(innerDirValues);
|
|
349
|
+
}
|
|
358
350
|
}
|
|
359
|
-
}
|
|
360
|
-
if (childSlot.props) {
|
|
361
|
-
childSlot.props = this_3.getCamelCaseProps(childSlot.props);
|
|
362
|
-
}
|
|
363
|
-
if (slot.length > 1) {
|
|
364
|
-
items = Object.keys(items).length == 0 && !items.length ? [] : items;
|
|
365
351
|
if (childSlot.props) {
|
|
366
|
-
|
|
352
|
+
childSlot.props = this_3.getCamelCaseProps(childSlot.props);
|
|
367
353
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
var
|
|
387
|
-
var
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
354
|
+
if (slot.length > 1) {
|
|
355
|
+
items = Object.keys(items).length == 0 && !items.length ? [] : items;
|
|
356
|
+
if (childSlot.props) {
|
|
357
|
+
items.push(childSlot.props);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
items = childSlot.props ? Object.assign(items, childSlot.props) : items;
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
var this_3 = this;
|
|
365
|
+
for (var _i = 0, slot_2 = slot; _i < slot_2.length; _i++) {
|
|
366
|
+
var childSlot = slot_2[_i];
|
|
367
|
+
_loop_3(childSlot);
|
|
368
|
+
}
|
|
369
|
+
return items;
|
|
370
|
+
},
|
|
371
|
+
resolveComplexInnerDirs: function (slots, tagObject, tagName) {
|
|
372
|
+
var slot = [];
|
|
373
|
+
var innerDirValues;
|
|
374
|
+
slot = slots.default ? slots.default() : slots;
|
|
375
|
+
var items = slot.length > 1 ? [] : {};
|
|
376
|
+
for (var _i = 0, slot_3 = slot; _i < slot_3.length; _i++) {
|
|
377
|
+
var childSlot = slot_3[_i];
|
|
378
|
+
var isRibbon = (this.ej2Instances.getModuleName().toLowerCase() == "ribbon");
|
|
379
|
+
var tag = childSlot.type.methods.getTag().replace(isRibbon ? "e-ribbon-" : "e-", "");
|
|
380
|
+
if (childSlot.children) {
|
|
381
|
+
innerDirValues = this.resolveMultilevelComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
|
|
382
|
+
if ((/[s]\b/).test(tag) || slot.length > 1) {
|
|
383
|
+
if ((/[s]\b/).test(tag)) {
|
|
384
|
+
items["" + tag] = !items["" + tag] ? [] : items["" + tag];
|
|
385
|
+
if (innerDirValues.length) {
|
|
386
|
+
items["" + tag] = innerDirValues;
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
items["" + tag].push(innerDirValues);
|
|
390
|
+
}
|
|
395
391
|
}
|
|
396
|
-
else {
|
|
397
|
-
items
|
|
392
|
+
else if (innerDirValues && !(isRibbon && innerDirValues.hasOwnProperty('collections'))) {
|
|
393
|
+
items.push(innerDirValues);
|
|
398
394
|
}
|
|
399
395
|
}
|
|
400
|
-
else
|
|
401
|
-
items
|
|
396
|
+
else {
|
|
397
|
+
items = innerDirValues ? innerDirValues : items;
|
|
402
398
|
}
|
|
403
399
|
}
|
|
404
|
-
|
|
405
|
-
|
|
400
|
+
if (childSlot.props) {
|
|
401
|
+
childSlot.props = this.getCamelCaseProps(childSlot.props);
|
|
406
402
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
403
|
+
if (slot.length > 1 && childSlot.props) {
|
|
404
|
+
if (isRibbon && innerDirValues && innerDirValues.hasOwnProperty('collections')) {
|
|
405
|
+
innerDirValues = childSlot.props ? Object.assign(innerDirValues, childSlot.props) : innerDirValues;
|
|
406
|
+
items.push(innerDirValues);
|
|
407
|
+
}
|
|
408
|
+
else if (items.length >= 0) {
|
|
409
|
+
items.push(childSlot.props);
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
items = childSlot.props ? Object.assign(items, childSlot.props) : items;
|
|
413
|
+
}
|
|
414
414
|
}
|
|
415
415
|
else {
|
|
416
416
|
items = childSlot.props ? Object.assign(items, childSlot.props) : items;
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
var tag = childSlot.type.methods.getTag().replace("e-", "");
|
|
433
|
-
if (childSlot.children) {
|
|
434
|
-
innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
|
|
435
|
-
}
|
|
436
|
-
if (childSlot.props) {
|
|
437
|
-
childSlot.props = this.getCamelCaseProps(childSlot.props);
|
|
438
|
-
}
|
|
439
|
-
if ((/[s]\b/).test(tag)) {
|
|
440
|
-
items["" + tag] = !items["" + tag] ? [] : items["" + tag];
|
|
441
|
-
if (innerDirValues.length) {
|
|
442
|
-
items["" + tag] = innerDirValues;
|
|
443
|
-
}
|
|
444
|
-
else {
|
|
445
|
-
items["" + tag].push(innerDirValues);
|
|
419
|
+
return items;
|
|
420
|
+
},
|
|
421
|
+
resolveMultilevelComplexInnerDirs: function (slots, tagObject, tagName) {
|
|
422
|
+
var slot = [];
|
|
423
|
+
var innerDirValues;
|
|
424
|
+
slot = slots.default ? slots.default() : slots;
|
|
425
|
+
var items = slot.length > 1 ? [] : {};
|
|
426
|
+
for (var _i = 0, slot_4 = slot; _i < slot_4.length; _i++) {
|
|
427
|
+
var childSlot = slot_4[_i];
|
|
428
|
+
var moduleName = this.ej2Instances.getModuleName().toLowerCase();
|
|
429
|
+
var tag = childSlot.type.methods.getTag().replace(moduleName === "ribbon" ? "e-ribbon-" : "e-", "");
|
|
430
|
+
if (childSlot.children) {
|
|
431
|
+
innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
|
|
446
432
|
}
|
|
447
433
|
if (childSlot.props) {
|
|
448
|
-
|
|
434
|
+
childSlot.props = this.getCamelCaseProps(childSlot.props);
|
|
435
|
+
}
|
|
436
|
+
if ((/[s]\b/).test(tag)) {
|
|
437
|
+
items["" + tag] = !items["" + tag] ? [] : items["" + tag];
|
|
438
|
+
if (innerDirValues.length) {
|
|
439
|
+
items["" + tag] = innerDirValues;
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
items["" + tag].push(innerDirValues);
|
|
443
|
+
}
|
|
444
|
+
if (childSlot.props) {
|
|
445
|
+
items["" + tag].push(childSlot.props);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
items = innerDirValues;
|
|
450
|
+
items = childSlot.props ? Object.assign(items, childSlot.props) : items;
|
|
449
451
|
}
|
|
450
452
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
var tagDirChild = children_1[_a];
|
|
474
|
-
var retObj = this.getVNodeValue(tagDirChild, tagMapper["" + dirTag], tagNameMapper);
|
|
475
|
-
if (Object.keys(retObj).length !== 0) {
|
|
476
|
-
dir[tagName.replace('e-', '')].push(retObj);
|
|
453
|
+
return items;
|
|
454
|
+
},
|
|
455
|
+
getDirectiveValues: function (tagDirectives, tagMapper, tagNameMapper) {
|
|
456
|
+
var keyTags = Object.keys(tagMapper);
|
|
457
|
+
var dir = {};
|
|
458
|
+
if (tagDirectives) {
|
|
459
|
+
for (var _i = 0, tagDirectives_1 = tagDirectives; _i < tagDirectives_1.length; _i++) {
|
|
460
|
+
var tagDirective = tagDirectives_1[_i];
|
|
461
|
+
if (tagDirective.componentOptions && tagDirective.componentOptions.children && tagDirective.componentOptions.tag ||
|
|
462
|
+
(tagDirective.tag === 'e-seriescollection' && tagDirective.children)) {
|
|
463
|
+
var dirTag = tagDirective.componentOptions ? tagDirective.componentOptions.tag : tagDirective.tag;
|
|
464
|
+
dirTag = (dirTag === 'e-seriescollection') ? 'e-seriesCollection' : dirTag;
|
|
465
|
+
if (keyTags.indexOf(dirTag) !== -1) {
|
|
466
|
+
var tagName = tagNameMapper["" + dirTag] ? tagNameMapper["" + dirTag] : dirTag;
|
|
467
|
+
dir[tagName.replace('e-', '')] = [];
|
|
468
|
+
var children = tagDirective.componentOptions ? tagDirective.componentOptions.children : tagDirective.children;
|
|
469
|
+
for (var _a = 0, children_1 = children; _a < children_1.length; _a++) {
|
|
470
|
+
var tagDirChild = children_1[_a];
|
|
471
|
+
var retObj = this.getVNodeValue(tagDirChild, tagMapper["" + dirTag], tagNameMapper);
|
|
472
|
+
if (Object.keys(retObj).length !== 0) {
|
|
473
|
+
dir[tagName.replace('e-', '')].push(retObj);
|
|
474
|
+
}
|
|
477
475
|
}
|
|
478
476
|
}
|
|
479
477
|
}
|
|
480
478
|
}
|
|
481
479
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
480
|
+
return dir;
|
|
481
|
+
},
|
|
482
|
+
getMultiLevelDirValue: function (tagDirectories, tagKey, tagNameMapper) {
|
|
483
|
+
var mulObj = {};
|
|
484
|
+
for (var _i = 0, tagDirectories_1 = tagDirectories; _i < tagDirectories_1.length; _i++) {
|
|
485
|
+
var tagDir = tagDirectories_1[_i];
|
|
486
|
+
var key = void 0;
|
|
487
|
+
var children = void 0;
|
|
488
|
+
if (tagDir.componentOptions) {
|
|
489
|
+
key = tagDir.componentOptions.tag;
|
|
490
|
+
if (tagDir.componentOptions.children) {
|
|
491
|
+
children = tagDir.componentOptions.children;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
else if ((tagDir.tag === 'e-markersettings' || tagDir.tag === 'e-markersetting') && tagDir.children) {
|
|
495
|
+
key = (tagDir.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
|
|
496
|
+
children = tagDir.children;
|
|
497
|
+
}
|
|
498
|
+
if (key) {
|
|
499
|
+
var tagName = tagNameMapper["" + key] ? tagNameMapper["" + key] : key;
|
|
500
|
+
mulObj[tagName.replace('e-', '')] = [];
|
|
501
|
+
if (children) {
|
|
502
|
+
for (var _a = 0, children_2 = children; _a < children_2.length; _a++) {
|
|
503
|
+
var tagDirChild = children_2[_a];
|
|
504
|
+
var mulLevObj = this.getVNodeValue(tagDirChild, tagKey["" + key], tagNameMapper);
|
|
505
|
+
if (Object.keys(mulLevObj).length !== 0) {
|
|
506
|
+
mulObj[tagName.replace('e-', '')].push(mulLevObj);
|
|
507
|
+
}
|
|
510
508
|
}
|
|
511
509
|
}
|
|
512
510
|
}
|
|
513
511
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
dirTag = (tagDirective.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
|
|
526
|
-
}
|
|
527
|
-
if (typeof tagKey === 'string' && dirTag === tagKey && tagDirective.data) {
|
|
528
|
-
ret = tagDirective.data.attrs ? this.getCamelCaseProps(tagDirective.data.attrs) : this.getCamelCaseProps(tagDirective.data);
|
|
529
|
-
}
|
|
530
|
-
else if (typeof tagKey === 'object') {
|
|
531
|
-
if (tagDirective.componentOptions.children && (Object.keys(tagKey).indexOf(dirTag) !== -1)) {
|
|
532
|
-
ret = this.getMultiLevelDirValue(tagDirective.componentOptions.children, tagKey["" + dirTag], tagNameMapper);
|
|
512
|
+
return mulObj;
|
|
513
|
+
},
|
|
514
|
+
getVNodeValue: function (tagDirective, tagKey, tagNameMapper) {
|
|
515
|
+
var ret = {};
|
|
516
|
+
if (tagDirective.componentOptions || ((tagDirective.tag === 'e-markersettings' || tagDirective.tag === 'e-markersetting') && tagDirective.context)) {
|
|
517
|
+
var dirTag = void 0;
|
|
518
|
+
if (tagDirective.componentOptions) {
|
|
519
|
+
dirTag = tagDirective.componentOptions.tag;
|
|
520
|
+
}
|
|
521
|
+
else {
|
|
522
|
+
dirTag = (tagDirective.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
|
|
533
523
|
}
|
|
534
|
-
|
|
535
|
-
ret = this.
|
|
524
|
+
if (typeof tagKey === 'string' && dirTag === tagKey && tagDirective.data) {
|
|
525
|
+
ret = tagDirective.data.attrs ? this.getCamelCaseProps(tagDirective.data.attrs) : this.getCamelCaseProps(tagDirective.data);
|
|
536
526
|
}
|
|
537
|
-
if (
|
|
538
|
-
|
|
527
|
+
else if (typeof tagKey === 'object') {
|
|
528
|
+
if (tagDirective.componentOptions.children && (Object.keys(tagKey).indexOf(dirTag) !== -1)) {
|
|
529
|
+
ret = this.getMultiLevelDirValue(tagDirective.componentOptions.children, tagKey["" + dirTag], tagNameMapper);
|
|
530
|
+
}
|
|
531
|
+
else if (tagDirective.children && (Object.keys(tagKey).indexOf(dirTag) !== -1) && (dirTag === 'e-markersettings' || dirTag === 'e-markersetting')) {
|
|
532
|
+
ret = this.getMultiLevelDirValue(tagDirective.children, tagKey["" + dirTag], tagNameMapper);
|
|
533
|
+
}
|
|
534
|
+
if (tagDirective.data && tagDirective.data.attrs) {
|
|
535
|
+
ret = extend(ret, this.getCamelCaseProps(tagDirective.data.attrs));
|
|
536
|
+
}
|
|
539
537
|
}
|
|
540
538
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
}(vueImport));
|
|
563
|
-
|
|
564
|
-
/**
|
|
565
|
-
* Vue Component Base
|
|
566
|
-
*/
|
|
567
|
-
// import { Base, Component as EJ2Component, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
568
|
-
var $internalHooks = [
|
|
569
|
-
'data',
|
|
570
|
-
'beforeCreate',
|
|
571
|
-
'created',
|
|
572
|
-
'beforeMount',
|
|
573
|
-
'mounted',
|
|
574
|
-
'beforeDestroy',
|
|
575
|
-
'destroyed',
|
|
576
|
-
'beforeUpdate',
|
|
577
|
-
'updated',
|
|
578
|
-
'activated',
|
|
579
|
-
'deactivated',
|
|
580
|
-
'render',
|
|
581
|
-
'errorCaptured' // 2.5
|
|
582
|
-
];
|
|
539
|
+
return ret;
|
|
540
|
+
},
|
|
541
|
+
/**
|
|
542
|
+
* convert kebab case directive props to camel case
|
|
543
|
+
*/
|
|
544
|
+
getCamelCaseProps: function (props) {
|
|
545
|
+
var retProps = {};
|
|
546
|
+
for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {
|
|
547
|
+
var prop = _a[_i];
|
|
548
|
+
retProps[prop.replace(/-[a-z]/g, function (e) { return e[1].toUpperCase(); })] = props["" + prop];
|
|
549
|
+
}
|
|
550
|
+
return retProps;
|
|
551
|
+
},
|
|
552
|
+
dataBind: function () {
|
|
553
|
+
this.ej2Instances.dataBind();
|
|
554
|
+
},
|
|
555
|
+
setProperties: function (arg, muteOnChange) {
|
|
556
|
+
return this.ej2Instances.setProperties(arg, muteOnChange);
|
|
557
|
+
},
|
|
558
|
+
}
|
|
559
|
+
});
|
|
583
560
|
function getProps(options) {
|
|
584
561
|
if (options === void 0) { options = {}; }
|
|
585
562
|
if (options.props) {
|
|
586
|
-
var
|
|
563
|
+
var _loop_4 = function (prop) {
|
|
587
564
|
(options.newprops || (options.newprops = {}))["" + prop] = {};
|
|
588
565
|
(options.watch || (options.watch = {}))["" + prop] = function (newVal) {
|
|
589
566
|
this.ej2Instances["" + prop] = newVal;
|
|
@@ -594,116 +571,23 @@ function getProps(options) {
|
|
|
594
571
|
};
|
|
595
572
|
for (var _i = 0, _a = options.props; _i < _a.length; _i++) {
|
|
596
573
|
var prop = _a[_i];
|
|
597
|
-
|
|
574
|
+
_loop_4(prop);
|
|
598
575
|
}
|
|
599
576
|
}
|
|
600
577
|
return [options.newprops, options.watch];
|
|
601
578
|
}
|
|
602
|
-
function EJComponentDecorator(options, isExecute$$1) {
|
|
603
|
-
if (!isExecute$$1) {
|
|
604
|
-
return;
|
|
605
|
-
}
|
|
606
|
-
return function (Component) {
|
|
607
|
-
return EJcomponentFactory(Component, options);
|
|
608
|
-
};
|
|
609
|
-
}
|
|
610
|
-
function EJcomponentFactory(Component, options) {
|
|
611
|
-
if (options === void 0) { options = {}; }
|
|
612
|
-
options.name = options.name || Component._componentTag || Component.name;
|
|
613
|
-
// prototype props.
|
|
614
|
-
var proto = Component.prototype;
|
|
615
|
-
if (options.props) {
|
|
616
|
-
var _loop_2 = function (prop) {
|
|
617
|
-
(options.props || (options.props = {}))["" + prop] = {};
|
|
618
|
-
(options.watch || (options.watch = {}))["" + prop] = function (newVal) {
|
|
619
|
-
this.ej2Instances["" + prop] = newVal;
|
|
620
|
-
if (this.dataBind && (options.name !== 'DateRangePickerComponent')) {
|
|
621
|
-
this.dataBind();
|
|
622
|
-
}
|
|
623
|
-
};
|
|
624
|
-
};
|
|
625
|
-
for (var _i = 0, _a = options.props; _i < _a.length; _i++) {
|
|
626
|
-
var prop = _a[_i];
|
|
627
|
-
_loop_2(prop);
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
Object.getOwnPropertyNames(proto).forEach(function (key) {
|
|
631
|
-
// hooks
|
|
632
|
-
if (key === 'constructor') {
|
|
633
|
-
return;
|
|
634
|
-
}
|
|
635
|
-
if ($internalHooks.indexOf(key) > -1) {
|
|
636
|
-
options["" + key] = proto["" + key];
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
var descriptor = Object.getOwnPropertyDescriptor(proto, key);
|
|
640
|
-
if (typeof descriptor.value === 'function') {
|
|
641
|
-
// methods
|
|
642
|
-
(options.methods || (options.methods = {}))["" + key] = descriptor.value;
|
|
643
|
-
}
|
|
644
|
-
else if (descriptor.get || descriptor.set) {
|
|
645
|
-
// computed properties
|
|
646
|
-
(options.computed || (options.computed = {}))["" + key] = {
|
|
647
|
-
get: descriptor.get,
|
|
648
|
-
set: descriptor.set
|
|
649
|
-
};
|
|
650
|
-
}
|
|
651
|
-
});
|
|
652
|
-
Object.getOwnPropertyNames(ComponentBase.prototype).forEach(function (key) {
|
|
653
|
-
if ($internalHooks.indexOf(key) > -1) {
|
|
654
|
-
options["" + key] = proto["" + key];
|
|
655
|
-
return;
|
|
656
|
-
}
|
|
657
|
-
});
|
|
658
|
-
(options.mixins || (options.mixins = [])).push({
|
|
659
|
-
data: function () {
|
|
660
|
-
return collectDataFromConstructor(this, Component);
|
|
661
|
-
}
|
|
662
|
-
});
|
|
663
|
-
// decorate options
|
|
664
|
-
var decorators = Component.__decorators__;
|
|
665
|
-
if (decorators) {
|
|
666
|
-
decorators.forEach(Function(options));
|
|
667
|
-
delete Component.__decorators__;
|
|
668
|
-
}
|
|
669
|
-
// find super
|
|
670
|
-
var superProto = Object.getPrototypeOf(Component.prototype);
|
|
671
|
-
var Super = superProto instanceof Vue$1__default
|
|
672
|
-
? superProto.constructor
|
|
673
|
-
: Vue$1__default;
|
|
674
|
-
var Extended = Super.extend(options);
|
|
675
|
-
return Extended;
|
|
676
|
-
}
|
|
677
|
-
function collectDataFromConstructor(vm, Component) {
|
|
678
|
-
Component.prototype._init = function () {
|
|
679
|
-
var _this = this;
|
|
680
|
-
var keys = Object.getOwnPropertyNames(vm);
|
|
681
|
-
if (vm.$options.props) {
|
|
682
|
-
for (var key in vm.$options.props) {
|
|
683
|
-
if (!vm.hasOwnProperty(key)) {
|
|
684
|
-
keys.push(key);
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
keys.forEach(function (key) {
|
|
689
|
-
if (key.charAt(0) !== '_') {
|
|
690
|
-
Object.defineProperty(_this, key, {
|
|
691
|
-
get: function () { return vm["" + key]; },
|
|
692
|
-
set: function (value) { return vm["" + key] = value; }
|
|
693
|
-
});
|
|
694
|
-
}
|
|
695
|
-
});
|
|
696
|
-
};
|
|
697
|
-
var data = new Component();
|
|
698
|
-
var plainData = {};
|
|
699
|
-
Object.keys(data).forEach(function (key) {
|
|
700
|
-
if (data["" + key] !== undefined) {
|
|
701
|
-
plainData["" + key] = data["" + key];
|
|
702
|
-
}
|
|
703
|
-
});
|
|
704
|
-
return plainData;
|
|
705
|
-
}
|
|
706
579
|
|
|
580
|
+
var __assign = (undefined && undefined.__assign) || function () {
|
|
581
|
+
__assign = Object.assign || function(t) {
|
|
582
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
583
|
+
s = arguments[i];
|
|
584
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
585
|
+
t[p] = s[p];
|
|
586
|
+
}
|
|
587
|
+
return t;
|
|
588
|
+
};
|
|
589
|
+
return __assign.apply(this, arguments);
|
|
590
|
+
};
|
|
707
591
|
// tslint:disable:no-any
|
|
708
592
|
var stringCompiler = getTemplateEngine();
|
|
709
593
|
function compile(templateElement, helper) {
|
|
@@ -723,7 +607,7 @@ function compile(templateElement, helper) {
|
|
|
723
607
|
var vueSlot_1 = getCurrentVueSlot(context.vueInstance, templateElement, root);
|
|
724
608
|
if (vueSlot_1) {
|
|
725
609
|
// Compilation for Vue 3 slot template
|
|
726
|
-
var app =
|
|
610
|
+
var app = aVue.createApp({
|
|
727
611
|
render: function () {
|
|
728
612
|
return vueSlot_1["" + templateElement]({ data: data });
|
|
729
613
|
}
|
|
@@ -733,6 +617,8 @@ function compile(templateElement, helper) {
|
|
|
733
617
|
app.use(plugins[parseInt(i.toString(), 10)]);
|
|
734
618
|
}
|
|
735
619
|
}
|
|
620
|
+
// Get values for Vue 3 slot template
|
|
621
|
+
getValues(app, context.vueInstance, root);
|
|
736
622
|
app.mount((context.getModuleName() === 'grid') ? ("#" + pid) : ("#" + id));
|
|
737
623
|
returnEle = ele.childNodes;
|
|
738
624
|
detach(ele);
|
|
@@ -788,12 +674,14 @@ function compile(templateElement, helper) {
|
|
|
788
674
|
}
|
|
789
675
|
}
|
|
790
676
|
templateCompRef.data = function () { return tempRef_1; };
|
|
791
|
-
var app =
|
|
677
|
+
var app = aVue.createApp(templateCompRef);
|
|
792
678
|
if (plugins) {
|
|
793
679
|
for (var i = 0; i < plugins.length; i++) {
|
|
794
680
|
app.use(plugins[parseInt(i.toString(), 10)]);
|
|
795
681
|
}
|
|
796
682
|
}
|
|
683
|
+
// Get values for Vue 3 functional template
|
|
684
|
+
getValues(app, context.vueInstance, root);
|
|
797
685
|
app.mount((context.getModuleName() === 'grid') ? ("#" + pid) : ("#" + id));
|
|
798
686
|
returnEle = ele.childNodes;
|
|
799
687
|
detach(ele);
|
|
@@ -801,8 +689,22 @@ function compile(templateElement, helper) {
|
|
|
801
689
|
else if (typeof templateElement === "string") {
|
|
802
690
|
var vueSlot_2 = getVueSlot(context.vueInstance, templateElement, root);
|
|
803
691
|
if (vueSlot_2) {
|
|
692
|
+
// Get provide values for Vue 2 slot template
|
|
693
|
+
var provided_1 = {};
|
|
694
|
+
var getProvideValues_1 = function (vueinstance) {
|
|
695
|
+
if (vueinstance['$parent'])
|
|
696
|
+
getProvideValues_1(vueinstance.$parent);
|
|
697
|
+
if (vueinstance['_provided'] && Object.keys(vueinstance['_provided']).length > 0) {
|
|
698
|
+
provided_1 = __assign({}, provided_1, vueinstance._provided);
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
var vueInstance = context.vueInstance ? context.vueInstance : ((root && root.vueInstance) ? root.vueInstance : null);
|
|
702
|
+
if (vueInstance) {
|
|
703
|
+
getProvideValues_1(vueInstance);
|
|
704
|
+
}
|
|
804
705
|
// Compilation for Vue 2 slot template
|
|
805
|
-
var vueTemplate = new
|
|
706
|
+
var vueTemplate = new aVue({
|
|
707
|
+
provide: __assign({}, provided_1),
|
|
806
708
|
render: function () {
|
|
807
709
|
return vueSlot_2["" + templateElement]({ data: data });
|
|
808
710
|
}
|
|
@@ -831,7 +733,7 @@ function compile(templateElement, helper) {
|
|
|
831
733
|
dataObj.propsData = propsData;
|
|
832
734
|
}
|
|
833
735
|
if (typeof templateFunction !== "function") {
|
|
834
|
-
templateFunction =
|
|
736
|
+
templateFunction = aVue.extend(templateFunction);
|
|
835
737
|
}
|
|
836
738
|
var templateVue = new templateFunction(dataObj);
|
|
837
739
|
// let templateVue = new Vue(tempObj.template);
|
|
@@ -858,6 +760,37 @@ function compile(templateElement, helper) {
|
|
|
858
760
|
};
|
|
859
761
|
}
|
|
860
762
|
setTemplateEngine({ compile: compile });
|
|
763
|
+
function getValues(app, cInstance, root) {
|
|
764
|
+
var vueInstance = cInstance ? cInstance : ((root && root.vueInstance) ? root.vueInstance : null);
|
|
765
|
+
if (!vueInstance) {
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
// Get globally defined variables.
|
|
769
|
+
var globalVariables = ['components', 'mixins', 'provides'];
|
|
770
|
+
for (var i = 0; i < globalVariables.length; i++) {
|
|
771
|
+
var gVariable = globalVariables[i];
|
|
772
|
+
if (app['_context'][gVariable] && vueInstance['$']['appContext'][gVariable]) {
|
|
773
|
+
app['_context'][gVariable] = vueInstance['$']['appContext'][gVariable];
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
// Get provide value from child component.
|
|
777
|
+
var provided = {};
|
|
778
|
+
var getProvideValue = function (vueinstance) {
|
|
779
|
+
if (vueinstance['$'] && vueinstance['$']['parent'])
|
|
780
|
+
getProvideValue(vueinstance.$.parent);
|
|
781
|
+
if (vueinstance['provides'] && Object.keys(vueinstance['provides']).length > 0) {
|
|
782
|
+
provided = __assign({}, provided, vueinstance.provides);
|
|
783
|
+
}
|
|
784
|
+
};
|
|
785
|
+
getProvideValue(vueInstance);
|
|
786
|
+
if (app['_context']['provides']) {
|
|
787
|
+
app._context.provides = __assign({}, app._context.provides, provided);
|
|
788
|
+
}
|
|
789
|
+
// Get globally defined properties.
|
|
790
|
+
if (app['_context']['config']['globalProperties'] && vueInstance['$']['appContext']['config']['globalProperties']) {
|
|
791
|
+
app['_context']['config']['globalProperties'] = vueInstance['$']['appContext']['config']['globalProperties'];
|
|
792
|
+
}
|
|
793
|
+
}
|
|
861
794
|
// Get the Vue2 slot template from the root or current Vue component.
|
|
862
795
|
function getVueSlot(vueInstance, templateElement, root) {
|
|
863
796
|
if (!vueInstance && !(root && root.vueInstance)) {
|
|
@@ -932,5 +865,5 @@ function getChildVueSlot(slots, templateElement) {
|
|
|
932
865
|
* index for component base
|
|
933
866
|
*/
|
|
934
867
|
|
|
935
|
-
export {
|
|
868
|
+
export { isExecute, aVue, gh, vueDefineComponent, ComponentBase, getProps, compile };
|
|
936
869
|
//# sourceMappingURL=ej2-vue-base.es5.js.map
|