@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.
@@ -1,61 +1,40 @@
1
1
  /**
2
2
  * Vue Component Base
3
3
  */
4
- var __extends = (this && this.__extends) || (function () {
5
- var extendStatics = function (d, b) {
6
- extendStatics = Object.setPrototypeOf ||
7
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
9
- return extendStatics(d, b);
10
- };
11
- return function (d, b) {
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
4
+ import * as Vue from 'vue';
17
5
  import { isNullOrUndefined, extend, getValue } from '@syncfusion/ej2-base';
18
- import * as Vue3 from 'vue-class-component';
19
- import * as Vue2 from 'vue';
20
- import Vue from 'vue';
21
- export var aVue = _interopRequireWildcard(Vue2);
22
- export function _interopRequireWildcard(obj) {
23
- if (obj && obj.__esModule) {
24
- return obj;
25
- }
26
- else {
27
- var newObj = {};
28
- if (obj != null) {
29
- for (var key in obj) {
30
- if (Object.prototype.hasOwnProperty.call(obj, key))
31
- newObj["" + key] = obj["" + key];
32
- }
33
- }
34
- newObj.default = obj;
35
- return newObj;
36
- }
37
- }
38
- export var allVue = aVue;
39
- export var gh = allVue.h;
40
- export var isExecute = (parseInt(allVue.version) > 2) ? false : true;
41
- var vueImport;
42
- if (!isExecute || parseInt(allVue.version) < 3) {
43
- vueImport = Vue3.Vue;
6
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) {
7
+ return obj;
44
8
  }
45
9
  else {
46
- vueImport = Vue;
47
- }
48
- var ComponentBase = /** @class */ (function (_super) {
49
- __extends(ComponentBase, _super);
50
- function ComponentBase() {
51
- var _this = _super.call(this, arguments) || this;
52
- _this.hasInjectedModules = false;
53
- _this.hasChildDirective = false;
54
- _this.childDirObjects = '';
55
- _this.isDecorator = false;
56
- return _this;
10
+ var newObj = {};
11
+ if (obj != null) {
12
+ for (var key in obj) {
13
+ if (Object.prototype.hasOwnProperty.call(obj, key))
14
+ newObj["" + key] = obj["" + key];
15
+ }
57
16
  }
58
- ComponentBase.prototype.created = function () {
17
+ newObj.default = obj;
18
+ return newObj;
19
+ } }
20
+ var curVue = _interopRequireWildcard(Vue);
21
+ export var isExecute = (parseInt(curVue['version']) > 2) ? false : true, aVue = !isExecute ? curVue : curVue['default'], gh = curVue['h'];
22
+ export var vueDefineComponent = function (options) { return !isExecute ? aVue['defineComponent'](options) : aVue['extend'](options); };
23
+ export var ComponentBase = vueDefineComponent({
24
+ name: 'ComponentBase',
25
+ data: function () {
26
+ return {
27
+ ej2Instances: {},
28
+ tagMapper: {},
29
+ tagNameMapper: {},
30
+ hasInjectedModules: false,
31
+ hasChildDirective: false,
32
+ childDirObjects: '',
33
+ propKeys: {},
34
+ isDecorator: false
35
+ };
36
+ },
37
+ created: function () {
59
38
  var _this = this;
60
39
  if (!this.propKeys) {
61
40
  return;
@@ -94,8 +73,8 @@ var ComponentBase = /** @class */ (function (_super) {
94
73
  }
95
74
  this.ej2Instances.injectedModules = prevModule;
96
75
  }
97
- };
98
- ComponentBase.prototype.mounted = function () {
76
+ },
77
+ mounted: function () {
99
78
  var cusEle = this.$el ? this.$el.querySelectorAll("div.e-directive") : null;
100
79
  if (!isExecute && cusEle) {
101
80
  for (var i = 0; i < cusEle.length; i++) {
@@ -111,79 +90,8 @@ var ComponentBase = /** @class */ (function (_super) {
111
90
  this.setModelValue();
112
91
  }
113
92
  this.ej2Instances.appendTo(this.$el);
114
- };
115
- ComponentBase.prototype.setModelValue = function () {
116
- if (!isNullOrUndefined(this.modelValue) || !isNullOrUndefined(this.$attrs.modelValue)) {
117
- var key = this.models.toString().match(/checked|value/) || [];
118
- var propKey = key[0];
119
- if (!isNullOrUndefined(propKey)) {
120
- this.ej2Instances["" + propKey] = !isNullOrUndefined(this.modelValue) ? this.modelValue : this.$attrs.modelValue;
121
- }
122
- }
123
- };
124
- ComponentBase.prototype.getInjectedServices = function () {
125
- var ret = [];
126
- var provide;
127
- if (this.$root && this.isDecorator) {
128
- provide = getValue('$root.$options.provide', this);
129
- }
130
- else if (this.$vnode) {
131
- provide = getValue('$vnode.context.$options.provide', this);
132
- }
133
- else if (this.$parent) {
134
- provide = getValue('$parent.$options.provide', this);
135
- }
136
- if (isNullOrUndefined(provide) && !isNullOrUndefined(this.$)) {
137
- provide = getValue('$.parent.provides', this);
138
- }
139
- if (provide) {
140
- // tslint:disable:no-any
141
- var injectables = provide;
142
- if (typeof provide === 'function') {
143
- if (provide.managed) {
144
- var provideKey = provide.managed;
145
- var provideValue = Object.keys(provideKey);
146
- var key = void 0;
147
- if (this.$root && this.isDecorator) {
148
- key = Object.keys(this.$root);
149
- }
150
- else if (this.$vnode) {
151
- key = Object.keys(this.$vnode.context);
152
- }
153
- else if (this.$parent) {
154
- key = Object.keys(this.$parent);
155
- }
156
- for (var i = 0; i < provideValue.length; i++) {
157
- for (var j = 0; j < key.length; j++) {
158
- if ((key[parseInt(j.toString(), 10)].indexOf(provideValue[parseInt(i.toString(), 10)])) !== -1) {
159
- if (this.$root && this.isDecorator) {
160
- provideKey[provideValue[parseInt(j.toString(), 10)]] = this.$root[key[parseInt(i.toString(), 10)]];
161
- }
162
- else if (this.$vnode) {
163
- provideKey[provideValue[parseInt(i.toString(), 10)]] = this.$vnode.context[key[parseInt(j.toString(), 10)]];
164
- }
165
- else if (this.$parent) {
166
- provideKey[provideValue[parseInt(i.toString(), 10)]] = this.$parent[key[parseInt(j.toString(), 10)]];
167
- }
168
- injectables = provideKey;
169
- }
170
- }
171
- }
172
- }
173
- // tslint:disable:no-any
174
- else if (this.$vnode) {
175
- injectables = this.$vnode.context.$options.provide();
176
- }
177
- else if (this.$parent) {
178
- injectables = this.$parent.$options.provide();
179
- }
180
- }
181
- ret = injectables[this.ej2Instances.getModuleName()] || [];
182
- }
183
- this.isDecorator = false;
184
- return ret;
185
- };
186
- ComponentBase.prototype.updated = function () {
93
+ },
94
+ updated: function () {
187
95
  if (this.isVue3) {
188
96
  this.setModelValue();
189
97
  }
@@ -196,367 +104,472 @@ var ComponentBase = /** @class */ (function (_super) {
196
104
  this.assignValueToWrapper(childKey, false);
197
105
  }
198
106
  }
199
- };
200
- ComponentBase.prototype.beforeDestroy = function () {
201
- var tempBeforeDestroyThis = this;
202
- tempBeforeDestroyThis.ej2Instances.destroy();
203
- tempBeforeDestroyThis.$el.style.visibility = 'hidden';
204
- tempBeforeDestroyThis = null;
205
- };
206
- ComponentBase.prototype.bindProperties = function () {
207
- var options = {};
208
- for (var _i = 0, _a = this.propKeys; _i < _a.length; _i++) {
209
- var prop = _a[_i];
210
- if ((!isNullOrUndefined(this["" + prop]) && !this.isVue3) || (this[0] && !isNullOrUndefined(this[0][0]) && !isNullOrUndefined(this[0][0]["" + prop]))) {
211
- options["" + prop] = !this.isVue3 ? this["" + prop] : this[0][0]["" + prop];
212
- }
213
- }
214
- if (this.hasChildDirective) {
215
- this.fetchChildPropValues(options);
216
- }
217
- if (this.hasInjectedModules) {
218
- var prevModule = this.getInjectedServices() || [];
219
- var curModule = this.ej2Instances.getInjectedModules() || [];
220
- for (var _b = 0, curModule_2 = curModule; _b < curModule_2.length; _b++) {
221
- var mod = curModule_2[_b];
222
- if (prevModule.indexOf(mod) === -1) {
223
- prevModule.push(mod);
107
+ },
108
+ beforeDestroy: function () {
109
+ this.destroyComponent();
110
+ },
111
+ beforeUnmount: function () {
112
+ this.destroyComponent();
113
+ },
114
+ methods: {
115
+ setModelValue: function () {
116
+ if (!isNullOrUndefined(this.modelValue) || !isNullOrUndefined(this.$attrs.modelValue)) {
117
+ var key = this.models.toString().match(/checked|value/) || [];
118
+ var propKey = key[0];
119
+ if (!isNullOrUndefined(propKey)) {
120
+ this.ej2Instances["" + propKey] = !isNullOrUndefined(this.modelValue) ? this.modelValue : this.$attrs.modelValue;
224
121
  }
225
122
  }
226
- this.ej2Instances.injectedModules = prevModule;
227
- }
228
- this.assignValueToWrapper(options);
229
- };
230
- ComponentBase.prototype.assignValueToWrapper = function (option, silent) {
231
- this.ej2Instances.setProperties(extend({}, {}, option, true), isNullOrUndefined(silent) ? true : silent);
232
- };
233
- ComponentBase.prototype.fetchChildPropValues = function (childOption) {
234
- var dirProps = {};
235
- if (!this.isVue3) {
236
- dirProps = this.getDirectiveValues(this.$slots.default, this.tagMapper || {}, this.tagNameMapper || {});
237
- }
238
- else {
239
- var propRef = void 0;
240
- if (this[0] && this[0][1].slots.default) {
241
- propRef = this[0][1].slots.default();
123
+ },
124
+ getInjectedServices: function () {
125
+ var ret = [];
126
+ var provide;
127
+ if (this.$root && this.isDecorator) {
128
+ provide = getValue('$root.$options.provide', this);
242
129
  }
243
- else if (this && this.$ && this.$.slots && this.$.slots.default) {
244
- propRef = this.$.slots.default();
130
+ else if (this.$vnode) {
131
+ provide = getValue('$vnode.context.$options.provide', this);
245
132
  }
246
- if (propRef) {
247
- for (var i = 0; i < propRef.length; i++) {
248
- if (propRef[parseInt(i.toString(), 10)].type.methods || propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection') {
249
- var key = propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection' ? 'series-collection' :
250
- propRef[parseInt(i.toString(), 10)].type.methods.getTag().replace("e-", "");
251
- var ref = this.resolveArrayDirectives(propRef[parseInt(i.toString(), 10)].children, key);
252
- var splitKeys = key.split('-');
253
- var controlName = this.ej2Instances.getModuleName().toLowerCase();
254
- var keyRef = (splitKeys.length > 1 && controlName.indexOf(splitKeys[0]) > -1) ? splitKeys[1] : splitKeys[0];
255
- keyRef = keyRef.replace(controlName, '');
256
- if (controlName == "splitter" && keyRef == "panes") {
257
- keyRef = "paneSettings";
133
+ else if (this.$parent) {
134
+ provide = getValue('$parent.$options.provide', this);
135
+ }
136
+ if (isNullOrUndefined(provide) && !isNullOrUndefined(this.$)) {
137
+ provide = getValue('$.parent.provides', this);
138
+ }
139
+ if (provide) {
140
+ // tslint:disable:no-any
141
+ var injectables = provide;
142
+ if (typeof provide === 'function') {
143
+ if (provide.managed) {
144
+ var provideKey = provide.managed;
145
+ var provideValue = Object.keys(provideKey);
146
+ var key = void 0;
147
+ if (this.$root && this.isDecorator) {
148
+ key = Object.keys(this.$root);
258
149
  }
259
- else if (controlName == "bulletchart" && keyRef == "range") {
260
- keyRef = "ranges";
150
+ else if (this.$vnode) {
151
+ key = Object.keys(this.$vnode.context);
261
152
  }
262
- else if (controlName == "schedule" && keyRef == "header") {
263
- keyRef = "headerRows";
153
+ else if (this.$parent) {
154
+ key = Object.keys(this.$parent);
155
+ }
156
+ for (var i = 0; i < provideValue.length; i++) {
157
+ for (var j = 0; j < key.length; j++) {
158
+ if ((key[parseInt(j.toString(), 10)].indexOf(provideValue[parseInt(i.toString(), 10)])) !== -1) {
159
+ if (this.$root && this.isDecorator) {
160
+ provideKey[provideValue[parseInt(j.toString(), 10)]] = this.$root[key[parseInt(i.toString(), 10)]];
161
+ }
162
+ else if (this.$vnode) {
163
+ provideKey[provideValue[parseInt(i.toString(), 10)]] = this.$vnode.context[key[parseInt(j.toString(), 10)]];
164
+ }
165
+ else if (this.$parent) {
166
+ provideKey[provideValue[parseInt(i.toString(), 10)]] = this.$parent[key[parseInt(j.toString(), 10)]];
167
+ }
168
+ injectables = provideKey;
169
+ }
170
+ }
264
171
  }
265
- dirProps["" + keyRef] = ref["" + key];
172
+ }
173
+ // tslint:disable:no-any
174
+ else if (this.$vnode) {
175
+ injectables = this.$vnode.context.$options.provide();
176
+ }
177
+ else if (this.$parent) {
178
+ injectables = this.$parent.$options.provide();
266
179
  }
267
180
  }
268
- }
269
- else {
270
- return;
271
- }
272
- }
273
- if (!this.childDirObjects) {
274
- this.childDirObjects = JSON.stringify(dirProps);
275
- }
276
- for (var _i = 0, _a = Object.keys(dirProps); _i < _a.length; _i++) {
277
- var dirProp = _a[_i];
278
- childOption["" + dirProp] = dirProps["" + dirProp];
279
- }
280
- };
281
- ComponentBase.prototype.resolveArrayDirectives = function (slots, tagName) {
282
- var slot = [];
283
- var innerDirValues;
284
- slot = slots.default ? slots.default() : slots;
285
- var items = {};
286
- items["" + tagName] = [];
287
- var _loop_2 = function (childSlot) {
288
- var tempObj = {};
289
- var tagRef = childSlot.type.methods ? childSlot.type.methods.getTag() : tagName;
290
- if (childSlot.children) {
291
- var key = void 0;
292
- innerDirValues = this_2.resolveComplexDirs(childSlot.children, this_2.tagMapper["e-" + tagName], tagRef);
293
- if (innerDirValues.length) {
294
- tempObj = innerDirValues;
181
+ ret = injectables[this.ej2Instances.getModuleName()] || [];
182
+ }
183
+ this.isDecorator = false;
184
+ return ret;
185
+ },
186
+ destroyComponent: function () {
187
+ var tempBeforeDestroyThis = this;
188
+ tempBeforeDestroyThis.ej2Instances.destroy();
189
+ tempBeforeDestroyThis.$el.style.visibility = 'hidden';
190
+ tempBeforeDestroyThis = null;
191
+ },
192
+ bindProperties: function () {
193
+ var options = {};
194
+ for (var _i = 0, _a = this.propKeys; _i < _a.length; _i++) {
195
+ var prop = _a[_i];
196
+ if (!isNullOrUndefined(this["" + prop])) {
197
+ options["" + prop] = this["" + prop];
295
198
  }
296
- else {
297
- for (var i = 0; i < Object.keys(innerDirValues).length; i++) {
298
- key = Object.keys(innerDirValues)[parseInt(i.toString(), 10)];
299
- tempObj["" + key] = innerDirValues["" + key];
300
- }
301
- ;
199
+ else if (this[0] && !isNullOrUndefined(this[0][0]) && !isNullOrUndefined(this[0][0]["" + prop])) {
200
+ options["" + prop] = this[0][0]["" + prop];
302
201
  }
303
202
  }
304
- if (childSlot.props) {
305
- Object.keys(childSlot.props).forEach(function (key) {
306
- var propName = key.replace(/-[a-z]/g, function (e) { return e[1].toUpperCase(); });
307
- if (propName) {
308
- tempObj["" + propName] = childSlot.props["" + key];
309
- }
310
- });
311
- }
312
- if (((/[s]\b/).test(tagRef) && innerDirValues) && (!(/[s]\b/).test(tagName) || innerDirValues.length)) {
313
- items["" + tagName] = tempObj;
314
- }
315
- else if (tempObj && Object.keys(tempObj).length !== 0) {
316
- items["" + tagName].push(tempObj);
203
+ if (this.hasChildDirective) {
204
+ this.fetchChildPropValues(options);
317
205
  }
318
- };
319
- var this_2 = this;
320
- for (var _i = 0, slot_1 = slot; _i < slot_1.length; _i++) {
321
- var childSlot = slot_1[_i];
322
- _loop_2(childSlot);
323
- }
324
- return items;
325
- };
326
- ComponentBase.prototype.resolveComplexDirs = function (slots, tagObject, tagName) {
327
- var slot = [];
328
- var innerDirValues;
329
- slot = slots.default ? slots.default() : slots;
330
- var items = {};
331
- var _loop_3 = function (childSlot) {
332
- var tagRef = void 0;
333
- var tag = void 0;
334
- if (tagObject["" + tagName]) {
335
- tagRef = Object.keys(tagObject["" + tagName]);
336
- tag = tagRef.find(function (key) {
337
- return tagObject["" + tagName]["" + key] ===
338
- childSlot.type.methods.getTag().replace(/[s]\b/, "");
339
- });
340
- tag = tag
341
- ? tag.replace("e-", "")
342
- : childSlot.type.methods.getTag().replace("e-", "");
343
- if (this_3.ej2Instances.getModuleName().toLowerCase() == "diagram" && tag.indexOf('annotations') != -1) {
344
- tag = 'annotations';
206
+ if (this.hasInjectedModules) {
207
+ var prevModule = this.getInjectedServices() || [];
208
+ var curModule = this.ej2Instances.getInjectedModules() || [];
209
+ for (var _b = 0, curModule_2 = curModule; _b < curModule_2.length; _b++) {
210
+ var mod = curModule_2[_b];
211
+ if (prevModule.indexOf(mod) === -1) {
212
+ prevModule.push(mod);
213
+ }
345
214
  }
215
+ this.ej2Instances.injectedModules = prevModule;
216
+ }
217
+ this.assignValueToWrapper(options);
218
+ },
219
+ assignValueToWrapper: function (option, silent) {
220
+ this.ej2Instances.setProperties(extend({}, {}, option, true), isNullOrUndefined(silent) ? true : silent);
221
+ },
222
+ fetchChildPropValues: function (childOption) {
223
+ var dirProps = {};
224
+ if (!this.isVue3) {
225
+ dirProps = this.getDirectiveValues(this.$slots.default, this.tagMapper || {}, this.tagNameMapper || {});
346
226
  }
347
- if (childSlot.children) {
348
- innerDirValues = this_3.resolveComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
349
- if (!items["" + tag]) {
350
- items["" + tag] = [];
227
+ else {
228
+ var propRef = void 0;
229
+ if (this[0] && this[0][1].slots.default) {
230
+ propRef = this[0][1].slots.default();
351
231
  }
352
- if (innerDirValues.length > 1) {
353
- items["" + tag] = innerDirValues;
232
+ else if (this && this.$ && this.$.slots && this.$.slots.default) {
233
+ propRef = this.$.slots.default();
234
+ }
235
+ if (propRef) {
236
+ for (var i = 0; i < propRef.length; i++) {
237
+ if (propRef[parseInt(i.toString(), 10)].type.methods || propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection') {
238
+ var key = propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection' ? 'series-collection' :
239
+ propRef[parseInt(i.toString(), 10)].type.methods.getTag().replace("e-", "");
240
+ var ref = this.resolveArrayDirectives(propRef[parseInt(i.toString(), 10)].children, key);
241
+ var splitKeys = key.split('-');
242
+ var controlName = this.ej2Instances.getModuleName().toLowerCase();
243
+ var keyRef = (splitKeys.length > 1 && controlName.indexOf(splitKeys[0]) > -1) ? splitKeys[1] : splitKeys[0];
244
+ keyRef = keyRef.replace(controlName, '');
245
+ if (controlName == "splitter" && keyRef == "panes") {
246
+ keyRef = "paneSettings";
247
+ }
248
+ else if (controlName == "bulletchart" && keyRef == "range") {
249
+ keyRef = "ranges";
250
+ }
251
+ else if (controlName == "schedule" && keyRef == "header") {
252
+ keyRef = "headerRows";
253
+ }
254
+ dirProps["" + keyRef] = ref["" + key];
255
+ }
256
+ }
354
257
  }
355
258
  else {
356
- items["" + tag].push(innerDirValues);
259
+ return;
357
260
  }
358
261
  }
359
- if (childSlot.props) {
360
- childSlot.props = this_3.getCamelCaseProps(childSlot.props);
361
- }
362
- if (slot.length > 1) {
363
- items = Object.keys(items).length == 0 && !items.length ? [] : items;
262
+ if (!this.childDirObjects) {
263
+ this.childDirObjects = JSON.stringify(dirProps);
264
+ }
265
+ for (var _i = 0, _a = Object.keys(dirProps); _i < _a.length; _i++) {
266
+ var dirProp = _a[_i];
267
+ childOption["" + dirProp] = dirProps["" + dirProp];
268
+ }
269
+ },
270
+ resolveArrayDirectives: function (slots, tagName) {
271
+ var slot = [];
272
+ var innerDirValues;
273
+ slot = slots.default ? slots.default() : slots;
274
+ var items = {};
275
+ items["" + tagName] = [];
276
+ var _loop_2 = function (childSlot) {
277
+ var tempObj = {};
278
+ var tagRef = childSlot.type.methods ? childSlot.type.methods.getTag() : tagName;
279
+ if (childSlot.children) {
280
+ var key = void 0;
281
+ innerDirValues = this_2.resolveComplexDirs(childSlot.children, this_2.tagMapper["e-" + tagName], tagRef);
282
+ if (innerDirValues.length) {
283
+ tempObj = innerDirValues;
284
+ }
285
+ else {
286
+ for (var i = 0; i < Object.keys(innerDirValues).length; i++) {
287
+ key = Object.keys(innerDirValues)[parseInt(i.toString(), 10)];
288
+ tempObj["" + key] = innerDirValues["" + key];
289
+ }
290
+ }
291
+ }
364
292
  if (childSlot.props) {
365
- items.push(childSlot.props);
293
+ Object.keys(childSlot.props).forEach(function (key) {
294
+ var propName = key.replace(/-[a-z]/g, function (e) { return e[1].toUpperCase(); });
295
+ if (propName) {
296
+ tempObj["" + propName] = childSlot.props["" + key];
297
+ }
298
+ });
366
299
  }
367
- }
368
- else {
369
- items = childSlot.props ? Object.assign(items, childSlot.props) : items;
370
- }
371
- };
372
- var this_3 = this;
373
- for (var _i = 0, slot_2 = slot; _i < slot_2.length; _i++) {
374
- var childSlot = slot_2[_i];
375
- _loop_3(childSlot);
376
- }
377
- return items;
378
- };
379
- ComponentBase.prototype.resolveComplexInnerDirs = function (slots, tagObject, tagName) {
380
- var slot = [];
381
- var innerDirValues;
382
- slot = slots.default ? slots.default() : slots;
383
- var items = slot.length > 1 ? [] : {};
384
- for (var _i = 0, slot_3 = slot; _i < slot_3.length; _i++) {
385
- var childSlot = slot_3[_i];
386
- var tag = childSlot.type.methods.getTag().replace("e-", "");
387
- if (childSlot.children) {
388
- innerDirValues = this.resolveMultilevelComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
389
- if ((/[s]\b/).test(tag) || slot.length > 1) {
390
- if ((/[s]\b/).test(tag)) {
391
- items["" + tag] = !items["" + tag] ? [] : items["" + tag];
392
- if (innerDirValues.length) {
393
- items["" + tag] = innerDirValues;
300
+ if (((/[s]\b/).test(tagRef) && innerDirValues) && (!(/[s]\b/).test(tagName) || innerDirValues.length)) {
301
+ items["" + tagName] = tempObj;
302
+ }
303
+ else if (tempObj && Object.keys(tempObj).length !== 0) {
304
+ items["" + tagName].push(tempObj);
305
+ }
306
+ };
307
+ var this_2 = this;
308
+ for (var _i = 0, slot_1 = slot; _i < slot_1.length; _i++) {
309
+ var childSlot = slot_1[_i];
310
+ _loop_2(childSlot);
311
+ }
312
+ return items;
313
+ },
314
+ resolveComplexDirs: function (slots, tagObject, tagName) {
315
+ var slot = [];
316
+ var innerDirValues;
317
+ slot = slots.default ? slots.default() : slots;
318
+ var items = {};
319
+ var _loop_3 = function (childSlot) {
320
+ var tagRef = void 0;
321
+ var tag = void 0;
322
+ if (tagObject["" + tagName]) {
323
+ tagRef = Object.keys(tagObject["" + tagName]);
324
+ tag = tagRef.find(function (key) {
325
+ return tagObject["" + tagName]["" + key] ===
326
+ childSlot.type.methods.getTag().replace(/[s]\b/, "");
327
+ });
328
+ var moduleName = this_3.ej2Instances.getModuleName().toLowerCase();
329
+ tag = tag
330
+ ? tag.replace("e-", "")
331
+ : childSlot.type.methods.getTag().replace(moduleName === "ribbon" ? "e-ribbon-" : "e-", "");
332
+ if (this_3.ej2Instances.getModuleName().toLowerCase() == "diagram" && tag.indexOf('annotations') != -1) {
333
+ tag = 'annotations';
334
+ }
335
+ }
336
+ if (childSlot.children) {
337
+ innerDirValues = this_3.resolveComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
338
+ if (!items["" + tag]) {
339
+ items["" + tag] = [];
340
+ }
341
+ if (innerDirValues.length > 1) {
342
+ items["" + tag] = innerDirValues;
343
+ }
344
+ else {
345
+ items["" + tag].push(innerDirValues);
346
+ }
347
+ }
348
+ if (childSlot.props) {
349
+ childSlot.props = this_3.getCamelCaseProps(childSlot.props);
350
+ }
351
+ if (slot.length > 1) {
352
+ items = Object.keys(items).length == 0 && !items.length ? [] : items;
353
+ if (childSlot.props) {
354
+ items.push(childSlot.props);
355
+ }
356
+ }
357
+ else {
358
+ items = childSlot.props ? Object.assign(items, childSlot.props) : items;
359
+ }
360
+ };
361
+ var this_3 = this;
362
+ for (var _i = 0, slot_2 = slot; _i < slot_2.length; _i++) {
363
+ var childSlot = slot_2[_i];
364
+ _loop_3(childSlot);
365
+ }
366
+ return items;
367
+ },
368
+ resolveComplexInnerDirs: function (slots, tagObject, tagName) {
369
+ var slot = [];
370
+ var innerDirValues;
371
+ slot = slots.default ? slots.default() : slots;
372
+ var items = slot.length > 1 ? [] : {};
373
+ for (var _i = 0, slot_3 = slot; _i < slot_3.length; _i++) {
374
+ var childSlot = slot_3[_i];
375
+ var isRibbon = (this.ej2Instances.getModuleName().toLowerCase() == "ribbon");
376
+ var tag = childSlot.type.methods.getTag().replace(isRibbon ? "e-ribbon-" : "e-", "");
377
+ if (childSlot.children) {
378
+ innerDirValues = this.resolveMultilevelComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
379
+ if ((/[s]\b/).test(tag) || slot.length > 1) {
380
+ if ((/[s]\b/).test(tag)) {
381
+ items["" + tag] = !items["" + tag] ? [] : items["" + tag];
382
+ if (innerDirValues.length) {
383
+ items["" + tag] = innerDirValues;
384
+ }
385
+ else {
386
+ items["" + tag].push(innerDirValues);
387
+ }
394
388
  }
395
- else {
396
- items["" + tag].push(innerDirValues);
389
+ else if (innerDirValues && !(isRibbon && innerDirValues.hasOwnProperty('collections'))) {
390
+ items.push(innerDirValues);
397
391
  }
398
392
  }
399
- else if (innerDirValues) {
400
- items.push(innerDirValues);
393
+ else {
394
+ items = innerDirValues ? innerDirValues : items;
401
395
  }
402
396
  }
403
- else {
404
- items = innerDirValues ? innerDirValues : items;
397
+ if (childSlot.props) {
398
+ childSlot.props = this.getCamelCaseProps(childSlot.props);
405
399
  }
406
- }
407
- if (childSlot.props) {
408
- childSlot.props = this.getCamelCaseProps(childSlot.props);
409
- }
410
- if (slot.length > 1 && childSlot.props) {
411
- if (items.length >= 0) {
412
- items.push(childSlot.props);
400
+ if (slot.length > 1 && childSlot.props) {
401
+ if (isRibbon && innerDirValues && innerDirValues.hasOwnProperty('collections')) {
402
+ innerDirValues = childSlot.props ? Object.assign(innerDirValues, childSlot.props) : innerDirValues;
403
+ items.push(innerDirValues);
404
+ }
405
+ else if (items.length >= 0) {
406
+ items.push(childSlot.props);
407
+ }
408
+ else {
409
+ items = childSlot.props ? Object.assign(items, childSlot.props) : items;
410
+ }
413
411
  }
414
412
  else {
415
413
  items = childSlot.props ? Object.assign(items, childSlot.props) : items;
416
414
  }
417
415
  }
418
- else {
419
- items = childSlot.props ? Object.assign(items, childSlot.props) : items;
420
- }
421
- }
422
- return items;
423
- };
424
- ComponentBase.prototype.resolveMultilevelComplexInnerDirs = function (slots, tagObject, tagName) {
425
- var slot = [];
426
- var innerDirValues;
427
- slot = slots.default ? slots.default() : slots;
428
- var items = slot.length > 1 ? [] : {};
429
- for (var _i = 0, slot_4 = slot; _i < slot_4.length; _i++) {
430
- var childSlot = slot_4[_i];
431
- var tag = childSlot.type.methods.getTag().replace("e-", "");
432
- if (childSlot.children) {
433
- innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
434
- }
435
- if (childSlot.props) {
436
- childSlot.props = this.getCamelCaseProps(childSlot.props);
437
- }
438
- if ((/[s]\b/).test(tag)) {
439
- items["" + tag] = !items["" + tag] ? [] : items["" + tag];
440
- if (innerDirValues.length) {
441
- items["" + tag] = innerDirValues;
442
- }
443
- else {
444
- items["" + tag].push(innerDirValues);
416
+ return items;
417
+ },
418
+ resolveMultilevelComplexInnerDirs: function (slots, tagObject, tagName) {
419
+ var slot = [];
420
+ var innerDirValues;
421
+ slot = slots.default ? slots.default() : slots;
422
+ var items = slot.length > 1 ? [] : {};
423
+ for (var _i = 0, slot_4 = slot; _i < slot_4.length; _i++) {
424
+ var childSlot = slot_4[_i];
425
+ var moduleName = this.ej2Instances.getModuleName().toLowerCase();
426
+ var tag = childSlot.type.methods.getTag().replace(moduleName === "ribbon" ? "e-ribbon-" : "e-", "");
427
+ if (childSlot.children) {
428
+ innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
445
429
  }
446
430
  if (childSlot.props) {
447
- items["" + tag].push(childSlot.props);
431
+ childSlot.props = this.getCamelCaseProps(childSlot.props);
432
+ }
433
+ if ((/[s]\b/).test(tag)) {
434
+ items["" + tag] = !items["" + tag] ? [] : items["" + tag];
435
+ if (innerDirValues.length) {
436
+ items["" + tag] = innerDirValues;
437
+ }
438
+ else {
439
+ items["" + tag].push(innerDirValues);
440
+ }
441
+ if (childSlot.props) {
442
+ items["" + tag].push(childSlot.props);
443
+ }
444
+ }
445
+ else {
446
+ items = innerDirValues;
447
+ items = childSlot.props ? Object.assign(items, childSlot.props) : items;
448
448
  }
449
449
  }
450
- else {
451
- items = innerDirValues;
452
- items = childSlot.props ? Object.assign(items, childSlot.props) : items;
453
- }
454
- }
455
- return items;
456
- };
457
- ComponentBase.prototype.getDirectiveValues = function (tagDirectives, tagMapper, tagNameMapper) {
458
- var keyTags = Object.keys(tagMapper);
459
- var dir = {};
460
- if (tagDirectives) {
461
- for (var _i = 0, tagDirectives_1 = tagDirectives; _i < tagDirectives_1.length; _i++) {
462
- var tagDirective = tagDirectives_1[_i];
463
- if (tagDirective.componentOptions && tagDirective.componentOptions.children && tagDirective.componentOptions.tag ||
464
- (tagDirective.tag === 'e-seriescollection' && tagDirective.children)) {
465
- var dirTag = tagDirective.componentOptions ? tagDirective.componentOptions.tag : tagDirective.tag;
466
- dirTag = (dirTag === 'e-seriescollection') ? 'e-seriesCollection' : dirTag;
467
- if (keyTags.indexOf(dirTag) !== -1) {
468
- var tagName = tagNameMapper["" + dirTag] ? tagNameMapper["" + dirTag] : dirTag;
469
- dir[tagName.replace('e-', '')] = [];
470
- var children = tagDirective.componentOptions ? tagDirective.componentOptions.children : tagDirective.children;
471
- for (var _a = 0, children_1 = children; _a < children_1.length; _a++) {
472
- var tagDirChild = children_1[_a];
473
- var retObj = this.getVNodeValue(tagDirChild, tagMapper["" + dirTag], tagNameMapper);
474
- if (Object.keys(retObj).length !== 0) {
475
- dir[tagName.replace('e-', '')].push(retObj);
450
+ return items;
451
+ },
452
+ getDirectiveValues: function (tagDirectives, tagMapper, tagNameMapper) {
453
+ var keyTags = Object.keys(tagMapper);
454
+ var dir = {};
455
+ if (tagDirectives) {
456
+ for (var _i = 0, tagDirectives_1 = tagDirectives; _i < tagDirectives_1.length; _i++) {
457
+ var tagDirective = tagDirectives_1[_i];
458
+ if (tagDirective.componentOptions && tagDirective.componentOptions.children && tagDirective.componentOptions.tag ||
459
+ (tagDirective.tag === 'e-seriescollection' && tagDirective.children)) {
460
+ var dirTag = tagDirective.componentOptions ? tagDirective.componentOptions.tag : tagDirective.tag;
461
+ dirTag = (dirTag === 'e-seriescollection') ? 'e-seriesCollection' : dirTag;
462
+ if (keyTags.indexOf(dirTag) !== -1) {
463
+ var tagName = tagNameMapper["" + dirTag] ? tagNameMapper["" + dirTag] : dirTag;
464
+ dir[tagName.replace('e-', '')] = [];
465
+ var children = tagDirective.componentOptions ? tagDirective.componentOptions.children : tagDirective.children;
466
+ for (var _a = 0, children_1 = children; _a < children_1.length; _a++) {
467
+ var tagDirChild = children_1[_a];
468
+ var retObj = this.getVNodeValue(tagDirChild, tagMapper["" + dirTag], tagNameMapper);
469
+ if (Object.keys(retObj).length !== 0) {
470
+ dir[tagName.replace('e-', '')].push(retObj);
471
+ }
476
472
  }
477
473
  }
478
474
  }
479
475
  }
480
476
  }
481
- }
482
- return dir;
483
- };
484
- ComponentBase.prototype.getMultiLevelDirValue = function (tagDirectories, tagKey, tagNameMapper) {
485
- var mulObj = {};
486
- for (var _i = 0, tagDirectories_1 = tagDirectories; _i < tagDirectories_1.length; _i++) {
487
- var tagDir = tagDirectories_1[_i];
488
- var key = void 0;
489
- var children = void 0;
490
- if (tagDir.componentOptions) {
491
- key = tagDir.componentOptions.tag;
492
- if (tagDir.componentOptions.children) {
493
- children = tagDir.componentOptions.children;
477
+ return dir;
478
+ },
479
+ getMultiLevelDirValue: function (tagDirectories, tagKey, tagNameMapper) {
480
+ var mulObj = {};
481
+ for (var _i = 0, tagDirectories_1 = tagDirectories; _i < tagDirectories_1.length; _i++) {
482
+ var tagDir = tagDirectories_1[_i];
483
+ var key = void 0;
484
+ var children = void 0;
485
+ if (tagDir.componentOptions) {
486
+ key = tagDir.componentOptions.tag;
487
+ if (tagDir.componentOptions.children) {
488
+ children = tagDir.componentOptions.children;
489
+ }
494
490
  }
495
- }
496
- else if ((tagDir.tag === 'e-markersettings' || tagDir.tag === 'e-markersetting') && tagDir.children) {
497
- key = (tagDir.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
498
- children = tagDir.children;
499
- }
500
- if (key) {
501
- var tagName = tagNameMapper["" + key] ? tagNameMapper["" + key] : key;
502
- mulObj[tagName.replace('e-', '')] = [];
503
- if (children) {
504
- for (var _a = 0, children_2 = children; _a < children_2.length; _a++) {
505
- var tagDirChild = children_2[_a];
506
- var mulLevObj = this.getVNodeValue(tagDirChild, tagKey["" + key], tagNameMapper);
507
- if (Object.keys(mulLevObj).length !== 0) {
508
- mulObj[tagName.replace('e-', '')].push(mulLevObj);
491
+ else if ((tagDir.tag === 'e-markersettings' || tagDir.tag === 'e-markersetting') && tagDir.children) {
492
+ key = (tagDir.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
493
+ children = tagDir.children;
494
+ }
495
+ if (key) {
496
+ var tagName = tagNameMapper["" + key] ? tagNameMapper["" + key] : key;
497
+ mulObj[tagName.replace('e-', '')] = [];
498
+ if (children) {
499
+ for (var _a = 0, children_2 = children; _a < children_2.length; _a++) {
500
+ var tagDirChild = children_2[_a];
501
+ var mulLevObj = this.getVNodeValue(tagDirChild, tagKey["" + key], tagNameMapper);
502
+ if (Object.keys(mulLevObj).length !== 0) {
503
+ mulObj[tagName.replace('e-', '')].push(mulLevObj);
504
+ }
509
505
  }
510
506
  }
511
507
  }
512
508
  }
513
- }
514
- return mulObj;
515
- };
516
- ComponentBase.prototype.getVNodeValue = function (tagDirective, tagKey, tagNameMapper) {
517
- var ret = {};
518
- if (tagDirective.componentOptions || ((tagDirective.tag === 'e-markersettings' || tagDirective.tag === 'e-markersetting') && tagDirective.context)) {
519
- var dirTag = void 0;
520
- if (tagDirective.componentOptions) {
521
- dirTag = tagDirective.componentOptions.tag;
522
- }
523
- else {
524
- dirTag = (tagDirective.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
525
- }
526
- if (typeof tagKey === 'string' && dirTag === tagKey && tagDirective.data) {
527
- ret = tagDirective.data.attrs ? this.getCamelCaseProps(tagDirective.data.attrs) : this.getCamelCaseProps(tagDirective.data);
528
- }
529
- else if (typeof tagKey === 'object') {
530
- if (tagDirective.componentOptions.children && (Object.keys(tagKey).indexOf(dirTag) !== -1)) {
531
- ret = this.getMultiLevelDirValue(tagDirective.componentOptions.children, tagKey["" + dirTag], tagNameMapper);
509
+ return mulObj;
510
+ },
511
+ getVNodeValue: function (tagDirective, tagKey, tagNameMapper) {
512
+ var ret = {};
513
+ if (tagDirective.componentOptions || ((tagDirective.tag === 'e-markersettings' || tagDirective.tag === 'e-markersetting') && tagDirective.context)) {
514
+ var dirTag = void 0;
515
+ if (tagDirective.componentOptions) {
516
+ dirTag = tagDirective.componentOptions.tag;
532
517
  }
533
- else if (tagDirective.children && (Object.keys(tagKey).indexOf(dirTag) !== -1) && (dirTag === 'e-markersettings' || dirTag === 'e-markersetting')) {
534
- ret = this.getMultiLevelDirValue(tagDirective.children, tagKey["" + dirTag], tagNameMapper);
518
+ else {
519
+ dirTag = (tagDirective.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
535
520
  }
536
- if (tagDirective.data && tagDirective.data.attrs) {
537
- ret = extend(ret, this.getCamelCaseProps(tagDirective.data.attrs));
521
+ if (typeof tagKey === 'string' && dirTag === tagKey && tagDirective.data) {
522
+ ret = tagDirective.data.attrs ? this.getCamelCaseProps(tagDirective.data.attrs) : this.getCamelCaseProps(tagDirective.data);
523
+ }
524
+ else if (typeof tagKey === 'object') {
525
+ if (tagDirective.componentOptions.children && (Object.keys(tagKey).indexOf(dirTag) !== -1)) {
526
+ ret = this.getMultiLevelDirValue(tagDirective.componentOptions.children, tagKey["" + dirTag], tagNameMapper);
527
+ }
528
+ else if (tagDirective.children && (Object.keys(tagKey).indexOf(dirTag) !== -1) && (dirTag === 'e-markersettings' || dirTag === 'e-markersetting')) {
529
+ ret = this.getMultiLevelDirValue(tagDirective.children, tagKey["" + dirTag], tagNameMapper);
530
+ }
531
+ if (tagDirective.data && tagDirective.data.attrs) {
532
+ ret = extend(ret, this.getCamelCaseProps(tagDirective.data.attrs));
533
+ }
538
534
  }
539
535
  }
540
- }
541
- return ret;
542
- };
543
- /**
544
- * convert kebab case directive props to camel case
545
- */
546
- ComponentBase.prototype.getCamelCaseProps = function (props) {
547
- var retProps = {};
548
- for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {
536
+ return ret;
537
+ },
538
+ /**
539
+ * convert kebab case directive props to camel case
540
+ */
541
+ getCamelCaseProps: function (props) {
542
+ var retProps = {};
543
+ for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {
544
+ var prop = _a[_i];
545
+ retProps[prop.replace(/-[a-z]/g, function (e) { return e[1].toUpperCase(); })] = props["" + prop];
546
+ }
547
+ return retProps;
548
+ },
549
+ dataBind: function () {
550
+ this.ej2Instances.dataBind();
551
+ },
552
+ setProperties: function (arg, muteOnChange) {
553
+ return this.ej2Instances.setProperties(arg, muteOnChange);
554
+ },
555
+ }
556
+ });
557
+ export function getProps(options) {
558
+ if (options === void 0) { options = {}; }
559
+ if (options.props) {
560
+ var _loop_4 = function (prop) {
561
+ (options.newprops || (options.newprops = {}))["" + prop] = {};
562
+ (options.watch || (options.watch = {}))["" + prop] = function (newVal) {
563
+ this.ej2Instances["" + prop] = newVal;
564
+ if (this.dataBind && (options.name !== 'DateRangePickerComponent')) {
565
+ this.dataBind();
566
+ }
567
+ };
568
+ };
569
+ for (var _i = 0, _a = options.props; _i < _a.length; _i++) {
549
570
  var prop = _a[_i];
550
- retProps[prop.replace(/-[a-z]/g, function (e) { return e[1].toUpperCase(); })] = props["" + prop];
571
+ _loop_4(prop);
551
572
  }
552
- return retProps;
553
- };
554
- ComponentBase.prototype.dataBind = function () {
555
- this.ej2Instances.dataBind();
556
- };
557
- ComponentBase.prototype.setProperties = function (arg, muteOnChange) {
558
- return this.ej2Instances.setProperties(arg, muteOnChange);
559
- };
560
- return ComponentBase;
561
- }(vueImport));
562
- export { ComponentBase };
573
+ }
574
+ return [options.newprops, options.watch];
575
+ }