@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 +27 -3
- package/README.md +2 -4
- package/dist/ej2-vue-base.umd.min.js +11 -2
- package/dist/es6/ej2-vue-base.es2015.js +231 -82
- package/dist/es6/ej2-vue-base.es2015.js.map +1 -1
- package/dist/es6/ej2-vue-base.es5.js +235 -86
- package/dist/es6/ej2-vue-base.es5.js.map +1 -1
- package/dist/global/ej2-vue-base.min.js +2 -2
- package/dist/global/ej2-vue-base.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +24 -13
- package/postinstall.js +7 -7
- package/src/component-base.d.ts +3 -1
- package/src/component-base.js +49 -5
- package/src/template.d.ts +1 -1
- package/src/template.js +186 -81
|
@@ -53,6 +53,7 @@ var ComponentBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
53
53
|
_this.hasInjectedModules = false;
|
|
54
54
|
_this.hasChildDirective = false;
|
|
55
55
|
_this.childDirObjects = '';
|
|
56
|
+
_this.isDecorator = false;
|
|
56
57
|
return _this;
|
|
57
58
|
}
|
|
58
59
|
ComponentBase.prototype.created = function () {
|
|
@@ -74,7 +75,11 @@ var ComponentBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
74
75
|
var vueInjectables = getValue('$parent.$options.provide', this);
|
|
75
76
|
if (this.hasInjectedModules && !isExecute) {
|
|
76
77
|
var prevModule = [];
|
|
77
|
-
if (injectables) {
|
|
78
|
+
if (injectables && injectables.managed) {
|
|
79
|
+
this.isDecorator = true;
|
|
80
|
+
prevModule = this.getInjectedServices() || [];
|
|
81
|
+
}
|
|
82
|
+
else if (injectables) {
|
|
78
83
|
prevModule = injectables[this.ej2Instances.getModuleName()] || [];
|
|
79
84
|
}
|
|
80
85
|
else if (vueInjectables) {
|
|
@@ -109,7 +114,10 @@ var ComponentBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
109
114
|
ComponentBase.prototype.getInjectedServices = function () {
|
|
110
115
|
var ret = [];
|
|
111
116
|
var provide;
|
|
112
|
-
if (this.$
|
|
117
|
+
if (this.$root && this.isDecorator) {
|
|
118
|
+
provide = getValue('$root.$options.provide', this);
|
|
119
|
+
}
|
|
120
|
+
else if (this.$vnode) {
|
|
113
121
|
provide = getValue('$vnode.context.$options.provide', this);
|
|
114
122
|
}
|
|
115
123
|
else if (this.$parent) {
|
|
@@ -119,8 +127,38 @@ var ComponentBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
119
127
|
// tslint:disable:no-any
|
|
120
128
|
var injectables = provide;
|
|
121
129
|
if (typeof provide === 'function') {
|
|
130
|
+
if (provide.managed) {
|
|
131
|
+
var provideKey = provide.managed;
|
|
132
|
+
var provideValue = Object.keys(provideKey);
|
|
133
|
+
var key = void 0;
|
|
134
|
+
if (this.$root && this.isDecorator) {
|
|
135
|
+
key = Object.keys(this.$root);
|
|
136
|
+
}
|
|
137
|
+
else if (this.$vnode) {
|
|
138
|
+
key = Object.keys(this.$vnode.context);
|
|
139
|
+
}
|
|
140
|
+
else if (this.$parent) {
|
|
141
|
+
key = Object.keys(this.$parent);
|
|
142
|
+
}
|
|
143
|
+
for (var i = 0; i < provideValue.length; i++) {
|
|
144
|
+
for (var j = 0; j < key.length; j++) {
|
|
145
|
+
if ((key[j].indexOf(provideValue[i])) !== -1) {
|
|
146
|
+
if (this.$root && this.isDecorator) {
|
|
147
|
+
provideKey[provideValue[j]] = this.$root[key[i]];
|
|
148
|
+
}
|
|
149
|
+
else if (this.$vnode) {
|
|
150
|
+
provideKey[provideValue[i]] = this.$vnode.context[key[j]];
|
|
151
|
+
}
|
|
152
|
+
else if (this.$parent) {
|
|
153
|
+
provideKey[provideValue[i]] = this.$parent[key[j]];
|
|
154
|
+
}
|
|
155
|
+
injectables = provideKey;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
122
160
|
// tslint:disable:no-any
|
|
123
|
-
if (this.$vnode) {
|
|
161
|
+
else if (this.$vnode) {
|
|
124
162
|
injectables = this.$vnode.context.$options.provide();
|
|
125
163
|
}
|
|
126
164
|
else if (this.$parent) {
|
|
@@ -129,6 +167,7 @@ var ComponentBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
129
167
|
}
|
|
130
168
|
ret = injectables[this.ej2Instances.getModuleName()] || [];
|
|
131
169
|
}
|
|
170
|
+
this.isDecorator = false;
|
|
132
171
|
return ret;
|
|
133
172
|
};
|
|
134
173
|
ComponentBase.prototype.updated = function () {
|
|
@@ -185,8 +224,10 @@ var ComponentBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
185
224
|
if (this[0] && this[0][1].slots.default) {
|
|
186
225
|
propRef = this[0][1].slots.default();
|
|
187
226
|
}
|
|
188
|
-
else if (this && this.$
|
|
189
|
-
|
|
227
|
+
else if (this && this.$) {
|
|
228
|
+
if (this.$.slots) {
|
|
229
|
+
propRef = this.$.slots.default();
|
|
230
|
+
}
|
|
190
231
|
}
|
|
191
232
|
if (propRef) {
|
|
192
233
|
for (var i = 0; i < propRef.length; i++) {
|
|
@@ -203,6 +244,9 @@ var ComponentBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
203
244
|
else if (controlName == "bulletchart" && keyRef == "range") {
|
|
204
245
|
keyRef = "ranges";
|
|
205
246
|
}
|
|
247
|
+
else if (controlName == "schedule" && keyRef == "header") {
|
|
248
|
+
keyRef = "headerRows";
|
|
249
|
+
}
|
|
206
250
|
dirProps[keyRef] = ref[key];
|
|
207
251
|
}
|
|
208
252
|
}
|
|
@@ -618,11 +662,9 @@ function collectDataFromConstructor(vm, Component) {
|
|
|
618
662
|
var stringCompiler = getTemplateEngine();
|
|
619
663
|
function compile(templateElement, helper) {
|
|
620
664
|
var that = this;
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
else {
|
|
625
|
-
return function (data, context, propName) {
|
|
665
|
+
return function (data, context, propName, element, root) {
|
|
666
|
+
var returnEle;
|
|
667
|
+
if (context) {
|
|
626
668
|
var pid = getUniqueID("templateParentDiv");
|
|
627
669
|
var id = getUniqueID("templateDiv");
|
|
628
670
|
var ele = createElement("div", {
|
|
@@ -630,98 +672,205 @@ function compile(templateElement, helper) {
|
|
|
630
672
|
innerHTML: '<div id="' + id + '"></div>',
|
|
631
673
|
});
|
|
632
674
|
document.body.appendChild(ele);
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
parent: context.vueInstance,
|
|
642
|
-
};
|
|
643
|
-
if (!object.template) {
|
|
644
|
-
object.template = object[Object.keys(object)[0]];
|
|
645
|
-
}
|
|
646
|
-
var templateCompRef = void 0;
|
|
647
|
-
if (object.template.extends) {
|
|
648
|
-
templateCompRef = object.template.extends._context.components.template;
|
|
649
|
-
}
|
|
650
|
-
else {
|
|
651
|
-
templateCompRef = object.template._context.components[templateElement.name];
|
|
652
|
-
if (!templateCompRef) {
|
|
653
|
-
var key = Object.keys(object.template._context.components)[0];
|
|
654
|
-
templateCompRef = object.template._context.components[key];
|
|
675
|
+
if (gh && typeof templateElement === "string") {
|
|
676
|
+
var vue3Slots_1 = getVue3Slot(context.vueInstance, templateElement, root);
|
|
677
|
+
if (vue3Slots_1) {
|
|
678
|
+
// Compilation for Vue 3 slot template
|
|
679
|
+
allVue
|
|
680
|
+
.createApp({
|
|
681
|
+
render: function () {
|
|
682
|
+
return vue3Slots_1[templateElement]({ data: data });
|
|
655
683
|
}
|
|
684
|
+
})
|
|
685
|
+
.mount("#" + id);
|
|
686
|
+
returnEle = ele.childNodes;
|
|
687
|
+
detach(ele);
|
|
688
|
+
}
|
|
689
|
+
else {
|
|
690
|
+
// Compilation for Vue 3 string template
|
|
691
|
+
detach(ele);
|
|
692
|
+
return stringCompiler(templateElement, helper)(data);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
else if (gh) {
|
|
696
|
+
// Compilation for Vue 3 functional template
|
|
697
|
+
var tempObj = templateElement.call(that, {});
|
|
698
|
+
var object = tempObj;
|
|
699
|
+
var propsData = getValue("template.propsData", tempObj);
|
|
700
|
+
var dataObj = {
|
|
701
|
+
data: { data: extend(tempObj.data || {}, data) },
|
|
702
|
+
parent: context.vueInstance,
|
|
703
|
+
};
|
|
704
|
+
if (!object.template) {
|
|
705
|
+
object.template = object[Object.keys(object)[0]];
|
|
706
|
+
}
|
|
707
|
+
var templateCompRef = void 0;
|
|
708
|
+
if (object.template.extends) {
|
|
709
|
+
templateCompRef = object.template.extends._context.components.template;
|
|
710
|
+
}
|
|
711
|
+
else {
|
|
712
|
+
templateCompRef = object.template._context.components[templateElement.name];
|
|
713
|
+
if (!templateCompRef) {
|
|
714
|
+
var key = Object.keys(object.template._context.components)[0];
|
|
715
|
+
templateCompRef = object.template._context.components[key];
|
|
656
716
|
}
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
}
|
|
671
|
-
};
|
|
672
|
-
for (var _i = 0, objkeys_1 = objkeys; _i < objkeys_1.length; _i++) {
|
|
673
|
-
var objstring = objkeys_1[_i];
|
|
674
|
-
_loop_1(objstring);
|
|
717
|
+
}
|
|
718
|
+
var tempRef_1;
|
|
719
|
+
if (propsData) {
|
|
720
|
+
tempRef_1 = Object.assign(templateCompRef.data(), propsData);
|
|
721
|
+
}
|
|
722
|
+
else {
|
|
723
|
+
tempRef_1 = Object.assign(templateCompRef.data(), dataObj.data);
|
|
724
|
+
if (templateCompRef.components) {
|
|
725
|
+
var objkeys = Object.keys(templateCompRef.components) || [];
|
|
726
|
+
var _loop_1 = function (objstring) {
|
|
727
|
+
var intComponent = templateCompRef.components[objstring];
|
|
728
|
+
if (intComponent && intComponent.data) {
|
|
729
|
+
var tempRef2_1 = Object.assign(intComponent.data(), dataObj.data);
|
|
730
|
+
intComponent.data = function () { return tempRef2_1; };
|
|
675
731
|
}
|
|
732
|
+
};
|
|
733
|
+
for (var _i = 0, objkeys_1 = objkeys; _i < objkeys_1.length; _i++) {
|
|
734
|
+
var objstring = objkeys_1[_i];
|
|
735
|
+
_loop_1(objstring);
|
|
676
736
|
}
|
|
677
737
|
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
738
|
+
}
|
|
739
|
+
templateCompRef.data = function () { return tempRef_1; };
|
|
740
|
+
allVue
|
|
741
|
+
.createApp(templateCompRef)
|
|
742
|
+
.mount("#" + id);
|
|
743
|
+
returnEle = ele.childNodes;
|
|
744
|
+
detach(ele);
|
|
745
|
+
}
|
|
746
|
+
else if (typeof templateElement === "string") {
|
|
747
|
+
var vue2Slots_1 = getVue2Slot(context.vueInstance, templateElement, root);
|
|
748
|
+
if (vue2Slots_1) {
|
|
749
|
+
// Compilation for Vue 2 slot template
|
|
750
|
+
var vueTemplate = new Vue$1__default({
|
|
751
|
+
render: function () {
|
|
752
|
+
return vue2Slots_1[templateElement]({ data: data });
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
vueTemplate.$mount("#" + id);
|
|
682
756
|
returnEle = ele.childNodes;
|
|
683
757
|
detach(ele);
|
|
684
758
|
}
|
|
685
759
|
else {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
760
|
+
// Compilation for Vue 2 string template
|
|
761
|
+
detach(ele);
|
|
762
|
+
return stringCompiler(templateElement, helper)(data);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
else {
|
|
766
|
+
// Compilation for Vue 2 functional template
|
|
767
|
+
var tempObj = templateElement.call(that, {});
|
|
768
|
+
var templateFunction = tempObj.template;
|
|
769
|
+
var propsData = getValue("template.propsData", tempObj);
|
|
770
|
+
var dataObj = {
|
|
771
|
+
data: { data: extend(tempObj.data || {}, data) },
|
|
772
|
+
parent: context.vueInstance,
|
|
773
|
+
};
|
|
774
|
+
if (propsData) {
|
|
775
|
+
templateFunction = tempObj.template.extends;
|
|
776
|
+
dataObj.propsData = propsData;
|
|
777
|
+
}
|
|
778
|
+
if (typeof templateFunction !== "function") {
|
|
779
|
+
templateFunction = Vue$1__default.extend(templateFunction);
|
|
780
|
+
}
|
|
781
|
+
var templateVue = new templateFunction(dataObj);
|
|
782
|
+
// let templateVue = new Vue(tempObj.template);
|
|
783
|
+
// templateVue.$data.data = extend(tempObj.data, data);
|
|
784
|
+
templateVue.$mount("#" + id);
|
|
785
|
+
returnEle = ele.childNodes;
|
|
786
|
+
if (context.vueInstance) {
|
|
787
|
+
var templateInstance = context.vueInstance.templateCollection;
|
|
788
|
+
if (!templateInstance) {
|
|
789
|
+
context.vueInstance.templateCollection = {};
|
|
790
|
+
templateInstance = context.vueInstance.templateCollection;
|
|
698
791
|
}
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
templateVue.$mount("#" + id);
|
|
703
|
-
returnEle = ele.childNodes;
|
|
704
|
-
if (context.vueInstance) {
|
|
705
|
-
var templateInstance = context.vueInstance.templateCollection;
|
|
706
|
-
if (!templateInstance) {
|
|
707
|
-
context.vueInstance.templateCollection = {};
|
|
708
|
-
templateInstance = context.vueInstance.templateCollection;
|
|
709
|
-
}
|
|
710
|
-
if (propName) {
|
|
711
|
-
if (!templateInstance[propName]) {
|
|
712
|
-
templateInstance[propName] = [];
|
|
713
|
-
}
|
|
714
|
-
templateInstance[propName].push(returnEle[0]);
|
|
792
|
+
if (propName) {
|
|
793
|
+
if (!templateInstance[propName]) {
|
|
794
|
+
templateInstance[propName] = [];
|
|
715
795
|
}
|
|
796
|
+
templateInstance[propName].push(returnEle[0]);
|
|
716
797
|
}
|
|
717
|
-
detach(ele);
|
|
718
798
|
}
|
|
799
|
+
detach(ele);
|
|
719
800
|
}
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
}
|
|
801
|
+
}
|
|
802
|
+
return returnEle || [];
|
|
803
|
+
};
|
|
723
804
|
}
|
|
724
805
|
setTemplateEngine({ compile: compile });
|
|
806
|
+
// Get the Vue2 slot template from the root or current Vue component.
|
|
807
|
+
function getVue2Slot(vueInstance, templateElement, root) {
|
|
808
|
+
if (!vueInstance && !(root && root.vueInstance)) {
|
|
809
|
+
return undefined;
|
|
810
|
+
}
|
|
811
|
+
var instance = (root && root.vueInstance) ? root.vueInstance : vueInstance;
|
|
812
|
+
return getVue2ChildSlot(instance, templateElement);
|
|
813
|
+
}
|
|
814
|
+
function getVue2ChildSlot(vueInstance, templateElement) {
|
|
815
|
+
if (!vueInstance) {
|
|
816
|
+
return undefined;
|
|
817
|
+
}
|
|
818
|
+
var slots = vueInstance.$slots;
|
|
819
|
+
var scopedSlots = vueInstance.$scopedSlots;
|
|
820
|
+
var vSlots = vueInstance.scopedSlots;
|
|
821
|
+
var children = vueInstance.children;
|
|
822
|
+
if (scopedSlots && scopedSlots[templateElement]) {
|
|
823
|
+
return scopedSlots;
|
|
824
|
+
}
|
|
825
|
+
else if (slots && slots.default) {
|
|
826
|
+
var childSlots = slots.default;
|
|
827
|
+
for (var i = 0; i < childSlots.length; i++) {
|
|
828
|
+
var slot = getVue2ChildSlot(getSlot(childSlots[i]), templateElement);
|
|
829
|
+
if (slot) {
|
|
830
|
+
return slot;
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
else if (vSlots && vSlots[templateElement]) {
|
|
835
|
+
return vSlots;
|
|
836
|
+
}
|
|
837
|
+
else if (children) {
|
|
838
|
+
for (var i = 0; i < children.length; i++) {
|
|
839
|
+
var slot = getVue2ChildSlot(getSlot(children[i]), templateElement);
|
|
840
|
+
if (slot) {
|
|
841
|
+
return slot;
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
return undefined;
|
|
846
|
+
}
|
|
847
|
+
function getSlot(vnode) {
|
|
848
|
+
var slot = (vnode.componentOptions && vnode.componentOptions.children) ? vnode.componentOptions : vnode.data;
|
|
849
|
+
return vnode.componentInstance ? vnode.componentInstance : slot;
|
|
850
|
+
}
|
|
851
|
+
// Get the Vue3 slot template from the root or current Vue component.
|
|
852
|
+
function getVue3Slot(vueInstance, templateElement, root) {
|
|
853
|
+
if (!vueInstance && !(root && root.vueInstance)) {
|
|
854
|
+
return undefined;
|
|
855
|
+
}
|
|
856
|
+
var slots = (root && root.vueInstance) ? root.vueInstance.$slots : vueInstance.$slots;
|
|
857
|
+
return getVue3ChildSlot(slots, templateElement);
|
|
858
|
+
}
|
|
859
|
+
function getVue3ChildSlot(slots, templateElement) {
|
|
860
|
+
if (slots && slots[templateElement]) {
|
|
861
|
+
return slots;
|
|
862
|
+
}
|
|
863
|
+
else if (slots && slots.default) {
|
|
864
|
+
var childSlots = slots.default();
|
|
865
|
+
for (var i = 0; i < childSlots.length; i++) {
|
|
866
|
+
var slot = getVue3ChildSlot(childSlots[i].children, templateElement);
|
|
867
|
+
if (slot) {
|
|
868
|
+
return slot;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
return undefined;
|
|
873
|
+
}
|
|
725
874
|
|
|
726
875
|
/**
|
|
727
876
|
* index for component base
|