qcobjects-sdk 2.4.5 → 2.4.8
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 +26 -21
- package/QCObjects-SDK.js +47 -47
- package/VERSION +1 -1
- package/demo-tests/test-component-grid.html +43 -30
- package/demo-tests/test-component-list.html +31 -23
- package/demo-tests/test-component-notifications.html +31 -12
- package/demo-tests/test-component-slider.html +47 -31
- package/js/org.qcobjects.cloud.auth.session.data.js +106 -47
- package/js/org.qcobjects.cloud.auth.session.usertoken.js +64 -54
- package/js/org.qcobjects.components.grid.js +46 -34
- package/js/org.qcobjects.components.js +137 -80
- package/js/org.qcobjects.components.list.js +27 -18
- package/js/org.qcobjects.components.notifications.js +73 -58
- package/js/org.qcobjects.components.slider.js +174 -151
- package/js/org.qcobjects.components.splashscreen.js +480 -460
- package/js/org.qcobjects.controllers.form.js +38 -20
- package/js/org.qcobjects.controllers.grid.js +46 -25
- package/js/org.qcobjects.controllers.js +38 -6
- package/js/org.qcobjects.controllers.list.js +169 -157
- package/js/org.qcobjects.controllers.slider.js +113 -97
- package/js/org.qcobjects.controllers.swagger.js +60 -51
- package/js/org.qcobjects.effects.js +149 -124
- package/js/org.qcobjects.i18n_messages.js +11 -6
- package/js/org.qcobjects.modal.controllers.js +14 -9
- package/js/org.qcobjects.modal.effects.js +25 -16
- package/js/org.qcobjects.models.js +19 -11
- package/js/org.qcobjects.tools.canvas.js +10 -6
- package/js/org.qcobjects.tools.js +17 -8
- package/js/org.qcobjects.tools.layouts.js +19 -8
- package/js/org.qcobjects.views.js +12 -7
- package/package.json +3 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* QCObjects SDK 2.
|
|
2
|
+
* QCObjects SDK 2.4
|
|
3
3
|
* ________________
|
|
4
4
|
*
|
|
5
5
|
* Author: Jean Machuca <correojean@gmail.com>
|
|
@@ -21,56 +21,115 @@
|
|
|
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
|
-
(function() {
|
|
26
|
-
"use strict";
|
|
24
|
+
*/
|
|
25
|
+
(function () {
|
|
26
|
+
"use strict";
|
|
27
|
+
Package("org.qcobjects.cloud.auth.session.data", [
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
class SessionData {
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates an instance of SessionData.
|
|
33
|
+
*/
|
|
34
|
+
constructor() {
|
|
35
|
+
this.__session_container__ = null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Sets the session container
|
|
40
|
+
*
|
|
41
|
+
* @param {*} sessionContainer1, sessionContainer2, ...
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
setSessionContainer() {
|
|
45
|
+
this.__session_container__ = [...arguments];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Gets the session container
|
|
50
|
+
*
|
|
51
|
+
* @return {*} sessionContainer
|
|
52
|
+
*/
|
|
53
|
+
getSessionContainer() {
|
|
54
|
+
if (typeof this.__session_container__ === "undefined" || this.__session_container__ === null) {
|
|
55
|
+
throw new Error("You need to set a session container first: sessionData.setSessionContainer(...arguments)");
|
|
56
|
+
}
|
|
57
|
+
return this.__session_container__;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Gets the session data
|
|
62
|
+
*
|
|
63
|
+
* @return {*} sessionData
|
|
64
|
+
*/
|
|
65
|
+
getSessionData() {
|
|
66
|
+
var __instance__ = this;
|
|
67
|
+
var s = sessionStorage.getItem(`${__instance__.index(...arguments)}`);
|
|
68
|
+
var sessionData = JSON.parse(s);
|
|
69
|
+
if (typeof sessionData === "undefined" || sessionData === null) {
|
|
70
|
+
sessionData = {};
|
|
71
|
+
}
|
|
72
|
+
return sessionData;
|
|
37
73
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Returns an index of the session
|
|
77
|
+
*
|
|
78
|
+
* @param {string} valueForIndex
|
|
79
|
+
* @return {string} index
|
|
80
|
+
* @example sessionInstance.index("me@email.com", "myusername")
|
|
81
|
+
*
|
|
82
|
+
*/
|
|
83
|
+
index() {
|
|
84
|
+
if (typeof SessionUserToken === "undefined") {
|
|
85
|
+
throw new Error("You need to import SessionUserToken first: Import (\"org.qcobjects.cloud.auth.session.usertoken\")");
|
|
86
|
+
}
|
|
87
|
+
return `session_${btoa(SessionUserToken.getGlobalUserToken(...arguments))}`;
|
|
46
88
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Saves the session instance
|
|
91
|
+
*
|
|
92
|
+
*/
|
|
93
|
+
save() {
|
|
94
|
+
var __instance__ = this;
|
|
95
|
+
var s = _DataStringify(__instance__.sessionData);
|
|
96
|
+
sessionStorage.setItem(`${__instance__.index(...arguments)}`, s);
|
|
52
97
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
*
|
|
102
|
+
* Gets the session value
|
|
103
|
+
*
|
|
104
|
+
* @param {*} name
|
|
105
|
+
* @param {*} defaultValue
|
|
106
|
+
* @return {*}
|
|
107
|
+
*/
|
|
108
|
+
get(name, defaultValue) {
|
|
109
|
+
var __instance__ = this;
|
|
110
|
+
var sessionData = __instance__.getSessionData(__instance__.getSessionContainer());
|
|
111
|
+
return (typeof sessionData[name] !== "undefined") ? (sessionData[name]) : (defaultValue);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
*
|
|
116
|
+
* Sets the session value
|
|
117
|
+
*
|
|
118
|
+
* @param {*} name
|
|
119
|
+
* @param {*} value
|
|
120
|
+
*/
|
|
121
|
+
set(name, value) {
|
|
122
|
+
var __instance__ = this;
|
|
123
|
+
var __session_container__ = __instance__.getSessionContainer();
|
|
124
|
+
var sessionData = __instance__.getSessionData(__session_container__);
|
|
125
|
+
__instance__.sessionData = sessionData;
|
|
126
|
+
__instance__.sessionData[name] = value;
|
|
127
|
+
__instance__.save(__session_container__);
|
|
128
|
+
}
|
|
129
|
+
|
|
72
130
|
}
|
|
73
|
-
|
|
74
|
-
]);
|
|
131
|
+
|
|
132
|
+
]);
|
|
133
|
+
Package("org.qcobjects.cloud.auth.session.data").map(c => Export(c));
|
|
75
134
|
|
|
76
135
|
}).call(null);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* QCObjects SDK 2.
|
|
2
|
+
* QCObjects SDK 2.4
|
|
3
3
|
* ________________
|
|
4
4
|
*
|
|
5
5
|
* Author: Jean Machuca <correojean@gmail.com>
|
|
@@ -21,75 +21,85 @@
|
|
|
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
|
-
(function() {
|
|
26
|
-
"use strict";
|
|
24
|
+
*/
|
|
25
|
+
(function () {
|
|
26
|
+
"use strict";
|
|
27
27
|
|
|
28
|
-
Package("org.qcobjects.cloud.auth.session.usertoken",[
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
Package("org.qcobjects.cloud.auth.session.usertoken", [
|
|
29
|
+
class SessionUserToken {
|
|
30
|
+
constructor() {
|
|
31
|
+
this.user = {};
|
|
32
|
+
this.__cache__ = null;
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
_new_(o) {
|
|
37
|
+
var __instance__ = this;
|
|
38
|
+
this.__cache__ = new ComplexStorageCache({
|
|
36
39
|
index: __instance__.__instanceID.toString(),
|
|
37
|
-
load
|
|
40
|
+
load() {
|
|
38
41
|
var __token__;
|
|
39
|
-
if (typeof navigator !== "undefined" && typeof origin !== "undefined"){
|
|
40
|
-
__token__ = _Crypt.encrypt(`${navigator.userAgent}|${o.username}|${(+(new Date())).toString()}`,origin);
|
|
42
|
+
if (typeof navigator !== "undefined" && typeof origin !== "undefined") {
|
|
43
|
+
__token__ = _Crypt.encrypt(`${navigator.userAgent}|${o.username}|${(+(new Date())).toString()}`, origin);
|
|
41
44
|
} else {
|
|
42
|
-
__token__ = _Crypt.encrypt(`${o.username}|${(+(new Date())).toString()}`,CONFIG.get("domain", "localhost"));
|
|
45
|
+
__token__ = _Crypt.encrypt(`${o.username}|${(+(new Date())).toString()}`, CONFIG.get("domain", "localhost"));
|
|
43
46
|
}
|
|
44
47
|
__instance__.user = {
|
|
45
|
-
priority:__instance__.__instanceID.toString(),
|
|
48
|
+
priority: __instance__.__instanceID.toString(),
|
|
46
49
|
token: __token__
|
|
47
50
|
};
|
|
48
51
|
return __instance__.user;
|
|
49
52
|
},
|
|
50
|
-
alternate
|
|
53
|
+
alternate(cacheController) {
|
|
51
54
|
__instance__.user = cacheController.cache.getCached(__instance__.__instanceID.toString()); // setting dataObject with the cached value
|
|
52
55
|
return;
|
|
53
56
|
}
|
|
54
57
|
});
|
|
55
|
-
},
|
|
56
|
-
generateIndex (s) {
|
|
57
|
-
return (typeof Buffer !== "undefined")?(Buffer.from(s, "ascii").toString("base64")):(btoa(s));
|
|
58
|
-
},
|
|
59
|
-
getGlobalUser () {
|
|
60
|
-
var username = [...arguments].join("|");
|
|
61
|
-
var __index__ = "userToken_"+SessionUserToken.generateIndex(username);
|
|
62
|
-
if (typeof global.get(__index__) === "undefined" || global.get(__index__) === null){
|
|
63
|
-
global.set(__index__, New(SessionUserToken, {
|
|
64
|
-
username: username
|
|
65
|
-
}));
|
|
66
58
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
59
|
+
|
|
60
|
+
generateIndex(s) {
|
|
61
|
+
return (typeof Buffer !== "undefined") ? (Buffer.from(s, "ascii").toString("base64")) : (btoa(s));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
getGlobalUser() {
|
|
65
|
+
var username = [...arguments].join("|");
|
|
66
|
+
var __index__ = "userToken_" + SessionUserToken.generateIndex(username);
|
|
67
|
+
if (typeof global.get(__index__) === "undefined" || global.get(__index__) === null) {
|
|
68
|
+
global.set(__index__, New(SessionUserToken, {
|
|
69
|
+
username: username
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
SessionUserToken.user = global.get(__index__).user;
|
|
73
|
+
return global.get(__index__).user;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
getGlobalUserToken() {
|
|
77
|
+
return this.getGlobalUser(...arguments).token;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
getGlobalUserId() {
|
|
81
|
+
return this.getGlobalUser(...arguments).id;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
getGlobalUserPriority() {
|
|
85
|
+
return this.getGlobalUser(...arguments).priority;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
getLoginCredentialsToken(username, password) {
|
|
89
|
+
return _Crypt.encrypt(`${username}${password}`, this.getGlobalUserToken(username));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
closeGlobalSession() {
|
|
93
|
+
this.getGlobalUser(...arguments);
|
|
94
|
+
var username = [...arguments].join("|");
|
|
95
|
+
var __index__ = "userToken_" + SessionUserToken.generateIndex(username);
|
|
96
|
+
if (typeof global.get(__index__) !== "undefined") {
|
|
97
|
+
global.get(__index__).__cache__.clear();
|
|
98
|
+
global.set(__index__, null);
|
|
99
|
+
SessionUserToken.user = {};
|
|
100
|
+
}
|
|
90
101
|
}
|
|
91
102
|
}
|
|
92
|
-
|
|
93
|
-
]);
|
|
103
|
+
]);
|
|
94
104
|
|
|
95
105
|
}).call(null);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* QCObjects SDK 2.
|
|
2
|
+
* QCObjects SDK 2.4
|
|
3
3
|
* ________________
|
|
4
4
|
*
|
|
5
5
|
* Author: Jean Machuca <correojean@gmail.com>
|
|
@@ -21,39 +21,51 @@
|
|
|
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
|
-
(function() {
|
|
26
|
-
"use strict";
|
|
27
|
-
Package("org.qcobjects.components.grid",[
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
24
|
+
*/
|
|
25
|
+
(function () {
|
|
26
|
+
"use strict";
|
|
27
|
+
Package("org.qcobjects.components.grid", [
|
|
28
|
+
|
|
29
|
+
class GridItemComponent extends Component {
|
|
30
|
+
|
|
31
|
+
constructor (){
|
|
32
|
+
super();
|
|
33
|
+
this.name = "grid-item";
|
|
34
|
+
this.shadowed= true;
|
|
35
|
+
this.tplsource= "inline";
|
|
36
|
+
this.template= `
|
|
37
|
+
<img src="{{image}}" />
|
|
38
|
+
<p>{{description}}</p>
|
|
39
|
+
`;
|
|
40
|
+
this.cached= false;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
class GridComponent extends Component {
|
|
45
|
+
constructor (){
|
|
46
|
+
super();
|
|
47
|
+
this.name= "grid";
|
|
48
|
+
this.cached= false;
|
|
49
|
+
this.view= null;
|
|
50
|
+
this.shadowed= true;
|
|
51
|
+
this.rows= 3;
|
|
52
|
+
this.cols= 3;
|
|
53
|
+
this.templateURI= "";
|
|
54
|
+
this.data= {};
|
|
55
|
+
this.tplsource= "inline";
|
|
56
|
+
this.template= "<p>Loading...</p>";
|
|
57
|
+
|
|
58
|
+
}
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
_new_(o) {
|
|
61
|
+
o.body.setAttribute("controllerClass", "DataGridController");
|
|
62
|
+
var subcomponentClass = (o.body.getAttribute("subcomponentClass") !== null) ? (o.body.getAttribute("subcomponentClass")) : ("GridItemComponent");
|
|
63
|
+
o.body.setAttribute("subcomponentClass", subcomponentClass);
|
|
64
|
+
_super_("Component", "_new_").call(this, o);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
]);
|
|
58
70
|
|
|
59
71
|
}).call(null);
|