@syncfusion/ej2-vue-base 20.1.48 → 20.1.55

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 CHANGED
@@ -2,11 +2,35 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
- ## Common
5
+ ## 20.1.51 (2022-04-26)
6
6
 
7
- ### Bug Fixes
7
+ ### Common
8
+
9
+ #### Bug Fixes
10
+
11
+ - `#FB9750` - The issue with "Providers are not accessible for Vue component with typescript application environment" has been resolved.
12
+
13
+ ## 20.1.51 (2022-04-26)
14
+
15
+ ### Common
16
+
17
+ #### Bug Fixes
18
+
19
+ - `#I334904`, `#I347008` - The issue with "Script error in Vite + Vue application" has been resolved.
20
+
21
+ ## 20.1.48 (2022-04-12)
22
+
23
+ ### Common
24
+
25
+ - The "Header Rows in Schedule component not rendered in Vue" issue has been fixed.
26
+
27
+ ## 20.1.47 (2022-04-04)
28
+
29
+ ### Common
30
+
31
+ #### New Features
8
32
 
9
- - `358507` - The v-for support has been provided.
33
+ - `F140652`, `F138394`, `F148391`, `I309881`, `F167735`, `I228458` - Provided slot template support for the Vue components.
10
34
 
11
35
  ## 19.4.53 (2022-02-22)
12
36
 
