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
package/.eslintrc.json
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
"root": true,
|
|
3
|
+
"env": {
|
|
4
|
+
"browser": true,
|
|
5
|
+
"node": true,
|
|
6
|
+
"es2021": true,
|
|
7
|
+
"es2020": true,
|
|
8
|
+
"es2017": true,
|
|
9
|
+
"es6": true
|
|
10
|
+
},
|
|
11
|
+
"extends": [
|
|
12
|
+
"eslint:recommended"
|
|
13
|
+
],
|
|
14
|
+
"globals": {
|
|
15
|
+
"Atomics": "readonly",
|
|
16
|
+
"SharedArrayBuffer": "readonly"
|
|
17
|
+
},
|
|
18
|
+
"parserOptions": {
|
|
19
|
+
"ecmaVersion": "latest",
|
|
20
|
+
"ecmaFeatures": {}
|
|
21
|
+
},
|
|
22
|
+
"rules": {
|
|
23
|
+
"semi": ["error", "always"],
|
|
24
|
+
"quotes": ["error", "double"],
|
|
25
|
+
"no-unused-vars": 1,
|
|
26
|
+
"no-undef": 0
|
|
27
|
+
}
|
|
23
28
|
}
|
package/QCObjects-SDK.js
CHANGED
|
@@ -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,19 +21,19 @@
|
|
|
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(_top) {
|
|
24
|
+
*/
|
|
25
|
+
(function (_top) {
|
|
26
26
|
"use strict";
|
|
27
27
|
var isBrowser = typeof window !== "undefined" && typeof window.self !== "undefined" && window === window.self;
|
|
28
28
|
var remoteImportsPath = CONFIG.get("remoteImportsPath");
|
|
29
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/js/");
|
|
30
|
+
var external = (!CONFIG.get("useLocalSDK")) ? (true) : (false);
|
|
31
|
+
if (external) {
|
|
32
|
+
CONFIG.set("remoteImportsPath", "https://sdk.qcobjects.dev/js/");
|
|
33
33
|
} else {
|
|
34
|
-
CONFIG.set("relativeImportPath","qcobjects-sdk/js/");
|
|
34
|
+
CONFIG.set("relativeImportPath", "qcobjects-sdk/js/");
|
|
35
35
|
}
|
|
36
|
-
if (typeof _top._DOMCreateElement === "undefined"){
|
|
36
|
+
if (typeof _top._DOMCreateElement === "undefined") {
|
|
37
37
|
_top._DOMCreateElement = function (elementName) {
|
|
38
38
|
var _ret_;
|
|
39
39
|
if (isBrowser) {
|
|
@@ -45,56 +45,56 @@
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
var _imports_;
|
|
48
|
-
if (isBrowser){
|
|
48
|
+
if (isBrowser) {
|
|
49
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.modal.controllers",function (){},external),
|
|
65
|
-
Import("org.qcobjects.modal.effects",function (){},external),
|
|
66
|
-
Import("org.qcobjects.views",function (){},external),
|
|
67
|
-
Import("org.qcobjects.effects",function (){},external),
|
|
68
|
-
Import("org.qcobjects.tools.canvas",function (){},external),
|
|
69
|
-
Import("org.qcobjects.tools.layouts",function (){},external),
|
|
70
|
-
Import("org.qcobjects.cloud.auth.session.usertoken",function (){},external),
|
|
71
|
-
Import("org.qcobjects.cloud.auth.session.data",function (){},external)
|
|
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.modal.controllers", function () {}, external),
|
|
65
|
+
Import("org.qcobjects.modal.effects", function () {}, external),
|
|
66
|
+
Import("org.qcobjects.views", function () {}, external),
|
|
67
|
+
Import("org.qcobjects.effects", function () {}, external),
|
|
68
|
+
Import("org.qcobjects.tools.canvas", function () {}, external),
|
|
69
|
+
Import("org.qcobjects.tools.layouts", function () {}, external),
|
|
70
|
+
Import("org.qcobjects.cloud.auth.session.usertoken", function () {}, external),
|
|
71
|
+
Import("org.qcobjects.cloud.auth.session.data", function () {}, external)
|
|
72
72
|
];
|
|
73
73
|
} else {
|
|
74
74
|
// non-browsers environment
|
|
75
75
|
var _relative_path_ = "qcobjects-sdk/js/";
|
|
76
76
|
_imports_ = [
|
|
77
|
-
Import(_relative_path_+"org.qcobjects.models",function (){},external),
|
|
78
|
-
Import(_relative_path_+"org.qcobjects.components",function (){},external),
|
|
79
|
-
Import(_relative_path_+"org.qcobjects.controllers",function (){},external),
|
|
80
|
-
Import(_relative_path_+"org.qcobjects.views",function (){},external),
|
|
81
|
-
Import(_relative_path_+"org.qcobjects.effects",function (){},external),
|
|
82
|
-
Import(_relative_path_+"org.qcobjects.modal.effects",function (){},external),
|
|
83
|
-
Import(_relative_path_+"org.qcobjects.tools.canvas",function (){},external),
|
|
84
|
-
Import(_relative_path_+"org.qcobjects.tools.layouts",function (){},external),
|
|
85
|
-
Import(_relative_path_+"org.qcobjects.cloud.auth.session.usertoken",function (){},external),
|
|
86
|
-
Import(_relative_path_+"org.qcobjects.cloud.auth.session.data",function (){},external)
|
|
77
|
+
Import(_relative_path_ + "org.qcobjects.models", function () {}, external),
|
|
78
|
+
Import(_relative_path_ + "org.qcobjects.components", function () {}, external),
|
|
79
|
+
Import(_relative_path_ + "org.qcobjects.controllers", function () {}, external),
|
|
80
|
+
Import(_relative_path_ + "org.qcobjects.views", function () {}, external),
|
|
81
|
+
Import(_relative_path_ + "org.qcobjects.effects", function () {}, external),
|
|
82
|
+
Import(_relative_path_ + "org.qcobjects.modal.effects", function () {}, external),
|
|
83
|
+
Import(_relative_path_ + "org.qcobjects.tools.canvas", function () {}, external),
|
|
84
|
+
Import(_relative_path_ + "org.qcobjects.tools.layouts", function () {}, external),
|
|
85
|
+
Import(_relative_path_ + "org.qcobjects.cloud.auth.session.usertoken", function () {}, external),
|
|
86
|
+
Import(_relative_path_ + "org.qcobjects.cloud.auth.session.data", function () {}, external)
|
|
87
87
|
];
|
|
88
88
|
}
|
|
89
|
-
_top._sdk_ = Promise.all(_imports_).then(function (){
|
|
90
|
-
CONFIG.set("useSDK",true);
|
|
91
|
-
CONFIG.set("remoteImportsPath",remoteImportsPath);
|
|
92
|
-
CONFIG.set("relativeImportPath",relativeImportPath);
|
|
89
|
+
_top._sdk_ = Promise.all(_imports_).then(function () {
|
|
90
|
+
CONFIG.set("useSDK", true);
|
|
91
|
+
CONFIG.set("remoteImportsPath", remoteImportsPath);
|
|
92
|
+
CONFIG.set("relativeImportPath", relativeImportPath);
|
|
93
93
|
_top.__start__();
|
|
94
94
|
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
|
|
98
|
-
}).call(null,(typeof module === "object" && typeof module.exports === "object")?(module.exports = global):((typeof global === "object")?(global):(
|
|
99
|
-
(typeof window === "object")?(window):({})
|
|
98
|
+
}).call(null, (typeof module === "object" && typeof module.exports === "object") ? (module.exports = global) : ((typeof global === "object") ? (global) : (
|
|
99
|
+
(typeof window === "object") ? (window) : ({})
|
|
100
100
|
)));
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.4.
|
|
1
|
+
2.4.8
|
|
@@ -3,47 +3,60 @@
|
|
|
3
3
|
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="utf-8" />
|
|
6
|
-
<meta name="viewport" content="
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
|
|
7
|
+
<!-- This is a wide open CSP declaration. To lock this down for production, see below. -->
|
|
8
|
+
<meta http-equiv="Content-Security-Policy"
|
|
9
|
+
content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap: https://ssl.gstatic.com; img-src * 'self' data:; child-src *; style-src * 'self' 'unsafe-inline' 'unsafe-eval'; script-src * 'self' 'unsafe-inline' 'unsafe-eval'; connect-src * 'self' 'unsafe-inline' 'unsafe-eval';media-src *">
|
|
10
10
|
<title>QCObjects Demo</title>
|
|
11
|
-
<script type="text/javascript"
|
|
11
|
+
<script type="text/javascript"
|
|
12
|
+
src="https://cdnjs.cloudflare.com/ajax/libs/qcobjects/2.4.20/QCObjects.min.js"></script>
|
|
12
13
|
</head>
|
|
13
14
|
|
|
14
15
|
<body>
|
|
15
16
|
|
|
16
17
|
|
|
17
|
-
<
|
|
18
|
+
<my-grid cols=4 componentClass="org.qcobjects.components.grid.GridComponent" serviceClass="MyTestService">
|
|
19
|
+
</my-grid>
|
|
18
20
|
|
|
19
21
|
<script>
|
|
20
|
-
logger.debugEnabled= true;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
logger.debugEnabled = true;
|
|
23
|
+
|
|
24
|
+
class MyTestService extends Service {
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Creates the instance for MyTestService
|
|
28
|
+
*/
|
|
29
|
+
constructor() {
|
|
30
|
+
super();
|
|
31
|
+
this.name = 'myservice';
|
|
32
|
+
this.external = true;
|
|
33
|
+
this.cached = false;
|
|
34
|
+
this.method = 'GET';
|
|
35
|
+
this.headers = { 'Content-Type': 'application/json' };
|
|
36
|
+
this.url = 'https://api.github.com/orgs/QuickCorp/repos';
|
|
37
|
+
this.withCredentials = false;
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
done({ request, service }) {
|
|
34
42
|
logger.debug(request);
|
|
35
|
-
service.template = JSON.stringify({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
service.template = JSON.stringify({
|
|
44
|
+
result: JSON.parse(service.template).reverse().map(function (project) {
|
|
45
|
+
return {
|
|
46
|
+
id: project.id,
|
|
47
|
+
description: project.description,
|
|
48
|
+
title: project.name,
|
|
49
|
+
url: project.html_url,
|
|
50
|
+
image: `https://via.placeholder.com/150/FFFF00/000000?text=${encodeURI(project.name)}`
|
|
51
|
+
};
|
|
52
|
+
})
|
|
53
|
+
});
|
|
44
54
|
}
|
|
45
55
|
|
|
46
|
-
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
RegisterWidgets ("my-grid")
|
|
47
60
|
</script>
|
|
48
61
|
</body>
|
|
49
62
|
|
|
@@ -3,38 +3,46 @@
|
|
|
3
3
|
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="utf-8" />
|
|
6
|
-
<meta name="viewport" content="
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
|
|
7
|
+
<!-- This is a wide open CSP declaration. To lock this down for production, see below. -->
|
|
8
|
+
<meta http-equiv="Content-Security-Policy"
|
|
9
|
+
content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap: https://ssl.gstatic.com; img-src * 'self' data:; child-src *; style-src * 'self' 'unsafe-inline' 'unsafe-eval'; script-src * 'self' 'unsafe-inline' 'unsafe-eval'; connect-src * 'self' 'unsafe-inline' 'unsafe-eval';media-src *">
|
|
10
10
|
<title>QCObjects Demo</title>
|
|
11
|
-
<script type="text/javascript"
|
|
11
|
+
<script type="text/javascript"
|
|
12
|
+
src="https://cdnjs.cloudflare.com/ajax/libs/qcobjects/2.4.20/QCObjects.min.js"></script>
|
|
12
13
|
</head>
|
|
13
14
|
|
|
14
15
|
<body>
|
|
15
16
|
|
|
17
|
+
<my-list componentClass="ListComponent" serviceClass="MyTestService" label-field="name" value-field="html_url">
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
</my-list>
|
|
18
20
|
|
|
19
21
|
<script>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
logger.debugEnabled = true;
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class MyTestService extends Service {
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Creates the instance for MyTestService
|
|
29
|
+
*/
|
|
30
|
+
constructor() {
|
|
31
|
+
|
|
32
|
+
this.name = 'myservice';
|
|
33
|
+
this.external = true;
|
|
34
|
+
this.cached = false;
|
|
35
|
+
this.method = 'GET';
|
|
36
|
+
this.headers = { 'Content-Type': 'application/json' };
|
|
37
|
+
this.url = 'https://api.github.com/orgs/QuickCorp/repos';
|
|
38
|
+
this.withCredentials = false;
|
|
39
|
+
|
|
35
40
|
}
|
|
36
|
-
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
RegisterWidgets("my-list");
|
|
44
|
+
|
|
37
45
|
</script>
|
|
38
46
|
</body>
|
|
39
47
|
|
|
40
|
-
</html>
|
|
48
|
+
</html>
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="utf-8" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
<!-- This is a wide open CSP declaration. To lock this down for production, see below. -->
|
|
8
|
+
<meta http-equiv="Content-Security-Policy"
|
|
9
|
+
content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap: https://ssl.gstatic.com; img-src * 'self' data:; child-src *; style-src * 'self' 'unsafe-inline' 'unsafe-eval'; script-src * 'self' 'unsafe-inline' 'unsafe-eval'; connect-src * 'self' 'unsafe-inline' 'unsafe-eval';media-src *">
|
|
10
10
|
<title>QCObjects Demo</title>
|
|
11
11
|
<script type="text/javascript" src="https://cdn.qcobjects.dev/QCObjects.js"></script>
|
|
12
12
|
</head>
|
|
@@ -14,17 +14,36 @@
|
|
|
14
14
|
<body>
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
<
|
|
17
|
+
<custom-notification template-source="inline" componentClass="CustomNotificationComponent"></custom-notification>
|
|
18
18
|
|
|
19
19
|
<script>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
|
|
21
|
+
class CustomNotificationComponent extends Component {
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Creates the instance for CustomNotificationComponent
|
|
25
|
+
*/
|
|
26
|
+
constructor () {
|
|
27
|
+
this.message= "Page was loaded successfully!";
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* What is inside this function is executed after the component loading is done
|
|
33
|
+
*
|
|
34
|
+
* @param {*} standardResponse it brings all information of the component
|
|
35
|
+
*/
|
|
36
|
+
done(standardResponse) {
|
|
37
|
+
super.done(standardResponse);
|
|
38
|
+
|
|
39
|
+
/* in this case we will call a notification after the component is loaded*/
|
|
40
|
+
NotificationComponent.success(this.message);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
RegisterWidgets ("custom-notification")
|
|
27
46
|
</script>
|
|
28
47
|
</body>
|
|
29
48
|
|
|
30
|
-
</html>
|
|
49
|
+
</html>
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="utf-8" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
<!-- This is a wide open CSP declaration. To lock this down for production, see below. -->
|
|
8
|
+
<meta http-equiv="Content-Security-Policy"
|
|
9
|
+
content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap: https://ssl.gstatic.com; img-src * 'self' data:; child-src *; style-src * 'self' 'unsafe-inline' 'unsafe-eval'; script-src * 'self' 'unsafe-inline' 'unsafe-eval'; connect-src * 'self' 'unsafe-inline' 'unsafe-eval';media-src *">
|
|
10
10
|
<title>QCObjects Demo</title>
|
|
11
11
|
<script type="text/javascript" src="https://cdn.qcobjects.dev/QCObjects.js"></script>
|
|
12
12
|
</head>
|
|
@@ -14,39 +14,55 @@
|
|
|
14
14
|
<body>
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
<
|
|
17
|
+
<my-slider componentClass="org.qcobjects.components.slider.SliderComponent" serviceClass="MyTestService"></my-slider>
|
|
18
18
|
|
|
19
19
|
<script>
|
|
20
|
-
logger.debugEnabled= true;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
logger.debugEnabled = true;
|
|
21
|
+
|
|
22
|
+
class MyTestService extends Service {
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Creates the instance for MyTestService
|
|
26
|
+
*/
|
|
27
|
+
constructor() {
|
|
28
|
+
this.name = 'myservice';
|
|
29
|
+
this.external = true;
|
|
30
|
+
this.cached = false;
|
|
31
|
+
this.method = 'GET';
|
|
32
|
+
this.headers = { 'Content-Type': 'application/json' };
|
|
33
|
+
this.url = 'https://api.github.com/orgs/QuickCorp/repos';
|
|
34
|
+
this.withCredentials = false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* What is inside this function is executed after the component loading is done
|
|
39
|
+
*
|
|
40
|
+
* @param {*} standardResponse it brings all information of the component
|
|
41
|
+
*/
|
|
42
|
+
done({ request, service }) {
|
|
34
43
|
logger.debug(request);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
|
|
45
|
+
/* in this case we will parse response and use only the fields we need */
|
|
46
|
+
service.template = JSON.stringify({
|
|
47
|
+
result: JSON.parse(service.template).reverse().map(function (project) {
|
|
48
|
+
return {
|
|
49
|
+
id: project.id,
|
|
50
|
+
description: project.description,
|
|
51
|
+
title: project.name,
|
|
52
|
+
link: project.html_url,
|
|
53
|
+
image: `https://via.placeholder.com/150/FFFF00/000000?text=${encodeURI(project.name)}`,
|
|
54
|
+
label: "Go to repo",
|
|
55
|
+
category: project.name
|
|
56
|
+
};
|
|
57
|
+
})
|
|
58
|
+
});
|
|
46
59
|
}
|
|
47
60
|
|
|
48
|
-
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
RegisterWidgets("my-slider")
|
|
49
65
|
</script>
|
|
50
66
|
</body>
|
|
51
67
|
|
|
52
|
-
</html>
|
|
68
|
+
</html>
|