@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.
- package/CHANGELOG.md +12 -0
- package/dist/ej2-vue-base.umd.min.js +2 -12
- package/dist/ej2-vue-base.umd.min.js.map +1 -1
- package/dist/es6/ej2-vue-base.es2015.js +465 -528
- package/dist/es6/ej2-vue-base.es2015.js.map +1 -1
- package/dist/es6/ej2-vue-base.es5.js +505 -578
- 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 +26 -9
- package/postinstall.js +1 -119
- package/src/component-base.d.ts +4 -48
- package/src/component-base.js +448 -441
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -1
- package/src/template.js +64 -5
- package/GitLeaksReport.json +0 -1
- package/gitleaks-ci/gitleaks +0 -0
- package/gitleaks-ci.tar.gz +0 -0
- package/src/component-decorator.d.ts +0 -4
- package/src/component-decorator.js +0 -144
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
package/src/template.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { setTemplateEngine, getTemplateEngine, getUniqueID, createElement, detach, extend, getValue } from "@syncfusion/ej2-base";
|
|
13
|
+
import { aVue as Vue, isExecute } from "./component-base";
|
|
4
14
|
// tslint:disable:no-any
|
|
5
15
|
var stringCompiler = getTemplateEngine();
|
|
6
16
|
export function compile(templateElement, helper) {
|
|
@@ -20,7 +30,7 @@ export function compile(templateElement, helper) {
|
|
|
20
30
|
var vueSlot_1 = getCurrentVueSlot(context.vueInstance, templateElement, root);
|
|
21
31
|
if (vueSlot_1) {
|
|
22
32
|
// Compilation for Vue 3 slot template
|
|
23
|
-
var app =
|
|
33
|
+
var app = Vue.createApp({
|
|
24
34
|
render: function () {
|
|
25
35
|
return vueSlot_1["" + templateElement]({ data: data });
|
|
26
36
|
}
|
|
@@ -30,6 +40,8 @@ export function compile(templateElement, helper) {
|
|
|
30
40
|
app.use(plugins[parseInt(i.toString(), 10)]);
|
|
31
41
|
}
|
|
32
42
|
}
|
|
43
|
+
// Get values for Vue 3 slot template
|
|
44
|
+
getValues(app, context.vueInstance, root);
|
|
33
45
|
app.mount((context.getModuleName() === 'grid') ? ("#" + pid) : ("#" + id));
|
|
34
46
|
returnEle = ele.childNodes;
|
|
35
47
|
detach(ele);
|
|
@@ -85,12 +97,14 @@ export function compile(templateElement, helper) {
|
|
|
85
97
|
}
|
|
86
98
|
}
|
|
87
99
|
templateCompRef.data = function () { return tempRef_1; };
|
|
88
|
-
var app =
|
|
100
|
+
var app = Vue.createApp(templateCompRef);
|
|
89
101
|
if (plugins) {
|
|
90
102
|
for (var i = 0; i < plugins.length; i++) {
|
|
91
103
|
app.use(plugins[parseInt(i.toString(), 10)]);
|
|
92
104
|
}
|
|
93
105
|
}
|
|
106
|
+
// Get values for Vue 3 functional template
|
|
107
|
+
getValues(app, context.vueInstance, root);
|
|
94
108
|
app.mount((context.getModuleName() === 'grid') ? ("#" + pid) : ("#" + id));
|
|
95
109
|
returnEle = ele.childNodes;
|
|
96
110
|
detach(ele);
|
|
@@ -98,8 +112,22 @@ export function compile(templateElement, helper) {
|
|
|
98
112
|
else if (typeof templateElement === "string") {
|
|
99
113
|
var vueSlot_2 = getVueSlot(context.vueInstance, templateElement, root);
|
|
100
114
|
if (vueSlot_2) {
|
|
115
|
+
// Get provide values for Vue 2 slot template
|
|
116
|
+
var provided_1 = {};
|
|
117
|
+
var getProvideValues_1 = function (vueinstance) {
|
|
118
|
+
if (vueinstance['$parent'])
|
|
119
|
+
getProvideValues_1(vueinstance.$parent);
|
|
120
|
+
if (vueinstance['_provided'] && Object.keys(vueinstance['_provided']).length > 0) {
|
|
121
|
+
provided_1 = __assign({}, provided_1, vueinstance._provided);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
var vueInstance = context.vueInstance ? context.vueInstance : ((root && root.vueInstance) ? root.vueInstance : null);
|
|
125
|
+
if (vueInstance) {
|
|
126
|
+
getProvideValues_1(vueInstance);
|
|
127
|
+
}
|
|
101
128
|
// Compilation for Vue 2 slot template
|
|
102
129
|
var vueTemplate = new Vue({
|
|
130
|
+
provide: __assign({}, provided_1),
|
|
103
131
|
render: function () {
|
|
104
132
|
return vueSlot_2["" + templateElement]({ data: data });
|
|
105
133
|
}
|
|
@@ -155,6 +183,37 @@ export function compile(templateElement, helper) {
|
|
|
155
183
|
};
|
|
156
184
|
}
|
|
157
185
|
setTemplateEngine({ compile: compile });
|
|
186
|
+
function getValues(app, cInstance, root) {
|
|
187
|
+
var vueInstance = cInstance ? cInstance : ((root && root.vueInstance) ? root.vueInstance : null);
|
|
188
|
+
if (!vueInstance) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
// Get globally defined variables.
|
|
192
|
+
var globalVariables = ['components', 'mixins', 'provides'];
|
|
193
|
+
for (var i = 0; i < globalVariables.length; i++) {
|
|
194
|
+
var gVariable = globalVariables[i];
|
|
195
|
+
if (app['_context'][gVariable] && vueInstance['$']['appContext'][gVariable]) {
|
|
196
|
+
app['_context'][gVariable] = vueInstance['$']['appContext'][gVariable];
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// Get provide value from child component.
|
|
200
|
+
var provided = {};
|
|
201
|
+
var getProvideValue = function (vueinstance) {
|
|
202
|
+
if (vueinstance['$'] && vueinstance['$']['parent'])
|
|
203
|
+
getProvideValue(vueinstance.$.parent);
|
|
204
|
+
if (vueinstance['provides'] && Object.keys(vueinstance['provides']).length > 0) {
|
|
205
|
+
provided = __assign({}, provided, vueinstance.provides);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
getProvideValue(vueInstance);
|
|
209
|
+
if (app['_context']['provides']) {
|
|
210
|
+
app._context.provides = __assign({}, app._context.provides, provided);
|
|
211
|
+
}
|
|
212
|
+
// Get globally defined properties.
|
|
213
|
+
if (app['_context']['config']['globalProperties'] && vueInstance['$']['appContext']['config']['globalProperties']) {
|
|
214
|
+
app['_context']['config']['globalProperties'] = vueInstance['$']['appContext']['config']['globalProperties'];
|
|
215
|
+
}
|
|
216
|
+
}
|
|
158
217
|
// Get the Vue2 slot template from the root or current Vue component.
|
|
159
218
|
function getVueSlot(vueInstance, templateElement, root) {
|
|
160
219
|
if (!vueInstance && !(root && root.vueInstance)) {
|
package/GitLeaksReport.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[]
|
package/gitleaks-ci/gitleaks
DELETED
|
Binary file
|
package/gitleaks-ci.tar.gz
DELETED
|
Binary file
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vue Component Base
|
|
3
|
-
*/
|
|
4
|
-
import Vue from 'vue';
|
|
5
|
-
// import { Base, Component as EJ2Component, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
6
|
-
import { ComponentBase } from './component-base';
|
|
7
|
-
export var $internalHooks = [
|
|
8
|
-
'data',
|
|
9
|
-
'beforeCreate',
|
|
10
|
-
'created',
|
|
11
|
-
'beforeMount',
|
|
12
|
-
'mounted',
|
|
13
|
-
'beforeDestroy',
|
|
14
|
-
'destroyed',
|
|
15
|
-
'beforeUpdate',
|
|
16
|
-
'updated',
|
|
17
|
-
'activated',
|
|
18
|
-
'deactivated',
|
|
19
|
-
'render',
|
|
20
|
-
'errorCaptured' // 2.5
|
|
21
|
-
];
|
|
22
|
-
export function getProps(options) {
|
|
23
|
-
if (options === void 0) { options = {}; }
|
|
24
|
-
if (options.props) {
|
|
25
|
-
var _loop_1 = function (prop) {
|
|
26
|
-
(options.newprops || (options.newprops = {}))["" + prop] = {};
|
|
27
|
-
(options.watch || (options.watch = {}))["" + prop] = function (newVal) {
|
|
28
|
-
this.ej2Instances["" + prop] = newVal;
|
|
29
|
-
if (this.dataBind && (options.name !== 'DateRangePickerComponent')) {
|
|
30
|
-
this.dataBind();
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
for (var _i = 0, _a = options.props; _i < _a.length; _i++) {
|
|
35
|
-
var prop = _a[_i];
|
|
36
|
-
_loop_1(prop);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return [options.newprops, options.watch];
|
|
40
|
-
}
|
|
41
|
-
export function EJComponentDecorator(options, isExecute) {
|
|
42
|
-
if (!isExecute) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
return function (Component) {
|
|
46
|
-
return EJcomponentFactory(Component, options);
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
export function EJcomponentFactory(Component, options) {
|
|
50
|
-
if (options === void 0) { options = {}; }
|
|
51
|
-
options.name = options.name || Component._componentTag || Component.name;
|
|
52
|
-
// prototype props.
|
|
53
|
-
var proto = Component.prototype;
|
|
54
|
-
if (options.props) {
|
|
55
|
-
var _loop_2 = function (prop) {
|
|
56
|
-
(options.props || (options.props = {}))["" + prop] = {};
|
|
57
|
-
(options.watch || (options.watch = {}))["" + prop] = function (newVal) {
|
|
58
|
-
this.ej2Instances["" + prop] = newVal;
|
|
59
|
-
if (this.dataBind && (options.name !== 'DateRangePickerComponent')) {
|
|
60
|
-
this.dataBind();
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
for (var _i = 0, _a = options.props; _i < _a.length; _i++) {
|
|
65
|
-
var prop = _a[_i];
|
|
66
|
-
_loop_2(prop);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
Object.getOwnPropertyNames(proto).forEach(function (key) {
|
|
70
|
-
// hooks
|
|
71
|
-
if (key === 'constructor') {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if ($internalHooks.indexOf(key) > -1) {
|
|
75
|
-
options["" + key] = proto["" + key];
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
var descriptor = Object.getOwnPropertyDescriptor(proto, key);
|
|
79
|
-
if (typeof descriptor.value === 'function') {
|
|
80
|
-
// methods
|
|
81
|
-
(options.methods || (options.methods = {}))["" + key] = descriptor.value;
|
|
82
|
-
}
|
|
83
|
-
else if (descriptor.get || descriptor.set) {
|
|
84
|
-
// computed properties
|
|
85
|
-
(options.computed || (options.computed = {}))["" + key] = {
|
|
86
|
-
get: descriptor.get,
|
|
87
|
-
set: descriptor.set
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
Object.getOwnPropertyNames(ComponentBase.prototype).forEach(function (key) {
|
|
92
|
-
if ($internalHooks.indexOf(key) > -1) {
|
|
93
|
-
options["" + key] = proto["" + key];
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
(options.mixins || (options.mixins = [])).push({
|
|
98
|
-
data: function () {
|
|
99
|
-
return collectDataFromConstructor(this, Component);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
// decorate options
|
|
103
|
-
var decorators = Component.__decorators__;
|
|
104
|
-
if (decorators) {
|
|
105
|
-
decorators.forEach(Function(options));
|
|
106
|
-
delete Component.__decorators__;
|
|
107
|
-
}
|
|
108
|
-
// find super
|
|
109
|
-
var superProto = Object.getPrototypeOf(Component.prototype);
|
|
110
|
-
var Super = superProto instanceof Vue
|
|
111
|
-
? superProto.constructor
|
|
112
|
-
: Vue;
|
|
113
|
-
var Extended = Super.extend(options);
|
|
114
|
-
return Extended;
|
|
115
|
-
}
|
|
116
|
-
function collectDataFromConstructor(vm, Component) {
|
|
117
|
-
Component.prototype._init = function () {
|
|
118
|
-
var _this = this;
|
|
119
|
-
var keys = Object.getOwnPropertyNames(vm);
|
|
120
|
-
if (vm.$options.props) {
|
|
121
|
-
for (var key in vm.$options.props) {
|
|
122
|
-
if (!vm.hasOwnProperty(key)) {
|
|
123
|
-
keys.push(key);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
keys.forEach(function (key) {
|
|
128
|
-
if (key.charAt(0) !== '_') {
|
|
129
|
-
Object.defineProperty(_this, key, {
|
|
130
|
-
get: function () { return vm["" + key]; },
|
|
131
|
-
set: function (value) { return vm["" + key] = value; }
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
var data = new Component();
|
|
137
|
-
var plainData = {};
|
|
138
|
-
Object.keys(data).forEach(function (key) {
|
|
139
|
-
if (data["" + key] !== undefined) {
|
|
140
|
-
plainData["" + key] = data["" + key];
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
return plainData;
|
|
144
|
-
}
|