@syncfusion/ej2-vue-base 20.4.51 → 21.1.36

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,373 +104,472 @@ var ComponentBase = /** @class */ (function (_super) {
196
104
  this.assignValueToWrapper(childKey, false);
197
105
  }
198
106
  }
199
- };
200
- ComponentBase.prototype.beforeDestroy = function () {
107
+ },
108
+ beforeDestroy: function () {
201
109
  this.destroyComponent();
202
- };
203
- ComponentBase.prototype.beforeUnmount = function () {
110
+ },
111
+ beforeUnmount: function () {
204
112
  this.destroyComponent();
205
- };
206
- ComponentBase.prototype.destroyComponent = function () {
207
- var tempBeforeDestroyThis = this;
208
- tempBeforeDestroyThis.ej2Instances.destroy();
209
- tempBeforeDestroyThis.$el.style.visibility = 'hidden';
210
- tempBeforeDestroyThis = null;
211
- };
212
- ComponentBase.prototype.bindProperties = function () {
213
- var options = {};
214
- for (var _i = 0, _a = this.propKeys; _i < _a.length; _i++) {
215
- var prop = _a[_i];
216
- if ((!isNullOrUndefined(this["" + prop]) && !this.isVue3) || (this[0] && !isNullOrUndefined(this[0][0]) && !isNullOrUndefined(this[0][0]["" + prop]))) {
217
- options["" + prop] = !this.isVue3 ? this["" + prop] : this[0][0]["" + prop];
218
- }
219
- }
220
- if (this.hasChildDirective) {
221
- this.fetchChildPropValues(options);
222
- }
223
- if (this.hasInjectedModules) {
224
- var prevModule = this.getInjectedServices() || [];
225
- var curModule = this.ej2Instances.getInjectedModules() || [];
226
- for (var _b = 0, curModule_2 = curModule; _b < curModule_2.length; _b++) {
227
- var mod = curModule_2[_b];
228
- if (prevModule.indexOf(mod) === -1) {
229
- prevModule.push(mod);
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;
230
121
  }
231
122
  }
232
- this.ej2Instances.injectedModules = prevModule;
233
- }
234
- this.assignValueToWrapper(options);
235
- };
236
- ComponentBase.prototype.assignValueToWrapper = function (option, silent) {
237
- this.ej2Instances.setProperties(extend({}, {}, option, true), isNullOrUndefined(silent) ? true : silent);
238
- };
239
- ComponentBase.prototype.fetchChildPropValues = function (childOption) {
240
- var dirProps = {};
241
- if (!this.isVue3) {
242
- dirProps = this.getDirectiveValues(this.$slots.default, this.tagMapper || {}, this.tagNameMapper || {});
243
- }
244
- else {
245
- var propRef = void 0;
246
- if (this[0] && this[0][1].slots.default) {
247
- 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);
248
129
  }
249
- else if (this && this.$ && this.$.slots && this.$.slots.default) {
250
- propRef = this.$.slots.default();
130
+ else if (this.$vnode) {
131
+ provide = getValue('$vnode.context.$options.provide', this);
251
132
  }
252
- if (propRef) {
253
- for (var i = 0; i < propRef.length; i++) {
254
- if (propRef[parseInt(i.toString(), 10)].type.methods || propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection') {
255
- var key = propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection' ? 'series-collection' :
256
- propRef[parseInt(i.toString(), 10)].type.methods.getTag().replace("e-", "");
257
- var ref = this.resolveArrayDirectives(propRef[parseInt(i.toString(), 10)].children, key);
258
- var splitKeys = key.split('-');
259
- var controlName = this.ej2Instances.getModuleName().toLowerCase();
260
- var keyRef = (splitKeys.length > 1 && controlName.indexOf(splitKeys[0]) > -1) ? splitKeys[1] : splitKeys[0];
261
- keyRef = keyRef.replace(controlName, '');
262
- if (controlName == "splitter" && keyRef == "panes") {
263
- 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);
264
149
  }
265
- else if (controlName == "bulletchart" && keyRef == "range") {
266
- keyRef = "ranges";
150
+ else if (this.$vnode) {
151
+ key = Object.keys(this.$vnode.context);
267
152
  }
268
- else if (controlName == "schedule" && keyRef == "header") {
269
- 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
+ }
270
171
  }
271
- 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();
272
179
  }
273
180
  }
274
- }
275
- else {
276
- return;
277
- }
278
- }
279
- if (!this.childDirObjects) {
280
- this.childDirObjects = JSON.stringify(dirProps);
281
- }
282
- for (var _i = 0, _a = Object.keys(dirProps); _i < _a.length; _i++) {
283
- var dirProp = _a[_i];
284
- childOption["" + dirProp] = dirProps["" + dirProp];
285
- }
286
- };
287
- ComponentBase.prototype.resolveArrayDirectives = function (slots, tagName) {
288
- var slot = [];
289
- var innerDirValues;
290
- slot = slots.default ? slots.default() : slots;
291
- var items = {};
292
- items["" + tagName] = [];
293
- var _loop_2 = function (childSlot) {
294
- var tempObj = {};
295
- var tagRef = childSlot.type.methods ? childSlot.type.methods.getTag() : tagName;
296
- if (childSlot.children) {
297
- var key = void 0;
298
- innerDirValues = this_2.resolveComplexDirs(childSlot.children, this_2.tagMapper["e-" + tagName], tagRef);
299
- if (innerDirValues.length) {
300
- 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];
301
198
  }
302
- else {
303
- for (var i = 0; i < Object.keys(innerDirValues).length; i++) {
304
- key = Object.keys(innerDirValues)[parseInt(i.toString(), 10)];
305
- tempObj["" + key] = innerDirValues["" + key];
306
- }
307
- ;
199
+ else if (this[0] && !isNullOrUndefined(this[0][0]) && !isNullOrUndefined(this[0][0]["" + prop])) {
200
+ options["" + prop] = this[0][0]["" + prop];
308
201
  }
309
202
  }
310
- if (childSlot.props) {
311
- Object.keys(childSlot.props).forEach(function (key) {
312
- var propName = key.replace(/-[a-z]/g, function (e) { return e[1].toUpperCase(); });
313
- if (propName) {
314
- tempObj["" + propName] = childSlot.props["" + key];
315
- }
316
- });
317
- }
318
- if (((/[s]\b/).test(tagRef) && innerDirValues) && (!(/[s]\b/).test(tagName) || innerDirValues.length)) {
319
- items["" + tagName] = tempObj;
320
- }
321
- else if (tempObj && Object.keys(tempObj).length !== 0) {
322
- items["" + tagName].push(tempObj);
203
+ if (this.hasChildDirective) {
204
+ this.fetchChildPropValues(options);
323
205
  }
324
- };
325
- var this_2 = this;
326
- for (var _i = 0, slot_1 = slot; _i < slot_1.length; _i++) {
327
- var childSlot = slot_1[_i];
328
- _loop_2(childSlot);
329
- }
330
- return items;
331
- };
332
- ComponentBase.prototype.resolveComplexDirs = function (slots, tagObject, tagName) {
333
- var slot = [];
334
- var innerDirValues;
335
- slot = slots.default ? slots.default() : slots;
336
- var items = {};
337
- var _loop_3 = function (childSlot) {
338
- var tagRef = void 0;
339
- var tag = void 0;
340
- if (tagObject["" + tagName]) {
341
- tagRef = Object.keys(tagObject["" + tagName]);
342
- tag = tagRef.find(function (key) {
343
- return tagObject["" + tagName]["" + key] ===
344
- childSlot.type.methods.getTag().replace(/[s]\b/, "");
345
- });
346
- tag = tag
347
- ? tag.replace("e-", "")
348
- : childSlot.type.methods.getTag().replace("e-", "");
349
- if (this_3.ej2Instances.getModuleName().toLowerCase() == "diagram" && tag.indexOf('annotations') != -1) {
350
- 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
+ }
351
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 || {});
352
226
  }
353
- if (childSlot.children) {
354
- innerDirValues = this_3.resolveComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
355
- if (!items["" + tag]) {
356
- 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();
357
231
  }
358
- if (innerDirValues.length > 1) {
359
- 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
+ }
360
257
  }
361
258
  else {
362
- items["" + tag].push(innerDirValues);
259
+ return;
363
260
  }
364
261
  }
365
- if (childSlot.props) {
366
- childSlot.props = this_3.getCamelCaseProps(childSlot.props);
367
- }
368
- if (slot.length > 1) {
369
- 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
+ }
370
292
  if (childSlot.props) {
371
- 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
+ });
372
299
  }
