qcobjects-sdk 0.0.1 → 0.0.3
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/.eslintrc.json +28 -0
- package/.github/FUNDING.yml +12 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- package/.github/ISSUE_TEMPLATE/custom.md +10 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/.github/ISSUE_TEMPLATE/issue-template.md +33 -0
- package/.github/workflows/codeql-analysis.yml +71 -0
- package/.github/workflows/npmpublish-beta.yml +38 -0
- package/.github/workflows/npmpublish-lts.yml +38 -0
- package/.github/workflows/npmpublish-main.yml +38 -0
- package/CHANGELOG.md +47 -0
- package/QCObjects-SDK.js +108 -232
- package/README.md +951 -6
- package/VERSION +1 -0
- package/css/base-modal.css +43 -0
- package/css/basic-layout-embedded-nav.css +14 -0
- package/css/basic-layout.css +76 -0
- package/css/components/horizontal-list.css +64 -0
- package/css/components/list.css +57 -0
- package/css/components/splashscreen.css +111 -0
- package/css/modal.css +46 -0
- package/demo-tests/test-component-grid.html +63 -0
- package/demo-tests/test-component-list.html +53 -0
- package/demo-tests/test-component-notifications.html +49 -0
- package/demo-tests/test-component-slider.html +68 -0
- package/favicon.ico +0 -0
- package/js/org.qcobjects.cloud.auth.session.data.js +136 -0
- package/js/org.qcobjects.cloud.auth.session.usertoken.js +107 -0
- package/js/org.qcobjects.components.grid.js +71 -0
- package/js/org.qcobjects.components.js +277 -0
- package/js/org.qcobjects.components.list.js +57 -0
- package/js/org.qcobjects.components.notifications.js +190 -0
- package/js/org.qcobjects.components.slider.js +217 -0
- package/js/org.qcobjects.components.splashscreen.js +622 -0
- package/js/org.qcobjects.controllers.form.js +214 -0
- package/js/org.qcobjects.controllers.grid.js +289 -0
- package/js/org.qcobjects.controllers.js +42 -0
- package/js/org.qcobjects.controllers.list.js +241 -0
- package/js/org.qcobjects.controllers.slider.js +148 -0
- package/js/org.qcobjects.controllers.swagger.js +86 -0
- package/js/org.qcobjects.effects.js +388 -0
- package/js/org.qcobjects.i18n_messages.js +58 -0
- package/js/org.qcobjects.modal.controllers.js +47 -0
- package/js/org.qcobjects.modal.effects.js +57 -0
- package/js/org.qcobjects.models.js +48 -0
- package/js/org.qcobjects.tools.canvas.js +59 -0
- package/js/org.qcobjects.tools.js +68 -0
- package/js/org.qcobjects.tools.layouts.js +82 -0
- package/js/org.qcobjects.views.js +42 -0
- package/package.json +17 -4
- package/spec/support/jasmine.json +16 -0
- package/spec/testsSpec.js +9 -0
- package/templates/components/modalyoulose.tpl.html +3 -0
- package/templates/components/modalyouwin.tpl.html +4 -0
- package/templates/components/splashscreen.tpl.html +128 -0
- package/templates/components/swagger-ui.tpl.html +22 -0
- package/v2.4 version +1 -0
package/QCObjects-SDK.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* QCObjects SDK
|
|
2
|
+
* QCObjects SDK 2.4
|
|
3
3
|
* ________________
|
|
4
4
|
*
|
|
5
5
|
* Author: Jean Machuca <correojean@gmail.com>
|
|
@@ -21,242 +21,118 @@
|
|
|
21
21
|
*
|
|
22
22
|
* Everyone is permitted to copy and distribute verbatim copies of this
|
|
23
23
|
* license document, but changing it is not allowed.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
*/
|
|
25
|
+
(function (_top) {
|
|
26
|
+
"use strict";
|
|
27
|
+
var isBrowser = typeof window !== "undefined" && typeof window.self !== "undefined" && window === window.self;
|
|
28
|
+
var remoteImportsPath = CONFIG.get("remoteImportsPath");
|
|
29
|
+
var relativeImportPath = CONFIG.get("relativeImportPath");
|
|
30
|
+
var external = (!CONFIG.get("useLocalSDK")) ? (true) : (false);
|
|
31
|
+
if (external) {
|
|
32
|
+
CONFIG.set("remoteImportsPath", "https://sdk.qcobjects.dev/v2.4/js/");
|
|
33
|
+
} else {
|
|
34
|
+
CONFIG.set("relativeImportPath", "qcobjects-sdk/js/");
|
|
35
|
+
}
|
|
36
|
+
if (typeof _top._DOMCreateElement === "undefined") {
|
|
37
|
+
_top._DOMCreateElement = function (elementName) {
|
|
38
|
+
var _ret_;
|
|
39
|
+
if (isBrowser) {
|
|
40
|
+
_ret_ = document.createElement(elementName);
|
|
41
|
+
} else {
|
|
42
|
+
_ret_ = {};
|
|
43
|
+
}
|
|
44
|
+
return _ret_;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
var _imports_;
|
|
48
|
+
if (isBrowser) {
|
|
49
|
+
_imports_ = [
|
|
50
|
+
Import("org.qcobjects.i18n_messages", function () {}, external),
|
|
51
|
+
Import("org.qcobjects.models", function () {}, external),
|
|
52
|
+
Import("org.qcobjects.components", function () {}, external),
|
|
53
|
+
Import("org.qcobjects.components.grid", function () {}, external),
|
|
54
|
+
Import("org.qcobjects.components.list", function () {}, external),
|
|
55
|
+
Import("org.qcobjects.components.slider", function () {}, external),
|
|
56
|
+
Import("org.qcobjects.components.notifications", function () {}, external),
|
|
57
|
+
Import("org.qcobjects.components.splashscreen", function () {}, external),
|
|
58
|
+
Import("org.qcobjects.controllers", function () {}, external),
|
|
59
|
+
Import("org.qcobjects.controllers.grid", function () {}, external),
|
|
60
|
+
Import("org.qcobjects.controllers.list", function () {}, external),
|
|
61
|
+
Import("org.qcobjects.controllers.slider", function () {}, external),
|
|
62
|
+
Import("org.qcobjects.controllers.form", function () {}, external),
|
|
63
|
+
Import("org.qcobjects.controllers.swagger", function () {}, external),
|
|
64
|
+
Import("org.qcobjects.effects", function () {}, external),
|
|
65
|
+
Import("org.qcobjects.modal.controllers", function () {}, external),
|
|
66
|
+
Import("org.qcobjects.views", function () {}, external),
|
|
67
|
+
Import("org.qcobjects.tools.canvas", function () {}, external),
|
|
68
|
+
Import("org.qcobjects.tools.layouts", function () {}, external),
|
|
69
|
+
Import("org.qcobjects.cloud.auth.session.usertoken", function () {}, external),
|
|
70
|
+
Import("org.qcobjects.cloud.auth.session.data", function () {}, external)
|
|
71
|
+
];
|
|
72
|
+
} else {
|
|
73
|
+
// non-browsers environment
|
|
74
|
+
(function loadBackendSDKRoutes(){
|
|
75
|
+
if (!loadBackendSDKRoutes.loaded){
|
|
76
|
+
let backend = CONFIG.get("backend");
|
|
77
|
+
if (typeof backend === "undefined"){
|
|
78
|
+
backend = {};
|
|
38
79
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
_obj.addEventListener('change',function(e){
|
|
42
|
-
logger.debug('Executing change event binding');
|
|
43
|
-
thisobj.executeBindings();
|
|
44
|
-
});
|
|
45
|
-
_obj.addEventListener('keydown',function(e){
|
|
46
|
-
logger.debug('Executing keydown event binding');
|
|
47
|
-
thisobj.executeBindings();
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
executeBinding:function (_obj){
|
|
52
|
-
var _datamodel = _obj.getAttribute('data-field');
|
|
53
|
-
logger.debug('Binding '+_datamodel+' for '+this.name);
|
|
54
|
-
this.data[_datamodel]=_obj.value;
|
|
55
|
-
},
|
|
56
|
-
executeBindings:function (){
|
|
57
|
-
if (typeof this.fieldType =='undefined' || this.fieldType == null ){
|
|
58
|
-
var _objList = this.body.subelements('*[data-field]'); // every child with data-field set
|
|
59
|
-
} else {
|
|
60
|
-
var _objList = this.body.subelements(this.fieldType+'[data-field]'); // every child with data-field set and tagname is equal to fieldType property
|
|
80
|
+
if (typeof backend.routes === "undefined"){
|
|
81
|
+
backend.routes = [];
|
|
61
82
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
83
|
+
backend.routes = backend.routes.concat([
|
|
84
|
+
{
|
|
85
|
+
"name":"QCObjects-SDK",
|
|
86
|
+
"description":"Redirection of QCObjects SDK",
|
|
87
|
+
"path":"^/qcobjects-sdk/(.*)$",
|
|
88
|
+
"microservice":"com.qcobjects.backend.microservice.static",
|
|
89
|
+
"redirect_to": "./node_modules/qcobjects-sdk/$1",
|
|
90
|
+
"responseHeaders":{},
|
|
91
|
+
"cors":{
|
|
92
|
+
"allow_origins":"*"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"name":"QCObjects-SDK.js",
|
|
97
|
+
"description":"Redirection of QCObjects SDK",
|
|
98
|
+
"path":"^/js/packages/QCObjects-SDK.js$",
|
|
99
|
+
"microservice":"com.qcobjects.backend.microservice.static",
|
|
100
|
+
"redirect_to": "./node_modules/qcobjects-sdk/QCObjects-SDK.js",
|
|
101
|
+
"responseHeaders":{},
|
|
102
|
+
"cors":{
|
|
103
|
+
"allow_origins":"*"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
]);
|
|
107
|
+
CONFIG.set("backend", backend);
|
|
108
|
+
loadBackendSDKRoutes.loaded = true;
|
|
74
109
|
}
|
|
75
|
-
})
|
|
76
|
-
Class('ButtonField',FormField,{
|
|
77
|
-
fieldType:'button'
|
|
78
|
-
}),
|
|
79
|
-
Class('InputField',FormField,{
|
|
80
|
-
fieldType:'input'
|
|
81
|
-
}),
|
|
82
|
-
Class('TextField',FormField,{
|
|
83
|
-
fieldType:'textarea'
|
|
84
|
-
}),
|
|
85
|
-
Class('EmailField',FormField,{
|
|
86
|
-
fieldType:'input'
|
|
87
|
-
})
|
|
88
|
-
]);
|
|
89
|
-
Package('org.quickcorp.tools.effects',[
|
|
90
|
-
Class('Effect',{
|
|
91
|
-
animate: function ({timing, draw, duration}) {
|
|
92
|
-
|
|
93
|
-
let start = performance.now();
|
|
110
|
+
})();
|
|
94
111
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
112
|
+
var _relative_path_ = "qcobjects-sdk/js/";
|
|
113
|
+
_imports_ = [
|
|
114
|
+
Import(_relative_path_ + "org.qcobjects.models", function () {}, external),
|
|
115
|
+
Import(_relative_path_ + "org.qcobjects.components", function () {}, external),
|
|
116
|
+
Import(_relative_path_ + "org.qcobjects.controllers", function () {}, external),
|
|
117
|
+
Import(_relative_path_ + "org.qcobjects.views", function () {}, external),
|
|
118
|
+
Import(_relative_path_ + "org.qcobjects.effects", function () {}, external),
|
|
119
|
+
Import(_relative_path_ + "org.qcobjects.tools.canvas", function () {}, external),
|
|
120
|
+
Import(_relative_path_ + "org.qcobjects.tools.layouts", function () {}, external),
|
|
121
|
+
Import(_relative_path_ + "org.qcobjects.cloud.auth.session.usertoken", function () {}, external),
|
|
122
|
+
Import(_relative_path_ + "org.qcobjects.cloud.auth.session.data", function () {}, external)
|
|
123
|
+
];
|
|
99
124
|
|
|
100
|
-
|
|
101
|
-
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
_top._sdk_ = Promise.all(_imports_).then(function () {
|
|
128
|
+
CONFIG.set("useSDK", true);
|
|
129
|
+
CONFIG.set("remoteImportsPath", remoteImportsPath);
|
|
130
|
+
CONFIG.set("relativeImportPath", relativeImportPath);
|
|
131
|
+
_top.__start__();
|
|
102
132
|
|
|
103
|
-
draw(Math.round(progress*100)); // draw it
|
|
104
|
-
|
|
105
|
-
if (timeFraction < 1) {
|
|
106
|
-
requestAnimationFrame(animate);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}),
|
|
112
|
-
Class('Move',Effect,{
|
|
113
|
-
apply: function (element, xfrom, yfrom, xto, yto){
|
|
114
|
-
var dx = xto-xfrom;
|
|
115
|
-
var dy = yto-yfrom;
|
|
116
|
-
this.animate({
|
|
117
|
-
duration: 1000,
|
|
118
|
-
timing(timeFraction) {
|
|
119
|
-
return timeFraction;
|
|
120
|
-
},
|
|
121
|
-
draw(progress) {
|
|
122
|
-
logger.debug('animation progress: '+progress.toString());
|
|
123
|
-
var y = yfrom + (progress*dy/100);
|
|
124
|
-
var x = xfrom + (progress*dx/100);
|
|
125
|
-
logger.debug('x: '+x.toString()+' y:'+y.toString());
|
|
126
|
-
element.style.top=y;
|
|
127
|
-
element.style.left=x;
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}),
|
|
132
|
-
Class('RotateX',Effect,{
|
|
133
|
-
apply: function (element, angleFrom,angleTo){
|
|
134
|
-
var da = angleTo-angleFrom;
|
|
135
|
-
this.animate({
|
|
136
|
-
duration: 1000,
|
|
137
|
-
timing(timeFraction) {
|
|
138
|
-
return timeFraction;
|
|
139
|
-
},
|
|
140
|
-
draw(progress) {
|
|
141
|
-
logger.debug('animation progress: '+progress.toString());
|
|
142
|
-
var angle = Math.round(angleFrom + (progress*da/100));
|
|
143
|
-
logger.debug('angle: '+angle.toString());
|
|
144
|
-
element.style.transform= 'rotate3d(1,0,0,'+angle.toString()+'deg)';
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}),
|
|
149
|
-
Class('RotateY',Effect,{
|
|
150
|
-
apply: function (element, angleFrom,angleTo){
|
|
151
|
-
var da = angleTo-angleFrom;
|
|
152
|
-
this.animate({
|
|
153
|
-
duration: 1000,
|
|
154
|
-
timing(timeFraction) {
|
|
155
|
-
return timeFraction;
|
|
156
|
-
},
|
|
157
|
-
draw(progress) {
|
|
158
|
-
logger.debug('animation progress: '+progress.toString());
|
|
159
|
-
var angle = Math.round(angleFrom + (progress*da/100));
|
|
160
|
-
logger.debug('angle: '+angle.toString());
|
|
161
|
-
element.style.transform= 'rotate3d(0,1,0,'+angle.toString()+'deg)';
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
}),
|
|
166
|
-
Class('RotateZ',Effect,{
|
|
167
|
-
apply: function (element, angleFrom,angleTo){
|
|
168
|
-
var da = angleTo-angleFrom;
|
|
169
|
-
this.animate({
|
|
170
|
-
duration: 1000,
|
|
171
|
-
timing(timeFraction) {
|
|
172
|
-
return timeFraction;
|
|
173
|
-
},
|
|
174
|
-
draw(progress) {
|
|
175
|
-
logger.debug('animation progress: '+progress.toString());
|
|
176
|
-
var angle = Math.round(angleFrom + (progress*da/100));
|
|
177
|
-
logger.debug('angle: '+angle.toString());
|
|
178
|
-
element.style.transform= 'rotate3d(0,0,1,'+angle.toString()+'deg)';
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
}),
|
|
183
|
-
Class('Rotate',Effect,{
|
|
184
|
-
apply: function (element, angleFrom,angleTo){
|
|
185
|
-
var da = angleTo-angleFrom;
|
|
186
|
-
this.animate({
|
|
187
|
-
duration: 1000,
|
|
188
|
-
timing(timeFraction) {
|
|
189
|
-
return timeFraction;
|
|
190
|
-
},
|
|
191
|
-
draw(progress) {
|
|
192
|
-
logger.debug('animation progress: '+progress.toString());
|
|
193
|
-
var angle = Math.round(angleFrom + (progress*da/100));
|
|
194
|
-
logger.debug('angle: '+angle.toString());
|
|
195
|
-
element.style.transform= 'rotate3d(1,1,1,'+angle.toString()+'deg)';
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
}),
|
|
200
|
-
Class('Fade',Effect,{
|
|
201
|
-
apply: function (element, alphaFrom,alphaTo){
|
|
202
|
-
var da = alphaTo-alphaFrom;
|
|
203
|
-
this.animate({
|
|
204
|
-
duration: 1000,
|
|
205
|
-
timing(timeFraction) {
|
|
206
|
-
return timeFraction;
|
|
207
|
-
},
|
|
208
|
-
draw(progress) {
|
|
209
|
-
logger.debug('animation progress: '+progress.toString());
|
|
210
|
-
var alpha = alphaFrom + (progress*da/100);
|
|
211
|
-
logger.debug('alpha: '+alpha.toString());
|
|
212
|
-
element.style.opacity= alpha.toString();
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
}),
|
|
217
|
-
Class('Radius',Effect,{
|
|
218
|
-
apply: function (element, radiusFrom,radiusTo){
|
|
219
|
-
var dr = radiusTo-radiusFrom;
|
|
220
|
-
this.animate({
|
|
221
|
-
duration: 1000,
|
|
222
|
-
timing(timeFraction) {
|
|
223
|
-
return timeFraction;
|
|
224
|
-
},
|
|
225
|
-
draw(progress) {
|
|
226
|
-
logger.debug('animation progress: '+progress.toString());
|
|
227
|
-
var radius = radiusFrom + (progress*dr/100);
|
|
228
|
-
logger.debug('alpha: '+radius.toString());
|
|
229
|
-
element.style.borderRadius= radius.toString()+'px';
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
})
|
|
234
|
-
]);
|
|
235
|
-
Package('org.quickcorp.tools.canvas',[
|
|
236
|
-
Class('CanvasTool',{
|
|
237
|
-
drawImageFilled: function (img,canvas){
|
|
238
|
-
// get the scale
|
|
239
|
-
var scale = Math.max(canvas.width / img.width, canvas.height / img.height);
|
|
240
|
-
// get the top left position of the image
|
|
241
|
-
var x = (canvas.width / 2) - (img.width / 2) * scale;
|
|
242
|
-
var y = (canvas.height / 2) - (img.height / 2) * scale;
|
|
243
|
-
var ctx = canvas.getContext('2d');
|
|
244
|
-
ctx.drawImage(img, x, y, img.width * scale, img.height * scale);
|
|
245
|
-
},
|
|
246
|
-
getImageResized: function (img,width,height,resizedImage){
|
|
247
|
-
var canvas = document.createElement('canvas');
|
|
248
|
-
canvas.width = width;
|
|
249
|
-
canvas.height = height;
|
|
250
|
-
canvas.style.width = width;
|
|
251
|
-
canvas.style.height = height;
|
|
252
|
-
this.drawImageFilled(img,canvas);
|
|
253
|
-
resizedImage.src = canvas.toDataURL("image/png");
|
|
254
|
-
return canvas;
|
|
255
|
-
}
|
|
256
|
-
})
|
|
257
|
-
]);
|
|
258
|
-
Ready(function (){
|
|
259
|
-
CONFIG.set('useSDK',true);
|
|
260
133
|
});
|
|
261
134
|
|
|
262
|
-
|
|
135
|
+
|
|
136
|
+
}).call(null, (typeof module === "object" && typeof module.exports === "object") ? (module.exports = global) : ((typeof global === "object") ? (global) : (
|
|
137
|
+
(typeof window === "object") ? (window) : ({})
|
|
138
|
+
)));
|