package/README.md CHANGED
@@ -78,9 +78,7 @@ Check the license detail [here](https://github.com/syncfusion/ej2-vue-ui-compone
78
78
 
79
79
  ## Changelog
80
80
 
81
- Check the changelog [here](https://ej2.syncfusion.com/vue/documentation/release-notes/index?utm_source=npm&utm_campaign=ej2-vue-base)
81
+ Check the changelog [here](https://ej2.syncfusion.com/vue/documentation/release-notes?utm_source=npm&utm_campaign=ej2-vue-base)
82
82
 
83
83
  © Copyright 2022 Syncfusion, Inc. All Rights Reserved. The Syncfusion Essential Studio license and copyright applies to this distribution.
84
- The Syncfusion Essential Studio license and copyright applies to this distribution.
85
-
86
- Added code
84
+ The Syncfusion Essential Studio license and copyright applies to this distribution.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: ej2-vue-base.umd.min.js
3
- * version : 20.1.48
3
+ * version : 20.1.55
4
4
  * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
@@ -9,7 +9,16 @@
9
9
  */
10
10
  /*!
11
11
  * filename: ej2-vue-base.umd.min.js
12
- * version : 19.2.55
12
+ * version : 20.1.47
13
+ * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
14
+ * Use of this code is subject to the terms of our license.
15
+ * A copy of the current license can be obtained at any time by e-mailing
16
+ * licensing@syncfusion.com. Any infringement will be prosecuted under
17
+ * applicable laws.
18
+ */
19
+ /*!
20
+ * filename: ej2-vue-base.umd.min.js
21
+ * version : 19.4.38
13
22
  * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
14
23
  * Use of this code is subject to the terms of our license.
15
24
  * A copy of the current license can be obtained at any time by e-mailing
@@ -39,6 +39,7 @@ class ComponentBase extends vueImport {
39
39
  this.hasInjectedModules = false;
40
40
  this.hasChildDirective = false;
41
41
  this.childDirObjects = '';
42
+ this.isDecorator = false;
42
43
  }
43
44
  created() {
44
45
  if (!this.propKeys) {
@@ -53,7 +54,11 @@ class ComponentBase extends vueImport {
53
54
  let vueInjectables = getValue('$parent.$options.provide', this);
54
55
  if (this.hasInjectedModules && !isExecute) {
55
56
  let prevModule = [];
56
- if (injectables) {
57
+ if (injectables && injectables.managed) {
58
+ this.isDecorator = true;
59
+ prevModule = this.getInjectedServices() || [];
60
+ }
61
+ else if (injectables) {
57
62
  prevModule = injectables[this.ej2Instances.getModuleName()] || [];
58
63
  }
59
64
  else if (vueInjectables) {
@@ -87,7 +92,10 @@ class ComponentBase extends vueImport {
87
92
  getInjectedServices() {
88
93
  let ret = [];
89
94
  let provide;
90
- if (this.$vnode) {
95
+ if (this.$root && this.isDecorator) {
96
+ provide = getValue('$root.$options.provide', this);
97
+ }
98
+ else if (this.$vnode) {
91
99
  provide = getValue('$vnode.context.$options.provide', this);
92
100
  }
93
101
  else if (this.$parent) {
@@ -97,8 +105,38 @@ class ComponentBase extends vueImport {
97
105
  // tslint:disable:no-any
98
106
  let injectables = provide;
99
107
  if (typeof provide === 'function') {
108
+ if (provide.managed) {
109
+ let provideKey = provide.managed;
110
+ let provideValue = Object.keys(provideKey);
111
+ let key;
112
+ if (this.$root && this.isDecorator) {
113
+ key = Object.keys(this.$root);
114
+ }
115
+ else if (this.$vnode) {
116
+ key = Object.keys(this.$vnode.context);
117
+ }
118
+ else if (this.$parent) {
119
+ key = Object.keys(this.$parent);
120
+ }
121
+ for (let i = 0; i < provideValue.length; i++) {
122
+ for (let j = 0; j < key.length; j++) {
123
+ if ((key[j].indexOf(provideValue[i])) !== -1) {
124
+ if (this.$root && this.isDecorator) {
125
+ provideKey[provideValue[j]] = this.$root[key[i]];
126
+ }
127
+ else if (this.$vnode) {
128
+ provideKey[provideValue[i]] = this.$vnode.context[key[j]];
129
+ }
130
+ else if (this.$parent) {
131
+ provideKey[provideValue[i]] = this.$parent[key[j]];
132
+ }
133
+ injectables = provideKey;
134
+ }
135
+ }
136
+ }
137
+ }
100
138
  // tslint:disable:no-any
101
- if (this.$vnode) {
139
+ else if (this.$vnode) {
102
140
  injectables = this.$vnode.context.$options.provide();
103
141
  }
104
142
  else if (this.$parent) {
@@ -107,6 +145,7 @@ class ComponentBase extends vueImport {
107
145
  }
108
146
  ret = injectables[this.ej2Instances.getModuleName()] || [];
109
147
  }
148
+ this.isDecorator = false;
110
149
  return ret;
111
150
  }
112
151
  updated() {
@@ -161,8 +200,10 @@ class ComponentBase extends vueImport {
161
200
  if (this[0] && this[0][1].slots.default) {
162
201
  propRef = this[0][1].slots.default();
163
202
  }
164
- else if (this && this.$slots) {
165
- propRef = this.$slots.default();
203
+ else if (this && this.$) {
204
+ if (this.$.slots) {
205
+ propRef = this.$.slots.default();
206
+ }
166
207
  }
167
208
  if (propRef) {
168
209
  for (let i = 0; i < propRef.length; i++) {
@@ -179,6 +220,9 @@ class ComponentBase extends vueImport {
179
220
  else if (controlName == "bulletchart" && keyRef == "range") {
180
221
  keyRef = "ranges";
181
222
  }
223
+ else if (controlName == "schedule" && keyRef == "header") {
224
+ keyRef = "headerRows";
225
+ }
182
226
  dirProps[keyRef] = ref[key];
183
227
  }
184
228
  }
@@ -563,11 +607,9 @@ function collectDataFromConstructor(vm, Component) {
563
607
  let stringCompiler = getTemplateEngine();
564
608
  function compile(templateElement, helper) {
565
609
  let that = this;
566
- if (typeof templateElement === "string") {
567
- return stringCompiler(templateElement, helper);
568
- }
569
- else {
570
- return (data, context, propName) => {
610
+ return (data, context, propName, element, root) => {
611
+ let returnEle;
612
+ if (context) {
571
613
  let pid = getUniqueID("templateParentDiv");
572
614
  let id = getUniqueID("templateDiv");
573
615
  let ele = createElement("div", {
@@ -575,94 +617,201 @@ function compile(templateElement, helper) {
575
617
  innerHTML: '<div id="' + id + '"></div>',
576
618
  });
577
619
  document.body.appendChild(ele);
578
- let tempObj = templateElement.call(that, {});
579
- let returnEle;
580
- if (context) {
581
- if (gh) {
582
- let object = tempObj;
583
- let propsData = getValue("template.propsData", tempObj);
584
- let dataObj = {
585
- data: { data: extend(tempObj.data || {}, data) },
586
- parent: context.vueInstance,
587
- };
588
- if (!object.template) {
589
- object.template = object[Object.keys(object)[0]];
590
- }
591
- let templateCompRef;
592
- if (object.template.extends) {
593
- templateCompRef = object.template.extends._context.components.template;
594
- }
595
- else {
596
- templateCompRef = object.template._context.components[templateElement.name];
597
- if (!templateCompRef) {
598
- let key = Object.keys(object.template._context.components)[0];
599
- templateCompRef = object.template._context.components[key];
620
+ if (gh && typeof templateElement === "string") {
621
+ let vue3Slots = getVue3Slot(context.vueInstance, templateElement, root);
622
+ if (vue3Slots) {
623
+ // Compilation for Vue 3 slot template
624
+ allVue
625
+ .createApp({
626
+ render() {
627
+ return vue3Slots[templateElement]({ data: data });
600
628
  }
629
+ })
630
+ .mount("#" + id);
631
+ returnEle = ele.childNodes;
632
+ detach(ele);
633
+ }
634
+ else {
635
+ // Compilation for Vue 3 string template
636
+ detach(ele);
637
+ return stringCompiler(templateElement, helper)(data);
638
+ }
639
+ }
640
+ else if (gh) {
641
+ // Compilation for Vue 3 functional template
642
+ let tempObj = templateElement.call(that, {});
643
+ let object = tempObj;
644
+ let propsData = getValue("template.propsData", tempObj);
645
+ let dataObj = {
646
+ data: { data: extend(tempObj.data || {}, data) },
647
+ parent: context.vueInstance,
648
+ };
649
+ if (!object.template) {
650
+ object.template = object[Object.keys(object)[0]];
651
+ }
652
+ let templateCompRef;
653
+ if (object.template.extends) {
654
+ templateCompRef = object.template.extends._context.components.template;
655
+ }
656
+ else {
657
+ templateCompRef = object.template._context.components[templateElement.name];
658
+ if (!templateCompRef) {
659
+ let key = Object.keys(object.template._context.components)[0];
660
+ templateCompRef = object.template._context.components[key];
601
661
  }
602
- let tempRef;
603
- if (propsData) {
604
- tempRef = Object.assign(templateCompRef.data(), propsData);
605
- }
606
- else {
607
- tempRef = Object.assign(templateCompRef.data(), dataObj.data);
608
- if (templateCompRef.components) {
609
- let objkeys = Object.keys(templateCompRef.components) || [];
610
- for (let objstring of objkeys) {
611
- let intComponent = templateCompRef.components[objstring];
612
- if (intComponent && intComponent.data) {
613
- let tempRef2 = Object.assign(intComponent.data(), dataObj.data);
614
- intComponent.data = function () { return tempRef2; };
615
- }
662
+ }
663
+ let tempRef;
664
+ if (propsData) {
665
+ tempRef = Object.assign(templateCompRef.data(), propsData);
666
+ }
667
+ else {
668
+ tempRef = Object.assign(templateCompRef.data(), dataObj.data);
669
+ if (templateCompRef.components) {
670
+ let objkeys = Object.keys(templateCompRef.components) || [];
671
+ for (let objstring of objkeys) {
672
+ let intComponent = templateCompRef.components[objstring];
673
+ if (intComponent && intComponent.data) {
674
+ let tempRef2 = Object.assign(intComponent.data(), dataObj.data);
675
+ intComponent.data = function () { return tempRef2; };
616
676
  }
617
677
  }
618
678
  }
619
- templateCompRef.data = function () { return tempRef; };
620
- allVue
621
- .createApp(templateCompRef)
622
- .mount("#" + id);
679
+ }
680
+ templateCompRef.data = function () { return tempRef; };
681
+ allVue
682
+ .createApp(templateCompRef)
683
+ .mount("#" + id);
684
+ returnEle = ele.childNodes;
685
+ detach(ele);
686
+ }
687
+ else if (typeof templateElement === "string") {
688
+ let vue2Slots = getVue2Slot(context.vueInstance, templateElement, root);
689
+ if (vue2Slots) {
690
+ // Compilation for Vue 2 slot template
691
+ let vueTemplate = new Vue$1__default({
692
+ render() {
693
+ return vue2Slots[templateElement]({ data: data });
694
+ }
695
+ });
696
+ vueTemplate.$mount("#" + id);
623
697
  returnEle = ele.childNodes;
624
698
  detach(ele);
625
699
  }
626
700
  else {
627
- let templateFunction = tempObj.template;
628
- let propsData = getValue("template.propsData", tempObj);
629
- let dataObj = {
630
- data: { data: extend(tempObj.data || {}, data) },
631
- parent: context.vueInstance,
632
- };
633
- if (propsData) {
634
- templateFunction = tempObj.template.extends;
635
- dataObj.propsData = propsData;
636
- }
637
- if (typeof templateFunction !== "function") {
638
- templateFunction = Vue$1__default.extend(templateFunction);
701
+ // Compilation for Vue 2 string template
702
+ detach(ele);
703
+ return stringCompiler(templateElement, helper)(data);
704
+ }
705
+ }
706
+ else {
707
+ // Compilation for Vue 2 functional template
708
+ let tempObj = templateElement.call(that, {});
709
+ let templateFunction = tempObj.template;
710
+ let propsData = getValue("template.propsData", tempObj);
711
+ let dataObj = {
712
+ data: { data: extend(tempObj.data || {}, data) },
713
+ parent: context.vueInstance,
714
+ };
715
+ if (propsData) {
716
+ templateFunction = tempObj.template.extends;
717
+ dataObj.propsData = propsData;
718
+ }
719
+ if (typeof templateFunction !== "function") {
720
+ templateFunction = Vue$1__default.extend(templateFunction);
721
+ }
722
+ let templateVue = new templateFunction(dataObj);
723
+ // let templateVue = new Vue(tempObj.template);
724
+ // templateVue.$data.data = extend(tempObj.data, data);
725
+ templateVue.$mount("#" + id);
726
+ returnEle = ele.childNodes;
727
+ if (context.vueInstance) {
728
+ let templateInstance = context.vueInstance.templateCollection;
729
+ if (!templateInstance) {
730
+ context.vueInstance.templateCollection = {};
731
+ templateInstance = context.vueInstance.templateCollection;
639
732
  }
640
- let templateVue = new templateFunction(dataObj);
641
- // let templateVue = new Vue(tempObj.template);
642
- // templateVue.$data.data = extend(tempObj.data, data);
643
- templateVue.$mount("#" + id);
644
- returnEle = ele.childNodes;
645
- if (context.vueInstance) {
646
- let templateInstance = context.vueInstance.templateCollection;
647
- if (!templateInstance) {
648
- context.vueInstance.templateCollection = {};
649
- templateInstance = context.vueInstance.templateCollection;
650
- }
651
- if (propName) {
652
- if (!templateInstance[propName]) {
653
- templateInstance[propName] = [];
654
- }
655
- templateInstance[propName].push(returnEle[0]);
733
+ if (propName) {
734
+ if (!templateInstance[propName]) {
735
+ templateInstance[propName] = [];
656
736
  }
737
+ templateInstance[propName].push(returnEle[0]);
657
738
  }
658
- detach(ele);
659
739
  }
740
+ detach(ele);
660
741
  }
661
- return returnEle || [];
662
- };
663
- }
742
+ }
743
+ return returnEle || [];
744
+ };
664
745
  }
665
746
  setTemplateEngine({ compile: compile });
747
+ // Get the Vue2 slot template from the root or current Vue component.
748
+ function getVue2Slot(vueInstance, templateElement, root) {
749
+ if (!vueInstance && !(root && root.vueInstance)) {
750
+ return undefined;
751
+ }
752
+ let instance = (root && root.vueInstance) ? root.vueInstance : vueInstance;
753
+ return getVue2ChildSlot(instance, templateElement);
754
+ }
755
+ function getVue2ChildSlot(vueInstance, templateElement) {
756
+ if (!vueInstance) {
757
+ return undefined;
758
+ }
759
+ let slots = vueInstance.$slots;
760
+ let scopedSlots = vueInstance.$scopedSlots;
761
+ let vSlots = vueInstance.scopedSlots;
762
+ let children = vueInstance.children;
763
+ if (scopedSlots && scopedSlots[templateElement]) {
764
+ return scopedSlots;
765
+ }
766
+ else if (slots && slots.default) {
767
+ let childSlots = slots.default;
768
+ for (let i = 0; i < childSlots.length; i++) {
769
+ let slot = getVue2ChildSlot(getSlot(childSlots[i]), templateElement);
770
+ if (slot) {
771
+ return slot;
772
+ }
773
+ }
774
+ }
775
+ else if (vSlots && vSlots[templateElement]) {
776
+ return vSlots;
777
+ }
778
+ else if (children) {
779
+ for (let i = 0; i < children.length; i++) {
780
+ let slot = getVue2ChildSlot(getSlot(children[i]), templateElement);
781
+ if (slot) {
782
+ return slot;
783
+ }
784
+ }
785
+ }
786
+ return undefined;
787
+ }
788
+ function getSlot(vnode) {
789
+ let slot = (vnode.componentOptions && vnode.componentOptions.children) ? vnode.componentOptions : vnode.data;
790
+ return vnode.componentInstance ? vnode.componentInstance : slot;
791
+ }
792
+ // Get the Vue3 slot template from the root or current Vue component.
793
+ function getVue3Slot(vueInstance, templateElement, root) {
794
+ if (!vueInstance && !(root && root.vueInstance)) {
795
+ return undefined;
796
+ }
797
+ let slots = (root && root.vueInstance) ? root.vueInstance.$slots : vueInstance.$slots;
798
+ return getVue3ChildSlot(slots, templateElement);
799
+ }
800
+ function getVue3ChildSlot(slots, templateElement) {
801
+ if (slots && slots[templateElement]) {
802
+ return slots;
803
+ }
804
+ else if (slots && slots.default) {
805
+ let childSlots = slots.default();
806
+ for (let i = 0; i < childSlots.length; i++) {
807
+ let slot = getVue3ChildSlot(childSlots[i].children, templateElement);
808
+ if (slot) {
809
+ return slot;
810
+ }
811
+ }
812
+ }
813
+ return undefined;
814
+ }
666
815
 
667
816
  /**
668
817
  * index for component base