373
- }
374
- else {
375
- items = childSlot.props ? Object.assign(items, childSlot.props) : items;
376
- }
377
- };
378
- var this_3 = this;
379
- for (var _i = 0, slot_2 = slot; _i < slot_2.length; _i++) {
380
- var childSlot = slot_2[_i];
381
- _loop_3(childSlot);
382
- }
383
- return items;
384
- };
385
- ComponentBase.prototype.resolveComplexInnerDirs = function (slots, tagObject, tagName) {
386
- var slot = [];
387
- var innerDirValues;
388
- slot = slots.default ? slots.default() : slots;
389
- var items = slot.length > 1 ? [] : {};
390
- for (var _i = 0, slot_3 = slot; _i < slot_3.length; _i++) {
391
- var childSlot = slot_3[_i];
392
- var tag = childSlot.type.methods.getTag().replace("e-", "");
393
- if (childSlot.children) {
394
- innerDirValues = this.resolveMultilevelComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
395
- if ((/[s]\b/).test(tag) || slot.length > 1) {
396
- if ((/[s]\b/).test(tag)) {
397
- items["" + tag] = !items["" + tag] ? [] : items["" + tag];
398
- if (innerDirValues.length) {
399
- 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
+ }
400
388
  }
401
- else {
402
- items["" + tag].push(innerDirValues);
389
+ else if (innerDirValues && !(isRibbon && innerDirValues.hasOwnProperty('collections'))) {
390
+ items.push(innerDirValues);
403
391
  }
404
392
  }
405
- else if (innerDirValues) {
406
- items.push(innerDirValues);
393
+ else {
394
+ items = innerDirValues ? innerDirValues : items;
407
395
  }
408
396
  }
409
- else {
410
- items = innerDirValues ? innerDirValues : items;
397
+ if (childSlot.props) {
398
+ childSlot.props = this.getCamelCaseProps(childSlot.props);
411
399
  }
412
- }
413
- if (childSlot.props) {
414
- childSlot.props = this.getCamelCaseProps(childSlot.props);
415
- }
416
- if (slot.length > 1 && childSlot.props) {
417
- if (items.length >= 0) {
418
- 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
+ }
419
411
  }
420
412
  else {
421
413
  items = childSlot.props ? Object.assign(items, childSlot.props) : items;
422
414
  }
423
415
  }
424
- else {
425
- items = childSlot.props ? Object.assign(items, childSlot.props) : items;
426
- }
427
- }
428
- return items;
429
- };
430
- ComponentBase.prototype.resolveMultilevelComplexInnerDirs = function (slots, tagObject, tagName) {
431
- var slot = [];
432
- var innerDirValues;
433
- slot = slots.default ? slots.default() : slots;
434
- var items = slot.length > 1 ? [] : {};
435
- for (var _i = 0, slot_4 = slot; _i < slot_4.length; _i++) {
436
- var childSlot = slot_4[_i];
437
- var tag = childSlot.type.methods.getTag().replace("e-", "");
438
- if (childSlot.children) {
439
- innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
440
- }
441
- if (childSlot.props) {
442
- childSlot.props = this.getCamelCaseProps(childSlot.props);
443
- }
444
- if ((/[s]\b/).test(tag)) {
445
- items["" + tag] = !items["" + tag] ? [] : items["" + tag];
446
- if (innerDirValues.length) {
447
- items["" + tag] = innerDirValues;
448
- }
449
- else {
450
- 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());
451
429
  }
452
430
  if (childSlot.props) {
453
- 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;
454
448
  }
455
449
  }
456
- else {
457
- items = innerDirValues;
458
- items = childSlot.props ? Object.assign(items, childSlot.props) : items;
459
- }
460
- }
461
- return items;
462
- };
463
- ComponentBase.prototype.getDirectiveValues = function (tagDirectives, tagMapper, tagNameMapper) {
464
- var keyTags = Object.keys(tagMapper);
465
- var dir = {};
466
- if (tagDirectives) {
467
- for (var _i = 0, tagDirectives_1 = tagDirectives; _i < tagDirectives_1.length; _i++) {
468
- var tagDirective = tagDirectives_1[_i];
469
- if (tagDirective.componentOptions && tagDirective.componentOptions.children && tagDirective.componentOptions.tag ||
470
- (tagDirective.tag === 'e-seriescollection' && tagDirective.children)) {
471
- var dirTag = tagDirective.componentOptions ? tagDirective.componentOptions.tag : tagDirective.tag;
472
- dirTag = (dirTag === 'e-seriescollection') ? 'e-seriesCollection' : dirTag;
473
- if (keyTags.indexOf(dirTag) !== -1) {
474
- var tagName = tagNameMapper["" + dirTag] ? tagNameMapper["" + dirTag] : dirTag;
475
- dir[tagName.replace('e-', '')] = [];
476
- var children = tagDirective.componentOptions ? tagDirective.componentOptions.children : tagDirective.children;
477
- for (var _a = 0, children_1 = children; _a < children_1.length; _a++) {
478
- var tagDirChild = children_1[_a];
479
- var retObj = this.getVNodeValue(tagDirChild, tagMapper["" + dirTag], tagNameMapper);
480
- if (Object.keys(retObj).length !== 0) {
481
- 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
+ }
482
472
  }
483
473
  }
484
474
  }
485
475
  }
486
476
  }
487
- }
488
- return dir;
489
- };
490
- ComponentBase.prototype.getMultiLevelDirValue = function (tagDirectories, tagKey, tagNameMapper) {
491
- var mulObj = {};
492
- for (var _i = 0, tagDirectories_1 = tagDirectories; _i < tagDirectories_1.length; _i++) {
493
- var tagDir = tagDirectories_1[_i];
494
- var key = void 0;
495
- var children = void 0;
496
- if (tagDir.componentOptions) {
497
- key = tagDir.componentOptions.tag;
498
- if (tagDir.componentOptions.children) {
499
- 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
+ }
500
490
  }
501
- }
502
- else if ((tagDir.tag === 'e-markersettings' || tagDir.tag === 'e-markersetting') && tagDir.children) {
503
- key = (tagDir.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
504
- children = tagDir.children;
505
- }
506
- if (key) {
507
- var tagName = tagNameMapper["" + key] ? tagNameMapper["" + key] : key;
508
- mulObj[tagName.replace('e-', '')] = [];
509
- if (children) {
510
- for (var _a = 0, children_2 = children; _a < children_2.length; _a++) {
511
- var tagDirChild = children_2[_a];
512
- var mulLevObj = this.getVNodeValue(tagDirChild, tagKey["" + key], tagNameMapper);
513
- if (Object.keys(mulLevObj).length !== 0) {
514
- 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
+ }
515
505
  }
516
506
  }
517
507
  }
518
508
  }
519
- }
520
- return mulObj;
521
- };
522
- ComponentBase.prototype.getVNodeValue = function (tagDirective, tagKey, tagNameMapper) {
523
- var ret = {};
524
- if (tagDirective.componentOptions || ((tagDirective.tag === 'e-markersettings' || tagDirective.tag === 'e-markersetting') && tagDirective.context)) {
525
- var dirTag = void 0;
526
- if (tagDirective.componentOptions) {
527
- dirTag = tagDirective.componentOptions.tag;
528
- }
529
- else {
530
- dirTag = (tagDirective.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
531
- }
532
- if (typeof tagKey === 'string' && dirTag === tagKey && tagDirective.data) {
533
- ret = tagDirective.data.attrs ? this.getCamelCaseProps(tagDirective.data.attrs) : this.getCamelCaseProps(tagDirective.data);
534
- }
535
- else if (typeof tagKey === 'object') {
536
- if (tagDirective.componentOptions.children && (Object.keys(tagKey).indexOf(dirTag) !== -1)) {
537
- 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;
538
517
  }
539
- else if (tagDirective.children && (Object.keys(tagKey).indexOf(dirTag) !== -1) && (dirTag === 'e-markersettings' || dirTag === 'e-markersetting')) {
540
- ret = this.getMultiLevelDirValue(tagDirective.children, tagKey["" + dirTag], tagNameMapper);
518
+ else {
519
+ dirTag = (tagDirective.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
541
520
  }
542
- if (tagDirective.data && tagDirective.data.attrs) {
543
- 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
+ }
544
534
  }
545
535
  }
546
- }
547
- return ret;
548
- };
549
- /**
550
- * convert kebab case directive props to camel case
551
- */
552
- ComponentBase.prototype.getCamelCaseProps = function (props) {
553
- var retProps = {};
554
- 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++) {
555
570
  var prop = _a[_i];
556
- retProps[prop.replace(/-[a-z]/g, function (e) { return e[1].toUpperCase(); })] = props["" + prop];
571
+ _loop_4(prop);
557
572
  }
558
- return retProps;
559
- };
560
- ComponentBase.prototype.dataBind = function () {
561
- this.ej2Instances.dataBind();
562
- };
563
- ComponentBase.prototype.setProperties = function (arg, muteOnChange) {
564
- return this.ej2Instances.setProperties(arg, muteOnChange);
565
- };
566
- return ComponentBase;
567
- }(vueImport));
568
- export { ComponentBase };
573
+ }
574
+ return [options.newprops, options.watch];
575
+ }