qcobjects-sdk 2.4.6 → 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.
Files changed (31) hide show
  1. package/.eslintrc.json +26 -21
  2. package/QCObjects-SDK.js +47 -47
  3. package/VERSION +1 -1
  4. package/demo-tests/test-component-grid.html +43 -30
  5. package/demo-tests/test-component-list.html +31 -23
  6. package/demo-tests/test-component-notifications.html +31 -12
  7. package/demo-tests/test-component-slider.html +47 -31
  8. package/js/org.qcobjects.cloud.auth.session.data.js +106 -47
  9. package/js/org.qcobjects.cloud.auth.session.usertoken.js +64 -54
  10. package/js/org.qcobjects.components.grid.js +46 -34
  11. package/js/org.qcobjects.components.js +137 -80
  12. package/js/org.qcobjects.components.list.js +27 -18
  13. package/js/org.qcobjects.components.notifications.js +73 -58
  14. package/js/org.qcobjects.components.slider.js +174 -151
  15. package/js/org.qcobjects.components.splashscreen.js +480 -460
  16. package/js/org.qcobjects.controllers.form.js +38 -20
  17. package/js/org.qcobjects.controllers.grid.js +46 -25
  18. package/js/org.qcobjects.controllers.js +38 -6
  19. package/js/org.qcobjects.controllers.list.js +169 -157
  20. package/js/org.qcobjects.controllers.slider.js +113 -97
  21. package/js/org.qcobjects.controllers.swagger.js +60 -51
  22. package/js/org.qcobjects.effects.js +149 -124
  23. package/js/org.qcobjects.i18n_messages.js +11 -6
  24. package/js/org.qcobjects.modal.controllers.js +14 -9
  25. package/js/org.qcobjects.modal.effects.js +25 -16
  26. package/js/org.qcobjects.models.js +19 -11
  27. package/js/org.qcobjects.tools.canvas.js +10 -6
  28. package/js/org.qcobjects.tools.js +17 -8
  29. package/js/org.qcobjects.tools.layouts.js +19 -8
  30. package/js/org.qcobjects.views.js +12 -7
  31. package/package.json +3 -4
@@ -1,5 +1,5 @@
1
1
  /**
2
- * QCObjects SDK 2.3
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
- Package("org.qcobjects.cloud.auth.session.data",[
29
- Class ("SessionData",Object, {
30
- __session_container__: null,
31
- setSessionContainer () {
32
- this.__session_container__ = [...arguments];
33
- },
34
- getSessionContainer () {
35
- if (typeof this.__session_container__ === "undefined" || this.__session_container__ === null){
36
- throw new Error("You need to set a session container first: sessionData.setSessionContainer(...arguments)");
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
- return this.__session_container__;
39
- },
40
- getSessionData () {
41
- var __instance__ = this;
42
- var s = sessionStorage.getItem(`${__instance__.index(...arguments)}`);
43
- var sessionData = JSON.parse(s);
44
- if (typeof sessionData === "undefined" || sessionData === null) {
45
- sessionData = {};
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
- return sessionData;
48
- },
49
- index () {
50
- if (typeof SessionUserToken === "undefined") {
51
- throw new Error("You need to import SessionUserToken first: Import (\"org.qcobjects.cloud.auth.session.usertoken\")");
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
- return `session_${btoa(SessionUserToken.getGlobalUserToken(...arguments))}`;
54
- },
55
- save () {
56
- var __instance__ = this;
57
- var s = _DataStringify(__instance__.sessionData);
58
- sessionStorage.setItem(`${__instance__.index(...arguments)}`, s);
59
- },
60
- get (name, defaultValue) {
61
- var __instance__ = this;
62
- var sessionData = __instance__.getSessionData(__instance__.getSessionContainer());
63
- return (typeof sessionData[name] !== "undefined")?(sessionData[name]):(defaultValue);
64
- },
65
- set (name, value) {
66
- var __instance__ = this;
67
- var __session_container__ = __instance__.getSessionContainer();
68
- var sessionData = __instance__.getSessionData(__session_container__);
69
- __instance__.sessionData = sessionData;
70
- __instance__.sessionData[name] = value;
71
- __instance__.save(__session_container__);
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.3
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
- Class ("SessionUserToken",Object, {
30
- user: {},
31
- __cache__: null,
32
- _new_ (o) {
33
- var __instance__ = this;
34
- this.__cache__ = new ComplexStorageCache(
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 (cacheController) {
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
- SessionUserToken.user = global.get(__index__).user;
68
- return global.get(__index__).user;
69
- },
70
- getGlobalUserToken () {
71
- return this.getGlobalUser(...arguments).token;
72
- },
73
- getGlobalUserId () {
74
- return this.getGlobalUser(...arguments).id;
75
- },
76
- getGlobalUserPriority () {
77
- return this.getGlobalUser(...arguments).priority;
78
- },
79
- getLoginCredentialsToken (username, password) {
80
- return _Crypt.encrypt(`${username}${password}`, this.getGlobalUserToken(username));
81
- },
82
- closeGlobalSession () {
83
- this.getGlobalUser(...arguments);
84
- var username = [...arguments].join("|");
85
- var __index__ = "userToken_"+SessionUserToken.generateIndex(username);
86
- if (typeof global.get(__index__) !== "undefined"){
87
- global.get(__index__).__cache__.clear();
88
- global.set(__index__, null);
89
- SessionUserToken.user = {};
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.3
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
- Class("GridItemComponent",Component,{
29
- name:"grid-item",
30
- shadowed: true,
31
- tplsource: "inline",
32
- template:`
33
- <img src="{{image}}" />
34
- <p>{{description}}</p>
35
- `,
36
- cached: false
37
- }),
38
- Class("GridComponent",Component,{
39
- name:"grid",
40
- cached:false,
41
- view:null,
42
- shadowed: true,
43
- rows:3,
44
- cols:3,
45
- templateURI:"",
46
- data:{},
47
- tplsource: "inline",
48
- template: "<p>Loading...</p>",
49
- _new_ (o){
50
- o.body.setAttribute("controllerClass","DataGridController");
51
- var subcomponentClass = (o.body.getAttribute("subcomponentClass") !== null)?(o.body.getAttribute("subcomponentClass")):("GridItemComponent");
52
- o.body.setAttribute("subcomponentClass",subcomponentClass);
53
- _super_("Component","_new_").call(this,o);
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);