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
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QCObjects SDK 2.4
|
|
3
|
+
* ________________
|
|
4
|
+
*
|
|
5
|
+
* Author: Jean Machuca <correojean@gmail.com>
|
|
6
|
+
*
|
|
7
|
+
* Cross Browser Javascript Framework for MVC Patterns
|
|
8
|
+
* QuickCorp/QCObjects is licensed under the
|
|
9
|
+
* GNU Lesser General Public License v3.0
|
|
10
|
+
* [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
|
|
11
|
+
*
|
|
12
|
+
* Permissions of this copyleft license are conditioned on making available
|
|
13
|
+
* complete source code of licensed works and modifications under the same
|
|
14
|
+
* license or the GNU GPLv3. Copyright and license notices must be preserved.
|
|
15
|
+
* Contributors provide an express grant of patent rights. However, a larger
|
|
16
|
+
* work using the licensed work through interfaces provided by the licensed
|
|
17
|
+
* work may be distributed under different terms and without source code for
|
|
18
|
+
* the larger work.
|
|
19
|
+
*
|
|
20
|
+
* Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
|
|
21
|
+
*
|
|
22
|
+
* Everyone is permitted to copy and distribute verbatim copies of this
|
|
23
|
+
* license document, but changing it is not allowed.
|
|
24
|
+
*/
|
|
25
|
+
(function () {
|
|
26
|
+
"use strict";
|
|
27
|
+
Package("org.qcobjects.cloud.auth.session.data", [
|
|
28
|
+
|
|
29
|
+
class SessionData extends InheritClass{
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates an instance of SessionData.
|
|
33
|
+
*/
|
|
34
|
+
constructor() {
|
|
35
|
+
super(...arguments);
|
|
36
|
+
this.__session_container__ = null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Sets the session container
|
|
41
|
+
*
|
|
42
|
+
* @param {*} sessionContainer1, sessionContainer2, ...
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
setSessionContainer() {
|
|
46
|
+
this.__session_container__ = [...arguments];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Gets the session container
|
|
51
|
+
*
|
|
52
|
+
* @return {*} sessionContainer
|
|
53
|
+
*/
|
|
54
|
+
getSessionContainer() {
|
|
55
|
+
if (typeof this.__session_container__ === "undefined" || this.__session_container__ === null) {
|
|
56
|
+
throw new Error("You need to set a session container first: sessionData.setSessionContainer(...arguments)");
|
|
57
|
+
}
|
|
58
|
+
return this.__session_container__;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Gets the session data
|
|
63
|
+
*
|
|
64
|
+
* @return {*} sessionData
|
|
65
|
+
*/
|
|
66
|
+
getSessionData() {
|
|
67
|
+
var __instance__ = this;
|
|
68
|
+
var s = sessionStorage.getItem(`${__instance__.index(...arguments)}`);
|
|
69
|
+
var sessionData = JSON.parse(s);
|
|
70
|
+
if (typeof sessionData === "undefined" || sessionData === null) {
|
|
71
|
+
sessionData = {};
|
|
72
|
+
}
|
|
73
|
+
return sessionData;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Returns an index of the session
|
|
78
|
+
*
|
|
79
|
+
* @param {string} valueForIndex
|
|
80
|
+
* @return {string} index
|
|
81
|
+
* @example sessionInstance.index("me@email.com", "myusername")
|
|
82
|
+
*
|
|
83
|
+
*/
|
|
84
|
+
index() {
|
|
85
|
+
if (typeof SessionUserToken === "undefined") {
|
|
86
|
+
throw new Error("You need to import SessionUserToken first: Import (\"org.qcobjects.cloud.auth.session.usertoken\")");
|
|
87
|
+
}
|
|
88
|
+
return `session_${btoa(SessionUserToken.getGlobalUserToken(...arguments))}`;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Saves the session instance
|
|
92
|
+
*
|
|
93
|
+
*/
|
|
94
|
+
save() {
|
|
95
|
+
var __instance__ = this;
|
|
96
|
+
var s = _DataStringify(__instance__.sessionData);
|
|
97
|
+
sessionStorage.setItem(`${__instance__.index(...arguments)}`, s);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
*
|
|
103
|
+
* Gets the session value
|
|
104
|
+
*
|
|
105
|
+
* @param {*} name
|
|
106
|
+
* @param {*} defaultValue
|
|
107
|
+
* @return {*}
|
|
108
|
+
*/
|
|
109
|
+
get(name, defaultValue) {
|
|
110
|
+
var __instance__ = this;
|
|
111
|
+
var sessionData = __instance__.getSessionData(__instance__.getSessionContainer());
|
|
112
|
+
return (typeof sessionData[name] !== "undefined") ? (sessionData[name]) : (defaultValue);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
*
|
|
117
|
+
* Sets the session value
|
|
118
|
+
*
|
|
119
|
+
* @param {*} name
|
|
120
|
+
* @param {*} value
|
|
121
|
+
*/
|
|
122
|
+
set(name, value) {
|
|
123
|
+
var __instance__ = this;
|
|
124
|
+
var __session_container__ = __instance__.getSessionContainer();
|
|
125
|
+
var sessionData = __instance__.getSessionData(__session_container__);
|
|
126
|
+
__instance__.sessionData = sessionData;
|
|
127
|
+
__instance__.sessionData[name] = value;
|
|
128
|
+
__instance__.save(__session_container__);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
]);
|
|
134
|
+
Package("org.qcobjects.cloud.auth.session.data").map(c => Export(c));
|
|
135
|
+
|
|
136
|
+
}).call(null);
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QCObjects SDK 2.4
|
|
3
|
+
* ________________
|
|
4
|
+
*
|
|
5
|
+
* Author: Jean Machuca <correojean@gmail.com>
|
|
6
|
+
*
|
|
7
|
+
* Cross Browser Javascript Framework for MVC Patterns
|
|
8
|
+
* QuickCorp/QCObjects is licensed under the
|
|
9
|
+
* GNU Lesser General Public License v3.0
|
|
10
|
+
* [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
|
|
11
|
+
*
|
|
12
|
+
* Permissions of this copyleft license are conditioned on making available
|
|
13
|
+
* complete source code of licensed works and modifications under the same
|
|
14
|
+
* license or the GNU GPLv3. Copyright and license notices must be preserved.
|
|
15
|
+
* Contributors provide an express grant of patent rights. However, a larger
|
|
16
|
+
* work using the licensed work through interfaces provided by the licensed
|
|
17
|
+
* work may be distributed under different terms and without source code for
|
|
18
|
+
* the larger work.
|
|
19
|
+
*
|
|
20
|
+
* Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
|
|
21
|
+
*
|
|
22
|
+
* Everyone is permitted to copy and distribute verbatim copies of this
|
|
23
|
+
* license document, but changing it is not allowed.
|
|
24
|
+
*/
|
|
25
|
+
(function () {
|
|
26
|
+
"use strict";
|
|
27
|
+
|
|
28
|
+
Package("org.qcobjects.cloud.auth.session.usertoken", [
|
|
29
|
+
class SessionUserToken extends InheritClass{
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.user = {};
|
|
33
|
+
this.__cache__ = null;
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_new_(o) {
|
|
38
|
+
super._new_(o);
|
|
39
|
+
var __instance__ = this;
|
|
40
|
+
this.__cache__ = new ComplexStorageCache({
|
|
41
|
+
index: __instance__.__instanceID.toString(),
|
|
42
|
+
load() {
|
|
43
|
+
var __token__;
|
|
44
|
+
if (typeof navigator !== "undefined" && typeof origin !== "undefined") {
|
|
45
|
+
__token__ = _Crypt.encrypt(`${navigator.userAgent}|${o.username}|${(+(new Date())).toString()}`, origin);
|
|
46
|
+
} else {
|
|
47
|
+
__token__ = _Crypt.encrypt(`${o.username}|${(+(new Date())).toString()}`, CONFIG.get("domain", "localhost"));
|
|
48
|
+
}
|
|
49
|
+
__instance__.user = {
|
|
50
|
+
priority: __instance__.__instanceID.toString(),
|
|
51
|
+
token: __token__
|
|
52
|
+
};
|
|
53
|
+
return __instance__.user;
|
|
54
|
+
},
|
|
55
|
+
alternate(cacheController) {
|
|
56
|
+
__instance__.user = cacheController.cache.getCached(__instance__.__instanceID.toString()); // setting dataObject with the cached value
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
generateIndex(s) {
|
|
63
|
+
return (typeof Buffer !== "undefined") ? (Buffer.from(s, "ascii").toString("base64")) : (btoa(s));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
getGlobalUser() {
|
|
67
|
+
var username = [...arguments].join("|");
|
|
68
|
+
var __index__ = "userToken_" + SessionUserToken.generateIndex(username);
|
|
69
|
+
if (typeof global.get(__index__) === "undefined" || global.get(__index__) === null) {
|
|
70
|
+
global.set(__index__, New(SessionUserToken, {
|
|
71
|
+
username: username
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
SessionUserToken.user = global.get(__index__).user;
|
|
75
|
+
return global.get(__index__).user;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
getGlobalUserToken() {
|
|
79
|
+
return this.getGlobalUser(...arguments).token;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
getGlobalUserId() {
|
|
83
|
+
return this.getGlobalUser(...arguments).id;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
getGlobalUserPriority() {
|
|
87
|
+
return this.getGlobalUser(...arguments).priority;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
getLoginCredentialsToken(username, password) {
|
|
91
|
+
return _Crypt.encrypt(`${username}${password}`, this.getGlobalUserToken(username));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
closeGlobalSession() {
|
|
95
|
+
this.getGlobalUser(...arguments);
|
|
96
|
+
var username = [...arguments].join("|");
|
|
97
|
+
var __index__ = "userToken_" + SessionUserToken.generateIndex(username);
|
|
98
|
+
if (typeof global.get(__index__) !== "undefined") {
|
|
99
|
+
global.get(__index__).__cache__.clear();
|
|
100
|
+
global.set(__index__, null);
|
|
101
|
+
SessionUserToken.user = {};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
]);
|
|
106
|
+
|
|
107
|
+
}).call(null);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QCObjects SDK 2.4
|
|
3
|
+
* ________________
|
|
4
|
+
*
|
|
5
|
+
* Author: Jean Machuca <correojean@gmail.com>
|
|
6
|
+
*
|
|
7
|
+
* Cross Browser Javascript Framework for MVC Patterns
|
|
8
|
+
* QuickCorp/QCObjects is licensed under the
|
|
9
|
+
* GNU Lesser General Public License v3.0
|
|
10
|
+
* [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
|
|
11
|
+
*
|
|
12
|
+
* Permissions of this copyleft license are conditioned on making available
|
|
13
|
+
* complete source code of licensed works and modifications under the same
|
|
14
|
+
* license or the GNU GPLv3. Copyright and license notices must be preserved.
|
|
15
|
+
* Contributors provide an express grant of patent rights. However, a larger
|
|
16
|
+
* work using the licensed work through interfaces provided by the licensed
|
|
17
|
+
* work may be distributed under different terms and without source code for
|
|
18
|
+
* the larger work.
|
|
19
|
+
*
|
|
20
|
+
* Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
|
|
21
|
+
*
|
|
22
|
+
* Everyone is permitted to copy and distribute verbatim copies of this
|
|
23
|
+
* license document, but changing it is not allowed.
|
|
24
|
+
*/
|
|
25
|
+
(function () {
|
|
26
|
+
"use strict";
|
|
27
|
+
Package("org.qcobjects.components.grid", [
|
|
28
|
+
|
|
29
|
+
class GridItemComponent extends Component {
|
|
30
|
+
|
|
31
|
+
constructor (){
|
|
32
|
+
super(...arguments);
|
|
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(...arguments);
|
|
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
|
+
}
|
|
59
|
+
|
|
60
|
+
_new_(o) {
|
|
61
|
+
super._new_(o);
|
|
62
|
+
o.body.setAttribute("controllerClass", "DataGridController");
|
|
63
|
+
var subcomponentClass = (o.body.getAttribute("subcomponentClass") !== null) ? (o.body.getAttribute("subcomponentClass")) : ("GridItemComponent");
|
|
64
|
+
o.body.setAttribute("subcomponentClass", subcomponentClass);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
]);
|
|
70
|
+
|
|
71
|
+
}).call(null);
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QCObjects SDK 2.4
|
|
3
|
+
* ________________
|
|
4
|
+
*
|
|
5
|
+
* Author: Jean Machuca <correojean@gmail.com>
|
|
6
|
+
*
|
|
7
|
+
* Cross Browser Javascript Framework for MVC Patterns
|
|
8
|
+
* QuickCorp/QCObjects is licensed under the
|
|
9
|
+
* GNU Lesser General Public License v3.0
|
|
10
|
+
* [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
|
|
11
|
+
*
|
|
12
|
+
* Permissions of this copyleft license are conditioned on making available
|
|
13
|
+
* complete source code of licensed works and modifications under the same
|
|
14
|
+
* license or the GNU GPLv3. Copyright and license notices must be preserved.
|
|
15
|
+
* Contributors provide an express grant of patent rights. However, a larger
|
|
16
|
+
* work using the licensed work through interfaces provided by the licensed
|
|
17
|
+
* work may be distributed under different terms and without source code for
|
|
18
|
+
* the larger work.
|
|
19
|
+
*
|
|
20
|
+
* Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
|
|
21
|
+
*
|
|
22
|
+
* Everyone is permitted to copy and distribute verbatim copies of this
|
|
23
|
+
* license document, but changing it is not allowed.
|
|
24
|
+
*/
|
|
25
|
+
"use strict";
|
|
26
|
+
(function () {
|
|
27
|
+
Package("org.qcobjects.base.components", [
|
|
28
|
+
class FormField extends Component {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
this.cached = false;
|
|
32
|
+
this.reload = true;
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
createBindingEvents() {
|
|
37
|
+
var thisobj = this;
|
|
38
|
+
var _objList;
|
|
39
|
+
if (typeof this.fieldType == "undefined" || this.fieldType == null) {
|
|
40
|
+
_objList = this.body.subelements("*[data-field]"); // every child with data-field set
|
|
41
|
+
} else {
|
|
42
|
+
_objList = this.body.subelements(this.fieldType + "[data-field]"); // every child with data-field set and tagname is equal to fieldType property
|
|
43
|
+
}
|
|
44
|
+
for (var _datak = 0; _datak < _objList.length; _datak++) {
|
|
45
|
+
var _obj = _objList[_datak];
|
|
46
|
+
_obj.addEventListener("change", function (e) {
|
|
47
|
+
logger.debug("Executing change event binding");
|
|
48
|
+
thisobj.executeBindings(e);
|
|
49
|
+
});
|
|
50
|
+
_obj.addEventListener("blur", function (e) {
|
|
51
|
+
logger.debug("Executing change event binding");
|
|
52
|
+
thisobj.executeBindings(e);
|
|
53
|
+
});
|
|
54
|
+
_obj.addEventListener("focus", function (e) {
|
|
55
|
+
logger.debug("Executing change event binding");
|
|
56
|
+
thisobj.executeBindings(e);
|
|
57
|
+
});
|
|
58
|
+
_obj.addEventListener("keydown", function (e) {
|
|
59
|
+
logger.debug("Executing keydown event binding");
|
|
60
|
+
thisobj.executeBindings(e);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
executeBinding(_obj) {
|
|
65
|
+
var _datamodel = _obj.getAttribute("data-field");
|
|
66
|
+
logger.debug("Binding " + _datamodel + " for " + this.name);
|
|
67
|
+
this.data[_datamodel] = _obj.value;
|
|
68
|
+
}
|
|
69
|
+
executeBindings() {
|
|
70
|
+
var _objList;
|
|
71
|
+
if (typeof this.fieldType == "undefined" || this.fieldType == null) {
|
|
72
|
+
_objList = this.body.subelements("*[data-field]"); // every child with data-field set
|
|
73
|
+
} else {
|
|
74
|
+
_objList = this.body.subelements(this.fieldType + "[data-field]"); // every child with data-field set and tagname is equal to fieldType property
|
|
75
|
+
}
|
|
76
|
+
for (var _datak = 0; _datak < _objList.length; _datak++) {
|
|
77
|
+
var _obj = _objList[_datak];
|
|
78
|
+
var _datamodel = _obj.getAttribute("data-field");
|
|
79
|
+
logger.debug("Binding " + _datamodel + " for " + this.name);
|
|
80
|
+
this.data[_datamodel] = _obj.value;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
done() {
|
|
84
|
+
super.done(...arguments);
|
|
85
|
+
var thisobj = this;
|
|
86
|
+
thisobj.executeBindings();
|
|
87
|
+
thisobj.createBindingEvents();
|
|
88
|
+
logger.debug("Field loaded: " + thisobj.fieldType + "[name=" + thisobj.name + "]");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
]);
|
|
95
|
+
Package("org.qcobjects.form.components", [
|
|
96
|
+
|
|
97
|
+
class ShadowedComponent extends Component {
|
|
98
|
+
constructor() {
|
|
99
|
+
super(...arguments);
|
|
100
|
+
this.container = null;
|
|
101
|
+
this.body = null;
|
|
102
|
+
this.shadowed = true;
|
|
103
|
+
this.cached = false;
|
|
104
|
+
this.controller = null;
|
|
105
|
+
this.view = null;
|
|
106
|
+
this.data = {};
|
|
107
|
+
this.body = _DOMCreateElement("div");
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class ButtonField extends FormField {
|
|
115
|
+
constructor() {
|
|
116
|
+
super(...arguments);
|
|
117
|
+
this.fieldType = "button";
|
|
118
|
+
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
class InputField extends FormField {
|
|
123
|
+
constructor() {
|
|
124
|
+
super(...arguments);
|
|
125
|
+
this.fieldType = "input";
|
|
126
|
+
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
class TextField extends FormField {
|
|
132
|
+
constructor() {
|
|
133
|
+
super(...arguments);
|
|
134
|
+
this.fieldType = "textarea";
|
|
135
|
+
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
class EmailField extends FormField {
|
|
141
|
+
constructor() {
|
|
142
|
+
super(...arguments);
|
|
143
|
+
this.fieldType = "input";
|
|
144
|
+
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
class ModalEnclosureComponent extends Component {
|
|
150
|
+
constructor() {
|
|
151
|
+
super(...arguments);
|
|
152
|
+
this.name = "modal";
|
|
153
|
+
this.tplsource = "inline";
|
|
154
|
+
this.cached = false;
|
|
155
|
+
this.basePath = CONFIG.get("modalBasePath", CONFIG.get("remoteSDKPath"));
|
|
156
|
+
this.data = {};
|
|
157
|
+
this.template = `
|
|
158
|
+
<!-- The Modal -->
|
|
159
|
+
<style>
|
|
160
|
+
@import url('https://sdk.qcobjects.dev/css/modal.css');
|
|
161
|
+
</style>
|
|
162
|
+
<div id="modalInstance_{{modalId}}" class="modal">
|
|
163
|
+
|
|
164
|
+
<!-- Modal content -->
|
|
165
|
+
<div class="modal-content">
|
|
166
|
+
<span class="close">×</span>
|
|
167
|
+
{{content}}
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
</div>
|
|
171
|
+
`;
|
|
172
|
+
this.body = _DOMCreateElement("div");
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
class ModalComponent extends Component {
|
|
178
|
+
constructor() {
|
|
179
|
+
super(...arguments);
|
|
180
|
+
this.name = "modal";
|
|
181
|
+
this.cached = false;
|
|
182
|
+
this.modalEnclosureComponentClass = "ModalEnclosureComponent";
|
|
183
|
+
this.basePath = CONFIG.get("modalBasePath", CONFIG.get("remoteSDKPath"));
|
|
184
|
+
this.controller = null;
|
|
185
|
+
this.view = null;
|
|
186
|
+
this.tplsource = "none";
|
|
187
|
+
this.closeOnClickOutside = false;
|
|
188
|
+
this.data = {
|
|
189
|
+
content: "",
|
|
190
|
+
modalId: 0
|
|
191
|
+
};
|
|
192
|
+
this.submodal = null;
|
|
193
|
+
var component = this;
|
|
194
|
+
component.data.modalId = component.__instanceID;
|
|
195
|
+
var submodal = New(ClassFactory(component.modalEnclosureComponentClass), {
|
|
196
|
+
name: component.name,
|
|
197
|
+
basePath: component.basePath,
|
|
198
|
+
data: component.data
|
|
199
|
+
});
|
|
200
|
+
component.subcomponents.push(submodal);
|
|
201
|
+
component.submodal = submodal;
|
|
202
|
+
if (submodal.tplsource == "none") {
|
|
203
|
+
component.body.innerHTML = submodal.parsedAssignmentText;
|
|
204
|
+
} else {
|
|
205
|
+
component.body.append(submodal.body);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
modal() {
|
|
211
|
+
var modalId = this.data.modalId;
|
|
212
|
+
var modalComponent = this;
|
|
213
|
+
|
|
214
|
+
Tag("#modalInstance_" + parseInt(modalId) + ".modal").map(function (modal) {
|
|
215
|
+
modal.style.display = "block";
|
|
216
|
+
ModalFade.apply(modal, 0, 1);
|
|
217
|
+
});
|
|
218
|
+
Tag("#modalInstance_" + parseInt(modalId) + ".modal .modal-content").map(function (modalcontent) {
|
|
219
|
+
ModalMoveDown.apply(modalcontent, 0, -document.body.clientHeight, 0, 0);
|
|
220
|
+
});
|
|
221
|
+
Tag("#modalInstance_" + parseInt(modalId) + ".modal .modal-content .close").map(function (closebtn) {
|
|
222
|
+
closebtn.addEventListener("click", function () {
|
|
223
|
+
modalComponent.close();
|
|
224
|
+
}, false);
|
|
225
|
+
});
|
|
226
|
+
if (modalComponent.closeOnClickOutside) {
|
|
227
|
+
window.addEventListener("click", function () {
|
|
228
|
+
modalComponent.close();
|
|
229
|
+
}, false);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
close() {
|
|
234
|
+
var modalId = this.data.modalId;
|
|
235
|
+
Tag("#modalInstance_" + parseInt(modalId) + ".modal").map(function (modal) {
|
|
236
|
+
modal.style.display = "block";
|
|
237
|
+
ModalFade.apply(modal, 1, 0);
|
|
238
|
+
});
|
|
239
|
+
Tag("#modalInstance_" + parseInt(modalId) + ".modal .modal-content").map(function (modalcontent) {
|
|
240
|
+
ModalMoveUp.apply(modalcontent, 0, 0, 0, -document.body.clientHeight);
|
|
241
|
+
});
|
|
242
|
+
setTimeout(function () {
|
|
243
|
+
Tag("#modalInstance_" + parseInt(modalId) + ".modal").map(function (modal) {
|
|
244
|
+
modal.style.display = "none";
|
|
245
|
+
});
|
|
246
|
+
}, 900);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
rebuild() {
|
|
250
|
+
let _ret_ = super.rebuild(...arguments);
|
|
251
|
+
this.templateURI = ComponentURI({
|
|
252
|
+
"COMPONENTS_BASE_PATH": CONFIG.get("componentsBasePath"),
|
|
253
|
+
"COMPONENT_NAME": "modal",
|
|
254
|
+
"TPLEXTENSION": CONFIG.get("tplextension"),
|
|
255
|
+
"TPL_SOURCE": "default" //here is always default in order to get the right uri
|
|
256
|
+
});
|
|
257
|
+
return _ret_; // parent call
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
},
|
|
262
|
+
|
|
263
|
+
class SwaggerUIComponent extends Component {
|
|
264
|
+
constructor() {
|
|
265
|
+
super(...arguments);
|
|
266
|
+
this.name = "swagger-ui";
|
|
267
|
+
this.cached = false;
|
|
268
|
+
this.basePath = CONFIG.get("remoteSDKPath");
|
|
269
|
+
this.tplextension = "tpl.html";
|
|
270
|
+
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
]);
|
|
276
|
+
|
|
277
|
+
}).call(null);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QCObjects SDK 2.4
|
|
3
|
+
* ________________
|
|
4
|
+
*
|
|
5
|
+
* Author: Jean Machuca <correojean@gmail.com>
|
|
6
|
+
*
|
|
7
|
+
* Cross Browser Javascript Framework for MVC Patterns
|
|
8
|
+
* QuickCorp/QCObjects is licensed under the
|
|
9
|
+
* GNU Lesser General Public License v3.0
|
|
10
|
+
* [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
|
|
11
|
+
*
|
|
12
|
+
* Permissions of this copyleft license are conditioned on making available
|
|
13
|
+
* complete source code of licensed works and modifications under the same
|
|
14
|
+
* license or the GNU GPLv3. Copyright and license notices must be preserved.
|
|
15
|
+
* Contributors provide an express grant of patent rights. However, a larger
|
|
16
|
+
* work using the licensed work through interfaces provided by the licensed
|
|
17
|
+
* work may be distributed under different terms and without source code for
|
|
18
|
+
* the larger work.
|
|
19
|
+
*
|
|
20
|
+
* Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
|
|
21
|
+
*
|
|
22
|
+
* Everyone is permitted to copy and distribute verbatim copies of this
|
|
23
|
+
* license document, but changing it is not allowed.
|
|
24
|
+
*/
|
|
25
|
+
(function() {
|
|
26
|
+
"use strict";
|
|
27
|
+
Package("org.qcobjects.components.list",[
|
|
28
|
+
|
|
29
|
+
class ListItemComponent extends Component {
|
|
30
|
+
constructor (){
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.name="list-item";
|
|
33
|
+
this.shadowed= false;
|
|
34
|
+
this.tplsource= "inline";
|
|
35
|
+
this.template="<a href=\"{{value}}\">{{label}}</a>";
|
|
36
|
+
this.cached= false;
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
class ListComponent extends Component {
|
|
43
|
+
constructor () {
|
|
44
|
+
super(...arguments);
|
|
45
|
+
this.name="list";
|
|
46
|
+
this.shadowed= true;
|
|
47
|
+
this.tplsource= "inline";
|
|
48
|
+
this.template= "<p>Loading...</p>";
|
|
49
|
+
this.body.setAttribute("controllerClass","ListController");
|
|
50
|
+
this.body.setAttribute("subcomponentClass","ListItemComponent");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
]);
|
|
56
|
+
|
|
57
|
+
}).call(null);
|